From b9a72d3c4d755d0c99b9cdce92ff8b319a92e74d Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 30 Apr 2015 11:39:02 -0700 Subject: [PATCH] Allow for H and V intra modes for non-rd mode. For non-rd mode (speed >=5): use mask based on prediction block size, and (for non-screen content mode) allow for checking horiz and vert intra modes for blocks sizes < 16x16. Avg psnr/ssim metrics go up by about ~0.2%. Only allowing H/V intra on block sizes below 16x16 for now, to keep encoding time increase very small, and also when allowing H/V on 16x16 blocks, metrics went down on a few clips which need to be further examined. Change-Id: I8ae0bc8cb2a964f9709612c76c5661acaab1381e --- vp9/encoder/vp9_pickmode.c | 2 +- vp9/encoder/vp9_speed_features.c | 12 ++++++++---- vp9/encoder/vp9_speed_features.h | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index c32a0dfcd..57bce3a23 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -1489,7 +1489,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, for (i = 0; i < 4; ++i) { const PREDICTION_MODE this_mode = intra_mode_list[i]; - if (!((1 << this_mode) & cpi->sf.intra_y_mode_mask[intra_tx_size])) + if (!((1 << this_mode) & cpi->sf.intra_y_mode_bsize_mask[bsize])) continue; mbmi->mode = this_mode; mbmi->ref_frame[0] = INTRA_FRAME; diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index 4c5ba5df3..31db990f1 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -318,11 +318,15 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf, if (!is_keyframe) { int i; if (content == VP9E_CONTENT_SCREEN) { - for (i = 0; i < TX_SIZES; ++i) - sf->intra_y_mode_mask[i] = INTRA_DC_TM_H_V; + for (i = 0; i < BLOCK_SIZES; ++i) + sf->intra_y_mode_bsize_mask[i] = INTRA_DC_TM_H_V; } else { - for (i = 0; i < TX_SIZES; i++) - sf->intra_y_mode_mask[i] = INTRA_DC; + for (i = 0; i < BLOCK_SIZES; ++i) + if (i >= BLOCK_16X16) + sf->intra_y_mode_bsize_mask[i] = INTRA_DC; + else + // Use H and V intra mode for block sizes <= 16X16. + sf->intra_y_mode_bsize_mask[i] = INTRA_DC_H_V; } } } diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h index 8722d9cec..b9a506f4f 100644 --- a/vp9/encoder/vp9_speed_features.h +++ b/vp9/encoder/vp9_speed_features.h @@ -340,6 +340,10 @@ typedef struct SPEED_FEATURES { int intra_y_mode_mask[TX_SIZES]; int intra_uv_mode_mask[TX_SIZES]; + // These bit masks allow you to enable or disable intra modes for each + // prediction block size separately. + int intra_y_mode_bsize_mask[BLOCK_SIZES]; + // This variable enables an early break out of mode testing if the model for // rd built from the prediction signal indicates a value that's much // higher than the best rd we've seen so far.