Showing the changes to libavfilter (2 of 2 files). Show all
Unified · Split
| @@ -24,7 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | SECTION .text |
| 26 | 26 | |
| 27 | −INIT_MMX mmxext | |
| 27 | +%macro PROCESS_ONE_LINE 1 | |
| 28 | 28 | cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w |
| 29 | 29 | movd m3, contrastd |
| 30 | 30 | movd m4, brightnessd |
| @@ -39,7 +39,7 @@ cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w · 8 unmodified lines | ||
| 39 | 39 | pxor m1, m1 |
| 40 | 40 | mov scalard, wd |
| 41 | 41 | and scalard, mmsize-1 |
| 42 | − sar wd, 3 | |
| 42 | + sar wd, %1 | |
| 43 | 43 | cmp wd, 1 |
| 44 | 44 | 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 | 81 | .end: |
| 82 | 82 | RET |
| 83 | + | |
| 84 | +%endmacro | |
| 85 | + | |
| 86 | +INIT_MMX mmxext | |
| 87 | +PROCESS_ONE_LINE 3 | |
| 88 | + | |
| 89 | +INIT_XMM sse2 | |
| 90 | +PROCESS_ONE_LINE 4 | |
| @@ -28,6 +28,8 @@ · 27 unmodified lines | ||
| 28 | 28 | |
| 29 | 29 | extern void ff_process_one_line_mmxext(const uint8_t *src, uint8_t *dst, short contrast, |
| 30 | 30 | 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); | |
| 31 | 33 | |
| 32 | 34 | static void process_mmxext(EQParameters *param, uint8_t *dst, int dst_stride, |
| 33 | 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 | 46 | emms_c(); |
| 45 | 47 | } |
| 46 | 48 | |
| 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 | + | |
| 47 | 63 | av_cold void ff_eq_init_x86(EQContext *eq) |
| 48 | 64 | { |
| 49 | 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 | 67 | if (cpu_flags & AV_CPU_FLAG_MMXEXT) { |
| 52 | 68 | eq->process = process_mmxext; |
| 53 | 69 | } |
| 70 | + if (cpu_flags & AV_CPU_FLAG_SSE2) { | |
| 71 | + eq->process = process_sse2; | |
| 72 | + } | |
| 54 | 73 | } |