TUT HEVC Encoder
Functions
yuv_io.c File Reference
#include <string.h>
#include <stdio.h>
#include "yuv_io.h"
Include dependency graph for yuv_io.c:

Functions

static void fill_after_frame (unsigned height, unsigned array_width, unsigned array_height, kvz_pixel *data)
 
static int read_and_fill_frame_data (FILE *file, unsigned width, unsigned height, unsigned bytes_per_sample, unsigned array_width, kvz_pixel *data)
 
static void swap_16b_buffer_bytes (kvz_pixel *input, int size)
 
static void shift_to_bitdepth (kvz_pixel *input, int size, int from_bitdepth, int to_bitdepth)
 
static void shift_to_bitdepth_and_spread (kvz_pixel *input, int size, int from_bitdepth, int to_bitdepth)
 
static bool machine_is_big_endian ()
 
static void mask_to_bitdepth (kvz_pixel *buf, unsigned length, unsigned bitdepth)
 
static int yuv_io_read_plane (FILE *file, unsigned in_width, unsigned in_height, unsigned in_bitdepth, unsigned out_width, unsigned out_height, unsigned out_bitdepth, kvz_pixel *out_buf)
 
static int read_frame_header (FILE *input)
 
int yuv_io_read (FILE *file, unsigned in_width, unsigned out_width, unsigned in_bitdepth, unsigned out_bitdepth, kvz_picture *img_out, unsigned file_format)
 Read a single frame from a file. More...
 
int yuv_io_seek (FILE *file, unsigned frames, unsigned input_width, unsigned input_height, unsigned file_format)
 Seek forward in a YUV file. More...
 
int yuv_io_write (FILE *file, const kvz_picture *img, unsigned output_width, unsigned output_height)
 Write a single frame to a file. More...
 

Function Documentation

◆ fill_after_frame()

static void fill_after_frame ( unsigned  height,
unsigned  array_width,
unsigned  array_height,
kvz_pixel data 
)
static
Here is the caller graph for this function:

◆ machine_is_big_endian()

static bool machine_is_big_endian ( )
static
Here is the caller graph for this function:

◆ mask_to_bitdepth()

static void mask_to_bitdepth ( kvz_pixel buf,
unsigned  length,
unsigned  bitdepth 
)
static
Here is the caller graph for this function:

◆ read_and_fill_frame_data()

static int read_and_fill_frame_data ( FILE *  file,
unsigned  width,
unsigned  height,
unsigned  bytes_per_sample,
unsigned  array_width,
kvz_pixel data 
)
static
Here is the caller graph for this function:

◆ read_frame_header()

static int read_frame_header ( FILE *  input)
static
Here is the caller graph for this function:

◆ shift_to_bitdepth()

static void shift_to_bitdepth ( kvz_pixel input,
int  size,
int  from_bitdepth,
int  to_bitdepth 
)
static
Here is the caller graph for this function:

◆ shift_to_bitdepth_and_spread()

static void shift_to_bitdepth_and_spread ( kvz_pixel input,
int  size,
int  from_bitdepth,
int  to_bitdepth 
)
static
Here is the caller graph for this function:

◆ swap_16b_buffer_bytes()

static void swap_16b_buffer_bytes ( kvz_pixel input,
int  size 
)
static
Here is the caller graph for this function:

◆ yuv_io_read()

int yuv_io_read ( FILE *  file,
unsigned  in_width,
unsigned  out_width,
unsigned  in_bitdepth,
unsigned  out_bitdepth,
kvz_picture img_out,
unsigned  file_format 
)

Read luma and chroma values from file. Extend pixels if the image buffer is larger than the input image.

Parameters
fileinput file
input_widthwidth of the input video in pixels
input_heightheight of the input video in pixels
img_outimage buffer
Returns
1 on success, 0 on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yuv_io_read_plane()

static int yuv_io_read_plane ( FILE *  file,
unsigned  in_width,
unsigned  in_height,
unsigned  in_bitdepth,
unsigned  out_width,
unsigned  out_height,
unsigned  out_bitdepth,
kvz_pixel out_buf 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yuv_io_seek()

int yuv_io_seek ( FILE *  file,
unsigned  frames,
unsigned  input_width,
unsigned  input_height,
unsigned  file_format 
)
Parameters
filethe input file
framesnumber of frames to seek
input_widthwidth of the input video in pixels
input_heightheight of the input video in pixels
Returns
1 on success, 0 on failure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ yuv_io_write()

int yuv_io_write ( FILE *  file,
const kvz_picture img,
unsigned  output_width,
unsigned  output_height 
)
Parameters
fileoutput file
imgimage to output
output_widthwidth of the output in pixels
output_heightheight of the output in pixels
Returns
1 on success, 0 on failure
Here is the caller graph for this function: