FFmpeg  4.3
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/attributes.h"
28 #include "libavutil/cpu.h"
29 #include "libavutil/x86/cpu.h"
30 #include "libavutil/x86/asm.h"
31 #include "libavcodec/vc1dsp.h"
32 #include "fpel.h"
33 #include "vc1dsp.h"
34 #include "config.h"
35 
36 #define LOOP_FILTER(EXT) \
37 void ff_vc1_v_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
38 void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
39 void ff_vc1_v_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
40 void ff_vc1_h_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
41 \
42 static void vc1_v_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
43 { \
44  ff_vc1_v_loop_filter8_ ## EXT(src, stride, pq); \
45  ff_vc1_v_loop_filter8_ ## EXT(src+8, stride, pq); \
46 } \
47 \
48 static void vc1_h_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
49 { \
50  ff_vc1_h_loop_filter8_ ## EXT(src, stride, pq); \
51  ff_vc1_h_loop_filter8_ ## EXT(src+8*stride, stride, pq); \
52 }
53 
54 #if HAVE_X86ASM
55 LOOP_FILTER(mmxext)
56 LOOP_FILTER(sse2)
57 LOOP_FILTER(ssse3)
58 
59 void ff_vc1_h_loop_filter8_sse4(uint8_t *src, int stride, int pq);
60 
61 static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq)
62 {
63  ff_vc1_h_loop_filter8_sse4(src, stride, pq);
64  ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq);
65 }
66 
67 #define DECLARE_FUNCTION(OP, DEPTH, INSN) \
68  static void OP##vc1_mspel_mc00_##DEPTH##INSN(uint8_t *dst, \
69  const uint8_t *src, ptrdiff_t stride, int rnd) \
70  { \
71  ff_ ## OP ## pixels ## DEPTH ## INSN(dst, src, stride, DEPTH); \
72  }
73 
74 DECLARE_FUNCTION(put_, 8, _mmx)
75 DECLARE_FUNCTION(put_, 16, _mmx)
76 DECLARE_FUNCTION(avg_, 8, _mmx)
77 DECLARE_FUNCTION(avg_, 16, _mmx)
78 DECLARE_FUNCTION(avg_, 8, _mmxext)
79 DECLARE_FUNCTION(avg_, 16, _mmxext)
80 DECLARE_FUNCTION(put_, 16, _sse2)
81 DECLARE_FUNCTION(avg_, 16, _sse2)
82 
83 #endif /* HAVE_X86ASM */
84 
86  ptrdiff_t stride, int h, int x, int y);
88  ptrdiff_t stride, int h, int x, int y);
90  ptrdiff_t stride, int h, int x, int y);
92  ptrdiff_t stride, int h, int x, int y);
94  ptrdiff_t stride, int h, int x, int y);
95 void ff_vc1_inv_trans_4x4_dc_mmxext(uint8_t *dest, ptrdiff_t linesize,
96  int16_t *block);
97 void ff_vc1_inv_trans_4x8_dc_mmxext(uint8_t *dest, ptrdiff_t linesize,
98  int16_t *block);
99 void ff_vc1_inv_trans_8x4_dc_mmxext(uint8_t *dest, ptrdiff_t linesize,
100  int16_t *block);
101 void ff_vc1_inv_trans_8x8_dc_mmxext(uint8_t *dest, ptrdiff_t linesize,
102  int16_t *block);
103 
104 
106 {
107  int cpu_flags = av_get_cpu_flags();
108 
110  if (EXTERNAL_MMX(cpu_flags))
111  ff_vc1dsp_init_mmx(dsp);
112 
116 
117 #define ASSIGN_LF(EXT) \
118  dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
119  dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \
120  dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
121  dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
122  dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
123  dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
124 
125 #if HAVE_X86ASM
126  if (EXTERNAL_MMX(cpu_flags)) {
128 
129  dsp->put_vc1_mspel_pixels_tab[1][0] = put_vc1_mspel_mc00_8_mmx;
130  dsp->put_vc1_mspel_pixels_tab[0][0] = put_vc1_mspel_mc00_16_mmx;
131  dsp->avg_vc1_mspel_pixels_tab[1][0] = avg_vc1_mspel_mc00_8_mmx;
132  dsp->avg_vc1_mspel_pixels_tab[0][0] = avg_vc1_mspel_mc00_16_mmx;
133  }
136  }
137  if (EXTERNAL_MMXEXT(cpu_flags)) {
138  ASSIGN_LF(mmxext);
140 
141  dsp->avg_vc1_mspel_pixels_tab[1][0] = avg_vc1_mspel_mc00_8_mmxext;
142  dsp->avg_vc1_mspel_pixels_tab[0][0] = avg_vc1_mspel_mc00_16_mmxext;
143 
148  }
149  if (EXTERNAL_SSE2(cpu_flags)) {
150  dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;
151  dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;
152  dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
153  dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
154 
155  dsp->put_vc1_mspel_pixels_tab[0][0] = put_vc1_mspel_mc00_16_sse2;
156  dsp->avg_vc1_mspel_pixels_tab[0][0] = avg_vc1_mspel_mc00_16_sse2;
157  }
158  if (EXTERNAL_SSSE3(cpu_flags)) {
159  ASSIGN_LF(ssse3);
162  }
163  if (EXTERNAL_SSE4(cpu_flags)) {
164  dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;
165  dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
166  }
167 #endif /* HAVE_X86ASM */
168 }
INLINE_MMX
#define INLINE_MMX(flags)
Definition: cpu.h:86
stride
int stride
Definition: mace.c:144
cpu.h
vc1dsp.h
VC1DSPContext::vc1_h_loop_filter8
void(* vc1_h_loop_filter8)(uint8_t *src, int stride, int pq)
Definition: vc1dsp.h:52
VC1DSPContext::avg_vc1_mspel_pixels_tab
vc1op_pixels_func avg_vc1_mspel_pixels_tab[2][16]
Definition: vc1dsp.h:60
VC1DSPContext::avg_no_rnd_vc1_chroma_pixels_tab
h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3]
Definition: vc1dsp.h:64
ff_vc1dsp_init_mmx
void ff_vc1dsp_init_mmx(VC1DSPContext *dsp)
EXTERNAL_AMD3DNOW
#define EXTERNAL_AMD3DNOW(flags)
Definition: cpu.h:54
ff_put_vc1_chroma_mc8_nornd_mmx
void ff_put_vc1_chroma_mc8_nornd_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y)
ff_vc1_inv_trans_8x4_dc_mmxext
void ff_vc1_inv_trans_8x4_dc_mmxext(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
VC1DSPContext::vc1_inv_trans_8x8_dc
void(* vc1_inv_trans_8x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:41
ff_vc1dsp_init_x86
av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
Definition: vc1dsp_init.c:105
av_get_cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Definition: cpu.c:93
VC1DSPContext::put_no_rnd_vc1_chroma_pixels_tab
h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]
Definition: vc1dsp.h:63
VC1DSPContext::vc1_inv_trans_4x4_dc
void(* vc1_inv_trans_4x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:44
cpu_flags
static atomic_int cpu_flags
Definition: cpu.c:50
ff_avg_vc1_chroma_mc8_nornd_ssse3
void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y)
DECLARE_FUNCTION
#define DECLARE_FUNCTION(a, b)
Macro to ease bicubic filter interpolation functions declarations.
Definition: vc1dsp_mmi.c:2139
ASSIGN_LF
#define ASSIGN_LF(EXT)
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
ff_avg_vc1_chroma_mc8_nornd_3dnow
void ff_avg_vc1_chroma_mc8_nornd_3dnow(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y)
VC1DSPContext::vc1_inv_trans_8x4_dc
void(* vc1_inv_trans_8x4_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:42
av_cold
#define av_cold
Definition: attributes.h:90
ff_vc1_inv_trans_4x8_dc_mmxext
void ff_vc1_inv_trans_4x8_dc_mmxext(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
ff_avg_vc1_chroma_mc8_nornd_mmxext
void ff_avg_vc1_chroma_mc8_nornd_mmxext(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y)
VC1DSPContext::vc1_v_loop_filter16
void(* vc1_v_loop_filter16)(uint8_t *src, int stride, int pq)
Definition: vc1dsp.h:53
src
#define src
Definition: vp8dsp.c:254
VC1DSPContext::vc1_h_loop_filter16
void(* vc1_h_loop_filter16)(uint8_t *src, int stride, int pq)
Definition: vc1dsp.h:54
VC1DSPContext::vc1_inv_trans_4x8_dc
void(* vc1_inv_trans_4x8_dc)(uint8_t *dest, ptrdiff_t stride, int16_t *block)
Definition: vc1dsp.h:43
ff_vc1_inv_trans_4x4_dc_mmxext
void ff_vc1_inv_trans_4x4_dc_mmxext(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
cpu.h
asm.h
attributes.h
EXTERNAL_SSE2
#define EXTERNAL_SSE2(flags)
Definition: cpu.h:59
ff_vc1_inv_trans_8x8_dc_mmxext
void ff_vc1_inv_trans_8x8_dc_mmxext(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
ff_put_vc1_chroma_mc8_nornd_ssse3
void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, uint8_t *src, ptrdiff_t stride, int h, int x, int y)
uint8_t
uint8_t
Definition: audio_convert.c:194
VC1DSPContext
Definition: vc1dsp.h:35
VC1DSPContext::put_vc1_mspel_pixels_tab
vc1op_pixels_func put_vc1_mspel_pixels_tab[2][16]
Definition: vc1dsp.h:59
EXTERNAL_SSE4
#define EXTERNAL_SSE4(flags)
Definition: cpu.h:68
VC1DSPContext::vc1_v_loop_filter8
void(* vc1_v_loop_filter8)(uint8_t *src, int stride, int pq)
Definition: vc1dsp.h:51
config.h
fpel.h
LOOP_FILTER
#define LOOP_FILTER(EXT)
Definition: vc1dsp_init.c:36
HAVE_6REGS
#define HAVE_6REGS
Definition: asm.h:76
INLINE_MMXEXT
#define INLINE_MMXEXT(flags)
Definition: cpu.h:87
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
h
h
Definition: vp9dsp_template.c:2038
EXTERNAL_SSSE3
#define EXTERNAL_SSSE3(flags)
Definition: cpu.h:65
EXTERNAL_MMX
#define EXTERNAL_MMX(flags)
Definition: cpu.h:56
EXTERNAL_MMXEXT
#define EXTERNAL_MMXEXT(flags)
Definition: cpu.h:57
ff_vc1dsp_init_mmxext
void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp)