You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/motion_est: Reset scene_change score, MB variance stats
Reset them in ff_me_init_pic(). It is the appropriate place for it and allows to remove resetting code from multiple places (e.g. mpegvideo_enc.c resetted it in two different places (one for the main slice context, one for all the others)). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@ -397,6 +397,10 @@ void ff_me_init_pic(MPVEncContext *const s)
|
||||
c->hpel_put[2][0]= c->hpel_put[2][1]=
|
||||
c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
|
||||
}
|
||||
/* Reset the average MB variance and scene change stats */
|
||||
c->scene_change_score = 0;
|
||||
c->mb_var_sum_temp =
|
||||
c->mc_mb_var_sum_temp = 0;
|
||||
}
|
||||
|
||||
#define CHECK_SAD_HALF_MV(suffix, x, y) \
|
||||
|
@ -3586,9 +3586,9 @@ static int encode_thread(AVCodecContext *c, void *arg){
|
||||
#define MERGE(field) dst->field += src->field; src->field=0
|
||||
static void merge_context_after_me(MPVEncContext *const dst, MPVEncContext *const src)
|
||||
{
|
||||
MERGE(me.scene_change_score);
|
||||
MERGE(me.mc_mb_var_sum_temp);
|
||||
MERGE(me.mb_var_sum_temp);
|
||||
ADD(me.scene_change_score);
|
||||
ADD(me.mc_mb_var_sum_temp);
|
||||
ADD(me.mb_var_sum_temp);
|
||||
}
|
||||
|
||||
static void merge_context_after_encode(MPVEncContext *const dst, MPVEncContext *const src)
|
||||
@ -3680,10 +3680,6 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt)
|
||||
int bits;
|
||||
int context_count = s->c.slice_context_count;
|
||||
|
||||
/* Reset the average MB variance */
|
||||
s->me.mb_var_sum_temp =
|
||||
s->me.mc_mb_var_sum_temp = 0;
|
||||
|
||||
/* we need to initialize some time vars before we can encode B-frames */
|
||||
// RAL: Condition added for MPEG1VIDEO
|
||||
if (s->c.out_format == FMT_MPEG1 || (s->c.h263_pred && s->c.msmpeg4_version == MSMP4_UNUSED))
|
||||
@ -3691,8 +3687,6 @@ static int encode_picture(MPVMainEncContext *const m, const AVPacket *pkt)
|
||||
if (CONFIG_MPEG4_ENCODER && s->c.codec_id == AV_CODEC_ID_MPEG4)
|
||||
ff_set_mpeg4_time(s);
|
||||
|
||||
s->me.scene_change_score=0;
|
||||
|
||||
// s->lambda = s->c.cur_pic.ptr->quality; //FIXME qscale / ... stuff for ME rate distortion
|
||||
|
||||
if (s->c.pict_type == AV_PICTURE_TYPE_I) {
|
||||
|
@ -1867,7 +1867,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
mpv->c.f_code = 1;
|
||||
mpv->c.pict_type = pic->pict_type;
|
||||
mpv->me.motion_est = enc->motion_est;
|
||||
mpv->me.scene_change_score = 0;
|
||||
mpv->me.dia_size = avctx->dia_size;
|
||||
mpv->c.quarter_sample = (s->avctx->flags & AV_CODEC_FLAG_QPEL)!=0;
|
||||
mpv->c.out_format = FMT_H263;
|
||||
|
Reference in New Issue
Block a user