FFmpeg
Loading...
Searching...
No Matches
vf_spp.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <stdint.h>
22
23#include "config.h"
25#include "libavutil/cpu.h"
26#include "libavutil/x86/asm.h"
27#include "libavutil/x86/cpu.h"
28#include "libavfilter/vf_spp.h"
29
30#if HAVE_SSE2_INLINE
31static void store_slice_sse2(uint8_t *dst, const int16_t *src,
32 int dst_stride, int src_stride,
33 int width, int height, int log2_scale,
34 const uint8_t dither[8][8])
35{
36 int y;
37
38 for (y = 0; y < height; y++) {
39 uint8_t *dst1 = dst;
40 const int16_t *src1 = src;
41 __asm__ volatile(
42 "movq (%3), %%xmm1 \n"
43 "movd %4, %%xmm2 \n"
44 "pxor %%xmm0, %%xmm0 \n"
45 "punpcklbw %%xmm0, %%xmm1 \n"
46 "psraw %%xmm2, %%xmm1 \n"
47 "movd %5, %%xmm2 \n"
48 "1: \n"
49 "movdqa (%0), %%xmm0 \n"
50 "paddw %%xmm1, %%xmm0 \n"
51 "psraw %%xmm2, %%xmm0 \n"
52 "packuswb %%xmm0, %%xmm0 \n"
53 "movq %%xmm0, (%1) \n"
54 "add $16, %0 \n"
55 "add $8, %1 \n"
56 "cmp %2, %1 \n"
57 " jb 1b \n"
58 : "+r" (src1), "+r"(dst1)
59 : "r"(dst + width), "r"(dither[y]), "g"(log2_scale), "g"(MAX_LEVEL - log2_scale)
60 XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2")
61 );
62 src += src_stride;
63 dst += dst_stride;
64 }
65}
66
67#endif /* HAVE_SSE2_INLINE */
68
70{
71#if HAVE_SSE2_INLINE
73
75 s->store_slice = store_slice_sse2;
76 }
77#endif
78}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#define XMM_CLOBBERS_ONLY(...)
Definition asm.h:95
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
#define s(width, name)
Definition cbs_vp9.c:198
Macro definitions for various function/variable attributes.
#define av_cold
Definition attributes.h:117
static atomic_int cpu_flags
Definition cpu.c:56
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition cpu.c:109
#define INLINE_SSE2(flags)
Definition cpu.h:83
#define MAX_LEVEL
Definition rl.h:36
#define src1
Definition h264pred.c:141
#define src
Definition vp8dsp.c:248
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89
static const uint16_t dither[8][8]
Definition vf_gradfun.c:46
void ff_spp_init_x86(SPPContext *s)
Definition vf_spp.c:69