Skip to content

Commit 01dfb76

Browse files
authored
update lib JPEGDEC to v1.8.4 (#24120)
1 parent c126fb3 commit 01dfb76

File tree

5 files changed

+82
-3
lines changed

5 files changed

+82
-3
lines changed

lib/libesp32/JPEGDEC/library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "JPEGDEC",
3-
"version": "1.8.3",
3+
"version": "1.8.4",
44
"description": "A fast JPEG library with a unique set of functions to make viewing image on microcontrollers easy. Includes fast downscaling options and the ability to view Exif embedded thumbnails. Supports baseline grayscale and color images with Huffman encoding.",
55
"repository":
66
{

lib/libesp32/JPEGDEC/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=JPEGDEC
2-
version=1.8.3
2+
version=1.8.4
33
author=Larry Bank
44
maintainer=Larry Bank
55
sentence=Optimized JPEG decoder for MCUs with 32K+ RAM.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CFLAGS=-ggdb -D__LINUX__ -Wall -O2 -I../../
2+
LIBS=-g -lJPEGDEC
3+
4+
all: jpeg_perf_test
5+
6+
jpeg_perf_test: main.o
7+
$(CXX) main.o $(LIBS) -o jpeg_perf_test
8+
9+
main.o: main.cpp
10+
$(CXX) $(CFLAGS) -c main.cpp
11+
12+
clean:
13+
rm -rf *.o jpeg_perf_test
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//
2+
// Perf Test
3+
//
4+
#include <JPEGDEC.h>
5+
#include <time.h>
6+
#include "../../../test_images/tulips.h" // 640x480 56k byte test image
7+
JPEGDEC jpeg;
8+
9+
long micros(void)
10+
{
11+
int iTime;
12+
struct timespec res;
13+
14+
clock_gettime(CLOCK_MONOTONIC, &res);
15+
iTime = 1000000*res.tv_sec + res.tv_nsec/1000;
16+
17+
return (long)iTime;
18+
} /* micros() */
19+
20+
int JPEGDraw(JPEGDRAW *pDraw)
21+
{
22+
// do nothing
23+
return 1; // continue decode
24+
} /* JPEGDraw() */
25+
26+
int main(int argc, char *argv[]) {
27+
long lTime;
28+
29+
if (jpeg.openFLASH((uint8_t *)tulips, sizeof(tulips), JPEGDraw)) {
30+
lTime = micros();
31+
if (jpeg.decode(0,0,0)) { // full sized decode
32+
lTime = micros() - lTime;
33+
printf("full sized decode in %d us\n", (int)lTime);
34+
}
35+
jpeg.close();
36+
}
37+
if (jpeg.openFLASH((uint8_t *)tulips, sizeof(tulips), JPEGDraw)) {
38+
lTime = micros();
39+
if (jpeg.decode(0,0,JPEG_SCALE_HALF)) { // 1/2 sized decode
40+
lTime = micros() - lTime;
41+
printf("half sized decode in %d us\n", (int)lTime);
42+
}
43+
jpeg.close();
44+
}
45+
if (jpeg.openFLASH((uint8_t *)tulips, sizeof(tulips), JPEGDraw)) {
46+
lTime = micros();
47+
if (jpeg.decode(0,0,JPEG_SCALE_QUARTER)) { // 1/4 sized decode
48+
lTime = micros() - lTime;
49+
printf("quarter sized decode in %d us\n", (int)lTime);
50+
}
51+
jpeg.close();
52+
}
53+
if (jpeg.openFLASH((uint8_t *)tulips, sizeof(tulips), JPEGDraw)) {
54+
lTime = micros();
55+
if (jpeg.decode(0,0,JPEG_SCALE_EIGHTH)) { // 1/8 sized decode
56+
lTime = micros() - lTime;
57+
printf("eighth sized decode in %d us\n", (int)lTime);
58+
}
59+
jpeg.close();
60+
}
61+
return 0;
62+
} /* main() */

lib/libesp32/JPEGDEC/src/jpeg.inl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3766,6 +3766,7 @@ static void JPEGPutMCU22(JPEGIMAGE *pJPEG, int x, int iPitch)
37663766
#endif // ESP32S3_SIMD
37673767

37683768
#ifdef HAS_NEON
3769+
if (x+8 <= iPitch && (iPitch & 15) == 0) { // only for non-clipped MCUs
37693770
if (pJPEG->ucPixelType == RGB8888) {
37703771
int8x8_t i88Cr, i88Cb;
37713772
uint8x16_t u816YL, u816YR;
@@ -3998,6 +3999,7 @@ static void JPEGPutMCU22(JPEGIMAGE *pJPEG, int x, int iPitch)
39983999
} // for each row
39994000
return;
40004001
} // 16bpp
4002+
} // not clipped
40014003
#endif // HAS_NEON
40024004

40034005
#ifdef HAS_SSE
@@ -5124,7 +5126,9 @@ static int DecodeJPEG(JPEGIMAGE *pJPEG)
51245126
}
51255127
for (x = 0; x < cx && bContinue && iErr == 0; x++)
51265128
{
5127-
pJPEG->usPixels = &pAlignedPixels[iDMAOffset]; // make sure output is correct offset for DMA
5129+
if (pJPEG->pFramebuffer == NULL) {
5130+
pJPEG->usPixels = &pAlignedPixels[iDMAOffset]; // make sure output is correct offset for DMA
5131+
}
51285132

51295133
iSkipMask = 0; // assume not skipping
51305134
if (bSkipRow || x*mcuCX < pJPEG->iCropX || x*mcuCX > pJPEG->iCropX+pJPEG->iCropCX) {

0 commit comments

Comments
 (0)