Skip to content

Commit cf40491

Browse files
feat: Use esp_jpeg component for decoding
1 parent 4467667 commit cf40491

File tree

10 files changed

+88
-1423
lines changed

10 files changed

+88
-1423
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
**/build
44
**/sdkconfig
55
**/sdkconfig.old
6-
**/dependencies.lock
6+
**/dependencies.lock
7+
**/managed_components/**

CMakeLists.txt

+1-14
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ set(srcs
77
conversions/to_jpg.cpp
88
conversions/to_bmp.c
99
conversions/jpge.cpp
10-
conversions/esp_jpg_decode.c
1110
)
1211

1312
set(priv_include_dirs
@@ -61,7 +60,6 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST
6160
list(APPEND srcs
6261
target/xclk.c
6362
target/esp32s2/ll_cam.c
64-
target/tjpgd.c
6563
)
6664

6765
list(APPEND priv_include_dirs
@@ -83,7 +81,7 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST
8381
endif()
8482

8583
# include the SCCB I2C driver
86-
# this uses either the legacy I2C API or the newwer version from IDF v5.4
84+
# this uses either the legacy I2C API or the newer version from IDF v5.4
8785
# as this features a method to obtain the I2C driver from a port number
8886
if (idf_version VERSION_GREATER_EQUAL "5.4")
8987
list(APPEND srcs driver/sccb-ng.c)
@@ -93,17 +91,6 @@ if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET ST
9391

9492
endif()
9593

96-
# CONFIG_ESP_ROM_HAS_JPEG_DECODE is available from IDF v4.4 but
97-
# previous IDF supported chips already support JPEG decoder, hence okay to use this
98-
if(idf_version VERSION_GREATER_EQUAL "4.4" AND NOT CONFIG_ESP_ROM_HAS_JPEG_DECODE)
99-
list(APPEND srcs
100-
target/tjpgd.c
101-
)
102-
list(APPEND priv_include_dirs
103-
target/jpeg_include/
104-
)
105-
endif()
106-
10794
idf_component_register(
10895
SRCS ${srcs}
10996
INCLUDE_DIRS ${include_dirs}

conversions/esp_jpg_decode.c

-140
This file was deleted.

conversions/include/esp_jpg_decode.h

-43
This file was deleted.

conversions/include/img_converters.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
1+
// Copyright 2015-2025 Espressif Systems (Shanghai) PTE LTD
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ extern "C" {
2222
#include <stdint.h>
2323
#include <stdbool.h>
2424
#include "esp_camera.h"
25-
#include "esp_jpg_decode.h"
25+
#include "jpeg_decoder.h"
2626

2727
typedef size_t (* jpg_out_cb)(void * arg, size_t index, const void* data, size_t len);
2828

@@ -121,7 +121,13 @@ bool frame2bmp(camera_fb_t * fb, uint8_t ** out, size_t * out_len);
121121
*/
122122
bool fmt2rgb888(const uint8_t *src_buf, size_t src_len, pixformat_t format, uint8_t * rgb_buf);
123123

124-
bool jpg2rgb565(const uint8_t *src, size_t src_len, uint8_t * out, jpg_scale_t scale);
124+
// Macros for backwards compatibility
125+
#define JPG_SCALE_NONE JPEG_IMAGE_SCALE_0
126+
#define JPG_SCALE_2X JPEG_IMAGE_SCALE_1_2
127+
#define JPG_SCALE_4X JPEG_IMAGE_SCALE_1_4
128+
#define JPG_SCALE_8X JPEG_IMAGE_SCALE_1_8
129+
#define JPG_SCALE_MAX JPEG_IMAGE_SCALE_1_8
130+
bool jpg2rgb565(const uint8_t *src, size_t src_len, uint8_t * out, esp_jpeg_image_scale_t scale);
125131

126132
#ifdef __cplusplus
127133
}

0 commit comments

Comments
 (0)