Skip to content

Commit

Permalink
Correct 8x8 MCU bug
Browse files Browse the repository at this point in the history
OK, got the bug nailed this time!
  • Loading branch information
Bodmer committed May 5, 2017
1 parent 6d59298 commit 4164a39
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "JPEGDecoder",
"version": "1.7.6",
"version": "1.7.7",
"keywords": "jpeg, jpg, decoder, TFT",
"description": "A JPEG decoder library, tested on Mega, Due and ESP8266",
"repository":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=JPEGDecoder
version=1.7.6
version=1.7.7
author=Bodmer <bodmer@anola.net>, Makoto Kurauchi, Rich Geldreich
maintainer=Bodmer
sentence= Jpeg decoder tested with Arduino Mega, Arduino Due and ESP8266 based NodeMCU 1.0
Expand Down
22 changes: 13 additions & 9 deletions src/picojpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1725,10 +1725,13 @@ static void convertCb(uint8 dstOfs)
int16 cbG, cbB;

cbG = ((cb * 88U) >> 8U) - 44U;
*pDstG++ = subAndClamp(pDstG[0], cbG);
pDstG[0] = subAndClamp(pDstG[0], cbG);

cbB = (cb + ((cb * 198U) >> 8U)) - 227U;
*pDstB++ = addAndClamp(pDstB[0], cbB);
pDstB[0] = addAndClamp(pDstB[0], cbB);

++pDstG;
++pDstB;
}
}
/*----------------------------------------------------------------------------*/
Expand All @@ -1746,11 +1749,14 @@ static void convertCr(uint8 dstOfs)
int16 crR, crG;

crR = (cr + ((cr * 103U) >> 8U)) - 179;
*pDstR++ = addAndClamp(pDstR[0], crR);
pDstR[0] = addAndClamp(pDstR[0], crR);

crG = ((cr * 183U) >> 8U) - 91;
*pDstG++ = subAndClamp(pDstG[0], crG);
}
pDstG[0] = subAndClamp(pDstG[0], crG);

++pDstR;
++pDstG;
}
}
/*----------------------------------------------------------------------------*/
static void transformBlock(uint8 mcuBlock)
Expand Down Expand Up @@ -1778,14 +1784,12 @@ static void transformBlock(uint8 mcuBlock)
}
case 1:
{
upsampleCbV(0, 0);
//convertCb(0); // Above line substituted by Bodmer
convertCb(0);
break;
}
case 2:
{
upsampleCrV(0, 0);
//convertCr(0); // Above line substituted by Bodmer
convertCr(0);
break;
}
}
Expand Down

0 comments on commit 4164a39

Please sign in to comment.