summaryrefslogtreecommitdiff
path: root/libavcodec/motion_est.c
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2014-02-08 02:59:58 +0100
committerDiego Biurrun <diego@biurrun.de>2014-07-17 09:07:10 -0700
commit2d60444331fca1910510038dd3817bea885c2367 (patch)
tree51ac937c7e051b03c7cc8e39b079a37f18dd09b0 /libavcodec/motion_est.c
parenta578b0407dc983aecd72028e1127062689b67089 (diff)
downloadffmpeg-2d60444331fca1910510038dd3817bea885c2367.tar.gz
dsputil: Split motion estimation compare bits off into their own context
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r--libavcodec/motion_est.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index a8a93b73e8..dee28f05ab 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -317,10 +317,10 @@ int ff_init_me(MpegEncContext *s){
av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n");
}
- ff_set_cmp(&s->dsp, s->dsp.me_pre_cmp, c->avctx->me_pre_cmp);
- ff_set_cmp(&s->dsp, s->dsp.me_cmp, c->avctx->me_cmp);
- ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, c->avctx->me_sub_cmp);
- ff_set_cmp(&s->dsp, s->dsp.mb_cmp, c->avctx->mb_cmp);
+ ff_set_cmp(&s->mecc, s->mecc.me_pre_cmp, c->avctx->me_pre_cmp);
+ ff_set_cmp(&s->mecc, s->mecc.me_cmp, c->avctx->me_cmp);
+ ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, c->avctx->me_sub_cmp);
+ ff_set_cmp(&s->mecc, s->mecc.mb_cmp, c->avctx->mb_cmp);
c->flags = get_flags(c, 0, c->avctx->me_cmp &FF_CMP_CHROMA);
c->sub_flags= get_flags(c, 0, c->avctx->me_sub_cmp&FF_CMP_CHROMA);
@@ -361,12 +361,10 @@ int ff_init_me(MpegEncContext *s){
/* 8x8 fullpel search would need a 4x4 chroma compare, which we do
* not have yet, and even if we had, the motion estimation code
* does not expect it. */
- if((c->avctx->me_cmp&FF_CMP_CHROMA)/* && !s->dsp.me_cmp[2]*/){
- s->dsp.me_cmp[2]= zero_cmp;
- }
- if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){
- s->dsp.me_sub_cmp[2]= zero_cmp;
- }
+ if ((c->avctx->me_cmp & FF_CMP_CHROMA) /* && !s->mecc.me_cmp[2] */)
+ s->mecc.me_cmp[2] = zero_cmp;
+ if ((c->avctx->me_sub_cmp & FF_CMP_CHROMA) && !s->mecc.me_sub_cmp[2])
+ s->mecc.me_sub_cmp[2] = zero_cmp;
c->hpel_put[2][0]= c->hpel_put[2][1]=
c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
@@ -379,7 +377,7 @@ int ff_init_me(MpegEncContext *s){
#define CHECK_SAD_HALF_MV(suffix, x, y) \
{\
- d= s->dsp.pix_abs[size][(x?1:0)+(y?2:0)](NULL, pix, ptr+((x)>>1), stride, h);\
+ d = s->mecc.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)\
}
@@ -615,7 +613,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
dmin4= c->sub_motion_search(s, &mx4, &my4, dmin4, block, block, size, h);
- if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){
+ if (s->mecc.me_sub_cmp[0] != s->mecc.mb_cmp[0]) {
int dxy;
const int offset= ((block&1) + (block>>1)*stride)*8;
uint8_t *dest_y = c->scratchpad + offset;
@@ -657,8 +655,11 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
if(same)
return INT_MAX;
- if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){
- dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16);
+ if (s->mecc.me_sub_cmp[0] != s->mecc.mb_cmp[0]) {
+ dmin_sum += s->mecc.mb_cmp[0](s,
+ s->new_picture.f->data[0] +
+ s->mb_x * 16 + s->mb_y * 16 * stride,
+ c->scratchpad, stride, 16);
}
if(c->avctx->mb_cmp&FF_CMP_CHROMA){
@@ -680,8 +681,8 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_picture.f->data[2] + offset, s->uvlinesize, 8);
}
- dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f->data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad , s->uvlinesize, 8);
- dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8);
+ dmin_sum += s->mecc.mb_cmp[1](s, s->new_picture.f->data[1] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad, s->uvlinesize, 8);
+ dmin_sum += s->mecc.mb_cmp[1](s, s->new_picture.f->data[2] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad + 8, s->uvlinesize, 8);
}
c->pred_x= mx;
@@ -777,7 +778,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index,
mv_table[xy][0]= mx_i;
mv_table[xy][1]= my_i;
- if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){
+ if (s->mecc.me_sub_cmp[0] != s->mecc.mb_cmp[0]) {
int dxy;
//FIXME chroma ME
@@ -789,7 +790,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index,
}else{
s->hdsp.put_pixels_tab [size][dxy](c->scratchpad, ref , stride, h);
}
- dmin= s->dsp.mb_cmp[size](s, c->src[block][0], c->scratchpad, stride, h);
+ dmin = s->mecc.mb_cmp[size](s, c->src[block][0], c->scratchpad, stride, h);
dmin+= (mv_penalty[mx_i-c->pred_x] + mv_penalty[my_i-c->pred_y] + 1)*c->mb_penalty_factor;
}else
dmin+= c->mb_penalty_factor; //field_select bits
@@ -940,7 +941,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->dsp.sse[0](NULL, pix, ppix, s->linesize, 16);
+ vard = s->mecc.sse[0](NULL, pix, ppix, s->linesize, 16);
pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
c->mc_mb_var_sum_temp += (vard+128)>>8;
@@ -1037,7 +1038,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
*(uint32_t*)(&c->scratchpad[i*s->linesize+12]) = mean;
}
- intra_score= s->dsp.mb_cmp[0](s, c->scratchpad, pix, s->linesize, 16);
+ intra_score= s->mecc.mb_cmp[0](s, c->scratchpad, pix, s->linesize, 16);
}
intra_score += c->mb_penalty_factor*16;
@@ -1237,7 +1238,7 @@ static inline int check_bidir_mv(MpegEncContext * s,
fbmin = (mv_penalty_f[motion_fx-pred_fx] + mv_penalty_f[motion_fy-pred_fy])*c->mb_penalty_factor
+(mv_penalty_b[motion_bx-pred_bx] + mv_penalty_b[motion_by-pred_by])*c->mb_penalty_factor
- + s->dsp.mb_cmp[size](s, src_data[0], dest_y, stride, h); //FIXME new_pic
+ + s->mecc.mb_cmp[size](s, src_data[0], dest_y, stride, h); // FIXME new_pic
if(c->avctx->mb_cmp&FF_CMP_CHROMA){
}