Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions src/row/arch/neon/tests/v210.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ fn check_rgb(width: usize, matrix: ColorMatrix, full_range: bool) {
let p = pseudo_random_v210_words(width.div_ceil(6), 0xAA55);
let mut s = std::vec![0u8; width * 3];
let mut k = std::vec![0u8; width * 3];
scalar::v210_to_rgb_or_rgba_row::<false>(&p, &mut s, width, matrix, full_range);
scalar::v210_to_rgb_or_rgba_row::<false, false>(&p, &mut s, width, matrix, full_range);
unsafe {
v210_to_rgb_or_rgba_row::<false>(&p, &mut k, width, matrix, full_range);
v210_to_rgb_or_rgba_row::<false, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s, k,
Expand All @@ -40,9 +40,9 @@ fn check_rgba(width: usize, matrix: ColorMatrix, full_range: bool) {
let p = pseudo_random_v210_words(width.div_ceil(6), 0xAA55);
let mut s = std::vec![0u8; width * 4];
let mut k = std::vec![0u8; width * 4];
scalar::v210_to_rgb_or_rgba_row::<true>(&p, &mut s, width, matrix, full_range);
scalar::v210_to_rgb_or_rgba_row::<true, false>(&p, &mut s, width, matrix, full_range);
unsafe {
v210_to_rgb_or_rgba_row::<true>(&p, &mut k, width, matrix, full_range);
v210_to_rgb_or_rgba_row::<true, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s, k,
Expand All @@ -54,9 +54,9 @@ fn check_rgb_u16(width: usize, matrix: ColorMatrix, full_range: bool) {
let p = pseudo_random_v210_words(width.div_ceil(6), 0xAA55);
let mut s = std::vec![0u16; width * 3];
let mut k = std::vec![0u16; width * 3];
scalar::v210_to_rgb_u16_or_rgba_u16_row::<false>(&p, &mut s, width, matrix, full_range);
scalar::v210_to_rgb_u16_or_rgba_u16_row::<false, false>(&p, &mut s, width, matrix, full_range);
unsafe {
v210_to_rgb_u16_or_rgba_u16_row::<false>(&p, &mut k, width, matrix, full_range);
v210_to_rgb_u16_or_rgba_u16_row::<false, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s, k,
Expand All @@ -68,9 +68,9 @@ fn check_rgba_u16(width: usize, matrix: ColorMatrix, full_range: bool) {
let p = pseudo_random_v210_words(width.div_ceil(6), 0xAA55);
let mut s = std::vec![0u16; width * 4];
let mut k = std::vec![0u16; width * 4];
scalar::v210_to_rgb_u16_or_rgba_u16_row::<true>(&p, &mut s, width, matrix, full_range);
scalar::v210_to_rgb_u16_or_rgba_u16_row::<true, false>(&p, &mut s, width, matrix, full_range);
unsafe {
v210_to_rgb_u16_or_rgba_u16_row::<true>(&p, &mut k, width, matrix, full_range);
v210_to_rgb_u16_or_rgba_u16_row::<true, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s, k,
Expand All @@ -82,9 +82,9 @@ fn check_luma(width: usize) {
let p = pseudo_random_v210_words(width.div_ceil(6), 0xC001);
let mut s = std::vec![0u8; width];
let mut k = std::vec![0u8; width];
scalar::v210_to_luma_row(&p, &mut s, width);
scalar::v210_to_luma_row::<false>(&p, &mut s, width);
unsafe {
v210_to_luma_row(&p, &mut k, width);
v210_to_luma_row::<false>(&p, &mut k, width);
}
assert_eq!(s, k, "NEON v210→luma diverges (width={width})");
}
Expand All @@ -93,9 +93,9 @@ fn check_luma_u16(width: usize) {
let p = pseudo_random_v210_words(width.div_ceil(6), 0xC001);
let mut s = std::vec![0u16; width];
let mut k = std::vec![0u16; width];
scalar::v210_to_luma_u16_row(&p, &mut s, width);
scalar::v210_to_luma_u16_row::<false>(&p, &mut s, width);
unsafe {
v210_to_luma_u16_row(&p, &mut k, width);
v210_to_luma_u16_row::<false>(&p, &mut k, width);
}
assert_eq!(s, k, "NEON v210→luma u16 diverges (width={width})");
}
Expand Down Expand Up @@ -213,7 +213,7 @@ fn neon_v210_lane_order_per_pixel_y_and_u() {
// Part 1: Luma natural-order (u16, no shift loss)
let mut luma = std::vec![0u16; W];
unsafe {
v210_to_luma_u16_row(&packed, &mut luma, W);
v210_to_luma_u16_row::<false>(&packed, &mut luma, W);
}
let expected_luma: std::vec::Vec<u16> = (1..=W as u16).collect();
assert_eq!(luma, expected_luma, "neon v210 luma reorder bug");
Expand All @@ -222,9 +222,15 @@ fn neon_v210_lane_order_per_pixel_y_and_u() {
let mut simd_rgb = std::vec![0u8; W * 3];
let mut scalar_rgb = std::vec![0u8; W * 3];
unsafe {
v210_to_rgb_or_rgba_row::<false>(&packed, &mut simd_rgb, W, crate::ColorMatrix::Bt709, false);
v210_to_rgb_or_rgba_row::<false, false>(
&packed,
&mut simd_rgb,
W,
crate::ColorMatrix::Bt709,
false,
);
}
scalar::v210_to_rgb_or_rgba_row::<false>(
scalar::v210_to_rgb_or_rgba_row::<false, false>(
&packed,
&mut scalar_rgb,
W,
Expand Down
28 changes: 17 additions & 11 deletions src/row/arch/neon/tests/y216.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ fn check_rgb<const ALPHA: bool>(width: usize, matrix: ColorMatrix, full_range: b
let bpp = if ALPHA { 4 } else { 3 };
let mut s = std::vec![0u8; width * bpp];
let mut k = std::vec![0u8; width * bpp];
scalar::y216_to_rgb_or_rgba_row::<ALPHA>(&p, &mut s, width, matrix, full_range);
scalar::y216_to_rgb_or_rgba_row::<ALPHA, false>(&p, &mut s, width, matrix, full_range);
unsafe {
y216_to_rgb_or_rgba_row::<ALPHA>(&p, &mut k, width, matrix, full_range);
y216_to_rgb_or_rgba_row::<ALPHA, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s,
Expand All @@ -32,9 +32,9 @@ fn check_rgb_u16<const ALPHA: bool>(width: usize, matrix: ColorMatrix, full_rang
let bpp = if ALPHA { 4 } else { 3 };
let mut s = std::vec![0u16; width * bpp];
let mut k = std::vec![0u16; width * bpp];
scalar::y216_to_rgb_u16_or_rgba_u16_row::<ALPHA>(&p, &mut s, width, matrix, full_range);
scalar::y216_to_rgb_u16_or_rgba_u16_row::<ALPHA, false>(&p, &mut s, width, matrix, full_range);
unsafe {
y216_to_rgb_u16_or_rgba_u16_row::<ALPHA>(&p, &mut k, width, matrix, full_range);
y216_to_rgb_u16_or_rgba_u16_row::<ALPHA, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s,
Expand All @@ -48,9 +48,9 @@ fn check_luma(width: usize) {
let p = pseudo_random_y216(width, 0xC001);
let mut s = std::vec![0u8; width];
let mut k = std::vec![0u8; width];
scalar::y216_to_luma_row(&p, &mut s, width);
scalar::y216_to_luma_row::<false>(&p, &mut s, width);
unsafe {
y216_to_luma_row(&p, &mut k, width);
y216_to_luma_row::<false>(&p, &mut k, width);
}
assert_eq!(s, k, "NEON y216→luma diverges (width={width})");
}
Expand All @@ -59,9 +59,9 @@ fn check_luma_u16(width: usize) {
let p = pseudo_random_y216(width, 0xC001);
let mut s = std::vec![0u16; width];
let mut k = std::vec![0u16; width];
scalar::y216_to_luma_u16_row(&p, &mut s, width);
scalar::y216_to_luma_u16_row::<false>(&p, &mut s, width);
unsafe {
y216_to_luma_u16_row(&p, &mut k, width);
y216_to_luma_u16_row::<false>(&p, &mut k, width);
}
assert_eq!(s, k, "NEON y216→luma u16 diverges (width={width})");
}
Expand Down Expand Up @@ -142,7 +142,7 @@ fn neon_y216_lane_order_per_pixel_y_and_u() {
// Part 1: Luma natural-order at u16
let mut luma_u16 = std::vec![0u16; W];
unsafe {
y216_to_luma_u16_row(&packed, &mut luma_u16, W);
y216_to_luma_u16_row::<false>(&packed, &mut luma_u16, W);
}
let expected_luma: std::vec::Vec<u16> = (1..=W as u16).collect();
assert_eq!(luma_u16, expected_luma, "NEON y216 luma_u16 reorder bug");
Expand All @@ -151,9 +151,15 @@ fn neon_y216_lane_order_per_pixel_y_and_u() {
let mut simd_rgb = std::vec![0u16; W * 3];
let mut scalar_rgb = std::vec![0u16; W * 3];
unsafe {
y216_to_rgb_u16_or_rgba_u16_row::<false>(&packed, &mut simd_rgb, W, ColorMatrix::Bt709, false);
y216_to_rgb_u16_or_rgba_u16_row::<false, false>(
&packed,
&mut simd_rgb,
W,
ColorMatrix::Bt709,
false,
);
}
scalar::y216_to_rgb_u16_or_rgba_u16_row::<false>(
scalar::y216_to_rgb_u16_or_rgba_u16_row::<false, false>(
&packed,
&mut scalar_rgb,
W,
Expand Down
50 changes: 27 additions & 23 deletions src/row/arch/neon/tests/y2xx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn check_y2xx_lane_order_per_pixel_y_and_u<const BITS: u32>() {
// Part 1: luma u16 natural-order (low-bit-packed: active BITS in low bits).
let mut luma_u16 = std::vec![0u16; W];
unsafe {
y2xx_n_to_luma_u16_row::<BITS>(&packed, &mut luma_u16, W);
y2xx_n_to_luma_u16_row::<BITS, false>(&packed, &mut luma_u16, W);
}
let expected_luma: std::vec::Vec<u16> = (1..=W as u16).collect();
assert_eq!(
Expand All @@ -45,15 +45,15 @@ fn check_y2xx_lane_order_per_pixel_y_and_u<const BITS: u32>() {
let mut simd_rgb = std::vec![0u16; W * 3];
let mut scalar_rgb = std::vec![0u16; W * 3];
unsafe {
y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, false>(
y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, false, false>(
&packed,
&mut simd_rgb,
W,
ColorMatrix::Bt709,
false,
);
}
scalar::y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, false>(
scalar::y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, false, false>(
&packed,
&mut scalar_rgb,
W,
Expand Down Expand Up @@ -95,9 +95,9 @@ fn check_rgb<const BITS: u32>(width: usize, matrix: ColorMatrix, full_range: boo
let p = pseudo_random_y210(width, 0xAA55);
let mut s = std::vec![0u8; width * 3];
let mut k = std::vec![0u8; width * 3];
scalar::y2xx_n_to_rgb_or_rgba_row::<BITS, false>(&p, &mut s, width, matrix, full_range);
scalar::y2xx_n_to_rgb_or_rgba_row::<BITS, false, false>(&p, &mut s, width, matrix, full_range);
unsafe {
y2xx_n_to_rgb_or_rgba_row::<BITS, false>(&p, &mut k, width, matrix, full_range);
y2xx_n_to_rgb_or_rgba_row::<BITS, false, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s, k,
Expand All @@ -109,9 +109,9 @@ fn check_rgba<const BITS: u32>(width: usize, matrix: ColorMatrix, full_range: bo
let p = pseudo_random_y210(width, 0xAA55);
let mut s = std::vec![0u8; width * 4];
let mut k = std::vec![0u8; width * 4];
scalar::y2xx_n_to_rgb_or_rgba_row::<BITS, true>(&p, &mut s, width, matrix, full_range);
scalar::y2xx_n_to_rgb_or_rgba_row::<BITS, true, false>(&p, &mut s, width, matrix, full_range);
unsafe {
y2xx_n_to_rgb_or_rgba_row::<BITS, true>(&p, &mut k, width, matrix, full_range);
y2xx_n_to_rgb_or_rgba_row::<BITS, true, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s, k,
Expand All @@ -123,9 +123,11 @@ fn check_rgb_u16<const BITS: u32>(width: usize, matrix: ColorMatrix, full_range:
let p = pseudo_random_y210(width, 0xAA55);
let mut s = std::vec![0u16; width * 3];
let mut k = std::vec![0u16; width * 3];
scalar::y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, false>(&p, &mut s, width, matrix, full_range);
scalar::y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, false, false>(
&p, &mut s, width, matrix, full_range,
);
unsafe {
y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, false>(&p, &mut k, width, matrix, full_range);
y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, false, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s, k,
Expand All @@ -137,9 +139,11 @@ fn check_rgba_u16<const BITS: u32>(width: usize, matrix: ColorMatrix, full_range
let p = pseudo_random_y210(width, 0xAA55);
let mut s = std::vec![0u16; width * 4];
let mut k = std::vec![0u16; width * 4];
scalar::y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, true>(&p, &mut s, width, matrix, full_range);
scalar::y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, true, false>(
&p, &mut s, width, matrix, full_range,
);
unsafe {
y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, true>(&p, &mut k, width, matrix, full_range);
y2xx_n_to_rgb_u16_or_rgba_u16_row::<BITS, true, false>(&p, &mut k, width, matrix, full_range);
}
assert_eq!(
s, k,
Expand All @@ -151,9 +155,9 @@ fn check_luma<const BITS: u32>(width: usize) {
let p = pseudo_random_y210(width, 0xC001);
let mut s = std::vec![0u8; width];
let mut k = std::vec![0u8; width];
scalar::y2xx_n_to_luma_row::<BITS>(&p, &mut s, width);
scalar::y2xx_n_to_luma_row::<BITS, false>(&p, &mut s, width);
unsafe {
y2xx_n_to_luma_row::<BITS>(&p, &mut k, width);
y2xx_n_to_luma_row::<BITS, false>(&p, &mut k, width);
}
assert_eq!(s, k, "NEON y2xx<{BITS}>→luma diverges (width={width})");
}
Expand All @@ -162,9 +166,9 @@ fn check_luma_u16<const BITS: u32>(width: usize) {
let p = pseudo_random_y210(width, 0xC001);
let mut s = std::vec![0u16; width];
let mut k = std::vec![0u16; width];
scalar::y2xx_n_to_luma_u16_row::<BITS>(&p, &mut s, width);
scalar::y2xx_n_to_luma_u16_row::<BITS, false>(&p, &mut s, width);
unsafe {
y2xx_n_to_luma_u16_row::<BITS>(&p, &mut k, width);
y2xx_n_to_luma_u16_row::<BITS, false>(&p, &mut k, width);
}
assert_eq!(s, k, "NEON y2xx<{BITS}>→luma u16 diverges (width={width})");
}
Expand Down Expand Up @@ -225,23 +229,23 @@ fn neon_y212_matches_scalar_widths() {
let p = pseudo_random_y212(w, 0xAA55);
let mut s = std::vec![0u8; w * 3];
let mut k = std::vec![0u8; w * 3];
scalar::y2xx_n_to_rgb_or_rgba_row::<12, false>(&p, &mut s, w, ColorMatrix::Bt709, false);
scalar::y2xx_n_to_rgb_or_rgba_row::<12, false, false>(&p, &mut s, w, ColorMatrix::Bt709, false);
unsafe {
y2xx_n_to_rgb_or_rgba_row::<12, false>(&p, &mut k, w, ColorMatrix::Bt709, false);
y2xx_n_to_rgb_or_rgba_row::<12, false, false>(&p, &mut k, w, ColorMatrix::Bt709, false);
}
assert_eq!(s, k, "NEON y2xx<12>→RGB diverges (width={w})");

let mut s_u16 = std::vec![0u16; w * 4];
let mut k_u16 = std::vec![0u16; w * 4];
scalar::y2xx_n_to_rgb_u16_or_rgba_u16_row::<12, true>(
scalar::y2xx_n_to_rgb_u16_or_rgba_u16_row::<12, true, false>(
&p,
&mut s_u16,
w,
ColorMatrix::Bt2020Ncl,
true,
);
unsafe {
y2xx_n_to_rgb_u16_or_rgba_u16_row::<12, true>(
y2xx_n_to_rgb_u16_or_rgba_u16_row::<12, true, false>(
&p,
&mut k_u16,
w,
Expand All @@ -253,17 +257,17 @@ fn neon_y212_matches_scalar_widths() {

let mut sl = std::vec![0u8; w];
let mut kl = std::vec![0u8; w];
scalar::y2xx_n_to_luma_row::<12>(&p, &mut sl, w);
scalar::y2xx_n_to_luma_row::<12, false>(&p, &mut sl, w);
unsafe {
y2xx_n_to_luma_row::<12>(&p, &mut kl, w);
y2xx_n_to_luma_row::<12, false>(&p, &mut kl, w);
}
assert_eq!(sl, kl, "NEON y2xx<12>→luma diverges (width={w})");

let mut slu = std::vec![0u16; w];
let mut klu = std::vec![0u16; w];
scalar::y2xx_n_to_luma_u16_row::<12>(&p, &mut slu, w);
scalar::y2xx_n_to_luma_u16_row::<12, false>(&p, &mut slu, w);
unsafe {
y2xx_n_to_luma_u16_row::<12>(&p, &mut klu, w);
y2xx_n_to_luma_u16_row::<12, false>(&p, &mut klu, w);
}
assert_eq!(slu, klu, "NEON y2xx<12>→luma u16 diverges (width={w})");
}
Expand Down
Loading
Loading