Showing the changes to libavfilter (2 of 2 files). Show all
Unified · Split
| @@ -24,7 +24,7 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | SECTION .text | 25 | SECTION .text |
| 26 | 26 | ||
| 27 | INIT_MMX mmxext | 27 | %macro PROCESS_ONE_LINE 1 |
| 28 | cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w | 28 | cglobal process_one_line, 5, 7, 5, src, dst, contrast, brightness, w |
| 29 | movd m3, contrastd | 29 | movd m3, contrastd |
| 30 | movd m4, brightnessd | 30 | 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, m1 | 39 | pxor m1, m1 |
| 40 | mov scalard, wd | 40 | mov scalard, wd |
| 41 | and scalard, mmsize-1 | 41 | and scalard, mmsize-1 |
| 42 | sar wd, 3 | 42 | sar wd, %1 |
| 43 | cmp wd, 1 | 43 | cmp wd, 1 |
| 44 | jl .loop1 | 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 | .end: | 81 | .end: |
| 82 | RET | 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 | extern void ff_process_one_line_mmxext(const uint8_t *src, uint8_t *dst, short contrast, | 29 | extern 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); |
| 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 | static void process_mmxext(EQParameters *param, uint8_t *dst, int dst_stride, | 34 | static 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 | ||
| 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 | av_cold void ff_eq_init_x86(EQContext *eq) | 63 | av_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 | } |