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 | 481 | static void fillPlane(uint8_t *plane, int stride, int width, int height, int y, | |
115 | uint8_t val) | ||
116 | { | ||
117 | int i; | ||
118 | 481 | uint8_t *ptr = plane + stride * y; | |
119 |
2/2✓ Branch 0 taken 23328 times.
✓ Branch 1 taken 481 times.
|
23809 | for (i = 0; i < height; i++) { |
120 | 23328 | memset(ptr, val, width); | |
121 | 23328 | ptr += stride; | |
122 | } | ||
123 | 481 | } | |
124 | |||
125 | 2462 | void ff_copyPlane(const uint8_t *src, int srcStride, | |
126 | int srcSliceY, int srcSliceH, int width, | ||
127 | uint8_t *dst, int dstStride) | ||
128 | { | ||
129 | 2462 | dst += dstStride * srcSliceY; | |
130 |
3/4✓ Branch 0 taken 1385 times.
✓ Branch 1 taken 1077 times.
✓ Branch 2 taken 1385 times.
✗ Branch 3 not taken.
|
2462 | if (dstStride == srcStride && srcStride > 0) { |
131 | 1385 | memcpy(dst, src, srcSliceH * dstStride); | |
132 | } else { | ||
133 | int i; | ||
134 |
2/2✓ Branch 0 taken 41436 times.
✓ Branch 1 taken 1077 times.
|
42513 | for (i = 0; i < srcSliceH; i++) { |
135 | 41436 | memcpy(dst, src, width); | |
136 | 41436 | src += srcStride; | |
137 | 41436 | dst += dstStride; | |
138 | } | ||
139 | } | ||
140 | 2462 | } | |
141 | |||
142 | 942 | static int planarToNv12Wrapper(SwsInternal *c, const uint8_t *const src[], | |
143 | const int srcStride[], int srcSliceY, | ||
144 | int srcSliceH, uint8_t *const dstParam[], | ||
145 | const int dstStride[]) | ||
146 | { | ||
147 | 942 | uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
148 | |||
149 | 942 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
150 | dstParam[0], dstStride[0]); | ||
151 | |||
152 |
2/2✓ Branch 0 taken 472 times.
✓ Branch 1 taken 470 times.
|
942 | if (c->dstFormat == AV_PIX_FMT_NV12) |
153 | 472 | interleaveBytes(src[1], src[2], dst, c->chrSrcW, (srcSliceH + 1) / 2, | |
154 | 472 | srcStride[1], srcStride[2], dstStride[1]); | |
155 | else | ||
156 | 470 | interleaveBytes(src[2], src[1], dst, c->chrSrcW, (srcSliceH + 1) / 2, | |
157 | 470 | srcStride[2], srcStride[1], dstStride[1]); | |
158 | |||
159 | 942 | return srcSliceH; | |
160 | } | ||
161 | |||
162 | 900 | static int nv12ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], | |
163 | const int srcStride[], int srcSliceY, | ||
164 | int srcSliceH, uint8_t *const dstParam[], | ||
165 | const 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 | ff_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 | 234 | static int planarToNv24Wrapper(SwsInternal *c, const uint8_t *const src[], | |
184 | const int srcStride[], int srcSliceY, | ||
185 | int srcSliceH, uint8_t *const dstParam[], | ||
186 | const int dstStride[]) | ||
187 | { | ||
188 | 234 | uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY; | |
189 | |||
190 | 234 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
191 | dstParam[0], dstStride[0]); | ||
192 | |||
193 |
1/2✓ Branch 0 taken 234 times.
✗ Branch 1 not taken.
|
234 | if (c->dstFormat == AV_PIX_FMT_NV24) |
194 | 234 | interleaveBytes(src[1], src[2], dst, c->chrSrcW, srcSliceH, | |
195 | 234 | 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 | 234 | return srcSliceH; | |
201 | } | ||
202 | |||
203 | 235 | static int nv24ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], | |
204 | const int srcStride[], int srcSliceY, | ||
205 | int srcSliceH, uint8_t *const dstParam[], | ||
206 | const int dstStride[]) | ||
207 | { | ||
208 | 235 | uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY; | |
209 | 235 | uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY; | |
210 | |||
211 | 235 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
212 | dstParam[0], dstStride[0]); | ||
213 | |||
214 |
1/2✓ Branch 0 taken 235 times.
✗ Branch 1 not taken.
|
235 | if (c->srcFormat == AV_PIX_FMT_NV24) |
215 | 235 | deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, srcSliceH, | |
216 | 235 | 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 | 235 | return srcSliceH; | |
222 | } | ||
223 | |||
224 | 16 | static void nv24_to_yuv420p_chroma(uint8_t *dst1, int dstStride1, | |
225 | uint8_t *dst2, int dstStride2, | ||
226 | const uint8_t *src, int srcStride, | ||
227 | int w, int h) | ||
228 | { | ||
229 | 16 | const uint8_t *src1 = src; | |
230 | 16 | const uint8_t *src2 = src + srcStride; | |
231 | // average 4 pixels into 1 (interleaved U and V) | ||
232 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 16 times.
|
48 | for (int y = 0; y < h; y += 2) { |
233 |
2/2✓ Branch 0 taken 12544 times.
✓ Branch 1 taken 32 times.
|
12576 | for (int x = 0; x < w; x++) { |
234 | 12544 | dst1[x] = (src1[4 * x + 0] + src1[4 * x + 2] + | |
235 | 12544 | src2[4 * x + 0] + src2[4 * x + 2]) >> 2; | |
236 | 12544 | dst2[x] = (src1[4 * x + 1] + src1[4 * x + 3] + | |
237 | 12544 | src2[4 * x + 1] + src2[4 * x + 3]) >> 2; | |
238 | } | ||
239 | 32 | src1 += srcStride * 2; | |
240 | 32 | src2 += srcStride * 2; | |
241 | 32 | dst1 += dstStride1; | |
242 | 32 | dst2 += dstStride2; | |
243 | } | ||
244 | 16 | } | |
245 | |||
246 | 16 | static int nv24ToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], | |
247 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
248 | uint8_t *const dstParam[], const int dstStride[]) | ||
249 | { | ||
250 | 16 | uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
251 | 16 | uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
252 | |||
253 | 16 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
254 | dstParam[0], dstStride[0]); | ||
255 | |||
256 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
16 | if (c->srcFormat == AV_PIX_FMT_NV24) |
257 | 8 | nv24_to_yuv420p_chroma(dst1, dstStride[1], dst2, dstStride[2], | |
258 | 8 | src[1], srcStride[1], c->srcW / 2, srcSliceH); | |
259 | else | ||
260 | 8 | nv24_to_yuv420p_chroma(dst2, dstStride[2], dst1, dstStride[1], | |
261 | 8 | src[1], srcStride[1], c->srcW / 2, srcSliceH); | |
262 | |||
263 | 16 | return srcSliceH; | |
264 | } | ||
265 | |||
266 | ✗ | static int planarToP01xWrapper(SwsInternal *c, const uint8_t *const src8[], | |
267 | const int srcStride[], int srcSliceY, | ||
268 | int srcSliceH, uint8_t *const dstParam8[], | ||
269 | const int dstStride[]) | ||
270 | { | ||
271 | ✗ | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat); | |
272 | ✗ | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat); | |
273 | ✗ | const uint16_t **src = (const uint16_t**)src8; | |
274 | ✗ | uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY); | |
275 | ✗ | uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2); | |
276 | int x, y; | ||
277 | |||
278 | /* Calculate net shift required for values. */ | ||
279 | ✗ | const int shift[3] = { | |
280 | ✗ | dst_format->comp[0].depth + dst_format->comp[0].shift - | |
281 | ✗ | src_format->comp[0].depth - src_format->comp[0].shift, | |
282 | ✗ | dst_format->comp[1].depth + dst_format->comp[1].shift - | |
283 | ✗ | src_format->comp[1].depth - src_format->comp[1].shift, | |
284 | ✗ | dst_format->comp[2].depth + dst_format->comp[2].shift - | |
285 | ✗ | src_format->comp[2].depth - src_format->comp[2].shift, | |
286 | }; | ||
287 | |||
288 | ✗ | av_assert0(!(srcStride[0] % 2 || srcStride[1] % 2 || srcStride[2] % 2 || | |
289 | dstStride[0] % 2 || dstStride[1] % 2)); | ||
290 | |||
291 | ✗ | for (y = 0; y < srcSliceH; y++) { | |
292 | ✗ | uint16_t *tdstY = dstY; | |
293 | ✗ | const uint16_t *tsrc0 = src[0]; | |
294 | ✗ | for (x = c->srcW; x > 0; x--) { | |
295 | ✗ | *tdstY++ = *tsrc0++ << shift[0]; | |
296 | } | ||
297 | ✗ | src[0] += srcStride[0] / 2; | |
298 | ✗ | dstY += dstStride[0] / 2; | |
299 | |||
300 | ✗ | if (!(y & 1)) { | |
301 | ✗ | uint16_t *tdstUV = dstUV; | |
302 | ✗ | const uint16_t *tsrc1 = src[1]; | |
303 | ✗ | const uint16_t *tsrc2 = src[2]; | |
304 | ✗ | for (x = c->srcW / 2; x > 0; x--) { | |
305 | ✗ | *tdstUV++ = *tsrc1++ << shift[1]; | |
306 | ✗ | *tdstUV++ = *tsrc2++ << shift[2]; | |
307 | } | ||
308 | ✗ | src[1] += srcStride[1] / 2; | |
309 | ✗ | src[2] += srcStride[2] / 2; | |
310 | ✗ | dstUV += dstStride[1] / 2; | |
311 | } | ||
312 | } | ||
313 | |||
314 | ✗ | return srcSliceH; | |
315 | } | ||
316 | |||
317 | #if AV_HAVE_BIGENDIAN | ||
318 | #define output_pixel(p, v) do { \ | ||
319 | uint16_t *pp = (p); \ | ||
320 | AV_WL16(pp, (v)); \ | ||
321 | } while(0) | ||
322 | #else | ||
323 | #define output_pixel(p, v) (*p) = (v) | ||
324 | #endif | ||
325 | |||
326 | 40 | static int planar8ToP01xleWrapper(SwsInternal *c, const uint8_t *const src[], | |
327 | const int srcStride[], int srcSliceY, | ||
328 | int srcSliceH, uint8_t *const dstParam8[], | ||
329 | const int dstStride[]) | ||
330 | { | ||
331 | 40 | const uint8_t *src0 = src[0], *src1 = src[1], *src2 = src[2]; | |
332 | 40 | uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY); | |
333 | 40 | uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2); | |
334 | int x, y, t; | ||
335 | |||
336 |
2/4✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
|
40 | av_assert0(!(dstStride[0] % 2 || dstStride[1] % 2)); |
337 | |||
338 |
2/2✓ Branch 0 taken 11520 times.
✓ Branch 1 taken 40 times.
|
11560 | for (y = 0; y < srcSliceH; y++) { |
339 | 11520 | uint16_t *tdstY = dstY; | |
340 | 11520 | const uint8_t *tsrc0 = src0; | |
341 |
2/2✓ Branch 0 taken 4055040 times.
✓ Branch 1 taken 11520 times.
|
4066560 | for (x = c->srcW; x > 0; x--) { |
342 | 4055040 | t = *tsrc0++; | |
343 | 4055040 | output_pixel(tdstY++, t << 8); | |
344 | } | ||
345 | 11520 | src0 += srcStride[0]; | |
346 | 11520 | dstY += dstStride[0] / 2; | |
347 | |||
348 |
2/2✓ Branch 0 taken 5760 times.
✓ Branch 1 taken 5760 times.
|
11520 | if (!(y & 1)) { |
349 | 5760 | uint16_t *tdstUV = dstUV; | |
350 | 5760 | const uint8_t *tsrc1 = src1; | |
351 | 5760 | const uint8_t *tsrc2 = src2; | |
352 |
2/2✓ Branch 0 taken 1013760 times.
✓ Branch 1 taken 5760 times.
|
1019520 | for (x = c->srcW / 2; x > 0; x--) { |
353 | 1013760 | t = *tsrc1++; | |
354 | 1013760 | output_pixel(tdstUV++, t << 8); | |
355 | 1013760 | t = *tsrc2++; | |
356 | 1013760 | output_pixel(tdstUV++, t << 8); | |
357 | } | ||
358 | 5760 | src1 += srcStride[1]; | |
359 | 5760 | src2 += srcStride[2]; | |
360 | 5760 | dstUV += dstStride[1] / 2; | |
361 | } | ||
362 | } | ||
363 | |||
364 | 40 | return srcSliceH; | |
365 | } | ||
366 | |||
367 | #undef output_pixel | ||
368 | |||
369 | ✗ | static int planarToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], | |
370 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
371 | uint8_t *const dstParam[], const int dstStride[]) | ||
372 | { | ||
373 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
374 | |||
375 | ✗ | yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], | |
376 | ✗ | srcStride[1], dstStride[0]); | |
377 | |||
378 | ✗ | return srcSliceH; | |
379 | } | ||
380 | |||
381 | ✗ | static int planarToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], | |
382 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
383 | uint8_t *const dstParam[], const int dstStride[]) | ||
384 | { | ||
385 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
386 | |||
387 | ✗ | yv12touyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], | |
388 | ✗ | srcStride[1], dstStride[0]); | |
389 | |||
390 | ✗ | return srcSliceH; | |
391 | } | ||
392 | |||
393 | ✗ | static int yuv422pToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], | |
394 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
395 | uint8_t *const dstParam[], const int dstStride[]) | ||
396 | { | ||
397 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
398 | |||
399 | ✗ | yuv422ptoyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], | |
400 | ✗ | srcStride[1], dstStride[0]); | |
401 | |||
402 | ✗ | return srcSliceH; | |
403 | } | ||
404 | |||
405 | ✗ | static int yuv422pToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], | |
406 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
407 | uint8_t *const dstParam[], const int dstStride[]) | ||
408 | { | ||
409 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
410 | |||
411 | ✗ | yuv422ptouyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], | |
412 | ✗ | srcStride[1], dstStride[0]); | |
413 | |||
414 | ✗ | return srcSliceH; | |
415 | } | ||
416 | |||
417 | ✗ | static int yuyvToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], | |
418 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
419 | uint8_t *const dstParam[], const int dstStride[]) | ||
420 | { | ||
421 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
422 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
423 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
424 | |||
425 | ✗ | yuyvtoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], | |
426 | ✗ | dstStride[1], srcStride[0]); | |
427 | |||
428 | ✗ | if (dstParam[3]) | |
429 | ✗ | fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
430 | |||
431 | ✗ | return srcSliceH; | |
432 | } | ||
433 | |||
434 | ✗ | static int yuyvToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], | |
435 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
436 | uint8_t *const dstParam[], const int dstStride[]) | ||
437 | { | ||
438 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
439 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY; | |
440 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY; | |
441 | |||
442 | ✗ | yuyvtoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], | |
443 | ✗ | dstStride[1], srcStride[0]); | |
444 | |||
445 | ✗ | return srcSliceH; | |
446 | } | ||
447 | |||
448 | ✗ | static int uyvyToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], | |
449 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
450 | uint8_t *const dstParam[], const int dstStride[]) | ||
451 | { | ||
452 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
453 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
454 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
455 | |||
456 | ✗ | uyvytoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], | |
457 | ✗ | dstStride[1], srcStride[0]); | |
458 | |||
459 | ✗ | if (dstParam[3]) | |
460 | ✗ | fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
461 | |||
462 | ✗ | return srcSliceH; | |
463 | } | ||
464 | |||
465 | ✗ | static int uyvyToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], | |
466 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
467 | uint8_t *const dstParam[], const int dstStride[]) | ||
468 | { | ||
469 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
470 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY; | |
471 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY; | |
472 | |||
473 | ✗ | uyvytoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], | |
474 | ✗ | dstStride[1], srcStride[0]); | |
475 | |||
476 | ✗ | return srcSliceH; | |
477 | } | ||
478 | |||
479 | ✗ | static void gray8aToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, | |
480 | const uint8_t *palette) | ||
481 | { | ||
482 | int i; | ||
483 | ✗ | for (i = 0; i < num_pixels; i++) | |
484 | ✗ | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i << 1]] | (src[(i << 1) + 1] << 24); | |
485 | ✗ | } | |
486 | |||
487 | ✗ | static void gray8aToPacked32_1(const uint8_t *src, uint8_t *dst, int num_pixels, | |
488 | const uint8_t *palette) | ||
489 | { | ||
490 | int i; | ||
491 | |||
492 | ✗ | for (i = 0; i < num_pixels; i++) | |
493 | ✗ | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i << 1]] | src[(i << 1) + 1]; | |
494 | ✗ | } | |
495 | |||
496 | ✗ | static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, | |
497 | const uint8_t *palette) | ||
498 | { | ||
499 | int i; | ||
500 | |||
501 | ✗ | for (i = 0; i < num_pixels; i++) { | |
502 | //FIXME slow? | ||
503 | ✗ | dst[0] = palette[src[i << 1] * 4 + 0]; | |
504 | ✗ | dst[1] = palette[src[i << 1] * 4 + 1]; | |
505 | ✗ | dst[2] = palette[src[i << 1] * 4 + 2]; | |
506 | ✗ | dst += 3; | |
507 | } | ||
508 | ✗ | } | |
509 | |||
510 | 1469 | static int bswap_16bpc(SwsInternal *c, const uint8_t *const src[], | |
511 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
512 | uint8_t *const dst[], const int dstStride[]) | ||
513 | { | ||
514 | int i, j, p; | ||
515 | |||
516 |
2/2✓ Branch 0 taken 5876 times.
✓ Branch 1 taken 1469 times.
|
7345 | for (p = 0; p < 4; p++) { |
517 | 5876 | int srcstr = srcStride[p] / 2; | |
518 | 5876 | int dststr = dstStride[p] / 2; | |
519 | 5876 | uint16_t *dstPtr = (uint16_t *) dst[p]; | |
520 | 5876 | const uint16_t *srcPtr = (const uint16_t *) src[p]; | |
521 | 5876 | int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr)); | |
522 |
3/4✓ Branch 0 taken 4407 times.
✓ Branch 1 taken 1469 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4407 times.
|
5876 | if(!dstPtr || !srcPtr) |
523 | 1469 | continue; | |
524 | 4407 | dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; | |
525 |
2/2✓ Branch 0 taken 189824 times.
✓ Branch 1 taken 4407 times.
|
194231 | for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { |
526 |
2/2✓ Branch 0 taken 69253120 times.
✓ Branch 1 taken 189824 times.
|
69442944 | for (j = 0; j < min_stride; j++) { |
527 | 69253120 | dstPtr[j] = av_bswap16(srcPtr[j]); | |
528 | } | ||
529 | 189824 | srcPtr += srcstr; | |
530 | 189824 | dstPtr += dststr; | |
531 | } | ||
532 | } | ||
533 | |||
534 | 1469 | return srcSliceH; | |
535 | } | ||
536 | |||
537 | 13 | static int bswap_32bpc(SwsInternal *c, const uint8_t *const src[], | |
538 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
539 | uint8_t *const dst[], const int dstStride[]) | ||
540 | { | ||
541 | int i, j, p; | ||
542 | |||
543 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 13 times.
|
65 | for (p = 0; p < 4; p++) { |
544 | 52 | int srcstr = srcStride[p] / 4; | |
545 | 52 | int dststr = dstStride[p] / 4; | |
546 | 52 | uint32_t *dstPtr = (uint32_t *) dst[p]; | |
547 | 52 | const uint32_t *srcPtr = (const uint32_t *) src[p]; | |
548 | 52 | int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr)); | |
549 |
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) |
550 | 13 | continue; | |
551 | 39 | dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; | |
552 |
2/2✓ Branch 0 taken 11232 times.
✓ Branch 1 taken 39 times.
|
11271 | for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { |
553 |
2/2✓ Branch 0 taken 3953664 times.
✓ Branch 1 taken 11232 times.
|
3964896 | for (j = 0; j < min_stride; j++) { |
554 | 3953664 | dstPtr[j] = av_bswap32(srcPtr[j]); | |
555 | } | ||
556 | 11232 | srcPtr += srcstr; | |
557 | 11232 | dstPtr += dststr; | |
558 | } | ||
559 | } | ||
560 | |||
561 | 13 | return srcSliceH; | |
562 | } | ||
563 | |||
564 | |||
565 | 32597 | static int palToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], | |
566 | int srcSliceY, int srcSliceH, uint8_t *const dst[], | ||
567 | const int dstStride[]) | ||
568 | { | ||
569 | 32597 | const enum AVPixelFormat srcFormat = c->srcFormat; | |
570 | 32597 | const enum AVPixelFormat dstFormat = c->dstFormat; | |
571 | 32597 | void (*conv)(const uint8_t *src, uint8_t *dst, int num_pixels, | |
572 | const uint8_t *palette) = NULL; | ||
573 | int i; | ||
574 | 32597 | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
575 | 32597 | const uint8_t *srcPtr = src[0]; | |
576 | |||
577 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32597 times.
|
32597 | if (srcFormat == AV_PIX_FMT_YA8) { |
578 | ✗ | switch (dstFormat) { | |
579 | ✗ | case AV_PIX_FMT_RGB32 : conv = gray8aToPacked32; break; | |
580 | ✗ | case AV_PIX_FMT_BGR32 : conv = gray8aToPacked32; break; | |
581 | ✗ | case AV_PIX_FMT_BGR32_1: conv = gray8aToPacked32_1; break; | |
582 | ✗ | case AV_PIX_FMT_RGB32_1: conv = gray8aToPacked32_1; break; | |
583 | ✗ | case AV_PIX_FMT_RGB24 : conv = gray8aToPacked24; break; | |
584 | ✗ | case AV_PIX_FMT_BGR24 : conv = gray8aToPacked24; break; | |
585 | } | ||
586 |
1/2✓ Branch 1 taken 32597 times.
✗ Branch 2 not taken.
|
32597 | } else if (usePal(srcFormat)) { |
587 |
3/7✓ Branch 0 taken 2556 times.
✓ Branch 1 taken 1952 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 28089 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
32597 | switch (dstFormat) { |
588 | 2556 | case AV_PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break; | |
589 | 1952 | case AV_PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break; | |
590 | ✗ | case AV_PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break; | |
591 | ✗ | case AV_PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break; | |
592 | 28089 | case AV_PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break; | |
593 | ✗ | case AV_PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break; | |
594 | } | ||
595 | } | ||
596 | |||
597 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32597 times.
|
32597 | if (!conv) |
598 | ✗ | av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", | |
599 | av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); | ||
600 | else { | ||
601 |
2/2✓ Branch 0 taken 814886 times.
✓ Branch 1 taken 32597 times.
|
847483 | for (i = 0; i < srcSliceH; i++) { |
602 | 814886 | conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb); | |
603 | 814886 | srcPtr += srcStride[0]; | |
604 | 814886 | dstPtr += dstStride[0]; | |
605 | } | ||
606 | } | ||
607 | |||
608 | 32597 | return srcSliceH; | |
609 | } | ||
610 | |||
611 | 2576 | static void packed16togbra16(const uint8_t *src, int srcStride, | |
612 | uint16_t *dst[], const int dstStride[], int srcSliceH, | ||
613 | int src_alpha, int swap, int shift, int width) | ||
614 | { | ||
615 | int x, h, i; | ||
616 | 2576 | int dst_alpha = dst[3] != NULL; | |
617 |
2/2✓ Branch 0 taken 82624 times.
✓ Branch 1 taken 2576 times.
|
85200 | for (h = 0; h < srcSliceH; h++) { |
618 | 82624 | uint16_t *src_line = (uint16_t *)(src + srcStride * h); | |
619 |
3/4✓ Branch 0 taken 256 times.
✓ Branch 1 taken 22464 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 59904 times.
|
82624 | switch (swap) { |
620 | 256 | case 3: | |
621 |
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) { |
622 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 128 times.
|
16512 | for (x = 0; x < width; x++) { |
623 | 16384 | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
624 | 16384 | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
625 | 16384 | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
626 | 16384 | dst[3][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
627 | } | ||
628 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
|
128 | } else if (dst_alpha) { |
629 | ✗ | for (x = 0; x < width; x++) { | |
630 | ✗ | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
631 | ✗ | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
632 | ✗ | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
633 | ✗ | dst[3][x] = 0xFFFF; | |
634 | } | ||
635 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
|
128 | } else if (src_alpha) { |
636 | ✗ | for (x = 0; x < width; x++) { | |
637 | ✗ | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
638 | ✗ | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
639 | ✗ | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
640 | ✗ | src_line++; | |
641 | } | ||
642 | } else { | ||
643 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 128 times.
|
16512 | for (x = 0; x < width; x++) { |
644 | 16384 | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
645 | 16384 | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
646 | 16384 | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
647 | } | ||
648 | } | ||
649 | 256 | break; | |
650 | 22464 | case 2: | |
651 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22464 | if (src_alpha && dst_alpha) { |
652 | ✗ | for (x = 0; x < width; x++) { | |
653 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
654 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
655 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
656 | ✗ | dst[3][x] = av_bswap16(*src_line++ >> shift); | |
657 | } | ||
658 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
|
22464 | } else if (dst_alpha) { |
659 | ✗ | for (x = 0; x < width; x++) { | |
660 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
661 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
662 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
663 | ✗ | dst[3][x] = 0xFFFF; | |
664 | } | ||
665 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
|
22464 | } else if (src_alpha) { |
666 | ✗ | for (x = 0; x < width; x++) { | |
667 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
668 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
669 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
670 | ✗ | src_line++; | |
671 | } | ||
672 | } else { | ||
673 |
2/2✓ Branch 0 taken 7907328 times.
✓ Branch 1 taken 22464 times.
|
7929792 | for (x = 0; x < width; x++) { |
674 | 7907328 | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
675 | 7907328 | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
676 | 7907328 | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
677 | } | ||
678 | } | ||
679 | 22464 | break; | |
680 | ✗ | case 1: | |
681 | ✗ | if (src_alpha && dst_alpha) { | |
682 | ✗ | for (x = 0; x < width; x++) { | |
683 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
684 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
685 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
686 | ✗ | dst[3][x] = av_bswap16(*src_line++) >> shift; | |
687 | } | ||
688 | ✗ | } else if (dst_alpha) { | |
689 | ✗ | for (x = 0; x < width; x++) { | |
690 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
691 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
692 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
693 | ✗ | dst[3][x] = 0xFFFF; | |
694 | } | ||
695 | ✗ | } else if (src_alpha) { | |
696 | ✗ | for (x = 0; x < width; x++) { | |
697 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
698 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
699 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
700 | ✗ | src_line++; | |
701 | } | ||
702 | } else { | ||
703 | ✗ | for (x = 0; x < width; x++) { | |
704 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
705 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
706 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
707 | } | ||
708 | } | ||
709 | ✗ | break; | |
710 | 59904 | default: | |
711 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 59904 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
59904 | if (src_alpha && dst_alpha) { |
712 | ✗ | for (x = 0; x < width; x++) { | |
713 | ✗ | dst[0][x] = *src_line++ >> shift; | |
714 | ✗ | dst[1][x] = *src_line++ >> shift; | |
715 | ✗ | dst[2][x] = *src_line++ >> shift; | |
716 | ✗ | dst[3][x] = *src_line++ >> shift; | |
717 | } | ||
718 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59904 times.
|
59904 | } else if (dst_alpha) { |
719 | ✗ | for (x = 0; x < width; x++) { | |
720 | ✗ | dst[0][x] = *src_line++ >> shift; | |
721 | ✗ | dst[1][x] = *src_line++ >> shift; | |
722 | ✗ | dst[2][x] = *src_line++ >> shift; | |
723 | ✗ | dst[3][x] = 0xFFFF; | |
724 | } | ||
725 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59904 times.
|
59904 | } else if (src_alpha) { |
726 | ✗ | for (x = 0; x < width; x++) { | |
727 | ✗ | dst[0][x] = *src_line++ >> shift; | |
728 | ✗ | dst[1][x] = *src_line++ >> shift; | |
729 | ✗ | dst[2][x] = *src_line++ >> shift; | |
730 | ✗ | src_line++; | |
731 | } | ||
732 | } else { | ||
733 |
2/2✓ Branch 0 taken 21086208 times.
✓ Branch 1 taken 59904 times.
|
21146112 | for (x = 0; x < width; x++) { |
734 | 21086208 | dst[0][x] = *src_line++ >> shift; | |
735 | 21086208 | dst[1][x] = *src_line++ >> shift; | |
736 | 21086208 | dst[2][x] = *src_line++ >> shift; | |
737 | } | ||
738 | } | ||
739 | } | ||
740 |
2/2✓ Branch 0 taken 330496 times.
✓ Branch 1 taken 82624 times.
|
413120 | for (i = 0; i < 4; i++) |
741 | 330496 | dst[i] += dstStride[i] >> 1; | |
742 | } | ||
743 | 2576 | } | |
744 | |||
745 | 936 | static void packed30togbra10(const uint8_t *src, int srcStride, | |
746 | uint16_t *dst[], const int dstStride[], int srcSliceH, | ||
747 | int swap, int bpc, int width) | ||
748 | { | ||
749 | int x, h, i; | ||
750 | 936 | int dst_alpha = dst[3] != NULL; | |
751 | 936 | int scale_high = bpc - 10, scale_low = 10 - scale_high; | |
752 |
2/2✓ Branch 0 taken 29952 times.
✓ Branch 1 taken 936 times.
|
30888 | for (h = 0; h < srcSliceH; h++) { |
753 | 29952 | uint32_t *src_line = (uint32_t *)(src + srcStride * h); | |
754 | unsigned component; | ||
755 | |||
756 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29952 times.
|
29952 | switch (swap) { |
757 | ✗ | case 3: | |
758 | case 2: | ||
759 | ✗ | if (dst_alpha) { | |
760 | ✗ | for (x = 0; x < width; x++) { | |
761 | ✗ | unsigned p = AV_RL32(src_line); | |
762 | ✗ | component = (p >> 20) & 0x3FF; | |
763 | ✗ | dst[0][x] = av_bswap16(component << scale_high | component >> scale_low); | |
764 | ✗ | component = (p >> 10) & 0x3FF; | |
765 | ✗ | dst[1][x] = av_bswap16(component << scale_high | component >> scale_low); | |
766 | ✗ | component = p & 0x3FF; | |
767 | ✗ | dst[2][x] = av_bswap16(component << scale_high | component >> scale_low); | |
768 | ✗ | dst[3][x] = 0xFFFF; | |
769 | ✗ | src_line++; | |
770 | } | ||
771 | } else { | ||
772 | ✗ | for (x = 0; x < width; x++) { | |
773 | ✗ | unsigned p = AV_RL32(src_line); | |
774 | ✗ | component = (p >> 20) & 0x3FF; | |
775 | ✗ | dst[0][x] = av_bswap16(component << scale_high | component >> scale_low); | |
776 | ✗ | component = (p >> 10) & 0x3FF; | |
777 | ✗ | dst[1][x] = av_bswap16(component << scale_high | component >> scale_low); | |
778 | ✗ | component = p & 0x3FF; | |
779 | ✗ | dst[2][x] = av_bswap16(component << scale_high | component >> scale_low); | |
780 | ✗ | src_line++; | |
781 | } | ||
782 | } | ||
783 | ✗ | break; | |
784 | 29952 | default: | |
785 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29952 times.
|
29952 | if (dst_alpha) { |
786 | ✗ | for (x = 0; x < width; x++) { | |
787 | ✗ | unsigned p = AV_RL32(src_line); | |
788 | ✗ | component = (p >> 20) & 0x3FF; | |
789 | ✗ | dst[0][x] = component << scale_high | component >> scale_low; | |
790 | ✗ | component = (p >> 10) & 0x3FF; | |
791 | ✗ | dst[1][x] = component << scale_high | component >> scale_low; | |
792 | ✗ | component = p & 0x3FF; | |
793 | ✗ | dst[2][x] = component << scale_high | component >> scale_low; | |
794 | ✗ | dst[3][x] = 0xFFFF; | |
795 | ✗ | src_line++; | |
796 | } | ||
797 | } else { | ||
798 |
2/2✓ Branch 0 taken 10543104 times.
✓ Branch 1 taken 29952 times.
|
10573056 | for (x = 0; x < width; x++) { |
799 | 10543104 | unsigned p = AV_RL32(src_line); | |
800 | 10543104 | component = (p >> 20) & 0x3FF; | |
801 | 10543104 | dst[0][x] = component << scale_high | component >> scale_low; | |
802 | 10543104 | component = (p >> 10) & 0x3FF; | |
803 | 10543104 | dst[1][x] = component << scale_high | component >> scale_low; | |
804 | 10543104 | component = p & 0x3FF; | |
805 | 10543104 | dst[2][x] = component << scale_high | component >> scale_low; | |
806 | 10543104 | src_line++; | |
807 | } | ||
808 | } | ||
809 | 29952 | break; | |
810 | } | ||
811 |
2/2✓ Branch 0 taken 119808 times.
✓ Branch 1 taken 29952 times.
|
149760 | for (i = 0; i < 4; i++) |
812 | 119808 | dst[i] += dstStride[i] >> 1; | |
813 | } | ||
814 | 936 | } | |
815 | |||
816 | 3512 | static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], | |
817 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
818 | uint8_t *const dst[], const int dstStride[]) | ||
819 | { | ||
820 | 3512 | uint16_t *dst2013[] = { (uint16_t *)dst[2], (uint16_t *)dst[0], (uint16_t *)dst[1], (uint16_t *)dst[3] }; | |
821 | 3512 | uint16_t *dst1023[] = { (uint16_t *)dst[1], (uint16_t *)dst[0], (uint16_t *)dst[2], (uint16_t *)dst[3] }; | |
822 | 3512 | int stride2013[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] }; | |
823 | 3512 | int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] }; | |
824 | 3512 | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat); | |
825 | 3512 | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat); | |
826 | 3512 | int bpc = dst_format->comp[0].depth; | |
827 | 3512 | int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA; | |
828 | 3512 | int swap = 0; | |
829 | int i; | ||
830 | |||
831 | 3512 | if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) || | |
832 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3510 times.
|
3512 | !HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE) |
833 | 2 | swap++; | |
834 | 3512 | if ( HAVE_BIGENDIAN && !(dst_format->flags & AV_PIX_FMT_FLAG_BE) || | |
835 |
2/2✓ Branch 0 taken 704 times.
✓ Branch 1 taken 2808 times.
|
3512 | !HAVE_BIGENDIAN && dst_format->flags & AV_PIX_FMT_FLAG_BE) |
836 | 704 | swap += 2; | |
837 | |||
838 |
1/2✓ Branch 0 taken 3512 times.
✗ Branch 1 not taken.
|
3512 | if ((dst_format->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) != |
839 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3512 times.
|
3512 | (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB) || bpc < 9) { |
840 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported conversion to planar RGB %s -> %s\n", | |
841 | ✗ | src_format->name, dst_format->name); | |
842 | ✗ | return srcSliceH; | |
843 | } | ||
844 | |||
845 |
2/2✓ Branch 0 taken 14048 times.
✓ Branch 1 taken 3512 times.
|
17560 | for(i=0; i<4; i++) { |
846 | 14048 | dst2013[i] += stride2013[i] * srcSliceY / 2; | |
847 | 14048 | dst1023[i] += stride1023[i] * srcSliceY / 2; | |
848 | } | ||
849 | |||
850 |
3/5✓ Branch 0 taken 2576 times.
✓ Branch 1 taken 468 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 468 times.
✗ Branch 4 not taken.
|
3512 | switch (c->srcFormat) { |
851 | 2576 | case AV_PIX_FMT_RGB48LE: | |
852 | case AV_PIX_FMT_RGB48BE: | ||
853 | case AV_PIX_FMT_RGBA64LE: | ||
854 | case AV_PIX_FMT_RGBA64BE: | ||
855 | 2576 | packed16togbra16(src[0], srcStride[0], | |
856 | dst2013, stride2013, srcSliceH, alpha, swap, | ||
857 | 16 - bpc, c->srcW); | ||
858 | 2576 | break; | |
859 | 468 | case AV_PIX_FMT_X2RGB10LE: | |
860 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 468 times.
|
468 | av_assert0(bpc >= 10); |
861 | 468 | packed30togbra10(src[0], srcStride[0], | |
862 | dst2013, stride2013, srcSliceH, swap, | ||
863 | bpc, c->srcW); | ||
864 | 468 | break; | |
865 | ✗ | case AV_PIX_FMT_BGR48LE: | |
866 | case AV_PIX_FMT_BGR48BE: | ||
867 | case AV_PIX_FMT_BGRA64LE: | ||
868 | case AV_PIX_FMT_BGRA64BE: | ||
869 | ✗ | packed16togbra16(src[0], srcStride[0], | |
870 | dst1023, stride1023, srcSliceH, alpha, swap, | ||
871 | 16 - bpc, c->srcW); | ||
872 | ✗ | break; | |
873 | 468 | case AV_PIX_FMT_X2BGR10LE: | |
874 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 468 times.
|
468 | av_assert0(bpc >= 10); |
875 | 468 | packed30togbra10(src[0], srcStride[0], | |
876 | dst1023, stride1023, srcSliceH, swap, | ||
877 | bpc, c->srcW); | ||
878 | 468 | break; | |
879 | ✗ | default: | |
880 | ✗ | av_log(c, AV_LOG_ERROR, | |
881 | "unsupported conversion to planar RGB %s -> %s\n", | ||
882 | ✗ | src_format->name, dst_format->name); | |
883 | } | ||
884 | |||
885 | 3512 | return srcSliceH; | |
886 | } | ||
887 | |||
888 | 2614 | static void gbr16ptopacked16(const uint16_t *src[], const int srcStride[], | |
889 | uint8_t *dst, int dstStride, int srcSliceH, | ||
890 | int alpha, int swap, int bpp, int width) | ||
891 | { | ||
892 | int x, h, i; | ||
893 | 2614 | int src_alpha = src[3] != NULL; | |
894 | 2614 | int scale_high = 16 - bpp, scale_low = (bpp - 8) * 2; | |
895 |
2/2✓ Branch 0 taken 87552 times.
✓ Branch 1 taken 2614 times.
|
90166 | for (h = 0; h < srcSliceH; h++) { |
896 | 87552 | uint16_t *dest = (uint16_t *)(dst + dstStride * h); | |
897 | uint16_t component; | ||
898 | |||
899 |
2/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 22464 times.
✓ Branch 3 taken 65088 times.
|
87552 | switch(swap) { |
900 | ✗ | case 3: | |
901 | ✗ | if (alpha && !src_alpha) { | |
902 | ✗ | for (x = 0; x < width; x++) { | |
903 | ✗ | component = av_bswap16(src[0][x]); | |
904 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
905 | ✗ | component = av_bswap16(src[1][x]); | |
906 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
907 | ✗ | component = av_bswap16(src[2][x]); | |
908 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
909 | ✗ | *dest++ = 0xffff; | |
910 | } | ||
911 | ✗ | } else if (alpha && src_alpha) { | |
912 | ✗ | for (x = 0; x < width; x++) { | |
913 | ✗ | component = av_bswap16(src[0][x]); | |
914 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
915 | ✗ | component = av_bswap16(src[1][x]); | |
916 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
917 | ✗ | component = av_bswap16(src[2][x]); | |
918 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
919 | ✗ | component = av_bswap16(src[3][x]); | |
920 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
921 | } | ||
922 | } else { | ||
923 | ✗ | for (x = 0; x < width; x++) { | |
924 | ✗ | component = av_bswap16(src[0][x]); | |
925 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
926 | ✗ | component = av_bswap16(src[1][x]); | |
927 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
928 | ✗ | component = av_bswap16(src[2][x]); | |
929 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
930 | } | ||
931 | } | ||
932 | ✗ | break; | |
933 | ✗ | case 2: | |
934 | ✗ | if (alpha && !src_alpha) { | |
935 | ✗ | for (x = 0; x < width; x++) { | |
936 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
937 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
938 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
939 | ✗ | *dest++ = 0xffff; | |
940 | } | ||
941 | ✗ | } else if (alpha && src_alpha) { | |
942 | ✗ | for (x = 0; x < width; x++) { | |
943 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
944 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
945 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
946 | ✗ | *dest++ = av_bswap16(src[3][x] << scale_high | src[3][x] >> scale_low); | |
947 | } | ||
948 | } else { | ||
949 | ✗ | for (x = 0; x < width; x++) { | |
950 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
951 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
952 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
953 | } | ||
954 | } | ||
955 | ✗ | break; | |
956 | 22464 | case 1: | |
957 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22464 | if (alpha && !src_alpha) { |
958 | ✗ | for (x = 0; x < width; x++) { | |
959 | ✗ | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
960 | ✗ | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
961 | ✗ | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
962 | ✗ | *dest++ = 0xffff; | |
963 | } | ||
964 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22464 | } else if (alpha && src_alpha) { |
965 | ✗ | for (x = 0; x < width; x++) { | |
966 | ✗ | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
967 | ✗ | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
968 | ✗ | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
969 | ✗ | *dest++ = av_bswap16(src[3][x]) << scale_high | av_bswap16(src[3][x]) >> scale_low; | |
970 | } | ||
971 | } else { | ||
972 |
2/2✓ Branch 0 taken 7907328 times.
✓ Branch 1 taken 22464 times.
|
7929792 | for (x = 0; x < width; x++) { |
973 | 7907328 | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
974 | 7907328 | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
975 | 7907328 | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
976 | } | ||
977 | } | ||
978 | 22464 | break; | |
979 | 65088 | default: | |
980 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 65088 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
65088 | if (alpha && !src_alpha) { |
981 | ✗ | for (x = 0; x < width; x++) { | |
982 | ✗ | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
983 | ✗ | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
984 | ✗ | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
985 | ✗ | *dest++ = 0xffff; | |
986 | } | ||
987 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 65088 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
65088 | } else if (alpha && src_alpha) { |
988 | ✗ | for (x = 0; x < width; x++) { | |
989 | ✗ | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
990 | ✗ | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
991 | ✗ | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
992 | ✗ | *dest++ = src[3][x] << scale_high | src[3][x] >> scale_low; | |
993 | } | ||
994 | } else { | ||
995 |
2/2✓ Branch 0 taken 23325696 times.
✓ Branch 1 taken 65088 times.
|
23390784 | for (x = 0; x < width; x++) { |
996 | 23325696 | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
997 | 23325696 | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
998 | 23325696 | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
999 | } | ||
1000 | } | ||
1001 | } | ||
1002 |
2/2✓ Branch 0 taken 262656 times.
✓ Branch 1 taken 87552 times.
|
350208 | for (i = 0; i < 3 + src_alpha; i++) |
1003 | 262656 | src[i] += srcStride[i] >> 1; | |
1004 | } | ||
1005 | 2614 | } | |
1006 | |||
1007 | 936 | static void gbr16ptopacked30(const uint16_t *src[], const int srcStride[], | |
1008 | uint8_t *dst, int dstStride, int srcSliceH, | ||
1009 | int swap, int bpp, int width) | ||
1010 | { | ||
1011 | int x, h, i; | ||
1012 | 936 | int shift = bpp - 10; | |
1013 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 936 times.
|
936 | av_assert0(bpp >= 0); |
1014 |
2/2✓ Branch 0 taken 29952 times.
✓ Branch 1 taken 936 times.
|
30888 | for (h = 0; h < srcSliceH; h++) { |
1015 | 29952 | uint8_t *dest = dst + dstStride * h; | |
1016 | |||
1017 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29952 times.
|
29952 | switch(swap) { |
1018 | ✗ | case 3: | |
1019 | case 1: | ||
1020 | ✗ | for (x = 0; x < width; x++) { | |
1021 | ✗ | unsigned C0 = av_bswap16(src[0][x]) >> shift; | |
1022 | ✗ | unsigned C1 = av_bswap16(src[1][x]) >> shift; | |
1023 | ✗ | unsigned C2 = av_bswap16(src[2][x]) >> shift; | |
1024 | ✗ | AV_WL32(dest + 4 * x, (3U << 30) + (C0 << 20) + (C1 << 10) + C2); | |
1025 | } | ||
1026 | ✗ | break; | |
1027 | 29952 | default: | |
1028 |
2/2✓ Branch 0 taken 10543104 times.
✓ Branch 1 taken 29952 times.
|
10573056 | for (x = 0; x < width; x++) { |
1029 | 10543104 | unsigned C0 = src[0][x] >> shift; | |
1030 | 10543104 | unsigned C1 = src[1][x] >> shift; | |
1031 | 10543104 | unsigned C2 = src[2][x] >> shift; | |
1032 | 10543104 | AV_WL32(dest + 4 * x, (3U << 30) + (C0 << 20) + (C1 << 10) + C2); | |
1033 | } | ||
1034 | 29952 | break; | |
1035 | } | ||
1036 |
2/2✓ Branch 0 taken 89856 times.
✓ Branch 1 taken 29952 times.
|
119808 | for (i = 0; i < 3; i++) |
1037 | 89856 | src[i] += srcStride[i] >> 1; | |
1038 | } | ||
1039 | 936 | } | |
1040 | |||
1041 | |||
1042 | 3550 | static int planarRgb16ToRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], | |
1043 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1044 | uint8_t *const dst[], const int dstStride[]) | ||
1045 | { | ||
1046 | 3550 | const uint16_t *src102[] = { (uint16_t *)src[1], (uint16_t *)src[0], (uint16_t *)src[2], (uint16_t *)src[3] }; | |
1047 | 3550 | const uint16_t *src201[] = { (uint16_t *)src[2], (uint16_t *)src[0], (uint16_t *)src[1], (uint16_t *)src[3] }; | |
1048 | 3550 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] }; | |
1049 | 3550 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] }; | |
1050 | 3550 | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->srcFormat); | |
1051 | 3550 | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->dstFormat); | |
1052 | 3550 | int bits_per_sample = src_format->comp[0].depth; | |
1053 | 3550 | int swap = 0; | |
1054 | 3550 | if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) || | |
1055 |
2/2✓ Branch 0 taken 702 times.
✓ Branch 1 taken 2848 times.
|
3550 | !HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE) |
1056 | 702 | swap++; | |
1057 | 3550 | if ( HAVE_BIGENDIAN && !(dst_format->flags & AV_PIX_FMT_FLAG_BE) || | |
1058 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3550 times.
|
3550 | !HAVE_BIGENDIAN && dst_format->flags & AV_PIX_FMT_FLAG_BE) |
1059 | ✗ | swap += 2; | |
1060 | |||
1061 |
1/2✓ Branch 0 taken 3550 times.
✗ Branch 1 not taken.
|
3550 | if ((src_format->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) != |
1062 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3550 times.
|
3550 | (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB) || |
1063 | bits_per_sample <= 8) { | ||
1064 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
1065 | ✗ | src_format->name, dst_format->name); | |
1066 | ✗ | return srcSliceH; | |
1067 | } | ||
1068 |
3/7✗ Branch 0 not taken.
✓ Branch 1 taken 2614 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 468 times.
✓ Branch 5 taken 468 times.
✗ Branch 6 not taken.
|
3550 | switch (c->dstFormat) { |
1069 | ✗ | case AV_PIX_FMT_BGR48LE: | |
1070 | case AV_PIX_FMT_BGR48BE: | ||
1071 | ✗ | gbr16ptopacked16(src102, stride102, | |
1072 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1073 | srcSliceH, 0, swap, bits_per_sample, c->srcW); | ||
1074 | ✗ | break; | |
1075 | 2614 | case AV_PIX_FMT_RGB48LE: | |
1076 | case AV_PIX_FMT_RGB48BE: | ||
1077 | 2614 | gbr16ptopacked16(src201, stride201, | |
1078 | 2614 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1079 | srcSliceH, 0, swap, bits_per_sample, c->srcW); | ||
1080 | 2614 | break; | |
1081 | ✗ | case AV_PIX_FMT_RGBA64LE: | |
1082 | case AV_PIX_FMT_RGBA64BE: | ||
1083 | ✗ | gbr16ptopacked16(src201, stride201, | |
1084 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1085 | srcSliceH, 1, swap, bits_per_sample, c->srcW); | ||
1086 | ✗ | break; | |
1087 | ✗ | case AV_PIX_FMT_BGRA64LE: | |
1088 | case AV_PIX_FMT_BGRA64BE: | ||
1089 | ✗ | gbr16ptopacked16(src102, stride102, | |
1090 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1091 | srcSliceH, 1, swap, bits_per_sample, c->srcW); | ||
1092 | ✗ | break; | |
1093 | 468 | case AV_PIX_FMT_X2RGB10LE: | |
1094 | 468 | gbr16ptopacked30(src201, stride201, | |
1095 | 468 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1096 | srcSliceH, swap, bits_per_sample, c->srcW); | ||
1097 | 468 | break; | |
1098 | 468 | case AV_PIX_FMT_X2BGR10LE: | |
1099 | 468 | gbr16ptopacked30(src102, stride102, | |
1100 | 468 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1101 | srcSliceH, swap, bits_per_sample, c->srcW); | ||
1102 | 468 | break; | |
1103 | ✗ | default: | |
1104 | ✗ | av_log(c, AV_LOG_ERROR, | |
1105 | "unsupported planar RGB conversion %s -> %s\n", | ||
1106 | ✗ | src_format->name, dst_format->name); | |
1107 | } | ||
1108 | |||
1109 | 3550 | return srcSliceH; | |
1110 | } | ||
1111 | |||
1112 | 486 | static void gbr24ptopacked24(const uint8_t *src[], const int srcStride[], | |
1113 | uint8_t *dst, int dstStride, int srcSliceH, | ||
1114 | int width) | ||
1115 | { | ||
1116 | int x, h, i; | ||
1117 |
2/2✓ Branch 0 taken 15232 times.
✓ Branch 1 taken 486 times.
|
15718 | for (h = 0; h < srcSliceH; h++) { |
1118 | 15232 | uint8_t *dest = dst + dstStride * h; | |
1119 |
2/2✓ Branch 0 taken 5304320 times.
✓ Branch 1 taken 15232 times.
|
5319552 | for (x = 0; x < width; x++) { |
1120 | 5304320 | *dest++ = src[0][x]; | |
1121 | 5304320 | *dest++ = src[1][x]; | |
1122 | 5304320 | *dest++ = src[2][x]; | |
1123 | } | ||
1124 | |||
1125 |
2/2✓ Branch 0 taken 45696 times.
✓ Branch 1 taken 15232 times.
|
60928 | for (i = 0; i < 3; i++) |
1126 | 45696 | src[i] += srcStride[i]; | |
1127 | } | ||
1128 | 486 | } | |
1129 | |||
1130 | 234 | static void gbr24ptopacked32(const uint8_t *src[], const int srcStride[], | |
1131 | uint8_t *dst, int dstStride, int srcSliceH, | ||
1132 | int alpha_first, int width) | ||
1133 | { | ||
1134 | int x, h, i; | ||
1135 |
2/2✓ Branch 0 taken 7488 times.
✓ Branch 1 taken 234 times.
|
7722 | for (h = 0; h < srcSliceH; h++) { |
1136 | 7488 | uint8_t *dest = dst + dstStride * h; | |
1137 | |||
1138 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7488 times.
|
7488 | if (alpha_first) { |
1139 | ✗ | for (x = 0; x < width; x++) { | |
1140 | ✗ | *dest++ = 0xff; | |
1141 | ✗ | *dest++ = src[0][x]; | |
1142 | ✗ | *dest++ = src[1][x]; | |
1143 | ✗ | *dest++ = src[2][x]; | |
1144 | } | ||
1145 | } else { | ||
1146 |
2/2✓ Branch 0 taken 2635776 times.
✓ Branch 1 taken 7488 times.
|
2643264 | for (x = 0; x < width; x++) { |
1147 | 2635776 | *dest++ = src[0][x]; | |
1148 | 2635776 | *dest++ = src[1][x]; | |
1149 | 2635776 | *dest++ = src[2][x]; | |
1150 | 2635776 | *dest++ = 0xff; | |
1151 | } | ||
1152 | } | ||
1153 | |||
1154 |
2/2✓ Branch 0 taken 22464 times.
✓ Branch 1 taken 7488 times.
|
29952 | for (i = 0; i < 3; i++) |
1155 | 22464 | src[i] += srcStride[i]; | |
1156 | } | ||
1157 | 234 | } | |
1158 | |||
1159 | 225 | static void gbraptopacked32(const uint8_t *src[], const int srcStride[], | |
1160 | uint8_t *dst, int dstStride, int srcSliceH, | ||
1161 | int alpha_first, int width) | ||
1162 | { | ||
1163 | int x, h, i; | ||
1164 |
2/2✓ Branch 0 taken 12000 times.
✓ Branch 1 taken 225 times.
|
12225 | for (h = 0; h < srcSliceH; h++) { |
1165 | 12000 | uint8_t *dest = dst + dstStride * h; | |
1166 | |||
1167 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12000 times.
|
12000 | if (alpha_first) { |
1168 | ✗ | for (x = 0; x < width; x++) { | |
1169 | ✗ | *dest++ = src[3][x]; | |
1170 | ✗ | *dest++ = src[0][x]; | |
1171 | ✗ | *dest++ = src[1][x]; | |
1172 | ✗ | *dest++ = src[2][x]; | |
1173 | } | ||
1174 | } else { | ||
1175 |
2/2✓ Branch 0 taken 8640000 times.
✓ Branch 1 taken 12000 times.
|
8652000 | for (x = 0; x < width; x++) { |
1176 | 8640000 | *dest++ = src[0][x]; | |
1177 | 8640000 | *dest++ = src[1][x]; | |
1178 | 8640000 | *dest++ = src[2][x]; | |
1179 | 8640000 | *dest++ = src[3][x]; | |
1180 | } | ||
1181 | } | ||
1182 | |||
1183 |
2/2✓ Branch 0 taken 48000 times.
✓ Branch 1 taken 12000 times.
|
60000 | for (i = 0; i < 4; i++) |
1184 | 48000 | src[i] += srcStride[i]; | |
1185 | } | ||
1186 | 225 | } | |
1187 | |||
1188 | 234 | static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], | |
1189 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1190 | uint8_t *const dst[], const int dstStride[]) | ||
1191 | { | ||
1192 | 234 | int alpha_first = 0; | |
1193 | 234 | const uint8_t *src102[] = { src[1], src[0], src[2], src[3] }; | |
1194 | 234 | const uint8_t *src201[] = { src[2], src[0], src[1], src[3] }; | |
1195 | 234 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] }; | |
1196 | 234 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] }; | |
1197 | |||
1198 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 234 times.
|
234 | if (c->srcFormat != AV_PIX_FMT_GBRAP) { |
1199 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
1200 | av_get_pix_fmt_name(c->srcFormat), | ||
1201 | av_get_pix_fmt_name(c->dstFormat)); | ||
1202 | ✗ | return srcSliceH; | |
1203 | } | ||
1204 | |||
1205 |
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) { |
1206 | ✗ | case AV_PIX_FMT_BGR24: | |
1207 | ✗ | gbr24ptopacked24(src102, stride102, | |
1208 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1209 | srcSliceH, c->srcW); | ||
1210 | ✗ | break; | |
1211 | |||
1212 | 9 | case AV_PIX_FMT_RGB24: | |
1213 | 9 | gbr24ptopacked24(src201, stride201, | |
1214 | 9 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1215 | srcSliceH, c->srcW); | ||
1216 | 9 | break; | |
1217 | |||
1218 | ✗ | case AV_PIX_FMT_ARGB: | |
1219 | ✗ | alpha_first = 1; | |
1220 | ✗ | case AV_PIX_FMT_RGBA: | |
1221 | ✗ | gbraptopacked32(src201, stride201, | |
1222 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1223 | srcSliceH, alpha_first, c->srcW); | ||
1224 | ✗ | break; | |
1225 | |||
1226 | ✗ | case AV_PIX_FMT_ABGR: | |
1227 | ✗ | alpha_first = 1; | |
1228 | 225 | case AV_PIX_FMT_BGRA: | |
1229 | 225 | gbraptopacked32(src102, stride102, | |
1230 | 225 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1231 | srcSliceH, alpha_first, c->srcW); | ||
1232 | 225 | break; | |
1233 | |||
1234 | ✗ | default: | |
1235 | ✗ | av_log(c, AV_LOG_ERROR, | |
1236 | "unsupported planar RGB conversion %s -> %s\n", | ||
1237 | av_get_pix_fmt_name(c->srcFormat), | ||
1238 | av_get_pix_fmt_name(c->dstFormat)); | ||
1239 | } | ||
1240 | |||
1241 | 234 | return srcSliceH; | |
1242 | } | ||
1243 | |||
1244 | 711 | static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], | |
1245 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1246 | uint8_t *const dst[], const int dstStride[]) | ||
1247 | { | ||
1248 | 711 | int alpha_first = 0; | |
1249 | 711 | const uint8_t *src102[] = { src[1], src[0], src[2] }; | |
1250 | 711 | const uint8_t *src201[] = { src[2], src[0], src[1] }; | |
1251 | 711 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2] }; | |
1252 | 711 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1] }; | |
1253 | |||
1254 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 711 times.
|
711 | if (c->srcFormat != AV_PIX_FMT_GBRP) { |
1255 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
1256 | av_get_pix_fmt_name(c->srcFormat), | ||
1257 | av_get_pix_fmt_name(c->dstFormat)); | ||
1258 | ✗ | return srcSliceH; | |
1259 | } | ||
1260 | |||
1261 |
3/7✓ Branch 0 taken 234 times.
✓ Branch 1 taken 243 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 234 times.
✗ Branch 6 not taken.
|
711 | switch (c->dstFormat) { |
1262 | 234 | case AV_PIX_FMT_BGR24: | |
1263 | 234 | gbr24ptopacked24(src102, stride102, | |
1264 | 234 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1265 | srcSliceH, c->srcW); | ||
1266 | 234 | break; | |
1267 | |||
1268 | 243 | case AV_PIX_FMT_RGB24: | |
1269 | 243 | gbr24ptopacked24(src201, stride201, | |
1270 | 243 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1271 | srcSliceH, c->srcW); | ||
1272 | 243 | break; | |
1273 | |||
1274 | ✗ | case AV_PIX_FMT_ARGB: | |
1275 | ✗ | alpha_first = 1; | |
1276 | ✗ | case AV_PIX_FMT_RGBA: | |
1277 | ✗ | gbr24ptopacked32(src201, stride201, | |
1278 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1279 | srcSliceH, alpha_first, c->srcW); | ||
1280 | ✗ | break; | |
1281 | |||
1282 | ✗ | case AV_PIX_FMT_ABGR: | |
1283 | ✗ | alpha_first = 1; | |
1284 | 234 | case AV_PIX_FMT_BGRA: | |
1285 | 234 | gbr24ptopacked32(src102, stride102, | |
1286 | 234 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
1287 | srcSliceH, alpha_first, c->srcW); | ||
1288 | 234 | break; | |
1289 | |||
1290 | ✗ | default: | |
1291 | ✗ | av_log(c, AV_LOG_ERROR, | |
1292 | "unsupported planar RGB conversion %s -> %s\n", | ||
1293 | av_get_pix_fmt_name(c->srcFormat), | ||
1294 | av_get_pix_fmt_name(c->dstFormat)); | ||
1295 | } | ||
1296 | |||
1297 | 711 | return srcSliceH; | |
1298 | } | ||
1299 | |||
1300 | 45 | static int planarRgbToplanarRgbWrapper(SwsInternal *c, | |
1301 | const uint8_t *const src[], const int srcStride[], | ||
1302 | int srcSliceY, int srcSliceH, | ||
1303 | uint8_t *const dst[], const int dstStride[]) | ||
1304 | { | ||
1305 | 45 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
1306 | dst[0], dstStride[0]); | ||
1307 | 45 | ff_copyPlane(src[1], srcStride[1], srcSliceY, srcSliceH, c->srcW, | |
1308 | 45 | dst[1], dstStride[1]); | |
1309 | 45 | ff_copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->srcW, | |
1310 | 45 | dst[2], dstStride[2]); | |
1311 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if (dst[3]) |
1312 | ✗ | fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
1313 | |||
1314 | 45 | return srcSliceH; | |
1315 | } | ||
1316 | |||
1317 | 991 | static void packedtogbr24p(const uint8_t *src, int srcStride, | |
1318 | uint8_t *const dst[], const int dstStride[], int srcSliceH, | ||
1319 | int alpha_first, int inc_size, int width) | ||
1320 | { | ||
1321 | uint8_t *dest[3]; | ||
1322 | int x, h; | ||
1323 | |||
1324 | 991 | dest[0] = dst[0]; | |
1325 | 991 | dest[1] = dst[1]; | |
1326 | 991 | dest[2] = dst[2]; | |
1327 | |||
1328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 991 times.
|
991 | if (alpha_first) |
1329 | ✗ | src++; | |
1330 | |||
1331 |
2/2✓ Branch 0 taken 28848 times.
✓ Branch 1 taken 991 times.
|
29839 | for (h = 0; h < srcSliceH; h++) { |
1332 |
2/2✓ Branch 0 taken 9756480 times.
✓ Branch 1 taken 28848 times.
|
9785328 | for (x = 0; x < width; x++) { |
1333 | 9756480 | dest[0][x] = src[0]; | |
1334 | 9756480 | dest[1][x] = src[1]; | |
1335 | 9756480 | dest[2][x] = src[2]; | |
1336 | |||
1337 | 9756480 | src += inc_size; | |
1338 | } | ||
1339 | 28848 | src += srcStride - width * inc_size; | |
1340 | 28848 | dest[0] += dstStride[0]; | |
1341 | 28848 | dest[1] += dstStride[1]; | |
1342 | 28848 | dest[2] += dstStride[2]; | |
1343 | } | ||
1344 | 991 | } | |
1345 | |||
1346 | 991 | static int rgbToPlanarRgbWrapper(SwsInternal *c, const uint8_t *const src[], | |
1347 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1348 | uint8_t *const dst[], const int dstStride[]) | ||
1349 | { | ||
1350 | 991 | int alpha_first = 0; | |
1351 | 991 | int stride102[] = { dstStride[1], dstStride[0], dstStride[2] }; | |
1352 | 991 | int stride201[] = { dstStride[2], dstStride[0], dstStride[1] }; | |
1353 | 991 | uint8_t *dst102[] = { dst[1] + srcSliceY * dstStride[1], | |
1354 | 991 | dst[0] + srcSliceY * dstStride[0], | |
1355 | 991 | dst[2] + srcSliceY * dstStride[2] }; | |
1356 | 991 | uint8_t *dst201[] = { dst[2] + srcSliceY * dstStride[2], | |
1357 | 991 | dst[0] + srcSliceY * dstStride[0], | |
1358 | 991 | dst[1] + srcSliceY * dstStride[1] }; | |
1359 | |||
1360 |
3/7✓ Branch 0 taken 523 times.
✓ Branch 1 taken 234 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 234 times.
✗ Branch 6 not taken.
|
991 | switch (c->srcFormat) { |
1361 | 523 | case AV_PIX_FMT_RGB24: | |
1362 | 523 | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201, | |
1363 | stride201, srcSliceH, alpha_first, 3, c->srcW); | ||
1364 | 523 | break; | |
1365 | 234 | case AV_PIX_FMT_BGR24: | |
1366 | 234 | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102, | |
1367 | stride102, srcSliceH, alpha_first, 3, c->srcW); | ||
1368 | 234 | break; | |
1369 | ✗ | case AV_PIX_FMT_ARGB: | |
1370 | ✗ | alpha_first = 1; | |
1371 | ✗ | case AV_PIX_FMT_RGBA: | |
1372 | ✗ | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201, | |
1373 | stride201, srcSliceH, alpha_first, 4, c->srcW); | ||
1374 | ✗ | break; | |
1375 | ✗ | case AV_PIX_FMT_ABGR: | |
1376 | ✗ | alpha_first = 1; | |
1377 | 234 | case AV_PIX_FMT_BGRA: | |
1378 | 234 | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102, | |
1379 | stride102, srcSliceH, alpha_first, 4, c->srcW); | ||
1380 | 234 | break; | |
1381 | ✗ | default: | |
1382 | ✗ | av_log(c, AV_LOG_ERROR, | |
1383 | "unsupported planar RGB conversion %s -> %s\n", | ||
1384 | av_get_pix_fmt_name(c->srcFormat), | ||
1385 | av_get_pix_fmt_name(c->dstFormat)); | ||
1386 | } | ||
1387 | |||
1388 | 991 | return srcSliceH; | |
1389 | } | ||
1390 | |||
1391 | ✗ | static void packed24togbrap(const uint8_t *src, int srcStride, | |
1392 | uint8_t *const dst[], const int dstStride[], | ||
1393 | int srcSliceH, int width) | ||
1394 | { | ||
1395 | uint8_t *dest[4]; | ||
1396 | int x, h; | ||
1397 | |||
1398 | ✗ | dest[0] = dst[0]; | |
1399 | ✗ | dest[1] = dst[1]; | |
1400 | ✗ | dest[2] = dst[2]; | |
1401 | ✗ | dest[3] = dst[3]; | |
1402 | |||
1403 | ✗ | for (h = 0; h < srcSliceH; h++) { | |
1404 | ✗ | for (x = 0; x < width; x++) { | |
1405 | ✗ | dest[0][x] = src[x * 3 + 0]; | |
1406 | ✗ | dest[1][x] = src[x * 3 + 1]; | |
1407 | ✗ | dest[2][x] = src[x * 3 + 2]; | |
1408 | ✗ | dest[3][x] = 0xff; | |
1409 | } | ||
1410 | ✗ | src += srcStride; | |
1411 | ✗ | dest[0] += dstStride[0]; | |
1412 | ✗ | dest[1] += dstStride[1]; | |
1413 | ✗ | dest[2] += dstStride[2]; | |
1414 | ✗ | dest[3] += dstStride[3]; | |
1415 | } | ||
1416 | ✗ | } | |
1417 | |||
1418 | 117 | static void packed32togbrap(const uint8_t *src, int srcStride, | |
1419 | uint8_t *const dst[], const int dstStride[], | ||
1420 | int srcSliceH, int alpha_first, int width) | ||
1421 | { | ||
1422 | uint8_t *dest[4]; | ||
1423 | int x, h; | ||
1424 | |||
1425 | 117 | dest[0] = dst[0]; | |
1426 | 117 | dest[1] = dst[1]; | |
1427 | 117 | dest[2] = dst[2]; | |
1428 | 117 | dest[3] = dst[3]; | |
1429 | |||
1430 |
2/2✓ Branch 0 taken 1204 times.
✓ Branch 1 taken 117 times.
|
1321 | for (h = 0; h < srcSliceH; h++) { |
1431 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1204 times.
|
1204 | if (alpha_first) { |
1432 | ✗ | for (x = 0; x < width; x++) { | |
1433 | ✗ | dest[0][x] = src[x * 4 + 1]; | |
1434 | ✗ | dest[1][x] = src[x * 4 + 2]; | |
1435 | ✗ | dest[2][x] = src[x * 4 + 3]; | |
1436 | ✗ | dest[3][x] = src[x * 4 + 0]; | |
1437 | } | ||
1438 | } else { | ||
1439 |
2/2✓ Branch 0 taken 144032 times.
✓ Branch 1 taken 1204 times.
|
145236 | for (x = 0; x < width; x++) { |
1440 | 144032 | dest[0][x] = src[x * 4 + 0]; | |
1441 | 144032 | dest[1][x] = src[x * 4 + 1]; | |
1442 | 144032 | dest[2][x] = src[x * 4 + 2]; | |
1443 | 144032 | dest[3][x] = src[x * 4 + 3]; | |
1444 | } | ||
1445 | } | ||
1446 | 1204 | src += srcStride; | |
1447 | 1204 | dest[0] += dstStride[0]; | |
1448 | 1204 | dest[1] += dstStride[1]; | |
1449 | 1204 | dest[2] += dstStride[2]; | |
1450 | 1204 | dest[3] += dstStride[3]; | |
1451 | } | ||
1452 | 117 | } | |
1453 | |||
1454 | 117 | static int rgbToPlanarRgbaWrapper(SwsInternal *c, const uint8_t *const src[], | |
1455 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1456 | uint8_t *const dst[], const int dstStride[]) | ||
1457 | { | ||
1458 | 117 | int alpha_first = 0; | |
1459 | 117 | int stride102[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] }; | |
1460 | 117 | int stride201[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] }; | |
1461 | 117 | uint8_t *dst102[] = { dst[1] + srcSliceY * dstStride[1], | |
1462 | 117 | dst[0] + srcSliceY * dstStride[0], | |
1463 | 117 | dst[2] + srcSliceY * dstStride[2], | |
1464 | 117 | dst[3] + srcSliceY * dstStride[3] }; | |
1465 | 117 | uint8_t *dst201[] = { dst[2] + srcSliceY * dstStride[2], | |
1466 | 117 | dst[0] + srcSliceY * dstStride[0], | |
1467 | 117 | dst[1] + srcSliceY * dstStride[1], | |
1468 | 117 | dst[3] + srcSliceY * dstStride[3] }; | |
1469 | |||
1470 |
2/7✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 45 times.
✗ Branch 6 not taken.
|
117 | switch (c->srcFormat) { |
1471 | ✗ | case AV_PIX_FMT_RGB24: | |
1472 | ✗ | packed24togbrap((const uint8_t *) src[0], srcStride[0], dst201, | |
1473 | stride201, srcSliceH, c->srcW); | ||
1474 | ✗ | break; | |
1475 | ✗ | case AV_PIX_FMT_BGR24: | |
1476 | ✗ | packed24togbrap((const uint8_t *) src[0], srcStride[0], dst102, | |
1477 | stride102, srcSliceH, c->srcW); | ||
1478 | ✗ | break; | |
1479 | ✗ | case AV_PIX_FMT_ARGB: | |
1480 | ✗ | alpha_first = 1; | |
1481 | 72 | case AV_PIX_FMT_RGBA: | |
1482 | 72 | packed32togbrap((const uint8_t *) src[0], srcStride[0], dst201, | |
1483 | stride201, srcSliceH, alpha_first, c->srcW); | ||
1484 | 72 | break; | |
1485 | ✗ | case AV_PIX_FMT_ABGR: | |
1486 | ✗ | alpha_first = 1; | |
1487 | 45 | case AV_PIX_FMT_BGRA: | |
1488 | 45 | packed32togbrap((const uint8_t *) src[0], srcStride[0], dst102, | |
1489 | stride102, srcSliceH, alpha_first, c->srcW); | ||
1490 | 45 | break; | |
1491 | ✗ | default: | |
1492 | ✗ | av_log(c, AV_LOG_ERROR, | |
1493 | "unsupported planar RGB conversion %s -> %s\n", | ||
1494 | av_get_pix_fmt_name(c->srcFormat), | ||
1495 | av_get_pix_fmt_name(c->dstFormat)); | ||
1496 | } | ||
1497 | |||
1498 | 117 | return srcSliceH; | |
1499 | } | ||
1500 | |||
1501 | #define BAYER_GBRG | ||
1502 | #define BAYER_8 | ||
1503 | #define BAYER_RENAME(x) bayer_gbrg8_to_##x | ||
1504 | #include "bayer_template.c" | ||
1505 | |||
1506 | #define BAYER_GBRG | ||
1507 | #define BAYER_16LE | ||
1508 | #define BAYER_RENAME(x) bayer_gbrg16le_to_##x | ||
1509 | #include "bayer_template.c" | ||
1510 | |||
1511 | #define BAYER_GBRG | ||
1512 | #define BAYER_16BE | ||
1513 | #define BAYER_RENAME(x) bayer_gbrg16be_to_##x | ||
1514 | #include "bayer_template.c" | ||
1515 | |||
1516 | #define BAYER_GRBG | ||
1517 | #define BAYER_8 | ||
1518 | #define BAYER_RENAME(x) bayer_grbg8_to_##x | ||
1519 | #include "bayer_template.c" | ||
1520 | |||
1521 | #define BAYER_GRBG | ||
1522 | #define BAYER_16LE | ||
1523 | #define BAYER_RENAME(x) bayer_grbg16le_to_##x | ||
1524 | #include "bayer_template.c" | ||
1525 | |||
1526 | #define BAYER_GRBG | ||
1527 | #define BAYER_16BE | ||
1528 | #define BAYER_RENAME(x) bayer_grbg16be_to_##x | ||
1529 | #include "bayer_template.c" | ||
1530 | |||
1531 | #define BAYER_BGGR | ||
1532 | #define BAYER_8 | ||
1533 | #define BAYER_RENAME(x) bayer_bggr8_to_##x | ||
1534 | #include "bayer_template.c" | ||
1535 | |||
1536 | #define BAYER_BGGR | ||
1537 | #define BAYER_16LE | ||
1538 | #define BAYER_RENAME(x) bayer_bggr16le_to_##x | ||
1539 | #include "bayer_template.c" | ||
1540 | |||
1541 | #define BAYER_BGGR | ||
1542 | #define BAYER_16BE | ||
1543 | #define BAYER_RENAME(x) bayer_bggr16be_to_##x | ||
1544 | #include "bayer_template.c" | ||
1545 | |||
1546 | #define BAYER_RGGB | ||
1547 | #define BAYER_8 | ||
1548 | #define BAYER_RENAME(x) bayer_rggb8_to_##x | ||
1549 | #include "bayer_template.c" | ||
1550 | |||
1551 | #define BAYER_RGGB | ||
1552 | #define BAYER_16LE | ||
1553 | #define BAYER_RENAME(x) bayer_rggb16le_to_##x | ||
1554 | #include "bayer_template.c" | ||
1555 | |||
1556 | #define BAYER_RGGB | ||
1557 | #define BAYER_16BE | ||
1558 | #define BAYER_RENAME(x) bayer_rggb16be_to_##x | ||
1559 | #include "bayer_template.c" | ||
1560 | |||
1561 | ✗ | static int bayer_to_rgb24_wrapper(SwsInternal *c, const uint8_t *const src[], | |
1562 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1563 | uint8_t *const dst[], const int dstStride[]) | ||
1564 | { | ||
1565 | ✗ | uint8_t *dstPtr= dst[0] + srcSliceY * dstStride[0]; | |
1566 | ✗ | const uint8_t *srcPtr= src[0]; | |
1567 | int i; | ||
1568 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
1569 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
1570 | |||
1571 | ✗ | switch(c->srcFormat) { | |
1572 | #define CASE(pixfmt, prefix) \ | ||
1573 | case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \ | ||
1574 | interpolate = bayer_##prefix##_to_rgb24_interpolate; \ | ||
1575 | break; | ||
1576 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
1577 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
1578 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
1579 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
1580 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
1581 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
1582 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
1583 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
1584 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
1585 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
1586 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
1587 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
1588 | #undef CASE | ||
1589 | ✗ | default: return 0; | |
1590 | } | ||
1591 | |||
1592 | ✗ | av_assert0(srcSliceH > 1); | |
1593 | |||
1594 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1595 | ✗ | srcPtr += 2 * srcStride[0]; | |
1596 | ✗ | dstPtr += 2 * dstStride[0]; | |
1597 | |||
1598 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
1599 | ✗ | interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1600 | ✗ | srcPtr += 2 * srcStride[0]; | |
1601 | ✗ | dstPtr += 2 * dstStride[0]; | |
1602 | } | ||
1603 | |||
1604 | ✗ | if (i + 1 == srcSliceH) { | |
1605 | ✗ | copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->srcW); | |
1606 | ✗ | } else if (i < srcSliceH) | |
1607 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1608 | ✗ | return srcSliceH; | |
1609 | } | ||
1610 | |||
1611 | ✗ | static int bayer_to_rgb48_wrapper(SwsInternal *c, const uint8_t *const src[], | |
1612 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1613 | uint8_t *const dst[], const int dstStride[]) | ||
1614 | { | ||
1615 | ✗ | uint8_t *dstPtr= dst[0] + srcSliceY * dstStride[0]; | |
1616 | ✗ | const uint8_t *srcPtr= src[0]; | |
1617 | int i; | ||
1618 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
1619 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
1620 | |||
1621 | ✗ | switch(c->srcFormat) { | |
1622 | #define CASE(pixfmt, prefix) \ | ||
1623 | case pixfmt: copy = bayer_##prefix##_to_rgb48_copy; \ | ||
1624 | interpolate = bayer_##prefix##_to_rgb48_interpolate; \ | ||
1625 | break; | ||
1626 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
1627 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
1628 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
1629 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
1630 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
1631 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
1632 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
1633 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
1634 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
1635 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
1636 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
1637 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
1638 | #undef CASE | ||
1639 | ✗ | default: return 0; | |
1640 | } | ||
1641 | |||
1642 | ✗ | av_assert0(srcSliceH > 1); | |
1643 | |||
1644 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1645 | ✗ | srcPtr += 2 * srcStride[0]; | |
1646 | ✗ | dstPtr += 2 * dstStride[0]; | |
1647 | |||
1648 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
1649 | ✗ | interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1650 | ✗ | srcPtr += 2 * srcStride[0]; | |
1651 | ✗ | dstPtr += 2 * dstStride[0]; | |
1652 | } | ||
1653 | |||
1654 | ✗ | if (i + 1 == srcSliceH) { | |
1655 | ✗ | copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->srcW); | |
1656 | ✗ | } else if (i < srcSliceH) | |
1657 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->srcW); | |
1658 | ✗ | return srcSliceH; | |
1659 | } | ||
1660 | |||
1661 | ✗ | static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], | |
1662 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1663 | uint8_t *const dst[], const int dstStride[]) | ||
1664 | { | ||
1665 | ✗ | const uint8_t *srcPtr= src[0]; | |
1666 | ✗ | uint8_t *dstY= dst[0] + srcSliceY * dstStride[0]; | |
1667 | ✗ | uint8_t *dstU= dst[1] + srcSliceY * dstStride[1] / 2; | |
1668 | ✗ | uint8_t *dstV= dst[2] + srcSliceY * dstStride[2] / 2; | |
1669 | int i; | ||
1670 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dstY, uint8_t *dstU, uint8_t *dstV, int luma_stride, int width, const int32_t *rgb2yuv); | ||
1671 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dstY, uint8_t *dstU, uint8_t *dstV, int luma_stride, int width, const int32_t *rgb2yuv); | ||
1672 | |||
1673 | ✗ | switch(c->srcFormat) { | |
1674 | #define CASE(pixfmt, prefix) \ | ||
1675 | case pixfmt: copy = bayer_##prefix##_to_yv12_copy; \ | ||
1676 | interpolate = bayer_##prefix##_to_yv12_interpolate; \ | ||
1677 | break; | ||
1678 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
1679 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
1680 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
1681 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
1682 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
1683 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
1684 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
1685 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
1686 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
1687 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
1688 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
1689 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
1690 | #undef CASE | ||
1691 | ✗ | default: return 0; | |
1692 | } | ||
1693 | |||
1694 | ✗ | av_assert0(srcSliceH > 1); | |
1695 | |||
1696 | ✗ | copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table); | |
1697 | ✗ | srcPtr += 2 * srcStride[0]; | |
1698 | ✗ | dstY += 2 * dstStride[0]; | |
1699 | ✗ | dstU += dstStride[1]; | |
1700 | ✗ | dstV += dstStride[1]; | |
1701 | |||
1702 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
1703 | ✗ | interpolate(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table); | |
1704 | ✗ | srcPtr += 2 * srcStride[0]; | |
1705 | ✗ | dstY += 2 * dstStride[0]; | |
1706 | ✗ | dstU += dstStride[1]; | |
1707 | ✗ | dstV += dstStride[1]; | |
1708 | } | ||
1709 | |||
1710 | ✗ | if (i + 1 == srcSliceH) { | |
1711 | ✗ | copy(srcPtr, -srcStride[0], dstY, dstU, dstV, -dstStride[0], c->srcW, c->input_rgb2yuv_table); | |
1712 | ✗ | } else if (i < srcSliceH) | |
1713 | ✗ | copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->srcW, c->input_rgb2yuv_table); | |
1714 | ✗ | return srcSliceH; | |
1715 | } | ||
1716 | |||
1717 | #define isRGBA32(x) ( \ | ||
1718 | (x) == AV_PIX_FMT_ARGB \ | ||
1719 | || (x) == AV_PIX_FMT_RGBA \ | ||
1720 | || (x) == AV_PIX_FMT_BGRA \ | ||
1721 | || (x) == AV_PIX_FMT_ABGR \ | ||
1722 | ) | ||
1723 | |||
1724 | #define isRGBA64(x) ( \ | ||
1725 | (x) == AV_PIX_FMT_RGBA64LE \ | ||
1726 | || (x) == AV_PIX_FMT_RGBA64BE \ | ||
1727 | || (x) == AV_PIX_FMT_BGRA64LE \ | ||
1728 | || (x) == AV_PIX_FMT_BGRA64BE \ | ||
1729 | ) | ||
1730 | |||
1731 | #define isRGB48(x) ( \ | ||
1732 | (x) == AV_PIX_FMT_RGB48LE \ | ||
1733 | || (x) == AV_PIX_FMT_RGB48BE \ | ||
1734 | || (x) == AV_PIX_FMT_BGR48LE \ | ||
1735 | || (x) == AV_PIX_FMT_BGR48BE \ | ||
1736 | ) | ||
1737 | |||
1738 | #define isAYUV(x) ( \ | ||
1739 | (x) == AV_PIX_FMT_AYUV \ | ||
1740 | || (x) == AV_PIX_FMT_VUYA \ | ||
1741 | || (x) == AV_PIX_FMT_VUYX \ | ||
1742 | || (x) == AV_PIX_FMT_UYVA \ | ||
1743 | ) | ||
1744 | |||
1745 | #define isX2RGB(x) ( \ | ||
1746 | (x) == AV_PIX_FMT_X2RGB10LE \ | ||
1747 | || (x) == AV_PIX_FMT_X2BGR10LE \ | ||
1748 | ) | ||
1749 | |||
1750 | /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ | ||
1751 | typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int); | ||
1752 | 20736 | static rgbConvFn findRgbConvFn(SwsInternal *c) | |
1753 | { | ||
1754 | 20736 | const enum AVPixelFormat srcFormat = c->srcFormat; | |
1755 | 20736 | const enum AVPixelFormat dstFormat = c->dstFormat; | |
1756 | 20736 | const int srcId = c->srcFormatBpp; | |
1757 | 20736 | const int dstId = c->dstFormatBpp; | |
1758 | 20736 | rgbConvFn conv = NULL; | |
1759 | |||
1760 | #define IS_NOT_NE(bpp, desc) \ | ||
1761 | (((bpp + 7) >> 3) == 2 && \ | ||
1762 | (!(desc->flags & AV_PIX_FMT_FLAG_BE) != !HAVE_BIGENDIAN)) | ||
1763 | |||
1764 | #define CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst) | ||
1765 | |||
1766 |
13/16✓ Branch 0 taken 20473 times.
✓ Branch 1 taken 263 times.
✓ Branch 2 taken 20169 times.
✓ Branch 3 taken 304 times.
✓ Branch 4 taken 15546 times.
✓ Branch 5 taken 4623 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 15544 times.
✓ Branch 8 taken 5192 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 5192 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4701 times.
✓ Branch 13 taken 491 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4701 times.
|
20736 | if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) { |
1767 |
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) |
1768 |
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) |
1769 |
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) |
1770 |
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; |
1771 |
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) |
1772 |
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; |
1773 |
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) |
1774 |
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; |
1775 |
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) |
1776 |
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; |
1777 |
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) |
1778 |
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; |
1779 |
13/16✓ Branch 0 taken 20009 times.
✓ Branch 1 taken 236 times.
✓ Branch 2 taken 19999 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 19998 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 19998 times.
✓ Branch 8 taken 229 times.
✓ Branch 9 taken 18 times.
✓ Branch 10 taken 228 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 228 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 228 times.
|
20245 | } else if (isRGB48(srcFormat) && isRGB48(dstFormat)) { |
1780 |
2/4✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
|
19 | if (CONV_IS(RGB48LE, BGR48LE) |
1781 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19 | || CONV_IS(BGR48LE, RGB48LE) |
1782 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19 | || CONV_IS(RGB48BE, BGR48BE) |
1783 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19 | || CONV_IS(BGR48BE, RGB48BE)) conv = rgb48tobgr48_nobswap; |
1784 |
2/4✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
|
19 | else if (CONV_IS(RGB48LE, BGR48BE) |
1785 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19 | || CONV_IS(BGR48LE, RGB48BE) |
1786 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19 | || CONV_IS(RGB48BE, BGR48LE) |
1787 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19 | || CONV_IS(BGR48BE, RGB48LE)) conv = rgb48tobgr48_bswap; |
1788 |
11/16✓ Branch 0 taken 20009 times.
✓ Branch 1 taken 217 times.
✓ Branch 2 taken 19999 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 19998 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 19998 times.
✓ Branch 8 taken 228 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 228 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 228 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 228 times.
|
20226 | } else if (isRGB48(srcFormat) && isRGBA64(dstFormat)) { |
1789 | ✗ | if (CONV_IS(RGB48LE, BGRA64LE) | |
1790 | ✗ | || CONV_IS(BGR48LE, RGBA64LE) | |
1791 | ✗ | || CONV_IS(RGB48BE, BGRA64BE) | |
1792 | ✗ | || CONV_IS(BGR48BE, RGBA64BE)) conv = rgb48tobgr64_nobswap; | |
1793 | ✗ | else if (CONV_IS(RGB48LE, BGRA64BE) | |
1794 | ✗ | || CONV_IS(BGR48LE, RGBA64BE) | |
1795 | ✗ | || CONV_IS(RGB48BE, BGRA64LE) | |
1796 | ✗ | || CONV_IS(BGR48BE, RGBA64LE)) conv = rgb48tobgr64_bswap; | |
1797 | ✗ | if (CONV_IS(RGB48LE, RGBA64LE) | |
1798 | ✗ | || CONV_IS(BGR48LE, BGRA64LE) | |
1799 | ✗ | || CONV_IS(RGB48BE, RGBA64BE) | |
1800 | ✗ | || CONV_IS(BGR48BE, BGRA64BE)) conv = rgb48to64_nobswap; | |
1801 | ✗ | else if (CONV_IS(RGB48LE, RGBA64BE) | |
1802 | ✗ | || CONV_IS(BGR48LE, BGRA64BE) | |
1803 | ✗ | || CONV_IS(RGB48BE, RGBA64LE) | |
1804 | ✗ | || CONV_IS(BGR48BE, BGRA64LE)) conv = rgb48to64_bswap; | |
1805 |
11/16✓ Branch 0 taken 20225 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 20215 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 20214 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20214 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.
|
20226 | } else if (isRGBA64(srcFormat) && isRGB48(dstFormat)) { |
1806 | ✗ | if (CONV_IS(RGBA64LE, BGR48LE) | |
1807 | ✗ | || CONV_IS(BGRA64LE, RGB48LE) | |
1808 | ✗ | || CONV_IS(RGBA64BE, BGR48BE) | |
1809 | ✗ | || CONV_IS(BGRA64BE, RGB48BE)) conv = rgb64tobgr48_nobswap; | |
1810 | ✗ | else if (CONV_IS(RGBA64LE, BGR48BE) | |
1811 | ✗ | || CONV_IS(BGRA64LE, RGB48BE) | |
1812 | ✗ | || CONV_IS(RGBA64BE, BGR48LE) | |
1813 | ✗ | || CONV_IS(BGRA64BE, RGB48LE)) conv = rgb64tobgr48_bswap; | |
1814 | ✗ | else if (CONV_IS(RGBA64LE, RGB48LE) | |
1815 | ✗ | || CONV_IS(BGRA64LE, BGR48LE) | |
1816 | ✗ | || CONV_IS(RGBA64BE, RGB48BE) | |
1817 | ✗ | || CONV_IS(BGRA64BE, BGR48BE)) conv = rgb64to48_nobswap; | |
1818 | ✗ | else if (CONV_IS(RGBA64LE, RGB48BE) | |
1819 | ✗ | || CONV_IS(BGRA64LE, BGR48BE) | |
1820 | ✗ | || CONV_IS(RGBA64BE, RGB48LE) | |
1821 | ✗ | || CONV_IS(BGRA64BE, BGR48LE)) conv = rgb64to48_bswap; | |
1822 |
9/12✓ Branch 0 taken 19947 times.
✓ Branch 1 taken 279 times.
✓ Branch 2 taken 279 times.
✓ Branch 3 taken 19668 times.
✓ Branch 4 taken 72 times.
✓ Branch 5 taken 486 times.
✓ Branch 6 taken 72 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 72 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 72 times.
|
20226 | } else if (isX2RGB(srcFormat) && isRGB48(dstFormat)) { |
1823 |
3/4✓ Branch 0 taken 243 times.
✓ Branch 1 taken 243 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 243 times.
|
486 | if (CONV_IS(X2RGB10LE, RGB48LE) |
1824 |
2/4✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 243 times.
|
486 | || CONV_IS(X2BGR10LE, BGR48LE)) conv = HAVE_BIGENDIAN ? x2rgb10to48_bswap |
1825 | : x2rgb10to48_nobswap; | ||
1826 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 243 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
243 | else if (CONV_IS(X2RGB10LE, RGB48BE) |
1827 |
2/4✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 243 times.
|
243 | || CONV_IS(X2BGR10LE, BGR48BE)) conv = HAVE_BIGENDIAN ? x2rgb10to48_nobswap |
1828 | : x2rgb10to48_bswap; | ||
1829 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 243 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
243 | else if (CONV_IS(X2RGB10LE, BGR48LE) |
1830 |
2/4✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✗ Branch 3 not taken.
|
243 | || CONV_IS(X2BGR10LE, RGB48LE)) conv = HAVE_BIGENDIAN ? x2rgb10tobgr48_bswap |
1831 | : x2rgb10tobgr48_nobswap; | ||
1832 | ✗ | else if (CONV_IS(X2RGB10LE, BGR48BE) | |
1833 | ✗ | || CONV_IS(X2BGR10LE, RGB48BE)) conv = HAVE_BIGENDIAN ? x2rgb10tobgr48_nobswap | |
1834 | : x2rgb10tobgr48_bswap; | ||
1835 | ✗ | else if (CONV_IS(X2RGB10LE, RGBA64LE) | |
1836 | ✗ | || CONV_IS(X2BGR10LE, BGRA64LE)) conv = HAVE_BIGENDIAN ? x2rgb10to64_bswap | |
1837 | : x2rgb10to64_nobswap; | ||
1838 | ✗ | else if (CONV_IS(X2RGB10LE, RGBA64BE) | |
1839 | ✗ | || CONV_IS(X2BGR10LE, BGRA64BE)) conv = HAVE_BIGENDIAN ? x2rgb10to64_nobswap | |
1840 | : x2rgb10to64_bswap; | ||
1841 | ✗ | else if (CONV_IS(X2RGB10LE, BGRA64LE) | |
1842 | ✗ | || CONV_IS(X2BGR10LE, RGBA64LE)) conv = HAVE_BIGENDIAN ? x2rgb10tobgr64_bswap | |
1843 | : x2rgb10tobgr64_nobswap; | ||
1844 | ✗ | else if (CONV_IS(X2RGB10LE, BGRA64BE) | |
1845 | ✗ | || CONV_IS(X2BGR10LE, RGBA64BE)) conv = HAVE_BIGENDIAN ? x2rgb10tobgr64_nobswap | |
1846 | : x2rgb10tobgr64_bswap; | ||
1847 |
4/16✓ Branch 0 taken 19740 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19740 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19740 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 19740 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 not taken.
✗ Branch 15 not taken.
|
19740 | } else if (isAYUV(srcFormat) && isAYUV(dstFormat)) { |
1848 | /* VUYX only for dst, to avoid copying undefined bytes */ | ||
1849 | ✗ | if ( CONV_IS(AYUV, VUYA) | |
1850 | ✗ | || CONV_IS(AYUV, VUYX) | |
1851 | ✗ | || CONV_IS(VUYA, AYUV)) conv = shuffle_bytes_3210; | |
1852 | ✗ | else if (CONV_IS(AYUV, UYVA)) conv = shuffle_bytes_2130; | |
1853 | ✗ | else if (CONV_IS(VUYA, UYVA)) conv = shuffle_bytes_1203; | |
1854 | ✗ | else if (CONV_IS(UYVA, AYUV)) conv = shuffle_bytes_3102; | |
1855 | ✗ | else if (CONV_IS(UYVA, VUYA) | |
1856 | ✗ | || CONV_IS(UYVA, VUYX)) conv = shuffle_bytes_2013; | |
1857 | } else | ||
1858 | /* BGR -> BGR */ | ||
1859 |
5/6✓ Branch 1 taken 2415 times.
✓ Branch 2 taken 17325 times.
✓ Branch 4 taken 2415 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 16502 times.
✓ Branch 7 taken 3238 times.
|
39480 | if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) || |
1860 |
2/2✓ Branch 2 taken 15735 times.
✓ Branch 3 taken 767 times.
|
36242 | (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) { |
1861 |
7/14✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8883 times.
✓ Branch 8 taken 1980 times.
✓ Branch 9 taken 4500 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 153 times.
✓ Branch 13 taken 201 times.
|
15735 | switch (srcId | (dstId << 16)) { |
1862 | ✗ | case 0x000F000C: conv = rgb12to15; break; | |
1863 | ✗ | case 0x000F0010: conv = rgb16to15; break; | |
1864 | 9 | case 0x000F0018: conv = rgb24to15; break; | |
1865 | ✗ | case 0x000F0020: conv = rgb32to15; break; | |
1866 | ✗ | case 0x0010000F: conv = rgb15to16; break; | |
1867 | 9 | case 0x00100018: conv = rgb24to16; break; | |
1868 | ✗ | case 0x00100020: conv = rgb32to16; break; | |
1869 | 8883 | case 0x0018000F: conv = rgb15to24; break; | |
1870 | 1980 | case 0x00180010: conv = rgb16to24; break; | |
1871 | 4500 | case 0x00180020: conv = rgb32to24; break; | |
1872 | ✗ | case 0x0020000F: conv = rgb15to32; break; | |
1873 | ✗ | case 0x00200010: conv = rgb16to32; break; | |
1874 | 153 | case 0x00200018: conv = rgb24to32; break; | |
1875 | } | ||
1876 |
6/6✓ Branch 1 taken 2379 times.
✓ Branch 2 taken 1626 times.
✓ Branch 4 taken 160 times.
✓ Branch 5 taken 2219 times.
✓ Branch 6 taken 767 times.
✓ Branch 7 taken 1019 times.
|
5791 | } else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) || |
1877 |
2/2✓ Branch 2 taken 307 times.
✓ Branch 3 taken 460 times.
|
2553 | (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) { |
1878 |
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 824 times.
✓ Branch 12 taken 70 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 18 times.
✓ Branch 16 taken 21 times.
|
2526 | switch (srcId | (dstId << 16)) { |
1879 | ✗ | case 0x000C000C: conv = rgb12tobgr12; break; | |
1880 | ✗ | case 0x000F000F: conv = rgb15tobgr15; break; | |
1881 | ✗ | case 0x000F0010: conv = rgb16tobgr15; break; | |
1882 | ✗ | case 0x000F0018: conv = rgb24tobgr15; break; | |
1883 | ✗ | case 0x000F0020: conv = rgb32tobgr15; break; | |
1884 | ✗ | case 0x0010000F: conv = rgb15tobgr16; break; | |
1885 | ✗ | case 0x00100010: conv = rgb16tobgr16; break; | |
1886 | ✗ | case 0x00100018: conv = rgb24tobgr16; break; | |
1887 | ✗ | case 0x00100020: conv = rgb32tobgr16; break; | |
1888 | 1593 | case 0x0018000F: conv = rgb15tobgr24; break; | |
1889 | ✗ | case 0x00180010: conv = rgb16tobgr24; break; | |
1890 | 824 | case 0x00180018: conv = rgb24tobgr24; break; | |
1891 | 70 | case 0x00180020: conv = rgb32tobgr24; break; | |
1892 | ✗ | case 0x0020000F: conv = rgb15tobgr32; break; | |
1893 | ✗ | case 0x00200010: conv = rgb16tobgr32; break; | |
1894 | 18 | case 0x00200018: conv = rgb24tobgr32; break; | |
1895 | } | ||
1896 | } | ||
1897 | |||
1898 | if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) && !isRGBA32(srcFormat) && ALT32_CORR<0) | ||
1899 | return NULL; | ||
1900 | |||
1901 | // Maintain symmetry between endianness | ||
1902 |
2/2✓ Branch 0 taken 3250 times.
✓ Branch 1 taken 17486 times.
|
20736 | if (c->flags & SWS_BITEXACT) |
1903 |
7/12✓ Branch 0 taken 3205 times.
✓ Branch 1 taken 45 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3205 times.
✓ Branch 4 taken 45 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 45 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 45 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 45 times.
✗ Branch 11 not taken.
|
3250 | if ((dstFormat == AV_PIX_FMT_RGB32 || dstFormat == AV_PIX_FMT_BGR32 ) && !isRGBA32(srcFormat) && ALT32_CORR>0) |
1904 | 45 | return NULL; | |
1905 | |||
1906 | 20691 | return conv; | |
1907 | } | ||
1908 | |||
1909 | /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ | ||
1910 | 18449 | static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], | |
1911 | int srcSliceY, int srcSliceH, uint8_t *const dst[], | ||
1912 | const int dstStride[]) | ||
1913 | |||
1914 | { | ||
1915 | 18449 | const enum AVPixelFormat srcFormat = c->srcFormat; | |
1916 | 18449 | const enum AVPixelFormat dstFormat = c->dstFormat; | |
1917 | 18449 | const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat); | |
1918 | 18449 | const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat); | |
1919 | 18449 | const int srcBpp = (c->srcFormatBpp + 7) >> 3; | |
1920 | 18449 | const int dstBpp = (c->dstFormatBpp + 7) >> 3; | |
1921 | 18449 | rgbConvFn conv = findRgbConvFn(c); | |
1922 | |||
1923 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18449 times.
|
18449 | if (!conv) { |
1924 | ✗ | av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", | |
1925 | av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); | ||
1926 | } else { | ||
1927 | 18449 | const uint8_t *srcPtr = src[0]; | |
1928 | 18449 | uint8_t *dstPtr = dst[0]; | |
1929 |
3/4✓ Branch 0 taken 12303 times.
✓ Branch 1 taken 6146 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12303 times.
|
18449 | int src_bswap = IS_NOT_NE(c->srcFormatBpp, desc_src); |
1930 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 18449 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
18449 | int dst_bswap = IS_NOT_NE(c->dstFormatBpp, desc_dst); |
1931 | |||
1932 |
4/6✓ Branch 0 taken 18449 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✓ Branch 3 taken 18206 times.
✓ Branch 4 taken 243 times.
✗ Branch 5 not taken.
|
18449 | if ((srcFormat == AV_PIX_FMT_RGB32_1 || srcFormat == AV_PIX_FMT_BGR32_1) && |
1933 |
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)) |
1934 | 9 | srcPtr += ALT32_CORR; | |
1935 | |||
1936 |
4/6✓ Branch 0 taken 18449 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 18440 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
18449 | if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) && |
1937 |
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)) { |
1938 | int i; | ||
1939 | av_assert0(ALT32_CORR == 1); | ||
1940 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 9 times.
|
265 | for (i = 0; i < srcSliceH; i++) |
1941 | 256 | dstPtr[dstStride[0] * (srcSliceY + i)] = 255; | |
1942 | 9 | dstPtr += ALT32_CORR; | |
1943 | } | ||
1944 | |||
1945 |
3/4✓ Branch 0 taken 13620 times.
✓ Branch 1 taken 4829 times.
✓ Branch 2 taken 13620 times.
✗ Branch 3 not taken.
|
18449 | if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 && |
1946 |
3/6✓ Branch 0 taken 13620 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13620 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13620 times.
✗ Branch 5 not taken.
|
13620 | !(srcStride[0] % srcBpp) && !dst_bswap && !src_bswap) |
1947 | 13620 | conv(srcPtr, dstPtr + dstStride[0] * srcSliceY, | |
1948 | 13620 | (srcSliceH - 1) * srcStride[0] + c->srcW * srcBpp); | |
1949 | else { | ||
1950 | int i, j; | ||
1951 | 4829 | dstPtr += dstStride[0] * srcSliceY; | |
1952 | |||
1953 |
2/2✓ Branch 0 taken 183137 times.
✓ Branch 1 taken 4829 times.
|
187966 | for (i = 0; i < srcSliceH; i++) { |
1954 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 183137 times.
|
183137 | if(src_bswap) { |
1955 | ✗ | for(j=0; j<c->srcW; j++) | |
1956 | ✗ | ((uint16_t*)c->formatConvBuffer)[j] = av_bswap16(((uint16_t*)srcPtr)[j]); | |
1957 | ✗ | conv(c->formatConvBuffer, dstPtr, c->srcW * srcBpp); | |
1958 | }else | ||
1959 | 183137 | conv(srcPtr, dstPtr, c->srcW * srcBpp); | |
1960 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 183137 times.
|
183137 | if(dst_bswap) |
1961 | ✗ | for(j=0; j<c->srcW; j++) | |
1962 | ✗ | ((uint16_t*)dstPtr)[j] = av_bswap16(((uint16_t*)dstPtr)[j]); | |
1963 | 183137 | srcPtr += srcStride[0]; | |
1964 | 183137 | dstPtr += dstStride[0]; | |
1965 | } | ||
1966 | } | ||
1967 | } | ||
1968 | 18449 | return srcSliceH; | |
1969 | } | ||
1970 | |||
1971 | ✗ | static int bgr24ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], | |
1972 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1973 | uint8_t *const dst[], const int dstStride[]) | ||
1974 | { | ||
1975 | ✗ | ff_rgb24toyv12( | |
1976 | src[0], | ||
1977 | ✗ | dst[0] + srcSliceY * dstStride[0], | |
1978 | ✗ | dst[1] + (srcSliceY >> 1) * dstStride[1], | |
1979 | ✗ | dst[2] + (srcSliceY >> 1) * dstStride[2], | |
1980 | c->srcW, srcSliceH, | ||
1981 | ✗ | dstStride[0], dstStride[1], srcStride[0], | |
1982 | ✗ | c->input_rgb2yuv_table); | |
1983 | ✗ | if (dst[3]) | |
1984 | ✗ | fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
1985 | ✗ | return srcSliceH; | |
1986 | } | ||
1987 | |||
1988 | ✗ | static int yvu9ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], | |
1989 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
1990 | uint8_t *const dst[], const int dstStride[]) | ||
1991 | { | ||
1992 | ✗ | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW, | |
1993 | dst[0], dstStride[0]); | ||
1994 | |||
1995 | ✗ | planar2x(src[1], dst[1] + dstStride[1] * (srcSliceY >> 1), c->chrSrcW, | |
1996 | ✗ | srcSliceH >> 2, srcStride[1], dstStride[1]); | |
1997 | ✗ | planar2x(src[2], dst[2] + dstStride[2] * (srcSliceY >> 1), c->chrSrcW, | |
1998 | ✗ | srcSliceH >> 2, srcStride[2], dstStride[2]); | |
1999 | ✗ | if (dst[3]) | |
2000 | ✗ | fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255); | |
2001 | ✗ | return srcSliceH; | |
2002 | } | ||
2003 | |||
2004 | ✗ | static int uint_y_to_float_y_wrapper(SwsInternal *c, const uint8_t *const src[], | |
2005 | const int srcStride[], int srcSliceY, | ||
2006 | int srcSliceH, uint8_t *const dst[], const int dstStride[]) | ||
2007 | { | ||
2008 | int y, x; | ||
2009 | ✗ | ptrdiff_t dstStrideFloat = dstStride[0] >> 2; | |
2010 | ✗ | const uint8_t *srcPtr = src[0]; | |
2011 | ✗ | float *dstPtr = (float *)(dst[0] + dstStride[0] * srcSliceY); | |
2012 | |||
2013 | ✗ | for (y = 0; y < srcSliceH; ++y){ | |
2014 | ✗ | for (x = 0; x < c->srcW; ++x){ | |
2015 | ✗ | dstPtr[x] = c->uint2float_lut[srcPtr[x]]; | |
2016 | } | ||
2017 | ✗ | srcPtr += srcStride[0]; | |
2018 | ✗ | dstPtr += dstStrideFloat; | |
2019 | } | ||
2020 | |||
2021 | ✗ | return srcSliceH; | |
2022 | } | ||
2023 | |||
2024 | ✗ | static int float_y_to_uint_y_wrapper(SwsInternal *c, | |
2025 | const uint8_t *const src[], | ||
2026 | const int srcStride[], int srcSliceY, | ||
2027 | int srcSliceH, uint8_t *const dst[], | ||
2028 | const int dstStride[]) | ||
2029 | { | ||
2030 | int y, x; | ||
2031 | ✗ | ptrdiff_t srcStrideFloat = srcStride[0] >> 2; | |
2032 | ✗ | const float *srcPtr = (const float *)src[0]; | |
2033 | ✗ | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
2034 | |||
2035 | ✗ | for (y = 0; y < srcSliceH; ++y){ | |
2036 | ✗ | for (x = 0; x < c->srcW; ++x){ | |
2037 | ✗ | dstPtr[x] = av_clip_uint8(lrintf(255.0f * srcPtr[x])); | |
2038 | } | ||
2039 | ✗ | srcPtr += srcStrideFloat; | |
2040 | ✗ | dstPtr += dstStride[0]; | |
2041 | } | ||
2042 | |||
2043 | ✗ | return srcSliceH; | |
2044 | } | ||
2045 | |||
2046 | /* unscaled copy like stuff (assumes nearly identical formats) */ | ||
2047 | 3015 | static int packedCopyWrapper(SwsInternal *c, const uint8_t *const src[], | |
2048 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
2049 | uint8_t *const dst[], const int dstStride[]) | ||
2050 | { | ||
2051 |
2/4✓ Branch 0 taken 3015 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3015 times.
✗ Branch 3 not taken.
|
3015 | if (dstStride[0] == srcStride[0] && srcStride[0] > 0) |
2052 | 3015 | memcpy(dst[0] + dstStride[0] * srcSliceY, src[0], srcSliceH * dstStride[0]); | |
2053 | else { | ||
2054 | int i; | ||
2055 | ✗ | const uint8_t *srcPtr = src[0]; | |
2056 | ✗ | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
2057 | ✗ | int length = 0; | |
2058 | |||
2059 | /* universal length finder */ | ||
2060 | ✗ | while (length + c->srcW <= FFABS(dstStride[0]) && | |
2061 | ✗ | length + c->srcW <= FFABS(srcStride[0])) | |
2062 | ✗ | length += c->srcW; | |
2063 | av_assert1(length != 0); | ||
2064 | |||
2065 | ✗ | for (i = 0; i < srcSliceH; i++) { | |
2066 | ✗ | memcpy(dstPtr, srcPtr, length); | |
2067 | ✗ | srcPtr += srcStride[0]; | |
2068 | ✗ | dstPtr += dstStride[0]; | |
2069 | } | ||
2070 | } | ||
2071 | 3015 | return srcSliceH; | |
2072 | } | ||
2073 | |||
2074 | #define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)\ | ||
2075 | unsigned shift= src_depth-dst_depth, tmp;\ | ||
2076 | if (c->dither == SWS_DITHER_NONE) {\ | ||
2077 | for (i = 0; i < height; i++) {\ | ||
2078 | for (j = 0; j < length-7; j+=8) {\ | ||
2079 | dst[j+0] = dbswap(bswap(src[j+0])>>shift);\ | ||
2080 | dst[j+1] = dbswap(bswap(src[j+1])>>shift);\ | ||
2081 | dst[j+2] = dbswap(bswap(src[j+2])>>shift);\ | ||
2082 | dst[j+3] = dbswap(bswap(src[j+3])>>shift);\ | ||
2083 | dst[j+4] = dbswap(bswap(src[j+4])>>shift);\ | ||
2084 | dst[j+5] = dbswap(bswap(src[j+5])>>shift);\ | ||
2085 | dst[j+6] = dbswap(bswap(src[j+6])>>shift);\ | ||
2086 | dst[j+7] = dbswap(bswap(src[j+7])>>shift);\ | ||
2087 | }\ | ||
2088 | for (; j < length; j++) {\ | ||
2089 | dst[j] = dbswap(bswap(src[j])>>shift);\ | ||
2090 | }\ | ||
2091 | dst += dstStride;\ | ||
2092 | src += srcStride;\ | ||
2093 | }\ | ||
2094 | } else if (shiftonly) {\ | ||
2095 | for (i = 0; i < height; i++) {\ | ||
2096 | const uint8_t *dither= dithers[shift-1][i&7];\ | ||
2097 | for (j = 0; j < length-7; j+=8) {\ | ||
2098 | tmp = (bswap(src[j+0]) + dither[0])>>shift; dst[j+0] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2099 | tmp = (bswap(src[j+1]) + dither[1])>>shift; dst[j+1] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2100 | tmp = (bswap(src[j+2]) + dither[2])>>shift; dst[j+2] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2101 | tmp = (bswap(src[j+3]) + dither[3])>>shift; dst[j+3] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2102 | tmp = (bswap(src[j+4]) + dither[4])>>shift; dst[j+4] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2103 | tmp = (bswap(src[j+5]) + dither[5])>>shift; dst[j+5] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2104 | tmp = (bswap(src[j+6]) + dither[6])>>shift; dst[j+6] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2105 | tmp = (bswap(src[j+7]) + dither[7])>>shift; dst[j+7] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2106 | }\ | ||
2107 | for (; j < length; j++) {\ | ||
2108 | tmp = (bswap(src[j]) + dither[j&7])>>shift; dst[j] = dbswap(tmp - (tmp>>dst_depth));\ | ||
2109 | }\ | ||
2110 | dst += dstStride;\ | ||
2111 | src += srcStride;\ | ||
2112 | }\ | ||
2113 | } else {\ | ||
2114 | for (i = 0; i < height; i++) {\ | ||
2115 | const uint8_t *dither= dithers[shift-1][i&7];\ | ||
2116 | for (j = 0; j < length-7; j+=8) {\ | ||
2117 | tmp = bswap(src[j+0]); dst[j+0] = dbswap((tmp - (tmp>>dst_depth) + dither[0])>>shift);\ | ||
2118 | tmp = bswap(src[j+1]); dst[j+1] = dbswap((tmp - (tmp>>dst_depth) + dither[1])>>shift);\ | ||
2119 | tmp = bswap(src[j+2]); dst[j+2] = dbswap((tmp - (tmp>>dst_depth) + dither[2])>>shift);\ | ||
2120 | tmp = bswap(src[j+3]); dst[j+3] = dbswap((tmp - (tmp>>dst_depth) + dither[3])>>shift);\ | ||
2121 | tmp = bswap(src[j+4]); dst[j+4] = dbswap((tmp - (tmp>>dst_depth) + dither[4])>>shift);\ | ||
2122 | tmp = bswap(src[j+5]); dst[j+5] = dbswap((tmp - (tmp>>dst_depth) + dither[5])>>shift);\ | ||
2123 | tmp = bswap(src[j+6]); dst[j+6] = dbswap((tmp - (tmp>>dst_depth) + dither[6])>>shift);\ | ||
2124 | tmp = bswap(src[j+7]); dst[j+7] = dbswap((tmp - (tmp>>dst_depth) + dither[7])>>shift);\ | ||
2125 | }\ | ||
2126 | for (; j < length; j++) {\ | ||
2127 | tmp = bswap(src[j]); dst[j] = dbswap((tmp - (tmp>>dst_depth) + dither[j&7])>>shift);\ | ||
2128 | }\ | ||
2129 | dst += dstStride;\ | ||
2130 | src += srcStride;\ | ||
2131 | }\ | ||
2132 | } | ||
2133 | |||
2134 | 12444 | static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], | |
2135 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
2136 | uint8_t *const dst[], const int dstStride[]) | ||
2137 | { | ||
2138 | 12444 | const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat); | |
2139 | 12444 | const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat); | |
2140 | int plane, i, j; | ||
2141 |
4/4✓ Branch 0 taken 49654 times.
✓ Branch 1 taken 667 times.
✓ Branch 2 taken 37877 times.
✓ Branch 3 taken 11777 times.
|
50321 | for (plane = 0; plane < 4 && dst[plane] != NULL; plane++) { |
2142 |
4/4✓ Branch 0 taken 25433 times.
✓ Branch 1 taken 12444 times.
✓ Branch 2 taken 667 times.
✓ Branch 3 taken 24766 times.
|
37877 | int length = (plane == 0 || plane == 3) ? c->srcW : AV_CEIL_RSHIFT(c->srcW, c->chrDstHSubSample); |
2143 |
4/4✓ Branch 0 taken 25433 times.
✓ Branch 1 taken 12444 times.
✓ Branch 2 taken 24766 times.
✓ Branch 3 taken 667 times.
|
37877 | int y = (plane == 0 || plane == 3) ? srcSliceY: AV_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample); |
2144 |
4/4✓ Branch 0 taken 25433 times.
✓ Branch 1 taken 12444 times.
✓ Branch 2 taken 24766 times.
✓ Branch 3 taken 667 times.
|
37877 | int height = (plane == 0 || plane == 3) ? srcSliceH: AV_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample); |
2145 | 37877 | const uint8_t *srcPtr = src[plane]; | |
2146 | 37877 | uint8_t *dstPtr = dst[plane] + dstStride[plane] * y; | |
2147 |
8/8✓ Branch 0 taken 25494 times.
✓ Branch 1 taken 12383 times.
✓ Branch 2 taken 13111 times.
✓ Branch 3 taken 12383 times.
✓ Branch 4 taken 13063 times.
✓ Branch 5 taken 48 times.
✓ Branch 6 taken 12396 times.
✓ Branch 7 taken 667 times.
|
37877 | int shiftonly = plane == 1 || plane == 2 || (!c->srcRange && plane == 0); |
2148 | |||
2149 | // ignore palette for GRAY8 | ||
2150 |
3/4✓ Branch 0 taken 12383 times.
✓ Branch 1 taken 25494 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12383 times.
|
37877 | if (plane == 1 && !dst[2]) continue; |
2151 |
5/6✓ Branch 0 taken 37210 times.
✓ Branch 1 taken 667 times.
✓ Branch 2 taken 12383 times.
✓ Branch 3 taken 24827 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12383 times.
|
37877 | if (!src[plane] || (plane == 1 && !src[2])) { |
2152 |
4/4✓ Branch 1 taken 624 times.
✓ Branch 2 taken 43 times.
✓ Branch 4 taken 143 times.
✓ Branch 5 taken 481 times.
|
1334 | if (is16BPS(c->dstFormat) || isNBPS(c->dstFormat)) { |
2153 | 186 | fillPlane16(dst[plane], dstStride[plane], length, height, y, | |
2154 | 186 | plane == 3, desc_dst->comp[plane].depth, | |
2155 | isBE(c->dstFormat)); | ||
2156 | } else { | ||
2157 |
1/2✓ Branch 0 taken 481 times.
✗ Branch 1 not taken.
|
481 | fillPlane(dst[plane], dstStride[plane], length, height, y, |
2158 | (plane == 3) ? 255 : 128); | ||
2159 | } | ||
2160 | } else { | ||
2161 |
4/4✓ Branch 1 taken 19222 times.
✓ Branch 2 taken 17988 times.
✓ Branch 4 taken 8272 times.
✓ Branch 5 taken 10950 times.
|
37210 | if(isNBPS(c->srcFormat) || isNBPS(c->dstFormat) |
2162 |
2/2✓ Branch 2 taken 3903 times.
✓ Branch 3 taken 4369 times.
|
8272 | || (is16BPS(c->srcFormat) != is16BPS(c->dstFormat)) |
2163 | 32841 | ) { | |
2164 | 32841 | const int src_depth = desc_src->comp[plane].depth; | |
2165 | 32841 | const int dst_depth = desc_dst->comp[plane].depth; | |
2166 | 32841 | const uint16_t *srcPtr2 = (const uint16_t *) srcPtr; | |
2167 | 32841 | uint16_t *dstPtr2 = (uint16_t*)dstPtr; | |
2168 | |||
2169 |
2/2✓ Branch 0 taken 6576 times.
✓ Branch 1 taken 26265 times.
|
32841 | if (dst_depth == 8) { |
2170 |
2/2✓ Branch 1 taken 4470 times.
✓ Branch 2 taken 2106 times.
|
6576 | if(isBE(c->srcFormat) == HAVE_BIGENDIAN){ |
2171 |
14/22✓ Branch 0 taken 1404 times.
✓ Branch 1 taken 3066 times.
✓ Branch 2 taken 1976832 times.
✓ Branch 3 taken 44928 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 44928 times.
✓ Branch 6 taken 44928 times.
✓ Branch 7 taken 1404 times.
✓ Branch 8 taken 3066 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 9372888 times.
✓ Branch 11 taken 199272 times.
✓ Branch 12 taken 5100 times.
✓ Branch 13 taken 199272 times.
✓ Branch 14 taken 199272 times.
✓ Branch 15 taken 3066 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.
|
11603490 | DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, , ) |
2172 | } else { | ||
2173 |
7/22✗ Branch 0 not taken.
✓ Branch 1 taken 2106 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 2106 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2965248 times.
✓ Branch 11 taken 67392 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 67392 times.
✓ Branch 14 taken 67392 times.
✓ Branch 15 taken 2106 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.
|
3034746 | DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, av_bswap16, ) |
2174 | } | ||
2175 |
2/2✓ Branch 0 taken 10641 times.
✓ Branch 1 taken 15624 times.
|
26265 | } else if (src_depth == 8) { |
2176 |
2/2✓ Branch 0 taken 620464 times.
✓ Branch 1 taken 10641 times.
|
631105 | for (i = 0; i < height; i++) { |
2177 | #define COPY816(w)\ | ||
2178 | if (shiftonly) {\ | ||
2179 | for (j = 0; j < length; j++)\ | ||
2180 | w(&dstPtr2[j], srcPtr[j]<<(dst_depth-8));\ | ||
2181 | } else {\ | ||
2182 | for (j = 0; j < length; j++)\ | ||
2183 | w(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) |\ | ||
2184 | (srcPtr[j]>>(2*8-dst_depth)));\ | ||
2185 | } | ||
2186 |
2/2✓ Branch 1 taken 159552 times.
✓ Branch 2 taken 460912 times.
|
620464 | if(isBE(c->dstFormat)){ |
2187 |
3/6✓ Branch 0 taken 159552 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48052224 times.
✓ Branch 3 taken 159552 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
48211776 | COPY816(AV_WB16) |
2188 | } else { | ||
2189 |
3/6✓ Branch 0 taken 460912 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 162348204 times.
✓ Branch 3 taken 460912 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
162809116 | COPY816(AV_WL16) |
2190 | } | ||
2191 | 620464 | dstPtr2 += dstStride[plane]/2; | |
2192 | 620464 | srcPtr += srcStride[plane]; | |
2193 | } | ||
2194 |
2/2✓ Branch 0 taken 10008 times.
✓ Branch 1 taken 5616 times.
|
15624 | } else if (src_depth <= dst_depth) { |
2195 |
2/2✓ Branch 0 taken 317856 times.
✓ Branch 1 taken 10008 times.
|
327864 | for (i = 0; i < height; i++) { |
2196 | 317856 | j = 0; | |
2197 |
4/4✓ Branch 1 taken 250464 times.
✓ Branch 2 taken 67392 times.
✓ Branch 3 taken 135984 times.
✓ Branch 4 taken 114480 times.
|
568320 | if(isBE(c->srcFormat) == HAVE_BIGENDIAN && |
2198 |
1/2✓ Branch 1 taken 135984 times.
✗ Branch 2 not taken.
|
386448 | isBE(c->dstFormat) == HAVE_BIGENDIAN && |
2199 | shiftonly) { | ||
2200 | 135984 | unsigned shift = dst_depth - src_depth; | |
2201 | #if HAVE_FAST_64BIT | ||
2202 | #define FAST_COPY_UP(shift) \ | ||
2203 | for (; j < length - 3; j += 4) { \ | ||
2204 | uint64_t v = AV_RN64A(srcPtr2 + j); \ | ||
2205 | AV_WN64A(dstPtr2 + j, v << shift); \ | ||
2206 | } | ||
2207 | #else | ||
2208 | #define FAST_COPY_UP(shift) \ | ||
2209 | for (; j < length - 1; j += 2) { \ | ||
2210 | uint32_t v = AV_RN32A(srcPtr2 + j); \ | ||
2211 | AV_WN32A(dstPtr2 + j, v << shift); \ | ||
2212 | } | ||
2213 | #endif | ||
2214 |
2/3✓ Branch 0 taken 22464 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113520 times.
|
135984 | switch (shift) |
2215 | { | ||
2216 |
2/2✓ Branch 0 taken 1976832 times.
✓ Branch 1 taken 22464 times.
|
1999296 | case 6: FAST_COPY_UP(6); break; |
2217 | ✗ | case 7: FAST_COPY_UP(7); break; | |
2218 | } | ||
2219 | } | ||
2220 | #define COPY_UP(r,w) \ | ||
2221 | if(shiftonly){\ | ||
2222 | for (; j < length; j++){ \ | ||
2223 | unsigned int v= r(&srcPtr2[j]);\ | ||
2224 | w(&dstPtr2[j], v<<(dst_depth-src_depth));\ | ||
2225 | }\ | ||
2226 | }else{\ | ||
2227 | for (; j < length; j++){ \ | ||
2228 | unsigned int v= r(&srcPtr2[j]);\ | ||
2229 | w(&dstPtr2[j], (v<<(dst_depth-src_depth)) | \ | ||
2230 | (v>>(2*src_depth-dst_depth)));\ | ||
2231 | }\ | ||
2232 | } | ||
2233 |
2/2✓ Branch 1 taken 67392 times.
✓ Branch 2 taken 250464 times.
|
317856 | if(isBE(c->srcFormat)){ |
2234 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 67392 times.
|
67392 | if(isBE(c->dstFormat)){ |
2235 | ✗ | COPY_UP(AV_RB16, AV_WB16) | |
2236 | } else { | ||
2237 |
3/6✓ Branch 0 taken 67392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23721984 times.
✓ Branch 3 taken 67392 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
23789376 | COPY_UP(AV_RB16, AV_WL16) |
2238 | } | ||
2239 | } else { | ||
2240 |
2/2✓ Branch 1 taken 114480 times.
✓ Branch 2 taken 135984 times.
|
250464 | if(isBE(c->dstFormat)){ |
2241 |
3/6✓ Branch 0 taken 114480 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 41379840 times.
✓ Branch 3 taken 114480 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
41494320 | COPY_UP(AV_RL16, AV_WB16) |
2242 | } else { | ||
2243 |
3/6✓ Branch 0 taken 135984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 39640320 times.
✓ Branch 3 taken 135984 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
39776304 | COPY_UP(AV_RL16, AV_WL16) |
2244 | } | ||
2245 | } | ||
2246 | 317856 | dstPtr2 += dstStride[plane]/2; | |
2247 | 317856 | srcPtr2 += srcStride[plane]/2; | |
2248 | } | ||
2249 | } else { | ||
2250 |
2/2✓ Branch 1 taken 3510 times.
✓ Branch 2 taken 2106 times.
|
5616 | if(isBE(c->srcFormat) == HAVE_BIGENDIAN){ |
2251 |
2/2✓ Branch 1 taken 2808 times.
✓ Branch 2 taken 702 times.
|
3510 | if(isBE(c->dstFormat) == HAVE_BIGENDIAN){ |
2252 |
13/22✓ Branch 0 taken 702 times.
✓ Branch 1 taken 2106 times.
✓ Branch 2 taken 988416 times.
✓ Branch 3 taken 22464 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 22464 times.
✓ Branch 6 taken 22464 times.
✓ Branch 7 taken 702 times.
✓ Branch 8 taken 2106 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2965248 times.
✓ Branch 11 taken 67392 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 67392 times.
✓ Branch 14 taken 67392 times.
✓ Branch 15 taken 2106 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.
|
4046328 | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , ) |
2253 | } else { | ||
2254 |
6/22✓ Branch 0 taken 702 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 988416 times.
✓ Branch 3 taken 22464 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 22464 times.
✓ Branch 6 taken 22464 times.
✓ Branch 7 taken 702 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 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
1011582 | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , av_bswap16) |
2255 | } | ||
2256 | }else{ | ||
2257 |
1/2✓ Branch 1 taken 2106 times.
✗ Branch 2 not taken.
|
2106 | if(isBE(c->dstFormat) == HAVE_BIGENDIAN){ |
2258 |
7/22✗ Branch 0 not taken.
✓ Branch 1 taken 2106 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 2106 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2965248 times.
✓ Branch 11 taken 67392 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 67392 times.
✓ Branch 14 taken 67392 times.
✓ Branch 15 taken 2106 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.
|
3034746 | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, ) |
2259 | } else { | ||
2260 | ✗ | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, av_bswap16) | |
2261 | } | ||
2262 | } | ||
2263 | } | ||
2264 |
5/6✓ Branch 1 taken 2207 times.
✓ Branch 2 taken 2162 times.
✓ Branch 4 taken 2207 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1496 times.
✓ Branch 7 taken 711 times.
|
8072 | } else if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat) && |
2265 | 2207 | isBE(c->srcFormat) != isBE(c->dstFormat)) { | |
2266 | |||
2267 |
2/2✓ Branch 0 taken 60840 times.
✓ Branch 1 taken 1496 times.
|
62336 | for (i = 0; i < height; i++) { |
2268 |
2/2✓ Branch 0 taken 24643584 times.
✓ Branch 1 taken 60840 times.
|
24704424 | for (j = 0; j < length; j++) |
2269 | 24643584 | ((uint16_t *) dstPtr)[j] = av_bswap16(((const uint16_t *) srcPtr)[j]); | |
2270 | 60840 | srcPtr += srcStride[plane]; | |
2271 | 60840 | dstPtr += dstStride[plane]; | |
2272 | } | ||
2273 |
4/6✓ Branch 1 taken 13 times.
✓ Branch 2 taken 2860 times.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13 times.
✗ Branch 7 not taken.
|
2899 | } else if (isFloat(c->srcFormat) && isFloat(c->dstFormat) && |
2274 | 13 | isBE(c->srcFormat) != isBE(c->dstFormat)) { /* swap float plane */ | |
2275 |
2/2✓ Branch 0 taken 3744 times.
✓ Branch 1 taken 13 times.
|
3757 | for (i = 0; i < height; i++) { |
2276 |
2/2✓ Branch 0 taken 1317888 times.
✓ Branch 1 taken 3744 times.
|
1321632 | for (j = 0; j < length; j++) |
2277 | 1317888 | ((uint32_t *) dstPtr)[j] = av_bswap32(((const uint32_t *) srcPtr)[j]); | |
2278 | 3744 | srcPtr += srcStride[plane]; | |
2279 | 3744 | dstPtr += dstStride[plane]; | |
2280 | } | ||
2281 |
2/2✓ Branch 0 taken 1408 times.
✓ Branch 1 taken 1452 times.
|
2860 | } else if (dstStride[plane] == srcStride[plane] && |
2282 |
3/4✓ Branch 0 taken 1408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 706 times.
✓ Branch 3 taken 702 times.
|
1408 | srcStride[plane] > 0 && srcStride[plane] == length) { |
2283 | 706 | memcpy(dst[plane] + dstStride[plane] * y, src[plane], | |
2284 | 706 | height * dstStride[plane]); | |
2285 | } else { | ||
2286 |
3/4✓ Branch 1 taken 711 times.
✓ Branch 2 taken 1443 times.
✓ Branch 4 taken 711 times.
✗ Branch 5 not taken.
|
2154 | if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) |
2287 | 711 | length *= 2; | |
2288 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1443 times.
|
1443 | else if (desc_src->comp[0].depth == 1) |
2289 | ✗ | length >>= 3; // monowhite/black | |
2290 |
2/2✓ Branch 0 taken 69869 times.
✓ Branch 1 taken 2154 times.
|
72023 | for (i = 0; i < height; i++) { |
2291 | 69869 | memcpy(dstPtr, srcPtr, length); | |
2292 | 69869 | srcPtr += srcStride[plane]; | |
2293 | 69869 | dstPtr += dstStride[plane]; | |
2294 | } | ||
2295 | } | ||
2296 | } | ||
2297 | } | ||
2298 | 12444 | return srcSliceH; | |
2299 | } | ||
2300 | |||
2301 | |||
2302 | #define IS_DIFFERENT_ENDIANESS(src_fmt, dst_fmt, pix_fmt) \ | ||
2303 | ((src_fmt == pix_fmt ## BE && dst_fmt == pix_fmt ## LE) || \ | ||
2304 | (src_fmt == pix_fmt ## LE && dst_fmt == pix_fmt ## BE)) | ||
2305 | |||
2306 | |||
2307 | 20123 | void ff_get_unscaled_swscale(SwsInternal *c) | |
2308 | { | ||
2309 | 20123 | const enum AVPixelFormat srcFormat = c->srcFormat; | |
2310 | 20123 | const enum AVPixelFormat dstFormat = c->dstFormat; | |
2311 | 20123 | const int flags = c->flags; | |
2312 | 20123 | const int dstH = c->dstH; | |
2313 | 20123 | const int dstW = c->dstW; | |
2314 | int needsDither; | ||
2315 | |||
2316 | 20123 | needsDither = isAnyRGB(dstFormat) && | |
2317 |
4/4✓ Branch 0 taken 10325 times.
✓ Branch 1 taken 9798 times.
✓ Branch 2 taken 1187 times.
✓ Branch 3 taken 9138 times.
|
21310 | c->dstFormatBpp < 24 && |
2318 |
3/4✓ Branch 0 taken 487 times.
✓ Branch 1 taken 700 times.
✓ Branch 3 taken 487 times.
✗ Branch 4 not taken.
|
1187 | (c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat))); |
2319 | |||
2320 | /* yv12_to_nv12 */ | ||
2321 |
6/6✓ Branch 0 taken 16112 times.
✓ Branch 1 taken 4011 times.
✓ Branch 2 taken 572 times.
✓ Branch 3 taken 15540 times.
✓ Branch 4 taken 4561 times.
✓ Branch 5 taken 22 times.
|
20123 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) && |
2322 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 4540 times.
|
4561 | (dstFormat == AV_PIX_FMT_NV12 || dstFormat == AV_PIX_FMT_NV21)) { |
2323 | 43 | c->convert_unscaled = planarToNv12Wrapper; | |
2324 | } | ||
2325 | /* yv24_to_nv24 */ | ||
2326 |
5/6✓ Branch 0 taken 19220 times.
✓ Branch 1 taken 903 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 19220 times.
✓ Branch 4 taken 894 times.
✓ Branch 5 taken 9 times.
|
20123 | if ((srcFormat == AV_PIX_FMT_YUV444P || srcFormat == AV_PIX_FMT_YUVA444P) && |
2327 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 894 times.
|
894 | (dstFormat == AV_PIX_FMT_NV24 || dstFormat == AV_PIX_FMT_NV42)) { |
2328 | 9 | c->convert_unscaled = planarToNv24Wrapper; | |
2329 | } | ||
2330 | /* nv12_to_yv12 */ | ||
2331 |
4/4✓ Branch 0 taken 671 times.
✓ Branch 1 taken 19452 times.
✓ Branch 2 taken 662 times.
✓ Branch 3 taken 9 times.
|
20123 | if (dstFormat == AV_PIX_FMT_YUV420P && |
2332 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 653 times.
|
662 | (srcFormat == AV_PIX_FMT_NV12 || srcFormat == AV_PIX_FMT_NV21)) { |
2333 | 18 | c->convert_unscaled = nv12ToPlanarWrapper; | |
2334 | } | ||
2335 | /* nv24_to_yv24 */ | ||
2336 |
4/4✓ Branch 0 taken 884 times.
✓ Branch 1 taken 19239 times.
✓ Branch 2 taken 874 times.
✓ Branch 3 taken 10 times.
|
20123 | if (dstFormat == AV_PIX_FMT_YUV444P && |
2337 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 874 times.
|
874 | (srcFormat == AV_PIX_FMT_NV24 || srcFormat == AV_PIX_FMT_NV42)) { |
2338 | 10 | c->convert_unscaled = nv24ToPlanarWrapper; | |
2339 | } | ||
2340 | /* yuv2bgr */ | ||
2341 |
6/6✓ Branch 0 taken 16112 times.
✓ Branch 1 taken 4011 times.
✓ Branch 2 taken 15399 times.
✓ Branch 3 taken 713 times.
✓ Branch 4 taken 572 times.
✓ Branch 5 taken 14827 times.
|
20123 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P || |
2342 |
2/2✓ Branch 1 taken 3171 times.
✓ Branch 2 taken 2125 times.
|
5296 | srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) && |
2343 |
5/8✓ Branch 0 taken 1716 times.
✓ Branch 1 taken 1455 times.
✓ Branch 2 taken 1716 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1716 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1716 times.
✗ Branch 7 not taken.
|
3171 | !(flags & SWS_ACCURATE_RND) && (c->dither == SWS_DITHER_BAYER || c->dither == SWS_DITHER_AUTO) && !(dstH & 1)) { |
2344 | 1716 | c->convert_unscaled = ff_yuv2rgb_get_func_ptr(c); | |
2345 | 1716 | c->dst_slice_align = 2; | |
2346 | } | ||
2347 | /* yuv420p1x_to_p01x */ | ||
2348 |
5/6✓ Branch 0 taken 20011 times.
✓ Branch 1 taken 112 times.
✓ Branch 2 taken 20011 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19932 times.
✓ Branch 5 taken 79 times.
|
20123 | if ((srcFormat == AV_PIX_FMT_YUV420P10 || srcFormat == AV_PIX_FMT_YUVA420P10 || |
2349 |
1/2✓ Branch 0 taken 19932 times.
✗ Branch 1 not taken.
|
19932 | srcFormat == AV_PIX_FMT_YUV420P12 || |
2350 |
2/2✓ Branch 0 taken 19842 times.
✓ Branch 1 taken 90 times.
|
19932 | srcFormat == AV_PIX_FMT_YUV420P14 || |
2351 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19842 times.
✓ Branch 2 taken 281 times.
✗ Branch 3 not taken.
|
20123 | srcFormat == AV_PIX_FMT_YUV420P16 || srcFormat == AV_PIX_FMT_YUVA420P16) && |
2352 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 281 times.
|
281 | (dstFormat == AV_PIX_FMT_P010 || dstFormat == AV_PIX_FMT_P016)) { |
2353 | ✗ | c->convert_unscaled = planarToP01xWrapper; | |
2354 | } | ||
2355 | /* yuv420p_to_p01xle */ | ||
2356 |
6/6✓ Branch 0 taken 16112 times.
✓ Branch 1 taken 4011 times.
✓ Branch 2 taken 572 times.
✓ Branch 3 taken 15540 times.
✓ Branch 4 taken 4571 times.
✓ Branch 5 taken 12 times.
|
20123 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) && |
2357 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4559 times.
|
4571 | (dstFormat == AV_PIX_FMT_P010LE || dstFormat == AV_PIX_FMT_P016LE)) { |
2358 | 24 | c->convert_unscaled = planar8ToP01xleWrapper; | |
2359 | } | ||
2360 | |||
2361 |
6/6✓ Branch 0 taken 77 times.
✓ Branch 1 taken 20046 times.
✓ Branch 2 taken 76 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 73 times.
✓ Branch 5 taken 3 times.
|
20123 | if (srcFormat == AV_PIX_FMT_YUV410P && !(dstH & 3) && |
2362 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
|
73 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && |
2363 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | !(flags & SWS_BITEXACT)) { |
2364 | ✗ | c->convert_unscaled = yvu9ToYv12Wrapper; | |
2365 | ✗ | c->dst_slice_align = 4; | |
2366 | } | ||
2367 | |||
2368 | /* bgr24toYV12 */ | ||
2369 |
4/4✓ Branch 0 taken 121 times.
✓ Branch 1 taken 20002 times.
✓ Branch 2 taken 101 times.
✓ Branch 3 taken 20 times.
|
20123 | if (srcFormat == AV_PIX_FMT_BGR24 && |
2370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101 times.
|
101 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && |
2371 |
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)) |
2372 | ✗ | c->convert_unscaled = bgr24ToYv12Wrapper; | |
2373 | |||
2374 | /* AYUV/VUYA/UYVA -> AYUV/VUYA/UYVA */ | ||
2375 |
10/18✓ Branch 0 taken 20123 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20123 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20050 times.
✓ Branch 5 taken 73 times.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 20046 times.
✓ Branch 8 taken 77 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 77 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 77 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 77 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
20123 | if (isAYUV(srcFormat) && isAYUV(dstFormat) && findRgbConvFn(c)) |
2376 | ✗ | c->convert_unscaled = rgbToRgbWrapper; | |
2377 | |||
2378 | /* RGB/BGR -> RGB/BGR (no dither needed forms) */ | ||
2379 |
6/6✓ Branch 1 taken 5986 times.
✓ Branch 2 taken 14137 times.
✓ Branch 4 taken 2287 times.
✓ Branch 5 taken 3699 times.
✓ Branch 7 taken 522 times.
✓ Branch 8 taken 1765 times.
|
20123 | if (isAnyRGB(srcFormat) && isAnyRGB(dstFormat) && findRgbConvFn(c) |
2380 |
3/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 504 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
|
522 | && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)))) |
2381 | 504 | c->convert_unscaled = rgbToRgbWrapper; | |
2382 | |||
2383 | /* RGB to planar RGB */ | ||
2384 |
5/6✓ Branch 0 taken 730 times.
✓ Branch 1 taken 19393 times.
✓ Branch 2 taken 730 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 789 times.
✓ Branch 5 taken 19334 times.
|
20123 | if ((srcFormat == AV_PIX_FMT_GBRP && dstFormat == AV_PIX_FMT_GBRAP) || |
2385 |
3/4✓ Branch 0 taken 789 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 775 times.
✓ Branch 3 taken 19348 times.
|
20123 | (srcFormat == AV_PIX_FMT_GBRP10 && dstFormat == AV_PIX_FMT_GBRAP10) || |
2386 |
3/4✓ Branch 0 taken 775 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20122 times.
|
20123 | (srcFormat == AV_PIX_FMT_GBRP12 && dstFormat == AV_PIX_FMT_GBRAP12) || |
2387 |
3/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 241 times.
✓ Branch 3 taken 19882 times.
|
20123 | (srcFormat == AV_PIX_FMT_GBRP14 && dstFormat == AV_PIX_FMT_GBRAP14) || |
2388 |
3/4✓ Branch 0 taken 241 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46 times.
✓ Branch 3 taken 20077 times.
|
20123 | (srcFormat == AV_PIX_FMT_GBRP16 && dstFormat == AV_PIX_FMT_GBRAP16) || |
2389 |
4/4✓ Branch 0 taken 37 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20113 times.
|
20123 | (srcFormat == AV_PIX_FMT_GBRAP && dstFormat == AV_PIX_FMT_GBRP) || |
2390 |
3/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20113 times.
|
20114 | (srcFormat == AV_PIX_FMT_GBRAP10 && dstFormat == AV_PIX_FMT_GBRP10) || |
2391 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20114 times.
|
20114 | (srcFormat == AV_PIX_FMT_GBRAP12 && dstFormat == AV_PIX_FMT_GBRP12) || |
2392 |
2/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 20111 times.
|
20114 | (srcFormat == AV_PIX_FMT_GBRAP14 && dstFormat == AV_PIX_FMT_GBRP14) || |
2393 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | (srcFormat == AV_PIX_FMT_GBRAP16 && dstFormat == AV_PIX_FMT_GBRP16)) |
2394 | 9 | c->convert_unscaled = planarRgbToplanarRgbWrapper; | |
2395 | |||
2396 | #define isByteRGB(f) ( \ | ||
2397 | f == AV_PIX_FMT_RGB32 || \ | ||
2398 | f == AV_PIX_FMT_RGB32_1 || \ | ||
2399 | f == AV_PIX_FMT_RGB24 || \ | ||
2400 | f == AV_PIX_FMT_BGR32 || \ | ||
2401 | f == AV_PIX_FMT_BGR32_1 || \ | ||
2402 | f == AV_PIX_FMT_BGR24) | ||
2403 | |||
2404 |
12/16✓ Branch 0 taken 730 times.
✓ Branch 1 taken 19393 times.
✓ Branch 3 taken 730 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 721 times.
✓ Branch 6 taken 9 times.
✓ Branch 7 taken 721 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 703 times.
✓ Branch 10 taken 18 times.
✓ Branch 11 taken 703 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 703 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 9 times.
✓ Branch 16 taken 694 times.
|
20123 | if (srcFormat == AV_PIX_FMT_GBRP && isPlanar(srcFormat) && isByteRGB(dstFormat)) |
2405 | 36 | c->convert_unscaled = planarRgbToRgbWrapper; | |
2406 | |||
2407 |
10/14✓ Branch 0 taken 46 times.
✓ Branch 1 taken 20077 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.
|
20123 | if (srcFormat == AV_PIX_FMT_GBRAP && isByteRGB(dstFormat)) |
2408 | 18 | c->convert_unscaled = planarRgbaToRgbWrapper; | |
2409 | |||
2410 |
6/6✓ Branch 0 taken 19252 times.
✓ Branch 1 taken 871 times.
✓ Branch 2 taken 19242 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 19241 times.
✓ Branch 5 taken 1 times.
|
20123 | if ((srcFormat == AV_PIX_FMT_RGB48LE || srcFormat == AV_PIX_FMT_RGB48BE || |
2411 |
3/4✓ Branch 0 taken 19241 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19240 times.
✓ Branch 3 taken 1 times.
|
19241 | srcFormat == AV_PIX_FMT_BGR48LE || srcFormat == AV_PIX_FMT_BGR48BE || |
2412 |
4/4✓ Branch 0 taken 19230 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 19229 times.
✓ Branch 3 taken 1 times.
|
19240 | srcFormat == AV_PIX_FMT_RGBA64LE || srcFormat == AV_PIX_FMT_RGBA64BE || |
2413 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 19229 times.
✓ Branch 2 taken 894 times.
✗ Branch 3 not taken.
|
20123 | srcFormat == AV_PIX_FMT_BGRA64LE || srcFormat == AV_PIX_FMT_BGRA64BE) && |
2414 |
3/4✓ Branch 0 taken 894 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 867 times.
✓ Branch 3 taken 27 times.
|
894 | (dstFormat == AV_PIX_FMT_GBRP9LE || dstFormat == AV_PIX_FMT_GBRP9BE || |
2415 |
4/4✓ Branch 0 taken 858 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 831 times.
✓ Branch 3 taken 27 times.
|
867 | dstFormat == AV_PIX_FMT_GBRP10LE || dstFormat == AV_PIX_FMT_GBRP10BE || |
2416 |
3/4✓ Branch 0 taken 822 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 822 times.
✗ Branch 3 not taken.
|
831 | dstFormat == AV_PIX_FMT_GBRP12LE || dstFormat == AV_PIX_FMT_GBRP12BE || |
2417 |
3/4✓ Branch 0 taken 822 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 804 times.
✓ Branch 3 taken 18 times.
|
822 | dstFormat == AV_PIX_FMT_GBRP14LE || dstFormat == AV_PIX_FMT_GBRP14BE || |
2418 |
3/4✓ Branch 0 taken 794 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 794 times.
✗ Branch 3 not taken.
|
804 | dstFormat == AV_PIX_FMT_GBRP16LE || dstFormat == AV_PIX_FMT_GBRP16BE || |
2419 |
2/4✓ Branch 0 taken 794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 794 times.
✗ Branch 3 not taken.
|
794 | dstFormat == AV_PIX_FMT_GBRAP10LE || dstFormat == AV_PIX_FMT_GBRAP10BE || |
2420 |
2/4✓ Branch 0 taken 794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 794 times.
✗ Branch 3 not taken.
|
794 | dstFormat == AV_PIX_FMT_GBRAP12LE || dstFormat == AV_PIX_FMT_GBRAP12BE || |
2421 |
2/4✓ Branch 0 taken 794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 794 times.
✗ Branch 3 not taken.
|
794 | dstFormat == AV_PIX_FMT_GBRAP14LE || dstFormat == AV_PIX_FMT_GBRAP14BE || |
2422 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 793 times.
|
794 | dstFormat == AV_PIX_FMT_GBRAP16LE || dstFormat == AV_PIX_FMT_GBRAP16BE )) |
2423 | 101 | c->convert_unscaled = Rgb16ToPlanarRgb16Wrapper; | |
2424 | |||
2425 |
4/4✓ Branch 1 taken 10556 times.
✓ Branch 2 taken 9567 times.
✓ Branch 3 taken 2571 times.
✓ Branch 4 taken 7985 times.
|
30679 | if (av_pix_fmt_desc_get(dstFormat)->comp[0].depth >= 10 && |
2426 |
4/4✓ Branch 2 taken 2482 times.
✓ Branch 3 taken 89 times.
✓ Branch 4 taken 2464 times.
✓ Branch 5 taken 18 times.
|
13127 | isPlanarRGB(dstFormat) && !isFloat(dstFormat) && |
2427 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 2446 times.
|
2464 | (srcFormat == AV_PIX_FMT_X2RGB10LE || srcFormat == AV_PIX_FMT_X2BGR10LE)) |
2428 | 36 | c->convert_unscaled = Rgb16ToPlanarRgb16Wrapper; | |
2429 | |||
2430 |
5/6✓ Branch 0 taken 20122 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 20122 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19881 times.
✓ Branch 5 taken 241 times.
|
20123 | if ((srcFormat == AV_PIX_FMT_GBRP9LE || srcFormat == AV_PIX_FMT_GBRP9BE || |
2431 |
4/4✓ Branch 0 taken 19782 times.
✓ Branch 1 taken 99 times.
✓ Branch 2 taken 18993 times.
✓ Branch 3 taken 789 times.
|
19881 | srcFormat == AV_PIX_FMT_GBRP16LE || srcFormat == AV_PIX_FMT_GBRP16BE || |
2432 |
4/4✓ Branch 0 taken 18921 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 18146 times.
✓ Branch 3 taken 775 times.
|
18993 | srcFormat == AV_PIX_FMT_GBRP10LE || srcFormat == AV_PIX_FMT_GBRP10BE || |
2433 |
4/4✓ Branch 0 taken 18074 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 18073 times.
✓ Branch 3 taken 1 times.
|
18146 | srcFormat == AV_PIX_FMT_GBRP12LE || srcFormat == AV_PIX_FMT_GBRP12BE || |
2434 |
3/4✓ Branch 0 taken 18073 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18072 times.
✓ Branch 3 taken 1 times.
|
18073 | srcFormat == AV_PIX_FMT_GBRP14LE || srcFormat == AV_PIX_FMT_GBRP14BE || |
2435 |
3/4✓ Branch 0 taken 18072 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18071 times.
✓ Branch 3 taken 1 times.
|
18072 | srcFormat == AV_PIX_FMT_GBRAP10LE || srcFormat == AV_PIX_FMT_GBRAP10BE || |
2436 |
2/4✓ Branch 0 taken 18071 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18071 times.
✗ Branch 3 not taken.
|
18071 | srcFormat == AV_PIX_FMT_GBRAP12LE || srcFormat == AV_PIX_FMT_GBRAP12BE || |
2437 |
3/4✓ Branch 0 taken 18071 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18068 times.
✓ Branch 3 taken 3 times.
|
18071 | srcFormat == AV_PIX_FMT_GBRAP14LE || srcFormat == AV_PIX_FMT_GBRAP14BE || |
2438 |
4/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 18059 times.
✓ Branch 2 taken 1955 times.
✓ Branch 3 taken 109 times.
|
20123 | srcFormat == AV_PIX_FMT_GBRAP16LE || srcFormat == AV_PIX_FMT_GBRAP16BE) && |
2439 |
2/4✓ Branch 0 taken 1955 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1955 times.
✗ Branch 3 not taken.
|
1955 | (dstFormat == AV_PIX_FMT_RGB48LE || dstFormat == AV_PIX_FMT_RGB48BE || |
2440 |
2/4✓ Branch 0 taken 1955 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1955 times.
✗ Branch 3 not taken.
|
1955 | dstFormat == AV_PIX_FMT_BGR48LE || dstFormat == AV_PIX_FMT_BGR48BE || |
2441 |
2/4✓ Branch 0 taken 1955 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1955 times.
✗ Branch 3 not taken.
|
1955 | dstFormat == AV_PIX_FMT_RGBA64LE || dstFormat == AV_PIX_FMT_RGBA64BE || |
2442 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1955 times.
|
1955 | dstFormat == AV_PIX_FMT_BGRA64LE || dstFormat == AV_PIX_FMT_BGRA64BE)) |
2443 | 109 | c->convert_unscaled = planarRgb16ToRgb16Wrapper; | |
2444 | |||
2445 |
4/4✓ Branch 1 taken 9065 times.
✓ Branch 2 taken 11058 times.
✓ Branch 3 taken 2094 times.
✓ Branch 4 taken 6971 times.
|
29188 | if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth >= 10 && |
2446 |
4/4✓ Branch 2 taken 2063 times.
✓ Branch 3 taken 31 times.
✓ Branch 4 taken 2045 times.
✓ Branch 5 taken 18 times.
|
11159 | isPlanarRGB(srcFormat) && !isFloat(srcFormat) && |
2447 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 2027 times.
|
2045 | (dstFormat == AV_PIX_FMT_X2RGB10LE || dstFormat == AV_PIX_FMT_X2BGR10LE)) |
2448 | 36 | c->convert_unscaled = planarRgb16ToRgb16Wrapper; | |
2449 | |||
2450 |
4/4✓ Branch 1 taken 10583 times.
✓ Branch 2 taken 9540 times.
✓ Branch 3 taken 1631 times.
✓ Branch 4 taken 8952 times.
|
30706 | if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth == 8 && |
2451 |
2/2✓ Branch 1 taken 100 times.
✓ Branch 2 taken 1531 times.
|
12214 | isPackedRGB(srcFormat) && dstFormat == AV_PIX_FMT_GBRP) |
2452 | 100 | c->convert_unscaled = rgbToPlanarRgbWrapper; | |
2453 | |||
2454 |
4/4✓ Branch 1 taken 10583 times.
✓ Branch 2 taken 9540 times.
✓ Branch 3 taken 1631 times.
✓ Branch 4 taken 8952 times.
|
30706 | if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth == 8 && |
2455 |
2/2✓ Branch 1 taken 81 times.
✓ Branch 2 taken 1550 times.
|
12214 | isPackedRGB(srcFormat) && dstFormat == AV_PIX_FMT_GBRAP) |
2456 | 81 | c->convert_unscaled = rgbToPlanarRgbaWrapper; | |
2457 | |||
2458 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 20123 times.
|
20123 | if (isBayer(srcFormat)) { |
2459 | ✗ | c->dst_slice_align = 2; | |
2460 | ✗ | if (dstFormat == AV_PIX_FMT_RGB24) | |
2461 | ✗ | c->convert_unscaled = bayer_to_rgb24_wrapper; | |
2462 | ✗ | else if (dstFormat == AV_PIX_FMT_RGB48) | |
2463 | ✗ | c->convert_unscaled = bayer_to_rgb48_wrapper; | |
2464 | ✗ | else if (dstFormat == AV_PIX_FMT_YUV420P) | |
2465 | ✗ | c->convert_unscaled = bayer_to_yv12_wrapper; | |
2466 | ✗ | else if (!isBayer(dstFormat)) { | |
2467 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported bayer conversion\n"); | |
2468 | ✗ | av_assert0(0); | |
2469 | } | ||
2470 | } | ||
2471 | |||
2472 | /* bswap 16 bits per pixel/component packed formats */ | ||
2473 |
3/10✗ Branch 0 not taken.
✓ Branch 1 taken 20123 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 20123 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 20123 times.
|
20123 | if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_BGGR16) || |
2474 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20123 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_RGGB16) || |
2475 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20123 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_GBRG16) || |
2476 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20123 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_GRBG16) || |
2477 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20123 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR444) || |
2478 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20122 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR48) || |
2479 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 20105 times.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR555) || |
2480 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20123 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) || |
2481 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20122 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || |
2482 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20123 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 45 times.
✓ Branch 7 taken 20078 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY9) || |
2483 |
6/8✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 45 times.
✓ Branch 3 taken 20078 times.
✓ Branch 4 taken 45 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 45 times.
✓ Branch 7 taken 20078 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY10) || |
2484 |
5/8✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 45 times.
✓ Branch 3 taken 20078 times.
✓ Branch 4 taken 45 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20123 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY12) || |
2485 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20123 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 99 times.
✓ Branch 7 taken 20024 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY14) || |
2486 |
7/8✓ Branch 0 taken 99 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 65 times.
✓ Branch 3 taken 20058 times.
✓ Branch 4 taken 63 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 45 times.
✓ Branch 7 taken 20076 times.
|
20123 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || |
2487 |
3/8✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20121 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20121 times.
|
20121 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) || |
2488 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20121 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20121 times.
|
20121 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_AYUV64) || |
2489 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20120 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 20049 times.
|
20121 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9) || |
2490 |
8/8✓ Branch 0 taken 63 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 789 times.
✓ Branch 3 taken 19323 times.
✓ Branch 4 taken 780 times.
✓ Branch 5 taken 9 times.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 20031 times.
|
20121 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) || |
2491 |
7/8✓ Branch 0 taken 63 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 775 times.
✓ Branch 3 taken 19319 times.
✓ Branch 4 taken 766 times.
✓ Branch 5 taken 9 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20085 times.
|
20103 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) || |
2492 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20084 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 99 times.
✓ Branch 7 taken 19986 times.
|
20085 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP14) || |
2493 |
7/8✓ Branch 0 taken 90 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 241 times.
✓ Branch 3 taken 19835 times.
✓ Branch 4 taken 230 times.
✓ Branch 5 taken 11 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20065 times.
|
20085 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP16) || |
2494 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20064 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20065 times.
|
20065 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP10) || |
2495 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20064 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20065 times.
|
20065 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP12) || |
2496 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20065 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 9 times.
✓ Branch 7 taken 20056 times.
|
20065 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP14) || |
2497 |
6/8✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 20062 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20063 times.
|
20065 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP16) || |
2498 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20063 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
✓ Branch 7 taken 20053 times.
|
20063 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB444) || |
2499 |
6/8✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 871 times.
✓ Branch 3 taken 19192 times.
✓ Branch 4 taken 870 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20062 times.
|
20063 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB48) || |
2500 |
4/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 178 times.
✓ Branch 3 taken 19884 times.
✓ Branch 4 taken 178 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20062 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB555) || |
2501 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 104 times.
✓ Branch 3 taken 19958 times.
✓ Branch 4 taken 104 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
✓ Branch 7 taken 20052 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB565) || |
2502 |
6/8✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20061 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19990 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGBA64) || |
2503 |
6/8✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 72 times.
✓ Branch 3 taken 19990 times.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 90 times.
✓ Branch 7 taken 19972 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_XV36) || |
2504 |
5/8✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✓ Branch 3 taken 19972 times.
✓ Branch 4 taken 90 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20062 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_XV48) || |
2505 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20062 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20062 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_XYZ12) || |
2506 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 20044 times.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19990 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P9) || |
2507 |
6/8✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
✓ Branch 3 taken 19950 times.
✓ Branch 4 taken 112 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19990 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P10) || |
2508 |
5/8✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 79 times.
✓ Branch 3 taken 19983 times.
✓ Branch 4 taken 79 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20062 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P12) || |
2509 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20062 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 90 times.
✓ Branch 7 taken 19972 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P14) || |
2510 |
5/8✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 90 times.
✓ Branch 3 taken 19972 times.
✓ Branch 4 taken 90 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20062 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P16) || |
2511 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 20053 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19990 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P9) || |
2512 |
6/8✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 122 times.
✓ Branch 3 taken 19940 times.
✓ Branch 4 taken 122 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19990 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P10) || |
2513 |
5/8✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 75 times.
✓ Branch 3 taken 19987 times.
✓ Branch 4 taken 75 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20062 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P12) || |
2514 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20062 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 90 times.
✓ Branch 7 taken 19972 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P14) || |
2515 |
7/8✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99 times.
✓ Branch 3 taken 19963 times.
✓ Branch 4 taken 90 times.
✓ Branch 5 taken 9 times.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19981 times.
|
20062 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P16) || |
2516 |
6/8✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 72 times.
✓ Branch 3 taken 19981 times.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19981 times.
|
20053 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV440P10) || |
2517 |
5/8✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 72 times.
✓ Branch 3 taken 19981 times.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20053 times.
|
20053 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV440P12) || |
2518 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20052 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19981 times.
|
20053 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P9) || |
2519 |
8/8✓ Branch 0 taken 63 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 796 times.
✓ Branch 3 taken 19248 times.
✓ Branch 4 taken 787 times.
✓ Branch 5 taken 9 times.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 19963 times.
|
20053 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P10) || |
2520 |
7/8✓ Branch 0 taken 63 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 795 times.
✓ Branch 3 taken 19231 times.
✓ Branch 4 taken 786 times.
✓ Branch 5 taken 9 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20017 times.
|
20035 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P12) || |
2521 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 20016 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 90 times.
✓ Branch 7 taken 19927 times.
|
20017 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P14) || |
2522 |
6/6✓ Branch 0 taken 81 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 252 times.
✓ Branch 3 taken 19756 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 243 times.
|
20017 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P16)) |
2523 | 124 | c->convert_unscaled = bswap_16bpc; | |
2524 | |||
2525 | /* bswap 32 bits per pixel/component formats */ | ||
2526 |
6/10✗ Branch 0 not taken.
✓ Branch 1 taken 20123 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 31 times.
✓ Branch 5 taken 20092 times.
✓ Branch 6 taken 30 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 20122 times.
|
20123 | if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRPF32) || |
2527 |
1/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 20122 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
20122 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAPF32)) |
2528 | 1 | c->convert_unscaled = bswap_32bpc; | |
2529 | |||
2530 |
11/14✓ Branch 1 taken 943 times.
✓ Branch 2 taken 19180 times.
✓ Branch 3 taken 799 times.
✓ Branch 4 taken 144 times.
✓ Branch 5 taken 799 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 97 times.
✓ Branch 8 taken 702 times.
✓ Branch 9 taken 52 times.
✓ Branch 10 taken 45 times.
✓ Branch 11 taken 52 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 52 times.
|
20123 | if (usePal(srcFormat) && isByteRGB(dstFormat)) |
2531 | 891 | c->convert_unscaled = palToRgbWrapper; | |
2532 | |||
2533 |
2/2✓ Branch 0 taken 713 times.
✓ Branch 1 taken 19410 times.
|
20123 | if (srcFormat == AV_PIX_FMT_YUV422P) { |
2534 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 713 times.
|
713 | if (dstFormat == AV_PIX_FMT_YUYV422) |
2535 | ✗ | c->convert_unscaled = yuv422pToYuy2Wrapper; | |
2536 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 713 times.
|
713 | else if (dstFormat == AV_PIX_FMT_UYVY422) |
2537 | ✗ | c->convert_unscaled = yuv422pToUyvyWrapper; | |
2538 | } | ||
2539 | |||
2540 | /* uint Y to float Y */ | ||
2541 |
3/4✓ Branch 0 taken 91 times.
✓ Branch 1 taken 20032 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 91 times.
|
20123 | if (srcFormat == AV_PIX_FMT_GRAY8 && dstFormat == AV_PIX_FMT_GRAYF32){ |
2542 | ✗ | c->convert_unscaled = uint_y_to_float_y_wrapper; | |
2543 | } | ||
2544 | |||
2545 | /* float Y to uint Y */ | ||
2546 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 20122 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
20123 | if (srcFormat == AV_PIX_FMT_GRAYF32 && dstFormat == AV_PIX_FMT_GRAY8){ |
2547 | ✗ | c->convert_unscaled = float_y_to_uint_y_wrapper; | |
2548 | } | ||
2549 | |||
2550 | /* LQ converters if -sws 0 or -sws 4*/ | ||
2551 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 20023 times.
|
20123 | if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) { |
2552 | /* yv12_to_yuy2 */ | ||
2553 |
3/4✓ Branch 0 taken 40 times.
✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
|
100 | if (srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) { |
2554 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
60 | if (dstFormat == AV_PIX_FMT_YUYV422) |
2555 | ✗ | c->convert_unscaled = planarToYuy2Wrapper; | |
2556 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
60 | else if (dstFormat == AV_PIX_FMT_UYVY422) |
2557 | ✗ | c->convert_unscaled = planarToUyvyWrapper; | |
2558 | } | ||
2559 | } | ||
2560 |
3/4✓ Branch 0 taken 73 times.
✓ Branch 1 taken 20050 times.
✓ Branch 2 taken 73 times.
✗ Branch 3 not taken.
|
20123 | if (srcFormat == AV_PIX_FMT_YUYV422 && |
2561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
|
73 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P)) |
2562 | ✗ | c->convert_unscaled = yuyvToYuv420Wrapper; | |
2563 |
3/4✓ Branch 0 taken 73 times.
✓ Branch 1 taken 20050 times.
✓ Branch 2 taken 73 times.
✗ Branch 3 not taken.
|
20123 | if (srcFormat == AV_PIX_FMT_UYVY422 && |
2564 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
|
73 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P)) |
2565 | ✗ | c->convert_unscaled = uyvyToYuv420Wrapper; | |
2566 |
3/4✓ Branch 0 taken 73 times.
✓ Branch 1 taken 20050 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 73 times.
|
20123 | if (srcFormat == AV_PIX_FMT_YUYV422 && dstFormat == AV_PIX_FMT_YUV422P) |
2567 | ✗ | c->convert_unscaled = yuyvToYuv422Wrapper; | |
2568 |
3/4✓ Branch 0 taken 73 times.
✓ Branch 1 taken 20050 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 73 times.
|
20123 | if (srcFormat == AV_PIX_FMT_UYVY422 && dstFormat == AV_PIX_FMT_YUV422P) |
2569 | ✗ | c->convert_unscaled = uyvyToYuv422Wrapper; | |
2570 |
4/4✓ Branch 0 taken 671 times.
✓ Branch 1 taken 19452 times.
✓ Branch 2 taken 619 times.
✓ Branch 3 taken 52 times.
|
20123 | if (dstFormat == AV_PIX_FMT_YUV420P && |
2571 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 567 times.
|
619 | (srcFormat == AV_PIX_FMT_NV24 || srcFormat == AV_PIX_FMT_NV42)) |
2572 | 104 | c->convert_unscaled = nv24ToYuv420Wrapper; | |
2573 | |||
2574 | #define isPlanarGray(x) (isGray(x) && (x) != AV_PIX_FMT_YA8 && (x) != AV_PIX_FMT_YA16LE && (x) != AV_PIX_FMT_YA16BE) | ||
2575 | /* simple copy */ | ||
2576 |
4/4✓ Branch 0 taken 19853 times.
✓ Branch 1 taken 270 times.
✓ Branch 2 taken 572 times.
✓ Branch 3 taken 19281 times.
|
20123 | if ( srcFormat == dstFormat || |
2577 |
3/4✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3842 times.
✓ Branch 3 taken 16011 times.
|
19853 | (srcFormat == AV_PIX_FMT_YUVA420P && dstFormat == AV_PIX_FMT_YUV420P) || |
2578 |
4/4✓ Branch 0 taken 3814 times.
✓ Branch 1 taken 28 times.
✓ Branch 2 taken 19677 times.
✓ Branch 3 taken 148 times.
|
23667 | (srcFormat == AV_PIX_FMT_YUV420P && dstFormat == AV_PIX_FMT_YUVA420P) || |
2579 |
5/12✓ Branch 3 taken 11343 times.
✓ Branch 4 taken 8334 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 11343 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 8211 times.
✓ Branch 15 taken 11466 times.
|
59179 | (isFloat(srcFormat) == isFloat(dstFormat)) && ((isPlanarYUV(srcFormat) && isPlanarGray(dstFormat)) || |
2580 |
3/10✗ Branch 2 not taken.
✓ Branch 3 taken 8211 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 19674 times.
|
47565 | (isPlanarYUV(dstFormat) && isPlanarGray(srcFormat)) || |
2581 |
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 11343 times.
✓ Branch 17 taken 8331 times.
|
39354 | (isPlanarGray(dstFormat) && isPlanarGray(srcFormat)) || |
2582 |
2/2✓ Branch 2 taken 4729 times.
✓ Branch 3 taken 6614 times.
|
31017 | (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat) && |
2583 |
2/2✓ Branch 0 taken 2068 times.
✓ Branch 1 taken 2661 times.
|
4729 | c->chrDstHSubSample == c->chrSrcHSubSample && |
2584 |
4/4✓ Branch 0 taken 1249 times.
✓ Branch 1 taken 819 times.
✓ Branch 2 taken 1023 times.
✓ Branch 3 taken 226 times.
|
3317 | c->chrDstVSubSample == c->chrSrcVSubSample && |
2585 |
2/2✓ Branch 2 taken 704 times.
✓ Branch 3 taken 319 times.
|
2272 | !isSemiPlanarYUV(srcFormat) && !isSemiPlanarYUV(dstFormat)))) |
2586 | { | ||
2587 |
2/2✓ Branch 1 taken 54 times.
✓ Branch 2 taken 951 times.
|
1005 | if (isPacked(c->srcFormat)) |
2588 | 54 | c->convert_unscaled = packedCopyWrapper; | |
2589 | else /* Planar YUV or gray */ | ||
2590 | 951 | c->convert_unscaled = planarCopyWrapper; | |
2591 | } | ||
2592 | |||
2593 | #if ARCH_PPC | ||
2594 | ff_get_unscaled_swscale_ppc(c); | ||
2595 | #elif ARCH_ARM | ||
2596 | ff_get_unscaled_swscale_arm(c); | ||
2597 | #elif ARCH_AARCH64 | ||
2598 | ff_get_unscaled_swscale_aarch64(c); | ||
2599 | #endif | ||
2600 | 20123 | } | |
2601 | |||
2602 | /* Convert the palette to the same packed 32-bit format as the palette */ | ||
2603 | 97576 | void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, | |
2604 | int num_pixels, const uint8_t *palette) | ||
2605 | { | ||
2606 | int i; | ||
2607 | |||
2608 |
2/2✓ Branch 0 taken 30214048 times.
✓ Branch 1 taken 97576 times.
|
30311624 | for (i = 0; i < num_pixels; i++) |
2609 | 30214048 | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i]]; | |
2610 | 97576 | } | |
2611 | |||
2612 | /* Palette format: ABCD -> dst format: ABC */ | ||
2613 | 717310 | void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, | |
2614 | int num_pixels, const uint8_t *palette) | ||
2615 | { | ||
2616 | int i; | ||
2617 | |||
2618 |
2/2✓ Branch 0 taken 273951884 times.
✓ Branch 1 taken 717310 times.
|
274669194 | for (i = 0; i < num_pixels; i++) { |
2619 | //FIXME slow? | ||
2620 | 273951884 | dst[0] = palette[src[i] * 4 + 0]; | |
2621 | 273951884 | dst[1] = palette[src[i] * 4 + 1]; | |
2622 | 273951884 | dst[2] = palette[src[i] * 4 + 2]; | |
2623 | 273951884 | dst += 3; | |
2624 | } | ||
2625 | 717310 | } | |
2626 |