mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fix jpeg loading
This commit is contained in:
parent
e20b1b787f
commit
165408f3c8
@ -564,10 +564,14 @@ bool imlib_read_geometry(FIL *fp, image_t *img, const char *path, img_read_setti
|
|||||||
file_read_open(fp, path);
|
file_read_open(fp, path);
|
||||||
file_buffer_on(fp); // REMEMBER TO TURN THIS OFF LATER!
|
file_buffer_on(fp); // REMEMBER TO TURN THIS OFF LATER!
|
||||||
vflipped = bmp_read_geometry(fp, img, path, &rs->bmp_rs);
|
vflipped = bmp_read_geometry(fp, img, path, &rs->bmp_rs);
|
||||||
} else {
|
} else if ((magic[0]==0xFF) && (magic[1]==0xD8)) { // JPG
|
||||||
rs->format = FORMAT_JPG;
|
rs->format = FORMAT_JPG;
|
||||||
file_read_open(fp, path);
|
file_read_open(fp, path);
|
||||||
|
// Do not use file_buffer_on() here.
|
||||||
jpeg_read_geometry(fp, img, path, &rs->jpg_rs);
|
jpeg_read_geometry(fp, img, path, &rs->jpg_rs);
|
||||||
|
file_buffer_on(fp); // REMEMBER TO TURN THIS OFF LATER!
|
||||||
|
} else {
|
||||||
|
ff_unsupported_format(NULL);
|
||||||
}
|
}
|
||||||
imblib_parse_extension(img, path); // Enforce extension!
|
imblib_parse_extension(img, path); // Enforce extension!
|
||||||
return vflipped;
|
return vflipped;
|
||||||
|
|||||||
@ -2100,14 +2100,14 @@ void jpeg_read_geometry(FIL *fp, image_t *img, const char *path, jpg_read_settin
|
|||||||
|| ((0xFFCD <= header) && (header <= 0xFFCF)))
|
|| ((0xFFCD <= header) && (header <= 0xFFCF)))
|
||||||
{
|
{
|
||||||
read_byte_ignore(fp);
|
read_byte_ignore(fp);
|
||||||
uint16_t width;
|
|
||||||
read_word(fp, &width);
|
|
||||||
width = __REV16(width);
|
|
||||||
|
|
||||||
uint16_t height;
|
uint16_t height;
|
||||||
read_word(fp, &height);
|
read_word(fp, &height);
|
||||||
height = __REV16(height);
|
height = __REV16(height);
|
||||||
|
|
||||||
|
uint16_t width;
|
||||||
|
read_word(fp, &width);
|
||||||
|
width = __REV16(width);
|
||||||
|
|
||||||
rs->jpg_w = width;
|
rs->jpg_w = width;
|
||||||
rs->jpg_h = height;
|
rs->jpg_h = height;
|
||||||
rs->jpg_size = IMLIB_IMAGE_MAX_SIZE(f_size(fp));
|
rs->jpg_size = IMLIB_IMAGE_MAX_SIZE(f_size(fp));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user