FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2025-08-19 23:55:23
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_to_y(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 #define shifted_planar_rgb16_to_a(rdpx_shift) \
1235 static av_always_inline void planar_rgb16_s ## rdpx_shift ## _to_a(uint8_t *_dst, const uint8_t *_src[4], \
1236 int width, int bpc, int is_be, int32_t *rgb2yuv) \
1237 { \
1238 int i; \
1239 const uint16_t **src = (const uint16_t **)_src; \
1240 uint16_t *dst = (uint16_t *)_dst; \
1241 int shift = (bpc < 16 ? bpc : 14) + 16 - rdpx_shift; \
1242 \
1243 for (i = 0; i < width; i++) { \
1244 dst[i] = rdpx(src[3] + i) << (14 - shift); \
1245 } \
1246 } \
1247
1248 #define shifted_planar_rgb16_to_uv(rdpx_shift) \
1249 static av_always_inline void planar_rgb16_s ## rdpx_shift ## _to_uv(uint8_t *_dstU, uint8_t *_dstV, \
1250 const uint8_t *_src[4], int width, \
1251 int bpc, int is_be, int32_t *rgb2yuv) \
1252 { \
1253 int i; \
1254 const uint16_t **src = (const uint16_t **)_src; \
1255 uint16_t *dstU = (uint16_t *)_dstU; \
1256 uint16_t *dstV = (uint16_t *)_dstV; \
1257 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX]; \
1258 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX]; \
1259 int shift = bpc < 16 ? bpc : 14; \
1260 for (i = 0; i < width; i++) { \
1261 int g = rdpx(src[0] + i) >> (16 - rdpx_shift); \
1262 int b = rdpx(src[1] + i) >> (16 - rdpx_shift); \
1263 int r = rdpx(src[2] + i) >> (16 - rdpx_shift); \
1264 \
1265 dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) \
1266 + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14); \
1267 dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) \
1268 + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14); \
1269 } \
1270 }
1271
1272 #define shifted_planar_rgb16_to_y_uv(rdpx_shift) \
1273 shifted_planar_rgb16_to_y(rdpx_shift) \
1274 shifted_planar_rgb16_to_uv(rdpx_shift)
1275
1276 #define shifted_planar_rgb16(rdpx_shift) \
1277 shifted_planar_rgb16_to_y_uv(rdpx_shift) \
1278 shifted_planar_rgb16_to_a(rdpx_shift)
1279
1280
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)
1281
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_to_y_uv(12)
1282
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_to_y_uv(10)
1283
1284 #undef rdpx
1285
1286 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
1287
1288 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)
1289 {
1290 int i;
1291 1188 const float **src = (const float **)_src;
1292 1188 uint16_t *dst = (uint16_t *)_dst;
1293
1294
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 1188 times.
413124 for (i = 0; i < width; i++) {
1295
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));
1296 }
1297 1188 }
1298
1299 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)
1300 {
1301 int i;
1302 2376 const float **src = (const float **)_src;
1303 2376 uint16_t *dstU = (uint16_t *)_dstU;
1304 2376 uint16_t *dstV = (uint16_t *)_dstV;
1305 2376 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1306 2376 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1307
1308
2/2
✓ Branch 0 taken 823872 times.
✓ Branch 1 taken 2376 times.
826248 for (i = 0; i < width; i++) {
1309
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));
1310
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));
1311
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));
1312
1313 823872 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1314 823872 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1315 }
1316 2376 }
1317
1318 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)
1319 {
1320 int i;
1321 2376 const float **src = (const float **)_src;
1322 2376 uint16_t *dst = (uint16_t *)_dst;
1323
1324 2376 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1325
1326
2/2
✓ Branch 0 taken 823872 times.
✓ Branch 1 taken 2376 times.
826248 for (i = 0; i < width; i++) {
1327
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));
1328
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));
1329
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));
1330
1331 823872 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1332 }
1333 2376 }
1334
1335 static av_always_inline void rgbf32_to_uv_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused1,
1336 const uint8_t *_src, const uint8_t *unused2,
1337 int width, int is_be, int32_t *rgb2yuv)
1338 {
1339 int i;
1340 const float *src = (const float *)_src;
1341 uint16_t *dstU = (uint16_t *)_dstU;
1342 uint16_t *dstV = (uint16_t *)_dstV;
1343 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1344 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1345
1346 for (i = 0; i < width; i++) {
1347 int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1348 int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1349 int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1350
1351 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1352 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1353 }
1354 }
1355
1356 static av_always_inline void rgbf32_to_y_c(uint8_t *_dst, const uint8_t *_src,
1357 const uint8_t *unused1, const uint8_t *unused2,
1358 int width, int is_be, int32_t *rgb2yuv)
1359 {
1360 int i;
1361 const float *src = (const float *)_src;
1362 uint16_t *dst = (uint16_t *)_dst;
1363
1364 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1365
1366 for (i = 0; i < width; i++) {
1367 int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1368 int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1369 int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1370
1371 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1372 }
1373 }
1374
1375 1152 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1376 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1377 {
1378 int i;
1379 1152 const float *src = (const float *)_src;
1380 1152 uint16_t *dst = (uint16_t *)_dst;
1381
1382
2/2
✓ Branch 0 taken 405504 times.
✓ Branch 1 taken 1152 times.
406656 for (i = 0; i < width; ++i){
1383
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));
1384 }
1385 1152 }
1386
1387 static av_always_inline void read_yaf32_gray_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1388 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1389 {
1390 int i;
1391 const float *src = (const float *)_src;
1392 uint16_t *dst = (uint16_t *)_dst;
1393
1394 for (i = 0; i < width; ++i)
1395 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i*2), 0.0f, 65535.0f));
1396 }
1397
1398 static av_always_inline void read_yaf32_alpha_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1399 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1400 {
1401 int i;
1402 const float *src = (const float *)_src;
1403 uint16_t *dst = (uint16_t *)_dst;
1404
1405 for (i = 0; i < width; ++i)
1406 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i*2 + 1), 0.0f, 65535.0f));
1407 }
1408
1409 #undef rdpx
1410
1411 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1412 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1413 int w, int32_t *rgb2yuv, void *opq) \
1414 { \
1415 planar_rgb16_s16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1416 } \
1417 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1418 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1419 void *opq) \
1420 { \
1421 planar_rgb16_s16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1422 } \
1423
1424 #define rgb9plus_planar_transparency_funcs(nbits) \
1425 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1426 int w, int32_t *rgb2yuv, \
1427 void *opq) \
1428 { \
1429 planar_rgb16_s16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1430 } \
1431 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1432 int w, int32_t *rgb2yuv, \
1433 void *opq) \
1434 { \
1435 planar_rgb16_s16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1436 }
1437
1438 #define rgb9plus_msb_planar_funcs_endian(nbits, endian_name, endian) \
1439 static void msb_planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1440 int w, int32_t *rgb2yuv, void *opq) \
1441 { \
1442 planar_rgb16_s##nbits##_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1443 } \
1444 static void msb_planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1445 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1446 void *opq) \
1447 { \
1448 planar_rgb16_s##nbits##_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1449 }
1450
1451 #define rgb9plus_planar_funcs(nbits) \
1452 rgb9plus_planar_funcs_endian(nbits, le, 0) \
1453 rgb9plus_planar_funcs_endian(nbits, be, 1)
1454
1455 #define rgb9plus_msb_planar_funcs(nbits) \
1456 rgb9plus_msb_planar_funcs_endian(nbits, le, 0) \
1457 rgb9plus_msb_planar_funcs_endian(nbits, be, 1)
1458
1459 4752 rgb9plus_planar_funcs(9)
1460 3632544 rgb9plus_planar_funcs(10)
1461 3452944 rgb9plus_planar_funcs(12)
1462 9360 rgb9plus_planar_funcs(14)
1463 1509036 rgb9plus_planar_funcs(16)
1464
1465 2376 rgb9plus_planar_transparency_funcs(10)
1466 2376 rgb9plus_planar_transparency_funcs(12)
1467 2304 rgb9plus_planar_transparency_funcs(14)
1468 2376 rgb9plus_planar_transparency_funcs(16)
1469
1470 4992 rgb9plus_msb_planar_funcs(10)
1471 4992 rgb9plus_msb_planar_funcs(12)
1472
1473 #define rgbf32_funcs_endian(endian_name, endian) \
1474 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1475 int w, int32_t *rgb2yuv, void *opq) \
1476 { \
1477 planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1478 } \
1479 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1480 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1481 void *opq) \
1482 { \
1483 planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1484 } \
1485 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1486 int w, int32_t *rgb2yuv, void *opq) \
1487 { \
1488 planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1489 } \
1490 static void rgbf32##endian_name##_to_y_c(uint8_t *dst, const uint8_t *src, \
1491 const uint8_t *unused1, const uint8_t *unused2, \
1492 int w, uint32_t *rgb2yuv, void *opq) \
1493 { \
1494 rgbf32_to_y_c(dst, src, unused1, unused2, w, endian, rgb2yuv); \
1495 } \
1496 static void rgbf32##endian_name##_to_uv_c(uint8_t *dstU, uint8_t *dstV, \
1497 const uint8_t *unused1, \
1498 const uint8_t *src, const uint8_t *unused2, \
1499 int w, uint32_t *rgb2yuv, \
1500 void *opq) \
1501 { \
1502 rgbf32_to_uv_c(dstU, dstV, unused1, src, unused2, w, endian, rgb2yuv); \
1503 } \
1504 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1505 const uint8_t *unused1, const uint8_t *unused2, \
1506 int width, uint32_t *unused, void *opq) \
1507 { \
1508 grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1509 } \
1510 static void read_yaf32##endian_name##_gray_c(uint8_t *dst, const uint8_t *src, \
1511 const uint8_t *unused1, const uint8_t *unused2, \
1512 int width, uint32_t *unused, void *opq) \
1513 { \
1514 read_yaf32_gray_c(dst, src, unused1, unused2, width, endian, unused); \
1515 } \
1516 static void read_yaf32##endian_name##_alpha_c(uint8_t *dst, const uint8_t *src, \
1517 const uint8_t *unused1, const uint8_t *unused2, \
1518 int width, uint32_t *unused, void *opq) \
1519 { \
1520 read_yaf32_alpha_c(dst, src, unused1, unused2, width, endian, unused); \
1521 }
1522
1523 7092 rgbf32_funcs_endian(le, 0)
1524 7092 rgbf32_funcs_endian(be, 1)
1525
1526 #define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : AV_RL16(&src), h2f_tbl))
1527 #define rdpx2(src) av_int2float(half2float(is_be ? AV_RB16(src) : AV_RL16(src), h2f_tbl))
1528
1529 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)
1530 {
1531 int i;
1532
1533
2/2
✓ Branch 0 taken 1859160 times.
✓ Branch 1 taken 3121 times.
1862281 for (i = 0; i < width; i++) {
1534
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)));
1535 }
1536 3121 }
1537
1538 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)
1539 {
1540 int i;
1541 6612 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1542 6612 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1543
1544
2/2
✓ Branch 0 taken 3537889 times.
✓ Branch 1 taken 6612 times.
3544501 for (i = 0; i < width; i++) {
1545
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));
1546
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));
1547
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));
1548
1549 3537889 AV_WN16(dstU + 2*i, (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1550 3537889 AV_WN16(dstV + 2*i, (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1551 }
1552 6612 }
1553
1554 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)
1555 {
1556 int i;
1557
1558 6612 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1559
1560
2/2
✓ Branch 0 taken 3537889 times.
✓ Branch 1 taken 6612 times.
3544501 for (i = 0; i < width; i++) {
1561
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));
1562
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));
1563
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));
1564
1565 3537889 AV_WN16(dst + 2*i, (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1566 }
1567 6612 }
1568
1569 24 static av_always_inline void grayf16ToY16_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 int i;
1573
1574
2/2
✓ Branch 0 taken 288 times.
✓ Branch 1 taken 24 times.
312 for (i = 0; i < width; ++i){
1575
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)));
1576 }
1577 24 }
1578
1579 12 static av_always_inline void read_yaf16_gray_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
1580 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1581 {
1582 12 uint16_t *dst = (uint16_t *)_dst;
1583
1584
2/2
✓ Branch 0 taken 144 times.
✓ Branch 1 taken 12 times.
156 for (int i = 0; i < width; i++)
1585
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));
1586 12 }
1587
1588 12 static av_always_inline void read_yaf16_alpha_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
1589 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1590 {
1591 12 uint16_t *dst = (uint16_t *)_dst;
1592
1593
2/2
✓ Branch 0 taken 144 times.
✓ Branch 1 taken 12 times.
156 for (int i = 0; i < width; i++)
1594
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));
1595 12 }
1596
1597 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1598 const uint16_t *src, int width,
1599 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1600 {
1601 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1602 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1603 int i;
1604 for (i = 0; i < width; i++) {
1605 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) +
1606 lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1;
1607 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) +
1608 lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1;
1609 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) +
1610 lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1;
1611
1612 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1613 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1614 }
1615 }
1616
1617 static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1618 const uint16_t *src, int width,
1619 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1620 {
1621 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1622 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1623 int i;
1624 for (i = 0; i < width; i++) {
1625 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1626 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1627 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1628
1629 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1630 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1631 }
1632 }
1633
1634 static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1635 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1636 {
1637 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1638 int i;
1639 for (i = 0; i < width; i++) {
1640 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1641 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1642 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1643
1644 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1645 }
1646 }
1647
1648 static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be,
1649 int width, Half2FloatTables *h2f_tbl)
1650 {
1651 int i;
1652 for (i=0; i<width; i++) {
1653 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[i*4+3]), 0.0f, 65535.0f));
1654 }
1655 }
1656
1657 static av_always_inline void rgbf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1658 const uint16_t *src, int width,
1659 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1660 {
1661 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1662 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1663 int i;
1664 for (i = 0; i < width; i++) {
1665 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+0]), 0.0f, 65535.0f)) +
1666 lrintf(av_clipf(65535.0f * rdpx(src[i*6+3]), 0.0f, 65535.0f))) >> 1;
1667 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+1]), 0.0f, 65535.0f)) +
1668 lrintf(av_clipf(65535.0f * rdpx(src[i*6+4]), 0.0f, 65535.0f))) >> 1;
1669 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+2]), 0.0f, 65535.0f)) +
1670 lrintf(av_clipf(65535.0f * rdpx(src[i*6+5]), 0.0f, 65535.0f))) >> 1;
1671
1672 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1673 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1674 }
1675 }
1676
1677 static av_always_inline void rgbf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1678 const uint16_t *src, int width,
1679 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1680 {
1681 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1682 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1683 int i;
1684 for (i = 0; i < width; i++) {
1685 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1686 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1687 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1688
1689 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1690 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1691 }
1692 }
1693
1694 static av_always_inline void rgbf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1695 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1696 {
1697 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1698 int i;
1699 for (i = 0; i < width; i++) {
1700 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1701 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1702 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1703
1704 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1705 }
1706 }
1707
1708 #undef rdpx
1709
1710 #define rgbaf16_funcs_endian(endian_name, endian) \
1711 static void planar_rgbf16##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1712 int w, int32_t *rgb2yuv, void *opq) \
1713 { \
1714 planar_rgbf16_to_y(dst, src, w, endian, rgb2yuv, opq); \
1715 } \
1716 static void planar_rgbf16##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1717 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1718 void *opq) \
1719 { \
1720 planar_rgbf16_to_uv(dstU, dstV, src, w, endian, rgb2yuv, opq); \
1721 } \
1722 static void planar_rgbf16##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1723 int w, int32_t *rgb2yuv, void *opq) \
1724 { \
1725 planar_rgbf16_to_a(dst, src, w, endian, rgb2yuv, opq); \
1726 } \
1727 static void grayf16##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1728 const uint8_t *unused1, const uint8_t *unused2, \
1729 int width, uint32_t *unused, void *opq) \
1730 { \
1731 grayf16ToY16_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1732 } \
1733 static void read_yaf16##endian_name##_gray_c(uint8_t *dst, const uint8_t *src, \
1734 const uint8_t *unused1, const uint8_t *unused2, \
1735 int width, uint32_t *unused, void *opq) \
1736 { \
1737 read_yaf16_gray_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1738 } \
1739 static void read_yaf16##endian_name##_alpha_c(uint8_t *dst, const uint8_t *src, \
1740 const uint8_t *unused1, const uint8_t *unused2, \
1741 int width, uint32_t *unused, void *opq) \
1742 { \
1743 read_yaf16_alpha_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1744 } \
1745 \
1746 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1747 const uint8_t *src1, const uint8_t *src2, \
1748 int width, uint32_t *_rgb2yuv, void *opq) \
1749 { \
1750 const uint16_t *src = (const uint16_t*)src1; \
1751 uint16_t *dstU = (uint16_t*)_dstU; \
1752 uint16_t *dstV = (uint16_t*)_dstV; \
1753 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1754 av_assert1(src1==src2); \
1755 rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1756 } \
1757 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1758 const uint8_t *src1, const uint8_t *src2, \
1759 int width, uint32_t *_rgb2yuv, void *opq) \
1760 { \
1761 const uint16_t *src = (const uint16_t*)src1; \
1762 uint16_t *dstU = (uint16_t*)_dstU; \
1763 uint16_t *dstV = (uint16_t*)_dstV; \
1764 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1765 av_assert1(src1==src2); \
1766 rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1767 } \
1768 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1769 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1770 { \
1771 const uint16_t *src = (const uint16_t*)_src; \
1772 uint16_t *dst = (uint16_t*)_dst; \
1773 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1774 rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1775 } \
1776 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1777 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1778 { \
1779 const uint16_t *src = (const uint16_t*)_src; \
1780 uint16_t *dst = (uint16_t*)_dst; \
1781 rgbaf16ToA_endian(dst, src, endian, width, opq); \
1782 } \
1783 static void rgbf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1784 const uint8_t *src1, const uint8_t *src2, \
1785 int width, uint32_t *_rgb2yuv, void *opq) \
1786 { \
1787 const uint16_t *src = (const uint16_t*)src1; \
1788 uint16_t *dstU = (uint16_t*)_dstU; \
1789 uint16_t *dstV = (uint16_t*)_dstV; \
1790 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1791 av_assert1(src1==src2); \
1792 rgbf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1793 } \
1794 static void rgbf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1795 const uint8_t *src1, const uint8_t *src2, \
1796 int width, uint32_t *_rgb2yuv, void *opq) \
1797 { \
1798 const uint16_t *src = (const uint16_t*)src1; \
1799 uint16_t *dstU = (uint16_t*)_dstU; \
1800 uint16_t *dstV = (uint16_t*)_dstV; \
1801 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1802 av_assert1(src1==src2); \
1803 rgbf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1804 } \
1805 static void rgbf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1806 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1807 { \
1808 const uint16_t *src = (const uint16_t*)_src; \
1809 uint16_t *dst = (uint16_t*)_dst; \
1810 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1811 rgbf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1812 } \
1813
1814 32786 rgbaf16_funcs_endian(le, 0)
1815 rgbaf16_funcs_endian(be, 1)
1816
1817 39214 av_cold void ff_sws_init_input_funcs(SwsInternal *c,
1818 planar1_YV12_fn *lumToYV12,
1819 planar1_YV12_fn *alpToYV12,
1820 planar2_YV12_fn *chrToYV12,
1821 planarX_YV12_fn *readLumPlanar,
1822 planarX_YV12_fn *readAlpPlanar,
1823 planarX2_YV12_fn *readChrPlanar)
1824 {
1825 39214 enum AVPixelFormat srcFormat = c->opts.src_format;
1826
1827 39214 *chrToYV12 = NULL;
1828
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 23306 times.
39214 switch (srcFormat) {
1829 112 case AV_PIX_FMT_YUYV422:
1830 112 *chrToYV12 = yuy2ToUV_c;
1831 112 break;
1832 112 case AV_PIX_FMT_YVYU422:
1833 112 *chrToYV12 = yvy2ToUV_c;
1834 112 break;
1835 112 case AV_PIX_FMT_UYVY422:
1836 112 *chrToYV12 = uyvyToUV_c;
1837 112 break;
1838 case AV_PIX_FMT_UYYVYY411:
1839 *chrToYV12 = uyyvyyToUV_c;
1840 break;
1841 116 case AV_PIX_FMT_VYU444:
1842 116 *chrToYV12 = vyuToUV_c;
1843 116 break;
1844 1115 case AV_PIX_FMT_NV12:
1845 case AV_PIX_FMT_NV16:
1846 case AV_PIX_FMT_NV24:
1847 1115 *chrToYV12 = nv12ToUV_c;
1848 1115 break;
1849 2 case AV_PIX_FMT_NV21:
1850 case AV_PIX_FMT_NV42:
1851 2 *chrToYV12 = nv21ToUV_c;
1852 2 break;
1853 30 case AV_PIX_FMT_RGB8:
1854 case AV_PIX_FMT_BGR8:
1855 case AV_PIX_FMT_PAL8:
1856 case AV_PIX_FMT_BGR4_BYTE:
1857 case AV_PIX_FMT_RGB4_BYTE:
1858 30 *chrToYV12 = palToUV_c;
1859 30 break;
1860 158 case AV_PIX_FMT_GBRP9LE:
1861 158 *readChrPlanar = planar_rgb9le_to_uv;
1862 158 break;
1863 1338 case AV_PIX_FMT_GBRAP10LE:
1864 case AV_PIX_FMT_GBRP10LE:
1865 1338 *readChrPlanar = planar_rgb10le_to_uv;
1866 1338 break;
1867 1334 case AV_PIX_FMT_GBRAP12LE:
1868 case AV_PIX_FMT_GBRP12LE:
1869 1334 *readChrPlanar = planar_rgb12le_to_uv;
1870 1334 break;
1871 159 case AV_PIX_FMT_GBRAP14LE:
1872 case AV_PIX_FMT_GBRP14LE:
1873 159 *readChrPlanar = planar_rgb14le_to_uv;
1874 159 break;
1875 688 case AV_PIX_FMT_GBRAP16LE:
1876 case AV_PIX_FMT_GBRP16LE:
1877 688 *readChrPlanar = planar_rgb16le_to_uv;
1878 688 break;
1879 426 case AV_PIX_FMT_GBRAPF32LE:
1880 case AV_PIX_FMT_GBRPF32LE:
1881 426 *readChrPlanar = planar_rgbf32le_to_uv;
1882 426 break;
1883 384 case AV_PIX_FMT_GBRAPF16LE:
1884 case AV_PIX_FMT_GBRPF16LE:
1885 384 *readChrPlanar = planar_rgbf16le_to_uv;
1886 384 break;
1887 2 case AV_PIX_FMT_GBRP10MSBLE:
1888 2 *readChrPlanar = msb_planar_rgb10le_to_uv;
1889 2 break;
1890 2 case AV_PIX_FMT_GBRP12MSBLE:
1891 2 *readChrPlanar = msb_planar_rgb12le_to_uv;
1892 2 break;
1893 157 case AV_PIX_FMT_GBRP9BE:
1894 157 *readChrPlanar = planar_rgb9be_to_uv;
1895 157 break;
1896 482 case AV_PIX_FMT_GBRAP10BE:
1897 case AV_PIX_FMT_GBRP10BE:
1898 482 *readChrPlanar = planar_rgb10be_to_uv;
1899 482 break;
1900 482 case AV_PIX_FMT_GBRAP12BE:
1901 case AV_PIX_FMT_GBRP12BE:
1902 482 *readChrPlanar = planar_rgb12be_to_uv;
1903 482 break;
1904 158 case AV_PIX_FMT_GBRAP14BE:
1905 case AV_PIX_FMT_GBRP14BE:
1906 158 *readChrPlanar = planar_rgb14be_to_uv;
1907 158 break;
1908 532 case AV_PIX_FMT_GBRAP16BE:
1909 case AV_PIX_FMT_GBRP16BE:
1910 532 *readChrPlanar = planar_rgb16be_to_uv;
1911 532 break;
1912 392 case AV_PIX_FMT_GBRAPF32BE:
1913 case AV_PIX_FMT_GBRPF32BE:
1914 392 *readChrPlanar = planar_rgbf32be_to_uv;
1915 392 break;
1916 case AV_PIX_FMT_GBRAPF16BE:
1917 case AV_PIX_FMT_GBRPF16BE:
1918 *readChrPlanar = planar_rgbf16be_to_uv;
1919 break;
1920 1 case AV_PIX_FMT_GBRP10MSBBE:
1921 1 *readChrPlanar = msb_planar_rgb10be_to_uv;
1922 1 break;
1923 1 case AV_PIX_FMT_GBRP12MSBBE:
1924 1 *readChrPlanar = msb_planar_rgb12be_to_uv;
1925 1 break;
1926 1315 case AV_PIX_FMT_GBRAP:
1927 case AV_PIX_FMT_GBRP:
1928 1315 *readChrPlanar = planar_rgb_to_uv;
1929 1315 break;
1930 #if HAVE_BIGENDIAN
1931 case AV_PIX_FMT_YUV420P9LE:
1932 case AV_PIX_FMT_YUV422P9LE:
1933 case AV_PIX_FMT_YUV444P9LE:
1934 case AV_PIX_FMT_YUV420P10LE:
1935 case AV_PIX_FMT_YUV422P10LE:
1936 case AV_PIX_FMT_YUV440P10LE:
1937 case AV_PIX_FMT_YUV444P10LE:
1938 case AV_PIX_FMT_YUV420P12LE:
1939 case AV_PIX_FMT_YUV422P12LE:
1940 case AV_PIX_FMT_YUV440P12LE:
1941 case AV_PIX_FMT_YUV444P12LE:
1942 case AV_PIX_FMT_YUV420P14LE:
1943 case AV_PIX_FMT_YUV422P14LE:
1944 case AV_PIX_FMT_YUV444P14LE:
1945 case AV_PIX_FMT_YUV420P16LE:
1946 case AV_PIX_FMT_YUV422P16LE:
1947 case AV_PIX_FMT_YUV444P16LE:
1948
1949 case AV_PIX_FMT_YUVA420P9LE:
1950 case AV_PIX_FMT_YUVA422P9LE:
1951 case AV_PIX_FMT_YUVA444P9LE:
1952 case AV_PIX_FMT_YUVA420P10LE:
1953 case AV_PIX_FMT_YUVA422P10LE:
1954 case AV_PIX_FMT_YUVA444P10LE:
1955 case AV_PIX_FMT_YUVA422P12LE:
1956 case AV_PIX_FMT_YUVA444P12LE:
1957 case AV_PIX_FMT_YUVA420P16LE:
1958 case AV_PIX_FMT_YUVA422P16LE:
1959 case AV_PIX_FMT_YUVA444P16LE:
1960 *chrToYV12 = bswap16UV_c;
1961 break;
1962 #else
1963 1228 case AV_PIX_FMT_YUV420P9BE:
1964 case AV_PIX_FMT_YUV422P9BE:
1965 case AV_PIX_FMT_YUV444P9BE:
1966 case AV_PIX_FMT_YUV420P10BE:
1967 case AV_PIX_FMT_YUV422P10BE:
1968 case AV_PIX_FMT_YUV440P10BE:
1969 case AV_PIX_FMT_YUV444P10BE:
1970 case AV_PIX_FMT_YUV420P12BE:
1971 case AV_PIX_FMT_YUV422P12BE:
1972 case AV_PIX_FMT_YUV440P12BE:
1973 case AV_PIX_FMT_YUV444P12BE:
1974 case AV_PIX_FMT_YUV420P14BE:
1975 case AV_PIX_FMT_YUV422P14BE:
1976 case AV_PIX_FMT_YUV444P14BE:
1977 case AV_PIX_FMT_YUV420P16BE:
1978 case AV_PIX_FMT_YUV422P16BE:
1979 case AV_PIX_FMT_YUV444P16BE:
1980
1981 case AV_PIX_FMT_YUVA420P9BE:
1982 case AV_PIX_FMT_YUVA422P9BE:
1983 case AV_PIX_FMT_YUVA444P9BE:
1984 case AV_PIX_FMT_YUVA420P10BE:
1985 case AV_PIX_FMT_YUVA422P10BE:
1986 case AV_PIX_FMT_YUVA444P10BE:
1987 case AV_PIX_FMT_YUVA422P12BE:
1988 case AV_PIX_FMT_YUVA444P12BE:
1989 case AV_PIX_FMT_YUVA420P16BE:
1990 case AV_PIX_FMT_YUVA422P16BE:
1991 case AV_PIX_FMT_YUVA444P16BE:
1992 1228 *chrToYV12 = bswap16UV_c;
1993 1228 break;
1994 #endif
1995 2 case AV_PIX_FMT_YUV444P10MSBLE:
1996 2 *chrToYV12 = shf16_10LEToUV_c;
1997 2 break;
1998 2 case AV_PIX_FMT_YUV444P12MSBLE:
1999 2 *chrToYV12 = shf16_12LEToUV_c;
2000 2 break;
2001 1 case AV_PIX_FMT_YUV444P10MSBBE:
2002 1 *chrToYV12 = shf16_10BEToUV_c;
2003 1 break;
2004 1 case AV_PIX_FMT_YUV444P12MSBBE:
2005 1 *chrToYV12 = shf16_12BEToUV_c;
2006 1 break;
2007 113 case AV_PIX_FMT_VUYA:
2008 case AV_PIX_FMT_VUYX:
2009 113 *chrToYV12 = read_vuyx_UV_c;
2010 113 break;
2011 111 case AV_PIX_FMT_XV30LE:
2012 111 *chrToYV12 = read_xv30le_UV_c;
2013 111 break;
2014 125 case AV_PIX_FMT_V30XLE:
2015 125 *chrToYV12 = read_v30xle_UV_c;
2016 125 break;
2017 1 case AV_PIX_FMT_AYUV:
2018 1 *chrToYV12 = read_ayuv_UV_c;
2019 1 break;
2020 1 case AV_PIX_FMT_AYUV64LE:
2021 1 *chrToYV12 = read_ayuv64le_UV_c;
2022 1 break;
2023 1 case AV_PIX_FMT_AYUV64BE:
2024 1 *chrToYV12 = read_ayuv64be_UV_c;
2025 1 break;
2026 5 case AV_PIX_FMT_UYVA:
2027 5 *chrToYV12 = read_uyva_UV_c;
2028 5 break;
2029 111 case AV_PIX_FMT_XV36LE:
2030 111 *chrToYV12 = read_xv36le_UV_c;
2031 111 break;
2032 111 case AV_PIX_FMT_XV36BE:
2033 111 *chrToYV12 = read_xv36be_UV_c;
2034 111 break;
2035 141 case AV_PIX_FMT_XV48LE:
2036 141 *chrToYV12 = read_xv48le_UV_c;
2037 141 break;
2038 141 case AV_PIX_FMT_XV48BE:
2039 141 *chrToYV12 = read_xv48be_UV_c;
2040 141 break;
2041 1 case AV_PIX_FMT_NV20LE:
2042 1 *chrToYV12 = nv20LEToUV_c;
2043 1 break;
2044 1143 case AV_PIX_FMT_P010LE:
2045 case AV_PIX_FMT_P210LE:
2046 case AV_PIX_FMT_P410LE:
2047 1143 *chrToYV12 = p010LEToUV_c;
2048 1143 break;
2049 1 case AV_PIX_FMT_NV20BE:
2050 1 *chrToYV12 = nv20BEToUV_c;
2051 1 break;
2052 303 case AV_PIX_FMT_P010BE:
2053 case AV_PIX_FMT_P210BE:
2054 case AV_PIX_FMT_P410BE:
2055 303 *chrToYV12 = p010BEToUV_c;
2056 303 break;
2057 1143 case AV_PIX_FMT_P012LE:
2058 case AV_PIX_FMT_P212LE:
2059 case AV_PIX_FMT_P412LE:
2060 1143 *chrToYV12 = p012LEToUV_c;
2061 1143 break;
2062 303 case AV_PIX_FMT_P012BE:
2063 case AV_PIX_FMT_P212BE:
2064 case AV_PIX_FMT_P412BE:
2065 303 *chrToYV12 = p012BEToUV_c;
2066 303 break;
2067 563 case AV_PIX_FMT_P016LE:
2068 case AV_PIX_FMT_P216LE:
2069 case AV_PIX_FMT_P416LE:
2070 563 *chrToYV12 = p016LEToUV_c;
2071 563 break;
2072 383 case AV_PIX_FMT_P016BE:
2073 case AV_PIX_FMT_P216BE:
2074 case AV_PIX_FMT_P416BE:
2075 383 *chrToYV12 = p016BEToUV_c;
2076 383 break;
2077 111 case AV_PIX_FMT_Y210LE:
2078 111 *chrToYV12 = y210le_UV_c;
2079 111 break;
2080 111 case AV_PIX_FMT_Y212LE:
2081 111 *chrToYV12 = y212le_UV_c;
2082 111 break;
2083 141 case AV_PIX_FMT_Y216LE:
2084 141 *chrToYV12 = y216le_UV_c;
2085 141 break;
2086 case AV_PIX_FMT_RGBF32LE:
2087 *chrToYV12 = rgbf32le_to_uv_c;
2088 break;
2089 case AV_PIX_FMT_RGBF32BE:
2090 *chrToYV12 = rgbf32be_to_uv_c;
2091 break;
2092 }
2093
2/2
✓ Branch 0 taken 24017 times.
✓ Branch 1 taken 15197 times.
39214 if (c->chrSrcHSubSample) {
2094
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 21979 times.
24017 switch (srcFormat) {
2095 case AV_PIX_FMT_RGBA64BE:
2096 *chrToYV12 = rgb64BEToUV_half_c;
2097 break;
2098 case AV_PIX_FMT_RGBA64LE:
2099 *chrToYV12 = rgb64LEToUV_half_c;
2100 break;
2101 case AV_PIX_FMT_BGRA64BE:
2102 *chrToYV12 = bgr64BEToUV_half_c;
2103 break;
2104 case AV_PIX_FMT_BGRA64LE:
2105 *chrToYV12 = bgr64LEToUV_half_c;
2106 break;
2107 case AV_PIX_FMT_RGB48BE:
2108 *chrToYV12 = rgb48BEToUV_half_c;
2109 break;
2110 424 case AV_PIX_FMT_RGB48LE:
2111 424 *chrToYV12 = rgb48LEToUV_half_c;
2112 424 break;
2113 case AV_PIX_FMT_BGR48BE:
2114 *chrToYV12 = bgr48BEToUV_half_c;
2115 break;
2116 case AV_PIX_FMT_BGR48LE:
2117 *chrToYV12 = bgr48LEToUV_half_c;
2118 break;
2119 58 case AV_PIX_FMT_RGB32:
2120 58 *chrToYV12 = bgr32ToUV_half_c;
2121 58 break;
2122 26 case AV_PIX_FMT_RGB32_1:
2123 26 *chrToYV12 = bgr321ToUV_half_c;
2124 26 break;
2125 56 case AV_PIX_FMT_BGR24:
2126 56 *chrToYV12 = bgr24ToUV_half_c;
2127 56 break;
2128 1 case AV_PIX_FMT_BGR565LE:
2129 1 *chrToYV12 = bgr16leToUV_half_c;
2130 1 break;
2131 1 case AV_PIX_FMT_BGR565BE:
2132 1 *chrToYV12 = bgr16beToUV_half_c;
2133 1 break;
2134 1 case AV_PIX_FMT_BGR555LE:
2135 1 *chrToYV12 = bgr15leToUV_half_c;
2136 1 break;
2137 1 case AV_PIX_FMT_BGR555BE:
2138 1 *chrToYV12 = bgr15beToUV_half_c;
2139 1 break;
2140 811 case AV_PIX_FMT_GBRAP:
2141 case AV_PIX_FMT_GBRP:
2142 811 *chrToYV12 = gbr24pToUV_half_c;
2143 811 break;
2144 1 case AV_PIX_FMT_BGR444LE:
2145 1 *chrToYV12 = bgr12leToUV_half_c;
2146 1 break;
2147 1 case AV_PIX_FMT_BGR444BE:
2148 1 *chrToYV12 = bgr12beToUV_half_c;
2149 1 break;
2150 64 case AV_PIX_FMT_BGR32:
2151 64 *chrToYV12 = rgb32ToUV_half_c;
2152 64 break;
2153 36 case AV_PIX_FMT_BGR32_1:
2154 36 *chrToYV12 = rgb321ToUV_half_c;
2155 36 break;
2156 532 case AV_PIX_FMT_RGB24:
2157 532 *chrToYV12 = rgb24ToUV_half_c;
2158 532 break;
2159 5 case AV_PIX_FMT_RGB565LE:
2160 5 *chrToYV12 = rgb16leToUV_half_c;
2161 5 break;
2162 1 case AV_PIX_FMT_RGB565BE:
2163 1 *chrToYV12 = rgb16beToUV_half_c;
2164 1 break;
2165 16 case AV_PIX_FMT_RGB555LE:
2166 16 *chrToYV12 = rgb15leToUV_half_c;
2167 16 break;
2168 1 case AV_PIX_FMT_RGB555BE:
2169 1 *chrToYV12 = rgb15beToUV_half_c;
2170 1 break;
2171 1 case AV_PIX_FMT_RGB444LE:
2172 1 *chrToYV12 = rgb12leToUV_half_c;
2173 1 break;
2174 1 case AV_PIX_FMT_RGB444BE:
2175 1 *chrToYV12 = rgb12beToUV_half_c;
2176 1 break;
2177 case AV_PIX_FMT_X2RGB10LE:
2178 *chrToYV12 = rgb30leToUV_half_c;
2179 break;
2180 case AV_PIX_FMT_X2BGR10LE:
2181 *chrToYV12 = bgr30leToUV_half_c;
2182 break;
2183 case AV_PIX_FMT_RGBAF16BE:
2184 *chrToYV12 = rgbaf16beToUV_half_c;
2185 break;
2186 case AV_PIX_FMT_RGBAF16LE:
2187 *chrToYV12 = rgbaf16leToUV_half_c;
2188 break;
2189 case AV_PIX_FMT_RGBF16BE:
2190 *chrToYV12 = rgbf16beToUV_half_c;
2191 break;
2192 case AV_PIX_FMT_RGBF16LE:
2193 *chrToYV12 = rgbf16leToUV_half_c;
2194 break;
2195 }
2196 } else {
2197
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) {
2198 11 case AV_PIX_FMT_RGBA64BE:
2199 11 *chrToYV12 = rgb64BEToUV_c;
2200 11 break;
2201 2 case AV_PIX_FMT_RGBA64LE:
2202 2 *chrToYV12 = rgb64LEToUV_c;
2203 2 break;
2204 1 case AV_PIX_FMT_BGRA64BE:
2205 1 *chrToYV12 = bgr64BEToUV_c;
2206 1 break;
2207 2 case AV_PIX_FMT_BGRA64LE:
2208 2 *chrToYV12 = bgr64LEToUV_c;
2209 2 break;
2210 12 case AV_PIX_FMT_RGB48BE:
2211 12 *chrToYV12 = rgb48BEToUV_c;
2212 12 break;
2213 594 case AV_PIX_FMT_RGB48LE:
2214 594 *chrToYV12 = rgb48LEToUV_c;
2215 594 break;
2216 1 case AV_PIX_FMT_BGR48BE:
2217 1 *chrToYV12 = bgr48BEToUV_c;
2218 1 break;
2219 2 case AV_PIX_FMT_BGR48LE:
2220 2 *chrToYV12 = bgr48LEToUV_c;
2221 2 break;
2222 228 case AV_PIX_FMT_RGB32:
2223 228 *chrToYV12 = bgr32ToUV_c;
2224 228 break;
2225 30 case AV_PIX_FMT_RGB32_1:
2226 30 *chrToYV12 = bgr321ToUV_c;
2227 30 break;
2228 106 case AV_PIX_FMT_BGR24:
2229 106 *chrToYV12 = bgr24ToUV_c;
2230 106 break;
2231 case AV_PIX_FMT_BGR565LE:
2232 *chrToYV12 = bgr16leToUV_c;
2233 break;
2234 case AV_PIX_FMT_BGR565BE:
2235 *chrToYV12 = bgr16beToUV_c;
2236 break;
2237 case AV_PIX_FMT_BGR555LE:
2238 *chrToYV12 = bgr15leToUV_c;
2239 break;
2240 case AV_PIX_FMT_BGR555BE:
2241 *chrToYV12 = bgr15beToUV_c;
2242 break;
2243 case AV_PIX_FMT_BGR444LE:
2244 *chrToYV12 = bgr12leToUV_c;
2245 break;
2246 case AV_PIX_FMT_BGR444BE:
2247 *chrToYV12 = bgr12beToUV_c;
2248 break;
2249 50 case AV_PIX_FMT_BGR32:
2250 50 *chrToYV12 = rgb32ToUV_c;
2251 50 break;
2252 30 case AV_PIX_FMT_BGR32_1:
2253 30 *chrToYV12 = rgb321ToUV_c;
2254 30 break;
2255 607 case AV_PIX_FMT_RGB24:
2256 607 *chrToYV12 = rgb24ToUV_c;
2257 607 break;
2258 101 case AV_PIX_FMT_RGB565LE:
2259 101 *chrToYV12 = rgb16leToUV_c;
2260 101 break;
2261 case AV_PIX_FMT_RGB565BE:
2262 *chrToYV12 = rgb16beToUV_c;
2263 break;
2264 101 case AV_PIX_FMT_RGB555LE:
2265 101 *chrToYV12 = rgb15leToUV_c;
2266 101 break;
2267 case AV_PIX_FMT_RGB555BE:
2268 *chrToYV12 = rgb15beToUV_c;
2269 break;
2270 case AV_PIX_FMT_RGB444LE:
2271 *chrToYV12 = rgb12leToUV_c;
2272 break;
2273 case AV_PIX_FMT_RGB444BE:
2274 *chrToYV12 = rgb12beToUV_c;
2275 break;
2276 81 case AV_PIX_FMT_X2RGB10LE:
2277 81 *chrToYV12 = rgb30leToUV_c;
2278 81 break;
2279 81 case AV_PIX_FMT_X2BGR10LE:
2280 81 *chrToYV12 = bgr30leToUV_c;
2281 81 break;
2282 case AV_PIX_FMT_RGBAF16BE:
2283 *chrToYV12 = rgbaf16beToUV_c;
2284 break;
2285 case AV_PIX_FMT_RGBAF16LE:
2286 *chrToYV12 = rgbaf16leToUV_c;
2287 break;
2288 case AV_PIX_FMT_RGBF16BE:
2289 *chrToYV12 = rgbf16beToUV_c;
2290 break;
2291 case AV_PIX_FMT_RGBF16LE:
2292 *chrToYV12 = rgbf16leToUV_c;
2293 break;
2294 }
2295 }
2296
2297 39214 *lumToYV12 = NULL;
2298 39214 *alpToYV12 = NULL;
2299
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 21034 times.
39214 switch (srcFormat) {
2300 158 case AV_PIX_FMT_GBRP9LE:
2301 158 *readLumPlanar = planar_rgb9le_to_y;
2302 158 break;
2303 236 case AV_PIX_FMT_GBRAP10LE:
2304 236 *readAlpPlanar = planar_rgb10le_to_a;
2305 1338 case AV_PIX_FMT_GBRP10LE:
2306 1338 *readLumPlanar = planar_rgb10le_to_y;
2307 1338 break;
2308 236 case AV_PIX_FMT_GBRAP12LE:
2309 236 *readAlpPlanar = planar_rgb12le_to_a;
2310 1334 case AV_PIX_FMT_GBRP12LE:
2311 1334 *readLumPlanar = planar_rgb12le_to_y;
2312 1334 break;
2313 1 case AV_PIX_FMT_GBRAP14LE:
2314 1 *readAlpPlanar = planar_rgb14le_to_a;
2315 159 case AV_PIX_FMT_GBRP14LE:
2316 159 *readLumPlanar = planar_rgb14le_to_y;
2317 159 break;
2318 236 case AV_PIX_FMT_GBRAP16LE:
2319 236 *readAlpPlanar = planar_rgb16le_to_a;
2320 688 case AV_PIX_FMT_GBRP16LE:
2321 688 *readLumPlanar = planar_rgb16le_to_y;
2322 688 break;
2323 235 case AV_PIX_FMT_GBRAPF32LE:
2324 235 *readAlpPlanar = planar_rgbf32le_to_a;
2325 426 case AV_PIX_FMT_GBRPF32LE:
2326 426 *readLumPlanar = planar_rgbf32le_to_y;
2327 426 break;
2328 115 case AV_PIX_FMT_GBRAPF16LE:
2329 115 *readAlpPlanar = planar_rgbf16le_to_a;
2330 384 case AV_PIX_FMT_GBRPF16LE:
2331 384 *readLumPlanar = planar_rgbf16le_to_y;
2332 384 break;
2333 2 case AV_PIX_FMT_GBRP10MSBLE:
2334 2 *readLumPlanar = msb_planar_rgb10le_to_y;
2335 2 break;
2336 2 case AV_PIX_FMT_GBRP12MSBLE:
2337 2 *readLumPlanar = msb_planar_rgb12le_to_y;
2338 2 break;
2339 157 case AV_PIX_FMT_GBRP9BE:
2340 157 *readLumPlanar = planar_rgb9be_to_y;
2341 157 break;
2342 235 case AV_PIX_FMT_GBRAP10BE:
2343 235 *readAlpPlanar = planar_rgb10be_to_a;
2344 482 case AV_PIX_FMT_GBRP10BE:
2345 482 *readLumPlanar = planar_rgb10be_to_y;
2346 482 break;
2347 235 case AV_PIX_FMT_GBRAP12BE:
2348 235 *readAlpPlanar = planar_rgb12be_to_a;
2349 482 case AV_PIX_FMT_GBRP12BE:
2350 482 *readLumPlanar = planar_rgb12be_to_y;
2351 482 break;
2352 1 case AV_PIX_FMT_GBRAP14BE:
2353 1 *readAlpPlanar = planar_rgb14be_to_a;
2354 158 case AV_PIX_FMT_GBRP14BE:
2355 158 *readLumPlanar = planar_rgb14be_to_y;
2356 158 break;
2357 245 case AV_PIX_FMT_GBRAP16BE:
2358 245 *readAlpPlanar = planar_rgb16be_to_a;
2359 532 case AV_PIX_FMT_GBRP16BE:
2360 532 *readLumPlanar = planar_rgb16be_to_y;
2361 532 break;
2362 235 case AV_PIX_FMT_GBRAPF32BE:
2363 235 *readAlpPlanar = planar_rgbf32be_to_a;
2364 392 case AV_PIX_FMT_GBRPF32BE:
2365 392 *readLumPlanar = planar_rgbf32be_to_y;
2366 392 break;
2367 case AV_PIX_FMT_GBRAPF16BE:
2368 *readAlpPlanar = planar_rgbf16be_to_a;
2369 case AV_PIX_FMT_GBRPF16BE:
2370 *readLumPlanar = planar_rgbf16be_to_y;
2371 break;
2372 1 case AV_PIX_FMT_GBRP10MSBBE:
2373 1 *readLumPlanar = msb_planar_rgb10be_to_y;
2374 1 break;
2375 1 case AV_PIX_FMT_GBRP12MSBBE:
2376 1 *readLumPlanar = msb_planar_rgb12be_to_y;
2377 1 break;
2378 276 case AV_PIX_FMT_GBRAP:
2379 276 *readAlpPlanar = planar_rgb_to_a;
2380 1315 case AV_PIX_FMT_GBRP:
2381 1315 *readLumPlanar = planar_rgb_to_y;
2382 1315 break;
2383 #if HAVE_BIGENDIAN
2384 case AV_PIX_FMT_YUV420P9LE:
2385 case AV_PIX_FMT_YUV422P9LE:
2386 case AV_PIX_FMT_YUV444P9LE:
2387 case AV_PIX_FMT_YUV420P10LE:
2388 case AV_PIX_FMT_YUV422P10LE:
2389 case AV_PIX_FMT_YUV440P10LE:
2390 case AV_PIX_FMT_YUV444P10LE:
2391 case AV_PIX_FMT_YUV420P12LE:
2392 case AV_PIX_FMT_YUV422P12LE:
2393 case AV_PIX_FMT_YUV440P12LE:
2394 case AV_PIX_FMT_YUV444P12LE:
2395 case AV_PIX_FMT_YUV420P14LE:
2396 case AV_PIX_FMT_YUV422P14LE:
2397 case AV_PIX_FMT_YUV444P14LE:
2398 case AV_PIX_FMT_YUV420P16LE:
2399 case AV_PIX_FMT_YUV422P16LE:
2400 case AV_PIX_FMT_YUV444P16LE:
2401
2402 case AV_PIX_FMT_GRAY9LE:
2403 case AV_PIX_FMT_GRAY10LE:
2404 case AV_PIX_FMT_GRAY12LE:
2405 case AV_PIX_FMT_GRAY14LE:
2406 case AV_PIX_FMT_GRAY16LE:
2407
2408 case AV_PIX_FMT_P016LE:
2409 case AV_PIX_FMT_P216LE:
2410 case AV_PIX_FMT_P416LE:
2411 *lumToYV12 = bswap16Y_c;
2412 break;
2413 case AV_PIX_FMT_YUVA420P9LE:
2414 case AV_PIX_FMT_YUVA422P9LE:
2415 case AV_PIX_FMT_YUVA444P9LE:
2416 case AV_PIX_FMT_YUVA420P10LE:
2417 case AV_PIX_FMT_YUVA422P10LE:
2418 case AV_PIX_FMT_YUVA444P10LE:
2419 case AV_PIX_FMT_YUVA422P12LE:
2420 case AV_PIX_FMT_YUVA444P12LE:
2421 case AV_PIX_FMT_YUVA420P16LE:
2422 case AV_PIX_FMT_YUVA422P16LE:
2423 case AV_PIX_FMT_YUVA444P16LE:
2424 *lumToYV12 = bswap16Y_c;
2425 *alpToYV12 = bswap16Y_c;
2426 break;
2427 #else
2428 1985 case AV_PIX_FMT_YUV420P9BE:
2429 case AV_PIX_FMT_YUV422P9BE:
2430 case AV_PIX_FMT_YUV444P9BE:
2431 case AV_PIX_FMT_YUV420P10BE:
2432 case AV_PIX_FMT_YUV422P10BE:
2433 case AV_PIX_FMT_YUV440P10BE:
2434 case AV_PIX_FMT_YUV444P10BE:
2435 case AV_PIX_FMT_YUV420P12BE:
2436 case AV_PIX_FMT_YUV422P12BE:
2437 case AV_PIX_FMT_YUV440P12BE:
2438 case AV_PIX_FMT_YUV444P12BE:
2439 case AV_PIX_FMT_YUV420P14BE:
2440 case AV_PIX_FMT_YUV422P14BE:
2441 case AV_PIX_FMT_YUV444P14BE:
2442 case AV_PIX_FMT_YUV420P16BE:
2443 case AV_PIX_FMT_YUV422P16BE:
2444 case AV_PIX_FMT_YUV444P16BE:
2445
2446 case AV_PIX_FMT_GRAY9BE:
2447 case AV_PIX_FMT_GRAY10BE:
2448 case AV_PIX_FMT_GRAY12BE:
2449 case AV_PIX_FMT_GRAY14BE:
2450 case AV_PIX_FMT_GRAY16BE:
2451
2452 case AV_PIX_FMT_P016BE:
2453 case AV_PIX_FMT_P216BE:
2454 case AV_PIX_FMT_P416BE:
2455 1985 *lumToYV12 = bswap16Y_c;
2456 1985 break;
2457 11 case AV_PIX_FMT_YUVA420P9BE:
2458 case AV_PIX_FMT_YUVA422P9BE:
2459 case AV_PIX_FMT_YUVA444P9BE:
2460 case AV_PIX_FMT_YUVA420P10BE:
2461 case AV_PIX_FMT_YUVA422P10BE:
2462 case AV_PIX_FMT_YUVA444P10BE:
2463 case AV_PIX_FMT_YUVA422P12BE:
2464 case AV_PIX_FMT_YUVA444P12BE:
2465 case AV_PIX_FMT_YUVA420P16BE:
2466 case AV_PIX_FMT_YUVA422P16BE:
2467 case AV_PIX_FMT_YUVA444P16BE:
2468 11 *lumToYV12 = bswap16Y_c;
2469 11 *alpToYV12 = bswap16Y_c;
2470 11 break;
2471 #endif
2472 2 case AV_PIX_FMT_YUV444P10MSBLE:
2473 2 *lumToYV12 = shf16_10LEToY_c;
2474 2 break;
2475 2 case AV_PIX_FMT_YUV444P12MSBLE:
2476 2 *lumToYV12 = shf16_12LEToY_c;
2477 2 break;
2478 1 case AV_PIX_FMT_YUV444P10MSBBE:
2479 1 *lumToYV12 = shf16_10BEToY_c;
2480 1 break;
2481 1 case AV_PIX_FMT_YUV444P12MSBBE:
2482 1 *lumToYV12 = shf16_12BEToY_c;
2483 1 break;
2484 1 case AV_PIX_FMT_YA16LE:
2485 1 *lumToYV12 = read_ya16le_gray_c;
2486 1 break;
2487 21 case AV_PIX_FMT_YA16BE:
2488 21 *lumToYV12 = read_ya16be_gray_c;
2489 21 break;
2490 9 case AV_PIX_FMT_YAF16LE:
2491 9 *lumToYV12 = read_yaf16le_gray_c;
2492 9 break;
2493 case AV_PIX_FMT_YAF16BE:
2494 *lumToYV12 = read_yaf16be_gray_c;
2495 break;
2496 113 case AV_PIX_FMT_VUYA:
2497 case AV_PIX_FMT_VUYX:
2498 113 *lumToYV12 = read_vuyx_Y_c;
2499 113 break;
2500 111 case AV_PIX_FMT_XV30LE:
2501 111 *lumToYV12 = read_xv30le_Y_c;
2502 111 break;
2503 125 case AV_PIX_FMT_V30XLE:
2504 125 *lumToYV12 = read_v30xle_Y_c;
2505 125 break;
2506 6 case AV_PIX_FMT_AYUV:
2507 case AV_PIX_FMT_UYVA:
2508 6 *lumToYV12 = read_ayuv_Y_c;
2509 6 break;
2510 142 case AV_PIX_FMT_AYUV64LE:
2511 case AV_PIX_FMT_XV48LE:
2512 142 *lumToYV12 = read_ayuv64le_Y_c;
2513 142 break;
2514 142 case AV_PIX_FMT_AYUV64BE:
2515 case AV_PIX_FMT_XV48BE:
2516 142 *lumToYV12 = read_ayuv64be_Y_c;
2517 142 break;
2518 111 case AV_PIX_FMT_XV36LE:
2519 111 *lumToYV12 = read_xv36le_Y_c;
2520 111 break;
2521 111 case AV_PIX_FMT_XV36BE:
2522 111 *lumToYV12 = read_xv36be_Y_c;
2523 111 break;
2524 245 case AV_PIX_FMT_YUYV422:
2525 case AV_PIX_FMT_YVYU422:
2526 case AV_PIX_FMT_YA8:
2527 245 *lumToYV12 = yuy2ToY_c;
2528 245 break;
2529 112 case AV_PIX_FMT_UYVY422:
2530 112 *lumToYV12 = uyvyToY_c;
2531 112 break;
2532 case AV_PIX_FMT_UYYVYY411:
2533 *lumToYV12 = uyyvyyToY_c;
2534 break;
2535 116 case AV_PIX_FMT_VYU444:
2536 116 *lumToYV12 = vyuToY_c;
2537 116 break;
2538 162 case AV_PIX_FMT_BGR24:
2539 162 *lumToYV12 = bgr24ToY_c;
2540 162 break;
2541 1 case AV_PIX_FMT_BGR565LE:
2542 1 *lumToYV12 = bgr16leToY_c;
2543 1 break;
2544 1 case AV_PIX_FMT_BGR565BE:
2545 1 *lumToYV12 = bgr16beToY_c;
2546 1 break;
2547 1 case AV_PIX_FMT_BGR555LE:
2548 1 *lumToYV12 = bgr15leToY_c;
2549 1 break;
2550 1 case AV_PIX_FMT_BGR555BE:
2551 1 *lumToYV12 = bgr15beToY_c;
2552 1 break;
2553 1 case AV_PIX_FMT_BGR444LE:
2554 1 *lumToYV12 = bgr12leToY_c;
2555 1 break;
2556 1 case AV_PIX_FMT_BGR444BE:
2557 1 *lumToYV12 = bgr12beToY_c;
2558 1 break;
2559 1139 case AV_PIX_FMT_RGB24:
2560 1139 *lumToYV12 = rgb24ToY_c;
2561 1139 break;
2562 106 case AV_PIX_FMT_RGB565LE:
2563 106 *lumToYV12 = rgb16leToY_c;
2564 106 break;
2565 1 case AV_PIX_FMT_RGB565BE:
2566 1 *lumToYV12 = rgb16beToY_c;
2567 1 break;
2568 117 case AV_PIX_FMT_RGB555LE:
2569 117 *lumToYV12 = rgb15leToY_c;
2570 117 break;
2571 1 case AV_PIX_FMT_RGB555BE:
2572 1 *lumToYV12 = rgb15beToY_c;
2573 1 break;
2574 1 case AV_PIX_FMT_RGB444LE:
2575 1 *lumToYV12 = rgb12leToY_c;
2576 1 break;
2577 1 case AV_PIX_FMT_RGB444BE:
2578 1 *lumToYV12 = rgb12beToY_c;
2579 1 break;
2580 30 case AV_PIX_FMT_RGB8:
2581 case AV_PIX_FMT_BGR8:
2582 case AV_PIX_FMT_PAL8:
2583 case AV_PIX_FMT_BGR4_BYTE:
2584 case AV_PIX_FMT_RGB4_BYTE:
2585 30 *lumToYV12 = palToY_c;
2586 30 break;
2587 112 case AV_PIX_FMT_MONOBLACK:
2588 112 *lumToYV12 = monoblack2Y_c;
2589 112 break;
2590 116 case AV_PIX_FMT_MONOWHITE:
2591 116 *lumToYV12 = monowhite2Y_c;
2592 116 break;
2593 286 case AV_PIX_FMT_RGB32:
2594 286 *lumToYV12 = bgr32ToY_c;
2595 286 break;
2596 56 case AV_PIX_FMT_RGB32_1:
2597 56 *lumToYV12 = bgr321ToY_c;
2598 56 break;
2599 114 case AV_PIX_FMT_BGR32:
2600 114 *lumToYV12 = rgb32ToY_c;
2601 114 break;
2602 66 case AV_PIX_FMT_BGR32_1:
2603 66 *lumToYV12 = rgb321ToY_c;
2604 66 break;
2605 12 case AV_PIX_FMT_RGB48BE:
2606 12 *lumToYV12 = rgb48BEToY_c;
2607 12 break;
2608 1018 case AV_PIX_FMT_RGB48LE:
2609 1018 *lumToYV12 = rgb48LEToY_c;
2610 1018 break;
2611 1 case AV_PIX_FMT_BGR48BE:
2612 1 *lumToYV12 = bgr48BEToY_c;
2613 1 break;
2614 2 case AV_PIX_FMT_BGR48LE:
2615 2 *lumToYV12 = bgr48LEToY_c;
2616 2 break;
2617 11 case AV_PIX_FMT_RGBA64BE:
2618 11 *lumToYV12 = rgb64BEToY_c;
2619 11 break;
2620 2 case AV_PIX_FMT_RGBA64LE:
2621 2 *lumToYV12 = rgb64LEToY_c;
2622 2 break;
2623 1 case AV_PIX_FMT_BGRA64BE:
2624 1 *lumToYV12 = bgr64BEToY_c;
2625 1 break;
2626 2 case AV_PIX_FMT_BGRA64LE:
2627 2 *lumToYV12 = bgr64LEToY_c;
2628 2 break;
2629 1 case AV_PIX_FMT_NV20LE:
2630 1 *lumToYV12 = nv20LEToY_c;
2631 1 break;
2632 1143 case AV_PIX_FMT_P010LE:
2633 case AV_PIX_FMT_P210LE:
2634 case AV_PIX_FMT_P410LE:
2635 1143 *lumToYV12 = p010LEToY_c;
2636 1143 break;
2637 1 case AV_PIX_FMT_NV20BE:
2638 1 *lumToYV12 = nv20BEToY_c;
2639 1 break;
2640 303 case AV_PIX_FMT_P010BE:
2641 case AV_PIX_FMT_P210BE:
2642 case AV_PIX_FMT_P410BE:
2643 303 *lumToYV12 = p010BEToY_c;
2644 303 break;
2645 1143 case AV_PIX_FMT_P012LE:
2646 case AV_PIX_FMT_P212LE:
2647 case AV_PIX_FMT_P412LE:
2648 1143 *lumToYV12 = p012LEToY_c;
2649 1143 break;
2650 303 case AV_PIX_FMT_P012BE:
2651 case AV_PIX_FMT_P212BE:
2652 case AV_PIX_FMT_P412BE:
2653 303 *lumToYV12 = p012BEToY_c;
2654 303 break;
2655 1 case AV_PIX_FMT_GRAYF32LE:
2656 1 *lumToYV12 = grayf32leToY16_c;
2657 1 break;
2658 1 case AV_PIX_FMT_GRAYF32BE:
2659 1 *lumToYV12 = grayf32beToY16_c;
2660 1 break;
2661 case AV_PIX_FMT_YAF32LE:
2662 *lumToYV12 = read_yaf32le_gray_c;
2663 break;
2664 case AV_PIX_FMT_YAF32BE:
2665 *lumToYV12 = read_yaf32be_gray_c;
2666 break;
2667 18 case AV_PIX_FMT_GRAYF16LE:
2668 18 *lumToYV12 = grayf16leToY16_c;
2669 18 break;
2670 case AV_PIX_FMT_GRAYF16BE:
2671 *lumToYV12 = grayf16beToY16_c;
2672 break;
2673 111 case AV_PIX_FMT_Y210LE:
2674 111 *lumToYV12 = y210le_Y_c;
2675 111 break;
2676 111 case AV_PIX_FMT_Y212LE:
2677 111 *lumToYV12 = y212le_Y_c;
2678 111 break;
2679 141 case AV_PIX_FMT_Y216LE:
2680 141 *lumToYV12 = y216le_Y_c;
2681 141 break;
2682 81 case AV_PIX_FMT_X2RGB10LE:
2683 81 *lumToYV12 = rgb30leToY_c;
2684 81 break;
2685 81 case AV_PIX_FMT_X2BGR10LE:
2686 81 *lumToYV12 = bgr30leToY_c;
2687 81 break;
2688 case AV_PIX_FMT_RGBAF16BE:
2689 *lumToYV12 = rgbaf16beToY_c;
2690 break;
2691 case AV_PIX_FMT_RGBAF16LE:
2692 *lumToYV12 = rgbaf16leToY_c;
2693 break;
2694 case AV_PIX_FMT_RGBF16BE:
2695 *lumToYV12 = rgbf16beToY_c;
2696 break;
2697 case AV_PIX_FMT_RGBF16LE:
2698 *lumToYV12 = rgbf16leToY_c;
2699 break;
2700 case AV_PIX_FMT_RGBF32LE:
2701 *lumToYV12 = rgbf32le_to_y_c;
2702 break;
2703 case AV_PIX_FMT_RGBF32BE:
2704 *lumToYV12 = rgbf32be_to_y_c;
2705 break;
2706 }
2707
2/2
✓ Branch 0 taken 358 times.
✓ Branch 1 taken 38856 times.
39214 if (c->needAlpha) {
2708
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)) {
2709
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)
2710 15 *alpToYV12 = bswap16Y_c;
2711 }
2712
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) {
2713 2 case AV_PIX_FMT_BGRA64LE:
2714 2 case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2715 2 case AV_PIX_FMT_BGRA64BE:
2716 2 case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2717 162 case AV_PIX_FMT_BGRA:
2718 case AV_PIX_FMT_RGBA:
2719 162 *alpToYV12 = rgbaToA_c;
2720 162 break;
2721 14 case AV_PIX_FMT_ABGR:
2722 case AV_PIX_FMT_ARGB:
2723 14 *alpToYV12 = abgrToA_c;
2724 14 break;
2725 case AV_PIX_FMT_RGBAF16BE:
2726 *alpToYV12 = rgbaf16beToA_c;
2727 break;
2728 case AV_PIX_FMT_RGBAF16LE:
2729 *alpToYV12 = rgbaf16leToA_c;
2730 break;
2731 1 case AV_PIX_FMT_YA8:
2732 1 *alpToYV12 = uyvyToY_c;
2733 1 break;
2734 1 case AV_PIX_FMT_YA16LE:
2735 1 *alpToYV12 = read_ya16le_alpha_c;
2736 1 break;
2737 1 case AV_PIX_FMT_YA16BE:
2738 1 *alpToYV12 = read_ya16be_alpha_c;
2739 1 break;
2740 9 case AV_PIX_FMT_YAF16LE:
2741 9 *alpToYV12 = read_yaf16le_alpha_c;
2742 9 break;
2743 case AV_PIX_FMT_YAF16BE:
2744 *alpToYV12 = read_yaf16be_alpha_c;
2745 break;
2746 case AV_PIX_FMT_YAF32LE:
2747 *alpToYV12 = read_yaf32le_alpha_c;
2748 break;
2749 case AV_PIX_FMT_YAF32BE:
2750 *alpToYV12 = read_yaf32be_alpha_c;
2751 break;
2752 2 case AV_PIX_FMT_VUYA:
2753 case AV_PIX_FMT_UYVA:
2754 2 *alpToYV12 = read_vuya_A_c;
2755 2 break;
2756 1 case AV_PIX_FMT_AYUV:
2757 1 *alpToYV12 = read_ayuv_A_c;
2758 1 break;
2759 1 case AV_PIX_FMT_AYUV64LE:
2760 1 *alpToYV12 = read_ayuv64le_A_c;
2761 1 break;
2762 1 case AV_PIX_FMT_AYUV64BE:
2763 1 *alpToYV12 = read_ayuv64be_A_c;
2764 1 break;
2765 case AV_PIX_FMT_PAL8 :
2766 *alpToYV12 = palToA_c;
2767 break;
2768 }
2769 }
2770 39214 }
2771