33#ifndef SAO_BAND_DDISTORTION_H_
34#define SAO_BAND_DDISTORTION_H_
45 static const int sao_eo_idx_to_eo_category[] = { 1, 2, 0, 3, 4 };
47 int eo_idx = 2 +
SIGN3((
int)c - (
int)a) +
SIGN3((
int)c - (
int)b);
49 return sao_eo_idx_to_eo_category[eo_idx];
64 for (y = 1; y < block_height - 1; y++) {
65 for (x = 1; x < block_width - 1; x++) {
66 uint32_t c_pos = y * block_width + x;
67 uint32_t a_pos = (y + a_ofs.
y) * block_width + x + a_ofs.
x;
68 uint32_t b_pos = (y + b_ofs.
y) * block_width + x + b_ofs.
x;
70 uint8_t a = rec_data[a_pos];
71 uint8_t b = rec_data[b_pos];
72 uint8_t c = rec_data[c_pos];
73 uint8_t orig = orig_data[c_pos];
76 int32_t offset = offsets[eo_cat];
79 int32_t diff = orig - c;
80 int32_t delta = diff - offset;
81 int32_t curr = delta * delta - diff * diff;
96 const int sao_bands[4])
101 for (y = 0; y < block_height; ++y) {
102 for (x = 0; x < block_width; ++x) {
103 const int32_t curr_pos = y * block_width + x;
108 int32_t band = (rec >> shift) - band_pos;
110 if (band >= 0 && band <= 3) {
111 offset = sao_bands[band];
115 int32_t diff = orig - rec;
116 int32_t delta = diff - offset;
118 int32_t dmask = (offset == 0) ? -1 : 0;
122 sum += delta * delta - diff * diff;
Top level of the encoder implementation.
#define SIGN3(x)
Definition global.h:216
This file defines the public API of Kvazaar when used as a library.
uint8_t kvz_pixel
Definition kvazaar.h:95
Sample Adaptive Offset filter.
static const vector2d_t g_sao_edge_offsets[SAO_NUM_EO][2]
Definition sao.h:71
@ NUM_SAO_EDGE_CATEGORIES
Definition sao.h:52
static int sao_band_ddistortion_generic(const encoder_state_t *const state, const kvz_pixel *orig_data, const kvz_pixel *rec_data, int block_width, int block_height, int band_pos, const int sao_bands[4])
Definition sao_shared_generics.h:90
static int sao_calc_eo_cat(kvz_pixel a, kvz_pixel b, kvz_pixel c)
Definition sao_shared_generics.h:42
static int sao_edge_ddistortion_generic(const kvz_pixel *orig_data, const kvz_pixel *rec_data, int32_t block_width, int32_t block_height, int32_t eo_class, const int32_t offsets[NUM_SAO_EDGE_CATEGORIES])
Definition sao_shared_generics.h:52
int8_t bitdepth
Definition encoder.h:82
Definition encoderstate.h:274
const encoder_control_t * encoder_control
Definition encoderstate.h:275