diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index ee43b27772..1f63bbd7b7 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -60,7 +60,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n) { int level, diff, i, j, run; int component; - RLTable *rl = &rl_mpeg1; + RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable= a->scantable.permutated; const uint16_t *quant_matrix= ff_mpeg1_default_intra_matrix; const int qscale= a->qscale; diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 9477ce9f22..a570ae410f 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -78,7 +78,7 @@ static const enum PixelFormat pixfmt_xvmc_mpg2_420[] = { PIX_FMT_XVMC_MPEG2_MC, -1}; -uint8_t static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; +uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; static void init_2d_vlc_rl(RLTable *rl, int use_static) { @@ -122,7 +122,7 @@ static void init_2d_vlc_rl(RLTable *rl, int use_static) } } -void common_init(MpegEncContext *s) +void ff_mpeg12_common_init(MpegEncContext *s) { s->y_dc_scale_table= @@ -157,20 +157,20 @@ static void init_vlcs(void) done = 1; init_vlc(&dc_lum_vlc, DC_VLC_BITS, 12, - vlc_dc_lum_bits, 1, 1, - vlc_dc_lum_code, 2, 2, 1); + ff_mpeg12_vlc_dc_lum_bits, 1, 1, + ff_mpeg12_vlc_dc_lum_code, 2, 2, 1); init_vlc(&dc_chroma_vlc, DC_VLC_BITS, 12, - vlc_dc_chroma_bits, 1, 1, - vlc_dc_chroma_code, 2, 2, 1); + ff_mpeg12_vlc_dc_chroma_bits, 1, 1, + ff_mpeg12_vlc_dc_chroma_code, 2, 2, 1); init_vlc(&mv_vlc, MV_VLC_BITS, 17, - &mbMotionVectorTable[0][1], 2, 1, - &mbMotionVectorTable[0][0], 2, 1, 1); + &ff_mpeg12_mbMotionVectorTable[0][1], 2, 1, + &ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 1); init_vlc(&mbincr_vlc, MBINCR_VLC_BITS, 36, - &mbAddrIncrTable[0][1], 2, 1, - &mbAddrIncrTable[0][0], 2, 1, 1); + &ff_mpeg12_mbAddrIncrTable[0][1], 2, 1, + &ff_mpeg12_mbAddrIncrTable[0][0], 2, 1, 1); init_vlc(&mb_pat_vlc, MB_PAT_VLC_BITS, 64, - &mbPatTable[0][1], 2, 1, - &mbPatTable[0][0], 2, 1, 1); + &ff_mpeg12_mbPatTable[0][1], 2, 1, + &ff_mpeg12_mbPatTable[0][0], 2, 1, 1); init_vlc(&mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7, &table_mb_ptype[0][1], 2, 1, @@ -178,11 +178,11 @@ static void init_vlcs(void) init_vlc(&mb_btype_vlc, MB_BTYPE_VLC_BITS, 11, &table_mb_btype[0][1], 2, 1, &table_mb_btype[0][0], 2, 1, 1); - init_rl(&rl_mpeg1, static_rl_table_store[0]); - init_rl(&rl_mpeg2, static_rl_table_store[1]); + init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); + init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); - init_2d_vlc_rl(&rl_mpeg1, 1); - init_2d_vlc_rl(&rl_mpeg2, 1); + init_2d_vlc_rl(&ff_rl_mpeg1, 1); + init_2d_vlc_rl(&ff_rl_mpeg2, 1); } } @@ -667,7 +667,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, { int level, dc, diff, i, j, run; int component; - RLTable *rl = &rl_mpeg1; + RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable= s->intra_scantable.permutated; const uint16_t *quant_matrix= s->intra_matrix; const int qscale= s->qscale; @@ -739,7 +739,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, int n) { int level, i, j, run; - RLTable *rl = &rl_mpeg1; + RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable= s->intra_scantable.permutated; const uint16_t *quant_matrix= s->inter_matrix; const int qscale= s->qscale; @@ -815,7 +815,7 @@ end: static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *block, int n) { int level, i, j, run; - RLTable *rl = &rl_mpeg1; + RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable= s->intra_scantable.permutated; const int qscale= s->qscale; @@ -889,7 +889,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, int n) { int level, i, j, run; - RLTable *rl = &rl_mpeg1; + RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable= s->intra_scantable.permutated; const uint16_t *quant_matrix; const int qscale= s->qscale; @@ -970,7 +970,7 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, int n) { int level, i, j, run; - RLTable *rl = &rl_mpeg1; + RLTable *rl = &ff_rl_mpeg1; uint8_t * const scantable= s->intra_scantable.permutated; const int qscale= s->qscale; OPEN_READER(re, &s->gb); @@ -1059,9 +1059,9 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, mismatch = block[0] ^ 1; i = 0; if (s->intra_vlc_format) - rl = &rl_mpeg2; + rl = &ff_rl_mpeg2; else - rl = &rl_mpeg1; + rl = &ff_rl_mpeg1; { OPEN_READER(re, &s->gb); @@ -1135,9 +1135,9 @@ static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, s->last_dc[component] = dc; block[0] = dc << (3 - s->intra_dc_precision); if (s->intra_vlc_format) - rl = &rl_mpeg2; + rl = &ff_rl_mpeg2; else - rl = &rl_mpeg1; + rl = &ff_rl_mpeg1; { OPEN_READER(re, &s->gb); @@ -1208,7 +1208,7 @@ static int mpeg_decode_init(AVCodecContext *avctx) s->mpeg_enc_ctx.avctx= avctx; s->mpeg_enc_ctx.flags= avctx->flags; s->mpeg_enc_ctx.flags2= avctx->flags2; - common_init(&s->mpeg_enc_ctx); + ff_mpeg12_common_init(&s->mpeg_enc_ctx); init_vlcs(); s->mpeg_enc_ctx_allocated = 0; @@ -1273,7 +1273,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){ avctx->time_base.num= ff_frame_rate_tab[s->frame_rate_index].den; //mpeg1 aspect avctx->sample_aspect_ratio= av_d2q( - 1.0/mpeg1_aspect[s->aspect_ratio_info], 255); + 1.0/ff_mpeg1_aspect[s->aspect_ratio_info], 255); }else{//mpeg2 //mpeg2 fps @@ -1288,19 +1288,19 @@ static int mpeg_decode_postinit(AVCodecContext *avctx){ if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0) ){ s->avctx->sample_aspect_ratio= av_div_q( - mpeg2_aspect[s->aspect_ratio_info], + ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational){s->width, s->height} ); }else{ s->avctx->sample_aspect_ratio= av_div_q( - mpeg2_aspect[s->aspect_ratio_info], + ff_mpeg2_aspect[s->aspect_ratio_info], (AVRational){s1->pan_scan.width, s1->pan_scan.height} ); } }else{ s->avctx->sample_aspect_ratio= - mpeg2_aspect[s->aspect_ratio_info]; + ff_mpeg2_aspect[s->aspect_ratio_info]; } }//mpeg2 diff --git a/libavcodec/mpeg12data.c b/libavcodec/mpeg12data.c index 7f39586cf3..93d491f3c2 100644 --- a/libavcodec/mpeg12data.c +++ b/libavcodec/mpeg12data.c @@ -49,17 +49,17 @@ const uint16_t ff_mpeg1_default_non_intra_matrix[64] = { 16, 16, 16, 16, 16, 16, 16, 16, }; -const uint16_t vlc_dc_lum_code[12] = { +const uint16_t ff_mpeg12_vlc_dc_lum_code[12] = { 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff, }; -const unsigned char vlc_dc_lum_bits[12] = { +const unsigned char ff_mpeg12_vlc_dc_lum_bits[12] = { 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9, }; -const uint16_t vlc_dc_chroma_code[12] = { +const uint16_t ff_mpeg12_vlc_dc_chroma_code[12] = { 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff, }; -const unsigned char vlc_dc_chroma_bits[12] = { +const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12] = { 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, }; @@ -163,7 +163,7 @@ static const int8_t mpeg1_run[111] = { 25, 26, 27, 28, 29, 30, 31, }; -RLTable rl_mpeg1 = { +RLTable ff_rl_mpeg1 = { 111, 111, mpeg1_vlc, @@ -171,7 +171,7 @@ RLTable rl_mpeg1 = { mpeg1_level, }; -RLTable rl_mpeg2 = { +RLTable ff_rl_mpeg2 = { 111, 111, mpeg2_vlc, @@ -179,7 +179,7 @@ RLTable rl_mpeg2 = { mpeg1_level, }; -const uint8_t mbAddrIncrTable[36][2] = { +const uint8_t ff_mpeg12_mbAddrIncrTable[36][2] = { {0x1, 1}, {0x3, 3}, {0x2, 3}, @@ -218,7 +218,7 @@ const uint8_t mbAddrIncrTable[36][2] = { {0x0, 8}, /* end (and 15 more 0 bits should follow) */ }; -const uint8_t mbPatTable[64][2] = { +const uint8_t ff_mpeg12_mbPatTable[64][2] = { {0x1, 9}, {0xb, 5}, {0x9, 5}, @@ -285,7 +285,7 @@ const uint8_t mbPatTable[64][2] = { {0xc, 6} }; -const uint8_t mbMotionVectorTable[17][2] = { +const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] = { { 0x1, 1 }, { 0x1, 2 }, { 0x1, 3 }, @@ -333,7 +333,7 @@ const uint8_t ff_mpeg1_dc_scale_table[128]={ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; -const float mpeg1_aspect[16]={ +const float ff_mpeg1_aspect[16]={ 0.0000, 1.0000, 0.6735, @@ -354,7 +354,7 @@ const float mpeg1_aspect[16]={ 1.2015, }; -const AVRational mpeg2_aspect[16]={ +const AVRational ff_mpeg2_aspect[16]={ {0,1}, {1,1}, {4,3}, diff --git a/libavcodec/mpeg12data.h b/libavcodec/mpeg12data.h index 8d587540de..9793604725 100644 --- a/libavcodec/mpeg12data.h +++ b/libavcodec/mpeg12data.h @@ -31,20 +31,20 @@ #include #include "mpegvideo.h" -extern const uint16_t vlc_dc_lum_code[12]; -extern const unsigned char vlc_dc_lum_bits[12]; -extern const uint16_t vlc_dc_chroma_code[12]; -extern const unsigned char vlc_dc_chroma_bits[12]; +extern const uint16_t ff_mpeg12_vlc_dc_lum_code[12]; +extern const unsigned char ff_mpeg12_vlc_dc_lum_bits[12]; +extern const uint16_t ff_mpeg12_vlc_dc_chroma_code[12]; +extern const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12]; -extern RLTable rl_mpeg1; -extern RLTable rl_mpeg2; +extern RLTable ff_rl_mpeg1; +extern RLTable ff_rl_mpeg2; -extern const uint8_t mbAddrIncrTable[36][2]; -extern const uint8_t mbPatTable[64][2]; +extern const uint8_t ff_mpeg12_mbAddrIncrTable[36][2]; +extern const uint8_t ff_mpeg12_mbPatTable[64][2]; -extern const uint8_t mbMotionVectorTable[17][2]; +extern const uint8_t ff_mpeg12_mbMotionVectorTable[17][2]; -extern const float mpeg1_aspect[16]; -extern const AVRational mpeg2_aspect[16]; +extern const float ff_mpeg1_aspect[16]; +extern const AVRational ff_mpeg2_aspect[16]; #endif // AVCODEC_MPEG12DATA_H diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 8afaf0a6d0..79d7b22a51 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -212,9 +212,9 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) for(i=1; i<15; i++){ float error= aspect_ratio; if(s->codec_id == CODEC_ID_MPEG1VIDEO || i <=1) - error-= 1.0/mpeg1_aspect[i]; + error-= 1.0/ff_mpeg1_aspect[i]; else - error-= av_q2d(mpeg2_aspect[i])*s->height/s->width; + error-= av_q2d(ff_mpeg2_aspect[i])*s->height/s->width; error= FFABS(error); @@ -312,8 +312,8 @@ static inline void encode_mb_skip_run(MpegEncContext *s, int run){ put_bits(&s->pb, 11, 0x008); run -= 33; } - put_bits(&s->pb, mbAddrIncrTable[run][1], - mbAddrIncrTable[run][0]); + put_bits(&s->pb, ff_mpeg12_mbAddrIncrTable[run][1], + ff_mpeg12_mbAddrIncrTable[run][0]); } static av_always_inline void put_qscale(MpegEncContext *s) @@ -554,9 +554,9 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, } if(cbp) { if (s->chroma_y_shift) { - put_bits(&s->pb, mbPatTable[cbp][1], mbPatTable[cbp][0]); + put_bits(&s->pb, ff_mpeg12_mbPatTable[cbp][1], ff_mpeg12_mbPatTable[cbp][0]); } else { - put_bits(&s->pb, mbPatTable[cbp>>2][1], mbPatTable[cbp>>2][0]); + put_bits(&s->pb, ff_mpeg12_mbPatTable[cbp>>2][1], ff_mpeg12_mbPatTable[cbp>>2][0]); put_bits(&s->pb, 2, cbp & 3); } } @@ -639,9 +639,9 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, s->mv_bits += get_bits_diff(s); if(cbp) { if (s->chroma_y_shift) { - put_bits(&s->pb, mbPatTable[cbp][1], mbPatTable[cbp][0]); + put_bits(&s->pb, ff_mpeg12_mbPatTable[cbp][1], ff_mpeg12_mbPatTable[cbp][0]); } else { - put_bits(&s->pb, mbPatTable[cbp>>2][1], mbPatTable[cbp>>2][0]); + put_bits(&s->pb, ff_mpeg12_mbPatTable[cbp>>2][1], ff_mpeg12_mbPatTable[cbp>>2][0]); put_bits(&s->pb, 2, cbp & 3); } } @@ -674,8 +674,8 @@ static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code) /* zero vector */ code = 0; put_bits(&s->pb, - mbMotionVectorTable[0][1], - mbMotionVectorTable[0][0]); + ff_mpeg12_mbMotionVectorTable[0][1], + ff_mpeg12_mbMotionVectorTable[0][0]); } else { bit_size = f_or_b_code - 1; range = 1 << bit_size; @@ -699,8 +699,8 @@ static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code) assert(code > 0 && code <= 16); put_bits(&s->pb, - mbMotionVectorTable[code][1], - mbMotionVectorTable[code][0]); + ff_mpeg12_mbMotionVectorTable[code][1], + ff_mpeg12_mbMotionVectorTable[code][0]); put_bits(&s->pb, 1, sign); if (bit_size > 0) { @@ -713,7 +713,7 @@ void ff_mpeg1_encode_init(MpegEncContext *s) { static int done=0; - common_init(s); + ff_mpeg12_common_init(s); if(!done){ int f_code; @@ -721,18 +721,18 @@ void ff_mpeg1_encode_init(MpegEncContext *s) int i; done=1; - init_rl(&rl_mpeg1, static_rl_table_store[0]); - init_rl(&rl_mpeg2, static_rl_table_store[1]); + init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); + init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); for(i=0; i<64; i++) { - mpeg1_max_level[0][i]= rl_mpeg1.max_level[0][i]; - mpeg1_index_run[0][i]= rl_mpeg1.index_run[0][i]; + mpeg1_max_level[0][i]= ff_rl_mpeg1.max_level[0][i]; + mpeg1_index_run[0][i]= ff_rl_mpeg1.index_run[0][i]; } - init_uni_ac_vlc(&rl_mpeg1, uni_mpeg1_ac_vlc_len); + init_uni_ac_vlc(&ff_rl_mpeg1, uni_mpeg1_ac_vlc_len); if(s->intra_vlc_format) - init_uni_ac_vlc(&rl_mpeg2, uni_mpeg2_ac_vlc_len); + init_uni_ac_vlc(&ff_rl_mpeg2, uni_mpeg2_ac_vlc_len); /* build unified dc encoding tables */ for(i=-255; i<256; i++) @@ -745,12 +745,12 @@ void ff_mpeg1_encode_init(MpegEncContext *s) if(diff<0) diff--; index = av_log2(2*adiff); - bits= vlc_dc_lum_bits[index] + index; - code= (vlc_dc_lum_code[index]<> bit_size) + 1; if(code<17){ - len= mbMotionVectorTable[code][1] + 1 + bit_size; + len= ff_mpeg12_mbMotionVectorTable[code][1] + 1 + bit_size; }else{ - len= mbMotionVectorTable[16][1] + 2 + bit_size; + len= ff_mpeg12_mbMotionVectorTable[16][1] + 2 + bit_size; } } @@ -822,13 +822,13 @@ static inline void encode_dc(MpegEncContext *s, int diff, int component) if (component == 0) { put_bits( &s->pb, - vlc_dc_lum_bits[index] + index, - (vlc_dc_lum_code[index]<pb, - vlc_dc_chroma_bits[index] + index, - (vlc_dc_chroma_code[index]<block_last_index[n]; @@ -864,7 +864,7 @@ static void mpeg1_encode_block(MpegEncContext *s, s->last_dc[component] = dc; i = 1; if (s->intra_vlc_format) - table_vlc = rl_mpeg2.table_vlc; + table_vlc = ff_rl_mpeg2.table_vlc; } else { /* encode the first coefficient : needs to be done here because it is handled slightly differently */