mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 04:57:06 +03:00
Use TJPGD in flash (stack in PSRAM?) - release
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
# the JPEG library is in ROM but seems to fail randomly (PSRAM issue?)
|
||||
set(TJPGD tjpgd)
|
||||
|
||||
idf_component_register(SRC_DIRS . core core/ifaces fonts
|
||||
INCLUDE_DIRS . fonts core
|
||||
REQUIRES platform_config tools esp_common
|
||||
PRIV_REQUIRES services freertos driver
|
||||
EMBED_FILES note.jpg
|
||||
)
|
||||
PRIV_REQUIRES services freertos driver ${TJPGD}
|
||||
EMBED_FILES note.jpg )
|
||||
|
||||
if (NOT TJPGD)
|
||||
add_compile_definitions(TJPGD_ROM)
|
||||
endif()
|
||||
|
||||
set_source_files_properties(display.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
-Wno-format-overflow
|
||||
)
|
||||
-Wno-format-overflow )
|
||||
|
||||
@@ -87,7 +87,7 @@ static void SetContrast( struct GDS_Device* Device, uint8_t Contrast ) {
|
||||
Device->WriteCommand( Device, Contrast );
|
||||
}
|
||||
|
||||
static void SPIParams(int Speed, uint8_t *mode, uint16_t *CS_pre, uint8_t *CS_post) {
|
||||
static void SPIParams(int Speed, uint8_t *mode, uint8_t *CS_pre, uint8_t *CS_post) {
|
||||
*CS_post = Speed / (8*1000*1000);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "math.h"
|
||||
#ifdef TJPGD_ROM
|
||||
#include "esp32/rom/tjpgd.h"
|
||||
#else
|
||||
#include "tjpgd.h"
|
||||
#endif
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "gds.h"
|
||||
@@ -24,7 +28,6 @@ typedef struct {
|
||||
const unsigned char *InData; // Pointer to jpeg data
|
||||
int InPos; // Current position in jpeg data
|
||||
int Width, Height;
|
||||
uint32_t Pixels;
|
||||
uint8_t Mode;
|
||||
union {
|
||||
void *OutData;
|
||||
@@ -144,8 +147,6 @@ static unsigned OutHandlerDirect(JDEC *Decoder, void *Bitmap, JRECT *Frame) {
|
||||
uint8_t *Pixels = (uint8_t*) Bitmap;
|
||||
int Shift = 8 - Context->Depth;
|
||||
|
||||
Context->Pixels += (Frame->bottom - Frame->top + 1) * (Frame->right - Frame->left + 1); \
|
||||
|
||||
// decoded image is RGB888, shift only make sense for grayscale
|
||||
if (Context->Mode == GDS_RGB888) {
|
||||
OUTHANDLERDIRECT(Scaler888, 0);
|
||||
@@ -421,21 +422,10 @@ bool GDS_DrawJPEG(struct GDS_Device* Device, uint8_t *Source, int x, int y, int
|
||||
Context.XMin = x - Context.XOfs;
|
||||
Context.YMin = y - Context.YOfs;
|
||||
Context.Mode = Device->Mode;
|
||||
Context.Pixels = 0;
|
||||
|
||||
// do decompress & draw
|
||||
ESP_LOGW(TAG,"Context before p:%d, w:%d, h:%d, min(%d,%d), ofs(%d,%d)",
|
||||
Context.Pixels,
|
||||
Context.Width, Context.Height,
|
||||
Context.XMin, Context.YMin,
|
||||
Context.XOfs, Context.YOfs);
|
||||
Res = jd_decomp(&Decoder, OutHandlerDirect, N);
|
||||
ESP_LOGW(TAG,"Context after p:%d, w:%d, h:%d, min(%d,%d), ofs(%d,%d)",
|
||||
Context.Pixels,
|
||||
Context.Width, Context.Height,
|
||||
Context.XMin, Context.YMin,
|
||||
Context.XOfs, Context.YOfs);
|
||||
if (Res == JDR_OK && Context.Pixels == Context.Width * Context.Height) {
|
||||
if (Res == JDR_OK) {
|
||||
Device->Dirty = true;
|
||||
Ret = true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user