FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2024-07-26 21:54:09
Exec Total Coverage
Lines: 923 1072 86.1%
Functions: 166 200 83.0%
Branches: 514 677 75.9%

Line Branch Exec Source
1 /*
2 * Copyright (C) 2001-2012 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <math.h>
22 #include <stdint.h>
23 #include <stdio.h>
24
25 #include "libavutil/bswap.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/avassert.h"
28 #include "config.h"
29 #include "swscale_internal.h"
30
31 #define input_pixel(pos) (is_be ? AV_RB16(pos) : AV_RL16(pos))
32
33 #define IS_BE_LE 0
34 #define IS_BE_BE 1
35 #define IS_BE_ 0
36 /* ENDIAN_IDENTIFIER needs to be "BE", "LE" or "". The latter is intended
37 * for single-byte cases where the concept of endianness does not apply. */
38 #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
39
40 #define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
41 #define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
42
43 static av_always_inline void
44 1479 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
45 enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
46 {
47 1479 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
48 int i;
49
2/2
✓ Branch 0 taken 441216 times.
✓ Branch 1 taken 1479 times.
442695 for (i = 0; i < width; i++) {
50
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int r_b = input_pixel(&src[i*4+0]);
51
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int g = input_pixel(&src[i*4+1]);
52
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int b_r = input_pixel(&src[i*4+2]);
53
54
12/16
✓ Branch 0 taken 441216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 441216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339840 times.
✓ Branch 5 taken 101376 times.
✓ Branch 6 taken 110592 times.
✓ Branch 7 taken 229248 times.
✓ Branch 8 taken 441216 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 441216 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 339840 times.
✓ Branch 13 taken 101376 times.
✓ Branch 14 taken 110592 times.
✓ Branch 15 taken 229248 times.
441216 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
55 }
56 1479 }
57
58 static av_always_inline void
59 1479 rgb64ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
60 const uint16_t *src1, const uint16_t *src2,
61 int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
62 {
63 int i;
64 1479 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
65 1479 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
66 av_assert1(src1==src2);
67
2/2
✓ Branch 0 taken 441216 times.
✓ Branch 1 taken 1479 times.
442695 for (i = 0; i < width; i++) {
68
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int r_b = input_pixel(&src1[i*4+0]);
69
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int g = input_pixel(&src1[i*4+1]);
70
2/2
✓ Branch 0 taken 220032 times.
✓ Branch 1 taken 221184 times.
441216 unsigned int b_r = input_pixel(&src1[i*4+2]);
71
72
12/16
✓ Branch 0 taken 441216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 441216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339840 times.
✓ Branch 5 taken 101376 times.
✓ Branch 6 taken 110592 times.
✓ Branch 7 taken 229248 times.
✓ Branch 8 taken 441216 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 441216 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 339840 times.
✓ Branch 13 taken 101376 times.
✓ Branch 14 taken 110592 times.
✓ Branch 15 taken 229248 times.
441216 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
73
12/16
✓ Branch 0 taken 441216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 441216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339840 times.
✓ Branch 5 taken 101376 times.
✓ Branch 6 taken 110592 times.
✓ Branch 7 taken 229248 times.
✓ Branch 8 taken 441216 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 441216 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 339840 times.
✓ Branch 13 taken 101376 times.
✓ Branch 14 taken 110592 times.
✓ Branch 15 taken 229248 times.
441216 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
74 }
75 1479 }
76
77 static av_always_inline void
78 rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
79 const uint16_t *src1, const uint16_t *src2,
80 int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
81 {
82 int i;
83 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
84 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
85 av_assert1(src1==src2);
86 for (i = 0; i < width; i++) {
87 unsigned r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
88 unsigned g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
89 unsigned b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
90
91 dstU[i]= (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
92 dstV[i]= (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
93 }
94 }
95
96 #define RGB64FUNCS_EXT(pattern, BE_LE, origin, is_be) \
97 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\
98 int width, uint32_t *rgb2yuv, void *opq) \
99 { \
100 const uint16_t *src = (const uint16_t *) _src; \
101 uint16_t *dst = (uint16_t *) _dst; \
102 rgb64ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
103 } \
104 \
105 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
106 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
107 int width, uint32_t *rgb2yuv, void *opq) \
108 { \
109 const uint16_t *src1 = (const uint16_t *) _src1, \
110 *src2 = (const uint16_t *) _src2; \
111 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
112 rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
113 } \
114 \
115 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
116 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
117 int width, uint32_t *rgb2yuv, void *opq) \
118 { \
119 const uint16_t *src1 = (const uint16_t *) _src1, \
120 *src2 = (const uint16_t *) _src2; \
121 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
122 rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
123 }
124 #define RGB64FUNCS(pattern, endianness, base_fmt) \
125 RGB64FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
126
127 1536 RGB64FUNCS(rgb, LE, AV_PIX_FMT_RGBA64)
128 1692 RGB64FUNCS(rgb, BE, AV_PIX_FMT_RGBA64)
129 1536 RGB64FUNCS(bgr, LE, AV_PIX_FMT_BGRA64)
130 1152 RGB64FUNCS(bgr, BE, AV_PIX_FMT_BGRA64)
131
132 47243 static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
133 const uint16_t *src, int width,
134 enum AVPixelFormat origin,
135 int32_t *rgb2yuv, int is_be)
136 {
137 47243 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
138 int i;
139
2/2
✓ Branch 0 taken 16009544 times.
✓ Branch 1 taken 47243 times.
16056787 for (i = 0; i < width; i++) {
140
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 15688136 times.
16009544 unsigned int r_b = input_pixel(&src[i * 3 + 0]);
141
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 15688136 times.
16009544 unsigned int g = input_pixel(&src[i * 3 + 1]);
142
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 15688136 times.
16009544 unsigned int b_r = input_pixel(&src[i * 3 + 2]);
143
144
12/16
✓ Branch 0 taken 15908168 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 15797576 times.
✓ Branch 3 taken 110592 times.
✓ Branch 4 taken 15797576 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 15797576 times.
✓ Branch 8 taken 15908168 times.
✓ Branch 9 taken 101376 times.
✓ Branch 10 taken 15797576 times.
✓ Branch 11 taken 110592 times.
✓ Branch 12 taken 15797576 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 15797576 times.
16009544 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
145 }
146 47243 }
147
148 2343 static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
149 uint16_t *dstV,
150 const uint16_t *src1,
151 const uint16_t *src2,
152 int width,
153 enum AVPixelFormat origin,
154 int32_t *rgb2yuv, int is_be)
155 {
156 int i;
157 2343 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
158 2343 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
159 av_assert1(src1 == src2);
160
2/2
✓ Branch 0 taken 745344 times.
✓ Branch 1 taken 2343 times.
747687 for (i = 0; i < width; i++) {
161
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 423936 times.
745344 unsigned r_b = input_pixel(&src1[i * 3 + 0]);
162
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 423936 times.
745344 unsigned g = input_pixel(&src1[i * 3 + 1]);
163
2/2
✓ Branch 0 taken 321408 times.
✓ Branch 1 taken 423936 times.
745344 unsigned b_r = input_pixel(&src1[i * 3 + 2]);
164
165
12/16
✓ Branch 0 taken 643968 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 533376 times.
✓ Branch 3 taken 110592 times.
✓ Branch 4 taken 533376 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 533376 times.
✓ Branch 8 taken 643968 times.
✓ Branch 9 taken 101376 times.
✓ Branch 10 taken 533376 times.
✓ Branch 11 taken 110592 times.
✓ Branch 12 taken 533376 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 533376 times.
745344 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
166
12/16
✓ Branch 0 taken 643968 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 533376 times.
✓ Branch 3 taken 110592 times.
✓ Branch 4 taken 533376 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 533376 times.
✓ Branch 8 taken 643968 times.
✓ Branch 9 taken 101376 times.
✓ Branch 10 taken 533376 times.
✓ Branch 11 taken 110592 times.
✓ Branch 12 taken 533376 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 533376 times.
745344 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
167 }
168 2343 }
169
170 44900 static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
171 uint16_t *dstV,
172 const uint16_t *src1,
173 const uint16_t *src2,
174 int width,
175 enum AVPixelFormat origin,
176 int32_t *rgb2yuv, int is_be)
177 {
178 int i;
179 44900 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
180 44900 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
181 av_assert1(src1 == src2);
182
2/2
✓ Branch 0 taken 7632100 times.
✓ Branch 1 taken 44900 times.
7677000 for (i = 0; i < width; i++) {
183
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7632100 times.
7632100 unsigned r_b = (input_pixel(&src1[6 * i + 0]) +
184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7632100 times.
7632100 input_pixel(&src1[6 * i + 3]) + 1) >> 1;
185
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7632100 times.
7632100 unsigned g = (input_pixel(&src1[6 * i + 1]) +
186
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7632100 times.
7632100 input_pixel(&src1[6 * i + 4]) + 1) >> 1;
187
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7632100 times.
7632100 unsigned b_r = (input_pixel(&src1[6 * i + 2]) +
188
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7632100 times.
7632100 input_pixel(&src1[6 * i + 5]) + 1) >> 1;
189
190
8/16
✓ Branch 0 taken 7632100 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7632100 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7632100 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7632100 times.
✓ Branch 8 taken 7632100 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7632100 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 7632100 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 7632100 times.
7632100 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
191
8/16
✓ Branch 0 taken 7632100 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7632100 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7632100 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7632100 times.
✓ Branch 8 taken 7632100 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7632100 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 7632100 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 7632100 times.
7632100 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
192 }
193 44900 }
194
195 #undef r
196 #undef b
197 #undef input_pixel
198
199 #define RGB48FUNCS_EXT(pattern, BE_LE, origin, is_be) \
200 static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
201 const uint8_t *_src, \
202 const uint8_t *unused0, const uint8_t *unused1,\
203 int width, \
204 uint32_t *rgb2yuv, \
205 void *opq) \
206 { \
207 const uint16_t *src = (const uint16_t *)_src; \
208 uint16_t *dst = (uint16_t *)_dst; \
209 rgb48ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
210 } \
211 \
212 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
213 uint8_t *_dstV, \
214 const uint8_t *unused0, \
215 const uint8_t *_src1, \
216 const uint8_t *_src2, \
217 int width, \
218 uint32_t *rgb2yuv, \
219 void *opq) \
220 { \
221 const uint16_t *src1 = (const uint16_t *)_src1, \
222 *src2 = (const uint16_t *)_src2; \
223 uint16_t *dstU = (uint16_t *)_dstU, \
224 *dstV = (uint16_t *)_dstV; \
225 rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
226 } \
227 \
228 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
229 uint8_t *_dstV, \
230 const uint8_t *unused0, \
231 const uint8_t *_src1, \
232 const uint8_t *_src2, \
233 int width, \
234 uint32_t *rgb2yuv, \
235 void *opq) \
236 { \
237 const uint16_t *src1 = (const uint16_t *)_src1, \
238 *src2 = (const uint16_t *)_src2; \
239 uint16_t *dstU = (uint16_t *)_dstU, \
240 *dstV = (uint16_t *)_dstV; \
241 rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
242 }
243 #define RGB48FUNCS(pattern, endianness, base_fmt) \
244 RGB48FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
245
246 183440 RGB48FUNCS(rgb, LE, AV_PIX_FMT_RGB48)
247 2844 RGB48FUNCS(rgb, BE, AV_PIX_FMT_RGB48)
248 1536 RGB48FUNCS(bgr, LE, AV_PIX_FMT_BGR48)
249 1152 RGB48FUNCS(bgr, BE, AV_PIX_FMT_BGR48)
250
251 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
252 origin == AV_PIX_FMT_BGRA || \
253 origin == AV_PIX_FMT_ARGB || \
254 origin == AV_PIX_FMT_ABGR) \
255 ? AV_RN32A(&src[(i) * 4]) \
256 : ((origin == AV_PIX_FMT_X2RGB10LE || \
257 origin == AV_PIX_FMT_X2BGR10LE) \
258 ? AV_RL32(&src[(i) * 4]) \
259 : (is_be ? AV_RB16(&src[(i) * 2]) \
260 : AV_RL16(&src[(i) * 2]))))
261
262 711188 static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
263 const uint8_t *src,
264 int width,
265 enum AVPixelFormat origin,
266 int shr, int shg,
267 int shb, int shp,
268 int maskr, int maskg,
269 int maskb, int rsh,
270 int gsh, int bsh, int S,
271 int32_t *rgb2yuv, int is_be)
272 {
273 711188 const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
274 711188 const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
275 int i;
276
277
2/2
✓ Branch 0 taken 249607537 times.
✓ Branch 1 taken 711188 times.
250318725 for (i = 0; i < width; i++) {
278
14/14
✓ Branch 0 taken 78849888 times.
✓ Branch 1 taken 170757649 times.
✓ Branch 2 taken 78387104 times.
✓ Branch 3 taken 462784 times.
✓ Branch 4 taken 78174944 times.
✓ Branch 5 taken 212160 times.
✓ Branch 6 taken 289728 times.
✓ Branch 7 taken 77885216 times.
✓ Branch 8 taken 77783840 times.
✓ Branch 9 taken 101376 times.
✓ Branch 10 taken 101376 times.
✓ Branch 11 taken 77682464 times.
✓ Branch 12 taken 608256 times.
✓ Branch 13 taken 77074208 times.
249607537 int px = input_pixel(i) >> shp;
279 249607537 int b = (px & maskb) >> shb;
280 249607537 int g = (px & maskg) >> shg;
281 249607537 int r = (px & maskr) >> shr;
282
283 249607537 dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
284 }
285 711188 }
286
287 259714 static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
288 int16_t *dstV,
289 const uint8_t *src,
290 int width,
291 enum AVPixelFormat origin,
292 int shr, int shg,
293 int shb, int shp,
294 int maskr, int maskg,
295 int maskb, int rsh,
296 int gsh, int bsh, int S,
297 int32_t *rgb2yuv, int is_be)
298 {
299 259714 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
300 259714 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
301 259714 const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
302 int i;
303
304
2/2
✓ Branch 0 taken 61874761 times.
✓ Branch 1 taken 259714 times.
62134475 for (i = 0; i < width; i++) {
305
11/14
✓ Branch 0 taken 1012032 times.
✓ Branch 1 taken 60862729 times.
✓ Branch 2 taken 627072 times.
✓ Branch 3 taken 384960 times.
✓ Branch 4 taken 414912 times.
✓ Branch 5 taken 212160 times.
✓ Branch 6 taken 212160 times.
✓ Branch 7 taken 202752 times.
✓ Branch 8 taken 202752 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 202752 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 202752 times.
61874761 int px = input_pixel(i) >> shp;
306 61874761 int b = (px & maskb) >> shb;
307 61874761 int g = (px & maskg) >> shg;
308 61874761 int r = (px & maskr) >> shr;
309
310 61874761 dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
311 61874761 dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
312 }
313 259714 }
314
315 389076 static av_always_inline void rgb16_32ToUV_half_c_template(int16_t *dstU,
316 int16_t *dstV,
317 const uint8_t *src,
318 int width,
319 enum AVPixelFormat origin,
320 int shr, int shg,
321 int shb, int shp,
322 int maskr, int maskg,
323 int maskb, int rsh,
324 int gsh, int bsh, int S,
325 int32_t *rgb2yuv, int is_be)
326 {
327 389076 const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
328 389076 rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
329 389076 maskgx = ~(maskr | maskb);
330 389076 const unsigned rnd = (256U<<(S)) + (1<<(S-6));
331 int i;
332
333 389076 maskr |= maskr << 1;
334 389076 maskb |= maskb << 1;
335 389076 maskg |= maskg << 1;
336
2/2
✓ Branch 0 taken 84160438 times.
✓ Branch 1 taken 389076 times.
84549514 for (i = 0; i < width; i++) {
337
14/14
✓ Branch 0 taken 38929360 times.
✓ Branch 1 taken 45231078 times.
✓ Branch 2 taken 38886672 times.
✓ Branch 3 taken 42688 times.
✓ Branch 4 taken 38883536 times.
✓ Branch 5 taken 3136 times.
✓ Branch 6 taken 42304 times.
✓ Branch 7 taken 38841232 times.
✓ Branch 8 taken 38790544 times.
✓ Branch 9 taken 50688 times.
✓ Branch 10 taken 50688 times.
✓ Branch 11 taken 38739856 times.
✓ Branch 12 taken 304128 times.
✓ Branch 13 taken 38435728 times.
84160438 unsigned px0 = input_pixel(2 * i + 0) >> shp;
338
14/14
✓ Branch 0 taken 38929360 times.
✓ Branch 1 taken 45231078 times.
✓ Branch 2 taken 38886672 times.
✓ Branch 3 taken 42688 times.
✓ Branch 4 taken 38883536 times.
✓ Branch 5 taken 3136 times.
✓ Branch 6 taken 42304 times.
✓ Branch 7 taken 38841232 times.
✓ Branch 8 taken 38790544 times.
✓ Branch 9 taken 50688 times.
✓ Branch 10 taken 50688 times.
✓ Branch 11 taken 38739856 times.
✓ Branch 12 taken 304128 times.
✓ Branch 13 taken 38435728 times.
84160438 unsigned px1 = input_pixel(2 * i + 1) >> shp;
339 84160438 int b, r, g = (px0 & maskgx) + (px1 & maskgx);
340 84160438 int rb = px0 + px1 - g;
341
342 84160438 b = (rb & maskb) >> shb;
343
4/4
✓ Branch 0 taken 84114998 times.
✓ Branch 1 taken 45440 times.
✓ Branch 2 taken 84064310 times.
✓ Branch 3 taken 50688 times.
84160438 if (shp ||
344
4/4
✓ Branch 0 taken 84013622 times.
✓ Branch 1 taken 50688 times.
✓ Branch 2 taken 76330834 times.
✓ Branch 3 taken 7682788 times.
84064310 origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
345
2/2
✓ Branch 0 taken 50688 times.
✓ Branch 1 taken 76280146 times.
76330834 origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
346 7880292 g >>= shg;
347 } else {
348 76280146 g = (g & maskg) >> shg;
349 }
350 84160438 r = (rb & maskr) >> shr;
351
352 84160438 dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);
353 84160438 dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);
354 }
355 389076 }
356
357 #undef input_pixel
358
359 #define RGB16_32FUNCS_EXT(fmt, name, shr, shg, shb, shp, maskr, \
360 maskg, maskb, rsh, gsh, bsh, S, is_be) \
361 static void name ## ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, \
362 int width, uint32_t *tab, void *opq) \
363 { \
364 rgb16_32ToY_c_template((int16_t*)dst, src, width, fmt, shr, shg, shb, shp, \
365 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
366 } \
367 \
368 static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
369 const uint8_t *unused0, const uint8_t *src, const uint8_t *dummy, \
370 int width, uint32_t *tab, void *opq) \
371 { \
372 rgb16_32ToUV_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
373 shr, shg, shb, shp, \
374 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
375 } \
376 \
377 static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
378 const uint8_t *unused0, const uint8_t *src, \
379 const uint8_t *dummy, \
380 int width, uint32_t *tab, void *opq) \
381 { \
382 rgb16_32ToUV_half_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
383 shr, shg, shb, shp, \
384 maskr, maskg, maskb, \
385 rsh, gsh, bsh, S, tab, is_be); \
386 }
387
388 #define RGB16_32FUNCS(base_fmt, endianness, name, shr, shg, shb, shp, maskr, \
389 maskg, maskb, rsh, gsh, bsh, S) \
390 RGB16_32FUNCS_EXT(base_fmt ## endianness, name, shr, shg, shb, shp, maskr, \
391 maskg, maskb, rsh, gsh, bsh, S, IS_BE(endianness))
392
393 1794150 RGB16_32FUNCS(AV_PIX_FMT_BGR32, , bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
394 2368 RGB16_32FUNCS(AV_PIX_FMT_BGR32_1, , bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
395 10220 RGB16_32FUNCS(AV_PIX_FMT_RGB32, , rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
396 3586 RGB16_32FUNCS(AV_PIX_FMT_RGB32_1, , rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
397 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
398 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
399 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
400 181904 RGB16_32FUNCS(AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
401 713904 RGB16_32FUNCS(AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
402 1152 RGB16_32FUNCS(AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
403 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
404 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
405 1152 RGB16_32FUNCS(AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
406 1152 RGB16_32FUNCS(AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
407 1152 RGB16_32FUNCS(AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
408 1152 RGB16_32FUNCS(AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
409 1152 RGB16_32FUNCS(AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
410 1152 RGB16_32FUNCS(AV_PIX_FMT_X2BGR10, LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0, RGB2YUV_SHIFT + 6)
411
412 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
413 const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
414 int width, uint32_t *rgb2yuv, void *opq)
415 {
416 uint16_t *dstU = (uint16_t *)_dstU;
417 uint16_t *dstV = (uint16_t *)_dstV;
418 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
419 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
420
421 int i;
422 for (i = 0; i < width; i++) {
423 unsigned int g = gsrc[2*i] + gsrc[2*i+1];
424 unsigned int b = bsrc[2*i] + bsrc[2*i+1];
425 unsigned int r = rsrc[2*i] + rsrc[2*i+1];
426
427 dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
428 dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
429 }
430 }
431
432 576 static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
433 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
434 {
435 576 int16_t *dst = (int16_t *)_dst;
436 576 const uint16_t *src = (const uint16_t *)_src;
437 int i;
438
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
439 202752 dst[i] = AV_RL16(src + 4 * i + 3);
440 576 }
441
442 576 static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
443 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
444 {
445 576 int16_t *dst = (int16_t *)_dst;
446 576 const uint16_t *src = (const uint16_t *)_src;
447 int i;
448
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
449 202752 dst[i] = AV_RB16(src + 4 * i + 3);
450 576 }
451
452 1455 static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
453 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
454 {
455 1455 int16_t *dst = (int16_t *)_dst;
456 int i;
457
2/2
✓ Branch 0 taken 483072 times.
✓ Branch 1 taken 1455 times.
484527 for (i=0; i<width; i++) {
458 483072 dst[i]= src[4*i]<<6 | src[4*i]>>2;
459 }
460 1455 }
461
462 97937 static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
463 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
464 {
465 97937 int16_t *dst = (int16_t *)_dst;
466 int i;
467
2/2
✓ Branch 0 taken 68036032 times.
✓ Branch 1 taken 97937 times.
68133969 for (i=0; i<width; i++) {
468 68036032 dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
469 }
470 97937 }
471
472 static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
473 const uint8_t *unused2, int width, uint32_t *pal, void *opq)
474 {
475 int16_t *dst = (int16_t *)_dst;
476 int i;
477 for (i=0; i<width; i++) {
478 int d= src[i];
479
480 dst[i]= (pal[d] >> 24)<<6 | pal[d]>>26;
481 }
482 }
483
484 184760 static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
485 const uint8_t *unused2, int width, uint32_t *pal, void *opq)
486 {
487 184760 int16_t *dst = (int16_t *)_dst;
488 int i;
489
2/2
✓ Branch 0 taken 63240280 times.
✓ Branch 1 taken 184760 times.
63425040 for (i = 0; i < width; i++) {
490 63240280 int d = src[i];
491
492 63240280 dst[i] = (pal[d] & 0xFF)<<6;
493 }
494 184760 }
495
496 184760 static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV,
497 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
498 int width, uint32_t *pal, void *opq)
499 {
500 184760 uint16_t *dstU = (uint16_t *)_dstU;
501 184760 int16_t *dstV = (int16_t *)_dstV;
502 int i;
503 av_assert1(src1 == src2);
504
2/2
✓ Branch 0 taken 63240280 times.
✓ Branch 1 taken 184760 times.
63425040 for (i = 0; i < width; i++) {
505 63240280 int p = pal[src1[i]];
506
507 63240280 dstU[i] = (uint8_t)(p>> 8)<<6;
508 63240280 dstV[i] = (uint8_t)(p>>16)<<6;
509 }
510 184760 }
511
512 11926 static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
513 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
514 {
515 11926 int16_t *dst = (int16_t *)_dst;
516 int i, j;
517 11926 width = (width + 7) >> 3;
518
2/2
✓ Branch 0 taken 93444 times.
✓ Branch 1 taken 11926 times.
105370 for (i = 0; i < width; i++) {
519 93444 int d = ~src[i];
520
2/2
✓ Branch 0 taken 747552 times.
✓ Branch 1 taken 93444 times.
840996 for (j = 0; j < 8; j++)
521 747552 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
522 }
523
1/2
✓ Branch 0 taken 11926 times.
✗ Branch 1 not taken.
11926 if(width&7){
524 11926 int d= ~src[i];
525
2/2
✓ Branch 0 taken 70404 times.
✓ Branch 1 taken 11926 times.
82330 for (j = 0; j < (width&7); j++)
526 70404 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
527 }
528 11926 }
529
530 576 static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
531 const uint8_t *unused2, int width, uint32_t *unused, void *opq)
532 {
533 576 int16_t *dst = (int16_t *)_dst;
534 int i, j;
535 576 width = (width + 7) >> 3;
536
2/2
✓ Branch 0 taken 25344 times.
✓ Branch 1 taken 576 times.
25920 for (i = 0; i < width; i++) {
537 25344 int d = src[i];
538
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 25344 times.
228096 for (j = 0; j < 8; j++)
539 202752 dst[8*i+j]= ((d>>(7-j))&1) * 16383;
540 }
541
1/2
✓ Branch 0 taken 576 times.
✗ Branch 1 not taken.
576 if(width&7){
542 576 int d = src[i];
543
2/2
✓ Branch 0 taken 2304 times.
✓ Branch 1 taken 576 times.
2880 for (j = 0; j < (width&7); j++)
544 2304 dst[8*i+j] = ((d>>(7-j))&1) * 16383;
545 }
546 576 }
547
548 1422 static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
549 uint32_t *unused, void *opq)
550 {
551 int i;
552
2/2
✓ Branch 0 taken 440064 times.
✓ Branch 1 taken 1422 times.
441486 for (i = 0; i < width; i++)
553 440064 dst[i] = src[2 * i];
554 1422 }
555
556 576 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
557 const uint8_t *src2, int width, uint32_t *unused, void *opq)
558 {
559 int i;
560
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 576 times.
101952 for (i = 0; i < width; i++) {
561 101376 dstU[i] = src1[4 * i + 1];
562 101376 dstV[i] = src1[4 * i + 3];
563 }
564 av_assert1(src1 == src2);
565 576 }
566
567 288 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
568 const uint8_t *src2, int width, uint32_t *unused, void *opq)
569 {
570 int i;
571
2/2
✓ Branch 0 taken 50688 times.
✓ Branch 1 taken 288 times.
50976 for (i = 0; i < width; i++) {
572 50688 dstV[i] = src1[4 * i + 1];
573 50688 dstU[i] = src1[4 * i + 3];
574 }
575 av_assert1(src1 == src2);
576 288 }
577
578 #define y21xle_wrapper(bits, shift) \
579 static void y2 ## bits ## le_UV_c(uint8_t *dstU, uint8_t *dstV, \
580 const uint8_t *unused0, \
581 const uint8_t *src, \
582 const uint8_t *unused1, int width, \
583 uint32_t *unused2, void *opq) \
584 { \
585 int i; \
586 for (i = 0; i < width; i++) { \
587 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> shift); \
588 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> shift); \
589 } \
590 } \
591 \
592 static void y2 ## bits ## le_Y_c(uint8_t *dst, const uint8_t *src, \
593 const uint8_t *unused0, \
594 const uint8_t *unused1, int width, \
595 uint32_t *unused2, void *opq) \
596 { \
597 int i; \
598 for (i = 0; i < width; i++) \
599 AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> shift); \
600 }
601
602
2/2
✓ Branch 0 taken 152064 times.
✓ Branch 1 taken 576 times.
305280 y21xle_wrapper(10, 6)
603
2/2
✓ Branch 0 taken 152064 times.
✓ Branch 1 taken 576 times.
305280 y21xle_wrapper(12, 4)
604
605 13806 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
606 uint32_t *unused, void *opq)
607 {
608 int i;
609 13806 const uint16_t *src = (const uint16_t *)_src;
610 13806 uint16_t *dst = (uint16_t *)_dst;
611
2/2
✓ Branch 0 taken 4799232 times.
✓ Branch 1 taken 13806 times.
4813038 for (i = 0; i < width; i++)
612 4799232 dst[i] = av_bswap16(src[i]);
613 13806 }
614
615 6624 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
616 const uint8_t *_src2, int width, uint32_t *unused, void *opq)
617 {
618 int i;
619 6624 const uint16_t *src1 = (const uint16_t *)_src1,
620 6624 *src2 = (const uint16_t *)_src2;
621 6624 uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
622
2/2
✓ Branch 0 taken 1672704 times.
✓ Branch 1 taken 6624 times.
1679328 for (i = 0; i < width; i++) {
623 1672704 dstU[i] = av_bswap16(src1[i]);
624 1672704 dstV[i] = av_bswap16(src2[i]);
625 }
626 6624 }
627
628 288 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
629 uint32_t *unused, void *opq)
630 {
631 int i;
632
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
633 101376 AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
634 288 }
635
636 288 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
637 uint32_t *unused, void *opq)
638 {
639 int i;
640
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
641 101376 AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
642 288 }
643
644 558 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
645 uint32_t *unused, void *opq)
646 {
647 int i;
648
2/2
✓ Branch 0 taken 135936 times.
✓ Branch 1 taken 558 times.
136494 for (i = 0; i < width; i++)
649 135936 AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
650 558 }
651
652 288 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
653 uint32_t *unused, void *opq)
654 {
655 int i;
656
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
657 101376 AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
658 288 }
659
660 288 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
661 uint32_t *unused2, void *opq)
662 {
663 int i;
664
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
665 101376 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
666 288 }
667
668
669 288 static void read_ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
670 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
671 {
672 int i;
673
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++) {
674 101376 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4));
675 101376 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6));
676 }
677 288 }
678
679 288 static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
680 uint32_t *unused2, void *opq)
681 {
682 int i;
683
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
684 101376 AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
685 288 }
686
687 576 static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
688 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
689 {
690 int i;
691
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++) {
692 202752 dstU[i] = src[i * 4 + 1];
693 202752 dstV[i] = src[i * 4];
694 }
695 576 }
696
697 576 static void read_vuyx_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
698 uint32_t *unused2, void *opq)
699 {
700 int i;
701
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
702 202752 dst[i] = src[i * 4 + 2];
703 576 }
704
705 288 static void read_vuya_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
706 uint32_t *unused2, void *opq)
707 {
708 int i;
709
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
710 101376 dst[i] = src[i * 4 + 3];
711 288 }
712
713 288 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
714 uint32_t *unused2, void *opq)
715 {
716 int i;
717
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
718 101376 AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
719 288 }
720
721
722 288 static void read_xv30le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
723 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
724 {
725 int i;
726
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++) {
727 101376 AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
728 101376 AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
729 }
730 288 }
731
732 288 static void read_xv36le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
733 uint32_t *unused2, void *opq)
734 {
735 int i;
736
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++)
737 101376 AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
738 288 }
739
740
741 288 static void read_xv36le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
742 const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
743 {
744 int i;
745
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 288 times.
101664 for (i = 0; i < width; i++) {
746 101376 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
747 101376 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
748 }
749 288 }
750
751 /* This is almost identical to the previous, end exists only because
752 * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
753 576 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
754 uint32_t *unused, void *opq)
755 {
756 int i;
757
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; i++)
758 202752 dst[i] = src[2 * i + 1];
759 576 }
760
761 288 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
762 const uint8_t *src2, int width, uint32_t *unused, void *opq)
763 {
764 int i;
765
2/2
✓ Branch 0 taken 50688 times.
✓ Branch 1 taken 288 times.
50976 for (i = 0; i < width; i++) {
766 50688 dstU[i] = src1[4 * i + 0];
767 50688 dstV[i] = src1[4 * i + 2];
768 }
769 av_assert1(src1 == src2);
770 288 }
771
772 1152 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
773 const uint8_t *src, int width)
774 {
775 int i;
776
2/2
✓ Branch 0 taken 304128 times.
✓ Branch 1 taken 1152 times.
305280 for (i = 0; i < width; i++) {
777 304128 dst1[i] = src[2 * i + 0];
778 304128 dst2[i] = src[2 * i + 1];
779 }
780 1152 }
781
782 720 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
783 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
784 int width, uint32_t *unused, void *opq)
785 {
786 720 nvXXtoUV_c(dstU, dstV, src1, width);
787 720 }
788
789 432 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
790 const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
791 int width, uint32_t *unused, void *opq)
792 {
793 432 nvXXtoUV_c(dstV, dstU, src1, width);
794 432 }
795
796 #define p01x_uv_wrapper(bits, shift) \
797 static void p0 ## bits ## LEToUV_c(uint8_t *dstU, uint8_t *dstV, \
798 const uint8_t *unused0, \
799 const uint8_t *src1, \
800 const uint8_t *src2, int width, \
801 uint32_t *unused, void *opq) \
802 { \
803 int i; \
804 for (i = 0; i < width; i++) { \
805 AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> shift); \
806 AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> shift); \
807 } \
808 } \
809 \
810 static void p0 ## bits ## BEToUV_c(uint8_t *dstU, uint8_t *dstV, \
811 const uint8_t *unused0, \
812 const uint8_t *src1, \
813 const uint8_t *src2, int width, \
814 uint32_t *unused, void *opq) \
815 { \
816 int i; \
817 for (i = 0; i < width; i++) { \
818 AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> shift); \
819 AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> shift); \
820 } \
821 }
822
823 #define p01x_wrapper(bits, shift) \
824 static void p0 ## bits ## LEToY_c(uint8_t *dst, const uint8_t *src, \
825 const uint8_t *unused1, \
826 const uint8_t *unused2, int width, \
827 uint32_t *unused, void *opq) \
828 { \
829 int i; \
830 for (i = 0; i < width; i++) { \
831 AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> shift); \
832 } \
833 } \
834 \
835 static void p0 ## bits ## BEToY_c(uint8_t *dst, const uint8_t *src, \
836 const uint8_t *unused1, \
837 const uint8_t *unused2, int width, \
838 uint32_t *unused, void *opq) \
839 { \
840 int i; \
841 for (i = 0; i < width; i++) { \
842 AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> shift); \
843 } \
844 } \
845 p01x_uv_wrapper(bits, shift)
846
847
2/2
✓ Branch 0 taken 963072 times.
✓ Branch 1 taken 3168 times.
1932480 p01x_wrapper(10, 6)
848
2/2
✓ Branch 0 taken 963072 times.
✓ Branch 1 taken 3168 times.
1932480 p01x_wrapper(12, 4)
849
2/2
✓ Branch 0 taken 354816 times.
✓ Branch 1 taken 1440 times.
712512 p01x_uv_wrapper(16, 0)
850
851 225407 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
852 int width, uint32_t *rgb2yuv, void *opq)
853 {
854 225407 int16_t *dst = (int16_t *)_dst;
855 225407 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
856 int i;
857
2/2
✓ Branch 0 taken 76645448 times.
✓ Branch 1 taken 225407 times.
76870855 for (i = 0; i < width; i++) {
858 76645448 int b = src[i * 3 + 0];
859 76645448 int g = src[i * 3 + 1];
860 76645448 int r = src[i * 3 + 2];
861
862 76645448 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
863 }
864 225407 }
865
866 588 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
867 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
868 {
869 588 int16_t *dstU = (int16_t *)_dstU;
870 588 int16_t *dstV = (int16_t *)_dstV;
871 588 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
872 588 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
873 int i;
874
2/2
✓ Branch 0 taken 212160 times.
✓ Branch 1 taken 588 times.
212748 for (i = 0; i < width; i++) {
875 212160 int b = src1[3 * i + 0];
876 212160 int g = src1[3 * i + 1];
877 212160 int r = src1[3 * i + 2];
878
879 212160 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
880 212160 dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
881 }
882 av_assert1(src1 == src2);
883 588 }
884
885 224844 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
886 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
887 {
888 224844 int16_t *dstU = (int16_t *)_dstU;
889 224844 int16_t *dstV = (int16_t *)_dstV;
890 int i;
891 224844 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
892 224844 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
893
2/2
✓ Branch 0 taken 38222772 times.
✓ Branch 1 taken 224844 times.
38447616 for (i = 0; i < width; i++) {
894 38222772 int b = src1[6 * i + 0] + src1[6 * i + 3];
895 38222772 int g = src1[6 * i + 1] + src1[6 * i + 4];
896 38222772 int r = src1[6 * i + 2] + src1[6 * i + 5];
897
898 38222772 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
899 38222772 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
900 }
901 av_assert1(src1 == src2);
902 224844 }
903
904 293866 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
905 uint32_t *rgb2yuv, void *opq)
906 {
907 293866 int16_t *dst = (int16_t *)_dst;
908 293866 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
909 int i;
910
2/2
✓ Branch 0 taken 91811292 times.
✓ Branch 1 taken 293866 times.
92105158 for (i = 0; i < width; i++) {
911 91811292 int r = src[i * 3 + 0];
912 91811292 int g = src[i * 3 + 1];
913 91811292 int b = src[i * 3 + 2];
914
915 91811292 dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
916 }
917 293866 }
918
919 1207 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
920 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
921 {
922 1207 int16_t *dstU = (int16_t *)_dstU;
923 1207 int16_t *dstV = (int16_t *)_dstV;
924 int i;
925 1207 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
926 1207 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
927 av_assert1(src1 == src2);
928
2/2
✓ Branch 0 taken 293844 times.
✓ Branch 1 taken 1207 times.
295051 for (i = 0; i < width; i++) {
929 293844 int r = src1[3 * i + 0];
930 293844 int g = src1[3 * i + 1];
931 293844 int b = src1[3 * i + 2];
932
933 293844 dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
934 293844 dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
935 }
936 1207 }
937
938 297270 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
939 const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
940 {
941 297270 int16_t *dstU = (int16_t *)_dstU;
942 297270 int16_t *dstV = (int16_t *)_dstV;
943 int i;
944 297270 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
945 297270 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
946 av_assert1(src1 == src2);
947
2/2
✓ Branch 0 taken 46025508 times.
✓ Branch 1 taken 297270 times.
46322778 for (i = 0; i < width; i++) {
948 46025508 int r = src1[6 * i + 0] + src1[6 * i + 3];
949 46025508 int g = src1[6 * i + 1] + src1[6 * i + 4];
950 46025508 int b = src1[6 * i + 2] + src1[6 * i + 5];
951
952 46025508 dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
953 46025508 dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
954 }
955 297270 }
956
957 1632 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
958 {
959 1632 uint16_t *dst = (uint16_t *)_dst;
960 1632 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
961 int i;
962
2/2
✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 1632 times.
284256 for (i = 0; i < width; i++) {
963 282624 int g = src[0][i];
964 282624 int b = src[1][i];
965 282624 int r = src[2][i];
966
967 282624 dst[i] = (ry*r + gy*g + by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
968 }
969 1632 }
970
971 561 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused, void *opq)
972 {
973 561 uint16_t *dst = (uint16_t *)_dst;
974 int i;
975
2/2
✓ Branch 0 taken 122952 times.
✓ Branch 1 taken 561 times.
123513 for (i = 0; i < width; i++)
976 122952 dst[i] = src[3][i] << 6;
977 561 }
978
979 1632 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
980 {
981 1632 uint16_t *dstU = (uint16_t *)_dstU;
982 1632 uint16_t *dstV = (uint16_t *)_dstV;
983 1632 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
984 1632 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
985 int i;
986
2/2
✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 1632 times.
284256 for (i = 0; i < width; i++) {
987 282624 int g = src[0][i];
988 282624 int b = src[1][i];
989 282624 int r = src[2][i];
990
991 282624 dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
992 282624 dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
993 }
994 1632 }
995
996 #define rdpx(src) \
997 (is_be ? AV_RB16(src) : AV_RL16(src))
998 95542 static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4],
999 int width, int bpc, int is_be, int32_t *rgb2yuv)
1000 {
1001 int i;
1002 95542 const uint16_t **src = (const uint16_t **)_src;
1003 95542 uint16_t *dst = (uint16_t *)_dst;
1004 95542 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1005
2/2
✓ Branch 0 taken 49148 times.
✓ Branch 1 taken 46394 times.
95542 int shift = bpc < 16 ? bpc : 14;
1006
2/2
✓ Branch 0 taken 32439184 times.
✓ Branch 1 taken 95542 times.
32534726 for (i = 0; i < width; i++) {
1007
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 31466512 times.
32439184 int g = rdpx(src[0] + i);
1008
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 31466512 times.
32439184 int b = rdpx(src[1] + i);
1009
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 31466512 times.
32439184 int r = rdpx(src[2] + i);
1010
1011 32439184 dst[i] = (ry*r + gy*g + by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1012 }
1013 95542 }
1014
1015 2412 static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
1016 int width, int bpc, int is_be, int32_t *rgb2yuv)
1017 {
1018 int i;
1019 2412 const uint16_t **src = (const uint16_t **)_src;
1020 2412 uint16_t *dst = (uint16_t *)_dst;
1021
2/2
✓ Branch 0 taken 1800 times.
✓ Branch 1 taken 612 times.
2412 int shift = bpc < 16 ? bpc : 14;
1022
1023
2/2
✓ Branch 0 taken 830304 times.
✓ Branch 1 taken 2412 times.
832716 for (i = 0; i < width; i++) {
1024
2/2
✓ Branch 0 taken 415152 times.
✓ Branch 1 taken 415152 times.
830304 dst[i] = rdpx(src[3] + i) << (14 - shift);
1025 }
1026 2412 }
1027
1028 73092 static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
1029 const uint8_t *_src[4], int width,
1030 int bpc, int is_be, int32_t *rgb2yuv)
1031 {
1032 int i;
1033 73092 const uint16_t **src = (const uint16_t **)_src;
1034 73092 uint16_t *dstU = (uint16_t *)_dstU;
1035 73092 uint16_t *dstV = (uint16_t *)_dstV;
1036 73092 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1037 73092 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1038
2/2
✓ Branch 0 taken 49148 times.
✓ Branch 1 taken 23944 times.
73092 int shift = bpc < 16 ? bpc : 14;
1039
2/2
✓ Branch 0 taken 24807084 times.
✓ Branch 1 taken 73092 times.
24880176 for (i = 0; i < width; i++) {
1040
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 23834412 times.
24807084 int g = rdpx(src[0] + i);
1041
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 23834412 times.
24807084 int b = rdpx(src[1] + i);
1042
2/2
✓ Branch 0 taken 972672 times.
✓ Branch 1 taken 23834412 times.
24807084 int r = rdpx(src[2] + i);
1043
1044 24807084 dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1045 24807084 dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1046 }
1047 73092 }
1048 #undef rdpx
1049
1050 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
1051
1052 612 static av_always_inline void planar_rgbf32_to_a(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1053 {
1054 int i;
1055 612 const float **src = (const float **)_src;
1056 612 uint16_t *dst = (uint16_t *)_dst;
1057
1058
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 612 times.
209796 for (i = 0; i < width; i++) {
1059
2/2
✓ Branch 0 taken 104592 times.
✓ Branch 1 taken 104592 times.
209184 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[3] + i), 0.0f, 65535.0f));
1060 }
1061 612 }
1062
1063 1224 static av_always_inline void planar_rgbf32_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1064 {
1065 int i;
1066 1224 const float **src = (const float **)_src;
1067 1224 uint16_t *dstU = (uint16_t *)_dstU;
1068 1224 uint16_t *dstV = (uint16_t *)_dstV;
1069 1224 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1070 1224 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1071
1072
2/2
✓ Branch 0 taken 418368 times.
✓ Branch 1 taken 1224 times.
419592 for (i = 0; i < width; i++) {
1073
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1074
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1075
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1076
1077 418368 dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1078 418368 dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1079 }
1080 1224 }
1081
1082 1224 static av_always_inline void planar_rgbf32_to_y(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1083 {
1084 int i;
1085 1224 const float **src = (const float **)_src;
1086 1224 uint16_t *dst = (uint16_t *)_dst;
1087
1088 1224 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1089
1090
2/2
✓ Branch 0 taken 418368 times.
✓ Branch 1 taken 1224 times.
419592 for (i = 0; i < width; i++) {
1091
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1092
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1093
2/2
✓ Branch 0 taken 209184 times.
✓ Branch 1 taken 209184 times.
418368 int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1094
1095 418368 dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1096 }
1097 1224 }
1098
1099 576 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1100 const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1101 {
1102 int i;
1103 576 const float *src = (const float *)_src;
1104 576 uint16_t *dst = (uint16_t *)_dst;
1105
1106
2/2
✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 576 times.
203328 for (i = 0; i < width; ++i){
1107
2/2
✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 101376 times.
202752 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i), 0.0f, 65535.0f));
1108 }
1109 576 }
1110
1111 #undef rdpx
1112
1113 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1114 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1115 int w, int32_t *rgb2yuv, void *opq) \
1116 { \
1117 planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1118 } \
1119 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1120 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1121 void *opq) \
1122 { \
1123 planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1124 } \
1125
1126 #define rgb9plus_planar_transparency_funcs(nbits) \
1127 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1128 int w, int32_t *rgb2yuv, \
1129 void *opq) \
1130 { \
1131 planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1132 } \
1133 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1134 int w, int32_t *rgb2yuv, \
1135 void *opq) \
1136 { \
1137 planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1138 }
1139
1140 #define rgb9plus_planar_funcs(nbits) \
1141 rgb9plus_planar_funcs_endian(nbits, le, 0) \
1142 rgb9plus_planar_funcs_endian(nbits, be, 1)
1143
1144 2448 rgb9plus_planar_funcs(9)
1145 184496 rgb9plus_planar_funcs(10)
1146 4896 rgb9plus_planar_funcs(12)
1147 4752 rgb9plus_planar_funcs(14)
1148 140676 rgb9plus_planar_funcs(16)
1149
1150 1224 rgb9plus_planar_transparency_funcs(10)
1151 1224 rgb9plus_planar_transparency_funcs(12)
1152 1152 rgb9plus_planar_transparency_funcs(14)
1153 1224 rgb9plus_planar_transparency_funcs(16)
1154
1155 #define rgbf32_planar_funcs_endian(endian_name, endian) \
1156 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1157 int w, int32_t *rgb2yuv, void *opq) \
1158 { \
1159 planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1160 } \
1161 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1162 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1163 void *opq) \
1164 { \
1165 planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1166 } \
1167 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1168 int w, int32_t *rgb2yuv, void *opq) \
1169 { \
1170 planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1171 } \
1172 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1173 const uint8_t *unused1, const uint8_t *unused2, \
1174 int width, uint32_t *unused, void *opq) \
1175 { \
1176 grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1177 }
1178
1179 3636 rgbf32_planar_funcs_endian(le, 0)
1180 3636 rgbf32_planar_funcs_endian(be, 1)
1181
1182 #define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : AV_RL16(&src), h2f_tbl))
1183
1184 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1185 const uint16_t *src, int width,
1186 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1187 {
1188 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1189 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1190 int i;
1191 for (i = 0; i < width; i++) {
1192 int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) +
1193 lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1;
1194 int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) +
1195 lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1;
1196 int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) +
1197 lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1;
1198
1199 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1200 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1201 }
1202 }
1203
1204 static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1205 const uint16_t *src, int width,
1206 int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1207 {
1208 int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1209 int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1210 int i;
1211 for (i = 0; i < width; i++) {
1212 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1213 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1214 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1215
1216 dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1217 dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1218 }
1219 }
1220
1221 static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1222 int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1223 {
1224 int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1225 int i;
1226 for (i = 0; i < width; i++) {
1227 int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1228 int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1229 int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1230
1231 dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1232 }
1233 }
1234
1235 static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be,
1236 int width, Half2FloatTables *h2f_tbl)
1237 {
1238 int i;
1239 for (i=0; i<width; i++) {
1240 dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[i*4+3]), 0.0f, 65535.0f));
1241 }
1242 }
1243
1244 #undef rdpx
1245
1246 #define rgbaf16_funcs_endian(endian_name, endian) \
1247 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1248 const uint8_t *src1, const uint8_t *src2, \
1249 int width, uint32_t *_rgb2yuv, void *opq) \
1250 { \
1251 const uint16_t *src = (const uint16_t*)src1; \
1252 uint16_t *dstU = (uint16_t*)_dstU; \
1253 uint16_t *dstV = (uint16_t*)_dstV; \
1254 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1255 av_assert1(src1==src2); \
1256 rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1257 } \
1258 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1259 const uint8_t *src1, const uint8_t *src2, \
1260 int width, uint32_t *_rgb2yuv, void *opq) \
1261 { \
1262 const uint16_t *src = (const uint16_t*)src1; \
1263 uint16_t *dstU = (uint16_t*)_dstU; \
1264 uint16_t *dstV = (uint16_t*)_dstV; \
1265 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1266 av_assert1(src1==src2); \
1267 rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1268 } \
1269 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1270 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1271 { \
1272 const uint16_t *src = (const uint16_t*)_src; \
1273 uint16_t *dst = (uint16_t*)_dst; \
1274 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1275 rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1276 } \
1277 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1278 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1279 { \
1280 const uint16_t *src = (const uint16_t*)_src; \
1281 uint16_t *dst = (uint16_t*)_dst; \
1282 rgbaf16ToA_endian(dst, src, endian, width, opq); \
1283 }
1284
1285 rgbaf16_funcs_endian(le, 0)
1286 rgbaf16_funcs_endian(be, 1)
1287
1288 17327 av_cold void ff_sws_init_input_funcs(SwsContext *c)
1289 {
1290 17327 enum AVPixelFormat srcFormat = c->srcFormat;
1291
1292 17327 c->chrToYV12 = NULL;
1293
33/33
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 29 times.
✓ Branch 6 taken 158 times.
✓ Branch 7 taken 398 times.
✓ Branch 8 taken 394 times.
✓ Branch 9 taken 159 times.
✓ Branch 10 taken 398 times.
✓ Branch 11 taken 422 times.
✓ Branch 12 taken 157 times.
✓ Branch 13 taken 392 times.
✓ Branch 14 taken 392 times.
✓ Branch 15 taken 158 times.
✓ Branch 16 taken 410 times.
✓ Branch 17 taken 392 times.
✓ Branch 18 taken 430 times.
✓ Branch 19 taken 28 times.
✓ Branch 20 taken 2 times.
✓ Branch 21 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 23 taken 1 times.
✓ Branch 24 taken 3 times.
✓ Branch 25 taken 3 times.
✓ Branch 26 taken 3 times.
✓ Branch 27 taken 3 times.
✓ Branch 28 taken 3 times.
✓ Branch 29 taken 3 times.
✓ Branch 30 taken 1 times.
✓ Branch 31 taken 1 times.
✓ Branch 32 taken 12976 times.
17327 switch (srcFormat) {
1294 2 case AV_PIX_FMT_YUYV422:
1295 2 c->chrToYV12 = yuy2ToUV_c;
1296 2 break;
1297 1 case AV_PIX_FMT_YVYU422:
1298 1 c->chrToYV12 = yvy2ToUV_c;
1299 1 break;
1300 1 case AV_PIX_FMT_UYVY422:
1301 1 c->chrToYV12 = uyvyToUV_c;
1302 1 break;
1303 3 case AV_PIX_FMT_NV12:
1304 case AV_PIX_FMT_NV16:
1305 case AV_PIX_FMT_NV24:
1306 3 c->chrToYV12 = nv12ToUV_c;
1307 3 break;
1308 2 case AV_PIX_FMT_NV21:
1309 case AV_PIX_FMT_NV42:
1310 2 c->chrToYV12 = nv21ToUV_c;
1311 2 break;
1312 29 case AV_PIX_FMT_RGB8:
1313 case AV_PIX_FMT_BGR8:
1314 case AV_PIX_FMT_PAL8:
1315 case AV_PIX_FMT_BGR4_BYTE:
1316 case AV_PIX_FMT_RGB4_BYTE:
1317 29 c->chrToYV12 = palToUV_c;
1318 29 break;
1319 158 case AV_PIX_FMT_GBRP9LE:
1320 158 c->readChrPlanar = planar_rgb9le_to_uv;
1321 158 break;
1322 398 case AV_PIX_FMT_GBRAP10LE:
1323 case AV_PIX_FMT_GBRP10LE:
1324 398 c->readChrPlanar = planar_rgb10le_to_uv;
1325 398 break;
1326 394 case AV_PIX_FMT_GBRAP12LE:
1327 case AV_PIX_FMT_GBRP12LE:
1328 394 c->readChrPlanar = planar_rgb12le_to_uv;
1329 394 break;
1330 159 case AV_PIX_FMT_GBRAP14LE:
1331 case AV_PIX_FMT_GBRP14LE:
1332 159 c->readChrPlanar = planar_rgb14le_to_uv;
1333 159 break;
1334 398 case AV_PIX_FMT_GBRAP16LE:
1335 case AV_PIX_FMT_GBRP16LE:
1336 398 c->readChrPlanar = planar_rgb16le_to_uv;
1337 398 break;
1338 422 case AV_PIX_FMT_GBRAPF32LE:
1339 case AV_PIX_FMT_GBRPF32LE:
1340 422 c->readChrPlanar = planar_rgbf32le_to_uv;
1341 422 break;
1342 157 case AV_PIX_FMT_GBRP9BE:
1343 157 c->readChrPlanar = planar_rgb9be_to_uv;
1344 157 break;
1345 392 case AV_PIX_FMT_GBRAP10BE:
1346 case AV_PIX_FMT_GBRP10BE:
1347 392 c->readChrPlanar = planar_rgb10be_to_uv;
1348 392 break;
1349 392 case AV_PIX_FMT_GBRAP12BE:
1350 case AV_PIX_FMT_GBRP12BE:
1351 392 c->readChrPlanar = planar_rgb12be_to_uv;
1352 392 break;
1353 158 case AV_PIX_FMT_GBRAP14BE:
1354 case AV_PIX_FMT_GBRP14BE:
1355 158 c->readChrPlanar = planar_rgb14be_to_uv;
1356 158 break;
1357 410 case AV_PIX_FMT_GBRAP16BE:
1358 case AV_PIX_FMT_GBRP16BE:
1359 410 c->readChrPlanar = planar_rgb16be_to_uv;
1360 410 break;
1361 392 case AV_PIX_FMT_GBRAPF32BE:
1362 case AV_PIX_FMT_GBRPF32BE:
1363 392 c->readChrPlanar = planar_rgbf32be_to_uv;
1364 392 break;
1365 430 case AV_PIX_FMT_GBRAP:
1366 case AV_PIX_FMT_GBRP:
1367 430 c->readChrPlanar = planar_rgb_to_uv;
1368 430 break;
1369 #if HAVE_BIGENDIAN
1370 case AV_PIX_FMT_YUV420P9LE:
1371 case AV_PIX_FMT_YUV422P9LE:
1372 case AV_PIX_FMT_YUV444P9LE:
1373 case AV_PIX_FMT_YUV420P10LE:
1374 case AV_PIX_FMT_YUV422P10LE:
1375 case AV_PIX_FMT_YUV440P10LE:
1376 case AV_PIX_FMT_YUV444P10LE:
1377 case AV_PIX_FMT_YUV420P12LE:
1378 case AV_PIX_FMT_YUV422P12LE:
1379 case AV_PIX_FMT_YUV440P12LE:
1380 case AV_PIX_FMT_YUV444P12LE:
1381 case AV_PIX_FMT_YUV420P14LE:
1382 case AV_PIX_FMT_YUV422P14LE:
1383 case AV_PIX_FMT_YUV444P14LE:
1384 case AV_PIX_FMT_YUV420P16LE:
1385 case AV_PIX_FMT_YUV422P16LE:
1386 case AV_PIX_FMT_YUV444P16LE:
1387
1388 case AV_PIX_FMT_YUVA420P9LE:
1389 case AV_PIX_FMT_YUVA422P9LE:
1390 case AV_PIX_FMT_YUVA444P9LE:
1391 case AV_PIX_FMT_YUVA420P10LE:
1392 case AV_PIX_FMT_YUVA422P10LE:
1393 case AV_PIX_FMT_YUVA444P10LE:
1394 case AV_PIX_FMT_YUVA422P12LE:
1395 case AV_PIX_FMT_YUVA444P12LE:
1396 case AV_PIX_FMT_YUVA420P16LE:
1397 case AV_PIX_FMT_YUVA422P16LE:
1398 case AV_PIX_FMT_YUVA444P16LE:
1399 c->chrToYV12 = bswap16UV_c;
1400 break;
1401 #else
1402 28 case AV_PIX_FMT_YUV420P9BE:
1403 case AV_PIX_FMT_YUV422P9BE:
1404 case AV_PIX_FMT_YUV444P9BE:
1405 case AV_PIX_FMT_YUV420P10BE:
1406 case AV_PIX_FMT_YUV422P10BE:
1407 case AV_PIX_FMT_YUV440P10BE:
1408 case AV_PIX_FMT_YUV444P10BE:
1409 case AV_PIX_FMT_YUV420P12BE:
1410 case AV_PIX_FMT_YUV422P12BE:
1411 case AV_PIX_FMT_YUV440P12BE:
1412 case AV_PIX_FMT_YUV444P12BE:
1413 case AV_PIX_FMT_YUV420P14BE:
1414 case AV_PIX_FMT_YUV422P14BE:
1415 case AV_PIX_FMT_YUV444P14BE:
1416 case AV_PIX_FMT_YUV420P16BE:
1417 case AV_PIX_FMT_YUV422P16BE:
1418 case AV_PIX_FMT_YUV444P16BE:
1419
1420 case AV_PIX_FMT_YUVA420P9BE:
1421 case AV_PIX_FMT_YUVA422P9BE:
1422 case AV_PIX_FMT_YUVA444P9BE:
1423 case AV_PIX_FMT_YUVA420P10BE:
1424 case AV_PIX_FMT_YUVA422P10BE:
1425 case AV_PIX_FMT_YUVA444P10BE:
1426 case AV_PIX_FMT_YUVA422P12BE:
1427 case AV_PIX_FMT_YUVA444P12BE:
1428 case AV_PIX_FMT_YUVA420P16BE:
1429 case AV_PIX_FMT_YUVA422P16BE:
1430 case AV_PIX_FMT_YUVA444P16BE:
1431 28 c->chrToYV12 = bswap16UV_c;
1432 28 break;
1433 #endif
1434 2 case AV_PIX_FMT_VUYA:
1435 case AV_PIX_FMT_VUYX:
1436 2 c->chrToYV12 = read_vuyx_UV_c;
1437 2 break;
1438 1 case AV_PIX_FMT_XV30LE:
1439 1 c->chrToYV12 = read_xv30le_UV_c;
1440 1 break;
1441 1 case AV_PIX_FMT_AYUV64LE:
1442 1 c->chrToYV12 = read_ayuv64le_UV_c;
1443 1 break;
1444 1 case AV_PIX_FMT_XV36LE:
1445 1 c->chrToYV12 = read_xv36le_UV_c;
1446 1 break;
1447 3 case AV_PIX_FMT_P010LE:
1448 case AV_PIX_FMT_P210LE:
1449 case AV_PIX_FMT_P410LE:
1450 3 c->chrToYV12 = p010LEToUV_c;
1451 3 break;
1452 3 case AV_PIX_FMT_P010BE:
1453 case AV_PIX_FMT_P210BE:
1454 case AV_PIX_FMT_P410BE:
1455 3 c->chrToYV12 = p010BEToUV_c;
1456 3 break;
1457 3 case AV_PIX_FMT_P012LE:
1458 case AV_PIX_FMT_P212LE:
1459 case AV_PIX_FMT_P412LE:
1460 3 c->chrToYV12 = p012LEToUV_c;
1461 3 break;
1462 3 case AV_PIX_FMT_P012BE:
1463 case AV_PIX_FMT_P212BE:
1464 case AV_PIX_FMT_P412BE:
1465 3 c->chrToYV12 = p012BEToUV_c;
1466 3 break;
1467 3 case AV_PIX_FMT_P016LE:
1468 case AV_PIX_FMT_P216LE:
1469 case AV_PIX_FMT_P416LE:
1470 3 c->chrToYV12 = p016LEToUV_c;
1471 3 break;
1472 3 case AV_PIX_FMT_P016BE:
1473 case AV_PIX_FMT_P216BE:
1474 case AV_PIX_FMT_P416BE:
1475 3 c->chrToYV12 = p016BEToUV_c;
1476 3 break;
1477 1 case AV_PIX_FMT_Y210LE:
1478 1 c->chrToYV12 = y210le_UV_c;
1479 1 break;
1480 1 case AV_PIX_FMT_Y212LE:
1481 1 c->chrToYV12 = y212le_UV_c;
1482 1 break;
1483 }
1484
2/2
✓ Branch 0 taken 16391 times.
✓ Branch 1 taken 936 times.
17327 if (c->chrSrcHSubSample) {
1485
23/32
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 57 times.
✓ Branch 9 taken 26 times.
✓ Branch 10 taken 55 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 390 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 18 taken 62 times.
✓ Branch 19 taken 35 times.
✓ Branch 20 taken 120 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 taken 1 times.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✓ Branch 31 taken 15609 times.
16391 switch (srcFormat) {
1486 case AV_PIX_FMT_RGBA64BE:
1487 c->chrToYV12 = rgb64BEToUV_half_c;
1488 break;
1489 case AV_PIX_FMT_RGBA64LE:
1490 c->chrToYV12 = rgb64LEToUV_half_c;
1491 break;
1492 case AV_PIX_FMT_BGRA64BE:
1493 c->chrToYV12 = bgr64BEToUV_half_c;
1494 break;
1495 case AV_PIX_FMT_BGRA64LE:
1496 c->chrToYV12 = bgr64LEToUV_half_c;
1497 break;
1498 case AV_PIX_FMT_RGB48BE:
1499 c->chrToYV12 = rgb48BEToUV_half_c;
1500 break;
1501 4 case AV_PIX_FMT_RGB48LE:
1502 4 c->chrToYV12 = rgb48LEToUV_half_c;
1503 4 break;
1504 case AV_PIX_FMT_BGR48BE:
1505 c->chrToYV12 = bgr48BEToUV_half_c;
1506 break;
1507 case AV_PIX_FMT_BGR48LE:
1508 c->chrToYV12 = bgr48LEToUV_half_c;
1509 break;
1510 57 case AV_PIX_FMT_RGB32:
1511 57 c->chrToYV12 = bgr32ToUV_half_c;
1512 57 break;
1513 26 case AV_PIX_FMT_RGB32_1:
1514 26 c->chrToYV12 = bgr321ToUV_half_c;
1515 26 break;
1516 55 case AV_PIX_FMT_BGR24:
1517 55 c->chrToYV12 = bgr24ToUV_half_c;
1518 55 break;
1519 1 case AV_PIX_FMT_BGR565LE:
1520 1 c->chrToYV12 = bgr16leToUV_half_c;
1521 1 break;
1522 1 case AV_PIX_FMT_BGR565BE:
1523 1 c->chrToYV12 = bgr16beToUV_half_c;
1524 1 break;
1525 1 case AV_PIX_FMT_BGR555LE:
1526 1 c->chrToYV12 = bgr15leToUV_half_c;
1527 1 break;
1528 1 case AV_PIX_FMT_BGR555BE:
1529 1 c->chrToYV12 = bgr15beToUV_half_c;
1530 1 break;
1531 390 case AV_PIX_FMT_GBRAP:
1532 case AV_PIX_FMT_GBRP:
1533 390 c->chrToYV12 = gbr24pToUV_half_c;
1534 390 break;
1535 1 case AV_PIX_FMT_BGR444LE:
1536 1 c->chrToYV12 = bgr12leToUV_half_c;
1537 1 break;
1538 1 case AV_PIX_FMT_BGR444BE:
1539 1 c->chrToYV12 = bgr12beToUV_half_c;
1540 1 break;
1541 62 case AV_PIX_FMT_BGR32:
1542 62 c->chrToYV12 = rgb32ToUV_half_c;
1543 62 break;
1544 35 case AV_PIX_FMT_BGR32_1:
1545 35 c->chrToYV12 = rgb321ToUV_half_c;
1546 35 break;
1547 120 case AV_PIX_FMT_RGB24:
1548 120 c->chrToYV12 = rgb24ToUV_half_c;
1549 120 break;
1550 5 case AV_PIX_FMT_RGB565LE:
1551 5 c->chrToYV12 = rgb16leToUV_half_c;
1552 5 break;
1553 1 case AV_PIX_FMT_RGB565BE:
1554 1 c->chrToYV12 = rgb16beToUV_half_c;
1555 1 break;
1556 16 case AV_PIX_FMT_RGB555LE:
1557 16 c->chrToYV12 = rgb15leToUV_half_c;
1558 16 break;
1559 1 case AV_PIX_FMT_RGB555BE:
1560 1 c->chrToYV12 = rgb15beToUV_half_c;
1561 1 break;
1562 1 case AV_PIX_FMT_RGB444LE:
1563 1 c->chrToYV12 = rgb12leToUV_half_c;
1564 1 break;
1565 1 case AV_PIX_FMT_RGB444BE:
1566 1 c->chrToYV12 = rgb12beToUV_half_c;
1567 1 break;
1568 1 case AV_PIX_FMT_X2RGB10LE:
1569 1 c->chrToYV12 = rgb30leToUV_half_c;
1570 1 break;
1571 1 case AV_PIX_FMT_X2BGR10LE:
1572 1 c->chrToYV12 = bgr30leToUV_half_c;
1573 1 break;
1574 case AV_PIX_FMT_RGBAF16BE:
1575 c->chrToYV12 = rgbaf16beToUV_half_c;
1576 break;
1577 case AV_PIX_FMT_RGBAF16LE:
1578 c->chrToYV12 = rgbaf16leToUV_half_c;
1579 break;
1580 }
1581 } else {
1582
17/31
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 11 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 123 times.
✓ Branch 9 taken 17 times.
✓ Branch 10 taken 16 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 107 times.
✓ Branch 18 taken 17 times.
✓ Branch 19 taken 44 times.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 30 taken 577 times.
936 switch (srcFormat) {
1583 10 case AV_PIX_FMT_RGBA64BE:
1584 10 c->chrToYV12 = rgb64BEToUV_c;
1585 10 break;
1586 2 case AV_PIX_FMT_RGBA64LE:
1587 2 c->chrToYV12 = rgb64LEToUV_c;
1588 2 break;
1589 1 case AV_PIX_FMT_BGRA64BE:
1590 1 c->chrToYV12 = bgr64BEToUV_c;
1591 1 break;
1592 2 case AV_PIX_FMT_BGRA64LE:
1593 2 c->chrToYV12 = bgr64LEToUV_c;
1594 2 break;
1595 11 case AV_PIX_FMT_RGB48BE:
1596 11 c->chrToYV12 = rgb48BEToUV_c;
1597 11 break;
1598 4 case AV_PIX_FMT_RGB48LE:
1599 4 c->chrToYV12 = rgb48LEToUV_c;
1600 4 break;
1601 1 case AV_PIX_FMT_BGR48BE:
1602 1 c->chrToYV12 = bgr48BEToUV_c;
1603 1 break;
1604 2 case AV_PIX_FMT_BGR48LE:
1605 2 c->chrToYV12 = bgr48LEToUV_c;
1606 2 break;
1607 123 case AV_PIX_FMT_RGB32:
1608 123 c->chrToYV12 = bgr32ToUV_c;
1609 123 break;
1610 17 case AV_PIX_FMT_RGB32_1:
1611 17 c->chrToYV12 = bgr321ToUV_c;
1612 17 break;
1613 16 case AV_PIX_FMT_BGR24:
1614 16 c->chrToYV12 = bgr24ToUV_c;
1615 16 break;
1616 case AV_PIX_FMT_BGR565LE:
1617 c->chrToYV12 = bgr16leToUV_c;
1618 break;
1619 case AV_PIX_FMT_BGR565BE:
1620 c->chrToYV12 = bgr16beToUV_c;
1621 break;
1622 case AV_PIX_FMT_BGR555LE:
1623 c->chrToYV12 = bgr15leToUV_c;
1624 break;
1625 case AV_PIX_FMT_BGR555BE:
1626 c->chrToYV12 = bgr15beToUV_c;
1627 break;
1628 case AV_PIX_FMT_BGR444LE:
1629 c->chrToYV12 = bgr12leToUV_c;
1630 break;
1631 case AV_PIX_FMT_BGR444BE:
1632 c->chrToYV12 = bgr12beToUV_c;
1633 break;
1634 107 case AV_PIX_FMT_BGR32:
1635 107 c->chrToYV12 = rgb32ToUV_c;
1636 107 break;
1637 17 case AV_PIX_FMT_BGR32_1:
1638 17 c->chrToYV12 = rgb321ToUV_c;
1639 17 break;
1640 44 case AV_PIX_FMT_RGB24:
1641 44 c->chrToYV12 = rgb24ToUV_c;
1642 44 break;
1643 1 case AV_PIX_FMT_RGB565LE:
1644 1 c->chrToYV12 = rgb16leToUV_c;
1645 1 break;
1646 case AV_PIX_FMT_RGB565BE:
1647 c->chrToYV12 = rgb16beToUV_c;
1648 break;
1649 1 case AV_PIX_FMT_RGB555LE:
1650 1 c->chrToYV12 = rgb15leToUV_c;
1651 1 break;
1652 case AV_PIX_FMT_RGB555BE:
1653 c->chrToYV12 = rgb15beToUV_c;
1654 break;
1655 case AV_PIX_FMT_RGB444LE:
1656 c->chrToYV12 = rgb12leToUV_c;
1657 break;
1658 case AV_PIX_FMT_RGB444BE:
1659 c->chrToYV12 = rgb12beToUV_c;
1660 break;
1661 case AV_PIX_FMT_X2RGB10LE:
1662 c->chrToYV12 = rgb30leToUV_c;
1663 break;
1664 case AV_PIX_FMT_X2BGR10LE:
1665 c->chrToYV12 = bgr30leToUV_c;
1666 break;
1667 case AV_PIX_FMT_RGBAF16BE:
1668 c->chrToYV12 = rgbaf16beToUV_c;
1669 break;
1670 case AV_PIX_FMT_RGBAF16LE:
1671 c->chrToYV12 = rgbaf16leToUV_c;
1672 break;
1673 }
1674 }
1675
1676 17327 c->lumToYV12 = NULL;
1677 17327 c->alpToYV12 = NULL;
1678
74/76
✓ Branch 0 taken 158 times.
✓ Branch 1 taken 236 times.
✓ Branch 2 taken 162 times.
✓ Branch 3 taken 236 times.
✓ Branch 4 taken 158 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 158 times.
✓ Branch 7 taken 236 times.
✓ Branch 8 taken 162 times.
✓ Branch 9 taken 235 times.
✓ Branch 10 taken 187 times.
✓ Branch 11 taken 157 times.
✓ Branch 12 taken 235 times.
✓ Branch 13 taken 157 times.
✓ Branch 14 taken 235 times.
✓ Branch 15 taken 157 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 157 times.
✓ Branch 18 taken 244 times.
✓ Branch 19 taken 166 times.
✓ Branch 20 taken 235 times.
✓ Branch 21 taken 157 times.
✓ Branch 22 taken 272 times.
✓ Branch 23 taken 158 times.
✓ Branch 24 taken 70 times.
✓ Branch 25 taken 11 times.
✓ Branch 26 taken 1 times.
✓ Branch 27 taken 46 times.
✓ Branch 28 taken 2 times.
✓ Branch 29 taken 1 times.
✓ Branch 30 taken 1 times.
✓ Branch 31 taken 1 times.
✓ Branch 32 taken 49 times.
✓ Branch 33 taken 1 times.
✓ Branch 34 taken 71 times.
✓ Branch 35 taken 1 times.
✓ Branch 36 taken 1 times.
✓ Branch 37 taken 1 times.
✓ Branch 38 taken 1 times.
✓ Branch 39 taken 1 times.
✓ Branch 40 taken 1 times.
✓ Branch 41 taken 164 times.
✓ Branch 42 taken 6 times.
✓ Branch 43 taken 1 times.
✓ Branch 44 taken 17 times.
✓ Branch 45 taken 1 times.
✓ Branch 46 taken 1 times.
✓ Branch 47 taken 1 times.
✓ Branch 48 taken 29 times.
✓ Branch 49 taken 2 times.
✓ Branch 50 taken 6 times.
✓ Branch 51 taken 180 times.
✓ Branch 52 taken 43 times.
✓ Branch 53 taken 169 times.
✓ Branch 54 taken 52 times.
✓ Branch 55 taken 11 times.
✓ Branch 56 taken 8 times.
✓ Branch 57 taken 1 times.
✓ Branch 58 taken 2 times.
✓ Branch 59 taken 10 times.
✓ Branch 60 taken 2 times.
✓ Branch 61 taken 1 times.
✓ Branch 62 taken 2 times.
✓ Branch 63 taken 3 times.
✓ Branch 64 taken 3 times.
✓ Branch 65 taken 3 times.
✓ Branch 66 taken 3 times.
✓ Branch 67 taken 1 times.
✓ Branch 68 taken 1 times.
✓ Branch 69 taken 1 times.
✓ Branch 70 taken 1 times.
✓ Branch 71 taken 1 times.
✓ Branch 72 taken 1 times.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✓ Branch 75 taken 12080 times.
17327 switch (srcFormat) {
1679 158 case AV_PIX_FMT_GBRP9LE:
1680 158 c->readLumPlanar = planar_rgb9le_to_y;
1681 158 break;
1682 236 case AV_PIX_FMT_GBRAP10LE:
1683 236 c->readAlpPlanar = planar_rgb10le_to_a;
1684 398 case AV_PIX_FMT_GBRP10LE:
1685 398 c->readLumPlanar = planar_rgb10le_to_y;
1686 398 break;
1687 236 case AV_PIX_FMT_GBRAP12LE:
1688 236 c->readAlpPlanar = planar_rgb12le_to_a;
1689 394 case AV_PIX_FMT_GBRP12LE:
1690 394 c->readLumPlanar = planar_rgb12le_to_y;
1691 394 break;
1692 1 case AV_PIX_FMT_GBRAP14LE:
1693 1 c->readAlpPlanar = planar_rgb14le_to_a;
1694 159 case AV_PIX_FMT_GBRP14LE:
1695 159 c->readLumPlanar = planar_rgb14le_to_y;
1696 159 break;
1697 236 case AV_PIX_FMT_GBRAP16LE:
1698 236 c->readAlpPlanar = planar_rgb16le_to_a;
1699 398 case AV_PIX_FMT_GBRP16LE:
1700 398 c->readLumPlanar = planar_rgb16le_to_y;
1701 398 break;
1702 235 case AV_PIX_FMT_GBRAPF32LE:
1703 235 c->readAlpPlanar = planar_rgbf32le_to_a;
1704 422 case AV_PIX_FMT_GBRPF32LE:
1705 422 c->readLumPlanar = planar_rgbf32le_to_y;
1706 422 break;
1707 157 case AV_PIX_FMT_GBRP9BE:
1708 157 c->readLumPlanar = planar_rgb9be_to_y;
1709 157 break;
1710 235 case AV_PIX_FMT_GBRAP10BE:
1711 235 c->readAlpPlanar = planar_rgb10be_to_a;
1712 392 case AV_PIX_FMT_GBRP10BE:
1713 392 c->readLumPlanar = planar_rgb10be_to_y;
1714 392 break;
1715 235 case AV_PIX_FMT_GBRAP12BE:
1716 235 c->readAlpPlanar = planar_rgb12be_to_a;
1717 392 case AV_PIX_FMT_GBRP12BE:
1718 392 c->readLumPlanar = planar_rgb12be_to_y;
1719 392 break;
1720 1 case AV_PIX_FMT_GBRAP14BE:
1721 1 c->readAlpPlanar = planar_rgb14be_to_a;
1722 158 case AV_PIX_FMT_GBRP14BE:
1723 158 c->readLumPlanar = planar_rgb14be_to_y;
1724 158 break;
1725 244 case AV_PIX_FMT_GBRAP16BE:
1726 244 c->readAlpPlanar = planar_rgb16be_to_a;
1727 410 case AV_PIX_FMT_GBRP16BE:
1728 410 c->readLumPlanar = planar_rgb16be_to_y;
1729 410 break;
1730 235 case AV_PIX_FMT_GBRAPF32BE:
1731 235 c->readAlpPlanar = planar_rgbf32be_to_a;
1732 392 case AV_PIX_FMT_GBRPF32BE:
1733 392 c->readLumPlanar = planar_rgbf32be_to_y;
1734 392 break;
1735 272 case AV_PIX_FMT_GBRAP:
1736 272 c->readAlpPlanar = planar_rgb_to_a;
1737 430 case AV_PIX_FMT_GBRP:
1738 430 c->readLumPlanar = planar_rgb_to_y;
1739 430 break;
1740 #if HAVE_BIGENDIAN
1741 case AV_PIX_FMT_YUV420P9LE:
1742 case AV_PIX_FMT_YUV422P9LE:
1743 case AV_PIX_FMT_YUV444P9LE:
1744 case AV_PIX_FMT_YUV420P10LE:
1745 case AV_PIX_FMT_YUV422P10LE:
1746 case AV_PIX_FMT_YUV440P10LE:
1747 case AV_PIX_FMT_YUV444P10LE:
1748 case AV_PIX_FMT_YUV420P12LE:
1749 case AV_PIX_FMT_YUV422P12LE:
1750 case AV_PIX_FMT_YUV440P12LE:
1751 case AV_PIX_FMT_YUV444P12LE:
1752 case AV_PIX_FMT_YUV420P14LE:
1753 case AV_PIX_FMT_YUV422P14LE:
1754 case AV_PIX_FMT_YUV444P14LE:
1755 case AV_PIX_FMT_YUV420P16LE:
1756 case AV_PIX_FMT_YUV422P16LE:
1757 case AV_PIX_FMT_YUV444P16LE:
1758
1759 case AV_PIX_FMT_GRAY9LE:
1760 case AV_PIX_FMT_GRAY10LE:
1761 case AV_PIX_FMT_GRAY12LE:
1762 case AV_PIX_FMT_GRAY14LE:
1763 case AV_PIX_FMT_GRAY16LE:
1764
1765 case AV_PIX_FMT_P016LE:
1766 case AV_PIX_FMT_P216LE:
1767 case AV_PIX_FMT_P416LE:
1768 c->lumToYV12 = bswap16Y_c;
1769 break;
1770 case AV_PIX_FMT_YUVA420P9LE:
1771 case AV_PIX_FMT_YUVA422P9LE:
1772 case AV_PIX_FMT_YUVA444P9LE:
1773 case AV_PIX_FMT_YUVA420P10LE:
1774 case AV_PIX_FMT_YUVA422P10LE:
1775 case AV_PIX_FMT_YUVA444P10LE:
1776 case AV_PIX_FMT_YUVA422P12LE:
1777 case AV_PIX_FMT_YUVA444P12LE:
1778 case AV_PIX_FMT_YUVA420P16LE:
1779 case AV_PIX_FMT_YUVA422P16LE:
1780 case AV_PIX_FMT_YUVA444P16LE:
1781 c->lumToYV12 = bswap16Y_c;
1782 c->alpToYV12 = bswap16Y_c;
1783 break;
1784 #else
1785 70 case AV_PIX_FMT_YUV420P9BE:
1786 case AV_PIX_FMT_YUV422P9BE:
1787 case AV_PIX_FMT_YUV444P9BE:
1788 case AV_PIX_FMT_YUV420P10BE:
1789 case AV_PIX_FMT_YUV422P10BE:
1790 case AV_PIX_FMT_YUV440P10BE:
1791 case AV_PIX_FMT_YUV444P10BE:
1792 case AV_PIX_FMT_YUV420P12BE:
1793 case AV_PIX_FMT_YUV422P12BE:
1794 case AV_PIX_FMT_YUV440P12BE:
1795 case AV_PIX_FMT_YUV444P12BE:
1796 case AV_PIX_FMT_YUV420P14BE:
1797 case AV_PIX_FMT_YUV422P14BE:
1798 case AV_PIX_FMT_YUV444P14BE:
1799 case AV_PIX_FMT_YUV420P16BE:
1800 case AV_PIX_FMT_YUV422P16BE:
1801 case AV_PIX_FMT_YUV444P16BE:
1802
1803 case AV_PIX_FMT_GRAY9BE:
1804 case AV_PIX_FMT_GRAY10BE:
1805 case AV_PIX_FMT_GRAY12BE:
1806 case AV_PIX_FMT_GRAY14BE:
1807 case AV_PIX_FMT_GRAY16BE:
1808
1809 case AV_PIX_FMT_P016BE:
1810 case AV_PIX_FMT_P216BE:
1811 case AV_PIX_FMT_P416BE:
1812 70 c->lumToYV12 = bswap16Y_c;
1813 70 break;
1814 11 case AV_PIX_FMT_YUVA420P9BE:
1815 case AV_PIX_FMT_YUVA422P9BE:
1816 case AV_PIX_FMT_YUVA444P9BE:
1817 case AV_PIX_FMT_YUVA420P10BE:
1818 case AV_PIX_FMT_YUVA422P10BE:
1819 case AV_PIX_FMT_YUVA444P10BE:
1820 case AV_PIX_FMT_YUVA422P12BE:
1821 case AV_PIX_FMT_YUVA444P12BE:
1822 case AV_PIX_FMT_YUVA420P16BE:
1823 case AV_PIX_FMT_YUVA422P16BE:
1824 case AV_PIX_FMT_YUVA444P16BE:
1825 11 c->lumToYV12 = bswap16Y_c;
1826 11 c->alpToYV12 = bswap16Y_c;
1827 11 break;
1828 #endif
1829 1 case AV_PIX_FMT_YA16LE:
1830 1 c->lumToYV12 = read_ya16le_gray_c;
1831 1 break;
1832 46 case AV_PIX_FMT_YA16BE:
1833 46 c->lumToYV12 = read_ya16be_gray_c;
1834 46 break;
1835 2 case AV_PIX_FMT_VUYA:
1836 case AV_PIX_FMT_VUYX:
1837 2 c->lumToYV12 = read_vuyx_Y_c;
1838 2 break;
1839 1 case AV_PIX_FMT_XV30LE:
1840 1 c->lumToYV12 = read_xv30le_Y_c;
1841 1 break;
1842 1 case AV_PIX_FMT_AYUV64LE:
1843 1 c->lumToYV12 = read_ayuv64le_Y_c;
1844 1 break;
1845 1 case AV_PIX_FMT_XV36LE:
1846 1 c->lumToYV12 = read_xv36le_Y_c;
1847 1 break;
1848 49 case AV_PIX_FMT_YUYV422:
1849 case AV_PIX_FMT_YVYU422:
1850 case AV_PIX_FMT_YA8:
1851 49 c->lumToYV12 = yuy2ToY_c;
1852 49 break;
1853 1 case AV_PIX_FMT_UYVY422:
1854 1 c->lumToYV12 = uyvyToY_c;
1855 1 break;
1856 71 case AV_PIX_FMT_BGR24:
1857 71 c->lumToYV12 = bgr24ToY_c;
1858 71 break;
1859 1 case AV_PIX_FMT_BGR565LE:
1860 1 c->lumToYV12 = bgr16leToY_c;
1861 1 break;
1862 1 case AV_PIX_FMT_BGR565BE:
1863 1 c->lumToYV12 = bgr16beToY_c;
1864 1 break;
1865 1 case AV_PIX_FMT_BGR555LE:
1866 1 c->lumToYV12 = bgr15leToY_c;
1867 1 break;
1868 1 case AV_PIX_FMT_BGR555BE:
1869 1 c->lumToYV12 = bgr15beToY_c;
1870 1 break;
1871 1 case AV_PIX_FMT_BGR444LE:
1872 1 c->lumToYV12 = bgr12leToY_c;
1873 1 break;
1874 1 case AV_PIX_FMT_BGR444BE:
1875 1 c->lumToYV12 = bgr12beToY_c;
1876 1 break;
1877 164 case AV_PIX_FMT_RGB24:
1878 164 c->lumToYV12 = rgb24ToY_c;
1879 164 break;
1880 6 case AV_PIX_FMT_RGB565LE:
1881 6 c->lumToYV12 = rgb16leToY_c;
1882 6 break;
1883 1 case AV_PIX_FMT_RGB565BE:
1884 1 c->lumToYV12 = rgb16beToY_c;
1885 1 break;
1886 17 case AV_PIX_FMT_RGB555LE:
1887 17 c->lumToYV12 = rgb15leToY_c;
1888 17 break;
1889 1 case AV_PIX_FMT_RGB555BE:
1890 1 c->lumToYV12 = rgb15beToY_c;
1891 1 break;
1892 1 case AV_PIX_FMT_RGB444LE:
1893 1 c->lumToYV12 = rgb12leToY_c;
1894 1 break;
1895 1 case AV_PIX_FMT_RGB444BE:
1896 1 c->lumToYV12 = rgb12beToY_c;
1897 1 break;
1898 29 case AV_PIX_FMT_RGB8:
1899 case AV_PIX_FMT_BGR8:
1900 case AV_PIX_FMT_PAL8:
1901 case AV_PIX_FMT_BGR4_BYTE:
1902 case AV_PIX_FMT_RGB4_BYTE:
1903 29 c->lumToYV12 = palToY_c;
1904 29 break;
1905 2 case AV_PIX_FMT_MONOBLACK:
1906 2 c->lumToYV12 = monoblack2Y_c;
1907 2 break;
1908 6 case AV_PIX_FMT_MONOWHITE:
1909 6 c->lumToYV12 = monowhite2Y_c;
1910 6 break;
1911 180 case AV_PIX_FMT_RGB32:
1912 180 c->lumToYV12 = bgr32ToY_c;
1913 180 break;
1914 43 case AV_PIX_FMT_RGB32_1:
1915 43 c->lumToYV12 = bgr321ToY_c;
1916 43 break;
1917 169 case AV_PIX_FMT_BGR32:
1918 169 c->lumToYV12 = rgb32ToY_c;
1919 169 break;
1920 52 case AV_PIX_FMT_BGR32_1:
1921 52 c->lumToYV12 = rgb321ToY_c;
1922 52 break;
1923 11 case AV_PIX_FMT_RGB48BE:
1924 11 c->lumToYV12 = rgb48BEToY_c;
1925 11 break;
1926 8 case AV_PIX_FMT_RGB48LE:
1927 8 c->lumToYV12 = rgb48LEToY_c;
1928 8 break;
1929 1 case AV_PIX_FMT_BGR48BE:
1930 1 c->lumToYV12 = bgr48BEToY_c;
1931 1 break;
1932 2 case AV_PIX_FMT_BGR48LE:
1933 2 c->lumToYV12 = bgr48LEToY_c;
1934 2 break;
1935 10 case AV_PIX_FMT_RGBA64BE:
1936 10 c->lumToYV12 = rgb64BEToY_c;
1937 10 break;
1938 2 case AV_PIX_FMT_RGBA64LE:
1939 2 c->lumToYV12 = rgb64LEToY_c;
1940 2 break;
1941 1 case AV_PIX_FMT_BGRA64BE:
1942 1 c->lumToYV12 = bgr64BEToY_c;
1943 1 break;
1944 2 case AV_PIX_FMT_BGRA64LE:
1945 2 c->lumToYV12 = bgr64LEToY_c;
1946 2 break;
1947 3 case AV_PIX_FMT_P010LE:
1948 case AV_PIX_FMT_P210LE:
1949 case AV_PIX_FMT_P410LE:
1950 3 c->lumToYV12 = p010LEToY_c;
1951 3 break;
1952 3 case AV_PIX_FMT_P010BE:
1953 case AV_PIX_FMT_P210BE:
1954 case AV_PIX_FMT_P410BE:
1955 3 c->lumToYV12 = p010BEToY_c;
1956 3 break;
1957 3 case AV_PIX_FMT_P012LE:
1958 case AV_PIX_FMT_P212LE:
1959 case AV_PIX_FMT_P412LE:
1960 3 c->lumToYV12 = p012LEToY_c;
1961 3 break;
1962 3 case AV_PIX_FMT_P012BE:
1963 case AV_PIX_FMT_P212BE:
1964 case AV_PIX_FMT_P412BE:
1965 3 c->lumToYV12 = p012BEToY_c;
1966 3 break;
1967 1 case AV_PIX_FMT_GRAYF32LE:
1968 1 c->lumToYV12 = grayf32leToY16_c;
1969 1 break;
1970 1 case AV_PIX_FMT_GRAYF32BE:
1971 1 c->lumToYV12 = grayf32beToY16_c;
1972 1 break;
1973 1 case AV_PIX_FMT_Y210LE:
1974 1 c->lumToYV12 = y210le_Y_c;
1975 1 break;
1976 1 case AV_PIX_FMT_Y212LE:
1977 1 c->lumToYV12 = y212le_Y_c;
1978 1 break;
1979 1 case AV_PIX_FMT_X2RGB10LE:
1980 1 c->lumToYV12 = rgb30leToY_c;
1981 1 break;
1982 1 case AV_PIX_FMT_X2BGR10LE:
1983 1 c->lumToYV12 = bgr30leToY_c;
1984 1 break;
1985 case AV_PIX_FMT_RGBAF16BE:
1986 c->lumToYV12 = rgbaf16beToY_c;
1987 break;
1988 case AV_PIX_FMT_RGBAF16LE:
1989 c->lumToYV12 = rgbaf16leToY_c;
1990 break;
1991 }
1992
2/2
✓ Branch 0 taken 296 times.
✓ Branch 1 taken 17031 times.
17327 if (c->needAlpha) {
1993
4/4
✓ Branch 1 taken 281 times.
✓ Branch 2 taken 15 times.
✓ Branch 4 taken 22 times.
✓ Branch 5 taken 259 times.
296 if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
1994
4/4
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 19 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 4 times.
37 if (HAVE_BIGENDIAN == !isBE(srcFormat) && !c->readAlpPlanar)
1995 14 c->alpToYV12 = bswap16Y_c;
1996 }
1997
10/13
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 229 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 45 times.
296 switch (srcFormat) {
1998 2 case AV_PIX_FMT_BGRA64LE:
1999 2 case AV_PIX_FMT_RGBA64LE: c->alpToYV12 = rgba64leToA_c; break;
2000 2 case AV_PIX_FMT_BGRA64BE:
2001 2 case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64beToA_c; break;
2002 229 case AV_PIX_FMT_BGRA:
2003 case AV_PIX_FMT_RGBA:
2004 229 c->alpToYV12 = rgbaToA_c;
2005 229 break;
2006 13 case AV_PIX_FMT_ABGR:
2007 case AV_PIX_FMT_ARGB:
2008 13 c->alpToYV12 = abgrToA_c;
2009 13 break;
2010 case AV_PIX_FMT_RGBAF16BE:
2011 c->alpToYV12 = rgbaf16beToA_c;
2012 break;
2013 case AV_PIX_FMT_RGBAF16LE:
2014 c->alpToYV12 = rgbaf16leToA_c;
2015 break;
2016 1 case AV_PIX_FMT_YA8:
2017 1 c->alpToYV12 = uyvyToY_c;
2018 1 break;
2019 1 case AV_PIX_FMT_YA16LE:
2020 1 c->alpToYV12 = read_ya16le_alpha_c;
2021 1 break;
2022 1 case AV_PIX_FMT_YA16BE:
2023 1 c->alpToYV12 = read_ya16be_alpha_c;
2024 1 break;
2025 1 case AV_PIX_FMT_VUYA:
2026 1 c->alpToYV12 = read_vuya_A_c;
2027 1 break;
2028 1 case AV_PIX_FMT_AYUV64LE:
2029 1 c->alpToYV12 = read_ayuv64le_A_c;
2030 1 break;
2031 case AV_PIX_FMT_PAL8 :
2032 c->alpToYV12 = palToA_c;
2033 break;
2034 }
2035 }
2036 17327 }
2037