Merge pull request #1556 from openmv/jpeg_fixes

imlib: Update JPEG decoder and fix memory issues.
This commit is contained in:
Ibrahim Abdelkader 2022-02-27 16:55:59 +02:00 committed by GitHub
commit b76222b9d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 327 additions and 669 deletions

View File

@ -2743,7 +2743,7 @@ void imlib_draw_image(image_t *dst_img, image_t *src_img, int dst_x_start, int d
} else if (src_img->is_yuv) { } else if (src_img->is_yuv) {
imlib_deyuv_image(&new_src_img, src_img); imlib_deyuv_image(&new_src_img, src_img);
} else if (is_jpeg) { } else if (is_jpeg) {
jpeg_decompress_image_to_binary(&new_src_img, src_img); jpeg_decompress(&new_src_img, src_img);
} else if (is_png) { } else if (is_png) {
png_decompress(&new_src_img, src_img); png_decompress(&new_src_img, src_img);
} }
@ -2755,7 +2755,7 @@ void imlib_draw_image(image_t *dst_img, image_t *src_img, int dst_x_start, int d
} else if (src_img->is_yuv) { } else if (src_img->is_yuv) {
imlib_deyuv_image(&new_src_img, src_img); imlib_deyuv_image(&new_src_img, src_img);
} else if (is_jpeg) { } else if (is_jpeg) {
jpeg_decompress_image_to_grayscale(&new_src_img, src_img); jpeg_decompress(&new_src_img, src_img);
} else if (is_png) { } else if (is_png) {
png_decompress(&new_src_img, src_img); png_decompress(&new_src_img, src_img);
} }
@ -2767,7 +2767,7 @@ void imlib_draw_image(image_t *dst_img, image_t *src_img, int dst_x_start, int d
} else if (src_img->is_yuv) { } else if (src_img->is_yuv) {
imlib_deyuv_image(&new_src_img, src_img); imlib_deyuv_image(&new_src_img, src_img);
} else if (is_jpeg) { } else if (is_jpeg) {
jpeg_decompress_image_to_rgb565(&new_src_img, src_img); jpeg_decompress(&new_src_img, src_img);
} else if (is_png) { } else if (is_png) {
png_decompress(&new_src_img, src_img); png_decompress(&new_src_img, src_img);
} }

View File

@ -1125,9 +1125,7 @@ void imlib_jpeg_compress_init();
void imlib_jpeg_compress_deinit(); void imlib_jpeg_compress_deinit();
void jpeg_mdma_irq_handler(); void jpeg_mdma_irq_handler();
#endif #endif
void jpeg_decompress_image_to_binary(image_t *dst, image_t *src); void jpeg_decompress(image_t *dst, image_t *src);
void jpeg_decompress_image_to_grayscale(image_t *dst, image_t *src);
void jpeg_decompress_image_to_rgb565(image_t *dst, image_t *src);
bool jpeg_compress(image_t *src, image_t *dst, int quality, bool realloc); bool jpeg_compress(image_t *src, image_t *dst, int quality, bool realloc);
int jpeg_clean_trailing_bytes(int bpp, uint8_t *data); int jpeg_clean_trailing_bytes(int bpp, uint8_t *data);
void jpeg_read_geometry(FIL *fp, image_t *img, const char *path, jpg_read_settings_t *rs); void jpeg_read_geometry(FIL *fp, image_t *img, const char *path, jpg_read_settings_t *rs);

File diff suppressed because it is too large Load Diff