mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 01:02:33 +00:00
avcodec/motion_est: Store remaining required me_cmp_funcs
This avoids using MpegEncContext.mecc; it already allows to avoid touching the latter for snowenc and svq1enc. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
d163eefd47
commit
10e7633cd7
@ -332,6 +332,9 @@ av_cold int ff_me_init(MotionEstContext *c, AVCodecContext *avctx,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
c->sse = mecc->sse[0];
|
||||
memcpy(c->pix_abs, mecc->pix_abs, sizeof(c->pix_abs));
|
||||
|
||||
c->flags = get_flags(c, 0, avctx->me_cmp & FF_CMP_CHROMA);
|
||||
c->sub_flags = get_flags(c, 0, avctx->me_sub_cmp & FF_CMP_CHROMA);
|
||||
c->mb_flags = get_flags(c, 0, avctx->mb_cmp & FF_CMP_CHROMA);
|
||||
@ -397,7 +400,7 @@ void ff_me_init_pic(MpegEncContext *s)
|
||||
|
||||
#define CHECK_SAD_HALF_MV(suffix, x, y) \
|
||||
{\
|
||||
d = s->mecc.pix_abs[size][(x ? 1 : 0) + (y ? 2 : 0)](NULL, pix, ptr + ((x) >> 1), stride, h); \
|
||||
d = c->pix_abs[size][(x ? 1 : 0) + (y ? 2 : 0)](NULL, pix, ptr + ((x) >> 1), stride, h); \
|
||||
d += (mv_penalty[pen_x + x] + mv_penalty[pen_y + y])*penalty_factor;\
|
||||
COPY3_IF_LT(dminh, d, dx, x, dy, y)\
|
||||
}
|
||||
@ -973,7 +976,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
|
||||
/* At this point (mx,my) are full-pell and the relative displacement */
|
||||
ppix = c->ref[0][0] + (my * s->linesize) + mx;
|
||||
|
||||
vard = s->mecc.sse[0](NULL, pix, ppix, s->linesize, 16);
|
||||
vard = c->sse(NULL, pix, ppix, s->linesize, 16);
|
||||
|
||||
s->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
|
||||
c->mc_mb_var_sum_temp += (vard+128)>>8;
|
||||
|
@ -89,6 +89,9 @@ typedef struct MotionEstContext {
|
||||
me_cmp_func me_sub_cmp[6];
|
||||
me_cmp_func mb_cmp[6];
|
||||
|
||||
me_cmp_func pix_abs[2][4];
|
||||
me_cmp_func sse;
|
||||
|
||||
op_pixels_func(*hpel_put)[4];
|
||||
op_pixels_func(*hpel_avg)[4];
|
||||
qpel_mc_func(*qpel_put)[16];
|
||||
|
@ -1869,7 +1869,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
mpv->qscale = (mpv->lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
|
||||
enc->lambda2 = mpv->lambda2 = (mpv->lambda*mpv->lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
|
||||
|
||||
mpv->mecc = enc->mecc; //move
|
||||
mpv->qdsp = enc->qdsp; //move
|
||||
mpv->hdsp = s->hdsp;
|
||||
ff_me_init_pic(&enc->m);
|
||||
|
@ -373,7 +373,6 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
|
||||
s->m.cur_pic.motion_val[0] = s->motion_val8[plane] + 2;
|
||||
s->m.p_mv_table = s->motion_val16[plane] +
|
||||
s->m.mb_stride + 1;
|
||||
s->m.mecc = s->mecc; // move
|
||||
ff_me_init_pic(&s->m);
|
||||
|
||||
s->m.me.dia_size = s->avctx->dia_size;
|
||||
|
Loading…
Reference in New Issue
Block a user