diff options
author | hizzlekizzle | 2020-04-26 14:11:43 -0500 |
---|---|---|
committer | GitHub | 2020-04-26 14:11:43 -0500 |
commit | a29aadf94b7aa47c59b310f1630ddc5b26dff0a9 (patch) | |
tree | 42b4e71365a8a79c618017e3adffd02c67030ccb /frontend/cspace_neon.S | |
parent | e68fbed7dafaca7b3099deb81c4cebc32f97138f (diff) | |
parent | 7aba2372d721604ae1edccb49528b3dce1491d85 (diff) | |
download | pcsx_rearmed-a29aadf94b7aa47c59b310f1630ddc5b26dff0a9.tar.gz pcsx_rearmed-a29aadf94b7aa47c59b310f1630ddc5b26dff0a9.tar.bz2 pcsx_rearmed-a29aadf94b7aa47c59b310f1630ddc5b26dff0a9.zip |
Merge pull request #405 from J-O-N/fix-neon-cspace
neon: Fixed bug where MSB of a 15-bit BGR color could corrupt green value.
Diffstat (limited to 'frontend/cspace_neon.S')
-rw-r--r-- | frontend/cspace_neon.S | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/frontend/cspace_neon.S b/frontend/cspace_neon.S index 8b201db..56ab304 100644 --- a/frontend/cspace_neon.S +++ b/frontend/cspace_neon.S @@ -27,19 +27,31 @@ FUNCTION(bgr555_to_rgb565): @ dst, src, bytes blt btr16_end64 0: pld [r1, #64*2] + @ Pulls 15-bit BGR color values (which are actually 16 bits) into q0-q3. + @ example: q0 = 0111 1110 0101 0011 vldmia r1!, {q0-q3} - vshl.u16 q8, q0, #11 - vshl.u16 q9, q1, #11 - vshl.u16 q10, q2, #11 - vshl.u16 q11, q3, #11 - vsri.u16 q8, q0, #10 - vsri.u16 q9, q1, #10 - vsri.u16 q10, q2, #10 - vsri.u16 q11, q3, #10 + @ Shift BGR color 1 bit to the left, discarding MSB and preparing for vbit. + @ MSB is used for transparency (not needed here, and can mess with green). + @ example: q0 = 1111 1100 1010 0110 vshl.u16 q0, q0, #1 vshl.u16 q1, q1, #1 vshl.u16 q2, q2, #1 vshl.u16 q3, q3, #1 + @ Places red value in left most bits, clears bits to the right. + @ example: q8 = 1001 1000 0000 0000 + vshl.u16 q8, q0, #10 + vshl.u16 q9, q1, #10 + vshl.u16 q10, q2, #10 + vshl.u16 q11, q3, #10 + @ Places blue value in right most bits, leaving bits to the left unchanged. + @ example: q8 = 1001 1000 0001 1111 + vsri.u16 q8, q0, #11 + vsri.u16 q9, q1, #11 + vsri.u16 q10, q2, #11 + vsri.u16 q11, q3, #11 + @ Sets green value from shifted BGR color by apply a mask. + @ example: q15 = 0000 0111 1100 0000 + @ q8 = 1001 1100 1001 1111 vbit q8, q0, q15 vbit q9, q1, q15 vbit q10, q2, q15 @@ -57,10 +69,10 @@ btr16_end64: @ handle the remainder (reasonably rare) 0: vld1.16 {q0}, [r1]! - vshl.u16 q1, q0, #11 - vshl.u16 q2, q0, #1 - vsri.u16 q1, q0, #10 - vbit q1, q2, q15 + vshl.u16 q0, q0, #1 + vshl.u16 q1, q0, #10 + vsri.u16 q1, q0, #11 + vbit q1, q0, q15 subs r2, r2, #16 vst1.16 {q1}, [r0]! bge 0b @@ -73,10 +85,10 @@ btr16_end16: @ very rare vld1.16 {d0}, [r1]! - vshl.u16 d1, d0, #11 - vshl.u16 d2, d0, #1 - vsri.u16 d1, d0, #10 - vbit d1, d2, d30 + vshl.u16 d0, d0, #1 + vshl.u16 d1, d0, #10 + vsri.u16 d1, d0, #11 + vbit d1, d0, d30 vst1.16 {d1}, [r0]! bx lr |