* 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
- *
*/
/**
//lets 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 var_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
}
+/*!
+ \param P[10][2] a list of candidate mvs to check before starting the
+ iterative search. If one of the candidates is close to the optimal mv, then
+ it takes fewer iterations. And it increases the chance that we find the
+ optimal mv.
+ */
static av_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 size, int h)
{
MotionEstContext * const c= &s->me;
- int best[2]={0, 0};
- int d, dmin;
+ int best[2]={0, 0}; /*!< x and y coordinates of the best motion vector.
+ i.e. the difference between the position of the
+ block currently being encoded and the position of
+ the block chosen to predict it from. */
+ int d; ///< the score (cmp + penalty) of any given mv
+ int dmin; /*!< the best value of d, i.e. the score
+ corresponding to the mv stored in best[]. */
int map_generation;
int penalty_factor;
const int ref_mv_stride= s->mb_stride; //pass as arg FIXME
map[0]= map_generation;
score_map[0]= dmin;
+ //FIXME precalc first term below?
+ 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 */
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)