mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Make low/high JPEG quality configurable.
This commit is contained in:
parent
ffcf70a57c
commit
3b9148cf9b
@ -41,6 +41,10 @@
|
|||||||
// This is only used for JPEG images sent to the IDE not normal compression.
|
// This is only used for JPEG images sent to the IDE not normal compression.
|
||||||
#define JPEG_QUALITY_THRESH (160*120*2)
|
#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).
|
// Linker script constants (see the linker script template stm32fxxx.ld.S).
|
||||||
// Note: fb_alloc is a stack-based, dynamically allocated memory on FB.
|
// 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).
|
// The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp).
|
||||||
|
|||||||
@ -41,6 +41,10 @@
|
|||||||
// This is only used for JPEG images sent to the IDE not normal compression.
|
// This is only used for JPEG images sent to the IDE not normal compression.
|
||||||
#define JPEG_QUALITY_THRESH (160*120*2)
|
#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).
|
// Linker script constants (see the linker script template stm32fxxx.ld.S).
|
||||||
// Note: fb_alloc is a stack-based, dynamically allocated memory on FB.
|
// 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).
|
// The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp).
|
||||||
|
|||||||
@ -44,6 +44,10 @@
|
|||||||
// This is only used for JPEG images sent to the IDE not normal compression.
|
// This is only used for JPEG images sent to the IDE not normal compression.
|
||||||
#define JPEG_QUALITY_THRESH (320*240*2)
|
#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).
|
// Linker script constants (see the linker script template stm32fxxx.ld.S).
|
||||||
// Note: fb_alloc is a stack-based, dynamically allocated memory on FB.
|
// 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).
|
// The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp).
|
||||||
|
|||||||
@ -78,8 +78,8 @@ void fb_update_jpeg_buffer()
|
|||||||
overflow_count--;
|
overflow_count--;
|
||||||
}
|
}
|
||||||
// No buffer overflow, increase quality up to max quality based on frame size
|
// No buffer overflow, increase quality up to max quality based on frame size
|
||||||
if (overflow_count == 0 &&
|
if (overflow_count == 0 && JPEG_FB()->quality
|
||||||
JPEG_FB()->quality < ((fb_buffer_size() > JPEG_QUALITY_THRESH) ? 35:60)) {
|
< ((fb_buffer_size() > JPEG_QUALITY_THRESH) ? JPEG_QUALITY_LOW:JPEG_QUALITY_HIGH)) {
|
||||||
JPEG_FB()->quality++;
|
JPEG_FB()->quality++;
|
||||||
}
|
}
|
||||||
// Set FB from JPEG image
|
// Set FB from JPEG image
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user