FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libswscale/input.c
Date: 2025-11-30 00:22:21
Exec Total Coverage
Lines: 1205 1414 85.2%
Functions: 242 284 85.2%
Branches: 691 870 79.4%

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