FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2026-10-01 14:18:39
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 244487 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
47 enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
48 {
49 244487 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
50 int i;
51
2/2
✓ Branch 0 taken 24093568 times.
✓ Branch 1 taken 244487 times.
24338055 for (i = 0; i < width; i++) {
52
2/2
✓ Branch 0 taken 12141440 times.
✓ Branch 1 taken 11952128 times.
24093568 unsigned int r_b = input_pixel(&src[i*4+0]);
53
2/2
✓ Branch 0 taken 12141440 times.
✓ Branch 1 taken 11952128 times.
24093568 unsigned int g = input_pixel(&src[i*4+1]);
54
2/2
✓ Branch 0 taken 12141440 times.
✓ Branch 1 taken 11952128 times.
24093568 unsigned int b_r = input_pixel(&src[i*4+2]);
55
56
12/16
✓ Branch 0 taken 24093568 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24093568 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17780608 times.
✓ Branch 5 taken 6312960 times.
✓ Branch 6 taken 5873664 times.
✓ Branch 7 taken 11906944 times.
✓ Branch 8 taken 24093568 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 24093568 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 17780608 times.
✓ Branch 13 taken 6312960 times.
✓ Branch 14 taken 5873664 times.
✓ Branch 15 taken 11906944 times.
24093568 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
57 }
58 244487 }
59
60 static av_always_inline void
61 244487 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 244487 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
67 244487 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 24093568 times.
✓ Branch 1 taken 244487 times.
24338055 for (i = 0; i < width; i++) {
70
2/2
✓ Branch 0 taken 12141440 times.
✓ Branch 1 taken 11952128 times.
24093568 unsigned int r_b = input_pixel(&src1[i*4+0]);
71
2/2
✓ Branch 0 taken 12141440 times.
✓ Branch 1 taken 11952128 times.
24093568 unsigned int g = input_pixel(&src1[i*4+1]);
72
2/2
✓ Branch 0 taken 12141440 times.
✓ Branch 1 taken 11952128 times.
24093568 unsigned int b_r = input_pixel(&src1[i*4+2]);
73
74
12/16
✓ Branch 0 taken 24093568 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24093568 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17780608 times.
✓ Branch 5 taken 6312960 times.
✓ Branch 6 taken 5873664 times.
✓ Branch 7 taken 11906944 times.
✓ Branch 8 taken 24093568 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 24093568 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 17780608 times.
✓ Branch 13 taken 6312960 times.
✓ Branch 14 taken 5873664 times.
✓ Branch 15 taken 11906944 times.
24093568 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
75
12/16
✓ Branch 0 taken 24093568 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24093568 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17780608 times.
✓ Branch 5 taken 6312960 times.
✓ Branch 6 taken 5873664 times.
✓ Branch 7 taken 11906944 times.
✓ Branch 8 taken 24093568 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 24093568 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 17780608 times.
✓ Branch 13 taken 6312960 times.
✓ Branch 14 taken 5873664 times.
✓ Branch 15 taken 11906944 times.
24093568 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
76 }
77 244487 }
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 248576 RGB64FUNCS(rgb, LE, AV_PIX_FMT_RGBA64)
130 240540 RGB64FUNCS(rgb, BE, AV_PIX_FMT_RGBA64)
131 235008 RGB64FUNCS(bgr, LE, AV_PIX_FMT_BGRA64)
132 253824 RGB64FUNCS(bgr, BE, AV_PIX_FMT_BGRA64)
133
134 1164385 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 1164385 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
140 int i;
141
2/2
✓ Branch 0 taken 347410312 times.
✓ Branch 1 taken 1164385 times.
348574697 for (i = 0; i < width; i++) {
142
2/2
✓ Branch 0 taken 11980672 times.
✓ Branch 1 taken 335429640 times.
347410312 unsigned int r_b = input_pixel(&src[i * 3 + 0]);
143
2/2
✓ Branch 0 taken 11980672 times.
✓ Branch 1 taken 335429640 times.
347410312 unsigned int g = input_pixel(&src[i * 3 + 1]);
144
2/2
✓ Branch 0 taken 11980672 times.
✓ Branch 1 taken 335429640 times.
347410312 unsigned int b_r = input_pixel(&src[i * 3 + 2]);
145
146
12/16
✓ Branch 0 taken 341459848 times.
✓ Branch 1 taken 5950464 times.
✓ Branch 2 taken 335055752 times.
✓ Branch 3 taken 6404096 times.
✓ Branch 4 taken 335055752 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 335055752 times.
✓ Branch 8 taken 341459848 times.
✓ Branch 9 taken 5950464 times.
✓ Branch 10 taken 335055752 times.
✓ Branch 11 taken 6404096 times.
✓ Branch 12 taken 335055752 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 335055752 times.
347410312 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
147 }
148 1164385 }
149
150 771709 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 771709 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
160 771709 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 209728960 times.
✓ Branch 1 taken 771709 times.
210500669 for (i = 0; i < width; i++) {
163
2/2
✓ Branch 0 taken 11980672 times.
✓ Branch 1 taken 197748288 times.
209728960 unsigned r_b = input_pixel(&src1[i * 3 + 0]);
164
2/2
✓ Branch 0 taken 11980672 times.
✓ Branch 1 taken 197748288 times.
209728960 unsigned g = input_pixel(&src1[i * 3 + 1]);
165
2/2
✓ Branch 0 taken 11980672 times.
✓ Branch 1 taken 197748288 times.
209728960 unsigned b_r = input_pixel(&src1[i * 3 + 2]);
166
167
12/16
✓ Branch 0 taken 203778496 times.
✓ Branch 1 taken 5950464 times.
✓ Branch 2 taken 197374400 times.
✓ Branch 3 taken 6404096 times.
✓ Branch 4 taken 197374400 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 197374400 times.
✓ Branch 8 taken 203778496 times.
✓ Branch 9 taken 5950464 times.
✓ Branch 10 taken 197374400 times.
✓ Branch 11 taken 6404096 times.
✓ Branch 12 taken 197374400 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 197374400 times.
209728960 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
168
12/16
✓ Branch 0 taken 203778496 times.
✓ Branch 1 taken 5950464 times.
✓ Branch 2 taken 197374400 times.
✓ Branch 3 taken 6404096 times.
✓ Branch 4 taken 197374400 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 197374400 times.
✓ Branch 8 taken 203778496 times.
✓ Branch 9 taken 5950464 times.
✓ Branch 10 taken 197374400 times.
✓ Branch 11 taken 6404096 times.
✓ Branch 12 taken 197374400 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 197374400 times.
209728960 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
169 }
170 771709 }
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 3941680 RGB48FUNCS(rgb, LE, AV_PIX_FMT_RGB48)
249 238364 RGB48FUNCS(rgb, BE, AV_PIX_FMT_RGB48)
250 255744 RGB48FUNCS(bgr, LE, AV_PIX_FMT_BGR48)
251 239744 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 1879122 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 1879122 const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
276 1879122 const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
277 int i;
278
279
2/2
✓ Branch 0 taken 458479921 times.
✓ Branch 1 taken 1879122 times.
460359043 for (i = 0; i < width; i++) {
280
14/14
✓ Branch 0 taken 261240992 times.
✓ Branch 1 taken 197238929 times.
✓ Branch 2 taken 260713696 times.
✓ Branch 3 taken 527296 times.
✓ Branch 4 taken 260295648 times.
✓ Branch 5 taken 418048 times.
✓ Branch 6 taken 492480 times.
✓ Branch 7 taken 259803168 times.
✓ Branch 8 taken 233340448 times.
✓ Branch 9 taken 26462720 times.
✓ Branch 10 taken 26769920 times.
✓ Branch 11 taken 206570528 times.
✓ Branch 12 taken 35755008 times.
✓ Branch 13 taken 170815520 times.
458479921 int px = input_pixel(i) >> shp;
281 458479921 int b = (px & maskb) >> shb;
282 458479921 int g = (px & maskg) >> shg;
283 458479921 int r = (px & maskr) >> shr;
284
285 458479921 dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
286 }
287 1879122 }
288
289 1424768 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 1424768 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
302 1424768 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
303 1424768 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
304 int i;
305
306
2/2
✓ Branch 0 taken 269733385 times.
✓ Branch 1 taken 1424768 times.
271158153 for (i = 0; i < width; i++) {
307
14/14
✓ Branch 0 taken 182389376 times.
✓ Branch 1 taken 87344009 times.
✓ Branch 2 taken 181939904 times.
✓ Branch 3 taken 449472 times.
✓ Branch 4 taken 181521856 times.
✓ Branch 5 taken 418048 times.
✓ Branch 6 taken 414912 times.
✓ Branch 7 taken 181106944 times.
✓ Branch 8 taken 154644224 times.
✓ Branch 9 taken 26462720 times.
✓ Branch 10 taken 26769920 times.
✓ Branch 11 taken 127874304 times.
✓ Branch 12 taken 34538496 times.
✓ Branch 13 taken 93335808 times.
269733385 int px = input_pixel(i) >> shp;
308 269733385 int b = (px & maskb) >> shb;
309 269733385 int g = (px & maskg) >> shg;
310 269733385 int r = (px & maskr) >> shr;
311
312 269733385 dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
313 269733385 dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
314 }
315 1424768 }
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 245376 RGB16_32FUNCS(AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
400 245504 RGB16_32FUNCS(AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
401 247424 RGB16_32FUNCS(AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
402 765568 RGB16_32FUNCS(AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
403 1288864 RGB16_32FUNCS(AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
404 237056 RGB16_32FUNCS(AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
405 237184 RGB16_32FUNCS(AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
406 233216 RGB16_32FUNCS(AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
407 237184 RGB16_32FUNCS(AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
408 257280 RGB16_32FUNCS(AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
409 256512 RGB16_32FUNCS(AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
410 238336 RGB16_32FUNCS(AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
411 388800 RGB16_32FUNCS(AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
412 399552 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 120704 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 120704 int16_t *dst = (int16_t *)_dst;
438 120704 const uint16_t *src = (const uint16_t *)_src;
439 int i;
440
2/2
✓ Branch 0 taken 11933696 times.
✓ Branch 1 taken 120704 times.
12054400 for (i = 0; i < width; i++)
441 11933696 dst[i] = AV_RL16(src + 4 * i + 3);
442 120704 }
443
444 123456 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 123456 int16_t *dst = (int16_t *)_dst;
448 123456 const uint16_t *src = (const uint16_t *)_src;
449 int i;
450
2/2
✓ Branch 0 taken 12124160 times.
✓ Branch 1 taken 123456 times.
12247616 for (i = 0; i < width; i++)
451 12124160 dst[i] = AV_RB16(src + 4 * i + 3);
452 123456 }
453
454 243183 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 243183 int16_t *dst = (int16_t *)_dst;
458 int i;
459
2/2
✓ Branch 0 taken 23909120 times.
✓ Branch 1 taken 243183 times.
24152303 for (i=0; i<width; i++) {
460 23909120 dst[i]= src[4*i]<<6 | src[4*i]>>2;
461 }
462 243183 }
463
464 334538 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 334538 int16_t *dst = (int16_t *)_dst;
468 int i;
469
2/2
✓ Branch 0 taken 91078536 times.
✓ Branch 1 taken 334538 times.
91413074 for (i=0; i<width; i++) {
470 91078536 dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
471 }
472 334538 }
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 433511 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 433511 int16_t *dst = (int16_t *)_dst;
490 int i;
491
2/2
✓ Branch 0 taken 87554840 times.
✓ Branch 1 taken 433511 times.
87988351 for (i = 0; i < width; i++) {
492 87554840 int d = src[i];
493
494 87554840 dst[i] = (pal[d] & 0xFF)<<6;
495 }
496 433511 }
497
498 433511 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 433511 uint16_t *dstU = (uint16_t *)_dstU;
503 433511 int16_t *dstV = (int16_t *)_dstV;
504 int i;
505 av_assert1(src1 == src2);
506
2/2
✓ Branch 0 taken 87554840 times.
✓ Branch 1 taken 433511 times.
87988351 for (i = 0; i < width; i++) {
507 87554840 int p = pal[src1[i]];
508
509 87554840 dstU[i] = (uint8_t)(p>> 8)<<6;
510 87554840 dstV[i] = (uint8_t)(p>>16)<<6;
511 }
512 433511 }
513
514 162488 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 162488 int16_t *dst = (int16_t *)_dst;
518 int i, j;
519 162488 width = (width + 7) >> 3;
520
2/2
✓ Branch 0 taken 4837724 times.
✓ Branch 1 taken 162488 times.
5000212 for (i = 0; i < width; i++) {
521 4837724 int d = ~src[i];
522
2/2
✓ Branch 0 taken 38701792 times.
✓ Branch 1 taken 4837724 times.
43539516 for (j = 0; j < 8; j++)
523 38701792 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
524 }
525
2/2
✓ Branch 0 taken 139096 times.
✓ Branch 1 taken 23392 times.
162488 if(width&7){
526 139096 int d= ~src[i];
527
2/2
✓ Branch 0 taken 579084 times.
✓ Branch 1 taken 139096 times.
718180 for (j = 0; j < (width&7); j++)
528 579084 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
529 }
530 162488 }
531
532 152482 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 152482 int16_t *dst = (int16_t *)_dst;
536 int i, j;
537 152482 width = (width + 7) >> 3;
538
2/2
✓ Branch 0 taken 4770520 times.
✓ Branch 1 taken 152482 times.
4923002 for (i = 0; i < width; i++) {
539 4770520 int d = src[i];
540
2/2
✓ Branch 0 taken 38164160 times.
✓ Branch 1 taken 4770520 times.
42934680 for (j = 0; j < 8; j++)
541 38164160 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
542 }
543
2/2
✓ Branch 0 taken 129250 times.
✓ Branch 1 taken 23232 times.
152482 if(width&7){
544 129250 int d = src[i];
545
2/2
✓ Branch 0 taken 517000 times.
✓ Branch 1 taken 129250 times.
646250 for (j = 0; j < (width&7); j++)
546 517000 dst[8*i+j] = ((d>>(7-j))&1) * 16383;
547 }
548 152482 }
549
550 185042 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 65074304 times.
✓ Branch 1 taken 185042 times.
65259346 for (i = 0; i < width; i++)
555 65074304 dst[i] = src[2 * i];
556 185042 }
557
558 92098 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 16209248 times.
✓ Branch 1 taken 92098 times.
16301346 for (i = 0; i < width; i++) {
563 16209248 dstU[i] = src1[4 * i + 1];
564 16209248 dstV[i] = src1[4 * i + 3];
565 }
566 av_assert1(src1 == src2);
567 92098 }
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 2313025 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 2313025 const uint16_t *src = (const uint16_t *)_src;
613 2313025 uint16_t *dst = (uint16_t *)_dst;
614
2/2
✓ Branch 0 taken 644747008 times.
✓ Branch 1 taken 2313025 times.
647060033 for (i = 0; i < width; i++)
615 644747008 dst[i] = av_bswap16(src[i]);
616 2313025 }
617
618 1050388 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 1050388 const uint16_t *src1 = (const uint16_t *)_src1,
623 1050388 *src2 = (const uint16_t *)_src2;
624 1050388 uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
625
2/2
✓ Branch 0 taken 221101824 times.
✓ Branch 1 taken 1050388 times.
222152212 for (i = 0; i < width; i++) {
626 221101824 dstU[i] = av_bswap16(src1[i]);
627 221101824 dstV[i] = av_bswap16(src2[i]);
628 }
629 1050388 }
630
631 61440 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 6005760 times.
✓ Branch 1 taken 61440 times.
6067200 for (i = 0; i < width; i++)
636 6005760 AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
637 61440 }
638
639 61440 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 6005760 times.
✓ Branch 1 taken 61440 times.
6067200 for (i = 0; i < width; i++)
644 6005760 AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
645 61440 }
646
647 61511 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 5956480 times.
✓ Branch 1 taken 61511 times.
6017991 for (i = 0; i < width; i++)
652 5956480 AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
653 61511 }
654
655 61376 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 5939200 times.
✓ Branch 1 taken 61376 times.
6000576 for (i = 0; i < width; i++)
660 5939200 AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
661 61376 }
662
663 226132 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 51578752 times.
✓ Branch 1 taken 226132 times.
51804884 for (i = 0; i < width; i++)
668 51578752 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
669 226132 }
670
671 238676 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 52906880 times.
✓ Branch 1 taken 238676 times.
53145556 for (i = 0; i < width; i++)
676 52906880 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2));
677 238676 }
678
679 226132 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 51578752 times.
✓ Branch 1 taken 226132 times.
51804884 for (i = 0; i < width; i++) {
684 51578752 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + u_offset));
685 51578752 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + v_offset));
686 }
687 226132 }
688
689 238676 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 52906880 times.
✓ Branch 1 taken 238676 times.
53145556 for (i = 0; i < width; i++) {
694 52906880 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + u_offset));
695 52906880 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + v_offset));
696 }
697 238676 }
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 246464 ayuv64_UV_funcs(ayuv64, 4, 6)
713 683152 ayuv64_UV_funcs(xv48, 0, 4)
714
715 60320 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 5836800 times.
✓ Branch 1 taken 60320 times.
5897120 for (i = 0; i < width; i++)
720 5836800 AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
721 60320 }
722
723 62912 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 6224896 times.
✓ Branch 1 taken 62912 times.
6287808 for (i = 0; i < width; i++)
728 6224896 AV_WN16(dst + i * 2, AV_RB16(src + i * 8));
729 62912 }
730
731 218786 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 44808896 times.
✓ Branch 1 taken 218786 times.
45027682 for (i = 0; i < width; i++) {
736 44808896 dstU[i] = src[i * 4 + 1];
737 44808896 dstV[i] = src[i * 4];
738 }
739 218786 }
740
741 218786 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 44808896 times.
✓ Branch 1 taken 218786 times.
45027682 for (i = 0; i < width; i++)
746 44808896 dst[i] = src[i * 4 + 2];
747 218786 }
748
749 127904 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 12722176 times.
✓ Branch 1 taken 127904 times.
12850080 for (i = 0; i < width; i++)
754 12722176 dst[i] = src[i * 4 + 3];
755 127904 }
756
757 62272 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 6130688 times.
✓ Branch 1 taken 62272 times.
6192960 for (i = 0; i < width; i++) {
762 6130688 dstU[i] = src[i * 4 + 2];
763 6130688 dstV[i] = src[i * 4 + 3];
764 }
765 62272 }
766
767 172388 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 27912648 times.
✓ Branch 1 taken 172388 times.
28085036 for (i = 0; i < width; i++)
772 27912648 dst[i] = src[i * 4 + 1];
773 172388 }
774
775 62272 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 6130688 times.
✓ Branch 1 taken 62272 times.
6192960 for (i = 0; i < width; i++)
780 6130688 dst[i] = src[i * 4];
781 62272 }
782
783 87666 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 14149860 times.
✓ Branch 1 taken 87666 times.
14237526 for (i = 0; i < width; i++) {
788 14149860 dstU[i] = src[i * 4];
789 14149860 dstV[i] = src[i * 4 + 2];
790 }
791 87666 }
792
793 195046 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 53234824 times.
✓ Branch 1 taken 195046 times.
53429870 for (i = 0; i < width; i++)
798 53234824 dst[i] = src[i * 3 + 1];
799 195046 }
800
801 172596 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 45602724 times.
✓ Branch 1 taken 172596 times.
45775320 for (i = 0; i < width; i++) {
806 45602724 dstU[i] = src[i * 3 + 2];
807 45602724 dstV[i] = src[i * 3];
808 }
809 172596 }
810
811 169493 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 50785160 times.
✓ Branch 1 taken 169493 times.
50954653 for (i = 0; i < width; i++)
816 50785160 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
817 169493 }
818
819
820 147043 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 43153060 times.
✓ Branch 1 taken 147043 times.
43300103 for (i = 0; i < width; i++) {
825 43153060 unsigned int uv = AV_RL32(src + i * 4);
826 43153060 AV_WN16(dstU + i * 2, (uv >> 2) & 0x3FFu);
827 43153060 AV_WN16(dstV + i * 2, (uv >> 22) & 0x3FFu);
828 }
829 147043 }
830
831 123138 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 35363520 times.
✓ Branch 1 taken 123138 times.
35486658 for (i = 0; i < width; i++)
836 35363520 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
837 123138 }
838
839
840 123138 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 35363520 times.
✓ Branch 1 taken 123138 times.
35486658 for (i = 0; i < width; i++) {
845 35363520 AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
846 35363520 AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
847 }
848 123138 }
849
850 152258 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 38191808 times.
✓ Branch 1 taken 152258 times.
38344066 for (i = 0; i < width; i++)
855 38191808 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
856 152258 }
857
858
859 152258 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 38191808 times.
✓ Branch 1 taken 152258 times.
38344066 for (i = 0; i < width; i++) {
864 38191808 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
865 38191808 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
866 }
867 152258 }
868
869 149730 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 37898944 times.
✓ Branch 1 taken 149730 times.
38048674 for (i = 0; i < width; i++)
874 37898944 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2) >> 4);
875 149730 }
876
877
878 149730 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 37898944 times.
✓ Branch 1 taken 149730 times.
38048674 for (i = 0; i < width; i++) {
883 37898944 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + 0) >> 4);
884 37898944 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + 4) >> 4);
885 }
886 149730 }
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 92674 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 32621248 times.
✓ Branch 1 taken 92674 times.
32713922 for (i = 0; i < width; i++)
895 32621248 dst[i] = src[2 * i + 1];
896 92674 }
897
898 92098 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 16209248 times.
✓ Branch 1 taken 92098 times.
16301346 for (i = 0; i < width; i++) {
903 16209248 dstU[i] = src1[4 * i + 0];
904 16209248 dstV[i] = src1[4 * i + 2];
905 }
906 av_assert1(src1 == src2);
907 92098 }
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 926282 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 300856160 times.
✓ Branch 1 taken 926282 times.
301782442 for (i = 0; i < width; i++) {
931 300856160 dst1[i] = src[2 * i + 0];
932 300856160 dst2[i] = src[2 * i + 1];
933 }
934 926282 }
935
936 925418 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 925418 nvXXtoUV_c(dstU, dstV, src1, width);
941 925418 }
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 107237376 times.
✓ Branch 1 taken 401280 times.
215277312 shf16_wrapper(10)
1066
2/2
✓ Branch 0 taken 107155456 times.
✓ Branch 1 taken 403840 times.
215118592 shf16_wrapper(12)
1067
1068 300664 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 300664 int16_t *dst = (int16_t *)_dst;
1072 300664 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1073 int i;
1074
2/2
✓ Branch 0 taken 103137640 times.
✓ Branch 1 taken 300664 times.
103438304 for (i = 0; i < width; i++) {
1075 103137640 int b = src[i * 3 + 0];
1076 103137640 int g = src[i * 3 + 1];
1077 103137640 int r = src[i * 3 + 2];
1078
1079 103137640 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1080 }
1081 300664 }
1082
1083 75526 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 75526 int16_t *dstU = (int16_t *)_dstU;
1087 75526 int16_t *dstV = (int16_t *)_dstV;
1088 75526 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1089 75526 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1090 int i;
1091
2/2
✓ Branch 0 taken 26592064 times.
✓ Branch 1 taken 75526 times.
26667590 for (i = 0; i < width; i++) {
1092 26592064 int b = src1[3 * i + 0];
1093 26592064 int g = src1[3 * i + 1];
1094 26592064 int r = src1[3 * i + 2];
1095
1096 26592064 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1097 26592064 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 75526 }
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 3927928 times.
✓ Branch 1 taken 755766 times.
✓ Branch 2 taken 191497024 times.
✓ Branch 3 taken 1392544508 times.
✓ Branch 4 taken 195962240 times.
✓ Branch 5 taken 1388164620 times.
✓ Branch 6 taken 186767616 times.
✓ Branch 7 taken 1388079292 times.
✓ Branch 8 taken 1574846908 times.
✓ Branch 9 taken 4598366 times.
3177450452 shifted_planar_rgb16(16)
1282
9/10
✓ Branch 0 taken 265088 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13209600 times.
✓ Branch 3 taken 12584960 times.
✓ Branch 4 taken 13209600 times.
✓ Branch 5 taken 12584960 times.
✓ Branch 6 taken 13209600 times.
✓ Branch 7 taken 12584960 times.
✓ Branch 8 taken 25794560 times.
✓ Branch 9 taken 265088 times.
52119296 shifted_planar_rgb16_to_y_uv(12)
1283
9/10
✓ Branch 0 taken 239808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12042240 times.
✓ Branch 3 taken 11638784 times.
✓ Branch 4 taken 12042240 times.
✓ Branch 5 taken 11638784 times.
✓ Branch 6 taken 12042240 times.
✓ Branch 7 taken 11638784 times.
✓ Branch 8 taken 23681024 times.
✓ Branch 9 taken 239808 times.
47841664 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 331712 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 163456 rgb9plus_planar_transparency_funcs(14)
1492 2400 rgb9plus_planar_transparency_funcs(16)
1493
1494 479616 rgb9plus_msb_planar_funcs(10)
1495 530176 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 102607 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 102607 enum AVPixelFormat srcFormat = c->opts.src_format;
1858
1859 102607 *chrToYV12 = NULL;
1860
53/57
✓ Branch 0 taken 112 times.
✓ Branch 1 taken 112 times.
✓ Branch 2 taken 112 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 707 times.
✓ Branch 5 taken 1995 times.
✓ Branch 6 taken 842 times.
✓ Branch 7 taken 2476 times.
✓ Branch 8 taken 753 times.
✓ Branch 9 taken 2458 times.
✓ Branch 10 taken 2413 times.
✓ Branch 11 taken 1111 times.
✓ Branch 12 taken 1973 times.
✓ Branch 13 taken 483 times.
✓ Branch 14 taken 384 times.
✓ Branch 15 taken 597 times.
✓ Branch 16 taken 640 times.
✓ Branch 17 taken 792 times.
✓ Branch 18 taken 1497 times.
✓ Branch 19 taken 1503 times.
✓ Branch 20 taken 1229 times.
✓ Branch 21 taken 1800 times.
✓ Branch 22 taken 422 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 598 times.
✓ Branch 25 taken 668 times.
✓ Branch 26 taken 2628 times.
✓ Branch 27 taken 3763 times.
✓ Branch 28 taken 398 times.
✓ Branch 29 taken 414 times.
✓ Branch 30 taken 393 times.
✓ Branch 31 taken 405 times.
✓ Branch 32 taken 1363 times.
✓ Branch 33 taken 418 times.
✓ Branch 34 taken 453 times.
✓ Branch 35 taken 625 times.
✓ Branch 36 taken 609 times.
✓ Branch 37 taken 621 times.
✓ Branch 38 taken 659 times.
✓ Branch 39 taken 705 times.
✓ Branch 40 taken 697 times.
✓ Branch 41 taken 651 times.
✓ Branch 42 taken 733 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 57112 times.
102607 switch (srcFormat) {
1861 112 case AV_PIX_FMT_YUYV422:
1862 112 *chrToYV12 = yuy2ToUV_c;
1863 112 break;
1864 112 case AV_PIX_FMT_YVYU422:
1865 112 *chrToYV12 = yvy2ToUV_c;
1866 112 break;
1867 112 case AV_PIX_FMT_UYVY422:
1868 112 *chrToYV12 = uyvyToUV_c;
1869 112 break;
1870 ✗ case AV_PIX_FMT_UYYVYY411:
1871 ✗ *chrToYV12 = uyyvyyToUV_c;
1872 ✗ break;
1873 707 case AV_PIX_FMT_VYU444:
1874 707 *chrToYV12 = vyuToUV_c;
1875 707 break;
1876 1995 case AV_PIX_FMT_NV12:
1877 case AV_PIX_FMT_NV16:
1878 case AV_PIX_FMT_NV24:
1879 1995 *chrToYV12 = nv12ToUV_c;
1880 1995 break;
1881 842 case AV_PIX_FMT_NV21:
1882 case AV_PIX_FMT_NV42:
1883 842 *chrToYV12 = nv21ToUV_c;
1884 842 break;
1885 2476 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 2476 *chrToYV12 = palToUV_c;
1891 2476 break;
1892 753 case AV_PIX_FMT_GBRP9LE:
1893 753 *readChrPlanar = planar_rgb9le_to_uv;
1894 753 break;
1895 2458 case AV_PIX_FMT_GBRAP10LE:
1896 case AV_PIX_FMT_GBRP10LE:
1897 2458 *readChrPlanar = planar_rgb10le_to_uv;
1898 2458 break;
1899 2413 case AV_PIX_FMT_GBRAP12LE:
1900 case AV_PIX_FMT_GBRP12LE:
1901 2413 *readChrPlanar = planar_rgb12le_to_uv;
1902 2413 break;
1903 1111 case AV_PIX_FMT_GBRAP14LE:
1904 case AV_PIX_FMT_GBRP14LE:
1905 1111 *readChrPlanar = planar_rgb14le_to_uv;
1906 1111 break;
1907 1973 case AV_PIX_FMT_GBRAP16LE:
1908 case AV_PIX_FMT_GBRP16LE:
1909 1973 *readChrPlanar = planar_rgb16le_to_uv;
1910 1973 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 597 case AV_PIX_FMT_GBRP10MSBLE:
1920 597 *readChrPlanar = msb_planar_rgb10le_to_uv;
1921 597 break;
1922 640 case AV_PIX_FMT_GBRP12MSBLE:
1923 640 *readChrPlanar = msb_planar_rgb12le_to_uv;
1924 640 break;
1925 792 case AV_PIX_FMT_GBRP9BE:
1926 792 *readChrPlanar = planar_rgb9be_to_uv;
1927 792 break;
1928 1497 case AV_PIX_FMT_GBRAP10BE:
1929 case AV_PIX_FMT_GBRP10BE:
1930 1497 *readChrPlanar = planar_rgb10be_to_uv;
1931 1497 break;
1932 1503 case AV_PIX_FMT_GBRAP12BE:
1933 case AV_PIX_FMT_GBRP12BE:
1934 1503 *readChrPlanar = planar_rgb12be_to_uv;
1935 1503 break;
1936 1229 case AV_PIX_FMT_GBRAP14BE:
1937 case AV_PIX_FMT_GBRP14BE:
1938 1229 *readChrPlanar = planar_rgb14be_to_uv;
1939 1229 break;
1940 1800 case AV_PIX_FMT_GBRAP16BE:
1941 case AV_PIX_FMT_GBRP16BE:
1942 1800 *readChrPlanar = planar_rgb16be_to_uv;
1943 1800 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 598 case AV_PIX_FMT_GBRP10MSBBE:
1953 598 *readChrPlanar = msb_planar_rgb10be_to_uv;
1954 598 break;
1955 668 case AV_PIX_FMT_GBRP12MSBBE:
1956 668 *readChrPlanar = msb_planar_rgb12be_to_uv;
1957 668 break;
1958 2628 case AV_PIX_FMT_GBRAP:
1959 case AV_PIX_FMT_GBRP:
1960 2628 *readChrPlanar = planar_rgb_to_uv;
1961 2628 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 3763 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 3763 *chrToYV12 = bswap16UV_c;
2025 3763 break;
2026 #endif
2027 398 case AV_PIX_FMT_YUV444P10MSBLE:
2028 398 *chrToYV12 = shf16_10LEToUV_c;
2029 398 break;
2030 414 case AV_PIX_FMT_YUV444P12MSBLE:
2031 414 *chrToYV12 = shf16_12LEToUV_c;
2032 414 break;
2033 393 case AV_PIX_FMT_YUV444P10MSBBE:
2034 393 *chrToYV12 = shf16_10BEToUV_c;
2035 393 break;
2036 405 case AV_PIX_FMT_YUV444P12MSBBE:
2037 405 *chrToYV12 = shf16_12BEToUV_c;
2038 405 break;
2039 1363 case AV_PIX_FMT_VUYA:
2040 case AV_PIX_FMT_VUYX:
2041 1363 *chrToYV12 = read_vuyx_UV_c;
2042 1363 break;
2043 418 case AV_PIX_FMT_XV30LE:
2044 418 *chrToYV12 = read_xv30le_UV_c;
2045 418 break;
2046 453 case AV_PIX_FMT_V30XLE:
2047 453 *chrToYV12 = read_v30xle_UV_c;
2048 453 break;
2049 625 case AV_PIX_FMT_AYUV:
2050 625 *chrToYV12 = read_ayuv_UV_c;
2051 625 break;
2052 609 case AV_PIX_FMT_AYUV64LE:
2053 609 *chrToYV12 = read_ayuv64le_UV_c;
2054 609 break;
2055 621 case AV_PIX_FMT_AYUV64BE:
2056 621 *chrToYV12 = read_ayuv64be_UV_c;
2057 621 break;
2058 659 case AV_PIX_FMT_UYVA:
2059 659 *chrToYV12 = read_uyva_UV_c;
2060 659 break;
2061 705 case AV_PIX_FMT_XV36LE:
2062 705 *chrToYV12 = read_xv36le_UV_c;
2063 705 break;
2064 697 case AV_PIX_FMT_XV36BE:
2065 697 *chrToYV12 = read_xv36be_UV_c;
2066 697 break;
2067 651 case AV_PIX_FMT_XV48LE:
2068 651 *chrToYV12 = read_xv48le_UV_c;
2069 651 break;
2070 733 case AV_PIX_FMT_XV48BE:
2071 733 *chrToYV12 = read_xv48be_UV_c;
2072 733 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 26899 times.
✓ Branch 1 taken 75708 times.
102607 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 24817 times.
26899 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 612 times.
✓ Branch 1 taken 627 times.
✓ Branch 2 taken 606 times.
✓ Branch 3 taken 581 times.
✓ Branch 4 taken 612 times.
✓ Branch 5 taken 1262 times.
✓ Branch 6 taken 594 times.
✓ Branch 7 taken 625 times.
✓ Branch 8 taken 1390 times.
✓ Branch 9 taken 1212 times.
✓ Branch 10 taken 724 times.
✓ Branch 11 taken 603 times.
✓ Branch 12 taken 577 times.
✓ Branch 13 taken 620 times.
✓ Branch 14 taken 587 times.
✓ Branch 15 taken 617 times.
✓ Branch 16 taken 592 times.
✓ Branch 17 taken 1296 times.
✓ Branch 18 taken 1290 times.
✓ Branch 19 taken 1272 times.
✓ Branch 20 taken 712 times.
✓ Branch 21 taken 640 times.
✓ Branch 22 taken 702 times.
✓ Branch 23 taken 637 times.
✓ Branch 24 taken 584 times.
✓ Branch 25 taken 596 times.
✓ Branch 26 taken 384 times.
✓ Branch 27 taken 411 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 54743 times.
75708 switch (srcFormat) {
2236 612 case AV_PIX_FMT_RGBA64BE:
2237 612 *chrToYV12 = rgb64BEToUV_c;
2238 612 break;
2239 627 case AV_PIX_FMT_RGBA64LE:
2240 627 *chrToYV12 = rgb64LEToUV_c;
2241 627 break;
2242 606 case AV_PIX_FMT_BGRA64BE:
2243 606 *chrToYV12 = bgr64BEToUV_c;
2244 606 break;
2245 581 case AV_PIX_FMT_BGRA64LE:
2246 581 *chrToYV12 = bgr64LEToUV_c;
2247 581 break;
2248 612 case AV_PIX_FMT_RGB48BE:
2249 612 *chrToYV12 = rgb48BEToUV_c;
2250 612 break;
2251 1262 case AV_PIX_FMT_RGB48LE:
2252 1262 *chrToYV12 = rgb48LEToUV_c;
2253 1262 break;
2254 594 case AV_PIX_FMT_BGR48BE:
2255 594 *chrToYV12 = bgr48BEToUV_c;
2256 594 break;
2257 625 case AV_PIX_FMT_BGR48LE:
2258 625 *chrToYV12 = bgr48LEToUV_c;
2259 625 break;
2260 1390 case AV_PIX_FMT_RGB32:
2261 1390 *chrToYV12 = bgr32ToUV_c;
2262 1390 break;
2263 1212 case AV_PIX_FMT_RGB32_1:
2264 1212 *chrToYV12 = bgr321ToUV_c;
2265 1212 break;
2266 724 case AV_PIX_FMT_BGR24:
2267 724 *chrToYV12 = bgr24ToUV_c;
2268 724 break;
2269 603 case AV_PIX_FMT_BGR565LE:
2270 603 *chrToYV12 = bgr16leToUV_c;
2271 603 break;
2272 577 case AV_PIX_FMT_BGR565BE:
2273 577 *chrToYV12 = bgr16beToUV_c;
2274 577 break;
2275 620 case AV_PIX_FMT_BGR555LE:
2276 620 *chrToYV12 = bgr15leToUV_c;
2277 620 break;
2278 587 case AV_PIX_FMT_BGR555BE:
2279 587 *chrToYV12 = bgr15beToUV_c;
2280 587 break;
2281 617 case AV_PIX_FMT_BGR444LE:
2282 617 *chrToYV12 = bgr12leToUV_c;
2283 617 break;
2284 592 case AV_PIX_FMT_BGR444BE:
2285 592 *chrToYV12 = bgr12beToUV_c;
2286 592 break;
2287 1296 case AV_PIX_FMT_BGR32:
2288 1296 *chrToYV12 = rgb32ToUV_c;
2289 1296 break;
2290 1290 case AV_PIX_FMT_BGR32_1:
2291 1290 *chrToYV12 = rgb321ToUV_c;
2292 1290 break;
2293 1272 case AV_PIX_FMT_RGB24:
2294 1272 *chrToYV12 = rgb24ToUV_c;
2295 1272 break;
2296 712 case AV_PIX_FMT_RGB565LE:
2297 712 *chrToYV12 = rgb16leToUV_c;
2298 712 break;
2299 640 case AV_PIX_FMT_RGB565BE:
2300 640 *chrToYV12 = rgb16beToUV_c;
2301 640 break;
2302 702 case AV_PIX_FMT_RGB555LE:
2303 702 *chrToYV12 = rgb15leToUV_c;
2304 702 break;
2305 637 case AV_PIX_FMT_RGB555BE:
2306 637 *chrToYV12 = rgb15beToUV_c;
2307 637 break;
2308 584 case AV_PIX_FMT_RGB444LE:
2309 584 *chrToYV12 = rgb12leToUV_c;
2310 584 break;
2311 596 case AV_PIX_FMT_RGB444BE:
2312 596 *chrToYV12 = rgb12beToUV_c;
2313 596 break;
2314 384 case AV_PIX_FMT_X2RGB10LE:
2315 384 *chrToYV12 = rgb30leToUV_c;
2316 384 break;
2317 411 case AV_PIX_FMT_X2BGR10LE:
2318 411 *chrToYV12 = bgr30leToUV_c;
2319 411 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 102607 *lumToYV12 = NULL;
2336 102607 *alpToYV12 = NULL;
2337
94/107
✓ Branch 0 taken 753 times.
✓ Branch 1 taken 680 times.
✓ Branch 2 taken 1778 times.
✓ Branch 3 taken 682 times.
✓ Branch 4 taken 1731 times.
✓ Branch 5 taken 374 times.
✓ Branch 6 taken 737 times.
✓ Branch 7 taken 874 times.
✓ Branch 8 taken 1099 times.
✓ Branch 9 taken 253 times.
✓ Branch 10 taken 230 times.
✓ Branch 11 taken 115 times.
✓ Branch 12 taken 269 times.
✓ Branch 13 taken 597 times.
✓ Branch 14 taken 640 times.
✓ Branch 15 taken 792 times.
✓ Branch 16 taken 645 times.
✓ Branch 17 taken 852 times.
✓ Branch 18 taken 655 times.
✓ Branch 19 taken 848 times.
✓ Branch 20 taken 418 times.
✓ Branch 21 taken 811 times.
✓ Branch 22 taken 862 times.
✓ Branch 23 taken 938 times.
✓ Branch 24 taken 253 times.
✓ Branch 25 taken 169 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 598 times.
✓ Branch 29 taken 668 times.
✓ Branch 30 taken 935 times.
✓ Branch 31 taken 1693 times.
✓ Branch 32 taken 6643 times.
✓ Branch 33 taken 964 times.
✓ Branch 34 taken 398 times.
✓ Branch 35 taken 414 times.
✓ Branch 36 taken 393 times.
✓ Branch 37 taken 405 times.
✓ Branch 38 taken 607 times.
✓ Branch 39 taken 618 times.
✓ Branch 40 taken 9 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 1363 times.
✓ Branch 43 taken 418 times.
✓ Branch 44 taken 453 times.
✓ Branch 45 taken 1284 times.
✓ Branch 46 taken 1260 times.
✓ Branch 47 taken 1354 times.
✓ Branch 48 taken 705 times.
✓ Branch 49 taken 697 times.
✓ Branch 50 taken 897 times.
✓ Branch 51 taken 112 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 707 times.
✓ Branch 54 taken 782 times.
✓ Branch 55 taken 604 times.
✓ Branch 56 taken 578 times.
✓ Branch 57 taken 621 times.
✓ Branch 58 taken 588 times.
✓ Branch 59 taken 618 times.
✓ Branch 60 taken 593 times.
✓ Branch 61 taken 1808 times.
✓ Branch 62 taken 717 times.
✓ Branch 63 taken 641 times.
✓ Branch 64 taken 718 times.
✓ Branch 65 taken 638 times.
✓ Branch 66 taken 585 times.
✓ Branch 67 taken 597 times.
✓ Branch 68 taken 2476 times.
✓ Branch 69 taken 719 times.
✓ Branch 70 taken 709 times.
✓ Branch 71 taken 1450 times.
✓ Branch 72 taken 1240 times.
✓ Branch 73 taken 1362 times.
✓ Branch 74 taken 1328 times.
✓ Branch 75 taken 612 times.
✓ Branch 76 taken 1686 times.
✓ Branch 77 taken 594 times.
✓ Branch 78 taken 625 times.
✓ Branch 79 taken 612 times.
✓ Branch 80 taken 627 times.
✓ Branch 81 taken 606 times.
✓ Branch 82 taken 581 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 384 times.
✓ Branch 99 taken 411 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 31481 times.
102607 switch (srcFormat) {
2338 753 case AV_PIX_FMT_GBRP9LE:
2339 753 *readLumPlanar = planar_rgb9le_to_y;
2340 753 break;
2341 680 case AV_PIX_FMT_GBRAP10LE:
2342 680 *readAlpPlanar = planar_rgb10le_to_a;
2343 av_fallthrough;
2344 2458 case AV_PIX_FMT_GBRP10LE:
2345 2458 *readLumPlanar = planar_rgb10le_to_y;
2346 2458 break;
2347 682 case AV_PIX_FMT_GBRAP12LE:
2348 682 *readAlpPlanar = planar_rgb12le_to_a;
2349 av_fallthrough;
2350 2413 case AV_PIX_FMT_GBRP12LE:
2351 2413 *readLumPlanar = planar_rgb12le_to_y;
2352 2413 break;
2353 374 case AV_PIX_FMT_GBRAP14LE:
2354 374 *readAlpPlanar = planar_rgb14le_to_a;
2355 av_fallthrough;
2356 1111 case AV_PIX_FMT_GBRP14LE:
2357 1111 *readLumPlanar = planar_rgb14le_to_y;
2358 1111 break;
2359 874 case AV_PIX_FMT_GBRAP16LE:
2360 874 *readAlpPlanar = planar_rgb16le_to_a;
2361 av_fallthrough;
2362 1973 case AV_PIX_FMT_GBRP16LE:
2363 1973 *readLumPlanar = planar_rgb16le_to_y;
2364 1973 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 597 case AV_PIX_FMT_GBRP10MSBLE:
2378 597 *readLumPlanar = msb_planar_rgb10le_to_y;
2379 597 break;
2380 640 case AV_PIX_FMT_GBRP12MSBLE:
2381 640 *readLumPlanar = msb_planar_rgb12le_to_y;
2382 640 break;
2383 792 case AV_PIX_FMT_GBRP9BE:
2384 792 *readLumPlanar = planar_rgb9be_to_y;
2385 792 break;
2386 645 case AV_PIX_FMT_GBRAP10BE:
2387 645 *readAlpPlanar = planar_rgb10be_to_a;
2388 av_fallthrough;
2389 1497 case AV_PIX_FMT_GBRP10BE:
2390 1497 *readLumPlanar = planar_rgb10be_to_y;
2391 1497 break;
2392 655 case AV_PIX_FMT_GBRAP12BE:
2393 655 *readAlpPlanar = planar_rgb12be_to_a;
2394 av_fallthrough;
2395 1503 case AV_PIX_FMT_GBRP12BE:
2396 1503 *readLumPlanar = planar_rgb12be_to_y;
2397 1503 break;
2398 418 case AV_PIX_FMT_GBRAP14BE:
2399 418 *readAlpPlanar = planar_rgb14be_to_a;
2400 av_fallthrough;
2401 1229 case AV_PIX_FMT_GBRP14BE:
2402 1229 *readLumPlanar = planar_rgb14be_to_y;
2403 1229 break;
2404 862 case AV_PIX_FMT_GBRAP16BE:
2405 862 *readAlpPlanar = planar_rgb16be_to_a;
2406 av_fallthrough;
2407 1800 case AV_PIX_FMT_GBRP16BE:
2408 1800 *readLumPlanar = planar_rgb16be_to_y;
2409 1800 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 598 case AV_PIX_FMT_GBRP10MSBBE:
2423 598 *readLumPlanar = msb_planar_rgb10be_to_y;
2424 598 break;
2425 668 case AV_PIX_FMT_GBRP12MSBBE:
2426 668 *readLumPlanar = msb_planar_rgb12be_to_y;
2427 668 break;
2428 935 case AV_PIX_FMT_GBRAP:
2429 935 *readAlpPlanar = planar_rgb_to_a;
2430 av_fallthrough;
2431 2628 case AV_PIX_FMT_GBRP:
2432 2628 *readLumPlanar = planar_rgb_to_y;
2433 2628 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 6643 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 6643 *lumToYV12 = bswap16Y_c;
2507 6643 break;
2508 964 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 964 *lumToYV12 = bswap16Y_c;
2520 964 *alpToYV12 = bswap16Y_c;
2521 964 break;
2522 #endif
2523 398 case AV_PIX_FMT_YUV444P10MSBLE:
2524 398 *lumToYV12 = shf16_10LEToY_c;
2525 398 break;
2526 414 case AV_PIX_FMT_YUV444P12MSBLE:
2527 414 *lumToYV12 = shf16_12LEToY_c;
2528 414 break;
2529 393 case AV_PIX_FMT_YUV444P10MSBBE:
2530 393 *lumToYV12 = shf16_10BEToY_c;
2531 393 break;
2532 405 case AV_PIX_FMT_YUV444P12MSBBE:
2533 405 *lumToYV12 = shf16_12BEToY_c;
2534 405 break;
2535 607 case AV_PIX_FMT_YA16LE:
2536 607 *lumToYV12 = read_ya16le_gray_c;
2537 607 break;
2538 618 case AV_PIX_FMT_YA16BE:
2539 618 *lumToYV12 = read_ya16be_gray_c;
2540 618 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 1363 case AV_PIX_FMT_VUYA:
2548 case AV_PIX_FMT_VUYX:
2549 1363 *lumToYV12 = read_vuyx_Y_c;
2550 1363 break;
2551 418 case AV_PIX_FMT_XV30LE:
2552 418 *lumToYV12 = read_xv30le_Y_c;
2553 418 break;
2554 453 case AV_PIX_FMT_V30XLE:
2555 453 *lumToYV12 = read_v30xle_Y_c;
2556 453 break;
2557 1284 case AV_PIX_FMT_AYUV:
2558 case AV_PIX_FMT_UYVA:
2559 1284 *lumToYV12 = read_ayuv_Y_c;
2560 1284 break;
2561 1260 case AV_PIX_FMT_AYUV64LE:
2562 case AV_PIX_FMT_XV48LE:
2563 1260 *lumToYV12 = read_ayuv64le_Y_c;
2564 1260 break;
2565 1354 case AV_PIX_FMT_AYUV64BE:
2566 case AV_PIX_FMT_XV48BE:
2567 1354 *lumToYV12 = read_ayuv64be_Y_c;
2568 1354 break;
2569 705 case AV_PIX_FMT_XV36LE:
2570 705 *lumToYV12 = read_xv36le_Y_c;
2571 705 break;
2572 697 case AV_PIX_FMT_XV36BE:
2573 697 *lumToYV12 = read_xv36be_Y_c;
2574 697 break;
2575 897 case AV_PIX_FMT_YUYV422:
2576 case AV_PIX_FMT_YVYU422:
2577 case AV_PIX_FMT_YA8:
2578 897 *lumToYV12 = yuy2ToY_c;
2579 897 break;
2580 112 case AV_PIX_FMT_UYVY422:
2581 112 *lumToYV12 = uyvyToY_c;
2582 112 break;
2583 ✗ case AV_PIX_FMT_UYYVYY411:
2584 ✗ *lumToYV12 = uyyvyyToY_c;
2585 ✗ break;
2586 707 case AV_PIX_FMT_VYU444:
2587 707 *lumToYV12 = vyuToY_c;
2588 707 break;
2589 782 case AV_PIX_FMT_BGR24:
2590 782 *lumToYV12 = bgr24ToY_c;
2591 782 break;
2592 604 case AV_PIX_FMT_BGR565LE:
2593 604 *lumToYV12 = bgr16leToY_c;
2594 604 break;
2595 578 case AV_PIX_FMT_BGR565BE:
2596 578 *lumToYV12 = bgr16beToY_c;
2597 578 break;
2598 621 case AV_PIX_FMT_BGR555LE:
2599 621 *lumToYV12 = bgr15leToY_c;
2600 621 break;
2601 588 case AV_PIX_FMT_BGR555BE:
2602 588 *lumToYV12 = bgr15beToY_c;
2603 588 break;
2604 618 case AV_PIX_FMT_BGR444LE:
2605 618 *lumToYV12 = bgr12leToY_c;
2606 618 break;
2607 593 case AV_PIX_FMT_BGR444BE:
2608 593 *lumToYV12 = bgr12beToY_c;
2609 593 break;
2610 1808 case AV_PIX_FMT_RGB24:
2611 1808 *lumToYV12 = rgb24ToY_c;
2612 1808 break;
2613 717 case AV_PIX_FMT_RGB565LE:
2614 717 *lumToYV12 = rgb16leToY_c;
2615 717 break;
2616 641 case AV_PIX_FMT_RGB565BE:
2617 641 *lumToYV12 = rgb16beToY_c;
2618 641 break;
2619 718 case AV_PIX_FMT_RGB555LE:
2620 718 *lumToYV12 = rgb15leToY_c;
2621 718 break;
2622 638 case AV_PIX_FMT_RGB555BE:
2623 638 *lumToYV12 = rgb15beToY_c;
2624 638 break;
2625 585 case AV_PIX_FMT_RGB444LE:
2626 585 *lumToYV12 = rgb12leToY_c;
2627 585 break;
2628 597 case AV_PIX_FMT_RGB444BE:
2629 597 *lumToYV12 = rgb12beToY_c;
2630 597 break;
2631 2476 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 2476 *lumToYV12 = palToY_c;
2637 2476 break;
2638 719 case AV_PIX_FMT_MONOBLACK:
2639 719 *lumToYV12 = monoblack2Y_c;
2640 719 break;
2641 709 case AV_PIX_FMT_MONOWHITE:
2642 709 *lumToYV12 = monowhite2Y_c;
2643 709 break;
2644 1450 case AV_PIX_FMT_RGB32:
2645 1450 *lumToYV12 = bgr32ToY_c;
2646 1450 break;
2647 1240 case AV_PIX_FMT_RGB32_1:
2648 1240 *lumToYV12 = bgr321ToY_c;
2649 1240 break;
2650 1362 case AV_PIX_FMT_BGR32:
2651 1362 *lumToYV12 = rgb32ToY_c;
2652 1362 break;
2653 1328 case AV_PIX_FMT_BGR32_1:
2654 1328 *lumToYV12 = rgb321ToY_c;
2655 1328 break;
2656 612 case AV_PIX_FMT_RGB48BE:
2657 612 *lumToYV12 = rgb48BEToY_c;
2658 612 break;
2659 1686 case AV_PIX_FMT_RGB48LE:
2660 1686 *lumToYV12 = rgb48LEToY_c;
2661 1686 break;
2662 594 case AV_PIX_FMT_BGR48BE:
2663 594 *lumToYV12 = bgr48BEToY_c;
2664 594 break;
2665 625 case AV_PIX_FMT_BGR48LE:
2666 625 *lumToYV12 = bgr48LEToY_c;
2667 625 break;
2668 612 case AV_PIX_FMT_RGBA64BE:
2669 612 *lumToYV12 = rgb64BEToY_c;
2670 612 break;
2671 627 case AV_PIX_FMT_RGBA64LE:
2672 627 *lumToYV12 = rgb64LEToY_c;
2673 627 break;
2674 606 case AV_PIX_FMT_BGRA64BE:
2675 606 *lumToYV12 = bgr64BEToY_c;
2676 606 break;
2677 581 case AV_PIX_FMT_BGRA64LE:
2678 581 *lumToYV12 = bgr64LEToY_c;
2679 581 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 384 case AV_PIX_FMT_X2RGB10LE:
2734 384 *lumToYV12 = rgb30leToY_c;
2735 384 break;
2736 411 case AV_PIX_FMT_X2BGR10LE:
2737 411 *lumToYV12 = bgr30leToY_c;
2738 411 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 19292 times.
✓ Branch 1 taken 83315 times.
102607 if (c->needAlpha) {
2759
4/4
✓ Branch 1 taken 12431 times.
✓ Branch 2 taken 6861 times.
✓ Branch 4 taken 3707 times.
✓ Branch 5 taken 8724 times.
19292 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
2760
4/4
✓ Branch 1 taken 5225 times.
✓ Branch 2 taken 5343 times.
✓ Branch 3 taken 3401 times.
✓ Branch 4 taken 1824 times.
10568 if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
2761 3401 *alpToYV12 = bswap16Y_c;
2762 }
2763
13/19
✓ Branch 0 taken 1206 times.
✓ Branch 1 taken 1208 times.
✓ Branch 2 taken 2566 times.
✓ Branch 3 taken 2452 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 653 times.
✓ Branch 7 taken 607 times.
✓ Branch 8 taken 608 times.
✓ Branch 9 taken 9 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 1284 times.
✓ Branch 14 taken 625 times.
✓ Branch 15 taken 609 times.
✓ Branch 16 taken 621 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 6844 times.
19292 switch (srcFormat) {
2764 1206 case AV_PIX_FMT_BGRA64LE:
2765 1206 case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2766 1208 case AV_PIX_FMT_BGRA64BE:
2767 1208 case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2768 2566 case AV_PIX_FMT_BGRA:
2769 case AV_PIX_FMT_RGBA:
2770 2566 *alpToYV12 = rgbaToA_c;
2771 2566 break;
2772 2452 case AV_PIX_FMT_ABGR:
2773 case AV_PIX_FMT_ARGB:
2774 2452 *alpToYV12 = abgrToA_c;
2775 2452 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 653 case AV_PIX_FMT_YA8:
2783 653 *alpToYV12 = uyvyToY_c;
2784 653 break;
2785 607 case AV_PIX_FMT_YA16LE:
2786 607 *alpToYV12 = read_ya16le_alpha_c;
2787 607 break;
2788 608 case AV_PIX_FMT_YA16BE:
2789 608 *alpToYV12 = read_ya16be_alpha_c;
2790 608 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 1284 case AV_PIX_FMT_VUYA:
2804 case AV_PIX_FMT_UYVA:
2805 1284 *alpToYV12 = read_vuya_A_c;
2806 1284 break;
2807 625 case AV_PIX_FMT_AYUV:
2808 625 *alpToYV12 = read_ayuv_A_c;
2809 625 break;
2810 609 case AV_PIX_FMT_AYUV64LE:
2811 609 *alpToYV12 = read_ayuv64le_A_c;
2812 609 break;
2813 621 case AV_PIX_FMT_AYUV64BE:
2814 621 *alpToYV12 = read_ayuv64be_A_c;
2815 621 break;
2816 ✗ case AV_PIX_FMT_PAL8 :
2817 ✗ *alpToYV12 = palToA_c;
2818 ✗ break;
2819 }
2820 }
2821 102607 }
2822