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

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
826 826
827 s->me.mv_penalty = ff_h263_get_mv_penalty(); // FIXME exact table for MSMPEG4 & H.263+827 s->me.mv_penalty = ff_h263_get_mv_penalty(); // FIXME exact table for MSMPEG4 & H.263+
828 828
829 ff_h263dsp_init(&s->h263dsp);
830
831 if (s->codec_id == AV_CODEC_ID_MPEG4)
832 return;
833
829 s->intra_ac_vlc_length =s->inter_ac_vlc_length = uni_h263_inter_rl_len;834 s->intra_ac_vlc_length =s->inter_ac_vlc_length = uni_h263_inter_rl_len;
830 s->intra_ac_vlc_last_length=s->inter_ac_vlc_last_length= uni_h263_inter_rl_len + 128*64;835 s->intra_ac_vlc_last_length=s->inter_ac_vlc_last_length= uni_h263_inter_rl_len + 128*64;
831 if(s->h263_aic){836 if(s->h263_aic){
@@ -842,8 +847,6 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m) · 10 unmodified lines
842 847
843 // use fcodes >1 only for MPEG-4 & H.263 & H.263+ FIXME848 // use fcodes >1 only for MPEG-4 & H.263 & H.263+ FIXME
844 switch(s->codec_id){849 switch(s->codec_id){
845 case AV_CODEC_ID_MPEG4:
846 break;
847 case AV_CODEC_ID_H263P:850 case AV_CODEC_ID_H263P:
848 if(s->umvplus)851 if(s->umvplus)
849 m->fcode_tab = umv_fcode_tab + MAX_MV;852 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
875 m->encode_picture_header = h263_encode_picture_header;878 m->encode_picture_header = h263_encode_picture_header;
876 if (!s->encode_mb)879 if (!s->encode_mb)
877 s->encode_mb = h263_encode_mb;880 s->encode_mb = h263_encode_mb;
878
879 ff_h263dsp_init(&s->h263dsp);
880}881}
881 882
882void ff_h263_encode_mba(MpegEncContext *s)883void 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
1305 m->encode_picture_header = mpeg4_encode_picture_header;1305 m->encode_picture_header = mpeg4_encode_picture_header;
1306 s->encode_mb = mpeg4_encode_mb;1306 s->encode_mb = mpeg4_encode_mb;
1307 1307
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
1308 ff_qpeldsp_init(&s->qdsp);1321 ff_qpeldsp_init(&s->qdsp);
1309 if ((ret = ff_mpv_encode_init(avctx)) < 0)1322 if ((ret = ff_mpv_encode_init(avctx)) < 0)
1310 return ret;1323 return ret;
@@ -1322,19 +1335,6 @@ static av_cold int encode_init(AVCodecContext *avctx) · 11 unmodified lines
1322 1335
1323 m4->time_increment_bits = av_log2(avctx->time_base.den - 1) + 1;1336 m4->time_increment_bits = av_log2(avctx->time_base.den - 1) + 1;
1324 1337
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
1338 if (s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {1338 if (s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
1339 s->avctx->extradata = av_malloc(1024);1339 s->avctx->extradata = av_malloc(1024);
1340 if (!s->avctx->extradata)1340 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