TUT HEVC Encoder
Loading...
Searching...
No Matches
sao.h
Go to the documentation of this file.
1#ifndef SAO_H_
2#define SAO_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 "checkpoint.h"
42#include "cu.h"
43#include "encoder.h"
44#include "encoderstate.h"
45#include "global.h" // IWYU pragma: keep
46#include "kvazaar.h"
47#include "videoframe.h"
48
49
53
54
64
65
66// Offsets of a and b in relation to c.
67// dir_offset[dir][a or b]
68// | | a | a | a |
69// | a c b | c | c | c |
70// | | b | b | b |
72 { { -1, 0 }, { 1, 0 } },
73 { { 0, -1 }, { 0, 1 } },
74 { { -1, -1 }, { 1, 1 } },
75 { { 1, -1 }, { -1, 1 } }
76};
77
78
79#define CHECKPOINT_SAO_INFO(prefix_str, sao) CHECKPOINT(prefix_str " type=%d eo_class=%d ddistortion=%d " \
80 "merge_left_flag=%d merge_up_flag=%d band_position=%d " \
81 "offsets[0]=%d offsets[1]=%d offsets[2]=%d offsets[3]=%d offsets[4]=%d", \
82 (sao).type, (sao).eo_class, (sao).ddistortion, \
83 (sao).merge_left_flag, (sao).merge_up_flag, (sao).band_position[0], \
84 (sao).offsets[0], (sao).offsets[1], (sao).offsets[2], (sao).offsets[3], (sao).offsets[4])
85
86
87void kvz_sao_reconstruct(const encoder_state_t *state,
88 const kvz_pixel *buffer,
89 int stride,
90 int frame_x,
91 int frame_y,
92 int width,
93 int height,
94 const sao_info_t *sao,
95 color_t color);
96
97void kvz_sao_search_lcu(const encoder_state_t* const state, int lcu_x, int lcu_y);
98void kvz_calc_sao_offset_array(const encoder_control_t * const encoder, const sao_info_t *sao, int *offset, color_t color_i);
99
100#endif
Printing of debug information.
Coding Unit data structure and related functions.
Initialization of encoder_control_t.
Top level of the encoder implementation.
Header that is included in every other header.
color_t
Definition global.h:309
This file defines the public API of Kvazaar when used as a library.
uint8_t kvz_pixel
Definition kvazaar.h:95
static const vector2d_t g_sao_edge_offsets[SAO_NUM_EO][2]
Definition sao.h:71
sao_eo_class
Definition sao.h:51
@ SAO_EO2
Definition sao.h:51
@ SAO_EO0
Definition sao.h:51
@ SAO_EO1
Definition sao.h:51
@ SAO_NUM_EO
Definition sao.h:51
@ SAO_EO3
Definition sao.h:51
sao_eo_cat
Definition sao.h:52
@ SAO_EO_CAT0
Definition sao.h:52
@ SAO_EO_CAT1
Definition sao.h:52
@ SAO_EO_CAT4
Definition sao.h:52
@ SAO_EO_CAT2
Definition sao.h:52
@ NUM_SAO_EDGE_CATEGORIES
Definition sao.h:52
@ SAO_EO_CAT3
Definition sao.h:52
sao_type
Definition sao.h:50
@ SAO_TYPE_BAND
Definition sao.h:50
@ SAO_TYPE_EDGE
Definition sao.h:50
@ SAO_TYPE_NONE
Definition sao.h:50
void kvz_sao_search_lcu(const encoder_state_t *const state, int lcu_x, int lcu_y)
Definition sao.c:671
struct sao_info_t sao_info_t
void kvz_calc_sao_offset_array(const encoder_control_t *const encoder, const sao_info_t *sao, int *offset, color_t color_i)
calculate an array of intensity correlations for each intensity value
Definition sao.c:180
void kvz_sao_reconstruct(const encoder_state_t *state, const kvz_pixel *buffer, int stride, int frame_x, int frame_y, int width, int height, const sao_info_t *sao, color_t color)
Reconstruct SAO.
Definition sao.c:302
Definition encoder.h:49
Definition encoderstate.h:274
Definition sao.h:55
sao_type type
Definition sao.h:56
sao_eo_class eo_class
Definition sao.h:57
int offsets[NUM_SAO_EDGE_CATEGORIES *2]
Definition sao.h:62
int merge_up_flag
Definition sao.h:60
int band_position[2]
Definition sao.h:61
int ddistortion
Definition sao.h:58
int merge_left_flag
Definition sao.h:59
Definition cu.h:121
Container for the frame currently being encoded.