History

avfilter/x86/vf_eq: add SSE2 version

Ting Fu committed 7 years ago

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

Showing the changes to libavfilter (2 of 2 files). Show all

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
2424
2525 SECTION .text
2626
27−INIT_MMX mmxext
27+%macro PROCESS_ONE_LINE 1
2828 cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w
2929 movd m3, contrastd
3030 movd m4, brightnessd
@@ -39,7 +39,7 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w · 8 unmodified lines
3939 pxor m1, m1
4040 mov scalard, wd
4141 and scalard, mmsize-1
42− sar wd, 3
42+ sar wd, %1
4343 cmp wd, 1
4444 jl .loop1
4545
@@ -80,3 +80,11 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w · 34 unmodified lines
8080
8181 .end:
8282 RET
83+
84+%endmacro
85+
86+INIT_MMX mmxext
87+PROCESS_ONE_LINE 3
88+
89+INIT_XMM sse2
90+PROCESS_ONE_LINE 4
libavfilter/x86/vf_eq_init.c+19−0
@@ -28,6 +28,8 @@ · 27 unmodified lines
2828
2929 extern void ff_process_one_line_mmxext(const uint8_t *src, uint8_t *dst, short contrast,
3030 short brightness, int w);
31+extern void ff_process_one_line_sse2(const uint8_t *src, uint8_t *dst, short contrast,
32+ short brightness, int w);
3133
3234 static void process_mmxext(EQParameters *param, uint8_t *dst, int dst_stride,
3335 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
4446 emms_c();
4547 }
4648
49+static 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+
4763 av_cold void ff_eq_init_x86(EQContext *eq)
4864 {
4965 int cpu_flags = av_get_cpu_flags();
@@ -51,4 +67,7 @@ av_cold void ff_eq_init_x86(EQContext *eq) · 1 unmodified line
5167 if (cpu_flags & AV_CPU_FLAG_MMXEXT) {
5268 eq->process = process_mmxext;
5369 }
70+ if (cpu_flags & AV_CPU_FLAG_SSE2) {
71+ eq->process = process_sse2;
72+ }
5473 }

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