24 #define YUV_TO_RGB_TABLE \
25 c->yuv2rgb_v2r_coeff, \
26 c->yuv2rgb_u2g_coeff, \
27 c->yuv2rgb_v2g_coeff, \
28 c->yuv2rgb_u2b_coeff, \
30 #define DECLARE_FF_YUVX_TO_RGBX_FUNCS(ifmt, ofmt) \
31 int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \
32 uint8_t *dst, int linesize, \
33 const uint8_t *srcY, int linesizeY, \
34 const uint8_t *srcU, int linesizeU, \
35 const uint8_t *srcV, int linesizeV, \
36 const int16_t *table, \
40 static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \
41 const int srcStride[], int srcSliceY, \
42 int srcSliceH, uint8_t *const dst[], \
43 const int dstStride[]) { \
44 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
46 return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
47 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
48 src[0], srcStride[0], \
49 src[1], srcStride[1], \
50 src[2], srcStride[2], \
52 c->yuv2rgb_y_offset >> 6, \
53 c->yuv2rgb_y_coeff); \
56 #define DECLARE_FF_YUVX_TO_GBRP_FUNCS(ifmt, ofmt) \
57 int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \
58 uint8_t *dst, int linesize, \
59 const uint8_t *srcY, int linesizeY, \
60 const uint8_t *srcU, int linesizeU, \
61 const uint8_t *srcV, int linesizeV, \
62 const int16_t *table, \
65 uint8_t *dst1, int linesize1, \
66 uint8_t *dst2, int linesize2); \
68 static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \
69 const int srcStride[], int srcSliceY, \
70 int srcSliceH, uint8_t *const dst[], \
71 const int dstStride[]) { \
72 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
74 return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
75 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
76 src[0], srcStride[0], \
77 src[1], srcStride[1], \
78 src[2], srcStride[2], \
80 c->yuv2rgb_y_offset >> 6, \
82 dst[1] + srcSliceY * dstStride[1], dstStride[1], \
83 dst[2] + srcSliceY * dstStride[2], dstStride[2]); \
86 #define DECLARE_FF_YUVX_TO_ALL_RGBX_FUNCS(yuvx) \
87 DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, argb) \
88 DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, rgba) \
89 DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, abgr) \
90 DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, bgra) \
91 DECLARE_FF_YUVX_TO_GBRP_FUNCS(yuvx, gbrp) \
92 DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, rgb24) \
93 DECLARE_FF_YUVX_TO_RGBX_FUNCS(yuvx, bgr24) \
98 #define DECLARE_FF_YUVA420P_TO_RGBX_FUNCS(ofmt) \
99 int ff_yuva420p_to_##ofmt##_neon(int w, int h, \
100 uint8_t *dst, int linesize, \
101 const uint8_t *srcY, int linesizeY, \
102 const uint8_t *srcU, int linesizeU, \
103 const uint8_t *srcV, int linesizeV, \
104 const int16_t *table, \
105 int y_offset, int y_coeff, \
106 const uint8_t *srcA, int linesizeA); \
108 static int yuva420p_to_##ofmt##_neon_wrapper(SwsInternal *c, \
109 const uint8_t *const src[], \
110 const int srcStride[], int srcSliceY, \
111 int srcSliceH, uint8_t *const dst[], \
112 const int dstStride[]) { \
113 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
115 return ff_yuva420p_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
116 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
117 src[0], srcStride[0], \
118 src[1], srcStride[1], \
119 src[2], srcStride[2], \
121 c->yuv2rgb_y_offset >> 6, \
122 c->yuv2rgb_y_coeff, \
123 src[3], srcStride[3]); \
131 #define DECLARE_FF_NVX_TO_RGBX_FUNCS(ifmt, ofmt) \
132 int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \
133 uint8_t *dst, int linesize, \
134 const uint8_t *srcY, int linesizeY, \
135 const uint8_t *srcC, int linesizeC, \
136 const int16_t *table, \
140 static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \
141 const int srcStride[], int srcSliceY, \
142 int srcSliceH, uint8_t *const dst[], \
143 const int dstStride[]) { \
144 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
146 return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
147 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
148 src[0], srcStride[0], src[1], srcStride[1], \
150 c->yuv2rgb_y_offset >> 6, \
151 c->yuv2rgb_y_coeff); \
154 #define DECLARE_FF_NVX_TO_GBRP_FUNCS(ifmt, ofmt) \
155 int ff_##ifmt##_to_##ofmt##_neon(int w, int h, \
156 uint8_t *dst, int linesize, \
157 const uint8_t *srcY, int linesizeY, \
158 const uint8_t *srcC, int linesizeC, \
159 const int16_t *table, \
162 uint8_t *dst1, int linesize1, \
163 uint8_t *dst2, int linesize2); \
165 static int ifmt##_to_##ofmt##_neon_wrapper(SwsInternal *c, const uint8_t *const src[], \
166 const int srcStride[], int srcSliceY, \
167 int srcSliceH, uint8_t *const dst[], \
168 const int dstStride[]) { \
169 const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
171 return ff_##ifmt##_to_##ofmt##_neon(c->opts.src_w, srcSliceH, \
172 dst[0] + srcSliceY * dstStride[0], dstStride[0], \
173 src[0], srcStride[0], src[1], srcStride[1], \
175 c->yuv2rgb_y_offset >> 6, \
176 c->yuv2rgb_y_coeff, \
177 dst[1] + srcSliceY * dstStride[1], dstStride[1], \
178 dst[2] + srcSliceY * dstStride[2], dstStride[2]); \
182 uint8_t *dst2,
int dstStride2,
183 const uint8_t *
src,
int srcStride,
187 const int srcStride[],
int srcSliceY,
int srcSliceH,
188 uint8_t *
const dst[],
const int dstStride[])
190 uint8_t *dst1 =
dst[1] + dstStride[1] * srcSliceY / 2;
191 uint8_t *dst2 =
dst[2] + dstStride[2] * srcSliceY / 2;
194 dst[0], dstStride[0]);
198 src[1], srcStride[1],
c->opts.src_w / 2,
202 src[1], srcStride[1],
c->opts.src_w / 2,
208 #define DECLARE_FF_NVX_TO_ALL_RGBX_FUNCS(nvx) \
209 DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, argb) \
210 DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, rgba) \
211 DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, abgr) \
212 DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgra) \
213 DECLARE_FF_NVX_TO_GBRP_FUNCS(nvx, gbrp) \
214 DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, rgb24) \
215 DECLARE_FF_NVX_TO_RGBX_FUNCS(nvx, bgr24) \
224 #define SET_FF_NVX_TO_RGBX_FUNC(ifmt, IFMT, ofmt, OFMT, accurate_rnd) do { \
225 if (c->opts.src_format == AV_PIX_FMT_##IFMT \
226 && c->opts.dst_format == AV_PIX_FMT_##OFMT \
227 && !(c->opts.src_h & 1) \
228 && !(c->opts.src_w & 15) \
230 c->convert_unscaled = ifmt##_to_##ofmt##_neon_wrapper; \
233 #define SET_FF_NVX_TO_ALL_RGBX_FUNC(nvx, NVX, accurate_rnd) do { \
234 SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, argb, ARGB, accurate_rnd); \
235 SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, rgba, RGBA, accurate_rnd); \
236 SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, abgr, ABGR, accurate_rnd); \
237 SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, bgra, BGRA, accurate_rnd); \
238 SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, gbrp, GBRP, accurate_rnd); \
239 SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, rgb24, RGB24, accurate_rnd); \
240 SET_FF_NVX_TO_RGBX_FUNC(nvx, NVX, bgr24, BGR24, accurate_rnd); \
260 !(
c->opts.src_h & 1) && !(
c->opts.src_w & 15) && !accurate_rnd)
275 (
c->opts.src_h & 1) || (
c->opts.src_w & 15) ||
280 switch (
c->opts.dst_format) {
290 switch (
c->opts.dst_format) {
291 #if CONFIG_SWSCALE_ALPHA
302 switch (
c->opts.dst_format) {