From 855a71dfda9fb2620ae5567a5bb0897aa4fc0d47 Mon Sep 17 00:00:00 2001 From: Marco Paniconi Date: Fri, 8 Mar 2019 21:00:48 -0800 Subject: [PATCH] vp9-screen: Rework the mode skip logic for screen Don't force skip of zero-golden reference when zero_temp_sad_source = 0, as it be may the inter-layer reference. And remove the flatness conditon when superblock is static. Change-Id: I6b4b6eac0f6a2abc862c23d0e5467c7cf61995ef --- vp9/encoder/vp9_pickmode.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 558210c60..ac9816263 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -2029,16 +2029,24 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data, if (!(cpi->ref_frame_flags & flag_list[ref_frame])) continue; - // For screen content on flat blocks: skip non-zero motion check for - // stationary blocks, only skip zero motion check for non-stationary blocks. - if (cpi->oxcf.content == VP9E_CONTENT_SCREEN && - sf->short_circuit_flat_blocks && x->source_variance == 0 && - cpi->compute_source_sad_onepass && cpi->sf.use_source_sad && - ((frame_mv[this_mode][ref_frame].as_int != 0 && - x->zero_temp_sad_source) || - (frame_mv[this_mode][ref_frame].as_int == 0 && - !x->zero_temp_sad_source))) { - continue; + // For screen content. If zero_temp_sad source is computed: skip + // non-zero motion check for stationary blocks. If the superblock is + // non-stationary then for flat blocks skip the zero last check (keep golden + // as it may be inter-layer reference). Otherwise (if zero_temp_sad_source + // is not computed) skip non-zero motion check for flat blocks. + // TODO(marpan): Compute zero_temp_sad_source per coding block. + if (cpi->oxcf.content == VP9E_CONTENT_SCREEN) { + if (cpi->compute_source_sad_onepass && cpi->sf.use_source_sad) { + if ((frame_mv[this_mode][ref_frame].as_int != 0 && + x->zero_temp_sad_source) || + (frame_mv[this_mode][ref_frame].as_int == 0 && + x->source_variance == 0 && ref_frame == LAST_FRAME && + !x->zero_temp_sad_source)) + continue; + } else if (frame_mv[this_mode][ref_frame].as_int != 0 && + x->source_variance == 0) { + continue; + } } if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode))) continue; -- 2.40.0