Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (C) 2001-2011 Michael Niedermayer <michaelni@gmx.at> | ||
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 <inttypes.h> | ||
22 | #include <string.h> | ||
23 | #include <math.h> | ||
24 | #include <stdio.h> | ||
25 | #include "config.h" | ||
26 | #include "swscale.h" | ||
27 | #include "swscale_internal.h" | ||
28 | #include "rgb2rgb.h" | ||
29 | #include "libavutil/intreadwrite.h" | ||
30 | #include "libavutil/avutil.h" | ||
31 | #include "libavutil/mathematics.h" | ||
32 | #include "libavutil/mem_internal.h" | ||
33 | #include "libavutil/bswap.h" | ||
34 | #include "libavutil/pixdesc.h" | ||
35 | #include "libavutil/avassert.h" | ||
36 | #include "libavutil/avconfig.h" | ||
37 | |||
38 | DECLARE_ALIGNED(8, static const uint8_t, dithers)[8][8][8]={ | ||
39 | { | ||
40 | { 0, 1, 0, 1, 0, 1, 0, 1,}, | ||
41 | { 1, 0, 1, 0, 1, 0, 1, 0,}, | ||
42 | { 0, 1, 0, 1, 0, 1, 0, 1,}, | ||
43 | { 1, 0, 1, 0, 1, 0, 1, 0,}, | ||
44 | { 0, 1, 0, 1, 0, 1, 0, 1,}, | ||
45 | { 1, 0, 1, 0, 1, 0, 1, 0,}, | ||
46 | { 0, 1, 0, 1, 0, 1, 0, 1,}, | ||
47 | { 1, 0, 1, 0, 1, 0, 1, 0,}, | ||
48 | },{ | ||
49 | { 1, 2, 1, 2, 1, 2, 1, 2,}, | ||
50 | { 3, 0, 3, 0, 3, 0, 3, 0,}, | ||
51 | { 1, 2, 1, 2, 1, 2, 1, 2,}, | ||
52 | { 3, 0, 3, 0, 3, 0, 3, 0,}, | ||
53 | { 1, 2, 1, 2, 1, 2, 1, 2,}, | ||
54 | { 3, 0, 3, 0, 3, 0, 3, 0,}, | ||
55 | { 1, 2, 1, 2, 1, 2, 1, 2,}, | ||
56 | { 3, 0, 3, 0, 3, 0, 3, 0,}, | ||
57 | },{ | ||
58 | { 2, 4, 3, 5, 2, 4, 3, 5,}, | ||
59 | { 6, 0, 7, 1, 6, 0, 7, 1,}, | ||
60 | { 3, 5, 2, 4, 3, 5, 2, 4,}, | ||
61 | { 7, 1, 6, 0, 7, 1, 6, 0,}, | ||
62 | { 2, 4, 3, 5, 2, 4, 3, 5,}, | ||
63 | { 6, 0, 7, 1, 6, 0, 7, 1,}, | ||
64 | { 3, 5, 2, 4, 3, 5, 2, 4,}, | ||
65 | { 7, 1, 6, 0, 7, 1, 6, 0,}, | ||
66 | },{ | ||
67 | { 4, 8, 7, 11, 4, 8, 7, 11,}, | ||
68 | { 12, 0, 15, 3, 12, 0, 15, 3,}, | ||
69 | { 6, 10, 5, 9, 6, 10, 5, 9,}, | ||
70 | { 14, 2, 13, 1, 14, 2, 13, 1,}, | ||
71 | { 4, 8, 7, 11, 4, 8, 7, 11,}, | ||
72 | { 12, 0, 15, 3, 12, 0, 15, 3,}, | ||
73 | { 6, 10, 5, 9, 6, 10, 5, 9,}, | ||
74 | { 14, 2, 13, 1, 14, 2, 13, 1,}, | ||
75 | },{ | ||
76 | { 9, 17, 15, 23, 8, 16, 14, 22,}, | ||
77 | { 25, 1, 31, 7, 24, 0, 30, 6,}, | ||
78 | { 13, 21, 11, 19, 12, 20, 10, 18,}, | ||
79 | { 29, 5, 27, 3, 28, 4, 26, 2,}, | ||
80 | { 8, 16, 14, 22, 9, 17, 15, 23,}, | ||
81 | { 24, 0, 30, 6, 25, 1, 31, 7,}, | ||
82 | { 12, 20, 10, 18, 13, 21, 11, 19,}, | ||
83 | { 28, 4, 26, 2, 29, 5, 27, 3,}, | ||
84 | },{ | ||
85 | { 18, 34, 30, 46, 17, 33, 29, 45,}, | ||
86 | { 50, 2, 62, 14, 49, 1, 61, 13,}, | ||
87 | { 26, 42, 22, 38, 25, 41, 21, 37,}, | ||
88 | { 58, 10, 54, 6, 57, 9, 53, 5,}, | ||
89 | { 16, 32, 28, 44, 19, 35, 31, 47,}, | ||
90 | { 48, 0, 60, 12, 51, 3, 63, 15,}, | ||
91 | { 24, 40, 20, 36, 27, 43, 23, 39,}, | ||
92 | { 56, 8, 52, 4, 59, 11, 55, 7,}, | ||
93 | },{ | ||
94 | { 18, 34, 30, 46, 17, 33, 29, 45,}, | ||
95 | { 50, 2, 62, 14, 49, 1, 61, 13,}, | ||
96 | { 26, 42, 22, 38, 25, 41, 21, 37,}, | ||
97 | { 58, 10, 54, 6, 57, 9, 53, 5,}, | ||
98 | { 16, 32, 28, 44, 19, 35, 31, 47,}, | ||
99 | { 48, 0, 60, 12, 51, 3, 63, 15,}, | ||
100 | { 24, 40, 20, 36, 27, 43, 23, 39,}, | ||
101 | { 56, 8, 52, 4, 59, 11, 55, 7,}, | ||
102 | },{ | ||
103 | { 36, 68, 60, 92, 34, 66, 58, 90,}, | ||
104 | { 100, 4,124, 28, 98, 2,122, 26,}, | ||
105 | { 52, 84, 44, 76, 50, 82, 42, 74,}, | ||
106 | { 116, 20,108, 12,114, 18,106, 10,}, | ||
107 | { 32, 64, 56, 88, 38, 70, 62, 94,}, | ||
108 | { 96, 0,120, 24,102, 6,126, 30,}, | ||
109 | { 48, 80, 40, 72, 54, 86, 46, 78,}, | ||
110 | { 112, 16,104, 8,118, 22,110, 14,}, | ||
111 | }}; | ||
112 | |||
113 | |||
114 | 476 | static void fillPlane(uint8_t *plane, int stride, int width, int height, int y, | |
115 | uint8_t val) | ||
116 | { | ||
117 | int i; | ||
118 | 476 | uint8_t *ptr = plane + stride * y; | |
119 |
2/2✓ Branch 0 taken 21888 times.
✓ Branch 1 taken 476 times.
|
22364 | for (i = 0; i < height; i++) { |
120 | 21888 | memset(ptr, val, width); | |
121 | 21888 | ptr += stride; | |
122 | } | ||
123 | 476 | } | |
124 | |||
125 | 1965 | static void copyPlane(const uint8_t *src, int srcStride, | |
126 | int srcSliceY, int srcSliceH, int width, | ||
127 | uint8_t *dst, int dstStride) | ||
128 | { | ||
129 | 1965 | dst += dstStride * srcSliceY; | |
130 |
3/4✓ Branch 0 taken 900 times.
✓ Branch 1 taken 1065 times.
✓ Branch 2 taken 900 times.
✗ Branch 3 not taken.
|
1965 | if (dstStride == srcStride && srcStride > 0) { |
131 | 900 | memcpy(dst, src, srcSliceH * dstStride); | |
132 | } else { | ||
133 | int i; | ||
134 |
2/2✓ Branch 0 taken 37980 times.
✓ Branch 1 taken 1065 times.
|
39045 | for (i = 0; i < srcSliceH; i++) { |
135 | 37980 | memcpy(dst, src, width); | |
136 | 37980 | src += srcStride; | |
137 | 37980 | dst += dstStride; | |
138 | } | ||
139 | } | ||
140 | 1965 | } | |
141 | |||
142 | 930 | static int planarToNv12Wrapper(SwsContext *c, const uint8_t *src[], | |
143 | int srcStride[], int srcSliceY, | ||
144 | int srcSliceH, uint8_t *dstParam[], | ||
145 | int dstStride[]) | ||
146 | { | ||
147 | 930 | uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
148 | |||
149 | 930 | copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
150 | dstParam[0], dstStride[0]); | ||
151 | |||
152 |
2/2✓ Branch 0 taken 465 times.
✓ Branch 1 taken 465 times.
|
930 | if (c->dstFormat == AV_PIX_FMT_NV12) |
153 | 465 | interleaveBytes(src[1], src[2], dst, c->chrSrcW, (srcSliceH + 1) / 2, | |
154 | 465 | srcStride[1], srcStride[2], dstStride[1]); | |
155 | else | ||
156 | 465 | interleaveBytes(src[2], src[1], dst, c->chrSrcW, (srcSliceH + 1) / 2, | |
157 | 465 | srcStride[2], srcStride[1], dstStride[1]); | |
158 | |||
159 | 930 | return srcSliceH; | |
160 | } | ||
161 | |||
162 | 900 | static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *src[], | |
163 | int srcStride[], int srcSliceY, | ||
164 | int srcSliceH, uint8_t *dstParam[], | ||
165 | int dstStride[]) | ||
166 | { | ||
167 | 900 | uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
168 | 900 | uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
169 | |||
170 | 900 | copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
171 | dstParam[0], dstStride[0]); | ||
172 | |||
173 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 450 times.
|
900 | if (c->srcFormat == AV_PIX_FMT_NV12) |
174 | 450 | deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, (srcSliceH + 1) / 2, | |
175 | 450 | srcStride[1], dstStride[1], dstStride[2]); | |
176 | else | ||
177 | 450 | deinterleaveBytes(src[1], dst2, dst1, c->chrSrcW, (srcSliceH + 1) / 2, | |
178 | 450 | srcStride[1], dstStride[2], dstStride[1]); | |
179 | |||
180 | 900 | return srcSliceH; | |
181 | } | ||
182 | |||
183 | ✗ | static int planarToNv24Wrapper(SwsContext *c, const uint8_t *src[], | |
184 | int srcStride[], int srcSliceY, | ||
185 | int srcSliceH, uint8_t *dstParam[], | ||
186 | int dstStride[]) | ||
187 | { | ||
188 | ✗ | uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY; | |
189 | |||
190 | ✗ | copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
191 | dstParam[0], dstStride[0]); | ||
192 | |||
193 | ✗ | if (c->dstFormat == AV_PIX_FMT_NV24) | |
194 | ✗ | interleaveBytes(src[1], src[2], dst, c->chrSrcW, srcSliceH, | |
195 | ✗ | srcStride[1], srcStride[2], dstStride[1]); | |
196 | else | ||
197 | ✗ | interleaveBytes(src[2], src[1], dst, c->chrSrcW, srcSliceH, | |
198 | ✗ | srcStride[2], srcStride[1], dstStride[1]); | |
199 | |||
200 | ✗ | return srcSliceH; | |
201 | } | ||
202 | |||
203 | ✗ | static int nv24ToPlanarWrapper(SwsContext *c, const uint8_t *src[], | |
204 | int srcStride[], int srcSliceY, | ||
205 | int srcSliceH, uint8_t *dstParam[], | ||
206 | int dstStride[]) | ||
207 | { | ||
208 | ✗ | uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY; | |
209 | ✗ | uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY; | |
210 | |||
211 | ✗ | copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
212 | dstParam[0], dstStride[0]); | ||
213 | |||
214 | ✗ | if (c->srcFormat == AV_PIX_FMT_NV24) | |
215 | ✗ | deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, srcSliceH, | |
216 | ✗ | srcStride[1], dstStride[1], dstStride[2]); | |
217 | else | ||
218 | ✗ | deinterleaveBytes(src[1], dst2, dst1, c->chrSrcW, srcSliceH, | |
219 | ✗ | srcStride[1], dstStride[2], dstStride[1]); | |
220 | |||
221 | ✗ | return srcSliceH; | |
222 | } | ||
223 | |||
224 | ✗ | static int planarToP01xWrapper(SwsContext *c, const uint8_t *src8[], | |
225 | int srcStride[], int srcSliceY, | ||
226 | int srcSliceH, uint8_t *dstParam8[], | ||
227 | int dstStride[]) | ||
228 | { | ||
229 | ✗ | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat); | |
230 | ✗ | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat); | |
231 | ✗ | const uint16_t **src = (const uint16_t**)src8; | |
232 | ✗ | uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY); | |
233 | ✗ | uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2); | |
234 | int x, y; | ||
235 | |||
236 | /* Calculate net shift required for values. */ | ||
237 | ✗ | const int shift[3] = { | |
238 | ✗ | dst_format->comp[0].depth + dst_format->comp[0].shift - | |
239 | ✗ | src_format->comp[0].depth - src_format->comp[0].shift, | |
240 | ✗ | dst_format->comp[1].depth + dst_format->comp[1].shift - | |
241 | ✗ | src_format->comp[1].depth - src_format->comp[1].shift, | |
242 | ✗ | dst_format->comp[2].depth + dst_format->comp[2].shift - | |
243 | ✗ | src_format->comp[2].depth - src_format->comp[2].shift, | |
244 | }; | ||
245 | |||
246 | ✗ | av_assert0(!(srcStride[0] % 2 || srcStride[1] % 2 || srcStride[2] % 2 || | |
247 | dstStride[0] % 2 || dstStride[1] % 2)); | ||
248 | |||
249 | ✗ | for (y = 0; y < srcSliceH; y++) { | |
250 | ✗ | uint16_t *tdstY = dstY; | |
251 | ✗ | const uint16_t *tsrc0 = src[0]; | |
252 | ✗ | for (x = c->srcW; x > 0; x--) { | |
253 | ✗ | *tdstY++ = *tsrc0++ << shift[0]; | |
254 | } | ||
255 | ✗ | src[0] += srcStride[0] / 2; | |
256 | ✗ | dstY += dstStride[0] / 2; | |
257 | |||
258 | ✗ | if (!(y & 1)) { | |
259 | ✗ | uint16_t *tdstUV = dstUV; | |
260 | ✗ | const uint16_t *tsrc1 = src[1]; | |
261 | ✗ | const uint16_t *tsrc2 = src[2]; | |
262 | ✗ | for (x = c->srcW / 2; x > 0; x--) { | |
263 | ✗ | *tdstUV++ = *tsrc1++ << shift[1]; | |
264 | ✗ | *tdstUV++ = *tsrc2++ << shift[2]; | |
265 | } | ||
266 | ✗ | src[1] += srcStride[1] / 2; | |
267 | ✗ | src[2] += srcStride[2] / 2; | |
268 | ✗ | dstUV += dstStride[1] / 2; | |
269 | } | ||
270 | } | ||
271 | |||
272 | ✗ | return srcSliceH; | |
273 | } | ||
274 | |||
275 | #if AV_HAVE_BIGENDIAN | ||
276 | #define output_pixel(p, v) do { \ | ||
277 | uint16_t *pp = (p); \ | ||
278 | AV_WL16(pp, (v)); \ | ||
279 | } while(0) | ||
280 | #else | ||
281 | #define output_pixel(p, v) (*p) = (v) | ||
282 | #endif | ||
283 | |||
284 | 30 | static int planar8ToP01xleWrapper(SwsContext *c, const uint8_t *src[], | |
285 | int srcStride[], int srcSliceY, | ||
286 | int srcSliceH, uint8_t *dstParam8[], | ||
287 | int dstStride[]) | ||
288 | { | ||
289 | 30 | uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY); | |
290 | 30 | uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2); | |
291 | int x, y, t; | ||
292 | |||
293 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 30 times.
|
30 | av_assert0(!(dstStride[0] % 2 || dstStride[1] % 2)); |
294 | |||
295 |
2/2✓ Branch 0 taken 8640 times.
✓ Branch 1 taken 30 times.
|
8670 | for (y = 0; y < srcSliceH; y++) { |
296 | 8640 | uint16_t *tdstY = dstY; | |
297 | 8640 | const uint8_t *tsrc0 = src[0]; | |
298 |
2/2✓ Branch 0 taken 3041280 times.
✓ Branch 1 taken 8640 times.
|
3049920 | for (x = c->srcW; x > 0; x--) { |
299 | 3041280 | t = *tsrc0++; | |
300 | 3041280 | output_pixel(tdstY++, t | (t << 8)); | |
301 | } | ||
302 | 8640 | src[0] += srcStride[0]; | |
303 | 8640 | dstY += dstStride[0] / 2; | |
304 | |||
305 |
2/2✓ Branch 0 taken 4320 times.
✓ Branch 1 taken 4320 times.
|
8640 | if (!(y & 1)) { |
306 | 4320 | uint16_t *tdstUV = dstUV; | |
307 | 4320 | const uint8_t *tsrc1 = src[1]; | |
308 | 4320 | const uint8_t *tsrc2 = src[2]; | |
309 |
2/2✓ Branch 0 taken 760320 times.
✓ Branch 1 taken 4320 times.
|
764640 | for (x = c->srcW / 2; x > 0; x--) { |
310 | 760320 | t = *tsrc1++; | |
311 | 760320 | output_pixel(tdstUV++, t | (t << 8)); | |
312 | 760320 | t = *tsrc2++; | |
313 | 760320 | output_pixel(tdstUV++, t | (t << 8)); | |
314 | } | ||
315 | 4320 | src[1] += srcStride[1]; | |
316 | 4320 | src[2] += srcStride[2]; | |
317 | 4320 | dstUV += dstStride[1] / 2; | |
318 | } | ||
319 | } | ||
320 | |||
321 | 30 | return srcSliceH; | |
322 | } | ||
323 | |||
324 | #undef output_pixel | ||
325 | |||
326 | ✗ | static int planarToYuy2Wrapper(SwsContext *c, const uint8_t *src[], | |
327 | int srcStride[], int srcSliceY, int srcSliceH, | ||
328 | uint8_t *dstParam[], int dstStride[]) | ||
329 | { | ||
330 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
331 | |||
332 | ✗ | yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], | |
333 | ✗ | srcStride[1], dstStride[0]); | |
334 | |||
335 | ✗ | return srcSliceH; | |
336 | } | ||
337 | |||
338 | ✗ | static int planarToUyvyWrapper(SwsContext *c, const uint8_t *src[], | |
339 | int srcStride[], int srcSliceY, int srcSliceH, | ||
340 | uint8_t *dstParam[], int dstStride[]) | ||
341 | { | ||
342 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
343 | |||
344 | ✗ | yv12touyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], | |
345 | ✗ | srcStride[1], dstStride[0]); | |
346 | |||
347 | ✗ | return srcSliceH; | |
348 | } | ||
349 | |||
350 | ✗ | static int yuv422pToYuy2Wrapper(SwsContext *c, const uint8_t *src[], | |
351 | int srcStride[], int srcSliceY, int srcSliceH, | ||
352 | uint8_t *dstParam[], int dstStride[]) | ||
353 | { | ||
354 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
355 | |||
356 | ✗ | yuv422ptoyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], | |
357 | ✗ | srcStride[1], dstStride[0]); | |
358 | |||
359 | ✗ | return srcSliceH; | |
360 | } | ||
361 | |||
362 | ✗ | static int yuv422pToUyvyWrapper(SwsContext *c, const uint8_t *src[], | |
363 | int srcStride[], int srcSliceY, int srcSliceH, | ||
364 | uint8_t *dstParam[], int dstStride[]) | ||
365 | { | ||
366 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
367 | |||
368 | ✗ | yuv422ptouyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], | |
369 | ✗ | srcStride[1], dstStride[0]); | |
370 | |||
371 | ✗ | return srcSliceH; | |
372 | } | ||
373 | |||
374 | ✗ | static int yuyvToYuv420Wrapper(SwsContext *c, const uint8_t *src[], | |
375 | int srcStride[], int srcSliceY, int srcSliceH, | ||
376 | uint8_t *dstParam[], int dstStride[]) | ||
377 | { | ||
378 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
379 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
380 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
381 | |||
382 | ✗ | yuyvtoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], | |
383 | ✗ | dstStride[1], srcStride[0]); | |
384 | |||
385 | ✗ | if (dstParam[3]) | |
386 | ✗ | fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
387 | |||
388 | ✗ | return srcSliceH; | |
389 | } | ||
390 | |||
391 | ✗ | static int yuyvToYuv422Wrapper(SwsContext *c, const uint8_t *src[], | |
392 | int srcStride[], int srcSliceY, int srcSliceH, | ||
393 | uint8_t *dstParam[], int dstStride[]) | ||
394 | { | ||
395 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
396 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY; | |
397 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY; | |
398 | |||
399 | ✗ | yuyvtoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], | |
400 | ✗ | dstStride[1], srcStride[0]); | |
401 | |||
402 | ✗ | return srcSliceH; | |
403 | } | ||
404 | |||
405 | ✗ | static int uyvyToYuv420Wrapper(SwsContext *c, const uint8_t *src[], | |
406 | int srcStride[], int srcSliceY, int srcSliceH, | ||
407 | uint8_t *dstParam[], int dstStride[]) | ||
408 | { | ||
409 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
410 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
411 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
412 | |||
413 | ✗ | uyvytoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], | |
414 | ✗ | dstStride[1], srcStride[0]); | |
415 | |||
416 | ✗ | if (dstParam[3]) | |
417 | ✗ | fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
418 | |||
419 | ✗ | return srcSliceH; | |
420 | } | ||
421 | |||
422 | ✗ | static int uyvyToYuv422Wrapper(SwsContext *c, const uint8_t *src[], | |
423 | int srcStride[], int srcSliceY, int srcSliceH, | ||
424 | uint8_t *dstParam[], int dstStride[]) | ||
425 | { | ||
426 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
427 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY; | |
428 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY; | |
429 | |||
430 | ✗ | uyvytoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], | |
431 | ✗ | dstStride[1], srcStride[0]); | |
432 | |||
433 | ✗ | return srcSliceH; | |
434 | } | ||
435 | |||
436 | ✗ | static void gray8aToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, | |
437 | const uint8_t *palette) | ||
438 | { | ||
439 | int i; | ||
440 | ✗ | for (i = 0; i < num_pixels; i++) | |
441 | ✗ | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i << 1]] | (src[(i << 1) + 1] << 24); | |
442 | ✗ | } | |
443 | |||
444 | ✗ | static void gray8aToPacked32_1(const uint8_t *src, uint8_t *dst, int num_pixels, | |
445 | const uint8_t *palette) | ||
446 | { | ||
447 | int i; | ||
448 | |||
449 | ✗ | for (i = 0; i < num_pixels; i++) | |
450 | ✗ | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i << 1]] | src[(i << 1) + 1]; | |
451 | ✗ | } | |
452 | |||
453 | ✗ | static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, | |
454 | const uint8_t *palette) | ||
455 | { | ||
456 | int i; | ||
457 | |||
458 | ✗ | for (i = 0; i < num_pixels; i++) { | |
459 | //FIXME slow? | ||
460 | ✗ | dst[0] = palette[src[i << 1] * 4 + 0]; | |
461 | ✗ | dst[1] = palette[src[i << 1] * 4 + 1]; | |
462 | ✗ | dst[2] = palette[src[i << 1] * 4 + 2]; | |
463 | ✗ | dst += 3; | |
464 | } | ||
465 | ✗ | } | |
466 | |||
467 | 65 | static int bswap_16bpc(SwsContext *c, const uint8_t *src[], | |
468 | int srcStride[], int srcSliceY, int srcSliceH, | ||
469 | uint8_t *dst[], int dstStride[]) | ||
470 | { | ||
471 | int i, j, p; | ||
472 | |||
473 |
2/2✓ Branch 0 taken 260 times.
✓ Branch 1 taken 65 times.
|
325 | for (p = 0; p < 4; p++) { |
474 | 260 | int srcstr = srcStride[p] / 2; | |
475 | 260 | int dststr = dstStride[p] / 2; | |
476 | 260 | uint16_t *dstPtr = (uint16_t *) dst[p]; | |
477 | 260 | const uint16_t *srcPtr = (const uint16_t *) src[p]; | |
478 | 260 | int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr)); | |
479 |
3/4✓ Branch 0 taken 195 times.
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 195 times.
|
260 | if(!dstPtr || !srcPtr) |
480 | 65 | continue; | |
481 | 195 | dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; | |
482 |
2/2✓ Branch 0 taken 55040 times.
✓ Branch 1 taken 195 times.
|
55235 | for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { |
483 |
2/2✓ Branch 0 taken 21809152 times.
✓ Branch 1 taken 55040 times.
|
21864192 | for (j = 0; j < min_stride; j++) { |
484 | 21809152 | dstPtr[j] = av_bswap16(srcPtr[j]); | |
485 | } | ||
486 | 55040 | srcPtr += srcstr; | |
487 | 55040 | dstPtr += dststr; | |
488 | } | ||
489 | } | ||
490 | |||
491 | 65 | return srcSliceH; | |
492 | } | ||
493 | |||
494 | 13 | static int bswap_32bpc(SwsContext *c, const uint8_t *src[], | |
495 | int srcStride[], int srcSliceY, int srcSliceH, | ||
496 | uint8_t *dst[], int dstStride[]) | ||
497 | { | ||
498 | int i, j, p; | ||
499 | |||
500 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 13 times.
|
65 | for (p = 0; p < 4; p++) { |
501 | 52 | int srcstr = srcStride[p] / 4; | |
502 | 52 | int dststr = dstStride[p] / 4; | |
503 | 52 | uint32_t *dstPtr = (uint32_t *) dst[p]; | |
504 | 52 | const uint32_t *srcPtr = (const uint32_t *) src[p]; | |
505 | 52 | int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr)); | |
506 |
3/4✓ Branch 0 taken 39 times.
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39 times.
|
52 | if(!dstPtr || !srcPtr) |
507 | 13 | continue; | |
508 | 39 | dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; | |
509 |
2/2✓ Branch 0 taken 11232 times.
✓ Branch 1 taken 39 times.
|
11271 | for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { |
510 |
2/2✓ Branch 0 taken 3953664 times.
✓ Branch 1 taken 11232 times.
|
3964896 | for (j = 0; j < min_stride; j++) { |
511 | 3953664 | dstPtr[j] = av_bswap32(srcPtr[j]); | |
512 | } | ||
513 | 11232 | srcPtr += srcstr; | |
514 | 11232 | dstPtr += dststr; | |
515 | } | ||
516 | } | ||
517 | |||
518 | 13 | return srcSliceH; | |
519 | } | ||
520 | |||
521 | |||
522 | 32363 | static int palToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], | |
523 | int srcSliceY, int srcSliceH, uint8_t *dst[], | ||
524 | int dstStride[]) | ||
525 | { | ||
526 | 32363 | const enum AVPixelFormat srcFormat = c->srcFormat; | |
527 | 32363 | const enum AVPixelFormat dstFormat = c->dstFormat; | |
528 | 32363 | void (*conv)(const uint8_t *src, uint8_t *dst, int num_pixels, | |
529 | const uint8_t *palette) = NULL; | ||
530 | int i; | ||
531 | 32363 | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
532 | 32363 | const uint8_t *srcPtr = src[0]; | |
533 | |||
534 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32363 times.
|
32363 | if (srcFormat == AV_PIX_FMT_YA8) { |
535 | ✗ | switch (dstFormat) { | |
536 | ✗ | case AV_PIX_FMT_RGB32 : conv = gray8aToPacked32; break; | |
537 | ✗ | case AV_PIX_FMT_BGR32 : conv = gray8aToPacked32; break; | |
538 | ✗ | case AV_PIX_FMT_BGR32_1: conv = gray8aToPacked32_1; break; | |
539 | ✗ | case AV_PIX_FMT_RGB32_1: conv = gray8aToPacked32_1; break; | |
540 | ✗ | case AV_PIX_FMT_RGB24 : conv = gray8aToPacked24; break; | |
541 | ✗ | case AV_PIX_FMT_BGR24 : conv = gray8aToPacked24; break; | |
542 | } | ||
543 |
1/2✓ Branch 1 taken 32363 times.
✗ Branch 2 not taken.
|
32363 | } else if (usePal(srcFormat)) { |
544 |
3/7✓ Branch 0 taken 2556 times.
✓ Branch 1 taken 1952 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 27855 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
32363 | switch (dstFormat) { |
545 | 2556 | case AV_PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break; | |
546 | 1952 | case AV_PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break; | |
547 | ✗ | case AV_PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break; | |
548 | ✗ | case AV_PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break; | |
549 | 27855 | case AV_PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break; | |
550 | ✗ | case AV_PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break; | |
551 | } | ||
552 | } | ||
553 | |||
554 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32363 times.
|
32363 | if (!conv) |
555 | ✗ | av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", | |
556 | av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); | ||
557 | else { | ||
558 |
2/2✓ Branch 0 taken 807398 times.
✓ Branch 1 taken 32363 times.
|
839761 | for (i = 0; i < srcSliceH; i++) { |
559 | 807398 | conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb); | |
560 | 807398 | srcPtr += srcStride[0]; | |
561 | 807398 | dstPtr += dstStride[0]; | |
562 | } | ||
563 | } | ||
564 | |||
565 | 32363 | return srcSliceH; | |
566 | } | ||
567 | |||
568 | 2 | static void packed16togbra16(const uint8_t *src, int srcStride, | |
569 | uint16_t *dst[], int dstStride[], int srcSliceH, | ||
570 | int src_alpha, int swap, int shift, int width) | ||
571 | { | ||
572 | int x, h, i; | ||
573 | 2 | int dst_alpha = dst[3] != NULL; | |
574 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 2 times.
|
258 | for (h = 0; h < srcSliceH; h++) { |
575 | 256 | uint16_t *src_line = (uint16_t *)(src + srcStride * h); | |
576 |
1/4✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
256 | switch (swap) { |
577 | 256 | case 3: | |
578 |
3/4✓ Branch 0 taken 128 times.
✓ Branch 1 taken 128 times.
✓ Branch 2 taken 128 times.
✗ Branch 3 not taken.
|
256 | if (src_alpha && dst_alpha) { |
579 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 128 times.
|
16512 | for (x = 0; x < width; x++) { |
580 | 16384 | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
581 | 16384 | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
582 | 16384 | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
583 | 16384 | dst[3][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
584 | } | ||
585 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
|
128 | } else if (dst_alpha) { |
586 | ✗ | for (x = 0; x < width; x++) { | |
587 | ✗ | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
588 | ✗ | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
589 | ✗ | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
590 | ✗ | dst[3][x] = 0xFFFF; | |
591 | } | ||
592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
|
128 | } else if (src_alpha) { |
593 | ✗ | for (x = 0; x < width; x++) { | |
594 | ✗ | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
595 | ✗ | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
596 | ✗ | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
597 | ✗ | src_line++; | |
598 | } | ||
599 | } else { | ||
600 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 128 times.
|
16512 | for (x = 0; x < width; x++) { |
601 | 16384 | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
602 | 16384 | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
603 | 16384 | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
604 | } | ||
605 | } | ||
606 | 256 | break; | |
607 | ✗ | case 2: | |
608 | ✗ | if (src_alpha && dst_alpha) { | |
609 | ✗ | for (x = 0; x < width; x++) { | |
610 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
611 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
612 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
613 | ✗ | dst[3][x] = av_bswap16(*src_line++ >> shift); | |
614 | } | ||
615 | ✗ | } else if (dst_alpha) { | |
616 | ✗ | for (x = 0; x < width; x++) { | |
617 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
618 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
619 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
620 | ✗ | dst[3][x] = 0xFFFF; | |
621 | } | ||
622 | ✗ | } else if (src_alpha) { | |
623 | ✗ | for (x = 0; x < width; x++) { | |
624 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
625 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
626 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
627 | ✗ | src_line++; | |
628 | } | ||
629 | } else { | ||
630 | ✗ | for (x = 0; x < width; x++) { | |
631 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
632 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
633 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
634 | } | ||
635 | } | ||
636 | ✗ | break; | |
637 | ✗ | case 1: | |
638 | ✗ | if (src_alpha && dst_alpha) { | |
639 | ✗ | for (x = 0; x < width; x++) { | |
640 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
641 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
642 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
643 | ✗ | dst[3][x] = av_bswap16(*src_line++) >> shift; | |
644 | } | ||
645 | ✗ | } else if (dst_alpha) { | |
646 | ✗ | for (x = 0; x < width; x++) { | |
647 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
648 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
649 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
650 | ✗ | dst[3][x] = 0xFFFF; | |
651 | } | ||
652 | ✗ | } else if (src_alpha) { | |
653 | ✗ | for (x = 0; x < width; x++) { | |
654 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
655 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
656 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
657 | ✗ | src_line++; | |
658 | } | ||
659 | } else { | ||
660 | ✗ | for (x = 0; x < width; x++) { | |
661 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
662 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
663 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
664 | } | ||
665 | } | ||
666 | ✗ | break; | |
667 | ✗ | default: | |
668 | ✗ | if (src_alpha && dst_alpha) { | |
669 | ✗ | for (x = 0; x < width; x++) { | |
670 | ✗ | dst[0][x] = *src_line++ >> shift; | |
671 | ✗ | dst[1][x] = *src_line++ >> shift; | |
672 | ✗ | dst[2][x] = *src_line++ >> shift; | |
673 | ✗ | dst[3][x] = *src_line++ >> shift; | |
674 | } | ||
675 | ✗ | } else if (dst_alpha) { | |
676 | ✗ | for (x = 0; x < width; x++) { | |
677 | ✗ | dst[0][x] = *src_line++ >> shift; | |
678 | ✗ | dst[1][x] = *src_line++ >> shift; | |
679 | ✗ | dst[2][x] = *src_line++ >> shift; | |
680 | ✗ | dst[3][x] = 0xFFFF; | |
681 | } | ||
682 | ✗ | } else if (src_alpha) { | |
683 | ✗ | for (x = 0; x < width; x++) { | |
684 | ✗ | dst[0][x] = *src_line++ >> shift; | |
685 | ✗ | dst[1][x] = *src_line++ >> shift; | |
686 | ✗ | dst[2][x] = *src_line++ >> shift; | |
687 | ✗ | src_line++; | |
688 | } | ||
689 | } else { | ||
690 | ✗ | for (x = 0; x < width; x++) { | |
691 | ✗ | dst[0][x] = *src_line++ >> shift; | |
692 | ✗ | dst[1][x] = *src_line++ >> shift; | |
693 | ✗ | dst[2][x] = *src_line++ >> shift; | |
694 | } | ||
695 | } | ||
696 | } | ||
697 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 256 times.
|
1280 | for (i = 0; i < 4; i++) |
698 | 1024 | dst[i] += dstStride[i] >> 1; | |
699 | } | ||
700 | 2 | } | |
701 | |||
702 | 2 | static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *src[], | |
703 | int srcStride[], int srcSliceY, int srcSliceH, | ||
704 | uint8_t *dst[], int dstStride[]) | ||
705 | { | ||
706 | 2 | uint16_t *dst2013[] = { (uint16_t *)dst[2], (uint16_t *)dst[0], (uint16_t *)dst[1], (uint16_t *)dst[3] }; | |
707 | 2 | uint16_t *dst1023[] = { (uint16_t *)dst[1], (uint16_t *)dst[0], (uint16_t *)dst[2], (uint16_t *)dst[3] }; | |
708 | 2 | int stride2013[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] }; | |
709 | 2 | int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] }; | |
710 | 2 | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat); | |
711 | 2 | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat); | |
712 | 2 | int bpc = dst_format->comp[0].depth; | |
713 | 2 | int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA; | |
714 | 2 | int swap = 0; | |
715 | int i; | ||
716 | |||
717 | 2 | if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) || | |
718 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | !HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE) |
719 | 2 | swap++; | |
720 | 2 | if ( HAVE_BIGENDIAN && !(dst_format->flags & AV_PIX_FMT_FLAG_BE) || | |
721 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | !HAVE_BIGENDIAN && dst_format->flags & AV_PIX_FMT_FLAG_BE) |
722 | 2 | swap += 2; | |
723 | |||
724 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if ((dst_format->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) != |
725 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB) || bpc < 9) { |
726 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported conversion to planar RGB %s -> %s\n", | |
727 | ✗ | src_format->name, dst_format->name); | |
728 | ✗ | return srcSliceH; | |
729 | } | ||
730 | |||
731 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | for(i=0; i<4; i++) { |
732 | 8 | dst2013[i] += stride2013[i] * srcSliceY / 2; | |
733 | 8 | dst1023[i] += stride1023[i] * srcSliceY / 2; | |
734 | } | ||
735 | |||
736 |
1/3✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
2 | switch (c->srcFormat) { |
737 | 2 | case AV_PIX_FMT_RGB48LE: | |
738 | case AV_PIX_FMT_RGB48BE: | ||
739 | case AV_PIX_FMT_RGBA64LE: | ||
740 | case AV_PIX_FMT_RGBA64BE: | ||
741 | 2 | packed16togbra16(src[0], srcStride[0], | |
742 | dst2013, stride2013, srcSliceH, alpha, swap, | ||
743 | 16 - bpc, c->srcW); | ||
744 | 2 | break; | |
745 | ✗ | case AV_PIX_FMT_BGR48LE: | |
746 | case AV_PIX_FMT_BGR48BE: | ||
747 | case AV_PIX_FMT_BGRA64LE: | ||
748 | case AV_PIX_FMT_BGRA64BE: | ||
749 | ✗ | packed16togbra16(src[0], srcStride[0], | |
750 | dst1023, stride1023, srcSliceH, alpha, swap, | ||
751 | 16 - bpc, c->srcW); | ||
752 | ✗ | break; | |
753 | ✗ | default: | |
754 | ✗ | av_log(c, AV_LOG_ERROR, | |
755 | "unsupported conversion to planar RGB %s -> %s\n", | ||
756 | ✗ | src_format->name, dst_format->name); | |
757 | } | ||
758 | |||
759 | 2 | return srcSliceH; | |
760 | } | ||
761 | |||
762 | 40 | static void gbr16ptopacked16(const uint16_t *src[], int srcStride[], | |
763 | uint8_t *dst, int dstStride, int srcSliceH, | ||
764 | int alpha, int swap, int bpp, int width) | ||
765 | { | ||
766 | int x, h, i; | ||
767 | 40 | int src_alpha = src[3] != NULL; | |
768 | 40 | int scale_high = 16 - bpp, scale_low = (bpp - 8) * 2; | |
769 |
2/2✓ Branch 0 taken 5184 times.
✓ Branch 1 taken 40 times.
|
5224 | for (h = 0; h < srcSliceH; h++) { |
770 | 5184 | uint16_t *dest = (uint16_t *)(dst + dstStride * h); | |
771 | uint16_t component; | ||
772 | |||
773 |
1/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5184 times.
|
5184 | switch(swap) { |
774 | ✗ | case 3: | |
775 | ✗ | if (alpha && !src_alpha) { | |
776 | ✗ | for (x = 0; x < width; x++) { | |
777 | ✗ | component = av_bswap16(src[0][x]); | |
778 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
779 | ✗ | component = av_bswap16(src[1][x]); | |
780 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
781 | ✗ | component = av_bswap16(src[2][x]); | |
782 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
783 | ✗ | *dest++ = 0xffff; | |
784 | } | ||
785 | ✗ | } else if (alpha && src_alpha) { | |
786 | ✗ | for (x = 0; x < width; x++) { | |
787 | ✗ | component = av_bswap16(src[0][x]); | |
788 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
789 | ✗ | component = av_bswap16(src[1][x]); | |
790 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
791 | ✗ | component = av_bswap16(src[2][x]); | |
792 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
793 | ✗ | component = av_bswap16(src[3][x]); | |
794 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
795 | } | ||
796 | } else { | ||
797 | ✗ | for (x = 0; x < width; x++) { | |
798 | ✗ | component = av_bswap16(src[0][x]); | |
799 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
800 | ✗ | component = av_bswap16(src[1][x]); | |
801 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
802 | ✗ | component = av_bswap16(src[2][x]); | |
803 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
804 | } | ||
805 | } | ||
806 | ✗ | break; | |
807 | ✗ | case 2: | |
808 | ✗ | if (alpha && !src_alpha) { | |
809 | ✗ | for (x = 0; x < width; x++) { | |
810 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
811 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
812 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
813 | ✗ | *dest++ = 0xffff; | |
814 | } | ||
815 | ✗ | } else if (alpha && src_alpha) { | |
816 | ✗ | for (x = 0; x < width; x++) { | |
817 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
818 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
819 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
820 | ✗ | *dest++ = av_bswap16(src[3][x] << scale_high | src[3][x] >> scale_low); | |
821 | } | ||
822 | } else { | ||
823 | ✗ | for (x = 0; x < width; x++) { | |
824 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
825 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
826 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
827 | } | ||
828 | } | ||
829 | ✗ | break; | |
830 | ✗ | case 1: | |
831 | ✗ | if (alpha && !src_alpha) { | |
832 | ✗ | for (x = 0; x < width; x++) { | |
833 | ✗ | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
834 | ✗ | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
835 | ✗ | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
836 | ✗ | *dest++ = 0xffff; | |
837 | } | ||
838 | ✗ | } else if (alpha && src_alpha) { | |
839 | ✗ | for (x = 0; x < width; x++) { | |
840 | ✗ | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
841 | ✗ | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
842 | ✗ | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
843 | ✗ | *dest++ = av_bswap16(src[3][x]) << scale_high | av_bswap16(src[3][x]) >> scale_low; | |
844 | } | ||
845 | } else { | ||
846 | ✗ | for (x = 0; x < width; x++) { | |
847 | ✗ | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
848 | ✗ | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
849 | ✗ | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
850 | } | ||
851 | } | ||
852 | ✗ | break; | |
853 | 5184 | default: | |
854 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5184 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5184 | if (alpha && !src_alpha) { |
855 | ✗ | for (x = 0; x < width; x++) { | |
856 | ✗ | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
857 | ✗ | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
858 | ✗ | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
859 | ✗ | *dest++ = 0xffff; | |
860 | } | ||
861 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5184 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5184 | } else if (alpha && src_alpha) { |
862 | ✗ | for (x = 0; x < width; x++) { | |
863 | ✗ | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
864 | ✗ | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
865 | ✗ | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
866 | ✗ | *dest++ = src[3][x] << scale_high | src[3][x] >> scale_low; | |
867 | } | ||
868 | } else { | ||
869 |
2/2✓ Branch 0 taken 2239488 times.
✓ Branch 1 taken 5184 times.
|
2244672 | for (x = 0; x < width; x++) { |
870 | 2239488 | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
871 | 2239488 | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
872 | 2239488 | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
873 | } | ||
874 | } | ||
875 | } | ||
876 |
2/2✓ Branch 0 taken 15552 times.
✓ Branch 1 taken 5184 times.
|
20736 | for (i = 0; i < 3 + src_alpha; i++) |
877 | 15552 | src[i] += srcStride[i] >> 1; | |
878 | } | ||
879 | 40 | } | |
880 | |||
881 | 40 | static int planarRgb16ToRgb16Wrapper(SwsContext *c, const uint8_t *src[], | |
882 | int srcStride[], int srcSliceY, int srcSliceH, | ||
883 | uint8_t *dst[], int dstStride[]) | ||
884 | { | ||
885 | 40 | const uint16_t *src102[] = { (uint16_t *)src[1], (uint16_t *)src[0], (uint16_t *)src[2], (uint16_t *)src[3] }; | |
886 | 40 | const uint16_t *src201[] = { (uint16_t *)src[2], (uint16_t *)src[0], (uint16_t *)src[1], (uint16_t *)src[3] }; | |
887 | 40 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] }; | |
888 | 40 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] }; | |
889 | 40 | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat); | |
890 | 40 | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat); | |
891 | 40 | int bits_per_sample = src_format->comp[0].depth; | |
892 | 40 | int swap = 0; | |
893 | 40 | if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) || | |
894 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | !HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE) |
895 | ✗ | swap++; | |
896 | 40 | if ( HAVE_BIGENDIAN && !(dst_format->flags & AV_PIX_FMT_FLAG_BE) || | |
897 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | !HAVE_BIGENDIAN && dst_format->flags & AV_PIX_FMT_FLAG_BE) |
898 | ✗ | swap += 2; | |
899 | |||
900 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if ((src_format->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) != |
901 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB) || |
902 | bits_per_sample <= 8) { | ||
903 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
904 | ✗ | src_format->name, dst_format->name); | |
905 | ✗ | return srcSliceH; | |
906 | } | ||
907 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
40 | switch (c->dstFormat) { |
908 | ✗ | case AV_PIX_FMT_BGR48LE: | |
909 | case AV_PIX_FMT_BGR48BE: | ||
910 | ✗ | gbr16ptopacked16(src102, stride102, | |
911 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
912 | srcSliceH, 0, swap, bits_per_sample, c->srcW); | ||
913 | ✗ | break; | |
914 | 40 | case AV_PIX_FMT_RGB48LE: | |
915 | case AV_PIX_FMT_RGB48BE: | ||
916 | 40 | gbr16ptopacked16(src201, stride201, | |
917 | 40 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
918 | srcSliceH, 0, swap, bits_per_sample, c->srcW); | ||
919 | 40 | break; | |
920 | ✗ | case AV_PIX_FMT_RGBA64LE: | |
921 | case AV_PIX_FMT_RGBA64BE: | ||
922 | ✗ | gbr16ptopacked16(src201, stride201, | |
923 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
924 | srcSliceH, 1, swap, bits_per_sample, c->srcW); | ||
925 | ✗ | break; | |
926 | ✗ | case AV_PIX_FMT_BGRA64LE: | |
927 | case AV_PIX_FMT_BGRA64BE: | ||
928 | ✗ | gbr16ptopacked16(src102, stride102, | |
929 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
930 | srcSliceH, 1, swap, bits_per_sample, c->srcW); | ||
931 | ✗ | break; | |
932 | ✗ | default: | |
933 | ✗ | av_log(c, AV_LOG_ERROR, | |
934 | "unsupported planar RGB conversion %s -> %s\n", | ||
935 | ✗ | src_format->name, dst_format->name); | |
936 | } | ||
937 | |||
938 | 40 | return srcSliceH; | |
939 | } | ||
940 | |||
941 | 18 | static void gbr24ptopacked24(const uint8_t *src[], int srcStride[], | |
942 | uint8_t *dst, int dstStride, int srcSliceH, | ||
943 | int width) | ||
944 | { | ||
945 | int x, h, i; | ||
946 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 18 times.
|
274 | for (h = 0; h < srcSliceH; h++) { |
947 | 256 | uint8_t *dest = dst + dstStride * h; | |
948 |
2/2✓ Branch 0 taken 32768 times.
✓ Branch 1 taken 256 times.
|
33024 | for (x = 0; x < width; x++) { |
949 | 32768 | *dest++ = src[0][x]; | |
950 | 32768 | *dest++ = src[1][x]; | |
951 | 32768 | *dest++ = src[2][x]; | |
952 | } | ||
953 | |||
954 |
2/2✓ Branch 0 taken 768 times.
✓ Branch 1 taken 256 times.
|
1024 | for (i = 0; i < 3; i++) |
955 | 768 | src[i] += srcStride[i]; | |
956 | } | ||
957 | 18 | } | |
958 | |||
959 | ✗ | static void gbr24ptopacked32(const uint8_t *src[], int srcStride[], | |
960 | uint8_t *dst, int dstStride, int srcSliceH, | ||
961 | int alpha_first, int width) | ||
962 | { | ||
963 | int x, h, i; | ||
964 | ✗ | for (h = 0; h < srcSliceH; h++) { | |
965 | ✗ | uint8_t *dest = dst + dstStride * h; | |
966 | |||
967 | ✗ | if (alpha_first) { | |
968 | ✗ | for (x = 0; x < width; x++) { | |
969 | ✗ | *dest++ = 0xff; | |
970 | ✗ | *dest++ = src[0][x]; | |
971 | ✗ | *dest++ = src[1][x]; | |
972 | ✗ | *dest++ = src[2][x]; | |
973 | } | ||
974 | } else { | ||
975 | ✗ | for (x = 0; x < width; x++) { | |
976 | ✗ | *dest++ = src[0][x]; | |
977 | ✗ | *dest++ = src[1][x]; | |
978 | ✗ | *dest++ = src[2][x]; | |
979 | ✗ | *dest++ = 0xff; | |
980 | } | ||
981 | } | ||
982 | |||
983 | ✗ | for (i = 0; i < 3; i++) | |
984 | ✗ | src[i] += srcStride[i]; | |
985 | } | ||
986 | ✗ | } | |
987 | |||
988 | 225 | static void gbraptopacked32(const uint8_t *src[], int srcStride[], | |
989 | uint8_t *dst, int dstStride, int srcSliceH, | ||
990 | int alpha_first, int width) | ||
991 | { | ||
992 | int x, h, i; | ||
993 |
2/2✓ Branch 0 taken 12000 times.
✓ Branch 1 taken 225 times.
|
12225 | for (h = 0; h < srcSliceH; h++) { |
994 | 12000 | uint8_t *dest = dst + dstStride * h; | |
995 | |||
996 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12000 times.
|
12000 | if (alpha_first) { |
997 | ✗ | for (x = 0; x < width; x++) { | |
998 | ✗ | *dest++ = src[3][x]; | |
999 | ✗ | *dest++ = src[0][x]; | |
1000 | ✗ | *dest++ = src[1][x]; | |
1001 | ✗ | *dest++ = src[2][x]; | |
1002 | } | ||
1003 | } else { | ||
1004 |
2/2✓ Branch 0 taken 8640000 times.
✓ Branch 1 taken 12000 times.
|
8652000 | for (x = 0; x < width; x++) { |
1005 | 8640000 | *dest++ = src[0][x]; | |
1006 | 8640000 | *dest++ = src[1][x]; | |
1007 | 8640000 | *dest++ = src[2][x]; | |
1008 | 8640000 | *dest++ = src[3][x]; | |
1009 | } | ||
1010 | } | ||
1011 | |||
1012 |
2/2✓ Branch 0 taken 48000 times.
✓ Branch 1 taken 12000 times.
|
60000 | for (i = 0; i < 4; i++) |
1013 | 48000 | src[i] += srcStride[i]; | |
1014 | } | ||
1015 | 225 | } | |
1016 | |||
1017 | 234 | static int planarRgbaToRgbWrapper(SwsContext *c, const uint8_t *src[], | |
1018 | int srcStride[], int srcSliceY, int srcSliceH, | ||
1019 | uint8_t *dst[], int dstStride[]) | ||
1020 | { | ||
1021 | 234 | int alpha_first = 0; | |
1022 | 234 | const uint8_t *src102[] = { src[1], src[0], src[2], src[3] }; | |
1023 | 234 | const uint8_t *src201[] = { src[2], src[0], src[1], src[3] }; | |
1024 | 234 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] }; | |
1025 | 234 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] }; | |
1026 | |||
1027 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 234 times.
|
234 | if (c->srcFormat != AV_PIX_FMT_GBRAP) { |
1028 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
1029 | av_get_pix_fmt_name(c->srcFormat), | ||
1030 | av_get_pix_fmt_name(c->dstFormat)); | ||
1031 | ✗ | return srcSliceH; | |
1032 | } | ||
1033 | |||
1034 |
2/7✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 225 times.
✗ Branch 6 not taken.
|
234 | switch (c->dstFormat) { |
1035 | ✗ | case AV_PIX_FMT_BGR24: | |
1036 | ✗ | gbr24ptopacked24(src102, stride102, | |
1037 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1038 | srcSliceH, c->srcW); | ||
1039 | ✗ | break; | |
1040 | |||
1041 | 9 | case AV_PIX_FMT_RGB24: | |
1042 | 9 | gbr24ptopacked24(src201, stride201, | |
1043 | 9 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1044 | srcSliceH, c->srcW); | ||
1045 | 9 | break; | |
1046 | |||
1047 | ✗ | case AV_PIX_FMT_ARGB: | |
1048 | ✗ | alpha_first = 1; | |
1049 | ✗ | case AV_PIX_FMT_RGBA: | |
1050 | ✗ | gbraptopacked32(src201, stride201, | |
1051 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1052 | srcSliceH, alpha_first, c->srcW); | ||
1053 | ✗ | break; | |
1054 | |||
1055 | ✗ | case AV_PIX_FMT_ABGR: | |
1056 | ✗ | alpha_first = 1; | |
1057 | 225 | case AV_PIX_FMT_BGRA: | |
1058 | 225 | gbraptopacked32(src102, stride102, | |
1059 | 225 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1060 | srcSliceH, alpha_first, c->srcW); | ||
1061 | 225 | break; | |
1062 | |||
1063 | ✗ | default: | |
1064 | ✗ | av_log(c, AV_LOG_ERROR, | |
1065 | "unsupported planar RGB conversion %s -> %s\n", | ||
1066 | av_get_pix_fmt_name(c->srcFormat), | ||
1067 | av_get_pix_fmt_name(c->dstFormat)); | ||
1068 | } | ||
1069 | |||
1070 | 234 | return srcSliceH; | |
1071 | } | ||
1072 | |||
1073 | 9 | static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[], | |
1074 | int srcStride[], int srcSliceY, int srcSliceH, | ||
1075 | uint8_t *dst[], int dstStride[]) | ||
1076 | { | ||
1077 | 9 | int alpha_first = 0; | |
1078 | 9 | const uint8_t *src102[] = { src[1], src[0], src[2] }; | |
1079 | 9 | const uint8_t *src201[] = { src[2], src[0], src[1] }; | |
1080 | 9 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2] }; | |
1081 | 9 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1] }; | |
1082 | |||
1083 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if (c->srcFormat != AV_PIX_FMT_GBRP) { |
1084 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
1085 | av_get_pix_fmt_name(c->srcFormat), | ||
1086 | av_get_pix_fmt_name(c->dstFormat)); | ||
1087 | ✗ | return srcSliceH; | |
1088 | } | ||
1089 | |||
1090 |
1/7✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
9 | switch (c->dstFormat) { |
1091 | ✗ | case AV_PIX_FMT_BGR24: | |
1092 | ✗ | gbr24ptopacked24(src102, stride102, | |
1093 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1094 | srcSliceH, c->srcW); | ||
1095 | ✗ | break; | |
1096 | |||
1097 | 9 | case AV_PIX_FMT_RGB24: | |
1098 | 9 | gbr24ptopacked24(src201, stride201, | |
1099 | 9 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1100 | srcSliceH, c->srcW); | ||
1101 | 9 | break; | |
1102 | |||
1103 | ✗ | case AV_PIX_FMT_ARGB: | |
1104 | ✗ | alpha_first = 1; | |
1105 | ✗ | case AV_PIX_FMT_RGBA: | |
1106 | ✗ | gbr24ptopacked32(src201, stride201, | |
1107 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1108 | srcSliceH, alpha_first, c->srcW); | ||
1109 | ✗ | break; | |
1110 | |||
1111 | ✗ | case AV_PIX_FMT_ABGR: | |
1112 | ✗ | alpha_first = 1; | |
1113 | ✗ | case AV_PIX_FMT_BGRA: | |
1114 | ✗ | gbr24ptopacked32(src102, stride102, | |
1115 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1116 | srcSliceH, alpha_first, c->srcW); | ||
1117 | ✗ | break; | |
1118 | |||
1119 | ✗ | default: | |
1120 | ✗ | av_log(c, AV_LOG_ERROR, | |
1121 | "unsupported planar RGB conversion %s -> %s\n", | ||
1122 | av_get_pix_fmt_name(c->srcFormat), | ||
1123 | av_get_pix_fmt_name(c->dstFormat)); | ||
1124 | } | ||
1125 | |||
1126 | 9 | return srcSliceH; | |
1127 | } | ||
1128 | |||
1129 | 45 | static int planarRgbToplanarRgbWrapper(SwsContext *c, | |
1130 | const uint8_t *src[], int srcStride[], | ||
1131 | int srcSliceY, int srcSliceH, | ||
1132 | uint8_t *dst[], int dstStride[]) | ||
1133 | { | ||
1134 | 45 | copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
1135 | dst[0], dstStride[0]); | ||
1136 | 45 | copyPlane(src[1], srcStride[1], srcSliceY, srcSliceH, c->srcW, | |
1137 | 45 | dst[1], dstStride[1]); | |
1138 | 45 | copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->srcW, | |
1139 | 45 | dst[2], dstStride[2]); | |
1140 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if (dst[3]) |
1141 | ✗ | fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
1142 | |||
1143 | 45 | return srcSliceH; | |
1144 | } | ||
1145 | |||
1146 | 199 | static void packedtogbr24p(const uint8_t *src, int srcStride, | |
1147 | uint8_t *dst[], int dstStride[], int srcSliceH, | ||
1148 | int alpha_first, int inc_size, int width) | ||
1149 | { | ||
1150 | uint8_t *dest[3]; | ||
1151 | int x, h; | ||
1152 | |||
1153 | 199 | dest[0] = dst[0]; | |
1154 | 199 | dest[1] = dst[1]; | |
1155 | 199 | dest[2] = dst[2]; | |
1156 | |||
1157 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 199 times.
|
199 | if (alpha_first) |
1158 | ✗ | src++; | |
1159 | |||
1160 |
2/2✓ Branch 0 taken 4384 times.
✓ Branch 1 taken 199 times.
|
4583 | for (h = 0; h < srcSliceH; h++) { |
1161 |
2/2✓ Branch 0 taken 1249152 times.
✓ Branch 1 taken 4384 times.
|
1253536 | for (x = 0; x < width; x++) { |
1162 | 1249152 | dest[0][x] = src[0]; | |
1163 | 1249152 | dest[1][x] = src[1]; | |
1164 | 1249152 | dest[2][x] = src[2]; | |
1165 | |||
1166 | 1249152 | src += inc_size; | |
1167 | } | ||
1168 | 4384 | src += srcStride - width * inc_size; | |
1169 | 4384 | dest[0] += dstStride[0]; | |
1170 | 4384 | dest[1] += dstStride[1]; | |
1171 | 4384 | dest[2] += dstStride[2]; | |
1172 | } | ||
1173 | 199 | } | |
1174 | |||
1175 | 199 | static int rgbToPlanarRgbWrapper(SwsContext *c, const uint8_t *src[], | |
1176 | int srcStride[], int srcSliceY, int srcSliceH, | ||
1177 | uint8_t *dst[], int dstStride[]) | ||
1178 | { | ||
1179 | 199 | int alpha_first = 0; | |
1180 | 199 | int stride102[] = { dstStride[1], dstStride[0], dstStride[2] }; | |
1181 | 199 | int stride201[] = { dstStride[2], dstStride[0], dstStride[1] }; | |
1182 | 199 | uint8_t *dst102[] = { dst[1] + srcSliceY * dstStride[1], | |
1183 | 199 | dst[0] + srcSliceY * dstStride[0], | |
1184 | 199 | dst[2] + srcSliceY * dstStride[2] }; | |
1185 | 199 | uint8_t *dst201[] = { dst[2] + srcSliceY * dstStride[2], | |
1186 | 199 | dst[0] + srcSliceY * dstStride[0], | |
1187 | 199 | dst[1] + srcSliceY * dstStride[1] }; | |
1188 | |||
1189 |
1/7✓ Branch 0 taken 199 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
199 | switch (c->srcFormat) { |
1190 | 199 | case AV_PIX_FMT_RGB24: | |
1191 | 199 | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201, | |
1192 | stride201, srcSliceH, alpha_first, 3, c->srcW); | ||
1193 | 199 | break; | |
1194 | ✗ | case AV_PIX_FMT_BGR24: | |
1195 | ✗ | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102, | |
1196 | stride102, srcSliceH, alpha_first, 3, c->srcW); | ||
1197 | ✗ | break; | |
1198 | ✗ | case AV_PIX_FMT_ARGB: | |
1199 | ✗ | alpha_first = 1; | |
1200 | ✗ | case AV_PIX_FMT_RGBA: | |
1201 | ✗ | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201, | |
1202 | stride201, srcSliceH, alpha_first, 4, c->srcW); | ||
1203 | ✗ | break; | |
1204 | ✗ | case AV_PIX_FMT_ABGR: | |
1205 | ✗ | alpha_first = 1; | |
1206 | ✗ | case AV_PIX_FMT_BGRA: | |
1207 | ✗ | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102, | |
1208 | stride102, srcSliceH, alpha_first, 4, c->srcW); | ||
1209 | ✗ | break; | |
1210 | ✗ | default: | |
1211 | ✗ | av_log(c, AV_LOG_ERROR, | |
1212 | "unsupported planar RGB conversion %s -> %s\n", | ||
1213 | av_get_pix_fmt_name(c->srcFormat), | ||
1214 | av_get_pix_fmt_name(c->dstFormat)); | ||
1215 | } | ||
1216 | |||
1217 | 199 | return srcSliceH; | |
1218 | } | ||
1219 | |||
1220 | #define BAYER_GBRG | ||
1221 | #define BAYER_8 | ||
1222 | #define BAYER_RENAME(x) bayer_gbrg8_to_##x | ||
1223 | #include "bayer_template.c" | ||
1224 | |||
1225 | #define BAYER_GBRG | ||
1226 | #define BAYER_16LE | ||
1227 | #define BAYER_RENAME(x) bayer_gbrg16le_to_##x | ||
1228 | #include "bayer_template.c" | ||
1229 | |||
1230 | #define BAYER_GBRG | ||
1231 | #define BAYER_16BE | ||
1232 | #define BAYER_RENAME(x) bayer_gbrg16be_to_##x | ||
1233 | #include "bayer_template.c" | ||
1234 | |||
1235 | #define BAYER_GRBG | ||
1236 | #define BAYER_8 | ||
1237 | #define BAYER_RENAME(x) bayer_grbg8_to_##x | ||
1238 | #include "bayer_template.c" | ||
1239 | |||
1240 | #define BAYER_GRBG | ||
1241 | #define BAYER_16LE | ||
1242 | #define BAYER_RENAME(x) bayer_grbg16le_to_##x | ||
1243 | #include "bayer_template.c" | ||
1244 | |||
1245 | #define BAYER_GRBG | ||
1246 | #define BAYER_16BE | ||
1247 | #define BAYER_RENAME(x) bayer_grbg16be_to_##x | ||
1248 | #include "bayer_template.c" | ||
1249 | |||
1250 | #define BAYER_BGGR | ||
1251 | #define BAYER_8 | ||
1252 | #define BAYER_RENAME(x) bayer_bggr8_to_##x | ||
1253 | #include "bayer_template.c" | ||
1254 | |||
1255 | #define BAYER_BGGR | ||
1256 | #define BAYER_16LE | ||
1257 | #define BAYER_RENAME(x) bayer_bggr16le_to_##x | ||
1258 | #include "bayer_template.c" | ||
1259 | |||
1260 | #define BAYER_BGGR | ||
1261 | #define BAYER_16BE | ||
1262 | #define BAYER_RENAME(x) bayer_bggr16be_to_##x | ||
1263 | #include "bayer_template.c" | ||
1264 | |||
1265 | #define BAYER_RGGB | ||
1266 | #define BAYER_8 | ||
1267 | #define BAYER_RENAME(x) bayer_rggb8_to_##x | ||
1268 | #include "bayer_template.c" | ||
1269 | |||
1270 | #define BAYER_RGGB | ||
1271 | #define BAYER_16LE | ||
1272 | #define BAYER_RENAME(x) bayer_rggb16le_to_##x | ||
1273 | #include "bayer_template.c" | ||
1274 | |||
1275 | #define BAYER_RGGB | ||
1276 | #define BAYER_16BE | ||
1277 | #define BAYER_RENAME(x) bayer_rggb16be_to_##x | ||
1278 | #include "bayer_template.c" | ||
1279 | |||
1280 | ✗ | static int bayer_to_rgb24_wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, | |
1281 | int srcSliceH, uint8_t* dst[], int dstStride[]) | ||
1282 | { | ||
1283 | ✗ | uint8_t *dstPtr= dst[0] + srcSliceY * dstStride[0]; | |
1284 | ✗ | const uint8_t *srcPtr= src[0]; | |
1285 | int i; | ||
1286 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
1287 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
1288 | |||
1289 | ✗ | switch(c->srcFormat) { | |
1290 | #define CASE(pixfmt, prefix) \ | ||
1291 | case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \ | ||
1292 | interpolate = bayer_##prefix##_to_rgb24_interpolate; \ | ||
1293 | break; | ||
1294 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
1295 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
1296 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
1297 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
1298 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
1299 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
1300 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
1301 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
1302 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
1303 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
1304 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
1305 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
1306 | #undef CASE | ||
1307 | ✗ | default: return 0; | |
1308 | } | ||
1309 | |||
1310 | ✗ | av_assert0(srcSliceH > 1); | |
1311 | |||
1312 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1313 | ✗ | srcPtr += 2 * srcStride[0]; | |
1314 | ✗ | dstPtr += 2 * dstStride[0]; | |
1315 | |||
1316 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
1317 | ✗ | interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1318 | ✗ | srcPtr += 2 * srcStride[0]; | |
1319 | ✗ | dstPtr += 2 * dstStride[0]; | |
1320 | } | ||
1321 | |||
1322 | ✗ | if (i + 1 == srcSliceH) { | |
1323 | ✗ | copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->srcW); | |
1324 | ✗ | } else if (i < srcSliceH) | |
1325 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1326 | ✗ | return srcSliceH; | |
1327 | } | ||
1328 | |||
1329 | ✗ | static int bayer_to_rgb48_wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, | |
1330 | int srcSliceH, uint8_t* dst[], int dstStride[]) | ||
1331 | { | ||
1332 | ✗ | uint8_t *dstPtr= dst[0] + srcSliceY * dstStride[0]; | |
1333 | ✗ | const uint8_t *srcPtr= src[0]; | |
1334 | int i; | ||
1335 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
1336 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
1337 | |||
1338 | ✗ | switch(c->srcFormat) { | |
1339 | #define CASE(pixfmt, prefix) \ | ||
1340 | case pixfmt: copy = bayer_##prefix##_to_rgb48_copy; \ | ||
1341 | interpolate = bayer_##prefix##_to_rgb48_interpolate; \ | ||
1342 | break; | ||
1343 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
1344 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
1345 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
1346 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
1347 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
1348 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
1349 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
1350 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
1351 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
1352 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
1353 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
1354 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
1355 | #undef CASE | ||
1356 | ✗ | default: return 0; | |
1357 | } | ||
1358 | |||
1359 | ✗ | av_assert0(srcSliceH > 1); | |
1360 | |||
1361 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1362 | ✗ | srcPtr += 2 * srcStride[0]; | |
1363 | ✗ | dstPtr += 2 * dstStride[0]; | |
1364 | |||
1365 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
1366 | ✗ | interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1367 | ✗ | srcPtr += 2 * srcStride[0]; | |
1368 | ✗ | dstPtr += 2 * dstStride[0]; | |
1369 | } | ||
1370 | |||
1371 | ✗ | if (i + 1 == srcSliceH) { | |
1372 | ✗ | copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->srcW); | |
1373 | ✗ | } else if (i < srcSliceH) | |
1374 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1375 | ✗ | return srcSliceH; | |
1376 | } | ||
1377 | |||
1378 | ✗ | static int bayer_to_yv12_wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, | |
1379 | int srcSliceH, uint8_t* dst[], int dstStride[]) | ||
1380 | { | ||
1381 | ✗ | const uint8_t *srcPtr= src[0]; | |
1382 | ✗ | uint8_t *dstY= dst[0] + srcSliceY * dstStride[0]; | |
1383 | ✗ | uint8_t *dstU= dst[1] + srcSliceY * dstStride[1] / 2; | |
1384 | ✗ | uint8_t *dstV= dst[2] + srcSliceY * dstStride[2] / 2; | |
1385 | int i; | ||
1386 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dstY, uint8_t *dstU, uint8_t *dstV, int luma_stride, int width, int32_t *rgb2yuv); | ||
1387 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dstY, uint8_t *dstU, uint8_t *dstV, int luma_stride, int width, int32_t *rgb2yuv); | ||
1388 | |||
1389 | ✗ | switch(c->srcFormat) { | |
1390 | #define CASE(pixfmt, prefix) \ | ||
1391 | case pixfmt: copy = bayer_##prefix##_to_yv12_copy; \ | ||
1392 | interpolate = bayer_##prefix##_to_yv12_interpolate; \ | ||
1393 | break; | ||
1394 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
1395 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
1396 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
1397 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
1398 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
1399 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
1400 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
1401 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
1402 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
1403 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
1404 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
1405 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
1406 | #undef CASE | ||
1407 | ✗ | default: return 0; | |
1408 | } | ||
1409 | |||
1410 | ✗ | av_assert0(srcSliceH > 1); | |
1411 | |||
1412 | ✗ | copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table); | |
1413 | ✗ | srcPtr += 2 * srcStride[0]; | |
1414 | ✗ | dstY += 2 * dstStride[0]; | |
1415 | ✗ | dstU += dstStride[1]; | |
1416 | ✗ | dstV += dstStride[1]; | |
1417 | |||
1418 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
1419 | ✗ | interpolate(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table); | |
1420 | ✗ | srcPtr += 2 * srcStride[0]; | |
1421 | ✗ | dstY += 2 * dstStride[0]; | |
1422 | ✗ | dstU += dstStride[1]; | |
1423 | ✗ | dstV += dstStride[1]; | |
1424 | } | ||
1425 | |||
1426 | ✗ | if (i + 1 == srcSliceH) { | |
1427 | ✗ | copy(srcPtr, -srcStride[0], dstY, dstU, dstV, -dstStride[0], c->srcW, c->input_rgb2yuv_table); | |
1428 | ✗ | } else if (i < srcSliceH) | |
1429 | ✗ | copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table); | |
1430 | ✗ | return srcSliceH; | |
1431 | } | ||
1432 | |||
1433 | #define isRGBA32(x) ( \ | ||
1434 | (x) == AV_PIX_FMT_ARGB \ | ||
1435 | || (x) == AV_PIX_FMT_RGBA \ | ||
1436 | || (x) == AV_PIX_FMT_BGRA \ | ||
1437 | || (x) == AV_PIX_FMT_ABGR \ | ||
1438 | ) | ||
1439 | |||
1440 | #define isRGBA64(x) ( \ | ||
1441 | (x) == AV_PIX_FMT_RGBA64LE \ | ||
1442 | || (x) == AV_PIX_FMT_RGBA64BE \ | ||
1443 | || (x) == AV_PIX_FMT_BGRA64LE \ | ||
1444 | || (x) == AV_PIX_FMT_BGRA64BE \ | ||
1445 | ) | ||
1446 | |||
1447 | #define isRGB48(x) ( \ | ||
1448 | (x) == AV_PIX_FMT_RGB48LE \ | ||
1449 | || (x) == AV_PIX_FMT_RGB48BE \ | ||
1450 | || (x) == AV_PIX_FMT_BGR48LE \ | ||
1451 | || (x) == AV_PIX_FMT_BGR48BE \ | ||
1452 | ) | ||
1453 | |||
1454 | /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ | ||
1455 | typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int); | ||
1456 | 17586 | static rgbConvFn findRgbConvFn(SwsContext *c) | |
1457 | { | ||
1458 | 17586 | const enum AVPixelFormat srcFormat = c->srcFormat; | |
1459 | 17586 | const enum AVPixelFormat dstFormat = c->dstFormat; | |
1460 | 17586 | const int srcId = c->srcFormatBpp; | |
1461 | 17586 | const int dstId = c->dstFormatBpp; | |
1462 | 17586 | rgbConvFn conv = NULL; | |
1463 | |||
1464 | #define IS_NOT_NE(bpp, desc) \ | ||
1465 | (((bpp + 7) >> 3) == 2 && \ | ||
1466 | (!(desc->flags & AV_PIX_FMT_FLAG_BE) != !HAVE_BIGENDIAN)) | ||
1467 | |||
1468 | #define CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst) | ||
1469 | |||
1470 |
13/16✓ Branch 0 taken 17323 times.
✓ Branch 1 taken 263 times.
✓ Branch 2 taken 17019 times.
✓ Branch 3 taken 304 times.
✓ Branch 4 taken 12675 times.
✓ Branch 5 taken 4344 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 12673 times.
✓ Branch 8 taken 4913 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4913 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4422 times.
✓ Branch 13 taken 491 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4422 times.
|
17586 | if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) { |
1471 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 491 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
491 | if ( CONV_IS(ABGR, RGBA) |
1472 |
3/4✓ Branch 0 taken 243 times.
✓ Branch 1 taken 248 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 243 times.
|
491 | || CONV_IS(ARGB, BGRA) |
1473 |
3/4✓ Branch 0 taken 36 times.
✓ Branch 1 taken 212 times.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
|
248 | || CONV_IS(BGRA, ARGB) |
1474 |
3/4✓ Branch 0 taken 212 times.
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 212 times.
|
491 | || CONV_IS(RGBA, ABGR)) conv = shuffle_bytes_3210; |
1475 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 248 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
248 | else if (CONV_IS(ABGR, ARGB) |
1476 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 248 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
248 | || CONV_IS(ARGB, ABGR)) conv = shuffle_bytes_0321; |
1477 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 248 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
248 | else if (CONV_IS(ABGR, BGRA) |
1478 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 248 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
248 | || CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230; |
1479 |
3/4✓ Branch 0 taken 36 times.
✓ Branch 1 taken 212 times.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
|
248 | else if (CONV_IS(BGRA, RGBA) |
1480 |
3/4✓ Branch 0 taken 212 times.
✓ Branch 1 taken 36 times.
✓ Branch 2 taken 212 times.
✗ Branch 3 not taken.
|
248 | || CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103; |
1481 |
2/4✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
✗ Branch 3 not taken.
|
36 | else if (CONV_IS(BGRA, ABGR) |
1482 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
36 | || CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012; |
1483 |
12/16✓ Branch 0 taken 17093 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 17083 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 17082 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 17082 times.
✓ Branch 8 taken 13 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 12 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 12 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 12 times.
|
17095 | } else if (isRGB48(srcFormat) && isRGB48(dstFormat)) { |
1484 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | if (CONV_IS(RGB48LE, BGR48LE) |
1485 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | || CONV_IS(BGR48LE, RGB48LE) |
1486 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | || CONV_IS(RGB48BE, BGR48BE) |
1487 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | || CONV_IS(BGR48BE, RGB48BE)) conv = rgb48tobgr48_nobswap; |
1488 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | else if (CONV_IS(RGB48LE, BGR48BE) |
1489 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | || CONV_IS(BGR48LE, RGB48BE) |
1490 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | || CONV_IS(RGB48BE, BGR48LE) |
1491 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | || CONV_IS(BGR48BE, RGB48LE)) conv = rgb48tobgr48_bswap; |
1492 |
11/16✓ Branch 0 taken 17093 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 17083 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 17082 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 17082 times.
✓ Branch 8 taken 12 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 12 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 12 times.
|
17094 | } else if (isRGB48(srcFormat) && isRGBA64(dstFormat)) { |
1493 | ✗ | if (CONV_IS(RGB48LE, BGRA64LE) | |
1494 | ✗ | || CONV_IS(BGR48LE, RGBA64LE) | |
1495 | ✗ | || CONV_IS(RGB48BE, BGRA64BE) | |
1496 | ✗ | || CONV_IS(BGR48BE, RGBA64BE)) conv = rgb48tobgr64_nobswap; | |
1497 | ✗ | else if (CONV_IS(RGB48LE, BGRA64BE) | |
1498 | ✗ | || CONV_IS(BGR48LE, RGBA64BE) | |
1499 | ✗ | || CONV_IS(RGB48BE, BGRA64LE) | |
1500 | ✗ | || CONV_IS(BGR48BE, RGBA64LE)) conv = rgb48tobgr64_bswap; | |
1501 | ✗ | if (CONV_IS(RGB48LE, RGBA64LE) | |
1502 | ✗ | || CONV_IS(BGR48LE, BGRA64LE) | |
1503 | ✗ | || CONV_IS(RGB48BE, RGBA64BE) | |
1504 | ✗ | || CONV_IS(BGR48BE, BGRA64BE)) conv = rgb48to64_nobswap; | |
1505 | ✗ | else if (CONV_IS(RGB48LE, RGBA64BE) | |
1506 | ✗ | || CONV_IS(BGR48LE, BGRA64BE) | |
1507 | ✗ | || CONV_IS(RGB48BE, RGBA64LE) | |
1508 | ✗ | || CONV_IS(BGR48BE, BGRA64LE)) conv = rgb48to64_bswap; | |
1509 |
11/16✓ Branch 0 taken 17093 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 17083 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 17082 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 17082 times.
✓ Branch 8 taken 12 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 12 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 12 times.
|
17094 | } else if (isRGBA64(srcFormat) && isRGB48(dstFormat)) { |
1510 | ✗ | if (CONV_IS(RGBA64LE, BGR48LE) | |
1511 | ✗ | || CONV_IS(BGRA64LE, RGB48LE) | |
1512 | ✗ | || CONV_IS(RGBA64BE, BGR48BE) | |
1513 | ✗ | || CONV_IS(BGRA64BE, RGB48BE)) conv = rgb64tobgr48_nobswap; | |
1514 | ✗ | else if (CONV_IS(RGBA64LE, BGR48BE) | |
1515 | ✗ | || CONV_IS(BGRA64LE, RGB48BE) | |
1516 | ✗ | || CONV_IS(RGBA64BE, BGR48LE) | |
1517 | ✗ | || CONV_IS(BGRA64BE, RGB48LE)) conv = rgb64tobgr48_bswap; | |
1518 | ✗ | else if (CONV_IS(RGBA64LE, RGB48LE) | |
1519 | ✗ | || CONV_IS(BGRA64LE, BGR48LE) | |
1520 | ✗ | || CONV_IS(RGBA64BE, RGB48BE) | |
1521 | ✗ | || CONV_IS(BGRA64BE, BGR48BE)) conv = rgb64to48_nobswap; | |
1522 | ✗ | else if (CONV_IS(RGBA64LE, RGB48BE) | |
1523 | ✗ | || CONV_IS(BGRA64LE, BGR48BE) | |
1524 | ✗ | || CONV_IS(RGBA64BE, RGB48LE) | |
1525 | ✗ | || CONV_IS(BGRA64BE, BGR48LE)) conv = rgb64to48_bswap; | |
1526 | } else | ||
1527 | /* BGR -> BGR */ | ||
1528 |
5/6✓ Branch 1 taken 2046 times.
✓ Branch 2 taken 15048 times.
✓ Branch 4 taken 2046 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 14927 times.
✓ Branch 7 taken 2167 times.
|
34188 | if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) || |
1529 |
2/2✓ Branch 2 taken 14799 times.
✓ Branch 3 taken 128 times.
|
32021 | (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) { |
1530 |
5/14✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 8640 times.
✓ Branch 8 taken 1737 times.
✓ Branch 9 taken 4257 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 144 times.
✓ Branch 13 taken 21 times.
|
14799 | switch (srcId | (dstId << 16)) { |
1531 | ✗ | case 0x000F000C: conv = rgb12to15; break; | |
1532 | ✗ | case 0x000F0010: conv = rgb16to15; break; | |
1533 | ✗ | case 0x000F0018: conv = rgb24to15; break; | |
1534 | ✗ | case 0x000F0020: conv = rgb32to15; break; | |
1535 | ✗ | case 0x0010000F: conv = rgb15to16; break; | |
1536 | ✗ | case 0x00100018: conv = rgb24to16; break; | |
1537 | ✗ | case 0x00100020: conv = rgb32to16; break; | |
1538 | 8640 | case 0x0018000F: conv = rgb15to24; break; | |
1539 | 1737 | case 0x00180010: conv = rgb16to24; break; | |
1540 | 4257 | case 0x00180020: conv = rgb32to24; break; | |
1541 | ✗ | case 0x0020000F: conv = rgb15to32; break; | |
1542 | ✗ | case 0x00200010: conv = rgb16to32; break; | |
1543 | 144 | case 0x00200018: conv = rgb24to32; break; | |
1544 | } | ||
1545 |
6/6✓ Branch 1 taken 2046 times.
✓ Branch 2 taken 249 times.
✓ Branch 4 taken 79 times.
✓ Branch 5 taken 1967 times.
✓ Branch 6 taken 128 times.
✓ Branch 7 taken 200 times.
|
2623 | } else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) || |
1546 |
2/2✓ Branch 2 taken 55 times.
✓ Branch 3 taken 73 times.
|
456 | (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) { |
1547 |
5/17✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1593 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 338 times.
✓ Branch 12 taken 70 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 18 times.
✓ Branch 16 taken 3 times.
|
2022 | switch (srcId | (dstId << 16)) { |
1548 | ✗ | case 0x000C000C: conv = rgb12tobgr12; break; | |
1549 | ✗ | case 0x000F000F: conv = rgb15tobgr15; break; | |
1550 | ✗ | case 0x000F0010: conv = rgb16tobgr15; break; | |
1551 | ✗ | case 0x000F0018: conv = rgb24tobgr15; break; | |
1552 | ✗ | case 0x000F0020: conv = rgb32tobgr15; break; | |
1553 | ✗ | case 0x0010000F: conv = rgb15tobgr16; break; | |
1554 | ✗ | case 0x00100010: conv = rgb16tobgr16; break; | |
1555 | ✗ | case 0x00100018: conv = rgb24tobgr16; break; | |
1556 | ✗ | case 0x00100020: conv = rgb32tobgr16; break; | |
1557 | 1593 | case 0x0018000F: conv = rgb15tobgr24; break; | |
1558 | ✗ | case 0x00180010: conv = rgb16tobgr24; break; | |
1559 | 338 | case 0x00180018: conv = rgb24tobgr24; break; | |
1560 | 70 | case 0x00180020: conv = rgb32tobgr24; break; | |
1561 | ✗ | case 0x0020000F: conv = rgb15tobgr32; break; | |
1562 | ✗ | case 0x00200010: conv = rgb16tobgr32; break; | |
1563 | 18 | case 0x00200018: conv = rgb24tobgr32; break; | |
1564 | } | ||
1565 | } | ||
1566 | |||
1567 | if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) && !isRGBA32(srcFormat) && ALT32_CORR<0) | ||
1568 | return NULL; | ||
1569 | |||
1570 | // Maintain symmetry between endianness | ||
1571 |
2/2✓ Branch 0 taken 118 times.
✓ Branch 1 taken 17468 times.
|
17586 | if (c->flags & SWS_BITEXACT) |
1572 |
2/12✓ Branch 0 taken 118 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 118 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
118 | if ((dstFormat == AV_PIX_FMT_RGB32 || dstFormat == AV_PIX_FMT_BGR32 ) && !isRGBA32(srcFormat) && ALT32_CORR>0) |
1573 | ✗ | return NULL; | |
1574 | |||
1575 | 17586 | return conv; | |
1576 | } | ||
1577 | |||
1578 | /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ | ||
1579 | 16811 | static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], | |
1580 | int srcSliceY, int srcSliceH, uint8_t *dst[], | ||
1581 | int dstStride[]) | ||
1582 | |||
1583 | { | ||
1584 | 16811 | const enum AVPixelFormat srcFormat = c->srcFormat; | |
1585 | 16811 | const enum AVPixelFormat dstFormat = c->dstFormat; | |
1586 | 16811 | const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat); | |
1587 | 16811 | const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat); | |
1588 | 16811 | const int srcBpp = (c->srcFormatBpp + 7) >> 3; | |
1589 | 16811 | const int dstBpp = (c->dstFormatBpp + 7) >> 3; | |
1590 | 16811 | rgbConvFn conv = findRgbConvFn(c); | |
1591 | |||
1592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16811 times.
|
16811 | if (!conv) { |
1593 | ✗ | av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", | |
1594 | av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); | ||
1595 | } else { | ||
1596 | 16811 | const uint8_t *srcPtr = src[0]; | |
1597 | 16811 | uint8_t *dstPtr = dst[0]; | |
1598 |
3/4✓ Branch 0 taken 11835 times.
✓ Branch 1 taken 4976 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 11835 times.
|
16811 | int src_bswap = IS_NOT_NE(c->srcFormatBpp, desc_src); |
1599 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 16811 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
16811 | int dst_bswap = IS_NOT_NE(c->dstFormatBpp, desc_dst); |
1600 | |||
1601 |
4/6✓ Branch 0 taken 16811 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✓ Branch 3 taken 16568 times.
✓ Branch 4 taken 243 times.
✗ Branch 5 not taken.
|
16811 | if ((srcFormat == AV_PIX_FMT_RGB32_1 || srcFormat == AV_PIX_FMT_BGR32_1) && |
1602 |
4/6✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 234 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
243 | !isRGBA32(dstFormat)) |
1603 | 9 | srcPtr += ALT32_CORR; | |
1604 | |||
1605 |
4/6✓ Branch 0 taken 16811 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 16802 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
16811 | if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) && |
1606 |
3/6✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | !isRGBA32(srcFormat)) { |
1607 | int i; | ||
1608 | av_assert0(ALT32_CORR == 1); | ||
1609 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 9 times.
|
265 | for (i = 0; i < srcSliceH; i++) |
1610 | 256 | dstPtr[dstStride[0] * (srcSliceY + i)] = 255; | |
1611 | 9 | dstPtr += ALT32_CORR; | |
1612 | } | ||
1613 | |||
1614 |
3/4✓ Branch 0 taken 11982 times.
✓ Branch 1 taken 4829 times.
✓ Branch 2 taken 11982 times.
✗ Branch 3 not taken.
|
16811 | if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 && |
1615 |
3/6✓ Branch 0 taken 11982 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11982 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11982 times.
✗ Branch 5 not taken.
|
11982 | !(srcStride[0] % srcBpp) && !dst_bswap && !src_bswap) |
1616 | 11982 | conv(srcPtr, dstPtr + dstStride[0] * srcSliceY, | |
1617 | 11982 | (srcSliceH - 1) * srcStride[0] + c->srcW * srcBpp); | |
1618 | else { | ||
1619 | int i, j; | ||
1620 | 4829 | dstPtr += dstStride[0] * srcSliceY; | |
1621 | |||
1622 |
2/2✓ Branch 0 taken 183137 times.
✓ Branch 1 taken 4829 times.
|
187966 | for (i = 0; i < srcSliceH; i++) { |
1623 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 183137 times.
|
183137 | if(src_bswap) { |
1624 | ✗ | for(j=0; j<c->srcW; j++) | |
1625 | ✗ | ((uint16_t*)c->formatConvBuffer)[j] = av_bswap16(((uint16_t*)srcPtr)[j]); | |
1626 | ✗ | conv(c->formatConvBuffer, dstPtr, c->srcW * srcBpp); | |
1627 | }else | ||
1628 | 183137 | conv(srcPtr, dstPtr, c->srcW * srcBpp); | |
1629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 183137 times.
|
183137 | if(dst_bswap) |
1630 | ✗ | for(j=0; j<c->srcW; j++) | |
1631 | ✗ | ((uint16_t*)dstPtr)[j] = av_bswap16(((uint16_t*)dstPtr)[j]); | |
1632 | 183137 | srcPtr += srcStride[0]; | |
1633 | 183137 | dstPtr += dstStride[0]; | |
1634 | } | ||
1635 | } | ||
1636 | } | ||
1637 | 16811 | return srcSliceH; | |
1638 | } | ||
1639 | |||
1640 | ✗ | static int bgr24ToYv12Wrapper(SwsContext *c, const uint8_t *src[], | |
1641 | int srcStride[], int srcSliceY, int srcSliceH, | ||
1642 | uint8_t *dst[], int dstStride[]) | ||
1643 | { | ||
1644 | ✗ | ff_rgb24toyv12( | |
1645 | src[0], | ||
1646 | ✗ | dst[0] + srcSliceY * dstStride[0], | |
1647 | ✗ | dst[1] + (srcSliceY >> 1) * dstStride[1], | |
1648 | ✗ | dst[2] + (srcSliceY >> 1) * dstStride[2], | |
1649 | c->srcW, srcSliceH, | ||
1650 | ✗ | dstStride[0], dstStride[1], srcStride[0], | |
1651 | ✗ | c->input_rgb2yuv_table); | |
1652 | ✗ | if (dst[3]) | |
1653 | ✗ | fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
1654 | ✗ | return srcSliceH; | |
1655 | } | ||
1656 | |||
1657 | ✗ | static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t *src[], | |
1658 | int srcStride[], int srcSliceY, int srcSliceH, | ||
1659 | uint8_t *dst[], int dstStride[]) | ||
1660 | { | ||
1661 | ✗ | copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
1662 | dst[0], dstStride[0]); | ||
1663 | |||
1664 | ✗ | planar2x(src[1], dst[1] + dstStride[1] * (srcSliceY >> 1), c->chrSrcW, | |
1665 | ✗ | srcSliceH >> 2, srcStride[1], dstStride[1]); | |
1666 | ✗ | planar2x(src[2], dst[2] + dstStride[2] * (srcSliceY >> 1), c->chrSrcW, | |
1667 | ✗ | srcSliceH >> 2, srcStride[2], dstStride[2]); | |
1668 | ✗ | if (dst[3]) | |
1669 | ✗ | fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
1670 | ✗ | return srcSliceH; | |
1671 | } | ||
1672 | |||
1673 | ✗ | static int uint_y_to_float_y_wrapper(SwsContext *c, const uint8_t *src[], | |
1674 | int srcStride[], int srcSliceY, | ||
1675 | int srcSliceH, uint8_t *dst[], int dstStride[]) | ||
1676 | { | ||
1677 | int y, x; | ||
1678 | ✗ | ptrdiff_t dstStrideFloat = dstStride[0] >> 2; | |
1679 | ✗ | const uint8_t *srcPtr = src[0]; | |
1680 | ✗ | float *dstPtr = (float *)(dst[0] + dstStride[0] * srcSliceY); | |
1681 | |||
1682 | ✗ | for (y = 0; y < srcSliceH; ++y){ | |
1683 | ✗ | for (x = 0; x < c->srcW; ++x){ | |
1684 | ✗ | dstPtr[x] = c->uint2float_lut[srcPtr[x]]; | |
1685 | } | ||
1686 | ✗ | srcPtr += srcStride[0]; | |
1687 | ✗ | dstPtr += dstStrideFloat; | |
1688 | } | ||
1689 | |||
1690 | ✗ | return srcSliceH; | |
1691 | } | ||
1692 | |||
1693 | ✗ | static int float_y_to_uint_y_wrapper(SwsContext *c, const uint8_t* src[], | |
1694 | int srcStride[], int srcSliceY, | ||
1695 | int srcSliceH, uint8_t* dst[], int dstStride[]) | ||
1696 | { | ||
1697 | int y, x; | ||
1698 | ✗ | ptrdiff_t srcStrideFloat = srcStride[0] >> 2; | |
1699 | ✗ | const float *srcPtr = (const float *)src[0]; | |
1700 | ✗ | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
1701 | |||
1702 | ✗ | for (y = 0; y < srcSliceH; ++y){ | |
1703 | ✗ | for (x = 0; x < c->srcW; ++x){ | |
1704 | ✗ | dstPtr[x] = av_clip_uint8(lrintf(255.0f * srcPtr[x])); | |
1705 | } | ||
1706 | ✗ | srcPtr += srcStrideFloat; | |
1707 | ✗ | dstPtr += dstStride[0]; | |
1708 | } | ||
1709 | |||
1710 | ✗ | return srcSliceH; | |
1711 | } | ||
1712 | |||
1713 | /* unscaled copy like stuff (assumes nearly identical formats) */ | ||
1714 | 2547 | static int packedCopyWrapper(SwsContext *c, const uint8_t *src[], | |
1715 | int srcStride[], int srcSliceY, int srcSliceH, | ||
1716 | uint8_t *dst[], int dstStride[]) | ||
1717 | { | ||
1718 |
2/4✓ Branch 0 taken 2547 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2547 times.
✗ Branch 3 not taken.
|
2547 | if (dstStride[0] == srcStride[0] && srcStride[0] > 0) |
1719 | 2547 | memcpy(dst[0] + dstStride[0] * srcSliceY, src[0], srcSliceH * dstStride[0]); | |
1720 | else { | ||
1721 | int i; | ||
1722 | ✗ | const uint8_t *srcPtr = src[0]; | |
1723 | ✗ | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
1724 | ✗ | int length = 0; | |
1725 | |||
1726 | /* universal length finder */ | ||
1727 | ✗ | while (length + c->srcW <= FFABS(dstStride[0]) && | |
1728 | ✗ | length + c->srcW <= FFABS(srcStride[0])) | |
1729 | ✗ | length += c->srcW; | |
1730 | av_assert1(length != 0); | ||
1731 | |||
1732 | ✗ | for (i = 0; i < srcSliceH; i++) { | |
1733 | ✗ | memcpy(dstPtr, srcPtr, length); | |
1734 | ✗ | srcPtr += srcStride[0]; | |
1735 | ✗ | dstPtr += dstStride[0]; | |
1736 | } | ||
1737 | } | ||
1738 | 2547 | return srcSliceH; | |
1739 | } | ||
1740 | |||
1741 | #define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)\ | ||
1742 | unsigned shift= src_depth-dst_depth, tmp;\ | ||
1743 | if (c->dither == SWS_DITHER_NONE) {\ | ||
1744 | for (i = 0; i < height; i++) {\ | ||
1745 | for (j = 0; j < length-7; j+=8) {\ | ||
1746 | dst[j+0] = dbswap(bswap(src[j+0])>>shift);\ | ||
1747 | dst[j+1] = dbswap(bswap(src[j+1])>>shift);\ | ||
1748 | dst[j+2] = dbswap(bswap(src[j+2])>>shift);\ | ||
1749 | dst[j+3] = dbswap(bswap(src[j+3])>>shift);\ | ||
1750 | dst[j+4] = dbswap(bswap(src[j+4])>>shift);\ | ||
1751 | dst[j+5] = dbswap(bswap(src[j+5])>>shift);\ | ||
1752 | dst[j+6] = dbswap(bswap(src[j+6])>>shift);\ | ||
1753 | dst[j+7] = dbswap(bswap(src[j+7])>>shift);\ | ||
1754 | }\ | ||
1755 | for (; j < length; j++) {\ | ||
1756 | dst[j] = dbswap(bswap(src[j])>>shift);\ | ||
1757 | }\ | ||
1758 | dst += dstStride;\ | ||
1759 | src += srcStride;\ | ||
1760 | }\ | ||
1761 | } else if (shiftonly) {\ | ||
1762 | for (i = 0; i < height; i++) {\ | ||
1763 | const uint8_t *dither= dithers[shift-1][i&7];\ | ||
1764 | for (j = 0; j < length-7; j+=8) {\ | ||
1765 | tmp = (bswap(src[j+0]) + dither[0])>>shift; dst[j+0] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1766 | tmp = (bswap(src[j+1]) + dither[1])>>shift; dst[j+1] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1767 | tmp = (bswap(src[j+2]) + dither[2])>>shift; dst[j+2] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1768 | tmp = (bswap(src[j+3]) + dither[3])>>shift; dst[j+3] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1769 | tmp = (bswap(src[j+4]) + dither[4])>>shift; dst[j+4] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1770 | tmp = (bswap(src[j+5]) + dither[5])>>shift; dst[j+5] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1771 | tmp = (bswap(src[j+6]) + dither[6])>>shift; dst[j+6] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1772 | tmp = (bswap(src[j+7]) + dither[7])>>shift; dst[j+7] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1773 | }\ | ||
1774 | for (; j < length; j++) {\ | ||
1775 | tmp = (bswap(src[j]) + dither[j&7])>>shift; dst[j] = dbswap(tmp - (tmp>>dst_depth));\ | ||
1776 | }\ | ||
1777 | dst += dstStride;\ | ||
1778 | src += srcStride;\ | ||
1779 | }\ | ||
1780 | } else {\ | ||
1781 | for (i = 0; i < height; i++) {\ | ||
1782 | const uint8_t *dither= dithers[shift-1][i&7];\ | ||
1783 | for (j = 0; j < length-7; j+=8) {\ | ||
1784 | tmp = bswap(src[j+0]); dst[j+0] = dbswap((tmp - (tmp>>dst_depth) + dither[0])>>shift);\ | ||
1785 | tmp = bswap(src[j+1]); dst[j+1] = dbswap((tmp - (tmp>>dst_depth) + dither[1])>>shift);\ | ||
1786 | tmp = bswap(src[j+2]); dst[j+2] = dbswap((tmp - (tmp>>dst_depth) + dither[2])>>shift);\ | ||
1787 | tmp = bswap(src[j+3]); dst[j+3] = dbswap((tmp - (tmp>>dst_depth) + dither[3])>>shift);\ | ||
1788 | tmp = bswap(src[j+4]); dst[j+4] = dbswap((tmp - (tmp>>dst_depth) + dither[4])>>shift);\ | ||
1789 | tmp = bswap(src[j+5]); dst[j+5] = dbswap((tmp - (tmp>>dst_depth) + dither[5])>>shift);\ | ||
1790 | tmp = bswap(src[j+6]); dst[j+6] = dbswap((tmp - (tmp>>dst_depth) + dither[6])>>shift);\ | ||
1791 | tmp = bswap(src[j+7]); dst[j+7] = dbswap((tmp - (tmp>>dst_depth) + dither[7])>>shift);\ | ||
1792 | }\ | ||
1793 | for (; j < length; j++) {\ | ||
1794 | tmp = bswap(src[j]); dst[j] = dbswap((tmp - (tmp>>dst_depth) + dither[j&7])>>shift);\ | ||
1795 | }\ | ||
1796 | dst += dstStride;\ | ||
1797 | src += srcStride;\ | ||
1798 | }\ | ||
1799 | } | ||
1800 | |||
1801 | 2530 | static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], | |
1802 | int srcStride[], int srcSliceY, int srcSliceH, | ||
1803 | uint8_t *dst[], int dstStride[]) | ||
1804 | { | ||
1805 | 2530 | const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat); | |
1806 | 2530 | const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat); | |
1807 | int plane, i, j; | ||
1808 |
4/4✓ Branch 0 taken 9998 times.
✓ Branch 1 taken 632 times.
✓ Branch 2 taken 8100 times.
✓ Branch 3 taken 1898 times.
|
10630 | for (plane = 0; plane < 4 && dst[plane] != NULL; plane++) { |
1809 |
4/4✓ Branch 0 taken 5570 times.
✓ Branch 1 taken 2530 times.
✓ Branch 2 taken 632 times.
✓ Branch 3 taken 4938 times.
|
8100 | int length = (plane == 0 || plane == 3) ? c->srcW : AV_CEIL_RSHIFT(c->srcW, c->chrDstHSubSample); |
1810 |
4/4✓ Branch 0 taken 5570 times.
✓ Branch 1 taken 2530 times.
✓ Branch 2 taken 4938 times.
✓ Branch 3 taken 632 times.
|
8100 | int y = (plane == 0 || plane == 3) ? srcSliceY: AV_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample); |
1811 |
4/4✓ Branch 0 taken 5570 times.
✓ Branch 1 taken 2530 times.
✓ Branch 2 taken 4938 times.
✓ Branch 3 taken 632 times.
|
8100 | int height = (plane == 0 || plane == 3) ? srcSliceH: AV_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample); |
1812 | 8100 | const uint8_t *srcPtr = src[plane]; | |
1813 | 8100 | uint8_t *dstPtr = dst[plane] + dstStride[plane] * y; | |
1814 |
8/8✓ Branch 0 taken 5631 times.
✓ Branch 1 taken 2469 times.
✓ Branch 2 taken 3162 times.
✓ Branch 3 taken 2469 times.
✓ Branch 4 taken 3114 times.
✓ Branch 5 taken 48 times.
✓ Branch 6 taken 2482 times.
✓ Branch 7 taken 632 times.
|
8100 | int shiftonly = plane == 1 || plane == 2 || (!c->srcRange && plane == 0); |
1815 | |||
1816 | // ignore palette for GRAY8 | ||
1817 |
3/4✓ Branch 0 taken 2469 times.
✓ Branch 1 taken 5631 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2469 times.
|
8100 | if (plane == 1 && !dst[2]) continue; |
1818 |
5/6✓ Branch 0 taken 7468 times.
✓ Branch 1 taken 632 times.
✓ Branch 2 taken 2469 times.
✓ Branch 3 taken 4999 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2469 times.
|
8100 | if (!src[plane] || (plane == 1 && !src[2])) { |
1819 |
4/4✓ Branch 1 taken 599 times.
✓ Branch 2 taken 33 times.
✓ Branch 4 taken 123 times.
✓ Branch 5 taken 476 times.
|
1264 | if (is16BPS(c->dstFormat) || isNBPS(c->dstFormat)) { |
1820 | 156 | fillPlane16(dst[plane], dstStride[plane], length, height, y, | |
1821 | 156 | plane == 3, desc_dst->comp[plane].depth, | |
1822 | isBE(c->dstFormat)); | ||
1823 | } else { | ||
1824 |
1/2✓ Branch 0 taken 476 times.
✗ Branch 1 not taken.
|
476 | fillPlane(dst[plane], dstStride[plane], length, height, y, |
1825 | (plane == 3) ? 255 : 128); | ||
1826 | } | ||
1827 | } else { | ||
1828 |
4/4✓ Branch 1 taken 6328 times.
✓ Branch 2 taken 1140 times.
✓ Branch 4 taken 2578 times.
✓ Branch 5 taken 3750 times.
|
7468 | if(isNBPS(c->srcFormat) || isNBPS(c->dstFormat) |
1829 |
2/2✓ Branch 2 taken 1035 times.
✓ Branch 3 taken 1543 times.
|
2578 | || (is16BPS(c->srcFormat) != is16BPS(c->dstFormat)) |
1830 | 5925 | ) { | |
1831 | 5925 | const int src_depth = desc_src->comp[plane].depth; | |
1832 | 5925 | const int dst_depth = desc_dst->comp[plane].depth; | |
1833 | 5925 | const uint16_t *srcPtr2 = (const uint16_t *) srcPtr; | |
1834 | 5925 | uint16_t *dstPtr2 = (uint16_t*)dstPtr; | |
1835 | |||
1836 |
2/2✓ Branch 0 taken 960 times.
✓ Branch 1 taken 4965 times.
|
5925 | if (dst_depth == 8) { |
1837 |
1/2✓ Branch 1 taken 960 times.
✗ Branch 2 not taken.
|
960 | if(isBE(c->srcFormat) == HAVE_BIGENDIAN){ |
1838 |
8/22✗ Branch 0 not taken.
✓ Branch 1 taken 960 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 960 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6407640 times.
✓ Branch 11 taken 131880 times.
✓ Branch 12 taken 5100 times.
✓ Branch 13 taken 131880 times.
✓ Branch 14 taken 131880 times.
✓ Branch 15 taken 960 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
6545580 | DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, , ) |
1839 | } else { | ||
1840 | ✗ | DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, av_bswap16, ) | |
1841 | } | ||
1842 |
2/2✓ Branch 0 taken 4785 times.
✓ Branch 1 taken 180 times.
|
4965 | } else if (src_depth == 8) { |
1843 |
2/2✓ Branch 0 taken 394672 times.
✓ Branch 1 taken 4785 times.
|
399457 | for (i = 0; i < height; i++) { |
1844 | #define COPY816(w)\ | ||
1845 | if (shiftonly) {\ | ||
1846 | for (j = 0; j < length; j++)\ | ||
1847 | w(&dstPtr2[j], srcPtr[j]<<(dst_depth-8));\ | ||
1848 | } else {\ | ||
1849 | for (j = 0; j < length; j++)\ | ||
1850 | w(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) |\ | ||
1851 | (srcPtr[j]>>(2*8-dst_depth)));\ | ||
1852 | } | ||
1853 |
2/2✓ Branch 1 taken 69120 times.
✓ Branch 2 taken 325552 times.
|
394672 | if(isBE(c->dstFormat)){ |
1854 |
3/6✓ Branch 0 taken 69120 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18247680 times.
✓ Branch 3 taken 69120 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18316800 | COPY816(AV_WB16) |
1855 | } else { | ||
1856 |
3/6✓ Branch 0 taken 325552 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116729004 times.
✓ Branch 3 taken 325552 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
117054556 | COPY816(AV_WL16) |
1857 | } | ||
1858 | 394672 | dstPtr2 += dstStride[plane]/2; | |
1859 | 394672 | srcPtr += srcStride[plane]; | |
1860 | } | ||
1861 |
1/2✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
|
180 | } else if (src_depth <= dst_depth) { |
1862 |
2/2✓ Branch 0 taken 3360 times.
✓ Branch 1 taken 180 times.
|
3540 | for (i = 0; i < height; i++) { |
1863 | 3360 | j = 0; | |
1864 |
3/4✓ Branch 1 taken 3360 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1200 times.
✓ Branch 4 taken 2160 times.
|
6720 | if(isBE(c->srcFormat) == HAVE_BIGENDIAN && |
1865 |
1/2✓ Branch 1 taken 1200 times.
✗ Branch 2 not taken.
|
4560 | isBE(c->dstFormat) == HAVE_BIGENDIAN && |
1866 | shiftonly) { | ||
1867 | 1200 | unsigned shift = dst_depth - src_depth; | |
1868 | #if HAVE_FAST_64BIT | ||
1869 | #define FAST_COPY_UP(shift) \ | ||
1870 | for (; j < length - 3; j += 4) { \ | ||
1871 | uint64_t v = AV_RN64A(srcPtr2 + j); \ | ||
1872 | AV_WN64A(dstPtr2 + j, v << shift); \ | ||
1873 | } | ||
1874 | #else | ||
1875 | #define FAST_COPY_UP(shift) \ | ||
1876 | for (; j < length - 1; j += 2) { \ | ||
1877 | uint32_t v = AV_RN32A(srcPtr2 + j); \ | ||
1878 | AV_WN32A(dstPtr2 + j, v << shift); \ | ||
1879 | } | ||
1880 | #endif | ||
1881 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1200 times.
|
1200 | switch (shift) |
1882 | { | ||
1883 | ✗ | case 6: FAST_COPY_UP(6); break; | |
1884 | ✗ | case 7: FAST_COPY_UP(7); break; | |
1885 | } | ||
1886 | } | ||
1887 | #define COPY_UP(r,w) \ | ||
1888 | if(shiftonly){\ | ||
1889 | for (; j < length; j++){ \ | ||
1890 | unsigned int v= r(&srcPtr2[j]);\ | ||
1891 | w(&dstPtr2[j], v<<(dst_depth-src_depth));\ | ||
1892 | }\ | ||
1893 | }else{\ | ||
1894 | for (; j < length; j++){ \ | ||
1895 | unsigned int v= r(&srcPtr2[j]);\ | ||
1896 | w(&dstPtr2[j], (v<<(dst_depth-src_depth)) | \ | ||
1897 | (v>>(2*src_depth-dst_depth)));\ | ||
1898 | }\ | ||
1899 | } | ||
1900 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 3360 times.
|
3360 | if(isBE(c->srcFormat)){ |
1901 | ✗ | if(isBE(c->dstFormat)){ | |
1902 | ✗ | COPY_UP(AV_RB16, AV_WB16) | |
1903 | } else { | ||
1904 | ✗ | COPY_UP(AV_RB16, AV_WL16) | |
1905 | } | ||
1906 | } else { | ||
1907 |
2/2✓ Branch 1 taken 2160 times.
✓ Branch 2 taken 1200 times.
|
3360 | if(isBE(c->dstFormat)){ |
1908 |
3/6✓ Branch 0 taken 2160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1843200 times.
✓ Branch 3 taken 2160 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1845360 | COPY_UP(AV_RL16, AV_WB16) |
1909 | } else { | ||
1910 |
3/6✓ Branch 0 taken 1200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103680 times.
✓ Branch 3 taken 1200 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
104880 | COPY_UP(AV_RL16, AV_WL16) |
1911 | } | ||
1912 | } | ||
1913 | 3360 | dstPtr2 += dstStride[plane]/2; | |
1914 | 3360 | srcPtr2 += srcStride[plane]/2; | |
1915 | } | ||
1916 | } else { | ||
1917 | ✗ | if(isBE(c->srcFormat) == HAVE_BIGENDIAN){ | |
1918 | ✗ | if(isBE(c->dstFormat) == HAVE_BIGENDIAN){ | |
1919 | ✗ | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , ) | |
1920 | } else { | ||
1921 | ✗ | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , av_bswap16) | |
1922 | } | ||
1923 | }else{ | ||
1924 | ✗ | if(isBE(c->dstFormat) == HAVE_BIGENDIAN){ | |
1925 | ✗ | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, ) | |
1926 | } else { | ||
1927 | ✗ | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, av_bswap16) | |
1928 | } | ||
1929 | } | ||
1930 | } | ||
1931 |
5/6✓ Branch 1 taken 101 times.
✓ Branch 2 taken 1442 times.
✓ Branch 4 taken 101 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 92 times.
✓ Branch 7 taken 9 times.
|
1736 | } else if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat) && |
1932 | 101 | isBE(c->srcFormat) != isBE(c->dstFormat)) { | |
1933 | |||
1934 |
2/2✓ Branch 0 taken 15912 times.
✓ Branch 1 taken 92 times.
|
16004 | for (i = 0; i < height; i++) { |
1935 |
2/2✓ Branch 0 taken 8828928 times.
✓ Branch 1 taken 15912 times.
|
8844840 | for (j = 0; j < length; j++) |
1936 | 8828928 | ((uint16_t *) dstPtr)[j] = av_bswap16(((const uint16_t *) srcPtr)[j]); | |
1937 | 15912 | srcPtr += srcStride[plane]; | |
1938 | 15912 | dstPtr += dstStride[plane]; | |
1939 | } | ||
1940 |
4/6✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1438 times.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13 times.
✗ Branch 7 not taken.
|
1477 | } else if (isFloat(c->srcFormat) && isFloat(c->dstFormat) && |
1941 | 13 | isBE(c->srcFormat) != isBE(c->dstFormat)) { /* swap float plane */ | |
1942 |
2/2✓ Branch 0 taken 3744 times.
✓ Branch 1 taken 13 times.
|
3757 | for (i = 0; i < height; i++) { |
1943 |
2/2✓ Branch 0 taken 1317888 times.
✓ Branch 1 taken 3744 times.
|
1321632 | for (j = 0; j < length; j++) |
1944 | 1317888 | ((uint32_t *) dstPtr)[j] = av_bswap32(((const uint32_t *) srcPtr)[j]); | |
1945 | 3744 | srcPtr += srcStride[plane]; | |
1946 | 3744 | dstPtr += dstStride[plane]; | |
1947 | } | ||
1948 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1437 times.
|
1438 | } else if (dstStride[plane] == srcStride[plane] && |
1949 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | srcStride[plane] > 0 && srcStride[plane] == length) { |
1950 | 1 | memcpy(dst[plane] + dstStride[plane] * y, src[plane], | |
1951 | 1 | height * dstStride[plane]); | |
1952 | } else { | ||
1953 |
3/4✓ Branch 1 taken 9 times.
✓ Branch 2 taken 1428 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
1437 | if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) |
1954 | 9 | length *= 2; | |
1955 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1428 times.
|
1428 | else if (desc_src->comp[0].depth == 1) |
1956 | ✗ | length >>= 3; // monowhite/black | |
1957 |
2/2✓ Branch 0 taken 44525 times.
✓ Branch 1 taken 1437 times.
|
45962 | for (i = 0; i < height; i++) { |
1958 | 44525 | memcpy(dstPtr, srcPtr, length); | |
1959 | 44525 | srcPtr += srcStride[plane]; | |
1960 | 44525 | dstPtr += dstStride[plane]; | |
1961 | } | ||
1962 | } | ||
1963 | } | ||
1964 | } | ||
1965 | 2530 | return srcSliceH; | |
1966 | } | ||
1967 | |||
1968 | |||
1969 | #define IS_DIFFERENT_ENDIANESS(src_fmt, dst_fmt, pix_fmt) \ | ||
1970 | ((src_fmt == pix_fmt ## BE && dst_fmt == pix_fmt ## LE) || \ | ||
1971 | (src_fmt == pix_fmt ## LE && dst_fmt == pix_fmt ## BE)) | ||
1972 | |||
1973 | |||
1974 | 5370 | void ff_get_unscaled_swscale(SwsContext *c) | |
1975 | { | ||
1976 | 5370 | const enum AVPixelFormat srcFormat = c->srcFormat; | |
1977 | 5370 | const enum AVPixelFormat dstFormat = c->dstFormat; | |
1978 | 5370 | const int flags = c->flags; | |
1979 | 5370 | const int dstH = c->dstH; | |
1980 | 5370 | const int dstW = c->dstW; | |
1981 | int needsDither; | ||
1982 | |||
1983 | 5370 | needsDither = isAnyRGB(dstFormat) && | |
1984 |
4/4✓ Branch 0 taken 3084 times.
✓ Branch 1 taken 2286 times.
✓ Branch 2 taken 257 times.
✓ Branch 3 taken 2827 times.
|
5627 | c->dstFormatBpp < 24 && |
1985 |
3/4✓ Branch 0 taken 163 times.
✓ Branch 1 taken 94 times.
✓ Branch 3 taken 163 times.
✗ Branch 4 not taken.
|
257 | (c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat))); |
1986 | |||
1987 | /* yv12_to_nv12 */ | ||
1988 |
5/6✓ Branch 0 taken 2396 times.
✓ Branch 1 taken 2974 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2396 times.
✓ Branch 4 taken 2954 times.
✓ Branch 5 taken 20 times.
|
5370 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) && |
1989 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 2934 times.
|
2954 | (dstFormat == AV_PIX_FMT_NV12 || dstFormat == AV_PIX_FMT_NV21)) { |
1990 | 40 | c->convert_unscaled = planarToNv12Wrapper; | |
1991 | } | ||
1992 | /* yv24_to_nv24 */ | ||
1993 |
5/6✓ Branch 0 taken 5292 times.
✓ Branch 1 taken 78 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 5288 times.
✓ Branch 4 taken 82 times.
✗ Branch 5 not taken.
|
5370 | if ((srcFormat == AV_PIX_FMT_YUV444P || srcFormat == AV_PIX_FMT_YUVA444P) && |
1994 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | (dstFormat == AV_PIX_FMT_NV24 || dstFormat == AV_PIX_FMT_NV42)) { |
1995 | ✗ | c->convert_unscaled = planarToNv24Wrapper; | |
1996 | } | ||
1997 | /* nv12_to_yv12 */ | ||
1998 |
4/4✓ Branch 0 taken 449 times.
✓ Branch 1 taken 4921 times.
✓ Branch 2 taken 440 times.
✓ Branch 3 taken 9 times.
|
5370 | if (dstFormat == AV_PIX_FMT_YUV420P && |
1999 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 431 times.
|
440 | (srcFormat == AV_PIX_FMT_NV12 || srcFormat == AV_PIX_FMT_NV21)) { |
2000 | 18 | c->convert_unscaled = nv12ToPlanarWrapper; | |
2001 | } | ||
2002 | /* nv24_to_yv24 */ | ||
2003 |
3/4✓ Branch 0 taken 87 times.
✓ Branch 1 taken 5283 times.
✓ Branch 2 taken 87 times.
✗ Branch 3 not taken.
|
5370 | if (dstFormat == AV_PIX_FMT_YUV444P && |
2004 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 87 times.
|
87 | (srcFormat == AV_PIX_FMT_NV24 || srcFormat == AV_PIX_FMT_NV42)) { |
2005 | ✗ | c->convert_unscaled = nv24ToPlanarWrapper; | |
2006 | } | ||
2007 | /* yuv2bgr */ | ||
2008 |
5/6✓ Branch 0 taken 2396 times.
✓ Branch 1 taken 2974 times.
✓ Branch 2 taken 2372 times.
✓ Branch 3 taken 24 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2372 times.
|
5370 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P || |
2009 |
2/2✓ Branch 1 taken 1232 times.
✓ Branch 2 taken 1766 times.
|
2998 | srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) && |
2010 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 1232 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1232 | !(flags & SWS_ACCURATE_RND) && (c->dither == SWS_DITHER_BAYER || c->dither == SWS_DITHER_AUTO) && !(dstH & 1)) { |
2011 | ✗ | c->convert_unscaled = ff_yuv2rgb_get_func_ptr(c); | |
2012 | ✗ | c->dst_slice_align = 2; | |
2013 | } | ||
2014 | /* yuv420p1x_to_p01x */ | ||
2015 |
5/6✓ Branch 0 taken 5304 times.
✓ Branch 1 taken 66 times.
✓ Branch 2 taken 5304 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5297 times.
✓ Branch 5 taken 7 times.
|
5370 | if ((srcFormat == AV_PIX_FMT_YUV420P10 || srcFormat == AV_PIX_FMT_YUVA420P10 || |
2016 |
1/2✓ Branch 0 taken 5297 times.
✗ Branch 1 not taken.
|
5297 | srcFormat == AV_PIX_FMT_YUV420P12 || |
2017 |
1/2✓ Branch 0 taken 5297 times.
✗ Branch 1 not taken.
|
5297 | srcFormat == AV_PIX_FMT_YUV420P14 || |
2018 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 5297 times.
✓ Branch 2 taken 73 times.
✗ Branch 3 not taken.
|
5370 | srcFormat == AV_PIX_FMT_YUV420P16 || srcFormat == AV_PIX_FMT_YUVA420P16) && |
2019 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
|
73 | (dstFormat == AV_PIX_FMT_P010 || dstFormat == AV_PIX_FMT_P016)) { |
2020 | ✗ | c->convert_unscaled = planarToP01xWrapper; | |
2021 | } | ||
2022 | /* yuv420p_to_p01xle */ | ||
2023 |
5/6✓ Branch 0 taken 2396 times.
✓ Branch 1 taken 2974 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2396 times.
✓ Branch 4 taken 2963 times.
✓ Branch 5 taken 11 times.
|
5370 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) && |
2024 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 2952 times.
|
2963 | (dstFormat == AV_PIX_FMT_P010LE || dstFormat == AV_PIX_FMT_P016LE)) { |
2025 | 22 | c->convert_unscaled = planar8ToP01xleWrapper; | |
2026 | } | ||
2027 | |||
2028 |
6/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 5365 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 3 times.
|
5370 | if (srcFormat == AV_PIX_FMT_YUV410P && !(dstH & 3) && |
2029 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && |
2030 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | !(flags & SWS_BITEXACT)) { |
2031 | ✗ | c->convert_unscaled = yvu9ToYv12Wrapper; | |
2032 | ✗ | c->dst_slice_align = 4; | |
2033 | } | ||
2034 | |||
2035 | /* bgr24toYV12 */ | ||
2036 |
4/4✓ Branch 0 taken 49 times.
✓ Branch 1 taken 5321 times.
✓ Branch 2 taken 29 times.
✓ Branch 3 taken 20 times.
|
5370 | if (srcFormat == AV_PIX_FMT_BGR24 && |
2037 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
|
29 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && |
2038 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
20 | !(flags & SWS_ACCURATE_RND) && !(dstW&1)) |
2039 | ✗ | c->convert_unscaled = bgr24ToYv12Wrapper; | |
2040 | |||
2041 | /* RGB/BGR -> RGB/BGR (no dither needed forms) */ | ||
2042 |
6/6✓ Branch 1 taken 1005 times.
✓ Branch 2 taken 4365 times.
✓ Branch 4 taken 775 times.
✓ Branch 5 taken 230 times.
✓ Branch 7 taken 441 times.
✓ Branch 8 taken 334 times.
|
5370 | if (isAnyRGB(srcFormat) && isAnyRGB(dstFormat) && findRgbConvFn(c) |
2043 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 441 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
441 | && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)))) |
2044 | 441 | c->convert_unscaled = rgbToRgbWrapper; | |
2045 | |||
2046 | /* RGB to planar RGB */ | ||
2047 |
5/6✓ Branch 0 taken 10 times.
✓ Branch 1 taken 5360 times.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 46 times.
✓ Branch 5 taken 5324 times.
|
5370 | if ((srcFormat == AV_PIX_FMT_GBRP && dstFormat == AV_PIX_FMT_GBRAP) || |
2048 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 37 times.
|
46 | (srcFormat == AV_PIX_FMT_GBRAP && dstFormat == AV_PIX_FMT_GBRP)) |
2049 | 9 | c->convert_unscaled = planarRgbToplanarRgbWrapper; | |
2050 | |||
2051 | #define isByteRGB(f) ( \ | ||
2052 | f == AV_PIX_FMT_RGB32 || \ | ||
2053 | f == AV_PIX_FMT_RGB32_1 || \ | ||
2054 | f == AV_PIX_FMT_RGB24 || \ | ||
2055 | f == AV_PIX_FMT_BGR32 || \ | ||
2056 | f == AV_PIX_FMT_BGR32_1 || \ | ||
2057 | f == AV_PIX_FMT_BGR24) | ||
2058 | |||
2059 |
10/16✓ Branch 0 taken 10 times.
✓ Branch 1 taken 5360 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 10 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 9 times.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
5370 | if (srcFormat == AV_PIX_FMT_GBRP && isPlanar(srcFormat) && isByteRGB(dstFormat)) |
2060 | 9 | c->convert_unscaled = planarRgbToRgbWrapper; | |
2061 | |||
2062 |
10/14✓ Branch 0 taken 46 times.
✓ Branch 1 taken 5324 times.
✓ Branch 2 taken 37 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 37 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 28 times.
✓ Branch 7 taken 9 times.
✓ Branch 8 taken 28 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 28 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 28 times.
|
5370 | if (srcFormat == AV_PIX_FMT_GBRAP && isByteRGB(dstFormat)) |
2063 | 18 | c->convert_unscaled = planarRgbaToRgbWrapper; | |
2064 | |||
2065 |
6/6✓ Branch 0 taken 5363 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 5353 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 5352 times.
✓ Branch 5 taken 1 times.
|
5370 | if ((srcFormat == AV_PIX_FMT_RGB48LE || srcFormat == AV_PIX_FMT_RGB48BE || |
2066 |
3/4✓ Branch 0 taken 5352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5351 times.
✓ Branch 3 taken 1 times.
|
5352 | srcFormat == AV_PIX_FMT_BGR48LE || srcFormat == AV_PIX_FMT_BGR48BE || |
2067 |
4/4✓ Branch 0 taken 5341 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 5340 times.
✓ Branch 3 taken 1 times.
|
5351 | srcFormat == AV_PIX_FMT_RGBA64LE || srcFormat == AV_PIX_FMT_RGBA64BE || |
2068 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 5340 times.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
5370 | srcFormat == AV_PIX_FMT_BGRA64LE || srcFormat == AV_PIX_FMT_BGRA64BE) && |
2069 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
30 | (dstFormat == AV_PIX_FMT_GBRP9LE || dstFormat == AV_PIX_FMT_GBRP9BE || |
2070 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
30 | dstFormat == AV_PIX_FMT_GBRP10LE || dstFormat == AV_PIX_FMT_GBRP10BE || |
2071 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
30 | dstFormat == AV_PIX_FMT_GBRP12LE || dstFormat == AV_PIX_FMT_GBRP12BE || |
2072 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
30 | dstFormat == AV_PIX_FMT_GBRP14LE || dstFormat == AV_PIX_FMT_GBRP14BE || |
2073 |
3/4✓ Branch 0 taken 29 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
|
30 | dstFormat == AV_PIX_FMT_GBRP16LE || dstFormat == AV_PIX_FMT_GBRP16BE || |
2074 |
2/4✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
|
29 | dstFormat == AV_PIX_FMT_GBRAP10LE || dstFormat == AV_PIX_FMT_GBRAP10BE || |
2075 |
2/4✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
|
29 | dstFormat == AV_PIX_FMT_GBRAP12LE || dstFormat == AV_PIX_FMT_GBRAP12BE || |
2076 |
2/4✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
|
29 | dstFormat == AV_PIX_FMT_GBRAP14LE || dstFormat == AV_PIX_FMT_GBRAP14BE || |
2077 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 28 times.
|
29 | dstFormat == AV_PIX_FMT_GBRAP16LE || dstFormat == AV_PIX_FMT_GBRAP16BE )) |
2078 | 2 | c->convert_unscaled = Rgb16ToPlanarRgb16Wrapper; | |
2079 | |||
2080 |
5/6✓ Branch 0 taken 5369 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 5369 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5362 times.
✓ Branch 5 taken 7 times.
|
5370 | if ((srcFormat == AV_PIX_FMT_GBRP9LE || srcFormat == AV_PIX_FMT_GBRP9BE || |
2081 |
4/4✓ Branch 0 taken 5353 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 5338 times.
✓ Branch 3 taken 15 times.
|
5362 | srcFormat == AV_PIX_FMT_GBRP16LE || srcFormat == AV_PIX_FMT_GBRP16BE || |
2082 |
3/4✓ Branch 0 taken 5338 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5337 times.
✓ Branch 3 taken 1 times.
|
5338 | srcFormat == AV_PIX_FMT_GBRP10LE || srcFormat == AV_PIX_FMT_GBRP10BE || |
2083 |
3/4✓ Branch 0 taken 5337 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5336 times.
✓ Branch 3 taken 1 times.
|
5337 | srcFormat == AV_PIX_FMT_GBRP12LE || srcFormat == AV_PIX_FMT_GBRP12BE || |
2084 |
3/4✓ Branch 0 taken 5336 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5335 times.
✓ Branch 3 taken 1 times.
|
5336 | srcFormat == AV_PIX_FMT_GBRP14LE || srcFormat == AV_PIX_FMT_GBRP14BE || |
2085 |
3/4✓ Branch 0 taken 5335 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5334 times.
✓ Branch 3 taken 1 times.
|
5335 | srcFormat == AV_PIX_FMT_GBRAP10LE || srcFormat == AV_PIX_FMT_GBRAP10BE || |
2086 |
2/4✓ Branch 0 taken 5334 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5334 times.
✗ Branch 3 not taken.
|
5334 | srcFormat == AV_PIX_FMT_GBRAP12LE || srcFormat == AV_PIX_FMT_GBRAP12BE || |
2087 |
3/4✓ Branch 0 taken 5334 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5331 times.
✓ Branch 3 taken 3 times.
|
5334 | srcFormat == AV_PIX_FMT_GBRAP14LE || srcFormat == AV_PIX_FMT_GBRAP14BE || |
2088 |
4/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 5322 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 10 times.
|
5370 | srcFormat == AV_PIX_FMT_GBRAP16LE || srcFormat == AV_PIX_FMT_GBRAP16BE) && |
2089 |
2/4✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✗ Branch 3 not taken.
|
38 | (dstFormat == AV_PIX_FMT_RGB48LE || dstFormat == AV_PIX_FMT_RGB48BE || |
2090 |
2/4✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✗ Branch 3 not taken.
|
38 | dstFormat == AV_PIX_FMT_BGR48LE || dstFormat == AV_PIX_FMT_BGR48BE || |
2091 |
2/4✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✗ Branch 3 not taken.
|
38 | dstFormat == AV_PIX_FMT_RGBA64LE || dstFormat == AV_PIX_FMT_RGBA64BE || |
2092 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | dstFormat == AV_PIX_FMT_BGRA64LE || dstFormat == AV_PIX_FMT_BGRA64BE)) |
2093 | 10 | c->convert_unscaled = planarRgb16ToRgb16Wrapper; | |
2094 | |||
2095 |
4/4✓ Branch 1 taken 4794 times.
✓ Branch 2 taken 576 times.
✓ Branch 3 taken 682 times.
✓ Branch 4 taken 4112 times.
|
10164 | if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth == 8 && |
2096 |
2/2✓ Branch 1 taken 55 times.
✓ Branch 2 taken 627 times.
|
5476 | isPackedRGB(srcFormat) && dstFormat == AV_PIX_FMT_GBRP) |
2097 | 55 | c->convert_unscaled = rgbToPlanarRgbWrapper; | |
2098 | |||
2099 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 5370 times.
|
5370 | if (isBayer(srcFormat)) { |
2100 | ✗ | c->dst_slice_align = 2; | |
2101 | ✗ | if (dstFormat == AV_PIX_FMT_RGB24) | |
2102 | ✗ | c->convert_unscaled = bayer_to_rgb24_wrapper; | |
2103 | ✗ | else if (dstFormat == AV_PIX_FMT_RGB48) | |
2104 | ✗ | c->convert_unscaled = bayer_to_rgb48_wrapper; | |
2105 | ✗ | else if (dstFormat == AV_PIX_FMT_YUV420P) | |
2106 | ✗ | c->convert_unscaled = bayer_to_yv12_wrapper; | |
2107 | ✗ | else if (!isBayer(dstFormat)) { | |
2108 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported bayer conversion\n"); | |
2109 | ✗ | av_assert0(0); | |
2110 | } | ||
2111 | } | ||
2112 | |||
2113 | /* bswap 16 bits per pixel/component packed formats */ | ||
2114 |
3/10✗ Branch 0 not taken.
✓ Branch 1 taken 5370 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5370 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 5370 times.
|
5370 | if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_BGGR16) || |
2115 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_RGGB16) || |
2116 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_GBRG16) || |
2117 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_GRBG16) || |
2118 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR444) || |
2119 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5369 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR48) || |
2120 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 5352 times.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR555) || |
2121 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) || |
2122 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5369 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || |
2123 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY9) || |
2124 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY10) || |
2125 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5370 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY12) || |
2126 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5370 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 45 times.
✓ Branch 7 taken 5325 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY14) || |
2127 |
7/8✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 5359 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 45 times.
✓ Branch 7 taken 5323 times.
|
5370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || |
2128 |
3/8✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5368 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5368 times.
|
5368 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) || |
2129 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5368 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5368 times.
|
5368 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_AYUV64) || |
2130 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5367 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5368 times.
|
5368 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9) || |
2131 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 5353 times.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5368 times.
|
5368 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) || |
2132 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5367 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5368 times.
|
5368 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) || |
2133 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5367 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9 times.
✓ Branch 7 taken 5359 times.
|
5368 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP14) || |
2134 |
6/8✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 5361 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5366 times.
|
5368 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP16) || |
2135 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5365 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5366 times.
|
5366 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP10) || |
2136 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5365 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5366 times.
|
5366 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP12) || |
2137 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5366 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 9 times.
✓ Branch 7 taken 5357 times.
|
5366 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP14) || |
2138 |
6/8✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 5363 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5364 times.
|
5366 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP16) || |
2139 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5364 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
✓ Branch 7 taken 5354 times.
|
5364 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB444) || |
2140 |
6/8✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 5357 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5364 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB48) || |
2141 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
✓ Branch 3 taken 5257 times.
✓ Branch 4 taken 106 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB555) || |
2142 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 32 times.
✓ Branch 3 taken 5331 times.
✓ Branch 4 taken 32 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
✓ Branch 7 taken 5353 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB565) || |
2143 |
5/8✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5362 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGBA64) || |
2144 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5363 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_XYZ12) || |
2145 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 5345 times.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P9) || |
2146 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 66 times.
✓ Branch 3 taken 5297 times.
✓ Branch 4 taken 66 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P10) || |
2147 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 5356 times.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P12) || |
2148 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5363 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P14) || |
2149 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5363 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P16) || |
2150 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 5354 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P9) || |
2151 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✓ Branch 3 taken 5317 times.
✓ Branch 4 taken 46 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P10) || |
2152 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 5360 times.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P12) || |
2153 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5363 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5363 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P14) || |
2154 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 5354 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5354 times.
|
5363 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P16) || |
2155 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5354 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5354 times.
|
5354 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV440P10) || |
2156 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5354 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5354 times.
|
5354 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV440P12) || |
2157 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5353 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5354 times.
|
5354 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P9) || |
2158 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 5341 times.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5354 times.
|
5354 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P10) || |
2159 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 5342 times.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5354 times.
|
5354 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P12) || |
2160 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5353 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5354 times.
|
5354 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P14) || |
2161 |
3/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 5345 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
|
5354 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P16)) |
2162 | 16 | c->convert_unscaled = bswap_16bpc; | |
2163 | |||
2164 | /* bswap 32 bits per pixel/component formats */ | ||
2165 |
6/10✗ Branch 0 not taken.
✓ Branch 1 taken 5370 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 31 times.
✓ Branch 5 taken 5339 times.
✓ Branch 6 taken 30 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5369 times.
|
5370 | if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRPF32) || |
2166 |
1/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5369 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5369 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAPF32)) |
2167 | 1 | c->convert_unscaled = bswap_32bpc; | |
2168 | |||
2169 |
11/14✓ Branch 1 taken 898 times.
✓ Branch 2 taken 4472 times.
✓ Branch 3 taken 754 times.
✓ Branch 4 taken 144 times.
✓ Branch 5 taken 754 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 61 times.
✓ Branch 8 taken 693 times.
✓ Branch 9 taken 16 times.
✓ Branch 10 taken 45 times.
✓ Branch 11 taken 16 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 16 times.
|
5370 | if (usePal(srcFormat) && isByteRGB(dstFormat)) |
2170 | 882 | c->convert_unscaled = palToRgbWrapper; | |
2171 | |||
2172 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 5346 times.
|
5370 | if (srcFormat == AV_PIX_FMT_YUV422P) { |
2173 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if (dstFormat == AV_PIX_FMT_YUYV422) |
2174 | ✗ | c->convert_unscaled = yuv422pToYuy2Wrapper; | |
2175 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | else if (dstFormat == AV_PIX_FMT_UYVY422) |
2176 | ✗ | c->convert_unscaled = yuv422pToUyvyWrapper; | |
2177 | } | ||
2178 | |||
2179 | /* uint Y to float Y */ | ||
2180 |
3/4✓ Branch 0 taken 46 times.
✓ Branch 1 taken 5324 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 46 times.
|
5370 | if (srcFormat == AV_PIX_FMT_GRAY8 && dstFormat == AV_PIX_FMT_GRAYF32){ |
2181 | ✗ | c->convert_unscaled = uint_y_to_float_y_wrapper; | |
2182 | } | ||
2183 | |||
2184 | /* float Y to uint Y */ | ||
2185 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5369 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
5370 | if (srcFormat == AV_PIX_FMT_GRAYF32 && dstFormat == AV_PIX_FMT_GRAY8){ |
2186 | ✗ | c->convert_unscaled = float_y_to_uint_y_wrapper; | |
2187 | } | ||
2188 | |||
2189 | /* LQ converters if -sws 0 or -sws 4*/ | ||
2190 |
2/2✓ Branch 0 taken 76 times.
✓ Branch 1 taken 5294 times.
|
5370 | if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) { |
2191 | /* yv12_to_yuy2 */ | ||
2192 |
3/4✓ Branch 0 taken 32 times.
✓ Branch 1 taken 44 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 32 times.
|
76 | if (srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) { |
2193 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if (dstFormat == AV_PIX_FMT_YUYV422) |
2194 | ✗ | c->convert_unscaled = planarToYuy2Wrapper; | |
2195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | else if (dstFormat == AV_PIX_FMT_UYVY422) |
2196 | ✗ | c->convert_unscaled = planarToUyvyWrapper; | |
2197 | } | ||
2198 | } | ||
2199 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5369 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
5370 | if (srcFormat == AV_PIX_FMT_YUYV422 && |
2200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P)) |
2201 | ✗ | c->convert_unscaled = yuyvToYuv420Wrapper; | |
2202 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5370 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5370 | if (srcFormat == AV_PIX_FMT_UYVY422 && |
2203 | ✗ | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P)) | |
2204 | ✗ | c->convert_unscaled = uyvyToYuv420Wrapper; | |
2205 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5369 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
5370 | if (srcFormat == AV_PIX_FMT_YUYV422 && dstFormat == AV_PIX_FMT_YUV422P) |
2206 | ✗ | c->convert_unscaled = yuyvToYuv422Wrapper; | |
2207 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5370 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5370 | if (srcFormat == AV_PIX_FMT_UYVY422 && dstFormat == AV_PIX_FMT_YUV422P) |
2208 | ✗ | c->convert_unscaled = uyvyToYuv422Wrapper; | |
2209 | |||
2210 | #define isPlanarGray(x) (isGray(x) && (x) != AV_PIX_FMT_YA8 && (x) != AV_PIX_FMT_YA16LE && (x) != AV_PIX_FMT_YA16BE) | ||
2211 | /* simple copy */ | ||
2212 |
3/4✓ Branch 0 taken 5207 times.
✓ Branch 1 taken 163 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5207 times.
|
5370 | if ( srcFormat == dstFormat || |
2213 |
2/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 2857 times.
✓ Branch 3 taken 2350 times.
|
5207 | (srcFormat == AV_PIX_FMT_YUVA420P && dstFormat == AV_PIX_FMT_YUV420P) || |
2214 |
4/4✓ Branch 0 taken 2830 times.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 5038 times.
✓ Branch 3 taken 142 times.
|
8037 | (srcFormat == AV_PIX_FMT_YUV420P && dstFormat == AV_PIX_FMT_YUVA420P) || |
2215 |
5/12✓ Branch 3 taken 3087 times.
✓ Branch 4 taken 1951 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3087 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1987 times.
✓ Branch 15 taken 3051 times.
|
15256 | (isFloat(srcFormat) == isFloat(dstFormat)) && ((isPlanarYUV(srcFormat) && isPlanarGray(dstFormat)) || |
2216 |
3/10✗ Branch 2 not taken.
✓ Branch 3 taken 1987 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 5035 times.
|
12063 | (isPlanarYUV(dstFormat) && isPlanarGray(srcFormat)) || |
2217 |
9/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 3 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 3 times.
✓ Branch 16 taken 3087 times.
✓ Branch 17 taken 1948 times.
|
10076 | (isPlanarGray(dstFormat) && isPlanarGray(srcFormat)) || |
2218 |
2/2✓ Branch 2 taken 1747 times.
✓ Branch 3 taken 1340 times.
|
8122 | (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat) && |
2219 |
2/2✓ Branch 0 taken 994 times.
✓ Branch 1 taken 753 times.
|
1747 | c->chrDstHSubSample == c->chrSrcHSubSample && |
2220 |
4/4✓ Branch 0 taken 494 times.
✓ Branch 1 taken 500 times.
✓ Branch 2 taken 476 times.
✓ Branch 3 taken 18 times.
|
1488 | c->chrDstVSubSample == c->chrSrcVSubSample && |
2221 |
2/2✓ Branch 2 taken 373 times.
✓ Branch 3 taken 103 times.
|
970 | !isSemiPlanarYUV(srcFormat) && !isSemiPlanarYUV(dstFormat)))) |
2222 | { | ||
2223 |
2/2✓ Branch 1 taken 36 times.
✓ Branch 2 taken 530 times.
|
566 | if (isPacked(c->srcFormat)) |
2224 | 36 | c->convert_unscaled = packedCopyWrapper; | |
2225 | else /* Planar YUV or gray */ | ||
2226 | 530 | c->convert_unscaled = planarCopyWrapper; | |
2227 | } | ||
2228 | |||
2229 | #if ARCH_PPC | ||
2230 | ff_get_unscaled_swscale_ppc(c); | ||
2231 | #elif ARCH_ARM | ||
2232 | ff_get_unscaled_swscale_arm(c); | ||
2233 | #elif ARCH_AARCH64 | ||
2234 | ff_get_unscaled_swscale_aarch64(c); | ||
2235 | #endif | ||
2236 | 5370 | } | |
2237 | |||
2238 | /* Convert the palette to the same packed 32-bit format as the palette */ | ||
2239 | 97576 | void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, | |
2240 | int num_pixels, const uint8_t *palette) | ||
2241 | { | ||
2242 | int i; | ||
2243 | |||
2244 |
2/2✓ Branch 0 taken 30214048 times.
✓ Branch 1 taken 97576 times.
|
30311624 | for (i = 0; i < num_pixels; i++) |
2245 | 30214048 | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i]]; | |
2246 | 97576 | } | |
2247 | |||
2248 | /* Palette format: ABCD -> dst format: ABC */ | ||
2249 | 709822 | void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, | |
2250 | int num_pixels, const uint8_t *palette) | ||
2251 | { | ||
2252 | int i; | ||
2253 | |||
2254 |
2/2✓ Branch 0 taken 271316108 times.
✓ Branch 1 taken 709822 times.
|
272025930 | for (i = 0; i < num_pixels; i++) { |
2255 | //FIXME slow? | ||
2256 | 271316108 | dst[0] = palette[src[i] * 4 + 0]; | |
2257 | 271316108 | dst[1] = palette[src[i] * 4 + 1]; | |
2258 | 271316108 | dst[2] = palette[src[i] * 4 + 2]; | |
2259 | 271316108 | dst += 3; | |
2260 | } | ||
2261 | 709822 | } | |
2262 |