* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
*/
/**
- * @file motion_est_template.c
+ * @file libavcodec/motion_est_template.c
* Motion estimation template.
*/
-//lets hope gcc will remove the unused vars ...(gcc 3.2.2 seems to do it ...)
+//Let us hope gcc will remove the unused vars ...(gcc 3.2.2 seems to do it ...)
#define LOAD_COMMON\
- uint32_t attribute_unused * const score_map= c->score_map;\
- const int attribute_unused xmin= c->xmin;\
- const int attribute_unused ymin= c->ymin;\
- const int attribute_unused xmax= c->xmax;\
- const int attribute_unused ymax= c->ymax;\
+ uint32_t av_unused * const score_map= c->score_map;\
+ const int av_unused xmin= c->xmin;\
+ const int av_unused ymin= c->ymin;\
+ const int av_unused xmax= c->xmax;\
+ const int av_unused ymax= c->ymax;\
uint8_t *mv_penalty= c->current_mv_penalty;\
const int pred_x= c->pred_x;\
const int pred_y= c->pred_y;\
return hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, 2);
}
+static int full_search(MpegEncContext * s, int *best, int dmin,
+ int src_index, int ref_index, int const penalty_factor,
+ int size, int h, int flags)
+{
+ MotionEstContext * const c= &s->me;
+ me_cmp_func cmpf, chroma_cmpf;
+ LOAD_COMMON
+ LOAD_COMMON2
+ int map_generation= c->map_generation;
+ int x,y, d;
+ const int dia_size= c->dia_size&0xFF;
+
+ cmpf= s->dsp.me_cmp[size];
+ chroma_cmpf= s->dsp.me_cmp[size+1];
+
+ for(y=FFMAX(-dia_size, ymin); y<=FFMIN(dia_size,ymax); y++){
+ for(x=FFMAX(-dia_size, xmin); x<=FFMIN(dia_size,xmax); x++){
+ CHECK_MV(x, y);
+ }
+ }
+
+ x= best[0];
+ y= best[1];
+ d= dmin;
+ CHECK_CLIPPED_MV(x , y);
+ CHECK_CLIPPED_MV(x+1, y);
+ CHECK_CLIPPED_MV(x, y+1);
+ CHECK_CLIPPED_MV(x-1, y);
+ CHECK_CLIPPED_MV(x, y-1);
+ best[0]= x;
+ best[1]= y;
+
+ return d;
+}
+
#define SAB_CHECK_MV(ax,ay)\
{\
const int key= ((ay)<<ME_MAP_MV_BITS) + (ax) + map_generation;\
return sab_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
else if(c->dia_size<2)
return small_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
+ else if(c->dia_size>1024)
+ return full_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
else if(c->dia_size>768)
return umh_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
else if(c->dia_size>512)
score_map[0]= dmin;
//FIXME precalc first term below?
- if((s->pict_type == B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
+ if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
/* first line */