RetroArch
Classes | Enumerations | Functions | Variables
rpng.c File Reference
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <boolean.h>
#include <formats/image.h>
#include <formats/rpng.h>
#include <streams/trans_stream.h>
#include <string/stdstring.h>
#include "rpng_internal.h"
Include dependency graph for rpng.c:

Classes

struct  adam7_pass
 
struct  idat_buffer
 
struct  png_chunk
 
struct  rpng_process
 
struct  rpng
 

Enumerations

enum  png_ihdr_color_type {
  PNG_IHDR_COLOR_GRAY = 0, PNG_IHDR_COLOR_RGB = 2, PNG_IHDR_COLOR_PLT = 3, PNG_IHDR_COLOR_GRAY_ALPHA = 4,
  PNG_IHDR_COLOR_RGBA = 6
}
 
enum  png_line_filter {
  PNG_FILTER_NONE = 0, PNG_FILTER_SUB, PNG_FILTER_UP, PNG_FILTER_AVERAGE,
  PNG_FILTER_PAETH
}
 
enum  png_chunk_type {
  PNG_CHUNK_NOOP = 0, PNG_CHUNK_ERROR, PNG_CHUNK_IHDR, PNG_CHUNK_IDAT,
  PNG_CHUNK_PLTE, PNG_CHUNK_tRNS, PNG_CHUNK_IEND
}
 

Functions

static INLINE uint32_t dword_be (const uint8_t *buf)
 
static enum png_chunk_type png_chunk_type (const struct png_chunk *chunk)
 
static bool png_process_ihdr (struct png_ihdr *ihdr)
 
static void png_reverse_filter_copy_line_rgb (uint32_t *data, const uint8_t *decoded, unsigned width, unsigned bpp)
 
static void png_reverse_filter_copy_line_rgba (uint32_t *data, const uint8_t *decoded, unsigned width, unsigned bpp)
 
static void png_reverse_filter_copy_line_bw (uint32_t *data, const uint8_t *decoded, unsigned width, unsigned depth)
 
static void png_reverse_filter_copy_line_gray_alpha (uint32_t *data, const uint8_t *decoded, unsigned width, unsigned bpp)
 
static void png_reverse_filter_copy_line_plt (uint32_t *data, const uint8_t *decoded, unsigned width, unsigned depth, const uint32_t *palette)
 
static void png_pass_geom (const struct png_ihdr *ihdr, unsigned width, unsigned height, unsigned *bpp_out, unsigned *pitch_out, size_t *pass_size)
 
static void png_reverse_filter_adam7_deinterlace_pass (uint32_t *data, const struct png_ihdr *ihdr, const uint32_t *input, unsigned pass_width, unsigned pass_height, const struct adam7_pass *pass)
 
static void png_reverse_filter_deinit (struct rpng_process *pngp)
 
static int png_reverse_filter_init (const struct png_ihdr *ihdr, struct rpng_process *pngp)
 
static int png_reverse_filter_copy_line (uint32_t *data, const struct png_ihdr *ihdr, struct rpng_process *pngp, unsigned filter)
 
static int png_reverse_filter_regular_iterate (uint32_t **data, const struct png_ihdr *ihdr, struct rpng_process *pngp)
 
static int png_reverse_filter_adam7_iterate (uint32_t **data_, const struct png_ihdr *ihdr, struct rpng_process *pngp)
 
static int png_reverse_filter_adam7 (uint32_t **data_, const struct png_ihdr *ihdr, struct rpng_process *pngp)
 
static int png_reverse_filter_iterate (rpng_t *rpng, uint32_t **data)
 
static int rpng_load_image_argb_process_inflate_init (rpng_t *rpng, uint32_t **data, unsigned *width, unsigned *height)
 
static bool png_read_plte (uint8_t *buf, uint32_t *buffer, unsigned entries)
 
static bool png_read_trns (uint8_t *buf, uint32_t *palette, unsigned entries)
 
bool png_realloc_idat (const struct png_chunk *chunk, struct idat_buffer *buf)
 
static struct rpng_processrpng_process_init (rpng_t *rpng, unsigned *width, unsigned *height)
 
static bool read_chunk_header (uint8_t *buf, struct png_chunk *chunk)
 
static bool png_parse_ihdr (uint8_t *buf, struct png_ihdr *ihdr)
 
bool rpng_iterate_image (rpng_t *rpng)
 
int rpng_process_image (rpng_t *rpng, void **_data, size_t size, unsigned *width, unsigned *height)
 
void rpng_free (rpng_t *rpng)
 
bool rpng_start (rpng_t *rpng)
 
bool rpng_is_valid (rpng_t *rpng)
 
bool rpng_set_buf_ptr (rpng_t *rpng, void *data)
 
rpng_trpng_alloc (void)
 

Variables

static const struct adam7_pass passes []
 

Enumeration Type Documentation

◆ png_chunk_type

Enumerator
PNG_CHUNK_NOOP 
PNG_CHUNK_ERROR 
PNG_CHUNK_IHDR 
PNG_CHUNK_IDAT 
PNG_CHUNK_PLTE 
PNG_CHUNK_tRNS 
PNG_CHUNK_IEND 

◆ png_ihdr_color_type

Enumerator
PNG_IHDR_COLOR_GRAY 
PNG_IHDR_COLOR_RGB 
PNG_IHDR_COLOR_PLT 
PNG_IHDR_COLOR_GRAY_ALPHA 
PNG_IHDR_COLOR_RGBA 

◆ png_line_filter

Enumerator
PNG_FILTER_NONE 
PNG_FILTER_SUB 
PNG_FILTER_UP 
PNG_FILTER_AVERAGE 
PNG_FILTER_PAETH 

Function Documentation

◆ dword_be()

static INLINE uint32_t dword_be ( const uint8_t buf)
static
Here is the caller graph for this function:

◆ png_chunk_type()

static enum png_chunk_type png_chunk_type ( const struct png_chunk chunk)
static
Here is the call graph for this function:

◆ png_parse_ihdr()

static bool png_parse_ihdr ( uint8_t buf,
struct png_ihdr ihdr 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_pass_geom()

static void png_pass_geom ( const struct png_ihdr ihdr,
unsigned  width,
unsigned  height,
unsigned *  bpp_out,
unsigned *  pitch_out,
size_t *  pass_size 
)
static
Here is the caller graph for this function:

◆ png_process_ihdr()

static bool png_process_ihdr ( struct png_ihdr ihdr)
static
Here is the caller graph for this function:

◆ png_read_plte()

static bool png_read_plte ( uint8_t buf,
uint32_t buffer,
unsigned  entries 
)
static
Here is the caller graph for this function:

◆ png_read_trns()

static bool png_read_trns ( uint8_t buf,
uint32_t palette,
unsigned  entries 
)
static
Here is the caller graph for this function:

◆ png_realloc_idat()

bool png_realloc_idat ( const struct png_chunk chunk,
struct idat_buffer buf 
)
Here is the caller graph for this function:

◆ png_reverse_filter_adam7()

static int png_reverse_filter_adam7 ( uint32_t **  data_,
const struct png_ihdr ihdr,
struct rpng_process pngp 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_reverse_filter_adam7_deinterlace_pass()

static void png_reverse_filter_adam7_deinterlace_pass ( uint32_t data,
const struct png_ihdr ihdr,
const uint32_t input,
unsigned  pass_width,
unsigned  pass_height,
const struct adam7_pass pass 
)
static
Here is the caller graph for this function:

◆ png_reverse_filter_adam7_iterate()

static int png_reverse_filter_adam7_iterate ( uint32_t **  data_,
const struct png_ihdr ihdr,
struct rpng_process pngp 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_reverse_filter_copy_line()

static int png_reverse_filter_copy_line ( uint32_t data,
const struct png_ihdr ihdr,
struct rpng_process pngp,
unsigned  filter 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_reverse_filter_copy_line_bw()

static void png_reverse_filter_copy_line_bw ( uint32_t data,
const uint8_t decoded,
unsigned  width,
unsigned  depth 
)
static
Here is the caller graph for this function:

◆ png_reverse_filter_copy_line_gray_alpha()

static void png_reverse_filter_copy_line_gray_alpha ( uint32_t data,
const uint8_t decoded,
unsigned  width,
unsigned  bpp 
)
static
Here is the caller graph for this function:

◆ png_reverse_filter_copy_line_plt()

static void png_reverse_filter_copy_line_plt ( uint32_t data,
const uint8_t decoded,
unsigned  width,
unsigned  depth,
const uint32_t palette 
)
static
Here is the caller graph for this function:

◆ png_reverse_filter_copy_line_rgb()

static void png_reverse_filter_copy_line_rgb ( uint32_t data,
const uint8_t decoded,
unsigned  width,
unsigned  bpp 
)
static
Here is the caller graph for this function:

◆ png_reverse_filter_copy_line_rgba()

static void png_reverse_filter_copy_line_rgba ( uint32_t data,
const uint8_t decoded,
unsigned  width,
unsigned  bpp 
)
static
Here is the caller graph for this function:

◆ png_reverse_filter_deinit()

static void png_reverse_filter_deinit ( struct rpng_process pngp)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_reverse_filter_init()

static int png_reverse_filter_init ( const struct png_ihdr ihdr,
struct rpng_process pngp 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_reverse_filter_iterate()

static int png_reverse_filter_iterate ( rpng_t rpng,
uint32_t **  data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ png_reverse_filter_regular_iterate()

static int png_reverse_filter_regular_iterate ( uint32_t **  data,
const struct png_ihdr ihdr,
struct rpng_process pngp 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_chunk_header()

static bool read_chunk_header ( uint8_t buf,
struct png_chunk chunk 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpng_alloc()

rpng_t* rpng_alloc ( void  )
Here is the caller graph for this function:

◆ rpng_free()

void rpng_free ( rpng_t rpng)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpng_is_valid()

bool rpng_is_valid ( rpng_t rpng)
Here is the caller graph for this function:

◆ rpng_iterate_image()

bool rpng_iterate_image ( rpng_t rpng)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpng_load_image_argb_process_inflate_init()

static int rpng_load_image_argb_process_inflate_init ( rpng_t rpng,
uint32_t **  data,
unsigned *  width,
unsigned *  height 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpng_process_image()

int rpng_process_image ( rpng_t rpng,
void **  _data,
size_t  size,
unsigned *  width,
unsigned *  height 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpng_process_init()

static struct rpng_process* rpng_process_init ( rpng_t rpng,
unsigned *  width,
unsigned *  height 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpng_set_buf_ptr()

bool rpng_set_buf_ptr ( rpng_t rpng,
void data 
)
Here is the caller graph for this function:

◆ rpng_start()

bool rpng_start ( rpng_t rpng)
Here is the caller graph for this function:

Variable Documentation

◆ passes

const struct adam7_pass passes[]
static
Initial value:
= {
{ 0, 0, 8, 8 },
{ 4, 0, 8, 8 },
{ 0, 4, 4, 8 },
{ 2, 0, 4, 4 },
{ 0, 2, 2, 4 },
{ 1, 0, 2, 2 },
{ 0, 1, 1, 2 },
}