preallocated elements in buffer

This commit is contained in:
Starccy
2022-05-11 13:49:05 +08:00
committed by l1npengtul
parent a663010bb3
commit 878ee012ed
+1 -1
View File
@@ -1232,7 +1232,7 @@ pub fn yuyv422_to_rgb(data: &[u8], rgba: bool) -> Result<Vec<u8>, NokhwaError> {
// yuyv yields 2 3-byte pixels per yuyv chunk
let rgb_buf_size = (data.len() / 4) * (2 * pixel_size);
let mut dest = Vec::with_capacity(rgb_buf_size);
let mut dest = vec![0; rgb_buf_size];
buf_yuyv422_to_rgb(data, &mut dest, rgba)?;
Ok(dest)