You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
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. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -826,6 +826,11 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m)
|
|||||||
|
|
||||||
s->me.mv_penalty = ff_h263_get_mv_penalty(); // FIXME exact table for MSMPEG4 & H.263+
|
s->me.mv_penalty = ff_h263_get_mv_penalty(); // FIXME exact table for MSMPEG4 & H.263+
|
||||||
|
|
||||||
|
ff_h263dsp_init(&s->h263dsp);
|
||||||
|
|
||||||
|
if (s->codec_id == AV_CODEC_ID_MPEG4)
|
||||||
|
return;
|
||||||
|
|
||||||
s->intra_ac_vlc_length =s->inter_ac_vlc_length = uni_h263_inter_rl_len;
|
s->intra_ac_vlc_length =s->inter_ac_vlc_length = uni_h263_inter_rl_len;
|
||||||
s->intra_ac_vlc_last_length=s->inter_ac_vlc_last_length= uni_h263_inter_rl_len + 128*64;
|
s->intra_ac_vlc_last_length=s->inter_ac_vlc_last_length= uni_h263_inter_rl_len + 128*64;
|
||||||
if(s->h263_aic){
|
if(s->h263_aic){
|
||||||
@ -842,8 +847,6 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m)
|
|||||||
|
|
||||||
// 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:
|
|
||||||
break;
|
|
||||||
case AV_CODEC_ID_H263P:
|
case AV_CODEC_ID_H263P:
|
||||||
if(s->umvplus)
|
if(s->umvplus)
|
||||||
m->fcode_tab = umv_fcode_tab + MAX_MV;
|
m->fcode_tab = umv_fcode_tab + MAX_MV;
|
||||||
@ -875,8 +878,6 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m)
|
|||||||
m->encode_picture_header = h263_encode_picture_header;
|
m->encode_picture_header = h263_encode_picture_header;
|
||||||
if (!s->encode_mb)
|
if (!s->encode_mb)
|
||||||
s->encode_mb = h263_encode_mb;
|
s->encode_mb = h263_encode_mb;
|
||||||
|
|
||||||
ff_h263dsp_init(&s->h263dsp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_h263_encode_mba(MpegEncContext *s)
|
void ff_h263_encode_mba(MpegEncContext *s)
|
||||||
|
@ -1305,6 +1305,19 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||||||
m->encode_picture_header = mpeg4_encode_picture_header;
|
m->encode_picture_header = mpeg4_encode_picture_header;
|
||||||
s->encode_mb = mpeg4_encode_mb;
|
s->encode_mb = mpeg4_encode_mb;
|
||||||
|
|
||||||
|
m->fcode_tab = fcode_tab + MAX_MV;
|
||||||
|
|
||||||
|
s->min_qcoeff = -2048;
|
||||||
|
s->max_qcoeff = 2047;
|
||||||
|
s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len;
|
||||||
|
s->intra_ac_vlc_last_length = uni_mpeg4_intra_rl_len + 128 * 64;
|
||||||
|
s->inter_ac_vlc_length = uni_mpeg4_inter_rl_len;
|
||||||
|
s->inter_ac_vlc_last_length = uni_mpeg4_inter_rl_len + 128 * 64;
|
||||||
|
s->luma_dc_vlc_length = uni_DCtab_lum_len;
|
||||||
|
s->ac_esc_length = 7 + 2 + 1 + 6 + 1 + 12 + 1;
|
||||||
|
s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table;
|
||||||
|
s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table;
|
||||||
|
|
||||||
ff_qpeldsp_init(&s->qdsp);
|
ff_qpeldsp_init(&s->qdsp);
|
||||||
if ((ret = ff_mpv_encode_init(avctx)) < 0)
|
if ((ret = ff_mpv_encode_init(avctx)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1322,19 +1335,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||||||
|
|
||||||
m4->time_increment_bits = av_log2(avctx->time_base.den - 1) + 1;
|
m4->time_increment_bits = av_log2(avctx->time_base.den - 1) + 1;
|
||||||
|
|
||||||
m->fcode_tab = fcode_tab + MAX_MV;
|
|
||||||
|
|
||||||
s->min_qcoeff = -2048;
|
|
||||||
s->max_qcoeff = 2047;
|
|
||||||
s->intra_ac_vlc_length = uni_mpeg4_intra_rl_len;
|
|
||||||
s->intra_ac_vlc_last_length = uni_mpeg4_intra_rl_len + 128 * 64;
|
|
||||||
s->inter_ac_vlc_length = uni_mpeg4_inter_rl_len;
|
|
||||||
s->inter_ac_vlc_last_length = uni_mpeg4_inter_rl_len + 128 * 64;
|
|
||||||
s->luma_dc_vlc_length = uni_DCtab_lum_len;
|
|
||||||
s->ac_esc_length = 7 + 2 + 1 + 6 + 1 + 12 + 1;
|
|
||||||
s->y_dc_scale_table = ff_mpeg4_y_dc_scale_table;
|
|
||||||
s->c_dc_scale_table = ff_mpeg4_c_dc_scale_table;
|
|
||||||
|
|
||||||
if (s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
|
if (s->avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
|
||||||
s->avctx->extradata = av_malloc(1024);
|
s->avctx->extradata = av_malloc(1024);
|
||||||
if (!s->avctx->extradata)
|
if (!s->avctx->extradata)
|
||||||
|
Reference in New Issue
Block a user