Skip to content
Snippets Groups Projects

Support for SIMD operations for RGG1555

Merged João Magalhães requested to merge joamag/simd into master
+ 16
0
@@ -2095,6 +2095,18 @@ impl Ppu {
///
/// This method should provide the same results as the SIMD implementation.
pub fn rgb888_to_rgb1555_scalar(rgb888_pixels: &[u8], rgb1555_pixels: &mut [u8]) {
assert!(
rgb888_pixels.len() % 3 == 0,
"Length of rgb888_pixels must be a multiple of 3"
);
assert!(
rgb1555_pixels.len() % 2 == 0,
"Length of rgb1555_pixels must be a multiple of 2"
);
assert!(
rgb888_pixels.len() / 3 == rgb1555_pixels.len() / 2,
"Length of rgb1555_pixels must be two thirds the length of rgb888_pixels"
);
for index in 0..rgb888_pixels.len() / RGB_SIZE {
let (r, g, b) = (
rgb888_pixels[index * RGB_SIZE],
@@ -2132,6 +2144,10 @@ impl Ppu {
rgb1555_pixels.len() % 2 == 0,
"Length of rgb1555_pixels must be a multiple of 2"
);
assert!(
rgb888_pixels.len() / 3 == rgb1555_pixels.len() / 2,
"Length of rgb1555_pixels must be two thirds the length of rgb888_pixels"
);
let num_pixels = rgb888_pixels.len() / 3;
let simd_chunks = num_pixels / SIMD_WIDTH;
Loading