[x264-devel] Scale interlaced refs/mvs for mvr predictors
Loren Merritt
git at videolan.org
Wed Aug 24 22:40:21 CEST 2011
x264 | branch: master | Loren Merritt <pengvado at akuvian.org> | Fri Aug 12 02:15:46 2011 +0000| [b581755785751a4c05db0dcb020d5daff278cfe0] | committer: Jason Garrett-Glaser
Scale interlaced refs/mvs for mvr predictors
Slightly improves compression and fixes a Valgrind error.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=b581755785751a4c05db0dcb020d5daff278cfe0
---
common/mvpred.c | 29 +++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/common/mvpred.c b/common/mvpred.c
index f741136..8409bbc 100644
--- a/common/mvpred.c
+++ b/common/mvpred.c
@@ -527,6 +527,16 @@ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[
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 )
@@ -550,10 +560,21 @@ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[
}
/* 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 */
More information about the x264-devel
mailing list