History

avfilter/x86/vf_eq: add SSE2 version

Ting Fu committed 7 years ago

Commit 4f589d61 parent 6aff2042 files · +29 −2Browse files

Unified · Split

2 files
  1. libavfilter/x86/vf_eq.asm +10 −2
  2. libavfilter/x86/vf_eq_init.c +19 −0
libavfilter/x86/vf_eq.asm+10−2
@@ -24,7 +24,7 @@ · 23 unmodified lines
24 24
25SECTION .text25SECTION .text
26 26
27INIT_MMX mmxext27%macro PROCESS_ONE_LINE 1
28cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w28cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w
29 movd m3, contrastd29 movd m3, contrastd
30 movd m4, brightnessd30 movd m4, brightnessd
@@ -39,7 +39,7 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w · 8 unmodified lines
39 pxor m1, m139 pxor m1, m1
40 mov scalard, wd40 mov scalard, wd
41 and scalard, mmsize-141 and scalard, mmsize-1
42 sar wd, 342 sar wd, %1
43 cmp wd, 143 cmp wd, 1
44 jl .loop144 jl .loop1
45 45
@@ -80,3 +80,11 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w · 34 unmodified lines
80 80
81 .end:81 .end:
82 RET82 RET
83
84%endmacro
85
86INIT_MMX mmxext
87PROCESS_ONE_LINE 3
88
89INIT_XMM sse2
90PROCESS_ONE_LINE 4
libavfilter/x86/vf_eq_init.c+19−0
@@ -28,6 +28,8 @@ · 27 unmodified lines
28 28
29extern void ff_process_one_line_mmxext(const uint8_t *src, uint8_t *dst, short contrast,29extern void ff_process_one_line_mmxext(const uint8_t *src, uint8_t *dst, short contrast,
30 short brightness, int w);30 short brightness, int w);
31extern void ff_process_one_line_sse2(const uint8_t *src, uint8_t *dst, short contrast,
32 short brightness, int w);
31 33
32static void process_mmxext(EQParameters *param, uint8_t *dst, int dst_stride,34static void process_mmxext(EQParameters *param, uint8_t *dst, int dst_stride,
33 const uint8_t *src, int src_stride, int w, int h)35 const uint8_t *src, int src_stride, int w, int h)
@@ -44,6 +46,20 @@ static void process_mmxext(EQParameters *param, uint8_t *dst, int dst_stride, · 10 unmodified lines
44 emms_c();46 emms_c();
45}47}
46 48
49static void process_sse2(EQParameters *param, uint8_t *dst, int dst_stride,
50 const uint8_t *src, int src_stride, int w, int h)
51{
52 short contrast = (short) (param->contrast * 256 * 16);
53 short brightness = ((short) (100.0 * param->brightness + 100.0) * 511)
54 / 200 - 128 - contrast / 32;
55
56 while (h--) {
57 ff_process_one_line_sse2(src, dst, contrast, brightness, w);
58 src += src_stride;
59 dst += dst_stride;
60 }
61}
62
47av_cold void ff_eq_init_x86(EQContext *eq)63av_cold void ff_eq_init_x86(EQContext *eq)
48{64{
49 int cpu_flags = av_get_cpu_flags();65 int cpu_flags = av_get_cpu_flags();
@@ -51,4 +67,7 @@ av_cold void ff_eq_init_x86(EQContext *eq) · 1 unmodified line
51 if (cpu_flags & AV_CPU_FLAG_MMXEXT) {67 if (cpu_flags & AV_CPU_FLAG_MMXEXT) {
52 eq->process = process_mmxext;68 eq->process = process_mmxext;
53 }69 }
70 if (cpu_flags & AV_CPU_FLAG_SSE2) {
71 eq->process = process_sse2;
72 }
54}73}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t