mirror of
https://github.com/l1npengtul/nokhwa.git
synced 2026-07-15 22:48:52 +00:00
another cool effect
This commit is contained in:
@@ -84,3 +84,6 @@ fabric.properties
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
*.png
|
||||
*.jpg
|
||||
*.jpeg
|
||||
|
||||
@@ -1782,6 +1782,8 @@ pub fn buf_nv12_to_rgb(
|
||||
});
|
||||
}
|
||||
|
||||
let rgba_size = if rgba { 4 } else { 3 };
|
||||
|
||||
let y_section = (resolution.width() * resolution.height()) as usize;
|
||||
|
||||
for (idx, row) in data[0..y_section]
|
||||
@@ -1794,13 +1796,12 @@ pub fn buf_nv12_to_rgb(
|
||||
let y1 = block[1];
|
||||
// determine the u and v
|
||||
let block_offset_idx = y_section + (true_idx * resolution.height() as usize) + cidx * 2;
|
||||
let offset_idx = idx * resolution.height() as usize * (if rgba { 4 } else { 3 })
|
||||
+ cidx * 2 * (if rgba { 4 } else { 3 });
|
||||
let offset_idx = idx * resolution.height() as usize * rgba_size + cidx * 2 * rgba_size;
|
||||
let u = data[block_offset_idx];
|
||||
let v = data[block_offset_idx + 1];
|
||||
if rgba {
|
||||
let px0 = yuyv444_to_rgba(y0 as i32, u as i32, v as i32);
|
||||
let px1 = yuyv444_to_rgba(y1 as i32, u as i32, v as i32);
|
||||
let px0 = yuyv444_to_rgba(y0 as i32, v as i32, u as i32);
|
||||
let px1 = yuyv444_to_rgba(y1 as i32, v as i32, u as i32);
|
||||
out[offset_idx] = px0[0];
|
||||
out[offset_idx + 1] = px0[1];
|
||||
out[offset_idx + 2] = px0[2];
|
||||
|
||||
Reference in New Issue
Block a user