X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fmotion_est%2Ffilter_motion_est.c;h=734f048f33f268a0ce4910bc0152fc4539022f9f;hb=3d366fcfb46c1ae8ae3e38e15012edb6affd9828;hp=1b0058d3867e0c975001fe67431ba34f0b30e1be;hpb=f4bb8619271de912e431dbaf5a4a7eb197b9ed04;p=melted diff --git a/src/modules/motion_est/filter_motion_est.c b/src/modules/motion_est/filter_motion_est.c index 1b0058d..734f048 100644 --- a/src/modules/motion_est/filter_motion_est.c +++ b/src/modules/motion_est/filter_motion_est.c @@ -3,7 +3,7 @@ * /author Zachary Drew, Copyright 2005 * * Currently only uses Gamma data for comparisonon (bug or feature?) - * Vector optimization coming soon. + * SSE optimized where available. * * Vector orientation: The vector data that is generated for the current frame specifies * the motion from the previous frame to the current frame. To know how a macroblock @@ -34,7 +34,9 @@ #include #include +#ifndef __DARWIN__ #include "sad_sse.h" +#endif #define NDEBUG #include @@ -51,8 +53,6 @@ #define ABS(a) ((a) >= 0 ? (a) : (-(a))) -typedef struct motion_vector_s motion_vector; - struct motion_est_context_s { int initialized; // true if filter has been initialized @@ -160,7 +160,7 @@ inline static int constrain( int *x, int *y, int *w, int *h, /** /brief Reference Sum of Absolute Differences comparison function * */ -inline static int sad_reference( uint8_t *block1, uint8_t *block2, const int xstride, const int ystride, const int w, const int h ) +static int sad_reference( uint8_t *block1, uint8_t *block2, const int xstride, const int ystride, const int w, const int h ) { int i, j, score = 0; for ( j = 0; j < h; j++ ){ @@ -290,6 +290,8 @@ static inline void diamond_search( // Keep track of best and former best candidates motion_vector best, former; + former.dx = 0; + former.dy = 0; // The direction of the refinement needs to be known motion_vector current; @@ -610,7 +612,9 @@ static void motion_search( uint8_t *from, //mb_w){ +#ifndef __DARWIN__ case 4: if(c->mb_h == 4) c->compare_optimized = sad_sse_422_luma_4x4; else c->compare_optimized = sad_sse_422_luma_4w; break; @@ -666,6 +671,7 @@ static void init_optimizations( struct motion_est_context_s *c ) break; case 64: c->compare_optimized = sad_sse_422_luma_64w; break; +#endif default: c->compare_optimized = sad_reference; break; } @@ -1033,6 +1039,10 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "motion_est.macroblock_width", c->mb_w ); mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "motion_est.macroblock_height", c->mb_h ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "motion_est.left_mb", c->left_mb ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "motion_est.right_mb", c->right_mb ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "motion_est.top_mb", c->top_mb ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "motion_est.bottom_mb", c->bottom_mb ); #ifdef BENCHMARK struct timeval finish; gettimeofday(&finish, NULL ); int difference = (finish.tv_sec - start.tv_sec) * 1000000 + (finish.tv_usec - start.tv_usec);