(RJPEG/RPNG) Add debug logs and change function signatures

This commit is contained in:
twinaphex 2016-05-13 09:08:32 +02:00
parent 5068accc4e
commit 8efe2de0ec
6 changed files with 44 additions and 11 deletions

View File

@ -184,7 +184,8 @@ static bool video_texture_image_load_png(
do
{
ret = rpng_nbio_load_image_argb_process(rpng, &out_img->pixels, &out_img->width,
ret = rpng_nbio_load_image_argb_process(rpng,
(void**)&out_img->pixels, &out_img->width,
&out_img->height);
}while(ret == IMAGE_PROCESS_NEXT);

View File

@ -11,8 +11,16 @@
#include <formats/image.h>
#if 0
#define DEBUG
#endif
void image_transfer_free(void *data, enum image_type_enum type)
{
#ifdef DEBUG
printf("image_transfer_free\n");
#endif
switch (type)
{
case IMAGE_TYPE_PNG:
@ -30,6 +38,10 @@ void image_transfer_free(void *data, enum image_type_enum type)
void *image_transfer_new(enum image_type_enum type)
{
#ifdef DEBUG
printf("image_transfer_new\n");
#endif
switch (type)
{
case IMAGE_TYPE_PNG:
@ -53,6 +65,10 @@ void *image_transfer_new(enum image_type_enum type)
bool image_transfer_start(void *data, enum image_type_enum type)
{
#ifdef DEBUG
printf("image_transfer_start\n");
#endif
switch (type)
{
case IMAGE_TYPE_PNG:
@ -95,6 +111,10 @@ int image_transfer_process(
uint32_t **buf, size_t len,
unsigned *width, unsigned *height)
{
#ifdef DEBUG
printf("image_transfer_process\n");
#endif
switch (type)
{
case IMAGE_TYPE_PNG:
@ -104,14 +124,17 @@ int image_transfer_process(
return rpng_nbio_load_image_argb_process(
(rpng_t*)data,
buf, width, height);
(void**)buf, width, height);
#else
break;
#endif
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
#ifdef DEBUG
printf("len is: %d\n", len);
#endif
return rjpeg_process_image((rjpeg_t*)data,
buf, len, width, height);
(void**)buf, len, width, height);
#else
break;
#endif
@ -122,6 +145,10 @@ int image_transfer_process(
bool image_transfer_iterate(void *data, enum image_type_enum type)
{
#ifdef DEBUG
printf("image_transfer_iterate\n");
#endif
switch (type)
{
case IMAGE_TYPE_PNG:
@ -132,8 +159,10 @@ bool image_transfer_iterate(void *data, enum image_type_enum type)
break;
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
#endif
return false;
#else
break;
#endif
}
return true;

View File

@ -2446,17 +2446,18 @@ static INLINE void video_frame_convert_rgba_to_bgra(
}
}
int rjpeg_process_image(void *data, uint8_t *buf,
int rjpeg_process_image(void *data, void **buf_data,
size_t size, unsigned *width, unsigned *height)
{
int comp;
struct texture_image *out_img = (struct texture_image*)data;
uint8_t **buf = (uint8_t**)buf_data;
out_img->pixels = (uint32_t*)rjpeg_load_from_memory(buf, size, width, height, &comp, 4);
out_img->pixels = (uint32_t*)rjpeg_load_from_memory(*buf, size, width, height, &comp, 4);
out_img->width = *width;
out_img->height = *height;
return 1;
return IMAGE_PROCESS_END;
}
bool rjpeg_image_load(uint8_t *buf, void *data, size_t size,
@ -2467,7 +2468,7 @@ bool rjpeg_image_load(uint8_t *buf, void *data, size_t size,
unsigned height = 0;
struct texture_image *out_img = (struct texture_image*)data;
if (rjpeg_process_image(out_img, buf, size, &width, &height))
if (rjpeg_process_image(out_img, (void**)&buf, size, &width, &height) == IMAGE_PROCESS_END)
return true;
return false;

View File

@ -943,8 +943,10 @@ error:
}
int rpng_nbio_load_image_argb_process(rpng_t *rpng,
uint32_t **data, unsigned *width, unsigned *height)
void **_data, unsigned *width, unsigned *height)
{
uint32_t **data = (uint32_t**)_data;
if (!rpng->process.initialized)
{
if (!rpng->process.stream_backend)

View File

@ -34,7 +34,7 @@ RETRO_BEGIN_DECLS
typedef struct rjpeg rjpeg_t;
int rjpeg_process_image(void *data, uint8_t *buf,
int rjpeg_process_image(void *data, void **buf,
size_t size, unsigned *width, unsigned *height);
bool rjpeg_image_load(uint8_t *buf, void *data, size_t size,

View File

@ -48,7 +48,7 @@ void rpng_nbio_load_image_free(rpng_t *rpng);
bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng);
int rpng_nbio_load_image_argb_process(rpng_t *rpng,
uint32_t **data, unsigned *width, unsigned *height);
void **data, unsigned *width, unsigned *height);
bool rpng_nbio_load_image_argb_start(rpng_t *rpng);