diff --git a/lib/libesp32/JPEGDEC/library.json b/lib/libesp32/JPEGDEC/library.json index 333cadb6d..3641dc24c 100644 --- a/lib/libesp32/JPEGDEC/library.json +++ b/lib/libesp32/JPEGDEC/library.json @@ -1,6 +1,6 @@ { "name": "JPEGDEC", - "version": "1.8.3", + "version": "1.8.4", "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.", "repository": { diff --git a/lib/libesp32/JPEGDEC/library.properties b/lib/libesp32/JPEGDEC/library.properties index 38f0d7808..003c63573 100644 --- a/lib/libesp32/JPEGDEC/library.properties +++ b/lib/libesp32/JPEGDEC/library.properties @@ -1,5 +1,5 @@ name=JPEGDEC -version=1.8.3 +version=1.8.4 author=Larry Bank maintainer=Larry Bank sentence=Optimized JPEG decoder for MCUs with 32K+ RAM. diff --git a/lib/libesp32/JPEGDEC/linux/examples/jpeg_perf_test/Makefile b/lib/libesp32/JPEGDEC/linux/examples/jpeg_perf_test/Makefile new file mode 100644 index 000000000..b74e9f8ba --- /dev/null +++ b/lib/libesp32/JPEGDEC/linux/examples/jpeg_perf_test/Makefile @@ -0,0 +1,13 @@ +CFLAGS=-ggdb -D__LINUX__ -Wall -O2 -I../../ +LIBS=-g -lJPEGDEC + +all: jpeg_perf_test + +jpeg_perf_test: main.o + $(CXX) main.o $(LIBS) -o jpeg_perf_test + +main.o: main.cpp + $(CXX) $(CFLAGS) -c main.cpp + +clean: + rm -rf *.o jpeg_perf_test diff --git a/lib/libesp32/JPEGDEC/linux/examples/jpeg_perf_test/main.cpp b/lib/libesp32/JPEGDEC/linux/examples/jpeg_perf_test/main.cpp new file mode 100644 index 000000000..a33223583 --- /dev/null +++ b/lib/libesp32/JPEGDEC/linux/examples/jpeg_perf_test/main.cpp @@ -0,0 +1,62 @@ +// +// Perf Test +// +#include +#include +#include "../../../test_images/tulips.h" // 640x480 56k byte test image +JPEGDEC jpeg; + +long micros(void) +{ +int iTime; +struct timespec res; + + clock_gettime(CLOCK_MONOTONIC, &res); + iTime = 1000000*res.tv_sec + res.tv_nsec/1000; + + return (long)iTime; +} /* micros() */ + +int JPEGDraw(JPEGDRAW *pDraw) +{ + // do nothing + return 1; // continue decode +} /* JPEGDraw() */ + +int main(int argc, char *argv[]) { +long lTime; + + if (jpeg.openFLASH((uint8_t *)tulips, sizeof(tulips), JPEGDraw)) { + lTime = micros(); + if (jpeg.decode(0,0,0)) { // full sized decode + lTime = micros() - lTime; + printf("full sized decode in %d us\n", (int)lTime); + } + jpeg.close(); + } + if (jpeg.openFLASH((uint8_t *)tulips, sizeof(tulips), JPEGDraw)) { + lTime = micros(); + if (jpeg.decode(0,0,JPEG_SCALE_HALF)) { // 1/2 sized decode + lTime = micros() - lTime; + printf("half sized decode in %d us\n", (int)lTime); + } + jpeg.close(); + } + if (jpeg.openFLASH((uint8_t *)tulips, sizeof(tulips), JPEGDraw)) { + lTime = micros(); + if (jpeg.decode(0,0,JPEG_SCALE_QUARTER)) { // 1/4 sized decode + lTime = micros() - lTime; + printf("quarter sized decode in %d us\n", (int)lTime); + } + jpeg.close(); + } + if (jpeg.openFLASH((uint8_t *)tulips, sizeof(tulips), JPEGDraw)) { + lTime = micros(); + if (jpeg.decode(0,0,JPEG_SCALE_EIGHTH)) { // 1/8 sized decode + lTime = micros() - lTime; + printf("eighth sized decode in %d us\n", (int)lTime); + } + jpeg.close(); + } + return 0; +} /* main() */ diff --git a/lib/libesp32/JPEGDEC/src/jpeg.inl b/lib/libesp32/JPEGDEC/src/jpeg.inl index c2bcb790a..06527bc38 100644 --- a/lib/libesp32/JPEGDEC/src/jpeg.inl +++ b/lib/libesp32/JPEGDEC/src/jpeg.inl @@ -3766,6 +3766,7 @@ static void JPEGPutMCU22(JPEGIMAGE *pJPEG, int x, int iPitch) #endif // ESP32S3_SIMD #ifdef HAS_NEON + if (x+8 <= iPitch && (iPitch & 15) == 0) { // only for non-clipped MCUs if (pJPEG->ucPixelType == RGB8888) { int8x8_t i88Cr, i88Cb; uint8x16_t u816YL, u816YR; @@ -3998,6 +3999,7 @@ static void JPEGPutMCU22(JPEGIMAGE *pJPEG, int x, int iPitch) } // for each row return; } // 16bpp + } // not clipped #endif // HAS_NEON #ifdef HAS_SSE @@ -5124,7 +5126,9 @@ static int DecodeJPEG(JPEGIMAGE *pJPEG) } for (x = 0; x < cx && bContinue && iErr == 0; x++) { - pJPEG->usPixels = &pAlignedPixels[iDMAOffset]; // make sure output is correct offset for DMA + if (pJPEG->pFramebuffer == NULL) { + pJPEG->usPixels = &pAlignedPixels[iDMAOffset]; // make sure output is correct offset for DMA + } iSkipMask = 0; // assume not skipping if (bSkipRow || x*mcuCX < pJPEG->iCropX || x*mcuCX > pJPEG->iCropX+pJPEG->iCropCX) {