FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2026-10-29 01:33:44
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 385415 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
47 enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
48 {
49 385415 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
50 int i;
51
2/2
✓ Branch 0 taken 37589888 times.
✓ Branch 1 taken 385415 times.
37975303 for (i = 0; i < width; i++) {
52
2/2
✓ Branch 0 taken 18994048 times.
✓ Branch 1 taken 18595840 times.
37589888 unsigned int r_b = input_pixel(&src[i*4+0]);
53
2/2
✓ Branch 0 taken 18994048 times.
✓ Branch 1 taken 18595840 times.
37589888 unsigned int g = input_pixel(&src[i*4+1]);
54
2/2
✓ Branch 0 taken 18994048 times.
✓ Branch 1 taken 18595840 times.
37589888 unsigned int b_r = input_pixel(&src[i*4+2]);
55
56
12/16
✓ Branch 0 taken 37589888 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37589888 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 27611008 times.
✓ Branch 5 taken 9978880 times.
✓ Branch 6 taken 9146368 times.
✓ Branch 7 taken 18464640 times.
✓ Branch 8 taken 37589888 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 37589888 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 27611008 times.
✓ Branch 13 taken 9978880 times.
✓ Branch 14 taken 9146368 times.
✓ Branch 15 taken 18464640 times.
37589888 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
57 }
58 385415 }
59
60 static av_always_inline void
61 385415 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 385415 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
67 385415 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 37589888 times.
✓ Branch 1 taken 385415 times.
37975303 for (i = 0; i < width; i++) {
70
2/2
✓ Branch 0 taken 18994048 times.
✓ Branch 1 taken 18595840 times.
37589888 unsigned int r_b = input_pixel(&src1[i*4+0]);
71
2/2
✓ Branch 0 taken 18994048 times.
✓ Branch 1 taken 18595840 times.
37589888 unsigned int g = input_pixel(&src1[i*4+1]);
72
2/2
✓ Branch 0 taken 18994048 times.
✓ Branch 1 taken 18595840 times.
37589888 unsigned int b_r = input_pixel(&src1[i*4+2]);
73
74
12/16
✓ Branch 0 taken 37589888 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37589888 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 27611008 times.
✓ Branch 5 taken 9978880 times.
✓ Branch 6 taken 9146368 times.
✓ Branch 7 taken 18464640 times.
✓ Branch 8 taken 37589888 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 37589888 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 27611008 times.
✓ Branch 13 taken 9978880 times.
✓ Branch 14 taken 9146368 times.
✓ Branch 15 taken 18464640 times.
37589888 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
75
12/16
✓ Branch 0 taken 37589888 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37589888 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 27611008 times.
✓ Branch 5 taken 9978880 times.
✓ Branch 6 taken 9146368 times.
✓ Branch 7 taken 18464640 times.
✓ Branch 8 taken 37589888 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 37589888 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 27611008 times.
✓ Branch 13 taken 9978880 times.
✓ Branch 14 taken 9146368 times.
✓ Branch 15 taken 18464640 times.
37589888 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
76 }
77 385415 }
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 385792 RGB64FUNCS(rgb, LE, AV_PIX_FMT_RGBA64)
130 380828 RGB64FUNCS(rgb, BE, AV_PIX_FMT_RGBA64)
131 370176 RGB64FUNCS(bgr, LE, AV_PIX_FMT_BGRA64)
132 404864 RGB64FUNCS(bgr, BE, AV_PIX_FMT_BGRA64)
133
134 1297377 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 1297377 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
140 int i;
141
2/2
✓ Branch 0 taken 360439688 times.
✓ Branch 1 taken 1297377 times.
361737065 for (i = 0; i < width; i++) {
142
2/2
✓ Branch 0 taken 17786752 times.
✓ Branch 1 taken 342652936 times.
360439688 unsigned int r_b = input_pixel(&src[i * 3 + 0]);
143
2/2
✓ Branch 0 taken 17786752 times.
✓ Branch 1 taken 342652936 times.
360439688 unsigned int g = input_pixel(&src[i * 3 + 1]);
144
2/2
✓ Branch 0 taken 17786752 times.
✓ Branch 1 taken 342652936 times.
360439688 unsigned int b_r = input_pixel(&src[i * 3 + 2]);
145
146
12/16
✓ Branch 0 taken 351589256 times.
✓ Branch 1 taken 8850432 times.
✓ Branch 2 taken 341330824 times.
✓ Branch 3 taken 10258432 times.
✓ Branch 4 taken 341330824 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 341330824 times.
✓ Branch 8 taken 351589256 times.
✓ Branch 9 taken 8850432 times.
✓ Branch 10 taken 341330824 times.
✓ Branch 11 taken 10258432 times.
✓ Branch 12 taken 341330824 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 341330824 times.
360439688 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
147 }
148 1297377 }
149
150 904701 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 904701 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
160 904701 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 222758336 times.
✓ Branch 1 taken 904701 times.
223663037 for (i = 0; i < width; i++) {
163
2/2
✓ Branch 0 taken 17786752 times.
✓ Branch 1 taken 204971584 times.
222758336 unsigned r_b = input_pixel(&src1[i * 3 + 0]);
164
2/2
✓ Branch 0 taken 17786752 times.
✓ Branch 1 taken 204971584 times.
222758336 unsigned g = input_pixel(&src1[i * 3 + 1]);
165
2/2
✓ Branch 0 taken 17786752 times.
✓ Branch 1 taken 204971584 times.
222758336 unsigned b_r = input_pixel(&src1[i * 3 + 2]);
166
167
12/16
✓ Branch 0 taken 213907904 times.
✓ Branch 1 taken 8850432 times.
✓ Branch 2 taken 203649472 times.
✓ Branch 3 taken 10258432 times.
✓ Branch 4 taken 203649472 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 203649472 times.
✓ Branch 8 taken 213907904 times.
✓ Branch 9 taken 8850432 times.
✓ Branch 10 taken 203649472 times.
✓ Branch 11 taken 10258432 times.
✓ Branch 12 taken 203649472 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 203649472 times.
222758336 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
168
12/16
✓ Branch 0 taken 213907904 times.
✓ Branch 1 taken 8850432 times.
✓ Branch 2 taken 203649472 times.
✓ Branch 3 taken 10258432 times.
✓ Branch 4 taken 203649472 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 203649472 times.
✓ Branch 8 taken 213907904 times.
✓ Branch 9 taken 8850432 times.
✓ Branch 10 taken 203649472 times.
✓ Branch 11 taken 10258432 times.
✓ Branch 12 taken 203649472 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 203649472 times.
222758336 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
169 }
170 904701 }
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 4084272 RGB48FUNCS(rgb, LE, AV_PIX_FMT_RGB48)
249 354332 RGB48FUNCS(rgb, BE, AV_PIX_FMT_RGB48)
250 407808 RGB48FUNCS(bgr, LE, AV_PIX_FMT_BGR48)
251 361088 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 2335506 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 2335506 const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
276 2335506 const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
277 int i;
278
279
2/2
✓ Branch 0 taken 501735729 times.
✓ Branch 1 taken 2335506 times.
504071235 for (i = 0; i < width; i++) {
280
14/14
✓ Branch 0 taken 304496800 times.
✓ Branch 1 taken 197238929 times.
✓ Branch 2 taken 303969504 times.
✓ Branch 3 taken 527296 times.
✓ Branch 4 taken 303551456 times.
✓ Branch 5 taken 418048 times.
✓ Branch 6 taken 492480 times.
✓ Branch 7 taken 303058976 times.
✓ Branch 8 taken 275007008 times.
✓ Branch 9 taken 28051968 times.
✓ Branch 10 taken 28660224 times.
✓ Branch 11 taken 246346784 times.
✓ Branch 12 taken 55927808 times.
✓ Branch 13 taken 190418976 times.
501735729 int px = input_pixel(i) >> shp;
281 501735729 int b = (px & maskb) >> shb;
282 501735729 int g = (px & maskg) >> shg;
283 501735729 int r = (px & maskr) >> shr;
284
285 501735729 dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
286 }
287 2335506 }
288
289 1881152 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 1881152 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
302 1881152 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
303 1881152 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
304 int i;
305
306
2/2
✓ Branch 0 taken 312989193 times.
✓ Branch 1 taken 1881152 times.
314870345 for (i = 0; i < width; i++) {
307
14/14
✓ Branch 0 taken 225645184 times.
✓ Branch 1 taken 87344009 times.
✓ Branch 2 taken 225195712 times.
✓ Branch 3 taken 449472 times.
✓ Branch 4 taken 224777664 times.
✓ Branch 5 taken 418048 times.
✓ Branch 6 taken 414912 times.
✓ Branch 7 taken 224362752 times.
✓ Branch 8 taken 196310784 times.
✓ Branch 9 taken 28051968 times.
✓ Branch 10 taken 28660224 times.
✓ Branch 11 taken 167650560 times.
✓ Branch 12 taken 54711296 times.
✓ Branch 13 taken 112939264 times.
312989193 int px = input_pixel(i) >> shp;
308 312989193 int b = (px & maskb) >> shb;
309 312989193 int g = (px & maskg) >> shg;
310 312989193 int r = (px & maskr) >> shr;
311
312 312989193 dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
313 312989193 dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
314 }
315 1881152 }
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 384896 RGB16_32FUNCS(AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
400 393472 RGB16_32FUNCS(AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
401 410752 RGB16_32FUNCS(AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
402 884352 RGB16_32FUNCS(AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
403 1414304 RGB16_32FUNCS(AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
404 371456 RGB16_32FUNCS(AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
405 368000 RGB16_32FUNCS(AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
406 371712 RGB16_32FUNCS(AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
407 364160 RGB16_32FUNCS(AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
408 414720 RGB16_32FUNCS(AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
409 406272 RGB16_32FUNCS(AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
410 383744 RGB16_32FUNCS(AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
411 457664 RGB16_32FUNCS(AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
412 477888 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 188800 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 188800 int16_t *dst = (int16_t *)_dst;
438 188800 const uint16_t *src = (const uint16_t *)_src;
439 int i;
440
2/2
✓ Branch 0 taken 18577408 times.
✓ Branch 1 taken 188800 times.
18766208 for (i = 0; i < width; i++)
441 18577408 dst[i] = AV_RL16(src + 4 * i + 3);
442 188800 }
443
444 196288 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 196288 int16_t *dst = (int16_t *)_dst;
448 196288 const uint16_t *src = (const uint16_t *)_src;
449 int i;
450
2/2
✓ Branch 0 taken 18976768 times.
✓ Branch 1 taken 196288 times.
19173056 for (i = 0; i < width; i++)
451 18976768 dst[i] = AV_RB16(src + 4 * i + 3);
452 196288 }
453
454 387055 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 387055 int16_t *dst = (int16_t *)_dst;
458 int i;
459
2/2
✓ Branch 0 taken 37583616 times.
✓ Branch 1 taken 387055 times.
37970671 for (i=0; i<width; i++) {
460 37583616 dst[i]= src[4*i]<<6 | src[4*i]>>2;
461 }
462 387055 }
463
464 473146 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 473146 int16_t *dst = (int16_t *)_dst;
468 int i;
469
2/2
✓ Branch 0 taken 104431880 times.
✓ Branch 1 taken 473146 times.
104905026 for (i=0; i<width; i++) {
470 104431880 dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
471 }
472 473146 }
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 578535 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 578535 int16_t *dst = (int16_t *)_dst;
490 int i;
491
2/2
✓ Branch 0 taken 101544728 times.
✓ Branch 1 taken 578535 times.
102123263 for (i = 0; i < width; i++) {
492 101544728 int d = src[i];
493
494 101544728 dst[i] = (pal[d] & 0xFF)<<6;
495 }
496 578535 }
497
498 578535 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 578535 uint16_t *dstU = (uint16_t *)_dstU;
503 578535 int16_t *dstV = (int16_t *)_dstV;
504 int i;
505 av_assert1(src1 == src2);
506
2/2
✓ Branch 0 taken 101544728 times.
✓ Branch 1 taken 578535 times.
102123263 for (i = 0; i < width; i++) {
507 101544728 int p = pal[src1[i]];
508
509 101544728 dstU[i] = (uint8_t)(p>> 8)<<6;
510 101544728 dstV[i] = (uint8_t)(p>>16)<<6;
511 }
512 578535 }
513
514 198008 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 198008 int16_t *dst = (int16_t *)_dst;
518 int i, j;
519 198008 width = (width + 7) >> 3;
520
2/2
✓ Branch 0 taken 5257820 times.
✓ Branch 1 taken 198008 times.
5455828 for (i = 0; i < width; i++) {
521 5257820 int d = ~src[i];
522
2/2
✓ Branch 0 taken 42062560 times.
✓ Branch 1 taken 5257820 times.
47320380 for (j = 0; j < 8; j++)
523 42062560 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
524 }
525
2/2
✓ Branch 0 taken 151960 times.
✓ Branch 1 taken 46048 times.
198008 if(width&7){
526 151960 int d= ~src[i];
527
2/2
✓ Branch 0 taken 630540 times.
✓ Branch 1 taken 151960 times.
782500 for (j = 0; j < (width&7); j++)
528 630540 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
529 }
530 198008 }
531
532 195106 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 195106 int16_t *dst = (int16_t *)_dst;
536 int i, j;
537 195106 width = (width + 7) >> 3;
538
2/2
✓ Branch 0 taken 5271256 times.
✓ Branch 1 taken 195106 times.
5466362 for (i = 0; i < width; i++) {
539 5271256 int d = src[i];
540
2/2
✓ Branch 0 taken 42170048 times.
✓ Branch 1 taken 5271256 times.
47441304 for (j = 0; j < 8; j++)
541 42170048 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
542 }
543
2/2
✓ Branch 0 taken 144866 times.
✓ Branch 1 taken 50240 times.
195106 if(width&7){
544 144866 int d = src[i];
545
2/2
✓ Branch 0 taken 579464 times.
✓ Branch 1 taken 144866 times.
724330 for (j = 0; j < (width&7); j++)
546 579464 dst[8*i+j] = ((d>>(7-j))&1) * 16383;
547 }
548 195106 }
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 2850497 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 2850497 const uint16_t *src = (const uint16_t *)_src;
613 2850497 uint16_t *dst = (uint16_t *)_dst;
614
2/2
✓ Branch 0 taken 697251584 times.
✓ Branch 1 taken 2850497 times.
700102081 for (i = 0; i < width; i++)
615 697251584 dst[i] = av_bswap16(src[i]);
616 2850497 }
617
618 1310292 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 1310292 const uint16_t *src1 = (const uint16_t *)_src1,
623 1310292 *src2 = (const uint16_t *)_src2;
624 1310292 uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
625
2/2
✓ Branch 0 taken 246734592 times.
✓ Branch 1 taken 1310292 times.
248044884 for (i = 0; i < width; i++) {
626 246734592 dstU[i] = av_bswap16(src1[i]);
627 246734592 dstV[i] = av_bswap16(src2[i]);
628 }
629 1310292 }
630
631 92352 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 8975360 times.
✓ Branch 1 taken 92352 times.
9067712 for (i = 0; i < width; i++)
636 8975360 AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
637 92352 }
638
639 92352 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 8975360 times.
✓ Branch 1 taken 92352 times.
9067712 for (i = 0; i < width; i++)
644 8975360 AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
645 92352 }
646
647 95239 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 9169792 times.
✓ Branch 1 taken 95239 times.
9265031 for (i = 0; i < width; i++)
652 9169792 AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
653 95239 }
654
655 95104 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 9152512 times.
✓ Branch 1 taken 95104 times.
9247616 for (i = 0; i < width; i++)
660 9152512 AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
661 95104 }
662
663 287828 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 57427840 times.
✓ Branch 1 taken 287828 times.
57715668 for (i = 0; i < width; i++)
668 57427840 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
669 287828 }
670
671 315092 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 60296064 times.
✓ Branch 1 taken 315092 times.
60611156 for (i = 0; i < width; i++)
676 60296064 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2));
677 315092 }
678
679 287828 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 57427840 times.
✓ Branch 1 taken 287828 times.
57715668 for (i = 0; i < width; i++) {
684 57427840 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + u_offset));
685 57427840 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + v_offset));
686 }
687 287828 }
688
689 315092 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 60296064 times.
✓ Branch 1 taken 315092 times.
60611156 for (i = 0; i < width; i++) {
694 60296064 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + u_offset));
695 60296064 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + v_offset));
696 }
697 315092 }
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 394176 ayuv64_UV_funcs(ayuv64, 4, 6)
713 811664 ayuv64_UV_funcs(xv48, 0, 4)
714
715 92448 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 8863744 times.
✓ Branch 1 taken 92448 times.
8956192 for (i = 0; i < width; i++)
720 8863744 AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
721 92448 }
722
723 104640 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 10390528 times.
✓ Branch 1 taken 104640 times.
10495168 for (i = 0; i < width; i++)
728 10390528 AV_WN16(dst + i * 2, AV_RB16(src + i * 8));
729 104640 }
730
731 292002 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 51790528 times.
✓ Branch 1 taken 292002 times.
52082530 for (i = 0; i < width; i++) {
736 51790528 dstU[i] = src[i * 4 + 1];
737 51790528 dstV[i] = src[i * 4];
738 }
739 292002 }
740
741 292002 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 51790528 times.
✓ Branch 1 taken 292002 times.
52082530 for (i = 0; i < width; i++)
746 51790528 dst[i] = src[i * 4 + 2];
747 292002 }
748
749 202656 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 19947520 times.
✓ Branch 1 taken 202656 times.
20150176 for (i = 0; i < width; i++)
754 19947520 dst[i] = src[i * 4 + 3];
755 202656 }
756
757 103872 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 10095616 times.
✓ Branch 1 taken 103872 times.
10199488 for (i = 0; i < width; i++) {
762 10095616 dstU[i] = src[i * 4 + 2];
763 10095616 dstV[i] = src[i * 4 + 3];
764 }
765 103872 }
766
767 249764 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 35389896 times.
✓ Branch 1 taken 249764 times.
35639660 for (i = 0; i < width; i++)
772 35389896 dst[i] = src[i * 4 + 1];
773 249764 }
774
775 103872 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 10095616 times.
✓ Branch 1 taken 103872 times.
10199488 for (i = 0; i < width; i++)
780 10095616 dst[i] = src[i * 4];
781 103872 }
782
783 123442 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 17662180 times.
✓ Branch 1 taken 123442 times.
17785622 for (i = 0; i < width; i++) {
788 17662180 dstU[i] = src[i * 4];
789 17662180 dstV[i] = src[i * 4 + 2];
790 }
791 123442 }
792
793 231014 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 56614024 times.
✓ Branch 1 taken 231014 times.
56845038 for (i = 0; i < width; i++)
798 56614024 dst[i] = src[i * 3 + 1];
799 231014 }
800
801 208564 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 48981924 times.
✓ Branch 1 taken 208564 times.
49190488 for (i = 0; i < width; i++) {
806 48981924 dstU[i] = src[i * 3 + 2];
807 48981924 dstV[i] = src[i * 3];
808 }
809 208564 }
810
811 188949 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 52669320 times.
✓ Branch 1 taken 188949 times.
52858269 for (i = 0; i < width; i++)
816 52669320 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
817 188949 }
818
819
820 166499 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 45037220 times.
✓ Branch 1 taken 166499 times.
45203719 for (i = 0; i < width; i++) {
825 45037220 unsigned int uv = AV_RL32(src + i * 4);
826 45037220 AV_WN16(dstU + i * 2, (uv >> 2) & 0x3FFu);
827 45037220 AV_WN16(dstV + i * 2, (uv >> 22) & 0x3FFu);
828 }
829 166499 }
830
831 141954 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 37139136 times.
✓ Branch 1 taken 141954 times.
37281090 for (i = 0; i < width; i++)
836 37139136 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
837 141954 }
838
839
840 141954 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 37139136 times.
✓ Branch 1 taken 141954 times.
37281090 for (i = 0; i < width; i++) {
845 37139136 AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
846 37139136 AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
847 }
848 141954 }
849
850 193410 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 42169024 times.
✓ Branch 1 taken 193410 times.
42362434 for (i = 0; i < width; i++)
855 42169024 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
856 193410 }
857
858
859 193410 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 42169024 times.
✓ Branch 1 taken 193410 times.
42362434 for (i = 0; i < width; i++) {
864 42169024 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
865 42169024 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
866 }
867 193410 }
868
869 183650 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 41222848 times.
✓ Branch 1 taken 183650 times.
41406498 for (i = 0; i < width; i++)
874 41222848 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2) >> 4);
875 183650 }
876
877
878 183650 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 41222848 times.
✓ Branch 1 taken 183650 times.
41406498 for (i = 0; i < width; i++) {
883 41222848 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + 0) >> 4);
884 41222848 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + 4) >> 4);
885 }
886 183650 }
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 120238080 times.
✓ Branch 1 taken 532608 times.
241541376 shf16_wrapper(10)
1066
2/2
✓ Branch 0 taken 120852480 times.
✓ Branch 1 taken 547712 times.
242800384 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 4054264 times.
✓ Branch 1 taken 755766 times.
✓ Branch 2 taken 197634880 times.
✓ Branch 3 taken 1397773052 times.
✓ Branch 4 taken 203842944 times.
✓ Branch 5 taken 1391692428 times.
✓ Branch 6 taken 190859520 times.
✓ Branch 7 taken 1391564988 times.
✓ Branch 8 taken 1582424508 times.
✓ Branch 9 taken 4682590 times.
3200435924 shifted_planar_rgb16(16)
1282
9/10
✓ Branch 0 taken 426880 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21839872 times.
✓ Branch 3 taken 19421184 times.
✓ Branch 4 taken 21839872 times.
✓ Branch 5 taken 19421184 times.
✓ Branch 6 taken 21839872 times.
✓ Branch 7 taken 19421184 times.
✓ Branch 8 taken 41261056 times.
✓ Branch 9 taken 426880 times.
83375872 shifted_planar_rgb16_to_y_uv(12)
1283
9/10
✓ Branch 0 taken 377408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18255872 times.
✓ Branch 3 taken 18679808 times.
✓ Branch 4 taken 18255872 times.
✓ Branch 5 taken 18679808 times.
✓ Branch 6 taken 18255872 times.
✓ Branch 7 taken 18679808 times.
✓ Branch 8 taken 36935680 times.
✓ Branch 9 taken 377408 times.
74626176 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 500160 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 247680 rgb9plus_planar_transparency_funcs(14)
1492 2400 rgb9plus_planar_transparency_funcs(16)
1493
1494 754816 rgb9plus_msb_planar_funcs(10)
1495 853760 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 162153 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 162153 enum AVPixelFormat srcFormat = c->opts.src_format;
1858
1859 162153 *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 1071 times.
✓ Branch 5 taken 6114 times.
✓ Branch 6 taken 4952 times.
✓ Branch 7 taken 3910 times.
✓ Branch 8 taken 1099 times.
✓ Branch 9 taken 3116 times.
✓ Branch 10 taken 3023 times.
✓ Branch 11 taken 1617 times.
✓ Branch 12 taken 2683 times.
✓ Branch 13 taken 483 times.
✓ Branch 14 taken 384 times.
✓ Branch 15 taken 965 times.
✓ Branch 16 taken 1008 times.
✓ Branch 17 taken 1158 times.
✓ Branch 18 taken 2093 times.
✓ Branch 19 taken 2055 times.
✓ Branch 20 taken 1845 times.
✓ Branch 21 taken 2542 times.
✓ Branch 22 taken 422 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 930 times.
✓ Branch 25 taken 1116 times.
✓ Branch 26 taken 3346 times.
✓ Branch 27 taken 6425 times.
✓ Branch 28 taken 714 times.
✓ Branch 29 taken 806 times.
✓ Branch 30 taken 699 times.
✓ Branch 31 taken 709 times.
✓ Branch 32 taken 2105 times.
✓ Branch 33 taken 602 times.
✓ Branch 34 taken 653 times.
✓ Branch 35 taken 1041 times.
✓ Branch 36 taken 951 times.
✓ Branch 37 taken 1025 times.
✓ Branch 38 taken 1035 times.
✓ Branch 39 taken 1099 times.
✓ Branch 40 taken 1043 times.
✓ Branch 41 taken 961 times.
✓ Branch 42 taken 1067 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 90640 times.
162153 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 1071 case AV_PIX_FMT_VYU444:
1874 1071 *chrToYV12 = vyuToUV_c;
1875 1071 break;
1876 6114 case AV_PIX_FMT_NV12:
1877 case AV_PIX_FMT_NV16:
1878 case AV_PIX_FMT_NV24:
1879 6114 *chrToYV12 = nv12ToUV_c;
1880 6114 break;
1881 4952 case AV_PIX_FMT_NV21:
1882 case AV_PIX_FMT_NV42:
1883 4952 *chrToYV12 = nv21ToUV_c;
1884 4952 break;
1885 3910 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 3910 *chrToYV12 = palToUV_c;
1891 3910 break;
1892 1099 case AV_PIX_FMT_GBRP9LE:
1893 1099 *readChrPlanar = planar_rgb9le_to_uv;
1894 1099 break;
1895 3116 case AV_PIX_FMT_GBRAP10LE:
1896 case AV_PIX_FMT_GBRP10LE:
1897 3116 *readChrPlanar = planar_rgb10le_to_uv;
1898 3116 break;
1899 3023 case AV_PIX_FMT_GBRAP12LE:
1900 case AV_PIX_FMT_GBRP12LE:
1901 3023 *readChrPlanar = planar_rgb12le_to_uv;
1902 3023 break;
1903 1617 case AV_PIX_FMT_GBRAP14LE:
1904 case AV_PIX_FMT_GBRP14LE:
1905 1617 *readChrPlanar = planar_rgb14le_to_uv;
1906 1617 break;
1907 2683 case AV_PIX_FMT_GBRAP16LE:
1908 case AV_PIX_FMT_GBRP16LE:
1909 2683 *readChrPlanar = planar_rgb16le_to_uv;
1910 2683 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 965 case AV_PIX_FMT_GBRP10MSBLE:
1920 965 *readChrPlanar = msb_planar_rgb10le_to_uv;
1921 965 break;
1922 1008 case AV_PIX_FMT_GBRP12MSBLE:
1923 1008 *readChrPlanar = msb_planar_rgb12le_to_uv;
1924 1008 break;
1925 1158 case AV_PIX_FMT_GBRP9BE:
1926 1158 *readChrPlanar = planar_rgb9be_to_uv;
1927 1158 break;
1928 2093 case AV_PIX_FMT_GBRAP10BE:
1929 case AV_PIX_FMT_GBRP10BE:
1930 2093 *readChrPlanar = planar_rgb10be_to_uv;
1931 2093 break;
1932 2055 case AV_PIX_FMT_GBRAP12BE:
1933 case AV_PIX_FMT_GBRP12BE:
1934 2055 *readChrPlanar = planar_rgb12be_to_uv;
1935 2055 break;
1936 1845 case AV_PIX_FMT_GBRAP14BE:
1937 case AV_PIX_FMT_GBRP14BE:
1938 1845 *readChrPlanar = planar_rgb14be_to_uv;
1939 1845 break;
1940 2542 case AV_PIX_FMT_GBRAP16BE:
1941 case AV_PIX_FMT_GBRP16BE:
1942 2542 *readChrPlanar = planar_rgb16be_to_uv;
1943 2542 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 930 case AV_PIX_FMT_GBRP10MSBBE:
1953 930 *readChrPlanar = msb_planar_rgb10be_to_uv;
1954 930 break;
1955 1116 case AV_PIX_FMT_GBRP12MSBBE:
1956 1116 *readChrPlanar = msb_planar_rgb12be_to_uv;
1957 1116 break;
1958 3346 case AV_PIX_FMT_GBRAP:
1959 case AV_PIX_FMT_GBRP:
1960 3346 *readChrPlanar = planar_rgb_to_uv;
1961 3346 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 6425 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 6425 *chrToYV12 = bswap16UV_c;
2025 6425 break;
2026 #endif
2027 714 case AV_PIX_FMT_YUV444P10MSBLE:
2028 714 *chrToYV12 = shf16_10LEToUV_c;
2029 714 break;
2030 806 case AV_PIX_FMT_YUV444P12MSBLE:
2031 806 *chrToYV12 = shf16_12LEToUV_c;
2032 806 break;
2033 699 case AV_PIX_FMT_YUV444P10MSBBE:
2034 699 *chrToYV12 = shf16_10BEToUV_c;
2035 699 break;
2036 709 case AV_PIX_FMT_YUV444P12MSBBE:
2037 709 *chrToYV12 = shf16_12BEToUV_c;
2038 709 break;
2039 2105 case AV_PIX_FMT_VUYA:
2040 case AV_PIX_FMT_VUYX:
2041 2105 *chrToYV12 = read_vuyx_UV_c;
2042 2105 break;
2043 602 case AV_PIX_FMT_XV30LE:
2044 602 *chrToYV12 = read_xv30le_UV_c;
2045 602 break;
2046 653 case AV_PIX_FMT_V30XLE:
2047 653 *chrToYV12 = read_v30xle_UV_c;
2048 653 break;
2049 1041 case AV_PIX_FMT_AYUV:
2050 1041 *chrToYV12 = read_ayuv_UV_c;
2051 1041 break;
2052 951 case AV_PIX_FMT_AYUV64LE:
2053 951 *chrToYV12 = read_ayuv64le_UV_c;
2054 951 break;
2055 1025 case AV_PIX_FMT_AYUV64BE:
2056 1025 *chrToYV12 = read_ayuv64be_UV_c;
2057 1025 break;
2058 1035 case AV_PIX_FMT_UYVA:
2059 1035 *chrToYV12 = read_uyva_UV_c;
2060 1035 break;
2061 1099 case AV_PIX_FMT_XV36LE:
2062 1099 *chrToYV12 = read_xv36le_UV_c;
2063 1099 break;
2064 1043 case AV_PIX_FMT_XV36BE:
2065 1043 *chrToYV12 = read_xv36be_UV_c;
2066 1043 break;
2067 961 case AV_PIX_FMT_XV48LE:
2068 961 *chrToYV12 = read_xv48le_UV_c;
2069 961 break;
2070 1067 case AV_PIX_FMT_XV48BE:
2071 1067 *chrToYV12 = read_xv48be_UV_c;
2072 1067 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 47795 times.
✓ Branch 1 taken 114358 times.
162153 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 45713 times.
47795 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 958 times.
✓ Branch 1 taken 979 times.
✓ Branch 2 taken 970 times.
✓ Branch 3 taken 917 times.
✓ Branch 4 taken 930 times.
✓ Branch 5 taken 1624 times.
✓ Branch 6 taken 902 times.
✓ Branch 7 taken 991 times.
✓ Branch 8 taken 2114 times.
✓ Branch 9 taken 1856 times.
✓ Branch 10 taken 1067 times.
✓ Branch 11 taken 935 times.
✓ Branch 12 taken 903 times.
✓ Branch 13 taken 1002 times.
✓ Branch 14 taken 945 times.
✓ Branch 15 taken 1023 times.
✓ Branch 16 taken 908 times.
✓ Branch 17 taken 1974 times.
✓ Branch 18 taken 2098 times.
✓ Branch 19 taken 1622 times.
✓ Branch 20 taken 1012 times.
✓ Branch 21 taken 1034 times.
✓ Branch 22 taken 1002 times.
✓ Branch 23 taken 1021 times.
✓ Branch 24 taken 910 times.
✓ Branch 25 taken 966 times.
✓ Branch 26 taken 556 times.
✓ Branch 27 taken 611 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 82528 times.
114358 switch (srcFormat) {
2236 958 case AV_PIX_FMT_RGBA64BE:
2237 958 *chrToYV12 = rgb64BEToUV_c;
2238 958 break;
2239 979 case AV_PIX_FMT_RGBA64LE:
2240 979 *chrToYV12 = rgb64LEToUV_c;
2241 979 break;
2242 970 case AV_PIX_FMT_BGRA64BE:
2243 970 *chrToYV12 = bgr64BEToUV_c;
2244 970 break;
2245 917 case AV_PIX_FMT_BGRA64LE:
2246 917 *chrToYV12 = bgr64LEToUV_c;
2247 917 break;
2248 930 case AV_PIX_FMT_RGB48BE:
2249 930 *chrToYV12 = rgb48BEToUV_c;
2250 930 break;
2251 1624 case AV_PIX_FMT_RGB48LE:
2252 1624 *chrToYV12 = rgb48LEToUV_c;
2253 1624 break;
2254 902 case AV_PIX_FMT_BGR48BE:
2255 902 *chrToYV12 = bgr48BEToUV_c;
2256 902 break;
2257 991 case AV_PIX_FMT_BGR48LE:
2258 991 *chrToYV12 = bgr48LEToUV_c;
2259 991 break;
2260 2114 case AV_PIX_FMT_RGB32:
2261 2114 *chrToYV12 = bgr32ToUV_c;
2262 2114 break;
2263 1856 case AV_PIX_FMT_RGB32_1:
2264 1856 *chrToYV12 = bgr321ToUV_c;
2265 1856 break;
2266 1067 case AV_PIX_FMT_BGR24:
2267 1067 *chrToYV12 = bgr24ToUV_c;
2268 1067 break;
2269 935 case AV_PIX_FMT_BGR565LE:
2270 935 *chrToYV12 = bgr16leToUV_c;
2271 935 break;
2272 903 case AV_PIX_FMT_BGR565BE:
2273 903 *chrToYV12 = bgr16beToUV_c;
2274 903 break;
2275 1002 case AV_PIX_FMT_BGR555LE:
2276 1002 *chrToYV12 = bgr15leToUV_c;
2277 1002 break;
2278 945 case AV_PIX_FMT_BGR555BE:
2279 945 *chrToYV12 = bgr15beToUV_c;
2280 945 break;
2281 1023 case AV_PIX_FMT_BGR444LE:
2282 1023 *chrToYV12 = bgr12leToUV_c;
2283 1023 break;
2284 908 case AV_PIX_FMT_BGR444BE:
2285 908 *chrToYV12 = bgr12beToUV_c;
2286 908 break;
2287 1974 case AV_PIX_FMT_BGR32:
2288 1974 *chrToYV12 = rgb32ToUV_c;
2289 1974 break;
2290 2098 case AV_PIX_FMT_BGR32_1:
2291 2098 *chrToYV12 = rgb321ToUV_c;
2292 2098 break;
2293 1622 case AV_PIX_FMT_RGB24:
2294 1622 *chrToYV12 = rgb24ToUV_c;
2295 1622 break;
2296 1012 case AV_PIX_FMT_RGB565LE:
2297 1012 *chrToYV12 = rgb16leToUV_c;
2298 1012 break;
2299 1034 case AV_PIX_FMT_RGB565BE:
2300 1034 *chrToYV12 = rgb16beToUV_c;
2301 1034 break;
2302 1002 case AV_PIX_FMT_RGB555LE:
2303 1002 *chrToYV12 = rgb15leToUV_c;
2304 1002 break;
2305 1021 case AV_PIX_FMT_RGB555BE:
2306 1021 *chrToYV12 = rgb15beToUV_c;
2307 1021 break;
2308 910 case AV_PIX_FMT_RGB444LE:
2309 910 *chrToYV12 = rgb12leToUV_c;
2310 910 break;
2311 966 case AV_PIX_FMT_RGB444BE:
2312 966 *chrToYV12 = rgb12beToUV_c;
2313 966 break;
2314 556 case AV_PIX_FMT_X2RGB10LE:
2315 556 *chrToYV12 = rgb30leToUV_c;
2316 556 break;
2317 611 case AV_PIX_FMT_X2BGR10LE:
2318 611 *chrToYV12 = bgr30leToUV_c;
2319 611 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 162153 *lumToYV12 = NULL;
2336 162153 *alpToYV12 = NULL;
2337
94/107
✓ Branch 0 taken 1099 times.
✓ Branch 1 taken 976 times.
✓ Branch 2 taken 2140 times.
✓ Branch 3 taken 952 times.
✓ Branch 4 taken 2071 times.
✓ Branch 5 taken 560 times.
✓ Branch 6 taken 1057 times.
✓ Branch 7 taken 1240 times.
✓ Branch 8 taken 1443 times.
✓ Branch 9 taken 253 times.
✓ Branch 10 taken 230 times.
✓ Branch 11 taken 115 times.
✓ Branch 12 taken 269 times.
✓ Branch 13 taken 965 times.
✓ Branch 14 taken 1008 times.
✓ Branch 15 taken 1158 times.
✓ Branch 16 taken 867 times.
✓ Branch 17 taken 1226 times.
✓ Branch 18 taken 895 times.
✓ Branch 19 taken 1160 times.
✓ Branch 20 taken 640 times.
✓ Branch 21 taken 1205 times.
✓ Branch 22 taken 1232 times.
✓ Branch 23 taken 1310 times.
✓ Branch 24 taken 253 times.
✓ Branch 25 taken 169 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 930 times.
✓ Branch 29 taken 1116 times.
✓ Branch 30 taken 1293 times.
✓ Branch 31 taken 2053 times.
✓ Branch 32 taken 10063 times.
✓ Branch 33 taken 2000 times.
✓ Branch 34 taken 714 times.
✓ Branch 35 taken 806 times.
✓ Branch 36 taken 699 times.
✓ Branch 37 taken 709 times.
✓ Branch 38 taken 917 times.
✓ Branch 39 taken 942 times.
✓ Branch 40 taken 9 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 2105 times.
✓ Branch 43 taken 602 times.
✓ Branch 44 taken 653 times.
✓ Branch 45 taken 2076 times.
✓ Branch 46 taken 1912 times.
✓ Branch 47 taken 2092 times.
✓ Branch 48 taken 1099 times.
✓ Branch 49 taken 1043 times.
✓ Branch 50 taken 1345 times.
✓ Branch 51 taken 121 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 1071 times.
✓ Branch 54 taken 1125 times.
✓ Branch 55 taken 936 times.
✓ Branch 56 taken 904 times.
✓ Branch 57 taken 1003 times.
✓ Branch 58 taken 946 times.
✓ Branch 59 taken 1024 times.
✓ Branch 60 taken 909 times.
✓ Branch 61 taken 2158 times.
✓ Branch 62 taken 1017 times.
✓ Branch 63 taken 1035 times.
✓ Branch 64 taken 1018 times.
✓ Branch 65 taken 1022 times.
✓ Branch 66 taken 911 times.
✓ Branch 67 taken 967 times.
✓ Branch 68 taken 3910 times.
✓ Branch 69 taken 1131 times.
✓ Branch 70 taken 1059 times.
✓ Branch 71 taken 2174 times.
✓ Branch 72 taken 1884 times.
✓ Branch 73 taken 2040 times.
✓ Branch 74 taken 2136 times.
✓ Branch 75 taken 930 times.
✓ Branch 76 taken 2048 times.
✓ Branch 77 taken 902 times.
✓ Branch 78 taken 991 times.
✓ Branch 79 taken 958 times.
✓ Branch 80 taken 979 times.
✓ Branch 81 taken 970 times.
✓ Branch 82 taken 917 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 556 times.
✓ Branch 99 taken 611 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 58753 times.
162153 switch (srcFormat) {
2338 1099 case AV_PIX_FMT_GBRP9LE:
2339 1099 *readLumPlanar = planar_rgb9le_to_y;
2340 1099 break;
2341 976 case AV_PIX_FMT_GBRAP10LE:
2342 976 *readAlpPlanar = planar_rgb10le_to_a;
2343 av_fallthrough;
2344 3116 case AV_PIX_FMT_GBRP10LE:
2345 3116 *readLumPlanar = planar_rgb10le_to_y;
2346 3116 break;
2347 952 case AV_PIX_FMT_GBRAP12LE:
2348 952 *readAlpPlanar = planar_rgb12le_to_a;
2349 av_fallthrough;
2350 3023 case AV_PIX_FMT_GBRP12LE:
2351 3023 *readLumPlanar = planar_rgb12le_to_y;
2352 3023 break;
2353 560 case AV_PIX_FMT_GBRAP14LE:
2354 560 *readAlpPlanar = planar_rgb14le_to_a;
2355 av_fallthrough;
2356 1617 case AV_PIX_FMT_GBRP14LE:
2357 1617 *readLumPlanar = planar_rgb14le_to_y;
2358 1617 break;
2359 1240 case AV_PIX_FMT_GBRAP16LE:
2360 1240 *readAlpPlanar = planar_rgb16le_to_a;
2361 av_fallthrough;
2362 2683 case AV_PIX_FMT_GBRP16LE:
2363 2683 *readLumPlanar = planar_rgb16le_to_y;
2364 2683 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 965 case AV_PIX_FMT_GBRP10MSBLE:
2378 965 *readLumPlanar = msb_planar_rgb10le_to_y;
2379 965 break;
2380 1008 case AV_PIX_FMT_GBRP12MSBLE:
2381 1008 *readLumPlanar = msb_planar_rgb12le_to_y;
2382 1008 break;
2383 1158 case AV_PIX_FMT_GBRP9BE:
2384 1158 *readLumPlanar = planar_rgb9be_to_y;
2385 1158 break;
2386 867 case AV_PIX_FMT_GBRAP10BE:
2387 867 *readAlpPlanar = planar_rgb10be_to_a;
2388 av_fallthrough;
2389 2093 case AV_PIX_FMT_GBRP10BE:
2390 2093 *readLumPlanar = planar_rgb10be_to_y;
2391 2093 break;
2392 895 case AV_PIX_FMT_GBRAP12BE:
2393 895 *readAlpPlanar = planar_rgb12be_to_a;
2394 av_fallthrough;
2395 2055 case AV_PIX_FMT_GBRP12BE:
2396 2055 *readLumPlanar = planar_rgb12be_to_y;
2397 2055 break;
2398 640 case AV_PIX_FMT_GBRAP14BE:
2399 640 *readAlpPlanar = planar_rgb14be_to_a;
2400 av_fallthrough;
2401 1845 case AV_PIX_FMT_GBRP14BE:
2402 1845 *readLumPlanar = planar_rgb14be_to_y;
2403 1845 break;
2404 1232 case AV_PIX_FMT_GBRAP16BE:
2405 1232 *readAlpPlanar = planar_rgb16be_to_a;
2406 av_fallthrough;
2407 2542 case AV_PIX_FMT_GBRP16BE:
2408 2542 *readLumPlanar = planar_rgb16be_to_y;
2409 2542 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 930 case AV_PIX_FMT_GBRP10MSBBE:
2423 930 *readLumPlanar = msb_planar_rgb10be_to_y;
2424 930 break;
2425 1116 case AV_PIX_FMT_GBRP12MSBBE:
2426 1116 *readLumPlanar = msb_planar_rgb12be_to_y;
2427 1116 break;
2428 1293 case AV_PIX_FMT_GBRAP:
2429 1293 *readAlpPlanar = planar_rgb_to_a;
2430 av_fallthrough;
2431 3346 case AV_PIX_FMT_GBRP:
2432 3346 *readLumPlanar = planar_rgb_to_y;
2433 3346 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 10063 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 10063 *lumToYV12 = bswap16Y_c;
2507 10063 break;
2508 2000 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 2000 *lumToYV12 = bswap16Y_c;
2520 2000 *alpToYV12 = bswap16Y_c;
2521 2000 break;
2522 #endif
2523 714 case AV_PIX_FMT_YUV444P10MSBLE:
2524 714 *lumToYV12 = shf16_10LEToY_c;
2525 714 break;
2526 806 case AV_PIX_FMT_YUV444P12MSBLE:
2527 806 *lumToYV12 = shf16_12LEToY_c;
2528 806 break;
2529 699 case AV_PIX_FMT_YUV444P10MSBBE:
2530 699 *lumToYV12 = shf16_10BEToY_c;
2531 699 break;
2532 709 case AV_PIX_FMT_YUV444P12MSBBE:
2533 709 *lumToYV12 = shf16_12BEToY_c;
2534 709 break;
2535 917 case AV_PIX_FMT_YA16LE:
2536 917 *lumToYV12 = read_ya16le_gray_c;
2537 917 break;
2538 942 case AV_PIX_FMT_YA16BE:
2539 942 *lumToYV12 = read_ya16be_gray_c;
2540 942 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 2105 case AV_PIX_FMT_VUYA:
2548 case AV_PIX_FMT_VUYX:
2549 2105 *lumToYV12 = read_vuyx_Y_c;
2550 2105 break;
2551 602 case AV_PIX_FMT_XV30LE:
2552 602 *lumToYV12 = read_xv30le_Y_c;
2553 602 break;
2554 653 case AV_PIX_FMT_V30XLE:
2555 653 *lumToYV12 = read_v30xle_Y_c;
2556 653 break;
2557 2076 case AV_PIX_FMT_AYUV:
2558 case AV_PIX_FMT_UYVA:
2559 2076 *lumToYV12 = read_ayuv_Y_c;
2560 2076 break;
2561 1912 case AV_PIX_FMT_AYUV64LE:
2562 case AV_PIX_FMT_XV48LE:
2563 1912 *lumToYV12 = read_ayuv64le_Y_c;
2564 1912 break;
2565 2092 case AV_PIX_FMT_AYUV64BE:
2566 case AV_PIX_FMT_XV48BE:
2567 2092 *lumToYV12 = read_ayuv64be_Y_c;
2568 2092 break;
2569 1099 case AV_PIX_FMT_XV36LE:
2570 1099 *lumToYV12 = read_xv36le_Y_c;
2571 1099 break;
2572 1043 case AV_PIX_FMT_XV36BE:
2573 1043 *lumToYV12 = read_xv36be_Y_c;
2574 1043 break;
2575 1345 case AV_PIX_FMT_YUYV422:
2576 case AV_PIX_FMT_YVYU422:
2577 case AV_PIX_FMT_YA8:
2578 1345 *lumToYV12 = yuy2ToY_c;
2579 1345 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 1071 case AV_PIX_FMT_VYU444:
2587 1071 *lumToYV12 = vyuToY_c;
2588 1071 break;
2589 1125 case AV_PIX_FMT_BGR24:
2590 1125 *lumToYV12 = bgr24ToY_c;
2591 1125 break;
2592 936 case AV_PIX_FMT_BGR565LE:
2593 936 *lumToYV12 = bgr16leToY_c;
2594 936 break;
2595 904 case AV_PIX_FMT_BGR565BE:
2596 904 *lumToYV12 = bgr16beToY_c;
2597 904 break;
2598 1003 case AV_PIX_FMT_BGR555LE:
2599 1003 *lumToYV12 = bgr15leToY_c;
2600 1003 break;
2601 946 case AV_PIX_FMT_BGR555BE:
2602 946 *lumToYV12 = bgr15beToY_c;
2603 946 break;
2604 1024 case AV_PIX_FMT_BGR444LE:
2605 1024 *lumToYV12 = bgr12leToY_c;
2606 1024 break;
2607 909 case AV_PIX_FMT_BGR444BE:
2608 909 *lumToYV12 = bgr12beToY_c;
2609 909 break;
2610 2158 case AV_PIX_FMT_RGB24:
2611 2158 *lumToYV12 = rgb24ToY_c;
2612 2158 break;
2613 1017 case AV_PIX_FMT_RGB565LE:
2614 1017 *lumToYV12 = rgb16leToY_c;
2615 1017 break;
2616 1035 case AV_PIX_FMT_RGB565BE:
2617 1035 *lumToYV12 = rgb16beToY_c;
2618 1035 break;
2619 1018 case AV_PIX_FMT_RGB555LE:
2620 1018 *lumToYV12 = rgb15leToY_c;
2621 1018 break;
2622 1022 case AV_PIX_FMT_RGB555BE:
2623 1022 *lumToYV12 = rgb15beToY_c;
2624 1022 break;
2625 911 case AV_PIX_FMT_RGB444LE:
2626 911 *lumToYV12 = rgb12leToY_c;
2627 911 break;
2628 967 case AV_PIX_FMT_RGB444BE:
2629 967 *lumToYV12 = rgb12beToY_c;
2630 967 break;
2631 3910 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 3910 *lumToYV12 = palToY_c;
2637 3910 break;
2638 1131 case AV_PIX_FMT_MONOBLACK:
2639 1131 *lumToYV12 = monoblack2Y_c;
2640 1131 break;
2641 1059 case AV_PIX_FMT_MONOWHITE:
2642 1059 *lumToYV12 = monowhite2Y_c;
2643 1059 break;
2644 2174 case AV_PIX_FMT_RGB32:
2645 2174 *lumToYV12 = bgr32ToY_c;
2646 2174 break;
2647 1884 case AV_PIX_FMT_RGB32_1:
2648 1884 *lumToYV12 = bgr321ToY_c;
2649 1884 break;
2650 2040 case AV_PIX_FMT_BGR32:
2651 2040 *lumToYV12 = rgb32ToY_c;
2652 2040 break;
2653 2136 case AV_PIX_FMT_BGR32_1:
2654 2136 *lumToYV12 = rgb321ToY_c;
2655 2136 break;
2656 930 case AV_PIX_FMT_RGB48BE:
2657 930 *lumToYV12 = rgb48BEToY_c;
2658 930 break;
2659 2048 case AV_PIX_FMT_RGB48LE:
2660 2048 *lumToYV12 = rgb48LEToY_c;
2661 2048 break;
2662 902 case AV_PIX_FMT_BGR48BE:
2663 902 *lumToYV12 = bgr48BEToY_c;
2664 902 break;
2665 991 case AV_PIX_FMT_BGR48LE:
2666 991 *lumToYV12 = bgr48LEToY_c;
2667 991 break;
2668 958 case AV_PIX_FMT_RGBA64BE:
2669 958 *lumToYV12 = rgb64BEToY_c;
2670 958 break;
2671 979 case AV_PIX_FMT_RGBA64LE:
2672 979 *lumToYV12 = rgb64LEToY_c;
2673 979 break;
2674 970 case AV_PIX_FMT_BGRA64BE:
2675 970 *lumToYV12 = bgr64BEToY_c;
2676 970 break;
2677 917 case AV_PIX_FMT_BGRA64LE:
2678 917 *lumToYV12 = bgr64LEToY_c;
2679 917 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 556 case AV_PIX_FMT_X2RGB10LE:
2734 556 *lumToYV12 = rgb30leToY_c;
2735 556 break;
2736 611 case AV_PIX_FMT_X2BGR10LE:
2737 611 *lumToYV12 = bgr30leToY_c;
2738 611 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 32734 times.
✓ Branch 1 taken 129419 times.
162153 if (c->needAlpha) {
2759
4/4
✓ Branch 1 taken 21631 times.
✓ Branch 2 taken 11103 times.
✓ Branch 4 taken 6489 times.
✓ Branch 5 taken 15142 times.
32734 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
2760
4/4
✓ Branch 1 taken 8753 times.
✓ Branch 2 taken 8839 times.
✓ Branch 3 taken 5875 times.
✓ Branch 4 taken 2878 times.
17592 if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
2761 5875 *alpToYV12 = bswap16Y_c;
2762 }
2763
13/19
✓ Branch 0 taken 1894 times.
✓ Branch 1 taken 1918 times.
✓ Branch 2 taken 3968 times.
✓ Branch 3 taken 3904 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1083 times.
✓ Branch 7 taken 917 times.
✓ Branch 8 taken 932 times.
✓ Branch 9 taken 9 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 2060 times.
✓ Branch 14 taken 1041 times.
✓ Branch 15 taken 951 times.
✓ Branch 16 taken 1025 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 13032 times.
32734 switch (srcFormat) {
2764 1894 case AV_PIX_FMT_BGRA64LE:
2765 1894 case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2766 1918 case AV_PIX_FMT_BGRA64BE:
2767 1918 case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2768 3968 case AV_PIX_FMT_BGRA:
2769 case AV_PIX_FMT_RGBA:
2770 3968 *alpToYV12 = rgbaToA_c;
2771 3968 break;
2772 3904 case AV_PIX_FMT_ABGR:
2773 case AV_PIX_FMT_ARGB:
2774 3904 *alpToYV12 = abgrToA_c;
2775 3904 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 1083 case AV_PIX_FMT_YA8:
2783 1083 *alpToYV12 = uyvyToY_c;
2784 1083 break;
2785 917 case AV_PIX_FMT_YA16LE:
2786 917 *alpToYV12 = read_ya16le_alpha_c;
2787 917 break;
2788 932 case AV_PIX_FMT_YA16BE:
2789 932 *alpToYV12 = read_ya16be_alpha_c;
2790 932 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 2060 case AV_PIX_FMT_VUYA:
2804 case AV_PIX_FMT_UYVA:
2805 2060 *alpToYV12 = read_vuya_A_c;
2806 2060 break;
2807 1041 case AV_PIX_FMT_AYUV:
2808 1041 *alpToYV12 = read_ayuv_A_c;
2809 1041 break;
2810 951 case AV_PIX_FMT_AYUV64LE:
2811 951 *alpToYV12 = read_ayuv64le_A_c;
2812 951 break;
2813 1025 case AV_PIX_FMT_AYUV64BE:
2814 1025 *alpToYV12 = read_ayuv64be_A_c;
2815 1025 break;
2816 ✗ case AV_PIX_FMT_PAL8 :
2817 ✗ *alpToYV12 = palToA_c;
2818 ✗ break;
2819 }
2820 }
2821 162153 }
2822