| 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 | #include <string.h> | ||
| 25 | |||
| 26 | #include "libavutil/attributes.h" | ||
| 27 | #include "libavutil/avutil.h" | ||
| 28 | #include "libavutil/avassert.h" | ||
| 29 | #include "libavutil/bswap.h" | ||
| 30 | #include "libavutil/intfloat.h" | ||
| 31 | #include "libavutil/intreadwrite.h" | ||
| 32 | #include "libavutil/mathematics.h" | ||
| 33 | #include "libavutil/mem_internal.h" | ||
| 34 | #include "libavutil/pixdesc.h" | ||
| 35 | #include "config.h" | ||
| 36 | #include "rgb2rgb.h" | ||
| 37 | #include "swscale.h" | ||
| 38 | #include "swscale_internal.h" | ||
| 39 | |||
| 40 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_2x2_4)[][8] = { | ||
| 41 | { 1, 3, 1, 3, 1, 3, 1, 3, }, | ||
| 42 | { 2, 0, 2, 0, 2, 0, 2, 0, }, | ||
| 43 | { 1, 3, 1, 3, 1, 3, 1, 3, }, | ||
| 44 | }; | ||
| 45 | |||
| 46 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_2x2_8)[][8] = { | ||
| 47 | { 6, 2, 6, 2, 6, 2, 6, 2, }, | ||
| 48 | { 0, 4, 0, 4, 0, 4, 0, 4, }, | ||
| 49 | { 6, 2, 6, 2, 6, 2, 6, 2, }, | ||
| 50 | }; | ||
| 51 | |||
| 52 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_4x4_16)[][8] = { | ||
| 53 | { 8, 4, 11, 7, 8, 4, 11, 7, }, | ||
| 54 | { 2, 14, 1, 13, 2, 14, 1, 13, }, | ||
| 55 | { 10, 6, 9, 5, 10, 6, 9, 5, }, | ||
| 56 | { 0, 12, 3, 15, 0, 12, 3, 15, }, | ||
| 57 | { 8, 4, 11, 7, 8, 4, 11, 7, }, | ||
| 58 | }; | ||
| 59 | |||
| 60 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_32)[][8] = { | ||
| 61 | { 17, 9, 23, 15, 16, 8, 22, 14, }, | ||
| 62 | { 5, 29, 3, 27, 4, 28, 2, 26, }, | ||
| 63 | { 21, 13, 19, 11, 20, 12, 18, 10, }, | ||
| 64 | { 0, 24, 6, 30, 1, 25, 7, 31, }, | ||
| 65 | { 16, 8, 22, 14, 17, 9, 23, 15, }, | ||
| 66 | { 4, 28, 2, 26, 5, 29, 3, 27, }, | ||
| 67 | { 20, 12, 18, 10, 21, 13, 19, 11, }, | ||
| 68 | { 1, 25, 7, 31, 0, 24, 6, 30, }, | ||
| 69 | { 17, 9, 23, 15, 16, 8, 22, 14, }, | ||
| 70 | }; | ||
| 71 | |||
| 72 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_73)[][8] = { | ||
| 73 | { 0, 55, 14, 68, 3, 58, 17, 72, }, | ||
| 74 | { 37, 18, 50, 32, 40, 22, 54, 35, }, | ||
| 75 | { 9, 64, 5, 59, 13, 67, 8, 63, }, | ||
| 76 | { 46, 27, 41, 23, 49, 31, 44, 26, }, | ||
| 77 | { 2, 57, 16, 71, 1, 56, 15, 70, }, | ||
| 78 | { 39, 21, 52, 34, 38, 19, 51, 33, }, | ||
| 79 | { 11, 66, 7, 62, 10, 65, 6, 60, }, | ||
| 80 | { 48, 30, 43, 25, 47, 29, 42, 24, }, | ||
| 81 | { 0, 55, 14, 68, 3, 58, 17, 72, }, | ||
| 82 | }; | ||
| 83 | |||
| 84 | #if 1 | ||
| 85 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = { | ||
| 86 | {117, 62, 158, 103, 113, 58, 155, 100, }, | ||
| 87 | { 34, 199, 21, 186, 31, 196, 17, 182, }, | ||
| 88 | {144, 89, 131, 76, 141, 86, 127, 72, }, | ||
| 89 | { 0, 165, 41, 206, 10, 175, 52, 217, }, | ||
| 90 | {110, 55, 151, 96, 120, 65, 162, 107, }, | ||
| 91 | { 28, 193, 14, 179, 38, 203, 24, 189, }, | ||
| 92 | {138, 83, 124, 69, 148, 93, 134, 79, }, | ||
| 93 | { 7, 172, 48, 213, 3, 168, 45, 210, }, | ||
| 94 | {117, 62, 158, 103, 113, 58, 155, 100, }, | ||
| 95 | }; | ||
| 96 | #elif 1 | ||
| 97 | // tries to correct a gamma of 1.5 | ||
| 98 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = { | ||
| 99 | { 0, 143, 18, 200, 2, 156, 25, 215, }, | ||
| 100 | { 78, 28, 125, 64, 89, 36, 138, 74, }, | ||
| 101 | { 10, 180, 3, 161, 16, 195, 8, 175, }, | ||
| 102 | {109, 51, 93, 38, 121, 60, 105, 47, }, | ||
| 103 | { 1, 152, 23, 210, 0, 147, 20, 205, }, | ||
| 104 | { 85, 33, 134, 71, 81, 30, 130, 67, }, | ||
| 105 | { 14, 190, 6, 171, 12, 185, 5, 166, }, | ||
| 106 | {117, 57, 101, 44, 113, 54, 97, 41, }, | ||
| 107 | { 0, 143, 18, 200, 2, 156, 25, 215, }, | ||
| 108 | }; | ||
| 109 | #elif 1 | ||
| 110 | // tries to correct a gamma of 2.0 | ||
| 111 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = { | ||
| 112 | { 0, 124, 8, 193, 0, 140, 12, 213, }, | ||
| 113 | { 55, 14, 104, 42, 66, 19, 119, 52, }, | ||
| 114 | { 3, 168, 1, 145, 6, 187, 3, 162, }, | ||
| 115 | { 86, 31, 70, 21, 99, 39, 82, 28, }, | ||
| 116 | { 0, 134, 11, 206, 0, 129, 9, 200, }, | ||
| 117 | { 62, 17, 114, 48, 58, 16, 109, 45, }, | ||
| 118 | { 5, 181, 2, 157, 4, 175, 1, 151, }, | ||
| 119 | { 95, 36, 78, 26, 90, 34, 74, 24, }, | ||
| 120 | { 0, 124, 8, 193, 0, 140, 12, 213, }, | ||
| 121 | }; | ||
| 122 | #else | ||
| 123 | // tries to correct a gamma of 2.5 | ||
| 124 | DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = { | ||
| 125 | { 0, 107, 3, 187, 0, 125, 6, 212, }, | ||
| 126 | { 39, 7, 86, 28, 49, 11, 102, 36, }, | ||
| 127 | { 1, 158, 0, 131, 3, 180, 1, 151, }, | ||
| 128 | { 68, 19, 52, 12, 81, 25, 64, 17, }, | ||
| 129 | { 0, 119, 5, 203, 0, 113, 4, 195, }, | ||
| 130 | { 45, 9, 96, 33, 42, 8, 91, 30, }, | ||
| 131 | { 2, 172, 1, 144, 2, 165, 0, 137, }, | ||
| 132 | { 77, 23, 60, 15, 72, 21, 56, 14, }, | ||
| 133 | { 0, 107, 3, 187, 0, 125, 6, 212, }, | ||
| 134 | }; | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #define IS_BE_LE 0 | ||
| 138 | #define IS_BE_BE 1 | ||
| 139 | /* ENDIAN_IDENTIFIER needs to be "BE" or "LE". */ | ||
| 140 | #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER | ||
| 141 | |||
| 142 | #define output_pixel(pos, val, bias, signedness) \ | ||
| 143 | if (big_endian) { \ | ||
| 144 | AV_WB16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \ | ||
| 145 | } else { \ | ||
| 146 | AV_WL16(pos, bias + av_clip_ ## signedness ## 16(val >> shift)); \ | ||
| 147 | } | ||
| 148 | |||
| 149 | static av_always_inline void | ||
| 150 | 2935342 | yuv2plane1_16_c_template(const int32_t *src, uint16_t *dest, int dstW, | |
| 151 | int big_endian, int output_bits) | ||
| 152 | { | ||
| 153 | int i; | ||
| 154 | 2935342 | int shift = 3; | |
| 155 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2935342 times.
|
2935342 | av_assert0(output_bits == 16); |
| 156 | |||
| 157 |
2/2✓ Branch 0 taken 956093896 times.
✓ Branch 1 taken 2935342 times.
|
959029238 | for (i = 0; i < dstW; i++) { |
| 158 | 956093896 | int val = src[i] + (1 << (shift - 1)); | |
| 159 |
2/2✓ Branch 0 taken 358386336 times.
✓ Branch 1 taken 597707560 times.
|
956093896 | output_pixel(&dest[i], val, 0, uint); |
| 160 | } | ||
| 161 | 2935342 | } | |
| 162 | |||
| 163 | static av_always_inline void | ||
| 164 | 621952 | yuv2planeX_16_c_template(const int16_t *filter, int filterSize, | |
| 165 | const int32_t **src, uint16_t *dest, int dstW, | ||
| 166 | int big_endian, int output_bits) | ||
| 167 | { | ||
| 168 | int i; | ||
| 169 | 621952 | int shift = 15; | |
| 170 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 621952 times.
|
621952 | av_assert0(output_bits == 16); |
| 171 | |||
| 172 |
2/2✓ Branch 0 taken 164438304 times.
✓ Branch 1 taken 621952 times.
|
165060256 | for (i = 0; i < dstW; i++) { |
| 173 | 164438304 | int val = 1 << (shift - 1); | |
| 174 | int j; | ||
| 175 | |||
| 176 | /* range of val is [0,0x7FFFFFFF], so 31 bits, but with lanczos/spline | ||
| 177 | * filters (or anything with negative coeffs, the range can be slightly | ||
| 178 | * wider in both directions. To account for this overflow, we subtract | ||
| 179 | * a constant so it always fits in the signed range (assuming a | ||
| 180 | * reasonable filterSize), and re-add that at the end. */ | ||
| 181 | 164438304 | val -= 0x40000000; | |
| 182 |
2/2✓ Branch 0 taken 818156672 times.
✓ Branch 1 taken 164438304 times.
|
982594976 | for (j = 0; j < filterSize; j++) |
| 183 | 818156672 | val += src[j][i] * (unsigned)filter[j]; | |
| 184 | |||
| 185 |
2/2✓ Branch 0 taken 39525632 times.
✓ Branch 1 taken 124912672 times.
|
164438304 | output_pixel(&dest[i], val, 0x8000, int); |
| 186 | } | ||
| 187 | 621952 | } | |
| 188 | |||
| 189 | static av_always_inline void | ||
| 190 | 641224 | yuv2nv12cX_16_c_template(int big_endian, const uint8_t *chrDither, | |
| 191 | const int16_t *chrFilter, int chrFilterSize, | ||
| 192 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 193 | uint8_t *dest8, int chrDstW, int output_bits) | ||
| 194 | { | ||
| 195 | 641224 | uint16_t *dest = (uint16_t*)dest8; | |
| 196 | 641224 | const int32_t **uSrc = (const int32_t **)chrUSrc; | |
| 197 | 641224 | const int32_t **vSrc = (const int32_t **)chrVSrc; | |
| 198 | 641224 | int shift = 15; | |
| 199 | int i, j; | ||
| 200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 641224 times.
|
641224 | av_assert0(output_bits == 16); |
| 201 | |||
| 202 |
2/2✓ Branch 0 taken 166244576 times.
✓ Branch 1 taken 641224 times.
|
166885800 | for (i = 0; i < chrDstW; i++) { |
| 203 | 166244576 | int u = 1 << (shift - 1); | |
| 204 | 166244576 | int v = 1 << (shift - 1); | |
| 205 | |||
| 206 | /* See yuv2planeX_16_c_template for details. */ | ||
| 207 | 166244576 | u -= 0x40000000; | |
| 208 | 166244576 | v -= 0x40000000; | |
| 209 |
2/2✓ Branch 0 taken 358067328 times.
✓ Branch 1 taken 166244576 times.
|
524311904 | for (j = 0; j < chrFilterSize; j++) { |
| 210 | 358067328 | u += uSrc[j][i] * (unsigned)chrFilter[j]; | |
| 211 | 358067328 | v += vSrc[j][i] * (unsigned)chrFilter[j]; | |
| 212 | } | ||
| 213 | |||
| 214 |
2/2✓ Branch 0 taken 59628400 times.
✓ Branch 1 taken 106616176 times.
|
166244576 | output_pixel(&dest[2*i] , u, 0x8000, int); |
| 215 |
2/2✓ Branch 0 taken 59628400 times.
✓ Branch 1 taken 106616176 times.
|
166244576 | output_pixel(&dest[2*i+1], v, 0x8000, int); |
| 216 | } | ||
| 217 | 641224 | } | |
| 218 | |||
| 219 | static av_always_inline void | ||
| 220 | 29392 | yuv2plane1_float_c_template(const int32_t *src, float *dest, int dstW) | |
| 221 | { | ||
| 222 | static const int big_endian = HAVE_BIGENDIAN; | ||
| 223 | static const int shift = 3; | ||
| 224 | static const float float_mult = 1.0f / 65535.0f; | ||
| 225 | int i, val; | ||
| 226 | uint16_t val_uint; | ||
| 227 | |||
| 228 |
2/2✓ Branch 0 taken 10340544 times.
✓ Branch 1 taken 29392 times.
|
10369936 | for (i = 0; i < dstW; ++i){ |
| 229 | 10340544 | val = src[i] + (1 << (shift - 1)); | |
| 230 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10340544 times.
|
10340544 | output_pixel(&val_uint, val, 0, uint); |
| 231 | 10340544 | dest[i] = float_mult * (float)val_uint; | |
| 232 | } | ||
| 233 | 29392 | } | |
| 234 | |||
| 235 | static av_always_inline void | ||
| 236 | 13248 | yuv2plane1_float_bswap_c_template(const int32_t *src, uint32_t *dest, int dstW) | |
| 237 | { | ||
| 238 | static const int big_endian = HAVE_BIGENDIAN; | ||
| 239 | static const int shift = 3; | ||
| 240 | static const float float_mult = 1.0f / 65535.0f; | ||
| 241 | int i, val; | ||
| 242 | uint16_t val_uint; | ||
| 243 | |||
| 244 |
2/2✓ Branch 0 taken 4663296 times.
✓ Branch 1 taken 13248 times.
|
4676544 | for (i = 0; i < dstW; ++i){ |
| 245 | 4663296 | val = src[i] + (1 << (shift - 1)); | |
| 246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4663296 times.
|
4663296 | output_pixel(&val_uint, val, 0, uint); |
| 247 | 4663296 | dest[i] = av_bswap32(av_float2int(float_mult * (float)val_uint)); | |
| 248 | } | ||
| 249 | 13248 | } | |
| 250 | |||
| 251 | static av_always_inline void | ||
| 252 | 9816 | yuv2planeX_float_c_template(const int16_t *filter, int filterSize, const int32_t **src, | |
| 253 | float *dest, int dstW, ptrdiff_t stride) | ||
| 254 | { | ||
| 255 | static const int big_endian = HAVE_BIGENDIAN; | ||
| 256 | static const int shift = 15; | ||
| 257 | static const float float_mult = 1.0f / 65535.0f; | ||
| 258 | int i, j, val; | ||
| 259 | uint16_t val_uint; | ||
| 260 | |||
| 261 |
2/2✓ Branch 0 taken 3364032 times.
✓ Branch 1 taken 9816 times.
|
3373848 | for (i = 0; i < dstW; ++i){ |
| 262 | 3364032 | val = (1 << (shift - 1)) - 0x40000000; | |
| 263 |
2/2✓ Branch 0 taken 4684032 times.
✓ Branch 1 taken 3364032 times.
|
8048064 | for (j = 0; j < filterSize; ++j){ |
| 264 | 4684032 | val += src[j][i] * (unsigned)filter[j]; | |
| 265 | } | ||
| 266 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3364032 times.
|
3364032 | output_pixel(&val_uint, val, 0x8000, int); |
| 267 | 3364032 | dest[i * stride] = float_mult * (float)val_uint; | |
| 268 | } | ||
| 269 | 9816 | } | |
| 270 | |||
| 271 | static av_always_inline void | ||
| 272 | 9816 | yuv2planeX_float_bswap_c_template(const int16_t *filter, int filterSize, const int32_t **src, | |
| 273 | uint32_t *dest, int dstW, ptrdiff_t stride) | ||
| 274 | { | ||
| 275 | static const int big_endian = HAVE_BIGENDIAN; | ||
| 276 | static const int shift = 15; | ||
| 277 | static const float float_mult = 1.0f / 65535.0f; | ||
| 278 | int i, j, val; | ||
| 279 | uint16_t val_uint; | ||
| 280 | |||
| 281 |
2/2✓ Branch 0 taken 3364032 times.
✓ Branch 1 taken 9816 times.
|
3373848 | for (i = 0; i < dstW; ++i){ |
| 282 | 3364032 | val = (1 << (shift - 1)) - 0x40000000; | |
| 283 |
2/2✓ Branch 0 taken 4684032 times.
✓ Branch 1 taken 3364032 times.
|
8048064 | for (j = 0; j < filterSize; ++j){ |
| 284 | 4684032 | val += src[j][i] * (unsigned)filter[j]; | |
| 285 | } | ||
| 286 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3364032 times.
|
3364032 | output_pixel(&val_uint, val, 0x8000, int); |
| 287 | 3364032 | dest[i * stride] = av_bswap32(av_float2int(float_mult * (float)val_uint)); | |
| 288 | } | ||
| 289 | 9816 | } | |
| 290 | |||
| 291 | #define yuv2plane1_float(template, dest_type, BE_LE) \ | ||
| 292 | static void yuv2plane1_float ## BE_LE ## _c(const int16_t *src, uint8_t *dest, int dstW, \ | ||
| 293 | const uint8_t *dither, int offset) \ | ||
| 294 | { \ | ||
| 295 | template((const int32_t *)src, (dest_type *)dest, dstW); \ | ||
| 296 | } | ||
| 297 | |||
| 298 | #define yuv2planeX_float(template, dest_type, BE_LE) \ | ||
| 299 | static void yuv2planeX_float ## BE_LE ## _c(const int16_t *filter, int filterSize, \ | ||
| 300 | const int16_t **src, uint8_t *dest, int dstW, \ | ||
| 301 | const uint8_t *dither, int offset) \ | ||
| 302 | { \ | ||
| 303 | template(filter, filterSize, (const int32_t **)src, (dest_type *)dest, dstW, 1); \ | ||
| 304 | } | ||
| 305 | |||
| 306 | #define yuv2yaf32_X(template, dest_type, BE_LE, is_be) \ | ||
| 307 | static void yuv2yaf32 ## BE_LE ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 308 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 309 | const int16_t *chrFilter, \ | ||
| 310 | const int16_t **chrUSrc, \ | ||
| 311 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 312 | const int16_t **alpSrc, uint8_t *dest, \ | ||
| 313 | int dstW, int y) \ | ||
| 314 | { \ | ||
| 315 | dest_type *dst = (dest_type *) dest; \ | ||
| 316 | template(lumFilter, lumFilterSize, (const int32_t **) lumSrc, dst, dstW, 2); \ | ||
| 317 | if (alpSrc) { \ | ||
| 318 | template(lumFilter, lumFilterSize, (const int32_t **) alpSrc, dst + 1, dstW, 2); \ | ||
| 319 | } else { \ | ||
| 320 | for (int i = 0; i < dstW; i++) { \ | ||
| 321 | if (is_be) { \ | ||
| 322 | AV_WB32(&dst[2 * i + 1], av_float2int(1.0f)); \ | ||
| 323 | } else { \ | ||
| 324 | AV_WL32(&dst[2 * i + 1], av_float2int(1.0f)); \ | ||
| 325 | } \ | ||
| 326 | } \ | ||
| 327 | } \ | ||
| 328 | } | ||
| 329 | |||
| 330 | #if HAVE_BIGENDIAN | ||
| 331 | yuv2plane1_float(yuv2plane1_float_c_template, float, BE) | ||
| 332 | yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, LE) | ||
| 333 | yuv2planeX_float(yuv2planeX_float_c_template, float, BE) | ||
| 334 | yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, LE) | ||
| 335 | yuv2yaf32_X(yuv2planeX_float_c_template, float, be, 1) | ||
| 336 | yuv2yaf32_X(yuv2planeX_float_bswap_c_template, uint32_t, le, 0) | ||
| 337 | #else | ||
| 338 | 29392 | yuv2plane1_float(yuv2plane1_float_c_template, float, LE) | |
| 339 | 13248 | yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, BE) | |
| 340 | 200 | yuv2planeX_float(yuv2planeX_float_c_template, float, LE) | |
| 341 | 200 | yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, BE) | |
| 342 |
4/4✓ Branch 1 taken 200 times.
✓ Branch 2 taken 9216 times.
✓ Branch 5 taken 3244032 times.
✓ Branch 6 taken 9216 times.
|
3253448 | yuv2yaf32_X(yuv2planeX_float_c_template, float, le, 0) |
| 343 |
4/4✓ Branch 1 taken 200 times.
✓ Branch 2 taken 9216 times.
✓ Branch 5 taken 3244032 times.
✓ Branch 6 taken 9216 times.
|
3253448 | yuv2yaf32_X(yuv2planeX_float_bswap_c_template, uint32_t, be, 1) |
| 344 | #endif | ||
| 345 | |||
| 346 | #undef output_pixel | ||
| 347 | |||
| 348 | #define output_pixel(pos, val) \ | ||
| 349 | if (big_endian) { \ | ||
| 350 | AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \ | ||
| 351 | } else { \ | ||
| 352 | AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \ | ||
| 353 | } | ||
| 354 | |||
| 355 | static av_always_inline void | ||
| 356 | 7155884 | yuv2plane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW, | |
| 357 | int big_endian, int output_bits) | ||
| 358 | { | ||
| 359 | int i; | ||
| 360 | 7155884 | int shift = 15 - output_bits; | |
| 361 | |||
| 362 |
2/2✓ Branch 0 taken 2337991592 times.
✓ Branch 1 taken 7155884 times.
|
2345147476 | for (i = 0; i < dstW; i++) { |
| 363 | 2337991592 | int val = src[i] + (1 << (shift - 1)); | |
| 364 |
2/2✓ Branch 0 taken 488871936 times.
✓ Branch 1 taken 1849119656 times.
|
2337991592 | output_pixel(&dest[i], val); |
| 365 | } | ||
| 366 | 7155884 | } | |
| 367 | |||
| 368 | static av_always_inline void | ||
| 369 | 3183768 | yuv2planeX_10_c_template(const int16_t *filter, int filterSize, | |
| 370 | const int16_t **src, uint16_t *dest, int dstW, | ||
| 371 | int big_endian, int output_bits) | ||
| 372 | { | ||
| 373 | int i; | ||
| 374 | 3183768 | int shift = 11 + 16 - output_bits; | |
| 375 | |||
| 376 |
2/2✓ Branch 0 taken 990480776 times.
✓ Branch 1 taken 3183768 times.
|
993664544 | for (i = 0; i < dstW; i++) { |
| 377 | 990480776 | int val = 1 << (shift - 1); | |
| 378 | int j; | ||
| 379 | |||
| 380 |
2/2✓ Branch 0 taken 4717519584 times.
✓ Branch 1 taken 990480776 times.
|
5708000360 | for (j = 0; j < filterSize; j++) |
| 381 | 4717519584 | val += src[j][i] * filter[j]; | |
| 382 | |||
| 383 |
2/2✓ Branch 0 taken 160650496 times.
✓ Branch 1 taken 829830280 times.
|
990480776 | output_pixel(&dest[i], val); |
| 384 | } | ||
| 385 | 3183768 | } | |
| 386 | |||
| 387 | #undef output_pixel | ||
| 388 | |||
| 389 | #define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \ | ||
| 390 | static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \ | ||
| 391 | uint8_t *dest, int dstW, \ | ||
| 392 | const uint8_t *dither, int offset)\ | ||
| 393 | { \ | ||
| 394 | yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \ | ||
| 395 | (uint16_t *) dest, dstW, is_be, bits); \ | ||
| 396 | }\ | ||
| 397 | static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \ | ||
| 398 | const int16_t **src, uint8_t *dest, int dstW, \ | ||
| 399 | const uint8_t *dither, int offset)\ | ||
| 400 | { \ | ||
| 401 | yuv2planeX_## template_size ## _c_template(filter, \ | ||
| 402 | filterSize, (const typeX_t **) src, \ | ||
| 403 | (uint16_t *) dest, dstW, is_be, bits); \ | ||
| 404 | } | ||
| 405 | |||
| 406 | 257504 | yuv2NBPS( 9, BE, 1, 10, int16_t) | |
| 407 | 287772 | yuv2NBPS( 9, LE, 0, 10, int16_t) | |
| 408 | 1970176 | yuv2NBPS(10, BE, 1, 10, int16_t) | |
| 409 | 10007948 | yuv2NBPS(10, LE, 0, 10, int16_t) | |
| 410 | 1968976 | yuv2NBPS(12, BE, 1, 10, int16_t) | |
| 411 | 5892112 | yuv2NBPS(12, LE, 0, 10, int16_t) | |
| 412 | 139056 | yuv2NBPS(14, BE, 1, 10, int16_t) | |
| 413 | 155760 | yuv2NBPS(14, LE, 0, 10, int16_t) | |
| 414 | 2618840 | yuv2NBPS(16, BE, 1, 16, int32_t) | |
| 415 | 4495748 | yuv2NBPS(16, LE, 0, 16, int32_t) | |
| 416 | |||
| 417 | #define output_pixel(pos, val) \ | ||
| 418 | if (big_endian) { \ | ||
| 419 | AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << (16 - output_bits)); \ | ||
| 420 | } else { \ | ||
| 421 | AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << (16 - output_bits)); \ | ||
| 422 | } | ||
| 423 | |||
| 424 | static av_always_inline void | ||
| 425 | 757440 | yuv2msbplane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW, | |
| 426 | int big_endian, int output_bits) | ||
| 427 | { | ||
| 428 | int i; | ||
| 429 | 757440 | int shift = 15 - output_bits; | |
| 430 | |||
| 431 |
2/2✓ Branch 0 taken 266471424 times.
✓ Branch 1 taken 757440 times.
|
267228864 | for (i = 0; i < dstW; i++) { |
| 432 | 266471424 | int val = src[i] + (1 << (shift - 1)); | |
| 433 |
2/2✓ Branch 0 taken 133005312 times.
✓ Branch 1 taken 133466112 times.
|
266471424 | output_pixel(&dest[i], val); |
| 434 | } | ||
| 435 | 757440 | } | |
| 436 | |||
| 437 | static av_always_inline void | ||
| 438 | 78432 | yuv2msbplaneX_10_c_template(const int16_t *filter, int filterSize, | |
| 439 | const int16_t **src, uint16_t *dest, int dstW, | ||
| 440 | int big_endian, int output_bits) | ||
| 441 | { | ||
| 442 | int i; | ||
| 443 | 78432 | int shift = 11 + 16 - output_bits; | |
| 444 | |||
| 445 |
2/2✓ Branch 0 taken 27243264 times.
✓ Branch 1 taken 78432 times.
|
27321696 | for (i = 0; i < dstW; i++) { |
| 446 | 27243264 | int val = 1 << (shift - 1); | |
| 447 | int j; | ||
| 448 | |||
| 449 |
2/2✓ Branch 0 taken 112813056 times.
✓ Branch 1 taken 27243264 times.
|
140056320 | for (j = 0; j < filterSize; j++) |
| 450 | 112813056 | val += src[j][i] * filter[j]; | |
| 451 | |||
| 452 |
2/2✓ Branch 0 taken 13216128 times.
✓ Branch 1 taken 14027136 times.
|
27243264 | output_pixel(&dest[i], val); |
| 453 | } | ||
| 454 | 78432 | } | |
| 455 | |||
| 456 | #define yuv2MSBNBPS(bits, BE_LE, is_be, template_size, typeX_t) \ | ||
| 457 | static void yuv2msbplane1_ ## bits ## BE_LE ## _c(const int16_t *src, \ | ||
| 458 | uint8_t *dest, int dstW, \ | ||
| 459 | const uint8_t *dither, int offset)\ | ||
| 460 | { \ | ||
| 461 | yuv2msbplane1_ ## template_size ## _c_template((const typeX_t *) src, \ | ||
| 462 | (uint16_t *) dest, dstW, is_be, bits); \ | ||
| 463 | }\ | ||
| 464 | static void yuv2msbplaneX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \ | ||
| 465 | const int16_t **src, uint8_t *dest, int dstW, \ | ||
| 466 | const uint8_t *dither, int offset)\ | ||
| 467 | { \ | ||
| 468 | yuv2msbplaneX_## template_size ## _c_template(filter, \ | ||
| 469 | filterSize, (const typeX_t **) src, \ | ||
| 470 | (uint16_t *) dest, dstW, is_be, bits); \ | ||
| 471 | } | ||
| 472 | |||
| 473 | 415920 | yuv2MSBNBPS(10, BE, 1, 10, int16_t) | |
| 474 | 419952 | yuv2MSBNBPS(10, LE, 0, 10, int16_t) | |
| 475 | 415920 | yuv2MSBNBPS(12, BE, 1, 10, int16_t) | |
| 476 | 419952 | yuv2MSBNBPS(12, LE, 0, 10, int16_t) | |
| 477 | |||
| 478 | #undef output_pixel | ||
| 479 | |||
| 480 | 386420 | static void yuv2nv12cX_16LE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, | |
| 481 | const int16_t *chrFilter, int chrFilterSize, | ||
| 482 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 483 | uint8_t *dest8, int chrDstW) | ||
| 484 | { | ||
| 485 | 386420 | yuv2nv12cX_16_c_template(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW, 16); | |
| 486 | 386420 | } | |
| 487 | |||
| 488 | 254804 | static void yuv2nv12cX_16BE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, | |
| 489 | const int16_t *chrFilter, int chrFilterSize, | ||
| 490 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 491 | uint8_t *dest8, int chrDstW) | ||
| 492 | { | ||
| 493 | 254804 | yuv2nv12cX_16_c_template(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW, 16); | |
| 494 | 254804 | } | |
| 495 | |||
| 496 | 12038598 | static void yuv2planeX_8_c(const int16_t *filter, int filterSize, | |
| 497 | const int16_t **src, uint8_t *dest, int dstW, | ||
| 498 | const uint8_t *dither, int offset) | ||
| 499 | { | ||
| 500 | int i; | ||
| 501 |
2/2✓ Branch 0 taken 7083512132 times.
✓ Branch 1 taken 12038598 times.
|
7095550730 | for (i=0; i<dstW; i++) { |
| 502 | 7083512132 | int val = dither[(i + offset) & 7] << 12; | |
| 503 | int j; | ||
| 504 |
2/2✓ Branch 0 taken 23440077436 times.
✓ Branch 1 taken 7083512132 times.
|
30523589568 | for (j=0; j<filterSize; j++) { |
| 505 | 23440077436 | val += (unsigned)(src[j][i] * filter[j]); | |
| 506 | |||
| 507 | } | ||
| 508 | |||
| 509 | 7083512132 | dest[i]= av_clip_uint8(val>>19); | |
| 510 | } | ||
| 511 | 12038598 | } | |
| 512 | |||
| 513 | 29475952 | static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW, | |
| 514 | const uint8_t *dither, int offset) | ||
| 515 | { | ||
| 516 | int i; | ||
| 517 |
2/2✓ Branch 0 taken 6433207353 times.
✓ Branch 1 taken 29475952 times.
|
6462683305 | for (i=0; i<dstW; i++) { |
| 518 | 6433207353 | int val = (src[i] + dither[(i + offset) & 7]) >> 7; | |
| 519 | 6433207353 | dest[i]= av_clip_uint8(val); | |
| 520 | } | ||
| 521 | 29475952 | } | |
| 522 | |||
| 523 | 858370 | static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, | |
| 524 | const int16_t *chrFilter, int chrFilterSize, | ||
| 525 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 526 | uint8_t *dest, int chrDstW) | ||
| 527 | { | ||
| 528 | int i; | ||
| 529 | |||
| 530 |
2/2✓ Branch 1 taken 848278 times.
✓ Branch 2 taken 10092 times.
|
858370 | if (!isSwappedChroma(dstFormat)) |
| 531 |
2/2✓ Branch 0 taken 274980688 times.
✓ Branch 1 taken 848278 times.
|
275828966 | for (i=0; i<chrDstW; i++) { |
| 532 | 274980688 | int u = chrDither[i & 7] << 12; | |
| 533 | 274980688 | int v = chrDither[(i + 3) & 7] << 12; | |
| 534 | int j; | ||
| 535 |
2/2✓ Branch 0 taken 516747872 times.
✓ Branch 1 taken 274980688 times.
|
791728560 | for (j=0; j<chrFilterSize; j++) { |
| 536 | 516747872 | u += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 537 | 516747872 | v += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 538 | } | ||
| 539 | |||
| 540 | 274980688 | dest[2*i]= av_clip_uint8(u>>19); | |
| 541 | 274980688 | dest[2*i+1]= av_clip_uint8(v>>19); | |
| 542 | } | ||
| 543 | else | ||
| 544 |
2/2✓ Branch 0 taken 3496784 times.
✓ Branch 1 taken 10092 times.
|
3506876 | for (i=0; i<chrDstW; i++) { |
| 545 | 3496784 | int u = chrDither[i & 7] << 12; | |
| 546 | 3496784 | int v = chrDither[(i + 3) & 7] << 12; | |
| 547 | int j; | ||
| 548 |
2/2✓ Branch 0 taken 14387136 times.
✓ Branch 1 taken 3496784 times.
|
17883920 | for (j=0; j<chrFilterSize; j++) { |
| 549 | 14387136 | u += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 550 | 14387136 | v += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 551 | } | ||
| 552 | |||
| 553 | 3496784 | dest[2*i]= av_clip_uint8(v>>19); | |
| 554 | 3496784 | dest[2*i+1]= av_clip_uint8(u>>19); | |
| 555 | } | ||
| 556 | 858370 | } | |
| 557 | |||
| 558 | |||
| 559 | #define output_pixel(pos, val) \ | ||
| 560 | if (big_endian) { \ | ||
| 561 | AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \ | ||
| 562 | } else { \ | ||
| 563 | AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \ | ||
| 564 | } | ||
| 565 | |||
| 566 | 2334528 | static void yuv2p01xl1_c(const int16_t *src, | |
| 567 | uint16_t *dest, int dstW, | ||
| 568 | int big_endian, int output_bits, int output_shift) | ||
| 569 | { | ||
| 570 | int i; | ||
| 571 | 2334528 | int shift = 15 - output_bits; | |
| 572 | |||
| 573 |
2/2✓ Branch 0 taken 821753856 times.
✓ Branch 1 taken 2334528 times.
|
824088384 | for (i = 0; i < dstW; i++) { |
| 574 | 821753856 | int val = src[i] + (1 << (shift - 1)); | |
| 575 |
2/2✓ Branch 0 taken 179841024 times.
✓ Branch 1 taken 641912832 times.
|
821753856 | output_pixel(&dest[i], val); |
| 576 | } | ||
| 577 | 2334528 | } | |
| 578 | |||
| 579 | 2800 | static void yuv2p01xlX_c(const int16_t *filter, int filterSize, | |
| 580 | const int16_t **src, uint16_t *dest, int dstW, | ||
| 581 | int big_endian, int output_bits, int output_shift) | ||
| 582 | { | ||
| 583 | int i, j; | ||
| 584 | 2800 | int shift = 11 + 16 - output_bits; | |
| 585 | |||
| 586 |
2/2✓ Branch 0 taken 560000 times.
✓ Branch 1 taken 2800 times.
|
562800 | for (i = 0; i < dstW; i++) { |
| 587 | 560000 | int val = 1 << (shift - 1); | |
| 588 | |||
| 589 |
2/2✓ Branch 0 taken 6720000 times.
✓ Branch 1 taken 560000 times.
|
7280000 | for (j = 0; j < filterSize; j++) |
| 590 | 6720000 | val += src[j][i] * filter[j]; | |
| 591 | |||
| 592 |
2/2✓ Branch 0 taken 280000 times.
✓ Branch 1 taken 280000 times.
|
560000 | output_pixel(&dest[i], val); |
| 593 | } | ||
| 594 | 2800 | } | |
| 595 | |||
| 596 | 2158944 | static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither, | |
| 597 | const int16_t *chrFilter, int chrFilterSize, | ||
| 598 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 599 | uint8_t *dest8, int chrDstW, int output_bits, int output_shift) | ||
| 600 | { | ||
| 601 | 2158944 | uint16_t *dest = (uint16_t*)dest8; | |
| 602 | int i, j; | ||
| 603 | 2158944 | int shift = 11 + 16 - output_bits; | |
| 604 | |||
| 605 |
2/2✓ Branch 0 taken 660683264 times.
✓ Branch 1 taken 2158944 times.
|
662842208 | for (i = 0; i < chrDstW; i++) { |
| 606 | 660683264 | int u = 1 << (shift - 1); | |
| 607 | 660683264 | int v = 1 << (shift - 1); | |
| 608 | |||
| 609 |
2/2✓ Branch 0 taken 1283509248 times.
✓ Branch 1 taken 660683264 times.
|
1944192512 | for (j = 0; j < chrFilterSize; j++) { |
| 610 | 1283509248 | u += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 611 | 1283509248 | v += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 612 | } | ||
| 613 | |||
| 614 |
2/2✓ Branch 0 taken 98393344 times.
✓ Branch 1 taken 562289920 times.
|
660683264 | output_pixel(&dest[2*i] , u); |
| 615 |
2/2✓ Branch 0 taken 98393344 times.
✓ Branch 1 taken 562289920 times.
|
660683264 | output_pixel(&dest[2*i+1], v); |
| 616 | } | ||
| 617 | 2158944 | } | |
| 618 | |||
| 619 | #undef output_pixel | ||
| 620 | |||
| 621 | #define yuv2p01x_wrapper(fmt, bits, shift) \ | ||
| 622 | static void yuv2 ## fmt ## l1_LE_c(const int16_t *src, \ | ||
| 623 | uint8_t *dest, int dstW, \ | ||
| 624 | const uint8_t *dither, int offset) \ | ||
| 625 | { \ | ||
| 626 | yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift); \ | ||
| 627 | } \ | ||
| 628 | \ | ||
| 629 | static void yuv2 ## fmt ## l1_BE_c(const int16_t *src, \ | ||
| 630 | uint8_t *dest, int dstW, \ | ||
| 631 | const uint8_t *dither, int offset) \ | ||
| 632 | { \ | ||
| 633 | yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift); \ | ||
| 634 | } \ | ||
| 635 | \ | ||
| 636 | static void yuv2 ## fmt ## lX_LE_c(const int16_t *filter, \ | ||
| 637 | int filterSize, const int16_t **src, \ | ||
| 638 | uint8_t *dest, int dstW, \ | ||
| 639 | const uint8_t *dither, int offset) \ | ||
| 640 | { \ | ||
| 641 | yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, \ | ||
| 642 | bits, shift); \ | ||
| 643 | } \ | ||
| 644 | \ | ||
| 645 | static void yuv2 ## fmt ## lX_BE_c(const int16_t *filter, \ | ||
| 646 | int filterSize, const int16_t **src, \ | ||
| 647 | uint8_t *dest, int dstW, \ | ||
| 648 | const uint8_t *dither, int offset) \ | ||
| 649 | { \ | ||
| 650 | yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, \ | ||
| 651 | bits, shift); \ | ||
| 652 | } \ | ||
| 653 | \ | ||
| 654 | static void yuv2 ## fmt ## cX_LE_c(enum AVPixelFormat dstFormat, \ | ||
| 655 | const uint8_t *chrDither, \ | ||
| 656 | const int16_t *chrFilter, \ | ||
| 657 | int chrFilterSize, \ | ||
| 658 | const int16_t **chrUSrc, \ | ||
| 659 | const int16_t **chrVSrc, \ | ||
| 660 | uint8_t *dest8, int chrDstW) \ | ||
| 661 | { \ | ||
| 662 | yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \ | ||
| 663 | dest8, chrDstW, bits, shift); \ | ||
| 664 | } \ | ||
| 665 | \ | ||
| 666 | static void yuv2 ## fmt ## cX_BE_c(enum AVPixelFormat dstFormat, \ | ||
| 667 | const uint8_t *chrDither, \ | ||
| 668 | const int16_t *chrFilter, \ | ||
| 669 | int chrFilterSize, \ | ||
| 670 | const int16_t **chrUSrc, \ | ||
| 671 | const int16_t **chrVSrc, \ | ||
| 672 | uint8_t *dest8, int chrDstW) \ | ||
| 673 | { \ | ||
| 674 | yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \ | ||
| 675 | dest8, chrDstW, bits, shift); \ | ||
| 676 | } | ||
| 677 | |||
| 678 | 4445936 | yuv2p01x_wrapper(p010, 10, 6) | |
| 679 | 4473584 | yuv2p01x_wrapper(p012, 12, 4) | |
| 680 | 73024 | yuv2p01x_wrapper(nv20, 10, 0) | |
| 681 | |||
| 682 | #define accumulate_bit(acc, val) \ | ||
| 683 | acc <<= 1; \ | ||
| 684 | acc |= (val) >= 234 | ||
| 685 | #define output_pixel(pos, acc) \ | ||
| 686 | if (target == AV_PIX_FMT_MONOBLACK) { \ | ||
| 687 | pos = acc; \ | ||
| 688 | } else { \ | ||
| 689 | pos = ~acc; \ | ||
| 690 | } | ||
| 691 | |||
| 692 | static av_always_inline void | ||
| 693 | 93684 | yuv2mono_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 694 | const int16_t **lumSrc, int lumFilterSize, | ||
| 695 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 696 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 697 | const int16_t **alpSrc, uint8_t *dest, int dstW, | ||
| 698 | int y, enum AVPixelFormat target) | ||
| 699 | { | ||
| 700 | 93684 | const uint8_t * const d128 = ff_dither_8x8_220[y&7]; | |
| 701 | int i; | ||
| 702 | 93684 | unsigned acc = 0; | |
| 703 | 93684 | int err = 0; | |
| 704 | |||
| 705 |
2/2✓ Branch 0 taken 16187684 times.
✓ Branch 1 taken 93684 times.
|
16281368 | for (i = 0; i < dstW; i += 2) { |
| 706 | int j; | ||
| 707 | 16187684 | int Y1 = 1 << 18; | |
| 708 | 16187684 | int Y2 = 1 << 18; | |
| 709 | |||
| 710 |
2/2✓ Branch 0 taken 16627684 times.
✓ Branch 1 taken 16187684 times.
|
32815368 | for (j = 0; j < lumFilterSize; j++) { |
| 711 | 16627684 | Y1 += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 712 | 16627684 | Y2 += lumSrc[j][i+1] * (unsigned)lumFilter[j]; | |
| 713 | } | ||
| 714 | 16187684 | Y1 >>= 19; | |
| 715 | 16187684 | Y2 >>= 19; | |
| 716 |
2/2✓ Branch 0 taken 734 times.
✓ Branch 1 taken 16186950 times.
|
16187684 | if ((Y1 | Y2) & 0x100) { |
| 717 | 734 | Y1 = av_clip_uint8(Y1); | |
| 718 | 734 | Y2 = av_clip_uint8(Y2); | |
| 719 | } | ||
| 720 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16187684 times.
|
16187684 | if (c->opts.dither == SWS_DITHER_ED) { |
| 721 | ✗ | Y1 += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4; | |
| 722 | ✗ | c->dither_error[0][i] = err; | |
| 723 | ✗ | acc = 2*acc + (Y1 >= 128); | |
| 724 | ✗ | Y1 -= 220*(acc&1); | |
| 725 | |||
| 726 | ✗ | err = Y2 + ((7*Y1 + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4); | |
| 727 | ✗ | c->dither_error[0][i+1] = Y1; | |
| 728 | ✗ | acc = 2*acc + (err >= 128); | |
| 729 | ✗ | err -= 220*(acc&1); | |
| 730 | } else { | ||
| 731 | 16187684 | accumulate_bit(acc, Y1 + d128[(i + 0) & 7]); | |
| 732 | 16187684 | accumulate_bit(acc, Y2 + d128[(i + 1) & 7]); | |
| 733 | } | ||
| 734 |
2/2✓ Branch 0 taken 4046496 times.
✓ Branch 1 taken 12141188 times.
|
16187684 | if ((i & 7) == 6) { |
| 735 |
2/2✓ Branch 0 taken 790664 times.
✓ Branch 1 taken 3255832 times.
|
4046496 | output_pixel(*dest++, acc); |
| 736 | } | ||
| 737 | } | ||
| 738 | 93684 | c->dither_error[0][i] = err; | |
| 739 | |||
| 740 |
2/2✓ Branch 0 taken 1700 times.
✓ Branch 1 taken 91984 times.
|
93684 | if (i & 6) { |
| 741 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1700 times.
|
1700 | output_pixel(*dest, acc); |
| 742 | } | ||
| 743 | 93684 | } | |
| 744 | |||
| 745 | static av_always_inline void | ||
| 746 | 64 | yuv2mono_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 747 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 748 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 749 | int yalpha, int uvalpha, int y, | ||
| 750 | enum AVPixelFormat target) | ||
| 751 | { | ||
| 752 | 64 | const int16_t *buf0 = buf[0], *buf1 = buf[1]; | |
| 753 | 64 | const uint8_t * const d128 = ff_dither_8x8_220[y & 7]; | |
| 754 | 64 | int yalpha1 = 4096 - yalpha; | |
| 755 | int i; | ||
| 756 | av_assert2(yalpha <= 4096U); | ||
| 757 | |||
| 758 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if (c->opts.dither == SWS_DITHER_ED) { |
| 759 | 64 | int err = 0; | |
| 760 | 64 | unsigned acc = 0; | |
| 761 |
2/2✓ Branch 0 taken 3264 times.
✓ Branch 1 taken 64 times.
|
3328 | for (i = 0; i < dstW; i +=2) { |
| 762 | int Y; | ||
| 763 | |||
| 764 | 3264 | Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; | |
| 765 | 3264 | Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4; | |
| 766 | 3264 | c->dither_error[0][i] = err; | |
| 767 | 3264 | acc = 2*acc + (Y >= 128); | |
| 768 | 3264 | Y -= 220*(acc&1); | |
| 769 | |||
| 770 | 3264 | err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; | |
| 771 | 3264 | err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4; | |
| 772 | 3264 | c->dither_error[0][i+1] = Y; | |
| 773 | 3264 | acc = 2*acc + (err >= 128); | |
| 774 | 3264 | err -= 220*(acc&1); | |
| 775 | |||
| 776 |
2/2✓ Branch 0 taken 768 times.
✓ Branch 1 taken 2496 times.
|
3264 | if ((i & 7) == 6) |
| 777 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 384 times.
|
768 | output_pixel(*dest++, acc); |
| 778 | } | ||
| 779 | 64 | c->dither_error[0][i] = err; | |
| 780 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if (i & 6) |
| 781 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 32 times.
|
64 | output_pixel(*dest, acc << (8 - (i & 7))); |
| 782 | } else { | ||
| 783 | ✗ | for (i = 0; i < dstW; i += 8) { | |
| 784 | int Y; | ||
| 785 | ✗ | unsigned acc = 0; | |
| 786 | |||
| 787 | ✗ | Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; | |
| 788 | ✗ | accumulate_bit(acc, Y + d128[0]); | |
| 789 | ✗ | Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; | |
| 790 | ✗ | accumulate_bit(acc, Y + d128[1]); | |
| 791 | ✗ | Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; | |
| 792 | ✗ | accumulate_bit(acc, Y + d128[2]); | |
| 793 | ✗ | Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; | |
| 794 | ✗ | accumulate_bit(acc, Y + d128[3]); | |
| 795 | ✗ | Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; | |
| 796 | ✗ | accumulate_bit(acc, Y + d128[4]); | |
| 797 | ✗ | Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; | |
| 798 | ✗ | accumulate_bit(acc, Y + d128[5]); | |
| 799 | ✗ | Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; | |
| 800 | ✗ | accumulate_bit(acc, Y + d128[6]); | |
| 801 | ✗ | Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; | |
| 802 | ✗ | accumulate_bit(acc, Y + d128[7]); | |
| 803 | |||
| 804 | ✗ | output_pixel(*dest++, acc); | |
| 805 | } | ||
| 806 | } | ||
| 807 | 64 | } | |
| 808 | |||
| 809 | static av_always_inline void | ||
| 810 | 176672 | yuv2mono_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 811 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 812 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 813 | int uvalpha, int y, enum AVPixelFormat target) | ||
| 814 | { | ||
| 815 | 176672 | const uint8_t * const d128 = ff_dither_8x8_220[y & 7]; | |
| 816 | int i; | ||
| 817 | |||
| 818 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 176640 times.
|
176672 | if (c->opts.dither == SWS_DITHER_ED) { |
| 819 | 32 | int err = 0; | |
| 820 | 32 | unsigned acc = 0; | |
| 821 |
2/2✓ Branch 0 taken 1600 times.
✓ Branch 1 taken 32 times.
|
1632 | for (i = 0; i < dstW; i +=2) { |
| 822 | int Y; | ||
| 823 | |||
| 824 | 1600 | Y = ((buf0[i + 0] + 64) >> 7); | |
| 825 | 1600 | Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4; | |
| 826 | 1600 | c->dither_error[0][i] = err; | |
| 827 | 1600 | acc = 2*acc + (Y >= 128); | |
| 828 | 1600 | Y -= 220*(acc&1); | |
| 829 | |||
| 830 | 1600 | err = ((buf0[i + 1] + 64) >> 7); | |
| 831 | 1600 | err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4; | |
| 832 | 1600 | c->dither_error[0][i+1] = Y; | |
| 833 | 1600 | acc = 2*acc + (err >= 128); | |
| 834 | 1600 | err -= 220*(acc&1); | |
| 835 | |||
| 836 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 1216 times.
|
1600 | if ((i & 7) == 6) |
| 837 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 192 times.
|
384 | output_pixel(*dest++, acc); |
| 838 | } | ||
| 839 | 32 | c->dither_error[0][i] = err; | |
| 840 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if (i & 6) |
| 841 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16 times.
|
32 | output_pixel(*dest, acc << (8 - (i & 7))); |
| 842 | } else { | ||
| 843 |
2/2✓ Branch 0 taken 7333632 times.
✓ Branch 1 taken 176640 times.
|
7510272 | for (i = 0; i < dstW; i += 8) { |
| 844 | 7333632 | unsigned acc = 0; | |
| 845 | 7333632 | accumulate_bit(acc, ((buf0[i + 0] + 64) >> 7) + d128[0]); | |
| 846 | 7333632 | accumulate_bit(acc, ((buf0[i + 1] + 64) >> 7) + d128[1]); | |
| 847 | 7333632 | accumulate_bit(acc, ((buf0[i + 2] + 64) >> 7) + d128[2]); | |
| 848 | 7333632 | accumulate_bit(acc, ((buf0[i + 3] + 64) >> 7) + d128[3]); | |
| 849 | 7333632 | accumulate_bit(acc, ((buf0[i + 4] + 64) >> 7) + d128[4]); | |
| 850 | 7333632 | accumulate_bit(acc, ((buf0[i + 5] + 64) >> 7) + d128[5]); | |
| 851 | 7333632 | accumulate_bit(acc, ((buf0[i + 6] + 64) >> 7) + d128[6]); | |
| 852 | 7333632 | accumulate_bit(acc, ((buf0[i + 7] + 64) >> 7) + d128[7]); | |
| 853 | |||
| 854 |
2/2✓ Branch 0 taken 3638016 times.
✓ Branch 1 taken 3695616 times.
|
7333632 | output_pixel(*dest++, acc); |
| 855 | } | ||
| 856 | } | ||
| 857 | 176672 | } | |
| 858 | |||
| 859 | #undef output_pixel | ||
| 860 | #undef accumulate_bit | ||
| 861 | |||
| 862 | #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \ | ||
| 863 | static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 864 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 865 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 866 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 867 | const int16_t **alpSrc, uint8_t *dest, int dstW, \ | ||
| 868 | int y) \ | ||
| 869 | { \ | ||
| 870 | name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 871 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 872 | alpSrc, dest, dstW, y, fmt); \ | ||
| 873 | } \ | ||
| 874 | \ | ||
| 875 | static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \ | ||
| 876 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 877 | const int16_t *abuf[2], uint8_t *dest, int dstW, \ | ||
| 878 | int yalpha, int uvalpha, int y) \ | ||
| 879 | { \ | ||
| 880 | name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ | ||
| 881 | dest, dstW, yalpha, uvalpha, y, fmt); \ | ||
| 882 | } \ | ||
| 883 | \ | ||
| 884 | static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \ | ||
| 885 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 886 | const int16_t *abuf0, uint8_t *dest, int dstW, \ | ||
| 887 | int uvalpha, int y) \ | ||
| 888 | { \ | ||
| 889 | name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \ | ||
| 890 | abuf0, dest, dstW, uvalpha, \ | ||
| 891 | y, fmt); \ | ||
| 892 | } | ||
| 893 | |||
| 894 | 337592 | YUV2PACKEDWRAPPER(yuv2mono,, white, AV_PIX_FMT_MONOWHITE) | |
| 895 | 203248 | YUV2PACKEDWRAPPER(yuv2mono,, black, AV_PIX_FMT_MONOBLACK) | |
| 896 | |||
| 897 | #define output_pixels(pos, Y1, U, Y2, V) \ | ||
| 898 | if (target == AV_PIX_FMT_YUYV422) { \ | ||
| 899 | dest[pos + 0] = Y1; \ | ||
| 900 | dest[pos + 1] = U; \ | ||
| 901 | dest[pos + 2] = Y2; \ | ||
| 902 | dest[pos + 3] = V; \ | ||
| 903 | } else if (target == AV_PIX_FMT_YVYU422) { \ | ||
| 904 | dest[pos + 0] = Y1; \ | ||
| 905 | dest[pos + 1] = V; \ | ||
| 906 | dest[pos + 2] = Y2; \ | ||
| 907 | dest[pos + 3] = U; \ | ||
| 908 | } else { /* AV_PIX_FMT_UYVY422 */ \ | ||
| 909 | dest[pos + 0] = U; \ | ||
| 910 | dest[pos + 1] = Y1; \ | ||
| 911 | dest[pos + 2] = V; \ | ||
| 912 | dest[pos + 3] = Y2; \ | ||
| 913 | } | ||
| 914 | |||
| 915 | static av_always_inline void | ||
| 916 | 32472 | yuv2422_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 917 | const int16_t **lumSrc, int lumFilterSize, | ||
| 918 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 919 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 920 | const int16_t **alpSrc, uint8_t *dest, int dstW, | ||
| 921 | int y, enum AVPixelFormat target) | ||
| 922 | { | ||
| 923 | int i; | ||
| 924 | |||
| 925 |
2/2✓ Branch 0 taken 5641824 times.
✓ Branch 1 taken 32472 times.
|
5674296 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 926 | int j; | ||
| 927 | 5641824 | int Y1 = 1 << 18; | |
| 928 | 5641824 | int Y2 = 1 << 18; | |
| 929 | 5641824 | int U = 1 << 18; | |
| 930 | 5641824 | int V = 1 << 18; | |
| 931 | |||
| 932 |
2/2✓ Branch 0 taken 6301824 times.
✓ Branch 1 taken 5641824 times.
|
11943648 | for (j = 0; j < lumFilterSize; j++) { |
| 933 | 6301824 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 934 | 6301824 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 935 | } | ||
| 936 |
2/2✓ Branch 0 taken 23047296 times.
✓ Branch 1 taken 5641824 times.
|
28689120 | for (j = 0; j < chrFilterSize; j++) { |
| 937 | 23047296 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 938 | 23047296 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 939 | } | ||
| 940 | 5641824 | Y1 >>= 19; | |
| 941 | 5641824 | Y2 >>= 19; | |
| 942 | 5641824 | U >>= 19; | |
| 943 | 5641824 | V >>= 19; | |
| 944 |
2/2✓ Branch 0 taken 50 times.
✓ Branch 1 taken 5641774 times.
|
5641824 | if ((Y1 | Y2 | U | V) & 0x100) { |
| 945 | 50 | Y1 = av_clip_uint8(Y1); | |
| 946 | 50 | Y2 = av_clip_uint8(Y2); | |
| 947 | 50 | U = av_clip_uint8(U); | |
| 948 | 50 | V = av_clip_uint8(V); | |
| 949 | } | ||
| 950 |
4/4✓ Branch 0 taken 2761248 times.
✓ Branch 1 taken 2880576 times.
✓ Branch 2 taken 1439264 times.
✓ Branch 3 taken 1441312 times.
|
5641824 | output_pixels(4*i, Y1, U, Y2, V); |
| 951 | } | ||
| 952 | 32472 | } | |
| 953 | |||
| 954 | static av_always_inline void | ||
| 955 | ✗ | yuv2422_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 956 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 957 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 958 | int yalpha, int uvalpha, int y, | ||
| 959 | enum AVPixelFormat target) | ||
| 960 | { | ||
| 961 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 962 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 963 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; | |
| 964 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 965 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 966 | int i; | ||
| 967 | av_assert2(yalpha <= 4096U); | ||
| 968 | av_assert2(uvalpha <= 4096U); | ||
| 969 | |||
| 970 | ✗ | for (i = 0; i < ((dstW + 1) >> 1); i++) { | |
| 971 | ✗ | int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; | |
| 972 | ✗ | int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; | |
| 973 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; | |
| 974 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; | |
| 975 | |||
| 976 | ✗ | if ((Y1 | Y2 | U | V) & 0x100) { | |
| 977 | ✗ | Y1 = av_clip_uint8(Y1); | |
| 978 | ✗ | Y2 = av_clip_uint8(Y2); | |
| 979 | ✗ | U = av_clip_uint8(U); | |
| 980 | ✗ | V = av_clip_uint8(V); | |
| 981 | } | ||
| 982 | |||
| 983 | ✗ | output_pixels(i * 4, Y1, U, Y2, V); | |
| 984 | } | ||
| 985 | ✗ | } | |
| 986 | |||
| 987 | static av_always_inline void | ||
| 988 | 333504 | yuv2422_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 989 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 990 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 991 | int uvalpha, int y, enum AVPixelFormat target) | ||
| 992 | { | ||
| 993 | 333504 | const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 994 | int i; | ||
| 995 | |||
| 996 |
1/2✓ Branch 0 taken 333504 times.
✗ Branch 1 not taken.
|
333504 | if (uvalpha < 2048) { |
| 997 |
2/2✓ Branch 0 taken 74594304 times.
✓ Branch 1 taken 333504 times.
|
74927808 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 998 | 74594304 | int Y1 = (buf0[i * 2 ]+64) >> 7; | |
| 999 | 74594304 | int Y2 = (buf0[i * 2 + 1]+64) >> 7; | |
| 1000 | 74594304 | int U = (ubuf0[i] +64) >> 7; | |
| 1001 | 74594304 | int V = (vbuf0[i] +64) >> 7; | |
| 1002 | |||
| 1003 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74594304 times.
|
74594304 | if ((Y1 | Y2 | U | V) & 0x100) { |
| 1004 | ✗ | Y1 = av_clip_uint8(Y1); | |
| 1005 | ✗ | Y2 = av_clip_uint8(Y2); | |
| 1006 | ✗ | U = av_clip_uint8(U); | |
| 1007 | ✗ | V = av_clip_uint8(V); | |
| 1008 | } | ||
| 1009 | |||
| 1010 |
4/4✓ Branch 0 taken 14496768 times.
✓ Branch 1 taken 60097536 times.
✓ Branch 2 taken 14496768 times.
✓ Branch 3 taken 45600768 times.
|
74594304 | output_pixels(i * 4, Y1, U, Y2, V); |
| 1011 | } | ||
| 1012 | } else { | ||
| 1013 | ✗ | const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 1014 | ✗ | for (i = 0; i < ((dstW + 1) >> 1); i++) { | |
| 1015 | ✗ | int Y1 = (buf0[i * 2 ] + 64) >> 7; | |
| 1016 | ✗ | int Y2 = (buf0[i * 2 + 1] + 64) >> 7; | |
| 1017 | ✗ | int U = (ubuf0[i] + ubuf1[i]+128) >> 8; | |
| 1018 | ✗ | int V = (vbuf0[i] + vbuf1[i]+128) >> 8; | |
| 1019 | |||
| 1020 | ✗ | if ((Y1 | Y2 | U | V) & 0x100) { | |
| 1021 | ✗ | Y1 = av_clip_uint8(Y1); | |
| 1022 | ✗ | Y2 = av_clip_uint8(Y2); | |
| 1023 | ✗ | U = av_clip_uint8(U); | |
| 1024 | ✗ | V = av_clip_uint8(V); | |
| 1025 | } | ||
| 1026 | |||
| 1027 | ✗ | output_pixels(i * 4, Y1, U, Y2, V); | |
| 1028 | } | ||
| 1029 | } | ||
| 1030 | 333504 | } | |
| 1031 | |||
| 1032 | #undef output_pixels | ||
| 1033 | |||
| 1034 | 196496 | YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422) | |
| 1035 | 181264 | YUV2PACKEDWRAPPER(yuv2, 422, yvyu422, AV_PIX_FMT_YVYU422) | |
| 1036 | 354192 | YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422) | |
| 1037 | |||
| 1038 | #define R_B ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? R : B) | ||
| 1039 | #define B_R ((target == AV_PIX_FMT_RGB48LE || target == AV_PIX_FMT_RGB48BE || target == AV_PIX_FMT_RGBA64LE || target == AV_PIX_FMT_RGBA64BE) ? B : R) | ||
| 1040 | #define output_pixel(pos, val) \ | ||
| 1041 | if (is_be) { \ | ||
| 1042 | AV_WB16(pos, val); \ | ||
| 1043 | } else { \ | ||
| 1044 | AV_WL16(pos, val); \ | ||
| 1045 | } | ||
| 1046 | |||
| 1047 | static av_always_inline void | ||
| 1048 | 19408 | yuv2ya16_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 1049 | const int32_t **lumSrc, int lumFilterSize, | ||
| 1050 | const int16_t *chrFilter, const int32_t **unused_chrUSrc, | ||
| 1051 | const int32_t **unused_chrVSrc, int unused_chrFilterSize, | ||
| 1052 | const int32_t **alpSrc, uint16_t *dest, int dstW, | ||
| 1053 | int y, enum AVPixelFormat target, | ||
| 1054 | int unused_hasAlpha, int unused_eightbytes, int is_be) | ||
| 1055 | { | ||
| 1056 | 19408 | int hasAlpha = !!alpSrc; | |
| 1057 | int i; | ||
| 1058 | |||
| 1059 |
2/2✓ Branch 0 taken 6770816 times.
✓ Branch 1 taken 19408 times.
|
6790224 | for (i = 0; i < dstW; i++) { |
| 1060 | int j; | ||
| 1061 | 6770816 | int Y = -0x40000000; | |
| 1062 | 6770816 | int A = 0xffff; | |
| 1063 | |||
| 1064 |
2/2✓ Branch 0 taken 7650816 times.
✓ Branch 1 taken 6770816 times.
|
14421632 | for (j = 0; j < lumFilterSize; j++) |
| 1065 | 7650816 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 1066 | |||
| 1067 | 6770816 | Y >>= 15; | |
| 1068 | 6770816 | Y += (1<<3) + 0x8000; | |
| 1069 | 6770816 | Y = av_clip_uint16(Y); | |
| 1070 | |||
| 1071 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 6690816 times.
|
6770816 | if (hasAlpha) { |
| 1072 | 80000 | A = -0x40000000 + (1<<14); | |
| 1073 |
2/2✓ Branch 0 taken 960000 times.
✓ Branch 1 taken 80000 times.
|
1040000 | for (j = 0; j < lumFilterSize; j++) |
| 1074 | 960000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 1075 | |||
| 1076 | 80000 | A >>= 15; | |
| 1077 | 80000 | A += 0x8000; | |
| 1078 | 80000 | A = av_clip_uint16(A); | |
| 1079 | } | ||
| 1080 | |||
| 1081 |
2/2✓ Branch 0 taken 3284032 times.
✓ Branch 1 taken 3486784 times.
|
6770816 | output_pixel(&dest[2 * i ], Y); |
| 1082 |
2/2✓ Branch 0 taken 3284032 times.
✓ Branch 1 taken 3486784 times.
|
6770816 | output_pixel(&dest[2 * i + 1], A); |
| 1083 | } | ||
| 1084 | 19408 | } | |
| 1085 | |||
| 1086 | static av_always_inline void | ||
| 1087 | ✗ | yuv2ya16_2_c_template(SwsInternal *c, const int32_t *buf[2], | |
| 1088 | const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], | ||
| 1089 | const int32_t *abuf[2], uint16_t *dest, int dstW, | ||
| 1090 | int yalpha_param, int unused_uvalpha, int y, | ||
| 1091 | enum AVPixelFormat target, int unused_hasAlpha, | ||
| 1092 | int unused_eightbytes, int is_be) | ||
| 1093 | { | ||
| 1094 | ✗ | unsigned yalpha = yalpha_param; | |
| 1095 | ✗ | int hasAlpha = abuf && abuf[0] && abuf[1]; | |
| 1096 | ✗ | const int32_t *buf0 = buf[0], *buf1 = buf[1], | |
| 1097 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 1098 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 1099 | ✗ | unsigned yalpha1 = 4096 - yalpha; | |
| 1100 | int i; | ||
| 1101 | |||
| 1102 | av_assert2(yalpha <= 4096U); | ||
| 1103 | |||
| 1104 | ✗ | for (i = 0; i < dstW; i++) { | |
| 1105 | ✗ | int Y = (int)(buf0[i] * yalpha1 + buf1[i] * yalpha) >> 15; | |
| 1106 | int A; | ||
| 1107 | |||
| 1108 | ✗ | Y = av_clip_uint16(Y); | |
| 1109 | |||
| 1110 | ✗ | if (hasAlpha) { | |
| 1111 | ✗ | A = (int)(abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 15; | |
| 1112 | ✗ | A = av_clip_uint16(A); | |
| 1113 | } | ||
| 1114 | |||
| 1115 | ✗ | output_pixel(&dest[2 * i ], Y); | |
| 1116 | ✗ | output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535); | |
| 1117 | } | ||
| 1118 | ✗ | } | |
| 1119 | |||
| 1120 | static av_always_inline void | ||
| 1121 | 2304 | yuv2ya16_1_c_template(SwsInternal *c, const int32_t *buf0, | |
| 1122 | const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], | ||
| 1123 | const int32_t *abuf0, uint16_t *dest, int dstW, | ||
| 1124 | int unused_uvalpha, int y, enum AVPixelFormat target, | ||
| 1125 | int unused_hasAlpha, int unused_eightbytes, int is_be) | ||
| 1126 | { | ||
| 1127 | 2304 | int hasAlpha = !!abuf0; | |
| 1128 | int i; | ||
| 1129 | |||
| 1130 |
2/2✓ Branch 0 taken 221184 times.
✓ Branch 1 taken 2304 times.
|
223488 | for (i = 0; i < dstW; i++) { |
| 1131 | 221184 | int Y = buf0[i] >> 3;/* 19 - 16 */ | |
| 1132 | int A; | ||
| 1133 | |||
| 1134 | 221184 | Y = av_clip_uint16(Y); | |
| 1135 | |||
| 1136 |
1/2✓ Branch 0 taken 221184 times.
✗ Branch 1 not taken.
|
221184 | if (hasAlpha) { |
| 1137 | 221184 | A = abuf0[i] >> 3; | |
| 1138 |
2/2✓ Branch 0 taken 113256 times.
✓ Branch 1 taken 107928 times.
|
221184 | if (A & 0x100) |
| 1139 | 113256 | A = av_clip_uint16(A); | |
| 1140 | } | ||
| 1141 | |||
| 1142 |
2/2✓ Branch 0 taken 110592 times.
✓ Branch 1 taken 110592 times.
|
221184 | output_pixel(&dest[2 * i ], Y); |
| 1143 |
4/6✓ Branch 0 taken 110592 times.
✓ Branch 1 taken 110592 times.
✓ Branch 2 taken 110592 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 110592 times.
✗ Branch 5 not taken.
|
221184 | output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535); |
| 1144 | } | ||
| 1145 | 2304 | } | |
| 1146 | |||
| 1147 | static av_always_inline void | ||
| 1148 | 297536 | yuv2rgba64_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 1149 | const int32_t **lumSrc, int lumFilterSize, | ||
| 1150 | const int16_t *chrFilter, const int32_t **chrUSrc, | ||
| 1151 | const int32_t **chrVSrc, int chrFilterSize, | ||
| 1152 | const int32_t **alpSrc, uint16_t *dest, int dstW, | ||
| 1153 | int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, | ||
| 1154 | int is_be) | ||
| 1155 | { | ||
| 1156 | int i; | ||
| 1157 | 297536 | int A1 = 0xffff<<14, A2 = 0xffff<<14; | |
| 1158 | |||
| 1159 |
2/2✓ Branch 0 taken 52168176 times.
✓ Branch 1 taken 297536 times.
|
52465712 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1160 | int j; | ||
| 1161 | 52168176 | unsigned Y1 = -0x40000000; | |
| 1162 | 52168176 | unsigned Y2 = -0x40000000; | |
| 1163 | 52168176 | unsigned U = -(128 << 23); // 19 | |
| 1164 | 52168176 | unsigned V = -(128 << 23); | |
| 1165 | int R, G, B; | ||
| 1166 | |||
| 1167 |
2/2✓ Branch 0 taken 52716480 times.
✓ Branch 1 taken 52168176 times.
|
104884656 | for (j = 0; j < lumFilterSize; j++) { |
| 1168 | 52716480 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 1169 | 52716480 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 1170 | } | ||
| 1171 |
2/2✓ Branch 0 taken 208734144 times.
✓ Branch 1 taken 52168176 times.
|
260902320 | for (j = 0; j < chrFilterSize; j++) {; |
| 1172 | 208734144 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1173 | 208734144 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1174 | } | ||
| 1175 | |||
| 1176 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52168176 times.
|
52168176 | if (hasAlpha) { |
| 1177 | ✗ | A1 = -0x40000000; | |
| 1178 | ✗ | A2 = -0x40000000; | |
| 1179 | ✗ | for (j = 0; j < lumFilterSize; j++) { | |
| 1180 | ✗ | A1 += alpSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 1181 | ✗ | A2 += alpSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 1182 | } | ||
| 1183 | ✗ | A1 >>= 1; | |
| 1184 | ✗ | A1 += 0x20002000; | |
| 1185 | ✗ | A2 >>= 1; | |
| 1186 | ✗ | A2 += 0x20002000; | |
| 1187 | } | ||
| 1188 | |||
| 1189 | // 8 bits: 12+15=27; 16 bits: 12+19=31 | ||
| 1190 | 52168176 | Y1 = (int)Y1 >> 14; // 10 | |
| 1191 | 52168176 | Y1 += 0x10000; | |
| 1192 | 52168176 | Y2 = (int)Y2 >> 14; | |
| 1193 | 52168176 | Y2 += 0x10000; | |
| 1194 | 52168176 | U = (int)U >> 14; | |
| 1195 | 52168176 | V = (int)V >> 14; | |
| 1196 | |||
| 1197 | // 8 bits: 27 -> 17 bits, 16 bits: 31 - 14 = 17 bits | ||
| 1198 | 52168176 | Y1 -= c->yuv2rgb_y_offset; | |
| 1199 | 52168176 | Y2 -= c->yuv2rgb_y_offset; | |
| 1200 | 52168176 | Y1 *= c->yuv2rgb_y_coeff; | |
| 1201 | 52168176 | Y2 *= c->yuv2rgb_y_coeff; | |
| 1202 | 52168176 | Y1 += (1 << 13) - (1 << 29); // 21 | |
| 1203 | 52168176 | Y2 += (1 << 13) - (1 << 29); | |
| 1204 | // 8 bits: 17 + 13 bits = 30 bits, 16 bits: 17 + 13 bits = 30 bits | ||
| 1205 | |||
| 1206 | 52168176 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1207 | 52168176 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1208 | 52168176 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1209 | |||
| 1210 | // 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits | ||
| 1211 |
14/18✓ Branch 0 taken 9535488 times.
✓ Branch 1 taken 42632688 times.
✓ Branch 2 taken 9535488 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4870656 times.
✓ Branch 5 taken 4664832 times.
✓ Branch 6 taken 4870656 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1623552 times.
✓ Branch 9 taken 3247104 times.
✓ Branch 10 taken 5985792 times.
✓ Branch 11 taken 36646896 times.
✓ Branch 12 taken 5985792 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 3348480 times.
✓ Branch 15 taken 2637312 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 3348480 times.
|
52168176 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)); |
| 1212 |
2/2✓ Branch 0 taken 9535488 times.
✓ Branch 1 taken 42632688 times.
|
52168176 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16)); |
| 1213 |
14/18✓ Branch 0 taken 9535488 times.
✓ Branch 1 taken 42632688 times.
✓ Branch 2 taken 9535488 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4870656 times.
✓ Branch 5 taken 4664832 times.
✓ Branch 6 taken 4870656 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1623552 times.
✓ Branch 9 taken 3247104 times.
✓ Branch 10 taken 5985792 times.
✓ Branch 11 taken 36646896 times.
✓ Branch 12 taken 5985792 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 3348480 times.
✓ Branch 15 taken 2637312 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 3348480 times.
|
52168176 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)); |
| 1214 |
2/2✓ Branch 0 taken 7507968 times.
✓ Branch 1 taken 44660208 times.
|
52168176 | if (eightbytes) { |
| 1215 |
2/2✓ Branch 0 taken 3247104 times.
✓ Branch 1 taken 4260864 times.
|
7507968 | output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); |
| 1216 |
12/18✓ Branch 0 taken 3247104 times.
✓ Branch 1 taken 4260864 times.
✓ Branch 2 taken 3247104 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3247104 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3247104 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1623552 times.
✓ Branch 9 taken 1623552 times.
✓ Branch 10 taken 4260864 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4260864 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1623552 times.
✓ Branch 15 taken 2637312 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1623552 times.
|
7507968 | output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1217 |
2/2✓ Branch 0 taken 3247104 times.
✓ Branch 1 taken 4260864 times.
|
7507968 | output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1218 |
12/18✓ Branch 0 taken 3247104 times.
✓ Branch 1 taken 4260864 times.
✓ Branch 2 taken 3247104 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3247104 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3247104 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1623552 times.
✓ Branch 9 taken 1623552 times.
✓ Branch 10 taken 4260864 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4260864 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1623552 times.
✓ Branch 15 taken 2637312 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1623552 times.
|
7507968 | output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1219 |
2/2✓ Branch 0 taken 3247104 times.
✓ Branch 1 taken 4260864 times.
|
7507968 | output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); |
| 1220 | 7507968 | dest += 8; | |
| 1221 | } else { | ||
| 1222 |
12/18✓ Branch 0 taken 6288384 times.
✓ Branch 1 taken 38371824 times.
✓ Branch 2 taken 6288384 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1623552 times.
✓ Branch 5 taken 4664832 times.
✓ Branch 6 taken 1623552 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1623552 times.
✓ Branch 10 taken 1724928 times.
✓ Branch 11 taken 36646896 times.
✓ Branch 12 taken 1724928 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1724928 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1724928 times.
|
44660208 | output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1223 |
2/2✓ Branch 0 taken 6288384 times.
✓ Branch 1 taken 38371824 times.
|
44660208 | output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1224 |
12/18✓ Branch 0 taken 6288384 times.
✓ Branch 1 taken 38371824 times.
✓ Branch 2 taken 6288384 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1623552 times.
✓ Branch 5 taken 4664832 times.
✓ Branch 6 taken 1623552 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1623552 times.
✓ Branch 10 taken 1724928 times.
✓ Branch 11 taken 36646896 times.
✓ Branch 12 taken 1724928 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1724928 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1724928 times.
|
44660208 | output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1225 | 44660208 | dest += 6; | |
| 1226 | } | ||
| 1227 | } | ||
| 1228 | 297536 | } | |
| 1229 | |||
| 1230 | static av_always_inline void | ||
| 1231 | 72 | yuv2rgba64_2_c_template(SwsInternal *c, const int32_t *buf[2], | |
| 1232 | const int32_t *ubuf[2], const int32_t *vbuf[2], | ||
| 1233 | const int32_t *abuf[2], uint16_t *dest, int dstW, | ||
| 1234 | int yalpha_param, int uvalpha_param, int y, | ||
| 1235 | enum AVPixelFormat target, int hasAlpha, int eightbytes, | ||
| 1236 | int is_be) | ||
| 1237 | { | ||
| 1238 | 72 | unsigned yalpha = yalpha_param; | |
| 1239 | 72 | unsigned uvalpha = uvalpha_param; | |
| 1240 | 72 | const int32_t *buf0 = buf[0], *buf1 = buf[1], | |
| 1241 | 72 | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 1242 | 72 | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 1243 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | *abuf0 = hasAlpha ? abuf[0] : NULL, |
| 1244 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | *abuf1 = hasAlpha ? abuf[1] : NULL; |
| 1245 | 72 | unsigned yalpha1 = 4096 - yalpha; | |
| 1246 | 72 | unsigned uvalpha1 = 4096 - uvalpha; | |
| 1247 | int i; | ||
| 1248 | 72 | int A1 = 0xffff<<14, A2 = 0xffff<<14; | |
| 1249 | |||
| 1250 | av_assert2(yalpha <= 4096U); | ||
| 1251 | av_assert2(uvalpha <= 4096U); | ||
| 1252 | |||
| 1253 |
2/2✓ Branch 0 taken 18432 times.
✓ Branch 1 taken 72 times.
|
18504 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1254 | 18432 | unsigned Y1 = (int)(buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14; | |
| 1255 | 18432 | unsigned Y2 = (int)(buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14; | |
| 1256 | 18432 | int U = (int)(ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1257 | 18432 | int V = (int)(vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1258 | int R, G, B; | ||
| 1259 | |||
| 1260 | 18432 | Y1 -= c->yuv2rgb_y_offset; | |
| 1261 | 18432 | Y2 -= c->yuv2rgb_y_offset; | |
| 1262 | 18432 | Y1 *= c->yuv2rgb_y_coeff; | |
| 1263 | 18432 | Y2 *= c->yuv2rgb_y_coeff; | |
| 1264 | 18432 | Y1 += (1 << 13) - (1 << 29); | |
| 1265 | 18432 | Y2 += (1 << 13) - (1 << 29); | |
| 1266 | |||
| 1267 | 18432 | R = (SUINT)V * c->yuv2rgb_v2r_coeff; | |
| 1268 | 18432 | G = (SUINT)V * c->yuv2rgb_v2g_coeff + (SUINT)U * c->yuv2rgb_u2g_coeff; | |
| 1269 | 18432 | B = (SUINT)U * c->yuv2rgb_u2b_coeff; | |
| 1270 | |||
| 1271 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18432 times.
|
18432 | if (hasAlpha) { |
| 1272 | ✗ | A1 = (int)(abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 1; | |
| 1273 | ✗ | A2 = (int)(abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 1; | |
| 1274 | |||
| 1275 | ✗ | A1 += 1 << 13; | |
| 1276 | ✗ | A2 += 1 << 13; | |
| 1277 | } | ||
| 1278 | |||
| 1279 |
14/18✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 9216 times.
✓ Branch 2 taken 9216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6912 times.
✓ Branch 5 taken 2304 times.
✓ Branch 6 taken 6912 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2304 times.
✓ Branch 9 taken 4608 times.
✓ Branch 10 taken 6912 times.
✓ Branch 11 taken 2304 times.
✓ Branch 12 taken 6912 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 4608 times.
✓ Branch 15 taken 2304 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 4608 times.
|
18432 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)); |
| 1280 |
2/2✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 9216 times.
|
18432 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16)); |
| 1281 |
14/18✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 9216 times.
✓ Branch 2 taken 9216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6912 times.
✓ Branch 5 taken 2304 times.
✓ Branch 6 taken 6912 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2304 times.
✓ Branch 9 taken 4608 times.
✓ Branch 10 taken 6912 times.
✓ Branch 11 taken 2304 times.
✓ Branch 12 taken 6912 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 4608 times.
✓ Branch 15 taken 2304 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 4608 times.
|
18432 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)); |
| 1282 |
2/2✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 9216 times.
|
18432 | if (eightbytes) { |
| 1283 |
2/2✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 4608 times.
|
9216 | output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); |
| 1284 |
12/18✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 4608 times.
✓ Branch 2 taken 4608 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4608 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4608 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2304 times.
✓ Branch 9 taken 2304 times.
✓ Branch 10 taken 4608 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4608 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2304 times.
✓ Branch 15 taken 2304 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 2304 times.
|
9216 | output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1285 |
2/2✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 4608 times.
|
9216 | output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1286 |
12/18✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 4608 times.
✓ Branch 2 taken 4608 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4608 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4608 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2304 times.
✓ Branch 9 taken 2304 times.
✓ Branch 10 taken 4608 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4608 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2304 times.
✓ Branch 15 taken 2304 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 2304 times.
|
9216 | output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1287 |
2/2✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 4608 times.
|
9216 | output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); |
| 1288 | 9216 | dest += 8; | |
| 1289 | } else { | ||
| 1290 |
12/18✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 4608 times.
✓ Branch 2 taken 4608 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2304 times.
✓ Branch 5 taken 2304 times.
✓ Branch 6 taken 2304 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2304 times.
✓ Branch 10 taken 2304 times.
✓ Branch 11 taken 2304 times.
✓ Branch 12 taken 2304 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2304 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 2304 times.
|
9216 | output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1291 |
2/2✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 4608 times.
|
9216 | output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1292 |
12/18✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 4608 times.
✓ Branch 2 taken 4608 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2304 times.
✓ Branch 5 taken 2304 times.
✓ Branch 6 taken 2304 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 2304 times.
✓ Branch 10 taken 2304 times.
✓ Branch 11 taken 2304 times.
✓ Branch 12 taken 2304 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2304 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 2304 times.
|
9216 | output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1293 | 9216 | dest += 6; | |
| 1294 | } | ||
| 1295 | } | ||
| 1296 | 72 | } | |
| 1297 | |||
| 1298 | static av_always_inline void | ||
| 1299 | 209708 | yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0, | |
| 1300 | const int32_t *ubuf[2], const int32_t *vbuf[2], | ||
| 1301 | const int32_t *abuf0, uint16_t *dest, int dstW, | ||
| 1302 | int uvalpha, int y, enum AVPixelFormat target, | ||
| 1303 | int hasAlpha, int eightbytes, int is_be) | ||
| 1304 | { | ||
| 1305 | 209708 | const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 1306 | int i; | ||
| 1307 | 209708 | SUINT A1 = 0xffff<<14, A2= 0xffff<<14; | |
| 1308 | |||
| 1309 |
2/2✓ Branch 0 taken 209660 times.
✓ Branch 1 taken 48 times.
|
209708 | if (uvalpha == 0) { |
| 1310 |
2/2✓ Branch 0 taken 36631780 times.
✓ Branch 1 taken 209660 times.
|
36841440 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1311 | 36631780 | SUINT Y1 = (buf0[i * 2] ) >> 2; | |
| 1312 | 36631780 | SUINT Y2 = (buf0[i * 2 + 1]) >> 2; | |
| 1313 | 36631780 | SUINT U = (ubuf0[i] - (128 << 11)) >> 2; | |
| 1314 | 36631780 | SUINT V = (vbuf0[i] - (128 << 11)) >> 2; | |
| 1315 | int R, G, B; | ||
| 1316 | |||
| 1317 | 36631780 | Y1 -= c->yuv2rgb_y_offset; | |
| 1318 | 36631780 | Y2 -= c->yuv2rgb_y_offset; | |
| 1319 | 36631780 | Y1 *= c->yuv2rgb_y_coeff; | |
| 1320 | 36631780 | Y2 *= c->yuv2rgb_y_coeff; | |
| 1321 | 36631780 | Y1 += (1 << 13) - (1 << 29); | |
| 1322 | 36631780 | Y2 += (1 << 13) - (1 << 29); | |
| 1323 | |||
| 1324 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36631780 times.
|
36631780 | if (hasAlpha) { |
| 1325 | ✗ | A1 = abuf0[i * 2 ] * (SUINT)(1 << 11); | |
| 1326 | ✗ | A2 = abuf0[i * 2 + 1] * (SUINT)(1 << 11); | |
| 1327 | |||
| 1328 | ✗ | A1 += 1 << 13; | |
| 1329 | ✗ | A2 += 1 << 13; | |
| 1330 | } | ||
| 1331 | |||
| 1332 | 36631780 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1333 | 36631780 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1334 | 36631780 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1335 | |||
| 1336 |
14/18✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 36628708 times.
✓ Branch 2 taken 3072 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2304 times.
✓ Branch 5 taken 768 times.
✓ Branch 6 taken 2304 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 768 times.
✓ Branch 9 taken 1536 times.
✓ Branch 10 taken 2304 times.
✓ Branch 11 taken 36626404 times.
✓ Branch 12 taken 2304 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1536 times.
✓ Branch 15 taken 768 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1536 times.
|
36631780 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)); |
| 1337 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 36628708 times.
|
36631780 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16)); |
| 1338 |
14/18✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 36628708 times.
✓ Branch 2 taken 3072 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2304 times.
✓ Branch 5 taken 768 times.
✓ Branch 6 taken 2304 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 768 times.
✓ Branch 9 taken 1536 times.
✓ Branch 10 taken 2304 times.
✓ Branch 11 taken 36626404 times.
✓ Branch 12 taken 2304 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1536 times.
✓ Branch 15 taken 768 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1536 times.
|
36631780 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)); |
| 1339 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 36628708 times.
|
36631780 | if (eightbytes) { |
| 1340 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 1536 times.
|
3072 | output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); |
| 1341 |
12/18✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 1536 times.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1536 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 768 times.
✓ Branch 9 taken 768 times.
✓ Branch 10 taken 1536 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1536 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 768 times.
✓ Branch 15 taken 768 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 768 times.
|
3072 | output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1342 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 1536 times.
|
3072 | output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1343 |
12/18✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 1536 times.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1536 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 768 times.
✓ Branch 9 taken 768 times.
✓ Branch 10 taken 1536 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1536 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 768 times.
✓ Branch 15 taken 768 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 768 times.
|
3072 | output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1344 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 1536 times.
|
3072 | output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); |
| 1345 | 3072 | dest += 8; | |
| 1346 | } else { | ||
| 1347 |
12/18✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 36627172 times.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 768 times.
✓ Branch 5 taken 768 times.
✓ Branch 6 taken 768 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 768 times.
✓ Branch 10 taken 768 times.
✓ Branch 11 taken 36626404 times.
✓ Branch 12 taken 768 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 768 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 768 times.
|
36628708 | output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1348 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 36627172 times.
|
36628708 | output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1349 |
12/18✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 36627172 times.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 768 times.
✓ Branch 5 taken 768 times.
✓ Branch 6 taken 768 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 768 times.
✓ Branch 10 taken 768 times.
✓ Branch 11 taken 36626404 times.
✓ Branch 12 taken 768 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 768 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 768 times.
|
36628708 | output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1350 | 36628708 | dest += 6; | |
| 1351 | } | ||
| 1352 | } | ||
| 1353 | } else { | ||
| 1354 | 48 | const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 1355 | 48 | SUINT A1 = 0xffff<<14, A2 = 0xffff<<14; | |
| 1356 | 48 | unsigned uvalpha1 = 4096 - uvalpha; | |
| 1357 | av_assert2(uvalpha <= 4096U); | ||
| 1358 | |||
| 1359 |
2/2✓ Branch 0 taken 12288 times.
✓ Branch 1 taken 48 times.
|
12336 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1360 | 12288 | SUINT Y1 = (buf0[i * 2] ) >> 2; | |
| 1361 | 12288 | SUINT Y2 = (buf0[i * 2 + 1]) >> 2; | |
| 1362 | 12288 | SUINT U = (int)((SUINT)ubuf0[i] * uvalpha1 + (SUINT)ubuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1363 | 12288 | SUINT V = (int)((SUINT)vbuf0[i] * uvalpha1 + (SUINT)vbuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1364 | int R, G, B; | ||
| 1365 | |||
| 1366 | 12288 | Y1 -= c->yuv2rgb_y_offset; | |
| 1367 | 12288 | Y2 -= c->yuv2rgb_y_offset; | |
| 1368 | 12288 | Y1 *= c->yuv2rgb_y_coeff; | |
| 1369 | 12288 | Y2 *= c->yuv2rgb_y_coeff; | |
| 1370 | 12288 | Y1 += (1 << 13) - (1 << 29); | |
| 1371 | 12288 | Y2 += (1 << 13) - (1 << 29); | |
| 1372 | |||
| 1373 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12288 times.
|
12288 | if (hasAlpha) { |
| 1374 | ✗ | A1 = abuf0[i * 2 ] * (SUINT)(1 << 11); | |
| 1375 | ✗ | A2 = abuf0[i * 2 + 1] * (SUINT)(1 << 11); | |
| 1376 | |||
| 1377 | ✗ | A1 += 1 << 13; | |
| 1378 | ✗ | A2 += 1 << 13; | |
| 1379 | } | ||
| 1380 | |||
| 1381 | 12288 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1382 | 12288 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1383 | 12288 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1384 | |||
| 1385 |
14/18✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 6144 times.
✓ Branch 2 taken 6144 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4608 times.
✓ Branch 5 taken 1536 times.
✓ Branch 6 taken 4608 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1536 times.
✓ Branch 9 taken 3072 times.
✓ Branch 10 taken 4608 times.
✓ Branch 11 taken 1536 times.
✓ Branch 12 taken 4608 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 3072 times.
✓ Branch 15 taken 1536 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 3072 times.
|
12288 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)); |
| 1386 |
2/2✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 6144 times.
|
12288 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16)); |
| 1387 |
14/18✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 6144 times.
✓ Branch 2 taken 6144 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4608 times.
✓ Branch 5 taken 1536 times.
✓ Branch 6 taken 4608 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1536 times.
✓ Branch 9 taken 3072 times.
✓ Branch 10 taken 4608 times.
✓ Branch 11 taken 1536 times.
✓ Branch 12 taken 4608 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 3072 times.
✓ Branch 15 taken 1536 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 3072 times.
|
12288 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)); |
| 1388 |
2/2✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 6144 times.
|
12288 | if (eightbytes) { |
| 1389 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
|
6144 | output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); |
| 1390 |
12/18✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 3072 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3072 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3072 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1536 times.
✓ Branch 9 taken 1536 times.
✓ Branch 10 taken 3072 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3072 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1536 times.
✓ Branch 15 taken 1536 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1536 times.
|
6144 | output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1391 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
|
6144 | output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1392 |
12/18✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 3072 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3072 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3072 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1536 times.
✓ Branch 9 taken 1536 times.
✓ Branch 10 taken 3072 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3072 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1536 times.
✓ Branch 15 taken 1536 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1536 times.
|
6144 | output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1393 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
|
6144 | output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); |
| 1394 | 6144 | dest += 8; | |
| 1395 | } else { | ||
| 1396 |
12/18✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 3072 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 1536 times.
✓ Branch 6 taken 1536 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1536 times.
✓ Branch 10 taken 1536 times.
✓ Branch 11 taken 1536 times.
✓ Branch 12 taken 1536 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1536 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1536 times.
|
6144 | output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1397 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
|
6144 | output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1398 |
12/18✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 3072 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 1536 times.
✓ Branch 6 taken 1536 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1536 times.
✓ Branch 10 taken 1536 times.
✓ Branch 11 taken 1536 times.
✓ Branch 12 taken 1536 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1536 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1536 times.
|
6144 | output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1399 | 6144 | dest += 6; | |
| 1400 | } | ||
| 1401 | } | ||
| 1402 | } | ||
| 1403 | 209708 | } | |
| 1404 | |||
| 1405 | static av_always_inline void | ||
| 1406 | 2000 | yuv2rgba64_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 1407 | const int32_t **lumSrc, int lumFilterSize, | ||
| 1408 | const int16_t *chrFilter, const int32_t **chrUSrc, | ||
| 1409 | const int32_t **chrVSrc, int chrFilterSize, | ||
| 1410 | const int32_t **alpSrc, uint16_t *dest, int dstW, | ||
| 1411 | int y, enum AVPixelFormat target, int hasAlpha, | ||
| 1412 | int eightbytes, int is_be) | ||
| 1413 | { | ||
| 1414 | int i; | ||
| 1415 | 2000 | int A = 0xffff<<14; | |
| 1416 | |||
| 1417 |
2/2✓ Branch 0 taken 400000 times.
✓ Branch 1 taken 2000 times.
|
402000 | for (i = 0; i < dstW; i++) { |
| 1418 | int j; | ||
| 1419 | 400000 | int Y = -0x40000000; | |
| 1420 | 400000 | int U = -(128 << 23); // 19 | |
| 1421 | 400000 | int V = -(128 << 23); | |
| 1422 | int R, G, B; | ||
| 1423 | |||
| 1424 |
2/2✓ Branch 0 taken 4800000 times.
✓ Branch 1 taken 400000 times.
|
5200000 | for (j = 0; j < lumFilterSize; j++) { |
| 1425 | 4800000 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 1426 | } | ||
| 1427 |
2/2✓ Branch 0 taken 4800000 times.
✓ Branch 1 taken 400000 times.
|
5200000 | for (j = 0; j < chrFilterSize; j++) {; |
| 1428 | 4800000 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1429 | 4800000 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1430 | } | ||
| 1431 | |||
| 1432 |
2/2✓ Branch 0 taken 160000 times.
✓ Branch 1 taken 240000 times.
|
400000 | if (hasAlpha) { |
| 1433 | 160000 | A = -0x40000000; | |
| 1434 |
2/2✓ Branch 0 taken 1920000 times.
✓ Branch 1 taken 160000 times.
|
2080000 | for (j = 0; j < lumFilterSize; j++) { |
| 1435 | 1920000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 1436 | } | ||
| 1437 | 160000 | A >>= 1; | |
| 1438 | 160000 | A += 0x20002000; | |
| 1439 | } | ||
| 1440 | |||
| 1441 | // 8bit: 12+15=27; 16-bit: 12+19=31 | ||
| 1442 | 400000 | Y >>= 14; // 10 | |
| 1443 | 400000 | Y += 0x10000; | |
| 1444 | 400000 | U >>= 14; | |
| 1445 | 400000 | V >>= 14; | |
| 1446 | |||
| 1447 | // 8bit: 27 -> 17bit, 16bit: 31 - 14 = 17bit | ||
| 1448 | 400000 | Y -= c->yuv2rgb_y_offset; | |
| 1449 | 400000 | Y *= c->yuv2rgb_y_coeff; | |
| 1450 | 400000 | Y += (1 << 13) - (1<<29); // 21 | |
| 1451 | // 8bit: 17 + 13bit = 30bit, 16bit: 17 + 13bit = 30bit | ||
| 1452 | |||
| 1453 | 400000 | R = (unsigned)V * c->yuv2rgb_v2r_coeff; | |
| 1454 | 400000 | G = (unsigned)V * c->yuv2rgb_v2g_coeff + (unsigned)U * c->yuv2rgb_u2g_coeff; | |
| 1455 | 400000 | B = (unsigned)U * c->yuv2rgb_u2b_coeff; | |
| 1456 | |||
| 1457 | // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit | ||
| 1458 |
14/18✓ Branch 0 taken 200000 times.
✓ Branch 1 taken 200000 times.
✓ Branch 2 taken 200000 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 120000 times.
✓ Branch 5 taken 80000 times.
✓ Branch 6 taken 120000 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 40000 times.
✓ Branch 9 taken 80000 times.
✓ Branch 10 taken 120000 times.
✓ Branch 11 taken 80000 times.
✓ Branch 12 taken 120000 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 80000 times.
✓ Branch 15 taken 40000 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 80000 times.
|
400000 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + (unsigned)Y)>>14) + (1<<15), 16)); |
| 1459 |
2/2✓ Branch 0 taken 200000 times.
✓ Branch 1 taken 200000 times.
|
400000 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + (unsigned)Y)>>14) + (1<<15), 16)); |
| 1460 |
14/18✓ Branch 0 taken 200000 times.
✓ Branch 1 taken 200000 times.
✓ Branch 2 taken 200000 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 120000 times.
✓ Branch 5 taken 80000 times.
✓ Branch 6 taken 120000 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 40000 times.
✓ Branch 9 taken 80000 times.
✓ Branch 10 taken 120000 times.
✓ Branch 11 taken 80000 times.
✓ Branch 12 taken 120000 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 80000 times.
✓ Branch 15 taken 40000 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 80000 times.
|
400000 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + (unsigned)Y)>>14) + (1<<15), 16)); |
| 1461 |
2/2✓ Branch 0 taken 160000 times.
✓ Branch 1 taken 240000 times.
|
400000 | if (eightbytes) { |
| 1462 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 80000 times.
|
160000 | output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); |
| 1463 | 160000 | dest += 4; | |
| 1464 | } else { | ||
| 1465 | 240000 | dest += 3; | |
| 1466 | } | ||
| 1467 | } | ||
| 1468 | 2000 | } | |
| 1469 | |||
| 1470 | static av_always_inline void | ||
| 1471 | ✗ | yuv2rgba64_full_2_c_template(SwsInternal *c, const int32_t *buf[2], | |
| 1472 | const int32_t *ubuf[2], const int32_t *vbuf[2], | ||
| 1473 | const int32_t *abuf[2], uint16_t *dest, int dstW, | ||
| 1474 | int yalpha_param, int uvalpha_param, int y, | ||
| 1475 | enum AVPixelFormat target, int hasAlpha, int eightbytes, | ||
| 1476 | int is_be) | ||
| 1477 | { | ||
| 1478 | ✗ | unsigned yalpha = yalpha_param; | |
| 1479 | ✗ | unsigned uvalpha = uvalpha_param; | |
| 1480 | ✗ | const int32_t *buf0 = buf[0], *buf1 = buf[1], | |
| 1481 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 1482 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 1483 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 1484 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 1485 | ✗ | unsigned yalpha1 = 4096 - yalpha; | |
| 1486 | ✗ | unsigned uvalpha1 = 4096 - uvalpha; | |
| 1487 | int i; | ||
| 1488 | ✗ | int A = 0xffff<<14; | |
| 1489 | |||
| 1490 | av_assert2(yalpha <= 4096U); | ||
| 1491 | av_assert2(uvalpha <= 4096U); | ||
| 1492 | |||
| 1493 | ✗ | for (i = 0; i < dstW; i++) { | |
| 1494 | ✗ | unsigned Y = (int)(buf0[i] * yalpha1 + buf1[i] * yalpha) >> 14; | |
| 1495 | ✗ | unsigned U = (int)(ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1496 | ✗ | unsigned V = (int)(vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1497 | int R, G, B; | ||
| 1498 | |||
| 1499 | ✗ | Y -= c->yuv2rgb_y_offset; | |
| 1500 | ✗ | Y *= c->yuv2rgb_y_coeff; | |
| 1501 | ✗ | Y += (1 << 13) - (1 << 29); | |
| 1502 | |||
| 1503 | ✗ | R = V * c->yuv2rgb_v2r_coeff; | |
| 1504 | ✗ | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1505 | ✗ | B = U * c->yuv2rgb_u2b_coeff; | |
| 1506 | |||
| 1507 | ✗ | if (hasAlpha) { | |
| 1508 | ✗ | A = (int)(abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 1; | |
| 1509 | |||
| 1510 | ✗ | A += 1 << 13; | |
| 1511 | } | ||
| 1512 | |||
| 1513 | ✗ | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)); | |
| 1514 | ✗ | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y) >> 14) + (1<<15), 16)); | |
| 1515 | ✗ | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)); | |
| 1516 | ✗ | if (eightbytes) { | |
| 1517 | ✗ | output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); | |
| 1518 | ✗ | dest += 4; | |
| 1519 | } else { | ||
| 1520 | ✗ | dest += 3; | |
| 1521 | } | ||
| 1522 | } | ||
| 1523 | ✗ | } | |
| 1524 | |||
| 1525 | static av_always_inline void | ||
| 1526 | 451392 | yuv2rgba64_full_1_c_template(SwsInternal *c, const int32_t *buf0, | |
| 1527 | const int32_t *ubuf[2], const int32_t *vbuf[2], | ||
| 1528 | const int32_t *abuf0, uint16_t *dest, int dstW, | ||
| 1529 | int uvalpha, int y, enum AVPixelFormat target, | ||
| 1530 | int hasAlpha, int eightbytes, int is_be) | ||
| 1531 | { | ||
| 1532 | 451392 | const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 1533 | int i; | ||
| 1534 | 451392 | SUINT A = 0xffff<<14; | |
| 1535 | |||
| 1536 |
1/2✓ Branch 0 taken 451392 times.
✗ Branch 1 not taken.
|
451392 | if (uvalpha == 0) { |
| 1537 |
2/2✓ Branch 0 taken 156432384 times.
✓ Branch 1 taken 451392 times.
|
156883776 | for (i = 0; i < dstW; i++) { |
| 1538 | 156432384 | SUINT Y = (buf0[i]) >> 2; | |
| 1539 | 156432384 | SUINT U = (ubuf0[i] - (128 << 11)) >> 2; | |
| 1540 | 156432384 | SUINT V = (vbuf0[i] - (128 << 11)) >> 2; | |
| 1541 | int R, G, B; | ||
| 1542 | |||
| 1543 | 156432384 | Y -= c->yuv2rgb_y_offset; | |
| 1544 | 156432384 | Y *= c->yuv2rgb_y_coeff; | |
| 1545 | 156432384 | Y += (1 << 13) - (1 << 29); | |
| 1546 | |||
| 1547 |
2/2✓ Branch 0 taken 442368 times.
✓ Branch 1 taken 155990016 times.
|
156432384 | if (hasAlpha) { |
| 1548 | 442368 | A = abuf0[i] * (SUINT)(1 << 11); | |
| 1549 | |||
| 1550 | 442368 | A += 1 << 13; | |
| 1551 | } | ||
| 1552 | |||
| 1553 | 156432384 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1554 | 156432384 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1555 | 156432384 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1556 | |||
| 1557 |
14/18✓ Branch 0 taken 442368 times.
✓ Branch 1 taken 155990016 times.
✓ Branch 2 taken 442368 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 331776 times.
✓ Branch 5 taken 110592 times.
✓ Branch 6 taken 331776 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 110592 times.
✓ Branch 9 taken 221184 times.
✓ Branch 10 taken 359424 times.
✓ Branch 11 taken 155630592 times.
✓ Branch 12 taken 359424 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 239616 times.
✓ Branch 15 taken 119808 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 239616 times.
|
156432384 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)); |
| 1558 |
2/2✓ Branch 0 taken 442368 times.
✓ Branch 1 taken 155990016 times.
|
156432384 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y) >> 14) + (1<<15), 16)); |
| 1559 |
14/18✓ Branch 0 taken 442368 times.
✓ Branch 1 taken 155990016 times.
✓ Branch 2 taken 442368 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 331776 times.
✓ Branch 5 taken 110592 times.
✓ Branch 6 taken 331776 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 110592 times.
✓ Branch 9 taken 221184 times.
✓ Branch 10 taken 359424 times.
✓ Branch 11 taken 155630592 times.
✓ Branch 12 taken 359424 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 239616 times.
✓ Branch 15 taken 119808 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 239616 times.
|
156432384 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)); |
| 1560 |
2/2✓ Branch 0 taken 460800 times.
✓ Branch 1 taken 155971584 times.
|
156432384 | if (eightbytes) { |
| 1561 |
2/2✓ Branch 0 taken 221184 times.
✓ Branch 1 taken 239616 times.
|
460800 | output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); |
| 1562 | 460800 | dest += 4; | |
| 1563 | } else { | ||
| 1564 | 155971584 | dest += 3; | |
| 1565 | } | ||
| 1566 | } | ||
| 1567 | } else { | ||
| 1568 | ✗ | const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 1569 | ✗ | unsigned uvalpha1 = 4096 - uvalpha; | |
| 1570 | ✗ | SUINT A = 0xffff<<14; | |
| 1571 | av_assert2(uvalpha <= 4096U); | ||
| 1572 | |||
| 1573 | ✗ | for (i = 0; i < dstW; i++) { | |
| 1574 | ✗ | SUINT Y = (buf0[i] ) >> 2; | |
| 1575 | ✗ | SUINT U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1576 | ✗ | SUINT V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1577 | int R, G, B; | ||
| 1578 | |||
| 1579 | ✗ | Y -= c->yuv2rgb_y_offset; | |
| 1580 | ✗ | Y *= c->yuv2rgb_y_coeff; | |
| 1581 | ✗ | Y += (1 << 13) - (1 << 29); | |
| 1582 | |||
| 1583 | ✗ | if (hasAlpha) { | |
| 1584 | ✗ | A = abuf0[i] * (SUINT)(1 << 11); | |
| 1585 | |||
| 1586 | ✗ | A += 1 << 13; | |
| 1587 | } | ||
| 1588 | |||
| 1589 | ✗ | R = V * c->yuv2rgb_v2r_coeff; | |
| 1590 | ✗ | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1591 | ✗ | B = U * c->yuv2rgb_u2b_coeff; | |
| 1592 | |||
| 1593 | ✗ | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)); | |
| 1594 | ✗ | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y) >> 14) + (1<<15), 16)); | |
| 1595 | ✗ | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)); | |
| 1596 | ✗ | if (eightbytes) { | |
| 1597 | ✗ | output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); | |
| 1598 | ✗ | dest += 4; | |
| 1599 | } else { | ||
| 1600 | ✗ | dest += 3; | |
| 1601 | } | ||
| 1602 | } | ||
| 1603 | } | ||
| 1604 | 451392 | } | |
| 1605 | |||
| 1606 | #undef output_pixel | ||
| 1607 | #undef r_b | ||
| 1608 | #undef b_r | ||
| 1609 | |||
| 1610 | #define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \ | ||
| 1611 | static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 1612 | const int16_t **_lumSrc, int lumFilterSize, \ | ||
| 1613 | const int16_t *chrFilter, const int16_t **_chrUSrc, \ | ||
| 1614 | const int16_t **_chrVSrc, int chrFilterSize, \ | ||
| 1615 | const int16_t **_alpSrc, uint8_t *_dest, int dstW, \ | ||
| 1616 | int y) \ | ||
| 1617 | { \ | ||
| 1618 | const int32_t **lumSrc = (const int32_t **) _lumSrc, \ | ||
| 1619 | **chrUSrc = (const int32_t **) _chrUSrc, \ | ||
| 1620 | **chrVSrc = (const int32_t **) _chrVSrc, \ | ||
| 1621 | **alpSrc = (const int32_t **) _alpSrc; \ | ||
| 1622 | uint16_t *dest = (uint16_t *) _dest; \ | ||
| 1623 | name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 1624 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 1625 | alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \ | ||
| 1626 | } \ | ||
| 1627 | \ | ||
| 1628 | static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \ | ||
| 1629 | const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ | ||
| 1630 | const int16_t *_abuf[2], uint8_t *_dest, int dstW, \ | ||
| 1631 | int yalpha, int uvalpha, int y) \ | ||
| 1632 | { \ | ||
| 1633 | const int32_t **buf = (const int32_t **) _buf, \ | ||
| 1634 | **ubuf = (const int32_t **) _ubuf, \ | ||
| 1635 | **vbuf = (const int32_t **) _vbuf, \ | ||
| 1636 | **abuf = (const int32_t **) _abuf; \ | ||
| 1637 | uint16_t *dest = (uint16_t *) _dest; \ | ||
| 1638 | name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ | ||
| 1639 | dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \ | ||
| 1640 | } \ | ||
| 1641 | \ | ||
| 1642 | static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \ | ||
| 1643 | const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ | ||
| 1644 | const int16_t *_abuf0, uint8_t *_dest, int dstW, \ | ||
| 1645 | int uvalpha, int y) \ | ||
| 1646 | { \ | ||
| 1647 | const int32_t *buf0 = (const int32_t *) _buf0, \ | ||
| 1648 | **ubuf = (const int32_t **) _ubuf, \ | ||
| 1649 | **vbuf = (const int32_t **) _vbuf, \ | ||
| 1650 | *abuf0 = (const int32_t *) _abuf0; \ | ||
| 1651 | uint16_t *dest = (uint16_t *) _dest; \ | ||
| 1652 | name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ | ||
| 1653 | dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \ | ||
| 1654 | } | ||
| 1655 | #define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \ | ||
| 1656 | YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes) | ||
| 1657 | |||
| 1658 | 53040 | YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48be, AV_PIX_FMT_RGB48, BE, 0, 0) | |
| 1659 | 838040 | YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48le, AV_PIX_FMT_RGB48, LE, 0, 0) | |
| 1660 | 18480 | YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48be, AV_PIX_FMT_BGR48, BE, 0, 0) | |
| 1661 | 19632 | YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48le, AV_PIX_FMT_BGR48, LE, 0, 0) | |
| 1662 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64be, AV_PIX_FMT_RGBA64, BE, 1, 1) | |
| 1663 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64le, AV_PIX_FMT_RGBA64, LE, 1, 1) | |
| 1664 | 18480 | YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64be, AV_PIX_FMT_RGBA64, BE, 0, 1) | |
| 1665 | 30000 | YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64le, AV_PIX_FMT_RGBA64, LE, 0, 1) | |
| 1666 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64be, AV_PIX_FMT_BGRA64, BE, 1, 1) | |
| 1667 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64le, AV_PIX_FMT_BGRA64, LE, 1, 1) | |
| 1668 | 18480 | YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, AV_PIX_FMT_BGRA64, BE, 0, 1) | |
| 1669 | 18480 | YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64, LE, 0, 1) | |
| 1670 | 21136 | YUV2PACKED16WRAPPER(yuv2, ya16, ya16be, AV_PIX_FMT_YA16, BE, 1, 0) | |
| 1671 | 22288 | YUV2PACKED16WRAPPER(yuv2, ya16, ya16le, AV_PIX_FMT_YA16, LE, 1, 0) | |
| 1672 | |||
| 1673 | 3104 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48be_full, AV_PIX_FMT_RGB48, BE, 0, 0) | |
| 1674 | 886880 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48le_full, AV_PIX_FMT_RGB48, LE, 0, 0) | |
| 1675 | 2704 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48be_full, AV_PIX_FMT_BGR48, BE, 0, 0) | |
| 1676 | 2896 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48le_full, AV_PIX_FMT_BGR48, LE, 0, 0) | |
| 1677 | 2704 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64be_full, AV_PIX_FMT_RGBA64, BE, 1, 1) | |
| 1678 | 2704 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64le_full, AV_PIX_FMT_RGBA64, LE, 1, 1) | |
| 1679 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64be_full, AV_PIX_FMT_RGBA64, BE, 0, 1) | |
| 1680 | 192 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64le_full, AV_PIX_FMT_RGBA64, LE, 0, 1) | |
| 1681 | 2704 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64be_full, AV_PIX_FMT_BGRA64, BE, 1, 1) | |
| 1682 | 2704 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64le_full, AV_PIX_FMT_BGRA64, LE, 1, 1) | |
| 1683 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64be_full, AV_PIX_FMT_BGRA64, BE, 0, 1) | |
| 1684 | 192 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64le_full, AV_PIX_FMT_BGRA64, LE, 0, 1) | |
| 1685 | |||
| 1686 | /* | ||
| 1687 | * Write out 2 RGB pixels in the target pixel format. This function takes a | ||
| 1688 | * R/G/B LUT as generated by ff_yuv2rgb_c_init_tables(), which takes care of | ||
| 1689 | * things like endianness conversion and shifting. The caller takes care of | ||
| 1690 | * setting the correct offset in these tables from the chroma (U/V) values. | ||
| 1691 | * This function then uses the luminance (Y1/Y2) values to write out the | ||
| 1692 | * correct RGB values into the destination buffer. | ||
| 1693 | */ | ||
| 1694 | static av_always_inline void | ||
| 1695 | 310298228 | yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, | |
| 1696 | unsigned A1, unsigned A2, | ||
| 1697 | const void *_r, const void *_g, const void *_b, int y, | ||
| 1698 | enum AVPixelFormat target, int hasAlpha) | ||
| 1699 | { | ||
| 1700 |
4/6✓ Branch 0 taken 310298228 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 310298228 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 301836212 times.
✓ Branch 5 taken 8462016 times.
|
310298228 | if (target == AV_PIX_FMT_ARGB || target == AV_PIX_FMT_RGBA || |
| 1701 |
2/2✓ Branch 0 taken 28764744 times.
✓ Branch 1 taken 273071468 times.
|
339062972 | target == AV_PIX_FMT_ABGR || target == AV_PIX_FMT_BGRA) { |
| 1702 | 37226760 | uint32_t *dest = (uint32_t *) _dest; | |
| 1703 | 37226760 | const uint32_t *r = (const uint32_t *) _r; | |
| 1704 | 37226760 | const uint32_t *g = (const uint32_t *) _g; | |
| 1705 | 37226760 | const uint32_t *b = (const uint32_t *) _b; | |
| 1706 | |||
| 1707 | #if CONFIG_SMALL | ||
| 1708 | int sh = hasAlpha ? ((target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24) : 0; | ||
| 1709 | |||
| 1710 | dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); | ||
| 1711 | dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); | ||
| 1712 | #else | ||
| 1713 |
2/2✓ Branch 0 taken 118400 times.
✓ Branch 1 taken 37108360 times.
|
37226760 | if (hasAlpha) { |
| 1714 |
3/4✓ Branch 0 taken 41600 times.
✓ Branch 1 taken 76800 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 41600 times.
|
118400 | int sh = (target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24; |
| 1715 | |||
| 1716 | av_assert2((((r[Y1] + g[Y1] + b[Y1]) >> sh) & 0xFF) == 0); | ||
| 1717 | 118400 | dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); | |
| 1718 | 118400 | dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); | |
| 1719 | } else { | ||
| 1720 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 | ||
| 1721 | int sh = (target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24; | ||
| 1722 | |||
| 1723 | av_assert2((((r[Y1] + g[Y1] + b[Y1]) >> sh) & 0xFF) == 0xFF); | ||
| 1724 | #endif | ||
| 1725 | 37108360 | dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; | |
| 1726 | 37108360 | dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; | |
| 1727 | } | ||
| 1728 | #endif | ||
| 1729 |
4/4✓ Branch 0 taken 147115078 times.
✓ Branch 1 taken 125956390 times.
✓ Branch 2 taken 27340910 times.
✓ Branch 3 taken 119774168 times.
|
273071468 | } else if (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) { |
| 1730 | 153297300 | uint8_t *dest = (uint8_t *) _dest; | |
| 1731 | 153297300 | const uint8_t *r = (const uint8_t *) _r; | |
| 1732 | 153297300 | const uint8_t *g = (const uint8_t *) _g; | |
| 1733 | 153297300 | const uint8_t *b = (const uint8_t *) _b; | |
| 1734 | |||
| 1735 | #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b) | ||
| 1736 | #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r) | ||
| 1737 | |||
| 1738 |
2/2✓ Branch 0 taken 125956390 times.
✓ Branch 1 taken 27340910 times.
|
153297300 | dest[i * 6 + 0] = r_b[Y1]; |
| 1739 | 153297300 | dest[i * 6 + 1] = g[Y1]; | |
| 1740 |
2/2✓ Branch 0 taken 125956390 times.
✓ Branch 1 taken 27340910 times.
|
153297300 | dest[i * 6 + 2] = b_r[Y1]; |
| 1741 |
2/2✓ Branch 0 taken 125956390 times.
✓ Branch 1 taken 27340910 times.
|
153297300 | dest[i * 6 + 3] = r_b[Y2]; |
| 1742 | 153297300 | dest[i * 6 + 4] = g[Y2]; | |
| 1743 |
2/2✓ Branch 0 taken 125956390 times.
✓ Branch 1 taken 27340910 times.
|
153297300 | dest[i * 6 + 5] = b_r[Y2]; |
| 1744 | #undef r_b | ||
| 1745 | #undef b_r | ||
| 1746 |
5/6✓ Branch 0 taken 89022964 times.
✓ Branch 1 taken 30751204 times.
✓ Branch 2 taken 89022964 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 35404360 times.
✓ Branch 5 taken 53618604 times.
|
119774168 | } else if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565 || |
| 1747 |
3/4✓ Branch 0 taken 35404360 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28590536 times.
✓ Branch 3 taken 6813824 times.
|
35404360 | target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555 || |
| 1748 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28590536 times.
|
28590536 | target == AV_PIX_FMT_RGB444 || target == AV_PIX_FMT_BGR444) { |
| 1749 | 91183632 | uint16_t *dest = (uint16_t *) _dest; | |
| 1750 | 91183632 | const uint16_t *r = (const uint16_t *) _r; | |
| 1751 | 91183632 | const uint16_t *g = (const uint16_t *) _g; | |
| 1752 | 91183632 | const uint16_t *b = (const uint16_t *) _b; | |
| 1753 | int dr1, dg1, db1, dr2, dg2, db2; | ||
| 1754 | |||
| 1755 |
3/4✓ Branch 0 taken 60432428 times.
✓ Branch 1 taken 30751204 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 60432428 times.
|
91183632 | if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565) { |
| 1756 | 30751204 | dr1 = ff_dither_2x2_8[ y & 1 ][0]; | |
| 1757 | 30751204 | dg1 = ff_dither_2x2_4[ y & 1 ][0]; | |
| 1758 | 30751204 | db1 = ff_dither_2x2_8[(y & 1) ^ 1][0]; | |
| 1759 | 30751204 | dr2 = ff_dither_2x2_8[ y & 1 ][1]; | |
| 1760 | 30751204 | dg2 = ff_dither_2x2_4[ y & 1 ][1]; | |
| 1761 | 30751204 | db2 = ff_dither_2x2_8[(y & 1) ^ 1][1]; | |
| 1762 |
3/4✓ Branch 0 taken 6813824 times.
✓ Branch 1 taken 53618604 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6813824 times.
|
60432428 | } else if (target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555) { |
| 1763 | 53618604 | dr1 = ff_dither_2x2_8[ y & 1 ][0]; | |
| 1764 | 53618604 | dg1 = ff_dither_2x2_8[ y & 1 ][1]; | |
| 1765 | 53618604 | db1 = ff_dither_2x2_8[(y & 1) ^ 1][0]; | |
| 1766 | 53618604 | dr2 = ff_dither_2x2_8[ y & 1 ][1]; | |
| 1767 | 53618604 | dg2 = ff_dither_2x2_8[ y & 1 ][0]; | |
| 1768 | 53618604 | db2 = ff_dither_2x2_8[(y & 1) ^ 1][1]; | |
| 1769 | } else { | ||
| 1770 | 6813824 | dr1 = ff_dither_4x4_16[ y & 3 ][0]; | |
| 1771 | 6813824 | dg1 = ff_dither_4x4_16[ y & 3 ][1]; | |
| 1772 | 6813824 | db1 = ff_dither_4x4_16[(y & 3) ^ 3][0]; | |
| 1773 | 6813824 | dr2 = ff_dither_4x4_16[ y & 3 ][1]; | |
| 1774 | 6813824 | dg2 = ff_dither_4x4_16[ y & 3 ][0]; | |
| 1775 | 6813824 | db2 = ff_dither_4x4_16[(y & 3) ^ 3][1]; | |
| 1776 | } | ||
| 1777 | |||
| 1778 | 91183632 | dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; | |
| 1779 | 91183632 | dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; | |
| 1780 |
4/4✓ Branch 0 taken 26968520 times.
✓ Branch 1 taken 1622016 times.
✓ Branch 2 taken 1622016 times.
✓ Branch 3 taken 25346504 times.
|
28590536 | } else if (target == AV_PIX_FMT_X2RGB10 || target == AV_PIX_FMT_X2BGR10) { |
| 1781 | 3244032 | uint32_t *dest = (uint32_t *) _dest; | |
| 1782 | 3244032 | const uint32_t *r = (const uint32_t *) _r; | |
| 1783 | 3244032 | const uint32_t *g = (const uint32_t *) _g; | |
| 1784 | 3244032 | const uint32_t *b = (const uint32_t *) _b; | |
| 1785 | 3244032 | dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; | |
| 1786 | 3244032 | dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; | |
| 1787 | } else /* 8/4 bits */ { | ||
| 1788 | 25346504 | uint8_t *dest = (uint8_t *) _dest; | |
| 1789 | 25346504 | const uint8_t *r = (const uint8_t *) _r; | |
| 1790 | 25346504 | const uint8_t *g = (const uint8_t *) _g; | |
| 1791 | 25346504 | const uint8_t *b = (const uint8_t *) _b; | |
| 1792 | int dr1, dg1, db1, dr2, dg2, db2; | ||
| 1793 | |||
| 1794 |
3/4✓ Branch 0 taken 4088832 times.
✓ Branch 1 taken 21257672 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4088832 times.
|
25346504 | if (target == AV_PIX_FMT_RGB8 || target == AV_PIX_FMT_BGR8) { |
| 1795 | 21257672 | const uint8_t * const d64 = ff_dither_8x8_73[y & 7]; | |
| 1796 | 21257672 | const uint8_t * const d32 = ff_dither_8x8_32[y & 7]; | |
| 1797 | 21257672 | dr1 = dg1 = d32[(i * 2 + 0) & 7]; | |
| 1798 | 21257672 | db1 = d64[(i * 2 + 0) & 7]; | |
| 1799 | 21257672 | dr2 = dg2 = d32[(i * 2 + 1) & 7]; | |
| 1800 | 21257672 | db2 = d64[(i * 2 + 1) & 7]; | |
| 1801 | } else { | ||
| 1802 | 4088832 | const uint8_t * const d64 = ff_dither_8x8_73 [y & 7]; | |
| 1803 | 4088832 | const uint8_t * const d128 = ff_dither_8x8_220[y & 7]; | |
| 1804 | 4088832 | dr1 = db1 = d128[(i * 2 + 0) & 7]; | |
| 1805 | 4088832 | dg1 = d64[(i * 2 + 0) & 7]; | |
| 1806 | 4088832 | dr2 = db2 = d128[(i * 2 + 1) & 7]; | |
| 1807 | 4088832 | dg2 = d64[(i * 2 + 1) & 7]; | |
| 1808 | } | ||
| 1809 | |||
| 1810 |
3/4✓ Branch 0 taken 25223624 times.
✓ Branch 1 taken 122880 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 25223624 times.
|
25346504 | if (target == AV_PIX_FMT_RGB4 || target == AV_PIX_FMT_BGR4) { |
| 1811 | 122880 | dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + | |
| 1812 | 122880 | ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); | |
| 1813 | } else { | ||
| 1814 | 25223624 | dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; | |
| 1815 | 25223624 | dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; | |
| 1816 | } | ||
| 1817 | } | ||
| 1818 | 310298228 | } | |
| 1819 | |||
| 1820 | static av_always_inline void | ||
| 1821 | 1317436 | yuv2rgb_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 1822 | const int16_t **lumSrc, int lumFilterSize, | ||
| 1823 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 1824 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 1825 | const int16_t **alpSrc, uint8_t *dest, int dstW, | ||
| 1826 | int y, enum AVPixelFormat target, int hasAlpha) | ||
| 1827 | { | ||
| 1828 | int i; | ||
| 1829 | |||
| 1830 |
2/2✓ Branch 0 taken 226546120 times.
✓ Branch 1 taken 1317436 times.
|
227863556 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1831 | int j, A1, A2; | ||
| 1832 | 226546120 | int Y1 = 1 << 18; | |
| 1833 | 226546120 | int Y2 = 1 << 18; | |
| 1834 | 226546120 | int U = 1 << 18; | |
| 1835 | 226546120 | int V = 1 << 18; | |
| 1836 | const void *r, *g, *b; | ||
| 1837 | |||
| 1838 |
2/2✓ Branch 0 taken 241073032 times.
✓ Branch 1 taken 226546120 times.
|
467619152 | for (j = 0; j < lumFilterSize; j++) { |
| 1839 | 241073032 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 1840 | 241073032 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 1841 | } | ||
| 1842 |
2/2✓ Branch 0 taken 910765600 times.
✓ Branch 1 taken 226546120 times.
|
1137311720 | for (j = 0; j < chrFilterSize; j++) { |
| 1843 | 910765600 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1844 | 910765600 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1845 | } | ||
| 1846 | 226546120 | Y1 >>= 19; | |
| 1847 | 226546120 | Y2 >>= 19; | |
| 1848 | 226546120 | U >>= 19; | |
| 1849 | 226546120 | V >>= 19; | |
| 1850 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 226546120 times.
|
226546120 | if (hasAlpha) { |
| 1851 | ✗ | A1 = 1 << 18; | |
| 1852 | ✗ | A2 = 1 << 18; | |
| 1853 | ✗ | for (j = 0; j < lumFilterSize; j++) { | |
| 1854 | ✗ | A1 += alpSrc[j][i * 2 ] * (unsigned)lumFilter[j]; | |
| 1855 | ✗ | A2 += alpSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 1856 | } | ||
| 1857 | ✗ | A1 >>= 19; | |
| 1858 | ✗ | A2 >>= 19; | |
| 1859 | ✗ | if ((A1 | A2) & 0x100) { | |
| 1860 | ✗ | A1 = av_clip_uint8(A1); | |
| 1861 | ✗ | A2 = av_clip_uint8(A2); | |
| 1862 | } | ||
| 1863 | } | ||
| 1864 | |||
| 1865 | 226546120 | r = c->table_rV[V + YUVRGB_TABLE_HEADROOM]; | |
| 1866 | 226546120 | g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]); | |
| 1867 | 226546120 | b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; | |
| 1868 | |||
| 1869 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 226546120 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 226546120 times.
|
226546120 | yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, |
| 1870 | r, g, b, y, target, hasAlpha); | ||
| 1871 | } | ||
| 1872 | 1317436 | } | |
| 1873 | |||
| 1874 | static av_always_inline void | ||
| 1875 | 216 | yuv2rgb_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 1876 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 1877 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 1878 | int yalpha, int uvalpha, int y, | ||
| 1879 | enum AVPixelFormat target, int hasAlpha) | ||
| 1880 | { | ||
| 1881 | 216 | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 1882 | 216 | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 1883 | 216 | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 1884 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216 times.
|
216 | *abuf0 = hasAlpha ? abuf[0] : NULL, |
| 1885 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216 times.
|
216 | *abuf1 = hasAlpha ? abuf[1] : NULL; |
| 1886 | 216 | int yalpha1 = 4096 - yalpha; | |
| 1887 | 216 | int uvalpha1 = 4096 - uvalpha; | |
| 1888 | int i; | ||
| 1889 | av_assert2(yalpha <= 4096U); | ||
| 1890 | av_assert2(uvalpha <= 4096U); | ||
| 1891 | |||
| 1892 |
2/2✓ Branch 0 taken 55296 times.
✓ Branch 1 taken 216 times.
|
55512 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1893 | 55296 | int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; | |
| 1894 | 55296 | int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; | |
| 1895 | 55296 | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; | |
| 1896 | 55296 | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; | |
| 1897 | int A1, A2; | ||
| 1898 | 55296 | const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], | |
| 1899 | 55296 | *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), | |
| 1900 | 55296 | *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; | |
| 1901 | |||
| 1902 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55296 times.
|
55296 | if (hasAlpha) { |
| 1903 | ✗ | A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19; | |
| 1904 | ✗ | A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19; | |
| 1905 | ✗ | A1 = av_clip_uint8(A1); | |
| 1906 | ✗ | A2 = av_clip_uint8(A2); | |
| 1907 | } | ||
| 1908 | |||
| 1909 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 55296 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 55296 times.
|
55296 | yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, |
| 1910 | r, g, b, y, target, hasAlpha); | ||
| 1911 | } | ||
| 1912 | 216 | } | |
| 1913 | |||
| 1914 | static av_always_inline void | ||
| 1915 | 542516 | yuv2rgb_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 1916 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 1917 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 1918 | int uvalpha, int y, enum AVPixelFormat target, | ||
| 1919 | int hasAlpha) | ||
| 1920 | { | ||
| 1921 | 542516 | const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 1922 | int i; | ||
| 1923 | |||
| 1924 |
2/2✓ Branch 0 taken 497812 times.
✓ Branch 1 taken 44704 times.
|
542516 | if (uvalpha == 0) { |
| 1925 |
2/2✓ Branch 0 taken 82234028 times.
✓ Branch 1 taken 497812 times.
|
82731840 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1926 | 82234028 | int Y1 = (buf0[i * 2 ] + 64) >> 7; | |
| 1927 | 82234028 | int Y2 = (buf0[i * 2 + 1] + 64) >> 7; | |
| 1928 | 82234028 | int U = (ubuf0[i] + 64) >> 7; | |
| 1929 | 82234028 | int V = (vbuf0[i] + 64) >> 7; | |
| 1930 | int A1, A2; | ||
| 1931 | 82234028 | const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], | |
| 1932 | 82234028 | *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), | |
| 1933 | 82234028 | *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; | |
| 1934 | |||
| 1935 |
2/2✓ Branch 0 taken 11840 times.
✓ Branch 1 taken 82222188 times.
|
82234028 | if (hasAlpha) { |
| 1936 | 11840 | A1 = abuf0[i * 2 ] * 255 + 16384 >> 15; | |
| 1937 | 11840 | A2 = abuf0[i * 2 + 1] * 255 + 16384 >> 15; | |
| 1938 | 11840 | A1 = av_clip_uint8(A1); | |
| 1939 | 11840 | A2 = av_clip_uint8(A2); | |
| 1940 | } | ||
| 1941 | |||
| 1942 |
4/4✓ Branch 0 taken 11840 times.
✓ Branch 1 taken 82222188 times.
✓ Branch 2 taken 11840 times.
✓ Branch 3 taken 82222188 times.
|
82234028 | yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, |
| 1943 | r, g, b, y, target, hasAlpha); | ||
| 1944 | } | ||
| 1945 | } else { | ||
| 1946 | 44704 | const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 1947 | 44704 | int uvalpha1 = 4096 - uvalpha; | |
| 1948 | av_assert2(uvalpha <= 4096U); | ||
| 1949 | |||
| 1950 |
2/2✓ Branch 0 taken 1462784 times.
✓ Branch 1 taken 44704 times.
|
1507488 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1951 | 1462784 | int Y1 = (buf0[i * 2 ] + 64) >> 7; | |
| 1952 | 1462784 | int Y2 = (buf0[i * 2 + 1] + 64) >> 7; | |
| 1953 | 1462784 | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (128 << 11)) >> 19; | |
| 1954 | 1462784 | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha + (128 << 11)) >> 19; | |
| 1955 | int A1, A2; | ||
| 1956 | 1462784 | const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], | |
| 1957 | 1462784 | *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), | |
| 1958 | 1462784 | *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; | |
| 1959 | |||
| 1960 |
2/2✓ Branch 0 taken 106560 times.
✓ Branch 1 taken 1356224 times.
|
1462784 | if (hasAlpha) { |
| 1961 | 106560 | A1 = (abuf0[i * 2 ] + 64) >> 7; | |
| 1962 | 106560 | A2 = (abuf0[i * 2 + 1] + 64) >> 7; | |
| 1963 | 106560 | A1 = av_clip_uint8(A1); | |
| 1964 | 106560 | A2 = av_clip_uint8(A2); | |
| 1965 | } | ||
| 1966 | |||
| 1967 |
4/4✓ Branch 0 taken 106560 times.
✓ Branch 1 taken 1356224 times.
✓ Branch 2 taken 106560 times.
✓ Branch 3 taken 1356224 times.
|
1462784 | yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, |
| 1968 | r, g, b, y, target, hasAlpha); | ||
| 1969 | } | ||
| 1970 | } | ||
| 1971 | 542516 | } | |
| 1972 | |||
| 1973 | #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ | ||
| 1974 | static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 1975 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 1976 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 1977 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 1978 | const int16_t **alpSrc, uint8_t *dest, int dstW, \ | ||
| 1979 | int y) \ | ||
| 1980 | { \ | ||
| 1981 | name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 1982 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 1983 | alpSrc, dest, dstW, y, fmt, hasAlpha); \ | ||
| 1984 | } | ||
| 1985 | |||
| 1986 | #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ | ||
| 1987 | YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ | ||
| 1988 | static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \ | ||
| 1989 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 1990 | const int16_t *abuf[2], uint8_t *dest, int dstW, \ | ||
| 1991 | int yalpha, int uvalpha, int y) \ | ||
| 1992 | { \ | ||
| 1993 | name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ | ||
| 1994 | dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \ | ||
| 1995 | } | ||
| 1996 | |||
| 1997 | #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \ | ||
| 1998 | YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ | ||
| 1999 | static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \ | ||
| 2000 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 2001 | const int16_t *abuf0, uint8_t *dest, int dstW, \ | ||
| 2002 | int uvalpha, int y) \ | ||
| 2003 | { \ | ||
| 2004 | name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ | ||
| 2005 | dstW, uvalpha, y, fmt, hasAlpha); \ | ||
| 2006 | } | ||
| 2007 | |||
| 2008 | #if CONFIG_SMALL | ||
| 2009 | YUV2RGBWRAPPER(yuv2rgb,, 32_1, AV_PIX_FMT_RGB32_1, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2010 | YUV2RGBWRAPPER(yuv2rgb,, 32, AV_PIX_FMT_RGB32, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2011 | #else | ||
| 2012 | #if CONFIG_SWSCALE_ALPHA | ||
| 2013 | 4800 | YUV2RGBWRAPPER(yuv2rgb,, a32_1, AV_PIX_FMT_RGB32_1, 1) | |
| 2014 | 2600 | YUV2RGBWRAPPER(yuv2rgb,, a32, AV_PIX_FMT_RGB32, 1) | |
| 2015 | #endif | ||
| 2016 | 116352 | YUV2RGBWRAPPER(yuv2rgb,, x32_1, AV_PIX_FMT_RGB32_1, 0) | |
| 2017 | 341008 | YUV2RGBWRAPPER(yuv2rgb,, x32, AV_PIX_FMT_RGB32, 0) | |
| 2018 | #endif | ||
| 2019 | 1469580 | YUV2RGBWRAPPER(yuv2, rgb, rgb24, AV_PIX_FMT_RGB24, 0) | |
| 2020 | 320812 | YUV2RGBWRAPPER(yuv2, rgb, bgr24, AV_PIX_FMT_BGR24, 0) | |
| 2021 | 390096 | YUV2RGBWRAPPER(yuv2rgb,, 16, AV_PIX_FMT_RGB565, 0) | |
| 2022 | 656096 | YUV2RGBWRAPPER(yuv2rgb,, 15, AV_PIX_FMT_RGB555, 0) | |
| 2023 | 84736 | YUV2RGBWRAPPER(yuv2rgb,, 12, AV_PIX_FMT_RGB444, 0) | |
| 2024 | 247664 | YUV2RGBWRAPPER(yuv2rgb,, 8, AV_PIX_FMT_RGB8, 0) | |
| 2025 | 4704 | YUV2RGBWRAPPER(yuv2rgb,, 4, AV_PIX_FMT_RGB4, 0) | |
| 2026 | 45024 | YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0) | |
| 2027 | 18432 | YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10, 0) | |
| 2028 | 18432 | YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10, 0) | |
| 2029 | |||
| 2030 | 360702149 | static av_always_inline void yuv2rgb_write_full(SwsInternal *c, | |
| 2031 | uint8_t *dest, int i, int Y, int A, int U, int V, | ||
| 2032 | int y, enum AVPixelFormat target, int hasAlpha, int err[4]) | ||
| 2033 | { | ||
| 2034 | int R, G, B; | ||
| 2035 |
4/4✓ Branch 0 taken 344218763 times.
✓ Branch 1 taken 16483386 times.
✓ Branch 2 taken 10831389 times.
✓ Branch 3 taken 333387374 times.
|
360702149 | int isrgb8 = target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8; |
| 2036 | |||
| 2037 | 360702149 | Y -= c->yuv2rgb_y_offset; | |
| 2038 | 360702149 | Y *= (unsigned)c->yuv2rgb_y_coeff; | |
| 2039 | 360702149 | Y += 1U << 21; | |
| 2040 | 360702149 | R = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2r_coeff; | |
| 2041 | 360702149 | G = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2g_coeff + U*(unsigned)c->yuv2rgb_u2g_coeff; | |
| 2042 | 360702149 | B = (unsigned)Y + U*(unsigned)c->yuv2rgb_u2b_coeff; | |
| 2043 |
2/2✓ Branch 0 taken 47019099 times.
✓ Branch 1 taken 313683050 times.
|
360702149 | if ((R | G | B) & 0xC0000000) { |
| 2044 | 47019099 | R = av_clip_uintp2(R, 30); | |
| 2045 | 47019099 | G = av_clip_uintp2(G, 30); | |
| 2046 | 47019099 | B = av_clip_uintp2(B, 30); | |
| 2047 | } | ||
| 2048 | |||
| 2049 |
9/10✓ Branch 0 taken 319616 times.
✓ Branch 1 taken 158328937 times.
✓ Branch 2 taken 319616 times.
✓ Branch 3 taken 319616 times.
✓ Branch 4 taken 54653476 times.
✓ Branch 5 taken 55106983 times.
✓ Branch 6 taken 23872576 times.
✓ Branch 7 taken 23872576 times.
✓ Branch 8 taken 43908753 times.
✗ Branch 9 not taken.
|
360702149 | switch(target) { |
| 2050 | 319616 | case AV_PIX_FMT_ARGB: | |
| 2051 |
2/2✓ Branch 0 taken 301184 times.
✓ Branch 1 taken 18432 times.
|
319616 | dest[0] = hasAlpha ? A : 255; |
| 2052 | 319616 | dest[1] = R >> 22; | |
| 2053 | 319616 | dest[2] = G >> 22; | |
| 2054 | 319616 | dest[3] = B >> 22; | |
| 2055 | 319616 | break; | |
| 2056 | 158328937 | case AV_PIX_FMT_RGB24: | |
| 2057 | 158328937 | dest[0] = R >> 22; | |
| 2058 | 158328937 | dest[1] = G >> 22; | |
| 2059 | 158328937 | dest[2] = B >> 22; | |
| 2060 | 158328937 | break; | |
| 2061 | 319616 | case AV_PIX_FMT_RGBA: | |
| 2062 | 319616 | dest[0] = R >> 22; | |
| 2063 | 319616 | dest[1] = G >> 22; | |
| 2064 | 319616 | dest[2] = B >> 22; | |
| 2065 |
2/2✓ Branch 0 taken 301184 times.
✓ Branch 1 taken 18432 times.
|
319616 | dest[3] = hasAlpha ? A : 255; |
| 2066 | 319616 | break; | |
| 2067 | 319616 | case AV_PIX_FMT_ABGR: | |
| 2068 |
2/2✓ Branch 0 taken 301184 times.
✓ Branch 1 taken 18432 times.
|
319616 | dest[0] = hasAlpha ? A : 255; |
| 2069 | 319616 | dest[1] = B >> 22; | |
| 2070 | 319616 | dest[2] = G >> 22; | |
| 2071 | 319616 | dest[3] = R >> 22; | |
| 2072 | 319616 | break; | |
| 2073 | 54653476 | case AV_PIX_FMT_BGR24: | |
| 2074 | 54653476 | dest[0] = B >> 22; | |
| 2075 | 54653476 | dest[1] = G >> 22; | |
| 2076 | 54653476 | dest[2] = R >> 22; | |
| 2077 | 54653476 | break; | |
| 2078 | 55106983 | case AV_PIX_FMT_BGRA: | |
| 2079 | 55106983 | dest[0] = B >> 22; | |
| 2080 | 55106983 | dest[1] = G >> 22; | |
| 2081 | 55106983 | dest[2] = R >> 22; | |
| 2082 |
2/2✓ Branch 0 taken 4193191 times.
✓ Branch 1 taken 50913792 times.
|
55106983 | dest[3] = hasAlpha ? A : 255; |
| 2083 | 55106983 | break; | |
| 2084 | 23872576 | case AV_PIX_FMT_X2RGB10LE: | |
| 2085 | 23872576 | R >>= 20; | |
| 2086 | 23872576 | G >>= 20; | |
| 2087 | 23872576 | B >>= 20; | |
| 2088 | 23872576 | AV_WL32(dest, (3U << 30) + (R << 20) + (G << 10) + B); | |
| 2089 | 23872576 | break; | |
| 2090 | 23872576 | case AV_PIX_FMT_X2BGR10LE: | |
| 2091 | 23872576 | R >>= 20; | |
| 2092 | 23872576 | G >>= 20; | |
| 2093 | 23872576 | B >>= 20; | |
| 2094 | 23872576 | AV_WL32(dest, (3U << 30) + (B << 20) + (G << 10) + R); | |
| 2095 | 23872576 | break; | |
| 2096 | 43908753 | case AV_PIX_FMT_BGR4_BYTE: | |
| 2097 | case AV_PIX_FMT_RGB4_BYTE: | ||
| 2098 | case AV_PIX_FMT_BGR8: | ||
| 2099 | case AV_PIX_FMT_RGB8: | ||
| 2100 | { | ||
| 2101 | int r,g,b; | ||
| 2102 | |||
| 2103 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 43908753 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
43908753 | switch (c->opts.dither) { |
| 2104 | ✗ | case SWS_DITHER_NONE: | |
| 2105 | ✗ | if (isrgb8) { | |
| 2106 | ✗ | r = av_clip_uintp2(R >> 27, 3); | |
| 2107 | ✗ | g = av_clip_uintp2(G >> 27, 3); | |
| 2108 | ✗ | b = av_clip_uintp2(B >> 28, 2); | |
| 2109 | } else { | ||
| 2110 | ✗ | r = av_clip_uintp2(R >> 29, 1); | |
| 2111 | ✗ | g = av_clip_uintp2(G >> 28, 2); | |
| 2112 | ✗ | b = av_clip_uintp2(B >> 29, 1); | |
| 2113 | } | ||
| 2114 | ✗ | break; | |
| 2115 | 43908753 | default: | |
| 2116 | case SWS_DITHER_AUTO: | ||
| 2117 | case SWS_DITHER_ED: | ||
| 2118 | 43908753 | R >>= 22; | |
| 2119 | 43908753 | G >>= 22; | |
| 2120 | 43908753 | B >>= 22; | |
| 2121 | 43908753 | R += (7*err[0] + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2])>>4; | |
| 2122 | 43908753 | G += (7*err[1] + 1*c->dither_error[1][i] + 5*c->dither_error[1][i+1] + 3*c->dither_error[1][i+2])>>4; | |
| 2123 | 43908753 | B += (7*err[2] + 1*c->dither_error[2][i] + 5*c->dither_error[2][i+1] + 3*c->dither_error[2][i+2])>>4; | |
| 2124 | 43908753 | c->dither_error[0][i] = err[0]; | |
| 2125 | 43908753 | c->dither_error[1][i] = err[1]; | |
| 2126 | 43908753 | c->dither_error[2][i] = err[2]; | |
| 2127 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | r = R >> (isrgb8 ? 5 : 7); |
| 2128 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | g = G >> (isrgb8 ? 5 : 6); |
| 2129 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | b = B >> (isrgb8 ? 6 : 7); |
| 2130 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | r = av_clip(r, 0, isrgb8 ? 7 : 1); |
| 2131 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | g = av_clip(g, 0, isrgb8 ? 7 : 3); |
| 2132 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | b = av_clip(b, 0, isrgb8 ? 3 : 1); |
| 2133 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | err[0] = R - r*(isrgb8 ? 36 : 255); |
| 2134 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | err[1] = G - g*(isrgb8 ? 36 : 85); |
| 2135 |
2/2✓ Branch 0 taken 27314775 times.
✓ Branch 1 taken 16593978 times.
|
43908753 | err[2] = B - b*(isrgb8 ? 85 : 255); |
| 2136 | 43908753 | break; | |
| 2137 | ✗ | case SWS_DITHER_A_DITHER: | |
| 2138 | ✗ | if (isrgb8) { | |
| 2139 | /* see http://pippin.gimp.org/a_dither/ for details/origin */ | ||
| 2140 | #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff)) | ||
| 2141 | ✗ | r = (((R >> 19) + A_DITHER(i,y) -96)>>8); | |
| 2142 | ✗ | g = (((G >> 19) + A_DITHER(i + 17,y) - 96)>>8); | |
| 2143 | ✗ | b = (((B >> 20) + A_DITHER(i + 17*2,y) -96)>>8); | |
| 2144 | ✗ | r = av_clip_uintp2(r, 3); | |
| 2145 | ✗ | g = av_clip_uintp2(g, 3); | |
| 2146 | ✗ | b = av_clip_uintp2(b, 2); | |
| 2147 | } else { | ||
| 2148 | ✗ | r = (((R >> 21) + A_DITHER(i,y)-256)>>8); | |
| 2149 | ✗ | g = (((G >> 19) + A_DITHER(i + 17,y)-256)>>8); | |
| 2150 | ✗ | b = (((B >> 21) + A_DITHER(i + 17*2,y)-256)>>8); | |
| 2151 | ✗ | r = av_clip_uintp2(r, 1); | |
| 2152 | ✗ | g = av_clip_uintp2(g, 2); | |
| 2153 | ✗ | b = av_clip_uintp2(b, 1); | |
| 2154 | } | ||
| 2155 | ✗ | break; | |
| 2156 | ✗ | case SWS_DITHER_X_DITHER: | |
| 2157 | ✗ | if (isrgb8) { | |
| 2158 | /* see http://pippin.gimp.org/a_dither/ for details/origin */ | ||
| 2159 | #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2) | ||
| 2160 | ✗ | r = (((R >> 19) + X_DITHER(i,y) - 96)>>8); | |
| 2161 | ✗ | g = (((G >> 19) + X_DITHER(i + 17,y) - 96)>>8); | |
| 2162 | ✗ | b = (((B >> 20) + X_DITHER(i + 17*2,y) - 96)>>8); | |
| 2163 | ✗ | r = av_clip_uintp2(r, 3); | |
| 2164 | ✗ | g = av_clip_uintp2(g, 3); | |
| 2165 | ✗ | b = av_clip_uintp2(b, 2); | |
| 2166 | } else { | ||
| 2167 | ✗ | r = (((R >> 21) + X_DITHER(i,y)-256)>>8); | |
| 2168 | ✗ | g = (((G >> 19) + X_DITHER(i + 17,y)-256)>>8); | |
| 2169 | ✗ | b = (((B >> 21) + X_DITHER(i + 17*2,y)-256)>>8); | |
| 2170 | ✗ | r = av_clip_uintp2(r, 1); | |
| 2171 | ✗ | g = av_clip_uintp2(g, 2); | |
| 2172 | ✗ | b = av_clip_uintp2(b, 1); | |
| 2173 | } | ||
| 2174 | |||
| 2175 | ✗ | break; | |
| 2176 | } | ||
| 2177 | |||
| 2178 |
2/2✓ Branch 0 taken 8296989 times.
✓ Branch 1 taken 35611764 times.
|
43908753 | if(target == AV_PIX_FMT_BGR4_BYTE) { |
| 2179 | 8296989 | dest[0] = r + 2*g + 8*b; | |
| 2180 |
2/2✓ Branch 0 taken 8296989 times.
✓ Branch 1 taken 27314775 times.
|
35611764 | } else if(target == AV_PIX_FMT_RGB4_BYTE) { |
| 2181 | 8296989 | dest[0] = b + 2*g + 8*r; | |
| 2182 |
2/2✓ Branch 0 taken 16483386 times.
✓ Branch 1 taken 10831389 times.
|
27314775 | } else if(target == AV_PIX_FMT_BGR8) { |
| 2183 | 16483386 | dest[0] = r + 8*g + 64*b; | |
| 2184 |
1/2✓ Branch 0 taken 10831389 times.
✗ Branch 1 not taken.
|
10831389 | } else if(target == AV_PIX_FMT_RGB8) { |
| 2185 | 10831389 | dest[0] = b + 4*g + 32*r; | |
| 2186 | } else | ||
| 2187 | av_assert2(0); | ||
| 2188 | 43908753 | break;} | |
| 2189 | } | ||
| 2190 | 360702149 | } | |
| 2191 | |||
| 2192 | static av_always_inline void | ||
| 2193 | 12356 | yuv2rgb_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 2194 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2195 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2196 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2197 | const int16_t **alpSrc, uint8_t *dest, | ||
| 2198 | int dstW, int y, enum AVPixelFormat target, int hasAlpha) | ||
| 2199 | { | ||
| 2200 | int i; | ||
| 2201 |
4/4✓ Branch 0 taken 10423 times.
✓ Branch 1 taken 1933 times.
✓ Branch 2 taken 822 times.
✓ Branch 3 taken 9601 times.
|
12356 | int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4; |
| 2202 | 12356 | int err[4] = {0}; | |
| 2203 | 12356 | int A = 0; //init to silence warning | |
| 2204 | |||
| 2205 |
4/4✓ Branch 0 taken 12156 times.
✓ Branch 1 taken 200 times.
✓ Branch 2 taken 11956 times.
✓ Branch 3 taken 200 times.
|
12356 | if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE |
| 2206 |
4/4✓ Branch 0 taken 11556 times.
✓ Branch 1 taken 400 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 11356 times.
|
11956 | || target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8) |
| 2207 | 1000 | step = 1; | |
| 2208 | |||
| 2209 |
2/2✓ Branch 0 taken 5224476 times.
✓ Branch 1 taken 12356 times.
|
5236832 | for (i = 0; i < dstW; i++) { |
| 2210 | int j; | ||
| 2211 | 5224476 | int Y = 1<<9; | |
| 2212 | 5224476 | int U = (1<<9)-(128 << 19); | |
| 2213 | 5224476 | int V = (1<<9)-(128 << 19); | |
| 2214 | |||
| 2215 |
2/2✓ Branch 0 taken 25372922 times.
✓ Branch 1 taken 5224476 times.
|
30597398 | for (j = 0; j < lumFilterSize; j++) { |
| 2216 | 25372922 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2217 | } | ||
| 2218 |
2/2✓ Branch 0 taken 26832626 times.
✓ Branch 1 taken 5224476 times.
|
32057102 | for (j = 0; j < chrFilterSize; j++) { |
| 2219 | 26832626 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2220 | 26832626 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2221 | } | ||
| 2222 | 5224476 | Y >>= 10; | |
| 2223 | 5224476 | U >>= 10; | |
| 2224 | 5224476 | V >>= 10; | |
| 2225 |
2/2✓ Branch 0 taken 4212007 times.
✓ Branch 1 taken 1012469 times.
|
5224476 | if (hasAlpha) { |
| 2226 | 4212007 | A = 1 << 18; | |
| 2227 |
2/2✓ Branch 0 taken 19408028 times.
✓ Branch 1 taken 4212007 times.
|
23620035 | for (j = 0; j < lumFilterSize; j++) { |
| 2228 | 19408028 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2229 | } | ||
| 2230 | 4212007 | A >>= 19; | |
| 2231 |
1/2✓ Branch 0 taken 4212007 times.
✗ Branch 1 not taken.
|
4212007 | if (A & 0x100) |
| 2232 | 4212007 | A = av_clip_uint8(A); | |
| 2233 | } | ||
| 2234 | 5224476 | yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); | |
| 2235 | 5224476 | dest += step; | |
| 2236 | } | ||
| 2237 | 12356 | c->dither_error[0][i] = err[0]; | |
| 2238 | 12356 | c->dither_error[1][i] = err[1]; | |
| 2239 | 12356 | c->dither_error[2][i] = err[2]; | |
| 2240 | 12356 | } | |
| 2241 | |||
| 2242 | static av_always_inline void | ||
| 2243 | ✗ | yuv2rgb_full_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 2244 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2245 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 2246 | int yalpha, int uvalpha, int y, | ||
| 2247 | enum AVPixelFormat target, int hasAlpha) | ||
| 2248 | { | ||
| 2249 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 2250 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 2251 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 2252 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 2253 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 2254 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 2255 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 2256 | int i; | ||
| 2257 | ✗ | int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4; | |
| 2258 | ✗ | int err[4] = {0}; | |
| 2259 | ✗ | int A = 0; // init to silcene warning | |
| 2260 | |||
| 2261 | av_assert2(yalpha <= 4096U); | ||
| 2262 | av_assert2(uvalpha <= 4096U); | ||
| 2263 | |||
| 2264 | ✗ | if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE | |
| 2265 | ✗ | || target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8) | |
| 2266 | ✗ | step = 1; | |
| 2267 | |||
| 2268 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2269 | ✗ | int Y = ( buf0[i] * yalpha1 + buf1[i] * yalpha ) >> 10; //FIXME rounding | |
| 2270 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha-(128 << 19)) >> 10; | |
| 2271 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha-(128 << 19)) >> 10; | |
| 2272 | |||
| 2273 | ✗ | if (hasAlpha) { | |
| 2274 | ✗ | A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha + (1<<18)) >> 19; | |
| 2275 | ✗ | if (A & 0x100) | |
| 2276 | ✗ | A = av_clip_uint8(A); | |
| 2277 | } | ||
| 2278 | |||
| 2279 | ✗ | yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); | |
| 2280 | ✗ | dest += step; | |
| 2281 | } | ||
| 2282 | ✗ | c->dither_error[0][i] = err[0]; | |
| 2283 | ✗ | c->dither_error[1][i] = err[1]; | |
| 2284 | ✗ | c->dither_error[2][i] = err[2]; | |
| 2285 | ✗ | } | |
| 2286 | |||
| 2287 | static av_always_inline void | ||
| 2288 | 1108365 | yuv2rgb_full_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 2289 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2290 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 2291 | int uvalpha, int y, enum AVPixelFormat target, | ||
| 2292 | int hasAlpha) | ||
| 2293 | { | ||
| 2294 | 1108365 | const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 2295 | int i; | ||
| 2296 |
4/4✓ Branch 0 taken 656585 times.
✓ Branch 1 taken 451780 times.
✓ Branch 2 taken 158440 times.
✓ Branch 3 taken 498145 times.
|
1108365 | int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4; |
| 2297 | 1108365 | int err[4] = {0}; | |
| 2298 | |||
| 2299 |
4/4✓ Branch 0 taken 1069672 times.
✓ Branch 1 taken 38693 times.
✓ Branch 2 taken 1030979 times.
✓ Branch 3 taken 38693 times.
|
1108365 | if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE |
| 2300 |
4/4✓ Branch 0 taken 954745 times.
✓ Branch 1 taken 76234 times.
✓ Branch 2 taken 45893 times.
✓ Branch 3 taken 908852 times.
|
1030979 | || target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8) |
| 2301 | 199513 | step = 1; | |
| 2302 | |||
| 2303 |
1/2✓ Branch 0 taken 1108365 times.
✗ Branch 1 not taken.
|
1108365 | if (uvalpha == 0) { |
| 2304 | 1108365 | int A = 0; //init to silence warning | |
| 2305 |
2/2✓ Branch 0 taken 355477673 times.
✓ Branch 1 taken 1108365 times.
|
356586038 | for (i = 0; i < dstW; i++) { |
| 2306 | 355477673 | int Y = buf0[i] * 4; | |
| 2307 | 355477673 | int U = (ubuf0[i] - (128<<7)) * 4; | |
| 2308 | 355477673 | int V = (vbuf0[i] - (128<<7)) * 4; | |
| 2309 | |||
| 2310 |
2/2✓ Branch 0 taken 884736 times.
✓ Branch 1 taken 354592937 times.
|
355477673 | if (hasAlpha) { |
| 2311 | 884736 | A = (abuf0[i] + 64) >> 7; | |
| 2312 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 884736 times.
|
884736 | if (A & 0x100) |
| 2313 | ✗ | A = av_clip_uint8(A); | |
| 2314 | } | ||
| 2315 | |||
| 2316 | 355477673 | yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); | |
| 2317 | 355477673 | dest += step; | |
| 2318 | } | ||
| 2319 | } else { | ||
| 2320 | ✗ | const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 2321 | ✗ | int A = 0; //init to silence warning | |
| 2322 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 2323 | av_assert2(uvalpha <= 4096U); | ||
| 2324 | |||
| 2325 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2326 | ✗ | int Y = buf0[i] * 4; | |
| 2327 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 19)) >> 10; | |
| 2328 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 19)) >> 10; | |
| 2329 | |||
| 2330 | ✗ | if (hasAlpha) { | |
| 2331 | ✗ | A = (abuf0[i] + 64) >> 7; | |
| 2332 | ✗ | if (A & 0x100) | |
| 2333 | ✗ | A = av_clip_uint8(A); | |
| 2334 | } | ||
| 2335 | |||
| 2336 | ✗ | yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); | |
| 2337 | ✗ | dest += step; | |
| 2338 | } | ||
| 2339 | } | ||
| 2340 | |||
| 2341 | 1108365 | c->dither_error[0][i] = err[0]; | |
| 2342 | 1108365 | c->dither_error[1][i] = err[1]; | |
| 2343 | 1108365 | c->dither_error[2][i] = err[2]; | |
| 2344 | 1108365 | } | |
| 2345 | |||
| 2346 | #if CONFIG_SMALL | ||
| 2347 | YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2348 | YUV2RGBWRAPPER(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2349 | YUV2RGBWRAPPER(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2350 | YUV2RGBWRAPPER(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2351 | #else | ||
| 2352 | #if CONFIG_SWSCALE_ALPHA | ||
| 2353 | 18610 | YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA, 1) | |
| 2354 | 5408 | YUV2RGBWRAPPER(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR, 1) | |
| 2355 | 5408 | YUV2RGBWRAPPER(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA, 1) | |
| 2356 | 5408 | YUV2RGBWRAPPER(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB, 1) | |
| 2357 | #endif | ||
| 2358 | 303504 | YUV2RGBWRAPPER(yuv2, rgb_full, bgrx32_full, AV_PIX_FMT_BGRA, 0) | |
| 2359 | 384 | YUV2RGBWRAPPER(yuv2, rgb_full, xbgr32_full, AV_PIX_FMT_ABGR, 0) | |
| 2360 | 384 | YUV2RGBWRAPPER(yuv2, rgb_full, rgbx32_full, AV_PIX_FMT_RGBA, 0) | |
| 2361 | 384 | YUV2RGBWRAPPER(yuv2, rgb_full, xrgb32_full, AV_PIX_FMT_ARGB, 0) | |
| 2362 | #endif | ||
| 2363 | 318524 | YUV2RGBWRAPPER(yuv2, rgb_full, bgr24_full, AV_PIX_FMT_BGR24, 0) | |
| 2364 | 907426 | YUV2RGBWRAPPER(yuv2, rgb_full, rgb24_full, AV_PIX_FMT_RGB24, 0) | |
| 2365 | |||
| 2366 | 77786 | YUV2RGBWRAPPER(yuv2, rgb_full, bgr4_byte_full, AV_PIX_FMT_BGR4_BYTE, 0) | |
| 2367 | 77786 | YUV2RGBWRAPPER(yuv2, rgb_full, rgb4_byte_full, AV_PIX_FMT_RGB4_BYTE, 0) | |
| 2368 | 153268 | YUV2RGBWRAPPER(yuv2, rgb_full, bgr8_full, AV_PIX_FMT_BGR8, 0) | |
| 2369 | 92186 | YUV2RGBWRAPPER(yuv2, rgb_full, rgb8_full, AV_PIX_FMT_RGB8, 0) | |
| 2370 | |||
| 2371 | 137488 | YUV2RGBWRAPPER(yuv2, rgb_full, x2rgb10_full, AV_PIX_FMT_X2RGB10LE, 0) | |
| 2372 | 137488 | YUV2RGBWRAPPER(yuv2, rgb_full, x2bgr10_full, AV_PIX_FMT_X2BGR10LE, 0) | |
| 2373 | |||
| 2374 | static void | ||
| 2375 | 2715644 | yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2376 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2377 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2378 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2379 | const int16_t **alpSrc, uint8_t **dest, | ||
| 2380 | int dstW, int y) | ||
| 2381 | { | ||
| 2382 | 2715644 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2383 | int i; | ||
| 2384 |
4/4✓ Branch 0 taken 126422 times.
✓ Branch 1 taken 2589222 times.
✓ Branch 2 taken 4304 times.
✓ Branch 3 taken 122118 times.
|
2715644 | int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc; |
| 2385 | 2715644 | uint16_t **dest16 = (uint16_t**)dest; | |
| 2386 | 2715644 | int SH = 22 + 8 - desc->comp[0].depth; | |
| 2387 | 2715644 | int A = 0; // init to silence warning | |
| 2388 | |||
| 2389 |
2/2✓ Branch 0 taken 951904144 times.
✓ Branch 1 taken 2715644 times.
|
954619788 | for (i = 0; i < dstW; i++) { |
| 2390 | int j; | ||
| 2391 | 951904144 | int Y = 1 << 9; | |
| 2392 | 951904144 | int U = (1 << 9) - (128 << 19); | |
| 2393 | 951904144 | int V = (1 << 9) - (128 << 19); | |
| 2394 | int R, G, B; | ||
| 2395 | |||
| 2396 |
2/2✓ Branch 0 taken 962204944 times.
✓ Branch 1 taken 951904144 times.
|
1914109088 | for (j = 0; j < lumFilterSize; j++) |
| 2397 | 962204944 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2398 | |||
| 2399 |
2/2✓ Branch 0 taken 1907492800 times.
✓ Branch 1 taken 951904144 times.
|
2859396944 | for (j = 0; j < chrFilterSize; j++) { |
| 2400 | 1907492800 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2401 | 1907492800 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2402 | } | ||
| 2403 | |||
| 2404 | 951904144 | Y >>= 10; | |
| 2405 | 951904144 | U >>= 10; | |
| 2406 | 951904144 | V >>= 10; | |
| 2407 | |||
| 2408 |
2/2✓ Branch 0 taken 598464 times.
✓ Branch 1 taken 951305680 times.
|
951904144 | if (hasAlpha) { |
| 2409 | 598464 | A = 1 << 18; | |
| 2410 | |||
| 2411 |
2/2✓ Branch 0 taken 4214464 times.
✓ Branch 1 taken 598464 times.
|
4812928 | for (j = 0; j < lumFilterSize; j++) |
| 2412 | 4214464 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2413 | |||
| 2414 |
2/2✓ Branch 0 taken 321720 times.
✓ Branch 1 taken 276744 times.
|
598464 | if (A & 0xF8000000) |
| 2415 | 321720 | A = av_clip_uintp2(A, 27); | |
| 2416 | } | ||
| 2417 | |||
| 2418 | 951904144 | Y -= c->yuv2rgb_y_offset; | |
| 2419 | 951904144 | Y *= c->yuv2rgb_y_coeff; | |
| 2420 | 951904144 | Y += 1 << (SH-1); | |
| 2421 | 951904144 | R = Y + V * (unsigned)c->yuv2rgb_v2r_coeff; | |
| 2422 | 951904144 | G = Y + V * (unsigned)c->yuv2rgb_v2g_coeff + U * (unsigned)c->yuv2rgb_u2g_coeff; | |
| 2423 | 951904144 | B = Y + U * (unsigned)c->yuv2rgb_u2b_coeff; | |
| 2424 | |||
| 2425 |
2/2✓ Branch 0 taken 280228960 times.
✓ Branch 1 taken 671675184 times.
|
951904144 | if ((R | G | B) & 0xC0000000) { |
| 2426 | 280228960 | R = av_clip_uintp2(R, 30); | |
| 2427 | 280228960 | G = av_clip_uintp2(G, 30); | |
| 2428 | 280228960 | B = av_clip_uintp2(B, 30); | |
| 2429 | } | ||
| 2430 | |||
| 2431 |
2/2✓ Branch 0 taken 660493456 times.
✓ Branch 1 taken 291410688 times.
|
951904144 | if (SH != 22) { |
| 2432 | 660493456 | dest16[0][i] = G >> SH; | |
| 2433 | 660493456 | dest16[1][i] = B >> SH; | |
| 2434 | 660493456 | dest16[2][i] = R >> SH; | |
| 2435 |
2/2✓ Branch 0 taken 539008 times.
✓ Branch 1 taken 659954448 times.
|
660493456 | if (hasAlpha) |
| 2436 | 539008 | dest16[3][i] = A >> (SH - 3); | |
| 2437 | } else { | ||
| 2438 | 291410688 | dest[0][i] = G >> 22; | |
| 2439 | 291410688 | dest[1][i] = B >> 22; | |
| 2440 | 291410688 | dest[2][i] = R >> 22; | |
| 2441 |
2/2✓ Branch 0 taken 59456 times.
✓ Branch 1 taken 291351232 times.
|
291410688 | if (hasAlpha) |
| 2442 | 59456 | dest[3][i] = A >> 19; | |
| 2443 | } | ||
| 2444 | } | ||
| 2445 |
4/4✓ Branch 0 taken 1886980 times.
✓ Branch 1 taken 828664 times.
✓ Branch 3 taken 223704 times.
✓ Branch 4 taken 1663276 times.
|
2715644 | if (SH != 22 && (!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) { |
| 2446 |
2/2✓ Branch 0 taken 77448768 times.
✓ Branch 1 taken 223704 times.
|
77672472 | for (i = 0; i < dstW; i++) { |
| 2447 | 77448768 | dest16[0][i] = av_bswap16(dest16[0][i]); | |
| 2448 | 77448768 | dest16[1][i] = av_bswap16(dest16[1][i]); | |
| 2449 | 77448768 | dest16[2][i] = av_bswap16(dest16[2][i]); | |
| 2450 |
2/2✓ Branch 0 taken 269504 times.
✓ Branch 1 taken 77179264 times.
|
77448768 | if (hasAlpha) |
| 2451 | 269504 | dest16[3][i] = av_bswap16(dest16[3][i]); | |
| 2452 | } | ||
| 2453 | } | ||
| 2454 | 2715644 | } | |
| 2455 | |||
| 2456 | static void | ||
| 2457 | 43616 | yuv2gbrpmsb_full_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2458 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2459 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2460 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2461 | const int16_t **alpSrc, uint8_t **dest, | ||
| 2462 | int dstW, int y) | ||
| 2463 | { | ||
| 2464 | 43616 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2465 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 43616 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
43616 | int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc; |
| 2466 | 43616 | uint16_t **dest16 = (uint16_t**)dest; | |
| 2467 | 43616 | int shift = 16 - desc->comp[0].depth; | |
| 2468 | int i; | ||
| 2469 | |||
| 2470 | 43616 | yuv2gbrp_full_X_c(c, lumFilter, lumSrc, lumFilterSize, | |
| 2471 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, | ||
| 2472 | alpSrc, dest, dstW, y); | ||
| 2473 | |||
| 2474 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43616 times.
|
43616 | if (desc->comp[0].depth <= 8) |
| 2475 | ✗ | return; | |
| 2476 | |||
| 2477 |
2/2✓ Branch 1 taken 21136 times.
✓ Branch 2 taken 22480 times.
|
43616 | if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) { |
| 2478 |
2/2✓ Branch 0 taken 6789248 times.
✓ Branch 1 taken 21136 times.
|
6810384 | for (i = 0; i < dstW; i++) { |
| 2479 | 6789248 | dest16[0][i] = av_bswap16(av_bswap16(dest16[0][i]) << shift); | |
| 2480 | 6789248 | dest16[1][i] = av_bswap16(av_bswap16(dest16[1][i]) << shift); | |
| 2481 | 6789248 | dest16[2][i] = av_bswap16(av_bswap16(dest16[2][i]) << shift); | |
| 2482 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6789248 times.
|
6789248 | if (hasAlpha) |
| 2483 | ✗ | dest16[3][i] = av_bswap16(av_bswap16(dest16[3][i]) << shift); | |
| 2484 | } | ||
| 2485 | } else { | ||
| 2486 |
2/2✓ Branch 0 taken 7213184 times.
✓ Branch 1 taken 22480 times.
|
7235664 | for (i = 0; i < dstW; i++) { |
| 2487 | 7213184 | dest16[0][i] = dest16[0][i] << shift; | |
| 2488 | 7213184 | dest16[1][i] = dest16[1][i] << shift; | |
| 2489 | 7213184 | dest16[2][i] = dest16[2][i] << shift; | |
| 2490 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7213184 times.
|
7213184 | if (hasAlpha) |
| 2491 | ✗ | dest16[3][i] = dest16[3][i] << shift; | |
| 2492 | } | ||
| 2493 | } | ||
| 2494 | } | ||
| 2495 | |||
| 2496 | static void | ||
| 2497 | 362796 | yuv2gbrp16_full_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2498 | const int16_t **lumSrcx, int lumFilterSize, | ||
| 2499 | const int16_t *chrFilter, const int16_t **chrUSrcx, | ||
| 2500 | const int16_t **chrVSrcx, int chrFilterSize, | ||
| 2501 | const int16_t **alpSrcx, uint8_t **dest, | ||
| 2502 | int dstW, int y) | ||
| 2503 | { | ||
| 2504 | 362796 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2505 | int i; | ||
| 2506 |
4/4✓ Branch 0 taken 27894 times.
✓ Branch 1 taken 334902 times.
✓ Branch 2 taken 820 times.
✓ Branch 3 taken 27074 times.
|
362796 | int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx; |
| 2507 | 362796 | uint16_t **dest16 = (uint16_t**)dest; | |
| 2508 | 362796 | const int32_t **lumSrc = (const int32_t**)lumSrcx; | |
| 2509 | 362796 | const int32_t **chrUSrc = (const int32_t**)chrUSrcx; | |
| 2510 | 362796 | const int32_t **chrVSrc = (const int32_t**)chrVSrcx; | |
| 2511 | 362796 | const int32_t **alpSrc = (const int32_t**)alpSrcx; | |
| 2512 | |||
| 2513 |
2/2✓ Branch 0 taken 127389632 times.
✓ Branch 1 taken 362796 times.
|
127752428 | for (i = 0; i < dstW; i++) { |
| 2514 | int j; | ||
| 2515 | 127389632 | int Y = -0x40000000; | |
| 2516 | 127389632 | int U = -(128 << 23); | |
| 2517 | 127389632 | int V = -(128 << 23); | |
| 2518 | int R, G, B, A; | ||
| 2519 | |||
| 2520 |
2/2✓ Branch 0 taken 129578432 times.
✓ Branch 1 taken 127389632 times.
|
256968064 | for (j = 0; j < lumFilterSize; j++) |
| 2521 | 129578432 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2522 | |||
| 2523 |
2/2✓ Branch 0 taken 218383808 times.
✓ Branch 1 taken 127389632 times.
|
345773440 | for (j = 0; j < chrFilterSize; j++) { |
| 2524 | 218383808 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2525 | 218383808 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2526 | } | ||
| 2527 | |||
| 2528 | 127389632 | Y >>= 14; | |
| 2529 | 127389632 | Y += 0x10000; | |
| 2530 | 127389632 | U >>= 14; | |
| 2531 | 127389632 | V >>= 14; | |
| 2532 | |||
| 2533 |
2/2✓ Branch 0 taken 131872 times.
✓ Branch 1 taken 127257760 times.
|
127389632 | if (hasAlpha) { |
| 2534 | 131872 | A = -0x40000000; | |
| 2535 | |||
| 2536 |
2/2✓ Branch 0 taken 1226272 times.
✓ Branch 1 taken 131872 times.
|
1358144 | for (j = 0; j < lumFilterSize; j++) |
| 2537 | 1226272 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2538 | |||
| 2539 | 131872 | A >>= 1; | |
| 2540 | 131872 | A += 0x20002000; | |
| 2541 | } | ||
| 2542 | |||
| 2543 | 127389632 | Y -= c->yuv2rgb_y_offset; | |
| 2544 | 127389632 | Y *= c->yuv2rgb_y_coeff; | |
| 2545 | 127389632 | Y += (1 << 13) - (1 << 29); | |
| 2546 | 127389632 | R = V * c->yuv2rgb_v2r_coeff; | |
| 2547 | 127389632 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 2548 | 127389632 | B = U * c->yuv2rgb_u2b_coeff; | |
| 2549 | |||
| 2550 | 127389632 | dest16[2][i] = av_clip_uintp2(((Y + (int64_t)R) >> 14) + (1<<15), 16); | |
| 2551 | 127389632 | dest16[0][i] = av_clip_uintp2(((Y + (int64_t)G) >> 14) + (1<<15), 16); | |
| 2552 | 127389632 | dest16[1][i] = av_clip_uintp2(((Y + (int64_t)B) >> 14) + (1<<15), 16); | |
| 2553 | |||
| 2554 |
2/2✓ Branch 0 taken 131872 times.
✓ Branch 1 taken 127257760 times.
|
127389632 | if (hasAlpha) |
| 2555 | 131872 | dest16[3][i] = av_clip_uintp2(A, 30) >> 14; | |
| 2556 | } | ||
| 2557 |
2/2✓ Branch 1 taken 124264 times.
✓ Branch 2 taken 238532 times.
|
362796 | if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) { |
| 2558 |
2/2✓ Branch 0 taken 43533760 times.
✓ Branch 1 taken 124264 times.
|
43658024 | for (i = 0; i < dstW; i++) { |
| 2559 | 43533760 | dest16[0][i] = av_bswap16(dest16[0][i]); | |
| 2560 | 43533760 | dest16[1][i] = av_bswap16(dest16[1][i]); | |
| 2561 | 43533760 | dest16[2][i] = av_bswap16(dest16[2][i]); | |
| 2562 |
2/2✓ Branch 0 taken 72416 times.
✓ Branch 1 taken 43461344 times.
|
43533760 | if (hasAlpha) |
| 2563 | 72416 | dest16[3][i] = av_bswap16(dest16[3][i]); | |
| 2564 | } | ||
| 2565 | } | ||
| 2566 | 362796 | } | |
| 2567 | |||
| 2568 | static void | ||
| 2569 | 87955 | yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2570 | const int16_t **lumSrcx, int lumFilterSize, | ||
| 2571 | const int16_t *chrFilter, const int16_t **chrUSrcx, | ||
| 2572 | const int16_t **chrVSrcx, int chrFilterSize, | ||
| 2573 | const int16_t **alpSrcx, uint8_t **dest, | ||
| 2574 | int dstW, int y) | ||
| 2575 | { | ||
| 2576 | 87955 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2577 | int i; | ||
| 2578 |
4/4✓ Branch 0 taken 38193 times.
✓ Branch 1 taken 49762 times.
✓ Branch 2 taken 3633 times.
✓ Branch 3 taken 34560 times.
|
87955 | int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx; |
| 2579 | 87955 | uint32_t **dest32 = (uint32_t**)dest; | |
| 2580 | 87955 | const int32_t **lumSrc = (const int32_t**)lumSrcx; | |
| 2581 | 87955 | const int32_t **chrUSrc = (const int32_t**)chrUSrcx; | |
| 2582 | 87955 | const int32_t **chrVSrc = (const int32_t**)chrVSrcx; | |
| 2583 | 87955 | const int32_t **alpSrc = (const int32_t**)alpSrcx; | |
| 2584 | static const float float_mult = 1.0f / 65535.0f; | ||
| 2585 | |||
| 2586 |
2/2✓ Branch 0 taken 32100150 times.
✓ Branch 1 taken 87955 times.
|
32188105 | for (i = 0; i < dstW; i++) { |
| 2587 | int j; | ||
| 2588 | 32100150 | int Y = -0x40000000; | |
| 2589 | 32100150 | int U = -(128 << 23); | |
| 2590 | 32100150 | int V = -(128 << 23); | |
| 2591 | int R, G, B, A; | ||
| 2592 | |||
| 2593 |
2/2✓ Branch 0 taken 34288950 times.
✓ Branch 1 taken 32100150 times.
|
66389100 | for (j = 0; j < lumFilterSize; j++) |
| 2594 | 34288950 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2595 | |||
| 2596 |
2/2✓ Branch 0 taken 118283574 times.
✓ Branch 1 taken 32100150 times.
|
150383724 | for (j = 0; j < chrFilterSize; j++) { |
| 2597 | 118283574 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2598 | 118283574 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2599 | } | ||
| 2600 | |||
| 2601 | 32100150 | Y >>= 14; | |
| 2602 | 32100150 | Y += 0x10000; | |
| 2603 | 32100150 | U >>= 14; | |
| 2604 | 32100150 | V >>= 14; | |
| 2605 | |||
| 2606 |
2/2✓ Branch 0 taken 1935115 times.
✓ Branch 1 taken 30165035 times.
|
32100150 | if (hasAlpha) { |
| 2607 | 1935115 | A = -0x40000000; | |
| 2608 | |||
| 2609 |
2/2✓ Branch 0 taken 3029515 times.
✓ Branch 1 taken 1935115 times.
|
4964630 | for (j = 0; j < lumFilterSize; j++) |
| 2610 | 3029515 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2611 | |||
| 2612 | 1935115 | A >>= 1; | |
| 2613 | 1935115 | A += 0x20002000; | |
| 2614 | } | ||
| 2615 | |||
| 2616 | 32100150 | Y -= c->yuv2rgb_y_offset; | |
| 2617 | 32100150 | Y *= c->yuv2rgb_y_coeff; | |
| 2618 | 32100150 | Y += (1 << 13) - (1 << 29); | |
| 2619 | 32100150 | R = V * c->yuv2rgb_v2r_coeff; | |
| 2620 | 32100150 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 2621 | 32100150 | B = U * c->yuv2rgb_u2b_coeff; | |
| 2622 | |||
| 2623 | 32100150 | R = av_clip_uintp2(((Y + R) >> 14) + (1<<15), 16); | |
| 2624 | 32100150 | G = av_clip_uintp2(((Y + G) >> 14) + (1<<15), 16); | |
| 2625 | 32100150 | B = av_clip_uintp2(((Y + B) >> 14) + (1<<15), 16); | |
| 2626 | |||
| 2627 | 32100150 | dest32[0][i] = av_float2int(float_mult * (float)G); | |
| 2628 | 32100150 | dest32[1][i] = av_float2int(float_mult * (float)B); | |
| 2629 | 32100150 | dest32[2][i] = av_float2int(float_mult * (float)R); | |
| 2630 |
2/2✓ Branch 0 taken 1935115 times.
✓ Branch 1 taken 30165035 times.
|
32100150 | if (hasAlpha) |
| 2631 | 1935115 | dest32[3][i] = av_float2int(float_mult * (float)(av_clip_uintp2(A, 30) >> 14)); | |
| 2632 | } | ||
| 2633 |
2/2✓ Branch 1 taken 23056 times.
✓ Branch 2 taken 64899 times.
|
87955 | if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) { |
| 2634 |
2/2✓ Branch 0 taken 8021632 times.
✓ Branch 1 taken 23056 times.
|
8044688 | for (i = 0; i < dstW; i++) { |
| 2635 | 8021632 | dest32[0][i] = av_bswap32(dest32[0][i]); | |
| 2636 | 8021632 | dest32[1][i] = av_bswap32(dest32[1][i]); | |
| 2637 | 8021632 | dest32[2][i] = av_bswap32(dest32[2][i]); | |
| 2638 |
2/2✓ Branch 0 taken 57152 times.
✓ Branch 1 taken 7964480 times.
|
8021632 | if (hasAlpha) |
| 2639 | 57152 | dest32[3][i] = av_bswap32(dest32[3][i]); | |
| 2640 | } | ||
| 2641 | } | ||
| 2642 | 87955 | } | |
| 2643 | |||
| 2644 | static void | ||
| 2645 | 1152 | yuv2ya8_1_c(SwsInternal *c, const int16_t *buf0, | |
| 2646 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2647 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 2648 | int uvalpha, int y) | ||
| 2649 | { | ||
| 2650 | 1152 | int hasAlpha = !!abuf0; | |
| 2651 | int i; | ||
| 2652 | |||
| 2653 |
2/2✓ Branch 0 taken 110592 times.
✓ Branch 1 taken 1152 times.
|
111744 | for (i = 0; i < dstW; i++) { |
| 2654 | 110592 | int Y = (buf0[i] + 64) >> 7; | |
| 2655 | int A; | ||
| 2656 | |||
| 2657 | 110592 | Y = av_clip_uint8(Y); | |
| 2658 | |||
| 2659 |
1/2✓ Branch 0 taken 110592 times.
✗ Branch 1 not taken.
|
110592 | if (hasAlpha) { |
| 2660 | 110592 | A = (abuf0[i] + 64) >> 7; | |
| 2661 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 110592 times.
|
110592 | if (A & 0x100) |
| 2662 | ✗ | A = av_clip_uint8(A); | |
| 2663 | } | ||
| 2664 | |||
| 2665 | 110592 | dest[i * 2 ] = Y; | |
| 2666 |
1/2✓ Branch 0 taken 110592 times.
✗ Branch 1 not taken.
|
110592 | dest[i * 2 + 1] = hasAlpha ? A : 255; |
| 2667 | } | ||
| 2668 | 1152 | } | |
| 2669 | |||
| 2670 | static void | ||
| 2671 | ✗ | yuv2ya8_2_c(SwsInternal *c, const int16_t *buf[2], | |
| 2672 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2673 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 2674 | int yalpha, int uvalpha, int y) | ||
| 2675 | { | ||
| 2676 | ✗ | int hasAlpha = abuf && abuf[0] && abuf[1]; | |
| 2677 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 2678 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 2679 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 2680 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 2681 | int i; | ||
| 2682 | |||
| 2683 | av_assert2(yalpha <= 4096U); | ||
| 2684 | |||
| 2685 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2686 | ✗ | int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19; | |
| 2687 | int A; | ||
| 2688 | |||
| 2689 | ✗ | Y = av_clip_uint8(Y); | |
| 2690 | |||
| 2691 | ✗ | if (hasAlpha) { | |
| 2692 | ✗ | A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 19; | |
| 2693 | ✗ | A = av_clip_uint8(A); | |
| 2694 | } | ||
| 2695 | |||
| 2696 | ✗ | dest[i * 2 ] = Y; | |
| 2697 | ✗ | dest[i * 2 + 1] = hasAlpha ? A : 255; | |
| 2698 | } | ||
| 2699 | ✗ | } | |
| 2700 | |||
| 2701 | static void | ||
| 2702 | 9992 | yuv2ya8_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2703 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2704 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2705 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2706 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) | ||
| 2707 | { | ||
| 2708 | 9992 | int hasAlpha = !!alpSrc; | |
| 2709 | int i; | ||
| 2710 | |||
| 2711 |
2/2✓ Branch 0 taken 3486784 times.
✓ Branch 1 taken 9992 times.
|
3496776 | for (i = 0; i < dstW; i++) { |
| 2712 | int j; | ||
| 2713 | 3486784 | int Y = 1 << 18, A = 1 << 18; | |
| 2714 | |||
| 2715 |
2/2✓ Branch 0 taken 3926784 times.
✓ Branch 1 taken 3486784 times.
|
7413568 | for (j = 0; j < lumFilterSize; j++) |
| 2716 | 3926784 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2717 | |||
| 2718 | 3486784 | Y >>= 19; | |
| 2719 |
2/2✓ Branch 0 taken 19122 times.
✓ Branch 1 taken 3467662 times.
|
3486784 | if (Y & 0x100) |
| 2720 | 19122 | Y = av_clip_uint8(Y); | |
| 2721 | |||
| 2722 |
2/2✓ Branch 0 taken 40000 times.
✓ Branch 1 taken 3446784 times.
|
3486784 | if (hasAlpha) { |
| 2723 |
2/2✓ Branch 0 taken 480000 times.
✓ Branch 1 taken 40000 times.
|
520000 | for (j = 0; j < lumFilterSize; j++) |
| 2724 | 480000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2725 | |||
| 2726 | 40000 | A >>= 19; | |
| 2727 | |||
| 2728 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40000 times.
|
40000 | if (A & 0x100) |
| 2729 | ✗ | A = av_clip_uint8(A); | |
| 2730 | } | ||
| 2731 | |||
| 2732 | 3486784 | dest[2 * i ] = Y; | |
| 2733 |
2/2✓ Branch 0 taken 40000 times.
✓ Branch 1 taken 3446784 times.
|
3486784 | dest[2 * i + 1] = hasAlpha ? A : 255; |
| 2734 | } | ||
| 2735 | 9992 | } | |
| 2736 | |||
| 2737 | #define output_pixels(pos, val) \ | ||
| 2738 | if (is_be) { \ | ||
| 2739 | AV_WB16(pos, val); \ | ||
| 2740 | } else { \ | ||
| 2741 | AV_WL16(pos, val); \ | ||
| 2742 | } | ||
| 2743 | |||
| 2744 | static av_always_inline void | ||
| 2745 | 251936 | yuv2ayuv64_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2746 | const int16_t **_lumSrc, int lumFilterSize, | ||
| 2747 | const int16_t *chrFilter, const int16_t **_chrUSrc, | ||
| 2748 | const int16_t **_chrVSrc, int chrFilterSize, | ||
| 2749 | const int16_t **_alpSrc, uint8_t *dest, int dstW, int y, | ||
| 2750 | int A_offset, int Y_offset, int U_offset, int V_offset, int is_be) | ||
| 2751 | { | ||
| 2752 | 251936 | const int32_t **lumSrc = (const int32_t **) _lumSrc, | |
| 2753 | 251936 | **chrUSrc = (const int32_t **) _chrUSrc, | |
| 2754 | 251936 | **chrVSrc = (const int32_t **) _chrVSrc, | |
| 2755 | 251936 | **alpSrc = (const int32_t **) _alpSrc; | |
| 2756 | 251936 | int hasAlpha = !!alpSrc; | |
| 2757 | int i; | ||
| 2758 | |||
| 2759 |
2/2✓ Branch 0 taken 87380224 times.
✓ Branch 1 taken 251936 times.
|
87632160 | for (i = 0; i < dstW; i++) { |
| 2760 | 87380224 | int Y = 1 << 14, U = 1 << 14; | |
| 2761 | 87380224 | int V = 1 << 14, A = 1 << 14; | |
| 2762 | int j; | ||
| 2763 | |||
| 2764 | 87380224 | Y -= 0x40000000; | |
| 2765 | 87380224 | U -= 0x40000000; | |
| 2766 | 87380224 | V -= 0x40000000; | |
| 2767 | 87380224 | A -= 0x40000000; | |
| 2768 | |||
| 2769 |
2/2✓ Branch 0 taken 89140224 times.
✓ Branch 1 taken 87380224 times.
|
176520448 | for (j = 0; j < lumFilterSize; j++) |
| 2770 | 89140224 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2771 | |||
| 2772 |
2/2✓ Branch 0 taken 128068608 times.
✓ Branch 1 taken 87380224 times.
|
215448832 | for (j = 0; j < chrFilterSize; j++) |
| 2773 | 128068608 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2774 | |||
| 2775 |
2/2✓ Branch 0 taken 128068608 times.
✓ Branch 1 taken 87380224 times.
|
215448832 | for (j = 0; j < chrFilterSize; j++) |
| 2776 | 128068608 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2777 | |||
| 2778 |
2/2✓ Branch 0 taken 301184 times.
✓ Branch 1 taken 87079040 times.
|
87380224 | if (hasAlpha) |
| 2779 |
2/2✓ Branch 0 taken 1181184 times.
✓ Branch 1 taken 301184 times.
|
1482368 | for (j = 0; j < lumFilterSize; j++) |
| 2780 | 1181184 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2781 | |||
| 2782 | 87380224 | Y = 0x8000 + av_clip_int16(Y >> 15); | |
| 2783 | 87380224 | U = 0x8000 + av_clip_int16(U >> 15); | |
| 2784 | 87380224 | V = 0x8000 + av_clip_int16(V >> 15); | |
| 2785 |
2/2✓ Branch 0 taken 301184 times.
✓ Branch 1 taken 87079040 times.
|
87380224 | if (hasAlpha) |
| 2786 | 301184 | A = 0x8000 + av_clip_int16(A >> 15); | |
| 2787 | |||
| 2788 |
6/6✓ Branch 0 taken 43690112 times.
✓ Branch 1 taken 43690112 times.
✓ Branch 2 taken 150592 times.
✓ Branch 3 taken 43539520 times.
✓ Branch 4 taken 150592 times.
✓ Branch 5 taken 43539520 times.
|
87380224 | output_pixels(dest + 8 * i + A_offset, hasAlpha ? A : 65535); |
| 2789 |
2/2✓ Branch 0 taken 43690112 times.
✓ Branch 1 taken 43690112 times.
|
87380224 | output_pixels(dest + 8 * i + Y_offset, Y); |
| 2790 |
2/2✓ Branch 0 taken 43690112 times.
✓ Branch 1 taken 43690112 times.
|
87380224 | output_pixels(dest + 8 * i + U_offset, U); |
| 2791 |
2/2✓ Branch 0 taken 43690112 times.
✓ Branch 1 taken 43690112 times.
|
87380224 | output_pixels(dest + 8 * i + V_offset, V); |
| 2792 | } | ||
| 2793 | 251936 | } | |
| 2794 | |||
| 2795 | #define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \ | ||
| 2796 | static void \ | ||
| 2797 | yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 2798 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 2799 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 2800 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 2801 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \ | ||
| 2802 | { \ | ||
| 2803 | yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 2804 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 2805 | alpSrc, dest, dstW, y, A, Y, U, V, is_be); \ | ||
| 2806 | } | ||
| 2807 | |||
| 2808 | 10568 | YUV2AYUV64(ayuv64, le, 0, 2, 4, 6, 0) | |
| 2809 | 10568 | YUV2AYUV64(ayuv64, be, 0, 2, 4, 6, 1) | |
| 2810 | |||
| 2811 | 115400 | YUV2AYUV64(xv48, le, 6, 2, 0, 4, 0) | |
| 2812 | 115400 | YUV2AYUV64(xv48, be, 6, 2, 0, 4, 1) | |
| 2813 | |||
| 2814 | #undef output_pixels | ||
| 2815 | |||
| 2816 | static av_always_inline void | ||
| 2817 | 245172 | yuv2v30_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 2818 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2819 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2820 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2821 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y, | ||
| 2822 | int shift) | ||
| 2823 | { | ||
| 2824 | int i; | ||
| 2825 |
2/2✓ Branch 0 taken 85109320 times.
✓ Branch 1 taken 245172 times.
|
85354492 | for (i = 0; i < dstW; i++) { |
| 2826 | 85109320 | int Y = 1 << 16, U = 1 << 16, V = 1 << 16, A = 0x3; | |
| 2827 | int j; | ||
| 2828 | |||
| 2829 |
2/2✓ Branch 0 taken 85989320 times.
✓ Branch 1 taken 85109320 times.
|
171098640 | for (j = 0; j < lumFilterSize; j++) |
| 2830 | 85989320 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2831 | |||
| 2832 |
2/2✓ Branch 0 taken 120659912 times.
✓ Branch 1 taken 85109320 times.
|
205769232 | for (j = 0; j < chrFilterSize; j++) { |
| 2833 | 120659912 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2834 | 120659912 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2835 | } | ||
| 2836 | |||
| 2837 | 85109320 | Y = av_clip_uintp2(Y >> 17, 10); | |
| 2838 | 85109320 | U = av_clip_uintp2(U >> 17, 10); | |
| 2839 | 85109320 | V = av_clip_uintp2(V >> 17, 10); | |
| 2840 | |||
| 2841 |
2/2✓ Branch 0 taken 52721160 times.
✓ Branch 1 taken 32388160 times.
|
85109320 | AV_WL32(dest + 4 * i, U << (shift + 0) | |
| 2842 | Y << (shift + 10) | | ||
| 2843 | (unsigned)V << (shift + 20) | | ||
| 2844 | (unsigned)A << (shift ? 0 : 30 /* xv30le = 30, v30xle = 0 */)); | ||
| 2845 | } | ||
| 2846 | 245172 | } | |
| 2847 | |||
| 2848 | #define V30LE_WRAPPER(name, shift) \ | ||
| 2849 | static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 2850 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 2851 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 2852 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 2853 | const int16_t **alpSrc, uint8_t *dest, int dstW, \ | ||
| 2854 | int y) \ | ||
| 2855 | { \ | ||
| 2856 | yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 2857 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 2858 | alpSrc, dest, dstW, y, shift); \ | ||
| 2859 | } | ||
| 2860 | |||
| 2861 | 92936 | V30LE_WRAPPER(xv30le, 0) | |
| 2862 | 152236 | V30LE_WRAPPER(v30xle, 2) | |
| 2863 | |||
| 2864 | #define output_pixels(pos, val, shift, bits, output_shift) \ | ||
| 2865 | if (is_be) { \ | ||
| 2866 | AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \ | ||
| 2867 | } else { \ | ||
| 2868 | AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \ | ||
| 2869 | } | ||
| 2870 | |||
| 2871 | static void | ||
| 2872 | 185872 | yuv2xv36_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2873 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2874 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2875 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2876 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y, int is_be) | ||
| 2877 | { | ||
| 2878 | int i; | ||
| 2879 |
2/2✓ Branch 0 taken 64776320 times.
✓ Branch 1 taken 185872 times.
|
64962192 | for (i = 0; i < dstW; i++) { |
| 2880 | 64776320 | int Y = 1 << 14, U = 1 << 14, V = 1 << 14, A = 65535; | |
| 2881 | int j; | ||
| 2882 | |||
| 2883 |
2/2✓ Branch 0 taken 65656320 times.
✓ Branch 1 taken 64776320 times.
|
130432640 | for (j = 0; j < lumFilterSize; j++) |
| 2884 | 65656320 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2885 | |||
| 2886 |
2/2✓ Branch 0 taken 85120512 times.
✓ Branch 1 taken 64776320 times.
|
149896832 | for (j = 0; j < chrFilterSize; j++) { |
| 2887 | 85120512 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2888 | 85120512 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2889 | } | ||
| 2890 | |||
| 2891 |
2/2✓ Branch 0 taken 32388160 times.
✓ Branch 1 taken 32388160 times.
|
64776320 | output_pixels(dest + 8 * i + 2, Y, 15, 12, 4) |
| 2892 |
2/2✓ Branch 0 taken 32388160 times.
✓ Branch 1 taken 32388160 times.
|
64776320 | output_pixels(dest + 8 * i + 0, U, 15, 12, 4) |
| 2893 |
2/2✓ Branch 0 taken 32388160 times.
✓ Branch 1 taken 32388160 times.
|
64776320 | output_pixels(dest + 8 * i + 4, V, 15, 12, 4) |
| 2894 |
2/2✓ Branch 0 taken 32388160 times.
✓ Branch 1 taken 32388160 times.
|
64776320 | output_pixels(dest + 8 * i + 6, A, 0, 12, 4); |
| 2895 | } | ||
| 2896 | 185872 | } | |
| 2897 | |||
| 2898 | #undef output_pixels | ||
| 2899 | |||
| 2900 | #define YUV2XV36(BE_LE, is_be) \ | ||
| 2901 | static void \ | ||
| 2902 | yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 2903 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 2904 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 2905 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 2906 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \ | ||
| 2907 | { \ | ||
| 2908 | yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 2909 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 2910 | alpSrc, dest, dstW, y, is_be); \ | ||
| 2911 | } | ||
| 2912 | |||
| 2913 | 92936 | YUV2XV36(le, 0) | |
| 2914 | 92936 | YUV2XV36(be, 1) | |
| 2915 | |||
| 2916 | #define output_pixels(pos, A, Y, U, V) \ | ||
| 2917 | if (target == AV_PIX_FMT_AYUV) { \ | ||
| 2918 | dest[pos + 0] = A; \ | ||
| 2919 | dest[pos + 1] = Y; \ | ||
| 2920 | dest[pos + 2] = U; \ | ||
| 2921 | dest[pos + 3] = V; \ | ||
| 2922 | } else if (target == AV_PIX_FMT_UYVA) { \ | ||
| 2923 | dest[pos + 0] = U; \ | ||
| 2924 | dest[pos + 1] = Y; \ | ||
| 2925 | dest[pos + 2] = V; \ | ||
| 2926 | dest[pos + 3] = A; \ | ||
| 2927 | } else { /* AV_PIX_FMT_VUYA || AV_PIX_FMT_VUYX */ \ | ||
| 2928 | dest[pos + 0] = V; \ | ||
| 2929 | dest[pos + 1] = U; \ | ||
| 2930 | dest[pos + 2] = Y; \ | ||
| 2931 | dest[pos + 3] = A; \ | ||
| 2932 | } | ||
| 2933 | |||
| 2934 | static av_always_inline void | ||
| 2935 | 131876 | yuv2ayuv_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 2936 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2937 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 2938 | int uvalpha, int y, enum AVPixelFormat target) | ||
| 2939 | { | ||
| 2940 | 131876 | int hasAlpha = !!abuf0; | |
| 2941 | int i; | ||
| 2942 | |||
| 2943 |
1/2✓ Branch 0 taken 131876 times.
✗ Branch 1 not taken.
|
131876 | if (uvalpha < 2048) { |
| 2944 |
2/2✓ Branch 0 taken 44700104 times.
✓ Branch 1 taken 131876 times.
|
44831980 | for (i = 0; i < dstW; i++) { |
| 2945 | 44700104 | int Y = (buf0[i] + 64) >> 7; | |
| 2946 | 44700104 | int U = (ubuf[0][i] + 64) >> 7; | |
| 2947 | 44700104 | int V = (vbuf[0][i] + 64) >> 7; | |
| 2948 | 44700104 | int A = 255; | |
| 2949 | |||
| 2950 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44700104 times.
|
44700104 | if (Y & 0x100) |
| 2951 | ✗ | Y = av_clip_uint8(Y); | |
| 2952 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44700104 times.
|
44700104 | if (U & 0x100) |
| 2953 | ✗ | U = av_clip_uint8(U); | |
| 2954 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44700104 times.
|
44700104 | if (V & 0x100) |
| 2955 | ✗ | V = av_clip_uint8(V); | |
| 2956 | |||
| 2957 |
2/2✓ Branch 0 taken 331776 times.
✓ Branch 1 taken 44368328 times.
|
44700104 | if (hasAlpha) { |
| 2958 | 331776 | A = (abuf0[i] + 64) >> 7; | |
| 2959 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 331776 times.
|
331776 | if (A & 0x100) |
| 2960 | ✗ | A = av_clip_uint8(A); | |
| 2961 | } | ||
| 2962 | |||
| 2963 |
4/4✓ Branch 0 taken 110592 times.
✓ Branch 1 taken 44589512 times.
✓ Branch 2 taken 15374792 times.
✓ Branch 3 taken 29214720 times.
|
44700104 | output_pixels(i * 4, A, Y, U, V) |
| 2964 | } | ||
| 2965 | } else { | ||
| 2966 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2967 | ✗ | int Y = (buf0[i] + 64) >> 7; | |
| 2968 | ✗ | int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8; | |
| 2969 | ✗ | int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8; | |
| 2970 | ✗ | int A = 255; | |
| 2971 | |||
| 2972 | ✗ | if (Y & 0x100) | |
| 2973 | ✗ | Y = av_clip_uint8(Y); | |
| 2974 | ✗ | if (U & 0x100) | |
| 2975 | ✗ | U = av_clip_uint8(U); | |
| 2976 | ✗ | if (V & 0x100) | |
| 2977 | ✗ | V = av_clip_uint8(V); | |
| 2978 | |||
| 2979 | ✗ | if (hasAlpha) { | |
| 2980 | ✗ | A = (abuf0[i] + 64) >> 7; | |
| 2981 | ✗ | if (A & 0x100) | |
| 2982 | ✗ | A = av_clip_uint8(A); | |
| 2983 | } | ||
| 2984 | |||
| 2985 | ✗ | output_pixels(i * 4, A, Y, U, V) | |
| 2986 | } | ||
| 2987 | } | ||
| 2988 | 131876 | } | |
| 2989 | |||
| 2990 | static av_always_inline void | ||
| 2991 | ✗ | yuv2ayuv_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 2992 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2993 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 2994 | int yalpha, int uvalpha, int y, | ||
| 2995 | enum AVPixelFormat target) | ||
| 2996 | { | ||
| 2997 | ✗ | int hasAlpha = abuf && abuf[0] && abuf[1]; | |
| 2998 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 2999 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 3000 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 3001 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 3002 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 3003 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 3004 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 3005 | int i; | ||
| 3006 | |||
| 3007 | av_assert2(yalpha <= 4096U); | ||
| 3008 | av_assert2(uvalpha <= 4096U); | ||
| 3009 | |||
| 3010 | ✗ | for (i = 0; i < dstW; i++) { | |
| 3011 | ✗ | int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19; | |
| 3012 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; | |
| 3013 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; | |
| 3014 | ✗ | int A = 255; | |
| 3015 | |||
| 3016 | ✗ | if (Y & 0x100) | |
| 3017 | ✗ | Y = av_clip_uint8(Y); | |
| 3018 | ✗ | if (U & 0x100) | |
| 3019 | ✗ | U = av_clip_uint8(U); | |
| 3020 | ✗ | if (V & 0x100) | |
| 3021 | ✗ | V = av_clip_uint8(V); | |
| 3022 | |||
| 3023 | ✗ | if (hasAlpha) { | |
| 3024 | ✗ | A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 19; | |
| 3025 | ✗ | A = av_clip_uint8(A); | |
| 3026 | } | ||
| 3027 | |||
| 3028 | ✗ | output_pixels(i * 4, A, Y, U, V) | |
| 3029 | } | ||
| 3030 | ✗ | } | |
| 3031 | |||
| 3032 | static av_always_inline void | ||
| 3033 | 40544 | yuv2ayuv_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 3034 | const int16_t **lumSrc, int lumFilterSize, | ||
| 3035 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 3036 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 3037 | const int16_t **alpSrc, uint8_t *dest, int dstW, | ||
| 3038 | int y, enum AVPixelFormat target) | ||
| 3039 | { | ||
| 3040 | int i; | ||
| 3041 | |||
| 3042 |
2/2✓ Branch 0 taken 14149888 times.
✓ Branch 1 taken 40544 times.
|
14190432 | for (i = 0; i < dstW; i++) { |
| 3043 | int j; | ||
| 3044 | 14149888 | int Y = 1 << 18, U = 1 << 18; | |
| 3045 | 14149888 | int V = 1 << 18, A = 255; | |
| 3046 | |||
| 3047 |
2/2✓ Branch 0 taken 15909888 times.
✓ Branch 1 taken 14149888 times.
|
30059776 | for (j = 0; j < lumFilterSize; j++) |
| 3048 | 15909888 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 3049 | |||
| 3050 |
2/2✓ Branch 0 taken 57879552 times.
✓ Branch 1 taken 14149888 times.
|
72029440 | for (j = 0; j < chrFilterSize; j++) |
| 3051 | 57879552 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3052 | |||
| 3053 |
2/2✓ Branch 0 taken 57879552 times.
✓ Branch 1 taken 14149888 times.
|
72029440 | for (j = 0; j < chrFilterSize; j++) |
| 3054 | 57879552 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3055 | |||
| 3056 | 14149888 | Y >>= 19; | |
| 3057 | 14149888 | U >>= 19; | |
| 3058 | 14149888 | V >>= 19; | |
| 3059 | |||
| 3060 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14149888 times.
|
14149888 | if (Y & 0x100) |
| 3061 | ✗ | Y = av_clip_uint8(Y); | |
| 3062 |
2/2✓ Branch 0 taken 560 times.
✓ Branch 1 taken 14149328 times.
|
14149888 | if (U & 0x100) |
| 3063 | 560 | U = av_clip_uint8(U); | |
| 3064 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 14149880 times.
|
14149888 | if (V & 0x100) |
| 3065 | 8 | V = av_clip_uint8(V); | |
| 3066 | |||
| 3067 |
2/2✓ Branch 0 taken 120000 times.
✓ Branch 1 taken 14029888 times.
|
14149888 | if (alpSrc) { |
| 3068 | 120000 | A = 1 << 18; | |
| 3069 | |||
| 3070 |
2/2✓ Branch 0 taken 1440000 times.
✓ Branch 1 taken 120000 times.
|
1560000 | for (j = 0; j < lumFilterSize; j++) |
| 3071 | 1440000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 3072 | |||
| 3073 | 120000 | A >>= 19; | |
| 3074 | |||
| 3075 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 120000 times.
|
120000 | if (A & 0x100) |
| 3076 | ✗ | A = av_clip_uint8(A); | |
| 3077 | } | ||
| 3078 | |||
| 3079 |
4/4✓ Branch 0 taken 3486784 times.
✓ Branch 1 taken 10663104 times.
✓ Branch 2 taken 3486784 times.
✓ Branch 3 taken 7176320 times.
|
14149888 | output_pixels(i * 4, A, Y, U, V) |
| 3080 | } | ||
| 3081 | 40544 | } | |
| 3082 | |||
| 3083 | #undef output_pixels | ||
| 3084 | |||
| 3085 | #define AYUVPACKEDWRAPPER(name, fmt) \ | ||
| 3086 | static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 3087 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 3088 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 3089 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 3090 | const int16_t **alpSrc, uint8_t *dest, int dstW, \ | ||
| 3091 | int y) \ | ||
| 3092 | { \ | ||
| 3093 | yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 3094 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 3095 | alpSrc, dest, dstW, y, fmt); \ | ||
| 3096 | } \ | ||
| 3097 | \ | ||
| 3098 | static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \ | ||
| 3099 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 3100 | const int16_t *abuf[2], uint8_t *dest, int dstW, \ | ||
| 3101 | int yalpha, int uvalpha, int y) \ | ||
| 3102 | { \ | ||
| 3103 | yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \ | ||
| 3104 | dest, dstW, yalpha, uvalpha, y, fmt); \ | ||
| 3105 | } \ | ||
| 3106 | \ | ||
| 3107 | static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \ | ||
| 3108 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 3109 | const int16_t *abuf0, uint8_t *dest, int dstW, \ | ||
| 3110 | int uvalpha, int y) \ | ||
| 3111 | { \ | ||
| 3112 | yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \ | ||
| 3113 | abuf0, dest, dstW, uvalpha, \ | ||
| 3114 | y, fmt); \ | ||
| 3115 | } | ||
| 3116 | |||
| 3117 | 210464 | AYUVPACKEDWRAPPER(vuyX, AV_PIX_FMT_VUYX) | |
| 3118 | 22288 | AYUVPACKEDWRAPPER(ayuv, AV_PIX_FMT_AYUV) | |
| 3119 | 112088 | AYUVPACKEDWRAPPER(uyva, AV_PIX_FMT_UYVA) | |
| 3120 | |||
| 3121 | #define output_pixel(pos, val, bits) \ | ||
| 3122 | AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); | ||
| 3123 | |||
| 3124 | #define yuv2y2xx_wrapper(bits) \ | ||
| 3125 | static void \ | ||
| 3126 | yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 3127 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 3128 | const int16_t *chrFilter, \ | ||
| 3129 | const int16_t **chrUSrc, \ | ||
| 3130 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 3131 | const int16_t **alpSrc, \ | ||
| 3132 | uint8_t *dest, int dstW, int y) \ | ||
| 3133 | { \ | ||
| 3134 | int i, j; \ | ||
| 3135 | int shift = 11 + 16 - bits; \ | ||
| 3136 | int output_shift = 16 - bits; \ | ||
| 3137 | for (i = 0; i < ((dstW + 1) >> 1); i++) { \ | ||
| 3138 | int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \ | ||
| 3139 | int U = 1 << (shift - 1), V = 1 << (shift - 1); \ | ||
| 3140 | \ | ||
| 3141 | for (j = 0; j < lumFilterSize; j++) { \ | ||
| 3142 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; \ | ||
| 3143 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; \ | ||
| 3144 | } \ | ||
| 3145 | \ | ||
| 3146 | for (j = 0; j < chrFilterSize; j++) { \ | ||
| 3147 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; \ | ||
| 3148 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; \ | ||
| 3149 | } \ | ||
| 3150 | \ | ||
| 3151 | output_pixel(dest + 8 * i + 0, Y1, bits); \ | ||
| 3152 | output_pixel(dest + 8 * i + 2, U, bits); \ | ||
| 3153 | output_pixel(dest + 8 * i + 4, Y2, bits); \ | ||
| 3154 | output_pixel(dest + 8 * i + 6, V, bits); \ | ||
| 3155 | } \ | ||
| 3156 | } | ||
| 3157 | |||
| 3158 |
6/6✓ Branch 0 taken 16054656 times.
✓ Branch 1 taken 15834656 times.
✓ Branch 2 taken 20008320 times.
✓ Branch 3 taken 15834656 times.
✓ Branch 4 taken 15834656 times.
✓ Branch 5 taken 90056 times.
|
51987688 | yuv2y2xx_wrapper(10) |
| 3159 |
6/6✓ Branch 0 taken 16054656 times.
✓ Branch 1 taken 15834656 times.
✓ Branch 2 taken 20008320 times.
✓ Branch 3 taken 15834656 times.
✓ Branch 4 taken 15834656 times.
✓ Branch 5 taken 90056 times.
|
51987688 | yuv2y2xx_wrapper(12) |
| 3160 | |||
| 3161 | static void | ||
| 3162 | 112520 | yuv2y216le_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 3163 | const int16_t **_lumSrc, int lumFilterSize, | ||
| 3164 | const int16_t *chrFilter, | ||
| 3165 | const int16_t **_chrUSrc, | ||
| 3166 | const int16_t **_chrVSrc, int chrFilterSize, | ||
| 3167 | const int16_t **_alpSrc, | ||
| 3168 | uint8_t *dest, int dstW, int y) | ||
| 3169 | { | ||
| 3170 | 112520 | const int32_t **lumSrc = (const int32_t **)_lumSrc; | |
| 3171 | 112520 | const int32_t **chrUSrc = (const int32_t **)_chrUSrc; | |
| 3172 | 112520 | const int32_t **chrVSrc = (const int32_t **)_chrVSrc; | |
| 3173 | 112520 | int shift = 15; | |
| 3174 | |||
| 3175 |
2/2✓ Branch 0 taken 19788320 times.
✓ Branch 1 taken 112520 times.
|
19900840 | for (int i = 0; i < ((dstW + 1) >> 1); i++) { |
| 3176 | 19788320 | int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); | |
| 3177 | 19788320 | int U = 1 << (shift - 1), V = 1 << (shift - 1); | |
| 3178 | |||
| 3179 | /* See yuv2planeX_16_c_template for details. */ | ||
| 3180 | 19788320 | Y1 -= 0x40000000; | |
| 3181 | 19788320 | U -= 0x40000000; | |
| 3182 | 19788320 | Y2 -= 0x40000000; | |
| 3183 | 19788320 | V -= 0x40000000; | |
| 3184 | |||
| 3185 |
2/2✓ Branch 0 taken 20008320 times.
✓ Branch 1 taken 19788320 times.
|
39796640 | for (int j = 0; j < lumFilterSize; j++) { |
| 3186 | 20008320 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 3187 | 20008320 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 3188 | } | ||
| 3189 | |||
| 3190 |
2/2✓ Branch 0 taken 23961984 times.
✓ Branch 1 taken 19788320 times.
|
43750304 | for (int j = 0; j < chrFilterSize; j++) { |
| 3191 | 23961984 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3192 | 23961984 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3193 | } | ||
| 3194 | |||
| 3195 | 19788320 | AV_WL16(dest + 8 * i + 0, 0x8000 + av_clip_int16(Y1 >> shift)); | |
| 3196 | 19788320 | AV_WL16(dest + 8 * i + 2, 0x8000 + av_clip_int16(U >> shift)); | |
| 3197 | 19788320 | AV_WL16(dest + 8 * i + 4, 0x8000 + av_clip_int16(Y2 >> shift)); | |
| 3198 | 19788320 | AV_WL16(dest + 8 * i + 6, 0x8000 + av_clip_int16(V >> shift)); | |
| 3199 | } | ||
| 3200 | 112520 | } | |
| 3201 | |||
| 3202 | static void | ||
| 3203 | 128420 | yuv2vyu444_1_c(SwsInternal *c, const int16_t *buf0, | |
| 3204 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 3205 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 3206 | int uvalpha, int y) | ||
| 3207 | { | ||
| 3208 | int i; | ||
| 3209 | |||
| 3210 |
1/2✓ Branch 0 taken 128420 times.
✗ Branch 1 not taken.
|
128420 | if (uvalpha < 2048) { |
| 3211 |
2/2✓ Branch 0 taken 44368328 times.
✓ Branch 1 taken 128420 times.
|
44496748 | for (i = 0; i < dstW; i++) { |
| 3212 | 44368328 | int Y = (buf0[i] + 64) >> 7; | |
| 3213 | 44368328 | int U = (ubuf[0][i] + 64) >> 7; | |
| 3214 | 44368328 | int V = (vbuf[0][i] + 64) >> 7; | |
| 3215 | |||
| 3216 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44368328 times.
|
44368328 | if (Y & 0x100) |
| 3217 | ✗ | Y = av_clip_uint8(Y); | |
| 3218 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44368328 times.
|
44368328 | if (U & 0x100) |
| 3219 | ✗ | U = av_clip_uint8(U); | |
| 3220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44368328 times.
|
44368328 | if (V & 0x100) |
| 3221 | ✗ | V = av_clip_uint8(V); | |
| 3222 | |||
| 3223 | 44368328 | dest[3 * i ] = V; | |
| 3224 | 44368328 | dest[3 * i + 1] = Y; | |
| 3225 | 44368328 | dest[3 * i + 2] = U; | |
| 3226 | } | ||
| 3227 | } else { | ||
| 3228 | ✗ | for (i = 0; i < dstW; i++) { | |
| 3229 | ✗ | int Y = (buf0[i] + 64) >> 7; | |
| 3230 | ✗ | int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8; | |
| 3231 | ✗ | int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8; | |
| 3232 | |||
| 3233 | ✗ | if (Y & 0x100) | |
| 3234 | ✗ | Y = av_clip_uint8(Y); | |
| 3235 | ✗ | if (U & 0x100) | |
| 3236 | ✗ | U = av_clip_uint8(U); | |
| 3237 | ✗ | if (V & 0x100) | |
| 3238 | ✗ | V = av_clip_uint8(V); | |
| 3239 | |||
| 3240 | ✗ | dest[3 * i ] = V; | |
| 3241 | ✗ | dest[3 * i + 1] = Y; | |
| 3242 | ✗ | dest[3 * i + 2] = U; | |
| 3243 | } | ||
| 3244 | } | ||
| 3245 | 128420 | } | |
| 3246 | |||
| 3247 | static void | ||
| 3248 | ✗ | yuv2vyu444_2_c(SwsInternal *c, const int16_t *buf[2], | |
| 3249 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 3250 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 3251 | int yalpha, int uvalpha, int y) | ||
| 3252 | { | ||
| 3253 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 3254 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 3255 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; | |
| 3256 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 3257 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 3258 | int i; | ||
| 3259 | |||
| 3260 | av_assert2(yalpha <= 4096U); | ||
| 3261 | av_assert2(uvalpha <= 4096U); | ||
| 3262 | |||
| 3263 | ✗ | for (i = 0; i < dstW; i++) { | |
| 3264 | ✗ | int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19; | |
| 3265 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; | |
| 3266 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; | |
| 3267 | |||
| 3268 | ✗ | if (Y & 0x100) | |
| 3269 | ✗ | Y = av_clip_uint8(Y); | |
| 3270 | ✗ | if (U & 0x100) | |
| 3271 | ✗ | U = av_clip_uint8(U); | |
| 3272 | ✗ | if (V & 0x100) | |
| 3273 | ✗ | V = av_clip_uint8(V); | |
| 3274 | |||
| 3275 | ✗ | dest[3 * i ] = V; | |
| 3276 | ✗ | dest[3 * i + 1] = Y; | |
| 3277 | ✗ | dest[3 * i + 2] = U; | |
| 3278 | } | ||
| 3279 | ✗ | } | |
| 3280 | |||
| 3281 | static void | ||
| 3282 | 10568 | yuv2vyu444_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 3283 | const int16_t **lumSrc, int lumFilterSize, | ||
| 3284 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 3285 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 3286 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) | ||
| 3287 | { | ||
| 3288 | int i; | ||
| 3289 | |||
| 3290 |
2/2✓ Branch 0 taken 3689536 times.
✓ Branch 1 taken 10568 times.
|
3700104 | for (i = 0; i < dstW; i++) { |
| 3291 | int j; | ||
| 3292 | 3689536 | int Y = 1 << 18, U = 1 << 18; | |
| 3293 | 3689536 | int V = 1 << 18; | |
| 3294 | |||
| 3295 |
2/2✓ Branch 0 taken 4129536 times.
✓ Branch 1 taken 3689536 times.
|
7819072 | for (j = 0; j < lumFilterSize; j++) |
| 3296 | 4129536 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 3297 | |||
| 3298 |
2/2✓ Branch 0 taken 15078144 times.
✓ Branch 1 taken 3689536 times.
|
18767680 | for (j = 0; j < chrFilterSize; j++) |
| 3299 | 15078144 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3300 | |||
| 3301 |
2/2✓ Branch 0 taken 15078144 times.
✓ Branch 1 taken 3689536 times.
|
18767680 | for (j = 0; j < chrFilterSize; j++) |
| 3302 | 15078144 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3303 | |||
| 3304 | 3689536 | Y >>= 19; | |
| 3305 | 3689536 | U >>= 19; | |
| 3306 | 3689536 | V >>= 19; | |
| 3307 | |||
| 3308 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3689536 times.
|
3689536 | if (Y & 0x100) |
| 3309 | ✗ | Y = av_clip_uint8(Y); | |
| 3310 |
2/2✓ Branch 0 taken 146 times.
✓ Branch 1 taken 3689390 times.
|
3689536 | if (U & 0x100) |
| 3311 | 146 | U = av_clip_uint8(U); | |
| 3312 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3689534 times.
|
3689536 | if (V & 0x100) |
| 3313 | 2 | V = av_clip_uint8(V); | |
| 3314 | |||
| 3315 | 3689536 | dest[3 * i ] = V; | |
| 3316 | 3689536 | dest[3 * i + 1] = Y; | |
| 3317 | 3689536 | dest[3 * i + 2] = U; | |
| 3318 | } | ||
| 3319 | 10568 | } | |
| 3320 | |||
| 3321 | #undef output_pixel | ||
| 3322 | |||
| 3323 | 579096 | av_cold void ff_sws_init_output_funcs(SwsInternal *c, | |
| 3324 | yuv2planar1_fn *yuv2plane1, | ||
| 3325 | yuv2planarX_fn *yuv2planeX, | ||
| 3326 | yuv2interleavedX_fn *yuv2nv12cX, | ||
| 3327 | yuv2packed1_fn *yuv2packed1, | ||
| 3328 | yuv2packed2_fn *yuv2packed2, | ||
| 3329 | yuv2packedX_fn *yuv2packedX, | ||
| 3330 | yuv2anyX_fn *yuv2anyX) | ||
| 3331 | { | ||
| 3332 | 579096 | enum AVPixelFormat dstFormat = c->opts.dst_format; | |
| 3333 | 579096 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); | |
| 3334 | |||
| 3335 |
4/4✓ Branch 1 taken 33137 times.
✓ Branch 2 taken 545959 times.
✓ Branch 4 taken 19238 times.
✓ Branch 5 taken 13899 times.
|
579096 | if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) { |
| 3336 |
2/2✓ Branch 0 taken 9581 times.
✓ Branch 1 taken 9657 times.
|
19238 | if (desc->comp[0].depth == 10) { |
| 3337 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7488 times.
|
9581 | *yuv2plane1 = isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c; |
| 3338 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7488 times.
|
9581 | *yuv2planeX = isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c; |
| 3339 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7488 times.
|
9581 | *yuv2nv12cX = isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c; |
| 3340 |
1/2✓ Branch 0 taken 9657 times.
✗ Branch 1 not taken.
|
9657 | } else if (desc->comp[0].depth == 12) { |
| 3341 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7564 times.
|
9657 | *yuv2plane1 = isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c; |
| 3342 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7564 times.
|
9657 | *yuv2planeX = isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c; |
| 3343 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7564 times.
|
9657 | *yuv2nv12cX = isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c; |
| 3344 | } else | ||
| 3345 | ✗ | av_assert0(0); | |
| 3346 |
4/4✓ Branch 1 taken 13899 times.
✓ Branch 2 taken 545959 times.
✓ Branch 4 taken 157 times.
✓ Branch 5 taken 13742 times.
|
559858 | } else if (isSemiPlanarYUV(dstFormat) && isNBPS(dstFormat)) { |
| 3347 |
1/2✓ Branch 0 taken 157 times.
✗ Branch 1 not taken.
|
157 | if (desc->comp[0].depth == 10) { |
| 3348 |
2/2✓ Branch 1 taken 76 times.
✓ Branch 2 taken 81 times.
|
157 | *yuv2plane1 = isBE(dstFormat) ? yuv2nv20l1_BE_c : yuv2nv20l1_LE_c; |
| 3349 |
2/2✓ Branch 1 taken 76 times.
✓ Branch 2 taken 81 times.
|
157 | *yuv2planeX = isBE(dstFormat) ? yuv2nv20lX_BE_c : yuv2nv20lX_LE_c; |
| 3350 |
2/2✓ Branch 1 taken 76 times.
✓ Branch 2 taken 81 times.
|
157 | *yuv2nv12cX = isBE(dstFormat) ? yuv2nv20cX_BE_c : yuv2nv20cX_LE_c; |
| 3351 | } else | ||
| 3352 | ✗ | av_assert0(0); | |
| 3353 |
2/2✓ Branch 1 taken 37111 times.
✓ Branch 2 taken 522590 times.
|
559701 | } else if (is16BPS(dstFormat)) { |
| 3354 |
2/2✓ Branch 1 taken 10195 times.
✓ Branch 2 taken 26916 times.
|
37111 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c; |
| 3355 |
2/2✓ Branch 1 taken 10195 times.
✓ Branch 2 taken 26916 times.
|
37111 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c; |
| 3356 |
2/2✓ Branch 1 taken 6233 times.
✓ Branch 2 taken 30878 times.
|
37111 | if (isSemiPlanarYUV(dstFormat)) { |
| 3357 |
2/2✓ Branch 1 taken 2589 times.
✓ Branch 2 taken 3644 times.
|
6233 | *yuv2nv12cX = isBE(dstFormat) ? yuv2nv12cX_16BE_c : yuv2nv12cX_16LE_c; |
| 3358 | } | ||
| 3359 |
3/4✓ Branch 1 taken 5902 times.
✓ Branch 2 taken 516688 times.
✓ Branch 4 taken 5902 times.
✗ Branch 5 not taken.
|
522590 | } else if (isDataInHighBits(dstFormat) && isNBPS(dstFormat)) { |
| 3360 |
2/2✓ Branch 0 taken 2152 times.
✓ Branch 1 taken 3750 times.
|
5902 | if (desc->comp[0].depth == 10) { |
| 3361 |
2/2✓ Branch 1 taken 694 times.
✓ Branch 2 taken 1458 times.
|
2152 | *yuv2planeX = isBE(dstFormat) ? yuv2msbplaneX_10BE_c : yuv2msbplaneX_10LE_c; |
| 3362 |
2/2✓ Branch 1 taken 694 times.
✓ Branch 2 taken 1458 times.
|
2152 | *yuv2plane1 = isBE(dstFormat) ? yuv2msbplane1_10BE_c : yuv2msbplane1_10LE_c; |
| 3363 |
1/2✓ Branch 0 taken 3750 times.
✗ Branch 1 not taken.
|
3750 | } else if (desc->comp[0].depth == 12) { |
| 3364 |
2/2✓ Branch 1 taken 1493 times.
✓ Branch 2 taken 2257 times.
|
3750 | *yuv2planeX = isBE(dstFormat) ? yuv2msbplaneX_12BE_c : yuv2msbplaneX_12LE_c; |
| 3365 |
2/2✓ Branch 1 taken 1493 times.
✓ Branch 2 taken 2257 times.
|
3750 | *yuv2plane1 = isBE(dstFormat) ? yuv2msbplane1_12BE_c : yuv2msbplane1_12LE_c; |
| 3366 | } else | ||
| 3367 | ✗ | av_assert0(0); | |
| 3368 |
2/2✓ Branch 1 taken 57288 times.
✓ Branch 2 taken 459400 times.
|
516688 | } else if (isNBPS(dstFormat)) { |
| 3369 |
2/2✓ Branch 0 taken 2006 times.
✓ Branch 1 taken 55282 times.
|
57288 | if (desc->comp[0].depth == 9) { |
| 3370 |
2/2✓ Branch 1 taken 942 times.
✓ Branch 2 taken 1064 times.
|
2006 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c; |
| 3371 |
2/2✓ Branch 1 taken 942 times.
✓ Branch 2 taken 1064 times.
|
2006 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c; |
| 3372 |
2/2✓ Branch 0 taken 31444 times.
✓ Branch 1 taken 23838 times.
|
55282 | } else if (desc->comp[0].depth == 10) { |
| 3373 |
2/2✓ Branch 1 taken 5253 times.
✓ Branch 2 taken 26191 times.
|
31444 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c; |
| 3374 |
2/2✓ Branch 1 taken 5253 times.
✓ Branch 2 taken 26191 times.
|
31444 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c; |
| 3375 |
2/2✓ Branch 0 taken 21957 times.
✓ Branch 1 taken 1881 times.
|
23838 | } else if (desc->comp[0].depth == 12) { |
| 3376 |
2/2✓ Branch 1 taken 5248 times.
✓ Branch 2 taken 16709 times.
|
21957 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c; |
| 3377 |
2/2✓ Branch 1 taken 5248 times.
✓ Branch 2 taken 16709 times.
|
21957 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c; |
| 3378 |
1/2✓ Branch 0 taken 1881 times.
✗ Branch 1 not taken.
|
1881 | } else if (desc->comp[0].depth == 14) { |
| 3379 |
2/2✓ Branch 1 taken 887 times.
✓ Branch 2 taken 994 times.
|
1881 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c; |
| 3380 |
2/2✓ Branch 1 taken 887 times.
✓ Branch 2 taken 994 times.
|
1881 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c; |
| 3381 | } else | ||
| 3382 | ✗ | av_assert0(0); | |
| 3383 |
2/2✓ Branch 0 taken 110 times.
✓ Branch 1 taken 459290 times.
|
459400 | } else if (dstFormat == AV_PIX_FMT_GRAYF32BE) { |
| 3384 | 110 | *yuv2planeX = yuv2planeX_floatBE_c; | |
| 3385 | 110 | *yuv2plane1 = yuv2plane1_floatBE_c; | |
| 3386 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 459042 times.
|
459290 | } else if (dstFormat == AV_PIX_FMT_GRAYF32LE) { |
| 3387 | 248 | *yuv2planeX = yuv2planeX_floatLE_c; | |
| 3388 | 248 | *yuv2plane1 = yuv2plane1_floatLE_c; | |
| 3389 | } else { | ||
| 3390 | 459042 | *yuv2plane1 = yuv2plane1_8_c; | |
| 3391 | 459042 | *yuv2planeX = yuv2planeX_8_c; | |
| 3392 |
2/2✓ Branch 1 taken 7509 times.
✓ Branch 2 taken 451533 times.
|
459042 | if (isSemiPlanarYUV(dstFormat)) |
| 3393 | 7509 | *yuv2nv12cX = yuv2nv12cX_c; | |
| 3394 | } | ||
| 3395 | |||
| 3396 |
2/2✓ Branch 0 taken 527485 times.
✓ Branch 1 taken 51611 times.
|
579096 | if(c->opts.flags & SWS_FULL_CHR_H_INT) { |
| 3397 |
24/25✓ Branch 0 taken 88 times.
✓ Branch 1 taken 88 times.
✓ Branch 2 taken 1716 times.
✓ Branch 3 taken 88 times.
✓ Branch 4 taken 44 times.
✓ Branch 5 taken 41 times.
✓ Branch 6 taken 44 times.
✓ Branch 7 taken 41 times.
✓ Branch 8 taken 3982 times.
✓ Branch 9 taken 1416 times.
✓ Branch 10 taken 3707 times.
✓ Branch 11 taken 44 times.
✓ Branch 12 taken 46 times.
✓ Branch 13 taken 41 times.
✓ Branch 14 taken 388 times.
✓ Branch 15 taken 388 times.
✓ Branch 16 taken 740 times.
✓ Branch 17 taken 439 times.
✓ Branch 18 taken 599 times.
✓ Branch 19 taken 599 times.
✓ Branch 20 taken 29421 times.
✓ Branch 21 taken 484 times.
✓ Branch 22 taken 4526 times.
✓ Branch 23 taken 2641 times.
✗ Branch 24 not taken.
|
51611 | switch (dstFormat) { |
| 3398 | 88 | case AV_PIX_FMT_RGBA: | |
| 3399 | #if CONFIG_SMALL | ||
| 3400 | *yuv2packedX = yuv2rgba32_full_X_c; | ||
| 3401 | *yuv2packed2 = yuv2rgba32_full_2_c; | ||
| 3402 | *yuv2packed1 = yuv2rgba32_full_1_c; | ||
| 3403 | #else | ||
| 3404 | #if CONFIG_SWSCALE_ALPHA | ||
| 3405 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 6 times.
|
88 | if (c->needAlpha) { |
| 3406 | 82 | *yuv2packedX = yuv2rgba32_full_X_c; | |
| 3407 | 82 | *yuv2packed2 = yuv2rgba32_full_2_c; | |
| 3408 | 82 | *yuv2packed1 = yuv2rgba32_full_1_c; | |
| 3409 | } else | ||
| 3410 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3411 | { | ||
| 3412 | 6 | *yuv2packedX = yuv2rgbx32_full_X_c; | |
| 3413 | 6 | *yuv2packed2 = yuv2rgbx32_full_2_c; | |
| 3414 | 6 | *yuv2packed1 = yuv2rgbx32_full_1_c; | |
| 3415 | } | ||
| 3416 | #endif /* !CONFIG_SMALL */ | ||
| 3417 | 88 | break; | |
| 3418 | 88 | case AV_PIX_FMT_ARGB: | |
| 3419 | #if CONFIG_SMALL | ||
| 3420 | *yuv2packedX = yuv2argb32_full_X_c; | ||
| 3421 | *yuv2packed2 = yuv2argb32_full_2_c; | ||
| 3422 | *yuv2packed1 = yuv2argb32_full_1_c; | ||
| 3423 | #else | ||
| 3424 | #if CONFIG_SWSCALE_ALPHA | ||
| 3425 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 6 times.
|
88 | if (c->needAlpha) { |
| 3426 | 82 | *yuv2packedX = yuv2argb32_full_X_c; | |
| 3427 | 82 | *yuv2packed2 = yuv2argb32_full_2_c; | |
| 3428 | 82 | *yuv2packed1 = yuv2argb32_full_1_c; | |
| 3429 | } else | ||
| 3430 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3431 | { | ||
| 3432 | 6 | *yuv2packedX = yuv2xrgb32_full_X_c; | |
| 3433 | 6 | *yuv2packed2 = yuv2xrgb32_full_2_c; | |
| 3434 | 6 | *yuv2packed1 = yuv2xrgb32_full_1_c; | |
| 3435 | } | ||
| 3436 | #endif /* !CONFIG_SMALL */ | ||
| 3437 | 88 | break; | |
| 3438 | 1716 | case AV_PIX_FMT_BGRA: | |
| 3439 | #if CONFIG_SMALL | ||
| 3440 | *yuv2packedX = yuv2bgra32_full_X_c; | ||
| 3441 | *yuv2packed2 = yuv2bgra32_full_2_c; | ||
| 3442 | *yuv2packed1 = yuv2bgra32_full_1_c; | ||
| 3443 | #else | ||
| 3444 | #if CONFIG_SWSCALE_ALPHA | ||
| 3445 |
2/2✓ Branch 0 taken 178 times.
✓ Branch 1 taken 1538 times.
|
1716 | if (c->needAlpha) { |
| 3446 | 178 | *yuv2packedX = yuv2bgra32_full_X_c; | |
| 3447 | 178 | *yuv2packed2 = yuv2bgra32_full_2_c; | |
| 3448 | 178 | *yuv2packed1 = yuv2bgra32_full_1_c; | |
| 3449 | } else | ||
| 3450 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3451 | { | ||
| 3452 | 1538 | *yuv2packedX = yuv2bgrx32_full_X_c; | |
| 3453 | 1538 | *yuv2packed2 = yuv2bgrx32_full_2_c; | |
| 3454 | 1538 | *yuv2packed1 = yuv2bgrx32_full_1_c; | |
| 3455 | } | ||
| 3456 | #endif /* !CONFIG_SMALL */ | ||
| 3457 | 1716 | break; | |
| 3458 | 88 | case AV_PIX_FMT_ABGR: | |
| 3459 | #if CONFIG_SMALL | ||
| 3460 | *yuv2packedX = yuv2abgr32_full_X_c; | ||
| 3461 | *yuv2packed2 = yuv2abgr32_full_2_c; | ||
| 3462 | *yuv2packed1 = yuv2abgr32_full_1_c; | ||
| 3463 | #else | ||
| 3464 | #if CONFIG_SWSCALE_ALPHA | ||
| 3465 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 6 times.
|
88 | if (c->needAlpha) { |
| 3466 | 82 | *yuv2packedX = yuv2abgr32_full_X_c; | |
| 3467 | 82 | *yuv2packed2 = yuv2abgr32_full_2_c; | |
| 3468 | 82 | *yuv2packed1 = yuv2abgr32_full_1_c; | |
| 3469 | } else | ||
| 3470 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3471 | { | ||
| 3472 | 6 | *yuv2packedX = yuv2xbgr32_full_X_c; | |
| 3473 | 6 | *yuv2packed2 = yuv2xbgr32_full_2_c; | |
| 3474 | 6 | *yuv2packed1 = yuv2xbgr32_full_1_c; | |
| 3475 | } | ||
| 3476 | #endif /* !CONFIG_SMALL */ | ||
| 3477 | 88 | break; | |
| 3478 | 44 | case AV_PIX_FMT_RGBA64LE: | |
| 3479 | #if CONFIG_SWSCALE_ALPHA | ||
| 3480 |
2/2✓ Branch 0 taken 41 times.
✓ Branch 1 taken 3 times.
|
44 | if (c->needAlpha) { |
| 3481 | 41 | *yuv2packedX = yuv2rgba64le_full_X_c; | |
| 3482 | 41 | *yuv2packed2 = yuv2rgba64le_full_2_c; | |
| 3483 | 41 | *yuv2packed1 = yuv2rgba64le_full_1_c; | |
| 3484 | } else | ||
| 3485 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3486 | { | ||
| 3487 | 3 | *yuv2packedX = yuv2rgbx64le_full_X_c; | |
| 3488 | 3 | *yuv2packed2 = yuv2rgbx64le_full_2_c; | |
| 3489 | 3 | *yuv2packed1 = yuv2rgbx64le_full_1_c; | |
| 3490 | } | ||
| 3491 | 44 | break; | |
| 3492 | 41 | case AV_PIX_FMT_RGBA64BE: | |
| 3493 | #if CONFIG_SWSCALE_ALPHA | ||
| 3494 |
1/2✓ Branch 0 taken 41 times.
✗ Branch 1 not taken.
|
41 | if (c->needAlpha) { |
| 3495 | 41 | *yuv2packedX = yuv2rgba64be_full_X_c; | |
| 3496 | 41 | *yuv2packed2 = yuv2rgba64be_full_2_c; | |
| 3497 | 41 | *yuv2packed1 = yuv2rgba64be_full_1_c; | |
| 3498 | } else | ||
| 3499 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3500 | { | ||
| 3501 | ✗ | *yuv2packedX = yuv2rgbx64be_full_X_c; | |
| 3502 | ✗ | *yuv2packed2 = yuv2rgbx64be_full_2_c; | |
| 3503 | ✗ | *yuv2packed1 = yuv2rgbx64be_full_1_c; | |
| 3504 | } | ||
| 3505 | 41 | break; | |
| 3506 | 44 | case AV_PIX_FMT_BGRA64LE: | |
| 3507 | #if CONFIG_SWSCALE_ALPHA | ||
| 3508 |
2/2✓ Branch 0 taken 41 times.
✓ Branch 1 taken 3 times.
|
44 | if (c->needAlpha) { |
| 3509 | 41 | *yuv2packedX = yuv2bgra64le_full_X_c; | |
| 3510 | 41 | *yuv2packed2 = yuv2bgra64le_full_2_c; | |
| 3511 | 41 | *yuv2packed1 = yuv2bgra64le_full_1_c; | |
| 3512 | } else | ||
| 3513 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3514 | { | ||
| 3515 | 3 | *yuv2packedX = yuv2bgrx64le_full_X_c; | |
| 3516 | 3 | *yuv2packed2 = yuv2bgrx64le_full_2_c; | |
| 3517 | 3 | *yuv2packed1 = yuv2bgrx64le_full_1_c; | |
| 3518 | } | ||
| 3519 | 44 | break; | |
| 3520 | 41 | case AV_PIX_FMT_BGRA64BE: | |
| 3521 | #if CONFIG_SWSCALE_ALPHA | ||
| 3522 |
1/2✓ Branch 0 taken 41 times.
✗ Branch 1 not taken.
|
41 | if (c->needAlpha) { |
| 3523 | 41 | *yuv2packedX = yuv2bgra64be_full_X_c; | |
| 3524 | 41 | *yuv2packed2 = yuv2bgra64be_full_2_c; | |
| 3525 | 41 | *yuv2packed1 = yuv2bgra64be_full_1_c; | |
| 3526 | } else | ||
| 3527 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3528 | { | ||
| 3529 | ✗ | *yuv2packedX = yuv2bgrx64be_full_X_c; | |
| 3530 | ✗ | *yuv2packed2 = yuv2bgrx64be_full_2_c; | |
| 3531 | ✗ | *yuv2packed1 = yuv2bgrx64be_full_1_c; | |
| 3532 | } | ||
| 3533 | 41 | break; | |
| 3534 | |||
| 3535 | 3982 | case AV_PIX_FMT_RGB24: | |
| 3536 | 3982 | *yuv2packedX = yuv2rgb24_full_X_c; | |
| 3537 | 3982 | *yuv2packed2 = yuv2rgb24_full_2_c; | |
| 3538 | 3982 | *yuv2packed1 = yuv2rgb24_full_1_c; | |
| 3539 | 3982 | break; | |
| 3540 | 1416 | case AV_PIX_FMT_BGR24: | |
| 3541 | 1416 | *yuv2packedX = yuv2bgr24_full_X_c; | |
| 3542 | 1416 | *yuv2packed2 = yuv2bgr24_full_2_c; | |
| 3543 | 1416 | *yuv2packed1 = yuv2bgr24_full_1_c; | |
| 3544 | 1416 | break; | |
| 3545 | 3707 | case AV_PIX_FMT_RGB48LE: | |
| 3546 | 3707 | *yuv2packedX = yuv2rgb48le_full_X_c; | |
| 3547 | 3707 | *yuv2packed2 = yuv2rgb48le_full_2_c; | |
| 3548 | 3707 | *yuv2packed1 = yuv2rgb48le_full_1_c; | |
| 3549 | 3707 | break; | |
| 3550 | 44 | case AV_PIX_FMT_BGR48LE: | |
| 3551 | 44 | *yuv2packedX = yuv2bgr48le_full_X_c; | |
| 3552 | 44 | *yuv2packed2 = yuv2bgr48le_full_2_c; | |
| 3553 | 44 | *yuv2packed1 = yuv2bgr48le_full_1_c; | |
| 3554 | 44 | break; | |
| 3555 | 46 | case AV_PIX_FMT_RGB48BE: | |
| 3556 | 46 | *yuv2packedX = yuv2rgb48be_full_X_c; | |
| 3557 | 46 | *yuv2packed2 = yuv2rgb48be_full_2_c; | |
| 3558 | 46 | *yuv2packed1 = yuv2rgb48be_full_1_c; | |
| 3559 | 46 | break; | |
| 3560 | 41 | case AV_PIX_FMT_BGR48BE: | |
| 3561 | 41 | *yuv2packedX = yuv2bgr48be_full_X_c; | |
| 3562 | 41 | *yuv2packed2 = yuv2bgr48be_full_2_c; | |
| 3563 | 41 | *yuv2packed1 = yuv2bgr48be_full_1_c; | |
| 3564 | 41 | break; | |
| 3565 | 388 | case AV_PIX_FMT_BGR4_BYTE: | |
| 3566 | 388 | *yuv2packedX = yuv2bgr4_byte_full_X_c; | |
| 3567 | 388 | *yuv2packed2 = yuv2bgr4_byte_full_2_c; | |
| 3568 | 388 | *yuv2packed1 = yuv2bgr4_byte_full_1_c; | |
| 3569 | 388 | break; | |
| 3570 | 388 | case AV_PIX_FMT_RGB4_BYTE: | |
| 3571 | 388 | *yuv2packedX = yuv2rgb4_byte_full_X_c; | |
| 3572 | 388 | *yuv2packed2 = yuv2rgb4_byte_full_2_c; | |
| 3573 | 388 | *yuv2packed1 = yuv2rgb4_byte_full_1_c; | |
| 3574 | 388 | break; | |
| 3575 | 740 | case AV_PIX_FMT_BGR8: | |
| 3576 | 740 | *yuv2packedX = yuv2bgr8_full_X_c; | |
| 3577 | 740 | *yuv2packed2 = yuv2bgr8_full_2_c; | |
| 3578 | 740 | *yuv2packed1 = yuv2bgr8_full_1_c; | |
| 3579 | 740 | break; | |
| 3580 | 439 | case AV_PIX_FMT_RGB8: | |
| 3581 | 439 | *yuv2packedX = yuv2rgb8_full_X_c; | |
| 3582 | 439 | *yuv2packed2 = yuv2rgb8_full_2_c; | |
| 3583 | 439 | *yuv2packed1 = yuv2rgb8_full_1_c; | |
| 3584 | 439 | break; | |
| 3585 | 599 | case AV_PIX_FMT_X2RGB10LE: | |
| 3586 | 599 | *yuv2packedX = yuv2x2rgb10_full_X_c; | |
| 3587 | 599 | *yuv2packed2 = yuv2x2rgb10_full_2_c; | |
| 3588 | 599 | *yuv2packed1 = yuv2x2rgb10_full_1_c; | |
| 3589 | 599 | break; | |
| 3590 | 599 | case AV_PIX_FMT_X2BGR10LE: | |
| 3591 | 599 | *yuv2packedX = yuv2x2bgr10_full_X_c; | |
| 3592 | 599 | *yuv2packed2 = yuv2x2bgr10_full_2_c; | |
| 3593 | 599 | *yuv2packed1 = yuv2x2bgr10_full_1_c; | |
| 3594 | 599 | break; | |
| 3595 | 29421 | case AV_PIX_FMT_GBRP: | |
| 3596 | case AV_PIX_FMT_GBRP9BE: | ||
| 3597 | case AV_PIX_FMT_GBRP9LE: | ||
| 3598 | case AV_PIX_FMT_GBRP10BE: | ||
| 3599 | case AV_PIX_FMT_GBRP10LE: | ||
| 3600 | case AV_PIX_FMT_GBRP12BE: | ||
| 3601 | case AV_PIX_FMT_GBRP12LE: | ||
| 3602 | case AV_PIX_FMT_GBRP14BE: | ||
| 3603 | case AV_PIX_FMT_GBRP14LE: | ||
| 3604 | case AV_PIX_FMT_GBRAP: | ||
| 3605 | case AV_PIX_FMT_GBRAP10BE: | ||
| 3606 | case AV_PIX_FMT_GBRAP10LE: | ||
| 3607 | case AV_PIX_FMT_GBRAP12BE: | ||
| 3608 | case AV_PIX_FMT_GBRAP12LE: | ||
| 3609 | case AV_PIX_FMT_GBRAP14BE: | ||
| 3610 | case AV_PIX_FMT_GBRAP14LE: | ||
| 3611 | 29421 | *yuv2anyX = yuv2gbrp_full_X_c; | |
| 3612 | 29421 | break; | |
| 3613 | 484 | case AV_PIX_FMT_GBRP10MSBBE: | |
| 3614 | case AV_PIX_FMT_GBRP10MSBLE: | ||
| 3615 | case AV_PIX_FMT_GBRP12MSBBE: | ||
| 3616 | case AV_PIX_FMT_GBRP12MSBLE: | ||
| 3617 | 484 | *yuv2anyX = yuv2gbrpmsb_full_X_c; | |
| 3618 | 484 | break; | |
| 3619 | 4526 | case AV_PIX_FMT_GBRP16BE: | |
| 3620 | case AV_PIX_FMT_GBRP16LE: | ||
| 3621 | case AV_PIX_FMT_GBRAP16BE: | ||
| 3622 | case AV_PIX_FMT_GBRAP16LE: | ||
| 3623 | 4526 | *yuv2anyX = yuv2gbrp16_full_X_c; | |
| 3624 | 4526 | break; | |
| 3625 | 2641 | case AV_PIX_FMT_GBRPF32BE: | |
| 3626 | case AV_PIX_FMT_GBRPF32LE: | ||
| 3627 | case AV_PIX_FMT_GBRAPF32BE: | ||
| 3628 | case AV_PIX_FMT_GBRAPF32LE: | ||
| 3629 | 2641 | *yuv2anyX = yuv2gbrpf32_full_X_c; | |
| 3630 | 2641 | break; | |
| 3631 | } | ||
| 3632 |
3/4✓ Branch 0 taken 37072 times.
✓ Branch 1 taken 14539 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 37072 times.
|
51611 | if (!*yuv2packedX && !*yuv2anyX) |
| 3633 | ✗ | goto YUV_PACKED; | |
| 3634 | } else { | ||
| 3635 | 527485 | YUV_PACKED: | |
| 3636 |
21/21✓ Branch 0 taken 170 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 118 times.
✓ Branch 3 taken 118 times.
✓ Branch 4 taken 3550 times.
✓ Branch 5 taken 252 times.
✓ Branch 6 taken 123 times.
✓ Branch 7 taken 118 times.
✓ Branch 8 taken 5458 times.
✓ Branch 9 taken 4534 times.
✓ Branch 10 taken 8457 times.
✓ Branch 11 taken 3452 times.
✓ Branch 12 taken 9704 times.
✓ Branch 13 taken 10815 times.
✓ Branch 14 taken 636 times.
✓ Branch 15 taken 1161 times.
✓ Branch 16 taken 156 times.
✓ Branch 17 taken 265 times.
✓ Branch 18 taken 76 times.
✓ Branch 19 taken 76 times.
✓ Branch 20 taken 478128 times.
|
527485 | switch (dstFormat) { |
| 3637 | 170 | case AV_PIX_FMT_RGBA64LE: | |
| 3638 | #if CONFIG_SWSCALE_ALPHA | ||
| 3639 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170 times.
|
170 | if (c->needAlpha) { |
| 3640 | ✗ | *yuv2packed1 = yuv2rgba64le_1_c; | |
| 3641 | ✗ | *yuv2packed2 = yuv2rgba64le_2_c; | |
| 3642 | ✗ | *yuv2packedX = yuv2rgba64le_X_c; | |
| 3643 | } else | ||
| 3644 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3645 | { | ||
| 3646 | 170 | *yuv2packed1 = yuv2rgbx64le_1_c; | |
| 3647 | 170 | *yuv2packed2 = yuv2rgbx64le_2_c; | |
| 3648 | 170 | *yuv2packedX = yuv2rgbx64le_X_c; | |
| 3649 | } | ||
| 3650 | 170 | break; | |
| 3651 | 118 | case AV_PIX_FMT_RGBA64BE: | |
| 3652 | #if CONFIG_SWSCALE_ALPHA | ||
| 3653 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118 times.
|
118 | if (c->needAlpha) { |
| 3654 | ✗ | *yuv2packed1 = yuv2rgba64be_1_c; | |
| 3655 | ✗ | *yuv2packed2 = yuv2rgba64be_2_c; | |
| 3656 | ✗ | *yuv2packedX = yuv2rgba64be_X_c; | |
| 3657 | } else | ||
| 3658 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3659 | { | ||
| 3660 | 118 | *yuv2packed1 = yuv2rgbx64be_1_c; | |
| 3661 | 118 | *yuv2packed2 = yuv2rgbx64be_2_c; | |
| 3662 | 118 | *yuv2packedX = yuv2rgbx64be_X_c; | |
| 3663 | } | ||
| 3664 | 118 | break; | |
| 3665 | 118 | case AV_PIX_FMT_BGRA64LE: | |
| 3666 | #if CONFIG_SWSCALE_ALPHA | ||
| 3667 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118 times.
|
118 | if (c->needAlpha) { |
| 3668 | ✗ | *yuv2packed1 = yuv2bgra64le_1_c; | |
| 3669 | ✗ | *yuv2packed2 = yuv2bgra64le_2_c; | |
| 3670 | ✗ | *yuv2packedX = yuv2bgra64le_X_c; | |
| 3671 | } else | ||
| 3672 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3673 | { | ||
| 3674 | 118 | *yuv2packed1 = yuv2bgrx64le_1_c; | |
| 3675 | 118 | *yuv2packed2 = yuv2bgrx64le_2_c; | |
| 3676 | 118 | *yuv2packedX = yuv2bgrx64le_X_c; | |
| 3677 | } | ||
| 3678 | 118 | break; | |
| 3679 | 118 | case AV_PIX_FMT_BGRA64BE: | |
| 3680 | #if CONFIG_SWSCALE_ALPHA | ||
| 3681 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 118 times.
|
118 | if (c->needAlpha) { |
| 3682 | ✗ | *yuv2packed1 = yuv2bgra64be_1_c; | |
| 3683 | ✗ | *yuv2packed2 = yuv2bgra64be_2_c; | |
| 3684 | ✗ | *yuv2packedX = yuv2bgra64be_X_c; | |
| 3685 | } else | ||
| 3686 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3687 | { | ||
| 3688 | 118 | *yuv2packed1 = yuv2bgrx64be_1_c; | |
| 3689 | 118 | *yuv2packed2 = yuv2bgrx64be_2_c; | |
| 3690 | 118 | *yuv2packedX = yuv2bgrx64be_X_c; | |
| 3691 | } | ||
| 3692 | 118 | break; | |
| 3693 | 3550 | case AV_PIX_FMT_RGB48LE: | |
| 3694 | 3550 | *yuv2packed1 = yuv2rgb48le_1_c; | |
| 3695 | 3550 | *yuv2packed2 = yuv2rgb48le_2_c; | |
| 3696 | 3550 | *yuv2packedX = yuv2rgb48le_X_c; | |
| 3697 | 3550 | break; | |
| 3698 | 252 | case AV_PIX_FMT_RGB48BE: | |
| 3699 | 252 | *yuv2packed1 = yuv2rgb48be_1_c; | |
| 3700 | 252 | *yuv2packed2 = yuv2rgb48be_2_c; | |
| 3701 | 252 | *yuv2packedX = yuv2rgb48be_X_c; | |
| 3702 | 252 | break; | |
| 3703 | 123 | case AV_PIX_FMT_BGR48LE: | |
| 3704 | 123 | *yuv2packed1 = yuv2bgr48le_1_c; | |
| 3705 | 123 | *yuv2packed2 = yuv2bgr48le_2_c; | |
| 3706 | 123 | *yuv2packedX = yuv2bgr48le_X_c; | |
| 3707 | 123 | break; | |
| 3708 | 118 | case AV_PIX_FMT_BGR48BE: | |
| 3709 | 118 | *yuv2packed1 = yuv2bgr48be_1_c; | |
| 3710 | 118 | *yuv2packed2 = yuv2bgr48be_2_c; | |
| 3711 | 118 | *yuv2packedX = yuv2bgr48be_X_c; | |
| 3712 | 118 | break; | |
| 3713 | 5458 | case AV_PIX_FMT_RGB32: | |
| 3714 | case AV_PIX_FMT_BGR32: | ||
| 3715 | #if CONFIG_SMALL | ||
| 3716 | *yuv2packed1 = yuv2rgb32_1_c; | ||
| 3717 | *yuv2packed2 = yuv2rgb32_2_c; | ||
| 3718 | *yuv2packedX = yuv2rgb32_X_c; | ||
| 3719 | #else | ||
| 3720 | #if CONFIG_SWSCALE_ALPHA | ||
| 3721 |
2/2✓ Branch 0 taken 748 times.
✓ Branch 1 taken 4710 times.
|
5458 | if (c->needAlpha) { |
| 3722 | 748 | *yuv2packed1 = yuv2rgba32_1_c; | |
| 3723 | 748 | *yuv2packed2 = yuv2rgba32_2_c; | |
| 3724 | 748 | *yuv2packedX = yuv2rgba32_X_c; | |
| 3725 | } else | ||
| 3726 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3727 | { | ||
| 3728 | 4710 | *yuv2packed1 = yuv2rgbx32_1_c; | |
| 3729 | 4710 | *yuv2packed2 = yuv2rgbx32_2_c; | |
| 3730 | 4710 | *yuv2packedX = yuv2rgbx32_X_c; | |
| 3731 | } | ||
| 3732 | #endif /* !CONFIG_SMALL */ | ||
| 3733 | 5458 | break; | |
| 3734 | 4534 | case AV_PIX_FMT_RGB32_1: | |
| 3735 | case AV_PIX_FMT_BGR32_1: | ||
| 3736 | #if CONFIG_SMALL | ||
| 3737 | *yuv2packed1 = yuv2rgb32_1_1_c; | ||
| 3738 | *yuv2packed2 = yuv2rgb32_1_2_c; | ||
| 3739 | *yuv2packedX = yuv2rgb32_1_X_c; | ||
| 3740 | #else | ||
| 3741 | #if CONFIG_SWSCALE_ALPHA | ||
| 3742 |
2/2✓ Branch 0 taken 748 times.
✓ Branch 1 taken 3786 times.
|
4534 | if (c->needAlpha) { |
| 3743 | 748 | *yuv2packed1 = yuv2rgba32_1_1_c; | |
| 3744 | 748 | *yuv2packed2 = yuv2rgba32_1_2_c; | |
| 3745 | 748 | *yuv2packedX = yuv2rgba32_1_X_c; | |
| 3746 | } else | ||
| 3747 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3748 | { | ||
| 3749 | 3786 | *yuv2packed1 = yuv2rgbx32_1_1_c; | |
| 3750 | 3786 | *yuv2packed2 = yuv2rgbx32_1_2_c; | |
| 3751 | 3786 | *yuv2packedX = yuv2rgbx32_1_X_c; | |
| 3752 | } | ||
| 3753 | #endif /* !CONFIG_SMALL */ | ||
| 3754 | 4534 | break; | |
| 3755 | 8457 | case AV_PIX_FMT_RGB24: | |
| 3756 | 8457 | *yuv2packed1 = yuv2rgb24_1_c; | |
| 3757 | 8457 | *yuv2packed2 = yuv2rgb24_2_c; | |
| 3758 | 8457 | *yuv2packedX = yuv2rgb24_X_c; | |
| 3759 | 8457 | break; | |
| 3760 | 3452 | case AV_PIX_FMT_BGR24: | |
| 3761 | 3452 | *yuv2packed1 = yuv2bgr24_1_c; | |
| 3762 | 3452 | *yuv2packed2 = yuv2bgr24_2_c; | |
| 3763 | 3452 | *yuv2packedX = yuv2bgr24_X_c; | |
| 3764 | 3452 | break; | |
| 3765 | 9704 | case AV_PIX_FMT_RGB565LE: | |
| 3766 | case AV_PIX_FMT_RGB565BE: | ||
| 3767 | case AV_PIX_FMT_BGR565LE: | ||
| 3768 | case AV_PIX_FMT_BGR565BE: | ||
| 3769 | 9704 | *yuv2packed1 = yuv2rgb16_1_c; | |
| 3770 | 9704 | *yuv2packed2 = yuv2rgb16_2_c; | |
| 3771 | 9704 | *yuv2packedX = yuv2rgb16_X_c; | |
| 3772 | 9704 | break; | |
| 3773 | 10815 | case AV_PIX_FMT_RGB555LE: | |
| 3774 | case AV_PIX_FMT_RGB555BE: | ||
| 3775 | case AV_PIX_FMT_BGR555LE: | ||
| 3776 | case AV_PIX_FMT_BGR555BE: | ||
| 3777 | 10815 | *yuv2packed1 = yuv2rgb15_1_c; | |
| 3778 | 10815 | *yuv2packed2 = yuv2rgb15_2_c; | |
| 3779 | 10815 | *yuv2packedX = yuv2rgb15_X_c; | |
| 3780 | 10815 | break; | |
| 3781 | 636 | case AV_PIX_FMT_RGB444LE: | |
| 3782 | case AV_PIX_FMT_RGB444BE: | ||
| 3783 | case AV_PIX_FMT_BGR444LE: | ||
| 3784 | case AV_PIX_FMT_BGR444BE: | ||
| 3785 | 636 | *yuv2packed1 = yuv2rgb12_1_c; | |
| 3786 | 636 | *yuv2packed2 = yuv2rgb12_2_c; | |
| 3787 | 636 | *yuv2packedX = yuv2rgb12_X_c; | |
| 3788 | 636 | break; | |
| 3789 | 1161 | case AV_PIX_FMT_RGB8: | |
| 3790 | case AV_PIX_FMT_BGR8: | ||
| 3791 | 1161 | *yuv2packed1 = yuv2rgb8_1_c; | |
| 3792 | 1161 | *yuv2packed2 = yuv2rgb8_2_c; | |
| 3793 | 1161 | *yuv2packedX = yuv2rgb8_X_c; | |
| 3794 | 1161 | break; | |
| 3795 | 156 | case AV_PIX_FMT_RGB4: | |
| 3796 | case AV_PIX_FMT_BGR4: | ||
| 3797 | 156 | *yuv2packed1 = yuv2rgb4_1_c; | |
| 3798 | 156 | *yuv2packed2 = yuv2rgb4_2_c; | |
| 3799 | 156 | *yuv2packedX = yuv2rgb4_X_c; | |
| 3800 | 156 | break; | |
| 3801 | 265 | case AV_PIX_FMT_RGB4_BYTE: | |
| 3802 | case AV_PIX_FMT_BGR4_BYTE: | ||
| 3803 | 265 | *yuv2packed1 = yuv2rgb4b_1_c; | |
| 3804 | 265 | *yuv2packed2 = yuv2rgb4b_2_c; | |
| 3805 | 265 | *yuv2packedX = yuv2rgb4b_X_c; | |
| 3806 | 265 | break; | |
| 3807 | 76 | case AV_PIX_FMT_X2RGB10LE: | |
| 3808 | case AV_PIX_FMT_X2RGB10BE: | ||
| 3809 | 76 | *yuv2packed1 = yuv2x2rgb10_1_c; | |
| 3810 | 76 | *yuv2packed2 = yuv2x2rgb10_2_c; | |
| 3811 | 76 | *yuv2packedX = yuv2x2rgb10_X_c; | |
| 3812 | 76 | break; | |
| 3813 | 76 | case AV_PIX_FMT_X2BGR10LE: | |
| 3814 | case AV_PIX_FMT_X2BGR10BE: | ||
| 3815 | 76 | *yuv2packed1 = yuv2x2bgr10_1_c; | |
| 3816 | 76 | *yuv2packed2 = yuv2x2bgr10_2_c; | |
| 3817 | 76 | *yuv2packedX = yuv2x2bgr10_X_c; | |
| 3818 | 76 | break; | |
| 3819 | } | ||
| 3820 | } | ||
| 3821 |
26/26✓ Branch 0 taken 1766 times.
✓ Branch 1 taken 870 times.
✓ Branch 2 taken 838 times.
✓ Branch 3 taken 753 times.
✓ Branch 4 taken 1067 times.
✓ Branch 5 taken 1213 times.
✓ Branch 6 taken 122 times.
✓ Branch 7 taken 122 times.
✓ Branch 8 taken 117 times.
✓ Branch 9 taken 81 times.
✓ Branch 10 taken 81 times.
✓ Branch 11 taken 1313 times.
✓ Branch 12 taken 117 times.
✓ Branch 13 taken 117 times.
✓ Branch 14 taken 122 times.
✓ Branch 15 taken 931 times.
✓ Branch 16 taken 526 times.
✓ Branch 17 taken 799 times.
✓ Branch 18 taken 799 times.
✓ Branch 19 taken 799 times.
✓ Branch 20 taken 985 times.
✓ Branch 21 taken 985 times.
✓ Branch 22 taken 748 times.
✓ Branch 23 taken 748 times.
✓ Branch 24 taken 934 times.
✓ Branch 25 taken 562143 times.
|
579096 | switch (dstFormat) { |
| 3822 | 1766 | case AV_PIX_FMT_MONOWHITE: | |
| 3823 | 1766 | *yuv2packed1 = yuv2monowhite_1_c; | |
| 3824 | 1766 | *yuv2packed2 = yuv2monowhite_2_c; | |
| 3825 | 1766 | *yuv2packedX = yuv2monowhite_X_c; | |
| 3826 | 1766 | break; | |
| 3827 | 870 | case AV_PIX_FMT_MONOBLACK: | |
| 3828 | 870 | *yuv2packed1 = yuv2monoblack_1_c; | |
| 3829 | 870 | *yuv2packed2 = yuv2monoblack_2_c; | |
| 3830 | 870 | *yuv2packedX = yuv2monoblack_X_c; | |
| 3831 | 870 | break; | |
| 3832 | 838 | case AV_PIX_FMT_YUYV422: | |
| 3833 | 838 | *yuv2packed1 = yuv2yuyv422_1_c; | |
| 3834 | 838 | *yuv2packed2 = yuv2yuyv422_2_c; | |
| 3835 | 838 | *yuv2packedX = yuv2yuyv422_X_c; | |
| 3836 | 838 | break; | |
| 3837 | 753 | case AV_PIX_FMT_YVYU422: | |
| 3838 | 753 | *yuv2packed1 = yuv2yvyu422_1_c; | |
| 3839 | 753 | *yuv2packed2 = yuv2yvyu422_2_c; | |
| 3840 | 753 | *yuv2packedX = yuv2yvyu422_X_c; | |
| 3841 | 753 | break; | |
| 3842 | 1067 | case AV_PIX_FMT_UYVY422: | |
| 3843 | 1067 | *yuv2packed1 = yuv2uyvy422_1_c; | |
| 3844 | 1067 | *yuv2packed2 = yuv2uyvy422_2_c; | |
| 3845 | 1067 | *yuv2packedX = yuv2uyvy422_X_c; | |
| 3846 | 1067 | break; | |
| 3847 | 1213 | case AV_PIX_FMT_VYU444: | |
| 3848 | 1213 | *yuv2packed1 = yuv2vyu444_1_c; | |
| 3849 | 1213 | *yuv2packed2 = yuv2vyu444_2_c; | |
| 3850 | 1213 | *yuv2packedX = yuv2vyu444_X_c; | |
| 3851 | 1213 | break; | |
| 3852 | 122 | case AV_PIX_FMT_YA8: | |
| 3853 | 122 | *yuv2packed1 = yuv2ya8_1_c; | |
| 3854 | 122 | *yuv2packed2 = yuv2ya8_2_c; | |
| 3855 | 122 | *yuv2packedX = yuv2ya8_X_c; | |
| 3856 | 122 | break; | |
| 3857 | 122 | case AV_PIX_FMT_YA16LE: | |
| 3858 | 122 | *yuv2packed1 = yuv2ya16le_1_c; | |
| 3859 | 122 | *yuv2packed2 = yuv2ya16le_2_c; | |
| 3860 | 122 | *yuv2packedX = yuv2ya16le_X_c; | |
| 3861 | 122 | break; | |
| 3862 | 117 | case AV_PIX_FMT_YA16BE: | |
| 3863 | 117 | *yuv2packed1 = yuv2ya16be_1_c; | |
| 3864 | 117 | *yuv2packed2 = yuv2ya16be_2_c; | |
| 3865 | 117 | *yuv2packedX = yuv2ya16be_X_c; | |
| 3866 | 117 | break; | |
| 3867 | 81 | case AV_PIX_FMT_YAF32LE: | |
| 3868 | 81 | *yuv2packedX = yuv2yaf32le_X_c; | |
| 3869 | 81 | break; | |
| 3870 | 81 | case AV_PIX_FMT_YAF32BE: | |
| 3871 | 81 | *yuv2packedX = yuv2yaf32be_X_c; | |
| 3872 | 81 | break; | |
| 3873 | 1313 | case AV_PIX_FMT_V30XLE: | |
| 3874 | 1313 | *yuv2packedX = yuv2v30xle_X_c; | |
| 3875 | 1313 | break; | |
| 3876 | 117 | case AV_PIX_FMT_AYUV64LE: | |
| 3877 | 117 | *yuv2packedX = yuv2ayuv64le_X_c; | |
| 3878 | 117 | break; | |
| 3879 | 117 | case AV_PIX_FMT_AYUV64BE: | |
| 3880 | 117 | *yuv2packedX = yuv2ayuv64be_X_c; | |
| 3881 | 117 | break; | |
| 3882 | 122 | case AV_PIX_FMT_AYUV: | |
| 3883 | 122 | *yuv2packed1 = yuv2ayuv_1_c; | |
| 3884 | 122 | *yuv2packed2 = yuv2ayuv_2_c; | |
| 3885 | 122 | *yuv2packedX = yuv2ayuv_X_c; | |
| 3886 | 122 | break; | |
| 3887 | 931 | case AV_PIX_FMT_VUYA: | |
| 3888 | case AV_PIX_FMT_VUYX: | ||
| 3889 | 931 | *yuv2packed1 = yuv2vuyX_1_c; | |
| 3890 | 931 | *yuv2packed2 = yuv2vuyX_2_c; | |
| 3891 | 931 | *yuv2packedX = yuv2vuyX_X_c; | |
| 3892 | 931 | break; | |
| 3893 | 526 | case AV_PIX_FMT_UYVA: | |
| 3894 | 526 | *yuv2packed1 = yuv2uyva_1_c; | |
| 3895 | 526 | *yuv2packed2 = yuv2uyva_2_c; | |
| 3896 | 526 | *yuv2packedX = yuv2uyva_X_c; | |
| 3897 | 526 | break; | |
| 3898 | 799 | case AV_PIX_FMT_XV30LE: | |
| 3899 | 799 | *yuv2packedX = yuv2xv30le_X_c; | |
| 3900 | 799 | break; | |
| 3901 | 799 | case AV_PIX_FMT_XV36LE: | |
| 3902 | 799 | *yuv2packedX = yuv2xv36le_X_c; | |
| 3903 | 799 | break; | |
| 3904 | 799 | case AV_PIX_FMT_XV36BE: | |
| 3905 | 799 | *yuv2packedX = yuv2xv36be_X_c; | |
| 3906 | 799 | break; | |
| 3907 | 985 | case AV_PIX_FMT_XV48LE: | |
| 3908 | 985 | *yuv2packedX = yuv2xv48le_X_c; | |
| 3909 | 985 | break; | |
| 3910 | 985 | case AV_PIX_FMT_XV48BE: | |
| 3911 | 985 | *yuv2packedX = yuv2xv48be_X_c; | |
| 3912 | 985 | break; | |
| 3913 | 748 | case AV_PIX_FMT_Y210LE: | |
| 3914 | 748 | *yuv2packedX = yuv2y210le_X_c; | |
| 3915 | 748 | break; | |
| 3916 | 748 | case AV_PIX_FMT_Y212LE: | |
| 3917 | 748 | *yuv2packedX = yuv2y212le_X_c; | |
| 3918 | 748 | break; | |
| 3919 | 934 | case AV_PIX_FMT_Y216LE: | |
| 3920 | 934 | *yuv2packedX = yuv2y216le_X_c; | |
| 3921 | 934 | break; | |
| 3922 | } | ||
| 3923 | 579096 | } | |
| 3924 |