Open nintha opened 3 years ago
I try to use this lib to convert png image, but the output yuv file down half color is wrong.
I use ffplay to display yuv file.
Luckily, i find some way to fix it. Comments is origin code.
pub fn convert_rgb_to_yuv420p(img: &[u8], width: u32, height: u32, bytes_per_pixel: usize) -> Vec<u8> { convert_rgb_to_yuv420(img, width, height, bytes_per_pixel, |yuv, uv_index, chroma_size, u, v| { yuv[*uv_index] = u; yuv[*uv_index + chroma_size] = v; // yuv[*uv_index + (f32::ceil(chroma_size as f32 / 2.0) as usize)] = v; *uv_index += 1; }) }
I just ran into the same issue.
I try to use this lib to convert png image, but the output yuv file down half color is wrong.
I use ffplay to display yuv file.
Luckily, i find some way to fix it. Comments is origin code.