History

avcodec/mpeg4videoenc: Move initializations before ff_mpv_encode_init()

This avoids relying on ff_update_duplicate_context() to copy these fields to the slice contexts.

Andreas Rheinhardt committed 1 year ago

Commit 0e333a51 parent 83973512 files · +18 −17Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/ituh263enc.c +5 −4
  2. libavcodec/mpeg4videoenc.c +13 −13
libavcodec/ituh263enc.c+5−4
@@ -826,6 +826,11 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m) · 825 unmodified lines
826826
827827 s->me.mv_penalty = ff_h263_get_mv_penalty(); // FIXME exact table for MSMPEG4 & H.263+
828828
829+ ff_h263dsp_init(&s->h263dsp);
830+
831+ if (s->codec_id == AV_CODEC_ID_MPEG4)
832+ return;
833+
829834 s->intra_ac_vlc_length =s->inter_ac_vlc_length = uni_h263_inter_rl_len;
830835 s->intra_ac_vlc_last_length=s->inter_ac_vlc_last_length= uni_h263_inter_rl_len + 128*64;
831836 if(s->h263_aic){
@@ -842,8 +847,6 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m) · 10 unmodified lines
842847
843848 // use fcodes >1 only for MPEG-4 & H.263 & H.263+ FIXME
844849 switch(s->codec_id){
845− case AV_CODEC_ID_MPEG4:
846− break;
847850 case AV_CODEC_ID_H263P:
848851 if(s->umvplus)
849852 m->fcode_tab = umv_fcode_tab + MAX_MV;
@@ -875,8 +878,6 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m) · 25 unmodified lines
875878 m->encode_picture_header = h263_encode_picture_header;
876879 if (!s->encode_mb)
877880 s->encode_mb = h263_encode_mb;
878−
879− ff_h263dsp_init(&s->h263dsp);
880881 }
881882
882883 void ff_h263_encode_mba(MpegEncContext *s)
libavcodec/mpeg4videoenc.c+13−13
@@ -1305,6 +1305,19 @@ static av_cold int encode_init(AVCodecContext *avctx) · 1304 unmodified lines
13051305 m->encode_picture_header = mpeg4_encode_picture_header;
13061306 s->encode_mb = mpeg4_encode_mb;
13071307
1308+ m->fcode_tab = fcode_tab + MAX_MV;
1309+
1310+ s->min_qcoeff = -2048;
1311+ s->max_qcoeff = 2047;
1312+ s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len;
1313+ s->intra_ac_vlc_last_length = uni_mpeg4_intra_rl_len + 128 * 64;
1314+ s->inter_ac_vlc_length = uni_mpeg4_inter_rl_len;
1315+ s->inter_ac_vlc_last_length = uni_mpeg4_inter_rl_len + 128 * 64;
1316+ s->luma_dc_vlc_length = uni_DCtab_lum_len;
1317+ s->ac_esc_length = 7 + 2 + 1 + 6 + 1 + 12 + 1;
1318+ s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table;
1319+ s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table;
1320+
13081321 ff_qpeldsp_init(&s->qdsp);
13091322 if ((ret = ff_mpv_encode_init(avctx)) < 0)
13101323 return ret;
@@ -1322,19 +1335,6 @@ static av_cold int encode_init(AVCodecContext *avctx) · 11 unmodified lines
13221335
13231336 m4->time_increment_bits = av_log2(avctx->time_base.den - 1) + 1;
13241337
1325− m->fcode_tab = fcode_tab + MAX_MV;
1326−
1327− s->min_qcoeff = -2048;
1328− s->max_qcoeff = 2047;
1329− s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len;
1330− s->intra_ac_vlc_last_length = uni_mpeg4_intra_rl_len + 128 * 64;
1331− s->inter_ac_vlc_length = uni_mpeg4_inter_rl_len;
1332− s->inter_ac_vlc_last_length = uni_mpeg4_inter_rl_len + 128 * 64;
1333− s->luma_dc_vlc_length = uni_DCtab_lum_len;
1334− s->ac_esc_length = 7 + 2 + 1 + 6 + 1 + 12 + 1;
1335− s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table;
1336− s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table;
1337−
13381338 if (s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
13391339 s->avctx->extradata = av_malloc(1024);
13401340 if (!s->avctx->extradata)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t