/*****************************************************************************
* mvpred.c: motion vector prediction
*****************************************************************************
- * Copyright (C) 2003-2011 x264 project
+ * Copyright (C) 2003-2015 x264 project
*
* Authors: Loren Merritt <lorenm@u.washington.edu>
* Fiona Glaser <fiona@x264.com>
i++; \
}
+#define SET_IMVP(xy) \
+ if( xy >= 0 ) \
+ { \
+ int shift = 1 + MB_INTERLACED - h->mb.field[xy]; \
+ int16_t *mvp = h->mb.mvr[i_list][i_ref<<1>>shift][xy]; \
+ mvc[i][0] = mvp[0]; \
+ mvc[i][1] = mvp[1]<<1>>shift; \
+ i++; \
+ }
+
/* b_direct */
if( h->sh.i_type == SLICE_TYPE_B
&& h->mb.cache.ref[i_list][x264_scan8[12]] == i_ref )
}
/* spatial predictors */
- SET_MVP( mvr[h->mb.i_mb_left_xy[0]] );
- SET_MVP( mvr[h->mb.i_mb_top_xy] );
- SET_MVP( mvr[h->mb.i_mb_topleft_xy] );
- SET_MVP( mvr[h->mb.i_mb_topright_xy] );
+ if( SLICE_MBAFF )
+ {
+ SET_IMVP( h->mb.i_mb_left_xy[0] );
+ SET_IMVP( h->mb.i_mb_top_xy );
+ SET_IMVP( h->mb.i_mb_topleft_xy );
+ SET_IMVP( h->mb.i_mb_topright_xy );
+ }
+ else
+ {
+ SET_MVP( mvr[h->mb.i_mb_left_xy[0]] );
+ SET_MVP( mvr[h->mb.i_mb_top_xy] );
+ SET_MVP( mvr[h->mb.i_mb_topleft_xy] );
+ SET_MVP( mvr[h->mb.i_mb_topright_xy] );
+ }
+#undef SET_IMVP
#undef SET_MVP
/* temporal predictors */