Commit 03da01e4 authored by Fiona Glaser's avatar Fiona Glaser Committed by Loren Merritt

omit P/B-skip mc from macroblock_encode if the pixels haven't been overwritten since probe_skip

parent e0f13712
...@@ -424,6 +424,9 @@ struct x264_t ...@@ -424,6 +424,9 @@ struct x264_t
* 1 (non-RD only) = the DCT is still in h->dct, restore fdec and skip reconstruction. * 1 (non-RD only) = the DCT is still in h->dct, restore fdec and skip reconstruction.
* 2 (RD only) = the DCT has since been overwritten by RD; restore that too. */ * 2 (RD only) = the DCT has since been overwritten by RD; restore that too. */
int i_skip_intra; int i_skip_intra;
/* skip flag for P/B-skip motion compensation */
/* if we've already done skip MC, we don't need to do it again */
int b_skip_pbskip_mc;
struct struct
{ {
......
...@@ -340,6 +340,7 @@ static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int i_qp ) ...@@ -340,6 +340,7 @@ static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int i_qp )
a->b_fast_intra = 1; a->b_fast_intra = 1;
} }
} }
h->mb.b_skip_pbskip_mc = 0;
} }
} }
...@@ -2388,6 +2389,7 @@ void x264_macroblock_analyse( x264_t *h ) ...@@ -2388,6 +2389,7 @@ void x264_macroblock_analyse( x264_t *h )
{ {
h->mb.i_type = B_SKIP; h->mb.i_type = B_SKIP;
x264_analyse_update_cache( h, &analysis ); x264_analyse_update_cache( h, &analysis );
h->mb.b_skip_pbskip_mc = 1;
return; return;
} }
} }
...@@ -2404,6 +2406,7 @@ void x264_macroblock_analyse( x264_t *h ) ...@@ -2404,6 +2406,7 @@ void x264_macroblock_analyse( x264_t *h )
const unsigned int flags = h->param.analyse.inter; const unsigned int flags = h->param.analyse.inter;
int i_type; int i_type;
int i_partition; int i_partition;
h->mb.b_skip_pbskip_mc = 0;
x264_mb_analyse_load_costs( h, &analysis ); x264_mb_analyse_load_costs( h, &analysis );
......
...@@ -293,19 +293,21 @@ void x264_macroblock_encode_pskip( x264_t *h ) ...@@ -293,19 +293,21 @@ void x264_macroblock_encode_pskip( x264_t *h )
const int mvy = x264_clip3( h->mb.cache.mv[0][x264_scan8[0]][1], const int mvy = x264_clip3( h->mb.cache.mv[0][x264_scan8[0]][1],
h->mb.mv_min[1], h->mb.mv_max[1] ); h->mb.mv_min[1], h->mb.mv_max[1] );
/* Motion compensation XXX probably unneeded */ /* don't do pskip motion compensation if it was already done in macroblock_analyse */
h->mc.mc_luma( h->mb.pic.p_fdec[0], FDEC_STRIDE, if( !h->mb.b_skip_pbskip_mc )
h->mb.pic.p_fref[0][0], h->mb.pic.i_stride[0], {
mvx, mvy, 16, 16 ); h->mc.mc_luma( h->mb.pic.p_fdec[0], FDEC_STRIDE,
h->mb.pic.p_fref[0][0], h->mb.pic.i_stride[0],
mvx, mvy, 16, 16 );
/* Chroma MC */ h->mc.mc_chroma( h->mb.pic.p_fdec[1], FDEC_STRIDE,
h->mc.mc_chroma( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fref[0][0][4], h->mb.pic.i_stride[1],
h->mb.pic.p_fref[0][0][4], h->mb.pic.i_stride[1], mvx, mvy, 8, 8 );
mvx, mvy, 8, 8 );
h->mc.mc_chroma( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mc.mc_chroma( h->mb.pic.p_fdec[2], FDEC_STRIDE,
h->mb.pic.p_fref[0][0][5], h->mb.pic.i_stride[2], h->mb.pic.p_fref[0][0][5], h->mb.pic.i_stride[2],
mvx, mvy, 8, 8 ); mvx, mvy, 8, 8 );
}
x264_macroblock_encode_skip( h ); x264_macroblock_encode_skip( h );
} }
...@@ -346,8 +348,9 @@ void x264_macroblock_encode( x264_t *h ) ...@@ -346,8 +348,9 @@ void x264_macroblock_encode( x264_t *h )
} }
if( h->mb.i_type == B_SKIP ) if( h->mb.i_type == B_SKIP )
{ {
/* XXX motion compensation is probably unneeded */ /* don't do bskip motion compensation if it was already done in macroblock_analyse */
x264_mb_mc( h ); if( !h->mb.b_skip_pbskip_mc )
x264_mb_mc( h );
x264_macroblock_encode_skip( h ); x264_macroblock_encode_skip( h );
return; return;
} }
...@@ -705,6 +708,7 @@ int x264_macroblock_probe_skip( x264_t *h, const int b_bidir ) ...@@ -705,6 +708,7 @@ int x264_macroblock_probe_skip( x264_t *h, const int b_bidir )
} }
} }
h->mb.b_skip_pbskip_mc = 1;
return 1; return 1;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment