1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

hevcdsp: separated sao edge filter and pixel restore funcs

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Reviewed-by: Mickaël Raulet <mraulet@insa-rennes.fr>
This commit is contained in:
Seppo Tomperi 2015-02-03 22:34:52 -03:00 committed by James Almer
parent fabbfaa095
commit 74d7faf400
4 changed files with 17 additions and 17 deletions

View File

@ -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,

View File

@ -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); \

View File

@ -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);

View File

@ -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,57 @@ 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,
uint8_t *horiz_edge, uint8_t *diag_edge)
{
int x, y;
pixel *dst = (pixel *)_dst;
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, width = _width, height = _height;
stride_dst /= sizeof(pixel);
stride_src /= sizeof(pixel);
if (sao_eo_class != SAO_EO_VERT) {
if (borders[0]) {
int offset_val = sao_offset_val[0];
for (y = 0; y < height; y++) {
dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val);
}
init_x = 1;
}
if (borders[2]) {
int offset_val = sao_offset_val[0];
int offset = width - 1;
for (x = 0; x < height; x++) {
dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val);
}
width--;
}
}
if (sao_eo_class != SAO_EO_HORIZ) {
if (borders[1]) {
int offset_val = sao_offset_val[0];
for (x = init_x; x < width; x++)
dst[x] = av_clip_pixel(src[x] + offset_val);
}
if (borders[3]) {
int offset_val = sao_offset_val[0];
int y_stride_dst = stride_dst * (height - 1);
int y_stride_src = stride_src * (height - 1);
for (x = init_x; x < width; x++)
dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val);
height--;
}
}
}
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,
@ -418,61 +468,6 @@ static void FUNC(sao_edge_filter_0)(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);
}
static void FUNC(sao_edge_filter_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,
uint8_t *horiz_edge, uint8_t *diag_edge)
{
int x, y;
pixel *dst = (pixel *)_dst;
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;
stride_dst /= sizeof(pixel);
stride_src /= sizeof(pixel);
if (sao_eo_class != SAO_EO_VERT) {
if (borders[0]) {
int offset_val = sao_offset_val[0];
for (y = 0; y < height; y++) {
dst[y * stride_dst] = av_clip_pixel(src[y * stride_src] + offset_val);
}
init_x = 1;
}
if (borders[2]) {
int offset_val = sao_offset_val[0];
int offset = width - 1;
for (x = 0; x < height; x++) {
dst[x * stride_dst + offset] = av_clip_pixel(src[x * stride_src + offset] + offset_val);
}
width--;
}
}
if (sao_eo_class != SAO_EO_HORIZ) {
if (borders[1]) {
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];
int y_stride_dst = stride_dst * (height - 1);
int y_stride_src = stride_src * (height - 1);
for (x = init_x; x < width; x++)
dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + offset_val);
height--;
}
}
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];