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 
27 #include "libavutil/cpu.h"
28 #include "libavutil/x86/cpu.h"
29 #include "libavcodec/vc1dsp.h"
30 #include "dsputil_mmx.h"
31 #include "vc1dsp.h"
32 #include "config.h"
33 
34 #define LOOP_FILTER(EXT) \
35 void ff_vc1_v_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
36 void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
37 void ff_vc1_v_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
38 void ff_vc1_h_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
39 \
40 static void vc1_v_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
41 { \
42  ff_vc1_v_loop_filter8_ ## EXT(src, stride, pq); \
43  ff_vc1_v_loop_filter8_ ## EXT(src+8, stride, pq); \
44 } \
45 \
46 static void vc1_h_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
47 { \
48  ff_vc1_h_loop_filter8_ ## EXT(src, stride, pq); \
49  ff_vc1_h_loop_filter8_ ## EXT(src+8*stride, stride, pq); \
50 }
51 
52 #if HAVE_YASM
53 LOOP_FILTER(mmxext)
54 LOOP_FILTER(sse2)
55 LOOP_FILTER(ssse3)
56 
57 void ff_vc1_h_loop_filter8_sse4(uint8_t *src, int stride, int pq);
58 
59 static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq)
60 {
61  ff_vc1_h_loop_filter8_sse4(src, stride, pq);
62  ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq);
63 }
64 
65 static void avg_vc1_mspel_mc00_mmxext(uint8_t *dst, const uint8_t *src,
66  ptrdiff_t stride, int rnd)
67 {
69 }
70 #endif /* HAVE_YASM */
71 
73  int stride, int h, int x, int y);
75  int stride, int h, int x, int y);
77  int stride, int h, int x, int y);
79  int stride, int h, int x, int y);
81  int stride, int h, int x, int y);
82 
83 
85 {
86  int mm_flags = av_get_cpu_flags();
87 
88  if (INLINE_MMX(mm_flags))
89  ff_vc1dsp_init_mmx(dsp);
90 
91  if (INLINE_MMXEXT(mm_flags))
93 
94 #define ASSIGN_LF(EXT) \
95  dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
96  dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \
97  dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
98  dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
99  dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
100  dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
101 
102 #if HAVE_YASM
103  if (mm_flags & AV_CPU_FLAG_MMX) {
105  }
106 
107  if (mm_flags & AV_CPU_FLAG_MMXEXT) {
108  ASSIGN_LF(mmxext);
110 
111  dsp->avg_vc1_mspel_pixels_tab[0] = avg_vc1_mspel_mc00_mmxext;
112  } else if (mm_flags & AV_CPU_FLAG_3DNOW) {
114  }
115 
116  if (mm_flags & AV_CPU_FLAG_SSE2) {
117  dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;
118  dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;
119  dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
120  dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
121  }
122  if (mm_flags & AV_CPU_FLAG_SSSE3) {
123  ASSIGN_LF(ssse3);
126  }
127  if (mm_flags & AV_CPU_FLAG_SSE4) {
128  dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;
129  dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
130  }
131 #endif /* HAVE_YASM */
132 }
VC-1 and WMV3 decoder.
void(* vc1_v_loop_filter16)(uint8_t *src, int stride, int pq)
Definition: vc1dsp.h:55
void ff_avg_vc1_chroma_mc8_nornd_mmxext(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y)
void(* vc1_h_loop_filter16)(uint8_t *src, int stride, int pq)
Definition: vc1dsp.h:56
int stride
Definition: mace.c:144
void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y)
uint8_t
#define av_cold
Definition: attributes.h:78
#define AV_CPU_FLAG_MMXEXT
SSE integer functions or AMD MMX ext.
Definition: cpu.h:30
void(* vc1_h_loop_filter8)(uint8_t *src, int stride, int pq)
Definition: vc1dsp.h:54
Discrete Time axis x
#define INLINE_MMX(flags)
Definition: x86/cpu.h:46
#define AV_CPU_FLAG_SSSE3
Conroe SSSE3 functions.
Definition: cpu.h:39
#define LOOP_FILTER(EXT)
Definition: vc1dsp_init.c:34
void(* vc1_v_loop_filter8)(uint8_t *src, int stride, int pq)
Definition: vc1dsp.h:53
void ff_avg_vc1_chroma_mc8_nornd_3dnow(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y)
void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y)
vc1op_pixels_func avg_vc1_mspel_pixels_tab[16]
Definition: vc1dsp.h:62
#define AV_CPU_FLAG_3DNOW
AMD 3DNOW.
Definition: cpu.h:32
h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3]
Definition: vc1dsp.h:66
void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp)
av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
Definition: vc1dsp_init.c:84
AVS_Value src
Definition: avisynth_c.h:523
#define AV_CPU_FLAG_MMX
standard MMX
Definition: cpu.h:29
#define ASSIGN_LF(EXT)
#define AV_CPU_FLAG_SSE4
Penryn SSE4.1 functions.
Definition: cpu.h:41
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:30
h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]
Definition: vc1dsp.h:65
#define INLINE_MMXEXT(flags)
Definition: x86/cpu.h:47
function y
Definition: D.m:1
void ff_put_vc1_chroma_mc8_nornd_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y)
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
#define AV_CPU_FLAG_SSE2
PIV SSE2 functions.
Definition: cpu.h:34
void ff_avg_pixels8_mmxext(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)