25 ptrdiff_t stride_dst, ptrdiff_t stride_src,
26 const int16_t *sao_offset_val,
int sao_left_class,
35 stride_dst /=
sizeof(
pixel);
36 stride_src /=
sizeof(
pixel);
38 for (k = 0; k < 4; k++)
39 offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
40 for (y = 0; y <
height; y++) {
41 for (x = 0; x <
width; x++)
48 #define CMP(a, b) (((a) > (b)) - ((a) < (b)))
53 static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 };
54 static const int8_t
pos[4][2][2] = {
55 { { -1, 0 }, { 1, 0 } },
56 { { 0, -1 }, { 0, 1 } },
57 { { -1, -1 }, { 1, 1 } },
58 { { 1, -1 }, { -1, 1 } },
62 int a_stride, b_stride;
65 stride_dst /=
sizeof(
pixel);
67 a_stride =
pos[eo][0][0] +
pos[eo][0][1] * stride_src;
68 b_stride =
pos[eo][1][0] +
pos[eo][1][1] * stride_src;
69 for (y = 0; y <
height; y++) {
70 for (x = 0; x <
width; x++) {
71 int diff0 =
CMP(
src[x],
src[x + a_stride]);
72 int diff1 =
CMP(
src[x],
src[x + b_stride]);
73 int offset_val = edge_idx[2 + diff0 + diff1];
82 ptrdiff_t stride_dst, ptrdiff_t stride_src,
const SAOParams *sao,
83 const int *borders,
int _width,
int _height,
84 int c_idx,
const uint8_t *vert_edge,
85 const uint8_t *horiz_edge,
const uint8_t *diag_edge)
90 const int16_t *sao_offset_val = sao->offset_val[c_idx];
91 int sao_eo_class = sao->eo_class[c_idx];
94 stride_dst /=
sizeof(
pixel);
95 stride_src /=
sizeof(
pixel);
99 int offset_val = sao_offset_val[0];
100 for (y = 0; y <
height; y++) {
106 int offset_val = sao_offset_val[0];
108 for (x = 0; x <
height; x++) {
116 int offset_val = sao_offset_val[0];
117 for (x = init_x; x <
width; x++)
121 int offset_val = sao_offset_val[0];
122 ptrdiff_t y_stride_dst = stride_dst * (
height - 1);
123 ptrdiff_t y_stride_src = stride_src * (
height - 1);
124 for (x = init_x; x <
width; x++)
132 ptrdiff_t stride_dst, ptrdiff_t stride_src,
const SAOParams *sao,
133 const int *borders,
int _width,
int _height,
134 int c_idx,
const uint8_t *vert_edge,
135 const uint8_t *horiz_edge,
const uint8_t *diag_edge)
140 const int16_t *sao_offset_val = sao->offset_val[c_idx];
141 int sao_eo_class = sao->eo_class[c_idx];
142 int init_x = 0, init_y = 0,
width = _width,
height = _height;
144 stride_dst /=
sizeof(
pixel);
145 stride_src /=
sizeof(
pixel);
149 int offset_val = sao_offset_val[0];
150 for (y = 0; y <
height; y++) {
156 int offset_val = sao_offset_val[0];
158 for (x = 0; x <
height; x++) {
166 int offset_val = sao_offset_val[0];
167 for (x = init_x; x <
width; x++)
172 int offset_val = sao_offset_val[0];
173 ptrdiff_t y_stride_dst = stride_dst * (
height - 1);
174 ptrdiff_t y_stride_src = stride_src * (
height - 1);
175 for (x = init_x; x <
width; x++)
182 int save_upper_left = !diag_edge[0] && sao_eo_class ==
SAO_EO_135D && !borders[0] && !borders[1];
183 int save_upper_right = !diag_edge[1] && sao_eo_class ==
SAO_EO_45D && !borders[1] && !borders[2];
184 int save_lower_right = !diag_edge[2] && sao_eo_class ==
SAO_EO_135D && !borders[2] && !borders[3];
185 int save_lower_left = !diag_edge[3] && sao_eo_class ==
SAO_EO_45D && !borders[0] && !borders[3];
189 for(y = init_y+save_upper_left; y<
height-save_lower_left; y++)
190 dst[y*stride_dst] =
src[y*stride_src];
193 for(y = init_y+save_upper_right; y<
height-save_lower_right; y++)
198 for(x = init_x+save_upper_left; x <
width-save_upper_right; x++)
202 for(x = init_x+save_lower_left; x <
width-save_lower_right; x++)
207 if(diag_edge[1] && sao_eo_class ==
SAO_EO_45D)
211 if(diag_edge[3] && sao_eo_class ==
SAO_EO_45D)