mirror of
https://github.com/l1npengtul/nokhwa.git
synced 2026-07-18 15:38:54 +00:00
preallocated elements in buffer
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user