]> git.nihav.org Git - nihav.git/commitdiff
vp8: use safer initialisation of partition BoolCoders
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 28 Jul 2022 16:42:50 +0000 (18:42 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 5 Sep 2022 16:25:32 +0000 (18:25 +0200)
nihav-duck/src/codecs/vp8.rs

index 9a9c4ccb8902155b027dcc3c23ccd136f0544d52..de5d32ab79c9d73b6b03892b82e421f8dcfe4fa3 100644 (file)
@@ -1281,13 +1281,10 @@ impl NADecoder for VP8Decoder {
         for start in part_offs[num_partitions..].iter_mut() {
             *start = data_start;
         }
-        let mut bc_src = unsafe {
-                let mut arr: [BoolCoder; 8] = std::mem::MaybeUninit::uninit().assume_init();
-                for (bc, &off) in arr.iter_mut().zip(part_offs.iter()) {
-                    std::ptr::write(bc, BoolCoder::new(&src[off..]).unwrap());
-                }
-                arr
-            };
+        let mut bc_src = Vec::new();
+        for &off in part_offs.iter() {
+            bc_src.push(BoolCoder::new(&src[off..]).unwrap());
+        }
 
         let vinfo = NAVideoInfo::new(self.width, self.height, false, YUV420_FORMAT);
         let ret = supp.pool_u8.get_free();