ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Mon Mar 3 21:04:49 2025 +0100| [94f364289b893e660ea2a7e3259db882d54ac508] | committer: Andreas Rheinhardt
avcodec/ituh263enc: Move MPEG-4 fcode_tab to mpeg4videoenc.c Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94f364289b893e660ea2a7e3259db882d54ac508 --- libavcodec/ituh263enc.c | 12 ------------ libavcodec/mpeg4videoenc.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index 1ef4a8f88e..2152046b43 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -52,11 +52,6 @@ */ static uint8_t mv_penalty[MAX_FCODE+1][MAX_DMV*2+1]; -/** - * Minimal fcode that a motion vector component would need. - */ -static uint8_t fcode_tab[MAX_MV*2+1]; - /** * Minimal fcode that a motion vector component would need in umv. * All entries in this table are 1. @@ -762,12 +757,6 @@ static av_cold void init_mv_penalty_and_fcode(void) } } - for(f_code=MAX_FCODE; f_code>0; f_code--){ - for(mv=-(16<<f_code); mv<(16<<f_code); mv++){ - fcode_tab[mv+MAX_MV]= f_code; - } - } - for(mv=0; mv<MAX_MV*2+1; mv++){ umv_fcode_tab[mv]= 1; } @@ -844,7 +833,6 @@ av_cold void ff_h263_encode_init(MpegEncContext *s) // use fcodes >1 only for MPEG-4 & H.263 & H.263+ FIXME switch(s->codec_id){ case AV_CODEC_ID_MPEG4: - s->fcode_tab= fcode_tab; break; case AV_CODEC_ID_H263P: if(s->umvplus) diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 0b31576dc5..64fb96a0cf 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -37,6 +37,11 @@ #include "profiles.h" #include "version.h" +/** + * Minimal fcode that a motion vector component would need. + */ +static uint8_t fcode_tab[MAX_MV*2+1]; + /* The uni_DCtab_* tables below contain unified bits+length tables to encode DC * differences in MPEG-4. Unified in the sense that the specification specifies * this encoding in several steps. */ @@ -1255,6 +1260,11 @@ static av_cold void mpeg4_encode_init_static(void) init_uni_mpeg4_rl_tab(&ff_mpeg4_rl_intra, uni_mpeg4_intra_rl_bits, uni_mpeg4_intra_rl_len); init_uni_mpeg4_rl_tab(&ff_h263_rl_inter, uni_mpeg4_inter_rl_bits, uni_mpeg4_inter_rl_len); + + for (int f_code = MAX_FCODE; f_code > 0; f_code--) { + for (int mv = -(16 << f_code); mv < (16 << f_code); mv++) + fcode_tab[mv + MAX_MV] = f_code; + } } static av_cold int encode_init(AVCodecContext *avctx) @@ -1274,6 +1284,7 @@ static av_cold int encode_init(AVCodecContext *avctx) ff_thread_once(&init_static_once, mpeg4_encode_init_static); + s->fcode_tab = fcode_tab; s->min_qcoeff = -2048; s->max_qcoeff = 2047; s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".