aboutsummaryrefslogtreecommitdiff
path: root/src/utils/segmentation_map.cc
diff options
context:
space:
mode:
authorBoyuan Yang <byang@debian.org>2022-07-14 15:56:57 -0400
committerBoyuan Yang <byang@debian.org>2022-07-14 15:56:57 -0400
commitd4dbf19f6b0181ee78034bfe4caf189d1c016998 (patch)
tree47d5d28d2ab770a10e6c48788725c51dffeb84a9 /src/utils/segmentation_map.cc
parent320ef65362608ee1148c299d8d5d7618af34e470 (diff)
downloadlibgav1-d4dbf19f6b0181ee78034bfe4caf189d1c016998.tar.gz
libgav1-d4dbf19f6b0181ee78034bfe4caf189d1c016998.tar.bz2
libgav1-d4dbf19f6b0181ee78034bfe4caf189d1c016998.zip
New upstream version 0.18.0
Diffstat (limited to 'src/utils/segmentation_map.cc')
-rw-r--r--src/utils/segmentation_map.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utils/segmentation_map.cc b/src/utils/segmentation_map.cc
index 4284ca2..bbf40c3 100644
--- a/src/utils/segmentation_map.cc
+++ b/src/utils/segmentation_map.cc
@@ -21,9 +21,12 @@
namespace libgav1 {
bool SegmentationMap::Allocate(int32_t rows4x4, int32_t columns4x4) {
+ if (rows4x4 * columns4x4 > rows4x4_ * columns4x4_) {
+ segment_id_buffer_.reset(new (std::nothrow) int8_t[rows4x4 * columns4x4]);
+ }
+
rows4x4_ = rows4x4;
columns4x4_ = columns4x4;
- segment_id_buffer_.reset(new (std::nothrow) int8_t[rows4x4_ * columns4x4_]);
if (segment_id_buffer_ == nullptr) return false;
segment_id_.Reset(rows4x4_, columns4x4_, segment_id_buffer_.get());
return true;