FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2026-07-21 08:37:06
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 124519 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
47 enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
48 {
49 124519 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
50 int i;
51
2/2
✓ Branch 0 taken 12639104 times.
✓ Branch 1 taken 124519 times.
12763623 for (i = 0; i < width; i++) {
52
2/2
✓ Branch 0 taken 6351744 times.
✓ Branch 1 taken 6287360 times.
12639104 unsigned int r_b = input_pixel(&src[i*4+0]);
53
2/2
✓ Branch 0 taken 6351744 times.
✓ Branch 1 taken 6287360 times.
12639104 unsigned int g = input_pixel(&src[i*4+1]);
54
2/2
✓ Branch 0 taken 6351744 times.
✓ Branch 1 taken 6287360 times.
12639104 unsigned int b_r = input_pixel(&src[i*4+2]);
55
56
12/16
✓ Branch 0 taken 12639104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12639104 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9485184 times.
✓ Branch 5 taken 3153920 times.
✓ Branch 6 taken 2946048 times.
✓ Branch 7 taken 6539136 times.
✓ Branch 8 taken 12639104 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 12639104 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 9485184 times.
✓ Branch 13 taken 3153920 times.
✓ Branch 14 taken 2946048 times.
✓ Branch 15 taken 6539136 times.
12639104 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
57 }
58 124519 }
59
60 static av_always_inline void
61 124519 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 124519 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
67 124519 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 12639104 times.
✓ Branch 1 taken 124519 times.
12763623 for (i = 0; i < width; i++) {
70
2/2
✓ Branch 0 taken 6351744 times.
✓ Branch 1 taken 6287360 times.
12639104 unsigned int r_b = input_pixel(&src1[i*4+0]);
71
2/2
✓ Branch 0 taken 6351744 times.
✓ Branch 1 taken 6287360 times.
12639104 unsigned int g = input_pixel(&src1[i*4+1]);
72
2/2
✓ Branch 0 taken 6351744 times.
✓ Branch 1 taken 6287360 times.
12639104 unsigned int b_r = input_pixel(&src1[i*4+2]);
73
74
12/16
✓ Branch 0 taken 12639104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12639104 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9485184 times.
✓ Branch 5 taken 3153920 times.
✓ Branch 6 taken 2946048 times.
✓ Branch 7 taken 6539136 times.
✓ Branch 8 taken 12639104 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 12639104 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 9485184 times.
✓ Branch 13 taken 3153920 times.
✓ Branch 14 taken 2946048 times.
✓ Branch 15 taken 6539136 times.
12639104 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
75
12/16
✓ Branch 0 taken 12639104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12639104 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9485184 times.
✓ Branch 5 taken 3153920 times.
✓ Branch 6 taken 2946048 times.
✓ Branch 7 taken 6539136 times.
✓ Branch 8 taken 12639104 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 12639104 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 9485184 times.
✓ Branch 13 taken 3153920 times.
✓ Branch 14 taken 2946048 times.
✓ Branch 15 taken 6539136 times.
12639104 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
76 }
77 124519 }
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 131200 RGB64FUNCS(rgb, LE, AV_PIX_FMT_RGBA64)
130 125980 RGB64FUNCS(rgb, BE, AV_PIX_FMT_RGBA64)
131 117248 RGB64FUNCS(bgr, LE, AV_PIX_FMT_BGRA64)
132 123648 RGB64FUNCS(bgr, BE, AV_PIX_FMT_BGRA64)
133
134 1034625 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 1034625 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
140 int i;
141
2/2
✓ Branch 0 taken 334726024 times.
✓ Branch 1 taken 1034625 times.
335760649 for (i = 0; i < width; i++) {
142
2/2
✓ Branch 0 taken 6060928 times.
✓ Branch 1 taken 328665096 times.
334726024 unsigned int r_b = input_pixel(&src[i * 3 + 0]);
143
2/2
✓ Branch 0 taken 6060928 times.
✓ Branch 1 taken 328665096 times.
334726024 unsigned int g = input_pixel(&src[i * 3 + 1]);
144
2/2
✓ Branch 0 taken 6060928 times.
✓ Branch 1 taken 328665096 times.
334726024 unsigned int b_r = input_pixel(&src[i * 3 + 2]);
145
146
12/16
✓ Branch 0 taken 331584392 times.
✓ Branch 1 taken 3141632 times.
✓ Branch 2 taken 328583048 times.
✓ Branch 3 taken 3001344 times.
✓ Branch 4 taken 328583048 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 328583048 times.
✓ Branch 8 taken 331584392 times.
✓ Branch 9 taken 3141632 times.
✓ Branch 10 taken 328583048 times.
✓ Branch 11 taken 3001344 times.
✓ Branch 12 taken 328583048 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 328583048 times.
334726024 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
147 }
148 1034625 }
149
150 641949 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 641949 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
160 641949 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 197044672 times.
✓ Branch 1 taken 641949 times.
197686621 for (i = 0; i < width; i++) {
163
2/2
✓ Branch 0 taken 6060928 times.
✓ Branch 1 taken 190983744 times.
197044672 unsigned r_b = input_pixel(&src1[i * 3 + 0]);
164
2/2
✓ Branch 0 taken 6060928 times.
✓ Branch 1 taken 190983744 times.
197044672 unsigned g = input_pixel(&src1[i * 3 + 1]);
165
2/2
✓ Branch 0 taken 6060928 times.
✓ Branch 1 taken 190983744 times.
197044672 unsigned b_r = input_pixel(&src1[i * 3 + 2]);
166
167
12/16
✓ Branch 0 taken 193903040 times.
✓ Branch 1 taken 3141632 times.
✓ Branch 2 taken 190901696 times.
✓ Branch 3 taken 3001344 times.
✓ Branch 4 taken 190901696 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 190901696 times.
✓ Branch 8 taken 193903040 times.
✓ Branch 9 taken 3141632 times.
✓ Branch 10 taken 190901696 times.
✓ Branch 11 taken 3001344 times.
✓ Branch 12 taken 190901696 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 190901696 times.
197044672 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
168
12/16
✓ Branch 0 taken 193903040 times.
✓ Branch 1 taken 3141632 times.
✓ Branch 2 taken 190901696 times.
✓ Branch 3 taken 3001344 times.
✓ Branch 4 taken 190901696 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 190901696 times.
✓ Branch 8 taken 193903040 times.
✓ Branch 9 taken 3141632 times.
✓ Branch 10 taken 190901696 times.
✓ Branch 11 taken 3001344 times.
✓ Branch 12 taken 190901696 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 190901696 times.
197044672 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
169 }
170 641949 }
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 3804464 RGB48FUNCS(rgb, LE, AV_PIX_FMT_RGB48)
249 110364 RGB48FUNCS(rgb, BE, AV_PIX_FMT_RGB48)
250 118400 RGB48FUNCS(bgr, LE, AV_PIX_FMT_BGR48)
251 123264 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 1491922 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 1491922 const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
276 1491922 const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
277 int i;
278
279
2/2
✓ Branch 0 taken 421751089 times.
✓ Branch 1 taken 1491922 times.
423243011 for (i = 0; i < width; i++) {
280
14/14
✓ Branch 0 taken 224512160 times.
✓ Branch 1 taken 197238929 times.
✓ Branch 2 taken 223984864 times.
✓ Branch 3 taken 527296 times.
✓ Branch 4 taken 223566816 times.
✓ Branch 5 taken 418048 times.
✓ Branch 6 taken 492480 times.
✓ Branch 7 taken 223074336 times.
✓ Branch 8 taken 196990496 times.
✓ Branch 9 taken 26083840 times.
✓ Branch 10 taken 26251776 times.
✓ Branch 11 taken 170738720 times.
✓ Branch 12 taken 18169856 times.
✓ Branch 13 taken 152568864 times.
421751089 int px = input_pixel(i) >> shp;
281 421751089 int b = (px & maskb) >> shb;
282 421751089 int g = (px & maskg) >> shg;
283 421751089 int r = (px & maskr) >> shr;
284
285 421751089 dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
286 }
287 1491922 }
288
289 1037568 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 1037568 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
302 1037568 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
303 1037568 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
304 int i;
305
306
2/2
✓ Branch 0 taken 233004553 times.
✓ Branch 1 taken 1037568 times.
234042121 for (i = 0; i < width; i++) {
307
14/14
✓ Branch 0 taken 145660544 times.
✓ Branch 1 taken 87344009 times.
✓ Branch 2 taken 145211072 times.
✓ Branch 3 taken 449472 times.
✓ Branch 4 taken 144793024 times.
✓ Branch 5 taken 418048 times.
✓ Branch 6 taken 414912 times.
✓ Branch 7 taken 144378112 times.
✓ Branch 8 taken 118294272 times.
✓ Branch 9 taken 26083840 times.
✓ Branch 10 taken 26251776 times.
✓ Branch 11 taken 92042496 times.
✓ Branch 12 taken 16953344 times.
✓ Branch 13 taken 75089152 times.
233004553 int px = input_pixel(i) >> shp;
308 233004553 int b = (px & maskb) >> shb;
309 233004553 int g = (px & maskg) >> shg;
310 233004553 int r = (px & maskr) >> shr;
311
312 233004553 dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
313 233004553 dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
314 }
315 1037568 }
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 121472 RGB16_32FUNCS(AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
400 113920 RGB16_32FUNCS(AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
401 108288 RGB16_32FUNCS(AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
402 636032 RGB16_32FUNCS(AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
403 1158560 RGB16_32FUNCS(AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
404 119552 RGB16_32FUNCS(AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
405 126976 RGB16_32FUNCS(AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
406 117376 RGB16_32FUNCS(AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
407 114944 RGB16_32FUNCS(AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
408 115968 RGB16_32FUNCS(AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
409 118528 RGB16_32FUNCS(AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
410 120704 RGB16_32FUNCS(AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
411 375232 RGB16_32FUNCS(AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
412 381504 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 61920 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 61920 int16_t *dst = (int16_t *)_dst;
438 61920 const uint16_t *src = (const uint16_t *)_src;
439 int i;
440
2/2
✓ Branch 0 taken 6268928 times.
✓ Branch 1 taken 61920 times.
6330848 for (i = 0; i < width; i++)
441 6268928 dst[i] = AV_RL16(src + 4 * i + 3);
442 61920 }
443
444 62272 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 62272 int16_t *dst = (int16_t *)_dst;
448 62272 const uint16_t *src = (const uint16_t *)_src;
449 int i;
450
2/2
✓ Branch 0 taken 6334464 times.
✓ Branch 1 taken 62272 times.
6396736 for (i = 0; i < width; i++)
451 6334464 dst[i] = AV_RB16(src + 4 * i + 3);
452 62272 }
453
454 112143 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 112143 int16_t *dst = (int16_t *)_dst;
458 int i;
459
2/2
✓ Branch 0 taken 11413248 times.
✓ Branch 1 taken 112143 times.
11525391 for (i=0; i<width; i++) {
460 11413248 dst[i]= src[4*i]<<6 | src[4*i]>>2;
461 }
462 112143 }
463
464 214602 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 214602 int16_t *dst = (int16_t *)_dst;
468 int i;
469
2/2
✓ Branch 0 taken 79497864 times.
✓ Branch 1 taken 214602 times.
79712466 for (i=0; i<width; i++) {
470 79497864 dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
471 }
472 214602 }
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 301223 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 301223 int16_t *dst = (int16_t *)_dst;
490 int i;
491
2/2
✓ Branch 0 taken 74827544 times.
✓ Branch 1 taken 301223 times.
75128767 for (i = 0; i < width; i++) {
492 74827544 int d = src[i];
493
494 74827544 dst[i] = (pal[d] & 0xFF)<<6;
495 }
496 301223 }
497
498 301223 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 301223 uint16_t *dstU = (uint16_t *)_dstU;
503 301223 int16_t *dstV = (int16_t *)_dstV;
504 int i;
505 av_assert1(src1 == src2);
506
2/2
✓ Branch 0 taken 74827544 times.
✓ Branch 1 taken 301223 times.
75128767 for (i = 0; i < width; i++) {
507 74827544 int p = pal[src1[i]];
508
509 74827544 dstU[i] = (uint8_t)(p>> 8)<<6;
510 74827544 dstV[i] = (uint8_t)(p>>16)<<6;
511 }
512 301223 }
513
514 132216 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 132216 int16_t *dst = (int16_t *)_dst;
518 int i, j;
519 132216 width = (width + 7) >> 3;
520
2/2
✓ Branch 0 taken 4464220 times.
✓ Branch 1 taken 132216 times.
4596436 for (i = 0; i < width; i++) {
521 4464220 int d = ~src[i];
522
2/2
✓ Branch 0 taken 35713760 times.
✓ Branch 1 taken 4464220 times.
40177980 for (j = 0; j < 8; j++)
523 35713760 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
524 }
525
2/2
✓ Branch 0 taken 119384 times.
✓ Branch 1 taken 12832 times.
132216 if(width&7){
526 119384 int d= ~src[i];
527
2/2
✓ Branch 0 taken 500236 times.
✓ Branch 1 taken 119384 times.
619620 for (j = 0; j < (width&7); j++)
528 500236 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
529 }
530 132216 }
531
532 119682 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 119682 int16_t *dst = (int16_t *)_dst;
536 int i, j;
537 119682 width = (width + 7) >> 3;
538
2/2
✓ Branch 0 taken 4388440 times.
✓ Branch 1 taken 119682 times.
4508122 for (i = 0; i < width; i++) {
539 4388440 int d = src[i];
540
2/2
✓ Branch 0 taken 35107520 times.
✓ Branch 1 taken 4388440 times.
39495960 for (j = 0; j < 8; j++)
541 35107520 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
542 }
543
2/2
✓ Branch 0 taken 108226 times.
✓ Branch 1 taken 11456 times.
119682 if(width&7){
544 108226 int d = src[i];
545
2/2
✓ Branch 0 taken 432904 times.
✓ Branch 1 taken 108226 times.
541130 for (j = 0; j < (width&7); j++)
546 432904 dst[8*i+j] = ((d>>(7-j))&1) * 16383;
547 }
548 119682 }
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 2008673 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 2008673 const uint16_t *src = (const uint16_t *)_src;
613 2008673 uint16_t *dst = (uint16_t *)_dst;
614
2/2
✓ Branch 0 taken 615367424 times.
✓ Branch 1 taken 2008673 times.
617376097 for (i = 0; i < width; i++)
615 615367424 dst[i] = av_bswap16(src[i]);
616 2008673 }
617
618 940692 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 940692 const uint16_t *src1 = (const uint16_t *)_src1,
623 940692 *src2 = (const uint16_t *)_src2;
624 940692 uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
625
2/2
✓ Branch 0 taken 210370304 times.
✓ Branch 1 taken 940692 times.
211310996 for (i = 0; i < width; i++) {
626 210370304 dstU[i] = av_bswap16(src1[i]);
627 210370304 dstV[i] = av_bswap16(src2[i]);
628 }
629 940692 }
630
631 29504 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 2975744 times.
✓ Branch 1 taken 29504 times.
3005248 for (i = 0; i < width; i++)
636 2975744 AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
637 29504 }
638
639 29504 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 2975744 times.
✓ Branch 1 taken 29504 times.
3005248 for (i = 0; i < width; i++)
644 2975744 AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
645 29504 }
646
647 30055 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 3044224 times.
✓ Branch 1 taken 30055 times.
3074279 for (i = 0; i < width; i++)
652 3044224 AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
653 30055 }
654
655 29920 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 3026944 times.
✓ Branch 1 taken 29920 times.
3056864 for (i = 0; i < width; i++)
660 3026944 AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
661 29920 }
662
663 174548 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 46777216 times.
✓ Branch 1 taken 174548 times.
46951764 for (i = 0; i < width; i++)
668 46777216 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
669 174548 }
670
671 173524 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 46687104 times.
✓ Branch 1 taken 173524 times.
46860628 for (i = 0; i < width; i++)
676 46687104 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2));
677 173524 }
678
679 174548 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 46777216 times.
✓ Branch 1 taken 174548 times.
46951764 for (i = 0; i < width; i++) {
684 46777216 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + u_offset));
685 46777216 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + v_offset));
686 }
687 174548 }
688
689 173524 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 46687104 times.
✓ Branch 1 taken 173524 times.
46860628 for (i = 0; i < width; i++) {
694 46687104 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + u_offset));
695 46687104 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + v_offset));
696 }
697 173524 }
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 116736 ayuv64_UV_funcs(ayuv64, 4, 6)
713 579408 ayuv64_UV_funcs(xv48, 0, 4)
714
715 29696 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 3020800 times.
✓ Branch 1 taken 29696 times.
3050496 for (i = 0; i < width; i++)
720 3020800 AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
721 29696 }
722
723 28672 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 2902016 times.
✓ Branch 1 taken 28672 times.
2930688 for (i = 0; i < width; i++)
728 2902016 AV_WN16(dst + i * 2, AV_RB16(src + i * 8));
729 28672 }
730
731 147714 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 37968576 times.
✓ Branch 1 taken 147714 times.
38116290 for (i = 0; i < width; i++) {
736 37968576 dstU[i] = src[i * 4 + 1];
737 37968576 dstV[i] = src[i * 4];
738 }
739 147714 }
740
741 147714 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 37968576 times.
✓ Branch 1 taken 147714 times.
38116290 for (i = 0; i < width; i++)
746 37968576 dst[i] = src[i * 4 + 2];
747 147714 }
748
749 55520 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 5693440 times.
✓ Branch 1 taken 55520 times.
5748960 for (i = 0; i < width; i++)
754 5693440 dst[i] = src[i * 4 + 3];
755 55520 }
756
757 27840 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 2738176 times.
✓ Branch 1 taken 27840 times.
2766016 for (i = 0; i < width; i++) {
762 2738176 dstU[i] = src[i * 4 + 2];
763 2738176 dstV[i] = src[i * 4 + 3];
764 }
765 27840 }
766
767 102116 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 20978120 times.
✓ Branch 1 taken 102116 times.
21080236 for (i = 0; i < width; i++)
772 20978120 dst[i] = src[i * 4 + 1];
773 102116 }
774
775 27840 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 2738176 times.
✓ Branch 1 taken 27840 times.
2766016 for (i = 0; i < width; i++)
780 2738176 dst[i] = src[i * 4];
781 27840 }
782
783 51826 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 10607844 times.
✓ Branch 1 taken 51826 times.
10659670 for (i = 0; i < width; i++) {
788 10607844 dstU[i] = src[i * 4];
789 10607844 dstV[i] = src[i * 4 + 2];
790 }
791 51826 }
792
793 165990 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 50449544 times.
✓ Branch 1 taken 165990 times.
50615534 for (i = 0; i < width; i++)
798 50449544 dst[i] = src[i * 3 + 1];
799 165990 }
800
801 143540 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 42817444 times.
✓ Branch 1 taken 143540 times.
42960984 for (i = 0; i < width; i++) {
806 42817444 dstU[i] = src[i * 3 + 2];
807 42817444 dstV[i] = src[i * 3];
808 }
809 143540 }
810
811 166453 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 50493320 times.
✓ Branch 1 taken 166453 times.
50659773 for (i = 0; i < width; i++)
816 50493320 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
817 166453 }
818
819
820 144003 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 42861220 times.
✓ Branch 1 taken 144003 times.
43005223 for (i = 0; i < width; i++) {
825 42861220 unsigned int uv = AV_RL32(src + i * 4);
826 42861220 AV_WN16(dstU + i * 2, (uv >> 2) & 0x3FFu);
827 42861220 AV_WN16(dstV + i * 2, (uv >> 22) & 0x3FFu);
828 }
829 144003 }
830
831 119330 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 34959040 times.
✓ Branch 1 taken 119330 times.
35078370 for (i = 0; i < width; i++)
836 34959040 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
837 119330 }
838
839
840 119330 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 34959040 times.
✓ Branch 1 taken 119330 times.
35078370 for (i = 0; i < width; i++) {
845 34959040 AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
846 34959040 AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
847 }
848 119330 }
849
850 120418 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 34991808 times.
✓ Branch 1 taken 120418 times.
35112226 for (i = 0; i < width; i++)
855 34991808 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
856 120418 }
857
858
859 120418 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 34991808 times.
✓ Branch 1 taken 120418 times.
35112226 for (i = 0; i < width; i++) {
864 34991808 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
865 34991808 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
866 }
867 120418 }
868
869 122754 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 35356352 times.
✓ Branch 1 taken 122754 times.
35479106 for (i = 0; i < width; i++)
874 35356352 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2) >> 4);
875 122754 }
876
877
878 122754 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 35356352 times.
✓ Branch 1 taken 122754 times.
35479106 for (i = 0; i < width; i++) {
883 35356352 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + 0) >> 4);
884 35356352 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + 4) >> 4);
885 }
886 122754 }
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 101011456 times.
✓ Branch 1 taken 337536 times.
202697984 shf16_wrapper(10)
1066
2/2
✓ Branch 0 taken 100892672 times.
✓ Branch 1 taken 334272 times.
202453888 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 1142898 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 1142898 int16_t *dst = (int16_t *)_dst;
1125 1142898 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1126 int i;
1127
2/2
✓ Branch 0 taken 390552672 times.
✓ Branch 1 taken 1142898 times.
391695570 for (i = 0; i < width; i++) {
1128 390552672 int r = src[i * 3 + 0];
1129 390552672 int g = src[i * 3 + 1];
1130 390552672 int b = src[i * 3 + 2];
1131
1132 390552672 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1133 }
1134 1142898 }
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 654572 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 654572 int16_t *dstU = (int16_t *)_dstU;
1159 654572 int16_t *dstV = (int16_t *)_dstV;
1160 int i;
1161 654572 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1162 654572 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 108878772 times.
✓ Branch 1 taken 654572 times.
109533344 for (i = 0; i < width; i++) {
1165 108878772 int r = src1[6 * i + 0] + src1[6 * i + 3];
1166 108878772 int g = src1[6 * i + 1] + src1[6 * i + 4];
1167 108878772 int b = src1[6 * i + 2] + src1[6 * i + 5];
1168
1169 108878772 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1170 108878772 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1171 }
1172 654572 }
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 3852760 times.
✓ Branch 1 taken 755766 times.
✓ Branch 2 taken 187675456 times.
✓ Branch 3 taken 1389638396 times.
✓ Branch 4 taken 191171968 times.
✓ Branch 5 taken 1386202156 times.
✓ Branch 6 taken 184219904 times.
✓ Branch 7 taken 1386141884 times.
✓ Branch 8 taken 1570361788 times.
✓ Branch 9 taken 4548254 times.
3163844756 shifted_planar_rgb16(16)
1282
9/10
✓ Branch 0 taken 118144 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6029312 times.
✓ Branch 3 taken 5916672 times.
✓ Branch 4 taken 6029312 times.
✓ Branch 5 taken 5916672 times.
✓ Branch 6 taken 6029312 times.
✓ Branch 7 taken 5916672 times.
✓ Branch 8 taken 11945984 times.
✓ Branch 9 taken 118144 times.
24128256 shifted_planar_rgb16_to_y_uv(12)
1283
9/10
✓ Branch 0 taken 110400 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5513216 times.
✓ Branch 3 taken 5699584 times.
✓ Branch 4 taken 5513216 times.
✓ Branch 5 taken 5699584 times.
✓ Branch 6 taken 5513216 times.
✓ Branch 7 taken 5699584 times.
✓ Branch 8 taken 11212800 times.
✓ Branch 9 taken 110400 times.
22646400 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 2400 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 2400 const float **src = (const float **)_src;
1304 2400 uint16_t *dstU = (uint16_t *)_dstU;
1305 2400 uint16_t *dstV = (uint16_t *)_dstV;
1306 2400 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1307 2400 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1308
1309
2/2
✓ Branch 0 taken 828160 times.
✓ Branch 1 taken 2400 times.
830560 for (i = 0; i < width; i++) {
1310
2/2
✓ Branch 0 taken 414080 times.
✓ Branch 1 taken 414080 times.
828160 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 414080 times.
828160 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 414080 times.
828160 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1313
1314 828160 dstU[i] = (int)((unsigned)ru*r + (unsigned)gu*g + (unsigned)bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1315 828160 dstV[i] = (int)((unsigned)rv*r + (unsigned)gv*g + (unsigned)bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1316 }
1317 2400 }
1318
1319 2400 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 2400 const float **src = (const float **)_src;
1323 2400 uint16_t *dst = (uint16_t *)_dst;
1324
1325 2400 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1326
1327
2/2
✓ Branch 0 taken 828160 times.
✓ Branch 1 taken 2400 times.
830560 for (i = 0; i < width; i++) {
1328
2/2
✓ Branch 0 taken 414080 times.
✓ Branch 1 taken 414080 times.
828160 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 414080 times.
828160 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 414080 times.
828160 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1331
1332 828160 dst[i] = (int)((unsigned)ry*r + (unsigned)gy*g + (unsigned)by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1333 }
1334 2400 }
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 1152 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 1152 const float *src = (const float *)_src;
1404 1152 uint16_t *dst = (uint16_t *)_dst;
1405
1406
2/2
✓ Branch 0 taken 405504 times.
✓ Branch 1 taken 1152 times.
406656 for (i = 0; i < width; ++i){
1407
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 202752 times.
405504 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i), 0.0f, 65535.0f));
1408 }
1409 1152 }
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 231488 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 113344 rgb9plus_planar_transparency_funcs(14)
1492 2400 rgb9plus_planar_transparency_funcs(16)
1493
1494 220800 rgb9plus_msb_planar_funcs(10)
1495 236288 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 7152 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 72740 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 72740 enum AVPixelFormat srcFormat = c->opts.src_format;
1858
1859 72740 *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 404 times.
✓ Branch 5 taken 1995 times.
✓ Branch 6 taken 842 times.
✓ Branch 7 taken 1187 times.
✓ Branch 8 taken 462 times.
✓ Branch 9 taken 1973 times.
✓ Branch 10 taken 1997 times.
✓ Branch 11 taken 737 times.
✓ Branch 12 taken 1337 times.
✓ Branch 13 taken 456 times.
✓ Branch 14 taken 384 times.
✓ Branch 15 taken 284 times.
✓ Branch 16 taken 284 times.
✓ Branch 17 taken 452 times.
✓ Branch 18 taken 1101 times.
✓ Branch 19 taken 1044 times.
✓ Branch 20 taken 709 times.
✓ Branch 21 taken 1148 times.
✓ Branch 22 taken 422 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 272 times.
✓ Branch 25 taken 300 times.
✓ Branch 26 taken 1990 times.
✓ Branch 27 taken 2681 times.
✓ Branch 28 taken 244 times.
✓ Branch 29 taken 246 times.
✓ Branch 30 taken 250 times.
✓ Branch 31 taken 229 times.
✓ Branch 32 taken 670 times.
✓ Branch 33 taken 388 times.
✓ Branch 34 taken 414 times.
✓ Branch 35 taken 279 times.
✓ Branch 36 taken 286 times.
✓ Branch 37 taken 282 times.
✓ Branch 38 taken 291 times.
✓ Branch 39 taken 399 times.
✓ Branch 40 taken 421 times.
✓ Branch 41 taken 420 times.
✓ Branch 42 taken 429 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 40412 times.
72740 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 404 case AV_PIX_FMT_VYU444:
1874 404 *chrToYV12 = vyuToUV_c;
1875 404 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 1187 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 1187 *chrToYV12 = palToUV_c;
1891 1187 break;
1892 462 case AV_PIX_FMT_GBRP9LE:
1893 462 *readChrPlanar = planar_rgb9le_to_uv;
1894 462 break;
1895 1973 case AV_PIX_FMT_GBRAP10LE:
1896 case AV_PIX_FMT_GBRP10LE:
1897 1973 *readChrPlanar = planar_rgb10le_to_uv;
1898 1973 break;
1899 1997 case AV_PIX_FMT_GBRAP12LE:
1900 case AV_PIX_FMT_GBRP12LE:
1901 1997 *readChrPlanar = planar_rgb12le_to_uv;
1902 1997 break;
1903 737 case AV_PIX_FMT_GBRAP14LE:
1904 case AV_PIX_FMT_GBRP14LE:
1905 737 *readChrPlanar = planar_rgb14le_to_uv;
1906 737 break;
1907 1337 case AV_PIX_FMT_GBRAP16LE:
1908 case AV_PIX_FMT_GBRP16LE:
1909 1337 *readChrPlanar = planar_rgb16le_to_uv;
1910 1337 break;
1911 456 case AV_PIX_FMT_GBRAPF32LE:
1912 case AV_PIX_FMT_GBRPF32LE:
1913 456 *readChrPlanar = planar_rgbf32le_to_uv;
1914 456 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 284 case AV_PIX_FMT_GBRP10MSBLE:
1920 284 *readChrPlanar = msb_planar_rgb10le_to_uv;
1921 284 break;
1922 284 case AV_PIX_FMT_GBRP12MSBLE:
1923 284 *readChrPlanar = msb_planar_rgb12le_to_uv;
1924 284 break;
1925 452 case AV_PIX_FMT_GBRP9BE:
1926 452 *readChrPlanar = planar_rgb9be_to_uv;
1927 452 break;
1928 1101 case AV_PIX_FMT_GBRAP10BE:
1929 case AV_PIX_FMT_GBRP10BE:
1930 1101 *readChrPlanar = planar_rgb10be_to_uv;
1931 1101 break;
1932 1044 case AV_PIX_FMT_GBRAP12BE:
1933 case AV_PIX_FMT_GBRP12BE:
1934 1044 *readChrPlanar = planar_rgb12be_to_uv;
1935 1044 break;
1936 709 case AV_PIX_FMT_GBRAP14BE:
1937 case AV_PIX_FMT_GBRP14BE:
1938 709 *readChrPlanar = planar_rgb14be_to_uv;
1939 709 break;
1940 1148 case AV_PIX_FMT_GBRAP16BE:
1941 case AV_PIX_FMT_GBRP16BE:
1942 1148 *readChrPlanar = planar_rgb16be_to_uv;
1943 1148 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 272 case AV_PIX_FMT_GBRP10MSBBE:
1953 272 *readChrPlanar = msb_planar_rgb10be_to_uv;
1954 272 break;
1955 300 case AV_PIX_FMT_GBRP12MSBBE:
1956 300 *readChrPlanar = msb_planar_rgb12be_to_uv;
1957 300 break;
1958 1990 case AV_PIX_FMT_GBRAP:
1959 case AV_PIX_FMT_GBRP:
1960 1990 *readChrPlanar = planar_rgb_to_uv;
1961 1990 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 2681 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 2681 *chrToYV12 = bswap16UV_c;
2025 2681 break;
2026 #endif
2027 244 case AV_PIX_FMT_YUV444P10MSBLE:
2028 244 *chrToYV12 = shf16_10LEToUV_c;
2029 244 break;
2030 246 case AV_PIX_FMT_YUV444P12MSBLE:
2031 246 *chrToYV12 = shf16_12LEToUV_c;
2032 246 break;
2033 250 case AV_PIX_FMT_YUV444P10MSBBE:
2034 250 *chrToYV12 = shf16_10BEToUV_c;
2035 250 break;
2036 229 case AV_PIX_FMT_YUV444P12MSBBE:
2037 229 *chrToYV12 = shf16_12BEToUV_c;
2038 229 break;
2039 670 case AV_PIX_FMT_VUYA:
2040 case AV_PIX_FMT_VUYX:
2041 670 *chrToYV12 = read_vuyx_UV_c;
2042 670 break;
2043 388 case AV_PIX_FMT_XV30LE:
2044 388 *chrToYV12 = read_xv30le_UV_c;
2045 388 break;
2046 414 case AV_PIX_FMT_V30XLE:
2047 414 *chrToYV12 = read_v30xle_UV_c;
2048 414 break;
2049 279 case AV_PIX_FMT_AYUV:
2050 279 *chrToYV12 = read_ayuv_UV_c;
2051 279 break;
2052 286 case AV_PIX_FMT_AYUV64LE:
2053 286 *chrToYV12 = read_ayuv64le_UV_c;
2054 286 break;
2055 282 case AV_PIX_FMT_AYUV64BE:
2056 282 *chrToYV12 = read_ayuv64be_UV_c;
2057 282 break;
2058 291 case AV_PIX_FMT_UYVA:
2059 291 *chrToYV12 = read_uyva_UV_c;
2060 291 break;
2061 399 case AV_PIX_FMT_XV36LE:
2062 399 *chrToYV12 = read_xv36le_UV_c;
2063 399 break;
2064 421 case AV_PIX_FMT_XV36BE:
2065 421 *chrToYV12 = read_xv36be_UV_c;
2066 421 break;
2067 420 case AV_PIX_FMT_XV48LE:
2068 420 *chrToYV12 = read_xv48le_UV_c;
2069 420 break;
2070 429 case AV_PIX_FMT_XV48BE:
2071 429 *chrToYV12 = read_xv48be_UV_c;
2072 429 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 26851 times.
✓ Branch 1 taken 45889 times.
72740 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 535 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 24770 times.
26851 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 535 case AV_PIX_FMT_RGB24:
2189 535 *chrToYV12 = rgb24ToUV_half_c;
2190 535 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 311 times.
✓ Branch 1 taken 322 times.
✓ Branch 2 taken 299 times.
✓ Branch 3 taken 287 times.
✓ Branch 4 taken 281 times.
✓ Branch 5 taken 918 times.
✓ Branch 6 taken 304 times.
✓ Branch 7 taken 294 times.
✓ Branch 8 taken 826 times.
✓ Branch 9 taken 611 times.
✓ Branch 10 taken 400 times.
✓ Branch 11 taken 297 times.
✓ Branch 12 taken 312 times.
✓ Branch 13 taken 277 times.
✓ Branch 14 taken 283 times.
✓ Branch 15 taken 268 times.
✓ Branch 16 taken 281 times.
✓ Branch 17 taken 630 times.
✓ Branch 18 taken 565 times.
✓ Branch 19 taken 954 times.
✓ Branch 20 taken 410 times.
✓ Branch 21 taken 290 times.
✓ Branch 22 taken 381 times.
✓ Branch 23 taken 285 times.
✓ Branch 24 taken 299 times.
✓ Branch 25 taken 298 times.
✓ Branch 26 taken 354 times.
✓ Branch 27 taken 366 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 34486 times.
45889 switch (srcFormat) {
2236 311 case AV_PIX_FMT_RGBA64BE:
2237 311 *chrToYV12 = rgb64BEToUV_c;
2238 311 break;
2239 322 case AV_PIX_FMT_RGBA64LE:
2240 322 *chrToYV12 = rgb64LEToUV_c;
2241 322 break;
2242 299 case AV_PIX_FMT_BGRA64BE:
2243 299 *chrToYV12 = bgr64BEToUV_c;
2244 299 break;
2245 287 case AV_PIX_FMT_BGRA64LE:
2246 287 *chrToYV12 = bgr64LEToUV_c;
2247 287 break;
2248 281 case AV_PIX_FMT_RGB48BE:
2249 281 *chrToYV12 = rgb48BEToUV_c;
2250 281 break;
2251 918 case AV_PIX_FMT_RGB48LE:
2252 918 *chrToYV12 = rgb48LEToUV_c;
2253 918 break;
2254 304 case AV_PIX_FMT_BGR48BE:
2255 304 *chrToYV12 = bgr48BEToUV_c;
2256 304 break;
2257 294 case AV_PIX_FMT_BGR48LE:
2258 294 *chrToYV12 = bgr48LEToUV_c;
2259 294 break;
2260 826 case AV_PIX_FMT_RGB32:
2261 826 *chrToYV12 = bgr32ToUV_c;
2262 826 break;
2263 611 case AV_PIX_FMT_RGB32_1:
2264 611 *chrToYV12 = bgr321ToUV_c;
2265 611 break;
2266 400 case AV_PIX_FMT_BGR24:
2267 400 *chrToYV12 = bgr24ToUV_c;
2268 400 break;
2269 297 case AV_PIX_FMT_BGR565LE:
2270 297 *chrToYV12 = bgr16leToUV_c;
2271 297 break;
2272 312 case AV_PIX_FMT_BGR565BE:
2273 312 *chrToYV12 = bgr16beToUV_c;
2274 312 break;
2275 277 case AV_PIX_FMT_BGR555LE:
2276 277 *chrToYV12 = bgr15leToUV_c;
2277 277 break;
2278 283 case AV_PIX_FMT_BGR555BE:
2279 283 *chrToYV12 = bgr15beToUV_c;
2280 283 break;
2281 268 case AV_PIX_FMT_BGR444LE:
2282 268 *chrToYV12 = bgr12leToUV_c;
2283 268 break;
2284 281 case AV_PIX_FMT_BGR444BE:
2285 281 *chrToYV12 = bgr12beToUV_c;
2286 281 break;
2287 630 case AV_PIX_FMT_BGR32:
2288 630 *chrToYV12 = rgb32ToUV_c;
2289 630 break;
2290 565 case AV_PIX_FMT_BGR32_1:
2291 565 *chrToYV12 = rgb321ToUV_c;
2292 565 break;
2293 954 case AV_PIX_FMT_RGB24:
2294 954 *chrToYV12 = rgb24ToUV_c;
2295 954 break;
2296 410 case AV_PIX_FMT_RGB565LE:
2297 410 *chrToYV12 = rgb16leToUV_c;
2298 410 break;
2299 290 case AV_PIX_FMT_RGB565BE:
2300 290 *chrToYV12 = rgb16beToUV_c;
2301 290 break;
2302 381 case AV_PIX_FMT_RGB555LE:
2303 381 *chrToYV12 = rgb15leToUV_c;
2304 381 break;
2305 285 case AV_PIX_FMT_RGB555BE:
2306 285 *chrToYV12 = rgb15beToUV_c;
2307 285 break;
2308 299 case AV_PIX_FMT_RGB444LE:
2309 299 *chrToYV12 = rgb12leToUV_c;
2310 299 break;
2311 298 case AV_PIX_FMT_RGB444BE:
2312 298 *chrToYV12 = rgb12beToUV_c;
2313 298 break;
2314 354 case AV_PIX_FMT_X2RGB10LE:
2315 354 *chrToYV12 = rgb30leToUV_c;
2316 354 break;
2317 366 case AV_PIX_FMT_X2BGR10LE:
2318 366 *chrToYV12 = bgr30leToUV_c;
2319 366 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 72740 *lumToYV12 = NULL;
2336 72740 *alpToYV12 = NULL;
2337
94/107
✓ Branch 0 taken 462 times.
✓ Branch 1 taken 533 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 547 times.
✓ Branch 4 taken 1450 times.
✓ Branch 5 taken 275 times.
✓ Branch 6 taken 462 times.
✓ Branch 7 taken 572 times.
✓ Branch 8 taken 765 times.
✓ Branch 9 taken 253 times.
✓ Branch 10 taken 203 times.
✓ Branch 11 taken 115 times.
✓ Branch 12 taken 269 times.
✓ Branch 13 taken 284 times.
✓ Branch 14 taken 284 times.
✓ Branch 15 taken 452 times.
✓ Branch 16 taken 542 times.
✓ Branch 17 taken 559 times.
✓ Branch 18 taken 516 times.
✓ Branch 19 taken 528 times.
✓ Branch 20 taken 276 times.
✓ Branch 21 taken 433 times.
✓ Branch 22 taken 549 times.
✓ Branch 23 taken 599 times.
✓ Branch 24 taken 253 times.
✓ Branch 25 taken 169 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 272 times.
✓ Branch 29 taken 300 times.
✓ Branch 30 taken 598 times.
✓ Branch 31 taken 1392 times.
✓ Branch 32 taken 4241 times.
✓ Branch 33 taken 662 times.
✓ Branch 34 taken 244 times.
✓ Branch 35 taken 246 times.
✓ Branch 36 taken 250 times.
✓ Branch 37 taken 229 times.
✓ Branch 38 taken 295 times.
✓ Branch 39 taken 289 times.
✓ Branch 40 taken 9 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 670 times.
✓ Branch 43 taken 388 times.
✓ Branch 44 taken 414 times.
✓ Branch 45 taken 570 times.
✓ Branch 46 taken 706 times.
✓ Branch 47 taken 711 times.
✓ Branch 48 taken 399 times.
✓ Branch 49 taken 421 times.
✓ Branch 50 taken 543 times.
✓ Branch 51 taken 112 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 404 times.
✓ Branch 54 taken 458 times.
✓ Branch 55 taken 298 times.
✓ Branch 56 taken 313 times.
✓ Branch 57 taken 278 times.
✓ Branch 58 taken 284 times.
✓ Branch 59 taken 269 times.
✓ Branch 60 taken 282 times.
✓ Branch 61 taken 1489 times.
✓ Branch 62 taken 415 times.
✓ Branch 63 taken 291 times.
✓ Branch 64 taken 397 times.
✓ Branch 65 taken 286 times.
✓ Branch 66 taken 300 times.
✓ Branch 67 taken 299 times.
✓ Branch 68 taken 1187 times.
✓ Branch 69 taken 396 times.
✓ Branch 70 taken 405 times.
✓ Branch 71 taken 886 times.
✓ Branch 72 taken 639 times.
✓ Branch 73 taken 696 times.
✓ Branch 74 taken 603 times.
✓ Branch 75 taken 281 times.
✓ Branch 76 taken 1342 times.
✓ Branch 77 taken 304 times.
✓ Branch 78 taken 294 times.
✓ Branch 79 taken 311 times.
✓ Branch 80 taken 322 times.
✓ Branch 81 taken 299 times.
✓ Branch 82 taken 287 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 1 times.
✓ Branch 90 taken 1 times.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✓ Branch 93 taken 18 times.
✗ Branch 94 not taken.
✓ Branch 95 taken 111 times.
✓ Branch 96 taken 111 times.
✓ Branch 97 taken 141 times.
✓ Branch 98 taken 354 times.
✓ Branch 99 taken 366 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 27597 times.
72740 switch (srcFormat) {
2338 462 case AV_PIX_FMT_GBRP9LE:
2339 462 *readLumPlanar = planar_rgb9le_to_y;
2340 462 break;
2341 533 case AV_PIX_FMT_GBRAP10LE:
2342 533 *readAlpPlanar = planar_rgb10le_to_a;
2343 av_fallthrough;
2344 1973 case AV_PIX_FMT_GBRP10LE:
2345 1973 *readLumPlanar = planar_rgb10le_to_y;
2346 1973 break;
2347 547 case AV_PIX_FMT_GBRAP12LE:
2348 547 *readAlpPlanar = planar_rgb12le_to_a;
2349 av_fallthrough;
2350 1997 case AV_PIX_FMT_GBRP12LE:
2351 1997 *readLumPlanar = planar_rgb12le_to_y;
2352 1997 break;
2353 275 case AV_PIX_FMT_GBRAP14LE:
2354 275 *readAlpPlanar = planar_rgb14le_to_a;
2355 av_fallthrough;
2356 737 case AV_PIX_FMT_GBRP14LE:
2357 737 *readLumPlanar = planar_rgb14le_to_y;
2358 737 break;
2359 572 case AV_PIX_FMT_GBRAP16LE:
2360 572 *readAlpPlanar = planar_rgb16le_to_a;
2361 av_fallthrough;
2362 1337 case AV_PIX_FMT_GBRP16LE:
2363 1337 *readLumPlanar = planar_rgb16le_to_y;
2364 1337 break;
2365 253 case AV_PIX_FMT_GBRAPF32LE:
2366 253 *readAlpPlanar = planar_rgbf32le_to_a;
2367 av_fallthrough;
2368 456 case AV_PIX_FMT_GBRPF32LE:
2369 456 *readLumPlanar = planar_rgbf32le_to_y;
2370 456 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 284 case AV_PIX_FMT_GBRP10MSBLE:
2378 284 *readLumPlanar = msb_planar_rgb10le_to_y;
2379 284 break;
2380 284 case AV_PIX_FMT_GBRP12MSBLE:
2381 284 *readLumPlanar = msb_planar_rgb12le_to_y;
2382 284 break;
2383 452 case AV_PIX_FMT_GBRP9BE:
2384 452 *readLumPlanar = planar_rgb9be_to_y;
2385 452 break;
2386 542 case AV_PIX_FMT_GBRAP10BE:
2387 542 *readAlpPlanar = planar_rgb10be_to_a;
2388 av_fallthrough;
2389 1101 case AV_PIX_FMT_GBRP10BE:
2390 1101 *readLumPlanar = planar_rgb10be_to_y;
2391 1101 break;
2392 516 case AV_PIX_FMT_GBRAP12BE:
2393 516 *readAlpPlanar = planar_rgb12be_to_a;
2394 av_fallthrough;
2395 1044 case AV_PIX_FMT_GBRP12BE:
2396 1044 *readLumPlanar = planar_rgb12be_to_y;
2397 1044 break;
2398 276 case AV_PIX_FMT_GBRAP14BE:
2399 276 *readAlpPlanar = planar_rgb14be_to_a;
2400 av_fallthrough;
2401 709 case AV_PIX_FMT_GBRP14BE:
2402 709 *readLumPlanar = planar_rgb14be_to_y;
2403 709 break;
2404 549 case AV_PIX_FMT_GBRAP16BE:
2405 549 *readAlpPlanar = planar_rgb16be_to_a;
2406 av_fallthrough;
2407 1148 case AV_PIX_FMT_GBRP16BE:
2408 1148 *readLumPlanar = planar_rgb16be_to_y;
2409 1148 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 272 case AV_PIX_FMT_GBRP10MSBBE:
2423 272 *readLumPlanar = msb_planar_rgb10be_to_y;
2424 272 break;
2425 300 case AV_PIX_FMT_GBRP12MSBBE:
2426 300 *readLumPlanar = msb_planar_rgb12be_to_y;
2427 300 break;
2428 598 case AV_PIX_FMT_GBRAP:
2429 598 *readAlpPlanar = planar_rgb_to_a;
2430 av_fallthrough;
2431 1990 case AV_PIX_FMT_GBRP:
2432 1990 *readLumPlanar = planar_rgb_to_y;
2433 1990 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 4241 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 4241 *lumToYV12 = bswap16Y_c;
2507 4241 break;
2508 662 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 662 *lumToYV12 = bswap16Y_c;
2520 662 *alpToYV12 = bswap16Y_c;
2521 662 break;
2522 #endif
2523 244 case AV_PIX_FMT_YUV444P10MSBLE:
2524 244 *lumToYV12 = shf16_10LEToY_c;
2525 244 break;
2526 246 case AV_PIX_FMT_YUV444P12MSBLE:
2527 246 *lumToYV12 = shf16_12LEToY_c;
2528 246 break;
2529 250 case AV_PIX_FMT_YUV444P10MSBBE:
2530 250 *lumToYV12 = shf16_10BEToY_c;
2531 250 break;
2532 229 case AV_PIX_FMT_YUV444P12MSBBE:
2533 229 *lumToYV12 = shf16_12BEToY_c;
2534 229 break;
2535 295 case AV_PIX_FMT_YA16LE:
2536 295 *lumToYV12 = read_ya16le_gray_c;
2537 295 break;
2538 289 case AV_PIX_FMT_YA16BE:
2539 289 *lumToYV12 = read_ya16be_gray_c;
2540 289 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 670 case AV_PIX_FMT_VUYA:
2548 case AV_PIX_FMT_VUYX:
2549 670 *lumToYV12 = read_vuyx_Y_c;
2550 670 break;
2551 388 case AV_PIX_FMT_XV30LE:
2552 388 *lumToYV12 = read_xv30le_Y_c;
2553 388 break;
2554 414 case AV_PIX_FMT_V30XLE:
2555 414 *lumToYV12 = read_v30xle_Y_c;
2556 414 break;
2557 570 case AV_PIX_FMT_AYUV:
2558 case AV_PIX_FMT_UYVA:
2559 570 *lumToYV12 = read_ayuv_Y_c;
2560 570 break;
2561 706 case AV_PIX_FMT_AYUV64LE:
2562 case AV_PIX_FMT_XV48LE:
2563 706 *lumToYV12 = read_ayuv64le_Y_c;
2564 706 break;
2565 711 case AV_PIX_FMT_AYUV64BE:
2566 case AV_PIX_FMT_XV48BE:
2567 711 *lumToYV12 = read_ayuv64be_Y_c;
2568 711 break;
2569 399 case AV_PIX_FMT_XV36LE:
2570 399 *lumToYV12 = read_xv36le_Y_c;
2571 399 break;
2572 421 case AV_PIX_FMT_XV36BE:
2573 421 *lumToYV12 = read_xv36be_Y_c;
2574 421 break;
2575 543 case AV_PIX_FMT_YUYV422:
2576 case AV_PIX_FMT_YVYU422:
2577 case AV_PIX_FMT_YA8:
2578 543 *lumToYV12 = yuy2ToY_c;
2579 543 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 404 case AV_PIX_FMT_VYU444:
2587 404 *lumToYV12 = vyuToY_c;
2588 404 break;
2589 458 case AV_PIX_FMT_BGR24:
2590 458 *lumToYV12 = bgr24ToY_c;
2591 458 break;
2592 298 case AV_PIX_FMT_BGR565LE:
2593 298 *lumToYV12 = bgr16leToY_c;
2594 298 break;
2595 313 case AV_PIX_FMT_BGR565BE:
2596 313 *lumToYV12 = bgr16beToY_c;
2597 313 break;
2598 278 case AV_PIX_FMT_BGR555LE:
2599 278 *lumToYV12 = bgr15leToY_c;
2600 278 break;
2601 284 case AV_PIX_FMT_BGR555BE:
2602 284 *lumToYV12 = bgr15beToY_c;
2603 284 break;
2604 269 case AV_PIX_FMT_BGR444LE:
2605 269 *lumToYV12 = bgr12leToY_c;
2606 269 break;
2607 282 case AV_PIX_FMT_BGR444BE:
2608 282 *lumToYV12 = bgr12beToY_c;
2609 282 break;
2610 1489 case AV_PIX_FMT_RGB24:
2611 1489 *lumToYV12 = rgb24ToY_c;
2612 1489 break;
2613 415 case AV_PIX_FMT_RGB565LE:
2614 415 *lumToYV12 = rgb16leToY_c;
2615 415 break;
2616 291 case AV_PIX_FMT_RGB565BE:
2617 291 *lumToYV12 = rgb16beToY_c;
2618 291 break;
2619 397 case AV_PIX_FMT_RGB555LE:
2620 397 *lumToYV12 = rgb15leToY_c;
2621 397 break;
2622 286 case AV_PIX_FMT_RGB555BE:
2623 286 *lumToYV12 = rgb15beToY_c;
2624 286 break;
2625 300 case AV_PIX_FMT_RGB444LE:
2626 300 *lumToYV12 = rgb12leToY_c;
2627 300 break;
2628 299 case AV_PIX_FMT_RGB444BE:
2629 299 *lumToYV12 = rgb12beToY_c;
2630 299 break;
2631 1187 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 1187 *lumToYV12 = palToY_c;
2637 1187 break;
2638 396 case AV_PIX_FMT_MONOBLACK:
2639 396 *lumToYV12 = monoblack2Y_c;
2640 396 break;
2641 405 case AV_PIX_FMT_MONOWHITE:
2642 405 *lumToYV12 = monowhite2Y_c;
2643 405 break;
2644 886 case AV_PIX_FMT_RGB32:
2645 886 *lumToYV12 = bgr32ToY_c;
2646 886 break;
2647 639 case AV_PIX_FMT_RGB32_1:
2648 639 *lumToYV12 = bgr321ToY_c;
2649 639 break;
2650 696 case AV_PIX_FMT_BGR32:
2651 696 *lumToYV12 = rgb32ToY_c;
2652 696 break;
2653 603 case AV_PIX_FMT_BGR32_1:
2654 603 *lumToYV12 = rgb321ToY_c;
2655 603 break;
2656 281 case AV_PIX_FMT_RGB48BE:
2657 281 *lumToYV12 = rgb48BEToY_c;
2658 281 break;
2659 1342 case AV_PIX_FMT_RGB48LE:
2660 1342 *lumToYV12 = rgb48LEToY_c;
2661 1342 break;
2662 304 case AV_PIX_FMT_BGR48BE:
2663 304 *lumToYV12 = bgr48BEToY_c;
2664 304 break;
2665 294 case AV_PIX_FMT_BGR48LE:
2666 294 *lumToYV12 = bgr48LEToY_c;
2667 294 break;
2668 311 case AV_PIX_FMT_RGBA64BE:
2669 311 *lumToYV12 = rgb64BEToY_c;
2670 311 break;
2671 322 case AV_PIX_FMT_RGBA64LE:
2672 322 *lumToYV12 = rgb64LEToY_c;
2673 322 break;
2674 299 case AV_PIX_FMT_BGRA64BE:
2675 299 *lumToYV12 = bgr64BEToY_c;
2676 299 break;
2677 287 case AV_PIX_FMT_BGRA64LE:
2678 287 *lumToYV12 = bgr64LEToY_c;
2679 287 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 1 case AV_PIX_FMT_GRAYF32LE:
2707 1 *lumToYV12 = grayf32leToY16_c;
2708 1 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 354 case AV_PIX_FMT_X2RGB10LE:
2734 354 *lumToYV12 = rgb30leToY_c;
2735 354 break;
2736 366 case AV_PIX_FMT_X2BGR10LE:
2737 366 *lumToYV12 = bgr30leToY_c;
2738 366 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 10225 times.
✓ Branch 1 taken 62515 times.
72740 if (c->needAlpha) {
2759
4/4
✓ Branch 1 taken 6808 times.
✓ Branch 2 taken 3417 times.
✓ Branch 4 taken 2686 times.
✓ Branch 5 taken 4122 times.
10225 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
2760
4/4
✓ Branch 1 taken 2950 times.
✓ Branch 2 taken 3153 times.
✓ Branch 3 taken 1823 times.
✓ Branch 4 taken 1127 times.
6103 if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
2761 1823 *alpToYV12 = bswap16Y_c;
2762 }
2763
13/19
✓ Branch 0 taken 607 times.
✓ Branch 1 taken 600 times.
✓ Branch 2 taken 1336 times.
✓ Branch 3 taken 1126 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 299 times.
✓ Branch 7 taken 295 times.
✓ Branch 8 taken 279 times.
✓ Branch 9 taken 9 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 553 times.
✓ Branch 14 taken 279 times.
✓ Branch 15 taken 286 times.
✓ Branch 16 taken 282 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 4274 times.
10225 switch (srcFormat) {
2764 607 case AV_PIX_FMT_BGRA64LE:
2765 607 case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2766 600 case AV_PIX_FMT_BGRA64BE:
2767 600 case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2768 1336 case AV_PIX_FMT_BGRA:
2769 case AV_PIX_FMT_RGBA:
2770 1336 *alpToYV12 = rgbaToA_c;
2771 1336 break;
2772 1126 case AV_PIX_FMT_ABGR:
2773 case AV_PIX_FMT_ARGB:
2774 1126 *alpToYV12 = abgrToA_c;
2775 1126 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 299 case AV_PIX_FMT_YA8:
2783 299 *alpToYV12 = uyvyToY_c;
2784 299 break;
2785 295 case AV_PIX_FMT_YA16LE:
2786 295 *alpToYV12 = read_ya16le_alpha_c;
2787 295 break;
2788 279 case AV_PIX_FMT_YA16BE:
2789 279 *alpToYV12 = read_ya16be_alpha_c;
2790 279 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 553 case AV_PIX_FMT_VUYA:
2804 case AV_PIX_FMT_UYVA:
2805 553 *alpToYV12 = read_vuya_A_c;
2806 553 break;
2807 279 case AV_PIX_FMT_AYUV:
2808 279 *alpToYV12 = read_ayuv_A_c;
2809 279 break;
2810 286 case AV_PIX_FMT_AYUV64LE:
2811 286 *alpToYV12 = read_ayuv64le_A_c;
2812 286 break;
2813 282 case AV_PIX_FMT_AYUV64BE:
2814 282 *alpToYV12 = read_ayuv64be_A_c;
2815 282 break;
2816 case AV_PIX_FMT_PAL8 :
2817 *alpToYV12 = palToA_c;
2818 break;
2819 }
2820 }
2821 72740 }
2822