123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230 |
- #ifndef _GLOBAL_H_
- #define _GLOBAL_H_
- #include <stdlib.h>
- #include <stdarg.h>
- #include <string.h>
- #include <assert.h>
- #include <time.h>
- #include <sys/timeb.h>
- #include <bfc/platform/types.h>
- #include "win32.h"
- #include "defines.h"
- #include "ifunctions.h"
- #include "parsetcommon.h"
- #include "types.h"
- #include "frame.h"
- #include "nalucommon.h"
- #include "memcache.h"
- #include <mmintrin.h>
- #ifdef H264_IPP
- #include "ippdefs.h"
- #include "ippcore.h"
- #include "ipps.h"
- #include "ippi.h"
- #include "ippvc.h"
- #endif
- #ifdef _M_IX86
- #pragma warning(disable: 4799)
- static inline void memzero_cache32(void *dst, unsigned long i)
- {
-
- __asm {
- pxor mm0, mm0
- mov edi, dst
- loopwrite:
- movq 0[edi], mm0
- movq 8[edi], mm0
- movq 16[edi], mm0
- movq 24[edi], mm0
- lea edi, [edi+32]
- sub i, 32
- jg loopwrite
- }
- }
- static inline void memzero_fast32(void *dst, unsigned long i)
- {
-
- __asm {
- pxor mm0, mm0
- mov edi, dst
- loopwrite:
- movntq 0[edi], mm0
- movntq 8[edi], mm0
- movntq 16[edi], mm0
- movntq 24[edi], mm0
- lea edi, [edi+32]
- sub i, 32
- jg loopwrite
- }
- }
- static inline void memzero64(void *dst)
- {
- __asm {
- pxor mm0, mm0
- mov edi, dst
- movq 0[edi], mm0
- movq 8[edi], mm0
- movq 16[edi], mm0
- movq 24[edi], mm0
- movq 32[edi], mm0
- movq 40[edi], mm0
- movq 48[edi], mm0
- movq 56[edi], mm0
- }
- }
- static inline void memzero128(void *dst)
- {
- __asm {
- pxor mm0, mm0
- mov edi, dst
- movq 0[edi], mm0
- movq 8[edi], mm0
- movq 16[edi], mm0
- movq 24[edi], mm0
- movq 32[edi], mm0
- movq 40[edi], mm0
- movq 48[edi], mm0
- movq 56[edi], mm0
- movq 64[edi], mm0
- movq 72[edi], mm0
- movq 80[edi], mm0
- movq 88[edi], mm0
- movq 96[edi], mm0
- movq 104[edi], mm0
- movq 112[edi], mm0
- movq 120[edi], mm0
- }
- }
- static inline void memzero24(void *dst)
- {
- __asm {
- pxor mm0, mm0
- mov edi, dst
- movq 0[edi], mm0
- movq 8[edi], mm0
- movq 16[edi], mm0
- }
- }
- static inline void memzero48(void *dst)
- {
- __asm {
- pxor mm0, mm0
- mov edi, dst
- movq 0[edi], mm0
- movq 8[edi], mm0
- movq 16[edi], mm0
- movq 24[edi], mm0
- movq 32[edi], mm0
- movq 40[edi], mm0
- }
- }
- static inline void memzero16(void *dst)
- {
- __asm {
- pxor mm0, mm0
- mov edi, dst
- movq 0[edi], mm0
- movq 8[edi], mm0
- }
- }
- static inline void memzero8(void *dst)
- {
- __asm {
- pxor mm0, mm0
- mov edi, dst
- movq 0[edi], mm0
- }
- }
- static inline void memset_fast_end()
- {
- _mm_empty();
- }
- #define TINY_BLOCK_COPY 64
- #define IN_CACHE_COPY 64 * 1024
- #define UNCACHED_COPY 197 * 1024
- #define BLOCK_PREFETCH_COPY infinity
- #define CACHEBLOCK 80h
- static void * memcpy_amd(void *dest, const void *src, size_t n)
- {
- __asm {
- mov ecx, [n]
- mov edi, [dest]
- mov esi, [src]
- mov ebx, ecx
- cld
- cmp ecx, TINY_BLOCK_COPY
- jb $memcpy_ic_3
- cmp ecx, 32*1024
- jbe $memcpy_do_align
- cmp ecx, 64*1024
- jbe $memcpy_align_done
- $memcpy_do_align:
- mov ecx, 8
- sub ecx, edi
- and ecx, 111b
- sub ebx, ecx
- neg ecx
- add ecx, offset $memcpy_align_done
- jmp ecx
- align 4
- movsb
- movsb
- movsb
- movsb
- movsb
- movsb
- movsb
- movsb
- $memcpy_align_done:
- mov ecx, ebx
- shr ecx, 6
- jz $memcpy_ic_2
- cmp ecx, IN_CACHE_COPY/64
- jae $memcpy_uc_test
- align 16
- $memcpy_ic_1:
- prefetchnta [esi + (200*64/34+192)]
- movq mm0, [esi+0]
- movq mm1, [esi+8]
- movq [edi+0], mm0
- movq [edi+8], mm1
- movq mm2, [esi+16]
- movq mm3, [esi+24]
- movq [edi+16], mm2
- movq [edi+24], mm3
- movq mm0, [esi+32]
- movq mm1, [esi+40]
- movq [edi+32], mm0
- movq [edi+40], mm1
- movq mm2, [esi+48]
- movq mm3, [esi+56]
- movq [edi+48], mm2
- movq [edi+56], mm3
- add esi, 64
- add edi, 64
- dec ecx
- jnz $memcpy_ic_1
- $memcpy_ic_2:
- mov ecx, ebx
- $memcpy_ic_3:
- shr ecx, 2
- and ecx, 1111b
- neg ecx
- add ecx, offset $memcpy_last_few
- jmp ecx
- $memcpy_uc_test:
- cmp ecx, UNCACHED_COPY/64
- jae $memcpy_bp_1
- $memcpy_64_test:
- or ecx, ecx
- jz $memcpy_ic_2
- align 16
- $memcpy_uc_1:
- prefetchnta [esi + (200*64/34+192)]
- movq mm0,[esi+0]
- add edi,64
- movq mm1,[esi+8]
- add esi,64
- movq mm2,[esi-48]
- movntq [edi-64], mm0
- movq mm0,[esi-40]
- movntq [edi-56], mm1
- movq mm1,[esi-32]
- movntq [edi-48], mm2
- movq mm2,[esi-24]
- movntq [edi-40], mm0
- movq mm0,[esi-16]
- movntq [edi-32], mm1
- movq mm1,[esi-8]
- movntq [edi-24], mm2
- movntq [edi-16], mm0
- dec ecx
- movntq [edi-8], mm1
- jnz $memcpy_uc_1
- jmp $memcpy_ic_2
- $memcpy_bp_1:
- cmp ecx, CACHEBLOCK
- jl $memcpy_64_test
- mov eax, CACHEBLOCK / 2
- add esi, CACHEBLOCK * 64
- align 16
- $memcpy_bp_2:
- mov edx, [esi-64]
- mov edx, [esi-128]
- sub esi, 128
- dec eax
- jnz $memcpy_bp_2
- mov eax, CACHEBLOCK
- align 16
- $memcpy_bp_3:
- movq mm0, [esi ]
- movq mm1, [esi+ 8]
- movq mm2, [esi+16]
- movq mm3, [esi+24]
- movq mm4, [esi+32]
- movq mm5, [esi+40]
- movq mm6, [esi+48]
- movq mm7, [esi+56]
- add esi, 64
- movntq [edi ], mm0
- movntq [edi+ 8], mm1
- movntq [edi+16], mm2
- movntq [edi+24], mm3
- movntq [edi+32], mm4
- movntq [edi+40], mm5
- movntq [edi+48], mm6
- movntq [edi+56], mm7
- add edi, 64
- dec eax
- jnz $memcpy_bp_3
- sub ecx, CACHEBLOCK
- jmp $memcpy_bp_1
- align 4
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- movsd
- $memcpy_last_few:
- mov ecx, ebx
- and ecx, 11b
- jz $memcpy_final
- rep movsb
- $memcpy_final:
- sfence
- mov eax, [dest]
- }
- }
- #elif defined(_M_X64)
- static inline void memzero24(void *dst)
- {
- int32_t j;
- int32_t *d = (int32_t *)dst;
- for (j=0;j<24;j+=4)
- {
- d[j] = 0;
- }
- }
- static inline void memset_fast_end() {}
- #else
- static inline void memzero_fast16(void *dst, unsigned long i)
- {
- int32_t j;
- int32_t *d = (int32_t *)dst;
- for (j=0;j<i;j+=4)
- {
- d[j] = 0;
- }
- }
- static inline void memzero24(void *dst)
- {
- int32_t j;
- int32_t *d = (int32_t *)dst;
- for (j=0;j<24;j+=4)
- {
- d[j] = 0;
- }
- }
- static inline void memset_fast_end() {}
- #endif
- #define UNDEFINED_REFERENCE ((int)0x80000000)
- typedef int32_t h264_ref_t;
- #define ET_SIZE 300
- extern char errortext[ET_SIZE];
- extern int sse2_flag, mmx_flag, sse_flag, sse3_flag, sse4_1_flag;
- typedef enum
- {
- LumaComp = 0,
- CrComp = 1,
- CbComp = 2
- } Color_Component;
- typedef struct pix_pos
- {
- int available;
- int mb_addr;
- short x;
- short y;
- short pos_x;
- short pos_y;
- } PixelPos;
- typedef struct
- {
- unsigned int Drange;
- unsigned int Dvalue;
- int DbitsLeft;
- byte *Dcodestrm;
- int *Dcodestrm_len;
- } DecodingEnvironment;
- typedef DecodingEnvironment *DecodingEnvironmentPtr;
- typedef short MotionVector[2];
- typedef struct pic_motion
- {
- h264_ref_t ref_pic_id;
- h264_ref_t ref_id;
- MotionVector mv;
- char ref_idx;
- } PicMotion;
- typedef struct motion_params
- {
- PicMotion **motion[2];
- byte ** moving_block;
- } MotionParams;
- typedef struct
- {
- uint16_t state;
- unsigned char MPS;
- unsigned char dummy;
- } BiContextType;
- typedef BiContextType *BiContextTypePtr;
- #define NUM_MB_TYPE_CTX 11
- #define NUM_B8_TYPE_CTX 9
- #define NUM_MV_RES_CTX 10
- #define NUM_REF_NO_CTX 6
- #define NUM_DELTA_QP_CTX 4
- #define NUM_MB_AFF_CTX 4
- #define NUM_TRANSFORM_SIZE_CTX 3
- struct storable_picture;
- struct datapartition;
- struct syntaxelement;
- typedef struct
- {
- BiContextType mb_type_contexts [3][NUM_MB_TYPE_CTX];
- BiContextType b8_type_contexts [2][NUM_B8_TYPE_CTX];
- BiContextType mv_res_contexts [2][NUM_MV_RES_CTX];
- BiContextType ref_no_contexts [2][NUM_REF_NO_CTX];
- BiContextType delta_qp_contexts[NUM_DELTA_QP_CTX];
- BiContextType mb_aff_contexts [NUM_MB_AFF_CTX];
- } MotionInfoContexts;
- #define NUM_IPR_CTX 2
- #define NUM_CIPR_CTX 4
- #define NUM_CBP_CTX 4
- #define NUM_BCBP_CTX 4
- #define NUM_MAP_CTX 15
- #define NUM_LAST_CTX 15
- #define NUM_ONE_CTX 5
- #define NUM_ABS_CTX 5
- typedef struct
- {
- BiContextType transform_size_contexts [NUM_TRANSFORM_SIZE_CTX];
- BiContextType ipr_contexts [NUM_IPR_CTX];
- BiContextType cipr_contexts[NUM_CIPR_CTX];
- BiContextType cbp_contexts [3][NUM_CBP_CTX];
- BiContextType bcbp_contexts[NUM_BLOCK_TYPES][NUM_BCBP_CTX];
- BiContextType map_contexts [2][NUM_BLOCK_TYPES][NUM_MAP_CTX+1];
- BiContextType last_contexts[2][NUM_BLOCK_TYPES][NUM_LAST_CTX+1];
- BiContextType one_contexts [NUM_BLOCK_TYPES][NUM_ONE_CTX];
- BiContextType abs_contexts [NUM_BLOCK_TYPES][NUM_ABS_CTX];
- } TextureInfoContexts;
- typedef struct DecRefPicMarking_s
- {
- int memory_management_control_operation;
- int difference_of_pic_nums_minus1;
- int long_term_pic_num;
- int long_term_frame_idx;
- int max_long_term_frame_idx_plus1;
- struct DecRefPicMarking_s *Next;
- } DecRefPicMarking_t;
- typedef struct pic_motion_params2
- {
- h264_ref_t ref_pic_id;
- h264_ref_t ref_id;
- short mv[2];
- char ref_idx;
- byte mb_field;
- byte field_frame;
- } PicMotionParams2;
- typedef struct macroblock
- {
- struct slice *p_Slice;
- struct img_par *p_Vid;
- struct inp_par *p_Inp;
- int mbAddrX;
- int mb_x;
- int mb_y;
- int block_x;
- int block_y;
- int block_y_aff;
- int pix_x;
- int pix_y;
- int pix_c_x;
- int pix_c_y;
- int subblock_x;
- int subblock_y;
- int qp;
- int qpc[2];
- int qp_scaled[MAX_PLANE];
- Boolean is_lossless;
- Boolean is_intra_block;
- Boolean is_v_block;
- short slice_nr;
- short delta_quant;
- struct macroblock *mb_up;
- struct macroblock *mb_left;
-
- int mb_type;
- short mvd[2][BLOCK_MULTIPLE][BLOCK_MULTIPLE][2];
- int cbp;
- int64 cbp_blk [3];
- int64 cbp_bits [3];
- int64 cbp_bits_8x8[3];
- int i16mode;
- char b8mode[4];
- char b8pdir[4];
- char ei_flag;
- char dpl_flag;
- char ipmode_DPCM;
- short DFDisableIdc;
- short DFAlphaC0Offset;
- short DFBetaOffset;
- char c_ipred_mode;
- Boolean mb_field;
- int skip_flag;
- int mb_addr_left, mb_addr_up, mb_addr_upper_right, mb_addr_upper_left;
- Boolean mb_avail_left, mb_avail_up, mb_avail_upper_right, mb_avail_upper_left;
- Boolean luma_transform_size_8x8_flag;
- Boolean NoMbPartLessThan8x8Flag;
- void (*itrans_8x8)(struct macroblock *currMB, ColorPlane pl, int ioff, int joff);
- void (*GetMVPredictor) (struct macroblock *currMB, PixelPos *block,
- short pmv[2], short ref_frame, struct pic_motion **motion, int mb_x, int mb_y, int blockshape_x, int blockshape_y);
- int (*read_and_store_CBP_block_bit) (struct macroblock *currMB, DecodingEnvironmentPtr dep_dp, int type);
- char (*readRefPictureIdx) (struct syntaxelement *currSE, struct datapartition *dP, int list);
- } Macroblock;
- typedef struct syntaxelement
- {
- int value1;
- int value2;
- int len;
-
- #if TRACE
- #define TRACESTRING_SIZE 100
- char tracestring[TRACESTRING_SIZE];
- #endif
-
- void (*mapping)(int len, int info, int *value1, int *value2);
- } SyntaxElement;
- typedef struct
- {
-
- int read_len;
- int code_len;
-
- int frame_bitoffset;
- int bitstream_length;
- byte *streamBuffer;
- } Bitstream;
- typedef int h264_int_block_row_t[BLOCK_SIZE];
- typedef h264_int_block_row_t h264_int_block_t[BLOCK_SIZE];
- typedef int16_t h264_short_block_row_t[BLOCK_SIZE];
- typedef h264_short_block_row_t h264_short_block_t[BLOCK_SIZE];
- typedef int h264_int_8x8block_row_t[BLOCK_SIZE_8x8];
- typedef h264_int_8x8block_row_t h264_int_8x8block_t[BLOCK_SIZE_8x8];
- typedef int16_t h264_short_8x8block_row_t[BLOCK_SIZE_8x8];
- typedef h264_short_8x8block_row_t h264_short_8x8block_t[BLOCK_SIZE_8x8];
- typedef imgpel h264_imgpel_8x8block_row_t[BLOCK_SIZE_8x8];
- typedef h264_imgpel_8x8block_row_t h264_imgpel_8x8block_t[BLOCK_SIZE_8x8];
- typedef int h264_int_macroblock_row_t[MB_BLOCK_SIZE];
- typedef h264_int_macroblock_row_t h264_int_macroblock_t[MB_BLOCK_SIZE];
- typedef int16_t h264_short_macroblock_row_t[MB_BLOCK_SIZE];
- typedef h264_short_macroblock_row_t h264_short_macroblock_t[MB_BLOCK_SIZE];
- typedef imgpel h264_imgpel_macroblock_row_t[MB_BLOCK_SIZE];
- typedef h264_imgpel_macroblock_row_t h264_imgpel_macroblock_t[MB_BLOCK_SIZE];
- typedef int h264_pic_position[2];
- typedef byte h264_4x4_byte[BLOCK_SIZE][BLOCK_SIZE];
- typedef h264_4x4_byte h264_nz_coefficient[3];
- typedef struct datapartition
- {
- Bitstream *bitstream;
- DecodingEnvironment de_cabac;
- } DataPartition;
- typedef struct slice
- {
- struct img_par *p_Vid;
- struct inp_par *p_Inp;
- pic_parameter_set_rbsp_t *active_pps;
- seq_parameter_set_rbsp_t *active_sps;
- struct colocated_params *p_colocated;
- struct colocated_params *Co_located_JV[MAX_PLANE];
- int mb_aff_frame_flag;
- int direct_spatial_mv_pred_flag;
- int num_ref_idx_l0_active;
- int num_ref_idx_l1_active;
- int qp;
- int slice_qp_delta;
- int qs;
- int slice_qs_delta;
- int slice_type;
- int model_number;
- PictureStructure structure;
- int start_mb_nr;
- int max_part_nr;
- int dp_mode;
- int last_dquant;
-
- DataPartition *partArr;
- MotionInfoContexts *mot_ctx;
- TextureInfoContexts *tex_ctx;
- int mvscale[6][MAX_REFERENCE_PICTURES];
- int ref_pic_list_reordering_flag_l0;
- int *reordering_of_pic_nums_idc_l0;
- int *abs_diff_pic_num_minus1_l0;
- int *long_term_pic_idx_l0;
- int ref_pic_list_reordering_flag_l1;
- int *reordering_of_pic_nums_idc_l1;
- int *abs_diff_pic_num_minus1_l1;
- int *long_term_pic_idx_l1;
-
- short DFDisableIdc;
- short DFAlphaC0Offset;
- short DFBetaOffset;
- int pic_parameter_set_id;
- int dpB_NotPresent;
- int dpC_NotPresent;
- __declspec(align(32)) h264_imgpel_macroblock_t mb_pred[MAX_PLANE];
- __declspec(align(32)) h264_imgpel_macroblock_t mb_rec[MAX_PLANE];
- __declspec(align(32)) union
- {
- __declspec(align(32)) h264_short_8x8block_t mb_rres8[MAX_PLANE][4];
- __declspec(align(32)) h264_short_macroblock_t cof[MAX_PLANE];
- __declspec(align(32)) h264_short_block_t cof4[MAX_PLANE][16];
- __declspec(align(32)) h264_short_macroblock_t ipcm[MAX_PLANE];
- };
- int cofu[16];
-
- int InvLevelScale4x4_Intra[3][6][4][4];
- int InvLevelScale4x4_Inter[3][6][4][4];
- int InvLevelScale8x8_Intra[3][6][64];
- int InvLevelScale8x8_Inter[3][6][64];
- int *qmatrix[12];
-
-
- int16_t coeff[64];
- int coeff_ctr;
- int pos;
-
- unsigned int apply_weights;
- unsigned int luma_log2_weight_denom;
- unsigned int chroma_log2_weight_denom;
- int wp_weight[2][MAX_REFERENCE_PICTURES][3];
- int wp_offset[6][MAX_REFERENCE_PICTURES][3];
- int wbp_weight[6][MAX_REFERENCE_PICTURES][MAX_REFERENCE_PICTURES][3];
- int wp_round_luma;
- int wp_round_chroma;
- void (*read_CBP_and_coeffs_from_NAL) (Macroblock *currMB);
- int (*decode_one_component ) (Macroblock *currMB, ColorPlane curr_plane, struct video_image *image, struct storable_picture *dec_picture);
- int (*readSlice ) (struct img_par *, struct inp_par *);
- int (*nal_startcode_follows ) (struct slice*, int );
- void (*read_motion_info_from_NAL) (Macroblock *currMB);
- void (*read_one_macroblock ) (Macroblock *currMB);
- void (*interpret_mb_mode ) (Macroblock *currMB);
- void (*compute_colocated ) (struct slice *currSlice, struct colocated_params *p, struct storable_picture **listX[6]);
- void (*linfo_cbp_intra) (int len,int info,int *cbp, int *dummy);
- void (*linfo_cbp_inter) (int len,int info,int *cbp, int *dummy);
- } Slice;
- typedef struct img_par
- {
- struct inp_par *p_Inp;
- pic_parameter_set_rbsp_t *active_pps;
- seq_parameter_set_rbsp_t *active_sps;
- seq_parameter_set_rbsp_t SeqParSet[MAXSPS];
- pic_parameter_set_rbsp_t PicParSet[MAXPPS];
- struct sei_params *p_SEI;
- struct old_slice_par *old_slice;
- int number;
- unsigned int current_mb_nr;
- unsigned int num_dec_mb;
- short current_slice_nr;
- int *intra_block;
-
- int qp;
- int sp_switch;
- int type;
- int width;
- int height;
- int width_cr;
- int height_cr;
- int mb_x;
- int mb_y;
- int block_x;
- int block_y;
- int pix_c_x;
- int pix_c_y;
- int allrefzero;
- byte **ipredmode;
- h264_nz_coefficient *nz_coeff;
- int **siblock;
- int cod_counter;
- int structure;
- Slice *currentSlice;
- Macroblock *mb_data;
- Macroblock *mb_data_JV[MAX_PLANE];
- int colour_plane_id;
- int ChromaArrayType;
-
- int mb_aff_frame_flag;
-
- int DeblockCall;
- byte mixedModeEdgeFlag;
-
-
-
- struct concealment_node *concealment_head;
- struct concealment_node *concealment_end;
- DecRefPicMarking_t *dec_ref_pic_marking_buffer;
- int num_ref_idx_l0_active;
- int num_ref_idx_l1_active;
- int slice_group_change_cycle;
- int redundant_pic_cnt;
- unsigned int pre_frame_num;
- int non_conforming_stream;
-
-
- int toppoc;
- int bottompoc;
- int framepoc;
- unsigned int frame_num;
- unsigned int field_pic_flag;
- byte bottom_field_flag;
-
-
- unsigned int pic_order_cnt_lsb;
- int delta_pic_order_cnt_bottom;
-
- int delta_pic_order_cnt[3];
-
-
- signed int PrevPicOrderCntMsb;
- unsigned int PrevPicOrderCntLsb;
- signed int PicOrderCntMsb;
-
- unsigned int AbsFrameNum;
- signed int ExpectedPicOrderCnt, PicOrderCntCycleCnt, FrameNumInPicOrderCntCycle;
- unsigned int PreviousFrameNum, FrameNumOffset;
- int ExpectedDeltaPerPicOrderCntCycle;
- int PreviousPOC, ThisPOC;
- int PreviousFrameNumOffset;
-
- int idr_flag;
- int nal_reference_idc;
- int idr_pic_id;
- int MaxFrameNum;
- unsigned int PicWidthInMbs;
- unsigned int PicHeightInMapUnits;
- unsigned int FrameHeightInMbs;
- unsigned int PicHeightInMbs;
- unsigned int PicSizeInMbs;
- unsigned int FrameSizeInMbs;
- unsigned int oldFrameSizeInMbs;
- int no_output_of_prior_pics_flag;
- int long_term_reference_flag;
- int adaptive_ref_pic_buffering_flag;
- int last_has_mmco_5;
- int last_pic_bottom_field;
-
- short bitdepth_luma;
- short bitdepth_chroma;
- int bitdepth_scale[2];
- int bitdepth_luma_qp_scale;
- int bitdepth_chroma_qp_scale;
- unsigned int dc_pred_value_comp[MAX_PLANE];
- int max_pel_value_comp[MAX_PLANE];
- int Transform8x8Mode;
- int profile_idc;
- int yuv_format;
- int lossless_qpprime_flag;
- int num_blk8x8_uv;
- int num_uv_blocks;
- int num_cdc_coeff;
- int mb_cr_size_x;
- int mb_cr_size_y;
- int mb_cr_size_x_blk;
- int mb_cr_size_y_blk;
- int mb_size[3][2];
- int mb_size_blk[3][2];
- int mb_size_shift[3][2];
- int subpel_x;
- int subpel_y;
- int shiftpel_x;
- int shiftpel_y;
- int max_vmv_r;
- int max_mb_vmv_r;
-
- int last_ref_pic_poc;
- int ref_poc_gap;
- int poc_gap;
- int earlier_missing_poc;
- unsigned int frame_to_conceal;
- int IDR_concealment_flag;
- int conceal_slice_type;
-
- int recovery_point;
- int recovery_point_found;
- int recovery_frame_cnt;
- int recovery_frame_num;
- int recovery_poc;
- int separate_colour_plane_flag;
- int frame_number;
- int init_bl_done;
-
- unsigned int previous_frame_num;
- int ref_flag[17];
-
- int Is_primary_correct;
- int Is_redundant_correct;
- int redundant_slice_ref_idx;
-
- int LastAccessUnitExists;
- int NALUCount;
- Boolean global_init_done;
- int *qp_per_matrix;
- int *qp_rem_matrix;
- struct frame_store *last_out_fs;
- int pocs_in_dpb[100];
- struct storable_picture *dec_picture;
- struct storable_picture *dec_picture_JV[MAX_PLANE];
- struct storable_picture *no_reference_picture;
- struct storable_picture **listX[6];
-
- struct object_buffer *erc_object_list;
- struct ercVariables_s *erc_errorVar;
- int erc_mvperMB;
- struct img_par *erc_img;
- int ec_flag[SE_MAX_ELEMENTS];
- struct memory_input_struct *mem_input;
- struct frame_store *out_buffer;
- struct storable_picture *pending_output;
- int pending_output_state;
- int recovery_flag;
-
- struct decoded_picture_buffer *p_Dpb;
- char listXsize[6];
-
- char cslice_type[9];
-
- int *MbToSliceGroupMap;
- int *MapUnitToSliceGroupMap;
- int NumberOfSliceGroups;
- #if (ENABLE_OUTPUT_TONEMAPPING)
- struct tone_mapping_struct_s *seiToneMapping;
- #endif
-
-
- struct storable_picture **out_pictures;
- size_t size_out_pictures;
- size_t num_out_pictures;
- ImageCache image_cache[2];
- MotionCache motion_cache;
- h264_pic_position *PicPos;
- NALU_t *nalu;
- void (*getNeighbour) (const Macroblock *currMB, int xN, int yN, const int mb_size[2], PixelPos *pix);
- void (*getNeighbourPX_NoPos)(const Macroblock *currMB, int xN, int yN, const int mb_size[2], PixelPos *pix);
- void (*getNeighbourXP_NoPos)(const Macroblock *currMB, int xN, int yN, const int mb_size[2], PixelPos *pix);
- void (*getNeighbourLuma) (const Macroblock *currMB, int xN, int yN, PixelPos *pix);
- void (*getNeighbourPXLuma) (const Macroblock *currMB, int xN, int yN, PixelPos *pix);
- void (*getNeighbourXPLuma) (const Macroblock *currMB, int xN, int yN, PixelPos *pix);
- void (*getNeighbourLeftLuma)(const Macroblock *currMB, PixelPos *pix);
- void (*getNeighbourNXLuma) (const Macroblock *currMB, int yN, PixelPos *pix);
- void (*getNeighbourLeft) (const Macroblock *currMB, const int mb_size[2], PixelPos *pix);
- void (*getNeighbourUp) (const Macroblock *currMB, const int mb_size[2], PixelPos *pix);
- void (*getNeighbourNX) (const Macroblock *currMB, int yN, const int mb_size[2], PixelPos *pix);
- void (*getNeighbourNP) (const Macroblock *currMB, int yN, const int mb_size[2], PixelPos *pix);
- void (*getNeighbourNPChromaNB)(const Macroblock *currMB, int yN, const int mb_size[2], PixelPos *pix);
- void (*getNeighbour0X) (const Macroblock *currMB, int yN, const int mb_size[2], PixelPos *pix);
- void (*getNeighbour0XLuma) (const Macroblock *currMB, int yN, PixelPos *pix);
- void (*getNeighbourX0) (const Macroblock *currMB, int xN, const int mb_size[2], PixelPos *pix);
- void (*getNeighbourUpLuma) (const Macroblock *currMB, PixelPos *pix);
- void (*getNeighbourNPLumaNB)(const Macroblock *currMB, int yN, PixelPos *pix);
- void (*getNeighbourPXLumaNB) (const Macroblock *currMB, int xN, int yN, PixelPos *pix);
- void (*getNeighbourPXLumaNB_NoPos)(const Macroblock *currMB, int yN, PixelPos *pix);
- void (*getNeighbourPPLumaNB) (const Macroblock *currMB, int xN, int yN, PixelPos *pix);
- void (*getNeighbourXPLumaNB) (const Macroblock *currMB, int xN, int yN, PixelPos *pix);
- void (*getNeighbourXPLumaNB_NoPos)(const Macroblock *currMB, int xN, int yN, PixelPos *pix);
- void (*get_mb_block_pos) (const h264_pic_position *PicPos, int mb_addr, short *x, short *y);
- void (*GetStrength) (byte Strength[16], Macroblock *MbQ, int dir,int edge, int mvlimit, struct storable_picture *p);
- void (*EdgeLoopLuma) (ColorPlane pl, struct video_image *image, const byte Strength[16], Macroblock *MbQ, int dir, int edge, struct storable_picture *p);
- void (*EdgeLoopChroma) (struct video_image *image, byte Strength[16], Macroblock *MbQ, int dir, int edge, int uv, struct storable_picture *p);
- } VideoParameters;
- typedef struct inp_par
- {
- int intra_profile_deblocking;
-
- FrameFormat output;
- #ifdef _LEAKYBUCKET_
- unsigned long R_decoder;
- unsigned long B_decoder;
- unsigned long F_decoder;
- char LeakyBucketParamFile[FILE_NAME_SIZE];
- #endif
-
- int ref_poc_gap;
- int poc_gap;
- } InputParameters;
- typedef struct old_slice_par
- {
- unsigned field_pic_flag;
- unsigned frame_num;
- int nal_ref_idc;
- unsigned pic_oder_cnt_lsb;
- int delta_pic_oder_cnt_bottom;
- int delta_pic_order_cnt[2];
- byte bottom_field_flag;
- byte idr_flag;
- int idr_pic_id;
- int pps_id;
- } OldSliceParams;
- typedef struct decoder_params
- {
- InputParameters *p_Inp;
- VideoParameters *p_Vid;
-
- } DecoderParams;
- #ifdef TRACE
- extern FILE *p_trace;
- extern int bitcounter;
- #endif
- extern void error(char *text, int code);
- extern int init_global_buffers(VideoParameters *p_Vid);
- extern void free_global_buffers(VideoParameters *p_Vid);
- extern int RBSPtoSODB(byte *streamBuffer, int last_byte_pos);
- extern int EBSPtoRBSP(byte *streamBuffer, int end_bytepos);
- void FreePartition (DataPartition *dp, int n);
- DataPartition *AllocPartition(int n);
- void tracebits(const char *trace_str, int len, int info,int value1);
- void tracebits2(const char *trace_str, int len, int info);
- unsigned CeilLog2 ( unsigned uiVal);
- unsigned CeilLog2_sf( unsigned uiVal);
- extern void change_plane_JV( VideoParameters *p_Vid, int nplane );
- extern void make_frame_picture_JV(VideoParameters *p_Vid);
- #endif
|