Make low/high JPEG quality configurable.

This commit is contained in:
iabdalkader 2018-04-09 01:07:49 +02:00
parent ffcf70a57c
commit 3b9148cf9b
4 changed files with 14 additions and 2 deletions

View File

@ -41,6 +41,10 @@
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (160*120*2)
// Low and high JPEG QS.
#define JPEG_QUALITY_LOW 35
#define JPEG_QUALITY_HIGH 60
// Linker script constants (see the linker script template stm32fxxx.ld.S).
// Note: fb_alloc is a stack-based, dynamically allocated memory on FB.
// The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp).

View File

@ -41,6 +41,10 @@
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (160*120*2)
// Low and high JPEG QS.
#define JPEG_QUALITY_LOW 35
#define JPEG_QUALITY_HIGH 60
// Linker script constants (see the linker script template stm32fxxx.ld.S).
// Note: fb_alloc is a stack-based, dynamically allocated memory on FB.
// The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp).

View File

@ -44,6 +44,10 @@
// This is only used for JPEG images sent to the IDE not normal compression.
#define JPEG_QUALITY_THRESH (320*240*2)
// Low and high JPEG QS.
#define JPEG_QUALITY_LOW 50
#define JPEG_QUALITY_HIGH 90
// Linker script constants (see the linker script template stm32fxxx.ld.S).
// Note: fb_alloc is a stack-based, dynamically allocated memory on FB.
// The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp).

View File

@ -78,8 +78,8 @@ void fb_update_jpeg_buffer()
overflow_count--;
}
// No buffer overflow, increase quality up to max quality based on frame size
if (overflow_count == 0 &&
JPEG_FB()->quality < ((fb_buffer_size() > JPEG_QUALITY_THRESH) ? 35:60)) {
if (overflow_count == 0 && JPEG_FB()->quality
< ((fb_buffer_size() > JPEG_QUALITY_THRESH) ? JPEG_QUALITY_LOW:JPEG_QUALITY_HIGH)) {
JPEG_FB()->quality++;
}
// Set FB from JPEG image