2012-06-04 10:47:12 +00:00
|
|
|
/**
|
|
|
|
* HEVC Encoder
|
|
|
|
* - Marko Viitanen ( fador at iki.fi ), Tampere University of Technology, Department of Computer Systems.
|
|
|
|
*/
|
|
|
|
|
2012-06-01 12:31:06 +00:00
|
|
|
/*! \file encoder.h
|
|
|
|
\brief Encoding related functions
|
|
|
|
\author Marko Viitanen
|
|
|
|
\date 2012-06
|
|
|
|
|
|
|
|
Structures for encoding
|
|
|
|
*/
|
2012-06-11 15:43:29 +00:00
|
|
|
#ifndef __ENCODER_H
|
|
|
|
#define __ENCODER_H
|
2012-06-01 12:31:06 +00:00
|
|
|
|
2012-06-05 11:01:47 +00:00
|
|
|
#include "picture.h"
|
2012-06-06 13:20:29 +00:00
|
|
|
#include "bitstream.h"
|
2012-06-05 11:01:47 +00:00
|
|
|
|
2012-06-04 10:47:12 +00:00
|
|
|
typedef struct encoder_control;
|
|
|
|
|
2012-06-04 08:53:48 +00:00
|
|
|
//ToDo: add ME data
|
2012-06-01 12:31:06 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-06-05 11:01:47 +00:00
|
|
|
void (*IME)();
|
|
|
|
void (*FME)();
|
2012-06-04 10:47:12 +00:00
|
|
|
int range;
|
2012-06-01 12:31:06 +00:00
|
|
|
|
|
|
|
} encoder_me;
|
|
|
|
|
2012-06-05 11:01:47 +00:00
|
|
|
/* Input info struct */
|
2012-06-01 12:31:06 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-06-04 08:53:48 +00:00
|
|
|
FILE* file;
|
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
|
|
|
uint32_t height_in_LCU;
|
2012-06-05 11:01:47 +00:00
|
|
|
uint32_t width_in_LCU;
|
|
|
|
picture cur_pic;
|
2012-06-01 12:31:06 +00:00
|
|
|
} encoder_input;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-06-05 11:01:47 +00:00
|
|
|
uint32_t frame;
|
|
|
|
config *cfg;
|
2012-06-01 12:31:06 +00:00
|
|
|
encoder_input in;
|
|
|
|
encoder_me me;
|
2012-06-05 11:01:47 +00:00
|
|
|
bitstream* stream;
|
|
|
|
FILE *output;
|
|
|
|
picture_list *ref;
|
2012-06-07 14:38:28 +00:00
|
|
|
uint8_t QP;
|
2012-06-01 12:31:06 +00:00
|
|
|
} encoder_control;
|
|
|
|
|
2012-06-05 11:01:47 +00:00
|
|
|
void init_encoder_control(encoder_control* control,bitstream* output);
|
|
|
|
void init_encoder_input(encoder_input* input,FILE* inputfile, uint32_t width, uint32_t height);
|
|
|
|
void encode_one_frame(encoder_control* encoder);
|
2012-06-01 12:31:06 +00:00
|
|
|
|
2012-06-05 12:38:54 +00:00
|
|
|
|
|
|
|
void encode_seq_parameter_set(encoder_control* encoder);
|
|
|
|
void encode_pic_parameter_set(encoder_control* encoder);
|
2012-06-06 11:09:28 +00:00
|
|
|
void encode_slice_data(encoder_control* encoder);
|
|
|
|
void encode_slice_header(encoder_control* encoder);
|
2012-06-06 13:20:29 +00:00
|
|
|
void encode_coding_tree(encoder_control* encoder,uint16_t xCtb,uint16_t yCtb, uint8_t depth);
|
2012-06-05 12:38:54 +00:00
|
|
|
|
2012-06-08 13:55:24 +00:00
|
|
|
|
2012-06-11 15:43:29 +00:00
|
|
|
static const uint8_t INIT_SPLIT_FLAG[3][3] =
|
|
|
|
{ { 107, 139, 126 }, { 107, 139, 126 }, { 139, 141, 157 } };
|
|
|
|
|
|
|
|
static const uint8_t INIT_INTRA_PRED_MODE[3] = { 183,154,184 };
|
|
|
|
|
|
|
|
static const uint8_t INIT_CHROMA_PRED_MODE[3][2] = { { 152, 139 }, { 152, 139 }, { 63, 139 } };
|
|
|
|
|
|
|
|
#define CNU 154
|
|
|
|
static const uint8_t INIT_TRANS_SUBDIV_FLAG[3][4] =
|
|
|
|
{
|
|
|
|
{ CNU, 153, 138, 138 },
|
|
|
|
{ CNU, 124, 138, 94 },
|
|
|
|
{ CNU, 224, 167, 122 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const uint8_t INIT_QT_CBF[3][8] =
|
|
|
|
{
|
|
|
|
{ 153, 111, CNU, CNU, CNU, 149, 92, 167 },
|
|
|
|
{ 153, 111, CNU, CNU, CNU, 149, 107, 167 },
|
|
|
|
{ 111, 141, CNU, CNU, CNU, 94, 138, 182 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-06-08 13:55:24 +00:00
|
|
|
|
2012-06-01 12:31:06 +00:00
|
|
|
#endif
|