TUT HEVC Encoder
Loading...
Searching...
No Matches
encmain.c File Reference
#include <math.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "checkpoint.h"
#include "cli.h"
#include "encoder.h"
#include "kvazaar.h"
#include "kvazaar_internal.h"
#include "threads.h"
#include "yuv_io.h"
Include dependency graph for encmain.c:

Data Structures

struct  input_handler_args
 

Macros

#define RETVAL_RUNNING   0
 
#define RETVAL_FAILURE   1
 
#define RETVAL_EOF   2
 

Functions

static FILE * open_input_file (const char *filename)
 Open a file for reading.
 
static FILE * open_output_file (const char *filename)
 Open a file for writing.
 
static unsigned get_padding (unsigned width_or_height)
 
static void compute_psnr (const kvz_picture *const src, const kvz_picture *const rec, double psnr[3])
 Calculates image PSNR value.
 
static void * input_read_thread (void *in_args)
 Handles input reading in a thread.
 
void output_recon_pictures (const kvz_api *const api, FILE *recout, kvz_picture *buffer[32], int *buffer_size, uint64_t *next_pts, unsigned width, unsigned height)
 
static double calc_avg_qp (uint64_t qp_sum, uint32_t frames_done)
 
static bool read_header (FILE *input, kvz_config *config)
 Reads the information in y4m header.
 
int main (int argc, char *argv[])
 Program main function.
 

Variables

static const double MAX_PSNR = 999.99
 Value that is printed instead of PSNR when SSE is zero.
 
static const double MAX_SQUARED_ERROR = (double) ((1 << 8 ) - 1)* (double) ((1 << 8 ) - 1)
 

Macro Definition Documentation

◆ RETVAL_EOF

#define RETVAL_EOF   2

◆ RETVAL_FAILURE

#define RETVAL_FAILURE   1

◆ RETVAL_RUNNING

#define RETVAL_RUNNING   0

Function Documentation

◆ calc_avg_qp()

static double calc_avg_qp ( uint64_t qp_sum,
uint32_t frames_done )
static
Here is the caller graph for this function:

◆ compute_psnr()

static void compute_psnr ( const kvz_picture *const src,
const kvz_picture *const rec,
double psnr[3] )
static
Parameters
srcsource picture
recreconstructed picture \prama psnr returns the PSNR
Here is the caller graph for this function:

◆ get_padding()

static unsigned get_padding ( unsigned width_or_height)
static
Here is the caller graph for this function:

◆ input_read_thread()

static void * input_read_thread ( void * in_args)
static
Parameters
in_argspointer to argument struct
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int argc,
char * argv[] )
Parameters
argcArgument count from commandline
argvArgument list
Returns
Program exit state

< Command line options

< input file (YUV)

< output file (HEVC NAL stream)

< reconstructed YUV output, –debug

Here is the call graph for this function:

◆ open_input_file()

static FILE * open_input_file ( const char * filename)
static

If the file is "-", stdin is used.

Parameters
filenamename of the file to open or "-"
Returns
the opened file or NULL if opening fails
Here is the caller graph for this function:

◆ open_output_file()

static FILE * open_output_file ( const char * filename)
static

If the file is "-", stdout is used.

Parameters
filenamename of the file to open or "-"
Returns
the opened file or NULL if opening fails
Here is the caller graph for this function:

◆ output_recon_pictures()

void output_recon_pictures ( const kvz_api *const api,
FILE * recout,
kvz_picture * buffer[32],
int * buffer_size,
uint64_t * next_pts,
unsigned width,
unsigned height )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_header()

static bool read_header ( FILE * input,
kvz_config * config )
static
Parameters
inputPointer to the input file
configPointer to the config struct
Here is the caller graph for this function:

Variable Documentation

◆ MAX_PSNR

const double MAX_PSNR = 999.99
static

◆ MAX_SQUARED_ERROR

const double MAX_SQUARED_ERROR = (double) ((1 << 8 ) - 1)* (double) ((1 << 8 ) - 1)
static