From: Kostya Shishkov Date: Sat, 5 Dec 2020 09:25:05 +0000 (+0100) Subject: codec_support/data: fix GenericCache internal size X-Git-Url: https://git.nihav.org/?p=nihav.git;a=commitdiff_plain;h=ed2bdcd95043c7fb9860c67a4e32466acbb61124 codec_support/data: fix GenericCache internal size --- diff --git a/nihav-codec-support/src/data/mod.rs b/nihav-codec-support/src/data/mod.rs index b8980f2..2ad6b8c 100644 --- a/nihav-codec-support/src/data/mod.rs +++ b/nihav-codec-support/src/data/mod.rs @@ -44,14 +44,14 @@ impl GenericCache { stride, height, xpos: 0, - data: Vec::with_capacity((height + 1) * stride), + data: Vec::with_capacity((height + 1) * stride + 1), default, }; ret.reset(); ret } /// Reports the total amount of elements stored. - pub fn full_size(&self) -> usize { self.stride * (self.height + 1) } + pub fn full_size(&self) -> usize { self.stride * (self.height + 1) + 1 } /// Resets the cache state. pub fn reset(&mut self) { self.data.truncate(0);