fix: 完善 libyuv 静态库构建

This commit is contained in:
mofeng-git
2026-07-17 23:25:04 +08:00
parent 79b6683817
commit 563c808836
2 changed files with 68 additions and 36 deletions

View File

@@ -1088,17 +1088,17 @@ pub fn bgr24_to_nv12(src: &[u8], dst: &mut [u8], width: i32, height: i32) -> Res
#[cfg(not(windows))]
{
let y_size = w * h;
call_yuv!(RGB24ToNV12(
src.as_ptr(),
width * 3,
dst.as_mut_ptr(),
width,
dst[y_size..].as_mut_ptr(),
width,
width,
height,
))
let y_size = w * h;
call_yuv!(RGB24ToNV12(
src.as_ptr(),
width * 3,
dst.as_mut_ptr(),
width,
dst[y_size..].as_mut_ptr(),
width,
width,
height,
))
}
}
@@ -1391,4 +1391,15 @@ mod tests {
assert_eq!(converter.dimensions(), (8, 8));
assert_eq!(converter.nv12_buffer().len(), nv12_size(8, 8));
}
#[test]
fn test_bgr24_to_nv12() {
let src = [0u8; 2 * 2 * 3];
let mut dst = [0xffu8; 2 * 2 * 3 / 2];
bgr24_to_nv12(&src, &mut dst, 2, 2).unwrap();
assert_eq!(&dst[..4], &[16, 16, 16, 16]);
assert_eq!(&dst[4..], &[128, 128]);
}
}