another cool effect

This commit is contained in:
l1npengtul
2022-11-18 08:25:36 -08:00
parent 666e34e47d
commit 035ef8b72f
2 changed files with 8 additions and 4 deletions
+3
View File
@@ -84,3 +84,6 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
*.png
*.jpg
*.jpeg
+5 -4
View File
@@ -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];