TUT HEVC Encoder
Loading...
Searching...
No Matches
encoder.h
Go to the documentation of this file.
1#ifndef ENCODER_H_
2#define ENCODER_H_
3/*****************************************************************************
4 * This file is part of Kvazaar HEVC encoder.
5 *
6 * Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice, this
16 * list of conditions and the following disclaimer in the documentation and/or
17 * other materials provided with the distribution.
18 *
19 * * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
33 ****************************************************************************/
34
41#include "global.h" // IWYU pragma: keep
42#include "kvazaar.h"
43#include "scalinglist.h"
44#include "threadqueue.h"
45#include "fast_coeff_cost.h"
46
47/* Encoder control options, the main struct */
48typedef struct encoder_control_t
49{
62
63 /* Input */
64 struct {
65 int32_t width;
66 int32_t height;
67 int32_t width_in_lcu;
69 int32_t real_width;
70 int32_t real_height;
73 } in;
74
75 /* TODO: add ME data */
76 struct {
77 void(*IME)();
78 void(*FME)();
79 int range;
80 } me;
81
82 int8_t bitdepth;
84
85 /* VUI */
86 struct
87 {
88 /* Timing info */
90 int32_t time_scale;
94
96 } vui;
97
98 //scaling list
100
101 //spec: references to variables defined in Rec. ITU-T H.265 (04/2013)
106 const int32_t *tiles_col_width;
107 const int32_t *tiles_row_height;
109 const int32_t *tiles_col_bd;
110 const int32_t *tiles_row_bd;
112 //PicSizeInCtbsY = height_in_lcu * width_in_lcu
113 const int32_t *tiles_ctb_addr_rs_to_ts;
114 const int32_t *tiles_ctb_addr_ts_to_rs;
116 const int32_t *tiles_tile_id;
118 //Slices
121
123
126
129
132
133 FILE *roi_file;
134
136
138 struct {
141
143 struct {
144 int right;
145 int down;
147
149
151
153
156
157void kvz_encoder_control_input_init(encoder_control_t *encoder, int32_t width, int32_t height);
158#endif
void kvz_encoder_control_free(encoder_control_t *encoder)
Free an encoder control structure.
Definition encoder.c:609
void kvz_encoder_control_input_init(encoder_control_t *encoder, int32_t width, int32_t height)
Definition encoder.c:645
struct encoder_control_t encoder_control_t
encoder_control_t * kvz_encoder_control_init(const kvz_config *cfg)
Allocate and initialize an encoder control structure.
Definition encoder.c:134
Header that is included in every other header.
#define MAX_GOP_LAYERS
Maximum number of layers in GOP structure (for allocating structures)
Definition global.h:130
This file defines the public API of Kvazaar when used as a library.
kvz_chroma_format
Chroma subsampling format used for encoding.
Definition kvazaar.h:209
Scaling list initialization.
Definition encoder.h:49
int tr_depth_inter
Definition encoder.h:135
int32_t width_in_lcu
Definition encoder.h:67
const int32_t * tiles_tile_id
Definition encoder.h:116
int8_t timing_info_present_flag
Definition encoder.h:95
const int32_t * tiles_ctb_addr_rs_to_ts
Definition encoder.h:113
struct encoder_control_t::@7 vui
int8_t frame_field_info_present_flag
Definition encoder.h:93
int8_t tiles_enable
Definition encoder.h:102
int8_t source_scan_type
Definition encoder.h:72
const int32_t * tiles_col_bd
Definition encoder.h:109
int32_t num_units_in_tick
Timing scale numerator.
Definition encoder.h:89
int8_t tiles_uniform_spacing_flag
Definition encoder.h:104
int32_t height_in_lcu
Definition encoder.h:68
fast_coeff_table_t fast_coeff_table
Definition encoder.h:150
struct encoder_control_t::@5 in
int down
Definition encoder.h:145
int32_t real_width
real input picture width
Definition encoder.h:69
const int32_t * tiles_row_height
Definition encoder.h:107
struct encoder_control_t::@8 pps
pic_parameter_set
double gop_layer_weights[6]
Picture weights when GOP is used.
Definition encoder.h:131
kvz_config cfg
Configuration.
Definition encoder.h:61
struct encoder_control_t::@6 me
double target_avg_bpp
Target average bits per pixel.
Definition encoder.h:128
int right
Definition encoder.h:144
int32_t height
Definition encoder.h:66
enum kvz_chroma_format chroma_format
Definition encoder.h:83
int64_t pixels_per_pic
Definition encoder.h:71
void(* IME)()
Definition encoder.h:77
int32_t width
Definition encoder.h:65
const int * slice_addresses_in_ts
Definition encoder.h:120
const int32_t * tiles_row_bd
Definition encoder.h:110
const int32_t * tiles_col_width
Definition encoder.h:106
int8_t bitdepth
Definition encoder.h:82
double target_avg_bppic
Target average bits per picture.
Definition encoder.h:125
int32_t poc_lsb_bits
Definition encoder.h:148
const int32_t * tiles_ctb_addr_ts_to_rs
Definition encoder.h:114
struct encoder_control_t::@9 max_inter_ref_lcu
Maximum motion vector distance as number of LCUs.
uint8_t dependent_slice_segments_enabled_flag
Definition encoder.h:139
void(* FME)()
Definition encoder.h:78
scaling_list_t scaling_list
Definition encoder.h:99
int slice_count
Definition encoder.h:119
int8_t field_seq_flag
Definition encoder.h:92
int32_t time_scale
Timing scale denominator.
Definition encoder.h:90
int range
Definition encoder.h:79
int32_t real_height
real input picture height
Definition encoder.h:70
FILE * roi_file
Definition encoder.h:133
threadqueue_queue_t * threadqueue
Definition encoder.h:122
Definition fast_coeff_cost.h:42
Struct which contains all configuration data.
Definition kvazaar.h:287
Definition scalinglist.h:46
Definition threadqueue.c:178
Container for worker tasks.