Commit 74d7faf4 authored by Seppo Tomperi's avatar Seppo Tomperi Committed by James Almer

hevcdsp: separated sao edge filter and pixel restore funcs

Reviewed-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Reviewed-by: 's avatarChristophe Gisquet <christophe.gisquet@gmail.com>
Reviewed-by: 's avatarMickaël Raulet <mraulet@insa-rennes.fr>
parent fabbfaa0
......@@ -427,7 +427,8 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y)
copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
x_ctb, y_ctb);
s->hevcdsp.sao_edge_filter[restore](src, dst,
s->hevcdsp.sao_edge_filter(src, dst, stride_src, stride_dst, sao, width, height, c_idx, 0, 0);
s->hevcdsp.sao_edge_restore[restore](src, dst,
stride_src, stride_dst,
sao,
edges, width,
......
......@@ -217,8 +217,9 @@ void ff_hevc_dsp_init(HEVCDSPContext *hevcdsp, int bit_depth)
hevcdsp->sao_band_filter[2] = \
hevcdsp->sao_band_filter[3] = \
hevcdsp->sao_band_filter[4] = FUNC(sao_band_filter_0, depth); \
hevcdsp->sao_edge_filter[0] = FUNC(sao_edge_filter_0, depth); \
hevcdsp->sao_edge_filter[1] = FUNC(sao_edge_filter_1, depth); \
hevcdsp->sao_edge_filter = FUNC(sao_edge_filter, depth); \
hevcdsp->sao_edge_restore[0] = FUNC(sao_edge_restore_0, depth); \
hevcdsp->sao_edge_restore[1] = FUNC(sao_edge_restore_1, depth); \
\
QPEL_FUNCS(depth); \
QPEL_UNI_FUNCS(depth); \
......
......@@ -61,10 +61,13 @@ typedef struct HEVCDSPContext {
void (*sao_band_filter[5])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
int16_t *sao_offset_val, int sao_left_class, int width, int height);
void (*sao_edge_filter[2])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
struct SAOParams *sao, int *borders, int _width,
int _height, int c_idx, uint8_t *vert_edge,
uint8_t *horiz_edge, uint8_t *diag_edge);
void (*sao_edge_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride_dst,
ptrdiff_t stride_src, SAOParams *sao, int width,
int height, int c_idx, int init_x, int init_y);
void (*sao_edge_restore[2])(uint8_t *_dst, uint8_t *_src, ptrdiff_t _stride_dst, ptrdiff_t _stride_src,
struct SAOParams *sao, int *borders, int _width, int _height, int c_idx,
uint8_t *vert_edge, uint8_t *horiz_edge, uint8_t *diag_edge);
void (*put_hevc_qpel[10][2][2])(int16_t *dst, uint8_t *src, ptrdiff_t srcstride,
int height, intptr_t mx, intptr_t my, int width);
......
......@@ -344,8 +344,8 @@ static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src,
pixel *dst = (pixel *)_dst;
pixel *src = (pixel *)_src;
int y_stride_src = init_y * stride_src;
int y_stride_dst = init_y * stride_dst;
int y_stride_src = init_y * (stride_src /= sizeof(pixel));
int y_stride_dst = init_y * (stride_dst /= sizeof(pixel));
int pos_0_0 = pos[sao_eo_class][0][0];
int pos_0_1 = pos[sao_eo_class][0][1];
int pos_1_0 = pos[sao_eo_class][1][0];
......@@ -368,7 +368,7 @@ static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src,
}
}
static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
static void FUNC(sao_edge_restore_0)(uint8_t *_dst, uint8_t *_src,
ptrdiff_t stride_dst, ptrdiff_t stride_src, SAOParams *sao,
int *borders, int _width, int _height,
int c_idx, uint8_t *vert_edge,
......@@ -379,7 +379,7 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
pixel *src = (pixel *)_src;
int16_t *sao_offset_val = sao->offset_val[c_idx];
int sao_eo_class = sao->eo_class[c_idx];
int init_x = 0, init_y = 0, width = _width, height = _height;
int init_x = 0, width = _width, height = _height;
stride_dst /= sizeof(pixel);
stride_src /= sizeof(pixel);
......@@ -406,7 +406,6 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
int offset_val = sao_offset_val[0];
for (x = init_x; x < width; x++)
dst[x] = av_clip_pixel(src[x] + offset_val);
init_y = 1;
}
if (borders[3]) {
int offset_val = sao_offset_val[0];
......@@ -417,11 +416,9 @@ static void FUNC(sao_edge_filter_0)(uint8_t *_dst, uint8_t *_src,
height--;
}
}
FUNC(sao_edge_filter)((uint8_t *)dst, (uint8_t *)src, stride_dst, stride_src, sao, width, height, c_idx, init_x, init_y);
}
static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
static void FUNC(sao_edge_restore_1)(uint8_t *_dst, uint8_t *_src,
ptrdiff_t stride_dst, ptrdiff_t stride_src, SAOParams *sao,
int *borders, int _width, int _height,
int c_idx, uint8_t *vert_edge,
......@@ -471,8 +468,6 @@ static void FUNC(sao_edge_filter_1)(uint8_t *_dst, uint8_t *_src,
}
}
FUNC(sao_edge_filter)((uint8_t *)dst, (uint8_t *)src, stride_dst, stride_src, sao, width, height, c_idx, init_x, init_y);
{
int save_upper_left = !diag_edge[0] && sao_eo_class == SAO_EO_135D && !borders[0] && !borders[1];
int save_upper_right = !diag_edge[1] && sao_eo_class == SAO_EO_45D && !borders[1] && !borders[2];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment