[FFmpeg-devel] [PATCH 2/3] x86: huffyuvdsp: add_hfyu_left_pred_bgr32
Christophe Gisquet
christophe.gisquet at gmail.com
Tue Jun 3 21:51:53 CEST 2014
C MMX SSE2
Cycles: 3092 1053 578
---
libavcodec/x86/huffyuvdsp.asm | 41 ++++++++++++++++++++++++++++++++++++++++
libavcodec/x86/huffyuvdsp_init.c | 10 +++++++++-
2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/libavcodec/x86/huffyuvdsp.asm b/libavcodec/x86/huffyuvdsp.asm
index 7ebb07c..1941b5a 100644
--- a/libavcodec/x86/huffyuvdsp.asm
+++ b/libavcodec/x86/huffyuvdsp.asm
@@ -1,6 +1,7 @@
;******************************************************************************
;* SIMD-optimized HuffYUV functions
;* Copyright (c) 2008 Loren Merritt
+;* Copyright (c) 2014 Christophe Gisquet
;*
;* This file is part of FFmpeg.
;*
@@ -222,3 +223,43 @@ INIT_MMX mmx
ADD_BYTES
INIT_XMM sse2
ADD_BYTES
+
+; void add_hfyu_left_pred_bgr32(uint8_t *dst, const uint8_t *src,
+; intptr_t w, uint8_t *left)
+%macro LEFT_BGR32 0
+cglobal add_hfyu_left_pred_bgr32, 4,4,3, dst, src, w, left
+ shl wq, 2
+ movd m0, [leftq]
+ lea dstq, [dstq + wq]
+ lea srcq, [srcq + wq]
+ LSHIFT m0, mmsize-4
+ neg wq
+.loop:
+ movu m1, [srcq+wq]
+ mova m2, m1
+%if mmsize == 8
+ punpckhdq m0, m0
+%endif
+ LSHIFT m1, 4
+ paddb m1, m2
+%if mmsize == 8
+ paddb m0, m1
+%else
+ pshufd m0, m0, q3333
+ mova m2, m1
+ LSHIFT m1, 8
+ paddb m2, m1
+ paddb m0, m2
+%endif
+ movu [dstq+wq], m0
+ add wq, mmsize
+ jl .loop
+ movd m0, [dstq-4]
+ movd [leftq], m0
+ REP_RET
+%endmacro
+
+INIT_MMX mmx
+LEFT_BGR32
+INIT_XMM sse2
+LEFT_BGR32
diff --git a/libavcodec/x86/huffyuvdsp_init.c b/libavcodec/x86/huffyuvdsp_init.c
index 86e482c..7bbef1e 100644
--- a/libavcodec/x86/huffyuvdsp_init.c
+++ b/libavcodec/x86/huffyuvdsp_init.c
@@ -41,6 +41,11 @@ int ff_add_hfyu_left_pred_ssse3(uint8_t *dst, const uint8_t *src,
int ff_add_hfyu_left_pred_sse4(uint8_t *dst, const uint8_t *src,
int w, int left);
+void ff_add_hfyu_left_pred_bgr32_mmx(uint8_t *dst, const uint8_t *src,
+ intptr_t w, uint8_t *left);
+void ff_add_hfyu_left_pred_bgr32_sse2(uint8_t *dst, const uint8_t *src,
+ intptr_t w, uint8_t *left);
+
av_cold void ff_huffyuvdsp_init_x86(HuffYUVDSPContext *c)
{
int cpu_flags = av_get_cpu_flags();
@@ -50,8 +55,10 @@ av_cold void ff_huffyuvdsp_init_x86(HuffYUVDSPContext *c)
c->add_hfyu_median_pred = ff_add_hfyu_median_pred_cmov;
#endif
- if (EXTERNAL_MMX(cpu_flags))
+ if (EXTERNAL_MMX(cpu_flags)) {
c->add_bytes = ff_add_bytes_mmx;
+ c->add_hfyu_left_pred_bgr32 = ff_add_hfyu_left_pred_bgr32_mmx;
+ }
if (EXTERNAL_MMXEXT(cpu_flags)) {
/* slower than cmov version on AMD */
@@ -62,6 +69,7 @@ av_cold void ff_huffyuvdsp_init_x86(HuffYUVDSPContext *c)
if (EXTERNAL_SSE2(cpu_flags)) {
c->add_bytes = ff_add_bytes_sse2;
c->add_hfyu_median_pred = ff_add_hfyu_median_pred_sse2;
+ c->add_hfyu_left_pred_bgr32 = ff_add_hfyu_left_pred_bgr32_sse2;
}
if (EXTERNAL_SSSE3(cpu_flags)) {
--
1.8.0.msysgit.0
More information about the ffmpeg-devel
mailing list