diff options
author | JackyChen <jackychen@google.com> | 2016-06-02 15:41:58 -0700 |
---|---|---|
committer | JackyChen <jackychen@google.com> | 2016-06-02 15:56:58 -0700 |
commit | 891dbe1e5261166d38d707a9c57795593202b58f (patch) | |
tree | ad25ef4412c75990cb9386a0e5916ec31f9a835d /vp9/encoder/vp9_encodeframe.c | |
parent | a32f3415392bda8bfc16c0a6827c42e1347a585d (diff) | |
download | libvpx-891dbe1e5261166d38d707a9c57795593202b58f.tar libvpx-891dbe1e5261166d38d707a9c57795593202b58f.tar.gz libvpx-891dbe1e5261166d38d707a9c57795593202b58f.tar.bz2 libvpx-891dbe1e5261166d38d707a9c57795593202b58f.zip |
vp9: Fix valgrind failure for short circuit on low temporal vaiance block.
Add check for actual split before using the variance of the split.
Change-Id: If0f93248be0b16d17738675d16c90516054dad2b
Diffstat (limited to 'vp9/encoder/vp9_encodeframe.c')
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 2eac53989..e3570504e 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1027,31 +1027,6 @@ static int choose_partitioning(VP9_COMP *cpi, force_split[0] = 1; } - if (cpi->sf.short_circuit_low_temp_var) { - // Set low variance flag, only for blocks >= 32x32 and if LAST_FRAME was - // selected. - if (ref_frame_partition == LAST_FRAME) { - // 64x64 - if (vt.part_variances.none.variance < (thresholds[0] >> 1)) - x->variance_low[0] = 1; - // 64x32 - if (vt.part_variances.horz[0].variance < (thresholds[0] >> 2)) - x->variance_low[1] = 1; - if (vt.part_variances.horz[1].variance < (thresholds[0] >> 2)) - x->variance_low[2] = 1; - // 32x64 - if (vt.part_variances.vert[0].variance < (thresholds[0] >> 2)) - x->variance_low[3] = 1; - if (vt.part_variances.vert[1].variance < (thresholds[0] >> 2)) - x->variance_low[4] = 1; - // 32x32 - for (i = 0; i < 4; i++) { - if (vt.split[i].part_variances.none.variance < (thresholds[1] >> 1)) - x->variance_low[i + 5] = 1; - } - } - } - // Now go through the entire structure, splitting every block size until // we get to one that's got a variance lower than our threshold. if ( mi_col + 8 > cm->mi_cols || mi_row + 8 > cm->mi_rows || @@ -1106,6 +1081,34 @@ static int choose_partitioning(VP9_COMP *cpi, } } } + + if (cpi->sf.short_circuit_low_temp_var) { + // Set low variance flag, only for blocks >= 32x32 and if LAST_FRAME was + // selected. + if (ref_frame_partition == LAST_FRAME) { + if (xd->mi[0]->sb_type == BLOCK_64X64 && + vt.part_variances.none.variance < (thresholds[0] >> 1)) { + x->variance_low[0] = 1; + } else if (xd->mi[0]->sb_type == BLOCK_64X32) { + if (vt.part_variances.horz[0].variance < (thresholds[0] >> 2)) + x->variance_low[1] = 1; + if (vt.part_variances.horz[1].variance < (thresholds[0] >> 2)) + x->variance_low[2] = 1; + } else if (xd->mi[0]->sb_type == BLOCK_32X64) { + if (vt.part_variances.vert[0].variance < (thresholds[0] >> 2)) + x->variance_low[3] = 1; + if (vt.part_variances.vert[1].variance < (thresholds[0] >> 2)) + x->variance_low[4] = 1; + } else { + // 32x32 + for (i = 0; i < 4; i++) { + if (!force_split[i + 1] && + vt.split[i].part_variances.none.variance < (thresholds[1] >> 1)) + x->variance_low[i + 5] = 1; + } + } + } + } return 0; } |