diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2007-11-07 23:23:35 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2007-11-07 23:23:35 +0000 |
commit | 85f601ee7b0236cdb0ad5f4db8aad76dc34b813c (patch) | |
tree | ffab73a6939610d4c41c5366b13b944639ef81cb | |
parent | b0bd01d68a5ed5c9c6fa16808c541771c36587d1 (diff) | |
download | ffmpeg-85f601ee7b0236cdb0ad5f4db8aad76dc34b813c.tar.gz |
rename some msmpeg4 symbols and make them non-static
so that they can be used in standalone wmv2.c
Originally committed as revision 10949 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/msmpeg4.c | 52 | ||||
-rw-r--r-- | libavcodec/wmv2.c | 34 |
2 files changed, 43 insertions, 43 deletions
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 609fc2f690..d3568fc601 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -62,10 +62,10 @@ static uint32_t v2_dc_lum_table[512][2]; static uint32_t v2_dc_chroma_table[512][2]; void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n); -static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, +int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, int n, int coded, const uint8_t *scantable); static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr); -static int msmpeg4_decode_motion(MpegEncContext * s, +int ff_msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr); static void init_h263_dc_for_msmpeg4(void); static inline void msmpeg4_memsetw(short *tab, int val, int n); @@ -75,7 +75,7 @@ static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, #endif //CONFIG_ENCODERS static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); -static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); +int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); /* vc1 externs */ extern uint8_t wmv3_dc_scale_table[32]; @@ -161,7 +161,7 @@ static void init_mv_table(MVTable *tab) } } -void ff_code012(PutBitContext *pb, int n) +void ff_msmpeg4_code012(PutBitContext *pb, int n) { if (n == 0) { put_bits(pb, 1, 0); @@ -347,8 +347,8 @@ void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number) if(s->msmpeg4_version>2){ if(!s->per_mb_rl_table){ - ff_code012(&s->pb, s->rl_chroma_table_index); - ff_code012(&s->pb, s->rl_table_index); + ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index); + ff_msmpeg4_code012(&s->pb, s->rl_table_index); } put_bits(&s->pb, 1, s->dc_table_index); @@ -361,7 +361,7 @@ void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number) if(s->msmpeg4_version>2){ if(!s->per_mb_rl_table) - ff_code012(&s->pb, s->rl_table_index); + ff_msmpeg4_code012(&s->pb, s->rl_table_index); put_bits(&s->pb, 1, s->dc_table_index); @@ -393,7 +393,7 @@ void msmpeg4_encode_ext_header(MpegEncContext * s) #endif //CONFIG_ENCODERS /* predict coded block */ -static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr) +int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr) { int xy, wrap, pred, a, b, c; @@ -421,7 +421,7 @@ static inline int coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_bl #ifdef CONFIG_ENCODERS -static void msmpeg4_encode_motion(MpegEncContext * s, +void ff_msmpeg4_encode_motion(MpegEncContext * s, int mx, int my) { int code; @@ -459,7 +459,7 @@ static void msmpeg4_encode_motion(MpegEncContext * s, } } -static inline void handle_slices(MpegEncContext *s){ +void ff_msmpeg4_handle_slices(MpegEncContext *s){ if (s->mb_x == 0) { if (s->slice_height && (s->mb_y % s->slice_height) == 0) { if(s->msmpeg4_version < 4){ @@ -480,7 +480,7 @@ void msmpeg4_encode_mb(MpegEncContext * s, int pred_x, pred_y; uint8_t *coded_block; - handle_slices(s); + ff_msmpeg4_handle_slices(s); if (!s->mb_intra) { /* compute cbp */ @@ -526,7 +526,7 @@ void msmpeg4_encode_mb(MpegEncContext * s, /* motion vector */ h263_pred_motion(s, 0, 0, &pred_x, &pred_y); - msmpeg4_encode_motion(s, motion_x - pred_x, + ff_msmpeg4_encode_motion(s, motion_x - pred_x, motion_y - pred_y); } @@ -546,7 +546,7 @@ void msmpeg4_encode_mb(MpegEncContext * s, cbp |= val << (5 - i); if (i < 4) { /* predict value for close blocks only for luma */ - pred = coded_block_pred(s, i, &coded_block); + pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block); *coded_block = val; val = val ^ pred; } @@ -990,7 +990,7 @@ else /****************************************/ /* decoding stuff */ -static VLC mb_non_intra_vlc[4]; +VLC ff_mb_non_intra_vlc[4]; static VLC v2_dc_lum_vlc; static VLC v2_dc_chroma_vlc; static VLC cbpy_vlc; @@ -999,7 +999,7 @@ static VLC v2_mb_type_vlc; static VLC v2_mv_vlc; static VLC v1_intra_cbpc_vlc; static VLC v1_inter_cbpc_vlc; -static VLC inter_intra_vlc; +VLC ff_inter_intra_vlc; /* This table is practically identical to the one from h263 * except that it is inverted. */ @@ -1114,7 +1114,7 @@ int ff_msmpeg4_decode_init(MpegEncContext *s) &mvtab[0][0], 2, 1, 1); for(i=0; i<4; i++){ - init_vlc(&mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128, + init_vlc(&ff_mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128, &wmv2_inter_table[i][0][1], 8, 4, &wmv2_inter_table[i][0][0], 8, 4, 1); //FIXME name? } @@ -1130,7 +1130,7 @@ int ff_msmpeg4_decode_init(MpegEncContext *s) inter_MCBPC_bits, 1, 1, inter_MCBPC_code, 1, 1, 1); - init_vlc(&inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, + init_vlc(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, &table_inter_intra[0][1], 2, 1, &table_inter_intra[0][0], 2, 1, 1); } @@ -1145,7 +1145,7 @@ int ff_msmpeg4_decode_init(MpegEncContext *s) s->decode_mb= msmpeg4v34_decode_mb; break; case 5: - s->decode_mb= wmv2_decode_mb; + s->decode_mb= ff_wmv2_decode_mb; case 6: //FIXME + TODO VC1 decode mb break; @@ -1508,7 +1508,7 @@ static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) s->dsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { - if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) + if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); return -1; @@ -1541,7 +1541,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) } } - code = get_vlc2(&s->gb, mb_non_intra_vlc[DEFAULT_INTER_INDEX].table, MB_NON_INTRA_VLC_BITS, 3); + code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[DEFAULT_INTER_INDEX].table, MB_NON_INTRA_VLC_BITS, 3); if (code < 0) return -1; //s->mb_intra = (code & 0x40) ? 0 : 1; @@ -1558,7 +1558,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) for(i=0;i<6;i++) { int val = ((code >> (5 - i)) & 1); if (i < 4) { - int pred = coded_block_pred(s, i, &coded_val); + int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val); val = val ^ pred; *coded_val = val; } @@ -1574,7 +1574,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) s->rl_chroma_table_index = s->rl_table_index; } h263_pred_motion(s, 0, 0, &mx, &my); - if (msmpeg4_decode_motion(s, &mx, &my) < 0) + if (ff_msmpeg4_decode_motion(s, &mx, &my) < 0) return -1; s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; @@ -1586,7 +1586,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) s->ac_pred = get_bits1(&s->gb); *mb_type_ptr = MB_TYPE_INTRA; if(s->inter_intra_pred){ - s->h263_aic_dir= get_vlc2(&s->gb, inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); + s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); // printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y); } if(s->per_mb_rl_table && cbp){ @@ -1597,7 +1597,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) s->dsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { - if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) + if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); return -1; @@ -1607,7 +1607,7 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) return 0; } //#define ERROR_DETAILS -static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, +int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, int n, int coded, const uint8_t *scan_table) { int level, i, last, run, run_diff; @@ -1911,7 +1911,7 @@ static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) return level; } -static int msmpeg4_decode_motion(MpegEncContext * s, +int ff_msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr) { MVTable *mv; diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index 8680d36739..a5b931e50a 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -141,8 +141,8 @@ int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number) if(w->per_mb_rl_bit) put_bits(&s->pb, 1, s->per_mb_rl_table); if(!s->per_mb_rl_table){ - ff_code012(&s->pb, s->rl_chroma_table_index); - ff_code012(&s->pb, s->rl_table_index); + ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index); + ff_msmpeg4_code012(&s->pb, s->rl_table_index); } put_bits(&s->pb, 1, s->dc_table_index); @@ -153,7 +153,7 @@ int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number) put_bits(&s->pb, 2, SKIP_TYPE_NONE); - ff_code012(&s->pb, cbp_index=0); + ff_msmpeg4_code012(&s->pb, cbp_index=0); if(s->qscale <= 10){ int map[3]= {0,2,1}; w->cbp_table_index= map[cbp_index]; @@ -170,14 +170,14 @@ int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number) if(w->abt_flag){ put_bits(&s->pb, 1, w->per_mb_abt^1); if(!w->per_mb_abt){ - ff_code012(&s->pb, w->abt_type); + ff_msmpeg4_code012(&s->pb, w->abt_type); } } if(w->per_mb_rl_bit) put_bits(&s->pb, 1, s->per_mb_rl_table); if(!s->per_mb_rl_table){ - ff_code012(&s->pb, s->rl_table_index); + ff_msmpeg4_code012(&s->pb, s->rl_table_index); s->rl_chroma_table_index = s->rl_table_index; } put_bits(&s->pb, 1, s->dc_table_index); @@ -203,7 +203,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s, int pred_x, pred_y; uint8_t *coded_block; - handle_slices(s); + ff_msmpeg4_handle_slices(s); if (!s->mb_intra) { /* compute cbp */ @@ -219,7 +219,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s, /* motion vector */ h263_pred_motion(s, 0, 0, &pred_x, &pred_y); - msmpeg4_encode_motion(s, motion_x - pred_x, + ff_msmpeg4_encode_motion(s, motion_x - pred_x, motion_y - pred_y); } else { /* compute cbp */ @@ -231,7 +231,7 @@ void ff_wmv2_encode_mb(MpegEncContext * s, cbp |= val << (5 - i); if (i < 4) { /* predict value for close blocks only for luma */ - pred = coded_block_pred(s, i, &coded_block); + pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block); *coded_block = val; val = val ^ pred; } @@ -482,7 +482,7 @@ static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){ MpegEncContext * const s= &w->s; int ret; - ret= msmpeg4_decode_motion(s, mx_ptr, my_ptr); + ret= ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr); if(ret<0) return -1; @@ -568,19 +568,19 @@ static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n, // printf("S%d", sub_cbp); if(sub_cbp&1){ - if (msmpeg4_decode_block(s, block, n, 1, scantable) < 0) + if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0) return -1; } if(sub_cbp&2){ - if (msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable) < 0) + if (ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable) < 0) return -1; } s->block_last_index[n] = 63; return 0; }else{ - return msmpeg4_decode_block(s, block, n, 1, s->inter_scantable.permutated); + return ff_msmpeg4_decode_block(s, block, n, 1, s->inter_scantable.permutated); } } @@ -711,7 +711,7 @@ void ff_mspel_motion(MpegEncContext *s, } -static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) +int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) { Wmv2Context * const w= (Wmv2Context*)s; int cbp, code, i; @@ -734,7 +734,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) return 0; } - code = get_vlc2(&s->gb, mb_non_intra_vlc[w->cbp_table_index].table, MB_NON_INTRA_VLC_BITS, 3); + code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table, MB_NON_INTRA_VLC_BITS, 3); if (code < 0) return -1; s->mb_intra = (~code & 0x40) >> 6; @@ -752,7 +752,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) for(i=0;i<6;i++) { int val = ((code >> (5 - i)) & 1); if (i < 4) { - int pred = coded_block_pred(s, i, &coded_val); + int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val); val = val ^ pred; *coded_val = val; } @@ -801,7 +801,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) //printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24)); s->ac_pred = get_bits1(&s->gb); if(s->inter_intra_pred){ - s->h263_aic_dir= get_vlc2(&s->gb, inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); + s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1); // printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y); } if(s->per_mb_rl_table && cbp){ @@ -811,7 +811,7 @@ static int wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) s->dsp.clear_blocks(s->block[0]); for (i = 0; i < 6; i++) { - if (msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) + if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0) { av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding intra block: %d x %d (%d)\n", s->mb_x, s->mb_y, i); return -1; |