FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2025-07-28 20:30:09
Exec Total Coverage
Lines: 1138 1414 80.5%
Functions: 222 284 78.2%
Branches: 615 870 70.7%

Line Branch Exec Source
1 /*
2 * Copyright (C) 2001-2012 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 <math.h>
22 #include <stddef.h>
23 #include <stdint.h>
24
25 #include "libavutil/bswap.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/avassert.h"
28 #include "libavutil/intfloat.h"
29 #include "config.h"
30 #include "swscale_internal.h"
31
32 #define input_pixel(pos) (is_be ? AV_RB16(pos) : AV_RL16(pos))
33
34 #define IS_BE_LE 0
35 #define IS_BE_BE 1
36 #define IS_BE_ 0
37 /* ENDIAN_IDENTIFIER needs to be "BE", "LE" or "". The latter is intended
38 * for single-byte cases where the concept of endianness does not apply. */
39 #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
40
41 #define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
42 #define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
43
44 static av_always_inline void
45 2631 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
46 enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
47 {
48 2631 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
49 int i;
50
2/2
✓ Branch 0 taken 846720 times.
✓ Branch 1 taken 2631 times.
849351 for (i = 0; i < width; i++) {
51
2/2
✓ Branch 0 taken 422784 times.
✓ Branch 1 taken 423936 times.
846720 unsigned int r_b = input_pixel(&src[i*4+0]);
52
2/2
✓ Branch 0 taken 422784 times.
✓ Branch 1 taken 423936 times.
846720 unsigned int g = input_pixel(&src[i*4+1]);
53
2/2
✓ Branch 0 taken 422784 times.
✓ Branch 1 taken 423936 times.
846720 unsigned int b_r = input_pixel(&src[i*4+2]);
54
55
12/16
✓ Branch 0 taken 846720 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 846720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 643968 times.
✓ Branch 5 taken 202752 times.
✓ Branch 6 taken 211968 times.
✓ Branch 7 taken 432000 times.
✓ Branch 8 taken 846720 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 846720 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 643968 times.
✓ Branch 13 taken 202752 times.
✓ Branch 14 taken 211968 times.
✓ Branch 15 taken 432000 times.
846720 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
56 }
57 2631 }
58
59 static av_always_inline void
60 2631 rgb64ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
61 const uint16_t *src1, const uint16_t *src2,
62 int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
63 {
64 int i;
65 2631 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
66 2631 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
67 av_assert1(src1==src2);
68
2/2
✓ Branch 0 taken 846720 times.
✓ Branch 1 taken 2631 times.
849351 for (i = 0; i < width; i++) {
69
2/2
✓ Branch 0 taken 422784 times.
✓ Branch 1 taken 423936 times.
846720 unsigned int r_b = input_pixel(&src1[i*4+0]);
70
2/2
✓ Branch 0 taken 422784 times.
✓ Branch 1 taken 423936 times.
846720 unsigned int g = input_pixel(&src1[i*4+1]);
71
2/2
✓ Branch 0 taken 422784 times.
✓ Branch 1 taken 423936 times.
846720 unsigned int b_r = input_pixel(&src1[i*4+2]);
72
73
12/16
✓ Branch 0 taken 846720 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 846720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 643968 times.
✓ Branch 5 taken 202752 times.
✓ Branch 6 taken 211968 times.
✓ Branch 7 taken 432000 times.
✓ Branch 8 taken 846720 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 846720 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 643968 times.
✓ Branch 13 taken 202752 times.
✓ Branch 14 taken 211968 times.
✓ Branch 15 taken 432000 times.
846720 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
74
12/16
✓ Branch 0 taken 846720 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 846720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 643968 times.
✓ Branch 5 taken 202752 times.
✓ Branch 6 taken 211968 times.
✓ Branch 7 taken 432000 times.
✓ Branch 8 taken 846720 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 846720 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 643968 times.
✓ Branch 13 taken 202752 times.
✓ Branch 14 taken 211968 times.
✓ Branch 15 taken 432000 times.
846720 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
75 }
76 2631 }
77
78 static av_always_inline void
79 rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
80 const uint16_t *src1, const uint16_t *src2,
81 int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
82 {
83 int i;
84 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
85 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
86 av_assert1(src1==src2);
87 for (i = 0; i < width; i++) {
88 unsigned r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
89 unsigned g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
90 unsigned b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
91
92 dstU[i]= (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
93 dstV[i]= (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
94 }
95 }
96
97 #define RGB64FUNCS_EXT(pattern, BE_LE, origin, is_be) \
98 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\
99 int width, uint32_t *rgb2yuv, void *opq) \
100 { \
101 const uint16_t *src = (const uint16_t *) _src; \
102 uint16_t *dst = (uint16_t *) _dst; \
103 rgb64ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
104 } \
105 \
106 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
107 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
108 int width, uint32_t *rgb2yuv, void *opq) \
109 { \
110 const uint16_t *src1 = (const uint16_t *) _src1, \
111 *src2 = (const uint16_t *) _src2; \
112 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
113 rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
114 } \
115 \
116 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
117 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
118 int width, uint32_t *rgb2yuv, void *opq) \
119 { \
120 const uint16_t *src1 = (const uint16_t *) _src1, \
121 *src2 = (const uint16_t *) _src2; \
122 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
123 rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
124 }
125 #define RGB64FUNCS(pattern, endianness, base_fmt) \
126 RGB64FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
127
128 2688 RGB64FUNCS(rgb, LE, AV_PIX_FMT_RGBA64)
129 2844 RGB64FUNCS(rgb, BE, AV_PIX_FMT_RGBA64)
130 2688 RGB64FUNCS(bgr, LE, AV_PIX_FMT_BGRA64)
131 2304 RGB64FUNCS(bgr, BE, AV_PIX_FMT_BGRA64)
132
133 888745 static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
134 const uint16_t *src, int width,
135 enum AVPixelFormat origin,
136 int32_t *rgb2yuv, int is_be)
137 {
138 888745 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
139 int i;
140
2/2
✓ Branch 0 taken 312218248 times.
✓ Branch 1 taken 888745 times.
313106993 for (i = 0; i < width; i++) {
141
2/2
✓ Branch 0 taken 625536 times.
✓ Branch 1 taken 311592712 times.
312218248 unsigned int r_b = input_pixel(&src[i * 3 + 0]);
142
2/2
✓ Branch 0 taken 625536 times.
✓ Branch 1 taken 311592712 times.
312218248 unsigned int g = input_pixel(&src[i * 3 + 1]);
143
2/2
✓ Branch 0 taken 625536 times.
✓ Branch 1 taken 311592712 times.
312218248 unsigned int b_r = input_pixel(&src[i * 3 + 2]);
144
145
12/16
✓ Branch 0 taken 312015496 times.
✓ Branch 1 taken 202752 times.
✓ Branch 2 taken 311803528 times.
✓ Branch 3 taken 211968 times.
✓ Branch 4 taken 311803528 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 311803528 times.
✓ Branch 8 taken 312015496 times.
✓ Branch 9 taken 202752 times.
✓ Branch 10 taken 311803528 times.
✓ Branch 11 taken 211968 times.
✓ Branch 12 taken 311803528 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 311803528 times.
312218248 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
146 }
147 888745 }
148
149 496069 static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
150 uint16_t *dstV,
151 const uint16_t *src1,
152 const uint16_t *src2,
153 int width,
154 enum AVPixelFormat origin,
155 int32_t *rgb2yuv, int is_be)
156 {
157 int i;
158 496069 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
159 496069 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
160 av_assert1(src1 == src2);
161
2/2
✓ Branch 0 taken 174536896 times.
✓ Branch 1 taken 496069 times.
175032965 for (i = 0; i < width; i++) {
162
2/2
✓ Branch 0 taken 625536 times.
✓ Branch 1 taken 173911360 times.
174536896 unsigned r_b = input_pixel(&src1[i * 3 + 0]);
163
2/2
✓ Branch 0 taken 625536 times.
✓ Branch 1 taken 173911360 times.
174536896 unsigned g = input_pixel(&src1[i * 3 + 1]);
164
2/2
✓ Branch 0 taken 625536 times.
✓ Branch 1 taken 173911360 times.
174536896 unsigned b_r = input_pixel(&src1[i * 3 + 2]);
165
166
12/16
✓ Branch 0 taken 174334144 times.
✓ Branch 1 taken 202752 times.
✓ Branch 2 taken 174122176 times.
✓ Branch 3 taken 211968 times.
✓ Branch 4 taken 174122176 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 174122176 times.
✓ Branch 8 taken 174334144 times.
✓ Branch 9 taken 202752 times.
✓ Branch 10 taken 174122176 times.
✓ Branch 11 taken 211968 times.
✓ Branch 12 taken 174122176 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 174122176 times.
174536896 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
167
12/16
✓ Branch 0 taken 174334144 times.
✓ Branch 1 taken 202752 times.
✓ Branch 2 taken 174122176 times.
✓ Branch 3 taken 211968 times.
✓ Branch 4 taken 174122176 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 174122176 times.
✓ Branch 8 taken 174334144 times.
✓ Branch 9 taken 202752 times.
✓ Branch 10 taken 174122176 times.
✓ Branch 11 taken 211968 times.
✓ Branch 12 taken 174122176 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 174122176 times.
174536896 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
168 }
169 496069 }
170
171 401672 static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
172 uint16_t *dstV,
173 const uint16_t *src1,
174 const uint16_t *src2,
175 int width,
176 enum AVPixelFormat origin,
177 int32_t *rgb2yuv, int is_be)
178 {
179 int i;
180 401672 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
181 401672 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
182 av_assert1(src1 == src2);
183
2/2
✓ Branch 0 taken 70423972 times.
✓ Branch 1 taken 401672 times.
70825644 for (i = 0; i < width; i++) {
184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 unsigned r_b = (input_pixel(&src1[6 * i + 0]) +
185
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 input_pixel(&src1[6 * i + 3]) + 1) >> 1;
186
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 unsigned g = (input_pixel(&src1[6 * i + 1]) +
187
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 input_pixel(&src1[6 * i + 4]) + 1) >> 1;
188
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 unsigned b_r = (input_pixel(&src1[6 * i + 2]) +
189
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 input_pixel(&src1[6 * i + 5]) + 1) >> 1;
190
191
8/16
✓ Branch 0 taken 70423972 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70423972 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 70423972 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 70423972 times.
✓ Branch 8 taken 70423972 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 70423972 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 70423972 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 70423972 times.
70423972 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
192
8/16
✓ Branch 0 taken 70423972 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70423972 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 70423972 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 70423972 times.
✓ Branch 8 taken 70423972 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 70423972 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 70423972 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 70423972 times.
70423972 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
193 }
194 401672 }
195
196 #undef r
197 #undef b
198 #undef input_pixel
199
200 #define RGB48FUNCS_EXT(pattern, BE_LE, origin, is_be) \
201 static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
202 const uint8_t *_src, \
203 const uint8_t *unused0, const uint8_t *unused1,\
204 int width, \
205 uint32_t *rgb2yuv, \
206 void *opq) \
207 { \
208 const uint16_t *src = (const uint16_t *)_src; \
209 uint16_t *dst = (uint16_t *)_dst; \
210 rgb48ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
211 } \
212 \
213 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
214 uint8_t *_dstV, \
215 const uint8_t *unused0, \
216 const uint8_t *_src1, \
217 const uint8_t *_src2, \
218 int width, \
219 uint32_t *rgb2yuv, \
220 void *opq) \
221 { \
222 const uint16_t *src1 = (const uint16_t *)_src1, \
223 *src2 = (const uint16_t *)_src2; \
224 uint16_t *dstU = (uint16_t *)_dstU, \
225 *dstV = (uint16_t *)_dstV; \
226 rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
227 } \
228 \
229 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
230 uint8_t *_dstV, \
231 const uint8_t *unused0, \
232 const uint8_t *_src1, \
233 const uint8_t *_src2, \
234 int width, \
235 uint32_t *rgb2yuv, \
236 void *opq) \
237 { \
238 const uint16_t *src1 = (const uint16_t *)_src1, \
239 *src2 = (const uint16_t *)_src2; \
240 uint16_t *dstU = (uint16_t *)_dstU, \
241 *dstV = (uint16_t *)_dstV; \
242 rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
243 }
244 #define RGB48FUNCS(pattern, endianness, base_fmt) \
245 RGB48FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
246
247 3562832 RGB48FUNCS(rgb, LE, AV_PIX_FMT_RGB48)
248 5148 RGB48FUNCS(rgb, BE, AV_PIX_FMT_RGB48)
249 2688 RGB48FUNCS(bgr, LE, AV_PIX_FMT_BGR48)
250 2304 RGB48FUNCS(bgr, BE, AV_PIX_FMT_BGR48)
251
252 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
253 origin == AV_PIX_FMT_BGRA || \
254 origin == AV_PIX_FMT_ARGB || \
255 origin == AV_PIX_FMT_ABGR) \
256 ? AV_RN32A(&src[(i) * 4]) \
257 : ((origin == AV_PIX_FMT_X2RGB10LE || \
258 origin == AV_PIX_FMT_X2BGR10LE) \
259 ? AV_RL32(&src[(i) * 4]) \
260 : (is_be ? AV_RB16(&src[(i) * 2]) \
261 : AV_RL16(&src[(i) * 2]))))
262
263 1089674 static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
264 const uint8_t *src,
265 int width,
266 enum AVPixelFormat origin,
267 int shr, int shg,
268 int shb, int shp,
269 int maskr, int maskg,
270 int maskb, int rsh,
271 int gsh, int bsh, int S,
272 int32_t *rgb2yuv, int is_be)
273 {
274 1089674 const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
275 1089674 const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
276 int i;
277
278
2/2
✓ Branch 0 taken 383076529 times.
✓ Branch 1 taken 1089674 times.
384166203 for (i = 0; i < width; i++) {
279
14/14
✓ Branch 0 taken 185840736 times.
✓ Branch 1 taken 197235793 times.
✓ Branch 2 taken 185313440 times.
✓ Branch 3 taken 527296 times.
✓ Branch 4 taken 184898528 times.
✓ Branch 5 taken 414912 times.
✓ Branch 6 taken 492480 times.
✓ Branch 7 taken 184406048 times.
✓ Branch 8 taken 160847392 times.
✓ Branch 9 taken 23558656 times.
✓ Branch 10 taken 23558656 times.
✓ Branch 11 taken 137288736 times.
✓ Branch 12 taken 1216512 times.
✓ Branch 13 taken 136072224 times.
383076529 int px = input_pixel(i) >> shp;
280 383076529 int b = (px & maskb) >> shb;
281 383076529 int g = (px & maskg) >> shg;
282 383076529 int r = (px & maskr) >> shr;
283
284 383076529 dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
285 }
286 1089674 }
287
288 635320 static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
289 int16_t *dstV,
290 const uint8_t *src,
291 int width,
292 enum AVPixelFormat origin,
293 int shr, int shg,
294 int shb, int shp,
295 int maskr, int maskg,
296 int maskb, int rsh,
297 int gsh, int bsh, int S,
298 int32_t *rgb2yuv, int is_be)
299 {
300 635320 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
301 635320 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
302 635320 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
303 int i;
304
305
2/2
✓ Branch 0 taken 194329993 times.
✓ Branch 1 taken 635320 times.
194965313 for (i = 0; i < width; i++) {
306
13/14
✓ Branch 0 taken 106989120 times.
✓ Branch 1 taken 87340873 times.
✓ Branch 2 taken 106539648 times.
✓ Branch 3 taken 449472 times.
✓ Branch 4 taken 106124736 times.
✓ Branch 5 taken 414912 times.
✓ Branch 6 taken 414912 times.
✓ Branch 7 taken 105709824 times.
✓ Branch 8 taken 82151168 times.
✓ Branch 9 taken 23558656 times.
✓ Branch 10 taken 23558656 times.
✓ Branch 11 taken 58592512 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 58592512 times.
194329993 int px = input_pixel(i) >> shp;
307 194329993 int b = (px & maskb) >> shb;
308 194329993 int g = (px & maskg) >> shg;
309 194329993 int r = (px & maskr) >> shr;
310
311 194329993 dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
312 194329993 dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
313 }
314 635320 }
315
316 391828 static av_always_inline void rgb16_32ToUV_half_c_template(int16_t *dstU,
317 int16_t *dstV,
318 const uint8_t *src,
319 int width,
320 enum AVPixelFormat origin,
321 int shr, int shg,
322 int shb, int shp,
323 int maskr, int maskg,
324 int maskb, int rsh,
325 int gsh, int bsh, int S,
326 int32_t *rgb2yuv, int is_be)
327 {
328 391828 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
329 391828 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
330 391828 maskgx = ~(maskr | maskb);
331 391828 const unsigned rnd = (256U<<(S)) + (1<<(S-6));
332 int i;
333
334 391828 maskr |= maskr << 1;
335 391828 maskb |= maskb << 1;
336 391828 maskg |= maskg << 1;
337
2/2
✓ Branch 0 taken 84659126 times.
✓ Branch 1 taken 391828 times.
85050954 for (i = 0; i < width; i++) {
338
12/14
✓ Branch 0 taken 39436240 times.
✓ Branch 1 taken 45222886 times.
✓ Branch 2 taken 39393552 times.
✓ Branch 3 taken 42688 times.
✓ Branch 4 taken 39390416 times.
✓ Branch 5 taken 3136 times.
✓ Branch 6 taken 42304 times.
✓ Branch 7 taken 39348112 times.
✓ Branch 8 taken 39348112 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 39348112 times.
✓ Branch 12 taken 608256 times.
✓ Branch 13 taken 38739856 times.
84659126 unsigned px0 = input_pixel(2 * i + 0) >> shp;
339
12/14
✓ Branch 0 taken 39436240 times.
✓ Branch 1 taken 45222886 times.
✓ Branch 2 taken 39393552 times.
✓ Branch 3 taken 42688 times.
✓ Branch 4 taken 39390416 times.
✓ Branch 5 taken 3136 times.
✓ Branch 6 taken 42304 times.
✓ Branch 7 taken 39348112 times.
✓ Branch 8 taken 39348112 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 39348112 times.
✓ Branch 12 taken 608256 times.
✓ Branch 13 taken 38739856 times.
84659126 unsigned px1 = input_pixel(2 * i + 1) >> shp;
340 84659126 int b, r, g = (px0 & maskgx) + (px1 & maskgx);
341 84659126 int rb = px0 + px1 - g;
342
343 84659126 b = (rb & maskb) >> shb;
344
4/4
✓ Branch 0 taken 84613686 times.
✓ Branch 1 taken 45440 times.
✓ Branch 2 taken 84512310 times.
✓ Branch 3 taken 101376 times.
84659126 if (shp ||
345
4/4
✓ Branch 0 taken 84410934 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 76677458 times.
✓ Branch 3 taken 7733476 times.
84512310 origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
346
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 76576082 times.
76677458 origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
347 8083044 g >>= shg;
348 } else {
349 76576082 g = (g & maskg) >> shg;
350 }
351 84659126 r = (rb & maskr) >> shr;
352
353 84659126 dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);
354 84659126 dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);
355 }
356 391828 }
357
358 #undef input_pixel
359
360 #define RGB16_32FUNCS_EXT(fmt, name, shr, shg, shb, shp, maskr, \
361 maskg, maskb, rsh, gsh, bsh, S, is_be) \
362 static void name ## ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, \
363 int width, uint32_t *tab, void *opq) \
364 { \
365 rgb16_32ToY_c_template((int16_t*)dst, src, width, fmt, shr, shg, shb, shp, \
366 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
367 } \
368 \
369 static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
370 const uint8_t *unused0, const uint8_t *src, const uint8_t *dummy, \
371 int width, uint32_t *tab, void *opq) \
372 { \
373 rgb16_32ToUV_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
374 shr, shg, shb, shp, \
375 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
376 } \
377 \
378 static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
379 const uint8_t *unused0, const uint8_t *src, \
380 const uint8_t *dummy, \
381 int width, uint32_t *tab, void *opq) \
382 { \
383 rgb16_32ToUV_half_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
384 shr, shg, shb, shp, \
385 maskr, maskg, maskb, \
386 rsh, gsh, bsh, S, tab, is_be); \
387 }
388
389 #define RGB16_32FUNCS(base_fmt, endianness, name, shr, shg, shb, shp, maskr, \
390 maskg, maskb, rsh, gsh, bsh, S) \
391 RGB16_32FUNCS_EXT(base_fmt ## endianness, name, shr, shg, shb, shp, maskr, \
392 maskg, maskb, rsh, gsh, bsh, S, IS_BE(endianness))
393
394 2094782 RGB16_32FUNCS(AV_PIX_FMT_BGR32, , bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
395 4672 RGB16_32FUNCS(AV_PIX_FMT_BGR32_1, , bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
396 8204 RGB16_32FUNCS(AV_PIX_FMT_RGB32, , rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
397 5890 RGB16_32FUNCS(AV_PIX_FMT_RGB32_1, , rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
398 2304 RGB16_32FUNCS(AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
399 2304 RGB16_32FUNCS(AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
400 2304 RGB16_32FUNCS(AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
401 514816 RGB16_32FUNCS(AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
402 1046816 RGB16_32FUNCS(AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
403 2304 RGB16_32FUNCS(AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
404 2304 RGB16_32FUNCS(AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
405 2304 RGB16_32FUNCS(AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
406 2304 RGB16_32FUNCS(AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
407 2304 RGB16_32FUNCS(AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
408 2304 RGB16_32FUNCS(AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
409 2304 RGB16_32FUNCS(AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
410 267712 RGB16_32FUNCS(AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
411 267712 RGB16_32FUNCS(AV_PIX_FMT_X2BGR10, LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0, RGB2YUV_SHIFT + 6)
412
413 363972 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
414 const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
415 int width, uint32_t *rgb2yuv, void *opq)
416 {
417 363972 uint16_t *dstU = (uint16_t *)_dstU;
418 363972 uint16_t *dstV = (uint16_t *)_dstV;
419 363972 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
420 363972 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
421
422 int i;
423
2/2
✓ Branch 0 taken 64059072 times.
✓ Branch 1 taken 363972 times.
64423044 for (i = 0; i < width; i++) {
424 64059072 unsigned int g = gsrc[2*i] + gsrc[2*i+1];
425 64059072 unsigned int b = bsrc[2*i] + bsrc[2*i+1];
426 64059072 unsigned int r = rsrc[2*i] + rsrc[2*i+1];
427
428 64059072 dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
429 64059072 dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
430 }
431 363972 }
432
433 1152 static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
434 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
435 {
436 1152 int16_t *dst = (int16_t *)_dst;
437 1152 const uint16_t *src = (const uint16_t *)_src;
438 int i;
439
2/2
✓ Branch 0 taken 405504 times.
✓ Branch 1 taken 1152 times.
406656 for (i = 0; i < width; i++)
440 405504 dst[i] = AV_RL16(src + 4 * i + 3);
441 1152 }
442
443 1152 static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
444 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
445 {
446 1152 int16_t *dst = (int16_t *)_dst;
447 1152 const uint16_t *src = (const uint16_t *)_src;
448 int i;
449
2/2
✓ Branch 0 taken 405504 times.
✓ Branch 1 taken 1152 times.
406656 for (i = 0; i < width; i++)
450 405504 dst[i] = AV_RB16(src + 4 * i + 3);
451 1152 }
452
453 2607 static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
454 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
455 {
456 2607 int16_t *dst = (int16_t *)_dst;
457 int i;
458
2/2
✓ Branch 0 taken 888576 times.
✓ Branch 1 taken 2607 times.
891183 for (i=0; i<width; i++) {
459 888576 dst[i]= src[4*i]<<6 | src[4*i]>>2;
460 }
461 2607 }
462
463 97754 static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
464 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
465 {
466 97754 int16_t *dst = (int16_t *)_dst;
467 int i;
468
2/2
✓ Branch 0 taken 68284936 times.
✓ Branch 1 taken 97754 times.
68382690 for (i=0; i<width; i++) {
469 68284936 dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
470 }
471 97754 }
472
473 static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
474 const uint8_t *unused2, int width, uint32_t *pal, void *opq)
475 {
476 int16_t *dst = (int16_t *)_dst;
477 int i;
478 for (i=0; i<width; i++) {
479 int d= src[i];
480
481 dst[i]= (pal[d] >> 24)<<6 | pal[d]>>26;
482 }
483 }
484
485 186471 static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
486 const uint8_t *unused2, int width, uint32_t *pal, void *opq)
487 {
488 186471 int16_t *dst = (int16_t *)_dst;
489 int i;
490
2/2
✓ Branch 0 taken 63833880 times.
✓ Branch 1 taken 186471 times.
64020351 for (i = 0; i < width; i++) {
491 63833880 int d = src[i];
492
493 63833880 dst[i] = (pal[d] & 0xFF)<<6;
494 }
495 186471 }
496
497 186471 static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV,
498 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
499 int width, uint32_t *pal, void *opq)
500 {
501 186471 uint16_t *dstU = (uint16_t *)_dstU;
502 186471 int16_t *dstV = (int16_t *)_dstV;
503 int i;
504 av_assert1(src1 == src2);
505
2/2
✓ Branch 0 taken 63833880 times.
✓ Branch 1 taken 186471 times.
64020351 for (i = 0; i < width; i++) {
506 63833880 int p = pal[src1[i]];
507
508 63833880 dstU[i] = (uint8_t)(p>> 8)<<6;
509 63833880 dstV[i] = (uint8_t)(p>>16)<<6;
510 }
511 186471 }
512
513 103448 static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
514 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
515 {
516 103448 int16_t *dst = (int16_t *)_dst;
517 int i, j;
518 103448 width = (width + 7) >> 3;
519
2/2
✓ Branch 0 taken 4120412 times.
✓ Branch 1 taken 103448 times.
4223860 for (i = 0; i < width; i++) {
520 4120412 int d = ~src[i];
521
2/2
✓ Branch 0 taken 32963296 times.
✓ Branch 1 taken 4120412 times.
37083708 for (j = 0; j < 8; j++)
522 32963296 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
523 }
524
1/2
✓ Branch 0 taken 103448 times.
✗ Branch 1 not taken.
103448 if(width&7){
525 103448 int d= ~src[i];
526
2/2
✓ Branch 0 taken 436492 times.
✓ Branch 1 taken 103448 times.
539940 for (j = 0; j < (width&7); j++)
527 436492 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
528 }
529 103448 }
530
531 92098 static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
532 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
533 {
534 92098 int16_t *dst = (int16_t *)_dst;
535 int i, j;
536 92098 width = (width + 7) >> 3;
537
2/2
✓ Branch 0 taken 4052312 times.
✓ Branch 1 taken 92098 times.
4144410 for (i = 0; i < width; i++) {
538 4052312 int d = src[i];
539
2/2
✓ Branch 0 taken 32418496 times.
✓ Branch 1 taken 4052312 times.
36470808 for (j = 0; j < 8; j++)
540 32418496 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
541 }
542
1/2
✓ Branch 0 taken 92098 times.
✗ Branch 1 not taken.
92098 if(width&7){
543 92098 int d = src[i];
544
2/2
✓ Branch 0 taken 368392 times.
✓ Branch 1 taken 92098 times.
460490 for (j = 0; j < (width&7); j++)
545 368392 dst[8*i+j] = ((d>>(7-j))&1) * 16383;
546 }
547 92098 }
548
549 185042 static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
550 uint32_t *unused, void *opq)
551 {
552 int i;
553
2/2
✓ Branch 0 taken 65074304 times.
✓ Branch 1 taken 185042 times.
65259346 for (i = 0; i < width; i++)
554 65074304 dst[i] = src[2 * i];
555 185042 }
556
557 92098 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
558 const uint8_t *src2, int width, uint32_t *unused, void *opq)
559 {
560 int i;
561
2/2
✓ Branch 0 taken 16209248 times.
✓ Branch 1 taken 92098 times.
16301346 for (i = 0; i < width; i++) {
562 16209248 dstU[i] = src1[4 * i + 1];
563 16209248 dstV[i] = src1[4 * i + 3];
564 }
565 av_assert1(src1 == src2);
566 92098 }
567
568 92098 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
569 const uint8_t *src2, int width, uint32_t *unused, void *opq)
570 {
571 int i;
572
2/2
✓ Branch 0 taken 16209248 times.
✓ Branch 1 taken 92098 times.
16301346 for (i = 0; i < width; i++) {
573 16209248 dstV[i] = src1[4 * i + 1];
574 16209248 dstU[i] = src1[4 * i + 3];
575 }
576 av_assert1(src1 == src2);
577 92098 }
578
579 #define y21xle_wrapper(bits, shift) \
580 static void y2 ## bits ## le_UV_c(uint8_t *dstU, uint8_t *dstV, \
581 const uint8_t *unused0, \
582 const uint8_t *src, \
583 const uint8_t *unused1, int width, \
584 uint32_t *unused2, void *opq) \
585 { \
586 int i; \
587 for (i = 0; i < width; i++) { \
588 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> shift); \
589 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> shift); \
590 } \
591 } \
592 \
593 static void y2 ## bits ## le_Y_c(uint8_t *dst, const uint8_t *src, \
594 const uint8_t *unused0, \
595 const uint8_t *unused1, int width, \
596 uint32_t *unused2, void *opq) \
597 { \
598 int i; \
599 for (i = 0; i < width; i++) \
600 AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> shift); \
601 }
602
603
2/2
✓ Branch 0 taken 48475680 times.
✓ Branch 1 taken 183620 times.
97318600 y21xle_wrapper(10, 6)
604
2/2
✓ Branch 0 taken 48475680 times.
✓ Branch 1 taken 183620 times.
97318600 y21xle_wrapper(12, 4)
605
2/2
✓ Branch 0 taken 61613376 times.
✓ Branch 1 taken 233384 times.
123693520 y21xle_wrapper(16, 0)
606
607 1651354 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
608 uint32_t *unused, void *opq)
609 {
610 int i;
611 1651354 const uint16_t *src = (const uint16_t *)_src;
612 1651354 uint16_t *dst = (uint16_t *)_dst;
613
2/2
✓ Branch 0 taken 581216128 times.
✓ Branch 1 taken 1651354 times.
582867482 for (i = 0; i < width; i++)
614 581216128 dst[i] = av_bswap16(src[i]);
615 1651354 }
616
617 792884 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
618 const uint8_t *_src2, int width, uint32_t *unused, void *opq)
619 {
620 int i;
621 792884 const uint16_t *src1 = (const uint16_t *)_src1,
622 792884 *src2 = (const uint16_t *)_src2;
623 792884 uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
624
2/2
✓ Branch 0 taken 196232960 times.
✓ Branch 1 taken 792884 times.
197025844 for (i = 0; i < width; i++) {
625 196232960 dstU[i] = av_bswap16(src1[i]);
626 196232960 dstV[i] = av_bswap16(src2[i]);
627 }
628 792884 }
629
630 576 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
631 uint32_t *unused, void *opq)
632 {
633 int i;
634
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
635 202752 AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
636 576 }
637
638 576 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
639 uint32_t *unused, void *opq)
640 {
641 int i;
642
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
643 202752 AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
644 576 }
645
646 846 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
647 uint32_t *unused, void *opq)
648 {
649 int i;
650
2/2
✓ Branch 0 taken 237312 times.
✓ Branch 1 taken 846 times.
238158 for (i = 0; i < width; i++)
651 237312 AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
652 846 }
653
654 576 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
655 uint32_t *unused, void *opq)
656 {
657 int i;
658
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
659 202752 AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
660 576 }
661
662 117268 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
663 uint32_t *unused2, void *opq)
664 {
665 int i;
666
2/2
✓ Branch 0 taken 41278336 times.
✓ Branch 1 taken 117268 times.
41395604 for (i = 0; i < width; i++)
667 41278336 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
668 117268 }
669
670 117268 static void read_ayuv64be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
671 uint32_t *unused2, void *opq)
672 {
673 int i;
674
2/2
✓ Branch 0 taken 41278336 times.
✓ Branch 1 taken 117268 times.
41395604 for (i = 0; i < width; i++)
675 41278336 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2));
676 117268 }
677
678 117268 static av_always_inline void ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width,
679 int u_offset, int v_offset)
680 {
681 int i;
682
2/2
✓ Branch 0 taken 41278336 times.
✓ Branch 1 taken 117268 times.
41395604 for (i = 0; i < width; i++) {
683 41278336 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + u_offset));
684 41278336 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + v_offset));
685 }
686 117268 }
687
688 117268 static av_always_inline void ayuv64be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width,
689 int u_offset, int v_offset)
690 {
691 int i;
692
2/2
✓ Branch 0 taken 41278336 times.
✓ Branch 1 taken 117268 times.
41395604 for (i = 0; i < width; i++) {
693 41278336 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + u_offset));
694 41278336 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + v_offset));
695 }
696 117268 }
697
698 #define ayuv64_UV_funcs(pixfmt, U, V) \
699 static void read_ ## pixfmt ## le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, \
700 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
701 { \
702 ayuv64le_UV_c(dstU, dstV, src, width, U, V); \
703 } \
704 \
705 static void read_ ## pixfmt ## be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, \
706 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
707 { \
708 ayuv64be_UV_c(dstU, dstV, src, width, U, V); \
709 }
710
711 2304 ayuv64_UV_funcs(ayuv64, 4, 6)
712 466768 ayuv64_UV_funcs(xv48, 0, 4)
713
714 576 static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
715 uint32_t *unused2, void *opq)
716 {
717 int i;
718
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
719 202752 AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
720 576 }
721
722 576 static void read_ayuv64be_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
723 uint32_t *unused2, void *opq)
724 {
725 int i;
726
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
727 202752 AV_WN16(dst + i * 2, AV_RB16(src + i * 8));
728 576 }
729
730 92674 static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
731 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
732 {
733 int i;
734
2/2
✓ Branch 0 taken 32621248 times.
✓ Branch 1 taken 92674 times.
32713922 for (i = 0; i < width; i++) {
735 32621248 dstU[i] = src[i * 4 + 1];
736 32621248 dstV[i] = src[i * 4];
737 }
738 92674 }
739
740 92674 static void read_vuyx_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
741 uint32_t *unused2, void *opq)
742 {
743 int i;
744
2/2
✓ Branch 0 taken 32621248 times.
✓ Branch 1 taken 92674 times.
32713922 for (i = 0; i < width; i++)
745 32621248 dst[i] = src[i * 4 + 2];
746 92674 }
747
748 1152 static void read_vuya_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
749 uint32_t *unused2, void *opq)
750 {
751 int i;
752
2/2
✓ Branch 0 taken 405504 times.
✓ Branch 1 taken 1152 times.
406656 for (i = 0; i < width; i++)
753 405504 dst[i] = src[i * 4 + 3];
754 1152 }
755
756 576 static void read_ayuv_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
757 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
758 {
759 int i;
760
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++) {
761 202752 dstU[i] = src[i * 4 + 2];
762 202752 dstV[i] = src[i * 4 + 3];
763 }
764 576 }
765
766 46052 static void read_ayuv_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
767 uint32_t *unused2, void *opq)
768 {
769 int i;
770
2/2
✓ Branch 0 taken 15669704 times.
✓ Branch 1 taken 46052 times.
15715756 for (i = 0; i < width; i++)
771 15669704 dst[i] = src[i * 4 + 1];
772 46052 }
773
774 576 static void read_ayuv_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
775 uint32_t *unused2, void *opq)
776 {
777 int i;
778
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
779 202752 dst[i] = src[i * 4];
780 576 }
781
782 23026 static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
783 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
784 {
785 int i;
786
2/2
✓ Branch 0 taken 7834852 times.
✓ Branch 1 taken 23026 times.
7857878 for (i = 0; i < width; i++) {
787 7834852 dstU[i] = src[i * 4];
788 7834852 dstV[i] = src[i * 4 + 2];
789 }
790 23026 }
791
792 136998 static void vyuToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
793 uint32_t *unused2, void *opq)
794 {
795 int i;
796
2/2
✓ Branch 0 taken 47682696 times.
✓ Branch 1 taken 136998 times.
47819694 for (i = 0; i < width; i++)
797 47682696 dst[i] = src[i * 3 + 1];
798 136998 }
799
800 114548 static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
801 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
802 {
803 int i;
804
2/2
✓ Branch 0 taken 40050596 times.
✓ Branch 1 taken 114548 times.
40165144 for (i = 0; i < width; i++) {
805 40050596 dstU[i] = src[i * 3 + 2];
806 40050596 dstV[i] = src[i * 3];
807 }
808 114548 }
809
810 136981 static void read_v30xle_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
811 uint32_t *unused2, void *opq)
812 {
813 int i;
814
2/2
✓ Branch 0 taken 47650696 times.
✓ Branch 1 taken 136981 times.
47787677 for (i = 0; i < width; i++)
815 47650696 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
816 136981 }
817
818
819 114531 static void read_v30xle_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
820 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
821 {
822 int i;
823
2/2
✓ Branch 0 taken 40018596 times.
✓ Branch 1 taken 114531 times.
40133127 for (i = 0; i < width; i++) {
824 40018596 unsigned int uv = AV_RL32(src + i * 4);
825 40018596 AV_WN16(dstU + i * 2, (uv >> 2) & 0x3FFu);
826 40018596 AV_WN16(dstV + i * 2, (uv >> 22) & 0x3FFu);
827 }
828 114531 }
829
830 91810 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
831 uint32_t *unused2, void *opq)
832 {
833 int i;
834
2/2
✓ Branch 0 taken 32317120 times.
✓ Branch 1 taken 91810 times.
32408930 for (i = 0; i < width; i++)
835 32317120 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
836 91810 }
837
838
839 91810 static void read_xv30le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
840 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
841 {
842 int i;
843
2/2
✓ Branch 0 taken 32317120 times.
✓ Branch 1 taken 91810 times.
32408930 for (i = 0; i < width; i++) {
844 32317120 AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
845 32317120 AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
846 }
847 91810 }
848
849 91810 static void read_xv36le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
850 uint32_t *unused2, void *opq)
851 {
852 int i;
853
2/2
✓ Branch 0 taken 32317120 times.
✓ Branch 1 taken 91810 times.
32408930 for (i = 0; i < width; i++)
854 32317120 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
855 91810 }
856
857
858 91810 static void read_xv36le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
859 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
860 {
861 int i;
862
2/2
✓ Branch 0 taken 32317120 times.
✓ Branch 1 taken 91810 times.
32408930 for (i = 0; i < width; i++) {
863 32317120 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
864 32317120 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
865 }
866 91810 }
867
868 91810 static void read_xv36be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
869 uint32_t *unused2, void *opq)
870 {
871 int i;
872
2/2
✓ Branch 0 taken 32317120 times.
✓ Branch 1 taken 91810 times.
32408930 for (i = 0; i < width; i++)
873 32317120 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2) >> 4);
874 91810 }
875
876
877 91810 static void read_xv36be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
878 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
879 {
880 int i;
881
2/2
✓ Branch 0 taken 32317120 times.
✓ Branch 1 taken 91810 times.
32408930 for (i = 0; i < width; i++) {
882 32317120 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + 0) >> 4);
883 32317120 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + 4) >> 4);
884 }
885 91810 }
886
887 /* This is almost identical to the previous, end exists only because
888 * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
889 92674 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
890 uint32_t *unused, void *opq)
891 {
892 int i;
893
2/2
✓ Branch 0 taken 32621248 times.
✓ Branch 1 taken 92674 times.
32713922 for (i = 0; i < width; i++)
894 32621248 dst[i] = src[2 * i + 1];
895 92674 }
896
897 92098 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
898 const uint8_t *src2, int width, uint32_t *unused, void *opq)
899 {
900 int i;
901
2/2
✓ Branch 0 taken 16209248 times.
✓ Branch 1 taken 92098 times.
16301346 for (i = 0; i < width; i++) {
902 16209248 dstU[i] = src1[4 * i + 0];
903 16209248 dstV[i] = src1[4 * i + 2];
904 }
905 av_assert1(src1 == src2);
906 92098 }
907
908 static void uyyvyyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
909 int width, uint32_t *unused, void *opq)
910 {
911 for (int i = 0; i < width; i++)
912 dst[i] = src[3 * (i >> 1) + 1 + (i & 1)];
913 }
914
915 static void uyyvyyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
916 const uint8_t *src2, int width, uint32_t *unused, void *opq)
917 {
918 for (int i = 0; i < width; i++) {
919 dstU[i] = src1[6 * i + 0];
920 dstV[i] = src1[6 * i + 3];
921 }
922 av_assert1(src1 == src2);
923 }
924
925 893106 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
926 const uint8_t *src, int width)
927 {
928 int i;
929
2/2
✓ Branch 0 taken 289178208 times.
✓ Branch 1 taken 893106 times.
290071314 for (i = 0; i < width; i++) {
930 289178208 dst1[i] = src[2 * i + 0];
931 289178208 dst2[i] = src[2 * i + 1];
932 }
933 893106 }
934
935 892242 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
936 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
937 int width, uint32_t *unused, void *opq)
938 {
939 892242 nvXXtoUV_c(dstU, dstV, src1, width);
940 892242 }
941
942 864 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
943 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
944 int width, uint32_t *unused, void *opq)
945 {
946 864 nvXXtoUV_c(dstV, dstU, src1, width);
947 864 }
948
949 #define p01x_uv_wrapper(fmt, shift) \
950 static void fmt ## LEToUV ## _c(uint8_t *dstU, \
951 uint8_t *dstV, \
952 const uint8_t *unused0, \
953 const uint8_t *src1, \
954 const uint8_t *src2, int width, \
955 uint32_t *unused, void *opq) \
956 { \
957 int i; \
958 for (i = 0; i < width; i++) { \
959 AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> shift); \
960 AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> shift); \
961 } \
962 } \
963 \
964 static void fmt ## BEToUV ## _c(uint8_t *dstU, \
965 uint8_t *dstV, \
966 const uint8_t *unused0, \
967 const uint8_t *src1, \
968 const uint8_t *src2, int width, \
969 uint32_t *unused, void *opq) \
970 { \
971 int i; \
972 for (i = 0; i < width; i++) { \
973 AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> shift); \
974 AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> shift); \
975 } \
976 }
977
978 #define p01x_wrapper(fmt, shift) \
979 static void fmt ## LEToY ## _c(uint8_t *dst, \
980 const uint8_t *src, \
981 const uint8_t *unused1, \
982 const uint8_t *unused2, int width, \
983 uint32_t *unused, void *opq) \
984 { \
985 int i; \
986 for (i = 0; i < width; i++) { \
987 AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> shift); \
988 } \
989 } \
990 \
991 static void fmt ## BEToY ## _c(uint8_t *dst, \
992 const uint8_t *src, \
993 const uint8_t *unused1, \
994 const uint8_t *unused2, int width, \
995 uint32_t *unused, void *opq) \
996 { \
997 int i; \
998 for (i = 0; i < width; i++) { \
999 AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> shift); \
1000 } \
1001 } \
1002 p01x_uv_wrapper(fmt, shift)
1003
1004
2/2
✓ Branch 0 taken 608256 times.
✓ Branch 1 taken 2304 times.
1221120 p01x_wrapper(nv20, 0)
1005
2/2
✓ Branch 0 taken 770355520 times.
✓ Branch 1 taken 2330944 times.
1545372928 p01x_wrapper(p010, 6)
1006
2/2
✓ Branch 0 taken 770355520 times.
✓ Branch 1 taken 2330944 times.
1545372928 p01x_wrapper(p012, 4)
1007
2/2
✓ Branch 0 taken 175695872 times.
✓ Branch 1 taken 680180 times.
352752104 p01x_uv_wrapper(p016, 0)
1008
1009 #define shf16_uv_wrapper(shift) \
1010 static void shf16_ ## shift ## LEToUV_c(uint8_t *dstU, \
1011 uint8_t *dstV, \
1012 const uint8_t *unused0, \
1013 const uint8_t *src1, \
1014 const uint8_t *src2, int width, \
1015 uint32_t *unused, void *opq) \
1016 { \
1017 int i; \
1018 for (i = 0; i < width; i++) { \
1019 AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 2) >> (16 - shift)); \
1020 AV_WN16(dstV + i * 2, AV_RL16(src2 + i * 2) >> (16 - shift)); \
1021 } \
1022 } \
1023 \
1024 static void shf16_ ## shift ## BEToUV_c(uint8_t *dstU, \
1025 uint8_t *dstV, \
1026 const uint8_t *unused0, \
1027 const uint8_t *src1, \
1028 const uint8_t *src2, int width, \
1029 uint32_t *unused, void *opq) \
1030 { \
1031 int i; \
1032 for (i = 0; i < width; i++) { \
1033 AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 2) >> (16 - shift)); \
1034 AV_WN16(dstV + i * 2, AV_RB16(src2 + i * 2) >> (16 - shift)); \
1035 } \
1036 }
1037
1038 #define shf16_wrapper(shift) \
1039 static void shf16_ ## shift ## LEToY_c(uint8_t *dst, \
1040 const uint8_t *src, \
1041 const uint8_t *unused1, \
1042 const uint8_t *unused2, int width, \
1043 uint32_t *unused, void *opq) \
1044 { \
1045 int i; \
1046 for (i = 0; i < width; i++) { \
1047 AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> (16 - shift)); \
1048 } \
1049 } \
1050 \
1051 static void shf16_ ## shift ## BEToY_c(uint8_t *dst, \
1052 const uint8_t *src, \
1053 const uint8_t *unused1, \
1054 const uint8_t *unused2, int width, \
1055 uint32_t *unused, void *opq) \
1056 { \
1057 int i; \
1058 for (i = 0; i < width; i++) { \
1059 AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> (16 - shift)); \
1060 } \
1061 } \
1062 shf16_uv_wrapper(shift)
1063
1064
2/2
✓ Branch 0 taken 829440 times.
✓ Branch 1 taken 2496 times.
1663872 shf16_wrapper(10)
1065
2/2
✓ Branch 0 taken 829440 times.
✓ Branch 1 taken 2496 times.
1663872 shf16_wrapper(12)
1066
1067 300660 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
1068 int width, uint32_t *rgb2yuv, void *opq)
1069 {
1070 300660 int16_t *dst = (int16_t *)_dst;
1071 300660 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1072 int i;
1073
2/2
✓ Branch 0 taken 103134504 times.
✓ Branch 1 taken 300660 times.
103435164 for (i = 0; i < width; i++) {
1074 103134504 int b = src[i * 3 + 0];
1075 103134504 int g = src[i * 3 + 1];
1076 103134504 int r = src[i * 3 + 2];
1077
1078 103134504 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1079 }
1080 300660 }
1081
1082 75522 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1083 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1084 {
1085 75522 int16_t *dstU = (int16_t *)_dstU;
1086 75522 int16_t *dstV = (int16_t *)_dstV;
1087 75522 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1088 75522 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1089 int i;
1090
2/2
✓ Branch 0 taken 26588928 times.
✓ Branch 1 taken 75522 times.
26664450 for (i = 0; i < width; i++) {
1091 26588928 int b = src1[3 * i + 0];
1092 26588928 int g = src1[3 * i + 1];
1093 26588928 int r = src1[3 * i + 2];
1094
1095 26588928 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1096 26588928 dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1097 }
1098 av_assert1(src1 == src2);
1099 75522 }
1100
1101 225180 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1102 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1103 {
1104 225180 int16_t *dstU = (int16_t *)_dstU;
1105 225180 int16_t *dstV = (int16_t *)_dstV;
1106 int i;
1107 225180 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1108 225180 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1109
2/2
✓ Branch 0 taken 38281908 times.
✓ Branch 1 taken 225180 times.
38507088 for (i = 0; i < width; i++) {
1110 38281908 int b = src1[6 * i + 0] + src1[6 * i + 3];
1111 38281908 int g = src1[6 * i + 1] + src1[6 * i + 4];
1112 38281908 int r = src1[6 * i + 2] + src1[6 * i + 5];
1113
1114 38281908 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1115 38281908 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1116 }
1117 av_assert1(src1 == src2);
1118 225180 }
1119
1120 1109234 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
1121 uint32_t *rgb2yuv, void *opq)
1122 {
1123 1109234 int16_t *dst = (int16_t *)_dst;
1124 1109234 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1125 int i;
1126
2/2
✓ Branch 0 taken 378775708 times.
✓ Branch 1 taken 1109234 times.
379884942 for (i = 0; i < width; i++) {
1127 378775708 int r = src[i * 3 + 0];
1128 378775708 int g = src[i * 3 + 1];
1129 378775708 int b = src[i * 3 + 2];
1130
1131 378775708 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1132 }
1133 1109234 }
1134
1135 468611 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1136 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1137 {
1138 468611 int16_t *dstU = (int16_t *)_dstU;
1139 468611 int16_t *dstV = (int16_t *)_dstV;
1140 int i;
1141 468611 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1142 468611 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1143 av_assert1(src1 == src2);
1144
2/2
✓ Branch 0 taken 164820052 times.
✓ Branch 1 taken 468611 times.
165288663 for (i = 0; i < width; i++) {
1145 164820052 int r = src1[3 * i + 0];
1146 164820052 int g = src1[3 * i + 1];
1147 164820052 int b = src1[3 * i + 2];
1148
1149 164820052 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1150 164820052 dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1151 }
1152 468611 }
1153
1154 654276 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1155 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1156 {
1157 654276 int16_t *dstU = (int16_t *)_dstU;
1158 654276 int16_t *dstV = (int16_t *)_dstV;
1159 int i;
1160 654276 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1161 654276 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1162 av_assert1(src1 == src2);
1163
2/2
✓ Branch 0 taken 108830484 times.
✓ Branch 1 taken 654276 times.
109484760 for (i = 0; i < width; i++) {
1164 108830484 int r = src1[6 * i + 0] + src1[6 * i + 3];
1165 108830484 int g = src1[6 * i + 1] + src1[6 * i + 4];
1166 108830484 int b = src1[6 * i + 2] + src1[6 * i + 5];
1167
1168 108830484 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1169 108830484 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1170 }
1171 654276 }
1172
1173 748560 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
1174 {
1175 748560 uint16_t *dst = (uint16_t *)_dst;
1176 748560 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1177 int i;
1178
2/2
✓ Branch 0 taken 263201280 times.
✓ Branch 1 taken 748560 times.
263949840 for (i = 0; i < width; i++) {
1179 263201280 int g = src[0][i];
1180 263201280 int b = src[1][i];
1181 263201280 int r = src[2][i];
1182
1183 263201280 dst[i] = (ry*r + gy*g + by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1184 }
1185 748560 }
1186
1187 849 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused, void *opq)
1188 {
1189 849 uint16_t *dst = (uint16_t *)_dst;
1190 int i;
1191
2/2
✓ Branch 0 taken 224328 times.
✓ Branch 1 taken 849 times.
225177 for (i = 0; i < width; i++)
1192 224328 dst[i] = src[3][i] << 6;
1193 849 }
1194
1195 386384 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
1196 {
1197 386384 uint16_t *dstU = (uint16_t *)_dstU;
1198 386384 uint16_t *dstV = (uint16_t *)_dstV;
1199 386384 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1200 386384 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1201 int i;
1202
2/2
✓ Branch 0 taken 135715328 times.
✓ Branch 1 taken 386384 times.
136101712 for (i = 0; i < width; i++) {
1203 135715328 int g = src[0][i];
1204 135715328 int b = src[1][i];
1205 135715328 int r = src[2][i];
1206
1207 135715328 dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1208 135715328 dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1209 }
1210 386384 }
1211
1212 #define rdpx(src) \
1213 (is_be ? AV_RB16(src) : AV_RL16(src))
1214
1215 #define shifted_planar_rgb16(rdpx_shift) \
1216 static av_always_inline void planar_rgb16_s ## rdpx_shift ## _to_y(uint8_t *_dst, const uint8_t *_src[4], \
1217 int width, int bpc, int is_be, int32_t *rgb2yuv) \
1218 { \
1219 int i; \
1220 const uint16_t **src = (const uint16_t **)_src; \
1221 uint16_t *dst = (uint16_t *)_dst; \
1222 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX]; \
1223 int shift = bpc < 16 ? bpc : 14; \
1224 for (i = 0; i < width; i++) { \
1225 int g = rdpx(src[0] + i) >> (16 - rdpx_shift); \
1226 int b = rdpx(src[1] + i) >> (16 - rdpx_shift); \
1227 int r = rdpx(src[2] + i) >> (16 - rdpx_shift); \
1228 \
1229 dst[i] = (ry*r + gy*g + by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) \
1230 + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14); \
1231 } \
1232 } \
1233 \
1234 static av_always_inline void planar_rgb16_s ## rdpx_shift ## _to_a(uint8_t *_dst, const uint8_t *_src[4], \
1235 int width, int bpc, int is_be, int32_t *rgb2yuv) \
1236 { \
1237 int i; \
1238 const uint16_t **src = (const uint16_t **)_src; \
1239 uint16_t *dst = (uint16_t *)_dst; \
1240 int shift = (bpc < 16 ? bpc : 14) + 16 - rdpx_shift; \
1241 \
1242 for (i = 0; i < width; i++) { \
1243 dst[i] = rdpx(src[3] + i) << (14 - shift); \
1244 } \
1245 } \
1246 \
1247 static av_always_inline void planar_rgb16_s ## rdpx_shift ## _to_uv(uint8_t *_dstU, uint8_t *_dstV, \
1248 const uint8_t *_src[4], int width, \
1249 int bpc, int is_be, int32_t *rgb2yuv) \
1250 { \
1251 int i; \
1252 const uint16_t **src = (const uint16_t **)_src; \
1253 uint16_t *dstU = (uint16_t *)_dstU; \
1254 uint16_t *dstV = (uint16_t *)_dstV; \
1255 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX]; \
1256 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX]; \
1257 int shift = bpc < 16 ? bpc : 14; \
1258 for (i = 0; i < width; i++) { \
1259 int g = rdpx(src[0] + i) >> (16 - rdpx_shift); \
1260 int b = rdpx(src[1] + i) >> (16 - rdpx_shift); \
1261 int r = rdpx(src[2] + i) >> (16 - rdpx_shift); \
1262 \
1263 dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) \
1264 + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14); \
1265 dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) \
1266 + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14); \
1267 } \
1268 }
1269
1270
10/10
✓ Branch 0 taken 3553328 times.
✓ Branch 1 taken 755706 times.
✓ Branch 2 taken 179760048 times.
✓ Branch 3 taken 1334888300 times.
✓ Branch 4 taken 180580704 times.
✓ Branch 5 taken 1334072360 times.
✓ Branch 6 taken 178939392 times.
✓ Branch 7 taken 1334067644 times.
✓ Branch 8 taken 1513007036 times.
✓ Branch 9 taken 4304318 times.
3037914764 shifted_planar_rgb16(16)
1271
9/10
✓ Branch 0 taken 2496 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405504 times.
✓ Branch 3 taken 423936 times.
✓ Branch 4 taken 405504 times.
✓ Branch 5 taken 423936 times.
✓ Branch 6 taken 405504 times.
✓ Branch 7 taken 423936 times.
✓ Branch 8 taken 829440 times.
✓ Branch 9 taken 2496 times.
1663872 shifted_planar_rgb16(12)
1272
9/10
✓ Branch 0 taken 2496 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405504 times.
✓ Branch 3 taken 423936 times.
✓ Branch 4 taken 405504 times.
✓ Branch 5 taken 423936 times.
✓ Branch 6 taken 405504 times.
✓ Branch 7 taken 423936 times.
✓ Branch 8 taken 829440 times.
✓ Branch 9 taken 2496 times.
1663872 shifted_planar_rgb16(10)
1273
1274 #undef rdpx
1275
1276 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
1277
1278 1188 static av_always_inline void planar_rgbf32_to_a(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1279 {
1280 int i;
1281 1188 const float **src = (const float **)_src;
1282 1188 uint16_t *dst = (uint16_t *)_dst;
1283
1284
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 1188 times.
413124 for (i = 0; i < width; i++) {
1285
2/2
✓ Branch 0 taken 205968 times.
✓ Branch 1 taken 205968 times.
411936 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[3] + i), 0.0f, 65535.0f));
1286 }
1287 1188 }
1288
1289 2376 static av_always_inline void planar_rgbf32_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1290 {
1291 int i;
1292 2376 const float **src = (const float **)_src;
1293 2376 uint16_t *dstU = (uint16_t *)_dstU;
1294 2376 uint16_t *dstV = (uint16_t *)_dstV;
1295 2376 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1296 2376 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1297
1298
2/2
✓ Branch 0 taken 823872 times.
✓ Branch 1 taken 2376 times.
826248 for (i = 0; i < width; i++) {
1299
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1300
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1301
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1302
1303 823872 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1304 823872 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1305 }
1306 2376 }
1307
1308 2376 static av_always_inline void planar_rgbf32_to_y(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1309 {
1310 int i;
1311 2376 const float **src = (const float **)_src;
1312 2376 uint16_t *dst = (uint16_t *)_dst;
1313
1314 2376 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1315
1316
2/2
✓ Branch 0 taken 823872 times.
✓ Branch 1 taken 2376 times.
826248 for (i = 0; i < width; i++) {
1317
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1318
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1319
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1320
1321 823872 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1322 }
1323 2376 }
1324
1325 static av_always_inline void rgbf32_to_uv_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused1,
1326 const uint8_t *_src, const uint8_t *unused2,
1327 int width, int is_be, int32_t *rgb2yuv)
1328 {
1329 int i;
1330 const float *src = (const float *)_src;
1331 uint16_t *dstU = (uint16_t *)_dstU;
1332 uint16_t *dstV = (uint16_t *)_dstV;
1333 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1334 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1335
1336 for (i = 0; i < width; i++) {
1337 int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1338 int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1339 int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1340
1341 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1342 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1343 }
1344 }
1345
1346 static av_always_inline void rgbf32_to_y_c(uint8_t *_dst, const uint8_t *_src,
1347 const uint8_t *unused1, const uint8_t *unused2,
1348 int width, int is_be, int32_t *rgb2yuv)
1349 {
1350 int i;
1351 const float *src = (const float *)_src;
1352 uint16_t *dst = (uint16_t *)_dst;
1353
1354 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1355
1356 for (i = 0; i < width; i++) {
1357 int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1358 int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1359 int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1360
1361 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1362 }
1363 }
1364
1365 1152 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1366 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1367 {
1368 int i;
1369 1152 const float *src = (const float *)_src;
1370 1152 uint16_t *dst = (uint16_t *)_dst;
1371
1372
2/2
✓ Branch 0 taken 405504 times.
✓ Branch 1 taken 1152 times.
406656 for (i = 0; i < width; ++i){
1373
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 202752 times.
405504 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i), 0.0f, 65535.0f));
1374 }
1375 1152 }
1376
1377 static av_always_inline void read_yaf32_gray_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1378 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1379 {
1380 int i;
1381 const float *src = (const float *)_src;
1382 uint16_t *dst = (uint16_t *)_dst;
1383
1384 for (i = 0; i < width; ++i)
1385 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i*2), 0.0f, 65535.0f));
1386 }
1387
1388 static av_always_inline void read_yaf32_alpha_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1389 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1390 {
1391 int i;
1392 const float *src = (const float *)_src;
1393 uint16_t *dst = (uint16_t *)_dst;
1394
1395 for (i = 0; i < width; ++i)
1396 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i*2 + 1), 0.0f, 65535.0f));
1397 }
1398
1399 #undef rdpx
1400
1401 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1402 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1403 int w, int32_t *rgb2yuv, void *opq) \
1404 { \
1405 planar_rgb16_s16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1406 } \
1407 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1408 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1409 void *opq) \
1410 { \
1411 planar_rgb16_s16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1412 } \
1413
1414 #define rgb9plus_planar_transparency_funcs(nbits) \
1415 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1416 int w, int32_t *rgb2yuv, \
1417 void *opq) \
1418 { \
1419 planar_rgb16_s16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1420 } \
1421 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1422 int w, int32_t *rgb2yuv, \
1423 void *opq) \
1424 { \
1425 planar_rgb16_s16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1426 }
1427
1428 #define rgb9plus_msb_planar_funcs_endian(nbits, endian_name, endian) \
1429 static void msb_planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1430 int w, int32_t *rgb2yuv, void *opq) \
1431 { \
1432 planar_rgb16_s##nbits##_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1433 } \
1434 static void msb_planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1435 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1436 void *opq) \
1437 { \
1438 planar_rgb16_s##nbits##_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1439 }
1440
1441 #define rgb9plus_planar_funcs(nbits) \
1442 rgb9plus_planar_funcs_endian(nbits, le, 0) \
1443 rgb9plus_planar_funcs_endian(nbits, be, 1)
1444
1445 #define rgb9plus_msb_planar_funcs(nbits) \
1446 rgb9plus_msb_planar_funcs_endian(nbits, le, 0) \
1447 rgb9plus_msb_planar_funcs_endian(nbits, be, 1)
1448
1449 4752 rgb9plus_planar_funcs(9)
1450 3632544 rgb9plus_planar_funcs(10)
1451 3452944 rgb9plus_planar_funcs(12)
1452 9360 rgb9plus_planar_funcs(14)
1453 1509036 rgb9plus_planar_funcs(16)
1454
1455 2376 rgb9plus_planar_transparency_funcs(10)
1456 2376 rgb9plus_planar_transparency_funcs(12)
1457 2304 rgb9plus_planar_transparency_funcs(14)
1458 2376 rgb9plus_planar_transparency_funcs(16)
1459
1460 4992 rgb9plus_msb_planar_funcs(10)
1461 4992 rgb9plus_msb_planar_funcs(12)
1462
1463 #define rgbf32_funcs_endian(endian_name, endian) \
1464 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1465 int w, int32_t *rgb2yuv, void *opq) \
1466 { \
1467 planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1468 } \
1469 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1470 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1471 void *opq) \
1472 { \
1473 planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1474 } \
1475 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1476 int w, int32_t *rgb2yuv, void *opq) \
1477 { \
1478 planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1479 } \
1480 static void rgbf32##endian_name##_to_y_c(uint8_t *dst, const uint8_t *src, \
1481 const uint8_t *unused1, const uint8_t *unused2, \
1482 int w, uint32_t *rgb2yuv, void *opq) \
1483 { \
1484 rgbf32_to_y_c(dst, src, unused1, unused2, w, endian, rgb2yuv); \
1485 } \
1486 static void rgbf32##endian_name##_to_uv_c(uint8_t *dstU, uint8_t *dstV, \
1487 const uint8_t *unused1, \
1488 const uint8_t *src, const uint8_t *unused2, \
1489 int w, uint32_t *rgb2yuv, \
1490 void *opq) \
1491 { \
1492 rgbf32_to_uv_c(dstU, dstV, unused1, src, unused2, w, endian, rgb2yuv); \
1493 } \
1494 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1495 const uint8_t *unused1, const uint8_t *unused2, \
1496 int width, uint32_t *unused, void *opq) \
1497 { \
1498 grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1499 } \
1500 static void read_yaf32##endian_name##_gray_c(uint8_t *dst, const uint8_t *src, \
1501 const uint8_t *unused1, const uint8_t *unused2, \
1502 int width, uint32_t *unused, void *opq) \
1503 { \
1504 read_yaf32_gray_c(dst, src, unused1, unused2, width, endian, unused); \
1505 } \
1506 static void read_yaf32##endian_name##_alpha_c(uint8_t *dst, const uint8_t *src, \
1507 const uint8_t *unused1, const uint8_t *unused2, \
1508 int width, uint32_t *unused, void *opq) \
1509 { \
1510 read_yaf32_alpha_c(dst, src, unused1, unused2, width, endian, unused); \
1511 }
1512
1513 7092 rgbf32_funcs_endian(le, 0)
1514 7092 rgbf32_funcs_endian(be, 1)
1515
1516 #define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : AV_RL16(&src), h2f_tbl))
1517 #define rdpx2(src) av_int2float(half2float(is_be ? AV_RB16(src) : AV_RL16(src), h2f_tbl))
1518
1519 3121 static av_always_inline void planar_rgbf16_to_a(uint8_t *dst, const uint8_t *src[4], int width, int is_be, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1520 {
1521 int i;
1522
1523
2/2
✓ Branch 0 taken 1859160 times.
✓ Branch 1 taken 3121 times.
1862281 for (i = 0; i < width; i++) {
1524
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1859160 times.
1859160 AV_WN16(dst + 2*i, lrintf(av_clipf(65535.0f * rdpx2(src[3] + 2*i), 0.0f, 65535.0f)));
1525 }
1526 3121 }
1527
1528 6612 static av_always_inline void planar_rgbf16_to_uv(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4], int width, int is_be, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1529 {
1530 int i;
1531 6612 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1532 6612 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1533
1534
2/2
✓ Branch 0 taken 3537889 times.
✓ Branch 1 taken 6612 times.
3544501 for (i = 0; i < width; i++) {
1535
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int g = lrintf(av_clipf(65535.0f * rdpx2(src[0] + 2*i), 0.0f, 65535.0f));
1536
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int b = lrintf(av_clipf(65535.0f * rdpx2(src[1] + 2*i), 0.0f, 65535.0f));
1537
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int r = lrintf(av_clipf(65535.0f * rdpx2(src[2] + 2*i), 0.0f, 65535.0f));
1538
1539 3537889 AV_WN16(dstU + 2*i, (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1540 3537889 AV_WN16(dstV + 2*i, (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1541 }
1542 6612 }
1543
1544 6612 static av_always_inline void planar_rgbf16_to_y(uint8_t *dst, const uint8_t *src[4], int width, int is_be, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1545 {
1546 int i;
1547
1548 6612 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1549
1550
2/2
✓ Branch 0 taken 3537889 times.
✓ Branch 1 taken 6612 times.
3544501 for (i = 0; i < width; i++) {
1551
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int g = lrintf(av_clipf(65535.0f * rdpx2(src[0] + 2*i), 0.0f, 65535.0f));
1552
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int b = lrintf(av_clipf(65535.0f * rdpx2(src[1] + 2*i), 0.0f, 65535.0f));
1553
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int r = lrintf(av_clipf(65535.0f * rdpx2(src[2] + 2*i), 0.0f, 65535.0f));
1554
1555 3537889 AV_WN16(dst + 2*i, (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1556 }
1557 6612 }
1558
1559 24 static av_always_inline void grayf16ToY16_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
1560 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1561 {
1562 int i;
1563
1564
2/2
✓ Branch 0 taken 288 times.
✓ Branch 1 taken 24 times.
312 for (i = 0; i < width; ++i){
1565
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 288 times.
288 AV_WN16(dst + 2*i, lrintf(av_clipf(65535.0f * rdpx2(src + 2*i), 0.0f, 65535.0f)));
1566 }
1567 24 }
1568
1569 12 static av_always_inline void read_yaf16_gray_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
1570 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1571 {
1572 12 uint16_t *dst = (uint16_t *)_dst;
1573
1574
2/2
✓ Branch 0 taken 144 times.
✓ Branch 1 taken 12 times.
156 for (int i = 0; i < width; i++)
1575
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
144 dst[i] = lrintf(av_clipf(65535.0f * rdpx2(src + 4*i), 0.0f, 65535.0f));
1576 12 }
1577
1578 12 static av_always_inline void read_yaf16_alpha_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
1579 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1580 {
1581 12 uint16_t *dst = (uint16_t *)_dst;
1582
1583
2/2
✓ Branch 0 taken 144 times.
✓ Branch 1 taken 12 times.
156 for (int i = 0; i < width; i++)
1584
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
144 dst[i] = lrintf(av_clipf(65535.0f * rdpx2(src + 4*i + 2), 0.0f, 65535.0f));
1585 12 }
1586
1587 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1588 const uint16_t *src, int width,
1589 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1590 {
1591 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1592 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1593 int i;
1594 for (i = 0; i < width; i++) {
1595 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) +
1596 lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1;
1597 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) +
1598 lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1;
1599 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) +
1600 lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1;
1601
1602 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1603 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1604 }
1605 }
1606
1607 static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1608 const uint16_t *src, int width,
1609 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1610 {
1611 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1612 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1613 int i;
1614 for (i = 0; i < width; i++) {
1615 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1616 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1617 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1618
1619 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1620 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1621 }
1622 }
1623
1624 static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1625 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1626 {
1627 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1628 int i;
1629 for (i = 0; i < width; i++) {
1630 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1631 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1632 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1633
1634 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1635 }
1636 }
1637
1638 static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be,
1639 int width, Half2FloatTables *h2f_tbl)
1640 {
1641 int i;
1642 for (i=0; i<width; i++) {
1643 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[i*4+3]), 0.0f, 65535.0f));
1644 }
1645 }
1646
1647 static av_always_inline void rgbf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1648 const uint16_t *src, int width,
1649 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1650 {
1651 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1652 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1653 int i;
1654 for (i = 0; i < width; i++) {
1655 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+0]), 0.0f, 65535.0f)) +
1656 lrintf(av_clipf(65535.0f * rdpx(src[i*6+3]), 0.0f, 65535.0f))) >> 1;
1657 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+1]), 0.0f, 65535.0f)) +
1658 lrintf(av_clipf(65535.0f * rdpx(src[i*6+4]), 0.0f, 65535.0f))) >> 1;
1659 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+2]), 0.0f, 65535.0f)) +
1660 lrintf(av_clipf(65535.0f * rdpx(src[i*6+5]), 0.0f, 65535.0f))) >> 1;
1661
1662 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1663 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1664 }
1665 }
1666
1667 static av_always_inline void rgbf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1668 const uint16_t *src, int width,
1669 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1670 {
1671 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1672 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1673 int i;
1674 for (i = 0; i < width; i++) {
1675 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1676 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1677 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1678
1679 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1680 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1681 }
1682 }
1683
1684 static av_always_inline void rgbf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1685 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1686 {
1687 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1688 int i;
1689 for (i = 0; i < width; i++) {
1690 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1691 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1692 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1693
1694 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1695 }
1696 }
1697
1698 #undef rdpx
1699
1700 #define rgbaf16_funcs_endian(endian_name, endian) \
1701 static void planar_rgbf16##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1702 int w, int32_t *rgb2yuv, void *opq) \
1703 { \
1704 planar_rgbf16_to_y(dst, src, w, endian, rgb2yuv, opq); \
1705 } \
1706 static void planar_rgbf16##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1707 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1708 void *opq) \
1709 { \
1710 planar_rgbf16_to_uv(dstU, dstV, src, w, endian, rgb2yuv, opq); \
1711 } \
1712 static void planar_rgbf16##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1713 int w, int32_t *rgb2yuv, void *opq) \
1714 { \
1715 planar_rgbf16_to_a(dst, src, w, endian, rgb2yuv, opq); \
1716 } \
1717 static void grayf16##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1718 const uint8_t *unused1, const uint8_t *unused2, \
1719 int width, uint32_t *unused, void *opq) \
1720 { \
1721 grayf16ToY16_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1722 } \
1723 static void read_yaf16##endian_name##_gray_c(uint8_t *dst, const uint8_t *src, \
1724 const uint8_t *unused1, const uint8_t *unused2, \
1725 int width, uint32_t *unused, void *opq) \
1726 { \
1727 read_yaf16_gray_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1728 } \
1729 static void read_yaf16##endian_name##_alpha_c(uint8_t *dst, const uint8_t *src, \
1730 const uint8_t *unused1, const uint8_t *unused2, \
1731 int width, uint32_t *unused, void *opq) \
1732 { \
1733 read_yaf16_alpha_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1734 } \
1735 \
1736 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1737 const uint8_t *src1, const uint8_t *src2, \
1738 int width, uint32_t *_rgb2yuv, void *opq) \
1739 { \
1740 const uint16_t *src = (const uint16_t*)src1; \
1741 uint16_t *dstU = (uint16_t*)_dstU; \
1742 uint16_t *dstV = (uint16_t*)_dstV; \
1743 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1744 av_assert1(src1==src2); \
1745 rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1746 } \
1747 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1748 const uint8_t *src1, const uint8_t *src2, \
1749 int width, uint32_t *_rgb2yuv, void *opq) \
1750 { \
1751 const uint16_t *src = (const uint16_t*)src1; \
1752 uint16_t *dstU = (uint16_t*)_dstU; \
1753 uint16_t *dstV = (uint16_t*)_dstV; \
1754 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1755 av_assert1(src1==src2); \
1756 rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1757 } \
1758 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1759 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1760 { \
1761 const uint16_t *src = (const uint16_t*)_src; \
1762 uint16_t *dst = (uint16_t*)_dst; \
1763 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1764 rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1765 } \
1766 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1767 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1768 { \
1769 const uint16_t *src = (const uint16_t*)_src; \
1770 uint16_t *dst = (uint16_t*)_dst; \
1771 rgbaf16ToA_endian(dst, src, endian, width, opq); \
1772 } \
1773 static void rgbf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1774 const uint8_t *src1, const uint8_t *src2, \
1775 int width, uint32_t *_rgb2yuv, void *opq) \
1776 { \
1777 const uint16_t *src = (const uint16_t*)src1; \
1778 uint16_t *dstU = (uint16_t*)_dstU; \
1779 uint16_t *dstV = (uint16_t*)_dstV; \
1780 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1781 av_assert1(src1==src2); \
1782 rgbf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1783 } \
1784 static void rgbf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1785 const uint8_t *src1, const uint8_t *src2, \
1786 int width, uint32_t *_rgb2yuv, void *opq) \
1787 { \
1788 const uint16_t *src = (const uint16_t*)src1; \
1789 uint16_t *dstU = (uint16_t*)_dstU; \
1790 uint16_t *dstV = (uint16_t*)_dstV; \
1791 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1792 av_assert1(src1==src2); \
1793 rgbf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1794 } \
1795 static void rgbf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1796 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1797 { \
1798 const uint16_t *src = (const uint16_t*)_src; \
1799 uint16_t *dst = (uint16_t*)_dst; \
1800 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1801 rgbf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1802 } \
1803
1804 32786 rgbaf16_funcs_endian(le, 0)
1805 rgbaf16_funcs_endian(be, 1)
1806
1807 39006 av_cold void ff_sws_init_input_funcs(SwsInternal *c,
1808 planar1_YV12_fn *lumToYV12,
1809 planar1_YV12_fn *alpToYV12,
1810 planar2_YV12_fn *chrToYV12,
1811 planarX_YV12_fn *readLumPlanar,
1812 planarX_YV12_fn *readAlpPlanar,
1813 planarX2_YV12_fn *readChrPlanar)
1814 {
1815 39006 enum AVPixelFormat srcFormat = c->opts.src_format;
1816
1817 39006 *chrToYV12 = NULL;
1818
53/57
✓ Branch 0 taken 112 times.
✓ Branch 1 taken 112 times.
✓ Branch 2 taken 112 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 116 times.
✓ Branch 5 taken 1115 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 30 times.
✓ Branch 8 taken 158 times.
✓ Branch 9 taken 1338 times.
✓ Branch 10 taken 1334 times.
✓ Branch 11 taken 159 times.
✓ Branch 12 taken 688 times.
✓ Branch 13 taken 426 times.
✓ Branch 14 taken 384 times.
✓ Branch 15 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 17 taken 157 times.
✓ Branch 18 taken 482 times.
✓ Branch 19 taken 482 times.
✓ Branch 20 taken 158 times.
✓ Branch 21 taken 532 times.
✓ Branch 22 taken 392 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 26 taken 1315 times.
✓ Branch 27 taken 1228 times.
✓ Branch 28 taken 2 times.
✓ Branch 29 taken 2 times.
✓ Branch 30 taken 1 times.
✓ Branch 31 taken 1 times.
✓ Branch 32 taken 113 times.
✓ Branch 33 taken 111 times.
✓ Branch 34 taken 125 times.
✓ Branch 35 taken 1 times.
✓ Branch 36 taken 1 times.
✓ Branch 37 taken 1 times.
✓ Branch 38 taken 5 times.
✓ Branch 39 taken 111 times.
✓ Branch 40 taken 111 times.
✓ Branch 41 taken 141 times.
✓ Branch 42 taken 141 times.
✓ Branch 43 taken 1 times.
✓ Branch 44 taken 1143 times.
✓ Branch 45 taken 1 times.
✓ Branch 46 taken 303 times.
✓ Branch 47 taken 1143 times.
✓ Branch 48 taken 303 times.
✓ Branch 49 taken 563 times.
✓ Branch 50 taken 383 times.
✓ Branch 51 taken 111 times.
✓ Branch 52 taken 111 times.
✓ Branch 53 taken 141 times.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✓ Branch 56 taken 23098 times.
39006 switch (srcFormat) {
1819 112 case AV_PIX_FMT_YUYV422:
1820 112 *chrToYV12 = yuy2ToUV_c;
1821 112 break;
1822 112 case AV_PIX_FMT_YVYU422:
1823 112 *chrToYV12 = yvy2ToUV_c;
1824 112 break;
1825 112 case AV_PIX_FMT_UYVY422:
1826 112 *chrToYV12 = uyvyToUV_c;
1827 112 break;
1828 case AV_PIX_FMT_UYYVYY411:
1829 *chrToYV12 = uyyvyyToUV_c;
1830 break;
1831 116 case AV_PIX_FMT_VYU444:
1832 116 *chrToYV12 = vyuToUV_c;
1833 116 break;
1834 1115 case AV_PIX_FMT_NV12:
1835 case AV_PIX_FMT_NV16:
1836 case AV_PIX_FMT_NV24:
1837 1115 *chrToYV12 = nv12ToUV_c;
1838 1115 break;
1839 2 case AV_PIX_FMT_NV21:
1840 case AV_PIX_FMT_NV42:
1841 2 *chrToYV12 = nv21ToUV_c;
1842 2 break;
1843 30 case AV_PIX_FMT_RGB8:
1844 case AV_PIX_FMT_BGR8:
1845 case AV_PIX_FMT_PAL8:
1846 case AV_PIX_FMT_BGR4_BYTE:
1847 case AV_PIX_FMT_RGB4_BYTE:
1848 30 *chrToYV12 = palToUV_c;
1849 30 break;
1850 158 case AV_PIX_FMT_GBRP9LE:
1851 158 *readChrPlanar = planar_rgb9le_to_uv;
1852 158 break;
1853 1338 case AV_PIX_FMT_GBRAP10LE:
1854 case AV_PIX_FMT_GBRP10LE:
1855 1338 *readChrPlanar = planar_rgb10le_to_uv;
1856 1338 break;
1857 1334 case AV_PIX_FMT_GBRAP12LE:
1858 case AV_PIX_FMT_GBRP12LE:
1859 1334 *readChrPlanar = planar_rgb12le_to_uv;
1860 1334 break;
1861 159 case AV_PIX_FMT_GBRAP14LE:
1862 case AV_PIX_FMT_GBRP14LE:
1863 159 *readChrPlanar = planar_rgb14le_to_uv;
1864 159 break;
1865 688 case AV_PIX_FMT_GBRAP16LE:
1866 case AV_PIX_FMT_GBRP16LE:
1867 688 *readChrPlanar = planar_rgb16le_to_uv;
1868 688 break;
1869 426 case AV_PIX_FMT_GBRAPF32LE:
1870 case AV_PIX_FMT_GBRPF32LE:
1871 426 *readChrPlanar = planar_rgbf32le_to_uv;
1872 426 break;
1873 384 case AV_PIX_FMT_GBRAPF16LE:
1874 case AV_PIX_FMT_GBRPF16LE:
1875 384 *readChrPlanar = planar_rgbf16le_to_uv;
1876 384 break;
1877 2 case AV_PIX_FMT_GBRP10MSBLE:
1878 2 *readChrPlanar = msb_planar_rgb10le_to_uv;
1879 2 break;
1880 2 case AV_PIX_FMT_GBRP12MSBLE:
1881 2 *readChrPlanar = msb_planar_rgb12le_to_uv;
1882 2 break;
1883 157 case AV_PIX_FMT_GBRP9BE:
1884 157 *readChrPlanar = planar_rgb9be_to_uv;
1885 157 break;
1886 482 case AV_PIX_FMT_GBRAP10BE:
1887 case AV_PIX_FMT_GBRP10BE:
1888 482 *readChrPlanar = planar_rgb10be_to_uv;
1889 482 break;
1890 482 case AV_PIX_FMT_GBRAP12BE:
1891 case AV_PIX_FMT_GBRP12BE:
1892 482 *readChrPlanar = planar_rgb12be_to_uv;
1893 482 break;
1894 158 case AV_PIX_FMT_GBRAP14BE:
1895 case AV_PIX_FMT_GBRP14BE:
1896 158 *readChrPlanar = planar_rgb14be_to_uv;
1897 158 break;
1898 532 case AV_PIX_FMT_GBRAP16BE:
1899 case AV_PIX_FMT_GBRP16BE:
1900 532 *readChrPlanar = planar_rgb16be_to_uv;
1901 532 break;
1902 392 case AV_PIX_FMT_GBRAPF32BE:
1903 case AV_PIX_FMT_GBRPF32BE:
1904 392 *readChrPlanar = planar_rgbf32be_to_uv;
1905 392 break;
1906 case AV_PIX_FMT_GBRAPF16BE:
1907 case AV_PIX_FMT_GBRPF16BE:
1908 *readChrPlanar = planar_rgbf16be_to_uv;
1909 break;
1910 1 case AV_PIX_FMT_GBRP10MSBBE:
1911 1 *readChrPlanar = msb_planar_rgb10be_to_uv;
1912 1 break;
1913 1 case AV_PIX_FMT_GBRP12MSBBE:
1914 1 *readChrPlanar = msb_planar_rgb12be_to_uv;
1915 1 break;
1916 1315 case AV_PIX_FMT_GBRAP:
1917 case AV_PIX_FMT_GBRP:
1918 1315 *readChrPlanar = planar_rgb_to_uv;
1919 1315 break;
1920 #if HAVE_BIGENDIAN
1921 case AV_PIX_FMT_YUV420P9LE:
1922 case AV_PIX_FMT_YUV422P9LE:
1923 case AV_PIX_FMT_YUV444P9LE:
1924 case AV_PIX_FMT_YUV420P10LE:
1925 case AV_PIX_FMT_YUV422P10LE:
1926 case AV_PIX_FMT_YUV440P10LE:
1927 case AV_PIX_FMT_YUV444P10LE:
1928 case AV_PIX_FMT_YUV420P12LE:
1929 case AV_PIX_FMT_YUV422P12LE:
1930 case AV_PIX_FMT_YUV440P12LE:
1931 case AV_PIX_FMT_YUV444P12LE:
1932 case AV_PIX_FMT_YUV420P14LE:
1933 case AV_PIX_FMT_YUV422P14LE:
1934 case AV_PIX_FMT_YUV444P14LE:
1935 case AV_PIX_FMT_YUV420P16LE:
1936 case AV_PIX_FMT_YUV422P16LE:
1937 case AV_PIX_FMT_YUV444P16LE:
1938
1939 case AV_PIX_FMT_YUVA420P9LE:
1940 case AV_PIX_FMT_YUVA422P9LE:
1941 case AV_PIX_FMT_YUVA444P9LE:
1942 case AV_PIX_FMT_YUVA420P10LE:
1943 case AV_PIX_FMT_YUVA422P10LE:
1944 case AV_PIX_FMT_YUVA444P10LE:
1945 case AV_PIX_FMT_YUVA422P12LE:
1946 case AV_PIX_FMT_YUVA444P12LE:
1947 case AV_PIX_FMT_YUVA420P16LE:
1948 case AV_PIX_FMT_YUVA422P16LE:
1949 case AV_PIX_FMT_YUVA444P16LE:
1950 *chrToYV12 = bswap16UV_c;
1951 break;
1952 #else
1953 1228 case AV_PIX_FMT_YUV420P9BE:
1954 case AV_PIX_FMT_YUV422P9BE:
1955 case AV_PIX_FMT_YUV444P9BE:
1956 case AV_PIX_FMT_YUV420P10BE:
1957 case AV_PIX_FMT_YUV422P10BE:
1958 case AV_PIX_FMT_YUV440P10BE:
1959 case AV_PIX_FMT_YUV444P10BE:
1960 case AV_PIX_FMT_YUV420P12BE:
1961 case AV_PIX_FMT_YUV422P12BE:
1962 case AV_PIX_FMT_YUV440P12BE:
1963 case AV_PIX_FMT_YUV444P12BE:
1964 case AV_PIX_FMT_YUV420P14BE:
1965 case AV_PIX_FMT_YUV422P14BE:
1966 case AV_PIX_FMT_YUV444P14BE:
1967 case AV_PIX_FMT_YUV420P16BE:
1968 case AV_PIX_FMT_YUV422P16BE:
1969 case AV_PIX_FMT_YUV444P16BE:
1970
1971 case AV_PIX_FMT_YUVA420P9BE:
1972 case AV_PIX_FMT_YUVA422P9BE:
1973 case AV_PIX_FMT_YUVA444P9BE:
1974 case AV_PIX_FMT_YUVA420P10BE:
1975 case AV_PIX_FMT_YUVA422P10BE:
1976 case AV_PIX_FMT_YUVA444P10BE:
1977 case AV_PIX_FMT_YUVA422P12BE:
1978 case AV_PIX_FMT_YUVA444P12BE:
1979 case AV_PIX_FMT_YUVA420P16BE:
1980 case AV_PIX_FMT_YUVA422P16BE:
1981 case AV_PIX_FMT_YUVA444P16BE:
1982 1228 *chrToYV12 = bswap16UV_c;
1983 1228 break;
1984 #endif
1985 2 case AV_PIX_FMT_YUV444P10MSBLE:
1986 2 *chrToYV12 = shf16_10LEToUV_c;
1987 2 break;
1988 2 case AV_PIX_FMT_YUV444P12MSBLE:
1989 2 *chrToYV12 = shf16_12LEToUV_c;
1990 2 break;
1991 1 case AV_PIX_FMT_YUV444P10MSBBE:
1992 1 *chrToYV12 = shf16_10BEToUV_c;
1993 1 break;
1994 1 case AV_PIX_FMT_YUV444P12MSBBE:
1995 1 *chrToYV12 = shf16_12BEToUV_c;
1996 1 break;
1997 113 case AV_PIX_FMT_VUYA:
1998 case AV_PIX_FMT_VUYX:
1999 113 *chrToYV12 = read_vuyx_UV_c;
2000 113 break;
2001 111 case AV_PIX_FMT_XV30LE:
2002 111 *chrToYV12 = read_xv30le_UV_c;
2003 111 break;
2004 125 case AV_PIX_FMT_V30XLE:
2005 125 *chrToYV12 = read_v30xle_UV_c;
2006 125 break;
2007 1 case AV_PIX_FMT_AYUV:
2008 1 *chrToYV12 = read_ayuv_UV_c;
2009 1 break;
2010 1 case AV_PIX_FMT_AYUV64LE:
2011 1 *chrToYV12 = read_ayuv64le_UV_c;
2012 1 break;
2013 1 case AV_PIX_FMT_AYUV64BE:
2014 1 *chrToYV12 = read_ayuv64be_UV_c;
2015 1 break;
2016 5 case AV_PIX_FMT_UYVA:
2017 5 *chrToYV12 = read_uyva_UV_c;
2018 5 break;
2019 111 case AV_PIX_FMT_XV36LE:
2020 111 *chrToYV12 = read_xv36le_UV_c;
2021 111 break;
2022 111 case AV_PIX_FMT_XV36BE:
2023 111 *chrToYV12 = read_xv36be_UV_c;
2024 111 break;
2025 141 case AV_PIX_FMT_XV48LE:
2026 141 *chrToYV12 = read_xv48le_UV_c;
2027 141 break;
2028 141 case AV_PIX_FMT_XV48BE:
2029 141 *chrToYV12 = read_xv48be_UV_c;
2030 141 break;
2031 1 case AV_PIX_FMT_NV20LE:
2032 1 *chrToYV12 = nv20LEToUV_c;
2033 1 break;
2034 1143 case AV_PIX_FMT_P010LE:
2035 case AV_PIX_FMT_P210LE:
2036 case AV_PIX_FMT_P410LE:
2037 1143 *chrToYV12 = p010LEToUV_c;
2038 1143 break;
2039 1 case AV_PIX_FMT_NV20BE:
2040 1 *chrToYV12 = nv20BEToUV_c;
2041 1 break;
2042 303 case AV_PIX_FMT_P010BE:
2043 case AV_PIX_FMT_P210BE:
2044 case AV_PIX_FMT_P410BE:
2045 303 *chrToYV12 = p010BEToUV_c;
2046 303 break;
2047 1143 case AV_PIX_FMT_P012LE:
2048 case AV_PIX_FMT_P212LE:
2049 case AV_PIX_FMT_P412LE:
2050 1143 *chrToYV12 = p012LEToUV_c;
2051 1143 break;
2052 303 case AV_PIX_FMT_P012BE:
2053 case AV_PIX_FMT_P212BE:
2054 case AV_PIX_FMT_P412BE:
2055 303 *chrToYV12 = p012BEToUV_c;
2056 303 break;
2057 563 case AV_PIX_FMT_P016LE:
2058 case AV_PIX_FMT_P216LE:
2059 case AV_PIX_FMT_P416LE:
2060 563 *chrToYV12 = p016LEToUV_c;
2061 563 break;
2062 383 case AV_PIX_FMT_P016BE:
2063 case AV_PIX_FMT_P216BE:
2064 case AV_PIX_FMT_P416BE:
2065 383 *chrToYV12 = p016BEToUV_c;
2066 383 break;
2067 111 case AV_PIX_FMT_Y210LE:
2068 111 *chrToYV12 = y210le_UV_c;
2069 111 break;
2070 111 case AV_PIX_FMT_Y212LE:
2071 111 *chrToYV12 = y212le_UV_c;
2072 111 break;
2073 141 case AV_PIX_FMT_Y216LE:
2074 141 *chrToYV12 = y216le_UV_c;
2075 141 break;
2076 case AV_PIX_FMT_RGBF32LE:
2077 *chrToYV12 = rgbf32le_to_uv_c;
2078 break;
2079 case AV_PIX_FMT_RGBF32BE:
2080 *chrToYV12 = rgbf32be_to_uv_c;
2081 break;
2082 }
2083
2/2
✓ Branch 0 taken 23809 times.
✓ Branch 1 taken 15197 times.
39006 if (c->chrSrcHSubSample) {
2084
21/34
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 424 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 58 times.
✓ Branch 9 taken 26 times.
✓ Branch 10 taken 56 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 811 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 18 taken 64 times.
✓ Branch 19 taken 36 times.
✓ Branch 20 taken 532 times.
✓ Branch 21 taken 5 times.
✓ Branch 22 taken 1 times.
✓ Branch 23 taken 16 times.
✓ Branch 24 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 33 taken 21771 times.
23809 switch (srcFormat) {
2085 case AV_PIX_FMT_RGBA64BE:
2086 *chrToYV12 = rgb64BEToUV_half_c;
2087 break;
2088 case AV_PIX_FMT_RGBA64LE:
2089 *chrToYV12 = rgb64LEToUV_half_c;
2090 break;
2091 case AV_PIX_FMT_BGRA64BE:
2092 *chrToYV12 = bgr64BEToUV_half_c;
2093 break;
2094 case AV_PIX_FMT_BGRA64LE:
2095 *chrToYV12 = bgr64LEToUV_half_c;
2096 break;
2097 case AV_PIX_FMT_RGB48BE:
2098 *chrToYV12 = rgb48BEToUV_half_c;
2099 break;
2100 424 case AV_PIX_FMT_RGB48LE:
2101 424 *chrToYV12 = rgb48LEToUV_half_c;
2102 424 break;
2103 case AV_PIX_FMT_BGR48BE:
2104 *chrToYV12 = bgr48BEToUV_half_c;
2105 break;
2106 case AV_PIX_FMT_BGR48LE:
2107 *chrToYV12 = bgr48LEToUV_half_c;
2108 break;
2109 58 case AV_PIX_FMT_RGB32:
2110 58 *chrToYV12 = bgr32ToUV_half_c;
2111 58 break;
2112 26 case AV_PIX_FMT_RGB32_1:
2113 26 *chrToYV12 = bgr321ToUV_half_c;
2114 26 break;
2115 56 case AV_PIX_FMT_BGR24:
2116 56 *chrToYV12 = bgr24ToUV_half_c;
2117 56 break;
2118 1 case AV_PIX_FMT_BGR565LE:
2119 1 *chrToYV12 = bgr16leToUV_half_c;
2120 1 break;
2121 1 case AV_PIX_FMT_BGR565BE:
2122 1 *chrToYV12 = bgr16beToUV_half_c;
2123 1 break;
2124 1 case AV_PIX_FMT_BGR555LE:
2125 1 *chrToYV12 = bgr15leToUV_half_c;
2126 1 break;
2127 1 case AV_PIX_FMT_BGR555BE:
2128 1 *chrToYV12 = bgr15beToUV_half_c;
2129 1 break;
2130 811 case AV_PIX_FMT_GBRAP:
2131 case AV_PIX_FMT_GBRP:
2132 811 *chrToYV12 = gbr24pToUV_half_c;
2133 811 break;
2134 1 case AV_PIX_FMT_BGR444LE:
2135 1 *chrToYV12 = bgr12leToUV_half_c;
2136 1 break;
2137 1 case AV_PIX_FMT_BGR444BE:
2138 1 *chrToYV12 = bgr12beToUV_half_c;
2139 1 break;
2140 64 case AV_PIX_FMT_BGR32:
2141 64 *chrToYV12 = rgb32ToUV_half_c;
2142 64 break;
2143 36 case AV_PIX_FMT_BGR32_1:
2144 36 *chrToYV12 = rgb321ToUV_half_c;
2145 36 break;
2146 532 case AV_PIX_FMT_RGB24:
2147 532 *chrToYV12 = rgb24ToUV_half_c;
2148 532 break;
2149 5 case AV_PIX_FMT_RGB565LE:
2150 5 *chrToYV12 = rgb16leToUV_half_c;
2151 5 break;
2152 1 case AV_PIX_FMT_RGB565BE:
2153 1 *chrToYV12 = rgb16beToUV_half_c;
2154 1 break;
2155 16 case AV_PIX_FMT_RGB555LE:
2156 16 *chrToYV12 = rgb15leToUV_half_c;
2157 16 break;
2158 1 case AV_PIX_FMT_RGB555BE:
2159 1 *chrToYV12 = rgb15beToUV_half_c;
2160 1 break;
2161 1 case AV_PIX_FMT_RGB444LE:
2162 1 *chrToYV12 = rgb12leToUV_half_c;
2163 1 break;
2164 1 case AV_PIX_FMT_RGB444BE:
2165 1 *chrToYV12 = rgb12beToUV_half_c;
2166 1 break;
2167 case AV_PIX_FMT_X2RGB10LE:
2168 *chrToYV12 = rgb30leToUV_half_c;
2169 break;
2170 case AV_PIX_FMT_X2BGR10LE:
2171 *chrToYV12 = bgr30leToUV_half_c;
2172 break;
2173 case AV_PIX_FMT_RGBAF16BE:
2174 *chrToYV12 = rgbaf16beToUV_half_c;
2175 break;
2176 case AV_PIX_FMT_RGBAF16LE:
2177 *chrToYV12 = rgbaf16leToUV_half_c;
2178 break;
2179 case AV_PIX_FMT_RGBF16BE:
2180 *chrToYV12 = rgbf16beToUV_half_c;
2181 break;
2182 case AV_PIX_FMT_RGBF16LE:
2183 *chrToYV12 = rgbf16leToUV_half_c;
2184 break;
2185 }
2186 } else {
2187
19/33
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 594 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 228 times.
✓ Branch 9 taken 30 times.
✓ Branch 10 taken 106 times.
✗ 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 taken 50 times.
✓ Branch 18 taken 30 times.
✓ Branch 19 taken 607 times.
✓ Branch 20 taken 101 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 101 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 81 times.
✓ Branch 27 taken 81 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 13157 times.
15197 switch (srcFormat) {
2188 11 case AV_PIX_FMT_RGBA64BE:
2189 11 *chrToYV12 = rgb64BEToUV_c;
2190 11 break;
2191 2 case AV_PIX_FMT_RGBA64LE:
2192 2 *chrToYV12 = rgb64LEToUV_c;
2193 2 break;
2194 1 case AV_PIX_FMT_BGRA64BE:
2195 1 *chrToYV12 = bgr64BEToUV_c;
2196 1 break;
2197 2 case AV_PIX_FMT_BGRA64LE:
2198 2 *chrToYV12 = bgr64LEToUV_c;
2199 2 break;
2200 12 case AV_PIX_FMT_RGB48BE:
2201 12 *chrToYV12 = rgb48BEToUV_c;
2202 12 break;
2203 594 case AV_PIX_FMT_RGB48LE:
2204 594 *chrToYV12 = rgb48LEToUV_c;
2205 594 break;
2206 1 case AV_PIX_FMT_BGR48BE:
2207 1 *chrToYV12 = bgr48BEToUV_c;
2208 1 break;
2209 2 case AV_PIX_FMT_BGR48LE:
2210 2 *chrToYV12 = bgr48LEToUV_c;
2211 2 break;
2212 228 case AV_PIX_FMT_RGB32:
2213 228 *chrToYV12 = bgr32ToUV_c;
2214 228 break;
2215 30 case AV_PIX_FMT_RGB32_1:
2216 30 *chrToYV12 = bgr321ToUV_c;
2217 30 break;
2218 106 case AV_PIX_FMT_BGR24:
2219 106 *chrToYV12 = bgr24ToUV_c;
2220 106 break;
2221 case AV_PIX_FMT_BGR565LE:
2222 *chrToYV12 = bgr16leToUV_c;
2223 break;
2224 case AV_PIX_FMT_BGR565BE:
2225 *chrToYV12 = bgr16beToUV_c;
2226 break;
2227 case AV_PIX_FMT_BGR555LE:
2228 *chrToYV12 = bgr15leToUV_c;
2229 break;
2230 case AV_PIX_FMT_BGR555BE:
2231 *chrToYV12 = bgr15beToUV_c;
2232 break;
2233 case AV_PIX_FMT_BGR444LE:
2234 *chrToYV12 = bgr12leToUV_c;
2235 break;
2236 case AV_PIX_FMT_BGR444BE:
2237 *chrToYV12 = bgr12beToUV_c;
2238 break;
2239 50 case AV_PIX_FMT_BGR32:
2240 50 *chrToYV12 = rgb32ToUV_c;
2241 50 break;
2242 30 case AV_PIX_FMT_BGR32_1:
2243 30 *chrToYV12 = rgb321ToUV_c;
2244 30 break;
2245 607 case AV_PIX_FMT_RGB24:
2246 607 *chrToYV12 = rgb24ToUV_c;
2247 607 break;
2248 101 case AV_PIX_FMT_RGB565LE:
2249 101 *chrToYV12 = rgb16leToUV_c;
2250 101 break;
2251 case AV_PIX_FMT_RGB565BE:
2252 *chrToYV12 = rgb16beToUV_c;
2253 break;
2254 101 case AV_PIX_FMT_RGB555LE:
2255 101 *chrToYV12 = rgb15leToUV_c;
2256 101 break;
2257 case AV_PIX_FMT_RGB555BE:
2258 *chrToYV12 = rgb15beToUV_c;
2259 break;
2260 case AV_PIX_FMT_RGB444LE:
2261 *chrToYV12 = rgb12leToUV_c;
2262 break;
2263 case AV_PIX_FMT_RGB444BE:
2264 *chrToYV12 = rgb12beToUV_c;
2265 break;
2266 81 case AV_PIX_FMT_X2RGB10LE:
2267 81 *chrToYV12 = rgb30leToUV_c;
2268 81 break;
2269 81 case AV_PIX_FMT_X2BGR10LE:
2270 81 *chrToYV12 = bgr30leToUV_c;
2271 81 break;
2272 case AV_PIX_FMT_RGBAF16BE:
2273 *chrToYV12 = rgbaf16beToUV_c;
2274 break;
2275 case AV_PIX_FMT_RGBAF16LE:
2276 *chrToYV12 = rgbaf16leToUV_c;
2277 break;
2278 case AV_PIX_FMT_RGBF16BE:
2279 *chrToYV12 = rgbf16beToUV_c;
2280 break;
2281 case AV_PIX_FMT_RGBF16LE:
2282 *chrToYV12 = rgbf16leToUV_c;
2283 break;
2284 }
2285 }
2286
2287 39006 *lumToYV12 = NULL;
2288 39006 *alpToYV12 = NULL;
2289
94/107
✓ Branch 0 taken 158 times.
✓ Branch 1 taken 236 times.
✓ Branch 2 taken 1102 times.
✓ Branch 3 taken 236 times.
✓ Branch 4 taken 1098 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 158 times.
✓ Branch 7 taken 236 times.
✓ Branch 8 taken 452 times.
✓ Branch 9 taken 235 times.
✓ Branch 10 taken 191 times.
✓ Branch 11 taken 115 times.
✓ Branch 12 taken 269 times.
✓ Branch 13 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 15 taken 157 times.
✓ Branch 16 taken 235 times.
✓ Branch 17 taken 247 times.
✓ Branch 18 taken 235 times.
✓ Branch 19 taken 247 times.
✓ Branch 20 taken 1 times.
✓ Branch 21 taken 157 times.
✓ Branch 22 taken 245 times.
✓ Branch 23 taken 287 times.
✓ Branch 24 taken 235 times.
✓ Branch 25 taken 157 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 1 times.
✓ Branch 29 taken 1 times.
✓ Branch 30 taken 276 times.
✓ Branch 31 taken 1039 times.
✓ Branch 32 taken 1985 times.
✓ Branch 33 taken 11 times.
✓ Branch 34 taken 2 times.
✓ Branch 35 taken 2 times.
✓ Branch 36 taken 1 times.
✓ Branch 37 taken 1 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 21 times.
✓ Branch 40 taken 9 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 113 times.
✓ Branch 43 taken 111 times.
✓ Branch 44 taken 125 times.
✓ Branch 45 taken 6 times.
✓ Branch 46 taken 142 times.
✓ Branch 47 taken 142 times.
✓ Branch 48 taken 111 times.
✓ Branch 49 taken 111 times.
✓ Branch 50 taken 245 times.
✓ Branch 51 taken 112 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 116 times.
✓ Branch 54 taken 162 times.
✓ Branch 55 taken 1 times.
✓ Branch 56 taken 1 times.
✓ Branch 57 taken 1 times.
✓ Branch 58 taken 1 times.
✓ Branch 59 taken 1 times.
✓ Branch 60 taken 1 times.
✓ Branch 61 taken 1139 times.
✓ Branch 62 taken 106 times.
✓ Branch 63 taken 1 times.
✓ Branch 64 taken 117 times.
✓ Branch 65 taken 1 times.
✓ Branch 66 taken 1 times.
✓ Branch 67 taken 1 times.
✓ Branch 68 taken 30 times.
✓ Branch 69 taken 112 times.
✓ Branch 70 taken 116 times.
✓ Branch 71 taken 286 times.
✓ Branch 72 taken 56 times.
✓ Branch 73 taken 114 times.
✓ Branch 74 taken 66 times.
✓ Branch 75 taken 12 times.
✓ Branch 76 taken 1018 times.
✓ Branch 77 taken 1 times.
✓ Branch 78 taken 2 times.
✓ Branch 79 taken 11 times.
✓ Branch 80 taken 2 times.
✓ Branch 81 taken 1 times.
✓ Branch 82 taken 2 times.
✓ Branch 83 taken 1 times.
✓ Branch 84 taken 1143 times.
✓ Branch 85 taken 1 times.
✓ Branch 86 taken 303 times.
✓ Branch 87 taken 1143 times.
✓ Branch 88 taken 303 times.
✓ Branch 89 taken 1 times.
✓ Branch 90 taken 1 times.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✓ Branch 93 taken 18 times.
✗ Branch 94 not taken.
✓ Branch 95 taken 111 times.
✓ Branch 96 taken 111 times.
✓ Branch 97 taken 141 times.
✓ Branch 98 taken 81 times.
✓ Branch 99 taken 81 times.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✓ Branch 106 taken 20826 times.
39006 switch (srcFormat) {
2290 158 case AV_PIX_FMT_GBRP9LE:
2291 158 *readLumPlanar = planar_rgb9le_to_y;
2292 158 break;
2293 236 case AV_PIX_FMT_GBRAP10LE:
2294 236 *readAlpPlanar = planar_rgb10le_to_a;
2295 1338 case AV_PIX_FMT_GBRP10LE:
2296 1338 *readLumPlanar = planar_rgb10le_to_y;
2297 1338 break;
2298 236 case AV_PIX_FMT_GBRAP12LE:
2299 236 *readAlpPlanar = planar_rgb12le_to_a;
2300 1334 case AV_PIX_FMT_GBRP12LE:
2301 1334 *readLumPlanar = planar_rgb12le_to_y;
2302 1334 break;
2303 1 case AV_PIX_FMT_GBRAP14LE:
2304 1 *readAlpPlanar = planar_rgb14le_to_a;
2305 159 case AV_PIX_FMT_GBRP14LE:
2306 159 *readLumPlanar = planar_rgb14le_to_y;
2307 159 break;
2308 236 case AV_PIX_FMT_GBRAP16LE:
2309 236 *readAlpPlanar = planar_rgb16le_to_a;
2310 688 case AV_PIX_FMT_GBRP16LE:
2311 688 *readLumPlanar = planar_rgb16le_to_y;
2312 688 break;
2313 235 case AV_PIX_FMT_GBRAPF32LE:
2314 235 *readAlpPlanar = planar_rgbf32le_to_a;
2315 426 case AV_PIX_FMT_GBRPF32LE:
2316 426 *readLumPlanar = planar_rgbf32le_to_y;
2317 426 break;
2318 115 case AV_PIX_FMT_GBRAPF16LE:
2319 115 *readAlpPlanar = planar_rgbf16le_to_a;
2320 384 case AV_PIX_FMT_GBRPF16LE:
2321 384 *readLumPlanar = planar_rgbf16le_to_y;
2322 384 break;
2323 2 case AV_PIX_FMT_GBRP10MSBLE:
2324 2 *readLumPlanar = msb_planar_rgb10le_to_y;
2325 2 break;
2326 2 case AV_PIX_FMT_GBRP12MSBLE:
2327 2 *readLumPlanar = msb_planar_rgb12le_to_y;
2328 2 break;
2329 157 case AV_PIX_FMT_GBRP9BE:
2330 157 *readLumPlanar = planar_rgb9be_to_y;
2331 157 break;
2332 235 case AV_PIX_FMT_GBRAP10BE:
2333 235 *readAlpPlanar = planar_rgb10be_to_a;
2334 482 case AV_PIX_FMT_GBRP10BE:
2335 482 *readLumPlanar = planar_rgb10be_to_y;
2336 482 break;
2337 235 case AV_PIX_FMT_GBRAP12BE:
2338 235 *readAlpPlanar = planar_rgb12be_to_a;
2339 482 case AV_PIX_FMT_GBRP12BE:
2340 482 *readLumPlanar = planar_rgb12be_to_y;
2341 482 break;
2342 1 case AV_PIX_FMT_GBRAP14BE:
2343 1 *readAlpPlanar = planar_rgb14be_to_a;
2344 158 case AV_PIX_FMT_GBRP14BE:
2345 158 *readLumPlanar = planar_rgb14be_to_y;
2346 158 break;
2347 245 case AV_PIX_FMT_GBRAP16BE:
2348 245 *readAlpPlanar = planar_rgb16be_to_a;
2349 532 case AV_PIX_FMT_GBRP16BE:
2350 532 *readLumPlanar = planar_rgb16be_to_y;
2351 532 break;
2352 235 case AV_PIX_FMT_GBRAPF32BE:
2353 235 *readAlpPlanar = planar_rgbf32be_to_a;
2354 392 case AV_PIX_FMT_GBRPF32BE:
2355 392 *readLumPlanar = planar_rgbf32be_to_y;
2356 392 break;
2357 case AV_PIX_FMT_GBRAPF16BE:
2358 *readAlpPlanar = planar_rgbf16be_to_a;
2359 case AV_PIX_FMT_GBRPF16BE:
2360 *readLumPlanar = planar_rgbf16be_to_y;
2361 break;
2362 1 case AV_PIX_FMT_GBRP10MSBBE:
2363 1 *readLumPlanar = msb_planar_rgb10be_to_y;
2364 1 break;
2365 1 case AV_PIX_FMT_GBRP12MSBBE:
2366 1 *readLumPlanar = msb_planar_rgb12be_to_y;
2367 1 break;
2368 276 case AV_PIX_FMT_GBRAP:
2369 276 *readAlpPlanar = planar_rgb_to_a;
2370 1315 case AV_PIX_FMT_GBRP:
2371 1315 *readLumPlanar = planar_rgb_to_y;
2372 1315 break;
2373 #if HAVE_BIGENDIAN
2374 case AV_PIX_FMT_YUV420P9LE:
2375 case AV_PIX_FMT_YUV422P9LE:
2376 case AV_PIX_FMT_YUV444P9LE:
2377 case AV_PIX_FMT_YUV420P10LE:
2378 case AV_PIX_FMT_YUV422P10LE:
2379 case AV_PIX_FMT_YUV440P10LE:
2380 case AV_PIX_FMT_YUV444P10LE:
2381 case AV_PIX_FMT_YUV420P12LE:
2382 case AV_PIX_FMT_YUV422P12LE:
2383 case AV_PIX_FMT_YUV440P12LE:
2384 case AV_PIX_FMT_YUV444P12LE:
2385 case AV_PIX_FMT_YUV420P14LE:
2386 case AV_PIX_FMT_YUV422P14LE:
2387 case AV_PIX_FMT_YUV444P14LE:
2388 case AV_PIX_FMT_YUV420P16LE:
2389 case AV_PIX_FMT_YUV422P16LE:
2390 case AV_PIX_FMT_YUV444P16LE:
2391
2392 case AV_PIX_FMT_GRAY9LE:
2393 case AV_PIX_FMT_GRAY10LE:
2394 case AV_PIX_FMT_GRAY12LE:
2395 case AV_PIX_FMT_GRAY14LE:
2396 case AV_PIX_FMT_GRAY16LE:
2397
2398 case AV_PIX_FMT_P016LE:
2399 case AV_PIX_FMT_P216LE:
2400 case AV_PIX_FMT_P416LE:
2401 *lumToYV12 = bswap16Y_c;
2402 break;
2403 case AV_PIX_FMT_YUVA420P9LE:
2404 case AV_PIX_FMT_YUVA422P9LE:
2405 case AV_PIX_FMT_YUVA444P9LE:
2406 case AV_PIX_FMT_YUVA420P10LE:
2407 case AV_PIX_FMT_YUVA422P10LE:
2408 case AV_PIX_FMT_YUVA444P10LE:
2409 case AV_PIX_FMT_YUVA422P12LE:
2410 case AV_PIX_FMT_YUVA444P12LE:
2411 case AV_PIX_FMT_YUVA420P16LE:
2412 case AV_PIX_FMT_YUVA422P16LE:
2413 case AV_PIX_FMT_YUVA444P16LE:
2414 *lumToYV12 = bswap16Y_c;
2415 *alpToYV12 = bswap16Y_c;
2416 break;
2417 #else
2418 1985 case AV_PIX_FMT_YUV420P9BE:
2419 case AV_PIX_FMT_YUV422P9BE:
2420 case AV_PIX_FMT_YUV444P9BE:
2421 case AV_PIX_FMT_YUV420P10BE:
2422 case AV_PIX_FMT_YUV422P10BE:
2423 case AV_PIX_FMT_YUV440P10BE:
2424 case AV_PIX_FMT_YUV444P10BE:
2425 case AV_PIX_FMT_YUV420P12BE:
2426 case AV_PIX_FMT_YUV422P12BE:
2427 case AV_PIX_FMT_YUV440P12BE:
2428 case AV_PIX_FMT_YUV444P12BE:
2429 case AV_PIX_FMT_YUV420P14BE:
2430 case AV_PIX_FMT_YUV422P14BE:
2431 case AV_PIX_FMT_YUV444P14BE:
2432 case AV_PIX_FMT_YUV420P16BE:
2433 case AV_PIX_FMT_YUV422P16BE:
2434 case AV_PIX_FMT_YUV444P16BE:
2435
2436 case AV_PIX_FMT_GRAY9BE:
2437 case AV_PIX_FMT_GRAY10BE:
2438 case AV_PIX_FMT_GRAY12BE:
2439 case AV_PIX_FMT_GRAY14BE:
2440 case AV_PIX_FMT_GRAY16BE:
2441
2442 case AV_PIX_FMT_P016BE:
2443 case AV_PIX_FMT_P216BE:
2444 case AV_PIX_FMT_P416BE:
2445 1985 *lumToYV12 = bswap16Y_c;
2446 1985 break;
2447 11 case AV_PIX_FMT_YUVA420P9BE:
2448 case AV_PIX_FMT_YUVA422P9BE:
2449 case AV_PIX_FMT_YUVA444P9BE:
2450 case AV_PIX_FMT_YUVA420P10BE:
2451 case AV_PIX_FMT_YUVA422P10BE:
2452 case AV_PIX_FMT_YUVA444P10BE:
2453 case AV_PIX_FMT_YUVA422P12BE:
2454 case AV_PIX_FMT_YUVA444P12BE:
2455 case AV_PIX_FMT_YUVA420P16BE:
2456 case AV_PIX_FMT_YUVA422P16BE:
2457 case AV_PIX_FMT_YUVA444P16BE:
2458 11 *lumToYV12 = bswap16Y_c;
2459 11 *alpToYV12 = bswap16Y_c;
2460 11 break;
2461 #endif
2462 2 case AV_PIX_FMT_YUV444P10MSBLE:
2463 2 *lumToYV12 = shf16_10LEToY_c;
2464 2 break;
2465 2 case AV_PIX_FMT_YUV444P12MSBLE:
2466 2 *lumToYV12 = shf16_12LEToY_c;
2467 2 break;
2468 1 case AV_PIX_FMT_YUV444P10MSBBE:
2469 1 *lumToYV12 = shf16_10BEToY_c;
2470 1 break;
2471 1 case AV_PIX_FMT_YUV444P12MSBBE:
2472 1 *lumToYV12 = shf16_12BEToY_c;
2473 1 break;
2474 1 case AV_PIX_FMT_YA16LE:
2475 1 *lumToYV12 = read_ya16le_gray_c;
2476 1 break;
2477 21 case AV_PIX_FMT_YA16BE:
2478 21 *lumToYV12 = read_ya16be_gray_c;
2479 21 break;
2480 9 case AV_PIX_FMT_YAF16LE:
2481 9 *lumToYV12 = read_yaf16le_gray_c;
2482 9 break;
2483 case AV_PIX_FMT_YAF16BE:
2484 *lumToYV12 = read_yaf16be_gray_c;
2485 break;
2486 113 case AV_PIX_FMT_VUYA:
2487 case AV_PIX_FMT_VUYX:
2488 113 *lumToYV12 = read_vuyx_Y_c;
2489 113 break;
2490 111 case AV_PIX_FMT_XV30LE:
2491 111 *lumToYV12 = read_xv30le_Y_c;
2492 111 break;
2493 125 case AV_PIX_FMT_V30XLE:
2494 125 *lumToYV12 = read_v30xle_Y_c;
2495 125 break;
2496 6 case AV_PIX_FMT_AYUV:
2497 case AV_PIX_FMT_UYVA:
2498 6 *lumToYV12 = read_ayuv_Y_c;
2499 6 break;
2500 142 case AV_PIX_FMT_AYUV64LE:
2501 case AV_PIX_FMT_XV48LE:
2502 142 *lumToYV12 = read_ayuv64le_Y_c;
2503 142 break;
2504 142 case AV_PIX_FMT_AYUV64BE:
2505 case AV_PIX_FMT_XV48BE:
2506 142 *lumToYV12 = read_ayuv64be_Y_c;
2507 142 break;
2508 111 case AV_PIX_FMT_XV36LE:
2509 111 *lumToYV12 = read_xv36le_Y_c;
2510 111 break;
2511 111 case AV_PIX_FMT_XV36BE:
2512 111 *lumToYV12 = read_xv36be_Y_c;
2513 111 break;
2514 245 case AV_PIX_FMT_YUYV422:
2515 case AV_PIX_FMT_YVYU422:
2516 case AV_PIX_FMT_YA8:
2517 245 *lumToYV12 = yuy2ToY_c;
2518 245 break;
2519 112 case AV_PIX_FMT_UYVY422:
2520 112 *lumToYV12 = uyvyToY_c;
2521 112 break;
2522 case AV_PIX_FMT_UYYVYY411:
2523 *lumToYV12 = uyyvyyToY_c;
2524 break;
2525 116 case AV_PIX_FMT_VYU444:
2526 116 *lumToYV12 = vyuToY_c;
2527 116 break;
2528 162 case AV_PIX_FMT_BGR24:
2529 162 *lumToYV12 = bgr24ToY_c;
2530 162 break;
2531 1 case AV_PIX_FMT_BGR565LE:
2532 1 *lumToYV12 = bgr16leToY_c;
2533 1 break;
2534 1 case AV_PIX_FMT_BGR565BE:
2535 1 *lumToYV12 = bgr16beToY_c;
2536 1 break;
2537 1 case AV_PIX_FMT_BGR555LE:
2538 1 *lumToYV12 = bgr15leToY_c;
2539 1 break;
2540 1 case AV_PIX_FMT_BGR555BE:
2541 1 *lumToYV12 = bgr15beToY_c;
2542 1 break;
2543 1 case AV_PIX_FMT_BGR444LE:
2544 1 *lumToYV12 = bgr12leToY_c;
2545 1 break;
2546 1 case AV_PIX_FMT_BGR444BE:
2547 1 *lumToYV12 = bgr12beToY_c;
2548 1 break;
2549 1139 case AV_PIX_FMT_RGB24:
2550 1139 *lumToYV12 = rgb24ToY_c;
2551 1139 break;
2552 106 case AV_PIX_FMT_RGB565LE:
2553 106 *lumToYV12 = rgb16leToY_c;
2554 106 break;
2555 1 case AV_PIX_FMT_RGB565BE:
2556 1 *lumToYV12 = rgb16beToY_c;
2557 1 break;
2558 117 case AV_PIX_FMT_RGB555LE:
2559 117 *lumToYV12 = rgb15leToY_c;
2560 117 break;
2561 1 case AV_PIX_FMT_RGB555BE:
2562 1 *lumToYV12 = rgb15beToY_c;
2563 1 break;
2564 1 case AV_PIX_FMT_RGB444LE:
2565 1 *lumToYV12 = rgb12leToY_c;
2566 1 break;
2567 1 case AV_PIX_FMT_RGB444BE:
2568 1 *lumToYV12 = rgb12beToY_c;
2569 1 break;
2570 30 case AV_PIX_FMT_RGB8:
2571 case AV_PIX_FMT_BGR8:
2572 case AV_PIX_FMT_PAL8:
2573 case AV_PIX_FMT_BGR4_BYTE:
2574 case AV_PIX_FMT_RGB4_BYTE:
2575 30 *lumToYV12 = palToY_c;
2576 30 break;
2577 112 case AV_PIX_FMT_MONOBLACK:
2578 112 *lumToYV12 = monoblack2Y_c;
2579 112 break;
2580 116 case AV_PIX_FMT_MONOWHITE:
2581 116 *lumToYV12 = monowhite2Y_c;
2582 116 break;
2583 286 case AV_PIX_FMT_RGB32:
2584 286 *lumToYV12 = bgr32ToY_c;
2585 286 break;
2586 56 case AV_PIX_FMT_RGB32_1:
2587 56 *lumToYV12 = bgr321ToY_c;
2588 56 break;
2589 114 case AV_PIX_FMT_BGR32:
2590 114 *lumToYV12 = rgb32ToY_c;
2591 114 break;
2592 66 case AV_PIX_FMT_BGR32_1:
2593 66 *lumToYV12 = rgb321ToY_c;
2594 66 break;
2595 12 case AV_PIX_FMT_RGB48BE:
2596 12 *lumToYV12 = rgb48BEToY_c;
2597 12 break;
2598 1018 case AV_PIX_FMT_RGB48LE:
2599 1018 *lumToYV12 = rgb48LEToY_c;
2600 1018 break;
2601 1 case AV_PIX_FMT_BGR48BE:
2602 1 *lumToYV12 = bgr48BEToY_c;
2603 1 break;
2604 2 case AV_PIX_FMT_BGR48LE:
2605 2 *lumToYV12 = bgr48LEToY_c;
2606 2 break;
2607 11 case AV_PIX_FMT_RGBA64BE:
2608 11 *lumToYV12 = rgb64BEToY_c;
2609 11 break;
2610 2 case AV_PIX_FMT_RGBA64LE:
2611 2 *lumToYV12 = rgb64LEToY_c;
2612 2 break;
2613 1 case AV_PIX_FMT_BGRA64BE:
2614 1 *lumToYV12 = bgr64BEToY_c;
2615 1 break;
2616 2 case AV_PIX_FMT_BGRA64LE:
2617 2 *lumToYV12 = bgr64LEToY_c;
2618 2 break;
2619 1 case AV_PIX_FMT_NV20LE:
2620 1 *lumToYV12 = nv20LEToY_c;
2621 1 break;
2622 1143 case AV_PIX_FMT_P010LE:
2623 case AV_PIX_FMT_P210LE:
2624 case AV_PIX_FMT_P410LE:
2625 1143 *lumToYV12 = p010LEToY_c;
2626 1143 break;
2627 1 case AV_PIX_FMT_NV20BE:
2628 1 *lumToYV12 = nv20BEToY_c;
2629 1 break;
2630 303 case AV_PIX_FMT_P010BE:
2631 case AV_PIX_FMT_P210BE:
2632 case AV_PIX_FMT_P410BE:
2633 303 *lumToYV12 = p010BEToY_c;
2634 303 break;
2635 1143 case AV_PIX_FMT_P012LE:
2636 case AV_PIX_FMT_P212LE:
2637 case AV_PIX_FMT_P412LE:
2638 1143 *lumToYV12 = p012LEToY_c;
2639 1143 break;
2640 303 case AV_PIX_FMT_P012BE:
2641 case AV_PIX_FMT_P212BE:
2642 case AV_PIX_FMT_P412BE:
2643 303 *lumToYV12 = p012BEToY_c;
2644 303 break;
2645 1 case AV_PIX_FMT_GRAYF32LE:
2646 1 *lumToYV12 = grayf32leToY16_c;
2647 1 break;
2648 1 case AV_PIX_FMT_GRAYF32BE:
2649 1 *lumToYV12 = grayf32beToY16_c;
2650 1 break;
2651 case AV_PIX_FMT_YAF32LE:
2652 *lumToYV12 = read_yaf32le_gray_c;
2653 break;
2654 case AV_PIX_FMT_YAF32BE:
2655 *lumToYV12 = read_yaf32be_gray_c;
2656 break;
2657 18 case AV_PIX_FMT_GRAYF16LE:
2658 18 *lumToYV12 = grayf16leToY16_c;
2659 18 break;
2660 case AV_PIX_FMT_GRAYF16BE:
2661 *lumToYV12 = grayf16beToY16_c;
2662 break;
2663 111 case AV_PIX_FMT_Y210LE:
2664 111 *lumToYV12 = y210le_Y_c;
2665 111 break;
2666 111 case AV_PIX_FMT_Y212LE:
2667 111 *lumToYV12 = y212le_Y_c;
2668 111 break;
2669 141 case AV_PIX_FMT_Y216LE:
2670 141 *lumToYV12 = y216le_Y_c;
2671 141 break;
2672 81 case AV_PIX_FMT_X2RGB10LE:
2673 81 *lumToYV12 = rgb30leToY_c;
2674 81 break;
2675 81 case AV_PIX_FMT_X2BGR10LE:
2676 81 *lumToYV12 = bgr30leToY_c;
2677 81 break;
2678 case AV_PIX_FMT_RGBAF16BE:
2679 *lumToYV12 = rgbaf16beToY_c;
2680 break;
2681 case AV_PIX_FMT_RGBAF16LE:
2682 *lumToYV12 = rgbaf16leToY_c;
2683 break;
2684 case AV_PIX_FMT_RGBF16BE:
2685 *lumToYV12 = rgbf16beToY_c;
2686 break;
2687 case AV_PIX_FMT_RGBF16LE:
2688 *lumToYV12 = rgbf16leToY_c;
2689 break;
2690 case AV_PIX_FMT_RGBF32LE:
2691 *lumToYV12 = rgbf32le_to_y_c;
2692 break;
2693 case AV_PIX_FMT_RGBF32BE:
2694 *lumToYV12 = rgbf32be_to_y_c;
2695 break;
2696 }
2697
2/2
✓ Branch 0 taken 358 times.
✓ Branch 1 taken 38648 times.
39006 if (c->needAlpha) {
2698
4/4
✓ Branch 1 taken 218 times.
✓ Branch 2 taken 140 times.
✓ Branch 4 taken 22 times.
✓ Branch 5 taken 196 times.
358 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
2699
4/4
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 143 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 4 times.
162 if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
2700 15 *alpToYV12 = bswap16Y_c;
2701 }
2702
13/19
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 162 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 9 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2 times.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 161 times.
358 switch (srcFormat) {
2703 2 case AV_PIX_FMT_BGRA64LE:
2704 2 case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2705 2 case AV_PIX_FMT_BGRA64BE:
2706 2 case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2707 162 case AV_PIX_FMT_BGRA:
2708 case AV_PIX_FMT_RGBA:
2709 162 *alpToYV12 = rgbaToA_c;
2710 162 break;
2711 14 case AV_PIX_FMT_ABGR:
2712 case AV_PIX_FMT_ARGB:
2713 14 *alpToYV12 = abgrToA_c;
2714 14 break;
2715 case AV_PIX_FMT_RGBAF16BE:
2716 *alpToYV12 = rgbaf16beToA_c;
2717 break;
2718 case AV_PIX_FMT_RGBAF16LE:
2719 *alpToYV12 = rgbaf16leToA_c;
2720 break;
2721 1 case AV_PIX_FMT_YA8:
2722 1 *alpToYV12 = uyvyToY_c;
2723 1 break;
2724 1 case AV_PIX_FMT_YA16LE:
2725 1 *alpToYV12 = read_ya16le_alpha_c;
2726 1 break;
2727 1 case AV_PIX_FMT_YA16BE:
2728 1 *alpToYV12 = read_ya16be_alpha_c;
2729 1 break;
2730 9 case AV_PIX_FMT_YAF16LE:
2731 9 *alpToYV12 = read_yaf16le_alpha_c;
2732 9 break;
2733 case AV_PIX_FMT_YAF16BE:
2734 *alpToYV12 = read_yaf16be_alpha_c;
2735 break;
2736 case AV_PIX_FMT_YAF32LE:
2737 *alpToYV12 = read_yaf32le_alpha_c;
2738 break;
2739 case AV_PIX_FMT_YAF32BE:
2740 *alpToYV12 = read_yaf32be_alpha_c;
2741 break;
2742 2 case AV_PIX_FMT_VUYA:
2743 case AV_PIX_FMT_UYVA:
2744 2 *alpToYV12 = read_vuya_A_c;
2745 2 break;
2746 1 case AV_PIX_FMT_AYUV:
2747 1 *alpToYV12 = read_ayuv_A_c;
2748 1 break;
2749 1 case AV_PIX_FMT_AYUV64LE:
2750 1 *alpToYV12 = read_ayuv64le_A_c;
2751 1 break;
2752 1 case AV_PIX_FMT_AYUV64BE:
2753 1 *alpToYV12 = read_ayuv64be_A_c;
2754 1 break;
2755 case AV_PIX_FMT_PAL8 :
2756 *alpToYV12 = palToA_c;
2757 break;
2758 }
2759 }
2760 39006 }
2761