1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/ituh263enc: Move MPEG-4 fcode_tab to mpeg4videoenc.c

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-03 21:04:49 +01:00
parent 3977abc89f
commit 94f364289b
2 changed files with 11 additions and 12 deletions

View File

@ -52,11 +52,6 @@
*/ */
static uint8_t mv_penalty[MAX_FCODE+1][MAX_DMV*2+1]; 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. * Minimal fcode that a motion vector component would need in umv.
* All entries in this table are 1. * 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++){ for(mv=0; mv<MAX_MV*2+1; mv++){
umv_fcode_tab[mv]= 1; 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 // use fcodes >1 only for MPEG-4 & H.263 & H.263+ FIXME
switch(s->codec_id){ switch(s->codec_id){
case AV_CODEC_ID_MPEG4: case AV_CODEC_ID_MPEG4:
s->fcode_tab= fcode_tab;
break; break;
case AV_CODEC_ID_H263P: case AV_CODEC_ID_H263P:
if(s->umvplus) if(s->umvplus)

View File

@ -37,6 +37,11 @@
#include "profiles.h" #include "profiles.h"
#include "version.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 /* 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 * differences in MPEG-4. Unified in the sense that the specification specifies
* this encoding in several steps. */ * 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_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); 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) 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); ff_thread_once(&init_static_once, mpeg4_encode_init_static);
s->fcode_tab = fcode_tab;
s->min_qcoeff = -2048; s->min_qcoeff = -2048;
s->max_qcoeff = 2047; s->max_qcoeff = 2047;
s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len; s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len;