FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2026-04-30 23:37:26
Exec Total Coverage
Lines: 1171 1414 82.8%
Functions: 233 284 82.0%
Branches: 633 870 72.8%

Line Branch Exec Source
1 /*
2 * Copyright (C) 2001-2012 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <math.h>
22 #include <stddef.h>
23 #include <stdint.h>
24
25 #include "libavutil/attributes.h"
26 #include "libavutil/bswap.h"
27 #include "libavutil/intreadwrite.h"
28 #include "libavutil/avassert.h"
29 #include "libavutil/intfloat.h"
30 #include "config.h"
31 #include "swscale_internal.h"
32
33 #define input_pixel(pos) (is_be ? AV_RB16(pos) : AV_RL16(pos))
34
35 #define IS_BE_LE 0
36 #define IS_BE_BE 1
37 #define IS_BE_ 0
38 /* ENDIAN_IDENTIFIER needs to be "BE", "LE" or "". The latter is intended
39 * for single-byte cases where the concept of endianness does not apply. */
40 #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
41
42 #define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
43 #define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
44
45 static av_always_inline void
46 55623 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
47 enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
48 {
49 55623 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
50 int i;
51
2/2
✓ Branch 0 taken 5933952 times.
✓ Branch 1 taken 55623 times.
5989575 for (i = 0; i < width; i++) {
52
2/2
✓ Branch 0 taken 2966400 times.
✓ Branch 1 taken 2967552 times.
5933952 unsigned int r_b = input_pixel(&src[i*4+0]);
53
2/2
✓ Branch 0 taken 2966400 times.
✓ Branch 1 taken 2967552 times.
5933952 unsigned int g = input_pixel(&src[i*4+1]);
54
2/2
✓ Branch 0 taken 2966400 times.
✓ Branch 1 taken 2967552 times.
5933952 unsigned int b_r = input_pixel(&src[i*4+2]);
55
56
12/16
✓ Branch 0 taken 5933952 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5933952 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4459392 times.
✓ Branch 5 taken 1474560 times.
✓ Branch 6 taken 1483776 times.
✓ Branch 7 taken 2975616 times.
✓ Branch 8 taken 5933952 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 5933952 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4459392 times.
✓ Branch 13 taken 1474560 times.
✓ Branch 14 taken 1483776 times.
✓ Branch 15 taken 2975616 times.
5933952 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
57 }
58 55623 }
59
60 static av_always_inline void
61 55623 rgb64ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
62 const uint16_t *src1, const uint16_t *src2,
63 int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
64 {
65 int i;
66 55623 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
67 55623 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
68 av_assert1(src1==src2);
69
2/2
✓ Branch 0 taken 5933952 times.
✓ Branch 1 taken 55623 times.
5989575 for (i = 0; i < width; i++) {
70
2/2
✓ Branch 0 taken 2966400 times.
✓ Branch 1 taken 2967552 times.
5933952 unsigned int r_b = input_pixel(&src1[i*4+0]);
71
2/2
✓ Branch 0 taken 2966400 times.
✓ Branch 1 taken 2967552 times.
5933952 unsigned int g = input_pixel(&src1[i*4+1]);
72
2/2
✓ Branch 0 taken 2966400 times.
✓ Branch 1 taken 2967552 times.
5933952 unsigned int b_r = input_pixel(&src1[i*4+2]);
73
74
12/16
✓ Branch 0 taken 5933952 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5933952 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4459392 times.
✓ Branch 5 taken 1474560 times.
✓ Branch 6 taken 1483776 times.
✓ Branch 7 taken 2975616 times.
✓ Branch 8 taken 5933952 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 5933952 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4459392 times.
✓ Branch 13 taken 1474560 times.
✓ Branch 14 taken 1483776 times.
✓ Branch 15 taken 2975616 times.
5933952 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
75
12/16
✓ Branch 0 taken 5933952 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5933952 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4459392 times.
✓ Branch 5 taken 1474560 times.
✓ Branch 6 taken 1483776 times.
✓ Branch 7 taken 2975616 times.
✓ Branch 8 taken 5933952 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 5933952 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4459392 times.
✓ Branch 13 taken 1474560 times.
✓ Branch 14 taken 1483776 times.
✓ Branch 15 taken 2975616 times.
5933952 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
76 }
77 55623 }
78
79 static av_always_inline void
80 rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
81 const uint16_t *src1, const uint16_t *src2,
82 int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
83 {
84 int i;
85 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
86 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
87 av_assert1(src1==src2);
88 for (i = 0; i < width; i++) {
89 unsigned r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
90 unsigned g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
91 unsigned b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
92
93 dstU[i]= (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
94 dstV[i]= (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
95 }
96 }
97
98 #define RGB64FUNCS_EXT(pattern, BE_LE, origin, is_be) \
99 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\
100 int width, uint32_t *rgb2yuv, void *opq) \
101 { \
102 const uint16_t *src = (const uint16_t *) _src; \
103 uint16_t *dst = (uint16_t *) _dst; \
104 rgb64ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
105 } \
106 \
107 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
108 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
109 int width, uint32_t *rgb2yuv, void *opq) \
110 { \
111 const uint16_t *src1 = (const uint16_t *) _src1, \
112 *src2 = (const uint16_t *) _src2; \
113 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
114 rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
115 } \
116 \
117 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
118 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
119 int width, uint32_t *rgb2yuv, void *opq) \
120 { \
121 const uint16_t *src1 = (const uint16_t *) _src1, \
122 *src2 = (const uint16_t *) _src2; \
123 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
124 rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
125 }
126 #define RGB64FUNCS(pattern, endianness, base_fmt) \
127 RGB64FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
128
129 55680 RGB64FUNCS(rgb, LE, AV_PIX_FMT_RGBA64)
130 55836 RGB64FUNCS(rgb, BE, AV_PIX_FMT_RGBA64)
131 55680 RGB64FUNCS(bgr, LE, AV_PIX_FMT_BGRA64)
132 55296 RGB64FUNCS(bgr, BE, AV_PIX_FMT_BGRA64)
133
134 1019457 static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
135 const uint16_t *src, int width,
136 enum AVPixelFormat origin,
137 int32_t *rgb2yuv, int is_be)
138 {
139 1019457 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
140 int i;
141
2/2
✓ Branch 0 taken 333259656 times.
✓ Branch 1 taken 1019457 times.
334279113 for (i = 0; i < width; i++) {
142
2/2
✓ Branch 0 taken 5307264 times.
✓ Branch 1 taken 327952392 times.
333259656 unsigned int r_b = input_pixel(&src[i * 3 + 0]);
143
2/2
✓ Branch 0 taken 5307264 times.
✓ Branch 1 taken 327952392 times.
333259656 unsigned int g = input_pixel(&src[i * 3 + 1]);
144
2/2
✓ Branch 0 taken 5307264 times.
✓ Branch 1 taken 327952392 times.
333259656 unsigned int b_r = input_pixel(&src[i * 3 + 2]);
145
146
12/16
✓ Branch 0 taken 331785096 times.
✓ Branch 1 taken 1474560 times.
✓ Branch 2 taken 330301320 times.
✓ Branch 3 taken 1483776 times.
✓ Branch 4 taken 330301320 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 330301320 times.
✓ Branch 8 taken 331785096 times.
✓ Branch 9 taken 1474560 times.
✓ Branch 10 taken 330301320 times.
✓ Branch 11 taken 1483776 times.
✓ Branch 12 taken 330301320 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 330301320 times.
333259656 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
147 }
148 1019457 }
149
150 624093 static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
151 uint16_t *dstV,
152 const uint16_t *src1,
153 const uint16_t *src2,
154 int width,
155 enum AVPixelFormat origin,
156 int32_t *rgb2yuv, int is_be)
157 {
158 int i;
159 624093 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
160 624093 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
161 av_assert1(src1 == src2);
162
2/2
✓ Branch 0 taken 195320256 times.
✓ Branch 1 taken 624093 times.
195944349 for (i = 0; i < width; i++) {
163
2/2
✓ Branch 0 taken 5178240 times.
✓ Branch 1 taken 190142016 times.
195320256 unsigned r_b = input_pixel(&src1[i * 3 + 0]);
164
2/2
✓ Branch 0 taken 5178240 times.
✓ Branch 1 taken 190142016 times.
195320256 unsigned g = input_pixel(&src1[i * 3 + 1]);
165
2/2
✓ Branch 0 taken 5178240 times.
✓ Branch 1 taken 190142016 times.
195320256 unsigned b_r = input_pixel(&src1[i * 3 + 2]);
166
167
12/16
✓ Branch 0 taken 193845696 times.
✓ Branch 1 taken 1474560 times.
✓ Branch 2 taken 192361920 times.
✓ Branch 3 taken 1483776 times.
✓ Branch 4 taken 192361920 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 192361920 times.
✓ Branch 8 taken 193845696 times.
✓ Branch 9 taken 1474560 times.
✓ Branch 10 taken 192361920 times.
✓ Branch 11 taken 1483776 times.
✓ Branch 12 taken 192361920 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 192361920 times.
195320256 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
168
12/16
✓ Branch 0 taken 193845696 times.
✓ Branch 1 taken 1474560 times.
✓ Branch 2 taken 192361920 times.
✓ Branch 3 taken 1483776 times.
✓ Branch 4 taken 192361920 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 192361920 times.
✓ Branch 8 taken 193845696 times.
✓ Branch 9 taken 1474560 times.
✓ Branch 10 taken 192361920 times.
✓ Branch 11 taken 1483776 times.
✓ Branch 12 taken 192361920 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 192361920 times.
195320256 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
169 }
170 624093 }
171
172 404360 static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
173 uint16_t *dstV,
174 const uint16_t *src1,
175 const uint16_t *src2,
176 int width,
177 enum AVPixelFormat origin,
178 int32_t *rgb2yuv, int is_be)
179 {
180 int i;
181 404360 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
182 404360 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
183 av_assert1(src1 == src2);
184
2/2
✓ Branch 0 taken 70552996 times.
✓ Branch 1 taken 404360 times.
70957356 for (i = 0; i < width; i++) {
185
2/2
✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 70488484 times.
70552996 unsigned r_b = (input_pixel(&src1[6 * i + 0]) +
186
2/2
✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 70488484 times.
70552996 input_pixel(&src1[6 * i + 3]) + 1) >> 1;
187
2/2
✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 70488484 times.
70552996 unsigned g = (input_pixel(&src1[6 * i + 1]) +
188
2/2
✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 70488484 times.
70552996 input_pixel(&src1[6 * i + 4]) + 1) >> 1;
189
2/2
✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 70488484 times.
70552996 unsigned b_r = (input_pixel(&src1[6 * i + 2]) +
190
2/2
✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 70488484 times.
70552996 input_pixel(&src1[6 * i + 5]) + 1) >> 1;
191
192
8/16
✓ Branch 0 taken 70552996 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70552996 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 70552996 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 70552996 times.
✓ Branch 8 taken 70552996 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 70552996 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 70552996 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 70552996 times.
70552996 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
193
8/16
✓ Branch 0 taken 70552996 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70552996 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 70552996 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 70552996 times.
✓ Branch 8 taken 70552996 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 70552996 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 70552996 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 70552996 times.
70552996 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
194 }
195 404360 }
196
197 #undef r
198 #undef b
199 #undef input_pixel
200
201 #define RGB48FUNCS_EXT(pattern, BE_LE, origin, is_be) \
202 static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
203 const uint8_t *_src, \
204 const uint8_t *unused0, const uint8_t *unused1,\
205 int width, \
206 uint32_t *rgb2yuv, \
207 void *opq) \
208 { \
209 const uint16_t *src = (const uint16_t *)_src; \
210 uint16_t *dst = (uint16_t *)_dst; \
211 rgb48ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
212 } \
213 \
214 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
215 uint8_t *_dstV, \
216 const uint8_t *unused0, \
217 const uint8_t *_src1, \
218 const uint8_t *_src2, \
219 int width, \
220 uint32_t *rgb2yuv, \
221 void *opq) \
222 { \
223 const uint16_t *src1 = (const uint16_t *)_src1, \
224 *src2 = (const uint16_t *)_src2; \
225 uint16_t *dstU = (uint16_t *)_dstU, \
226 *dstV = (uint16_t *)_dstV; \
227 rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
228 } \
229 \
230 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
231 uint8_t *_dstV, \
232 const uint8_t *unused0, \
233 const uint8_t *_src1, \
234 const uint8_t *_src2, \
235 int width, \
236 uint32_t *rgb2yuv, \
237 void *opq) \
238 { \
239 const uint16_t *src1 = (const uint16_t *)_src1, \
240 *src2 = (const uint16_t *)_src2; \
241 uint16_t *dstU = (uint16_t *)_dstU, \
242 *dstV = (uint16_t *)_dstV; \
243 rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
244 }
245 #define RGB48FUNCS(pattern, endianness, base_fmt) \
246 RGB48FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
247
248 3837616 RGB48FUNCS(rgb, LE, AV_PIX_FMT_RGB48)
249 147228 RGB48FUNCS(rgb, BE, AV_PIX_FMT_RGB48)
250 55680 RGB48FUNCS(bgr, LE, AV_PIX_FMT_BGR48)
251 55296 RGB48FUNCS(bgr, BE, AV_PIX_FMT_BGR48)
252
253 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
254 origin == AV_PIX_FMT_BGRA || \
255 origin == AV_PIX_FMT_ARGB || \
256 origin == AV_PIX_FMT_ABGR) \
257 ? AV_RN32A(&src[(i) * 4]) \
258 : ((origin == AV_PIX_FMT_X2RGB10LE || \
259 origin == AV_PIX_FMT_X2BGR10LE) \
260 ? AV_RL32(&src[(i) * 4]) \
261 : (is_be ? AV_RB16(&src[(i) * 2]) \
262 : AV_RL16(&src[(i) * 2]))))
263
264 1277450 static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
265 const uint8_t *src,
266 int width,
267 enum AVPixelFormat origin,
268 int shr, int shg,
269 int shb, int shp,
270 int maskr, int maskg,
271 int maskb, int rsh,
272 int gsh, int bsh, int S,
273 int32_t *rgb2yuv, int is_be)
274 {
275 1277450 const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
276 1277450 const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
277 int i;
278
279
2/2
✓ Branch 0 taken 401103025 times.
✓ Branch 1 taken 1277450 times.
402380475 for (i = 0; i < width; i++) {
280
14/14
✓ Branch 0 taken 203867232 times.
✓ Branch 1 taken 197235793 times.
✓ Branch 2 taken 203339936 times.
✓ Branch 3 taken 527296 times.
✓ Branch 4 taken 202925024 times.
✓ Branch 5 taken 414912 times.
✓ Branch 6 taken 492480 times.
✓ Branch 7 taken 202432544 times.
✓ Branch 8 taken 177602080 times.
✓ Branch 9 taken 24830464 times.
✓ Branch 10 taken 24830464 times.
✓ Branch 11 taken 152771616 times.
✓ Branch 12 taken 8957952 times.
✓ Branch 13 taken 143813664 times.
401103025 int px = input_pixel(i) >> shp;
281 401103025 int b = (px & maskb) >> shb;
282 401103025 int g = (px & maskg) >> shg;
283 401103025 int r = (px & maskr) >> shr;
284
285 401103025 dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
286 }
287 1277450 }
288
289 823096 static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
290 int16_t *dstV,
291 const uint8_t *src,
292 int width,
293 enum AVPixelFormat origin,
294 int shr, int shg,
295 int shb, int shp,
296 int maskr, int maskg,
297 int maskb, int rsh,
298 int gsh, int bsh, int S,
299 int32_t *rgb2yuv, int is_be)
300 {
301 823096 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
302 823096 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
303 823096 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
304 int i;
305
306
2/2
✓ Branch 0 taken 212356489 times.
✓ Branch 1 taken 823096 times.
213179585 for (i = 0; i < width; i++) {
307
14/14
✓ Branch 0 taken 125015616 times.
✓ Branch 1 taken 87340873 times.
✓ Branch 2 taken 124566144 times.
✓ Branch 3 taken 449472 times.
✓ Branch 4 taken 124151232 times.
✓ Branch 5 taken 414912 times.
✓ Branch 6 taken 414912 times.
✓ Branch 7 taken 123736320 times.
✓ Branch 8 taken 98905856 times.
✓ Branch 9 taken 24830464 times.
✓ Branch 10 taken 24830464 times.
✓ Branch 11 taken 74075392 times.
✓ Branch 12 taken 7741440 times.
✓ Branch 13 taken 66333952 times.
212356489 int px = input_pixel(i) >> shp;
308 212356489 int b = (px & maskb) >> shb;
309 212356489 int g = (px & maskg) >> shg;
310 212356489 int r = (px & maskr) >> shr;
311
312 212356489 dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
313 212356489 dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
314 }
315 823096 }
316
317 391828 static av_always_inline void rgb16_32ToUV_half_c_template(int16_t *dstU,
318 int16_t *dstV,
319 const uint8_t *src,
320 int width,
321 enum AVPixelFormat origin,
322 int shr, int shg,
323 int shb, int shp,
324 int maskr, int maskg,
325 int maskb, int rsh,
326 int gsh, int bsh, int S,
327 int32_t *rgb2yuv, int is_be)
328 {
329 391828 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
330 391828 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
331 391828 maskgx = ~(maskr | maskb);
332 391828 const unsigned rnd = (256U<<(S)) + (1<<(S-6));
333 int i;
334
335 391828 maskr |= maskr << 1;
336 391828 maskb |= maskb << 1;
337 391828 maskg |= maskg << 1;
338
2/2
✓ Branch 0 taken 84659126 times.
✓ Branch 1 taken 391828 times.
85050954 for (i = 0; i < width; i++) {
339
12/14
✓ Branch 0 taken 39436240 times.
✓ Branch 1 taken 45222886 times.
✓ Branch 2 taken 39393552 times.
✓ Branch 3 taken 42688 times.
✓ Branch 4 taken 39390416 times.
✓ Branch 5 taken 3136 times.
✓ Branch 6 taken 42304 times.
✓ Branch 7 taken 39348112 times.
✓ Branch 8 taken 39348112 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 39348112 times.
✓ Branch 12 taken 608256 times.
✓ Branch 13 taken 38739856 times.
84659126 unsigned px0 = input_pixel(2 * i + 0) >> shp;
340
12/14
✓ Branch 0 taken 39436240 times.
✓ Branch 1 taken 45222886 times.
✓ Branch 2 taken 39393552 times.
✓ Branch 3 taken 42688 times.
✓ Branch 4 taken 39390416 times.
✓ Branch 5 taken 3136 times.
✓ Branch 6 taken 42304 times.
✓ Branch 7 taken 39348112 times.
✓ Branch 8 taken 39348112 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 39348112 times.
✓ Branch 12 taken 608256 times.
✓ Branch 13 taken 38739856 times.
84659126 unsigned px1 = input_pixel(2 * i + 1) >> shp;
341 84659126 int b, r, g = (px0 & maskgx) + (px1 & maskgx);
342 84659126 int rb = px0 + px1 - g;
343
344 84659126 b = (rb & maskb) >> shb;
345
4/4
✓ Branch 0 taken 84613686 times.
✓ Branch 1 taken 45440 times.
✓ Branch 2 taken 84512310 times.
✓ Branch 3 taken 101376 times.
84659126 if (shp ||
346
4/4
✓ Branch 0 taken 84410934 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 76677458 times.
✓ Branch 3 taken 7733476 times.
84512310 origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
347
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 76576082 times.
76677458 origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
348 8083044 g >>= shg;
349 } else {
350 76576082 g = (g & maskg) >> shg;
351 }
352 84659126 r = (rb & maskr) >> shr;
353
354 84659126 dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);
355 84659126 dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);
356 }
357 391828 }
358
359 #undef input_pixel
360
361 #define RGB16_32FUNCS_EXT(fmt, name, shr, shg, shb, shp, maskr, \
362 maskg, maskb, rsh, gsh, bsh, S, is_be) \
363 static void name ## ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, \
364 int width, uint32_t *tab, void *opq) \
365 { \
366 rgb16_32ToY_c_template((int16_t*)dst, src, width, fmt, shr, shg, shb, shp, \
367 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
368 } \
369 \
370 static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
371 const uint8_t *unused0, const uint8_t *src, const uint8_t *dummy, \
372 int width, uint32_t *tab, void *opq) \
373 { \
374 rgb16_32ToUV_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
375 shr, shg, shb, shp, \
376 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
377 } \
378 \
379 static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
380 const uint8_t *unused0, const uint8_t *src, \
381 const uint8_t *dummy, \
382 int width, uint32_t *tab, void *opq) \
383 { \
384 rgb16_32ToUV_half_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
385 shr, shg, shb, shp, \
386 maskr, maskg, maskb, \
387 rsh, gsh, bsh, S, tab, is_be); \
388 }
389
390 #define RGB16_32FUNCS(base_fmt, endianness, name, shr, shg, shb, shp, maskr, \
391 maskg, maskb, rsh, gsh, bsh, S) \
392 RGB16_32FUNCS_EXT(base_fmt ## endianness, name, shr, shg, shb, shp, maskr, \
393 maskg, maskb, rsh, gsh, bsh, S, IS_BE(endianness))
394
395 2094782 RGB16_32FUNCS(AV_PIX_FMT_BGR32, , bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
396 4672 RGB16_32FUNCS(AV_PIX_FMT_BGR32_1, , bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
397 8204 RGB16_32FUNCS(AV_PIX_FMT_RGB32, , rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
398 5890 RGB16_32FUNCS(AV_PIX_FMT_RGB32_1, , rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
399 56064 RGB16_32FUNCS(AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
400 56064 RGB16_32FUNCS(AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
401 56064 RGB16_32FUNCS(AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
402 568576 RGB16_32FUNCS(AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
403 1100576 RGB16_32FUNCS(AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
404 56064 RGB16_32FUNCS(AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
405 56064 RGB16_32FUNCS(AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
406 56064 RGB16_32FUNCS(AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
407 56064 RGB16_32FUNCS(AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
408 56064 RGB16_32FUNCS(AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
409 56064 RGB16_32FUNCS(AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
410 56064 RGB16_32FUNCS(AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
411 320704 RGB16_32FUNCS(AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
412 320704 RGB16_32FUNCS(AV_PIX_FMT_X2BGR10, LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0, RGB2YUV_SHIFT + 6)
413
414 363972 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
415 const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
416 int width, uint32_t *rgb2yuv, void *opq)
417 {
418 363972 uint16_t *dstU = (uint16_t *)_dstU;
419 363972 uint16_t *dstV = (uint16_t *)_dstV;
420 363972 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
421 363972 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
422
423 int i;
424
2/2
✓ Branch 0 taken 64059072 times.
✓ Branch 1 taken 363972 times.
64423044 for (i = 0; i < width; i++) {
425 64059072 unsigned int g = gsrc[2*i] + gsrc[2*i+1];
426 64059072 unsigned int b = bsrc[2*i] + bsrc[2*i+1];
427 64059072 unsigned int r = rsrc[2*i] + rsrc[2*i+1];
428
429 64059072 dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
430 64059072 dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
431 }
432 363972 }
433
434 26112 static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
435 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
436 {
437 26112 int16_t *dst = (int16_t *)_dst;
438 26112 const uint16_t *src = (const uint16_t *)_src;
439 int i;
440
2/2
✓ Branch 0 taken 2801664 times.
✓ Branch 1 taken 26112 times.
2827776 for (i = 0; i < width; i++)
441 2801664 dst[i] = AV_RL16(src + 4 * i + 3);
442 26112 }
443
444 26112 static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
445 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
446 {
447 26112 int16_t *dst = (int16_t *)_dst;
448 26112 const uint16_t *src = (const uint16_t *)_src;
449 int i;
450
2/2
✓ Branch 0 taken 2801664 times.
✓ Branch 1 taken 26112 times.
2827776 for (i = 0; i < width; i++)
451 2801664 dst[i] = AV_RB16(src + 4 * i + 3);
452 26112 }
453
454 52527 static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
455 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
456 {
457 52527 int16_t *dst = (int16_t *)_dst;
458 int i;
459
2/2
✓ Branch 0 taken 5680896 times.
✓ Branch 1 taken 52527 times.
5733423 for (i=0; i<width; i++) {
460 5680896 dst[i]= src[4*i]<<6 | src[4*i]>>2;
461 }
462 52527 }
463
464 147682 static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
465 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
466 {
467 147682 int16_t *dst = (int16_t *)_dst;
468 int i;
469
2/2
✓ Branch 0 taken 73077320 times.
✓ Branch 1 taken 147682 times.
73225002 for (i=0; i<width; i++) {
470 73077320 dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
471 }
472 147682 }
473
474 static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
475 const uint8_t *unused2, int width, uint32_t *pal, void *opq)
476 {
477 int16_t *dst = (int16_t *)_dst;
478 int i;
479 for (i=0; i<width; i++) {
480 int d= src[i];
481
482 dst[i]= (pal[d] >> 24)<<6 | pal[d]>>26;
483 }
484 }
485
486 240231 static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
487 const uint8_t *unused2, int width, uint32_t *pal, void *opq)
488 {
489 240231 int16_t *dst = (int16_t *)_dst;
490 int i;
491
2/2
✓ Branch 0 taken 68994840 times.
✓ Branch 1 taken 240231 times.
69235071 for (i = 0; i < width; i++) {
492 68994840 int d = src[i];
493
494 68994840 dst[i] = (pal[d] & 0xFF)<<6;
495 }
496 240231 }
497
498 240231 static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV,
499 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
500 int width, uint32_t *pal, void *opq)
501 {
502 240231 uint16_t *dstU = (uint16_t *)_dstU;
503 240231 int16_t *dstV = (int16_t *)_dstV;
504 int i;
505 av_assert1(src1 == src2);
506
2/2
✓ Branch 0 taken 68994840 times.
✓ Branch 1 taken 240231 times.
69235071 for (i = 0; i < width; i++) {
507 68994840 int p = pal[src1[i]];
508
509 68994840 dstU[i] = (uint8_t)(p>> 8)<<6;
510 68994840 dstV[i] = (uint8_t)(p>>16)<<6;
511 }
512 240231 }
513
514 116888 static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
515 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
516 {
517 116888 int16_t *dst = (int16_t *)_dst;
518 int i, j;
519 116888 width = (width + 7) >> 3;
520
2/2
✓ Branch 0 taken 4281692 times.
✓ Branch 1 taken 116888 times.
4398580 for (i = 0; i < width; i++) {
521 4281692 int d = ~src[i];
522
2/2
✓ Branch 0 taken 34253536 times.
✓ Branch 1 taken 4281692 times.
38535228 for (j = 0; j < 8; j++)
523 34253536 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
524 }
525
1/2
✓ Branch 0 taken 116888 times.
✗ Branch 1 not taken.
116888 if(width&7){
526 116888 int d= ~src[i];
527
2/2
✓ Branch 0 taken 490252 times.
✓ Branch 1 taken 116888 times.
607140 for (j = 0; j < (width&7); j++)
528 490252 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
529 }
530 116888 }
531
532 105538 static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
533 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
534 {
535 105538 int16_t *dst = (int16_t *)_dst;
536 int i, j;
537 105538 width = (width + 7) >> 3;
538
2/2
✓ Branch 0 taken 4213592 times.
✓ Branch 1 taken 105538 times.
4319130 for (i = 0; i < width; i++) {
539 4213592 int d = src[i];
540
2/2
✓ Branch 0 taken 33708736 times.
✓ Branch 1 taken 4213592 times.
37922328 for (j = 0; j < 8; j++)
541 33708736 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
542 }
543
1/2
✓ Branch 0 taken 105538 times.
✗ Branch 1 not taken.
105538 if(width&7){
544 105538 int d = src[i];
545
2/2
✓ Branch 0 taken 422152 times.
✓ Branch 1 taken 105538 times.
527690 for (j = 0; j < (width&7); j++)
546 422152 dst[8*i+j] = ((d>>(7-j))&1) * 16383;
547 }
548 105538 }
549
550 185042 static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
551 uint32_t *unused, void *opq)
552 {
553 int i;
554
2/2
✓ Branch 0 taken 65074304 times.
✓ Branch 1 taken 185042 times.
65259346 for (i = 0; i < width; i++)
555 65074304 dst[i] = src[2 * i];
556 185042 }
557
558 92098 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
559 const uint8_t *src2, int width, uint32_t *unused, void *opq)
560 {
561 int i;
562
2/2
✓ Branch 0 taken 16209248 times.
✓ Branch 1 taken 92098 times.
16301346 for (i = 0; i < width; i++) {
563 16209248 dstU[i] = src1[4 * i + 1];
564 16209248 dstV[i] = src1[4 * i + 3];
565 }
566 av_assert1(src1 == src2);
567 92098 }
568
569 92098 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
570 const uint8_t *src2, int width, uint32_t *unused, void *opq)
571 {
572 int i;
573
2/2
✓ Branch 0 taken 16209248 times.
✓ Branch 1 taken 92098 times.
16301346 for (i = 0; i < width; i++) {
574 16209248 dstV[i] = src1[4 * i + 1];
575 16209248 dstU[i] = src1[4 * i + 3];
576 }
577 av_assert1(src1 == src2);
578 92098 }
579
580 #define y21xle_wrapper(bits, shift) \
581 static void y2 ## bits ## le_UV_c(uint8_t *dstU, uint8_t *dstV, \
582 const uint8_t *unused0, \
583 const uint8_t *src, \
584 const uint8_t *unused1, int width, \
585 uint32_t *unused2, void *opq) \
586 { \
587 int i; \
588 for (i = 0; i < width; i++) { \
589 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> shift); \
590 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> shift); \
591 } \
592 } \
593 \
594 static void y2 ## bits ## le_Y_c(uint8_t *dst, const uint8_t *src, \
595 const uint8_t *unused0, \
596 const uint8_t *unused1, int width, \
597 uint32_t *unused2, void *opq) \
598 { \
599 int i; \
600 for (i = 0; i < width; i++) \
601 AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> shift); \
602 }
603
604
2/2
✓ Branch 0 taken 48475680 times.
✓ Branch 1 taken 183620 times.
97318600 y21xle_wrapper(10, 6)
605
2/2
✓ Branch 0 taken 48475680 times.
✓ Branch 1 taken 183620 times.
97318600 y21xle_wrapper(12, 4)
606
2/2
✓ Branch 0 taken 61613376 times.
✓ Branch 1 taken 233384 times.
123693520 y21xle_wrapper(16, 0)
607
608 1751617 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
609 uint32_t *unused, void *opq)
610 {
611 int i;
612 1751617 const uint16_t *src = (const uint16_t *)_src;
613 1751617 uint16_t *dst = (uint16_t *)_dst;
614
2/2
✓ Branch 0 taken 590845696 times.
✓ Branch 1 taken 1751617 times.
592597313 for (i = 0; i < width; i++)
615 590845696 dst[i] = av_bswap16(src[i]);
616 1751617 }
617
618 801524 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
619 const uint8_t *_src2, int width, uint32_t *unused, void *opq)
620 {
621 int i;
622 801524 const uint16_t *src1 = (const uint16_t *)_src1,
623 801524 *src2 = (const uint16_t *)_src2;
624 801524 uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
625
2/2
✓ Branch 0 taken 197062400 times.
✓ Branch 1 taken 801524 times.
197863924 for (i = 0; i < width; i++) {
626 197062400 dstU[i] = av_bswap16(src1[i]);
627 197062400 dstV[i] = av_bswap16(src2[i]);
628 }
629 801524 }
630
631 14016 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
632 uint32_t *unused, void *opq)
633 {
634 int i;
635
2/2
✓ Branch 0 taken 1492992 times.
✓ Branch 1 taken 14016 times.
1507008 for (i = 0; i < width; i++)
636 1492992 AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
637 14016 }
638
639 13056 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
640 uint32_t *unused, void *opq)
641 {
642 int i;
643
2/2
✓ Branch 0 taken 1400832 times.
✓ Branch 1 taken 13056 times.
1413888 for (i = 0; i < width; i++)
644 1400832 AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
645 13056 }
646
647 14151 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
648 uint32_t *unused, void *opq)
649 {
650 int i;
651
2/2
✓ Branch 0 taken 1510272 times.
✓ Branch 1 taken 14151 times.
1524423 for (i = 0; i < width; i++)
652 1510272 AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
653 14151 }
654
655 13056 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
656 uint32_t *unused, void *opq)
657 {
658 int i;
659
2/2
✓ Branch 0 taken 1400832 times.
✓ Branch 1 taken 13056 times.
1413888 for (i = 0; i < width; i++)
660 1400832 AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
661 13056 }
662
663 144148 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
664 uint32_t *unused2, void *opq)
665 {
666 int i;
667
2/2
✓ Branch 0 taken 43858816 times.
✓ Branch 1 taken 144148 times.
44002964 for (i = 0; i < width; i++)
668 43858816 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
669 144148 }
670
671 144148 static void read_ayuv64be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
672 uint32_t *unused2, void *opq)
673 {
674 int i;
675
2/2
✓ Branch 0 taken 43858816 times.
✓ Branch 1 taken 144148 times.
44002964 for (i = 0; i < width; i++)
676 43858816 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2));
677 144148 }
678
679 144148 static av_always_inline void ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width,
680 int u_offset, int v_offset)
681 {
682 int i;
683
2/2
✓ Branch 0 taken 43858816 times.
✓ Branch 1 taken 144148 times.
44002964 for (i = 0; i < width; i++) {
684 43858816 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + u_offset));
685 43858816 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + v_offset));
686 }
687 144148 }
688
689 144148 static av_always_inline void ayuv64be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width,
690 int u_offset, int v_offset)
691 {
692 int i;
693
2/2
✓ Branch 0 taken 43858816 times.
✓ Branch 1 taken 144148 times.
44002964 for (i = 0; i < width; i++) {
694 43858816 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + u_offset));
695 43858816 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + v_offset));
696 }
697 144148 }
698
699 #define ayuv64_UV_funcs(pixfmt, U, V) \
700 static void read_ ## pixfmt ## le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, \
701 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
702 { \
703 ayuv64le_UV_c(dstU, dstV, src, width, U, V); \
704 } \
705 \
706 static void read_ ## pixfmt ## be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, \
707 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
708 { \
709 ayuv64be_UV_c(dstU, dstV, src, width, U, V); \
710 }
711
712 56064 ayuv64_UV_funcs(ayuv64, 4, 6)
713 520528 ayuv64_UV_funcs(xv48, 0, 4)
714
715 13056 static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
716 uint32_t *unused2, void *opq)
717 {
718 int i;
719
2/2
✓ Branch 0 taken 1400832 times.
✓ Branch 1 taken 13056 times.
1413888 for (i = 0; i < width; i++)
720 1400832 AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
721 13056 }
722
723 13056 static void read_ayuv64be_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
724 uint32_t *unused2, void *opq)
725 {
726 int i;
727
2/2
✓ Branch 0 taken 1400832 times.
✓ Branch 1 taken 13056 times.
1413888 for (i = 0; i < width; i++)
728 1400832 AV_WN16(dst + i * 2, AV_RB16(src + i * 8));
729 13056 }
730
731 119554 static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
732 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
733 {
734 int i;
735
2/2
✓ Branch 0 taken 35201728 times.
✓ Branch 1 taken 119554 times.
35321282 for (i = 0; i < width; i++) {
736 35201728 dstU[i] = src[i * 4 + 1];
737 35201728 dstV[i] = src[i * 4];
738 }
739 119554 }
740
741 119554 static void read_vuyx_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
742 uint32_t *unused2, void *opq)
743 {
744 int i;
745
2/2
✓ Branch 0 taken 35201728 times.
✓ Branch 1 taken 119554 times.
35321282 for (i = 0; i < width; i++)
746 35201728 dst[i] = src[i * 4 + 2];
747 119554 }
748
749 26112 static void read_vuya_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
750 uint32_t *unused2, void *opq)
751 {
752 int i;
753
2/2
✓ Branch 0 taken 2801664 times.
✓ Branch 1 taken 26112 times.
2827776 for (i = 0; i < width; i++)
754 2801664 dst[i] = src[i * 4 + 3];
755 26112 }
756
757 14016 static void read_ayuv_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
758 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
759 {
760 int i;
761
2/2
✓ Branch 0 taken 1492992 times.
✓ Branch 1 taken 14016 times.
1507008 for (i = 0; i < width; i++) {
762 1492992 dstU[i] = src[i * 4 + 2];
763 1492992 dstV[i] = src[i * 4 + 3];
764 }
765 14016 }
766
767 72932 static void read_ayuv_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
768 uint32_t *unused2, void *opq)
769 {
770 int i;
771
2/2
✓ Branch 0 taken 18250184 times.
✓ Branch 1 taken 72932 times.
18323116 for (i = 0; i < width; i++)
772 18250184 dst[i] = src[i * 4 + 1];
773 72932 }
774
775 13056 static void read_ayuv_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
776 uint32_t *unused2, void *opq)
777 {
778 int i;
779
2/2
✓ Branch 0 taken 1400832 times.
✓ Branch 1 taken 13056 times.
1413888 for (i = 0; i < width; i++)
780 1400832 dst[i] = src[i * 4];
781 13056 }
782
783 36466 static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
784 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
785 {
786 int i;
787
2/2
✓ Branch 0 taken 9125092 times.
✓ Branch 1 taken 36466 times.
9161558 for (i = 0; i < width; i++) {
788 9125092 dstU[i] = src[i * 4];
789 9125092 dstV[i] = src[i * 4 + 2];
790 }
791 36466 }
792
793 150438 static void vyuToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
794 uint32_t *unused2, void *opq)
795 {
796 int i;
797
2/2
✓ Branch 0 taken 48972936 times.
✓ Branch 1 taken 150438 times.
49123374 for (i = 0; i < width; i++)
798 48972936 dst[i] = src[i * 3 + 1];
799 150438 }
800
801 127988 static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
802 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
803 {
804 int i;
805
2/2
✓ Branch 0 taken 41340836 times.
✓ Branch 1 taken 127988 times.
41468824 for (i = 0; i < width; i++) {
806 41340836 dstU[i] = src[i * 3 + 2];
807 41340836 dstV[i] = src[i * 3];
808 }
809 127988 }
810
811 150421 static void read_v30xle_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
812 uint32_t *unused2, void *opq)
813 {
814 int i;
815
2/2
✓ Branch 0 taken 48940936 times.
✓ Branch 1 taken 150421 times.
49091357 for (i = 0; i < width; i++)
816 48940936 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
817 150421 }
818
819
820 127971 static void read_v30xle_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
821 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
822 {
823 int i;
824
2/2
✓ Branch 0 taken 41308836 times.
✓ Branch 1 taken 127971 times.
41436807 for (i = 0; i < width; i++) {
825 41308836 unsigned int uv = AV_RL32(src + i * 4);
826 41308836 AV_WN16(dstU + i * 2, (uv >> 2) & 0x3FFu);
827 41308836 AV_WN16(dstV + i * 2, (uv >> 22) & 0x3FFu);
828 }
829 127971 }
830
831 105250 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
832 uint32_t *unused2, void *opq)
833 {
834 int i;
835
2/2
✓ Branch 0 taken 33607360 times.
✓ Branch 1 taken 105250 times.
33712610 for (i = 0; i < width; i++)
836 33607360 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
837 105250 }
838
839
840 105250 static void read_xv30le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
841 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
842 {
843 int i;
844
2/2
✓ Branch 0 taken 33607360 times.
✓ Branch 1 taken 105250 times.
33712610 for (i = 0; i < width; i++) {
845 33607360 AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
846 33607360 AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
847 }
848 105250 }
849
850 105250 static void read_xv36le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
851 uint32_t *unused2, void *opq)
852 {
853 int i;
854
2/2
✓ Branch 0 taken 33607360 times.
✓ Branch 1 taken 105250 times.
33712610 for (i = 0; i < width; i++)
855 33607360 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
856 105250 }
857
858
859 105250 static void read_xv36le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
860 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
861 {
862 int i;
863
2/2
✓ Branch 0 taken 33607360 times.
✓ Branch 1 taken 105250 times.
33712610 for (i = 0; i < width; i++) {
864 33607360 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
865 33607360 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
866 }
867 105250 }
868
869 105250 static void read_xv36be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
870 uint32_t *unused2, void *opq)
871 {
872 int i;
873
2/2
✓ Branch 0 taken 33607360 times.
✓ Branch 1 taken 105250 times.
33712610 for (i = 0; i < width; i++)
874 33607360 AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2) >> 4);
875 105250 }
876
877
878 105250 static void read_xv36be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
879 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
880 {
881 int i;
882
2/2
✓ Branch 0 taken 33607360 times.
✓ Branch 1 taken 105250 times.
33712610 for (i = 0; i < width; i++) {
883 33607360 AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + 0) >> 4);
884 33607360 AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + 4) >> 4);
885 }
886 105250 }
887
888 /* This is almost identical to the previous, end exists only because
889 * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
890 92674 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
891 uint32_t *unused, void *opq)
892 {
893 int i;
894
2/2
✓ Branch 0 taken 32621248 times.
✓ Branch 1 taken 92674 times.
32713922 for (i = 0; i < width; i++)
895 32621248 dst[i] = src[2 * i + 1];
896 92674 }
897
898 92098 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
899 const uint8_t *src2, int width, uint32_t *unused, void *opq)
900 {
901 int i;
902
2/2
✓ Branch 0 taken 16209248 times.
✓ Branch 1 taken 92098 times.
16301346 for (i = 0; i < width; i++) {
903 16209248 dstU[i] = src1[4 * i + 0];
904 16209248 dstV[i] = src1[4 * i + 2];
905 }
906 av_assert1(src1 == src2);
907 92098 }
908
909 static void uyyvyyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
910 int width, uint32_t *unused, void *opq)
911 {
912 for (int i = 0; i < width; i++)
913 dst[i] = src[3 * (i >> 1) + 1 + (i & 1)];
914 }
915
916 static void uyyvyyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
917 const uint8_t *src2, int width, uint32_t *unused, void *opq)
918 {
919 for (int i = 0; i < width; i++) {
920 dstU[i] = src1[6 * i + 0];
921 dstV[i] = src1[6 * i + 3];
922 }
923 av_assert1(src1 == src2);
924 }
925
926 975242 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
927 const uint8_t *src, int width)
928 {
929 int i;
930
2/2
✓ Branch 0 taken 305556320 times.
✓ Branch 1 taken 975242 times.
306531562 for (i = 0; i < width; i++) {
931 305556320 dst1[i] = src[2 * i + 0];
932 305556320 dst2[i] = src[2 * i + 1];
933 }
934 975242 }
935
936 949610 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
937 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
938 int width, uint32_t *unused, void *opq)
939 {
940 949610 nvXXtoUV_c(dstU, dstV, src1, width);
941 949610 }
942
943 25632 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
944 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
945 int width, uint32_t *unused, void *opq)
946 {
947 25632 nvXXtoUV_c(dstV, dstU, src1, width);
948 25632 }
949
950 #define p01x_uv_wrapper(fmt, shift) \
951 static void fmt ## LEToUV ## _c(uint8_t *dstU, \
952 uint8_t *dstV, \
953 const uint8_t *unused0, \
954 const uint8_t *src1, \
955 const uint8_t *src2, int width, \
956 uint32_t *unused, void *opq) \
957 { \
958 int i; \
959 for (i = 0; i < width; i++) { \
960 AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> shift); \
961 AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> shift); \
962 } \
963 } \
964 \
965 static void fmt ## BEToUV ## _c(uint8_t *dstU, \
966 uint8_t *dstV, \
967 const uint8_t *unused0, \
968 const uint8_t *src1, \
969 const uint8_t *src2, int width, \
970 uint32_t *unused, void *opq) \
971 { \
972 int i; \
973 for (i = 0; i < width; i++) { \
974 AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> shift); \
975 AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> shift); \
976 } \
977 }
978
979 #define p01x_wrapper(fmt, shift) \
980 static void fmt ## LEToY ## _c(uint8_t *dst, \
981 const uint8_t *src, \
982 const uint8_t *unused1, \
983 const uint8_t *unused2, int width, \
984 uint32_t *unused, void *opq) \
985 { \
986 int i; \
987 for (i = 0; i < width; i++) { \
988 AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> shift); \
989 } \
990 } \
991 \
992 static void fmt ## BEToY ## _c(uint8_t *dst, \
993 const uint8_t *src, \
994 const uint8_t *unused1, \
995 const uint8_t *unused2, int width, \
996 uint32_t *unused, void *opq) \
997 { \
998 int i; \
999 for (i = 0; i < width; i++) { \
1000 AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> shift); \
1001 } \
1002 } \
1003 p01x_uv_wrapper(fmt, shift)
1004
1005
2/2
✓ Branch 0 taken 608256 times.
✓ Branch 1 taken 2304 times.
1221120 p01x_wrapper(nv20, 0)
1006
2/2
✓ Branch 0 taken 803038016 times.
✓ Branch 1 taken 2494448 times.
1611064928 p01x_wrapper(p010, 6)
1007
2/2
✓ Branch 0 taken 803038016 times.
✓ Branch 1 taken 2494448 times.
1611064928 p01x_wrapper(p012, 4)
1008
2/2
✓ Branch 0 taken 180359168 times.
✓ Branch 1 taken 728756 times.
362175848 p01x_uv_wrapper(p016, 0)
1009
1010 #define shf16_uv_wrapper(shift) \
1011 static void shf16_ ## shift ## LEToUV_c(uint8_t *dstU, \
1012 uint8_t *dstV, \
1013 const uint8_t *unused0, \
1014 const uint8_t *src1, \
1015 const uint8_t *src2, int width, \
1016 uint32_t *unused, void *opq) \
1017 { \
1018 int i; \
1019 for (i = 0; i < width; i++) { \
1020 AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 2) >> (16 - shift)); \
1021 AV_WN16(dstV + i * 2, AV_RL16(src2 + i * 2) >> (16 - shift)); \
1022 } \
1023 } \
1024 \
1025 static void shf16_ ## shift ## BEToUV_c(uint8_t *dstU, \
1026 uint8_t *dstV, \
1027 const uint8_t *unused0, \
1028 const uint8_t *src1, \
1029 const uint8_t *src2, int width, \
1030 uint32_t *unused, void *opq) \
1031 { \
1032 int i; \
1033 for (i = 0; i < width; i++) { \
1034 AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 2) >> (16 - shift)); \
1035 AV_WN16(dstV + i * 2, AV_RB16(src2 + i * 2) >> (16 - shift)); \
1036 } \
1037 }
1038
1039 #define shf16_wrapper(shift) \
1040 static void shf16_ ## shift ## LEToY_c(uint8_t *dst, \
1041 const uint8_t *src, \
1042 const uint8_t *unused1, \
1043 const uint8_t *unused2, int width, \
1044 uint32_t *unused, void *opq) \
1045 { \
1046 int i; \
1047 for (i = 0; i < width; i++) { \
1048 AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> (16 - shift)); \
1049 } \
1050 } \
1051 \
1052 static void shf16_ ## shift ## BEToY_c(uint8_t *dst, \
1053 const uint8_t *src, \
1054 const uint8_t *unused1, \
1055 const uint8_t *unused2, int width, \
1056 uint32_t *unused, void *opq) \
1057 { \
1058 int i; \
1059 for (i = 0; i < width; i++) { \
1060 AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> (16 - shift)); \
1061 } \
1062 } \
1063 shf16_uv_wrapper(shift)
1064
1065
2/2
✓ Branch 0 taken 94621696 times.
✓ Branch 1 taken 271744 times.
189786880 shf16_wrapper(10)
1066
2/2
✓ Branch 0 taken 94621696 times.
✓ Branch 1 taken 271744 times.
189786880 shf16_wrapper(12)
1067
1068 300660 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
1069 int width, uint32_t *rgb2yuv, void *opq)
1070 {
1071 300660 int16_t *dst = (int16_t *)_dst;
1072 300660 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1073 int i;
1074
2/2
✓ Branch 0 taken 103134504 times.
✓ Branch 1 taken 300660 times.
103435164 for (i = 0; i < width; i++) {
1075 103134504 int b = src[i * 3 + 0];
1076 103134504 int g = src[i * 3 + 1];
1077 103134504 int r = src[i * 3 + 2];
1078
1079 103134504 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1080 }
1081 300660 }
1082
1083 75522 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1084 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1085 {
1086 75522 int16_t *dstU = (int16_t *)_dstU;
1087 75522 int16_t *dstV = (int16_t *)_dstV;
1088 75522 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1089 75522 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1090 int i;
1091
2/2
✓ Branch 0 taken 26588928 times.
✓ Branch 1 taken 75522 times.
26664450 for (i = 0; i < width; i++) {
1092 26588928 int b = src1[3 * i + 0];
1093 26588928 int g = src1[3 * i + 1];
1094 26588928 int r = src1[3 * i + 2];
1095
1096 26588928 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1097 26588928 dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1098 }
1099 av_assert1(src1 == src2);
1100 75522 }
1101
1102 225180 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1103 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1104 {
1105 225180 int16_t *dstU = (int16_t *)_dstU;
1106 225180 int16_t *dstV = (int16_t *)_dstV;
1107 int i;
1108 225180 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1109 225180 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1110
2/2
✓ Branch 0 taken 38281908 times.
✓ Branch 1 taken 225180 times.
38507088 for (i = 0; i < width; i++) {
1111 38281908 int b = src1[6 * i + 0] + src1[6 * i + 3];
1112 38281908 int g = src1[6 * i + 1] + src1[6 * i + 4];
1113 38281908 int r = src1[6 * i + 2] + src1[6 * i + 5];
1114
1115 38281908 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1116 38281908 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1117 }
1118 av_assert1(src1 == src2);
1119 225180 }
1120
1121 1142410 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
1122 uint32_t *rgb2yuv, void *opq)
1123 {
1124 1142410 int16_t *dst = (int16_t *)_dst;
1125 1142410 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1126 int i;
1127
2/2
✓ Branch 0 taken 390453660 times.
✓ Branch 1 taken 1142410 times.
391596070 for (i = 0; i < width; i++) {
1128 390453660 int r = src[i * 3 + 0];
1129 390453660 int g = src[i * 3 + 1];
1130 390453660 int b = src[i * 3 + 2];
1131
1132 390453660 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1133 }
1134 1142410 }
1135
1136 501787 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1137 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1138 {
1139 501787 int16_t *dstU = (int16_t *)_dstU;
1140 501787 int16_t *dstV = (int16_t *)_dstV;
1141 int i;
1142 501787 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1143 501787 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1144 av_assert1(src1 == src2);
1145
2/2
✓ Branch 0 taken 176498004 times.
✓ Branch 1 taken 501787 times.
176999791 for (i = 0; i < width; i++) {
1146 176498004 int r = src1[3 * i + 0];
1147 176498004 int g = src1[3 * i + 1];
1148 176498004 int b = src1[3 * i + 2];
1149
1150 176498004 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1151 176498004 dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1152 }
1153 501787 }
1154
1155 654276 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1156 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1157 {
1158 654276 int16_t *dstU = (int16_t *)_dstU;
1159 654276 int16_t *dstV = (int16_t *)_dstV;
1160 int i;
1161 654276 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1162 654276 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1163 av_assert1(src1 == src2);
1164
2/2
✓ Branch 0 taken 108830484 times.
✓ Branch 1 taken 654276 times.
109484760 for (i = 0; i < width; i++) {
1165 108830484 int r = src1[6 * i + 0] + src1[6 * i + 3];
1166 108830484 int g = src1[6 * i + 1] + src1[6 * i + 4];
1167 108830484 int b = src1[6 * i + 2] + src1[6 * i + 5];
1168
1169 108830484 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1170 108830484 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1171 }
1172 654276 }
1173
1174 781736 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
1175 {
1176 781736 uint16_t *dst = (uint16_t *)_dst;
1177 781736 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1178 int i;
1179
2/2
✓ Branch 0 taken 274879232 times.
✓ Branch 1 taken 781736 times.
275660968 for (i = 0; i < width; i++) {
1180 274879232 int g = src[0][i];
1181 274879232 int b = src[1][i];
1182 274879232 int r = src[2][i];
1183
1184 274879232 dst[i] = (int)((unsigned)ry*r + (unsigned)gy*g + (unsigned)by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1185 }
1186 781736 }
1187
1188 849 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused, void *opq)
1189 {
1190 849 uint16_t *dst = (uint16_t *)_dst;
1191 int i;
1192
2/2
✓ Branch 0 taken 224328 times.
✓ Branch 1 taken 849 times.
225177 for (i = 0; i < width; i++)
1193 224328 dst[i] = src[3][i] << 6;
1194 849 }
1195
1196 419560 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
1197 {
1198 419560 uint16_t *dstU = (uint16_t *)_dstU;
1199 419560 uint16_t *dstV = (uint16_t *)_dstV;
1200 419560 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1201 419560 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1202 int i;
1203
2/2
✓ Branch 0 taken 147393280 times.
✓ Branch 1 taken 419560 times.
147812840 for (i = 0; i < width; i++) {
1204 147393280 int g = src[0][i];
1205 147393280 int b = src[1][i];
1206 147393280 int r = src[2][i];
1207
1208 147393280 dstU[i] = (int)((unsigned)ru*r + (unsigned)gu*g + (unsigned)bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1209 147393280 dstV[i] = (int)((unsigned)rv*r + (unsigned)gv*g + (unsigned)bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1210 }
1211 419560 }
1212
1213 #define rdpx(src) \
1214 (is_be ? AV_RB16(src) : AV_RL16(src))
1215
1216 #define shifted_planar_rgb16_to_y(rdpx_shift) \
1217 static av_always_inline void planar_rgb16_s ## rdpx_shift ## _to_y(uint8_t *_dst, const uint8_t *_src[4], \
1218 int width, int bpc, int is_be, int32_t *rgb2yuv) \
1219 { \
1220 int i; \
1221 const uint16_t **src = (const uint16_t **)_src; \
1222 uint16_t *dst = (uint16_t *)_dst; \
1223 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX]; \
1224 int shift = bpc < 16 ? bpc : 14; \
1225 for (i = 0; i < width; i++) { \
1226 int g = rdpx(src[0] + i) >> (16 - rdpx_shift); \
1227 int b = rdpx(src[1] + i) >> (16 - rdpx_shift); \
1228 int r = rdpx(src[2] + i) >> (16 - rdpx_shift); \
1229 \
1230 dst[i] = (int)((unsigned)ry*r + (unsigned)gy*g + (unsigned)by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) \
1231 + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14); \
1232 } \
1233 }
1234
1235 #define shifted_planar_rgb16_to_a(rdpx_shift) \
1236 static av_always_inline void planar_rgb16_s ## rdpx_shift ## _to_a(uint8_t *_dst, const uint8_t *_src[4], \
1237 int width, int bpc, int is_be, int32_t *rgb2yuv) \
1238 { \
1239 int i; \
1240 const uint16_t **src = (const uint16_t **)_src; \
1241 uint16_t *dst = (uint16_t *)_dst; \
1242 int shift = (bpc < 16 ? bpc : 14) + 16 - rdpx_shift; \
1243 \
1244 for (i = 0; i < width; i++) { \
1245 dst[i] = rdpx(src[3] + i) << (14 - shift); \
1246 } \
1247 } \
1248
1249 #define shifted_planar_rgb16_to_uv(rdpx_shift) \
1250 static av_always_inline void planar_rgb16_s ## rdpx_shift ## _to_uv(uint8_t *_dstU, uint8_t *_dstV, \
1251 const uint8_t *_src[4], int width, \
1252 int bpc, int is_be, int32_t *rgb2yuv) \
1253 { \
1254 int i; \
1255 const uint16_t **src = (const uint16_t **)_src; \
1256 uint16_t *dstU = (uint16_t *)_dstU; \
1257 uint16_t *dstV = (uint16_t *)_dstV; \
1258 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX]; \
1259 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX]; \
1260 int shift = bpc < 16 ? bpc : 14; \
1261 for (i = 0; i < width; i++) { \
1262 int g = rdpx(src[0] + i) >> (16 - rdpx_shift); \
1263 int b = rdpx(src[1] + i) >> (16 - rdpx_shift); \
1264 int r = rdpx(src[2] + i) >> (16 - rdpx_shift); \
1265 \
1266 dstU[i] = (int)((unsigned)ru*r + (unsigned)gu*g + (unsigned)bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) \
1267 + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14); \
1268 dstV[i] = (int)((unsigned)rv*r + (unsigned)gv*g + (unsigned)bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) \
1269 + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14); \
1270 } \
1271 }
1272
1273 #define shifted_planar_rgb16_to_y_uv(rdpx_shift) \
1274 shifted_planar_rgb16_to_y(rdpx_shift) \
1275 shifted_planar_rgb16_to_uv(rdpx_shift)
1276
1277 #define shifted_planar_rgb16(rdpx_shift) \
1278 shifted_planar_rgb16_to_y_uv(rdpx_shift) \
1279 shifted_planar_rgb16_to_a(rdpx_shift)
1280
1281
10/10
✓ Branch 0 taken 3763984 times.
✓ Branch 1 taken 755706 times.
✓ Branch 2 taken 183501744 times.
✓ Branch 3 taken 1385341804 times.
✓ Branch 4 taken 185520480 times.
✓ Branch 5 taken 1383352744 times.
✓ Branch 6 taken 181483008 times.
✓ Branch 7 taken 1383323068 times.
✓ Branch 8 taken 1564806076 times.
✓ Branch 9 taken 4490014 times.
3146726476 shifted_planar_rgb16(16)
1282
9/10
✓ Branch 0 taken 56256 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2985984 times.
✓ Branch 3 taken 3004416 times.
✓ Branch 4 taken 2985984 times.
✓ Branch 5 taken 3004416 times.
✓ Branch 6 taken 2985984 times.
✓ Branch 7 taken 3004416 times.
✓ Branch 8 taken 5990400 times.
✓ Branch 9 taken 56256 times.
12093312 shifted_planar_rgb16_to_y_uv(12)
1283
9/10
✓ Branch 0 taken 56256 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2985984 times.
✓ Branch 3 taken 3004416 times.
✓ Branch 4 taken 2985984 times.
✓ Branch 5 taken 3004416 times.
✓ Branch 6 taken 2985984 times.
✓ Branch 7 taken 3004416 times.
✓ Branch 8 taken 5990400 times.
✓ Branch 9 taken 56256 times.
12093312 shifted_planar_rgb16_to_y_uv(10)
1284
1285 #undef rdpx
1286
1287 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
1288
1289 1188 static av_always_inline void planar_rgbf32_to_a(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1290 {
1291 int i;
1292 1188 const float **src = (const float **)_src;
1293 1188 uint16_t *dst = (uint16_t *)_dst;
1294
1295
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 1188 times.
413124 for (i = 0; i < width; i++) {
1296
2/2
✓ Branch 0 taken 205968 times.
✓ Branch 1 taken 205968 times.
411936 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[3] + i), 0.0f, 65535.0f));
1297 }
1298 1188 }
1299
1300 2376 static av_always_inline void planar_rgbf32_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1301 {
1302 int i;
1303 2376 const float **src = (const float **)_src;
1304 2376 uint16_t *dstU = (uint16_t *)_dstU;
1305 2376 uint16_t *dstV = (uint16_t *)_dstV;
1306 2376 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1307 2376 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1308
1309
2/2
✓ Branch 0 taken 823872 times.
✓ Branch 1 taken 2376 times.
826248 for (i = 0; i < width; i++) {
1310
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1311
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1312
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1313
1314 823872 dstU[i] = (int)((unsigned)ru*r + (unsigned)gu*g + (unsigned)bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1315 823872 dstV[i] = (int)((unsigned)rv*r + (unsigned)gv*g + (unsigned)bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1316 }
1317 2376 }
1318
1319 2376 static av_always_inline void planar_rgbf32_to_y(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1320 {
1321 int i;
1322 2376 const float **src = (const float **)_src;
1323 2376 uint16_t *dst = (uint16_t *)_dst;
1324
1325 2376 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1326
1327
2/2
✓ Branch 0 taken 823872 times.
✓ Branch 1 taken 2376 times.
826248 for (i = 0; i < width; i++) {
1328
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1329
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1330
2/2
✓ Branch 0 taken 411936 times.
✓ Branch 1 taken 411936 times.
823872 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1331
1332 823872 dst[i] = (int)((unsigned)ry*r + (unsigned)gy*g + (unsigned)by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1333 }
1334 2376 }
1335
1336 static av_always_inline void rgbf32_to_uv_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused1,
1337 const uint8_t *_src, const uint8_t *unused2,
1338 int width, int is_be, int32_t *rgb2yuv)
1339 {
1340 int i;
1341 const float *src = (const float *)_src;
1342 uint16_t *dstU = (uint16_t *)_dstU;
1343 uint16_t *dstV = (uint16_t *)_dstV;
1344 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1345 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1346
1347 for (i = 0; i < width; i++) {
1348 int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1349 int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1350 int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1351
1352 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1353 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1354 }
1355 }
1356
1357 static av_always_inline void rgbf32_to_y_c(uint8_t *_dst, const uint8_t *_src,
1358 const uint8_t *unused1, const uint8_t *unused2,
1359 int width, int is_be, int32_t *rgb2yuv)
1360 {
1361 int i;
1362 const float *src = (const float *)_src;
1363 uint16_t *dst = (uint16_t *)_dst;
1364
1365 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1366
1367 for (i = 0; i < width; i++) {
1368 int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1369 int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1370 int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1371
1372 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1373 }
1374 }
1375
1376 28032 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1377 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1378 {
1379 int i;
1380 28032 const float *src = (const float *)_src;
1381 28032 uint16_t *dst = (uint16_t *)_dst;
1382
1383
2/2
✓ Branch 0 taken 2985984 times.
✓ Branch 1 taken 28032 times.
3014016 for (i = 0; i < width; ++i){
1384
2/2
✓ Branch 0 taken 1492992 times.
✓ Branch 1 taken 1492992 times.
2985984 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i), 0.0f, 65535.0f));
1385 }
1386 28032 }
1387
1388 static av_always_inline void read_yaf32_gray_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1389 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1390 {
1391 int i;
1392 const float *src = (const float *)_src;
1393 uint16_t *dst = (uint16_t *)_dst;
1394
1395 for (i = 0; i < width; ++i)
1396 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i*2), 0.0f, 65535.0f));
1397 }
1398
1399 static av_always_inline void read_yaf32_alpha_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1400 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1401 {
1402 int i;
1403 const float *src = (const float *)_src;
1404 uint16_t *dst = (uint16_t *)_dst;
1405
1406 for (i = 0; i < width; ++i)
1407 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i*2 + 1), 0.0f, 65535.0f));
1408 }
1409
1410 #undef rdpx
1411
1412 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1413 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1414 int w, int32_t *rgb2yuv, void *opq) \
1415 { \
1416 planar_rgb16_s16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1417 } \
1418 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1419 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1420 void *opq) \
1421 { \
1422 planar_rgb16_s16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1423 } \
1424
1425 #define rgb9plus_planar_transparency_funcs(nbits) \
1426 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1427 int w, int32_t *rgb2yuv, \
1428 void *opq) \
1429 { \
1430 planar_rgb16_s16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1431 } \
1432 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1433 int w, int32_t *rgb2yuv, \
1434 void *opq) \
1435 { \
1436 planar_rgb16_s16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1437 }
1438
1439 #define rgb9plus_msb_planar_funcs_endian(nbits, endian_name, endian) \
1440 static void msb_planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1441 int w, int32_t *rgb2yuv, void *opq) \
1442 { \
1443 planar_rgb16_s##nbits##_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1444 } \
1445 static void msb_planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1446 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1447 void *opq) \
1448 { \
1449 planar_rgb16_s##nbits##_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1450 }
1451
1452 #define rgb9plus_planar_funcs(nbits) \
1453 rgb9plus_planar_funcs_endian(nbits, le, 0) \
1454 rgb9plus_planar_funcs_endian(nbits, be, 1)
1455
1456 #define rgb9plus_msb_planar_funcs(nbits) \
1457 rgb9plus_msb_planar_funcs_endian(nbits, le, 0) \
1458 rgb9plus_msb_planar_funcs_endian(nbits, be, 1)
1459
1460 4752 rgb9plus_planar_funcs(9)
1461 3765248 rgb9plus_planar_funcs(10)
1462 3585648 rgb9plus_planar_funcs(12)
1463 115344 rgb9plus_planar_funcs(14)
1464 1509036 rgb9plus_planar_funcs(16)
1465
1466 2376 rgb9plus_planar_transparency_funcs(10)
1467 2376 rgb9plus_planar_transparency_funcs(12)
1468 52224 rgb9plus_planar_transparency_funcs(14)
1469 2376 rgb9plus_planar_transparency_funcs(16)
1470
1471 112512 rgb9plus_msb_planar_funcs(10)
1472 112512 rgb9plus_msb_planar_funcs(12)
1473
1474 #define rgbf32_funcs_endian(endian_name, endian) \
1475 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1476 int w, int32_t *rgb2yuv, void *opq) \
1477 { \
1478 planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1479 } \
1480 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1481 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1482 void *opq) \
1483 { \
1484 planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1485 } \
1486 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1487 int w, int32_t *rgb2yuv, void *opq) \
1488 { \
1489 planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1490 } \
1491 static void rgbf32##endian_name##_to_y_c(uint8_t *dst, const uint8_t *src, \
1492 const uint8_t *unused1, const uint8_t *unused2, \
1493 int w, uint32_t *rgb2yuv, void *opq) \
1494 { \
1495 rgbf32_to_y_c(dst, src, unused1, unused2, w, endian, rgb2yuv); \
1496 } \
1497 static void rgbf32##endian_name##_to_uv_c(uint8_t *dstU, uint8_t *dstV, \
1498 const uint8_t *unused1, \
1499 const uint8_t *src, const uint8_t *unused2, \
1500 int w, uint32_t *rgb2yuv, \
1501 void *opq) \
1502 { \
1503 rgbf32_to_uv_c(dstU, dstV, unused1, src, unused2, w, endian, rgb2yuv); \
1504 } \
1505 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1506 const uint8_t *unused1, const uint8_t *unused2, \
1507 int width, uint32_t *unused, void *opq) \
1508 { \
1509 grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1510 } \
1511 static void read_yaf32##endian_name##_gray_c(uint8_t *dst, const uint8_t *src, \
1512 const uint8_t *unused1, const uint8_t *unused2, \
1513 int width, uint32_t *unused, void *opq) \
1514 { \
1515 read_yaf32_gray_c(dst, src, unused1, unused2, width, endian, unused); \
1516 } \
1517 static void read_yaf32##endian_name##_alpha_c(uint8_t *dst, const uint8_t *src, \
1518 const uint8_t *unused1, const uint8_t *unused2, \
1519 int width, uint32_t *unused, void *opq) \
1520 { \
1521 read_yaf32_alpha_c(dst, src, unused1, unused2, width, endian, unused); \
1522 }
1523
1524 33972 rgbf32_funcs_endian(le, 0)
1525 33972 rgbf32_funcs_endian(be, 1)
1526
1527 #define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : AV_RL16(&src), h2f_tbl))
1528 #define rdpx2(src) av_int2float(half2float(is_be ? AV_RB16(src) : AV_RL16(src), h2f_tbl))
1529
1530 3121 static av_always_inline void planar_rgbf16_to_a(uint8_t *dst, const uint8_t *src[4], int width, int is_be, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1531 {
1532 int i;
1533
1534
2/2
✓ Branch 0 taken 1859160 times.
✓ Branch 1 taken 3121 times.
1862281 for (i = 0; i < width; i++) {
1535
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1859160 times.
1859160 AV_WN16(dst + 2*i, lrintf(av_clipf(65535.0f * rdpx2(src[3] + 2*i), 0.0f, 65535.0f)));
1536 }
1537 3121 }
1538
1539 6612 static av_always_inline void planar_rgbf16_to_uv(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4], int width, int is_be, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1540 {
1541 int i;
1542 6612 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1543 6612 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1544
1545
2/2
✓ Branch 0 taken 3537889 times.
✓ Branch 1 taken 6612 times.
3544501 for (i = 0; i < width; i++) {
1546
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int g = lrintf(av_clipf(65535.0f * rdpx2(src[0] + 2*i), 0.0f, 65535.0f));
1547
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int b = lrintf(av_clipf(65535.0f * rdpx2(src[1] + 2*i), 0.0f, 65535.0f));
1548
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int r = lrintf(av_clipf(65535.0f * rdpx2(src[2] + 2*i), 0.0f, 65535.0f));
1549
1550 3537889 AV_WN16(dstU + 2*i, (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1551 3537889 AV_WN16(dstV + 2*i, (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1552 }
1553 6612 }
1554
1555 6612 static av_always_inline void planar_rgbf16_to_y(uint8_t *dst, const uint8_t *src[4], int width, int is_be, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1556 {
1557 int i;
1558
1559 6612 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1560
1561
2/2
✓ Branch 0 taken 3537889 times.
✓ Branch 1 taken 6612 times.
3544501 for (i = 0; i < width; i++) {
1562
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int g = lrintf(av_clipf(65535.0f * rdpx2(src[0] + 2*i), 0.0f, 65535.0f));
1563
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int b = lrintf(av_clipf(65535.0f * rdpx2(src[1] + 2*i), 0.0f, 65535.0f));
1564
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3537889 times.
3537889 int r = lrintf(av_clipf(65535.0f * rdpx2(src[2] + 2*i), 0.0f, 65535.0f));
1565
1566 3537889 AV_WN16(dst + 2*i, (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
1567 }
1568 6612 }
1569
1570 24 static av_always_inline void grayf16ToY16_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
1571 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1572 {
1573 int i;
1574
1575
2/2
✓ Branch 0 taken 288 times.
✓ Branch 1 taken 24 times.
312 for (i = 0; i < width; ++i){
1576
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 288 times.
288 AV_WN16(dst + 2*i, lrintf(av_clipf(65535.0f * rdpx2(src + 2*i), 0.0f, 65535.0f)));
1577 }
1578 24 }
1579
1580 12 static av_always_inline void read_yaf16_gray_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
1581 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1582 {
1583 12 uint16_t *dst = (uint16_t *)_dst;
1584
1585
2/2
✓ Branch 0 taken 144 times.
✓ Branch 1 taken 12 times.
156 for (int i = 0; i < width; i++)
1586
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
144 dst[i] = lrintf(av_clipf(65535.0f * rdpx2(src + 4*i), 0.0f, 65535.0f));
1587 12 }
1588
1589 12 static av_always_inline void read_yaf16_alpha_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
1590 const uint8_t *unused2, int width, int is_be, uint32_t *unused, Half2FloatTables *h2f_tbl)
1591 {
1592 12 uint16_t *dst = (uint16_t *)_dst;
1593
1594
2/2
✓ Branch 0 taken 144 times.
✓ Branch 1 taken 12 times.
156 for (int i = 0; i < width; i++)
1595
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
144 dst[i] = lrintf(av_clipf(65535.0f * rdpx2(src + 4*i + 2), 0.0f, 65535.0f));
1596 12 }
1597
1598 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1599 const uint16_t *src, int width,
1600 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1601 {
1602 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1603 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1604 int i;
1605 for (i = 0; i < width; i++) {
1606 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) +
1607 lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1;
1608 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) +
1609 lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1;
1610 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) +
1611 lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1;
1612
1613 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1614 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1615 }
1616 }
1617
1618 static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1619 const uint16_t *src, int width,
1620 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1621 {
1622 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1623 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1624 int i;
1625 for (i = 0; i < width; i++) {
1626 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1627 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1628 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1629
1630 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1631 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1632 }
1633 }
1634
1635 static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1636 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1637 {
1638 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1639 int i;
1640 for (i = 0; i < width; i++) {
1641 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1642 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1643 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1644
1645 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1646 }
1647 }
1648
1649 static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be,
1650 int width, Half2FloatTables *h2f_tbl)
1651 {
1652 int i;
1653 for (i=0; i<width; i++) {
1654 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[i*4+3]), 0.0f, 65535.0f));
1655 }
1656 }
1657
1658 static av_always_inline void rgbf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1659 const uint16_t *src, int width,
1660 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1661 {
1662 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1663 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1664 int i;
1665 for (i = 0; i < width; i++) {
1666 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+0]), 0.0f, 65535.0f)) +
1667 lrintf(av_clipf(65535.0f * rdpx(src[i*6+3]), 0.0f, 65535.0f))) >> 1;
1668 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+1]), 0.0f, 65535.0f)) +
1669 lrintf(av_clipf(65535.0f * rdpx(src[i*6+4]), 0.0f, 65535.0f))) >> 1;
1670 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+2]), 0.0f, 65535.0f)) +
1671 lrintf(av_clipf(65535.0f * rdpx(src[i*6+5]), 0.0f, 65535.0f))) >> 1;
1672
1673 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1674 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1675 }
1676 }
1677
1678 static av_always_inline void rgbf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1679 const uint16_t *src, int width,
1680 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1681 {
1682 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1683 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1684 int i;
1685 for (i = 0; i < width; i++) {
1686 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1687 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1688 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1689
1690 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1691 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1692 }
1693 }
1694
1695 static av_always_inline void rgbf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1696 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1697 {
1698 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1699 int i;
1700 for (i = 0; i < width; i++) {
1701 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1702 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1703 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1704
1705 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1706 }
1707 }
1708
1709 #undef rdpx
1710
1711 #define rgbaf16_funcs_endian(endian_name, endian) \
1712 static void planar_rgbf16##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1713 int w, int32_t *rgb2yuv, void *opq) \
1714 { \
1715 planar_rgbf16_to_y(dst, src, w, endian, rgb2yuv, opq); \
1716 } \
1717 static void planar_rgbf16##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1718 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1719 void *opq) \
1720 { \
1721 planar_rgbf16_to_uv(dstU, dstV, src, w, endian, rgb2yuv, opq); \
1722 } \
1723 static void planar_rgbf16##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1724 int w, int32_t *rgb2yuv, void *opq) \
1725 { \
1726 planar_rgbf16_to_a(dst, src, w, endian, rgb2yuv, opq); \
1727 } \
1728 static void grayf16##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1729 const uint8_t *unused1, const uint8_t *unused2, \
1730 int width, uint32_t *unused, void *opq) \
1731 { \
1732 grayf16ToY16_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1733 } \
1734 static void read_yaf16##endian_name##_gray_c(uint8_t *dst, const uint8_t *src, \
1735 const uint8_t *unused1, const uint8_t *unused2, \
1736 int width, uint32_t *unused, void *opq) \
1737 { \
1738 read_yaf16_gray_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1739 } \
1740 static void read_yaf16##endian_name##_alpha_c(uint8_t *dst, const uint8_t *src, \
1741 const uint8_t *unused1, const uint8_t *unused2, \
1742 int width, uint32_t *unused, void *opq) \
1743 { \
1744 read_yaf16_alpha_c(dst, src, unused1, unused2, width, endian, unused, opq); \
1745 } \
1746 \
1747 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1748 const uint8_t *src1, const uint8_t *src2, \
1749 int width, uint32_t *_rgb2yuv, void *opq) \
1750 { \
1751 const uint16_t *src = (const uint16_t*)src1; \
1752 uint16_t *dstU = (uint16_t*)_dstU; \
1753 uint16_t *dstV = (uint16_t*)_dstV; \
1754 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1755 av_assert1(src1==src2); \
1756 rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1757 } \
1758 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1759 const uint8_t *src1, const uint8_t *src2, \
1760 int width, uint32_t *_rgb2yuv, void *opq) \
1761 { \
1762 const uint16_t *src = (const uint16_t*)src1; \
1763 uint16_t *dstU = (uint16_t*)_dstU; \
1764 uint16_t *dstV = (uint16_t*)_dstV; \
1765 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1766 av_assert1(src1==src2); \
1767 rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1768 } \
1769 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1770 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1771 { \
1772 const uint16_t *src = (const uint16_t*)_src; \
1773 uint16_t *dst = (uint16_t*)_dst; \
1774 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1775 rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1776 } \
1777 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1778 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1779 { \
1780 const uint16_t *src = (const uint16_t*)_src; \
1781 uint16_t *dst = (uint16_t*)_dst; \
1782 rgbaf16ToA_endian(dst, src, endian, width, opq); \
1783 } \
1784 static void rgbf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1785 const uint8_t *src1, const uint8_t *src2, \
1786 int width, uint32_t *_rgb2yuv, void *opq) \
1787 { \
1788 const uint16_t *src = (const uint16_t*)src1; \
1789 uint16_t *dstU = (uint16_t*)_dstU; \
1790 uint16_t *dstV = (uint16_t*)_dstV; \
1791 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1792 av_assert1(src1==src2); \
1793 rgbf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1794 } \
1795 static void rgbf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1796 const uint8_t *src1, const uint8_t *src2, \
1797 int width, uint32_t *_rgb2yuv, void *opq) \
1798 { \
1799 const uint16_t *src = (const uint16_t*)src1; \
1800 uint16_t *dstU = (uint16_t*)_dstU; \
1801 uint16_t *dstV = (uint16_t*)_dstV; \
1802 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1803 av_assert1(src1==src2); \
1804 rgbf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1805 } \
1806 static void rgbf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1807 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1808 { \
1809 const uint16_t *src = (const uint16_t*)_src; \
1810 uint16_t *dst = (uint16_t*)_dst; \
1811 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1812 rgbf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1813 } \
1814
1815 32786 rgbaf16_funcs_endian(le, 0)
1816 rgbaf16_funcs_endian(be, 1)
1817
1818 57173 av_cold void ff_sws_init_input_funcs(SwsInternal *c,
1819 planar1_YV12_fn *lumToYV12,
1820 planar1_YV12_fn *alpToYV12,
1821 planar2_YV12_fn *chrToYV12,
1822 planarX_YV12_fn *readLumPlanar,
1823 planarX_YV12_fn *readAlpPlanar,
1824 planarX2_YV12_fn *readChrPlanar)
1825 {
1826 57173 enum AVPixelFormat srcFormat = c->opts.src_format;
1827
1828 57173 *chrToYV12 = NULL;
1829
53/57
✓ Branch 0 taken 112 times.
✓ Branch 1 taken 112 times.
✓ Branch 2 taken 112 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 256 times.
✓ Branch 5 taken 1407 times.
✓ Branch 6 taken 260 times.
✓ Branch 7 taken 590 times.
✓ Branch 8 taken 308 times.
✓ Branch 9 taken 1684 times.
✓ Branch 10 taken 1680 times.
✓ Branch 11 taken 447 times.
✓ Branch 12 taken 994 times.
✓ Branch 13 taken 736 times.
✓ Branch 14 taken 384 times.
✓ Branch 15 taken 142 times.
✓ Branch 16 taken 142 times.
✓ Branch 17 taken 307 times.
✓ Branch 18 taken 788 times.
✓ Branch 19 taken 788 times.
✓ Branch 20 taken 446 times.
✓ Branch 21 taken 838 times.
✓ Branch 22 taken 702 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 141 times.
✓ Branch 25 taken 141 times.
✓ Branch 26 taken 1665 times.
✓ Branch 27 taken 1318 times.
✓ Branch 28 taken 92 times.
✓ Branch 29 taken 92 times.
✓ Branch 30 taken 91 times.
✓ Branch 31 taken 91 times.
✓ Branch 32 taken 393 times.
✓ Branch 33 taken 251 times.
✓ Branch 34 taken 265 times.
✓ Branch 35 taken 141 times.
✓ Branch 36 taken 141 times.
✓ Branch 37 taken 141 times.
✓ Branch 38 taken 145 times.
✓ Branch 39 taken 251 times.
✓ Branch 40 taken 251 times.
✓ Branch 41 taken 281 times.
✓ Branch 42 taken 281 times.
✓ Branch 43 taken 1 times.
✓ Branch 44 taken 1436 times.
✓ Branch 45 taken 1 times.
✓ Branch 46 taken 556 times.
✓ Branch 47 taken 1436 times.
✓ Branch 48 taken 556 times.
✓ Branch 49 taken 816 times.
✓ Branch 50 taken 636 times.
✓ Branch 51 taken 111 times.
✓ Branch 52 taken 111 times.
✓ Branch 53 taken 141 times.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✓ Branch 56 taken 31965 times.
57173 switch (srcFormat) {
1830 112 case AV_PIX_FMT_YUYV422:
1831 112 *chrToYV12 = yuy2ToUV_c;
1832 112 break;
1833 112 case AV_PIX_FMT_YVYU422:
1834 112 *chrToYV12 = yvy2ToUV_c;
1835 112 break;
1836 112 case AV_PIX_FMT_UYVY422:
1837 112 *chrToYV12 = uyvyToUV_c;
1838 112 break;
1839 case AV_PIX_FMT_UYYVYY411:
1840 *chrToYV12 = uyyvyyToUV_c;
1841 break;
1842 256 case AV_PIX_FMT_VYU444:
1843 256 *chrToYV12 = vyuToUV_c;
1844 256 break;
1845 1407 case AV_PIX_FMT_NV12:
1846 case AV_PIX_FMT_NV16:
1847 case AV_PIX_FMT_NV24:
1848 1407 *chrToYV12 = nv12ToUV_c;
1849 1407 break;
1850 260 case AV_PIX_FMT_NV21:
1851 case AV_PIX_FMT_NV42:
1852 260 *chrToYV12 = nv21ToUV_c;
1853 260 break;
1854 590 case AV_PIX_FMT_RGB8:
1855 case AV_PIX_FMT_BGR8:
1856 case AV_PIX_FMT_PAL8:
1857 case AV_PIX_FMT_BGR4_BYTE:
1858 case AV_PIX_FMT_RGB4_BYTE:
1859 590 *chrToYV12 = palToUV_c;
1860 590 break;
1861 308 case AV_PIX_FMT_GBRP9LE:
1862 308 *readChrPlanar = planar_rgb9le_to_uv;
1863 308 break;
1864 1684 case AV_PIX_FMT_GBRAP10LE:
1865 case AV_PIX_FMT_GBRP10LE:
1866 1684 *readChrPlanar = planar_rgb10le_to_uv;
1867 1684 break;
1868 1680 case AV_PIX_FMT_GBRAP12LE:
1869 case AV_PIX_FMT_GBRP12LE:
1870 1680 *readChrPlanar = planar_rgb12le_to_uv;
1871 1680 break;
1872 447 case AV_PIX_FMT_GBRAP14LE:
1873 case AV_PIX_FMT_GBRP14LE:
1874 447 *readChrPlanar = planar_rgb14le_to_uv;
1875 447 break;
1876 994 case AV_PIX_FMT_GBRAP16LE:
1877 case AV_PIX_FMT_GBRP16LE:
1878 994 *readChrPlanar = planar_rgb16le_to_uv;
1879 994 break;
1880 736 case AV_PIX_FMT_GBRAPF32LE:
1881 case AV_PIX_FMT_GBRPF32LE:
1882 736 *readChrPlanar = planar_rgbf32le_to_uv;
1883 736 break;
1884 384 case AV_PIX_FMT_GBRAPF16LE:
1885 case AV_PIX_FMT_GBRPF16LE:
1886 384 *readChrPlanar = planar_rgbf16le_to_uv;
1887 384 break;
1888 142 case AV_PIX_FMT_GBRP10MSBLE:
1889 142 *readChrPlanar = msb_planar_rgb10le_to_uv;
1890 142 break;
1891 142 case AV_PIX_FMT_GBRP12MSBLE:
1892 142 *readChrPlanar = msb_planar_rgb12le_to_uv;
1893 142 break;
1894 307 case AV_PIX_FMT_GBRP9BE:
1895 307 *readChrPlanar = planar_rgb9be_to_uv;
1896 307 break;
1897 788 case AV_PIX_FMT_GBRAP10BE:
1898 case AV_PIX_FMT_GBRP10BE:
1899 788 *readChrPlanar = planar_rgb10be_to_uv;
1900 788 break;
1901 788 case AV_PIX_FMT_GBRAP12BE:
1902 case AV_PIX_FMT_GBRP12BE:
1903 788 *readChrPlanar = planar_rgb12be_to_uv;
1904 788 break;
1905 446 case AV_PIX_FMT_GBRAP14BE:
1906 case AV_PIX_FMT_GBRP14BE:
1907 446 *readChrPlanar = planar_rgb14be_to_uv;
1908 446 break;
1909 838 case AV_PIX_FMT_GBRAP16BE:
1910 case AV_PIX_FMT_GBRP16BE:
1911 838 *readChrPlanar = planar_rgb16be_to_uv;
1912 838 break;
1913 702 case AV_PIX_FMT_GBRAPF32BE:
1914 case AV_PIX_FMT_GBRPF32BE:
1915 702 *readChrPlanar = planar_rgbf32be_to_uv;
1916 702 break;
1917 case AV_PIX_FMT_GBRAPF16BE:
1918 case AV_PIX_FMT_GBRPF16BE:
1919 *readChrPlanar = planar_rgbf16be_to_uv;
1920 break;
1921 141 case AV_PIX_FMT_GBRP10MSBBE:
1922 141 *readChrPlanar = msb_planar_rgb10be_to_uv;
1923 141 break;
1924 141 case AV_PIX_FMT_GBRP12MSBBE:
1925 141 *readChrPlanar = msb_planar_rgb12be_to_uv;
1926 141 break;
1927 1665 case AV_PIX_FMT_GBRAP:
1928 case AV_PIX_FMT_GBRP:
1929 1665 *readChrPlanar = planar_rgb_to_uv;
1930 1665 break;
1931 #if HAVE_BIGENDIAN
1932 case AV_PIX_FMT_YUV420P9LE:
1933 case AV_PIX_FMT_YUV422P9LE:
1934 case AV_PIX_FMT_YUV444P9LE:
1935 case AV_PIX_FMT_YUV420P10LE:
1936 case AV_PIX_FMT_YUV422P10LE:
1937 case AV_PIX_FMT_YUV440P10LE:
1938 case AV_PIX_FMT_YUV444P10LE:
1939 case AV_PIX_FMT_YUV420P12LE:
1940 case AV_PIX_FMT_YUV422P12LE:
1941 case AV_PIX_FMT_YUV440P12LE:
1942 case AV_PIX_FMT_YUV444P12LE:
1943 case AV_PIX_FMT_YUV420P14LE:
1944 case AV_PIX_FMT_YUV422P14LE:
1945 case AV_PIX_FMT_YUV444P14LE:
1946 case AV_PIX_FMT_YUV420P16LE:
1947 case AV_PIX_FMT_YUV422P16LE:
1948 case AV_PIX_FMT_YUV444P16LE:
1949
1950 case AV_PIX_FMT_YUVA420P9LE:
1951 case AV_PIX_FMT_YUVA422P9LE:
1952 case AV_PIX_FMT_YUVA444P9LE:
1953 case AV_PIX_FMT_YUVA420P10LE:
1954 case AV_PIX_FMT_YUVA422P10LE:
1955 case AV_PIX_FMT_YUVA444P10LE:
1956 case AV_PIX_FMT_YUVA422P12LE:
1957 case AV_PIX_FMT_YUVA444P12LE:
1958 case AV_PIX_FMT_YUVA420P16LE:
1959 case AV_PIX_FMT_YUVA422P16LE:
1960 case AV_PIX_FMT_YUVA444P16LE:
1961 *chrToYV12 = bswap16UV_c;
1962 break;
1963 #else
1964 1318 case AV_PIX_FMT_YUV420P9BE:
1965 case AV_PIX_FMT_YUV422P9BE:
1966 case AV_PIX_FMT_YUV444P9BE:
1967 case AV_PIX_FMT_YUV420P10BE:
1968 case AV_PIX_FMT_YUV422P10BE:
1969 case AV_PIX_FMT_YUV440P10BE:
1970 case AV_PIX_FMT_YUV444P10BE:
1971 case AV_PIX_FMT_YUV420P12BE:
1972 case AV_PIX_FMT_YUV422P12BE:
1973 case AV_PIX_FMT_YUV440P12BE:
1974 case AV_PIX_FMT_YUV444P12BE:
1975 case AV_PIX_FMT_YUV420P14BE:
1976 case AV_PIX_FMT_YUV422P14BE:
1977 case AV_PIX_FMT_YUV444P14BE:
1978 case AV_PIX_FMT_YUV420P16BE:
1979 case AV_PIX_FMT_YUV422P16BE:
1980 case AV_PIX_FMT_YUV444P16BE:
1981
1982 case AV_PIX_FMT_YUVA420P9BE:
1983 case AV_PIX_FMT_YUVA422P9BE:
1984 case AV_PIX_FMT_YUVA444P9BE:
1985 case AV_PIX_FMT_YUVA420P10BE:
1986 case AV_PIX_FMT_YUVA422P10BE:
1987 case AV_PIX_FMT_YUVA444P10BE:
1988 case AV_PIX_FMT_YUVA422P12BE:
1989 case AV_PIX_FMT_YUVA444P12BE:
1990 case AV_PIX_FMT_YUVA420P16BE:
1991 case AV_PIX_FMT_YUVA422P16BE:
1992 case AV_PIX_FMT_YUVA444P16BE:
1993 1318 *chrToYV12 = bswap16UV_c;
1994 1318 break;
1995 #endif
1996 92 case AV_PIX_FMT_YUV444P10MSBLE:
1997 92 *chrToYV12 = shf16_10LEToUV_c;
1998 92 break;
1999 92 case AV_PIX_FMT_YUV444P12MSBLE:
2000 92 *chrToYV12 = shf16_12LEToUV_c;
2001 92 break;
2002 91 case AV_PIX_FMT_YUV444P10MSBBE:
2003 91 *chrToYV12 = shf16_10BEToUV_c;
2004 91 break;
2005 91 case AV_PIX_FMT_YUV444P12MSBBE:
2006 91 *chrToYV12 = shf16_12BEToUV_c;
2007 91 break;
2008 393 case AV_PIX_FMT_VUYA:
2009 case AV_PIX_FMT_VUYX:
2010 393 *chrToYV12 = read_vuyx_UV_c;
2011 393 break;
2012 251 case AV_PIX_FMT_XV30LE:
2013 251 *chrToYV12 = read_xv30le_UV_c;
2014 251 break;
2015 265 case AV_PIX_FMT_V30XLE:
2016 265 *chrToYV12 = read_v30xle_UV_c;
2017 265 break;
2018 141 case AV_PIX_FMT_AYUV:
2019 141 *chrToYV12 = read_ayuv_UV_c;
2020 141 break;
2021 141 case AV_PIX_FMT_AYUV64LE:
2022 141 *chrToYV12 = read_ayuv64le_UV_c;
2023 141 break;
2024 141 case AV_PIX_FMT_AYUV64BE:
2025 141 *chrToYV12 = read_ayuv64be_UV_c;
2026 141 break;
2027 145 case AV_PIX_FMT_UYVA:
2028 145 *chrToYV12 = read_uyva_UV_c;
2029 145 break;
2030 251 case AV_PIX_FMT_XV36LE:
2031 251 *chrToYV12 = read_xv36le_UV_c;
2032 251 break;
2033 251 case AV_PIX_FMT_XV36BE:
2034 251 *chrToYV12 = read_xv36be_UV_c;
2035 251 break;
2036 281 case AV_PIX_FMT_XV48LE:
2037 281 *chrToYV12 = read_xv48le_UV_c;
2038 281 break;
2039 281 case AV_PIX_FMT_XV48BE:
2040 281 *chrToYV12 = read_xv48be_UV_c;
2041 281 break;
2042 1 case AV_PIX_FMT_NV20LE:
2043 1 *chrToYV12 = nv20LEToUV_c;
2044 1 break;
2045 1436 case AV_PIX_FMT_P010LE:
2046 case AV_PIX_FMT_P210LE:
2047 case AV_PIX_FMT_P410LE:
2048 1436 *chrToYV12 = p010LEToUV_c;
2049 1436 break;
2050 1 case AV_PIX_FMT_NV20BE:
2051 1 *chrToYV12 = nv20BEToUV_c;
2052 1 break;
2053 556 case AV_PIX_FMT_P010BE:
2054 case AV_PIX_FMT_P210BE:
2055 case AV_PIX_FMT_P410BE:
2056 556 *chrToYV12 = p010BEToUV_c;
2057 556 break;
2058 1436 case AV_PIX_FMT_P012LE:
2059 case AV_PIX_FMT_P212LE:
2060 case AV_PIX_FMT_P412LE:
2061 1436 *chrToYV12 = p012LEToUV_c;
2062 1436 break;
2063 556 case AV_PIX_FMT_P012BE:
2064 case AV_PIX_FMT_P212BE:
2065 case AV_PIX_FMT_P412BE:
2066 556 *chrToYV12 = p012BEToUV_c;
2067 556 break;
2068 816 case AV_PIX_FMT_P016LE:
2069 case AV_PIX_FMT_P216LE:
2070 case AV_PIX_FMT_P416LE:
2071 816 *chrToYV12 = p016LEToUV_c;
2072 816 break;
2073 636 case AV_PIX_FMT_P016BE:
2074 case AV_PIX_FMT_P216BE:
2075 case AV_PIX_FMT_P416BE:
2076 636 *chrToYV12 = p016BEToUV_c;
2077 636 break;
2078 111 case AV_PIX_FMT_Y210LE:
2079 111 *chrToYV12 = y210le_UV_c;
2080 111 break;
2081 111 case AV_PIX_FMT_Y212LE:
2082 111 *chrToYV12 = y212le_UV_c;
2083 111 break;
2084 141 case AV_PIX_FMT_Y216LE:
2085 141 *chrToYV12 = y216le_UV_c;
2086 141 break;
2087 case AV_PIX_FMT_RGBF32LE:
2088 *chrToYV12 = rgbf32le_to_uv_c;
2089 break;
2090 case AV_PIX_FMT_RGBF32BE:
2091 *chrToYV12 = rgbf32be_to_uv_c;
2092 break;
2093 }
2094
2/2
✓ Branch 0 taken 25137 times.
✓ Branch 1 taken 32036 times.
57173 if (c->chrSrcHSubSample) {
2095
22/34
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 438 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 60 times.
✓ Branch 9 taken 28 times.
✓ Branch 10 taken 58 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 841 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 18 taken 66 times.
✓ Branch 19 taken 38 times.
✓ Branch 20 taken 535 times.
✓ Branch 21 taken 5 times.
✓ Branch 22 taken 1 times.
✓ Branch 23 taken 16 times.
✓ Branch 24 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 26 taken 1 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✓ Branch 33 taken 23028 times.
25137 switch (srcFormat) {
2096 case AV_PIX_FMT_RGBA64BE:
2097 *chrToYV12 = rgb64BEToUV_half_c;
2098 break;
2099 case AV_PIX_FMT_RGBA64LE:
2100 *chrToYV12 = rgb64LEToUV_half_c;
2101 break;
2102 case AV_PIX_FMT_BGRA64BE:
2103 *chrToYV12 = bgr64BEToUV_half_c;
2104 break;
2105 case AV_PIX_FMT_BGRA64LE:
2106 *chrToYV12 = bgr64LEToUV_half_c;
2107 break;
2108 14 case AV_PIX_FMT_RGB48BE:
2109 14 *chrToYV12 = rgb48BEToUV_half_c;
2110 14 break;
2111 438 case AV_PIX_FMT_RGB48LE:
2112 438 *chrToYV12 = rgb48LEToUV_half_c;
2113 438 break;
2114 case AV_PIX_FMT_BGR48BE:
2115 *chrToYV12 = bgr48BEToUV_half_c;
2116 break;
2117 case AV_PIX_FMT_BGR48LE:
2118 *chrToYV12 = bgr48LEToUV_half_c;
2119 break;
2120 60 case AV_PIX_FMT_RGB32:
2121 60 *chrToYV12 = bgr32ToUV_half_c;
2122 60 break;
2123 28 case AV_PIX_FMT_RGB32_1:
2124 28 *chrToYV12 = bgr321ToUV_half_c;
2125 28 break;
2126 58 case AV_PIX_FMT_BGR24:
2127 58 *chrToYV12 = bgr24ToUV_half_c;
2128 58 break;
2129 1 case AV_PIX_FMT_BGR565LE:
2130 1 *chrToYV12 = bgr16leToUV_half_c;
2131 1 break;
2132 1 case AV_PIX_FMT_BGR565BE:
2133 1 *chrToYV12 = bgr16beToUV_half_c;
2134 1 break;
2135 1 case AV_PIX_FMT_BGR555LE:
2136 1 *chrToYV12 = bgr15leToUV_half_c;
2137 1 break;
2138 1 case AV_PIX_FMT_BGR555BE:
2139 1 *chrToYV12 = bgr15beToUV_half_c;
2140 1 break;
2141 841 case AV_PIX_FMT_GBRAP:
2142 case AV_PIX_FMT_GBRP:
2143 841 *chrToYV12 = gbr24pToUV_half_c;
2144 841 break;
2145 1 case AV_PIX_FMT_BGR444LE:
2146 1 *chrToYV12 = bgr12leToUV_half_c;
2147 1 break;
2148 1 case AV_PIX_FMT_BGR444BE:
2149 1 *chrToYV12 = bgr12beToUV_half_c;
2150 1 break;
2151 66 case AV_PIX_FMT_BGR32:
2152 66 *chrToYV12 = rgb32ToUV_half_c;
2153 66 break;
2154 38 case AV_PIX_FMT_BGR32_1:
2155 38 *chrToYV12 = rgb321ToUV_half_c;
2156 38 break;
2157 535 case AV_PIX_FMT_RGB24:
2158 535 *chrToYV12 = rgb24ToUV_half_c;
2159 535 break;
2160 5 case AV_PIX_FMT_RGB565LE:
2161 5 *chrToYV12 = rgb16leToUV_half_c;
2162 5 break;
2163 1 case AV_PIX_FMT_RGB565BE:
2164 1 *chrToYV12 = rgb16beToUV_half_c;
2165 1 break;
2166 16 case AV_PIX_FMT_RGB555LE:
2167 16 *chrToYV12 = rgb15leToUV_half_c;
2168 16 break;
2169 1 case AV_PIX_FMT_RGB555BE:
2170 1 *chrToYV12 = rgb15beToUV_half_c;
2171 1 break;
2172 1 case AV_PIX_FMT_RGB444LE:
2173 1 *chrToYV12 = rgb12leToUV_half_c;
2174 1 break;
2175 1 case AV_PIX_FMT_RGB444BE:
2176 1 *chrToYV12 = rgb12beToUV_half_c;
2177 1 break;
2178 case AV_PIX_FMT_X2RGB10LE:
2179 *chrToYV12 = rgb30leToUV_half_c;
2180 break;
2181 case AV_PIX_FMT_X2BGR10LE:
2182 *chrToYV12 = bgr30leToUV_half_c;
2183 break;
2184 case AV_PIX_FMT_RGBAF16BE:
2185 *chrToYV12 = rgbaf16beToUV_half_c;
2186 break;
2187 case AV_PIX_FMT_RGBAF16LE:
2188 *chrToYV12 = rgbaf16leToUV_half_c;
2189 break;
2190 case AV_PIX_FMT_RGBF16BE:
2191 *chrToYV12 = rgbf16beToUV_half_c;
2192 break;
2193 case AV_PIX_FMT_RGBF16LE:
2194 *chrToYV12 = rgbf16leToUV_half_c;
2195 break;
2196 }
2197 } else {
2198
29/33
✓ Branch 0 taken 149 times.
✓ Branch 1 taken 140 times.
✓ Branch 2 taken 139 times.
✓ Branch 3 taken 140 times.
✓ Branch 4 taken 368 times.
✓ Branch 5 taken 990 times.
✓ Branch 6 taken 139 times.
✓ Branch 7 taken 140 times.
✓ Branch 8 taken 510 times.
✓ Branch 9 taken 312 times.
✓ Branch 10 taken 247 times.
✓ Branch 11 taken 140 times.
✓ Branch 12 taken 140 times.
✓ Branch 13 taken 140 times.
✓ Branch 14 taken 140 times.
✓ Branch 15 taken 140 times.
✓ Branch 16 taken 140 times.
✓ Branch 17 taken 333 times.
✓ Branch 18 taken 312 times.
✓ Branch 19 taken 788 times.
✓ Branch 20 taken 241 times.
✓ Branch 21 taken 140 times.
✓ Branch 22 taken 241 times.
✓ Branch 23 taken 140 times.
✓ Branch 24 taken 140 times.
✓ Branch 25 taken 140 times.
✓ Branch 26 taken 219 times.
✓ Branch 27 taken 219 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 25009 times.
32036 switch (srcFormat) {
2199 149 case AV_PIX_FMT_RGBA64BE:
2200 149 *chrToYV12 = rgb64BEToUV_c;
2201 149 break;
2202 140 case AV_PIX_FMT_RGBA64LE:
2203 140 *chrToYV12 = rgb64LEToUV_c;
2204 140 break;
2205 139 case AV_PIX_FMT_BGRA64BE:
2206 139 *chrToYV12 = bgr64BEToUV_c;
2207 139 break;
2208 140 case AV_PIX_FMT_BGRA64LE:
2209 140 *chrToYV12 = bgr64LEToUV_c;
2210 140 break;
2211 368 case AV_PIX_FMT_RGB48BE:
2212 368 *chrToYV12 = rgb48BEToUV_c;
2213 368 break;
2214 990 case AV_PIX_FMT_RGB48LE:
2215 990 *chrToYV12 = rgb48LEToUV_c;
2216 990 break;
2217 139 case AV_PIX_FMT_BGR48BE:
2218 139 *chrToYV12 = bgr48BEToUV_c;
2219 139 break;
2220 140 case AV_PIX_FMT_BGR48LE:
2221 140 *chrToYV12 = bgr48LEToUV_c;
2222 140 break;
2223 510 case AV_PIX_FMT_RGB32:
2224 510 *chrToYV12 = bgr32ToUV_c;
2225 510 break;
2226 312 case AV_PIX_FMT_RGB32_1:
2227 312 *chrToYV12 = bgr321ToUV_c;
2228 312 break;
2229 247 case AV_PIX_FMT_BGR24:
2230 247 *chrToYV12 = bgr24ToUV_c;
2231 247 break;
2232 140 case AV_PIX_FMT_BGR565LE:
2233 140 *chrToYV12 = bgr16leToUV_c;
2234 140 break;
2235 140 case AV_PIX_FMT_BGR565BE:
2236 140 *chrToYV12 = bgr16beToUV_c;
2237 140 break;
2238 140 case AV_PIX_FMT_BGR555LE:
2239 140 *chrToYV12 = bgr15leToUV_c;
2240 140 break;
2241 140 case AV_PIX_FMT_BGR555BE:
2242 140 *chrToYV12 = bgr15beToUV_c;
2243 140 break;
2244 140 case AV_PIX_FMT_BGR444LE:
2245 140 *chrToYV12 = bgr12leToUV_c;
2246 140 break;
2247 140 case AV_PIX_FMT_BGR444BE:
2248 140 *chrToYV12 = bgr12beToUV_c;
2249 140 break;
2250 333 case AV_PIX_FMT_BGR32:
2251 333 *chrToYV12 = rgb32ToUV_c;
2252 333 break;
2253 312 case AV_PIX_FMT_BGR32_1:
2254 312 *chrToYV12 = rgb321ToUV_c;
2255 312 break;
2256 788 case AV_PIX_FMT_RGB24:
2257 788 *chrToYV12 = rgb24ToUV_c;
2258 788 break;
2259 241 case AV_PIX_FMT_RGB565LE:
2260 241 *chrToYV12 = rgb16leToUV_c;
2261 241 break;
2262 140 case AV_PIX_FMT_RGB565BE:
2263 140 *chrToYV12 = rgb16beToUV_c;
2264 140 break;
2265 241 case AV_PIX_FMT_RGB555LE:
2266 241 *chrToYV12 = rgb15leToUV_c;
2267 241 break;
2268 140 case AV_PIX_FMT_RGB555BE:
2269 140 *chrToYV12 = rgb15beToUV_c;
2270 140 break;
2271 140 case AV_PIX_FMT_RGB444LE:
2272 140 *chrToYV12 = rgb12leToUV_c;
2273 140 break;
2274 140 case AV_PIX_FMT_RGB444BE:
2275 140 *chrToYV12 = rgb12beToUV_c;
2276 140 break;
2277 219 case AV_PIX_FMT_X2RGB10LE:
2278 219 *chrToYV12 = rgb30leToUV_c;
2279 219 break;
2280 219 case AV_PIX_FMT_X2BGR10LE:
2281 219 *chrToYV12 = bgr30leToUV_c;
2282 219 break;
2283 case AV_PIX_FMT_RGBAF16BE:
2284 *chrToYV12 = rgbaf16beToUV_c;
2285 break;
2286 case AV_PIX_FMT_RGBAF16LE:
2287 *chrToYV12 = rgbaf16leToUV_c;
2288 break;
2289 case AV_PIX_FMT_RGBF16BE:
2290 *chrToYV12 = rgbf16beToUV_c;
2291 break;
2292 case AV_PIX_FMT_RGBF16LE:
2293 *chrToYV12 = rgbf16leToUV_c;
2294 break;
2295 }
2296 }
2297
2298 57173 *lumToYV12 = NULL;
2299 57173 *alpToYV12 = NULL;
2300
94/107
✓ Branch 0 taken 308 times.
✓ Branch 1 taken 392 times.
✓ Branch 2 taken 1292 times.
✓ Branch 3 taken 392 times.
✓ Branch 4 taken 1288 times.
✓ Branch 5 taken 139 times.
✓ Branch 6 taken 308 times.
✓ Branch 7 taken 392 times.
✓ Branch 8 taken 602 times.
✓ Branch 9 taken 393 times.
✓ Branch 10 taken 343 times.
✓ Branch 11 taken 115 times.
✓ Branch 12 taken 269 times.
✓ Branch 13 taken 142 times.
✓ Branch 14 taken 142 times.
✓ Branch 15 taken 307 times.
✓ Branch 16 taken 391 times.
✓ Branch 17 taken 397 times.
✓ Branch 18 taken 391 times.
✓ Branch 19 taken 397 times.
✓ Branch 20 taken 139 times.
✓ Branch 21 taken 307 times.
✓ Branch 22 taken 391 times.
✓ Branch 23 taken 447 times.
✓ Branch 24 taken 393 times.
✓ Branch 25 taken 309 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 141 times.
✓ Branch 29 taken 141 times.
✓ Branch 30 taken 434 times.
✓ Branch 31 taken 1231 times.
✓ Branch 32 taken 2998 times.
✓ Branch 33 taken 51 times.
✓ Branch 34 taken 92 times.
✓ Branch 35 taken 92 times.
✓ Branch 36 taken 91 times.
✓ Branch 37 taken 91 times.
✓ Branch 38 taken 141 times.
✓ Branch 39 taken 151 times.
✓ Branch 40 taken 9 times.
✗ Branch 41 not taken.
✓ Branch 42 taken 393 times.
✓ Branch 43 taken 251 times.
✓ Branch 44 taken 265 times.
✓ Branch 45 taken 286 times.
✓ Branch 46 taken 422 times.
✓ Branch 47 taken 422 times.
✓ Branch 48 taken 251 times.
✓ Branch 49 taken 251 times.
✓ Branch 50 taken 385 times.
✓ Branch 51 taken 112 times.
✗ Branch 52 not taken.
✓ Branch 53 taken 256 times.
✓ Branch 54 taken 305 times.
✓ Branch 55 taken 141 times.
✓ Branch 56 taken 141 times.
✓ Branch 57 taken 141 times.
✓ Branch 58 taken 141 times.
✓ Branch 59 taken 141 times.
✓ Branch 60 taken 141 times.
✓ Branch 61 taken 1323 times.
✓ Branch 62 taken 246 times.
✓ Branch 63 taken 141 times.
✓ Branch 64 taken 257 times.
✓ Branch 65 taken 141 times.
✓ Branch 66 taken 141 times.
✓ Branch 67 taken 141 times.
✓ Branch 68 taken 590 times.
✓ Branch 69 taken 252 times.
✓ Branch 70 taken 256 times.
✓ Branch 71 taken 570 times.
✓ Branch 72 taken 340 times.
✓ Branch 73 taken 399 times.
✓ Branch 74 taken 350 times.
✓ Branch 75 taken 382 times.
✓ Branch 76 taken 1428 times.
✓ Branch 77 taken 139 times.
✓ Branch 78 taken 140 times.
✓ Branch 79 taken 149 times.
✓ Branch 80 taken 140 times.
✓ Branch 81 taken 139 times.
✓ Branch 82 taken 140 times.
✓ Branch 83 taken 1 times.
✓ Branch 84 taken 1436 times.
✓ Branch 85 taken 1 times.
✓ Branch 86 taken 556 times.
✓ Branch 87 taken 1436 times.
✓ Branch 88 taken 556 times.
✓ Branch 89 taken 141 times.
✓ Branch 90 taken 141 times.
✗ Branch 91 not taken.
✗ Branch 92 not taken.
✓ Branch 93 taken 18 times.
✗ Branch 94 not taken.
✓ Branch 95 taken 111 times.
✓ Branch 96 taken 111 times.
✓ Branch 97 taken 141 times.
✓ Branch 98 taken 219 times.
✓ Branch 99 taken 219 times.
✗ Branch 100 not taken.
✗ Branch 101 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✓ Branch 106 taken 23788 times.
57173 switch (srcFormat) {
2301 308 case AV_PIX_FMT_GBRP9LE:
2302 308 *readLumPlanar = planar_rgb9le_to_y;
2303 308 break;
2304 392 case AV_PIX_FMT_GBRAP10LE:
2305 392 *readAlpPlanar = planar_rgb10le_to_a;
2306 av_fallthrough;
2307 1684 case AV_PIX_FMT_GBRP10LE:
2308 1684 *readLumPlanar = planar_rgb10le_to_y;
2309 1684 break;
2310 392 case AV_PIX_FMT_GBRAP12LE:
2311 392 *readAlpPlanar = planar_rgb12le_to_a;
2312 av_fallthrough;
2313 1680 case AV_PIX_FMT_GBRP12LE:
2314 1680 *readLumPlanar = planar_rgb12le_to_y;
2315 1680 break;
2316 139 case AV_PIX_FMT_GBRAP14LE:
2317 139 *readAlpPlanar = planar_rgb14le_to_a;
2318 av_fallthrough;
2319 447 case AV_PIX_FMT_GBRP14LE:
2320 447 *readLumPlanar = planar_rgb14le_to_y;
2321 447 break;
2322 392 case AV_PIX_FMT_GBRAP16LE:
2323 392 *readAlpPlanar = planar_rgb16le_to_a;
2324 av_fallthrough;
2325 994 case AV_PIX_FMT_GBRP16LE:
2326 994 *readLumPlanar = planar_rgb16le_to_y;
2327 994 break;
2328 393 case AV_PIX_FMT_GBRAPF32LE:
2329 393 *readAlpPlanar = planar_rgbf32le_to_a;
2330 av_fallthrough;
2331 736 case AV_PIX_FMT_GBRPF32LE:
2332 736 *readLumPlanar = planar_rgbf32le_to_y;
2333 736 break;
2334 115 case AV_PIX_FMT_GBRAPF16LE:
2335 115 *readAlpPlanar = planar_rgbf16le_to_a;
2336 av_fallthrough;
2337 384 case AV_PIX_FMT_GBRPF16LE:
2338 384 *readLumPlanar = planar_rgbf16le_to_y;
2339 384 break;
2340 142 case AV_PIX_FMT_GBRP10MSBLE:
2341 142 *readLumPlanar = msb_planar_rgb10le_to_y;
2342 142 break;
2343 142 case AV_PIX_FMT_GBRP12MSBLE:
2344 142 *readLumPlanar = msb_planar_rgb12le_to_y;
2345 142 break;
2346 307 case AV_PIX_FMT_GBRP9BE:
2347 307 *readLumPlanar = planar_rgb9be_to_y;
2348 307 break;
2349 391 case AV_PIX_FMT_GBRAP10BE:
2350 391 *readAlpPlanar = planar_rgb10be_to_a;
2351 av_fallthrough;
2352 788 case AV_PIX_FMT_GBRP10BE:
2353 788 *readLumPlanar = planar_rgb10be_to_y;
2354 788 break;
2355 391 case AV_PIX_FMT_GBRAP12BE:
2356 391 *readAlpPlanar = planar_rgb12be_to_a;
2357 av_fallthrough;
2358 788 case AV_PIX_FMT_GBRP12BE:
2359 788 *readLumPlanar = planar_rgb12be_to_y;
2360 788 break;
2361 139 case AV_PIX_FMT_GBRAP14BE:
2362 139 *readAlpPlanar = planar_rgb14be_to_a;
2363 av_fallthrough;
2364 446 case AV_PIX_FMT_GBRP14BE:
2365 446 *readLumPlanar = planar_rgb14be_to_y;
2366 446 break;
2367 391 case AV_PIX_FMT_GBRAP16BE:
2368 391 *readAlpPlanar = planar_rgb16be_to_a;
2369 av_fallthrough;
2370 838 case AV_PIX_FMT_GBRP16BE:
2371 838 *readLumPlanar = planar_rgb16be_to_y;
2372 838 break;
2373 393 case AV_PIX_FMT_GBRAPF32BE:
2374 393 *readAlpPlanar = planar_rgbf32be_to_a;
2375 av_fallthrough;
2376 702 case AV_PIX_FMT_GBRPF32BE:
2377 702 *readLumPlanar = planar_rgbf32be_to_y;
2378 702 break;
2379 case AV_PIX_FMT_GBRAPF16BE:
2380 *readAlpPlanar = planar_rgbf16be_to_a;
2381 av_fallthrough;
2382 case AV_PIX_FMT_GBRPF16BE:
2383 *readLumPlanar = planar_rgbf16be_to_y;
2384 break;
2385 141 case AV_PIX_FMT_GBRP10MSBBE:
2386 141 *readLumPlanar = msb_planar_rgb10be_to_y;
2387 141 break;
2388 141 case AV_PIX_FMT_GBRP12MSBBE:
2389 141 *readLumPlanar = msb_planar_rgb12be_to_y;
2390 141 break;
2391 434 case AV_PIX_FMT_GBRAP:
2392 434 *readAlpPlanar = planar_rgb_to_a;
2393 av_fallthrough;
2394 1665 case AV_PIX_FMT_GBRP:
2395 1665 *readLumPlanar = planar_rgb_to_y;
2396 1665 break;
2397 #if HAVE_BIGENDIAN
2398 case AV_PIX_FMT_YUV420P9LE:
2399 case AV_PIX_FMT_YUV422P9LE:
2400 case AV_PIX_FMT_YUV444P9LE:
2401 case AV_PIX_FMT_YUV420P10LE:
2402 case AV_PIX_FMT_YUV422P10LE:
2403 case AV_PIX_FMT_YUV440P10LE:
2404 case AV_PIX_FMT_YUV444P10LE:
2405 case AV_PIX_FMT_YUV420P12LE:
2406 case AV_PIX_FMT_YUV422P12LE:
2407 case AV_PIX_FMT_YUV440P12LE:
2408 case AV_PIX_FMT_YUV444P12LE:
2409 case AV_PIX_FMT_YUV420P14LE:
2410 case AV_PIX_FMT_YUV422P14LE:
2411 case AV_PIX_FMT_YUV444P14LE:
2412 case AV_PIX_FMT_YUV420P16LE:
2413 case AV_PIX_FMT_YUV422P16LE:
2414 case AV_PIX_FMT_YUV444P16LE:
2415
2416 case AV_PIX_FMT_GRAY9LE:
2417 case AV_PIX_FMT_GRAY10LE:
2418 case AV_PIX_FMT_GRAY12LE:
2419 case AV_PIX_FMT_GRAY14LE:
2420 case AV_PIX_FMT_GRAY16LE:
2421
2422 case AV_PIX_FMT_P016LE:
2423 case AV_PIX_FMT_P216LE:
2424 case AV_PIX_FMT_P416LE:
2425 *lumToYV12 = bswap16Y_c;
2426 break;
2427 case AV_PIX_FMT_YUVA420P9LE:
2428 case AV_PIX_FMT_YUVA422P9LE:
2429 case AV_PIX_FMT_YUVA444P9LE:
2430 case AV_PIX_FMT_YUVA420P10LE:
2431 case AV_PIX_FMT_YUVA422P10LE:
2432 case AV_PIX_FMT_YUVA444P10LE:
2433 case AV_PIX_FMT_YUVA422P12LE:
2434 case AV_PIX_FMT_YUVA444P12LE:
2435 case AV_PIX_FMT_YUVA420P16LE:
2436 case AV_PIX_FMT_YUVA422P16LE:
2437 case AV_PIX_FMT_YUVA444P16LE:
2438 *lumToYV12 = bswap16Y_c;
2439 *alpToYV12 = bswap16Y_c;
2440 break;
2441 #else
2442 2998 case AV_PIX_FMT_YUV420P9BE:
2443 case AV_PIX_FMT_YUV422P9BE:
2444 case AV_PIX_FMT_YUV444P9BE:
2445 case AV_PIX_FMT_YUV420P10BE:
2446 case AV_PIX_FMT_YUV422P10BE:
2447 case AV_PIX_FMT_YUV440P10BE:
2448 case AV_PIX_FMT_YUV444P10BE:
2449 case AV_PIX_FMT_YUV420P12BE:
2450 case AV_PIX_FMT_YUV422P12BE:
2451 case AV_PIX_FMT_YUV440P12BE:
2452 case AV_PIX_FMT_YUV444P12BE:
2453 case AV_PIX_FMT_YUV420P14BE:
2454 case AV_PIX_FMT_YUV422P14BE:
2455 case AV_PIX_FMT_YUV444P14BE:
2456 case AV_PIX_FMT_YUV420P16BE:
2457 case AV_PIX_FMT_YUV422P16BE:
2458 case AV_PIX_FMT_YUV444P16BE:
2459
2460 case AV_PIX_FMT_GRAY9BE:
2461 case AV_PIX_FMT_GRAY10BE:
2462 case AV_PIX_FMT_GRAY12BE:
2463 case AV_PIX_FMT_GRAY14BE:
2464 case AV_PIX_FMT_GRAY16BE:
2465
2466 case AV_PIX_FMT_P016BE:
2467 case AV_PIX_FMT_P216BE:
2468 case AV_PIX_FMT_P416BE:
2469 2998 *lumToYV12 = bswap16Y_c;
2470 2998 break;
2471 51 case AV_PIX_FMT_YUVA420P9BE:
2472 case AV_PIX_FMT_YUVA422P9BE:
2473 case AV_PIX_FMT_YUVA444P9BE:
2474 case AV_PIX_FMT_YUVA420P10BE:
2475 case AV_PIX_FMT_YUVA422P10BE:
2476 case AV_PIX_FMT_YUVA444P10BE:
2477 case AV_PIX_FMT_YUVA422P12BE:
2478 case AV_PIX_FMT_YUVA444P12BE:
2479 case AV_PIX_FMT_YUVA420P16BE:
2480 case AV_PIX_FMT_YUVA422P16BE:
2481 case AV_PIX_FMT_YUVA444P16BE:
2482 51 *lumToYV12 = bswap16Y_c;
2483 51 *alpToYV12 = bswap16Y_c;
2484 51 break;
2485 #endif
2486 92 case AV_PIX_FMT_YUV444P10MSBLE:
2487 92 *lumToYV12 = shf16_10LEToY_c;
2488 92 break;
2489 92 case AV_PIX_FMT_YUV444P12MSBLE:
2490 92 *lumToYV12 = shf16_12LEToY_c;
2491 92 break;
2492 91 case AV_PIX_FMT_YUV444P10MSBBE:
2493 91 *lumToYV12 = shf16_10BEToY_c;
2494 91 break;
2495 91 case AV_PIX_FMT_YUV444P12MSBBE:
2496 91 *lumToYV12 = shf16_12BEToY_c;
2497 91 break;
2498 141 case AV_PIX_FMT_YA16LE:
2499 141 *lumToYV12 = read_ya16le_gray_c;
2500 141 break;
2501 151 case AV_PIX_FMT_YA16BE:
2502 151 *lumToYV12 = read_ya16be_gray_c;
2503 151 break;
2504 9 case AV_PIX_FMT_YAF16LE:
2505 9 *lumToYV12 = read_yaf16le_gray_c;
2506 9 break;
2507 case AV_PIX_FMT_YAF16BE:
2508 *lumToYV12 = read_yaf16be_gray_c;
2509 break;
2510 393 case AV_PIX_FMT_VUYA:
2511 case AV_PIX_FMT_VUYX:
2512 393 *lumToYV12 = read_vuyx_Y_c;
2513 393 break;
2514 251 case AV_PIX_FMT_XV30LE:
2515 251 *lumToYV12 = read_xv30le_Y_c;
2516 251 break;
2517 265 case AV_PIX_FMT_V30XLE:
2518 265 *lumToYV12 = read_v30xle_Y_c;
2519 265 break;
2520 286 case AV_PIX_FMT_AYUV:
2521 case AV_PIX_FMT_UYVA:
2522 286 *lumToYV12 = read_ayuv_Y_c;
2523 286 break;
2524 422 case AV_PIX_FMT_AYUV64LE:
2525 case AV_PIX_FMT_XV48LE:
2526 422 *lumToYV12 = read_ayuv64le_Y_c;
2527 422 break;
2528 422 case AV_PIX_FMT_AYUV64BE:
2529 case AV_PIX_FMT_XV48BE:
2530 422 *lumToYV12 = read_ayuv64be_Y_c;
2531 422 break;
2532 251 case AV_PIX_FMT_XV36LE:
2533 251 *lumToYV12 = read_xv36le_Y_c;
2534 251 break;
2535 251 case AV_PIX_FMT_XV36BE:
2536 251 *lumToYV12 = read_xv36be_Y_c;
2537 251 break;
2538 385 case AV_PIX_FMT_YUYV422:
2539 case AV_PIX_FMT_YVYU422:
2540 case AV_PIX_FMT_YA8:
2541 385 *lumToYV12 = yuy2ToY_c;
2542 385 break;
2543 112 case AV_PIX_FMT_UYVY422:
2544 112 *lumToYV12 = uyvyToY_c;
2545 112 break;
2546 case AV_PIX_FMT_UYYVYY411:
2547 *lumToYV12 = uyyvyyToY_c;
2548 break;
2549 256 case AV_PIX_FMT_VYU444:
2550 256 *lumToYV12 = vyuToY_c;
2551 256 break;
2552 305 case AV_PIX_FMT_BGR24:
2553 305 *lumToYV12 = bgr24ToY_c;
2554 305 break;
2555 141 case AV_PIX_FMT_BGR565LE:
2556 141 *lumToYV12 = bgr16leToY_c;
2557 141 break;
2558 141 case AV_PIX_FMT_BGR565BE:
2559 141 *lumToYV12 = bgr16beToY_c;
2560 141 break;
2561 141 case AV_PIX_FMT_BGR555LE:
2562 141 *lumToYV12 = bgr15leToY_c;
2563 141 break;
2564 141 case AV_PIX_FMT_BGR555BE:
2565 141 *lumToYV12 = bgr15beToY_c;
2566 141 break;
2567 141 case AV_PIX_FMT_BGR444LE:
2568 141 *lumToYV12 = bgr12leToY_c;
2569 141 break;
2570 141 case AV_PIX_FMT_BGR444BE:
2571 141 *lumToYV12 = bgr12beToY_c;
2572 141 break;
2573 1323 case AV_PIX_FMT_RGB24:
2574 1323 *lumToYV12 = rgb24ToY_c;
2575 1323 break;
2576 246 case AV_PIX_FMT_RGB565LE:
2577 246 *lumToYV12 = rgb16leToY_c;
2578 246 break;
2579 141 case AV_PIX_FMT_RGB565BE:
2580 141 *lumToYV12 = rgb16beToY_c;
2581 141 break;
2582 257 case AV_PIX_FMT_RGB555LE:
2583 257 *lumToYV12 = rgb15leToY_c;
2584 257 break;
2585 141 case AV_PIX_FMT_RGB555BE:
2586 141 *lumToYV12 = rgb15beToY_c;
2587 141 break;
2588 141 case AV_PIX_FMT_RGB444LE:
2589 141 *lumToYV12 = rgb12leToY_c;
2590 141 break;
2591 141 case AV_PIX_FMT_RGB444BE:
2592 141 *lumToYV12 = rgb12beToY_c;
2593 141 break;
2594 590 case AV_PIX_FMT_RGB8:
2595 case AV_PIX_FMT_BGR8:
2596 case AV_PIX_FMT_PAL8:
2597 case AV_PIX_FMT_BGR4_BYTE:
2598 case AV_PIX_FMT_RGB4_BYTE:
2599 590 *lumToYV12 = palToY_c;
2600 590 break;
2601 252 case AV_PIX_FMT_MONOBLACK:
2602 252 *lumToYV12 = monoblack2Y_c;
2603 252 break;
2604 256 case AV_PIX_FMT_MONOWHITE:
2605 256 *lumToYV12 = monowhite2Y_c;
2606 256 break;
2607 570 case AV_PIX_FMT_RGB32:
2608 570 *lumToYV12 = bgr32ToY_c;
2609 570 break;
2610 340 case AV_PIX_FMT_RGB32_1:
2611 340 *lumToYV12 = bgr321ToY_c;
2612 340 break;
2613 399 case AV_PIX_FMT_BGR32:
2614 399 *lumToYV12 = rgb32ToY_c;
2615 399 break;
2616 350 case AV_PIX_FMT_BGR32_1:
2617 350 *lumToYV12 = rgb321ToY_c;
2618 350 break;
2619 382 case AV_PIX_FMT_RGB48BE:
2620 382 *lumToYV12 = rgb48BEToY_c;
2621 382 break;
2622 1428 case AV_PIX_FMT_RGB48LE:
2623 1428 *lumToYV12 = rgb48LEToY_c;
2624 1428 break;
2625 139 case AV_PIX_FMT_BGR48BE:
2626 139 *lumToYV12 = bgr48BEToY_c;
2627 139 break;
2628 140 case AV_PIX_FMT_BGR48LE:
2629 140 *lumToYV12 = bgr48LEToY_c;
2630 140 break;
2631 149 case AV_PIX_FMT_RGBA64BE:
2632 149 *lumToYV12 = rgb64BEToY_c;
2633 149 break;
2634 140 case AV_PIX_FMT_RGBA64LE:
2635 140 *lumToYV12 = rgb64LEToY_c;
2636 140 break;
2637 139 case AV_PIX_FMT_BGRA64BE:
2638 139 *lumToYV12 = bgr64BEToY_c;
2639 139 break;
2640 140 case AV_PIX_FMT_BGRA64LE:
2641 140 *lumToYV12 = bgr64LEToY_c;
2642 140 break;
2643 1 case AV_PIX_FMT_NV20LE:
2644 1 *lumToYV12 = nv20LEToY_c;
2645 1 break;
2646 1436 case AV_PIX_FMT_P010LE:
2647 case AV_PIX_FMT_P210LE:
2648 case AV_PIX_FMT_P410LE:
2649 1436 *lumToYV12 = p010LEToY_c;
2650 1436 break;
2651 1 case AV_PIX_FMT_NV20BE:
2652 1 *lumToYV12 = nv20BEToY_c;
2653 1 break;
2654 556 case AV_PIX_FMT_P010BE:
2655 case AV_PIX_FMT_P210BE:
2656 case AV_PIX_FMT_P410BE:
2657 556 *lumToYV12 = p010BEToY_c;
2658 556 break;
2659 1436 case AV_PIX_FMT_P012LE:
2660 case AV_PIX_FMT_P212LE:
2661 case AV_PIX_FMT_P412LE:
2662 1436 *lumToYV12 = p012LEToY_c;
2663 1436 break;
2664 556 case AV_PIX_FMT_P012BE:
2665 case AV_PIX_FMT_P212BE:
2666 case AV_PIX_FMT_P412BE:
2667 556 *lumToYV12 = p012BEToY_c;
2668 556 break;
2669 141 case AV_PIX_FMT_GRAYF32LE:
2670 141 *lumToYV12 = grayf32leToY16_c;
2671 141 break;
2672 141 case AV_PIX_FMT_GRAYF32BE:
2673 141 *lumToYV12 = grayf32beToY16_c;
2674 141 break;
2675 case AV_PIX_FMT_YAF32LE:
2676 *lumToYV12 = read_yaf32le_gray_c;
2677 break;
2678 case AV_PIX_FMT_YAF32BE:
2679 *lumToYV12 = read_yaf32be_gray_c;
2680 break;
2681 18 case AV_PIX_FMT_GRAYF16LE:
2682 18 *lumToYV12 = grayf16leToY16_c;
2683 18 break;
2684 case AV_PIX_FMT_GRAYF16BE:
2685 *lumToYV12 = grayf16beToY16_c;
2686 break;
2687 111 case AV_PIX_FMT_Y210LE:
2688 111 *lumToYV12 = y210le_Y_c;
2689 111 break;
2690 111 case AV_PIX_FMT_Y212LE:
2691 111 *lumToYV12 = y212le_Y_c;
2692 111 break;
2693 141 case AV_PIX_FMT_Y216LE:
2694 141 *lumToYV12 = y216le_Y_c;
2695 141 break;
2696 219 case AV_PIX_FMT_X2RGB10LE:
2697 219 *lumToYV12 = rgb30leToY_c;
2698 219 break;
2699 219 case AV_PIX_FMT_X2BGR10LE:
2700 219 *lumToYV12 = bgr30leToY_c;
2701 219 break;
2702 case AV_PIX_FMT_RGBAF16BE:
2703 *lumToYV12 = rgbaf16beToY_c;
2704 break;
2705 case AV_PIX_FMT_RGBAF16LE:
2706 *lumToYV12 = rgbaf16leToY_c;
2707 break;
2708 case AV_PIX_FMT_RGBF16BE:
2709 *lumToYV12 = rgbf16beToY_c;
2710 break;
2711 case AV_PIX_FMT_RGBF16LE:
2712 *lumToYV12 = rgbf16leToY_c;
2713 break;
2714 case AV_PIX_FMT_RGBF32LE:
2715 *lumToYV12 = rgbf32le_to_y_c;
2716 break;
2717 case AV_PIX_FMT_RGBF32BE:
2718 *lumToYV12 = rgbf32be_to_y_c;
2719 break;
2720 }
2721
2/2
✓ Branch 0 taken 4420 times.
✓ Branch 1 taken 52753 times.
57173 if (c->needAlpha) {
2722
4/4
✓ Branch 1 taken 2980 times.
✓ Branch 2 taken 1440 times.
✓ Branch 4 taken 802 times.
✓ Branch 5 taken 2178 times.
4420 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
2723
4/4
✓ Branch 1 taken 1059 times.
✓ Branch 2 taken 1183 times.
✓ Branch 3 taken 535 times.
✓ Branch 4 taken 524 times.
2242 if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
2724 535 *alpToYV12 = bswap16Y_c;
2725 }
2726
13/19
✓ Branch 0 taken 262 times.
✓ Branch 1 taken 262 times.
✓ Branch 2 taken 683 times.
✓ Branch 3 taken 534 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 131 times.
✓ Branch 7 taken 131 times.
✓ Branch 8 taken 131 times.
✓ Branch 9 taken 9 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 262 times.
✓ Branch 14 taken 131 times.
✓ Branch 15 taken 131 times.
✓ Branch 16 taken 131 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1622 times.
4420 switch (srcFormat) {
2727 262 case AV_PIX_FMT_BGRA64LE:
2728 262 case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2729 262 case AV_PIX_FMT_BGRA64BE:
2730 262 case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2731 683 case AV_PIX_FMT_BGRA:
2732 case AV_PIX_FMT_RGBA:
2733 683 *alpToYV12 = rgbaToA_c;
2734 683 break;
2735 534 case AV_PIX_FMT_ABGR:
2736 case AV_PIX_FMT_ARGB:
2737 534 *alpToYV12 = abgrToA_c;
2738 534 break;
2739 case AV_PIX_FMT_RGBAF16BE:
2740 *alpToYV12 = rgbaf16beToA_c;
2741 break;
2742 case AV_PIX_FMT_RGBAF16LE:
2743 *alpToYV12 = rgbaf16leToA_c;
2744 break;
2745 131 case AV_PIX_FMT_YA8:
2746 131 *alpToYV12 = uyvyToY_c;
2747 131 break;
2748 131 case AV_PIX_FMT_YA16LE:
2749 131 *alpToYV12 = read_ya16le_alpha_c;
2750 131 break;
2751 131 case AV_PIX_FMT_YA16BE:
2752 131 *alpToYV12 = read_ya16be_alpha_c;
2753 131 break;
2754 9 case AV_PIX_FMT_YAF16LE:
2755 9 *alpToYV12 = read_yaf16le_alpha_c;
2756 9 break;
2757 case AV_PIX_FMT_YAF16BE:
2758 *alpToYV12 = read_yaf16be_alpha_c;
2759 break;
2760 case AV_PIX_FMT_YAF32LE:
2761 *alpToYV12 = read_yaf32le_alpha_c;
2762 break;
2763 case AV_PIX_FMT_YAF32BE:
2764 *alpToYV12 = read_yaf32be_alpha_c;
2765 break;
2766 262 case AV_PIX_FMT_VUYA:
2767 case AV_PIX_FMT_UYVA:
2768 262 *alpToYV12 = read_vuya_A_c;
2769 262 break;
2770 131 case AV_PIX_FMT_AYUV:
2771 131 *alpToYV12 = read_ayuv_A_c;
2772 131 break;
2773 131 case AV_PIX_FMT_AYUV64LE:
2774 131 *alpToYV12 = read_ayuv64le_A_c;
2775 131 break;
2776 131 case AV_PIX_FMT_AYUV64BE:
2777 131 *alpToYV12 = read_ayuv64be_A_c;
2778 131 break;
2779 case AV_PIX_FMT_PAL8 :
2780 *alpToYV12 = palToA_c;
2781 break;
2782 }
2783 }
2784 57173 }
2785