FFmpeg
Loading...
Searching...
No Matches
colorspacedsp_init.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "libavutil/x86/cpu.h"
22
24
25#define decl_yuv2yuv_fn(t) \
26void ff_yuv2yuv_##t##_sse2(uint8_t *yuv_out[3], const ptrdiff_t yuv_out_stride[3], \
27 uint8_t *yuv_in[3], const ptrdiff_t yuv_in_stride[3], \
28 int w, int h, const int16_t yuv2yuv_coeffs[3][3][8], \
29 const int16_t yuv_offset[2][8])
30
31#define decl_yuv2yuv_fns(ss) \
32decl_yuv2yuv_fn(ss##p8to8); \
33decl_yuv2yuv_fn(ss##p10to8); \
34decl_yuv2yuv_fn(ss##p12to8); \
35decl_yuv2yuv_fn(ss##p8to10); \
36decl_yuv2yuv_fn(ss##p10to10); \
37decl_yuv2yuv_fn(ss##p12to10); \
38decl_yuv2yuv_fn(ss##p8to12); \
39decl_yuv2yuv_fn(ss##p10to12); \
40decl_yuv2yuv_fn(ss##p12to12)
41
45
46#define decl_yuv2rgb_fn(t) \
47void ff_yuv2rgb_##t##_sse2(int16_t *rgb_out[3], ptrdiff_t rgb_stride, \
48 uint8_t *yuv_in[3], const ptrdiff_t yuv_stride[3], \
49 int w, int h, const int16_t coeff[3][3][8], \
50 const int16_t yuv_offset[8])
51
52#define decl_yuv2rgb_fns(ss) \
53decl_yuv2rgb_fn(ss##p8); \
54decl_yuv2rgb_fn(ss##p10); \
55decl_yuv2rgb_fn(ss##p12)
56
60
61#define decl_rgb2yuv_fn(t) \
62void ff_rgb2yuv_##t##_sse2(uint8_t *yuv_out[3], const ptrdiff_t yuv_stride[3], \
63 int16_t *rgb_in[3], ptrdiff_t rgb_stride, \
64 int w, int h, const int16_t coeff[3][3][8], \
65 const int16_t yuv_offset[8])
66
67#define decl_rgb2yuv_fns(ss) \
68decl_rgb2yuv_fn(ss##p8); \
69decl_rgb2yuv_fn(ss##p10); \
70decl_rgb2yuv_fn(ss##p12)
71
75
76void ff_multiply3x3_sse2(int16_t *data[3], ptrdiff_t stride, int w, int h,
77 const int16_t coeff[3][3][8]);
78
80{
81#if ARCH_X86_64
83
85#define assign_yuv2yuv_fns(ss) \
86 dsp->yuv2yuv[BPP_8 ][BPP_8 ][SS_##ss] = ff_yuv2yuv_##ss##p8to8_sse2; \
87 dsp->yuv2yuv[BPP_8 ][BPP_10][SS_##ss] = ff_yuv2yuv_##ss##p8to10_sse2; \
88 dsp->yuv2yuv[BPP_8 ][BPP_12][SS_##ss] = ff_yuv2yuv_##ss##p8to12_sse2; \
89 dsp->yuv2yuv[BPP_10][BPP_8 ][SS_##ss] = ff_yuv2yuv_##ss##p10to8_sse2; \
90 dsp->yuv2yuv[BPP_10][BPP_10][SS_##ss] = ff_yuv2yuv_##ss##p10to10_sse2; \
91 dsp->yuv2yuv[BPP_10][BPP_12][SS_##ss] = ff_yuv2yuv_##ss##p10to12_sse2; \
92 dsp->yuv2yuv[BPP_12][BPP_8 ][SS_##ss] = ff_yuv2yuv_##ss##p12to8_sse2; \
93 dsp->yuv2yuv[BPP_12][BPP_10][SS_##ss] = ff_yuv2yuv_##ss##p12to10_sse2; \
94 dsp->yuv2yuv[BPP_12][BPP_12][SS_##ss] = ff_yuv2yuv_##ss##p12to12_sse2
95
96 assign_yuv2yuv_fns(420);
97 assign_yuv2yuv_fns(422);
98 assign_yuv2yuv_fns(444);
99
100#define assign_yuv2rgb_fns(ss) \
101 dsp->yuv2rgb[BPP_8 ][SS_##ss] = ff_yuv2rgb_##ss##p8_sse2; \
102 dsp->yuv2rgb[BPP_10][SS_##ss] = ff_yuv2rgb_##ss##p10_sse2; \
103 dsp->yuv2rgb[BPP_12][SS_##ss] = ff_yuv2rgb_##ss##p12_sse2
104
105 assign_yuv2rgb_fns(420);
106 assign_yuv2rgb_fns(422);
107 assign_yuv2rgb_fns(444);
108
109#define assign_rgb2yuv_fns(ss) \
110 dsp->rgb2yuv[BPP_8 ][SS_##ss] = ff_rgb2yuv_##ss##p8_sse2; \
111 dsp->rgb2yuv[BPP_10][SS_##ss] = ff_rgb2yuv_##ss##p10_sse2; \
112 dsp->rgb2yuv[BPP_12][SS_##ss] = ff_rgb2yuv_##ss##p12_sse2
113
114 assign_rgb2yuv_fns(420);
115 assign_rgb2yuv_fns(422);
116 assign_rgb2yuv_fns(444);
117
119 }
120#endif
121}
#define decl_yuv2rgb_fns(ss)
#define decl_yuv2yuv_fns(ss)
#define decl_rgb2yuv_fns(ss)
void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
void ff_multiply3x3_sse2(int16_t *data[3], ptrdiff_t stride, int w, int h, const int16_t coeff[3][3][8])
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 EXTERNAL_SSE2(flags)
Definition cpu.h:53
uint8_t w
Definition llvidencdsp.c:39
const char data[16]
Definition mxf.c:149
void(* multiply3x3)(int16_t *data[3], ptrdiff_t stride, int w, int h, const int16_t m[3][3][8])
#define stride
static const double coeff[2][5]