diff options
author | Seppo Tomperi <seppo.tomperi@vtt.fi> | 2015-02-03 22:36:42 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2015-02-04 17:52:54 -0300 |
commit | 4386e1fd94cd5a60b95dd19f75dcefa7c579c9f9 (patch) | |
tree | 86f2874744ffcea076e0fac84452ec8ccb2f5dd4 /libavcodec/hevcdsp_template.c | |
parent | 74d7faf4001e74c54f81000e521cef8e9965c80b (diff) | |
download | ffmpeg-4386e1fd94cd5a60b95dd19f75dcefa7c579c9f9.tar.gz |
hevcdsp: simplified sao_edge_filter
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Reviewed-by: Mickaƫl Raulet <mraulet@insa-rennes.fr>
Diffstat (limited to 'libavcodec/hevcdsp_template.c')
-rw-r--r-- | libavcodec/hevcdsp_template.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index 37c30b93a2..d372c9a2a6 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -330,7 +330,7 @@ static void FUNC(sao_band_filter_0)(uint8_t *_dst, uint8_t *_src, static void FUNC(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) { + int c_idx) { static const uint8_t edge_idx[] = { 1, 2, 0, 3, 4 }; static const int8_t pos[4][2][2] = { @@ -340,31 +340,27 @@ static void FUNC(sao_edge_filter)(uint8_t *_dst, uint8_t *_src, { { 1, -1 }, { -1, 1 } }, // 135 degree }; int16_t *sao_offset_val = sao->offset_val[c_idx]; - int sao_eo_class = sao->eo_class[c_idx]; + int eo = sao->eo_class[c_idx]; pixel *dst = (pixel *)_dst; pixel *src = (pixel *)_src; - - 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]; - int pos_1_1 = pos[sao_eo_class][1][1]; + int a_stride, b_stride; + int src_offset = 0; + int dst_offset = 0; int x, y; + stride_src /= sizeof(pixel); + stride_dst /= sizeof(pixel); - int y_stride_0_1 = (init_y + pos_0_1) * stride_src; - int y_stride_1_1 = (init_y + pos_1_1) * stride_src; - for (y = init_y; y < height; y++) { - for (x = init_x; x < width; x++) { - int diff0 = CMP(src[x + y_stride_src], src[x + pos_0_0 + y_stride_0_1]); - int diff1 = CMP(src[x + y_stride_src], src[x + pos_1_0 + y_stride_1_1]); + a_stride = pos[eo][0][0] + pos[eo][0][1] * stride_src; + b_stride = pos[eo][1][0] + pos[eo][1][1] * stride_src; + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + int diff0 = CMP(src[x + src_offset], src[x + src_offset + a_stride]); + int diff1 = CMP(src[x + src_offset], src[x + src_offset + b_stride]); int offset_val = edge_idx[2 + diff0 + diff1]; - dst[x + y_stride_dst] = av_clip_pixel(src[x + y_stride_src] + sao_offset_val[offset_val]); + dst[x + dst_offset] = av_clip_pixel(src[x + src_offset] + sao_offset_val[offset_val]); } - y_stride_src += stride_src; - y_stride_dst += stride_dst; - y_stride_0_1 += stride_src; - y_stride_1_1 += stride_src; + src_offset += stride_src; + dst_offset += stride_dst; } } |