Skip to content

Commit

Permalink
Fix Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannik Schleicher committed Dec 11, 2024
1 parent 8d0a6da commit c8ef3ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion openh264/src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@ impl DecodedYUV<'_> {
target.len()
);

if dim.0 % 8 == 0 {
// for f32x8 math, image needs to:
// - have a width divisible by 8
// - have at least two rows
if dim.0 % 8 == 0 && dim.1 >= 2 {
Self::write_rgb8_f32x8(self.y, self.u, self.v, dim, strides, target);
} else {
Self::write_rgb8_scalar(self.y, self.u, self.v, dim, strides, target);
Expand Down
8 changes: 4 additions & 4 deletions openh264/src/formats/yuv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,18 @@ mod tests {
/// Test every YUV value and see, if the SIMD version delivers a similar RGB value.
#[test]
fn test_write_rgb8_f32x8_spectrum() {
let dim = (8, 1);
let dim = (8, 2);
let strides = (8, 4, 4);

// build artificial YUV planes containing the entire YUV spectrum
for y in 0..=255u8 {
for u in 0..=255u8 {
for v in 0..=255u8 {
let (y_plane, u_plane, v_plane) = (vec![y; 8], vec![u; 4], vec![v; 4]);
let mut target = vec![0; dim.0 * 3];
let (y_plane, u_plane, v_plane) = (vec![y; 16], vec![u; 4], vec![v; 4]);
let mut target = vec![0; dim.0 * dim.1 * 3];
crate::decoder::DecodedYUV::write_rgb8_scalar(&y_plane, &u_plane, &v_plane, dim, strides, &mut target);

let mut target2 = vec![0; dim.0 * 3];
let mut target2 = vec![0; dim.0 * dim.1 * 3];
crate::decoder::DecodedYUV::write_rgb8_f32x8(&y_plane, &u_plane, &v_plane, dim, strides, &mut target2);

// compare first pixel
Expand Down

0 comments on commit c8ef3ab

Please sign in to comment.