FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2025-03-08 20:38:41
Exec Total Coverage
Lines: 1086 1317 82.5%
Functions: 194 246 78.9%
Branches: 579 810 71.5%

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 <stdint.h>
23 #include <stdio.h>
24
25 #include "libavutil/bswap.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/avassert.h"
28 #include "config.h"
29 #include "swscale_internal.h"
30
31 #define input_pixel(pos) (is_be ? AV_RB16(pos) : AV_RL16(pos))
32
33 #define IS_BE_LE 0
34 #define IS_BE_BE 1
35 #define IS_BE_ 0
36 /* ENDIAN_IDENTIFIER needs to be "BE", "LE" or "". The latter is intended
37 * for single-byte cases where the concept of endianness does not apply. */
38 #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
39
40 #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)
41 #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)
42
43 static av_always_inline void
44 1479 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
45 enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
46 {
47 1479 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
48 int i;
49
2/2
✓ Branch 0 taken 441216 times.
✓ Branch 1 taken 1479 times.
442695 for (i = 0; i < width; i++) {
50
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int r_b = input_pixel(&src[i*4+0]);
51
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int g = input_pixel(&src[i*4+1]);
52
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int b_r = input_pixel(&src[i*4+2]);
53
54
12/16
✓ Branch 0 taken 441216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 441216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339840 times.
✓ Branch 5 taken 101376 times.
✓ Branch 6 taken 110592 times.
✓ Branch 7 taken 229248 times.
✓ Branch 8 taken 441216 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 441216 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 339840 times.
✓ Branch 13 taken 101376 times.
✓ Branch 14 taken 110592 times.
✓ Branch 15 taken 229248 times.
441216 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
55 }
56 1479 }
57
58 static av_always_inline void
59 1479 rgb64ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
60 const uint16_t *src1, const uint16_t *src2,
61 int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
62 {
63 int i;
64 1479 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
65 1479 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
66 av_assert1(src1==src2);
67
2/2
✓ Branch 0 taken 441216 times.
✓ Branch 1 taken 1479 times.
442695 for (i = 0; i < width; i++) {
68
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int r_b = input_pixel(&src1[i*4+0]);
69
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int g = input_pixel(&src1[i*4+1]);
70
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int b_r = input_pixel(&src1[i*4+2]);
71
72
12/16
✓ Branch 0 taken 441216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 441216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339840 times.
✓ Branch 5 taken 101376 times.
✓ Branch 6 taken 110592 times.
✓ Branch 7 taken 229248 times.
✓ Branch 8 taken 441216 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 441216 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 339840 times.
✓ Branch 13 taken 101376 times.
✓ Branch 14 taken 110592 times.
✓ Branch 15 taken 229248 times.
441216 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
73
12/16
✓ Branch 0 taken 441216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 441216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339840 times.
✓ Branch 5 taken 101376 times.
✓ Branch 6 taken 110592 times.
✓ Branch 7 taken 229248 times.
✓ Branch 8 taken 441216 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 441216 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 339840 times.
✓ Branch 13 taken 101376 times.
✓ Branch 14 taken 110592 times.
✓ Branch 15 taken 229248 times.
441216 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
74 }
75 1479 }
76
77 static av_always_inline void
78 rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
79 const uint16_t *src1, const uint16_t *src2,
80 int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
81 {
82 int i;
83 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
84 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
85 av_assert1(src1==src2);
86 for (i = 0; i < width; i++) {
87 unsigned r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
88 unsigned g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
89 unsigned b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
90
91 dstU[i]= (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
92 dstV[i]= (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
93 }
94 }
95
96 #define RGB64FUNCS_EXT(pattern, BE_LE, origin, is_be) \
97 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\
98 int width, uint32_t *rgb2yuv, void *opq) \
99 { \
100 const uint16_t *src = (const uint16_t *) _src; \
101 uint16_t *dst = (uint16_t *) _dst; \
102 rgb64ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
103 } \
104 \
105 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
106 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
107 int width, uint32_t *rgb2yuv, void *opq) \
108 { \
109 const uint16_t *src1 = (const uint16_t *) _src1, \
110 *src2 = (const uint16_t *) _src2; \
111 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
112 rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
113 } \
114 \
115 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
116 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
117 int width, uint32_t *rgb2yuv, void *opq) \
118 { \
119 const uint16_t *src1 = (const uint16_t *) _src1, \
120 *src2 = (const uint16_t *) _src2; \
121 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
122 rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
123 }
124 #define RGB64FUNCS(pattern, endianness, base_fmt) \
125 RGB64FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
126
127 1536 RGB64FUNCS(rgb, LE, AV_PIX_FMT_RGBA64)
128 1692 RGB64FUNCS(rgb, BE, AV_PIX_FMT_RGBA64)
129 1536 RGB64FUNCS(bgr, LE, AV_PIX_FMT_BGRA64)
130 1152 RGB64FUNCS(bgr, BE, AV_PIX_FMT_BGRA64)
131
132 828959 static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
133 const uint16_t *src, int width,
134 enum AVPixelFormat origin,
135 int32_t *rgb2yuv, int is_be)
136 {
137 828959 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
138 int i;
139
2/2
✓ Branch 0 taken 291173576 times.
✓ Branch 1 taken 828959 times.
292002535 for (i = 0; i < width; i++) {
140
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 290852168 times.
291173576 unsigned int r_b = input_pixel(&src[i * 3 + 0]);
141
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 290852168 times.
291173576 unsigned int g = input_pixel(&src[i * 3 + 1]);
142
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 290852168 times.
291173576 unsigned int b_r = input_pixel(&src[i * 3 + 2]);
143
144
12/16
✓ Branch 0 taken 291072200 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 290961608 times.
✓ Branch 3 taken 110592 times.
✓ Branch 4 taken 290961608 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 290961608 times.
✓ Branch 8 taken 291072200 times.
✓ Branch 9 taken 101376 times.
✓ Branch 10 taken 290961608 times.
✓ Branch 11 taken 110592 times.
✓ Branch 12 taken 290961608 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 290961608 times.
291173576 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
145 }
146 828959 }
147
148 436283 static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
149 uint16_t *dstV,
150 const uint16_t *src1,
151 const uint16_t *src2,
152 int width,
153 enum AVPixelFormat origin,
154 int32_t *rgb2yuv, int is_be)
155 {
156 int i;
157 436283 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
158 436283 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
159 av_assert1(src1 == src2);
160
2/2
✓ Branch 0 taken 153492224 times.
✓ Branch 1 taken 436283 times.
153928507 for (i = 0; i < width; i++) {
161
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 153170816 times.
153492224 unsigned r_b = input_pixel(&src1[i * 3 + 0]);
162
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 153170816 times.
153492224 unsigned g = input_pixel(&src1[i * 3 + 1]);
163
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 153170816 times.
153492224 unsigned b_r = input_pixel(&src1[i * 3 + 2]);
164
165
12/16
✓ Branch 0 taken 153390848 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 153280256 times.
✓ Branch 3 taken 110592 times.
✓ Branch 4 taken 153280256 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 153280256 times.
✓ Branch 8 taken 153390848 times.
✓ Branch 9 taken 101376 times.
✓ Branch 10 taken 153280256 times.
✓ Branch 11 taken 110592 times.
✓ Branch 12 taken 153280256 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 153280256 times.
153492224 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
166
12/16
✓ Branch 0 taken 153390848 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 153280256 times.
✓ Branch 3 taken 110592 times.
✓ Branch 4 taken 153280256 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 153280256 times.
✓ Branch 8 taken 153390848 times.
✓ Branch 9 taken 101376 times.
✓ Branch 10 taken 153280256 times.
✓ Branch 11 taken 110592 times.
✓ Branch 12 taken 153280256 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 153280256 times.
153492224 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
167 }
168 436283 }
169
170 401672 static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
171 uint16_t *dstV,
172 const uint16_t *src1,
173 const uint16_t *src2,
174 int width,
175 enum AVPixelFormat origin,
176 int32_t *rgb2yuv, int is_be)
177 {
178 int i;
179 401672 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
180 401672 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
181 av_assert1(src1 == src2);
182
2/2
✓ Branch 0 taken 70423972 times.
✓ Branch 1 taken 401672 times.
70825644 for (i = 0; i < width; i++) {
183
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 unsigned r_b = (input_pixel(&src1[6 * i + 0]) +
184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 input_pixel(&src1[6 * i + 3]) + 1) >> 1;
185
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 unsigned g = (input_pixel(&src1[6 * i + 1]) +
186
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 input_pixel(&src1[6 * i + 4]) + 1) >> 1;
187
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 unsigned b_r = (input_pixel(&src1[6 * i + 2]) +
188
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 70423972 times.
70423972 input_pixel(&src1[6 * i + 5]) + 1) >> 1;
189
190
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;
191
8/16
✓ Branch 0 taken 70423972 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70423972 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 70423972 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 70423972 times.
✓ Branch 8 taken 70423972 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 70423972 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 70423972 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 70423972 times.
70423972 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
192 }
193 401672 }
194
195 #undef r
196 #undef b
197 #undef input_pixel
198
199 #define RGB48FUNCS_EXT(pattern, BE_LE, origin, is_be) \
200 static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
201 const uint8_t *_src, \
202 const uint8_t *unused0, const uint8_t *unused1,\
203 int width, \
204 uint32_t *rgb2yuv, \
205 void *opq) \
206 { \
207 const uint16_t *src = (const uint16_t *)_src; \
208 uint16_t *dst = (uint16_t *)_dst; \
209 rgb48ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
210 } \
211 \
212 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
213 uint8_t *_dstV, \
214 const uint8_t *unused0, \
215 const uint8_t *_src1, \
216 const uint8_t *_src2, \
217 int width, \
218 uint32_t *rgb2yuv, \
219 void *opq) \
220 { \
221 const uint16_t *src1 = (const uint16_t *)_src1, \
222 *src2 = (const uint16_t *)_src2; \
223 uint16_t *dstU = (uint16_t *)_dstU, \
224 *dstV = (uint16_t *)_dstV; \
225 rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
226 } \
227 \
228 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
229 uint8_t *_dstV, \
230 const uint8_t *unused0, \
231 const uint8_t *_src1, \
232 const uint8_t *_src2, \
233 int width, \
234 uint32_t *rgb2yuv, \
235 void *opq) \
236 { \
237 const uint16_t *src1 = (const uint16_t *)_src1, \
238 *src2 = (const uint16_t *)_src2; \
239 uint16_t *dstU = (uint16_t *)_dstU, \
240 *dstV = (uint16_t *)_dstV; \
241 rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
242 }
243 #define RGB48FUNCS(pattern, endianness, base_fmt) \
244 RGB48FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
245
246 3328296 RGB48FUNCS(rgb, LE, AV_PIX_FMT_RGB48)
247 2844 RGB48FUNCS(rgb, BE, AV_PIX_FMT_RGB48)
248 1536 RGB48FUNCS(bgr, LE, AV_PIX_FMT_BGR48)
249 1152 RGB48FUNCS(bgr, BE, AV_PIX_FMT_BGR48)
250
251 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
252 origin == AV_PIX_FMT_BGRA || \
253 origin == AV_PIX_FMT_ARGB || \
254 origin == AV_PIX_FMT_ABGR) \
255 ? AV_RN32A(&src[(i) * 4]) \
256 : ((origin == AV_PIX_FMT_X2RGB10LE || \
257 origin == AV_PIX_FMT_X2BGR10LE) \
258 ? AV_RL32(&src[(i) * 4]) \
259 : (is_be ? AV_RB16(&src[(i) * 2]) \
260 : AV_RL16(&src[(i) * 2]))))
261
262 958928 static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
263 const uint8_t *src,
264 int width,
265 enum AVPixelFormat origin,
266 int shr, int shg,
267 int shb, int shp,
268 int maskr, int maskg,
269 int maskb, int rsh,
270 int gsh, int bsh, int S,
271 int32_t *rgb2yuv, int is_be)
272 {
273 958928 const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
274 958928 const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
275 int i;
276
277
2/2
✓ Branch 0 taken 337053937 times.
✓ Branch 1 taken 958928 times.
338012865 for (i = 0; i < width; i++) {
278
14/14
✓ Branch 0 taken 148779360 times.
✓ Branch 1 taken 188274577 times.
✓ Branch 2 taken 148454816 times.
✓ Branch 3 taken 324544 times.
✓ Branch 4 taken 148242656 times.
✓ Branch 5 taken 212160 times.
✓ Branch 6 taken 289728 times.
✓ Branch 7 taken 147952928 times.
✓ Branch 8 taken 133254112 times.
✓ Branch 9 taken 14698816 times.
✓ Branch 10 taken 14698816 times.
✓ Branch 11 taken 118555296 times.
✓ Branch 12 taken 608256 times.
✓ Branch 13 taken 117947040 times.
337053937 int px = input_pixel(i) >> shp;
279 337053937 int b = (px & maskb) >> shb;
280 337053937 int g = (px & maskg) >> shg;
281 337053937 int r = (px & maskr) >> shr;
282
283 337053937 dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
284 }
285 958928 }
286
287 508030 static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
288 int16_t *dstV,
289 const uint8_t *src,
290 int width,
291 enum AVPixelFormat origin,
292 int shr, int shg,
293 int shb, int shp,
294 int maskr, int maskg,
295 int maskb, int rsh,
296 int gsh, int bsh, int S,
297 int32_t *rgb2yuv, int is_be)
298 {
299 508030 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
300 508030 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
301 508030 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
302 int i;
303
304
2/2
✓ Branch 0 taken 149523913 times.
✓ Branch 1 taken 508030 times.
150031943 for (i = 0; i < width; i++) {
305
13/14
✓ Branch 0 taken 71144256 times.
✓ Branch 1 taken 78379657 times.
✓ Branch 2 taken 70897536 times.
✓ Branch 3 taken 246720 times.
✓ Branch 4 taken 70685376 times.
✓ Branch 5 taken 212160 times.
✓ Branch 6 taken 212160 times.
✓ Branch 7 taken 70473216 times.
✓ Branch 8 taken 55774400 times.
✓ Branch 9 taken 14698816 times.
✓ Branch 10 taken 14698816 times.
✓ Branch 11 taken 41075584 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 41075584 times.
149523913 int px = input_pixel(i) >> shp;
306 149523913 int b = (px & maskb) >> shb;
307 149523913 int g = (px & maskg) >> shg;
308 149523913 int r = (px & maskr) >> shr;
309
310 149523913 dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
311 149523913 dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
312 }
313 508030 }
314
315 388372 static av_always_inline void rgb16_32ToUV_half_c_template(int16_t *dstU,
316 int16_t *dstV,
317 const uint8_t *src,
318 int width,
319 enum AVPixelFormat origin,
320 int shr, int shg,
321 int shb, int shp,
322 int maskr, int maskg,
323 int maskb, int rsh,
324 int gsh, int bsh, int S,
325 int32_t *rgb2yuv, int is_be)
326 {
327 388372 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
328 388372 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
329 388372 maskgx = ~(maskr | maskb);
330 388372 const unsigned rnd = (256U<<(S)) + (1<<(S-6));
331 int i;
332
333 388372 maskr |= maskr << 1;
334 388372 maskb |= maskb << 1;
335 388372 maskg |= maskg << 1;
336
2/2
✓ Branch 0 taken 84050870 times.
✓ Branch 1 taken 388372 times.
84439242 for (i = 0; i < width; i++) {
337
12/14
✓ Branch 0 taken 38827984 times.
✓ Branch 1 taken 45222886 times.
✓ Branch 2 taken 38785296 times.
✓ Branch 3 taken 42688 times.
✓ Branch 4 taken 38782160 times.
✓ Branch 5 taken 3136 times.
✓ Branch 6 taken 42304 times.
✓ Branch 7 taken 38739856 times.
✓ Branch 8 taken 38739856 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 38739856 times.
✓ Branch 12 taken 304128 times.
✓ Branch 13 taken 38435728 times.
84050870 unsigned px0 = input_pixel(2 * i + 0) >> shp;
338
12/14
✓ Branch 0 taken 38827984 times.
✓ Branch 1 taken 45222886 times.
✓ Branch 2 taken 38785296 times.
✓ Branch 3 taken 42688 times.
✓ Branch 4 taken 38782160 times.
✓ Branch 5 taken 3136 times.
✓ Branch 6 taken 42304 times.
✓ Branch 7 taken 38739856 times.
✓ Branch 8 taken 38739856 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 38739856 times.
✓ Branch 12 taken 304128 times.
✓ Branch 13 taken 38435728 times.
84050870 unsigned px1 = input_pixel(2 * i + 1) >> shp;
339 84050870 int b, r, g = (px0 & maskgx) + (px1 & maskgx);
340 84050870 int rb = px0 + px1 - g;
341
342 84050870 b = (rb & maskb) >> shb;
343
4/4
✓ Branch 0 taken 84005430 times.
✓ Branch 1 taken 45440 times.
✓ Branch 2 taken 83954742 times.
✓ Branch 3 taken 50688 times.
84050870 if (shp ||
344
4/4
✓ Branch 0 taken 83904054 times.
✓ Branch 1 taken 50688 times.
✓ Branch 2 taken 76221266 times.
✓ Branch 3 taken 7682788 times.
83954742 origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
345
2/2
✓ Branch 0 taken 50688 times.
✓ Branch 1 taken 76170578 times.
76221266 origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
346 7880292 g >>= shg;
347 } else {
348 76170578 g = (g & maskg) >> shg;
349 }
350 84050870 r = (rb & maskr) >> shr;
351
352 84050870 dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);
353 84050870 dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);
354 }
355 388372 }
356
357 #undef input_pixel
358
359 #define RGB16_32FUNCS_EXT(fmt, name, shr, shg, shb, shp, maskr, \
360 maskg, maskb, rsh, gsh, bsh, S, is_be) \
361 static void name ## ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, \
362 int width, uint32_t *tab, void *opq) \
363 { \
364 rgb16_32ToY_c_template((int16_t*)dst, src, width, fmt, shr, shg, shb, shp, \
365 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
366 } \
367 \
368 static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
369 const uint8_t *unused0, const uint8_t *src, const uint8_t *dummy, \
370 int width, uint32_t *tab, void *opq) \
371 { \
372 rgb16_32ToUV_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
373 shr, shg, shb, shp, \
374 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
375 } \
376 \
377 static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
378 const uint8_t *unused0, const uint8_t *src, \
379 const uint8_t *dummy, \
380 int width, uint32_t *tab, void *opq) \
381 { \
382 rgb16_32ToUV_half_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
383 shr, shg, shb, shp, \
384 maskr, maskg, maskb, \
385 rsh, gsh, bsh, S, tab, is_be); \
386 }
387
388 #define RGB16_32FUNCS(base_fmt, endianness, name, shr, shg, shb, shp, maskr, \
389 maskg, maskb, rsh, gsh, bsh, S) \
390 RGB16_32FUNCS_EXT(base_fmt ## endianness, name, shr, shg, shb, shp, maskr, \
391 maskg, maskb, rsh, gsh, bsh, S, IS_BE(endianness))
392
393 1992950 RGB16_32FUNCS(AV_PIX_FMT_BGR32, , bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
394 2368 RGB16_32FUNCS(AV_PIX_FMT_BGR32_1, , bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
395 5900 RGB16_32FUNCS(AV_PIX_FMT_RGB32, , rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
396 3586 RGB16_32FUNCS(AV_PIX_FMT_RGB32_1, , rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
397 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
398 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
399 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
400 414136 RGB16_32FUNCS(AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
401 946136 RGB16_32FUNCS(AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
402 1152 RGB16_32FUNCS(AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
403 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
404 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
405 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
406 1152 RGB16_32FUNCS(AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
407 1152 RGB16_32FUNCS(AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
408 1152 RGB16_32FUNCS(AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
409 167032 RGB16_32FUNCS(AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
410 167032 RGB16_32FUNCS(AV_PIX_FMT_X2BGR10, LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0, RGB2YUV_SHIFT + 6)
411
412 356772 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
413 const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
414 int width, uint32_t *rgb2yuv, void *opq)
415 {
416 356772 uint16_t *dstU = (uint16_t *)_dstU;
417 356772 uint16_t *dstV = (uint16_t *)_dstV;
418 356772 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
419 356772 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
420
421 int i;
422
2/2
✓ Branch 0 taken 62791872 times.
✓ Branch 1 taken 356772 times.
63148644 for (i = 0; i < width; i++) {
423 62791872 unsigned int g = gsrc[2*i] + gsrc[2*i+1];
424 62791872 unsigned int b = bsrc[2*i] + bsrc[2*i+1];
425 62791872 unsigned int r = rsrc[2*i] + rsrc[2*i+1];
426
427 62791872 dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
428 62791872 dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
429 }
430 356772 }
431
432 576 static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
433 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
434 {
435 576 int16_t *dst = (int16_t *)_dst;
436 576 const uint16_t *src = (const uint16_t *)_src;
437 int i;
438
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
439 202752 dst[i] = AV_RL16(src + 4 * i + 3);
440 576 }
441
442 576 static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
443 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
444 {
445 576 int16_t *dst = (int16_t *)_dst;
446 576 const uint16_t *src = (const uint16_t *)_src;
447 int i;
448
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
449 202752 dst[i] = AV_RB16(src + 4 * i + 3);
450 576 }
451
452 1455 static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
453 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
454 {
455 1455 int16_t *dst = (int16_t *)_dst;
456 int i;
457
2/2
✓ Branch 0 taken 483072 times.
✓ Branch 1 taken 1455 times.
484527 for (i=0; i<width; i++) {
458 483072 dst[i]= src[4*i]<<6 | src[4*i]>>2;
459 }
460 1455 }
461
462 96602 static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
463 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
464 {
465 96602 int16_t *dst = (int16_t *)_dst;
466 int i;
467
2/2
✓ Branch 0 taken 67879432 times.
✓ Branch 1 taken 96602 times.
67976034 for (i=0; i<width; i++) {
468 67879432 dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
469 }
470 96602 }
471
472 static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
473 const uint8_t *unused2, int width, uint32_t *pal, void *opq)
474 {
475 int16_t *dst = (int16_t *)_dst;
476 int i;
477 for (i=0; i<width; i++) {
478 int d= src[i];
479
480 dst[i]= (pal[d] >> 24)<<6 | pal[d]>>26;
481 }
482 }
483
484 184760 static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
485 const uint8_t *unused2, int width, uint32_t *pal, void *opq)
486 {
487 184760 int16_t *dst = (int16_t *)_dst;
488 int i;
489
2/2
✓ Branch 0 taken 63240280 times.
✓ Branch 1 taken 184760 times.
63425040 for (i = 0; i < width; i++) {
490 63240280 int d = src[i];
491
492 63240280 dst[i] = (pal[d] & 0xFF)<<6;
493 }
494 184760 }
495
496 184760 static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV,
497 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
498 int width, uint32_t *pal, void *opq)
499 {
500 184760 uint16_t *dstU = (uint16_t *)_dstU;
501 184760 int16_t *dstV = (int16_t *)_dstV;
502 int i;
503 av_assert1(src1 == src2);
504
2/2
✓ Branch 0 taken 63240280 times.
✓ Branch 1 taken 184760 times.
63425040 for (i = 0; i < width; i++) {
505 63240280 int p = pal[src1[i]];
506
507 63240280 dstU[i] = (uint8_t)(p>> 8)<<6;
508 63240280 dstV[i] = (uint8_t)(p>>16)<<6;
509 }
510 184760 }
511
512 78278 static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
513 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
514 {
515 78278 int16_t *dst = (int16_t *)_dst;
516 int i, j;
517 78278 width = (width + 7) >> 3;
518
2/2
✓ Branch 0 taken 3012932 times.
✓ Branch 1 taken 78278 times.
3091210 for (i = 0; i < width; i++) {
519 3012932 int d = ~src[i];
520
2/2
✓ Branch 0 taken 24103456 times.
✓ Branch 1 taken 3012932 times.
27116388 for (j = 0; j < 8; j++)
521 24103456 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
522 }
523
1/2
✓ Branch 0 taken 78278 times.
✗ Branch 1 not taken.
78278 if(width&7){
524 78278 int d= ~src[i];
525
2/2
✓ Branch 0 taken 335812 times.
✓ Branch 1 taken 78278 times.
414090 for (j = 0; j < (width&7); j++)
526 335812 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
527 }
528 78278 }
529
530 66928 static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
531 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
532 {
533 66928 int16_t *dst = (int16_t *)_dst;
534 int i, j;
535 66928 width = (width + 7) >> 3;
536
2/2
✓ Branch 0 taken 2944832 times.
✓ Branch 1 taken 66928 times.
3011760 for (i = 0; i < width; i++) {
537 2944832 int d = src[i];
538
2/2
✓ Branch 0 taken 23558656 times.
✓ Branch 1 taken 2944832 times.
26503488 for (j = 0; j < 8; j++)
539 23558656 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
540 }
541
1/2
✓ Branch 0 taken 66928 times.
✗ Branch 1 not taken.
66928 if(width&7){
542 66928 int d = src[i];
543
2/2
✓ Branch 0 taken 267712 times.
✓ Branch 1 taken 66928 times.
334640 for (j = 0; j < (width&7); j++)
544 267712 dst[8*i+j] = ((d>>(7-j))&1) * 16383;
545 }
546 66928 }
547
548 134414 static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
549 uint32_t *unused, void *opq)
550 {
551 int i;
552
2/2
✓ Branch 0 taken 47253248 times.
✓ Branch 1 taken 134414 times.
47387662 for (i = 0; i < width; i++)
553 47253248 dst[i] = src[2 * i];
554 134414 }
555
556 66928 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
557 const uint8_t *src2, int width, uint32_t *unused, void *opq)
558 {
559 int i;
560
2/2
✓ Branch 0 taken 11779328 times.
✓ Branch 1 taken 66928 times.
11846256 for (i = 0; i < width; i++) {
561 11779328 dstU[i] = src1[4 * i + 1];
562 11779328 dstV[i] = src1[4 * i + 3];
563 }
564 av_assert1(src1 == src2);
565 66928 }
566
567 66928 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
568 const uint8_t *src2, int width, uint32_t *unused, void *opq)
569 {
570 int i;
571
2/2
✓ Branch 0 taken 11779328 times.
✓ Branch 1 taken 66928 times.
11846256 for (i = 0; i < width; i++) {
572 11779328 dstV[i] = src1[4 * i + 1];
573 11779328 dstU[i] = src1[4 * i + 3];
574 }
575 av_assert1(src1 == src2);
576 66928 }
577
578 #define y21xle_wrapper(bits, shift) \
579 static void y2 ## bits ## le_UV_c(uint8_t *dstU, uint8_t *dstV, \
580 const uint8_t *unused0, \
581 const uint8_t *src, \
582 const uint8_t *unused1, int width, \
583 uint32_t *unused2, void *opq) \
584 { \
585 int i; \
586 for (i = 0; i < width; i++) { \
587 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> shift); \
588 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> shift); \
589 } \
590 } \
591 \
592 static void y2 ## bits ## le_Y_c(uint8_t *dst, const uint8_t *src, \
593 const uint8_t *unused0, \
594 const uint8_t *unused1, int width, \
595 uint32_t *unused2, void *opq) \
596 { \
597 int i; \
598 for (i = 0; i < width; i++) \
599 AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> shift); \
600 }
601
602
2/2
✓ Branch 0 taken 35185920 times.
✓ Branch 1 taken 133280 times.
70638400 y21xle_wrapper(10, 6)
603
2/2
✓ Branch 0 taken 35185920 times.
✓ Branch 1 taken 133280 times.
70638400 y21xle_wrapper(12, 4)
604
2/2
✓ Branch 0 taken 43944384 times.
✓ Branch 1 taken 166456 times.
88221680 y21xle_wrapper(16, 0)
605
606 1185782 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
607 uint32_t *unused, void *opq)
608 {
609 int i;
610 1185782 const uint16_t *src = (const uint16_t *)_src;
611 1185782 uint16_t *dst = (uint16_t *)_dst;
612
2/2
✓ Branch 0 taken 417334784 times.
✓ Branch 1 taken 1185782 times.
418520566 for (i = 0; i < width; i++)
613 417334784 dst[i] = av_bswap16(src[i]);
614 1185782 }
615
616 547164 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
617 const uint8_t *_src2, int width, uint32_t *unused, void *opq)
618 {
619 int i;
620 547164 const uint16_t *src1 = (const uint16_t *)_src1,
621 547164 *src2 = (const uint16_t *)_src2;
622 547164 uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
623
2/2
✓ Branch 0 taken 133049664 times.
✓ Branch 1 taken 547164 times.
133596828 for (i = 0; i < width; i++) {
624 133049664 dstU[i] = av_bswap16(src1[i]);
625 133049664 dstV[i] = av_bswap16(src2[i]);
626 }
627 547164 }
628
629 288 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
630 uint32_t *unused, void *opq)
631 {
632 int i;
633
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
634 101376 AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
635 288 }
636
637 288 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
638 uint32_t *unused, void *opq)
639 {
640 int i;
641
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
642 101376 AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
643 288 }
644
645 558 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
646 uint32_t *unused, void *opq)
647 {
648 int i;
649
2/2
✓ Branch 0 taken 135936 times.
✓ Branch 1 taken 558 times.
136494 for (i = 0; i < width; i++)
650 135936 AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
651 558 }
652
653 288 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
654 uint32_t *unused, void *opq)
655 {
656 int i;
657
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
658 101376 AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
659 288 }
660
661 83516 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
662 uint32_t *unused2, void *opq)
663 {
664 int i;
665
2/2
✓ Branch 0 taken 29397632 times.
✓ Branch 1 taken 83516 times.
29481148 for (i = 0; i < width; i++)
666 29397632 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
667 83516 }
668
669 83516 static void read_ayuv64be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
670 uint32_t *unused2, void *opq)
671 {
672 int i;
673
2/2
✓ Branch 0 taken 29397632 times.
✓ Branch 1 taken 83516 times.
29481148 for (i = 0; i < width; i++)
674 29397632 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2));
675 83516 }
676
677 83516 static av_always_inline void ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width,
678 int u_offset, int v_offset)
679 {
680 int i;
681
2/2
✓ Branch 0 taken 29397632 times.
✓ Branch 1 taken 83516 times.
29481148 for (i = 0; i < width; i++) {
682 29397632 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + u_offset));
683 29397632 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + v_offset));
684 }
685 83516 }
686
687 83516 static av_always_inline void ayuv64be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width,
688 int u_offset, int v_offset)
689 {
690 int i;
691
2/2
✓ Branch 0 taken 29397632 times.
✓ Branch 1 taken 83516 times.
29481148 for (i = 0; i < width; i++) {
692 29397632 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + u_offset));
693 29397632 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + v_offset));
694 }
695 83516 }
696
697 #define ayuv64_UV_funcs(pixfmt, U, V) \
698 static void read_ ## pixfmt ## le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, \
699 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
700 { \
701 ayuv64le_UV_c(dstU, dstV, src, width, U, V); \
702 } \
703 \
704 static void read_ ## pixfmt ## be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, \
705 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
706 { \
707 ayuv64be_UV_c(dstU, dstV, src, width, U, V); \
708 }
709
710 1152 ayuv64_UV_funcs(ayuv64, 4, 6)
711 332912 ayuv64_UV_funcs(xv48, 0, 4)
712
713 288 static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
714 uint32_t *unused2, void *opq)
715 {
716 int i;
717
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
718 101376 AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
719 288 }
720
721 288 static void read_ayuv64be_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
722 uint32_t *unused2, void *opq)
723 {
724 int i;
725
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
726 101376 AV_WN16(dst + i * 2, AV_RB16(src + i * 8));
727 288 }
728
729 67216 static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
730 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
731 {
732 int i;
733
2/2
✓ Branch 0 taken 23660032 times.
✓ Branch 1 taken 67216 times.
23727248 for (i = 0; i < width; i++) {
734 23660032 dstU[i] = src[i * 4 + 1];
735 23660032 dstV[i] = src[i * 4];
736 }
737 67216 }
738
739 67216 static void read_vuyx_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
740 uint32_t *unused2, void *opq)
741 {
742 int i;
743
2/2
✓ Branch 0 taken 23660032 times.
✓ Branch 1 taken 67216 times.
23727248 for (i = 0; i < width; i++)
744 23660032 dst[i] = src[i * 4 + 2];
745 67216 }
746
747 576 static void read_vuya_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
748 uint32_t *unused2, void *opq)
749 {
750 int i;
751
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
752 202752 dst[i] = src[i * 4 + 3];
753 576 }
754
755 288 static void read_ayuv_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
756 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
757 {
758 int i;
759
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++) {
760 101376 dstU[i] = src[i * 4 + 2];
761 101376 dstV[i] = src[i * 4 + 3];
762 }
763 288 }
764
765 45476 static void read_ayuv_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
766 uint32_t *unused2, void *opq)
767 {
768 int i;
769
2/2
✓ Branch 0 taken 15466952 times.
✓ Branch 1 taken 45476 times.
15512428 for (i = 0; i < width; i++)
770 15466952 dst[i] = src[i * 4 + 1];
771 45476 }
772
773 288 static void read_ayuv_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
774 uint32_t *unused2, void *opq)
775 {
776 int i;
777
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
778 101376 dst[i] = src[i * 4];
779 288 }
780
781 22738 static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
782 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
783 {
784 int i;
785
2/2
✓ Branch 0 taken 7733476 times.
✓ Branch 1 taken 22738 times.
7756214 for (i = 0; i < width; i++) {
786 7733476 dstU[i] = src[i * 4];
787 7733476 dstV[i] = src[i * 4 + 2];
788 }
789 22738 }
790
791 111828 static void vyuToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
792 uint32_t *unused2, void *opq)
793 {
794 int i;
795
2/2
✓ Branch 0 taken 38822856 times.
✓ Branch 1 taken 111828 times.
38934684 for (i = 0; i < width; i++)
796 38822856 dst[i] = src[i * 3 + 1];
797 111828 }
798
799 89378 static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
800 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
801 {
802 int i;
803
2/2
✓ Branch 0 taken 31190756 times.
✓ Branch 1 taken 89378 times.
31280134 for (i = 0; i < width; i++) {
804 31190756 dstU[i] = src[i * 3 + 2];
805 31190756 dstV[i] = src[i * 3];
806 }
807 89378 }
808
809 111811 static void read_v30xle_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
810 uint32_t *unused2, void *opq)
811 {
812 int i;
813
2/2
✓ Branch 0 taken 38790856 times.
✓ Branch 1 taken 111811 times.
38902667 for (i = 0; i < width; i++)
814 38790856 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
815 111811 }
816
817
818 89361 static void read_v30xle_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
819 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
820 {
821 int i;
822
2/2
✓ Branch 0 taken 31158756 times.
✓ Branch 1 taken 89361 times.
31248117 for (i = 0; i < width; i++) {
823 31158756 unsigned int uv = AV_RL32(src + i * 4);
824 31158756 AV_WN16(dstU + i * 2, (uv >> 2) & 0x3FFu);
825 31158756 AV_WN16(dstV + i * 2, (uv >> 22) & 0x3FFu);
826 }
827 89361 }
828
829 66640 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
830 uint32_t *unused2, void *opq)
831 {
832 int i;
833
2/2
✓ Branch 0 taken 23457280 times.
✓ Branch 1 taken 66640 times.
23523920 for (i = 0; i < width; i++)
834 23457280 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
835 66640 }
836
837
838 66640 static void read_xv30le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
839 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
840 {
841 int i;
842
2/2
✓ Branch 0 taken 23457280 times.
✓ Branch 1 taken 66640 times.
23523920 for (i = 0; i < width; i++) {
843 23457280 AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
844 23457280 AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
845 }
846 66640 }
847
848 66640 static void read_xv36le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
849 uint32_t *unused2, void *opq)
850 {
851 int i;
852
2/2
✓ Branch 0 taken 23457280 times.
✓ Branch 1 taken 66640 times.
23523920 for (i = 0; i < width; i++)
853 23457280 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
854 66640 }
855
856
857 66640 static void read_xv36le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
858 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
859 {
860 int i;
861
2/2
✓ Branch 0 taken 23457280 times.
✓ Branch 1 taken 66640 times.
23523920 for (i = 0; i < width; i++) {
862 23457280 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
863 23457280 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
864 }
865 66640 }
866
867 66640 static void read_xv36be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
868 uint32_t *unused2, void *opq)
869 {
870 int i;
871
2/2
✓ Branch 0 taken 23457280 times.
✓ Branch 1 taken 66640 times.
23523920 for (i = 0; i < width; i++)
872 23457280 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2) >> 4);
873 66640 }
874
875
876 66640 static void read_xv36be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
877 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
878 {
879 int i;
880
2/2
✓ Branch 0 taken 23457280 times.
✓ Branch 1 taken 66640 times.
23523920 for (i = 0; i < width; i++) {
881 23457280 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + 0) >> 4);
882 23457280 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + 4) >> 4);
883 }
884 66640 }
885
886 /* This is almost identical to the previous, end exists only because
887 * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
888 67216 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
889 uint32_t *unused, void *opq)
890 {
891 int i;
892
2/2
✓ Branch 0 taken 23660032 times.
✓ Branch 1 taken 67216 times.
23727248 for (i = 0; i < width; i++)
893 23660032 dst[i] = src[2 * i + 1];
894 67216 }
895
896 66928 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
897 const uint8_t *src2, int width, uint32_t *unused, void *opq)
898 {
899 int i;
900
2/2
✓ Branch 0 taken 11779328 times.
✓ Branch 1 taken 66928 times.
11846256 for (i = 0; i < width; i++) {
901 11779328 dstU[i] = src1[4 * i + 0];
902 11779328 dstV[i] = src1[4 * i + 2];
903 }
904 av_assert1(src1 == src2);
905 66928 }
906
907 162602 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
908 const uint8_t *src, int width)
909 {
910 int i;
911
2/2
✓ Branch 0 taken 38937536 times.
✓ Branch 1 taken 162602 times.
39100138 for (i = 0; i < width; i++) {
912 38937536 dst1[i] = src[2 * i + 0];
913 38937536 dst2[i] = src[2 * i + 1];
914 }
915 162602 }
916
917 162170 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
918 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
919 int width, uint32_t *unused, void *opq)
920 {
921 162170 nvXXtoUV_c(dstU, dstV, src1, width);
922 162170 }
923
924 432 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
925 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
926 int width, uint32_t *unused, void *opq)
927 {
928 432 nvXXtoUV_c(dstV, dstU, src1, width);
929 432 }
930
931 #define p01x_uv_wrapper(bits, shift) \
932 static void p0 ## bits ## LEToUV_c(uint8_t *dstU, uint8_t *dstV, \
933 const uint8_t *unused0, \
934 const uint8_t *src1, \
935 const uint8_t *src2, int width, \
936 uint32_t *unused, void *opq) \
937 { \
938 int i; \
939 for (i = 0; i < width; i++) { \
940 AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> shift); \
941 AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> shift); \
942 } \
943 } \
944 \
945 static void p0 ## bits ## BEToUV_c(uint8_t *dstU, uint8_t *dstV, \
946 const uint8_t *unused0, \
947 const uint8_t *src1, \
948 const uint8_t *src2, int width, \
949 uint32_t *unused, void *opq) \
950 { \
951 int i; \
952 for (i = 0; i < width; i++) { \
953 AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> shift); \
954 AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> shift); \
955 } \
956 }
957
958 #define p01x_wrapper(bits, shift) \
959 static void p0 ## bits ## LEToY_c(uint8_t *dst, const uint8_t *src, \
960 const uint8_t *unused1, \
961 const uint8_t *unused2, int width, \
962 uint32_t *unused, void *opq) \
963 { \
964 int i; \
965 for (i = 0; i < width; i++) { \
966 AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> shift); \
967 } \
968 } \
969 \
970 static void p0 ## bits ## BEToY_c(uint8_t *dst, const uint8_t *src, \
971 const uint8_t *unused1, \
972 const uint8_t *unused2, int width, \
973 uint32_t *unused, void *opq) \
974 { \
975 int i; \
976 for (i = 0; i < width; i++) { \
977 AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> shift); \
978 } \
979 } \
980 p01x_uv_wrapper(bits, shift)
981
982
2/2
✓ Branch 0 taken 225223680 times.
✓ Branch 1 taken 743232 times.
451933824 p01x_wrapper(10, 6)
983
2/2
✓ Branch 0 taken 225223680 times.
✓ Branch 1 taken 743232 times.
451933824 p01x_wrapper(12, 4)
984
2/2
✓ Branch 0 taken 104046976 times.
✓ Branch 1 taken 424720 times.
208943392 p01x_uv_wrapper(16, 0)
985
986 275171 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
987 int width, uint32_t *rgb2yuv, void *opq)
988 {
989 275171 int16_t *dst = (int16_t *)_dst;
990 275171 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
991 int i;
992
2/2
✓ Branch 0 taken 94162376 times.
✓ Branch 1 taken 275171 times.
94437547 for (i = 0; i < width; i++) {
993 94162376 int b = src[i * 3 + 0];
994 94162376 int g = src[i * 3 + 1];
995 94162376 int r = src[i * 3 + 2];
996
997 94162376 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
998 }
999 275171 }
1000
1001 50352 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1002 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1003 {
1004 50352 int16_t *dstU = (int16_t *)_dstU;
1005 50352 int16_t *dstV = (int16_t *)_dstV;
1006 50352 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1007 50352 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1008 int i;
1009
2/2
✓ Branch 0 taken 17729088 times.
✓ Branch 1 taken 50352 times.
17779440 for (i = 0; i < width; i++) {
1010 17729088 int b = src1[3 * i + 0];
1011 17729088 int g = src1[3 * i + 1];
1012 17729088 int r = src1[3 * i + 2];
1013
1014 17729088 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1015 17729088 dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1016 }
1017 av_assert1(src1 == src2);
1018 50352 }
1019
1020 224844 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1021 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1022 {
1023 224844 int16_t *dstU = (int16_t *)_dstU;
1024 224844 int16_t *dstV = (int16_t *)_dstV;
1025 int i;
1026 224844 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1027 224844 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1028
2/2
✓ Branch 0 taken 38222772 times.
✓ Branch 1 taken 224844 times.
38447616 for (i = 0; i < width; i++) {
1029 38222772 int b = src1[6 * i + 0] + src1[6 * i + 3];
1030 38222772 int g = src1[6 * i + 1] + src1[6 * i + 4];
1031 38222772 int r = src1[6 * i + 2] + src1[6 * i + 5];
1032
1033 38222772 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1034 38222772 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1035 }
1036 av_assert1(src1 == src2);
1037 224844 }
1038
1039 1084064 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
1040 uint32_t *rgb2yuv, void *opq)
1041 {
1042 1084064 int16_t *dst = (int16_t *)_dst;
1043 1084064 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1044 int i;
1045
2/2
✓ Branch 0 taken 369915868 times.
✓ Branch 1 taken 1084064 times.
370999932 for (i = 0; i < width; i++) {
1046 369915868 int r = src[i * 3 + 0];
1047 369915868 int g = src[i * 3 + 1];
1048 369915868 int b = src[i * 3 + 2];
1049
1050 369915868 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1051 }
1052 1084064 }
1053
1054 443441 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1055 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1056 {
1057 443441 int16_t *dstU = (int16_t *)_dstU;
1058 443441 int16_t *dstV = (int16_t *)_dstV;
1059 int i;
1060 443441 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1061 443441 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1062 av_assert1(src1 == src2);
1063
2/2
✓ Branch 0 taken 155960212 times.
✓ Branch 1 taken 443441 times.
156403653 for (i = 0; i < width; i++) {
1064 155960212 int r = src1[3 * i + 0];
1065 155960212 int g = src1[3 * i + 1];
1066 155960212 int b = src1[3 * i + 2];
1067
1068 155960212 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1069 155960212 dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1070 }
1071 443441 }
1072
1073 654276 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1074 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1075 {
1076 654276 int16_t *dstU = (int16_t *)_dstU;
1077 654276 int16_t *dstV = (int16_t *)_dstV;
1078 int i;
1079 654276 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1080 654276 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1081 av_assert1(src1 == src2);
1082
2/2
✓ Branch 0 taken 108830484 times.
✓ Branch 1 taken 654276 times.
109484760 for (i = 0; i < width; i++) {
1083 108830484 int r = src1[6 * i + 0] + src1[6 * i + 3];
1084 108830484 int g = src1[6 * i + 1] + src1[6 * i + 4];
1085 108830484 int b = src1[6 * i + 2] + src1[6 * i + 5];
1086
1087 108830484 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1088 108830484 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1089 }
1090 654276 }
1091
1092 733584 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
1093 {
1094 733584 uint16_t *dst = (uint16_t *)_dst;
1095 733584 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1096 int i;
1097
2/2
✓ Branch 0 taken 257929728 times.
✓ Branch 1 taken 733584 times.
258663312 for (i = 0; i < width; i++) {
1098 257929728 int g = src[0][i];
1099 257929728 int b = src[1][i];
1100 257929728 int r = src[2][i];
1101
1102 257929728 dst[i] = (ry*r + gy*g + by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1103 }
1104 733584 }
1105
1106 561 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused, void *opq)
1107 {
1108 561 uint16_t *dst = (uint16_t *)_dst;
1109 int i;
1110
2/2
✓ Branch 0 taken 122952 times.
✓ Branch 1 taken 561 times.
123513 for (i = 0; i < width; i++)
1111 122952 dst[i] = src[3][i] << 6;
1112 561 }
1113
1114 385808 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
1115 {
1116 385808 uint16_t *dstU = (uint16_t *)_dstU;
1117 385808 uint16_t *dstV = (uint16_t *)_dstV;
1118 385808 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1119 385808 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1120 int i;
1121
2/2
✓ Branch 0 taken 135512576 times.
✓ Branch 1 taken 385808 times.
135898384 for (i = 0; i < width; i++) {
1122 135512576 int g = src[0][i];
1123 135512576 int b = src[1][i];
1124 135512576 int r = src[2][i];
1125
1126 135512576 dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1127 135512576 dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1128 }
1129 385808 }
1130
1131 #define rdpx(src) \
1132 (is_be ? AV_RB16(src) : AV_RL16(src))
1133 1982440 static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4],
1134 int width, int bpc, int is_be, int32_t *rgb2yuv)
1135 {
1136 int i;
1137 1982440 const uint16_t **src = (const uint16_t **)_src;
1138 1982440 uint16_t *dst = (uint16_t *)_dst;
1139 1982440 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1140
2/2
✓ Branch 0 taken 1662344 times.
✓ Branch 1 taken 320096 times.
1982440 int shift = bpc < 16 ? bpc : 14;
1141
2/2
✓ Branch 0 taken 696627280 times.
✓ Branch 1 taken 1982440 times.
698609720 for (i = 0; i < width; i++) {
1142
2/2
✓ Branch 0 taken 59362432 times.
✓ Branch 1 taken 637264848 times.
696627280 int g = rdpx(src[0] + i);
1143
2/2
✓ Branch 0 taken 59362432 times.
✓ Branch 1 taken 637264848 times.
696627280 int b = rdpx(src[1] + i);
1144
2/2
✓ Branch 0 taken 59362432 times.
✓ Branch 1 taken 637264848 times.
696627280 int r = rdpx(src[2] + i);
1145
1146 696627280 dst[i] = (ry*r + gy*g + by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1147 }
1148 1982440 }
1149
1150 2412 static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
1151 int width, int bpc, int is_be, int32_t *rgb2yuv)
1152 {
1153 int i;
1154 2412 const uint16_t **src = (const uint16_t **)_src;
1155 2412 uint16_t *dst = (uint16_t *)_dst;
1156
2/2
✓ Branch 0 taken 1800 times.
✓ Branch 1 taken 612 times.
2412 int shift = bpc < 16 ? bpc : 14;
1157
1158
2/2
✓ Branch 0 taken 830304 times.
✓ Branch 1 taken 2412 times.
832716 for (i = 0; i < width; i++) {
1159
2/2
✓ Branch 0 taken 415152 times.
✓ Branch 1 taken 415152 times.
830304 dst[i] = rdpx(src[3] + i) << (14 - shift);
1160 }
1161 2412 }
1162
1163 1979750 static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
1164 const uint8_t *_src[4], int width,
1165 int bpc, int is_be, int32_t *rgb2yuv)
1166 {
1167 int i;
1168 1979750 const uint16_t **src = (const uint16_t **)_src;
1169 1979750 uint16_t *dstU = (uint16_t *)_dstU;
1170 1979750 uint16_t *dstV = (uint16_t *)_dstV;
1171 1979750 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1172 1979750 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1173
2/2
✓ Branch 0 taken 1680336 times.
✓ Branch 1 taken 299414 times.
1979750 int shift = bpc < 16 ? bpc : 14;
1174
2/2
✓ Branch 0 taken 695950700 times.
✓ Branch 1 taken 1979750 times.
697930450 for (i = 0; i < width; i++) {
1175
2/2
✓ Branch 0 taken 59362432 times.
✓ Branch 1 taken 636588268 times.
695950700 int g = rdpx(src[0] + i);
1176
2/2
✓ Branch 0 taken 59362432 times.
✓ Branch 1 taken 636588268 times.
695950700 int b = rdpx(src[1] + i);
1177
2/2
✓ Branch 0 taken 59362432 times.
✓ Branch 1 taken 636588268 times.
695950700 int r = rdpx(src[2] + i);
1178
1179 695950700 dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1180 695950700 dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1181 }
1182 1979750 }
1183 #undef rdpx
1184
1185 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
1186
1187 612 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)
1188 {
1189 int i;
1190 612 const float **src = (const float **)_src;
1191 612 uint16_t *dst = (uint16_t *)_dst;
1192
1193
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 612 times.
209796 for (i = 0; i < width; i++) {
1194
2/2
✓ Branch 0 taken 104592 times.
✓ Branch 1 taken 104592 times.
209184 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[3] + i), 0.0f, 65535.0f));
1195 }
1196 612 }
1197
1198 1224 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)
1199 {
1200 int i;
1201 1224 const float **src = (const float **)_src;
1202 1224 uint16_t *dstU = (uint16_t *)_dstU;
1203 1224 uint16_t *dstV = (uint16_t *)_dstV;
1204 1224 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1205 1224 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1206
1207
2/2
✓ Branch 0 taken 418368 times.
✓ Branch 1 taken 1224 times.
419592 for (i = 0; i < width; i++) {
1208
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1209
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1210
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1211
1212 418368 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1213 418368 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1214 }
1215 1224 }
1216
1217 1224 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)
1218 {
1219 int i;
1220 1224 const float **src = (const float **)_src;
1221 1224 uint16_t *dst = (uint16_t *)_dst;
1222
1223 1224 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1224
1225
2/2
✓ Branch 0 taken 418368 times.
✓ Branch 1 taken 1224 times.
419592 for (i = 0; i < width; i++) {
1226
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1227
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1228
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1229
1230 418368 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1231 }
1232 1224 }
1233
1234 static av_always_inline void rgbf32_to_uv_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused1,
1235 const uint8_t *_src, const uint8_t *unused2,
1236 int width, int is_be, int32_t *rgb2yuv)
1237 {
1238 int i;
1239 const float *src = (const float *)_src;
1240 uint16_t *dstU = (uint16_t *)_dstU;
1241 uint16_t *dstV = (uint16_t *)_dstV;
1242 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1243 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1244
1245 for (i = 0; i < width; i++) {
1246 int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1247 int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1248 int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1249
1250 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1251 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1252 }
1253 }
1254
1255 static av_always_inline void rgbf32_to_y_c(uint8_t *_dst, const uint8_t *_src,
1256 const uint8_t *unused1, const uint8_t *unused2,
1257 int width, int is_be, int32_t *rgb2yuv)
1258 {
1259 int i;
1260 const float *src = (const float *)_src;
1261 uint16_t *dst = (uint16_t *)_dst;
1262
1263 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1264
1265 for (i = 0; i < width; i++) {
1266 int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1267 int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1268 int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1269
1270 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1271 }
1272 }
1273
1274 576 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1275 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1276 {
1277 int i;
1278 576 const float *src = (const float *)_src;
1279 576 uint16_t *dst = (uint16_t *)_dst;
1280
1281
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; ++i){
1282
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 101376 times.
202752 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i), 0.0f, 65535.0f));
1283 }
1284 576 }
1285
1286 #undef rdpx
1287
1288 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1289 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1290 int w, int32_t *rgb2yuv, void *opq) \
1291 { \
1292 planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1293 } \
1294 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1295 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1296 void *opq) \
1297 { \
1298 planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1299 } \
1300
1301 #define rgb9plus_planar_transparency_funcs(nbits) \
1302 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1303 int w, int32_t *rgb2yuv, \
1304 void *opq) \
1305 { \
1306 planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1307 } \
1308 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1309 int w, int32_t *rgb2yuv, \
1310 void *opq) \
1311 { \
1312 planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1313 }
1314
1315 #define rgb9plus_planar_funcs(nbits) \
1316 rgb9plus_planar_funcs_endian(nbits, le, 0) \
1317 rgb9plus_planar_funcs_endian(nbits, be, 1)
1318
1319 2448 rgb9plus_planar_funcs(9)
1320 3428880 rgb9plus_planar_funcs(10)
1321 3249280 rgb9plus_planar_funcs(12)
1322 4752 rgb9plus_planar_funcs(14)
1323 1239020 rgb9plus_planar_funcs(16)
1324
1325 1224 rgb9plus_planar_transparency_funcs(10)
1326 1224 rgb9plus_planar_transparency_funcs(12)
1327 1152 rgb9plus_planar_transparency_funcs(14)
1328 1224 rgb9plus_planar_transparency_funcs(16)
1329
1330 #define rgbf32_funcs_endian(endian_name, endian) \
1331 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1332 int w, int32_t *rgb2yuv, void *opq) \
1333 { \
1334 planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1335 } \
1336 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1337 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1338 void *opq) \
1339 { \
1340 planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1341 } \
1342 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1343 int w, int32_t *rgb2yuv, void *opq) \
1344 { \
1345 planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1346 } \
1347 static void rgbf32##endian_name##_to_y_c(uint8_t *dst, const uint8_t *src, \
1348 const uint8_t *unused1, const uint8_t *unused2, \
1349 int w, uint32_t *rgb2yuv, void *opq) \
1350 { \
1351 rgbf32_to_y_c(dst, src, unused1, unused2, w, endian, rgb2yuv); \
1352 } \
1353 static void rgbf32##endian_name##_to_uv_c(uint8_t *dstU, uint8_t *dstV, \
1354 const uint8_t *unused1, \
1355 const uint8_t *src, const uint8_t *unused2, \
1356 int w, uint32_t *rgb2yuv, \
1357 void *opq) \
1358 { \
1359 rgbf32_to_uv_c(dstU, dstV, unused1, src, unused2, w, endian, rgb2yuv); \
1360 } \
1361 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1362 const uint8_t *unused1, const uint8_t *unused2, \
1363 int width, uint32_t *unused, void *opq) \
1364 { \
1365 grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1366 }
1367
1368 3636 rgbf32_funcs_endian(le, 0)
1369 3636 rgbf32_funcs_endian(be, 1)
1370
1371 #define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : AV_RL16(&src), h2f_tbl))
1372 #define rdpx2(src) av_int2float(half2float(is_be ? AV_RB16(src) : AV_RL16(src), h2f_tbl))
1373
1374 3133 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)
1375 {
1376 int i;
1377
1378
2/2
✓ Branch 0 taken 1859304 times.
✓ Branch 1 taken 3133 times.
1862437 for (i = 0; i < width; i++) {
1379
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1859304 times.
1859304 AV_WN16(dst + 2*i, lrintf(av_clipf(65535.0f * rdpx2(src[3] + 2*i), 0.0f, 65535.0f)));
1380 }
1381 3133 }
1382
1383 6624 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)
1384 {
1385 int i;
1386 6624 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1387 6624 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1388
1389
2/2
✓ Branch 0 taken 3538033 times.
✓ Branch 1 taken 6624 times.
3544657 for (i = 0; i < width; i++) {
1390
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3538033 times.
3538033 int g = lrintf(av_clipf(65535.0f * rdpx2(src[0] + 2*i), 0.0f, 65535.0f));
1391
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3538033 times.
3538033 int b = lrintf(av_clipf(65535.0f * rdpx2(src[1] + 2*i), 0.0f, 65535.0f));
1392
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3538033 times.
3538033 int r = lrintf(av_clipf(65535.0f * rdpx2(src[2] + 2*i), 0.0f, 65535.0f));
1393
1394 3538033 AV_WN16(dstU + 2*i, (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1395 3538033 AV_WN16(dstV + 2*i, (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1396 }
1397 6624 }
1398
1399 6624 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)
1400 {
1401 int i;
1402
1403 6624 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1404
1405
2/2
✓ Branch 0 taken 3538033 times.
✓ Branch 1 taken 6624 times.
3544657 for (i = 0; i < width; i++) {
1406
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3538033 times.
3538033 int g = lrintf(av_clipf(65535.0f * rdpx2(src[0] + 2*i), 0.0f, 65535.0f));
1407
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3538033 times.
3538033 int b = lrintf(av_clipf(65535.0f * rdpx2(src[1] + 2*i), 0.0f, 65535.0f));
1408
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3538033 times.
3538033 int r = lrintf(av_clipf(65535.0f * rdpx2(src[2] + 2*i), 0.0f, 65535.0f));
1409
1410 3538033 AV_WN16(dst + 2*i, (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1411 }
1412 6624 }
1413
1414 24 static av_always_inline void grayf16ToY16_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
1415 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1416 {
1417 int i;
1418
1419
2/2
✓ Branch 0 taken 288 times.
✓ Branch 1 taken 24 times.
312 for (i = 0; i < width; ++i){
1420
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)));
1421 }
1422 24 }
1423
1424 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1425 const uint16_t *src, int width,
1426 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1427 {
1428 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1429 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1430 int i;
1431 for (i = 0; i < width; i++) {
1432 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) +
1433 lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1;
1434 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) +
1435 lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1;
1436 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) +
1437 lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1;
1438
1439 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1440 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1441 }
1442 }
1443
1444 static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1445 const uint16_t *src, int width,
1446 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1447 {
1448 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1449 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1450 int i;
1451 for (i = 0; i < width; i++) {
1452 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1453 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1454 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1455
1456 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1457 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1458 }
1459 }
1460
1461 static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1462 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1463 {
1464 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1465 int i;
1466 for (i = 0; i < width; i++) {
1467 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1468 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1469 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1470
1471 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1472 }
1473 }
1474
1475 static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be,
1476 int width, Half2FloatTables *h2f_tbl)
1477 {
1478 int i;
1479 for (i=0; i<width; i++) {
1480 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[i*4+3]), 0.0f, 65535.0f));
1481 }
1482 }
1483
1484 static av_always_inline void rgbf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1485 const uint16_t *src, int width,
1486 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1487 {
1488 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1489 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1490 int i;
1491 for (i = 0; i < width; i++) {
1492 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+0]), 0.0f, 65535.0f)) +
1493 lrintf(av_clipf(65535.0f * rdpx(src[i*6+3]), 0.0f, 65535.0f))) >> 1;
1494 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+1]), 0.0f, 65535.0f)) +
1495 lrintf(av_clipf(65535.0f * rdpx(src[i*6+4]), 0.0f, 65535.0f))) >> 1;
1496 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+2]), 0.0f, 65535.0f)) +
1497 lrintf(av_clipf(65535.0f * rdpx(src[i*6+5]), 0.0f, 65535.0f))) >> 1;
1498
1499 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1500 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1501 }
1502 }
1503
1504 static av_always_inline void rgbf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1505 const uint16_t *src, int width,
1506 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1507 {
1508 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1509 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1510 int i;
1511 for (i = 0; i < width; i++) {
1512 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1513 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1514 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1515
1516 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1517 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1518 }
1519 }
1520
1521 static av_always_inline void rgbf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1522 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1523 {
1524 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1525 int i;
1526 for (i = 0; i < width; i++) {
1527 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1528 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1529 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1530
1531 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1532 }
1533 }
1534
1535 #undef rdpx
1536
1537 #define rgbaf16_funcs_endian(endian_name, endian) \
1538 static void planar_rgbf16##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1539 int w, int32_t *rgb2yuv, void *opq) \
1540 { \
1541 planar_rgbf16_to_y(dst, src, w, endian, rgb2yuv, opq); \
1542 } \
1543 static void planar_rgbf16##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1544 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1545 void *opq) \
1546 { \
1547 planar_rgbf16_to_uv(dstU, dstV, src, w, endian, rgb2yuv, opq); \
1548 } \
1549 static void planar_rgbf16##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1550 int w, int32_t *rgb2yuv, void *opq) \
1551 { \
1552 planar_rgbf16_to_a(dst, src, w, endian, rgb2yuv, opq); \
1553 } \
1554 static void grayf16##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1555 const uint8_t *unused1, const uint8_t *unused2, \
1556 int width, uint32_t *unused, void *opq) \
1557 { \
1558 grayf16ToY16_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1559 } \
1560 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1561 const uint8_t *src1, const uint8_t *src2, \
1562 int width, uint32_t *_rgb2yuv, void *opq) \
1563 { \
1564 const uint16_t *src = (const uint16_t*)src1; \
1565 uint16_t *dstU = (uint16_t*)_dstU; \
1566 uint16_t *dstV = (uint16_t*)_dstV; \
1567 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1568 av_assert1(src1==src2); \
1569 rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1570 } \
1571 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1572 const uint8_t *src1, const uint8_t *src2, \
1573 int width, uint32_t *_rgb2yuv, void *opq) \
1574 { \
1575 const uint16_t *src = (const uint16_t*)src1; \
1576 uint16_t *dstU = (uint16_t*)_dstU; \
1577 uint16_t *dstV = (uint16_t*)_dstV; \
1578 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1579 av_assert1(src1==src2); \
1580 rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1581 } \
1582 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1583 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1584 { \
1585 const uint16_t *src = (const uint16_t*)_src; \
1586 uint16_t *dst = (uint16_t*)_dst; \
1587 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1588 rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1589 } \
1590 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1591 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1592 { \
1593 const uint16_t *src = (const uint16_t*)_src; \
1594 uint16_t *dst = (uint16_t*)_dst; \
1595 rgbaf16ToA_endian(dst, src, endian, width, opq); \
1596 } \
1597 static void rgbf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1598 const uint8_t *src1, const uint8_t *src2, \
1599 int width, uint32_t *_rgb2yuv, void *opq) \
1600 { \
1601 const uint16_t *src = (const uint16_t*)src1; \
1602 uint16_t *dstU = (uint16_t*)_dstU; \
1603 uint16_t *dstV = (uint16_t*)_dstV; \
1604 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1605 av_assert1(src1==src2); \
1606 rgbf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1607 } \
1608 static void rgbf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1609 const uint8_t *src1, const uint8_t *src2, \
1610 int width, uint32_t *_rgb2yuv, void *opq) \
1611 { \
1612 const uint16_t *src = (const uint16_t*)src1; \
1613 uint16_t *dstU = (uint16_t*)_dstU; \
1614 uint16_t *dstV = (uint16_t*)_dstV; \
1615 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1616 av_assert1(src1==src2); \
1617 rgbf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1618 } \
1619 static void rgbf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1620 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1621 { \
1622 const uint16_t *src = (const uint16_t*)_src; \
1623 uint16_t *dst = (uint16_t*)_dst; \
1624 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1625 rgbf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1626 } \
1627
1628 32810 rgbaf16_funcs_endian(le, 0)
1629 rgbaf16_funcs_endian(be, 1)
1630
1631 33469 av_cold void ff_sws_init_input_funcs(SwsInternal *c,
1632 planar1_YV12_fn *lumToYV12,
1633 planar1_YV12_fn *alpToYV12,
1634 planar2_YV12_fn *chrToYV12,
1635 planarX_YV12_fn *readLumPlanar,
1636 planarX_YV12_fn *readAlpPlanar,
1637 planarX2_YV12_fn *readChrPlanar)
1638 {
1639 33469 enum AVPixelFormat srcFormat = c->opts.src_format;
1640
1641 33469 *chrToYV12 = NULL;
1642
43/46
✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 86 times.
✓ Branch 4 taken 235 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 30 times.
✓ Branch 7 taken 158 times.
✓ Branch 8 taken 1308 times.
✓ Branch 9 taken 1304 times.
✓ Branch 10 taken 159 times.
✓ Branch 11 taken 648 times.
✓ Branch 12 taken 422 times.
✓ Branch 13 taken 393 times.
✓ Branch 14 taken 157 times.
✓ Branch 15 taken 452 times.
✓ Branch 16 taken 452 times.
✓ Branch 17 taken 158 times.
✓ Branch 18 taken 492 times.
✓ Branch 19 taken 392 times.
✗ Branch 20 not taken.
✓ Branch 21 taken 1314 times.
✓ Branch 22 taken 868 times.
✓ Branch 23 taken 83 times.
✓ Branch 24 taken 81 times.
✓ Branch 25 taken 95 times.
✓ Branch 26 taken 1 times.
✓ Branch 27 taken 1 times.
✓ Branch 28 taken 1 times.
✓ Branch 29 taken 5 times.
✓ Branch 30 taken 81 times.
✓ Branch 31 taken 81 times.
✓ Branch 32 taken 101 times.
✓ Branch 33 taken 101 times.
✓ Branch 34 taken 243 times.
✓ Branch 35 taken 243 times.
✓ Branch 36 taken 243 times.
✓ Branch 37 taken 243 times.
✓ Branch 38 taken 303 times.
✓ Branch 39 taken 303 times.
✓ Branch 40 taken 81 times.
✓ Branch 41 taken 81 times.
✓ Branch 42 taken 101 times.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✓ Branch 45 taken 21721 times.
33469 switch (srcFormat) {
1643 82 case AV_PIX_FMT_YUYV422:
1644 82 *chrToYV12 = yuy2ToUV_c;
1645 82 break;
1646 82 case AV_PIX_FMT_YVYU422:
1647 82 *chrToYV12 = yvy2ToUV_c;
1648 82 break;
1649 82 case AV_PIX_FMT_UYVY422:
1650 82 *chrToYV12 = uyvyToUV_c;
1651 82 break;
1652 86 case AV_PIX_FMT_VYU444:
1653 86 *chrToYV12 = vyuToUV_c;
1654 86 break;
1655 235 case AV_PIX_FMT_NV12:
1656 case AV_PIX_FMT_NV16:
1657 case AV_PIX_FMT_NV24:
1658 235 *chrToYV12 = nv12ToUV_c;
1659 235 break;
1660 2 case AV_PIX_FMT_NV21:
1661 case AV_PIX_FMT_NV42:
1662 2 *chrToYV12 = nv21ToUV_c;
1663 2 break;
1664 30 case AV_PIX_FMT_RGB8:
1665 case AV_PIX_FMT_BGR8:
1666 case AV_PIX_FMT_PAL8:
1667 case AV_PIX_FMT_BGR4_BYTE:
1668 case AV_PIX_FMT_RGB4_BYTE:
1669 30 *chrToYV12 = palToUV_c;
1670 30 break;
1671 158 case AV_PIX_FMT_GBRP9LE:
1672 158 *readChrPlanar = planar_rgb9le_to_uv;
1673 158 break;
1674 1308 case AV_PIX_FMT_GBRAP10LE:
1675 case AV_PIX_FMT_GBRP10LE:
1676 1308 *readChrPlanar = planar_rgb10le_to_uv;
1677 1308 break;
1678 1304 case AV_PIX_FMT_GBRAP12LE:
1679 case AV_PIX_FMT_GBRP12LE:
1680 1304 *readChrPlanar = planar_rgb12le_to_uv;
1681 1304 break;
1682 159 case AV_PIX_FMT_GBRAP14LE:
1683 case AV_PIX_FMT_GBRP14LE:
1684 159 *readChrPlanar = planar_rgb14le_to_uv;
1685 159 break;
1686 648 case AV_PIX_FMT_GBRAP16LE:
1687 case AV_PIX_FMT_GBRP16LE:
1688 648 *readChrPlanar = planar_rgb16le_to_uv;
1689 648 break;
1690 422 case AV_PIX_FMT_GBRAPF32LE:
1691 case AV_PIX_FMT_GBRPF32LE:
1692 422 *readChrPlanar = planar_rgbf32le_to_uv;
1693 422 break;
1694 393 case AV_PIX_FMT_GBRAPF16LE:
1695 case AV_PIX_FMT_GBRPF16LE:
1696 393 *readChrPlanar = planar_rgbf16le_to_uv;
1697 393 break;
1698 157 case AV_PIX_FMT_GBRP9BE:
1699 157 *readChrPlanar = planar_rgb9be_to_uv;
1700 157 break;
1701 452 case AV_PIX_FMT_GBRAP10BE:
1702 case AV_PIX_FMT_GBRP10BE:
1703 452 *readChrPlanar = planar_rgb10be_to_uv;
1704 452 break;
1705 452 case AV_PIX_FMT_GBRAP12BE:
1706 case AV_PIX_FMT_GBRP12BE:
1707 452 *readChrPlanar = planar_rgb12be_to_uv;
1708 452 break;
1709 158 case AV_PIX_FMT_GBRAP14BE:
1710 case AV_PIX_FMT_GBRP14BE:
1711 158 *readChrPlanar = planar_rgb14be_to_uv;
1712 158 break;
1713 492 case AV_PIX_FMT_GBRAP16BE:
1714 case AV_PIX_FMT_GBRP16BE:
1715 492 *readChrPlanar = planar_rgb16be_to_uv;
1716 492 break;
1717 392 case AV_PIX_FMT_GBRAPF32BE:
1718 case AV_PIX_FMT_GBRPF32BE:
1719 392 *readChrPlanar = planar_rgbf32be_to_uv;
1720 392 break;
1721 case AV_PIX_FMT_GBRAPF16BE:
1722 case AV_PIX_FMT_GBRPF16BE:
1723 *readChrPlanar = planar_rgbf16be_to_uv;
1724 break;
1725 1314 case AV_PIX_FMT_GBRAP:
1726 case AV_PIX_FMT_GBRP:
1727 1314 *readChrPlanar = planar_rgb_to_uv;
1728 1314 break;
1729 #if HAVE_BIGENDIAN
1730 case AV_PIX_FMT_YUV420P9LE:
1731 case AV_PIX_FMT_YUV422P9LE:
1732 case AV_PIX_FMT_YUV444P9LE:
1733 case AV_PIX_FMT_YUV420P10LE:
1734 case AV_PIX_FMT_YUV422P10LE:
1735 case AV_PIX_FMT_YUV440P10LE:
1736 case AV_PIX_FMT_YUV444P10LE:
1737 case AV_PIX_FMT_YUV420P12LE:
1738 case AV_PIX_FMT_YUV422P12LE:
1739 case AV_PIX_FMT_YUV440P12LE:
1740 case AV_PIX_FMT_YUV444P12LE:
1741 case AV_PIX_FMT_YUV420P14LE:
1742 case AV_PIX_FMT_YUV422P14LE:
1743 case AV_PIX_FMT_YUV444P14LE:
1744 case AV_PIX_FMT_YUV420P16LE:
1745 case AV_PIX_FMT_YUV422P16LE:
1746 case AV_PIX_FMT_YUV444P16LE:
1747
1748 case AV_PIX_FMT_YUVA420P9LE:
1749 case AV_PIX_FMT_YUVA422P9LE:
1750 case AV_PIX_FMT_YUVA444P9LE:
1751 case AV_PIX_FMT_YUVA420P10LE:
1752 case AV_PIX_FMT_YUVA422P10LE:
1753 case AV_PIX_FMT_YUVA444P10LE:
1754 case AV_PIX_FMT_YUVA422P12LE:
1755 case AV_PIX_FMT_YUVA444P12LE:
1756 case AV_PIX_FMT_YUVA420P16LE:
1757 case AV_PIX_FMT_YUVA422P16LE:
1758 case AV_PIX_FMT_YUVA444P16LE:
1759 *chrToYV12 = bswap16UV_c;
1760 break;
1761 #else
1762 868 case AV_PIX_FMT_YUV420P9BE:
1763 case AV_PIX_FMT_YUV422P9BE:
1764 case AV_PIX_FMT_YUV444P9BE:
1765 case AV_PIX_FMT_YUV420P10BE:
1766 case AV_PIX_FMT_YUV422P10BE:
1767 case AV_PIX_FMT_YUV440P10BE:
1768 case AV_PIX_FMT_YUV444P10BE:
1769 case AV_PIX_FMT_YUV420P12BE:
1770 case AV_PIX_FMT_YUV422P12BE:
1771 case AV_PIX_FMT_YUV440P12BE:
1772 case AV_PIX_FMT_YUV444P12BE:
1773 case AV_PIX_FMT_YUV420P14BE:
1774 case AV_PIX_FMT_YUV422P14BE:
1775 case AV_PIX_FMT_YUV444P14BE:
1776 case AV_PIX_FMT_YUV420P16BE:
1777 case AV_PIX_FMT_YUV422P16BE:
1778 case AV_PIX_FMT_YUV444P16BE:
1779
1780 case AV_PIX_FMT_YUVA420P9BE:
1781 case AV_PIX_FMT_YUVA422P9BE:
1782 case AV_PIX_FMT_YUVA444P9BE:
1783 case AV_PIX_FMT_YUVA420P10BE:
1784 case AV_PIX_FMT_YUVA422P10BE:
1785 case AV_PIX_FMT_YUVA444P10BE:
1786 case AV_PIX_FMT_YUVA422P12BE:
1787 case AV_PIX_FMT_YUVA444P12BE:
1788 case AV_PIX_FMT_YUVA420P16BE:
1789 case AV_PIX_FMT_YUVA422P16BE:
1790 case AV_PIX_FMT_YUVA444P16BE:
1791 868 *chrToYV12 = bswap16UV_c;
1792 868 break;
1793 #endif
1794 83 case AV_PIX_FMT_VUYA:
1795 case AV_PIX_FMT_VUYX:
1796 83 *chrToYV12 = read_vuyx_UV_c;
1797 83 break;
1798 81 case AV_PIX_FMT_XV30LE:
1799 81 *chrToYV12 = read_xv30le_UV_c;
1800 81 break;
1801 95 case AV_PIX_FMT_V30XLE:
1802 95 *chrToYV12 = read_v30xle_UV_c;
1803 95 break;
1804 1 case AV_PIX_FMT_AYUV:
1805 1 *chrToYV12 = read_ayuv_UV_c;
1806 1 break;
1807 1 case AV_PIX_FMT_AYUV64LE:
1808 1 *chrToYV12 = read_ayuv64le_UV_c;
1809 1 break;
1810 1 case AV_PIX_FMT_AYUV64BE:
1811 1 *chrToYV12 = read_ayuv64be_UV_c;
1812 1 break;
1813 5 case AV_PIX_FMT_UYVA:
1814 5 *chrToYV12 = read_uyva_UV_c;
1815 5 break;
1816 81 case AV_PIX_FMT_XV36LE:
1817 81 *chrToYV12 = read_xv36le_UV_c;
1818 81 break;
1819 81 case AV_PIX_FMT_XV36BE:
1820 81 *chrToYV12 = read_xv36be_UV_c;
1821 81 break;
1822 101 case AV_PIX_FMT_XV48LE:
1823 101 *chrToYV12 = read_xv48le_UV_c;
1824 101 break;
1825 101 case AV_PIX_FMT_XV48BE:
1826 101 *chrToYV12 = read_xv48be_UV_c;
1827 101 break;
1828 243 case AV_PIX_FMT_P010LE:
1829 case AV_PIX_FMT_P210LE:
1830 case AV_PIX_FMT_P410LE:
1831 243 *chrToYV12 = p010LEToUV_c;
1832 243 break;
1833 243 case AV_PIX_FMT_P010BE:
1834 case AV_PIX_FMT_P210BE:
1835 case AV_PIX_FMT_P410BE:
1836 243 *chrToYV12 = p010BEToUV_c;
1837 243 break;
1838 243 case AV_PIX_FMT_P012LE:
1839 case AV_PIX_FMT_P212LE:
1840 case AV_PIX_FMT_P412LE:
1841 243 *chrToYV12 = p012LEToUV_c;
1842 243 break;
1843 243 case AV_PIX_FMT_P012BE:
1844 case AV_PIX_FMT_P212BE:
1845 case AV_PIX_FMT_P412BE:
1846 243 *chrToYV12 = p012BEToUV_c;
1847 243 break;
1848 303 case AV_PIX_FMT_P016LE:
1849 case AV_PIX_FMT_P216LE:
1850 case AV_PIX_FMT_P416LE:
1851 303 *chrToYV12 = p016LEToUV_c;
1852 303 break;
1853 303 case AV_PIX_FMT_P016BE:
1854 case AV_PIX_FMT_P216BE:
1855 case AV_PIX_FMT_P416BE:
1856 303 *chrToYV12 = p016BEToUV_c;
1857 303 break;
1858 81 case AV_PIX_FMT_Y210LE:
1859 81 *chrToYV12 = y210le_UV_c;
1860 81 break;
1861 81 case AV_PIX_FMT_Y212LE:
1862 81 *chrToYV12 = y212le_UV_c;
1863 81 break;
1864 101 case AV_PIX_FMT_Y216LE:
1865 101 *chrToYV12 = y216le_UV_c;
1866 101 break;
1867 case AV_PIX_FMT_RGBF32LE:
1868 *chrToYV12 = rgbf32le_to_uv_c;
1869 break;
1870 case AV_PIX_FMT_RGBF32BE:
1871 *chrToYV12 = rgbf32be_to_uv_c;
1872 break;
1873 }
1874
2/2
✓ Branch 0 taken 22430 times.
✓ Branch 1 taken 11039 times.
33469 if (c->chrSrcHSubSample) {
1875
21/34
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 424 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 58 times.
✓ Branch 9 taken 26 times.
✓ Branch 10 taken 56 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 810 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 18 taken 64 times.
✓ Branch 19 taken 36 times.
✓ Branch 20 taken 532 times.
✓ Branch 21 taken 5 times.
✓ Branch 22 taken 1 times.
✓ Branch 23 taken 16 times.
✓ Branch 24 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 33 taken 20393 times.
22430 switch (srcFormat) {
1876 case AV_PIX_FMT_RGBA64BE:
1877 *chrToYV12 = rgb64BEToUV_half_c;
1878 break;
1879 case AV_PIX_FMT_RGBA64LE:
1880 *chrToYV12 = rgb64LEToUV_half_c;
1881 break;
1882 case AV_PIX_FMT_BGRA64BE:
1883 *chrToYV12 = bgr64BEToUV_half_c;
1884 break;
1885 case AV_PIX_FMT_BGRA64LE:
1886 *chrToYV12 = bgr64LEToUV_half_c;
1887 break;
1888 case AV_PIX_FMT_RGB48BE:
1889 *chrToYV12 = rgb48BEToUV_half_c;
1890 break;
1891 424 case AV_PIX_FMT_RGB48LE:
1892 424 *chrToYV12 = rgb48LEToUV_half_c;
1893 424 break;
1894 case AV_PIX_FMT_BGR48BE:
1895 *chrToYV12 = bgr48BEToUV_half_c;
1896 break;
1897 case AV_PIX_FMT_BGR48LE:
1898 *chrToYV12 = bgr48LEToUV_half_c;
1899 break;
1900 58 case AV_PIX_FMT_RGB32:
1901 58 *chrToYV12 = bgr32ToUV_half_c;
1902 58 break;
1903 26 case AV_PIX_FMT_RGB32_1:
1904 26 *chrToYV12 = bgr321ToUV_half_c;
1905 26 break;
1906 56 case AV_PIX_FMT_BGR24:
1907 56 *chrToYV12 = bgr24ToUV_half_c;
1908 56 break;
1909 1 case AV_PIX_FMT_BGR565LE:
1910 1 *chrToYV12 = bgr16leToUV_half_c;
1911 1 break;
1912 1 case AV_PIX_FMT_BGR565BE:
1913 1 *chrToYV12 = bgr16beToUV_half_c;
1914 1 break;
1915 1 case AV_PIX_FMT_BGR555LE:
1916 1 *chrToYV12 = bgr15leToUV_half_c;
1917 1 break;
1918 1 case AV_PIX_FMT_BGR555BE:
1919 1 *chrToYV12 = bgr15beToUV_half_c;
1920 1 break;
1921 810 case AV_PIX_FMT_GBRAP:
1922 case AV_PIX_FMT_GBRP:
1923 810 *chrToYV12 = gbr24pToUV_half_c;
1924 810 break;
1925 1 case AV_PIX_FMT_BGR444LE:
1926 1 *chrToYV12 = bgr12leToUV_half_c;
1927 1 break;
1928 1 case AV_PIX_FMT_BGR444BE:
1929 1 *chrToYV12 = bgr12beToUV_half_c;
1930 1 break;
1931 64 case AV_PIX_FMT_BGR32:
1932 64 *chrToYV12 = rgb32ToUV_half_c;
1933 64 break;
1934 36 case AV_PIX_FMT_BGR32_1:
1935 36 *chrToYV12 = rgb321ToUV_half_c;
1936 36 break;
1937 532 case AV_PIX_FMT_RGB24:
1938 532 *chrToYV12 = rgb24ToUV_half_c;
1939 532 break;
1940 5 case AV_PIX_FMT_RGB565LE:
1941 5 *chrToYV12 = rgb16leToUV_half_c;
1942 5 break;
1943 1 case AV_PIX_FMT_RGB565BE:
1944 1 *chrToYV12 = rgb16beToUV_half_c;
1945 1 break;
1946 16 case AV_PIX_FMT_RGB555LE:
1947 16 *chrToYV12 = rgb15leToUV_half_c;
1948 16 break;
1949 1 case AV_PIX_FMT_RGB555BE:
1950 1 *chrToYV12 = rgb15beToUV_half_c;
1951 1 break;
1952 1 case AV_PIX_FMT_RGB444LE:
1953 1 *chrToYV12 = rgb12leToUV_half_c;
1954 1 break;
1955 1 case AV_PIX_FMT_RGB444BE:
1956 1 *chrToYV12 = rgb12beToUV_half_c;
1957 1 break;
1958 case AV_PIX_FMT_X2RGB10LE:
1959 *chrToYV12 = rgb30leToUV_half_c;
1960 break;
1961 case AV_PIX_FMT_X2BGR10LE:
1962 *chrToYV12 = bgr30leToUV_half_c;
1963 break;
1964 case AV_PIX_FMT_RGBAF16BE:
1965 *chrToYV12 = rgbaf16beToUV_half_c;
1966 break;
1967 case AV_PIX_FMT_RGBAF16LE:
1968 *chrToYV12 = rgbaf16leToUV_half_c;
1969 break;
1970 case AV_PIX_FMT_RGBF16BE:
1971 *chrToYV12 = rgbf16beToUV_half_c;
1972 break;
1973 case AV_PIX_FMT_RGBF16LE:
1974 *chrToYV12 = rgbf16leToUV_half_c;
1975 break;
1976 }
1977 } else {
1978
19/33
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 524 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 198 times.
✓ Branch 9 taken 30 times.
✓ Branch 10 taken 76 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 50 times.
✓ Branch 18 taken 30 times.
✓ Branch 19 taken 577 times.
✓ Branch 20 taken 71 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 71 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 51 times.
✓ Branch 27 taken 51 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 9279 times.
11039 switch (srcFormat) {
1979 11 case AV_PIX_FMT_RGBA64BE:
1980 11 *chrToYV12 = rgb64BEToUV_c;
1981 11 break;
1982 2 case AV_PIX_FMT_RGBA64LE:
1983 2 *chrToYV12 = rgb64LEToUV_c;
1984 2 break;
1985 1 case AV_PIX_FMT_BGRA64BE:
1986 1 *chrToYV12 = bgr64BEToUV_c;
1987 1 break;
1988 2 case AV_PIX_FMT_BGRA64LE:
1989 2 *chrToYV12 = bgr64LEToUV_c;
1990 2 break;
1991 12 case AV_PIX_FMT_RGB48BE:
1992 12 *chrToYV12 = rgb48BEToUV_c;
1993 12 break;
1994 524 case AV_PIX_FMT_RGB48LE:
1995 524 *chrToYV12 = rgb48LEToUV_c;
1996 524 break;
1997 1 case AV_PIX_FMT_BGR48BE:
1998 1 *chrToYV12 = bgr48BEToUV_c;
1999 1 break;
2000 2 case AV_PIX_FMT_BGR48LE:
2001 2 *chrToYV12 = bgr48LEToUV_c;
2002 2 break;
2003 198 case AV_PIX_FMT_RGB32:
2004 198 *chrToYV12 = bgr32ToUV_c;
2005 198 break;
2006 30 case AV_PIX_FMT_RGB32_1:
2007 30 *chrToYV12 = bgr321ToUV_c;
2008 30 break;
2009 76 case AV_PIX_FMT_BGR24:
2010 76 *chrToYV12 = bgr24ToUV_c;
2011 76 break;
2012 case AV_PIX_FMT_BGR565LE:
2013 *chrToYV12 = bgr16leToUV_c;
2014 break;
2015 case AV_PIX_FMT_BGR565BE:
2016 *chrToYV12 = bgr16beToUV_c;
2017 break;
2018 case AV_PIX_FMT_BGR555LE:
2019 *chrToYV12 = bgr15leToUV_c;
2020 break;
2021 case AV_PIX_FMT_BGR555BE:
2022 *chrToYV12 = bgr15beToUV_c;
2023 break;
2024 case AV_PIX_FMT_BGR444LE:
2025 *chrToYV12 = bgr12leToUV_c;
2026 break;
2027 case AV_PIX_FMT_BGR444BE:
2028 *chrToYV12 = bgr12beToUV_c;
2029 break;
2030 50 case AV_PIX_FMT_BGR32:
2031 50 *chrToYV12 = rgb32ToUV_c;
2032 50 break;
2033 30 case AV_PIX_FMT_BGR32_1:
2034 30 *chrToYV12 = rgb321ToUV_c;
2035 30 break;
2036 577 case AV_PIX_FMT_RGB24:
2037 577 *chrToYV12 = rgb24ToUV_c;
2038 577 break;
2039 71 case AV_PIX_FMT_RGB565LE:
2040 71 *chrToYV12 = rgb16leToUV_c;
2041 71 break;
2042 case AV_PIX_FMT_RGB565BE:
2043 *chrToYV12 = rgb16beToUV_c;
2044 break;
2045 71 case AV_PIX_FMT_RGB555LE:
2046 71 *chrToYV12 = rgb15leToUV_c;
2047 71 break;
2048 case AV_PIX_FMT_RGB555BE:
2049 *chrToYV12 = rgb15beToUV_c;
2050 break;
2051 case AV_PIX_FMT_RGB444LE:
2052 *chrToYV12 = rgb12leToUV_c;
2053 break;
2054 case AV_PIX_FMT_RGB444BE:
2055 *chrToYV12 = rgb12beToUV_c;
2056 break;
2057 51 case AV_PIX_FMT_X2RGB10LE:
2058 51 *chrToYV12 = rgb30leToUV_c;
2059 51 break;
2060 51 case AV_PIX_FMT_X2BGR10LE:
2061 51 *chrToYV12 = bgr30leToUV_c;
2062 51 break;
2063 case AV_PIX_FMT_RGBAF16BE:
2064 *chrToYV12 = rgbaf16beToUV_c;
2065 break;
2066 case AV_PIX_FMT_RGBAF16LE:
2067 *chrToYV12 = rgbaf16leToUV_c;
2068 break;
2069 case AV_PIX_FMT_RGBF16BE:
2070 *chrToYV12 = rgbf16beToUV_c;
2071 break;
2072 case AV_PIX_FMT_RGBF16LE:
2073 *chrToYV12 = rgbf16leToUV_c;
2074 break;
2075 }
2076 }
2077
2078 33469 *lumToYV12 = NULL;
2079 33469 *alpToYV12 = NULL;
2080
83/92
✓ Branch 0 taken 158 times.
✓ Branch 1 taken 236 times.
✓ Branch 2 taken 1072 times.
✓ Branch 3 taken 236 times.
✓ Branch 4 taken 1068 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 158 times.
✓ Branch 7 taken 236 times.
✓ Branch 8 taken 412 times.
✓ Branch 9 taken 235 times.
✓ Branch 10 taken 187 times.
✓ Branch 11 taken 124 times.
✓ Branch 12 taken 269 times.
✓ Branch 13 taken 157 times.
✓ Branch 14 taken 235 times.
✓ Branch 15 taken 217 times.
✓ Branch 16 taken 235 times.
✓ Branch 17 taken 217 times.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 157 times.
✓ Branch 20 taken 245 times.
✓ Branch 21 taken 247 times.
✓ Branch 22 taken 235 times.
✓ Branch 23 taken 157 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 276 times.
✓ Branch 27 taken 1038 times.
✓ Branch 28 taken 1445 times.
✓ Branch 29 taken 11 times.
✓ Branch 30 taken 1 times.
✓ Branch 31 taken 21 times.
✓ Branch 32 taken 83 times.
✓ Branch 33 taken 81 times.
✓ Branch 34 taken 95 times.
✓ Branch 35 taken 6 times.
✓ Branch 36 taken 102 times.
✓ Branch 37 taken 102 times.
✓ Branch 38 taken 81 times.
✓ Branch 39 taken 81 times.
✓ Branch 40 taken 185 times.
✓ Branch 41 taken 82 times.
✓ Branch 42 taken 86 times.
✓ Branch 43 taken 132 times.
✓ Branch 44 taken 1 times.
✓ Branch 45 taken 1 times.
✓ Branch 46 taken 1 times.
✓ Branch 47 taken 1 times.
✓ Branch 48 taken 1 times.
✓ Branch 49 taken 1 times.
✓ Branch 50 taken 1109 times.
✓ Branch 51 taken 76 times.
✓ Branch 52 taken 1 times.
✓ Branch 53 taken 87 times.
✓ Branch 54 taken 1 times.
✓ Branch 55 taken 1 times.
✓ Branch 56 taken 1 times.
✓ Branch 57 taken 30 times.
✓ Branch 58 taken 82 times.
✓ Branch 59 taken 86 times.
✓ Branch 60 taken 256 times.
✓ Branch 61 taken 56 times.
✓ Branch 62 taken 114 times.
✓ Branch 63 taken 66 times.
✓ Branch 64 taken 12 times.
✓ Branch 65 taken 948 times.
✓ Branch 66 taken 1 times.
✓ Branch 67 taken 2 times.
✓ Branch 68 taken 11 times.
✓ Branch 69 taken 2 times.
✓ Branch 70 taken 1 times.
✓ Branch 71 taken 2 times.
✓ Branch 72 taken 243 times.
✓ Branch 73 taken 243 times.
✓ Branch 74 taken 243 times.
✓ Branch 75 taken 243 times.
✓ Branch 76 taken 1 times.
✓ Branch 77 taken 1 times.
✓ Branch 78 taken 18 times.
✗ Branch 79 not taken.
✓ Branch 80 taken 81 times.
✓ Branch 81 taken 81 times.
✓ Branch 82 taken 101 times.
✓ Branch 83 taken 51 times.
✓ Branch 84 taken 51 times.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 90 not taken.
✓ Branch 91 taken 18758 times.
33469 switch (srcFormat) {
2081 158 case AV_PIX_FMT_GBRP9LE:
2082 158 *readLumPlanar = planar_rgb9le_to_y;
2083 158 break;
2084 236 case AV_PIX_FMT_GBRAP10LE:
2085 236 *readAlpPlanar = planar_rgb10le_to_a;
2086 1308 case AV_PIX_FMT_GBRP10LE:
2087 1308 *readLumPlanar = planar_rgb10le_to_y;
2088 1308 break;
2089 236 case AV_PIX_FMT_GBRAP12LE:
2090 236 *readAlpPlanar = planar_rgb12le_to_a;
2091 1304 case AV_PIX_FMT_GBRP12LE:
2092 1304 *readLumPlanar = planar_rgb12le_to_y;
2093 1304 break;
2094 1 case AV_PIX_FMT_GBRAP14LE:
2095 1 *readAlpPlanar = planar_rgb14le_to_a;
2096 159 case AV_PIX_FMT_GBRP14LE:
2097 159 *readLumPlanar = planar_rgb14le_to_y;
2098 159 break;
2099 236 case AV_PIX_FMT_GBRAP16LE:
2100 236 *readAlpPlanar = planar_rgb16le_to_a;
2101 648 case AV_PIX_FMT_GBRP16LE:
2102 648 *readLumPlanar = planar_rgb16le_to_y;
2103 648 break;
2104 235 case AV_PIX_FMT_GBRAPF32LE:
2105 235 *readAlpPlanar = planar_rgbf32le_to_a;
2106 422 case AV_PIX_FMT_GBRPF32LE:
2107 422 *readLumPlanar = planar_rgbf32le_to_y;
2108 422 break;
2109 124 case AV_PIX_FMT_GBRAPF16LE:
2110 124 *readAlpPlanar = planar_rgbf16le_to_a;
2111 393 case AV_PIX_FMT_GBRPF16LE:
2112 393 *readLumPlanar = planar_rgbf16le_to_y;
2113 393 break;
2114 157 case AV_PIX_FMT_GBRP9BE:
2115 157 *readLumPlanar = planar_rgb9be_to_y;
2116 157 break;
2117 235 case AV_PIX_FMT_GBRAP10BE:
2118 235 *readAlpPlanar = planar_rgb10be_to_a;
2119 452 case AV_PIX_FMT_GBRP10BE:
2120 452 *readLumPlanar = planar_rgb10be_to_y;
2121 452 break;
2122 235 case AV_PIX_FMT_GBRAP12BE:
2123 235 *readAlpPlanar = planar_rgb12be_to_a;
2124 452 case AV_PIX_FMT_GBRP12BE:
2125 452 *readLumPlanar = planar_rgb12be_to_y;
2126 452 break;
2127 1 case AV_PIX_FMT_GBRAP14BE:
2128 1 *readAlpPlanar = planar_rgb14be_to_a;
2129 158 case AV_PIX_FMT_GBRP14BE:
2130 158 *readLumPlanar = planar_rgb14be_to_y;
2131 158 break;
2132 245 case AV_PIX_FMT_GBRAP16BE:
2133 245 *readAlpPlanar = planar_rgb16be_to_a;
2134 492 case AV_PIX_FMT_GBRP16BE:
2135 492 *readLumPlanar = planar_rgb16be_to_y;
2136 492 break;
2137 235 case AV_PIX_FMT_GBRAPF32BE:
2138 235 *readAlpPlanar = planar_rgbf32be_to_a;
2139 392 case AV_PIX_FMT_GBRPF32BE:
2140 392 *readLumPlanar = planar_rgbf32be_to_y;
2141 392 break;
2142 case AV_PIX_FMT_GBRAPF16BE:
2143 *readAlpPlanar = planar_rgbf16be_to_a;
2144 case AV_PIX_FMT_GBRPF16BE:
2145 *readLumPlanar = planar_rgbf16be_to_y;
2146 break;
2147 276 case AV_PIX_FMT_GBRAP:
2148 276 *readAlpPlanar = planar_rgb_to_a;
2149 1314 case AV_PIX_FMT_GBRP:
2150 1314 *readLumPlanar = planar_rgb_to_y;
2151 1314 break;
2152 #if HAVE_BIGENDIAN
2153 case AV_PIX_FMT_YUV420P9LE:
2154 case AV_PIX_FMT_YUV422P9LE:
2155 case AV_PIX_FMT_YUV444P9LE:
2156 case AV_PIX_FMT_YUV420P10LE:
2157 case AV_PIX_FMT_YUV422P10LE:
2158 case AV_PIX_FMT_YUV440P10LE:
2159 case AV_PIX_FMT_YUV444P10LE:
2160 case AV_PIX_FMT_YUV420P12LE:
2161 case AV_PIX_FMT_YUV422P12LE:
2162 case AV_PIX_FMT_YUV440P12LE:
2163 case AV_PIX_FMT_YUV444P12LE:
2164 case AV_PIX_FMT_YUV420P14LE:
2165 case AV_PIX_FMT_YUV422P14LE:
2166 case AV_PIX_FMT_YUV444P14LE:
2167 case AV_PIX_FMT_YUV420P16LE:
2168 case AV_PIX_FMT_YUV422P16LE:
2169 case AV_PIX_FMT_YUV444P16LE:
2170
2171 case AV_PIX_FMT_GRAY9LE:
2172 case AV_PIX_FMT_GRAY10LE:
2173 case AV_PIX_FMT_GRAY12LE:
2174 case AV_PIX_FMT_GRAY14LE:
2175 case AV_PIX_FMT_GRAY16LE:
2176
2177 case AV_PIX_FMT_P016LE:
2178 case AV_PIX_FMT_P216LE:
2179 case AV_PIX_FMT_P416LE:
2180 *lumToYV12 = bswap16Y_c;
2181 break;
2182 case AV_PIX_FMT_YUVA420P9LE:
2183 case AV_PIX_FMT_YUVA422P9LE:
2184 case AV_PIX_FMT_YUVA444P9LE:
2185 case AV_PIX_FMT_YUVA420P10LE:
2186 case AV_PIX_FMT_YUVA422P10LE:
2187 case AV_PIX_FMT_YUVA444P10LE:
2188 case AV_PIX_FMT_YUVA422P12LE:
2189 case AV_PIX_FMT_YUVA444P12LE:
2190 case AV_PIX_FMT_YUVA420P16LE:
2191 case AV_PIX_FMT_YUVA422P16LE:
2192 case AV_PIX_FMT_YUVA444P16LE:
2193 *lumToYV12 = bswap16Y_c;
2194 *alpToYV12 = bswap16Y_c;
2195 break;
2196 #else
2197 1445 case AV_PIX_FMT_YUV420P9BE:
2198 case AV_PIX_FMT_YUV422P9BE:
2199 case AV_PIX_FMT_YUV444P9BE:
2200 case AV_PIX_FMT_YUV420P10BE:
2201 case AV_PIX_FMT_YUV422P10BE:
2202 case AV_PIX_FMT_YUV440P10BE:
2203 case AV_PIX_FMT_YUV444P10BE:
2204 case AV_PIX_FMT_YUV420P12BE:
2205 case AV_PIX_FMT_YUV422P12BE:
2206 case AV_PIX_FMT_YUV440P12BE:
2207 case AV_PIX_FMT_YUV444P12BE:
2208 case AV_PIX_FMT_YUV420P14BE:
2209 case AV_PIX_FMT_YUV422P14BE:
2210 case AV_PIX_FMT_YUV444P14BE:
2211 case AV_PIX_FMT_YUV420P16BE:
2212 case AV_PIX_FMT_YUV422P16BE:
2213 case AV_PIX_FMT_YUV444P16BE:
2214
2215 case AV_PIX_FMT_GRAY9BE:
2216 case AV_PIX_FMT_GRAY10BE:
2217 case AV_PIX_FMT_GRAY12BE:
2218 case AV_PIX_FMT_GRAY14BE:
2219 case AV_PIX_FMT_GRAY16BE:
2220
2221 case AV_PIX_FMT_P016BE:
2222 case AV_PIX_FMT_P216BE:
2223 case AV_PIX_FMT_P416BE:
2224 1445 *lumToYV12 = bswap16Y_c;
2225 1445 break;
2226 11 case AV_PIX_FMT_YUVA420P9BE:
2227 case AV_PIX_FMT_YUVA422P9BE:
2228 case AV_PIX_FMT_YUVA444P9BE:
2229 case AV_PIX_FMT_YUVA420P10BE:
2230 case AV_PIX_FMT_YUVA422P10BE:
2231 case AV_PIX_FMT_YUVA444P10BE:
2232 case AV_PIX_FMT_YUVA422P12BE:
2233 case AV_PIX_FMT_YUVA444P12BE:
2234 case AV_PIX_FMT_YUVA420P16BE:
2235 case AV_PIX_FMT_YUVA422P16BE:
2236 case AV_PIX_FMT_YUVA444P16BE:
2237 11 *lumToYV12 = bswap16Y_c;
2238 11 *alpToYV12 = bswap16Y_c;
2239 11 break;
2240 #endif
2241 1 case AV_PIX_FMT_YA16LE:
2242 1 *lumToYV12 = read_ya16le_gray_c;
2243 1 break;
2244 21 case AV_PIX_FMT_YA16BE:
2245 21 *lumToYV12 = read_ya16be_gray_c;
2246 21 break;
2247 83 case AV_PIX_FMT_VUYA:
2248 case AV_PIX_FMT_VUYX:
2249 83 *lumToYV12 = read_vuyx_Y_c;
2250 83 break;
2251 81 case AV_PIX_FMT_XV30LE:
2252 81 *lumToYV12 = read_xv30le_Y_c;
2253 81 break;
2254 95 case AV_PIX_FMT_V30XLE:
2255 95 *lumToYV12 = read_v30xle_Y_c;
2256 95 break;
2257 6 case AV_PIX_FMT_AYUV:
2258 case AV_PIX_FMT_UYVA:
2259 6 *lumToYV12 = read_ayuv_Y_c;
2260 6 break;
2261 102 case AV_PIX_FMT_AYUV64LE:
2262 case AV_PIX_FMT_XV48LE:
2263 102 *lumToYV12 = read_ayuv64le_Y_c;
2264 102 break;
2265 102 case AV_PIX_FMT_AYUV64BE:
2266 case AV_PIX_FMT_XV48BE:
2267 102 *lumToYV12 = read_ayuv64be_Y_c;
2268 102 break;
2269 81 case AV_PIX_FMT_XV36LE:
2270 81 *lumToYV12 = read_xv36le_Y_c;
2271 81 break;
2272 81 case AV_PIX_FMT_XV36BE:
2273 81 *lumToYV12 = read_xv36be_Y_c;
2274 81 break;
2275 185 case AV_PIX_FMT_YUYV422:
2276 case AV_PIX_FMT_YVYU422:
2277 case AV_PIX_FMT_YA8:
2278 185 *lumToYV12 = yuy2ToY_c;
2279 185 break;
2280 82 case AV_PIX_FMT_UYVY422:
2281 82 *lumToYV12 = uyvyToY_c;
2282 82 break;
2283 86 case AV_PIX_FMT_VYU444:
2284 86 *lumToYV12 = vyuToY_c;
2285 86 break;
2286 132 case AV_PIX_FMT_BGR24:
2287 132 *lumToYV12 = bgr24ToY_c;
2288 132 break;
2289 1 case AV_PIX_FMT_BGR565LE:
2290 1 *lumToYV12 = bgr16leToY_c;
2291 1 break;
2292 1 case AV_PIX_FMT_BGR565BE:
2293 1 *lumToYV12 = bgr16beToY_c;
2294 1 break;
2295 1 case AV_PIX_FMT_BGR555LE:
2296 1 *lumToYV12 = bgr15leToY_c;
2297 1 break;
2298 1 case AV_PIX_FMT_BGR555BE:
2299 1 *lumToYV12 = bgr15beToY_c;
2300 1 break;
2301 1 case AV_PIX_FMT_BGR444LE:
2302 1 *lumToYV12 = bgr12leToY_c;
2303 1 break;
2304 1 case AV_PIX_FMT_BGR444BE:
2305 1 *lumToYV12 = bgr12beToY_c;
2306 1 break;
2307 1109 case AV_PIX_FMT_RGB24:
2308 1109 *lumToYV12 = rgb24ToY_c;
2309 1109 break;
2310 76 case AV_PIX_FMT_RGB565LE:
2311 76 *lumToYV12 = rgb16leToY_c;
2312 76 break;
2313 1 case AV_PIX_FMT_RGB565BE:
2314 1 *lumToYV12 = rgb16beToY_c;
2315 1 break;
2316 87 case AV_PIX_FMT_RGB555LE:
2317 87 *lumToYV12 = rgb15leToY_c;
2318 87 break;
2319 1 case AV_PIX_FMT_RGB555BE:
2320 1 *lumToYV12 = rgb15beToY_c;
2321 1 break;
2322 1 case AV_PIX_FMT_RGB444LE:
2323 1 *lumToYV12 = rgb12leToY_c;
2324 1 break;
2325 1 case AV_PIX_FMT_RGB444BE:
2326 1 *lumToYV12 = rgb12beToY_c;
2327 1 break;
2328 30 case AV_PIX_FMT_RGB8:
2329 case AV_PIX_FMT_BGR8:
2330 case AV_PIX_FMT_PAL8:
2331 case AV_PIX_FMT_BGR4_BYTE:
2332 case AV_PIX_FMT_RGB4_BYTE:
2333 30 *lumToYV12 = palToY_c;
2334 30 break;
2335 82 case AV_PIX_FMT_MONOBLACK:
2336 82 *lumToYV12 = monoblack2Y_c;
2337 82 break;
2338 86 case AV_PIX_FMT_MONOWHITE:
2339 86 *lumToYV12 = monowhite2Y_c;
2340 86 break;
2341 256 case AV_PIX_FMT_RGB32:
2342 256 *lumToYV12 = bgr32ToY_c;
2343 256 break;
2344 56 case AV_PIX_FMT_RGB32_1:
2345 56 *lumToYV12 = bgr321ToY_c;
2346 56 break;
2347 114 case AV_PIX_FMT_BGR32:
2348 114 *lumToYV12 = rgb32ToY_c;
2349 114 break;
2350 66 case AV_PIX_FMT_BGR32_1:
2351 66 *lumToYV12 = rgb321ToY_c;
2352 66 break;
2353 12 case AV_PIX_FMT_RGB48BE:
2354 12 *lumToYV12 = rgb48BEToY_c;
2355 12 break;
2356 948 case AV_PIX_FMT_RGB48LE:
2357 948 *lumToYV12 = rgb48LEToY_c;
2358 948 break;
2359 1 case AV_PIX_FMT_BGR48BE:
2360 1 *lumToYV12 = bgr48BEToY_c;
2361 1 break;
2362 2 case AV_PIX_FMT_BGR48LE:
2363 2 *lumToYV12 = bgr48LEToY_c;
2364 2 break;
2365 11 case AV_PIX_FMT_RGBA64BE:
2366 11 *lumToYV12 = rgb64BEToY_c;
2367 11 break;
2368 2 case AV_PIX_FMT_RGBA64LE:
2369 2 *lumToYV12 = rgb64LEToY_c;
2370 2 break;
2371 1 case AV_PIX_FMT_BGRA64BE:
2372 1 *lumToYV12 = bgr64BEToY_c;
2373 1 break;
2374 2 case AV_PIX_FMT_BGRA64LE:
2375 2 *lumToYV12 = bgr64LEToY_c;
2376 2 break;
2377 243 case AV_PIX_FMT_P010LE:
2378 case AV_PIX_FMT_P210LE:
2379 case AV_PIX_FMT_P410LE:
2380 243 *lumToYV12 = p010LEToY_c;
2381 243 break;
2382 243 case AV_PIX_FMT_P010BE:
2383 case AV_PIX_FMT_P210BE:
2384 case AV_PIX_FMT_P410BE:
2385 243 *lumToYV12 = p010BEToY_c;
2386 243 break;
2387 243 case AV_PIX_FMT_P012LE:
2388 case AV_PIX_FMT_P212LE:
2389 case AV_PIX_FMT_P412LE:
2390 243 *lumToYV12 = p012LEToY_c;
2391 243 break;
2392 243 case AV_PIX_FMT_P012BE:
2393 case AV_PIX_FMT_P212BE:
2394 case AV_PIX_FMT_P412BE:
2395 243 *lumToYV12 = p012BEToY_c;
2396 243 break;
2397 1 case AV_PIX_FMT_GRAYF32LE:
2398 1 *lumToYV12 = grayf32leToY16_c;
2399 1 break;
2400 1 case AV_PIX_FMT_GRAYF32BE:
2401 1 *lumToYV12 = grayf32beToY16_c;
2402 1 break;
2403 18 case AV_PIX_FMT_GRAYF16LE:
2404 18 *lumToYV12 = grayf16leToY16_c;
2405 18 break;
2406 case AV_PIX_FMT_GRAYF16BE:
2407 *lumToYV12 = grayf16beToY16_c;
2408 break;
2409 81 case AV_PIX_FMT_Y210LE:
2410 81 *lumToYV12 = y210le_Y_c;
2411 81 break;
2412 81 case AV_PIX_FMT_Y212LE:
2413 81 *lumToYV12 = y212le_Y_c;
2414 81 break;
2415 101 case AV_PIX_FMT_Y216LE:
2416 101 *lumToYV12 = y216le_Y_c;
2417 101 break;
2418 51 case AV_PIX_FMT_X2RGB10LE:
2419 51 *lumToYV12 = rgb30leToY_c;
2420 51 break;
2421 51 case AV_PIX_FMT_X2BGR10LE:
2422 51 *lumToYV12 = bgr30leToY_c;
2423 51 break;
2424 case AV_PIX_FMT_RGBAF16BE:
2425 *lumToYV12 = rgbaf16beToY_c;
2426 break;
2427 case AV_PIX_FMT_RGBAF16LE:
2428 *lumToYV12 = rgbaf16leToY_c;
2429 break;
2430 case AV_PIX_FMT_RGBF16BE:
2431 *lumToYV12 = rgbf16beToY_c;
2432 break;
2433 case AV_PIX_FMT_RGBF16LE:
2434 *lumToYV12 = rgbf16leToY_c;
2435 break;
2436 case AV_PIX_FMT_RGBF32LE:
2437 *lumToYV12 = rgbf32le_to_y_c;
2438 break;
2439 case AV_PIX_FMT_RGBF32BE:
2440 *lumToYV12 = rgbf32be_to_y_c;
2441 break;
2442 }
2443
2/2
✓ Branch 0 taken 358 times.
✓ Branch 1 taken 33111 times.
33469 if (c->needAlpha) {
2444
4/4
✓ Branch 1 taken 218 times.
✓ Branch 2 taken 140 times.
✓ Branch 4 taken 22 times.
✓ Branch 5 taken 196 times.
358 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
2445
4/4
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 143 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 4 times.
162 if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
2446 15 *alpToYV12 = bswap16Y_c;
2447 }
2448
12/15
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 162 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 2 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 170 times.
358 switch (srcFormat) {
2449 2 case AV_PIX_FMT_BGRA64LE:
2450 2 case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2451 2 case AV_PIX_FMT_BGRA64BE:
2452 2 case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2453 162 case AV_PIX_FMT_BGRA:
2454 case AV_PIX_FMT_RGBA:
2455 162 *alpToYV12 = rgbaToA_c;
2456 162 break;
2457 14 case AV_PIX_FMT_ABGR:
2458 case AV_PIX_FMT_ARGB:
2459 14 *alpToYV12 = abgrToA_c;
2460 14 break;
2461 case AV_PIX_FMT_RGBAF16BE:
2462 *alpToYV12 = rgbaf16beToA_c;
2463 break;
2464 case AV_PIX_FMT_RGBAF16LE:
2465 *alpToYV12 = rgbaf16leToA_c;
2466 break;
2467 1 case AV_PIX_FMT_YA8:
2468 1 *alpToYV12 = uyvyToY_c;
2469 1 break;
2470 1 case AV_PIX_FMT_YA16LE:
2471 1 *alpToYV12 = read_ya16le_alpha_c;
2472 1 break;
2473 1 case AV_PIX_FMT_YA16BE:
2474 1 *alpToYV12 = read_ya16be_alpha_c;
2475 1 break;
2476 2 case AV_PIX_FMT_VUYA:
2477 case AV_PIX_FMT_UYVA:
2478 2 *alpToYV12 = read_vuya_A_c;
2479 2 break;
2480 1 case AV_PIX_FMT_AYUV:
2481 1 *alpToYV12 = read_ayuv_A_c;
2482 1 break;
2483 1 case AV_PIX_FMT_AYUV64LE:
2484 1 *alpToYV12 = read_ayuv64le_A_c;
2485 1 break;
2486 1 case AV_PIX_FMT_AYUV64BE:
2487 1 *alpToYV12 = read_ayuv64be_A_c;
2488 1 break;
2489 case AV_PIX_FMT_PAL8 :
2490 *alpToYV12 = palToA_c;
2491 break;
2492 }
2493 }
2494 33469 }
2495