diff options
author | James Almer <jamrial@gmail.com> | 2015-02-01 15:01:36 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2015-02-01 20:22:35 -0300 |
commit | fa3eccb4f9f3ecc9e2bb3c5924c2aa343b808076 (patch) | |
tree | 3cb8dd1f22abc025929deedb3cd90c672d68ad53 /libavcodec/hevc_filter.c | |
parent | a1684311b3de0766932c42b1ffdd59823d786bc2 (diff) | |
download | ffmpeg-fa3eccb4f9f3ecc9e2bb3c5924c2aa343b808076.tar.gz |
x86/hevc: add ff_hevc_sao_band_filter_{8,10,12}_{sse2,avx,avx2}
Original x86 intrinsics code and initial 8bit yasm port by Pierre-Edouard Lepere.
10/12bit yasm ports, refactoring and optimizations by James Almer
Benchmarks of BQTerrace_1920x1080_60_qp22.bin with an Intel Core i5-4200U
width 32
40338 decicycles in sao_band_filter_0_8, 2048 runs, 0 skips
8056 decicycles in ff_hevc_sao_band_filter_8_32_sse2, 2048 runs, 0 skips
7458 decicycles in ff_hevc_sao_band_filter_8_32_avx, 2048 runs, 0 skips
4504 decicycles in ff_hevc_sao_band_filter_8_32_avx2, 2048 runs, 0 skips
width 64
136046 decicycles in sao_band_filter_0_8, 16384 runs, 0 skips
28576 decicycles in ff_hevc_sao_band_filter_8_32_sse2, 16384 runs, 0 skips
26707 decicycles in ff_hevc_sao_band_filter_8_32_avx, 16384 runs, 0 skips
14387 decicycles in ff_hevc_sao_band_filter_8_32_avx2, 16384 runs, 0 skips
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/hevc_filter.c')
-rw-r--r-- | libavcodec/hevc_filter.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index fb1aa373df..9354c14300 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -187,6 +187,7 @@ static void restore_tqb_pixels(HEVCContext *s, int x0, int y0, int width, int he static void sao_filter_CTB(HEVCContext *s, int x, int y) { + static const uint8_t band_tab[8] = { 0, 1, 2, 2, 3, 3, 4, 4 }; int c_idx; int edges[4]; // 0 left 1 top 2 right 3 bottom int x_ctb = x >> s->sps->log2_ctb_size; @@ -252,15 +253,16 @@ static void sao_filter_CTB(HEVCContext *s, int x, int y) int ctb_size_v = (1 << (s->sps->log2_ctb_size)) >> s->sps->vshift[c_idx]; int width = FFMIN(ctb_size_h, (s->sps->width >> s->sps->hshift[c_idx]) - x0); int height = FFMIN(ctb_size_v, (s->sps->height >> s->sps->vshift[c_idx]) - y0); + int tab = band_tab[(FFALIGN(width, 8) >> 3) - 1]; uint8_t *src = &s->frame->data[c_idx][y0 * stride_src + (x0 << s->sps->pixel_shift)]; uint8_t *dst = &s->sao_frame->data[c_idx][y0 * stride_dst + (x0 << s->sps->pixel_shift)]; switch (sao->type_idx[c_idx]) { case SAO_BAND: copy_CTB(dst, src, width << s->sps->pixel_shift, height, stride_dst, stride_src); - s->hevcdsp.sao_band_filter(src, dst, stride_src, stride_dst, - sao->offset_val[c_idx], sao->band_position[c_idx], - width, height); + s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst, + sao->offset_val[c_idx], sao->band_position[c_idx], + width, height); restore_tqb_pixels(s, x, y, width, height, c_idx); sao->type_idx[c_idx] = SAO_APPLIED; break; |