diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-10-29 14:40:07 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-10-29 14:40:07 +0200 |
commit | 379524159c95f1c3639976ccf35f9d47cd9732ac (patch) | |
tree | a420329fa8bbb301f2d290d4813621b1c64afd12 /nihav-codec-support/src | |
parent | fa49f0616b3b7f6454ea5722f8a6d1ca38908df6 (diff) | |
download | nihav-379524159c95f1c3639976ccf35f9d47cd9732ac.tar.gz |
replace vec.truncate(0) with vec.clear()
Diffstat (limited to 'nihav-codec-support/src')
-rw-r--r-- | nihav-codec-support/src/codecs/h263/decoder.rs | 10 | ||||
-rw-r--r-- | nihav-codec-support/src/codecs/h263/mod.rs | 4 | ||||
-rw-r--r-- | nihav-codec-support/src/data/mod.rs | 2 | ||||
-rw-r--r-- | nihav-codec-support/src/vq/generic_elbg.rs | 6 |
4 files changed, 11 insertions, 11 deletions
diff --git a/nihav-codec-support/src/codecs/h263/decoder.rs b/nihav-codec-support/src/codecs/h263/decoder.rs index e1af173..bba8c04 100644 --- a/nihav-codec-support/src/codecs/h263/decoder.rs +++ b/nihav-codec-support/src/codecs/h263/decoder.rs @@ -538,16 +538,16 @@ impl H263BaseDecoder { if capacity < self.num_mb { self.obmc_blk.reserve(self.num_mb - capacity); } - self.obmc_blk.truncate(0); + self.obmc_blk.clear(); } if self.has_b { - self.mv_data.truncate(0); + self.mv_data.clear(); } let save_b_data = pinfo.mode.is_ref() && self.may_have_b_frames; if save_b_data { - self.mv_data.truncate(0); + self.mv_data.clear(); } let is_b = pinfo.mode == Type::B; @@ -580,7 +580,7 @@ impl H263BaseDecoder { let mut mb_pos = 0; let apply_acpred = /*(pinfo.mode == Type::I) && */pinfo.plusinfo.is_some() && pinfo.plusinfo.unwrap().aic; if apply_acpred { - self.pred_coeffs.truncate(0); + self.pred_coeffs.clear(); if !self.pred_quant { self.pred_coeffs.resize(self.mb_w * self.mb_h, ZERO_PRED_COEFFS); } else { @@ -796,7 +796,7 @@ impl H263BaseDecoder { recon_b_frame(b_buf, bck_buf.clone(), fwd_buf.clone(), self.mb_w, self.mb_h, self.b_data.as_slice(), bdsp); } - self.b_data.truncate(0); + self.b_data.clear(); Ok(bufinfo) } } diff --git a/nihav-codec-support/src/codecs/h263/mod.rs b/nihav-codec-support/src/codecs/h263/mod.rs index 0ddfed5..e357778 100644 --- a/nihav-codec-support/src/codecs/h263/mod.rs +++ b/nihav-codec-support/src/codecs/h263/mod.rs @@ -358,9 +358,9 @@ impl CBPInfo { fn new() -> Self { CBPInfo{ cbp: Vec::new(), q: Vec::new(), mb_w: 0 } } fn reset(&mut self, mb_w: usize) { self.mb_w = mb_w; - self.cbp.truncate(0); + self.cbp.clear(); self.cbp.resize(self.mb_w * 2, 0); - self.q.truncate(0); + self.q.clear(); self.q.resize(self.mb_w * 2, 0); } fn update_row(&mut self) { diff --git a/nihav-codec-support/src/data/mod.rs b/nihav-codec-support/src/data/mod.rs index 2ad6b8c..eba0299 100644 --- a/nihav-codec-support/src/data/mod.rs +++ b/nihav-codec-support/src/data/mod.rs @@ -54,7 +54,7 @@ impl<T:Copy> GenericCache<T> { 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); + self.data.clear(); let size = self.full_size(); self.data.resize(size, self.default); self.xpos = self.stride + 1; diff --git a/nihav-codec-support/src/vq/generic_elbg.rs b/nihav-codec-support/src/vq/generic_elbg.rs index 32cbb82..d6c30d2 100644 --- a/nihav-codec-support/src/vq/generic_elbg.rs +++ b/nihav-codec-support/src/vq/generic_elbg.rs @@ -199,7 +199,7 @@ impl<T: VQElement+Default, TS: VQElementSum<T>> ELBG<T, TS> { } // put points into the nearest clusters - indices.truncate(0); + indices.clear(); for entry in entries.iter() { let mut bestidx = 0; let mut bestdist = std::u32::MAX; @@ -230,8 +230,8 @@ impl<T: VQElement+Default, TS: VQElementSum<T>> ELBG<T, TS> { } let dmean = dist / (dst.len() as u64); - low_u.truncate(0); - high_u.truncate(0); + low_u.clear(); + high_u.clear(); let mut used = vec![false; dst.len()]; for (i, cluster) in self.clusters.iter().enumerate() { if cluster.dist < dmean { |