FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 1048 1269 82.6%
Functions: 186 234 79.5%
Branches: 559 778 71.9%

Line Branch Exec Source
1 /*
2 * Copyright (C) 2001-2012 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <math.h>
22 #include <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 388500 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 388500 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
328 388500 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
329 388500 maskgx = ~(maskr | maskb);
330 388500 const unsigned rnd = (256U<<(S)) + (1<<(S-6));
331 int i;
332
333 388500 maskr |= maskr << 1;
334 388500 maskb |= maskb << 1;
335 388500 maskg |= maskg << 1;
336
2/2
✓ Branch 0 taken 84059062 times.
✓ Branch 1 taken 388500 times.
84447562 for (i = 0; i < width; i++) {
337
12/14
✓ Branch 0 taken 38827984 times.
✓ Branch 1 taken 45231078 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.
84059062 unsigned px0 = input_pixel(2 * i + 0) >> shp;
338
12/14
✓ Branch 0 taken 38827984 times.
✓ Branch 1 taken 45231078 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.
84059062 unsigned px1 = input_pixel(2 * i + 1) >> shp;
339 84059062 int b, r, g = (px0 & maskgx) + (px1 & maskgx);
340 84059062 int rb = px0 + px1 - g;
341
342 84059062 b = (rb & maskb) >> shb;
343
4/4
✓ Branch 0 taken 84013622 times.
✓ Branch 1 taken 45440 times.
✓ Branch 2 taken 83962934 times.
✓ Branch 3 taken 50688 times.
84059062 if (shp ||
344
4/4
✓ Branch 0 taken 83912246 times.
✓ Branch 1 taken 50688 times.
✓ Branch 2 taken 76229458 times.
✓ Branch 3 taken 7682788 times.
83962934 origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
345
2/2
✓ Branch 0 taken 50688 times.
✓ Branch 1 taken 76178770 times.
76229458 origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
346 7880292 g >>= shg;
347 } else {
348 76178770 g = (g & maskg) >> shg;
349 }
350 84059062 r = (rb & maskr) >> shr;
351
352 84059062 dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);
353 84059062 dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);
354 }
355 388500 }
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 1993206 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 1083876 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 1083876 int16_t *dst = (int16_t *)_dst;
1043 1083876 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1044 int i;
1045
2/2
✓ Branch 0 taken 369894812 times.
✓ Branch 1 taken 1083876 times.
370978688 for (i = 0; i < width; i++) {
1046 369894812 int r = src[i * 3 + 0];
1047 369894812 int g = src[i * 3 + 1];
1048 369894812 int b = src[i * 3 + 2];
1049
1050 369894812 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1051 }
1052 1083876 }
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 654042 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 654042 int16_t *dstU = (int16_t *)_dstU;
1077 654042 int16_t *dstV = (int16_t *)_dstV;
1078 int i;
1079 654042 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1080 654042 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 108817380 times.
✓ Branch 1 taken 654042 times.
109471422 for (i = 0; i < width; i++) {
1083 108817380 int r = src1[6 * i + 0] + src1[6 * i + 3];
1084 108817380 int g = src1[6 * i + 1] + src1[6 * i + 4];
1085 108817380 int b = src1[6 * i + 2] + src1[6 * i + 5];
1086
1087 108817380 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1088 108817380 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1089 }
1090 654042 }
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
1373 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1374 const uint16_t *src, int width,
1375 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1376 {
1377 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1378 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1379 int i;
1380 for (i = 0; i < width; i++) {
1381 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) +
1382 lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1;
1383 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) +
1384 lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1;
1385 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) +
1386 lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1;
1387
1388 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1389 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1390 }
1391 }
1392
1393 static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1394 const uint16_t *src, int width,
1395 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1396 {
1397 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1398 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1399 int i;
1400 for (i = 0; i < width; i++) {
1401 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1402 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1403 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1404
1405 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1406 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1407 }
1408 }
1409
1410 static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1411 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1412 {
1413 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1414 int i;
1415 for (i = 0; i < width; i++) {
1416 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1417 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1418 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1419
1420 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1421 }
1422 }
1423
1424 static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be,
1425 int width, Half2FloatTables *h2f_tbl)
1426 {
1427 int i;
1428 for (i=0; i<width; i++) {
1429 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[i*4+3]), 0.0f, 65535.0f));
1430 }
1431 }
1432
1433 static av_always_inline void rgbf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1434 const uint16_t *src, int width,
1435 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1436 {
1437 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1438 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1439 int i;
1440 for (i = 0; i < width; i++) {
1441 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+0]), 0.0f, 65535.0f)) +
1442 lrintf(av_clipf(65535.0f * rdpx(src[i*6+3]), 0.0f, 65535.0f))) >> 1;
1443 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+1]), 0.0f, 65535.0f)) +
1444 lrintf(av_clipf(65535.0f * rdpx(src[i*6+4]), 0.0f, 65535.0f))) >> 1;
1445 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+2]), 0.0f, 65535.0f)) +
1446 lrintf(av_clipf(65535.0f * rdpx(src[i*6+5]), 0.0f, 65535.0f))) >> 1;
1447
1448 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1449 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1450 }
1451 }
1452
1453 static av_always_inline void rgbf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1454 const uint16_t *src, int width,
1455 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1456 {
1457 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1458 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1459 int i;
1460 for (i = 0; i < width; i++) {
1461 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1462 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1463 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1464
1465 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1466 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1467 }
1468 }
1469
1470 static av_always_inline void rgbf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1471 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1472 {
1473 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1474 int i;
1475 for (i = 0; i < width; i++) {
1476 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1477 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1478 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1479
1480 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1481 }
1482 }
1483
1484 #undef rdpx
1485
1486 #define rgbaf16_funcs_endian(endian_name, endian) \
1487 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1488 const uint8_t *src1, const uint8_t *src2, \
1489 int width, uint32_t *_rgb2yuv, void *opq) \
1490 { \
1491 const uint16_t *src = (const uint16_t*)src1; \
1492 uint16_t *dstU = (uint16_t*)_dstU; \
1493 uint16_t *dstV = (uint16_t*)_dstV; \
1494 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1495 av_assert1(src1==src2); \
1496 rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1497 } \
1498 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1499 const uint8_t *src1, const uint8_t *src2, \
1500 int width, uint32_t *_rgb2yuv, void *opq) \
1501 { \
1502 const uint16_t *src = (const uint16_t*)src1; \
1503 uint16_t *dstU = (uint16_t*)_dstU; \
1504 uint16_t *dstV = (uint16_t*)_dstV; \
1505 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1506 av_assert1(src1==src2); \
1507 rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1508 } \
1509 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1510 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1511 { \
1512 const uint16_t *src = (const uint16_t*)_src; \
1513 uint16_t *dst = (uint16_t*)_dst; \
1514 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1515 rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1516 } \
1517 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1518 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1519 { \
1520 const uint16_t *src = (const uint16_t*)_src; \
1521 uint16_t *dst = (uint16_t*)_dst; \
1522 rgbaf16ToA_endian(dst, src, endian, width, opq); \
1523 } \
1524 static void rgbf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1525 const uint8_t *src1, const uint8_t *src2, \
1526 int width, uint32_t *_rgb2yuv, void *opq) \
1527 { \
1528 const uint16_t *src = (const uint16_t*)src1; \
1529 uint16_t *dstU = (uint16_t*)_dstU; \
1530 uint16_t *dstV = (uint16_t*)_dstV; \
1531 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1532 av_assert1(src1==src2); \
1533 rgbf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1534 } \
1535 static void rgbf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1536 const uint8_t *src1, const uint8_t *src2, \
1537 int width, uint32_t *_rgb2yuv, void *opq) \
1538 { \
1539 const uint16_t *src = (const uint16_t*)src1; \
1540 uint16_t *dstU = (uint16_t*)_dstU; \
1541 uint16_t *dstV = (uint16_t*)_dstV; \
1542 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1543 av_assert1(src1==src2); \
1544 rgbf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1545 } \
1546 static void rgbf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1547 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1548 { \
1549 const uint16_t *src = (const uint16_t*)_src; \
1550 uint16_t *dst = (uint16_t*)_dst; \
1551 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1552 rgbf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1553 } \
1554
1555 rgbaf16_funcs_endian(le, 0)
1556 rgbaf16_funcs_endian(be, 1)
1557
1558 30303 av_cold void ff_sws_init_input_funcs(SwsInternal *c,
1559 planar1_YV12_fn *lumToYV12,
1560 planar1_YV12_fn *alpToYV12,
1561 planar2_YV12_fn *chrToYV12,
1562 planarX_YV12_fn *readLumPlanar,
1563 planarX_YV12_fn *readAlpPlanar,
1564 planarX2_YV12_fn *readChrPlanar)
1565 {
1566 30303 enum AVPixelFormat srcFormat = c->srcFormat;
1567
1568 30303 *chrToYV12 = NULL;
1569
42/44
✓ Branch 0 taken 74 times.
✓ Branch 1 taken 74 times.
✓ Branch 2 taken 74 times.
✓ Branch 3 taken 78 times.
✓ Branch 4 taken 212 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 29 times.
✓ Branch 7 taken 158 times.
✓ Branch 8 taken 1217 times.
✓ Branch 9 taken 1213 times.
✓ Branch 10 taken 159 times.
✓ Branch 11 taken 623 times.
✓ Branch 12 taken 422 times.
✓ Branch 13 taken 157 times.
✓ Branch 14 taken 446 times.
✓ Branch 15 taken 446 times.
✓ Branch 16 taken 158 times.
✓ Branch 17 taken 482 times.
✓ Branch 18 taken 392 times.
✓ Branch 19 taken 1222 times.
✓ Branch 20 taken 784 times.
✓ Branch 21 taken 75 times.
✓ Branch 22 taken 73 times.
✓ Branch 23 taken 86 times.
✓ Branch 24 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 26 taken 1 times.
✓ Branch 27 taken 5 times.
✓ Branch 28 taken 73 times.
✓ Branch 29 taken 73 times.
✓ Branch 30 taken 91 times.
✓ Branch 31 taken 91 times.
✓ Branch 32 taken 219 times.
✓ Branch 33 taken 219 times.
✓ Branch 34 taken 219 times.
✓ Branch 35 taken 219 times.
✓ Branch 36 taken 273 times.
✓ Branch 37 taken 273 times.
✓ Branch 38 taken 73 times.
✓ Branch 39 taken 73 times.
✓ Branch 40 taken 91 times.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✓ Branch 43 taken 19652 times.
30303 switch (srcFormat) {
1570 74 case AV_PIX_FMT_YUYV422:
1571 74 *chrToYV12 = yuy2ToUV_c;
1572 74 break;
1573 74 case AV_PIX_FMT_YVYU422:
1574 74 *chrToYV12 = yvy2ToUV_c;
1575 74 break;
1576 74 case AV_PIX_FMT_UYVY422:
1577 74 *chrToYV12 = uyvyToUV_c;
1578 74 break;
1579 78 case AV_PIX_FMT_VYU444:
1580 78 *chrToYV12 = vyuToUV_c;
1581 78 break;
1582 212 case AV_PIX_FMT_NV12:
1583 case AV_PIX_FMT_NV16:
1584 case AV_PIX_FMT_NV24:
1585 212 *chrToYV12 = nv12ToUV_c;
1586 212 break;
1587 2 case AV_PIX_FMT_NV21:
1588 case AV_PIX_FMT_NV42:
1589 2 *chrToYV12 = nv21ToUV_c;
1590 2 break;
1591 29 case AV_PIX_FMT_RGB8:
1592 case AV_PIX_FMT_BGR8:
1593 case AV_PIX_FMT_PAL8:
1594 case AV_PIX_FMT_BGR4_BYTE:
1595 case AV_PIX_FMT_RGB4_BYTE:
1596 29 *chrToYV12 = palToUV_c;
1597 29 break;
1598 158 case AV_PIX_FMT_GBRP9LE:
1599 158 *readChrPlanar = planar_rgb9le_to_uv;
1600 158 break;
1601 1217 case AV_PIX_FMT_GBRAP10LE:
1602 case AV_PIX_FMT_GBRP10LE:
1603 1217 *readChrPlanar = planar_rgb10le_to_uv;
1604 1217 break;
1605 1213 case AV_PIX_FMT_GBRAP12LE:
1606 case AV_PIX_FMT_GBRP12LE:
1607 1213 *readChrPlanar = planar_rgb12le_to_uv;
1608 1213 break;
1609 159 case AV_PIX_FMT_GBRAP14LE:
1610 case AV_PIX_FMT_GBRP14LE:
1611 159 *readChrPlanar = planar_rgb14le_to_uv;
1612 159 break;
1613 623 case AV_PIX_FMT_GBRAP16LE:
1614 case AV_PIX_FMT_GBRP16LE:
1615 623 *readChrPlanar = planar_rgb16le_to_uv;
1616 623 break;
1617 422 case AV_PIX_FMT_GBRAPF32LE:
1618 case AV_PIX_FMT_GBRPF32LE:
1619 422 *readChrPlanar = planar_rgbf32le_to_uv;
1620 422 break;
1621 157 case AV_PIX_FMT_GBRP9BE:
1622 157 *readChrPlanar = planar_rgb9be_to_uv;
1623 157 break;
1624 446 case AV_PIX_FMT_GBRAP10BE:
1625 case AV_PIX_FMT_GBRP10BE:
1626 446 *readChrPlanar = planar_rgb10be_to_uv;
1627 446 break;
1628 446 case AV_PIX_FMT_GBRAP12BE:
1629 case AV_PIX_FMT_GBRP12BE:
1630 446 *readChrPlanar = planar_rgb12be_to_uv;
1631 446 break;
1632 158 case AV_PIX_FMT_GBRAP14BE:
1633 case AV_PIX_FMT_GBRP14BE:
1634 158 *readChrPlanar = planar_rgb14be_to_uv;
1635 158 break;
1636 482 case AV_PIX_FMT_GBRAP16BE:
1637 case AV_PIX_FMT_GBRP16BE:
1638 482 *readChrPlanar = planar_rgb16be_to_uv;
1639 482 break;
1640 392 case AV_PIX_FMT_GBRAPF32BE:
1641 case AV_PIX_FMT_GBRPF32BE:
1642 392 *readChrPlanar = planar_rgbf32be_to_uv;
1643 392 break;
1644 1222 case AV_PIX_FMT_GBRAP:
1645 case AV_PIX_FMT_GBRP:
1646 1222 *readChrPlanar = planar_rgb_to_uv;
1647 1222 break;
1648 #if HAVE_BIGENDIAN
1649 case AV_PIX_FMT_YUV420P9LE:
1650 case AV_PIX_FMT_YUV422P9LE:
1651 case AV_PIX_FMT_YUV444P9LE:
1652 case AV_PIX_FMT_YUV420P10LE:
1653 case AV_PIX_FMT_YUV422P10LE:
1654 case AV_PIX_FMT_YUV440P10LE:
1655 case AV_PIX_FMT_YUV444P10LE:
1656 case AV_PIX_FMT_YUV420P12LE:
1657 case AV_PIX_FMT_YUV422P12LE:
1658 case AV_PIX_FMT_YUV440P12LE:
1659 case AV_PIX_FMT_YUV444P12LE:
1660 case AV_PIX_FMT_YUV420P14LE:
1661 case AV_PIX_FMT_YUV422P14LE:
1662 case AV_PIX_FMT_YUV444P14LE:
1663 case AV_PIX_FMT_YUV420P16LE:
1664 case AV_PIX_FMT_YUV422P16LE:
1665 case AV_PIX_FMT_YUV444P16LE:
1666
1667 case AV_PIX_FMT_YUVA420P9LE:
1668 case AV_PIX_FMT_YUVA422P9LE:
1669 case AV_PIX_FMT_YUVA444P9LE:
1670 case AV_PIX_FMT_YUVA420P10LE:
1671 case AV_PIX_FMT_YUVA422P10LE:
1672 case AV_PIX_FMT_YUVA444P10LE:
1673 case AV_PIX_FMT_YUVA422P12LE:
1674 case AV_PIX_FMT_YUVA444P12LE:
1675 case AV_PIX_FMT_YUVA420P16LE:
1676 case AV_PIX_FMT_YUVA422P16LE:
1677 case AV_PIX_FMT_YUVA444P16LE:
1678 *chrToYV12 = bswap16UV_c;
1679 break;
1680 #else
1681 784 case AV_PIX_FMT_YUV420P9BE:
1682 case AV_PIX_FMT_YUV422P9BE:
1683 case AV_PIX_FMT_YUV444P9BE:
1684 case AV_PIX_FMT_YUV420P10BE:
1685 case AV_PIX_FMT_YUV422P10BE:
1686 case AV_PIX_FMT_YUV440P10BE:
1687 case AV_PIX_FMT_YUV444P10BE:
1688 case AV_PIX_FMT_YUV420P12BE:
1689 case AV_PIX_FMT_YUV422P12BE:
1690 case AV_PIX_FMT_YUV440P12BE:
1691 case AV_PIX_FMT_YUV444P12BE:
1692 case AV_PIX_FMT_YUV420P14BE:
1693 case AV_PIX_FMT_YUV422P14BE:
1694 case AV_PIX_FMT_YUV444P14BE:
1695 case AV_PIX_FMT_YUV420P16BE:
1696 case AV_PIX_FMT_YUV422P16BE:
1697 case AV_PIX_FMT_YUV444P16BE:
1698
1699 case AV_PIX_FMT_YUVA420P9BE:
1700 case AV_PIX_FMT_YUVA422P9BE:
1701 case AV_PIX_FMT_YUVA444P9BE:
1702 case AV_PIX_FMT_YUVA420P10BE:
1703 case AV_PIX_FMT_YUVA422P10BE:
1704 case AV_PIX_FMT_YUVA444P10BE:
1705 case AV_PIX_FMT_YUVA422P12BE:
1706 case AV_PIX_FMT_YUVA444P12BE:
1707 case AV_PIX_FMT_YUVA420P16BE:
1708 case AV_PIX_FMT_YUVA422P16BE:
1709 case AV_PIX_FMT_YUVA444P16BE:
1710 784 *chrToYV12 = bswap16UV_c;
1711 784 break;
1712 #endif
1713 75 case AV_PIX_FMT_VUYA:
1714 case AV_PIX_FMT_VUYX:
1715 75 *chrToYV12 = read_vuyx_UV_c;
1716 75 break;
1717 73 case AV_PIX_FMT_XV30LE:
1718 73 *chrToYV12 = read_xv30le_UV_c;
1719 73 break;
1720 86 case AV_PIX_FMT_V30XLE:
1721 86 *chrToYV12 = read_v30xle_UV_c;
1722 86 break;
1723 1 case AV_PIX_FMT_AYUV:
1724 1 *chrToYV12 = read_ayuv_UV_c;
1725 1 break;
1726 1 case AV_PIX_FMT_AYUV64LE:
1727 1 *chrToYV12 = read_ayuv64le_UV_c;
1728 1 break;
1729 1 case AV_PIX_FMT_AYUV64BE:
1730 1 *chrToYV12 = read_ayuv64be_UV_c;
1731 1 break;
1732 5 case AV_PIX_FMT_UYVA:
1733 5 *chrToYV12 = read_uyva_UV_c;
1734 5 break;
1735 73 case AV_PIX_FMT_XV36LE:
1736 73 *chrToYV12 = read_xv36le_UV_c;
1737 73 break;
1738 73 case AV_PIX_FMT_XV36BE:
1739 73 *chrToYV12 = read_xv36be_UV_c;
1740 73 break;
1741 91 case AV_PIX_FMT_XV48LE:
1742 91 *chrToYV12 = read_xv48le_UV_c;
1743 91 break;
1744 91 case AV_PIX_FMT_XV48BE:
1745 91 *chrToYV12 = read_xv48be_UV_c;
1746 91 break;
1747 219 case AV_PIX_FMT_P010LE:
1748 case AV_PIX_FMT_P210LE:
1749 case AV_PIX_FMT_P410LE:
1750 219 *chrToYV12 = p010LEToUV_c;
1751 219 break;
1752 219 case AV_PIX_FMT_P010BE:
1753 case AV_PIX_FMT_P210BE:
1754 case AV_PIX_FMT_P410BE:
1755 219 *chrToYV12 = p010BEToUV_c;
1756 219 break;
1757 219 case AV_PIX_FMT_P012LE:
1758 case AV_PIX_FMT_P212LE:
1759 case AV_PIX_FMT_P412LE:
1760 219 *chrToYV12 = p012LEToUV_c;
1761 219 break;
1762 219 case AV_PIX_FMT_P012BE:
1763 case AV_PIX_FMT_P212BE:
1764 case AV_PIX_FMT_P412BE:
1765 219 *chrToYV12 = p012BEToUV_c;
1766 219 break;
1767 273 case AV_PIX_FMT_P016LE:
1768 case AV_PIX_FMT_P216LE:
1769 case AV_PIX_FMT_P416LE:
1770 273 *chrToYV12 = p016LEToUV_c;
1771 273 break;
1772 273 case AV_PIX_FMT_P016BE:
1773 case AV_PIX_FMT_P216BE:
1774 case AV_PIX_FMT_P416BE:
1775 273 *chrToYV12 = p016BEToUV_c;
1776 273 break;
1777 73 case AV_PIX_FMT_Y210LE:
1778 73 *chrToYV12 = y210le_UV_c;
1779 73 break;
1780 73 case AV_PIX_FMT_Y212LE:
1781 73 *chrToYV12 = y212le_UV_c;
1782 73 break;
1783 91 case AV_PIX_FMT_Y216LE:
1784 91 *chrToYV12 = y216le_UV_c;
1785 91 break;
1786 case AV_PIX_FMT_RGBF32LE:
1787 *chrToYV12 = rgbf32le_to_uv_c;
1788 break;
1789 case AV_PIX_FMT_RGBF32BE:
1790 *chrToYV12 = rgbf32be_to_uv_c;
1791 break;
1792 }
1793
2/2
✓ Branch 0 taken 20633 times.
✓ Branch 1 taken 9670 times.
30303 if (c->chrSrcHSubSample) {
1794
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 382 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 57 times.
✓ Branch 9 taken 26 times.
✓ Branch 10 taken 55 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 768 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 18 taken 62 times.
✓ Branch 19 taken 35 times.
✓ Branch 20 taken 498 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 18719 times.
20633 switch (srcFormat) {
1795 case AV_PIX_FMT_RGBA64BE:
1796 *chrToYV12 = rgb64BEToUV_half_c;
1797 break;
1798 case AV_PIX_FMT_RGBA64LE:
1799 *chrToYV12 = rgb64LEToUV_half_c;
1800 break;
1801 case AV_PIX_FMT_BGRA64BE:
1802 *chrToYV12 = bgr64BEToUV_half_c;
1803 break;
1804 case AV_PIX_FMT_BGRA64LE:
1805 *chrToYV12 = bgr64LEToUV_half_c;
1806 break;
1807 case AV_PIX_FMT_RGB48BE:
1808 *chrToYV12 = rgb48BEToUV_half_c;
1809 break;
1810 382 case AV_PIX_FMT_RGB48LE:
1811 382 *chrToYV12 = rgb48LEToUV_half_c;
1812 382 break;
1813 case AV_PIX_FMT_BGR48BE:
1814 *chrToYV12 = bgr48BEToUV_half_c;
1815 break;
1816 case AV_PIX_FMT_BGR48LE:
1817 *chrToYV12 = bgr48LEToUV_half_c;
1818 break;
1819 57 case AV_PIX_FMT_RGB32:
1820 57 *chrToYV12 = bgr32ToUV_half_c;
1821 57 break;
1822 26 case AV_PIX_FMT_RGB32_1:
1823 26 *chrToYV12 = bgr321ToUV_half_c;
1824 26 break;
1825 55 case AV_PIX_FMT_BGR24:
1826 55 *chrToYV12 = bgr24ToUV_half_c;
1827 55 break;
1828 1 case AV_PIX_FMT_BGR565LE:
1829 1 *chrToYV12 = bgr16leToUV_half_c;
1830 1 break;
1831 1 case AV_PIX_FMT_BGR565BE:
1832 1 *chrToYV12 = bgr16beToUV_half_c;
1833 1 break;
1834 1 case AV_PIX_FMT_BGR555LE:
1835 1 *chrToYV12 = bgr15leToUV_half_c;
1836 1 break;
1837 1 case AV_PIX_FMT_BGR555BE:
1838 1 *chrToYV12 = bgr15beToUV_half_c;
1839 1 break;
1840 768 case AV_PIX_FMT_GBRAP:
1841 case AV_PIX_FMT_GBRP:
1842 768 *chrToYV12 = gbr24pToUV_half_c;
1843 768 break;
1844 1 case AV_PIX_FMT_BGR444LE:
1845 1 *chrToYV12 = bgr12leToUV_half_c;
1846 1 break;
1847 1 case AV_PIX_FMT_BGR444BE:
1848 1 *chrToYV12 = bgr12beToUV_half_c;
1849 1 break;
1850 62 case AV_PIX_FMT_BGR32:
1851 62 *chrToYV12 = rgb32ToUV_half_c;
1852 62 break;
1853 35 case AV_PIX_FMT_BGR32_1:
1854 35 *chrToYV12 = rgb321ToUV_half_c;
1855 35 break;
1856 498 case AV_PIX_FMT_RGB24:
1857 498 *chrToYV12 = rgb24ToUV_half_c;
1858 498 break;
1859 5 case AV_PIX_FMT_RGB565LE:
1860 5 *chrToYV12 = rgb16leToUV_half_c;
1861 5 break;
1862 1 case AV_PIX_FMT_RGB565BE:
1863 1 *chrToYV12 = rgb16beToUV_half_c;
1864 1 break;
1865 16 case AV_PIX_FMT_RGB555LE:
1866 16 *chrToYV12 = rgb15leToUV_half_c;
1867 16 break;
1868 1 case AV_PIX_FMT_RGB555BE:
1869 1 *chrToYV12 = rgb15beToUV_half_c;
1870 1 break;
1871 1 case AV_PIX_FMT_RGB444LE:
1872 1 *chrToYV12 = rgb12leToUV_half_c;
1873 1 break;
1874 1 case AV_PIX_FMT_RGB444BE:
1875 1 *chrToYV12 = rgb12beToUV_half_c;
1876 1 break;
1877 case AV_PIX_FMT_X2RGB10LE:
1878 *chrToYV12 = rgb30leToUV_half_c;
1879 break;
1880 case AV_PIX_FMT_X2BGR10LE:
1881 *chrToYV12 = bgr30leToUV_half_c;
1882 break;
1883 case AV_PIX_FMT_RGBAF16BE:
1884 *chrToYV12 = rgbaf16beToUV_half_c;
1885 break;
1886 case AV_PIX_FMT_RGBAF16LE:
1887 *chrToYV12 = rgbaf16leToUV_half_c;
1888 break;
1889 case AV_PIX_FMT_RGBF16BE:
1890 *chrToYV12 = rgbf16beToUV_half_c;
1891 break;
1892 case AV_PIX_FMT_RGBF16LE:
1893 *chrToYV12 = rgbf16leToUV_half_c;
1894 break;
1895 }
1896 } else {
1897
19/33
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 11 times.
✓ Branch 5 taken 472 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 168 times.
✓ Branch 9 taken 17 times.
✓ Branch 10 taken 70 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 35 times.
✓ Branch 18 taken 17 times.
✓ Branch 19 taken 521 times.
✓ Branch 20 taken 64 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 64 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 46 times.
✓ Branch 27 taken 46 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 8121 times.
9670 switch (srcFormat) {
1898 10 case AV_PIX_FMT_RGBA64BE:
1899 10 *chrToYV12 = rgb64BEToUV_c;
1900 10 break;
1901 2 case AV_PIX_FMT_RGBA64LE:
1902 2 *chrToYV12 = rgb64LEToUV_c;
1903 2 break;
1904 1 case AV_PIX_FMT_BGRA64BE:
1905 1 *chrToYV12 = bgr64BEToUV_c;
1906 1 break;
1907 2 case AV_PIX_FMT_BGRA64LE:
1908 2 *chrToYV12 = bgr64LEToUV_c;
1909 2 break;
1910 11 case AV_PIX_FMT_RGB48BE:
1911 11 *chrToYV12 = rgb48BEToUV_c;
1912 11 break;
1913 472 case AV_PIX_FMT_RGB48LE:
1914 472 *chrToYV12 = rgb48LEToUV_c;
1915 472 break;
1916 1 case AV_PIX_FMT_BGR48BE:
1917 1 *chrToYV12 = bgr48BEToUV_c;
1918 1 break;
1919 2 case AV_PIX_FMT_BGR48LE:
1920 2 *chrToYV12 = bgr48LEToUV_c;
1921 2 break;
1922 168 case AV_PIX_FMT_RGB32:
1923 168 *chrToYV12 = bgr32ToUV_c;
1924 168 break;
1925 17 case AV_PIX_FMT_RGB32_1:
1926 17 *chrToYV12 = bgr321ToUV_c;
1927 17 break;
1928 70 case AV_PIX_FMT_BGR24:
1929 70 *chrToYV12 = bgr24ToUV_c;
1930 70 break;
1931 case AV_PIX_FMT_BGR565LE:
1932 *chrToYV12 = bgr16leToUV_c;
1933 break;
1934 case AV_PIX_FMT_BGR565BE:
1935 *chrToYV12 = bgr16beToUV_c;
1936 break;
1937 case AV_PIX_FMT_BGR555LE:
1938 *chrToYV12 = bgr15leToUV_c;
1939 break;
1940 case AV_PIX_FMT_BGR555BE:
1941 *chrToYV12 = bgr15beToUV_c;
1942 break;
1943 case AV_PIX_FMT_BGR444LE:
1944 *chrToYV12 = bgr12leToUV_c;
1945 break;
1946 case AV_PIX_FMT_BGR444BE:
1947 *chrToYV12 = bgr12beToUV_c;
1948 break;
1949 35 case AV_PIX_FMT_BGR32:
1950 35 *chrToYV12 = rgb32ToUV_c;
1951 35 break;
1952 17 case AV_PIX_FMT_BGR32_1:
1953 17 *chrToYV12 = rgb321ToUV_c;
1954 17 break;
1955 521 case AV_PIX_FMT_RGB24:
1956 521 *chrToYV12 = rgb24ToUV_c;
1957 521 break;
1958 64 case AV_PIX_FMT_RGB565LE:
1959 64 *chrToYV12 = rgb16leToUV_c;
1960 64 break;
1961 case AV_PIX_FMT_RGB565BE:
1962 *chrToYV12 = rgb16beToUV_c;
1963 break;
1964 64 case AV_PIX_FMT_RGB555LE:
1965 64 *chrToYV12 = rgb15leToUV_c;
1966 64 break;
1967 case AV_PIX_FMT_RGB555BE:
1968 *chrToYV12 = rgb15beToUV_c;
1969 break;
1970 case AV_PIX_FMT_RGB444LE:
1971 *chrToYV12 = rgb12leToUV_c;
1972 break;
1973 case AV_PIX_FMT_RGB444BE:
1974 *chrToYV12 = rgb12beToUV_c;
1975 break;
1976 46 case AV_PIX_FMT_X2RGB10LE:
1977 46 *chrToYV12 = rgb30leToUV_c;
1978 46 break;
1979 46 case AV_PIX_FMT_X2BGR10LE:
1980 46 *chrToYV12 = bgr30leToUV_c;
1981 46 break;
1982 case AV_PIX_FMT_RGBAF16BE:
1983 *chrToYV12 = rgbaf16beToUV_c;
1984 break;
1985 case AV_PIX_FMT_RGBAF16LE:
1986 *chrToYV12 = rgbaf16leToUV_c;
1987 break;
1988 case AV_PIX_FMT_RGBF16BE:
1989 *chrToYV12 = rgbf16beToUV_c;
1990 break;
1991 case AV_PIX_FMT_RGBF16LE:
1992 *chrToYV12 = rgbf16leToUV_c;
1993 break;
1994 }
1995 }
1996
1997 30303 *lumToYV12 = NULL;
1998 30303 *alpToYV12 = NULL;
1999
80/86
✓ Branch 0 taken 158 times.
✓ Branch 1 taken 236 times.
✓ Branch 2 taken 981 times.
✓ Branch 3 taken 236 times.
✓ Branch 4 taken 977 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 158 times.
✓ Branch 7 taken 236 times.
✓ Branch 8 taken 387 times.
✓ Branch 9 taken 235 times.
✓ Branch 10 taken 187 times.
✓ Branch 11 taken 157 times.
✓ Branch 12 taken 235 times.
✓ Branch 13 taken 211 times.
✓ Branch 14 taken 235 times.
✓ Branch 15 taken 211 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 157 times.
✓ Branch 18 taken 244 times.
✓ Branch 19 taken 238 times.
✓ Branch 20 taken 235 times.
✓ Branch 21 taken 157 times.
✓ Branch 22 taken 272 times.
✓ Branch 23 taken 950 times.
✓ Branch 24 taken 1330 times.
✓ Branch 25 taken 11 times.
✓ Branch 26 taken 1 times.
✓ Branch 27 taken 46 times.
✓ Branch 28 taken 75 times.
✓ Branch 29 taken 73 times.
✓ Branch 30 taken 86 times.
✓ Branch 31 taken 6 times.
✓ Branch 32 taken 92 times.
✓ Branch 33 taken 92 times.
✓ Branch 34 taken 73 times.
✓ Branch 35 taken 73 times.
✓ Branch 36 taken 194 times.
✓ Branch 37 taken 74 times.
✓ Branch 38 taken 78 times.
✓ Branch 39 taken 125 times.
✓ Branch 40 taken 1 times.
✓ Branch 41 taken 1 times.
✓ Branch 42 taken 1 times.
✓ Branch 43 taken 1 times.
✓ Branch 44 taken 1 times.
✓ Branch 45 taken 1 times.
✓ Branch 46 taken 1019 times.
✓ Branch 47 taken 69 times.
✓ Branch 48 taken 1 times.
✓ Branch 49 taken 80 times.
✓ Branch 50 taken 1 times.
✓ Branch 51 taken 1 times.
✓ Branch 52 taken 1 times.
✓ Branch 53 taken 29 times.
✓ Branch 54 taken 74 times.
✓ Branch 55 taken 78 times.
✓ Branch 56 taken 225 times.
✓ Branch 57 taken 43 times.
✓ Branch 58 taken 97 times.
✓ Branch 59 taken 52 times.
✓ Branch 60 taken 11 times.
✓ Branch 61 taken 854 times.
✓ Branch 62 taken 1 times.
✓ Branch 63 taken 2 times.
✓ Branch 64 taken 10 times.
✓ Branch 65 taken 2 times.
✓ Branch 66 taken 1 times.
✓ Branch 67 taken 2 times.
✓ Branch 68 taken 219 times.
✓ Branch 69 taken 219 times.
✓ Branch 70 taken 219 times.
✓ Branch 71 taken 219 times.
✓ Branch 72 taken 1 times.
✓ Branch 73 taken 1 times.
✓ Branch 74 taken 73 times.
✓ Branch 75 taken 73 times.
✓ Branch 76 taken 91 times.
✓ Branch 77 taken 46 times.
✓ Branch 78 taken 46 times.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 84 not taken.
✓ Branch 85 taken 16913 times.
30303 switch (srcFormat) {
2000 158 case AV_PIX_FMT_GBRP9LE:
2001 158 *readLumPlanar = planar_rgb9le_to_y;
2002 158 break;
2003 236 case AV_PIX_FMT_GBRAP10LE:
2004 236 *readAlpPlanar = planar_rgb10le_to_a;
2005 1217 case AV_PIX_FMT_GBRP10LE:
2006 1217 *readLumPlanar = planar_rgb10le_to_y;
2007 1217 break;
2008 236 case AV_PIX_FMT_GBRAP12LE:
2009 236 *readAlpPlanar = planar_rgb12le_to_a;
2010 1213 case AV_PIX_FMT_GBRP12LE:
2011 1213 *readLumPlanar = planar_rgb12le_to_y;
2012 1213 break;
2013 1 case AV_PIX_FMT_GBRAP14LE:
2014 1 *readAlpPlanar = planar_rgb14le_to_a;
2015 159 case AV_PIX_FMT_GBRP14LE:
2016 159 *readLumPlanar = planar_rgb14le_to_y;
2017 159 break;
2018 236 case AV_PIX_FMT_GBRAP16LE:
2019 236 *readAlpPlanar = planar_rgb16le_to_a;
2020 623 case AV_PIX_FMT_GBRP16LE:
2021 623 *readLumPlanar = planar_rgb16le_to_y;
2022 623 break;
2023 235 case AV_PIX_FMT_GBRAPF32LE:
2024 235 *readAlpPlanar = planar_rgbf32le_to_a;
2025 422 case AV_PIX_FMT_GBRPF32LE:
2026 422 *readLumPlanar = planar_rgbf32le_to_y;
2027 422 break;
2028 157 case AV_PIX_FMT_GBRP9BE:
2029 157 *readLumPlanar = planar_rgb9be_to_y;
2030 157 break;
2031 235 case AV_PIX_FMT_GBRAP10BE:
2032 235 *readAlpPlanar = planar_rgb10be_to_a;
2033 446 case AV_PIX_FMT_GBRP10BE:
2034 446 *readLumPlanar = planar_rgb10be_to_y;
2035 446 break;
2036 235 case AV_PIX_FMT_GBRAP12BE:
2037 235 *readAlpPlanar = planar_rgb12be_to_a;
2038 446 case AV_PIX_FMT_GBRP12BE:
2039 446 *readLumPlanar = planar_rgb12be_to_y;
2040 446 break;
2041 1 case AV_PIX_FMT_GBRAP14BE:
2042 1 *readAlpPlanar = planar_rgb14be_to_a;
2043 158 case AV_PIX_FMT_GBRP14BE:
2044 158 *readLumPlanar = planar_rgb14be_to_y;
2045 158 break;
2046 244 case AV_PIX_FMT_GBRAP16BE:
2047 244 *readAlpPlanar = planar_rgb16be_to_a;
2048 482 case AV_PIX_FMT_GBRP16BE:
2049 482 *readLumPlanar = planar_rgb16be_to_y;
2050 482 break;
2051 235 case AV_PIX_FMT_GBRAPF32BE:
2052 235 *readAlpPlanar = planar_rgbf32be_to_a;
2053 392 case AV_PIX_FMT_GBRPF32BE:
2054 392 *readLumPlanar = planar_rgbf32be_to_y;
2055 392 break;
2056 272 case AV_PIX_FMT_GBRAP:
2057 272 *readAlpPlanar = planar_rgb_to_a;
2058 1222 case AV_PIX_FMT_GBRP:
2059 1222 *readLumPlanar = planar_rgb_to_y;
2060 1222 break;
2061 #if HAVE_BIGENDIAN
2062 case AV_PIX_FMT_YUV420P9LE:
2063 case AV_PIX_FMT_YUV422P9LE:
2064 case AV_PIX_FMT_YUV444P9LE:
2065 case AV_PIX_FMT_YUV420P10LE:
2066 case AV_PIX_FMT_YUV422P10LE:
2067 case AV_PIX_FMT_YUV440P10LE:
2068 case AV_PIX_FMT_YUV444P10LE:
2069 case AV_PIX_FMT_YUV420P12LE:
2070 case AV_PIX_FMT_YUV422P12LE:
2071 case AV_PIX_FMT_YUV440P12LE:
2072 case AV_PIX_FMT_YUV444P12LE:
2073 case AV_PIX_FMT_YUV420P14LE:
2074 case AV_PIX_FMT_YUV422P14LE:
2075 case AV_PIX_FMT_YUV444P14LE:
2076 case AV_PIX_FMT_YUV420P16LE:
2077 case AV_PIX_FMT_YUV422P16LE:
2078 case AV_PIX_FMT_YUV444P16LE:
2079
2080 case AV_PIX_FMT_GRAY9LE:
2081 case AV_PIX_FMT_GRAY10LE:
2082 case AV_PIX_FMT_GRAY12LE:
2083 case AV_PIX_FMT_GRAY14LE:
2084 case AV_PIX_FMT_GRAY16LE:
2085
2086 case AV_PIX_FMT_P016LE:
2087 case AV_PIX_FMT_P216LE:
2088 case AV_PIX_FMT_P416LE:
2089 *lumToYV12 = bswap16Y_c;
2090 break;
2091 case AV_PIX_FMT_YUVA420P9LE:
2092 case AV_PIX_FMT_YUVA422P9LE:
2093 case AV_PIX_FMT_YUVA444P9LE:
2094 case AV_PIX_FMT_YUVA420P10LE:
2095 case AV_PIX_FMT_YUVA422P10LE:
2096 case AV_PIX_FMT_YUVA444P10LE:
2097 case AV_PIX_FMT_YUVA422P12LE:
2098 case AV_PIX_FMT_YUVA444P12LE:
2099 case AV_PIX_FMT_YUVA420P16LE:
2100 case AV_PIX_FMT_YUVA422P16LE:
2101 case AV_PIX_FMT_YUVA444P16LE:
2102 *lumToYV12 = bswap16Y_c;
2103 *alpToYV12 = bswap16Y_c;
2104 break;
2105 #else
2106 1330 case AV_PIX_FMT_YUV420P9BE:
2107 case AV_PIX_FMT_YUV422P9BE:
2108 case AV_PIX_FMT_YUV444P9BE:
2109 case AV_PIX_FMT_YUV420P10BE:
2110 case AV_PIX_FMT_YUV422P10BE:
2111 case AV_PIX_FMT_YUV440P10BE:
2112 case AV_PIX_FMT_YUV444P10BE:
2113 case AV_PIX_FMT_YUV420P12BE:
2114 case AV_PIX_FMT_YUV422P12BE:
2115 case AV_PIX_FMT_YUV440P12BE:
2116 case AV_PIX_FMT_YUV444P12BE:
2117 case AV_PIX_FMT_YUV420P14BE:
2118 case AV_PIX_FMT_YUV422P14BE:
2119 case AV_PIX_FMT_YUV444P14BE:
2120 case AV_PIX_FMT_YUV420P16BE:
2121 case AV_PIX_FMT_YUV422P16BE:
2122 case AV_PIX_FMT_YUV444P16BE:
2123
2124 case AV_PIX_FMT_GRAY9BE:
2125 case AV_PIX_FMT_GRAY10BE:
2126 case AV_PIX_FMT_GRAY12BE:
2127 case AV_PIX_FMT_GRAY14BE:
2128 case AV_PIX_FMT_GRAY16BE:
2129
2130 case AV_PIX_FMT_P016BE:
2131 case AV_PIX_FMT_P216BE:
2132 case AV_PIX_FMT_P416BE:
2133 1330 *lumToYV12 = bswap16Y_c;
2134 1330 break;
2135 11 case AV_PIX_FMT_YUVA420P9BE:
2136 case AV_PIX_FMT_YUVA422P9BE:
2137 case AV_PIX_FMT_YUVA444P9BE:
2138 case AV_PIX_FMT_YUVA420P10BE:
2139 case AV_PIX_FMT_YUVA422P10BE:
2140 case AV_PIX_FMT_YUVA444P10BE:
2141 case AV_PIX_FMT_YUVA422P12BE:
2142 case AV_PIX_FMT_YUVA444P12BE:
2143 case AV_PIX_FMT_YUVA420P16BE:
2144 case AV_PIX_FMT_YUVA422P16BE:
2145 case AV_PIX_FMT_YUVA444P16BE:
2146 11 *lumToYV12 = bswap16Y_c;
2147 11 *alpToYV12 = bswap16Y_c;
2148 11 break;
2149 #endif
2150 1 case AV_PIX_FMT_YA16LE:
2151 1 *lumToYV12 = read_ya16le_gray_c;
2152 1 break;
2153 46 case AV_PIX_FMT_YA16BE:
2154 46 *lumToYV12 = read_ya16be_gray_c;
2155 46 break;
2156 75 case AV_PIX_FMT_VUYA:
2157 case AV_PIX_FMT_VUYX:
2158 75 *lumToYV12 = read_vuyx_Y_c;
2159 75 break;
2160 73 case AV_PIX_FMT_XV30LE:
2161 73 *lumToYV12 = read_xv30le_Y_c;
2162 73 break;
2163 86 case AV_PIX_FMT_V30XLE:
2164 86 *lumToYV12 = read_v30xle_Y_c;
2165 86 break;
2166 6 case AV_PIX_FMT_AYUV:
2167 case AV_PIX_FMT_UYVA:
2168 6 *lumToYV12 = read_ayuv_Y_c;
2169 6 break;
2170 92 case AV_PIX_FMT_AYUV64LE:
2171 case AV_PIX_FMT_XV48LE:
2172 92 *lumToYV12 = read_ayuv64le_Y_c;
2173 92 break;
2174 92 case AV_PIX_FMT_AYUV64BE:
2175 case AV_PIX_FMT_XV48BE:
2176 92 *lumToYV12 = read_ayuv64be_Y_c;
2177 92 break;
2178 73 case AV_PIX_FMT_XV36LE:
2179 73 *lumToYV12 = read_xv36le_Y_c;
2180 73 break;
2181 73 case AV_PIX_FMT_XV36BE:
2182 73 *lumToYV12 = read_xv36be_Y_c;
2183 73 break;
2184 194 case AV_PIX_FMT_YUYV422:
2185 case AV_PIX_FMT_YVYU422:
2186 case AV_PIX_FMT_YA8:
2187 194 *lumToYV12 = yuy2ToY_c;
2188 194 break;
2189 74 case AV_PIX_FMT_UYVY422:
2190 74 *lumToYV12 = uyvyToY_c;
2191 74 break;
2192 78 case AV_PIX_FMT_VYU444:
2193 78 *lumToYV12 = vyuToY_c;
2194 78 break;
2195 125 case AV_PIX_FMT_BGR24:
2196 125 *lumToYV12 = bgr24ToY_c;
2197 125 break;
2198 1 case AV_PIX_FMT_BGR565LE:
2199 1 *lumToYV12 = bgr16leToY_c;
2200 1 break;
2201 1 case AV_PIX_FMT_BGR565BE:
2202 1 *lumToYV12 = bgr16beToY_c;
2203 1 break;
2204 1 case AV_PIX_FMT_BGR555LE:
2205 1 *lumToYV12 = bgr15leToY_c;
2206 1 break;
2207 1 case AV_PIX_FMT_BGR555BE:
2208 1 *lumToYV12 = bgr15beToY_c;
2209 1 break;
2210 1 case AV_PIX_FMT_BGR444LE:
2211 1 *lumToYV12 = bgr12leToY_c;
2212 1 break;
2213 1 case AV_PIX_FMT_BGR444BE:
2214 1 *lumToYV12 = bgr12beToY_c;
2215 1 break;
2216 1019 case AV_PIX_FMT_RGB24:
2217 1019 *lumToYV12 = rgb24ToY_c;
2218 1019 break;
2219 69 case AV_PIX_FMT_RGB565LE:
2220 69 *lumToYV12 = rgb16leToY_c;
2221 69 break;
2222 1 case AV_PIX_FMT_RGB565BE:
2223 1 *lumToYV12 = rgb16beToY_c;
2224 1 break;
2225 80 case AV_PIX_FMT_RGB555LE:
2226 80 *lumToYV12 = rgb15leToY_c;
2227 80 break;
2228 1 case AV_PIX_FMT_RGB555BE:
2229 1 *lumToYV12 = rgb15beToY_c;
2230 1 break;
2231 1 case AV_PIX_FMT_RGB444LE:
2232 1 *lumToYV12 = rgb12leToY_c;
2233 1 break;
2234 1 case AV_PIX_FMT_RGB444BE:
2235 1 *lumToYV12 = rgb12beToY_c;
2236 1 break;
2237 29 case AV_PIX_FMT_RGB8:
2238 case AV_PIX_FMT_BGR8:
2239 case AV_PIX_FMT_PAL8:
2240 case AV_PIX_FMT_BGR4_BYTE:
2241 case AV_PIX_FMT_RGB4_BYTE:
2242 29 *lumToYV12 = palToY_c;
2243 29 break;
2244 74 case AV_PIX_FMT_MONOBLACK:
2245 74 *lumToYV12 = monoblack2Y_c;
2246 74 break;
2247 78 case AV_PIX_FMT_MONOWHITE:
2248 78 *lumToYV12 = monowhite2Y_c;
2249 78 break;
2250 225 case AV_PIX_FMT_RGB32:
2251 225 *lumToYV12 = bgr32ToY_c;
2252 225 break;
2253 43 case AV_PIX_FMT_RGB32_1:
2254 43 *lumToYV12 = bgr321ToY_c;
2255 43 break;
2256 97 case AV_PIX_FMT_BGR32:
2257 97 *lumToYV12 = rgb32ToY_c;
2258 97 break;
2259 52 case AV_PIX_FMT_BGR32_1:
2260 52 *lumToYV12 = rgb321ToY_c;
2261 52 break;
2262 11 case AV_PIX_FMT_RGB48BE:
2263 11 *lumToYV12 = rgb48BEToY_c;
2264 11 break;
2265 854 case AV_PIX_FMT_RGB48LE:
2266 854 *lumToYV12 = rgb48LEToY_c;
2267 854 break;
2268 1 case AV_PIX_FMT_BGR48BE:
2269 1 *lumToYV12 = bgr48BEToY_c;
2270 1 break;
2271 2 case AV_PIX_FMT_BGR48LE:
2272 2 *lumToYV12 = bgr48LEToY_c;
2273 2 break;
2274 10 case AV_PIX_FMT_RGBA64BE:
2275 10 *lumToYV12 = rgb64BEToY_c;
2276 10 break;
2277 2 case AV_PIX_FMT_RGBA64LE:
2278 2 *lumToYV12 = rgb64LEToY_c;
2279 2 break;
2280 1 case AV_PIX_FMT_BGRA64BE:
2281 1 *lumToYV12 = bgr64BEToY_c;
2282 1 break;
2283 2 case AV_PIX_FMT_BGRA64LE:
2284 2 *lumToYV12 = bgr64LEToY_c;
2285 2 break;
2286 219 case AV_PIX_FMT_P010LE:
2287 case AV_PIX_FMT_P210LE:
2288 case AV_PIX_FMT_P410LE:
2289 219 *lumToYV12 = p010LEToY_c;
2290 219 break;
2291 219 case AV_PIX_FMT_P010BE:
2292 case AV_PIX_FMT_P210BE:
2293 case AV_PIX_FMT_P410BE:
2294 219 *lumToYV12 = p010BEToY_c;
2295 219 break;
2296 219 case AV_PIX_FMT_P012LE:
2297 case AV_PIX_FMT_P212LE:
2298 case AV_PIX_FMT_P412LE:
2299 219 *lumToYV12 = p012LEToY_c;
2300 219 break;
2301 219 case AV_PIX_FMT_P012BE:
2302 case AV_PIX_FMT_P212BE:
2303 case AV_PIX_FMT_P412BE:
2304 219 *lumToYV12 = p012BEToY_c;
2305 219 break;
2306 1 case AV_PIX_FMT_GRAYF32LE:
2307 1 *lumToYV12 = grayf32leToY16_c;
2308 1 break;
2309 1 case AV_PIX_FMT_GRAYF32BE:
2310 1 *lumToYV12 = grayf32beToY16_c;
2311 1 break;
2312 73 case AV_PIX_FMT_Y210LE:
2313 73 *lumToYV12 = y210le_Y_c;
2314 73 break;
2315 73 case AV_PIX_FMT_Y212LE:
2316 73 *lumToYV12 = y212le_Y_c;
2317 73 break;
2318 91 case AV_PIX_FMT_Y216LE:
2319 91 *lumToYV12 = y216le_Y_c;
2320 91 break;
2321 46 case AV_PIX_FMT_X2RGB10LE:
2322 46 *lumToYV12 = rgb30leToY_c;
2323 46 break;
2324 46 case AV_PIX_FMT_X2BGR10LE:
2325 46 *lumToYV12 = bgr30leToY_c;
2326 46 break;
2327 case AV_PIX_FMT_RGBAF16BE:
2328 *lumToYV12 = rgbaf16beToY_c;
2329 break;
2330 case AV_PIX_FMT_RGBAF16LE:
2331 *lumToYV12 = rgbaf16leToY_c;
2332 break;
2333 case AV_PIX_FMT_RGBF16BE:
2334 *lumToYV12 = rgbf16beToY_c;
2335 break;
2336 case AV_PIX_FMT_RGBF16LE:
2337 *lumToYV12 = rgbf16leToY_c;
2338 break;
2339 case AV_PIX_FMT_RGBF32LE:
2340 *lumToYV12 = rgbf32le_to_y_c;
2341 break;
2342 case AV_PIX_FMT_RGBF32BE:
2343 *lumToYV12 = rgbf32be_to_y_c;
2344 break;
2345 }
2346
2/2
✓ Branch 0 taken 218 times.
✓ Branch 1 taken 30085 times.
30303 if (c->needAlpha) {
2347
4/4
✓ Branch 1 taken 202 times.
✓ Branch 2 taken 16 times.
✓ Branch 4 taken 22 times.
✓ Branch 5 taken 180 times.
218 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
2348
4/4
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 19 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 4 times.
38 if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
2349 15 *alpToYV12 = bswap16Y_c;
2350 }
2351
12/15
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 148 times.
✓ Branch 3 taken 13 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 45 times.
218 switch (srcFormat) {
2352 2 case AV_PIX_FMT_BGRA64LE:
2353 2 case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2354 2 case AV_PIX_FMT_BGRA64BE:
2355 2 case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2356 148 case AV_PIX_FMT_BGRA:
2357 case AV_PIX_FMT_RGBA:
2358 148 *alpToYV12 = rgbaToA_c;
2359 148 break;
2360 13 case AV_PIX_FMT_ABGR:
2361 case AV_PIX_FMT_ARGB:
2362 13 *alpToYV12 = abgrToA_c;
2363 13 break;
2364 case AV_PIX_FMT_RGBAF16BE:
2365 *alpToYV12 = rgbaf16beToA_c;
2366 break;
2367 case AV_PIX_FMT_RGBAF16LE:
2368 *alpToYV12 = rgbaf16leToA_c;
2369 break;
2370 1 case AV_PIX_FMT_YA8:
2371 1 *alpToYV12 = uyvyToY_c;
2372 1 break;
2373 1 case AV_PIX_FMT_YA16LE:
2374 1 *alpToYV12 = read_ya16le_alpha_c;
2375 1 break;
2376 1 case AV_PIX_FMT_YA16BE:
2377 1 *alpToYV12 = read_ya16be_alpha_c;
2378 1 break;
2379 2 case AV_PIX_FMT_VUYA:
2380 case AV_PIX_FMT_UYVA:
2381 2 *alpToYV12 = read_vuya_A_c;
2382 2 break;
2383 1 case AV_PIX_FMT_AYUV:
2384 1 *alpToYV12 = read_ayuv_A_c;
2385 1 break;
2386 1 case AV_PIX_FMT_AYUV64LE:
2387 1 *alpToYV12 = read_ayuv64le_A_c;
2388 1 break;
2389 1 case AV_PIX_FMT_AYUV64BE:
2390 1 *alpToYV12 = read_ayuv64be_A_c;
2391 1 break;
2392 case AV_PIX_FMT_PAL8 :
2393 *alpToYV12 = palToA_c;
2394 break;
2395 }
2396 }
2397 30303 }
2398