summaryrefslogtreecommitdiff
path: root/vp9/encoder
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2016-01-31 22:24:55 -0800
committerMarco <marpan@google.com>2016-01-31 22:29:51 -0800
commit9b24251c9139f5f5213a4a0e94c33ad57fb20617 (patch)
treeceae133062e5284446e410910209c489e18edf37 /vp9/encoder
parent6a94d6ad8ed853225e0b19a6a5a68f60ae88495c (diff)
downloadlibvpx-9b24251c9139f5f5213a4a0e94c33ad57fb20617.tar
libvpx-9b24251c9139f5f5213a4a0e94c33ad57fb20617.tar.gz
libvpx-9b24251c9139f5f5213a4a0e94c33ad57fb20617.tar.bz2
libvpx-9b24251c9139f5f5213a4a0e94c33ad57fb20617.zip
vp9-noise estimate: Put check to avoid possible out of bounds.
Put check to avoid possible out of bounds when looping over the blocks to estimate noise level. No change in behavior. Change-Id: I4b7b19b7edee0ae1c35b9dc0700b1bf9b304d7f5
Diffstat (limited to 'vp9/encoder')
-rw-r--r--vp9/encoder/vp9_noise_estimate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c
index b1a261986..e56cc9b01 100644
--- a/vp9/encoder/vp9_noise_estimate.c
+++ b/vp9/encoder/vp9_noise_estimate.c
@@ -162,7 +162,9 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) {
// 16x16 blocks, 1/4 sample of frame.
- if (mi_row % 4 == 0 && mi_col % 4 == 0) {
+ if (mi_row % 4 == 0 && mi_col % 4 == 0 &&
+ mi_row < cm->mi_rows - 1 &&
+ mi_col < cm->mi_cols - 1) {
int bl_index = mi_row * cm->mi_cols + mi_col;
int bl_index1 = bl_index + 1;
int bl_index2 = bl_index + cm->mi_cols;