[FFmpeg-devel,5/6] avcodec/h264: mmx2, sse2, avx 10-bit h chroma intra deblock/loop filter

Submitted by James Darnley on Dec. 1, 2016, 4:57 p.m.

Details

Message ID 20161201165749.10368-6-jdarnley@obe.tv
State New
Headers show

Commit Message

James Darnley Dec. 1, 2016, 4:57 p.m.
Yorkfield:
 - mmx2: 0.99x faster (180 vs. 181 cycles)
 - sse2: 1.05x faster (180 vs. 170 cycles)

Skylake:
 - mmx2: 1.21x faster (125 vs. 103 cycles)
 - sse2: 1.54x faster (125 vs.  81 cycles)
 - avx:  1.29x faster (125 vs.  97 cycles)
---
 libavcodec/x86/h264_deblock_10bit.asm | 29 +++++++++++++++++++++++++++++
 libavcodec/x86/h264dsp_init.c         |  3 +++
 2 files changed, 32 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavcodec/x86/h264_deblock_10bit.asm b/libavcodec/x86/h264_deblock_10bit.asm
index 4c1dc6a..fb10bfb 100644
--- a/libavcodec/x86/h264_deblock_10bit.asm
+++ b/libavcodec/x86/h264_deblock_10bit.asm
@@ -1071,6 +1071,35 @@  cglobal deblock_h_chroma422_10, 5, 7, 8, 3*mmsize, pix_, stride_, alpha_, beta_,
     jl .loop
 RET
 
+;-----------------------------------------------------------------------------
+; void ff_deblock_h_chroma_intra_10(uint16_t *pix, int stride, int alpha,
+;                                   int beta)
+;-----------------------------------------------------------------------------
+cglobal deblock_h_chroma_intra_10, 4, 6, 8, 2*mmsize, pix_, stride_, alpha_, beta_
+    shl alpha_d,  2
+    shl beta_d,   2
+    mov r4,       pix_q
+    lea r5,      [3*stride_q]
+    add r4,       r5
+%if mmsize == 8
+    mov r5b,      2
+    .loop:
+%endif
+
+        CHROMA_H_LOAD r4, r5, [rsp], [rsp + mmsize]
+        LOAD_AB     m4, m5, alpha_d, beta_d
+        LOAD_MASK   m0, m1, m2, m3, m4, m5, m7, m6, m4
+        CHROMA_DEBLOCK_P0_Q0_INTRA m1, m2, m0, m3, m7, m5, m6
+        CHROMA_H_STORE r4, r5, [rsp], [rsp + mmsize]
+
+%if mmsize == 8
+        lea pix_q, [pix_q + 4*stride_q]
+        lea r4,    [r4 + 4*stride_q]
+        dec r5b
+    jg .loop
+%endif
+RET
+
 %endmacro
 
 %if ARCH_X86_64 == 0
diff --git a/libavcodec/x86/h264dsp_init.c b/libavcodec/x86/h264dsp_init.c
index 7b3d17f..395b8c3 100644
--- a/libavcodec/x86/h264dsp_init.c
+++ b/libavcodec/x86/h264dsp_init.c
@@ -315,6 +315,7 @@  av_cold void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
             c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_mmxext;
             if (chroma_format_idc <= 1) {
                 c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_10_mmxext;
+                c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma_intra_10_mmxext;
             } else {
                 c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_10_mmxext;
             }
@@ -353,6 +354,7 @@  av_cold void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
             c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_sse2;
             if (chroma_format_idc <= 1) {
                 c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_10_sse2;
+                c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma_intra_10_sse2;
             } else {
                 c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_10_sse2;
             }
@@ -393,6 +395,7 @@  av_cold void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
             c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_avx;
             if (chroma_format_idc <= 1) {
                 c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_10_avx;
+                c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma_intra_10_avx;
             } else {
                 c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_10_avx;
             }