FFmpeg
Loading...
Searching...
No Matches
vc1dsp_init.c
Go to the documentation of this file.
1/*
2 * VC-1 and WMV3 - DSP functions MMX-optimized
3 * Copyright (c) 2007 Christophe GISQUET <christophe.gisquet@free.fr>
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following
12 * conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
25 */
26
28#include "libavutil/cpu.h"
29#include "libavutil/x86/cpu.h"
30#include "libavcodec/vc1dsp.h"
31#include "vc1dsp.h"
32#include "config.h"
33
34#define LOOP_FILTER4(EXT) \
35void ff_vc1_v_loop_filter4_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq); \
36void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq);
37#define LOOP_FILTER816(EXT) \
38void ff_vc1_v_loop_filter8_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq); \
39void ff_vc1_h_loop_filter8_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq); \
40\
41static void vc1_v_loop_filter16_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq) \
42{ \
43 ff_vc1_v_loop_filter8_ ## EXT(src, stride, pq); \
44 ff_vc1_v_loop_filter8_ ## EXT(src+8, stride, pq); \
45} \
46\
47static void vc1_h_loop_filter16_ ## EXT(uint8_t *src, ptrdiff_t stride, int pq) \
48{ \
49 ff_vc1_h_loop_filter8_ ## EXT(src, stride, pq); \
50 ff_vc1_h_loop_filter8_ ## EXT(src+8*stride, stride, pq); \
51}
52
54LOOP_FILTER4(ssse3)
55LOOP_FILTER816(ssse3)
56
57void ff_vc1_h_loop_filter8_sse4(uint8_t *src, ptrdiff_t stride, int pq);
58
59static void vc1_h_loop_filter16_sse4(uint8_t *src, ptrdiff_t stride, int pq)
60{
63}
64
65void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src,
66 ptrdiff_t stride, int h, int x, int y);
67void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src,
68 ptrdiff_t stride, int h, int x, int y);
69void ff_vc1_inv_trans_4x4_dc_sse2(uint8_t *dest, ptrdiff_t linesize,
70 int16_t *block);
71void ff_vc1_inv_trans_4x8_dc_sse2(uint8_t *dest, ptrdiff_t linesize,
72 int16_t *block);
73void ff_vc1_inv_trans_8x4_dc_sse2(uint8_t *dest, ptrdiff_t linesize,
74 int16_t *block);
75void ff_vc1_inv_trans_8x8_dc_sse2(uint8_t *dest, ptrdiff_t linesize,
76 int16_t *block);
77
78#define MSPEL_FUNC(OP, X, Y, SIZE, XMM) \
79 void ff_vc1_ ## OP ## _mspel_mc ## X ## Y ## _ ## SIZE ##_ ## XMM \
80 (uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int rnd); \
81 dsp->OP ## _vc1_mspel_pixels_tab[SIZE == 8][X + 4 * Y] = \
82 ff_vc1_ ## OP ## _mspel_mc ## X ## Y## _ ## SIZE ##_ ## XMM
83#define MSPEL_FUNCS_SIZE(X, Y, SIZE, XMM) \
84 MSPEL_FUNC(put, X, Y, SIZE, XMM); \
85 MSPEL_FUNC(avg, X, Y, SIZE, XMM)
86#define MSPEL_FUNCS(X, Y, XMM) \
87 MSPEL_FUNCS_SIZE(X, Y, 8, XMM); \
88 MSPEL_FUNCS_SIZE(X, Y, 16, XMM)
89
91{
93
94#if HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL
95 if (HAVE_X86_6REGS && INLINE_MMX(cpu_flags))
97 ff_vc1dsp_init_mmx(dsp);
98
99 if (HAVE_X86_6REGS && INLINE_MMXEXT(cpu_flags))
101 ff_vc1dsp_init_mmxext(dsp);
102#endif /* HAVE_X86_6REGS && HAVE_INLINE_ASM && HAVE_MMX_EXTERNAL */
103
104#define ASSIGN_LF4(EXT) \
105 dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
106 dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT
107#define ASSIGN_LF816(EXT) \
108 dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
109 dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
110 dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
111 dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
112
118
119 ASSIGN_LF816(sse2);
120
121 MSPEL_FUNCS(0, 0, sse2);
122 }
124 ASSIGN_LF4(ssse3);
125 ASSIGN_LF816(ssse3);
128
129 MSPEL_FUNCS(0, 1, ssse3);
130 MSPEL_FUNCS(0, 2, ssse3);
131 MSPEL_FUNCS(0, 3, ssse3);
132 MSPEL_FUNCS(1, 0, ssse3);
133 MSPEL_FUNCS(2, 0, ssse3);
134 MSPEL_FUNCS(3, 0, ssse3);
135 }
139 }
140}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static int16_t block[64]
Definition dct.c:125
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_MMXEXT(flags)
Definition cpu.h:81
#define EXTERNAL_MMXEXT(flags)
Definition cpu.h:51
#define EXTERNAL_SSSE3(flags)
Definition cpu.h:59
#define INLINE_MMX(flags)
Definition cpu.h:80
#define EXTERNAL_MMX(flags)
Definition cpu.h:50
#define EXTERNAL_SSE4(flags)
Definition cpu.h:62
#define EXTERNAL_SSE2(flags)
Definition cpu.h:53
void(* vc1_inv_trans_8x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition vc1dsp.h:44
h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]
Definition vc1dsp.h:65
void(* vc1_inv_trans_4x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition vc1dsp.h:45
void(* vc1_h_loop_filter8)(uint8_t *src, ptrdiff_t stride, int pq)
Definition vc1dsp.h:54
void(* vc1_h_loop_filter16)(uint8_t *src, ptrdiff_t stride, int pq)
Definition vc1dsp.h:56
void(* vc1_inv_trans_4x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition vc1dsp.h:46
h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3]
Definition vc1dsp.h:66
void(* vc1_inv_trans_8x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition vc1dsp.h:43
#define stride
#define src
Definition vp8dsp.c:248
VC-1 and WMV3 decoder.
#define LOOP_FILTER4(EXT)
Definition vc1dsp_init.c:34
#define ASSIGN_LF4(EXT)
void ff_vc1_inv_trans_8x8_dc_sse2(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int h, int x, int y)
void ff_vc1_inv_trans_8x4_dc_sse2(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
static void vc1_h_loop_filter16_sse4(uint8_t *src, ptrdiff_t stride, int pq)
Definition vc1dsp_init.c:59
#define ASSIGN_LF816(EXT)
void ff_vc1_inv_trans_4x8_dc_sse2(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
void ff_vc1_h_loop_filter8_sse4(uint8_t *src, ptrdiff_t stride, int pq)
#define LOOP_FILTER816(EXT)
Definition vc1dsp_init.c:37
void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int h, int x, int y)
#define MSPEL_FUNCS(X, Y, XMM)
Definition vc1dsp_init.c:86
av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
Definition vc1dsp_init.c:90
void ff_vc1_inv_trans_4x4_dc_sse2(uint8_t *dest, ptrdiff_t linesize, int16_t *block)