mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-20 01:22:16 +00:00
Revert "(RJPEG) Remove rjpeg_test"
This reverts commit 5a4b062b0d2ad1f28e2897e373174be98b183443.
This commit is contained in:
parent
e56abc03b3
commit
7a16cf8806
@ -173,6 +173,16 @@ static void rjpeg__start_mem(rjpeg__context *s, const uint8_t *buffer, int len)
|
||||
s->img_buffer_end = (uint8_t *) buffer+len;
|
||||
}
|
||||
|
||||
static void rjpeg__rewind(rjpeg__context *s)
|
||||
{
|
||||
/* conceptually rewind SHOULD rewind to the beginning of the stream,
|
||||
* but we just rewind to the beginning of the initial buffer, because
|
||||
* we only use it after doing 'test', which only ever looks at at most 92 bytes
|
||||
*/
|
||||
s->img_buffer = s->img_buffer_original;
|
||||
}
|
||||
|
||||
static int rjpeg__jpeg_test(rjpeg__context *s);
|
||||
static uint8_t *rjpeg__jpeg_load(rjpeg__context *s, unsigned *x, unsigned *y, int *comp, int req_comp);
|
||||
|
||||
/* this is not threadsafe */
|
||||
@ -199,7 +209,10 @@ static int rjpeg__vertically_flip_on_load = 0;
|
||||
|
||||
static unsigned char *rjpeg__load_main(rjpeg__context *s, unsigned *x, unsigned *y, int *comp, int req_comp)
|
||||
{
|
||||
return rjpeg__jpeg_load(s,x,y,comp,req_comp);
|
||||
if (rjpeg__jpeg_test(s))
|
||||
return rjpeg__jpeg_load(s,x,y,comp,req_comp);
|
||||
|
||||
return rjpeg__errpuc("unknown image type", "Image not of any known type, or corrupt");
|
||||
}
|
||||
|
||||
static unsigned char *rjpeg__load_flip(rjpeg__context *s, unsigned *x, unsigned *y, int *comp, int req_comp)
|
||||
@ -2406,6 +2419,17 @@ static unsigned char *rjpeg__jpeg_load(rjpeg__context *s, unsigned *x, unsigned
|
||||
return rjpeg_load_jpeg_image(&j, x,y,comp,req_comp);
|
||||
}
|
||||
|
||||
static int rjpeg__jpeg_test(rjpeg__context *s)
|
||||
{
|
||||
int r;
|
||||
rjpeg__jpeg j;
|
||||
j.s = s;
|
||||
rjpeg__setup_jpeg(&j);
|
||||
r = rjpeg__decode_jpeg_header(&j, RJPEG_SCAN_TYPE);
|
||||
rjpeg__rewind(s);
|
||||
return r;
|
||||
}
|
||||
|
||||
static INLINE void video_frame_convert_rgba_to_bgra(
|
||||
const void *src_data,
|
||||
void *dst_data,
|
||||
|
Loading…
x
Reference in New Issue
Block a user