mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(rjpeg) Cleanup
This commit is contained in:
parent
a84540515c
commit
2712b60de0
@ -250,11 +250,15 @@ typedef struct
|
||||
*/
|
||||
#define RJPEG__RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)
|
||||
|
||||
#define JPEG_MARKER 0xFF
|
||||
#define JPEG_MARKER_SOI 0xD8
|
||||
#define JPEG_MARKER_SOS 0xDA
|
||||
#define JPEG_MARKER_EOI 0xD9
|
||||
#define JPEG_MARKER_APP1 0xE1
|
||||
#define JPEG_MARKER_APP2 0xE2
|
||||
|
||||
/* use comparisons since in some cases we handle more than one case (e.g. SOF) */
|
||||
#define rjpeg__SOI(x) ((x) == 0xd8)
|
||||
#define rjpeg__EOI(x) ((x) == 0xd9)
|
||||
#define rjpeg__SOF(x) ((x) == 0xc0 || (x) == 0xc1 || (x) == 0xc2)
|
||||
#define rjpeg__SOS(x) ((x) == 0xda)
|
||||
|
||||
#define rjpeg__SOF_progressive(x) ((x) == 0xc2)
|
||||
#define rjpeg__div4(x) ((uint8_t) ((x) >> 2))
|
||||
@ -1331,6 +1335,7 @@ static int rjpeg__parse_entropy_coded_data(rjpeg__jpeg *z)
|
||||
for (i=0; i < w; ++i)
|
||||
{
|
||||
short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w);
|
||||
|
||||
if (z->spec_start == 0)
|
||||
{
|
||||
if (!rjpeg__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n))
|
||||
@ -1869,7 +1874,7 @@ static int rjpeg__decode_jpeg_header(rjpeg__jpeg *z, int scan)
|
||||
m = rjpeg__get_marker(z);
|
||||
|
||||
/* No SOI. Corrupt JPEG? */
|
||||
if (!rjpeg__SOI(m))
|
||||
if (m != JPEG_MARKER_SOI)
|
||||
return 0;
|
||||
|
||||
if (scan == RJPEG_SCAN_TYPE)
|
||||
@ -1912,9 +1917,9 @@ static int rjpeg__decode_jpeg_image(rjpeg__jpeg *j)
|
||||
return 0;
|
||||
m = rjpeg__get_marker(j);
|
||||
|
||||
while (!rjpeg__EOI(m))
|
||||
while (m != JPEG_MARKER_EOI)
|
||||
{
|
||||
if (rjpeg__SOS(m))
|
||||
if (m == JPEG_MARKER_SOS)
|
||||
{
|
||||
if (!rjpeg__process_scan_header(j))
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user