#ifdef _MSC_VER
#define snprintf _snprintf
+#define X264_VERSION "" // no configure script for msvc
#endif
#include "x264.h"
void *x264_realloc( void *p, int i_size );
void x264_free( void * );
+/* x264_slurp_file: malloc space for the whole file and read it */
+char *x264_slurp_file( const char *filename );
+
/* mdate: return the current date in microsecond */
int64_t x264_mdate( void );
SLICE_TYPE_SI = 4
};
+static const char slice_type_to_char[] = { 'P', 'B', 'I', 'S', 'S' };
+
typedef struct
{
x264_sps_t *sps;
int i_type;
int i_first_mb;
+ int i_last_mb;
int i_pps_id;
*/
#define X264_BFRAME_MAX 16
+#define X264_SLICE_MAX 4
+#define X264_NAL_MAX (4 + X264_SLICE_MAX)
typedef struct x264_ratecontrol_t x264_ratecontrol_t;
typedef struct x264_vlc_table_t x264_vlc_table_t;
/* encoder parameters */
x264_param_t param;
+ x264_t *thread[X264_SLICE_MAX];
+
/* bitstream output */
struct
{
int i_nal;
- x264_nal_t nal[4]; /* for now 4 is enough */
+ x264_nal_t nal[X264_NAL_MAX];
int i_bitstream; /* size of p_bitstream */
uint8_t *p_bitstream; /* will hold data for all nal */
bs_t bs;
/* frame number/poc */
int i_frame;
- int i_poc;
int i_frame_offset; /* decoding only */
int i_frame_num; /* decoding only */
int i_poc_msb; /* decoding only */
int i_poc_lsb; /* decoding only */
+ int i_poc; /* decoding only */
+
+ int i_thread_num; /* threads only */
+ int i_nal_type; /* threads only */
+ int i_nal_ref_idc; /* threads only */
/* We use only one SPS and one PPS */
- x264_sps_t sps_array[32];
+ x264_sps_t sps_array[1];
x264_sps_t *sps;
- x264_pps_t pps_array[256];
+ x264_pps_t pps_array[1];
x264_pps_t *pps;
int i_idr_pic_id;
+ int dequant4_mf[4][6][4][4];
+ int dequant8_mf[2][6][8][8];
+ int quant4_mf[4][6][4][4];
+ int quant8_mf[2][6][8][8];
+
/* Slice header */
x264_slice_header_t sh;
struct
{
- /* Frames to be encoded */
- x264_frame_t *current[X264_BFRAME_MAX+1];
- /* Temporary buffer (eg B frames pending until we reach the I/P) */
- x264_frame_t *next[X264_BFRAME_MAX+1];
+ /* Frames to be encoded (whose types have been decided) */
+ x264_frame_t *current[X264_BFRAME_MAX+3];
+ /* Temporary buffer (frames types not yet decided) */
+ x264_frame_t *next[X264_BFRAME_MAX+3];
/* Unused frames */
- x264_frame_t *unused[X264_BFRAME_MAX+1];
+ x264_frame_t *unused[X264_BFRAME_MAX+3];
/* For adaptive B decision */
x264_frame_t *last_nonb;
- /* frames used for reference +1 for decoding +1 sentinel */
- x264_frame_t *reference[16+2+1+1];
+ /* frames used for reference +1 for decoding + sentinels */
+ x264_frame_t *reference[16+2+1+2];
int i_last_idr; /* Frame number of the last IDR */
/* references lists */
int i_ref0;
- x264_frame_t *fref0[16]; /* ref list 0 */
+ x264_frame_t *fref0[16+3]; /* ref list 0 */
int i_ref1;
- x264_frame_t *fref1[16]; /* ref list 1 */
+ x264_frame_t *fref1[16+3]; /* ref list 1 */
int b_ref_reorder[2];
{
DECLARE_ALIGNED( int, luma16x16_dc[16], 16 );
DECLARE_ALIGNED( int, chroma_dc[2][4], 16 );
+ // FIXME merge with union
+ DECLARE_ALIGNED( int, luma8x8[4][64], 16 );
union
{
DECLARE_ALIGNED( int, residual_ac[15], 16 );
int i_b4_xy;
/* Search parameters */
+ int i_me_method;
int i_subpel_refine;
+ int b_chroma_me;
/* Allowed qpel MV range to stay within the picture + emulated edge pixels */
int mv_min[2];
int mv_max[2];
int mv_min_fpel[2];
int mv_max_fpel[2];
+ /* neighboring MBs */
unsigned int i_neighbour;
+ unsigned int i_neighbour8[4]; /* neighbours of each 8x8 or 4x4 block that are available */
+ unsigned int i_neighbour4[16]; /* at the time the block is coded */
+ int i_mb_type_top;
+ int i_mb_type_left;
+ int i_mb_type_topleft;
+ int i_mb_type_topright;
/* mb table */
int8_t *type; /* mb type */
int8_t *ref[2]; /* mb ref. set to -1 if non used (intra or Lx only) */
int16_t (*mvr[2][16])[2]; /* 16x16 mv for each possible ref */
int8_t *skipbp; /* block pattern for SKIP or DIRECT (sub)mbs. B-frames + cabac only */
+ int8_t *mb_transform_size; /* transform_size_8x8_flag of each mb */
/* current value */
int i_type;
int i_partition;
int i_sub_partition[4];
+ int b_transform_8x8;
int i_cbp_luma;
int i_cbp_chroma;
/* cache */
struct
{
- /* real intra4x4_pred_mode if I_4X4, I_PRED_4x4_DC if mb available, -1 if not */
+ /* real intra4x4_pred_mode if I_4X4 or I_8X8, I_PRED_4x4_DC if mb available, -1 if not */
int intra4x4_pred_mode[X264_SCAN8_SIZE];
/* i_non_zero_count if availble else 0x80 */
int16_t direct_mv[2][X264_SCAN8_SIZE][2];
int8_t direct_ref[2][X264_SCAN8_SIZE];
+
+ /* number of neighbors (top and left) that used 8x8 dct */
+ int i_neighbour_transform_size;
+ int b_transform_8x8_allowed;
} cache;
/* */
+ int i_qp; /* current qp */
int i_last_qp; /* last qp */
int i_last_dqp; /* last delta qp */
int b_variable_qp; /* whether qp is allowed to vary per macroblock */
+ int b_lossless;
/* B_direct and weighted prediction */
int dist_scale_factor[16][16];
/* ? */
int i_misc_bits;
/* MB type counts */
- int i_mb_count[18];
+ int i_mb_count[19];
+ int i_mb_count_i;
int i_mb_count_p;
int i_mb_count_skip;
+ int i_mb_count_8x8dct[2];
/* Estimated (SATD) cost as Intra/Predicted frame */
/* XXX: both omit the cost of MBs coded as P_SKIP */
int i_intra_cost;
float f_psnr_mean_u[5];
float f_psnr_mean_v[5];
/* */
- int64_t i_mb_count[5][18];
+ int64_t i_mb_count[5][19];
+ int64_t i_mb_count_8x8dct[2];
} stat;
/* CPU functions dependants */
x264_predict_t predict_16x16[4+3];
- x264_predict_t predict_8x8[4+3];
+ x264_predict_t predict_8x8c[4+3];
+ x264_predict8x8_t predict_8x8[9+3];
x264_predict_t predict_4x4[9+3];
x264_pixel_function_t pixf;
x264_vlc_table_t *x264_total_zeros_lookup[15];
x264_vlc_table_t *x264_total_zeros_dc_lookup[3];
x264_vlc_table_t *x264_run_before_lookup[7];
+
+#if VISUALIZE
+ struct visualize_t *visualize;
+#endif
};
#endif