Skip to content

Commit e8e99cd

Browse files
Laurence BankLaurence Bank
authored andcommitted
Fixed S3 SIMD RGBX8888 output
1 parent bbcca1d commit e8e99cd

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/jpeg.inl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3133,15 +3133,15 @@ static void JPEGPixelRGB(uint32_t *pDest, int iY, int iCb, int iCr)
31333133
i32 = ((iCBB + iY) >> 12);
31343134
if (i32 < 0) i32 = 0;
31353135
else if (i32 > 255) i32 = 255;
3136-
u32Pixel |= (uint32_t)i32; // blue
3136+
u32Pixel |= (uint32_t)(i32<<16); // blue
31373137
i32 = ((iCBG + iCRG + iY) >> 12); // green pixel
31383138
if (i32 < 0) i32 = 0;
31393139
else if (i32 > 255) i32 = 255;
31403140
u32Pixel |= (uint32_t)(i32 << 8);
31413141
i32 = ((iCRR + iY) >> 12); // red pixel
31423142
if (i32 < 0) i32 = 0;
31433143
else if (i32 > 255) i32 = 255;
3144-
u32Pixel |= (uint32_t)(i32 << 16);
3144+
u32Pixel |= (uint32_t)(i32);
31453145
pDest[0] = u32Pixel;
31463146
} /* JPEGPixelRGB() */
31473147

@@ -3221,28 +3221,28 @@ static void JPEGPixel2RGB(uint32_t *pDest, int32_t iY1, int32_t iY2, int32_t iCb
32213221
if (i32 < 0) i32 = 0;
32223222
else if (i32 > 255) i32 = 255;
32233223
u32Pixel1 = u32Pixel2 = 0xff000000; // Alpha = 255
3224-
u32Pixel1 |= (uint32_t)i32; // blue
3224+
u32Pixel1 |= (uint32_t)(i32<<16); // blue
32253225
i32 = ((iCBG + iCRG + iY1) >> 12); // green pixel
32263226
if (i32 < 0) i32 = 0;
32273227
else if (i32 > 255) i32 = 255;
32283228
u32Pixel1 |= (uint32_t)(i32 << 8); // green
32293229
i32 = ((iCRR + iY1) >> 12); // red pixel
32303230
if (i32 < 0) i32 = 0;
32313231
else if (i32 > 255) i32 = 255;
3232-
u32Pixel1 |= (uint32_t)(i32 << 16); // red
3232+
u32Pixel1 |= (uint32_t)i32; // red
32333233

32343234
i32 = ((iCBB + iY2) >> 12); // blue pixel
32353235
if (i32 < 0) i32 = 0;
32363236
else if (i32 > 255) i32 = 255;
3237-
u32Pixel2 |= (uint32_t)i32;
3237+
u32Pixel2 |= (uint32_t)(i32<<16);
32383238
i32 = ((iCBG + iCRG + iY2) >> 12); // green pixel
32393239
if (i32 < 0) i32 = 0;
32403240
else if (i32 > 255) i32 = 255;
32413241
u32Pixel2 |= (uint32_t)(i32 << 8);
32423242
i32 = ((iCRR + iY2) >> 12); // red pixel
32433243
if (i32 < 0) i32 = 0;
32443244
else if (i32 > 255) i32 = 255;
3245-
u32Pixel2 |= (uint32_t)(i32 << 16);
3245+
u32Pixel2 |= (uint32_t)i32;
32463246
pDest[0] = u32Pixel1;
32473247
pDest[1] = u32Pixel2;
32483248
} /* JPEGPixel2RGB() */

src/s3_simd_420.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
ee.vzip.16 q7,q2 # create RGB8888 pixels
118118
ee.vst.128.ip q7,a5,16 # store 8 x RGB8888 pixels = 32 bytes
119119
ee.vst.128.ip q2,a5,16
120-
addi.n a6,a6,-16 # restore pointer to start of 16-bit constants
120+
addi.n a6,a6,-12 # restore pointer to start of 16-bit constants
121121
ee.vld.l.64.ip q0,a2,0 # load right 8 Y values into Q0
122122
ee.movi.32.q q1,a3,0 # restore second 4 values of Cb
123123
ee.movi.32.q q2,a4,0 # restore second 4 values of Cr

0 commit comments

Comments
 (0)