FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2026-10-07 23:37:25
Exec Total Coverage
Lines: 1168 1436 81.3%
Functions: 232 287 80.8%
Branches: 628 886 70.9%

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