summaryrefslogtreecommitdiff
path: root/libavcodec/motion_est_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-08-22 17:16:03 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-08-22 17:16:03 +0000
commit26efc54e4a6811f29d07d875185190175cb513e6 (patch)
treeae92d157d94487dfdc2cee4ea3cbb7c1f99d1144 /libavcodec/motion_est_template.c
parentc931e6086012d955e2fd0c896ff1fdb9099b4204 (diff)
4x4 SSE compare function
wavelet based compare functions make epzs_motion_search() more flexible so it can be used for a wider range of block sizes make get_penalty_factor() independant of MpegEncContext Originally committed as revision 3410 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est_template.c')
-rw-r--r--libavcodec/motion_est_template.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c
index b5ee885730..db7c2a4cbc 100644
--- a/libavcodec/motion_est_template.c
+++ b/libavcodec/motion_est_template.c
@@ -851,15 +851,13 @@ static always_inline int diamond_search(MpegEncContext * s, int *best, int dmin,
static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
- int ref_mv_scale, int flags)
+ int ref_mv_scale, int flags, int size, int h)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d, dmin;
int map_generation;
const int penalty_factor= c->penalty_factor;
- const int size=0;
- const int h=16;
const int ref_mv_stride= s->mb_stride; //pass as arg FIXME
const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; //add to last_mv beforepassing FIXME
me_cmp_func cmpf, chroma_cmpf;
@@ -872,6 +870,7 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx
map_generation= update_map_generation(c);
+ assert(cmpf);
dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
map[0]= map_generation;
score_map[0]= dmin;
@@ -882,7 +881,7 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx
CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}else{
- if(dmin<256 && ( P_LEFT[0] |P_LEFT[1]
+ if(dmin<h*h && ( P_LEFT[0] |P_LEFT[1]
|P_TOP[0] |P_TOP[1]
|P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
*mx_ptr= 0;
@@ -891,7 +890,7 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx
return dmin;
}
CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
- if(dmin>256*2){
+ if(dmin>h*h*2){
CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
@@ -899,7 +898,7 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
}
}
- if(dmin>256*4){
+ if(dmin>h*h*4){
if(c->pre_pass){
CHECK_CLIPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
@@ -948,19 +947,18 @@ static always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx
}
//this function is dedicated to the braindamaged gcc
-static inline int epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr,
+inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr,
int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
- int ref_mv_scale)
+ int ref_mv_scale, int size, int h)
{
MotionEstContext * const c= &s->me;
//FIXME convert other functions in the same way if faster
- switch(c->flags){
- case 0:
- return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0);
+ if(c->flags==0 && h==16 && size==0){
+ return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0, 0, 16);
// case FLAG_QPEL:
// return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, FLAG_QPEL);
- default:
- return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, c->flags);
+ }else{
+ return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, c->flags, size, h);
}
}