diff options
author | Yaowu Xu <yaowu@google.com> | 2015-04-24 08:22:13 -0700 |
---|---|---|
committer | Yaowu Xu <yaowu@google.com> | 2015-04-24 12:34:18 -0700 |
commit | b3e411e48164cda6913b659128549858b6f69ba3 (patch) | |
tree | 3ba5f5877008783e144e7a3b7d2e63829239c46f | |
parent | 4feae6791c0da9535a1c4c347e473ebc996c9d39 (diff) | |
download | libvpx-b3e411e48164cda6913b659128549858b6f69ba3.tar.gz |
Add validation of UV partition size
For color sampling format other than 420, valid partion size in Y may
not work for UV plane. This commit adds validation of UV partition
size before select the partition choice.
This fixes a crash for real time encoding of 422 input.
Change-Id: I1fe3282accfd58625e8b5e6a4c8d2c84199751b6
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 08cb5d384..4d1964d63 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -432,11 +432,12 @@ static int set_vt_partitioning(VP9_COMP *cpi, // Check vertical split. if (mi_row + block_height / 2 < cm->mi_rows) { + BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_VERT); get_variance(&vt.part_variances->vert[0]); get_variance(&vt.part_variances->vert[1]); if (vt.part_variances->vert[0].variance < threshold && - vt.part_variances->vert[1].variance < threshold) { - BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_VERT); + vt.part_variances->vert[1].variance < threshold && + get_plane_block_size(subsize, &xd->plane[1]) < BLOCK_INVALID) { set_block_size(cpi, xd, mi_row, mi_col, subsize); set_block_size(cpi, xd, mi_row, mi_col + block_width / 2, subsize); return 1; @@ -444,11 +445,12 @@ static int set_vt_partitioning(VP9_COMP *cpi, } // Check horizontal split. if (mi_col + block_width / 2 < cm->mi_cols) { + BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_HORZ); get_variance(&vt.part_variances->horz[0]); get_variance(&vt.part_variances->horz[1]); if (vt.part_variances->horz[0].variance < threshold && - vt.part_variances->horz[1].variance < threshold) { - BLOCK_SIZE subsize = get_subsize(bsize, PARTITION_HORZ); + vt.part_variances->horz[1].variance < threshold && + get_plane_block_size(subsize, &xd->plane[1]) < BLOCK_INVALID) { set_block_size(cpi, xd, mi_row, mi_col, subsize); set_block_size(cpi, xd, mi_row + block_height / 2, mi_col, subsize); return 1; |