| 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 | 2933038 | 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 | 2933038 | int shift = 3; | |
| 155 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2933038 times.
|
2933038 | av_assert0(output_bits == 16); |
| 156 | |||
| 157 |
2/2✓ Branch 0 taken 955872712 times.
✓ Branch 1 taken 2933038 times.
|
958805750 | for (i = 0; i < dstW; i++) { |
| 158 | 955872712 | int val = src[i] + (1 << (shift - 1)); | |
| 159 |
2/2✓ Branch 0 taken 358275744 times.
✓ Branch 1 taken 597596968 times.
|
955872712 | output_pixel(&dest[i], val, 0, uint); |
| 160 | } | ||
| 161 | 2933038 | } | |
| 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 | 200 | yuv2planeX_float_c_template(const int16_t *filter, int filterSize, const int32_t **src, | |
| 253 | float *dest, int dstW) | ||
| 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 40000 times.
✓ Branch 1 taken 200 times.
|
40200 | for (i = 0; i < dstW; ++i){ |
| 262 | 40000 | val = (1 << (shift - 1)) - 0x40000000; | |
| 263 |
2/2✓ Branch 0 taken 480000 times.
✓ Branch 1 taken 40000 times.
|
520000 | for (j = 0; j < filterSize; ++j){ |
| 264 | 480000 | val += src[j][i] * (unsigned)filter[j]; | |
| 265 | } | ||
| 266 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40000 times.
|
40000 | output_pixel(&val_uint, val, 0x8000, int); |
| 267 | 40000 | dest[i] = float_mult * (float)val_uint; | |
| 268 | } | ||
| 269 | 200 | } | |
| 270 | |||
| 271 | static av_always_inline void | ||
| 272 | 200 | yuv2planeX_float_bswap_c_template(const int16_t *filter, int filterSize, const int32_t **src, | |
| 273 | uint32_t *dest, int dstW) | ||
| 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 40000 times.
✓ Branch 1 taken 200 times.
|
40200 | for (i = 0; i < dstW; ++i){ |
| 282 | 40000 | val = (1 << (shift - 1)) - 0x40000000; | |
| 283 |
2/2✓ Branch 0 taken 480000 times.
✓ Branch 1 taken 40000 times.
|
520000 | for (j = 0; j < filterSize; ++j){ |
| 284 | 480000 | val += src[j][i] * (unsigned)filter[j]; | |
| 285 | } | ||
| 286 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40000 times.
|
40000 | output_pixel(&val_uint, val, 0x8000, int); |
| 287 | 40000 | dest[i] = av_bswap32(av_float2int(float_mult * (float)val_uint)); | |
| 288 | } | ||
| 289 | 200 | } | |
| 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); \ | ||
| 304 | } | ||
| 305 | |||
| 306 | #if HAVE_BIGENDIAN | ||
| 307 | yuv2plane1_float(yuv2plane1_float_c_template, float, BE) | ||
| 308 | yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, LE) | ||
| 309 | yuv2planeX_float(yuv2planeX_float_c_template, float, BE) | ||
| 310 | yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, LE) | ||
| 311 | #else | ||
| 312 | 29392 | yuv2plane1_float(yuv2plane1_float_c_template, float, LE) | |
| 313 | 13248 | yuv2plane1_float(yuv2plane1_float_bswap_c_template, uint32_t, BE) | |
| 314 | 200 | yuv2planeX_float(yuv2planeX_float_c_template, float, LE) | |
| 315 | 200 | yuv2planeX_float(yuv2planeX_float_bswap_c_template, uint32_t, BE) | |
| 316 | #endif | ||
| 317 | |||
| 318 | #undef output_pixel | ||
| 319 | |||
| 320 | #define output_pixel(pos, val) \ | ||
| 321 | if (big_endian) { \ | ||
| 322 | AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits)); \ | ||
| 323 | } else { \ | ||
| 324 | AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits)); \ | ||
| 325 | } | ||
| 326 | |||
| 327 | static av_always_inline void | ||
| 328 | 7161068 | yuv2plane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW, | |
| 329 | int big_endian, int output_bits) | ||
| 330 | { | ||
| 331 | int i; | ||
| 332 | 7161068 | int shift = 15 - output_bits; | |
| 333 | |||
| 334 |
2/2✓ Branch 0 taken 2342175656 times.
✓ Branch 1 taken 7161068 times.
|
2349336724 | for (i = 0; i < dstW; i++) { |
| 335 | 2342175656 | int val = src[i] + (1 << (shift - 1)); | |
| 336 |
2/2✓ Branch 0 taken 488429568 times.
✓ Branch 1 taken 1853746088 times.
|
2342175656 | output_pixel(&dest[i], val); |
| 337 | } | ||
| 338 | 7161068 | } | |
| 339 | |||
| 340 | static av_always_inline void | ||
| 341 | 3212312 | yuv2planeX_10_c_template(const int16_t *filter, int filterSize, | |
| 342 | const int16_t **src, uint16_t *dest, int dstW, | ||
| 343 | int big_endian, int output_bits) | ||
| 344 | { | ||
| 345 | int i; | ||
| 346 | 3212312 | int shift = 11 + 16 - output_bits; | |
| 347 | |||
| 348 |
2/2✓ Branch 0 taken 1000493448 times.
✓ Branch 1 taken 3212312 times.
|
1003705760 | for (i = 0; i < dstW; i++) { |
| 349 | 1000493448 | int val = 1 << (shift - 1); | |
| 350 | int j; | ||
| 351 | |||
| 352 |
2/2✓ Branch 0 taken 4757133024 times.
✓ Branch 1 taken 1000493448 times.
|
5757626472 | for (j = 0; j < filterSize; j++) |
| 353 | 4757133024 | val += src[j][i] * filter[j]; | |
| 354 | |||
| 355 |
2/2✓ Branch 0 taken 160588032 times.
✓ Branch 1 taken 839905416 times.
|
1000493448 | output_pixel(&dest[i], val); |
| 356 | } | ||
| 357 | 3212312 | } | |
| 358 | |||
| 359 | #undef output_pixel | ||
| 360 | |||
| 361 | #define yuv2NBPS(bits, BE_LE, is_be, template_size, typeX_t) \ | ||
| 362 | static void yuv2plane1_ ## bits ## BE_LE ## _c(const int16_t *src, \ | ||
| 363 | uint8_t *dest, int dstW, \ | ||
| 364 | const uint8_t *dither, int offset)\ | ||
| 365 | { \ | ||
| 366 | yuv2plane1_ ## template_size ## _c_template((const typeX_t *) src, \ | ||
| 367 | (uint16_t *) dest, dstW, is_be, bits); \ | ||
| 368 | }\ | ||
| 369 | static void yuv2planeX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \ | ||
| 370 | const int16_t **src, uint8_t *dest, int dstW, \ | ||
| 371 | const uint8_t *dither, int offset)\ | ||
| 372 | { \ | ||
| 373 | yuv2planeX_## template_size ## _c_template(filter, \ | ||
| 374 | filterSize, (const typeX_t **) src, \ | ||
| 375 | (uint16_t *) dest, dstW, is_be, bits); \ | ||
| 376 | } | ||
| 377 | |||
| 378 | 255136 | yuv2NBPS( 9, BE, 1, 10, int16_t) | |
| 379 | 285404 | yuv2NBPS( 9, LE, 0, 10, int16_t) | |
| 380 | 1967808 | yuv2NBPS(10, BE, 1, 10, int16_t) | |
| 381 | 10091980 | yuv2NBPS(10, LE, 0, 10, int16_t) | |
| 382 | 1966608 | yuv2NBPS(12, BE, 1, 10, int16_t) | |
| 383 | 5889744 | yuv2NBPS(12, LE, 0, 10, int16_t) | |
| 384 | 136688 | yuv2NBPS(14, BE, 1, 10, int16_t) | |
| 385 | 153392 | yuv2NBPS(14, LE, 0, 10, int16_t) | |
| 386 | 2616536 | yuv2NBPS(16, BE, 1, 16, int32_t) | |
| 387 | 4493444 | yuv2NBPS(16, LE, 0, 16, int32_t) | |
| 388 | |||
| 389 | #define output_pixel(pos, val) \ | ||
| 390 | if (big_endian) { \ | ||
| 391 | AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << (16 - output_bits)); \ | ||
| 392 | } else { \ | ||
| 393 | AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << (16 - output_bits)); \ | ||
| 394 | } | ||
| 395 | |||
| 396 | static av_always_inline void | ||
| 397 | 112320 | yuv2msbplane1_10_c_template(const int16_t *src, uint16_t *dest, int dstW, | |
| 398 | int big_endian, int output_bits) | ||
| 399 | { | ||
| 400 | int i; | ||
| 401 | 112320 | int shift = 15 - output_bits; | |
| 402 | |||
| 403 |
2/2✓ Branch 0 taken 39389184 times.
✓ Branch 1 taken 112320 times.
|
39501504 | for (i = 0; i < dstW; i++) { |
| 404 | 39389184 | int val = src[i] + (1 << (shift - 1)); | |
| 405 |
2/2✓ Branch 0 taken 19058688 times.
✓ Branch 1 taken 20330496 times.
|
39389184 | output_pixel(&dest[i], val); |
| 406 | } | ||
| 407 | 112320 | } | |
| 408 | |||
| 409 | static av_always_inline void | ||
| 410 | 154656 | yuv2msbplaneX_10_c_template(const int16_t *filter, int filterSize, | |
| 411 | const int16_t **src, uint16_t *dest, int dstW, | ||
| 412 | int big_endian, int output_bits) | ||
| 413 | { | ||
| 414 | int i; | ||
| 415 | 154656 | int shift = 11 + 16 - output_bits; | |
| 416 | |||
| 417 |
2/2✓ Branch 0 taken 40533888 times.
✓ Branch 1 taken 154656 times.
|
40688544 | for (i = 0; i < dstW; i++) { |
| 418 | 40533888 | int val = 1 << (shift - 1); | |
| 419 | int j; | ||
| 420 | |||
| 421 |
2/2✓ Branch 0 taken 171735552 times.
✓ Branch 1 taken 40533888 times.
|
212269440 | for (j = 0; j < filterSize; j++) |
| 422 | 171735552 | val += src[j][i] * filter[j]; | |
| 423 | |||
| 424 |
2/2✓ Branch 0 taken 19658688 times.
✓ Branch 1 taken 20875200 times.
|
40533888 | output_pixel(&dest[i], val); |
| 425 | } | ||
| 426 | 154656 | } | |
| 427 | |||
| 428 | #define yuv2MSBNBPS(bits, BE_LE, is_be, template_size, typeX_t) \ | ||
| 429 | static void yuv2msbplane1_ ## bits ## BE_LE ## _c(const int16_t *src, \ | ||
| 430 | uint8_t *dest, int dstW, \ | ||
| 431 | const uint8_t *dither, int offset)\ | ||
| 432 | { \ | ||
| 433 | yuv2msbplane1_ ## template_size ## _c_template((const typeX_t *) src, \ | ||
| 434 | (uint16_t *) dest, dstW, is_be, bits); \ | ||
| 435 | }\ | ||
| 436 | static void yuv2msbplaneX_ ## bits ## BE_LE ## _c(const int16_t *filter, int filterSize, \ | ||
| 437 | const int16_t **src, uint8_t *dest, int dstW, \ | ||
| 438 | const uint8_t *dither, int offset)\ | ||
| 439 | { \ | ||
| 440 | yuv2msbplaneX_## template_size ## _c_template(filter, \ | ||
| 441 | filterSize, (const typeX_t **) src, \ | ||
| 442 | (uint16_t *) dest, dstW, is_be, bits); \ | ||
| 443 | } | ||
| 444 | |||
| 445 | 129168 | yuv2MSBNBPS(10, BE, 1, 10, int16_t) | |
| 446 | 137808 | yuv2MSBNBPS(10, LE, 0, 10, int16_t) | |
| 447 | 129168 | yuv2MSBNBPS(12, BE, 1, 10, int16_t) | |
| 448 | 137808 | yuv2MSBNBPS(12, LE, 0, 10, int16_t) | |
| 449 | |||
| 450 | #undef output_pixel | ||
| 451 | |||
| 452 | 386420 | static void yuv2nv12cX_16LE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, | |
| 453 | const int16_t *chrFilter, int chrFilterSize, | ||
| 454 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 455 | uint8_t *dest8, int chrDstW) | ||
| 456 | { | ||
| 457 | 386420 | yuv2nv12cX_16_c_template(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW, 16); | |
| 458 | 386420 | } | |
| 459 | |||
| 460 | 254804 | static void yuv2nv12cX_16BE_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, | |
| 461 | const int16_t *chrFilter, int chrFilterSize, | ||
| 462 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 463 | uint8_t *dest8, int chrDstW) | ||
| 464 | { | ||
| 465 | 254804 | yuv2nv12cX_16_c_template(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, dest8, chrDstW, 16); | |
| 466 | 254804 | } | |
| 467 | |||
| 468 | 11626532 | static void yuv2planeX_8_c(const int16_t *filter, int filterSize, | |
| 469 | const int16_t **src, uint8_t *dest, int dstW, | ||
| 470 | const uint8_t *dither, int offset) | ||
| 471 | { | ||
| 472 | int i; | ||
| 473 |
2/2✓ Branch 0 taken 7037855332 times.
✓ Branch 1 taken 11626532 times.
|
7049481864 | for (i=0; i<dstW; i++) { |
| 474 | 7037855332 | int val = dither[(i + offset) & 7] << 12; | |
| 475 | int j; | ||
| 476 |
2/2✓ Branch 0 taken 23285254332 times.
✓ Branch 1 taken 7037855332 times.
|
30323109664 | for (j=0; j<filterSize; j++) |
| 477 | 23285254332 | val += src[j][i] * filter[j]; | |
| 478 | |||
| 479 | 7037855332 | dest[i]= av_clip_uint8(val>>19); | |
| 480 | } | ||
| 481 | 11626532 | } | |
| 482 | |||
| 483 | 11176991 | static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW, | |
| 484 | const uint8_t *dither, int offset) | ||
| 485 | { | ||
| 486 | int i; | ||
| 487 |
2/2✓ Branch 0 taken 4162237277 times.
✓ Branch 1 taken 11176991 times.
|
4173414268 | for (i=0; i<dstW; i++) { |
| 488 | 4162237277 | int val = (src[i] + dither[(i + offset) & 7]) >> 7; | |
| 489 | 4162237277 | dest[i]= av_clip_uint8(val); | |
| 490 | } | ||
| 491 | 11176991 | } | |
| 492 | |||
| 493 | 828346 | static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, | |
| 494 | const int16_t *chrFilter, int chrFilterSize, | ||
| 495 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 496 | uint8_t *dest, int chrDstW) | ||
| 497 | { | ||
| 498 | int i; | ||
| 499 | |||
| 500 |
2/2✓ Branch 1 taken 818254 times.
✓ Branch 2 taken 10092 times.
|
828346 | if (!isSwappedChroma(dstFormat)) |
| 501 |
2/2✓ Branch 0 taken 264429392 times.
✓ Branch 1 taken 818254 times.
|
265247646 | for (i=0; i<chrDstW; i++) { |
| 502 | 264429392 | int u = chrDither[i & 7] << 12; | |
| 503 | 264429392 | int v = chrDither[(i + 3) & 7] << 12; | |
| 504 | int j; | ||
| 505 |
2/2✓ Branch 0 taken 506157664 times.
✓ Branch 1 taken 264429392 times.
|
770587056 | for (j=0; j<chrFilterSize; j++) { |
| 506 | 506157664 | u += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 507 | 506157664 | v += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 508 | } | ||
| 509 | |||
| 510 | 264429392 | dest[2*i]= av_clip_uint8(u>>19); | |
| 511 | 264429392 | dest[2*i+1]= av_clip_uint8(v>>19); | |
| 512 | } | ||
| 513 | else | ||
| 514 |
2/2✓ Branch 0 taken 3496784 times.
✓ Branch 1 taken 10092 times.
|
3506876 | for (i=0; i<chrDstW; i++) { |
| 515 | 3496784 | int u = chrDither[i & 7] << 12; | |
| 516 | 3496784 | int v = chrDither[(i + 3) & 7] << 12; | |
| 517 | int j; | ||
| 518 |
2/2✓ Branch 0 taken 14387136 times.
✓ Branch 1 taken 3496784 times.
|
17883920 | for (j=0; j<chrFilterSize; j++) { |
| 519 | 14387136 | u += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 520 | 14387136 | v += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 521 | } | ||
| 522 | |||
| 523 | 3496784 | dest[2*i]= av_clip_uint8(v>>19); | |
| 524 | 3496784 | dest[2*i+1]= av_clip_uint8(u>>19); | |
| 525 | } | ||
| 526 | 828346 | } | |
| 527 | |||
| 528 | |||
| 529 | #define output_pixel(pos, val) \ | ||
| 530 | if (big_endian) { \ | ||
| 531 | AV_WB16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \ | ||
| 532 | } else { \ | ||
| 533 | AV_WL16(pos, av_clip_uintp2(val >> shift, output_bits) << output_shift); \ | ||
| 534 | } | ||
| 535 | |||
| 536 | 2274624 | static void yuv2p01xl1_c(const int16_t *src, | |
| 537 | uint16_t *dest, int dstW, | ||
| 538 | int big_endian, int output_bits, int output_shift) | ||
| 539 | { | ||
| 540 | int i; | ||
| 541 | 2274624 | int shift = 15 - output_bits; | |
| 542 | |||
| 543 |
2/2✓ Branch 0 taken 800667648 times.
✓ Branch 1 taken 2274624 times.
|
802942272 | for (i = 0; i < dstW; i++) { |
| 544 | 800667648 | int val = src[i] + (1 << (shift - 1)); | |
| 545 |
2/2✓ Branch 0 taken 179841024 times.
✓ Branch 1 taken 620826624 times.
|
800667648 | output_pixel(&dest[i], val); |
| 546 | } | ||
| 547 | 2274624 | } | |
| 548 | |||
| 549 | 2800 | static void yuv2p01xlX_c(const int16_t *filter, int filterSize, | |
| 550 | const int16_t **src, uint16_t *dest, int dstW, | ||
| 551 | int big_endian, int output_bits, int output_shift) | ||
| 552 | { | ||
| 553 | int i, j; | ||
| 554 | 2800 | int shift = 11 + 16 - output_bits; | |
| 555 | |||
| 556 |
2/2✓ Branch 0 taken 560000 times.
✓ Branch 1 taken 2800 times.
|
562800 | for (i = 0; i < dstW; i++) { |
| 557 | 560000 | int val = 1 << (shift - 1); | |
| 558 | |||
| 559 |
2/2✓ Branch 0 taken 6720000 times.
✓ Branch 1 taken 560000 times.
|
7280000 | for (j = 0; j < filterSize; j++) |
| 560 | 6720000 | val += src[j][i] * filter[j]; | |
| 561 | |||
| 562 |
2/2✓ Branch 0 taken 280000 times.
✓ Branch 1 taken 280000 times.
|
560000 | output_pixel(&dest[i], val); |
| 563 | } | ||
| 564 | 2800 | } | |
| 565 | |||
| 566 | 2099040 | static void yuv2p01xcX_c(int big_endian, const uint8_t *chrDither, | |
| 567 | const int16_t *chrFilter, int chrFilterSize, | ||
| 568 | const int16_t **chrUSrc, const int16_t **chrVSrc, | ||
| 569 | uint8_t *dest8, int chrDstW, int output_bits, int output_shift) | ||
| 570 | { | ||
| 571 | 2099040 | uint16_t *dest = (uint16_t*)dest8; | |
| 572 | int i, j; | ||
| 573 | 2099040 | int shift = 11 + 16 - output_bits; | |
| 574 | |||
| 575 |
2/2✓ Branch 0 taken 639597056 times.
✓ Branch 1 taken 2099040 times.
|
641696096 | for (i = 0; i < chrDstW; i++) { |
| 576 | 639597056 | int u = 1 << (shift - 1); | |
| 577 | 639597056 | int v = 1 << (shift - 1); | |
| 578 | |||
| 579 |
2/2✓ Branch 0 taken 1262423040 times.
✓ Branch 1 taken 639597056 times.
|
1902020096 | for (j = 0; j < chrFilterSize; j++) { |
| 580 | 1262423040 | u += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 581 | 1262423040 | v += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 582 | } | ||
| 583 | |||
| 584 |
2/2✓ Branch 0 taken 98393344 times.
✓ Branch 1 taken 541203712 times.
|
639597056 | output_pixel(&dest[2*i] , u); |
| 585 |
2/2✓ Branch 0 taken 98393344 times.
✓ Branch 1 taken 541203712 times.
|
639597056 | output_pixel(&dest[2*i+1], v); |
| 586 | } | ||
| 587 | 2099040 | } | |
| 588 | |||
| 589 | #undef output_pixel | ||
| 590 | |||
| 591 | #define yuv2p01x_wrapper(fmt, bits, shift) \ | ||
| 592 | static void yuv2 ## fmt ## l1_LE_c(const int16_t *src, \ | ||
| 593 | uint8_t *dest, int dstW, \ | ||
| 594 | const uint8_t *dither, int offset) \ | ||
| 595 | { \ | ||
| 596 | yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 0, bits, shift); \ | ||
| 597 | } \ | ||
| 598 | \ | ||
| 599 | static void yuv2 ## fmt ## l1_BE_c(const int16_t *src, \ | ||
| 600 | uint8_t *dest, int dstW, \ | ||
| 601 | const uint8_t *dither, int offset) \ | ||
| 602 | { \ | ||
| 603 | yuv2p01xl1_c(src, (uint16_t*)dest, dstW, 1, bits, shift); \ | ||
| 604 | } \ | ||
| 605 | \ | ||
| 606 | static void yuv2 ## fmt ## lX_LE_c(const int16_t *filter, \ | ||
| 607 | int filterSize, const int16_t **src, \ | ||
| 608 | uint8_t *dest, int dstW, \ | ||
| 609 | const uint8_t *dither, int offset) \ | ||
| 610 | { \ | ||
| 611 | yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 0, \ | ||
| 612 | bits, shift); \ | ||
| 613 | } \ | ||
| 614 | \ | ||
| 615 | static void yuv2 ## fmt ## lX_BE_c(const int16_t *filter, \ | ||
| 616 | int filterSize, const int16_t **src, \ | ||
| 617 | uint8_t *dest, int dstW, \ | ||
| 618 | const uint8_t *dither, int offset) \ | ||
| 619 | { \ | ||
| 620 | yuv2p01xlX_c(filter, filterSize, src, (uint16_t*)dest, dstW, 1, \ | ||
| 621 | bits, shift); \ | ||
| 622 | } \ | ||
| 623 | \ | ||
| 624 | static void yuv2 ## fmt ## cX_LE_c(enum AVPixelFormat dstFormat, \ | ||
| 625 | const uint8_t *chrDither, \ | ||
| 626 | const int16_t *chrFilter, \ | ||
| 627 | int chrFilterSize, \ | ||
| 628 | const int16_t **chrUSrc, \ | ||
| 629 | const int16_t **chrVSrc, \ | ||
| 630 | uint8_t *dest8, int chrDstW) \ | ||
| 631 | { \ | ||
| 632 | yuv2p01xcX_c(0, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \ | ||
| 633 | dest8, chrDstW, bits, shift); \ | ||
| 634 | } \ | ||
| 635 | \ | ||
| 636 | static void yuv2 ## fmt ## cX_BE_c(enum AVPixelFormat dstFormat, \ | ||
| 637 | const uint8_t *chrDither, \ | ||
| 638 | const int16_t *chrFilter, \ | ||
| 639 | int chrFilterSize, \ | ||
| 640 | const int16_t **chrUSrc, \ | ||
| 641 | const int16_t **chrVSrc, \ | ||
| 642 | uint8_t *dest8, int chrDstW) \ | ||
| 643 | { \ | ||
| 644 | yuv2p01xcX_c(1, chrDither, chrFilter, chrFilterSize, chrUSrc, chrVSrc, \ | ||
| 645 | dest8, chrDstW, bits, shift); \ | ||
| 646 | } | ||
| 647 | |||
| 648 | 4326128 | yuv2p01x_wrapper(p010, 10, 6) | |
| 649 | 4353776 | yuv2p01x_wrapper(p012, 12, 4) | |
| 650 | 73024 | yuv2p01x_wrapper(nv20, 10, 0) | |
| 651 | |||
| 652 | #define accumulate_bit(acc, val) \ | ||
| 653 | acc <<= 1; \ | ||
| 654 | acc |= (val) >= 234 | ||
| 655 | #define output_pixel(pos, acc) \ | ||
| 656 | if (target == AV_PIX_FMT_MONOBLACK) { \ | ||
| 657 | pos = acc; \ | ||
| 658 | } else { \ | ||
| 659 | pos = ~acc; \ | ||
| 660 | } | ||
| 661 | |||
| 662 | static av_always_inline void | ||
| 663 | 91380 | yuv2mono_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 664 | const int16_t **lumSrc, int lumFilterSize, | ||
| 665 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 666 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 667 | const int16_t **alpSrc, uint8_t *dest, int dstW, | ||
| 668 | int y, enum AVPixelFormat target) | ||
| 669 | { | ||
| 670 | 91380 | const uint8_t * const d128 = ff_dither_8x8_220[y&7]; | |
| 671 | int i; | ||
| 672 | 91380 | unsigned acc = 0; | |
| 673 | 91380 | int err = 0; | |
| 674 | |||
| 675 |
2/2✓ Branch 0 taken 15782180 times.
✓ Branch 1 taken 91380 times.
|
15873560 | for (i = 0; i < dstW; i += 2) { |
| 676 | int j; | ||
| 677 | 15782180 | int Y1 = 1 << 18; | |
| 678 | 15782180 | int Y2 = 1 << 18; | |
| 679 | |||
| 680 |
2/2✓ Branch 0 taken 16222180 times.
✓ Branch 1 taken 15782180 times.
|
32004360 | for (j = 0; j < lumFilterSize; j++) { |
| 681 | 16222180 | Y1 += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 682 | 16222180 | Y2 += lumSrc[j][i+1] * (unsigned)lumFilter[j]; | |
| 683 | } | ||
| 684 | 15782180 | Y1 >>= 19; | |
| 685 | 15782180 | Y2 >>= 19; | |
| 686 |
2/2✓ Branch 0 taken 734 times.
✓ Branch 1 taken 15781446 times.
|
15782180 | if ((Y1 | Y2) & 0x100) { |
| 687 | 734 | Y1 = av_clip_uint8(Y1); | |
| 688 | 734 | Y2 = av_clip_uint8(Y2); | |
| 689 | } | ||
| 690 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15782180 times.
|
15782180 | if (c->opts.dither == SWS_DITHER_ED) { |
| 691 | ✗ | 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; | |
| 692 | ✗ | c->dither_error[0][i] = err; | |
| 693 | ✗ | acc = 2*acc + (Y1 >= 128); | |
| 694 | ✗ | Y1 -= 220*(acc&1); | |
| 695 | |||
| 696 | ✗ | 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); | |
| 697 | ✗ | c->dither_error[0][i+1] = Y1; | |
| 698 | ✗ | acc = 2*acc + (err >= 128); | |
| 699 | ✗ | err -= 220*(acc&1); | |
| 700 | } else { | ||
| 701 | 15782180 | accumulate_bit(acc, Y1 + d128[(i + 0) & 7]); | |
| 702 | 15782180 | accumulate_bit(acc, Y2 + d128[(i + 1) & 7]); | |
| 703 | } | ||
| 704 |
2/2✓ Branch 0 taken 3945120 times.
✓ Branch 1 taken 11837060 times.
|
15782180 | if ((i & 7) == 6) { |
| 705 |
2/2✓ Branch 0 taken 689288 times.
✓ Branch 1 taken 3255832 times.
|
3945120 | output_pixel(*dest++, acc); |
| 706 | } | ||
| 707 | } | ||
| 708 | 91380 | c->dither_error[0][i] = err; | |
| 709 | |||
| 710 |
2/2✓ Branch 0 taken 1700 times.
✓ Branch 1 taken 89680 times.
|
91380 | if (i & 6) { |
| 711 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1700 times.
|
1700 | output_pixel(*dest, acc); |
| 712 | } | ||
| 713 | 91380 | } | |
| 714 | |||
| 715 | static av_always_inline void | ||
| 716 | ✗ | yuv2mono_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 717 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 718 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 719 | int yalpha, int uvalpha, int y, | ||
| 720 | enum AVPixelFormat target) | ||
| 721 | { | ||
| 722 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1]; | |
| 723 | ✗ | const uint8_t * const d128 = ff_dither_8x8_220[y & 7]; | |
| 724 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 725 | int i; | ||
| 726 | av_assert2(yalpha <= 4096U); | ||
| 727 | |||
| 728 | ✗ | if (c->opts.dither == SWS_DITHER_ED) { | |
| 729 | ✗ | int err = 0; | |
| 730 | ✗ | unsigned acc = 0; | |
| 731 | ✗ | for (i = 0; i < dstW; i +=2) { | |
| 732 | int Y; | ||
| 733 | |||
| 734 | ✗ | Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; | |
| 735 | ✗ | 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; | |
| 736 | ✗ | c->dither_error[0][i] = err; | |
| 737 | ✗ | acc = 2*acc + (Y >= 128); | |
| 738 | ✗ | Y -= 220*(acc&1); | |
| 739 | |||
| 740 | ✗ | err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; | |
| 741 | ✗ | 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; | |
| 742 | ✗ | c->dither_error[0][i+1] = Y; | |
| 743 | ✗ | acc = 2*acc + (err >= 128); | |
| 744 | ✗ | err -= 220*(acc&1); | |
| 745 | |||
| 746 | ✗ | if ((i & 7) == 6) | |
| 747 | ✗ | output_pixel(*dest++, acc); | |
| 748 | } | ||
| 749 | ✗ | c->dither_error[0][i] = err; | |
| 750 | } else { | ||
| 751 | ✗ | for (i = 0; i < dstW; i += 8) { | |
| 752 | int Y; | ||
| 753 | ✗ | unsigned acc = 0; | |
| 754 | |||
| 755 | ✗ | Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19; | |
| 756 | ✗ | accumulate_bit(acc, Y + d128[0]); | |
| 757 | ✗ | Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19; | |
| 758 | ✗ | accumulate_bit(acc, Y + d128[1]); | |
| 759 | ✗ | Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19; | |
| 760 | ✗ | accumulate_bit(acc, Y + d128[2]); | |
| 761 | ✗ | Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19; | |
| 762 | ✗ | accumulate_bit(acc, Y + d128[3]); | |
| 763 | ✗ | Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19; | |
| 764 | ✗ | accumulate_bit(acc, Y + d128[4]); | |
| 765 | ✗ | Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19; | |
| 766 | ✗ | accumulate_bit(acc, Y + d128[5]); | |
| 767 | ✗ | Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19; | |
| 768 | ✗ | accumulate_bit(acc, Y + d128[6]); | |
| 769 | ✗ | Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19; | |
| 770 | ✗ | accumulate_bit(acc, Y + d128[7]); | |
| 771 | |||
| 772 | ✗ | output_pixel(*dest++, acc); | |
| 773 | } | ||
| 774 | } | ||
| 775 | ✗ | } | |
| 776 | |||
| 777 | static av_always_inline void | ||
| 778 | 174336 | yuv2mono_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 779 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 780 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 781 | int uvalpha, int y, enum AVPixelFormat target) | ||
| 782 | { | ||
| 783 | 174336 | const uint8_t * const d128 = ff_dither_8x8_220[y & 7]; | |
| 784 | int i; | ||
| 785 | |||
| 786 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 174336 times.
|
174336 | if (c->opts.dither == SWS_DITHER_ED) { |
| 787 | ✗ | int err = 0; | |
| 788 | ✗ | unsigned acc = 0; | |
| 789 | ✗ | for (i = 0; i < dstW; i +=2) { | |
| 790 | int Y; | ||
| 791 | |||
| 792 | ✗ | Y = ((buf0[i + 0] + 64) >> 7); | |
| 793 | ✗ | 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; | |
| 794 | ✗ | c->dither_error[0][i] = err; | |
| 795 | ✗ | acc = 2*acc + (Y >= 128); | |
| 796 | ✗ | Y -= 220*(acc&1); | |
| 797 | |||
| 798 | ✗ | err = ((buf0[i + 1] + 64) >> 7); | |
| 799 | ✗ | 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; | |
| 800 | ✗ | c->dither_error[0][i+1] = Y; | |
| 801 | ✗ | acc = 2*acc + (err >= 128); | |
| 802 | ✗ | err -= 220*(acc&1); | |
| 803 | |||
| 804 | ✗ | if ((i & 7) == 6) | |
| 805 | ✗ | output_pixel(*dest++, acc); | |
| 806 | } | ||
| 807 | ✗ | c->dither_error[0][i] = err; | |
| 808 | } else { | ||
| 809 |
2/2✓ Branch 0 taken 7305984 times.
✓ Branch 1 taken 174336 times.
|
7480320 | for (i = 0; i < dstW; i += 8) { |
| 810 | 7305984 | unsigned acc = 0; | |
| 811 | 7305984 | accumulate_bit(acc, ((buf0[i + 0] + 64) >> 7) + d128[0]); | |
| 812 | 7305984 | accumulate_bit(acc, ((buf0[i + 1] + 64) >> 7) + d128[1]); | |
| 813 | 7305984 | accumulate_bit(acc, ((buf0[i + 2] + 64) >> 7) + d128[2]); | |
| 814 | 7305984 | accumulate_bit(acc, ((buf0[i + 3] + 64) >> 7) + d128[3]); | |
| 815 | 7305984 | accumulate_bit(acc, ((buf0[i + 4] + 64) >> 7) + d128[4]); | |
| 816 | 7305984 | accumulate_bit(acc, ((buf0[i + 5] + 64) >> 7) + d128[5]); | |
| 817 | 7305984 | accumulate_bit(acc, ((buf0[i + 6] + 64) >> 7) + d128[6]); | |
| 818 | 7305984 | accumulate_bit(acc, ((buf0[i + 7] + 64) >> 7) + d128[7]); | |
| 819 | |||
| 820 |
2/2✓ Branch 0 taken 3624192 times.
✓ Branch 1 taken 3681792 times.
|
7305984 | output_pixel(*dest++, acc); |
| 821 | } | ||
| 822 | } | ||
| 823 | 174336 | } | |
| 824 | |||
| 825 | #undef output_pixel | ||
| 826 | #undef accumulate_bit | ||
| 827 | |||
| 828 | #define YUV2PACKEDWRAPPER(name, base, ext, fmt) \ | ||
| 829 | static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 830 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 831 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 832 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 833 | const int16_t **alpSrc, uint8_t *dest, int dstW, \ | ||
| 834 | int y) \ | ||
| 835 | { \ | ||
| 836 | name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 837 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 838 | alpSrc, dest, dstW, y, fmt); \ | ||
| 839 | } \ | ||
| 840 | \ | ||
| 841 | static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \ | ||
| 842 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 843 | const int16_t *abuf[2], uint8_t *dest, int dstW, \ | ||
| 844 | int yalpha, int uvalpha, int y) \ | ||
| 845 | { \ | ||
| 846 | name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ | ||
| 847 | dest, dstW, yalpha, uvalpha, y, fmt); \ | ||
| 848 | } \ | ||
| 849 | \ | ||
| 850 | static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \ | ||
| 851 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 852 | const int16_t *abuf0, uint8_t *dest, int dstW, \ | ||
| 853 | int uvalpha, int y) \ | ||
| 854 | { \ | ||
| 855 | name ## base ## _1_c_template(c, buf0, ubuf, vbuf, \ | ||
| 856 | abuf0, dest, dstW, uvalpha, \ | ||
| 857 | y, fmt); \ | ||
| 858 | } | ||
| 859 | |||
| 860 | 335192 | YUV2PACKEDWRAPPER(yuv2mono,, white, AV_PIX_FMT_MONOWHITE) | |
| 861 | 196240 | YUV2PACKEDWRAPPER(yuv2mono,, black, AV_PIX_FMT_MONOBLACK) | |
| 862 | |||
| 863 | #define output_pixels(pos, Y1, U, Y2, V) \ | ||
| 864 | if (target == AV_PIX_FMT_YUYV422) { \ | ||
| 865 | dest[pos + 0] = Y1; \ | ||
| 866 | dest[pos + 1] = U; \ | ||
| 867 | dest[pos + 2] = Y2; \ | ||
| 868 | dest[pos + 3] = V; \ | ||
| 869 | } else if (target == AV_PIX_FMT_YVYU422) { \ | ||
| 870 | dest[pos + 0] = Y1; \ | ||
| 871 | dest[pos + 1] = V; \ | ||
| 872 | dest[pos + 2] = Y2; \ | ||
| 873 | dest[pos + 3] = U; \ | ||
| 874 | } else { /* AV_PIX_FMT_UYVY422 */ \ | ||
| 875 | dest[pos + 0] = U; \ | ||
| 876 | dest[pos + 1] = Y1; \ | ||
| 877 | dest[pos + 2] = V; \ | ||
| 878 | dest[pos + 3] = Y2; \ | ||
| 879 | } | ||
| 880 | |||
| 881 | static av_always_inline void | ||
| 882 | 32280 | yuv2422_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 883 | const int16_t **lumSrc, int lumFilterSize, | ||
| 884 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 885 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 886 | const int16_t **alpSrc, uint8_t *dest, int dstW, | ||
| 887 | int y, enum AVPixelFormat target) | ||
| 888 | { | ||
| 889 | int i; | ||
| 890 | |||
| 891 |
2/2✓ Branch 0 taken 5635680 times.
✓ Branch 1 taken 32280 times.
|
5667960 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 892 | int j; | ||
| 893 | 5635680 | int Y1 = 1 << 18; | |
| 894 | 5635680 | int Y2 = 1 << 18; | |
| 895 | 5635680 | int U = 1 << 18; | |
| 896 | 5635680 | int V = 1 << 18; | |
| 897 | |||
| 898 |
2/2✓ Branch 0 taken 6295680 times.
✓ Branch 1 taken 5635680 times.
|
11931360 | for (j = 0; j < lumFilterSize; j++) { |
| 899 | 6295680 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 900 | 6295680 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 901 | } | ||
| 902 |
2/2✓ Branch 0 taken 23022720 times.
✓ Branch 1 taken 5635680 times.
|
28658400 | for (j = 0; j < chrFilterSize; j++) { |
| 903 | 23022720 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 904 | 23022720 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 905 | } | ||
| 906 | 5635680 | Y1 >>= 19; | |
| 907 | 5635680 | Y2 >>= 19; | |
| 908 | 5635680 | U >>= 19; | |
| 909 | 5635680 | V >>= 19; | |
| 910 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 5635645 times.
|
5635680 | if ((Y1 | Y2 | U | V) & 0x100) { |
| 911 | 35 | Y1 = av_clip_uint8(Y1); | |
| 912 | 35 | Y2 = av_clip_uint8(Y2); | |
| 913 | 35 | U = av_clip_uint8(U); | |
| 914 | 35 | V = av_clip_uint8(V); | |
| 915 | } | ||
| 916 |
4/4✓ Branch 0 taken 2757152 times.
✓ Branch 1 taken 2878528 times.
✓ Branch 2 taken 1439264 times.
✓ Branch 3 taken 1439264 times.
|
5635680 | output_pixels(4*i, Y1, U, Y2, V); |
| 917 | } | ||
| 918 | 32280 | } | |
| 919 | |||
| 920 | static av_always_inline void | ||
| 921 | ✗ | yuv2422_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 922 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 923 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 924 | int yalpha, int uvalpha, int y, | ||
| 925 | enum AVPixelFormat target) | ||
| 926 | { | ||
| 927 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 928 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 929 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; | |
| 930 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 931 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 932 | int i; | ||
| 933 | av_assert2(yalpha <= 4096U); | ||
| 934 | av_assert2(uvalpha <= 4096U); | ||
| 935 | |||
| 936 | ✗ | for (i = 0; i < ((dstW + 1) >> 1); i++) { | |
| 937 | ✗ | int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; | |
| 938 | ✗ | int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; | |
| 939 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; | |
| 940 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; | |
| 941 | |||
| 942 | ✗ | if ((Y1 | Y2 | U | V) & 0x100) { | |
| 943 | ✗ | Y1 = av_clip_uint8(Y1); | |
| 944 | ✗ | Y2 = av_clip_uint8(Y2); | |
| 945 | ✗ | U = av_clip_uint8(U); | |
| 946 | ✗ | V = av_clip_uint8(V); | |
| 947 | } | ||
| 948 | |||
| 949 | ✗ | output_pixels(i * 4, Y1, U, Y2, V); | |
| 950 | } | ||
| 951 | ✗ | } | |
| 952 | |||
| 953 | static av_always_inline void | ||
| 954 | 333504 | yuv2422_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 955 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 956 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 957 | int uvalpha, int y, enum AVPixelFormat target) | ||
| 958 | { | ||
| 959 | 333504 | const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 960 | int i; | ||
| 961 | |||
| 962 |
1/2✓ Branch 0 taken 333504 times.
✗ Branch 1 not taken.
|
333504 | if (uvalpha < 2048) { |
| 963 |
2/2✓ Branch 0 taken 74594304 times.
✓ Branch 1 taken 333504 times.
|
74927808 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 964 | 74594304 | int Y1 = (buf0[i * 2 ]+64) >> 7; | |
| 965 | 74594304 | int Y2 = (buf0[i * 2 + 1]+64) >> 7; | |
| 966 | 74594304 | int U = (ubuf0[i] +64) >> 7; | |
| 967 | 74594304 | int V = (vbuf0[i] +64) >> 7; | |
| 968 | |||
| 969 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 74594304 times.
|
74594304 | if ((Y1 | Y2 | U | V) & 0x100) { |
| 970 | ✗ | Y1 = av_clip_uint8(Y1); | |
| 971 | ✗ | Y2 = av_clip_uint8(Y2); | |
| 972 | ✗ | U = av_clip_uint8(U); | |
| 973 | ✗ | V = av_clip_uint8(V); | |
| 974 | } | ||
| 975 | |||
| 976 |
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); |
| 977 | } | ||
| 978 | } else { | ||
| 979 | ✗ | const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 980 | ✗ | for (i = 0; i < ((dstW + 1) >> 1); i++) { | |
| 981 | ✗ | int Y1 = (buf0[i * 2 ] + 64) >> 7; | |
| 982 | ✗ | int Y2 = (buf0[i * 2 + 1] + 64) >> 7; | |
| 983 | ✗ | int U = (ubuf0[i] + ubuf1[i]+128) >> 8; | |
| 984 | ✗ | int V = (vbuf0[i] + vbuf1[i]+128) >> 8; | |
| 985 | |||
| 986 | ✗ | if ((Y1 | Y2 | U | V) & 0x100) { | |
| 987 | ✗ | Y1 = av_clip_uint8(Y1); | |
| 988 | ✗ | Y2 = av_clip_uint8(Y2); | |
| 989 | ✗ | U = av_clip_uint8(U); | |
| 990 | ✗ | V = av_clip_uint8(V); | |
| 991 | } | ||
| 992 | |||
| 993 | ✗ | output_pixels(i * 4, Y1, U, Y2, V); | |
| 994 | } | ||
| 995 | } | ||
| 996 | 333504 | } | |
| 997 | |||
| 998 | #undef output_pixels | ||
| 999 | |||
| 1000 | 196240 | YUV2PACKEDWRAPPER(yuv2, 422, yuyv422, AV_PIX_FMT_YUYV422) | |
| 1001 | 181264 | YUV2PACKEDWRAPPER(yuv2, 422, yvyu422, AV_PIX_FMT_YVYU422) | |
| 1002 | 354064 | YUV2PACKEDWRAPPER(yuv2, 422, uyvy422, AV_PIX_FMT_UYVY422) | |
| 1003 | |||
| 1004 | #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) | ||
| 1005 | #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) | ||
| 1006 | #define output_pixel(pos, val) \ | ||
| 1007 | if (is_be) { \ | ||
| 1008 | AV_WB16(pos, val); \ | ||
| 1009 | } else { \ | ||
| 1010 | AV_WL16(pos, val); \ | ||
| 1011 | } | ||
| 1012 | |||
| 1013 | static av_always_inline void | ||
| 1014 | 19408 | yuv2ya16_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 1015 | const int32_t **lumSrc, int lumFilterSize, | ||
| 1016 | const int16_t *chrFilter, const int32_t **unused_chrUSrc, | ||
| 1017 | const int32_t **unused_chrVSrc, int unused_chrFilterSize, | ||
| 1018 | const int32_t **alpSrc, uint16_t *dest, int dstW, | ||
| 1019 | int y, enum AVPixelFormat target, | ||
| 1020 | int unused_hasAlpha, int unused_eightbytes, int is_be) | ||
| 1021 | { | ||
| 1022 | 19408 | int hasAlpha = !!alpSrc; | |
| 1023 | int i; | ||
| 1024 | |||
| 1025 |
2/2✓ Branch 0 taken 6770816 times.
✓ Branch 1 taken 19408 times.
|
6790224 | for (i = 0; i < dstW; i++) { |
| 1026 | int j; | ||
| 1027 | 6770816 | int Y = -0x40000000; | |
| 1028 | 6770816 | int A = 0xffff; | |
| 1029 | |||
| 1030 |
2/2✓ Branch 0 taken 7650816 times.
✓ Branch 1 taken 6770816 times.
|
14421632 | for (j = 0; j < lumFilterSize; j++) |
| 1031 | 7650816 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 1032 | |||
| 1033 | 6770816 | Y >>= 15; | |
| 1034 | 6770816 | Y += (1<<3) + 0x8000; | |
| 1035 | 6770816 | Y = av_clip_uint16(Y); | |
| 1036 | |||
| 1037 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 6690816 times.
|
6770816 | if (hasAlpha) { |
| 1038 | 80000 | A = -0x40000000 + (1<<14); | |
| 1039 |
2/2✓ Branch 0 taken 960000 times.
✓ Branch 1 taken 80000 times.
|
1040000 | for (j = 0; j < lumFilterSize; j++) |
| 1040 | 960000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 1041 | |||
| 1042 | 80000 | A >>= 15; | |
| 1043 | 80000 | A += 0x8000; | |
| 1044 | 80000 | A = av_clip_uint16(A); | |
| 1045 | } | ||
| 1046 | |||
| 1047 |
2/2✓ Branch 0 taken 3284032 times.
✓ Branch 1 taken 3486784 times.
|
6770816 | output_pixel(&dest[2 * i ], Y); |
| 1048 |
2/2✓ Branch 0 taken 3284032 times.
✓ Branch 1 taken 3486784 times.
|
6770816 | output_pixel(&dest[2 * i + 1], A); |
| 1049 | } | ||
| 1050 | 19408 | } | |
| 1051 | |||
| 1052 | static av_always_inline void | ||
| 1053 | ✗ | yuv2ya16_2_c_template(SwsInternal *c, const int32_t *buf[2], | |
| 1054 | const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], | ||
| 1055 | const int32_t *abuf[2], uint16_t *dest, int dstW, | ||
| 1056 | int yalpha_param, int unused_uvalpha, int y, | ||
| 1057 | enum AVPixelFormat target, int unused_hasAlpha, | ||
| 1058 | int unused_eightbytes, int is_be) | ||
| 1059 | { | ||
| 1060 | ✗ | unsigned yalpha = yalpha_param; | |
| 1061 | ✗ | int hasAlpha = abuf && abuf[0] && abuf[1]; | |
| 1062 | ✗ | const int32_t *buf0 = buf[0], *buf1 = buf[1], | |
| 1063 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 1064 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 1065 | ✗ | unsigned yalpha1 = 4096 - yalpha; | |
| 1066 | int i; | ||
| 1067 | |||
| 1068 | av_assert2(yalpha <= 4096U); | ||
| 1069 | |||
| 1070 | ✗ | for (i = 0; i < dstW; i++) { | |
| 1071 | ✗ | int Y = (int)(buf0[i] * yalpha1 + buf1[i] * yalpha) >> 15; | |
| 1072 | int A; | ||
| 1073 | |||
| 1074 | ✗ | Y = av_clip_uint16(Y); | |
| 1075 | |||
| 1076 | ✗ | if (hasAlpha) { | |
| 1077 | ✗ | A = (int)(abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 15; | |
| 1078 | ✗ | A = av_clip_uint16(A); | |
| 1079 | } | ||
| 1080 | |||
| 1081 | ✗ | output_pixel(&dest[2 * i ], Y); | |
| 1082 | ✗ | output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535); | |
| 1083 | } | ||
| 1084 | ✗ | } | |
| 1085 | |||
| 1086 | static av_always_inline void | ||
| 1087 | ✗ | yuv2ya16_1_c_template(SwsInternal *c, const int32_t *buf0, | |
| 1088 | const int32_t *unused_ubuf[2], const int32_t *unused_vbuf[2], | ||
| 1089 | const int32_t *abuf0, uint16_t *dest, int dstW, | ||
| 1090 | int unused_uvalpha, int y, enum AVPixelFormat target, | ||
| 1091 | int unused_hasAlpha, int unused_eightbytes, int is_be) | ||
| 1092 | { | ||
| 1093 | ✗ | int hasAlpha = !!abuf0; | |
| 1094 | int i; | ||
| 1095 | |||
| 1096 | ✗ | for (i = 0; i < dstW; i++) { | |
| 1097 | ✗ | int Y = buf0[i] >> 3;/* 19 - 16 */ | |
| 1098 | int A; | ||
| 1099 | |||
| 1100 | ✗ | Y = av_clip_uint16(Y); | |
| 1101 | |||
| 1102 | ✗ | if (hasAlpha) { | |
| 1103 | ✗ | A = abuf0[i] >> 3; | |
| 1104 | ✗ | if (A & 0x100) | |
| 1105 | ✗ | A = av_clip_uint16(A); | |
| 1106 | } | ||
| 1107 | |||
| 1108 | ✗ | output_pixel(&dest[2 * i ], Y); | |
| 1109 | ✗ | output_pixel(&dest[2 * i + 1], hasAlpha ? A : 65535); | |
| 1110 | } | ||
| 1111 | ✗ | } | |
| 1112 | |||
| 1113 | static av_always_inline void | ||
| 1114 | 297520 | yuv2rgba64_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 1115 | const int32_t **lumSrc, int lumFilterSize, | ||
| 1116 | const int16_t *chrFilter, const int32_t **chrUSrc, | ||
| 1117 | const int32_t **chrVSrc, int chrFilterSize, | ||
| 1118 | const int32_t **alpSrc, uint16_t *dest, int dstW, | ||
| 1119 | int y, enum AVPixelFormat target, int hasAlpha, int eightbytes, | ||
| 1120 | int is_be) | ||
| 1121 | { | ||
| 1122 | int i; | ||
| 1123 | 297520 | int A1 = 0xffff<<14, A2 = 0xffff<<14; | |
| 1124 | |||
| 1125 |
2/2✓ Branch 0 taken 52164080 times.
✓ Branch 1 taken 297520 times.
|
52461600 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1126 | int j; | ||
| 1127 | 52164080 | unsigned Y1 = -0x40000000; | |
| 1128 | 52164080 | unsigned Y2 = -0x40000000; | |
| 1129 | 52164080 | int U = -(128 << 23); // 19 | |
| 1130 | 52164080 | int V = -(128 << 23); | |
| 1131 | int R, G, B; | ||
| 1132 | |||
| 1133 |
2/2✓ Branch 0 taken 52679616 times.
✓ Branch 1 taken 52164080 times.
|
104843696 | for (j = 0; j < lumFilterSize; j++) { |
| 1134 | 52679616 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 1135 | 52679616 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 1136 | } | ||
| 1137 |
2/2✓ Branch 0 taken 208697280 times.
✓ Branch 1 taken 52164080 times.
|
260861360 | for (j = 0; j < chrFilterSize; j++) {; |
| 1138 | 208697280 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1139 | 208697280 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1140 | } | ||
| 1141 | |||
| 1142 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52164080 times.
|
52164080 | if (hasAlpha) { |
| 1143 | ✗ | A1 = -0x40000000; | |
| 1144 | ✗ | A2 = -0x40000000; | |
| 1145 | ✗ | for (j = 0; j < lumFilterSize; j++) { | |
| 1146 | ✗ | A1 += alpSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 1147 | ✗ | A2 += alpSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 1148 | } | ||
| 1149 | ✗ | A1 >>= 1; | |
| 1150 | ✗ | A1 += 0x20002000; | |
| 1151 | ✗ | A2 >>= 1; | |
| 1152 | ✗ | A2 += 0x20002000; | |
| 1153 | } | ||
| 1154 | |||
| 1155 | // 8 bits: 12+15=27; 16 bits: 12+19=31 | ||
| 1156 | 52164080 | Y1 = (int)Y1 >> 14; // 10 | |
| 1157 | 52164080 | Y1 += 0x10000; | |
| 1158 | 52164080 | Y2 = (int)Y2 >> 14; | |
| 1159 | 52164080 | Y2 += 0x10000; | |
| 1160 | 52164080 | U >>= 14; | |
| 1161 | 52164080 | V >>= 14; | |
| 1162 | |||
| 1163 | // 8 bits: 27 -> 17 bits, 16 bits: 31 - 14 = 17 bits | ||
| 1164 | 52164080 | Y1 -= c->yuv2rgb_y_offset; | |
| 1165 | 52164080 | Y2 -= c->yuv2rgb_y_offset; | |
| 1166 | 52164080 | Y1 *= c->yuv2rgb_y_coeff; | |
| 1167 | 52164080 | Y2 *= c->yuv2rgb_y_coeff; | |
| 1168 | 52164080 | Y1 += (1 << 13) - (1 << 29); // 21 | |
| 1169 | 52164080 | Y2 += (1 << 13) - (1 << 29); | |
| 1170 | // 8 bits: 17 + 13 bits = 30 bits, 16 bits: 17 + 13 bits = 30 bits | ||
| 1171 | |||
| 1172 | 52164080 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1173 | 52164080 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1174 | 52164080 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1175 | |||
| 1176 | // 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits | ||
| 1177 |
14/18✓ Branch 0 taken 9533440 times.
✓ Branch 1 taken 42630640 times.
✓ Branch 2 taken 9533440 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4869120 times.
✓ Branch 5 taken 4664320 times.
✓ Branch 6 taken 4869120 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1623040 times.
✓ Branch 9 taken 3246080 times.
✓ Branch 10 taken 5984256 times.
✓ Branch 11 taken 36646384 times.
✓ Branch 12 taken 5984256 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 3347456 times.
✓ Branch 15 taken 2636800 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 3347456 times.
|
52164080 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)); |
| 1178 |
2/2✓ Branch 0 taken 9533440 times.
✓ Branch 1 taken 42630640 times.
|
52164080 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16)); |
| 1179 |
14/18✓ Branch 0 taken 9533440 times.
✓ Branch 1 taken 42630640 times.
✓ Branch 2 taken 9533440 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4869120 times.
✓ Branch 5 taken 4664320 times.
✓ Branch 6 taken 4869120 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1623040 times.
✓ Branch 9 taken 3246080 times.
✓ Branch 10 taken 5984256 times.
✓ Branch 11 taken 36646384 times.
✓ Branch 12 taken 5984256 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 3347456 times.
✓ Branch 15 taken 2636800 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 3347456 times.
|
52164080 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)); |
| 1180 |
2/2✓ Branch 0 taken 7505920 times.
✓ Branch 1 taken 44658160 times.
|
52164080 | if (eightbytes) { |
| 1181 |
2/2✓ Branch 0 taken 3246080 times.
✓ Branch 1 taken 4259840 times.
|
7505920 | output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); |
| 1182 |
12/18✓ Branch 0 taken 3246080 times.
✓ Branch 1 taken 4259840 times.
✓ Branch 2 taken 3246080 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3246080 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3246080 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1623040 times.
✓ Branch 9 taken 1623040 times.
✓ Branch 10 taken 4259840 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4259840 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1623040 times.
✓ Branch 15 taken 2636800 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1623040 times.
|
7505920 | output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1183 |
2/2✓ Branch 0 taken 3246080 times.
✓ Branch 1 taken 4259840 times.
|
7505920 | output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1184 |
12/18✓ Branch 0 taken 3246080 times.
✓ Branch 1 taken 4259840 times.
✓ Branch 2 taken 3246080 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3246080 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3246080 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1623040 times.
✓ Branch 9 taken 1623040 times.
✓ Branch 10 taken 4259840 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4259840 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1623040 times.
✓ Branch 15 taken 2636800 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1623040 times.
|
7505920 | output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1185 |
2/2✓ Branch 0 taken 3246080 times.
✓ Branch 1 taken 4259840 times.
|
7505920 | output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); |
| 1186 | 7505920 | dest += 8; | |
| 1187 | } else { | ||
| 1188 |
12/18✓ Branch 0 taken 6287360 times.
✓ Branch 1 taken 38370800 times.
✓ Branch 2 taken 6287360 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1623040 times.
✓ Branch 5 taken 4664320 times.
✓ Branch 6 taken 1623040 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1623040 times.
✓ Branch 10 taken 1724416 times.
✓ Branch 11 taken 36646384 times.
✓ Branch 12 taken 1724416 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1724416 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1724416 times.
|
44658160 | output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1189 |
2/2✓ Branch 0 taken 6287360 times.
✓ Branch 1 taken 38370800 times.
|
44658160 | output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1190 |
12/18✓ Branch 0 taken 6287360 times.
✓ Branch 1 taken 38370800 times.
✓ Branch 2 taken 6287360 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1623040 times.
✓ Branch 5 taken 4664320 times.
✓ Branch 6 taken 1623040 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1623040 times.
✓ Branch 10 taken 1724416 times.
✓ Branch 11 taken 36646384 times.
✓ Branch 12 taken 1724416 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1724416 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1724416 times.
|
44658160 | output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1191 | 44658160 | dest += 6; | |
| 1192 | } | ||
| 1193 | } | ||
| 1194 | 297520 | } | |
| 1195 | |||
| 1196 | static av_always_inline void | ||
| 1197 | 48 | yuv2rgba64_2_c_template(SwsInternal *c, const int32_t *buf[2], | |
| 1198 | const int32_t *ubuf[2], const int32_t *vbuf[2], | ||
| 1199 | const int32_t *abuf[2], uint16_t *dest, int dstW, | ||
| 1200 | int yalpha_param, int uvalpha_param, int y, | ||
| 1201 | enum AVPixelFormat target, int hasAlpha, int eightbytes, | ||
| 1202 | int is_be) | ||
| 1203 | { | ||
| 1204 | 48 | unsigned yalpha = yalpha_param; | |
| 1205 | 48 | unsigned uvalpha = uvalpha_param; | |
| 1206 | 48 | const int32_t *buf0 = buf[0], *buf1 = buf[1], | |
| 1207 | 48 | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 1208 | 48 | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 1209 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | *abuf0 = hasAlpha ? abuf[0] : NULL, |
| 1210 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | *abuf1 = hasAlpha ? abuf[1] : NULL; |
| 1211 | 48 | unsigned yalpha1 = 4096 - yalpha; | |
| 1212 | 48 | unsigned uvalpha1 = 4096 - uvalpha; | |
| 1213 | int i; | ||
| 1214 | 48 | int A1 = 0xffff<<14, A2 = 0xffff<<14; | |
| 1215 | |||
| 1216 | av_assert2(yalpha <= 4096U); | ||
| 1217 | av_assert2(uvalpha <= 4096U); | ||
| 1218 | |||
| 1219 |
2/2✓ Branch 0 taken 12288 times.
✓ Branch 1 taken 48 times.
|
12336 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1220 | 12288 | unsigned Y1 = (int)(buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14; | |
| 1221 | 12288 | unsigned Y2 = (int)(buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14; | |
| 1222 | 12288 | int U = (int)(ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1223 | 12288 | int V = (int)(vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1224 | int R, G, B; | ||
| 1225 | |||
| 1226 | 12288 | Y1 -= c->yuv2rgb_y_offset; | |
| 1227 | 12288 | Y2 -= c->yuv2rgb_y_offset; | |
| 1228 | 12288 | Y1 *= c->yuv2rgb_y_coeff; | |
| 1229 | 12288 | Y2 *= c->yuv2rgb_y_coeff; | |
| 1230 | 12288 | Y1 += (1 << 13) - (1 << 29); | |
| 1231 | 12288 | Y2 += (1 << 13) - (1 << 29); | |
| 1232 | |||
| 1233 | 12288 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1234 | 12288 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1235 | 12288 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1236 | |||
| 1237 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12288 times.
|
12288 | if (hasAlpha) { |
| 1238 | ✗ | A1 = (int)(abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 1; | |
| 1239 | ✗ | A2 = (int)(abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 1; | |
| 1240 | |||
| 1241 | ✗ | A1 += 1 << 13; | |
| 1242 | ✗ | A2 += 1 << 13; | |
| 1243 | } | ||
| 1244 | |||
| 1245 |
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)); |
| 1246 |
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)); |
| 1247 |
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)); |
| 1248 |
2/2✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 6144 times.
|
12288 | if (eightbytes) { |
| 1249 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
|
6144 | output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); |
| 1250 |
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)); |
| 1251 |
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)); |
| 1252 |
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)); |
| 1253 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 3072 times.
|
6144 | output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); |
| 1254 | 6144 | dest += 8; | |
| 1255 | } else { | ||
| 1256 |
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)); |
| 1257 |
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)); |
| 1258 |
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)); |
| 1259 | 6144 | dest += 6; | |
| 1260 | } | ||
| 1261 | } | ||
| 1262 | 48 | } | |
| 1263 | |||
| 1264 | static av_always_inline void | ||
| 1265 | 209684 | yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0, | |
| 1266 | const int32_t *ubuf[2], const int32_t *vbuf[2], | ||
| 1267 | const int32_t *abuf0, uint16_t *dest, int dstW, | ||
| 1268 | int uvalpha, int y, enum AVPixelFormat target, | ||
| 1269 | int hasAlpha, int eightbytes, int is_be) | ||
| 1270 | { | ||
| 1271 | 209684 | const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 1272 | int i; | ||
| 1273 | 209684 | int A1 = 0xffff<<14, A2= 0xffff<<14; | |
| 1274 | |||
| 1275 |
2/2✓ Branch 0 taken 209652 times.
✓ Branch 1 taken 32 times.
|
209684 | if (uvalpha == 0) { |
| 1276 |
2/2✓ Branch 0 taken 36629732 times.
✓ Branch 1 taken 209652 times.
|
36839384 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1277 | 36629732 | SUINT Y1 = (buf0[i * 2] ) >> 2; | |
| 1278 | 36629732 | SUINT Y2 = (buf0[i * 2 + 1]) >> 2; | |
| 1279 | 36629732 | SUINT U = (ubuf0[i] - (128 << 11)) >> 2; | |
| 1280 | 36629732 | SUINT V = (vbuf0[i] - (128 << 11)) >> 2; | |
| 1281 | int R, G, B; | ||
| 1282 | |||
| 1283 | 36629732 | Y1 -= c->yuv2rgb_y_offset; | |
| 1284 | 36629732 | Y2 -= c->yuv2rgb_y_offset; | |
| 1285 | 36629732 | Y1 *= c->yuv2rgb_y_coeff; | |
| 1286 | 36629732 | Y2 *= c->yuv2rgb_y_coeff; | |
| 1287 | 36629732 | Y1 += (1 << 13) - (1 << 29); | |
| 1288 | 36629732 | Y2 += (1 << 13) - (1 << 29); | |
| 1289 | |||
| 1290 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36629732 times.
|
36629732 | if (hasAlpha) { |
| 1291 | ✗ | A1 = abuf0[i * 2 ] * (1 << 11); | |
| 1292 | ✗ | A2 = abuf0[i * 2 + 1] * (1 << 11); | |
| 1293 | |||
| 1294 | ✗ | A1 += 1 << 13; | |
| 1295 | ✗ | A2 += 1 << 13; | |
| 1296 | } | ||
| 1297 | |||
| 1298 | 36629732 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1299 | 36629732 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1300 | 36629732 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1301 | |||
| 1302 |
14/18✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 36627684 times.
✓ Branch 2 taken 2048 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 512 times.
✓ Branch 6 taken 1536 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 512 times.
✓ Branch 9 taken 1024 times.
✓ Branch 10 taken 1536 times.
✓ Branch 11 taken 36626148 times.
✓ Branch 12 taken 1536 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1024 times.
✓ Branch 15 taken 512 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1024 times.
|
36629732 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)); |
| 1303 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 36627684 times.
|
36629732 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16)); |
| 1304 |
14/18✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 36627684 times.
✓ Branch 2 taken 2048 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 512 times.
✓ Branch 6 taken 1536 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 512 times.
✓ Branch 9 taken 1024 times.
✓ Branch 10 taken 1536 times.
✓ Branch 11 taken 36626148 times.
✓ Branch 12 taken 1536 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1024 times.
✓ Branch 15 taken 512 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1024 times.
|
36629732 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)); |
| 1305 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 36627684 times.
|
36629732 | if (eightbytes) { |
| 1306 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 1024 times.
|
2048 | output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); |
| 1307 |
12/18✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 1024 times.
✓ Branch 2 taken 1024 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1024 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1024 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 512 times.
✓ Branch 9 taken 512 times.
✓ Branch 10 taken 1024 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1024 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 512 times.
✓ Branch 15 taken 512 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 512 times.
|
2048 | output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1308 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 1024 times.
|
2048 | output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1309 |
12/18✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 1024 times.
✓ Branch 2 taken 1024 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1024 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1024 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 512 times.
✓ Branch 9 taken 512 times.
✓ Branch 10 taken 1024 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1024 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 512 times.
✓ Branch 15 taken 512 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 512 times.
|
2048 | output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1310 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 1024 times.
|
2048 | output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); |
| 1311 | 2048 | dest += 8; | |
| 1312 | } else { | ||
| 1313 |
12/18✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 36626660 times.
✓ Branch 2 taken 1024 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 512 times.
✓ Branch 5 taken 512 times.
✓ Branch 6 taken 512 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 512 times.
✓ Branch 10 taken 512 times.
✓ Branch 11 taken 36626148 times.
✓ Branch 12 taken 512 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 512 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 512 times.
|
36627684 | output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1314 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 36626660 times.
|
36627684 | output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1315 |
12/18✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 36626660 times.
✓ Branch 2 taken 1024 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 512 times.
✓ Branch 5 taken 512 times.
✓ Branch 6 taken 512 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 512 times.
✓ Branch 10 taken 512 times.
✓ Branch 11 taken 36626148 times.
✓ Branch 12 taken 512 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 512 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 512 times.
|
36627684 | output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1316 | 36627684 | dest += 6; | |
| 1317 | } | ||
| 1318 | } | ||
| 1319 | } else { | ||
| 1320 | 32 | const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 1321 | 32 | int A1 = 0xffff<<14, A2 = 0xffff<<14; | |
| 1322 | 32 | unsigned uvalpha1 = 4096 - uvalpha; | |
| 1323 | av_assert2(uvalpha <= 4096U); | ||
| 1324 | |||
| 1325 |
2/2✓ Branch 0 taken 8192 times.
✓ Branch 1 taken 32 times.
|
8224 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1326 | 8192 | SUINT Y1 = (buf0[i * 2] ) >> 2; | |
| 1327 | 8192 | SUINT Y2 = (buf0[i * 2 + 1]) >> 2; | |
| 1328 | 8192 | SUINT U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1329 | 8192 | SUINT V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1330 | int R, G, B; | ||
| 1331 | |||
| 1332 | 8192 | Y1 -= c->yuv2rgb_y_offset; | |
| 1333 | 8192 | Y2 -= c->yuv2rgb_y_offset; | |
| 1334 | 8192 | Y1 *= c->yuv2rgb_y_coeff; | |
| 1335 | 8192 | Y2 *= c->yuv2rgb_y_coeff; | |
| 1336 | 8192 | Y1 += (1 << 13) - (1 << 29); | |
| 1337 | 8192 | Y2 += (1 << 13) - (1 << 29); | |
| 1338 | |||
| 1339 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8192 times.
|
8192 | if (hasAlpha) { |
| 1340 | ✗ | A1 = abuf0[i * 2 ] * (1 << 11); | |
| 1341 | ✗ | A2 = abuf0[i * 2 + 1] * (1 << 11); | |
| 1342 | |||
| 1343 | ✗ | A1 += 1 << 13; | |
| 1344 | ✗ | A2 += 1 << 13; | |
| 1345 | } | ||
| 1346 | |||
| 1347 | 8192 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1348 | 8192 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1349 | 8192 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1350 | |||
| 1351 |
14/18✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 4096 times.
✓ Branch 2 taken 4096 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3072 times.
✓ Branch 5 taken 1024 times.
✓ Branch 6 taken 3072 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1024 times.
✓ Branch 9 taken 2048 times.
✓ Branch 10 taken 3072 times.
✓ Branch 11 taken 1024 times.
✓ Branch 12 taken 3072 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2048 times.
✓ Branch 15 taken 1024 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 2048 times.
|
8192 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16)); |
| 1352 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 4096 times.
|
8192 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16)); |
| 1353 |
14/18✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 4096 times.
✓ Branch 2 taken 4096 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3072 times.
✓ Branch 5 taken 1024 times.
✓ Branch 6 taken 3072 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1024 times.
✓ Branch 9 taken 2048 times.
✓ Branch 10 taken 3072 times.
✓ Branch 11 taken 1024 times.
✓ Branch 12 taken 3072 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 2048 times.
✓ Branch 15 taken 1024 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 2048 times.
|
8192 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16)); |
| 1354 |
2/2✓ Branch 0 taken 4096 times.
✓ Branch 1 taken 4096 times.
|
8192 | if (eightbytes) { |
| 1355 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 2048 times.
|
4096 | output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); |
| 1356 |
12/18✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 2048 times.
✓ Branch 2 taken 2048 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2048 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2048 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1024 times.
✓ Branch 9 taken 1024 times.
✓ Branch 10 taken 2048 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2048 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1024 times.
✓ Branch 15 taken 1024 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1024 times.
|
4096 | output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1357 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 2048 times.
|
4096 | output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1358 |
12/18✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 2048 times.
✓ Branch 2 taken 2048 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2048 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2048 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1024 times.
✓ Branch 9 taken 1024 times.
✓ Branch 10 taken 2048 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2048 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1024 times.
✓ Branch 15 taken 1024 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1024 times.
|
4096 | output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1359 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 2048 times.
|
4096 | output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); |
| 1360 | 4096 | dest += 8; | |
| 1361 | } else { | ||
| 1362 |
12/18✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 2048 times.
✓ Branch 2 taken 2048 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1024 times.
✓ Branch 5 taken 1024 times.
✓ Branch 6 taken 1024 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1024 times.
✓ Branch 10 taken 1024 times.
✓ Branch 11 taken 1024 times.
✓ Branch 12 taken 1024 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1024 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1024 times.
|
4096 | output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16)); |
| 1363 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 2048 times.
|
4096 | output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16)); |
| 1364 |
12/18✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 2048 times.
✓ Branch 2 taken 2048 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1024 times.
✓ Branch 5 taken 1024 times.
✓ Branch 6 taken 1024 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1024 times.
✓ Branch 10 taken 1024 times.
✓ Branch 11 taken 1024 times.
✓ Branch 12 taken 1024 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1024 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 1024 times.
|
4096 | output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16)); |
| 1365 | 4096 | dest += 6; | |
| 1366 | } | ||
| 1367 | } | ||
| 1368 | } | ||
| 1369 | 209684 | } | |
| 1370 | |||
| 1371 | static av_always_inline void | ||
| 1372 | 2000 | yuv2rgba64_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 1373 | const int32_t **lumSrc, int lumFilterSize, | ||
| 1374 | const int16_t *chrFilter, const int32_t **chrUSrc, | ||
| 1375 | const int32_t **chrVSrc, int chrFilterSize, | ||
| 1376 | const int32_t **alpSrc, uint16_t *dest, int dstW, | ||
| 1377 | int y, enum AVPixelFormat target, int hasAlpha, | ||
| 1378 | int eightbytes, int is_be) | ||
| 1379 | { | ||
| 1380 | int i; | ||
| 1381 | 2000 | int A = 0xffff<<14; | |
| 1382 | |||
| 1383 |
2/2✓ Branch 0 taken 400000 times.
✓ Branch 1 taken 2000 times.
|
402000 | for (i = 0; i < dstW; i++) { |
| 1384 | int j; | ||
| 1385 | 400000 | int Y = -0x40000000; | |
| 1386 | 400000 | int U = -(128 << 23); // 19 | |
| 1387 | 400000 | int V = -(128 << 23); | |
| 1388 | int R, G, B; | ||
| 1389 | |||
| 1390 |
2/2✓ Branch 0 taken 4800000 times.
✓ Branch 1 taken 400000 times.
|
5200000 | for (j = 0; j < lumFilterSize; j++) { |
| 1391 | 4800000 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 1392 | } | ||
| 1393 |
2/2✓ Branch 0 taken 4800000 times.
✓ Branch 1 taken 400000 times.
|
5200000 | for (j = 0; j < chrFilterSize; j++) {; |
| 1394 | 4800000 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1395 | 4800000 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1396 | } | ||
| 1397 | |||
| 1398 |
2/2✓ Branch 0 taken 160000 times.
✓ Branch 1 taken 240000 times.
|
400000 | if (hasAlpha) { |
| 1399 | 160000 | A = -0x40000000; | |
| 1400 |
2/2✓ Branch 0 taken 1920000 times.
✓ Branch 1 taken 160000 times.
|
2080000 | for (j = 0; j < lumFilterSize; j++) { |
| 1401 | 1920000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 1402 | } | ||
| 1403 | 160000 | A >>= 1; | |
| 1404 | 160000 | A += 0x20002000; | |
| 1405 | } | ||
| 1406 | |||
| 1407 | // 8bit: 12+15=27; 16-bit: 12+19=31 | ||
| 1408 | 400000 | Y >>= 14; // 10 | |
| 1409 | 400000 | Y += 0x10000; | |
| 1410 | 400000 | U >>= 14; | |
| 1411 | 400000 | V >>= 14; | |
| 1412 | |||
| 1413 | // 8bit: 27 -> 17bit, 16bit: 31 - 14 = 17bit | ||
| 1414 | 400000 | Y -= c->yuv2rgb_y_offset; | |
| 1415 | 400000 | Y *= c->yuv2rgb_y_coeff; | |
| 1416 | 400000 | Y += (1 << 13) - (1<<29); // 21 | |
| 1417 | // 8bit: 17 + 13bit = 30bit, 16bit: 17 + 13bit = 30bit | ||
| 1418 | |||
| 1419 | 400000 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1420 | 400000 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1421 | 400000 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1422 | |||
| 1423 | // 8bit: 30 - 22 = 8bit, 16bit: 30bit - 14 = 16bit | ||
| 1424 |
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)); |
| 1425 |
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)); |
| 1426 |
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)); |
| 1427 |
2/2✓ Branch 0 taken 160000 times.
✓ Branch 1 taken 240000 times.
|
400000 | if (eightbytes) { |
| 1428 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 80000 times.
|
160000 | output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); |
| 1429 | 160000 | dest += 4; | |
| 1430 | } else { | ||
| 1431 | 240000 | dest += 3; | |
| 1432 | } | ||
| 1433 | } | ||
| 1434 | 2000 | } | |
| 1435 | |||
| 1436 | static av_always_inline void | ||
| 1437 | ✗ | yuv2rgba64_full_2_c_template(SwsInternal *c, const int32_t *buf[2], | |
| 1438 | const int32_t *ubuf[2], const int32_t *vbuf[2], | ||
| 1439 | const int32_t *abuf[2], uint16_t *dest, int dstW, | ||
| 1440 | int yalpha_param, int uvalpha_param, int y, | ||
| 1441 | enum AVPixelFormat target, int hasAlpha, int eightbytes, | ||
| 1442 | int is_be) | ||
| 1443 | { | ||
| 1444 | ✗ | unsigned yalpha = yalpha_param; | |
| 1445 | ✗ | unsigned uvalpha = uvalpha_param; | |
| 1446 | ✗ | const int32_t *buf0 = buf[0], *buf1 = buf[1], | |
| 1447 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 1448 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 1449 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 1450 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 1451 | ✗ | unsigned yalpha1 = 4096 - yalpha; | |
| 1452 | ✗ | unsigned uvalpha1 = 4096 - uvalpha; | |
| 1453 | int i; | ||
| 1454 | ✗ | int A = 0xffff<<14; | |
| 1455 | |||
| 1456 | av_assert2(yalpha <= 4096U); | ||
| 1457 | av_assert2(uvalpha <= 4096U); | ||
| 1458 | |||
| 1459 | ✗ | for (i = 0; i < dstW; i++) { | |
| 1460 | ✗ | int Y = (int)(buf0[i] * yalpha1 + buf1[i] * yalpha) >> 14; | |
| 1461 | ✗ | int U = (int)(ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1462 | ✗ | int V = (int)(vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1463 | int R, G, B; | ||
| 1464 | |||
| 1465 | ✗ | Y -= c->yuv2rgb_y_offset; | |
| 1466 | ✗ | Y *= c->yuv2rgb_y_coeff; | |
| 1467 | ✗ | Y += (1 << 13) - (1 << 29); | |
| 1468 | |||
| 1469 | ✗ | R = V * c->yuv2rgb_v2r_coeff; | |
| 1470 | ✗ | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1471 | ✗ | B = U * c->yuv2rgb_u2b_coeff; | |
| 1472 | |||
| 1473 | ✗ | if (hasAlpha) { | |
| 1474 | ✗ | A = (int)(abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 1; | |
| 1475 | |||
| 1476 | ✗ | A += 1 << 13; | |
| 1477 | } | ||
| 1478 | |||
| 1479 | ✗ | output_pixel(&dest[0], av_clip_uintp2(((R_B + Y) >> 14) + (1<<15), 16)); | |
| 1480 | ✗ | output_pixel(&dest[1], av_clip_uintp2((( G + Y) >> 14) + (1<<15), 16)); | |
| 1481 | ✗ | output_pixel(&dest[2], av_clip_uintp2(((B_R + Y) >> 14) + (1<<15), 16)); | |
| 1482 | ✗ | if (eightbytes) { | |
| 1483 | ✗ | output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); | |
| 1484 | ✗ | dest += 4; | |
| 1485 | } else { | ||
| 1486 | ✗ | dest += 3; | |
| 1487 | } | ||
| 1488 | } | ||
| 1489 | ✗ | } | |
| 1490 | |||
| 1491 | static av_always_inline void | ||
| 1492 | 412224 | yuv2rgba64_full_1_c_template(SwsInternal *c, const int32_t *buf0, | |
| 1493 | const int32_t *ubuf[2], const int32_t *vbuf[2], | ||
| 1494 | const int32_t *abuf0, uint16_t *dest, int dstW, | ||
| 1495 | int uvalpha, int y, enum AVPixelFormat target, | ||
| 1496 | int hasAlpha, int eightbytes, int is_be) | ||
| 1497 | { | ||
| 1498 | 412224 | const int32_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 1499 | int i; | ||
| 1500 | 412224 | int A = 0xffff<<14; | |
| 1501 | |||
| 1502 |
1/2✓ Branch 0 taken 412224 times.
✗ Branch 1 not taken.
|
412224 | if (uvalpha == 0) { |
| 1503 |
2/2✓ Branch 0 taken 145004544 times.
✓ Branch 1 taken 412224 times.
|
145416768 | for (i = 0; i < dstW; i++) { |
| 1504 | 145004544 | SUINT Y = (buf0[i]) >> 2; | |
| 1505 | 145004544 | SUINT U = (ubuf0[i] - (128 << 11)) >> 2; | |
| 1506 | 145004544 | SUINT V = (vbuf0[i] - (128 << 11)) >> 2; | |
| 1507 | int R, G, B; | ||
| 1508 | |||
| 1509 | 145004544 | Y -= c->yuv2rgb_y_offset; | |
| 1510 | 145004544 | Y *= c->yuv2rgb_y_coeff; | |
| 1511 | 145004544 | Y += (1 << 13) - (1 << 29); | |
| 1512 | |||
| 1513 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 145004544 times.
|
145004544 | if (hasAlpha) { |
| 1514 | ✗ | A = abuf0[i] * (1 << 11); | |
| 1515 | |||
| 1516 | ✗ | A += 1 << 13; | |
| 1517 | } | ||
| 1518 | |||
| 1519 | 145004544 | R = V * c->yuv2rgb_v2r_coeff; | |
| 1520 | 145004544 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1521 | 145004544 | B = U * c->yuv2rgb_u2b_coeff; | |
| 1522 | |||
| 1523 |
7/18✗ Branch 0 not taken.
✓ Branch 1 taken 145004544 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 27648 times.
✓ Branch 11 taken 144976896 times.
✓ Branch 12 taken 27648 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 18432 times.
✓ Branch 15 taken 9216 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 18432 times.
|
145004544 | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)); |
| 1524 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 145004544 times.
|
145004544 | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y) >> 14) + (1<<15), 16)); |
| 1525 |
7/18✗ Branch 0 not taken.
✓ Branch 1 taken 145004544 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 27648 times.
✓ Branch 11 taken 144976896 times.
✓ Branch 12 taken 27648 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 18432 times.
✓ Branch 15 taken 9216 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 18432 times.
|
145004544 | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)); |
| 1526 |
2/2✓ Branch 0 taken 18432 times.
✓ Branch 1 taken 144986112 times.
|
145004544 | if (eightbytes) { |
| 1527 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18432 times.
|
18432 | output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); |
| 1528 | 18432 | dest += 4; | |
| 1529 | } else { | ||
| 1530 | 144986112 | dest += 3; | |
| 1531 | } | ||
| 1532 | } | ||
| 1533 | } else { | ||
| 1534 | ✗ | const int32_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 1535 | ✗ | unsigned uvalpha1 = 4096 - uvalpha; | |
| 1536 | ✗ | int A = 0xffff<<14; | |
| 1537 | av_assert2(uvalpha <= 4096U); | ||
| 1538 | |||
| 1539 | ✗ | for (i = 0; i < dstW; i++) { | |
| 1540 | ✗ | SUINT Y = (buf0[i] ) >> 2; | |
| 1541 | ✗ | SUINT U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1542 | ✗ | SUINT V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 23)) >> 14; | |
| 1543 | int R, G, B; | ||
| 1544 | |||
| 1545 | ✗ | Y -= c->yuv2rgb_y_offset; | |
| 1546 | ✗ | Y *= c->yuv2rgb_y_coeff; | |
| 1547 | ✗ | Y += (1 << 13) - (1 << 29); | |
| 1548 | |||
| 1549 | ✗ | if (hasAlpha) { | |
| 1550 | ✗ | A = abuf0[i] * (1 << 11); | |
| 1551 | |||
| 1552 | ✗ | A += 1 << 13; | |
| 1553 | } | ||
| 1554 | |||
| 1555 | ✗ | R = V * c->yuv2rgb_v2r_coeff; | |
| 1556 | ✗ | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 1557 | ✗ | B = U * c->yuv2rgb_u2b_coeff; | |
| 1558 | |||
| 1559 | ✗ | output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y) >> 14) + (1<<15), 16)); | |
| 1560 | ✗ | output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y) >> 14) + (1<<15), 16)); | |
| 1561 | ✗ | output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y) >> 14) + (1<<15), 16)); | |
| 1562 | ✗ | if (eightbytes) { | |
| 1563 | ✗ | output_pixel(&dest[3], av_clip_uintp2(A, 30) >> 14); | |
| 1564 | ✗ | dest += 4; | |
| 1565 | } else { | ||
| 1566 | ✗ | dest += 3; | |
| 1567 | } | ||
| 1568 | } | ||
| 1569 | } | ||
| 1570 | 412224 | } | |
| 1571 | |||
| 1572 | #undef output_pixel | ||
| 1573 | #undef r_b | ||
| 1574 | #undef b_r | ||
| 1575 | |||
| 1576 | #define YUV2PACKED16WRAPPER_EXT(name, base, ext, fmt, is_be, hasAlpha, eightbytes) \ | ||
| 1577 | static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 1578 | const int16_t **_lumSrc, int lumFilterSize, \ | ||
| 1579 | const int16_t *chrFilter, const int16_t **_chrUSrc, \ | ||
| 1580 | const int16_t **_chrVSrc, int chrFilterSize, \ | ||
| 1581 | const int16_t **_alpSrc, uint8_t *_dest, int dstW, \ | ||
| 1582 | int y) \ | ||
| 1583 | { \ | ||
| 1584 | const int32_t **lumSrc = (const int32_t **) _lumSrc, \ | ||
| 1585 | **chrUSrc = (const int32_t **) _chrUSrc, \ | ||
| 1586 | **chrVSrc = (const int32_t **) _chrVSrc, \ | ||
| 1587 | **alpSrc = (const int32_t **) _alpSrc; \ | ||
| 1588 | uint16_t *dest = (uint16_t *) _dest; \ | ||
| 1589 | name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 1590 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 1591 | alpSrc, dest, dstW, y, fmt, hasAlpha, eightbytes, is_be); \ | ||
| 1592 | } \ | ||
| 1593 | \ | ||
| 1594 | static void name ## ext ## _2_c(SwsInternal *c, const int16_t *_buf[2], \ | ||
| 1595 | const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ | ||
| 1596 | const int16_t *_abuf[2], uint8_t *_dest, int dstW, \ | ||
| 1597 | int yalpha, int uvalpha, int y) \ | ||
| 1598 | { \ | ||
| 1599 | const int32_t **buf = (const int32_t **) _buf, \ | ||
| 1600 | **ubuf = (const int32_t **) _ubuf, \ | ||
| 1601 | **vbuf = (const int32_t **) _vbuf, \ | ||
| 1602 | **abuf = (const int32_t **) _abuf; \ | ||
| 1603 | uint16_t *dest = (uint16_t *) _dest; \ | ||
| 1604 | name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ | ||
| 1605 | dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \ | ||
| 1606 | } \ | ||
| 1607 | \ | ||
| 1608 | static void name ## ext ## _1_c(SwsInternal *c, const int16_t *_buf0, \ | ||
| 1609 | const int16_t *_ubuf[2], const int16_t *_vbuf[2], \ | ||
| 1610 | const int16_t *_abuf0, uint8_t *_dest, int dstW, \ | ||
| 1611 | int uvalpha, int y) \ | ||
| 1612 | { \ | ||
| 1613 | const int32_t *buf0 = (const int32_t *) _buf0, \ | ||
| 1614 | **ubuf = (const int32_t **) _ubuf, \ | ||
| 1615 | **vbuf = (const int32_t **) _vbuf, \ | ||
| 1616 | *abuf0 = (const int32_t *) _abuf0; \ | ||
| 1617 | uint16_t *dest = (uint16_t *) _dest; \ | ||
| 1618 | name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ | ||
| 1619 | dstW, uvalpha, y, fmt, hasAlpha, eightbytes, is_be); \ | ||
| 1620 | } | ||
| 1621 | #define YUV2PACKED16WRAPPER(name, base, ext, base_fmt, endianness, hasAlpha, eightbytes) \ | ||
| 1622 | YUV2PACKED16WRAPPER_EXT(name, base, ext, base_fmt ## endianness, IS_BE(endianness), hasAlpha, eightbytes) | ||
| 1623 | |||
| 1624 | 53024 | YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48be, AV_PIX_FMT_RGB48, BE, 0, 0) | |
| 1625 | 838024 | YUV2PACKED16WRAPPER(yuv2, rgba64, rgb48le, AV_PIX_FMT_RGB48, LE, 0, 0) | |
| 1626 | 18464 | YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48be, AV_PIX_FMT_BGR48, BE, 0, 0) | |
| 1627 | 19616 | YUV2PACKED16WRAPPER(yuv2, rgba64, bgr48le, AV_PIX_FMT_BGR48, LE, 0, 0) | |
| 1628 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64be, AV_PIX_FMT_RGBA64, BE, 1, 1) | |
| 1629 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64, rgba64le, AV_PIX_FMT_RGBA64, LE, 1, 1) | |
| 1630 | 18464 | YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64be, AV_PIX_FMT_RGBA64, BE, 0, 1) | |
| 1631 | 29984 | YUV2PACKED16WRAPPER(yuv2, rgba64, rgbx64le, AV_PIX_FMT_RGBA64, LE, 0, 1) | |
| 1632 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64be, AV_PIX_FMT_BGRA64, BE, 1, 1) | |
| 1633 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64, bgra64le, AV_PIX_FMT_BGRA64, LE, 1, 1) | |
| 1634 | 18464 | YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64be, AV_PIX_FMT_BGRA64, BE, 0, 1) | |
| 1635 | 18464 | YUV2PACKED16WRAPPER(yuv2, rgba64, bgrx64le, AV_PIX_FMT_BGRA64, LE, 0, 1) | |
| 1636 | 18832 | YUV2PACKED16WRAPPER(yuv2, ya16, ya16be, AV_PIX_FMT_YA16, BE, 1, 0) | |
| 1637 | 19984 | YUV2PACKED16WRAPPER(yuv2, ya16, ya16le, AV_PIX_FMT_YA16, LE, 1, 0) | |
| 1638 | |||
| 1639 | 800 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48be_full, AV_PIX_FMT_RGB48, BE, 0, 0) | |
| 1640 | 824672 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgb48le_full, AV_PIX_FMT_RGB48, LE, 0, 0) | |
| 1641 | 400 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48be_full, AV_PIX_FMT_BGR48, BE, 0, 0) | |
| 1642 | 592 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgr48le_full, AV_PIX_FMT_BGR48, LE, 0, 0) | |
| 1643 | 400 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64be_full, AV_PIX_FMT_RGBA64, BE, 1, 1) | |
| 1644 | 400 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgba64le_full, AV_PIX_FMT_RGBA64, LE, 1, 1) | |
| 1645 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64be_full, AV_PIX_FMT_RGBA64, BE, 0, 1) | |
| 1646 | 192 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, rgbx64le_full, AV_PIX_FMT_RGBA64, LE, 0, 1) | |
| 1647 | 400 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64be_full, AV_PIX_FMT_BGRA64, BE, 1, 1) | |
| 1648 | 400 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgra64le_full, AV_PIX_FMT_BGRA64, LE, 1, 1) | |
| 1649 | ✗ | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64be_full, AV_PIX_FMT_BGRA64, BE, 0, 1) | |
| 1650 | 192 | YUV2PACKED16WRAPPER(yuv2, rgba64_full, bgrx64le_full, AV_PIX_FMT_BGRA64, LE, 0, 1) | |
| 1651 | |||
| 1652 | /* | ||
| 1653 | * Write out 2 RGB pixels in the target pixel format. This function takes a | ||
| 1654 | * R/G/B LUT as generated by ff_yuv2rgb_c_init_tables(), which takes care of | ||
| 1655 | * things like endianness conversion and shifting. The caller takes care of | ||
| 1656 | * setting the correct offset in these tables from the chroma (U/V) values. | ||
| 1657 | * This function then uses the luminance (Y1/Y2) values to write out the | ||
| 1658 | * correct RGB values into the destination buffer. | ||
| 1659 | */ | ||
| 1660 | static av_always_inline void | ||
| 1661 | 305484116 | yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, | |
| 1662 | unsigned A1, unsigned A2, | ||
| 1663 | const void *_r, const void *_g, const void *_b, int y, | ||
| 1664 | enum AVPixelFormat target, int hasAlpha) | ||
| 1665 | { | ||
| 1666 |
4/6✓ Branch 0 taken 305484116 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 305484116 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 297410196 times.
✓ Branch 5 taken 8073920 times.
|
305484116 | if (target == AV_PIX_FMT_ARGB || target == AV_PIX_FMT_RGBA || |
| 1667 |
2/2✓ Branch 0 taken 28552648 times.
✓ Branch 1 taken 268857548 times.
|
334036764 | target == AV_PIX_FMT_ABGR || target == AV_PIX_FMT_BGRA) { |
| 1668 | 36626568 | uint32_t *dest = (uint32_t *) _dest; | |
| 1669 | 36626568 | const uint32_t *r = (const uint32_t *) _r; | |
| 1670 | 36626568 | const uint32_t *g = (const uint32_t *) _g; | |
| 1671 | 36626568 | const uint32_t *b = (const uint32_t *) _b; | |
| 1672 | |||
| 1673 | #if CONFIG_SMALL | ||
| 1674 | int sh = hasAlpha ? ((target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24) : 0; | ||
| 1675 | |||
| 1676 | dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); | ||
| 1677 | dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); | ||
| 1678 | #else | ||
| 1679 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36626568 times.
|
36626568 | if (hasAlpha) { |
| 1680 | ✗ | int sh = (target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24; | |
| 1681 | |||
| 1682 | av_assert2((((r[Y1] + g[Y1] + b[Y1]) >> sh) & 0xFF) == 0); | ||
| 1683 | ✗ | dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); | |
| 1684 | ✗ | dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); | |
| 1685 | } else { | ||
| 1686 | #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 | ||
| 1687 | int sh = (target == AV_PIX_FMT_RGB32_1 || target == AV_PIX_FMT_BGR32_1) ? 0 : 24; | ||
| 1688 | |||
| 1689 | av_assert2((((r[Y1] + g[Y1] + b[Y1]) >> sh) & 0xFF) == 0xFF); | ||
| 1690 | #endif | ||
| 1691 | 36626568 | dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; | |
| 1692 | 36626568 | dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; | |
| 1693 | } | ||
| 1694 | #endif | ||
| 1695 |
4/4✓ Branch 0 taken 145099974 times.
✓ Branch 1 taken 123757574 times.
✓ Branch 2 taken 27320814 times.
✓ Branch 3 taken 117779160 times.
|
268857548 | } else if (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) { |
| 1696 | 151078388 | uint8_t *dest = (uint8_t *) _dest; | |
| 1697 | 151078388 | const uint8_t *r = (const uint8_t *) _r; | |
| 1698 | 151078388 | const uint8_t *g = (const uint8_t *) _g; | |
| 1699 | 151078388 | const uint8_t *b = (const uint8_t *) _b; | |
| 1700 | |||
| 1701 | #define r_b ((target == AV_PIX_FMT_RGB24) ? r : b) | ||
| 1702 | #define b_r ((target == AV_PIX_FMT_RGB24) ? b : r) | ||
| 1703 | |||
| 1704 |
2/2✓ Branch 0 taken 123757574 times.
✓ Branch 1 taken 27320814 times.
|
151078388 | dest[i * 6 + 0] = r_b[Y1]; |
| 1705 | 151078388 | dest[i * 6 + 1] = g[Y1]; | |
| 1706 |
2/2✓ Branch 0 taken 123757574 times.
✓ Branch 1 taken 27320814 times.
|
151078388 | dest[i * 6 + 2] = b_r[Y1]; |
| 1707 |
2/2✓ Branch 0 taken 123757574 times.
✓ Branch 1 taken 27320814 times.
|
151078388 | dest[i * 6 + 3] = r_b[Y2]; |
| 1708 | 151078388 | dest[i * 6 + 4] = g[Y2]; | |
| 1709 |
2/2✓ Branch 0 taken 123757574 times.
✓ Branch 1 taken 27320814 times.
|
151078388 | dest[i * 6 + 5] = b_r[Y2]; |
| 1710 | #undef r_b | ||
| 1711 | #undef b_r | ||
| 1712 |
5/6✓ Branch 0 taken 87849332 times.
✓ Branch 1 taken 29929828 times.
✓ Branch 2 taken 87849332 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 35052104 times.
✓ Branch 5 taken 52797228 times.
|
117779160 | } else if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565 || |
| 1713 |
3/4✓ Branch 0 taken 35052104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28467656 times.
✓ Branch 3 taken 6584448 times.
|
35052104 | target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555 || |
| 1714 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28467656 times.
|
28467656 | target == AV_PIX_FMT_RGB444 || target == AV_PIX_FMT_BGR444) { |
| 1715 | 89311504 | uint16_t *dest = (uint16_t *) _dest; | |
| 1716 | 89311504 | const uint16_t *r = (const uint16_t *) _r; | |
| 1717 | 89311504 | const uint16_t *g = (const uint16_t *) _g; | |
| 1718 | 89311504 | const uint16_t *b = (const uint16_t *) _b; | |
| 1719 | int dr1, dg1, db1, dr2, dg2, db2; | ||
| 1720 | |||
| 1721 |
3/4✓ Branch 0 taken 59381676 times.
✓ Branch 1 taken 29929828 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 59381676 times.
|
89311504 | if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565) { |
| 1722 | 29929828 | dr1 = ff_dither_2x2_8[ y & 1 ][0]; | |
| 1723 | 29929828 | dg1 = ff_dither_2x2_4[ y & 1 ][0]; | |
| 1724 | 29929828 | db1 = ff_dither_2x2_8[(y & 1) ^ 1][0]; | |
| 1725 | 29929828 | dr2 = ff_dither_2x2_8[ y & 1 ][1]; | |
| 1726 | 29929828 | dg2 = ff_dither_2x2_4[ y & 1 ][1]; | |
| 1727 | 29929828 | db2 = ff_dither_2x2_8[(y & 1) ^ 1][1]; | |
| 1728 |
3/4✓ Branch 0 taken 6584448 times.
✓ Branch 1 taken 52797228 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6584448 times.
|
59381676 | } else if (target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555) { |
| 1729 | 52797228 | dr1 = ff_dither_2x2_8[ y & 1 ][0]; | |
| 1730 | 52797228 | dg1 = ff_dither_2x2_8[ y & 1 ][1]; | |
| 1731 | 52797228 | db1 = ff_dither_2x2_8[(y & 1) ^ 1][0]; | |
| 1732 | 52797228 | dr2 = ff_dither_2x2_8[ y & 1 ][1]; | |
| 1733 | 52797228 | dg2 = ff_dither_2x2_8[ y & 1 ][0]; | |
| 1734 | 52797228 | db2 = ff_dither_2x2_8[(y & 1) ^ 1][1]; | |
| 1735 | } else { | ||
| 1736 | 6584448 | dr1 = ff_dither_4x4_16[ y & 3 ][0]; | |
| 1737 | 6584448 | dg1 = ff_dither_4x4_16[ y & 3 ][1]; | |
| 1738 | 6584448 | db1 = ff_dither_4x4_16[(y & 3) ^ 3][0]; | |
| 1739 | 6584448 | dr2 = ff_dither_4x4_16[ y & 3 ][1]; | |
| 1740 | 6584448 | dg2 = ff_dither_4x4_16[ y & 3 ][0]; | |
| 1741 | 6584448 | db2 = ff_dither_4x4_16[(y & 3) ^ 3][1]; | |
| 1742 | } | ||
| 1743 | |||
| 1744 | 89311504 | dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; | |
| 1745 | 89311504 | dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; | |
| 1746 |
4/4✓ Branch 0 taken 26845640 times.
✓ Branch 1 taken 1622016 times.
✓ Branch 2 taken 1622016 times.
✓ Branch 3 taken 25223624 times.
|
28467656 | } else if (target == AV_PIX_FMT_X2RGB10 || target == AV_PIX_FMT_X2BGR10) { |
| 1747 | 3244032 | uint32_t *dest = (uint32_t *) _dest; | |
| 1748 | 3244032 | const uint32_t *r = (const uint32_t *) _r; | |
| 1749 | 3244032 | const uint32_t *g = (const uint32_t *) _g; | |
| 1750 | 3244032 | const uint32_t *b = (const uint32_t *) _b; | |
| 1751 | 3244032 | dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; | |
| 1752 | 3244032 | dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; | |
| 1753 | } else /* 8/4 bits */ { | ||
| 1754 | 25223624 | uint8_t *dest = (uint8_t *) _dest; | |
| 1755 | 25223624 | const uint8_t *r = (const uint8_t *) _r; | |
| 1756 | 25223624 | const uint8_t *g = (const uint8_t *) _g; | |
| 1757 | 25223624 | const uint8_t *b = (const uint8_t *) _b; | |
| 1758 | int dr1, dg1, db1, dr2, dg2, db2; | ||
| 1759 | |||
| 1760 |
3/4✓ Branch 0 taken 3970048 times.
✓ Branch 1 taken 21253576 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3970048 times.
|
25223624 | if (target == AV_PIX_FMT_RGB8 || target == AV_PIX_FMT_BGR8) { |
| 1761 | 21253576 | const uint8_t * const d64 = ff_dither_8x8_73[y & 7]; | |
| 1762 | 21253576 | const uint8_t * const d32 = ff_dither_8x8_32[y & 7]; | |
| 1763 | 21253576 | dr1 = dg1 = d32[(i * 2 + 0) & 7]; | |
| 1764 | 21253576 | db1 = d64[(i * 2 + 0) & 7]; | |
| 1765 | 21253576 | dr2 = dg2 = d32[(i * 2 + 1) & 7]; | |
| 1766 | 21253576 | db2 = d64[(i * 2 + 1) & 7]; | |
| 1767 | } else { | ||
| 1768 | 3970048 | const uint8_t * const d64 = ff_dither_8x8_73 [y & 7]; | |
| 1769 | 3970048 | const uint8_t * const d128 = ff_dither_8x8_220[y & 7]; | |
| 1770 | 3970048 | dr1 = db1 = d128[(i * 2 + 0) & 7]; | |
| 1771 | 3970048 | dg1 = d64[(i * 2 + 0) & 7]; | |
| 1772 | 3970048 | dr2 = db2 = d128[(i * 2 + 1) & 7]; | |
| 1773 | 3970048 | dg2 = d64[(i * 2 + 1) & 7]; | |
| 1774 | } | ||
| 1775 | |||
| 1776 |
3/4✓ Branch 0 taken 25215432 times.
✓ Branch 1 taken 8192 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 25215432 times.
|
25223624 | if (target == AV_PIX_FMT_RGB4 || target == AV_PIX_FMT_BGR4) { |
| 1777 | 8192 | dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + | |
| 1778 | 8192 | ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); | |
| 1779 | } else { | ||
| 1780 | 25215432 | dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; | |
| 1781 | 25215432 | dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; | |
| 1782 | } | ||
| 1783 | } | ||
| 1784 | 305484116 | } | |
| 1785 | |||
| 1786 | static av_always_inline void | ||
| 1787 | 1306356 | yuv2rgb_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 1788 | const int16_t **lumSrc, int lumFilterSize, | ||
| 1789 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 1790 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 1791 | const int16_t **alpSrc, uint8_t *dest, int dstW, | ||
| 1792 | int y, enum AVPixelFormat target, int hasAlpha) | ||
| 1793 | { | ||
| 1794 | int i; | ||
| 1795 | |||
| 1796 |
2/2✓ Branch 0 taken 224527016 times.
✓ Branch 1 taken 1306356 times.
|
225833372 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1797 | int j, A1, A2; | ||
| 1798 | 224527016 | int Y1 = 1 << 18; | |
| 1799 | 224527016 | int Y2 = 1 << 18; | |
| 1800 | 224527016 | int U = 1 << 18; | |
| 1801 | 224527016 | int V = 1 << 18; | |
| 1802 | const void *r, *g, *b; | ||
| 1803 | |||
| 1804 |
2/2✓ Branch 0 taken 238955624 times.
✓ Branch 1 taken 224527016 times.
|
463482640 | for (j = 0; j < lumFilterSize; j++) { |
| 1805 | 238955624 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 1806 | 238955624 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 1807 | } | ||
| 1808 |
2/2✓ Branch 0 taken 902627744 times.
✓ Branch 1 taken 224527016 times.
|
1127154760 | for (j = 0; j < chrFilterSize; j++) { |
| 1809 | 902627744 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1810 | 902627744 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 1811 | } | ||
| 1812 | 224527016 | Y1 >>= 19; | |
| 1813 | 224527016 | Y2 >>= 19; | |
| 1814 | 224527016 | U >>= 19; | |
| 1815 | 224527016 | V >>= 19; | |
| 1816 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 224527016 times.
|
224527016 | if (hasAlpha) { |
| 1817 | ✗ | A1 = 1 << 18; | |
| 1818 | ✗ | A2 = 1 << 18; | |
| 1819 | ✗ | for (j = 0; j < lumFilterSize; j++) { | |
| 1820 | ✗ | A1 += alpSrc[j][i * 2 ] * (unsigned)lumFilter[j]; | |
| 1821 | ✗ | A2 += alpSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 1822 | } | ||
| 1823 | ✗ | A1 >>= 19; | |
| 1824 | ✗ | A2 >>= 19; | |
| 1825 | ✗ | if ((A1 | A2) & 0x100) { | |
| 1826 | ✗ | A1 = av_clip_uint8(A1); | |
| 1827 | ✗ | A2 = av_clip_uint8(A2); | |
| 1828 | } | ||
| 1829 | } | ||
| 1830 | |||
| 1831 | 224527016 | r = c->table_rV[V + YUVRGB_TABLE_HEADROOM]; | |
| 1832 | 224527016 | g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]); | |
| 1833 | 224527016 | b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; | |
| 1834 | |||
| 1835 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 224527016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 224527016 times.
|
224527016 | yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, |
| 1836 | r, g, b, y, target, hasAlpha); | ||
| 1837 | } | ||
| 1838 | 1306356 | } | |
| 1839 | |||
| 1840 | static av_always_inline void | ||
| 1841 | 144 | yuv2rgb_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 1842 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 1843 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 1844 | int yalpha, int uvalpha, int y, | ||
| 1845 | enum AVPixelFormat target, int hasAlpha) | ||
| 1846 | { | ||
| 1847 | 144 | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 1848 | 144 | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 1849 | 144 | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 1850 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
|
144 | *abuf0 = hasAlpha ? abuf[0] : NULL, |
| 1851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
|
144 | *abuf1 = hasAlpha ? abuf[1] : NULL; |
| 1852 | 144 | int yalpha1 = 4096 - yalpha; | |
| 1853 | 144 | int uvalpha1 = 4096 - uvalpha; | |
| 1854 | int i; | ||
| 1855 | av_assert2(yalpha <= 4096U); | ||
| 1856 | av_assert2(uvalpha <= 4096U); | ||
| 1857 | |||
| 1858 |
2/2✓ Branch 0 taken 36864 times.
✓ Branch 1 taken 144 times.
|
37008 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1859 | 36864 | int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19; | |
| 1860 | 36864 | int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 19; | |
| 1861 | 36864 | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; | |
| 1862 | 36864 | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; | |
| 1863 | int A1, A2; | ||
| 1864 | 36864 | const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], | |
| 1865 | 36864 | *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), | |
| 1866 | 36864 | *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; | |
| 1867 | |||
| 1868 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36864 times.
|
36864 | if (hasAlpha) { |
| 1869 | ✗ | A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 19; | |
| 1870 | ✗ | A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 19; | |
| 1871 | ✗ | A1 = av_clip_uint8(A1); | |
| 1872 | ✗ | A2 = av_clip_uint8(A2); | |
| 1873 | } | ||
| 1874 | |||
| 1875 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 36864 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36864 times.
|
36864 | yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, |
| 1876 | r, g, b, y, target, hasAlpha); | ||
| 1877 | } | ||
| 1878 | 144 | } | |
| 1879 | |||
| 1880 | static av_always_inline void | ||
| 1881 | 464316 | yuv2rgb_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 1882 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 1883 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 1884 | int uvalpha, int y, enum AVPixelFormat target, | ||
| 1885 | int hasAlpha) | ||
| 1886 | { | ||
| 1887 | 464316 | const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 1888 | int i; | ||
| 1889 | |||
| 1890 |
2/2✓ Branch 0 taken 464220 times.
✓ Branch 1 taken 96 times.
|
464316 | if (uvalpha == 0) { |
| 1891 |
2/2✓ Branch 0 taken 80895660 times.
✓ Branch 1 taken 464220 times.
|
81359880 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1892 | 80895660 | int Y1 = (buf0[i * 2 ] + 64) >> 7; | |
| 1893 | 80895660 | int Y2 = (buf0[i * 2 + 1] + 64) >> 7; | |
| 1894 | 80895660 | int U = (ubuf0[i] + 64) >> 7; | |
| 1895 | 80895660 | int V = (vbuf0[i] + 64) >> 7; | |
| 1896 | int A1, A2; | ||
| 1897 | 80895660 | const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], | |
| 1898 | 80895660 | *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), | |
| 1899 | 80895660 | *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; | |
| 1900 | |||
| 1901 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 80895660 times.
|
80895660 | if (hasAlpha) { |
| 1902 | ✗ | A1 = abuf0[i * 2 ] * 255 + 16384 >> 15; | |
| 1903 | ✗ | A2 = abuf0[i * 2 + 1] * 255 + 16384 >> 15; | |
| 1904 | ✗ | A1 = av_clip_uint8(A1); | |
| 1905 | ✗ | A2 = av_clip_uint8(A2); | |
| 1906 | } | ||
| 1907 | |||
| 1908 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 80895660 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 80895660 times.
|
80895660 | yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, |
| 1909 | r, g, b, y, target, hasAlpha); | ||
| 1910 | } | ||
| 1911 | } else { | ||
| 1912 | 96 | const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 1913 | 96 | int uvalpha1 = 4096 - uvalpha; | |
| 1914 | av_assert2(uvalpha <= 4096U); | ||
| 1915 | |||
| 1916 |
2/2✓ Branch 0 taken 24576 times.
✓ Branch 1 taken 96 times.
|
24672 | for (i = 0; i < ((dstW + 1) >> 1); i++) { |
| 1917 | 24576 | int Y1 = (buf0[i * 2 ] + 64) >> 7; | |
| 1918 | 24576 | int Y2 = (buf0[i * 2 + 1] + 64) >> 7; | |
| 1919 | 24576 | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (128 << 11)) >> 19; | |
| 1920 | 24576 | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha + (128 << 11)) >> 19; | |
| 1921 | int A1, A2; | ||
| 1922 | 24576 | const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], | |
| 1923 | 24576 | *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), | |
| 1924 | 24576 | *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; | |
| 1925 | |||
| 1926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24576 times.
|
24576 | if (hasAlpha) { |
| 1927 | ✗ | A1 = (abuf0[i * 2 ] + 64) >> 7; | |
| 1928 | ✗ | A2 = (abuf0[i * 2 + 1] + 64) >> 7; | |
| 1929 | ✗ | A1 = av_clip_uint8(A1); | |
| 1930 | ✗ | A2 = av_clip_uint8(A2); | |
| 1931 | } | ||
| 1932 | |||
| 1933 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 24576 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24576 times.
|
24576 | yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, |
| 1934 | r, g, b, y, target, hasAlpha); | ||
| 1935 | } | ||
| 1936 | } | ||
| 1937 | 464316 | } | |
| 1938 | |||
| 1939 | #define YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ | ||
| 1940 | static void name ## ext ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 1941 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 1942 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 1943 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 1944 | const int16_t **alpSrc, uint8_t *dest, int dstW, \ | ||
| 1945 | int y) \ | ||
| 1946 | { \ | ||
| 1947 | name ## base ## _X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 1948 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 1949 | alpSrc, dest, dstW, y, fmt, hasAlpha); \ | ||
| 1950 | } | ||
| 1951 | |||
| 1952 | #define YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ | ||
| 1953 | YUV2RGBWRAPPERX(name, base, ext, fmt, hasAlpha) \ | ||
| 1954 | static void name ## ext ## _2_c(SwsInternal *c, const int16_t *buf[2], \ | ||
| 1955 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 1956 | const int16_t *abuf[2], uint8_t *dest, int dstW, \ | ||
| 1957 | int yalpha, int uvalpha, int y) \ | ||
| 1958 | { \ | ||
| 1959 | name ## base ## _2_c_template(c, buf, ubuf, vbuf, abuf, \ | ||
| 1960 | dest, dstW, yalpha, uvalpha, y, fmt, hasAlpha); \ | ||
| 1961 | } | ||
| 1962 | |||
| 1963 | #define YUV2RGBWRAPPER(name, base, ext, fmt, hasAlpha) \ | ||
| 1964 | YUV2RGBWRAPPERX2(name, base, ext, fmt, hasAlpha) \ | ||
| 1965 | static void name ## ext ## _1_c(SwsInternal *c, const int16_t *buf0, \ | ||
| 1966 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 1967 | const int16_t *abuf0, uint8_t *dest, int dstW, \ | ||
| 1968 | int uvalpha, int y) \ | ||
| 1969 | { \ | ||
| 1970 | name ## base ## _1_c_template(c, buf0, ubuf, vbuf, abuf0, dest, \ | ||
| 1971 | dstW, uvalpha, y, fmt, hasAlpha); \ | ||
| 1972 | } | ||
| 1973 | |||
| 1974 | #if CONFIG_SMALL | ||
| 1975 | YUV2RGBWRAPPER(yuv2rgb,, 32_1, AV_PIX_FMT_RGB32_1, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 1976 | YUV2RGBWRAPPER(yuv2rgb,, 32, AV_PIX_FMT_RGB32, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 1977 | #else | ||
| 1978 | #if CONFIG_SWSCALE_ALPHA | ||
| 1979 | ✗ | YUV2RGBWRAPPER(yuv2rgb,, a32_1, AV_PIX_FMT_RGB32_1, 1) | |
| 1980 | ✗ | YUV2RGBWRAPPER(yuv2rgb,, a32, AV_PIX_FMT_RGB32, 1) | |
| 1981 | #endif | ||
| 1982 | 97120 | YUV2RGBWRAPPER(yuv2rgb,, x32_1, AV_PIX_FMT_RGB32_1, 0) | |
| 1983 | 330576 | YUV2RGBWRAPPER(yuv2rgb,, x32, AV_PIX_FMT_RGB32, 0) | |
| 1984 | #endif | ||
| 1985 | 1435628 | YUV2RGBWRAPPER(yuv2, rgb, rgb24, AV_PIX_FMT_RGB24, 0) | |
| 1986 | 319668 | YUV2RGBWRAPPER(yuv2, rgb, bgr24, AV_PIX_FMT_BGR24, 0) | |
| 1987 | 343816 | YUV2RGBWRAPPER(yuv2rgb,, 16, AV_PIX_FMT_RGB565, 0) | |
| 1988 | 609816 | YUV2RGBWRAPPER(yuv2rgb,, 15, AV_PIX_FMT_RGB555, 0) | |
| 1989 | 75456 | YUV2RGBWRAPPER(yuv2rgb,, 12, AV_PIX_FMT_RGB444, 0) | |
| 1990 | 247632 | YUV2RGBWRAPPER(yuv2rgb,, 8, AV_PIX_FMT_RGB8, 0) | |
| 1991 | 64 | YUV2RGBWRAPPER(yuv2rgb,, 4, AV_PIX_FMT_RGB4, 0) | |
| 1992 | 44992 | YUV2RGBWRAPPER(yuv2rgb,, 4b, AV_PIX_FMT_RGB4_BYTE, 0) | |
| 1993 | 18432 | YUV2RGBWRAPPER(yuv2, rgb, x2rgb10, AV_PIX_FMT_X2RGB10, 0) | |
| 1994 | 18432 | YUV2RGBWRAPPER(yuv2, rgb, x2bgr10, AV_PIX_FMT_X2BGR10, 0) | |
| 1995 | |||
| 1996 | 348370372 | static av_always_inline void yuv2rgb_write_full(SwsInternal *c, | |
| 1997 | uint8_t *dest, int i, int Y, int A, int U, int V, | ||
| 1998 | int y, enum AVPixelFormat target, int hasAlpha, int err[4]) | ||
| 1999 | { | ||
| 2000 | int R, G, B; | ||
| 2001 |
4/4✓ Branch 0 taken 331997578 times.
✓ Branch 1 taken 16372794 times.
✓ Branch 2 taken 10720797 times.
✓ Branch 3 taken 321276781 times.
|
348370372 | int isrgb8 = target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8; |
| 2002 | |||
| 2003 | 348370372 | Y -= c->yuv2rgb_y_offset; | |
| 2004 | 348370372 | Y *= c->yuv2rgb_y_coeff; | |
| 2005 | 348370372 | Y += 1 << 21; | |
| 2006 | 348370372 | R = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2r_coeff; | |
| 2007 | 348370372 | G = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2g_coeff + U*(unsigned)c->yuv2rgb_u2g_coeff; | |
| 2008 | 348370372 | B = (unsigned)Y + U*(unsigned)c->yuv2rgb_u2b_coeff; | |
| 2009 |
2/2✓ Branch 0 taken 48158541 times.
✓ Branch 1 taken 300211831 times.
|
348370372 | if ((R | G | B) & 0xC0000000) { |
| 2010 | 48158541 | R = av_clip_uintp2(R, 30); | |
| 2011 | 48158541 | G = av_clip_uintp2(G, 30); | |
| 2012 | 48158541 | B = av_clip_uintp2(B, 30); | |
| 2013 | } | ||
| 2014 | |||
| 2015 |
9/10✓ Branch 0 taken 98432 times.
✓ Branch 1 taken 147656040 times.
✓ Branch 2 taken 98432 times.
✓ Branch 3 taken 98432 times.
✓ Branch 4 taken 54542884 times.
✓ Branch 5 taken 54885799 times.
✓ Branch 6 taken 23761984 times.
✓ Branch 7 taken 23761984 times.
✓ Branch 8 taken 43466385 times.
✗ Branch 9 not taken.
|
348370372 | switch(target) { |
| 2016 | 98432 | case AV_PIX_FMT_ARGB: | |
| 2017 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 18432 times.
|
98432 | dest[0] = hasAlpha ? A : 255; |
| 2018 | 98432 | dest[1] = R >> 22; | |
| 2019 | 98432 | dest[2] = G >> 22; | |
| 2020 | 98432 | dest[3] = B >> 22; | |
| 2021 | 98432 | break; | |
| 2022 | 147656040 | case AV_PIX_FMT_RGB24: | |
| 2023 | 147656040 | dest[0] = R >> 22; | |
| 2024 | 147656040 | dest[1] = G >> 22; | |
| 2025 | 147656040 | dest[2] = B >> 22; | |
| 2026 | 147656040 | break; | |
| 2027 | 98432 | case AV_PIX_FMT_RGBA: | |
| 2028 | 98432 | dest[0] = R >> 22; | |
| 2029 | 98432 | dest[1] = G >> 22; | |
| 2030 | 98432 | dest[2] = B >> 22; | |
| 2031 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 18432 times.
|
98432 | dest[3] = hasAlpha ? A : 255; |
| 2032 | 98432 | break; | |
| 2033 | 98432 | case AV_PIX_FMT_ABGR: | |
| 2034 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 18432 times.
|
98432 | dest[0] = hasAlpha ? A : 255; |
| 2035 | 98432 | dest[1] = B >> 22; | |
| 2036 | 98432 | dest[2] = G >> 22; | |
| 2037 | 98432 | dest[3] = R >> 22; | |
| 2038 | 98432 | break; | |
| 2039 | 54542884 | case AV_PIX_FMT_BGR24: | |
| 2040 | 54542884 | dest[0] = B >> 22; | |
| 2041 | 54542884 | dest[1] = G >> 22; | |
| 2042 | 54542884 | dest[2] = R >> 22; | |
| 2043 | 54542884 | break; | |
| 2044 | 54885799 | case AV_PIX_FMT_BGRA: | |
| 2045 | 54885799 | dest[0] = B >> 22; | |
| 2046 | 54885799 | dest[1] = G >> 22; | |
| 2047 | 54885799 | dest[2] = R >> 22; | |
| 2048 |
2/2✓ Branch 0 taken 3972007 times.
✓ Branch 1 taken 50913792 times.
|
54885799 | dest[3] = hasAlpha ? A : 255; |
| 2049 | 54885799 | break; | |
| 2050 | 23761984 | case AV_PIX_FMT_X2RGB10LE: | |
| 2051 | 23761984 | R >>= 20; | |
| 2052 | 23761984 | G >>= 20; | |
| 2053 | 23761984 | B >>= 20; | |
| 2054 | 23761984 | AV_WL32(dest, (3U << 30) + (R << 20) + (G << 10) + B); | |
| 2055 | 23761984 | break; | |
| 2056 | 23761984 | case AV_PIX_FMT_X2BGR10LE: | |
| 2057 | 23761984 | R >>= 20; | |
| 2058 | 23761984 | G >>= 20; | |
| 2059 | 23761984 | B >>= 20; | |
| 2060 | 23761984 | AV_WL32(dest, (3U << 30) + (B << 20) + (G << 10) + R); | |
| 2061 | 23761984 | break; | |
| 2062 | 43466385 | case AV_PIX_FMT_BGR4_BYTE: | |
| 2063 | case AV_PIX_FMT_RGB4_BYTE: | ||
| 2064 | case AV_PIX_FMT_BGR8: | ||
| 2065 | case AV_PIX_FMT_RGB8: | ||
| 2066 | { | ||
| 2067 | int r,g,b; | ||
| 2068 | |||
| 2069 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 43466385 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
43466385 | switch (c->opts.dither) { |
| 2070 | ✗ | case SWS_DITHER_NONE: | |
| 2071 | ✗ | if (isrgb8) { | |
| 2072 | ✗ | r = av_clip_uintp2(R >> 27, 3); | |
| 2073 | ✗ | g = av_clip_uintp2(G >> 27, 3); | |
| 2074 | ✗ | b = av_clip_uintp2(B >> 28, 2); | |
| 2075 | } else { | ||
| 2076 | ✗ | r = av_clip_uintp2(R >> 29, 1); | |
| 2077 | ✗ | g = av_clip_uintp2(G >> 28, 2); | |
| 2078 | ✗ | b = av_clip_uintp2(B >> 29, 1); | |
| 2079 | } | ||
| 2080 | ✗ | break; | |
| 2081 | 43466385 | default: | |
| 2082 | case SWS_DITHER_AUTO: | ||
| 2083 | case SWS_DITHER_ED: | ||
| 2084 | 43466385 | R >>= 22; | |
| 2085 | 43466385 | G >>= 22; | |
| 2086 | 43466385 | B >>= 22; | |
| 2087 | 43466385 | 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; | |
| 2088 | 43466385 | 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; | |
| 2089 | 43466385 | 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; | |
| 2090 | 43466385 | c->dither_error[0][i] = err[0]; | |
| 2091 | 43466385 | c->dither_error[1][i] = err[1]; | |
| 2092 | 43466385 | c->dither_error[2][i] = err[2]; | |
| 2093 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | r = R >> (isrgb8 ? 5 : 7); |
| 2094 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | g = G >> (isrgb8 ? 5 : 6); |
| 2095 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | b = B >> (isrgb8 ? 6 : 7); |
| 2096 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | r = av_clip(r, 0, isrgb8 ? 7 : 1); |
| 2097 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | g = av_clip(g, 0, isrgb8 ? 7 : 3); |
| 2098 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | b = av_clip(b, 0, isrgb8 ? 3 : 1); |
| 2099 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | err[0] = R - r*(isrgb8 ? 36 : 255); |
| 2100 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | err[1] = G - g*(isrgb8 ? 36 : 85); |
| 2101 |
2/2✓ Branch 0 taken 27093591 times.
✓ Branch 1 taken 16372794 times.
|
43466385 | err[2] = B - b*(isrgb8 ? 85 : 255); |
| 2102 | 43466385 | break; | |
| 2103 | ✗ | case SWS_DITHER_A_DITHER: | |
| 2104 | ✗ | if (isrgb8) { | |
| 2105 | /* see http://pippin.gimp.org/a_dither/ for details/origin */ | ||
| 2106 | #define A_DITHER(u,v) (((((u)+((v)*236))*119)&0xff)) | ||
| 2107 | ✗ | r = (((R >> 19) + A_DITHER(i,y) -96)>>8); | |
| 2108 | ✗ | g = (((G >> 19) + A_DITHER(i + 17,y) - 96)>>8); | |
| 2109 | ✗ | b = (((B >> 20) + A_DITHER(i + 17*2,y) -96)>>8); | |
| 2110 | ✗ | r = av_clip_uintp2(r, 3); | |
| 2111 | ✗ | g = av_clip_uintp2(g, 3); | |
| 2112 | ✗ | b = av_clip_uintp2(b, 2); | |
| 2113 | } else { | ||
| 2114 | ✗ | r = (((R >> 21) + A_DITHER(i,y)-256)>>8); | |
| 2115 | ✗ | g = (((G >> 19) + A_DITHER(i + 17,y)-256)>>8); | |
| 2116 | ✗ | b = (((B >> 21) + A_DITHER(i + 17*2,y)-256)>>8); | |
| 2117 | ✗ | r = av_clip_uintp2(r, 1); | |
| 2118 | ✗ | g = av_clip_uintp2(g, 2); | |
| 2119 | ✗ | b = av_clip_uintp2(b, 1); | |
| 2120 | } | ||
| 2121 | ✗ | break; | |
| 2122 | ✗ | case SWS_DITHER_X_DITHER: | |
| 2123 | ✗ | if (isrgb8) { | |
| 2124 | /* see http://pippin.gimp.org/a_dither/ for details/origin */ | ||
| 2125 | #define X_DITHER(u,v) (((((u)^((v)*237))*181)&0x1ff)/2) | ||
| 2126 | ✗ | r = (((R >> 19) + X_DITHER(i,y) - 96)>>8); | |
| 2127 | ✗ | g = (((G >> 19) + X_DITHER(i + 17,y) - 96)>>8); | |
| 2128 | ✗ | b = (((B >> 20) + X_DITHER(i + 17*2,y) - 96)>>8); | |
| 2129 | ✗ | r = av_clip_uintp2(r, 3); | |
| 2130 | ✗ | g = av_clip_uintp2(g, 3); | |
| 2131 | ✗ | b = av_clip_uintp2(b, 2); | |
| 2132 | } else { | ||
| 2133 | ✗ | r = (((R >> 21) + X_DITHER(i,y)-256)>>8); | |
| 2134 | ✗ | g = (((G >> 19) + X_DITHER(i + 17,y)-256)>>8); | |
| 2135 | ✗ | b = (((B >> 21) + X_DITHER(i + 17*2,y)-256)>>8); | |
| 2136 | ✗ | r = av_clip_uintp2(r, 1); | |
| 2137 | ✗ | g = av_clip_uintp2(g, 2); | |
| 2138 | ✗ | b = av_clip_uintp2(b, 1); | |
| 2139 | } | ||
| 2140 | |||
| 2141 | ✗ | break; | |
| 2142 | } | ||
| 2143 | |||
| 2144 |
2/2✓ Branch 0 taken 8186397 times.
✓ Branch 1 taken 35279988 times.
|
43466385 | if(target == AV_PIX_FMT_BGR4_BYTE) { |
| 2145 | 8186397 | dest[0] = r + 2*g + 8*b; | |
| 2146 |
2/2✓ Branch 0 taken 8186397 times.
✓ Branch 1 taken 27093591 times.
|
35279988 | } else if(target == AV_PIX_FMT_RGB4_BYTE) { |
| 2147 | 8186397 | dest[0] = b + 2*g + 8*r; | |
| 2148 |
2/2✓ Branch 0 taken 16372794 times.
✓ Branch 1 taken 10720797 times.
|
27093591 | } else if(target == AV_PIX_FMT_BGR8) { |
| 2149 | 16372794 | dest[0] = r + 8*g + 64*b; | |
| 2150 |
1/2✓ Branch 0 taken 10720797 times.
✗ Branch 1 not taken.
|
10720797 | } else if(target == AV_PIX_FMT_RGB8) { |
| 2151 | 10720797 | dest[0] = b + 4*g + 32*r; | |
| 2152 | } else | ||
| 2153 | av_assert2(0); | ||
| 2154 | 43466385 | break;} | |
| 2155 | } | ||
| 2156 | 348370372 | } | |
| 2157 | |||
| 2158 | static av_always_inline void | ||
| 2159 | 12235 | yuv2rgb_full_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 2160 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2161 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2162 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2163 | const int16_t **alpSrc, uint8_t *dest, | ||
| 2164 | int dstW, int y, enum AVPixelFormat target, int hasAlpha) | ||
| 2165 | { | ||
| 2166 | int i; | ||
| 2167 |
4/4✓ Branch 0 taken 10423 times.
✓ Branch 1 taken 1812 times.
✓ Branch 2 taken 822 times.
✓ Branch 3 taken 9601 times.
|
12235 | int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4; |
| 2168 | 12235 | int err[4] = {0}; | |
| 2169 | 12235 | int A = 0; //init to silence warning | |
| 2170 | |||
| 2171 |
4/4✓ Branch 0 taken 12035 times.
✓ Branch 1 taken 200 times.
✓ Branch 2 taken 11835 times.
✓ Branch 3 taken 200 times.
|
12235 | if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE |
| 2172 |
4/4✓ Branch 0 taken 11435 times.
✓ Branch 1 taken 400 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 11235 times.
|
11835 | || target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8) |
| 2173 | 1000 | step = 1; | |
| 2174 | |||
| 2175 |
2/2✓ Branch 0 taken 5205275 times.
✓ Branch 1 taken 12235 times.
|
5217510 | for (i = 0; i < dstW; i++) { |
| 2176 | int j; | ||
| 2177 | 5205275 | int Y = 1<<9; | |
| 2178 | 5205275 | int U = (1<<9)-(128 << 19); | |
| 2179 | 5205275 | int V = (1<<9)-(128 << 19); | |
| 2180 | |||
| 2181 |
2/2✓ Branch 0 taken 25219196 times.
✓ Branch 1 taken 5205275 times.
|
30424471 | for (j = 0; j < lumFilterSize; j++) { |
| 2182 | 25219196 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2183 | } | ||
| 2184 |
2/2✓ Branch 0 taken 26678900 times.
✓ Branch 1 taken 5205275 times.
|
31884175 | for (j = 0; j < chrFilterSize; j++) { |
| 2185 | 26678900 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2186 | 26678900 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2187 | } | ||
| 2188 | 5205275 | Y >>= 10; | |
| 2189 | 5205275 | U >>= 10; | |
| 2190 | 5205275 | V >>= 10; | |
| 2191 |
2/2✓ Branch 0 taken 4212007 times.
✓ Branch 1 taken 993268 times.
|
5205275 | if (hasAlpha) { |
| 2192 | 4212007 | A = 1 << 18; | |
| 2193 |
2/2✓ Branch 0 taken 19408028 times.
✓ Branch 1 taken 4212007 times.
|
23620035 | for (j = 0; j < lumFilterSize; j++) { |
| 2194 | 19408028 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2195 | } | ||
| 2196 | 4212007 | A >>= 19; | |
| 2197 |
1/2✓ Branch 0 taken 4212007 times.
✗ Branch 1 not taken.
|
4212007 | if (A & 0x100) |
| 2198 | 4212007 | A = av_clip_uint8(A); | |
| 2199 | } | ||
| 2200 | 5205275 | yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); | |
| 2201 | 5205275 | dest += step; | |
| 2202 | } | ||
| 2203 | 12235 | c->dither_error[0][i] = err[0]; | |
| 2204 | 12235 | c->dither_error[1][i] = err[1]; | |
| 2205 | 12235 | c->dither_error[2][i] = err[2]; | |
| 2206 | 12235 | } | |
| 2207 | |||
| 2208 | static av_always_inline void | ||
| 2209 | ✗ | yuv2rgb_full_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 2210 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2211 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 2212 | int yalpha, int uvalpha, int y, | ||
| 2213 | enum AVPixelFormat target, int hasAlpha) | ||
| 2214 | { | ||
| 2215 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 2216 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 2217 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 2218 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 2219 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 2220 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 2221 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 2222 | int i; | ||
| 2223 | ✗ | int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4; | |
| 2224 | ✗ | int err[4] = {0}; | |
| 2225 | ✗ | int A = 0; // init to silcene warning | |
| 2226 | |||
| 2227 | av_assert2(yalpha <= 4096U); | ||
| 2228 | av_assert2(uvalpha <= 4096U); | ||
| 2229 | |||
| 2230 | ✗ | if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE | |
| 2231 | ✗ | || target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8) | |
| 2232 | ✗ | step = 1; | |
| 2233 | |||
| 2234 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2235 | ✗ | int Y = ( buf0[i] * yalpha1 + buf1[i] * yalpha ) >> 10; //FIXME rounding | |
| 2236 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha-(128 << 19)) >> 10; | |
| 2237 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha-(128 << 19)) >> 10; | |
| 2238 | |||
| 2239 | ✗ | if (hasAlpha) { | |
| 2240 | ✗ | A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha + (1<<18)) >> 19; | |
| 2241 | ✗ | if (A & 0x100) | |
| 2242 | ✗ | A = av_clip_uint8(A); | |
| 2243 | } | ||
| 2244 | |||
| 2245 | ✗ | yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); | |
| 2246 | ✗ | dest += step; | |
| 2247 | } | ||
| 2248 | ✗ | c->dither_error[0][i] = err[0]; | |
| 2249 | ✗ | c->dither_error[1][i] = err[1]; | |
| 2250 | ✗ | c->dither_error[2][i] = err[2]; | |
| 2251 | ✗ | } | |
| 2252 | |||
| 2253 | static av_always_inline void | ||
| 2254 | 1059981 | yuv2rgb_full_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 2255 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2256 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 2257 | int uvalpha, int y, enum AVPixelFormat target, | ||
| 2258 | int hasAlpha) | ||
| 2259 | { | ||
| 2260 | 1059981 | const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; | |
| 2261 | int i; | ||
| 2262 |
4/4✓ Branch 0 taken 639305 times.
✓ Branch 1 taken 420676 times.
✓ Branch 2 taken 157288 times.
✓ Branch 3 taken 482017 times.
|
1059981 | int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4; |
| 2263 | 1059981 | int err[4] = {0}; | |
| 2264 | |||
| 2265 |
4/4✓ Branch 0 taken 1022440 times.
✓ Branch 1 taken 37541 times.
✓ Branch 2 taken 984899 times.
✓ Branch 3 taken 37541 times.
|
1059981 | if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE |
| 2266 |
4/4✓ Branch 0 taken 909817 times.
✓ Branch 1 taken 75082 times.
✓ Branch 2 taken 44741 times.
✓ Branch 3 taken 865076 times.
|
984899 | || target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8) |
| 2267 | 194905 | step = 1; | |
| 2268 | |||
| 2269 |
1/2✓ Branch 0 taken 1059981 times.
✗ Branch 1 not taken.
|
1059981 | if (uvalpha == 0) { |
| 2270 | 1059981 | int A = 0; //init to silence warning | |
| 2271 |
2/2✓ Branch 0 taken 343165097 times.
✓ Branch 1 taken 1059981 times.
|
344225078 | for (i = 0; i < dstW; i++) { |
| 2272 | 343165097 | int Y = buf0[i] * 4; | |
| 2273 | 343165097 | int U = (ubuf0[i] - (128<<7)) * 4; | |
| 2274 | 343165097 | int V = (vbuf0[i] - (128<<7)) * 4; | |
| 2275 | |||
| 2276 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 343165097 times.
|
343165097 | if (hasAlpha) { |
| 2277 | ✗ | A = (abuf0[i] + 64) >> 7; | |
| 2278 | ✗ | if (A & 0x100) | |
| 2279 | ✗ | A = av_clip_uint8(A); | |
| 2280 | } | ||
| 2281 | |||
| 2282 | 343165097 | yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); | |
| 2283 | 343165097 | dest += step; | |
| 2284 | } | ||
| 2285 | } else { | ||
| 2286 | ✗ | const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; | |
| 2287 | ✗ | int A = 0; //init to silence warning | |
| 2288 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 2289 | av_assert2(uvalpha <= 4096U); | ||
| 2290 | |||
| 2291 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2292 | ✗ | int Y = buf0[i] * 4; | |
| 2293 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 19)) >> 10; | |
| 2294 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha - (128 << 19)) >> 10; | |
| 2295 | |||
| 2296 | ✗ | if (hasAlpha) { | |
| 2297 | ✗ | A = (abuf0[i] + 64) >> 7; | |
| 2298 | ✗ | if (A & 0x100) | |
| 2299 | ✗ | A = av_clip_uint8(A); | |
| 2300 | } | ||
| 2301 | |||
| 2302 | ✗ | yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err); | |
| 2303 | ✗ | dest += step; | |
| 2304 | } | ||
| 2305 | } | ||
| 2306 | |||
| 2307 | 1059981 | c->dither_error[0][i] = err[0]; | |
| 2308 | 1059981 | c->dither_error[1][i] = err[1]; | |
| 2309 | 1059981 | c->dither_error[2][i] = err[2]; | |
| 2310 | 1059981 | } | |
| 2311 | |||
| 2312 | #if CONFIG_SMALL | ||
| 2313 | YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2314 | YUV2RGBWRAPPER(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2315 | YUV2RGBWRAPPER(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2316 | YUV2RGBWRAPPER(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB, CONFIG_SWSCALE_ALPHA && c->needAlpha) | ||
| 2317 | #else | ||
| 2318 | #if CONFIG_SWSCALE_ALPHA | ||
| 2319 | 14002 | YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA, 1) | |
| 2320 | 800 | YUV2RGBWRAPPER(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR, 1) | |
| 2321 | 800 | YUV2RGBWRAPPER(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA, 1) | |
| 2322 | 800 | YUV2RGBWRAPPER(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB, 1) | |
| 2323 | #endif | ||
| 2324 | 303504 | YUV2RGBWRAPPER(yuv2, rgb_full, bgrx32_full, AV_PIX_FMT_BGRA, 0) | |
| 2325 | 384 | YUV2RGBWRAPPER(yuv2, rgb_full, xbgr32_full, AV_PIX_FMT_ABGR, 0) | |
| 2326 | 384 | YUV2RGBWRAPPER(yuv2, rgb_full, rgbx32_full, AV_PIX_FMT_RGBA, 0) | |
| 2327 | 384 | YUV2RGBWRAPPER(yuv2, rgb_full, xrgb32_full, AV_PIX_FMT_ARGB, 0) | |
| 2328 | #endif | ||
| 2329 | 316220 | YUV2RGBWRAPPER(yuv2, rgb_full, bgr24_full, AV_PIX_FMT_BGR24, 0) | |
| 2330 | 844976 | YUV2RGBWRAPPER(yuv2, rgb_full, rgb24_full, AV_PIX_FMT_RGB24, 0) | |
| 2331 | |||
| 2332 | 75482 | YUV2RGBWRAPPER(yuv2, rgb_full, bgr4_byte_full, AV_PIX_FMT_BGR4_BYTE, 0) | |
| 2333 | 75482 | YUV2RGBWRAPPER(yuv2, rgb_full, rgb4_byte_full, AV_PIX_FMT_RGB4_BYTE, 0) | |
| 2334 | 150964 | YUV2RGBWRAPPER(yuv2, rgb_full, bgr8_full, AV_PIX_FMT_BGR8, 0) | |
| 2335 | 89882 | YUV2RGBWRAPPER(yuv2, rgb_full, rgb8_full, AV_PIX_FMT_RGB8, 0) | |
| 2336 | |||
| 2337 | 135184 | YUV2RGBWRAPPER(yuv2, rgb_full, x2rgb10_full, AV_PIX_FMT_X2RGB10LE, 0) | |
| 2338 | 135184 | YUV2RGBWRAPPER(yuv2, rgb_full, x2bgr10_full, AV_PIX_FMT_X2BGR10LE, 0) | |
| 2339 | |||
| 2340 | static void | ||
| 2341 | 2617608 | yuv2gbrp_full_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2342 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2343 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2344 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2345 | const int16_t **alpSrc, uint8_t **dest, | ||
| 2346 | int dstW, int y) | ||
| 2347 | { | ||
| 2348 | 2617608 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2349 | int i; | ||
| 2350 |
4/4✓ Branch 0 taken 123878 times.
✓ Branch 1 taken 2493730 times.
✓ Branch 2 taken 1760 times.
✓ Branch 3 taken 122118 times.
|
2617608 | int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc; |
| 2351 | 2617608 | uint16_t **dest16 = (uint16_t**)dest; | |
| 2352 | 2617608 | int SH = 22 + 8 - desc->comp[0].depth; | |
| 2353 | 2617608 | int A = 0; // init to silence warning | |
| 2354 | |||
| 2355 |
2/2✓ Branch 0 taken 919480848 times.
✓ Branch 1 taken 2617608 times.
|
922098456 | for (i = 0; i < dstW; i++) { |
| 2356 | int j; | ||
| 2357 | 919480848 | int Y = 1 << 9; | |
| 2358 | 919480848 | int U = (1 << 9) - (128 << 19); | |
| 2359 | 919480848 | int V = (1 << 9) - (128 << 19); | |
| 2360 | int R, G, B; | ||
| 2361 | |||
| 2362 |
2/2✓ Branch 0 taken 929406448 times.
✓ Branch 1 taken 919480848 times.
|
1848887296 | for (j = 0; j < lumFilterSize; j++) |
| 2363 | 929406448 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2364 | |||
| 2365 |
2/2✓ Branch 0 taken 1874678944 times.
✓ Branch 1 taken 919480848 times.
|
2794159792 | for (j = 0; j < chrFilterSize; j++) { |
| 2366 | 1874678944 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2367 | 1874678944 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2368 | } | ||
| 2369 | |||
| 2370 | 919480848 | Y >>= 10; | |
| 2371 | 919480848 | U >>= 10; | |
| 2372 | 919480848 | V >>= 10; | |
| 2373 | |||
| 2374 |
2/2✓ Branch 0 taken 344320 times.
✓ Branch 1 taken 919136528 times.
|
919480848 | if (hasAlpha) { |
| 2375 | 344320 | A = 1 << 18; | |
| 2376 | |||
| 2377 |
2/2✓ Branch 0 taken 3826320 times.
✓ Branch 1 taken 344320 times.
|
4170640 | for (j = 0; j < lumFilterSize; j++) |
| 2378 | 3826320 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2379 | |||
| 2380 |
2/2✓ Branch 0 taken 299670 times.
✓ Branch 1 taken 44650 times.
|
344320 | if (A & 0xF8000000) |
| 2381 | 299670 | A = av_clip_uintp2(A, 27); | |
| 2382 | } | ||
| 2383 | |||
| 2384 | 919480848 | Y -= c->yuv2rgb_y_offset; | |
| 2385 | 919480848 | Y *= c->yuv2rgb_y_coeff; | |
| 2386 | 919480848 | Y += 1 << (SH-1); | |
| 2387 | 919480848 | R = Y + V * (unsigned)c->yuv2rgb_v2r_coeff; | |
| 2388 | 919480848 | G = Y + V * (unsigned)c->yuv2rgb_v2g_coeff + U * (unsigned)c->yuv2rgb_u2g_coeff; | |
| 2389 | 919480848 | B = Y + U * (unsigned)c->yuv2rgb_u2b_coeff; | |
| 2390 | |||
| 2391 |
2/2✓ Branch 0 taken 281373782 times.
✓ Branch 1 taken 638107066 times.
|
919480848 | if ((R | G | B) & 0xC0000000) { |
| 2392 | 281373782 | R = av_clip_uintp2(R, 30); | |
| 2393 | 281373782 | G = av_clip_uintp2(G, 30); | |
| 2394 | 281373782 | B = av_clip_uintp2(B, 30); | |
| 2395 | } | ||
| 2396 | |||
| 2397 |
2/2✓ Branch 0 taken 638664592 times.
✓ Branch 1 taken 280816256 times.
|
919480848 | if (SH != 22) { |
| 2398 | 638664592 | dest16[0][i] = G >> SH; | |
| 2399 | 638664592 | dest16[1][i] = B >> SH; | |
| 2400 | 638664592 | dest16[2][i] = R >> SH; | |
| 2401 |
2/2✓ Branch 0 taken 291456 times.
✓ Branch 1 taken 638373136 times.
|
638664592 | if (hasAlpha) |
| 2402 | 291456 | dest16[3][i] = A >> (SH - 3); | |
| 2403 | } else { | ||
| 2404 | 280816256 | dest[0][i] = G >> 22; | |
| 2405 | 280816256 | dest[1][i] = B >> 22; | |
| 2406 | 280816256 | dest[2][i] = R >> 22; | |
| 2407 |
2/2✓ Branch 0 taken 52864 times.
✓ Branch 1 taken 280763392 times.
|
280816256 | if (hasAlpha) |
| 2408 | 52864 | dest[3][i] = A >> 19; | |
| 2409 | } | ||
| 2410 | } | ||
| 2411 |
4/4✓ Branch 0 taken 1819588 times.
✓ Branch 1 taken 798020 times.
✓ Branch 3 taken 219960 times.
✓ Branch 4 taken 1599628 times.
|
2617608 | if (SH != 22 && (!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) { |
| 2412 |
2/2✓ Branch 0 taken 77077440 times.
✓ Branch 1 taken 219960 times.
|
77297400 | for (i = 0; i < dstW; i++) { |
| 2413 | 77077440 | dest16[0][i] = av_bswap16(dest16[0][i]); | |
| 2414 | 77077440 | dest16[1][i] = av_bswap16(dest16[1][i]); | |
| 2415 | 77077440 | dest16[2][i] = av_bswap16(dest16[2][i]); | |
| 2416 |
2/2✓ Branch 0 taken 145728 times.
✓ Branch 1 taken 76931712 times.
|
77077440 | if (hasAlpha) |
| 2417 | 145728 | dest16[3][i] = av_bswap16(dest16[3][i]); | |
| 2418 | } | ||
| 2419 | } | ||
| 2420 | 2617608 | } | |
| 2421 | |||
| 2422 | static void | ||
| 2423 | 39008 | yuv2gbrpmsb_full_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2424 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2425 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2426 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2427 | const int16_t **alpSrc, uint8_t **dest, | ||
| 2428 | int dstW, int y) | ||
| 2429 | { | ||
| 2430 | 39008 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2431 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 39008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39008 | int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrc; |
| 2432 | 39008 | uint16_t **dest16 = (uint16_t**)dest; | |
| 2433 | 39008 | int shift = 16 - desc->comp[0].depth; | |
| 2434 | int i; | ||
| 2435 | |||
| 2436 | 39008 | yuv2gbrp_full_X_c(c, lumFilter, lumSrc, lumFilterSize, | |
| 2437 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, | ||
| 2438 | alpSrc, dest, dstW, y); | ||
| 2439 | |||
| 2440 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39008 times.
|
39008 | if (desc->comp[0].depth <= 8) |
| 2441 | ✗ | return; | |
| 2442 | |||
| 2443 |
2/2✓ Branch 1 taken 18832 times.
✓ Branch 2 taken 20176 times.
|
39008 | if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) { |
| 2444 |
2/2✓ Branch 0 taken 6568064 times.
✓ Branch 1 taken 18832 times.
|
6586896 | for (i = 0; i < dstW; i++) { |
| 2445 | 6568064 | dest16[0][i] = av_bswap16(av_bswap16(dest16[0][i]) << shift); | |
| 2446 | 6568064 | dest16[1][i] = av_bswap16(av_bswap16(dest16[1][i]) << shift); | |
| 2447 | 6568064 | dest16[2][i] = av_bswap16(av_bswap16(dest16[2][i]) << shift); | |
| 2448 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6568064 times.
|
6568064 | if (hasAlpha) |
| 2449 | ✗ | dest16[3][i] = av_bswap16(av_bswap16(dest16[3][i]) << shift); | |
| 2450 | } | ||
| 2451 | } else { | ||
| 2452 |
2/2✓ Branch 0 taken 6992000 times.
✓ Branch 1 taken 20176 times.
|
7012176 | for (i = 0; i < dstW; i++) { |
| 2453 | 6992000 | dest16[0][i] = dest16[0][i] << shift; | |
| 2454 | 6992000 | dest16[1][i] = dest16[1][i] << shift; | |
| 2455 | 6992000 | dest16[2][i] = dest16[2][i] << shift; | |
| 2456 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6992000 times.
|
6992000 | if (hasAlpha) |
| 2457 | ✗ | dest16[3][i] = dest16[3][i] << shift; | |
| 2458 | } | ||
| 2459 | } | ||
| 2460 | } | ||
| 2461 | |||
| 2462 | static void | ||
| 2463 | 362604 | yuv2gbrp16_full_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2464 | const int16_t **lumSrcx, int lumFilterSize, | ||
| 2465 | const int16_t *chrFilter, const int16_t **chrUSrcx, | ||
| 2466 | const int16_t **chrVSrcx, int chrFilterSize, | ||
| 2467 | const int16_t **alpSrcx, uint8_t **dest, | ||
| 2468 | int dstW, int y) | ||
| 2469 | { | ||
| 2470 | 362604 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2471 | int i; | ||
| 2472 |
4/4✓ Branch 0 taken 27798 times.
✓ Branch 1 taken 334806 times.
✓ Branch 2 taken 724 times.
✓ Branch 3 taken 27074 times.
|
362604 | int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx; |
| 2473 | 362604 | uint16_t **dest16 = (uint16_t**)dest; | |
| 2474 | 362604 | const int32_t **lumSrc = (const int32_t**)lumSrcx; | |
| 2475 | 362604 | const int32_t **chrUSrc = (const int32_t**)chrUSrcx; | |
| 2476 | 362604 | const int32_t **chrVSrc = (const int32_t**)chrVSrcx; | |
| 2477 | 362604 | const int32_t **alpSrc = (const int32_t**)alpSrcx; | |
| 2478 | |||
| 2479 |
2/2✓ Branch 0 taken 127363264 times.
✓ Branch 1 taken 362604 times.
|
127725868 | for (i = 0; i < dstW; i++) { |
| 2480 | int j; | ||
| 2481 | 127363264 | int Y = -0x40000000; | |
| 2482 | 127363264 | int U = -(128 << 23); | |
| 2483 | 127363264 | int V = -(128 << 23); | |
| 2484 | int R, G, B, A; | ||
| 2485 | |||
| 2486 |
2/2✓ Branch 0 taken 129444864 times.
✓ Branch 1 taken 127363264 times.
|
256808128 | for (j = 0; j < lumFilterSize; j++) |
| 2487 | 129444864 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2488 | |||
| 2489 |
2/2✓ Branch 0 taken 218250240 times.
✓ Branch 1 taken 127363264 times.
|
345613504 | for (j = 0; j < chrFilterSize; j++) { |
| 2490 | 218250240 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2491 | 218250240 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2492 | } | ||
| 2493 | |||
| 2494 | 127363264 | Y >>= 14; | |
| 2495 | 127363264 | Y += 0x10000; | |
| 2496 | 127363264 | U >>= 14; | |
| 2497 | 127363264 | V >>= 14; | |
| 2498 | |||
| 2499 |
2/2✓ Branch 0 taken 118688 times.
✓ Branch 1 taken 127244576 times.
|
127363264 | if (hasAlpha) { |
| 2500 | 118688 | A = -0x40000000; | |
| 2501 | |||
| 2502 |
2/2✓ Branch 0 taken 1159488 times.
✓ Branch 1 taken 118688 times.
|
1278176 | for (j = 0; j < lumFilterSize; j++) |
| 2503 | 1159488 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2504 | |||
| 2505 | 118688 | A >>= 1; | |
| 2506 | 118688 | A += 0x20002000; | |
| 2507 | } | ||
| 2508 | |||
| 2509 | 127363264 | Y -= c->yuv2rgb_y_offset; | |
| 2510 | 127363264 | Y *= c->yuv2rgb_y_coeff; | |
| 2511 | 127363264 | Y += (1 << 13) - (1 << 29); | |
| 2512 | 127363264 | R = V * c->yuv2rgb_v2r_coeff; | |
| 2513 | 127363264 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 2514 | 127363264 | B = U * c->yuv2rgb_u2b_coeff; | |
| 2515 | |||
| 2516 | 127363264 | dest16[2][i] = av_clip_uintp2(((Y + R) >> 14) + (1<<15), 16); | |
| 2517 | 127363264 | dest16[0][i] = av_clip_uintp2(((Y + G) >> 14) + (1<<15), 16); | |
| 2518 | 127363264 | dest16[1][i] = av_clip_uintp2(((Y + B) >> 14) + (1<<15), 16); | |
| 2519 | |||
| 2520 |
2/2✓ Branch 0 taken 118688 times.
✓ Branch 1 taken 127244576 times.
|
127363264 | if (hasAlpha) |
| 2521 | 118688 | dest16[3][i] = av_clip_uintp2(A, 30) >> 14; | |
| 2522 | } | ||
| 2523 |
2/2✓ Branch 1 taken 124168 times.
✓ Branch 2 taken 238436 times.
|
362604 | if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) { |
| 2524 |
2/2✓ Branch 0 taken 43520576 times.
✓ Branch 1 taken 124168 times.
|
43644744 | for (i = 0; i < dstW; i++) { |
| 2525 | 43520576 | dest16[0][i] = av_bswap16(dest16[0][i]); | |
| 2526 | 43520576 | dest16[1][i] = av_bswap16(dest16[1][i]); | |
| 2527 | 43520576 | dest16[2][i] = av_bswap16(dest16[2][i]); | |
| 2528 |
2/2✓ Branch 0 taken 65824 times.
✓ Branch 1 taken 43454752 times.
|
43520576 | if (hasAlpha) |
| 2529 | 65824 | dest16[3][i] = av_bswap16(dest16[3][i]); | |
| 2530 | } | ||
| 2531 | } | ||
| 2532 | 362604 | } | |
| 2533 | |||
| 2534 | static void | ||
| 2535 | 84691 | yuv2gbrpf32_full_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2536 | const int16_t **lumSrcx, int lumFilterSize, | ||
| 2537 | const int16_t *chrFilter, const int16_t **chrUSrcx, | ||
| 2538 | const int16_t **chrVSrcx, int chrFilterSize, | ||
| 2539 | const int16_t **alpSrcx, uint8_t **dest, | ||
| 2540 | int dstW, int y) | ||
| 2541 | { | ||
| 2542 | 84691 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2543 | int i; | ||
| 2544 |
4/4✓ Branch 0 taken 38145 times.
✓ Branch 1 taken 46546 times.
✓ Branch 2 taken 3585 times.
✓ Branch 3 taken 34560 times.
|
84691 | int hasAlpha = (desc->flags & AV_PIX_FMT_FLAG_ALPHA) && alpSrcx; |
| 2545 | 84691 | uint32_t **dest32 = (uint32_t**)dest; | |
| 2546 | 84691 | const int32_t **lumSrc = (const int32_t**)lumSrcx; | |
| 2547 | 84691 | const int32_t **chrUSrc = (const int32_t**)chrUSrcx; | |
| 2548 | 84691 | const int32_t **chrVSrc = (const int32_t**)chrVSrcx; | |
| 2549 | 84691 | const int32_t **alpSrc = (const int32_t**)alpSrcx; | |
| 2550 | static const float float_mult = 1.0f / 65535.0f; | ||
| 2551 | |||
| 2552 |
2/2✓ Branch 0 taken 30848054 times.
✓ Branch 1 taken 84691 times.
|
30932745 | for (i = 0; i < dstW; i++) { |
| 2553 | int j; | ||
| 2554 | 30848054 | int Y = -0x40000000; | |
| 2555 | 30848054 | int U = -(128 << 23); | |
| 2556 | 30848054 | int V = -(128 << 23); | |
| 2557 | int R, G, B, A; | ||
| 2558 | |||
| 2559 |
2/2✓ Branch 0 taken 32929654 times.
✓ Branch 1 taken 30848054 times.
|
63777708 | for (j = 0; j < lumFilterSize; j++) |
| 2560 | 32929654 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2561 | |||
| 2562 |
2/2✓ Branch 0 taken 114435958 times.
✓ Branch 1 taken 30848054 times.
|
145284012 | for (j = 0; j < chrFilterSize; j++) { |
| 2563 | 114435958 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2564 | 114435958 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2565 | } | ||
| 2566 | |||
| 2567 | 30848054 | Y >>= 14; | |
| 2568 | 30848054 | Y += 0x10000; | |
| 2569 | 30848054 | U >>= 14; | |
| 2570 | 30848054 | V >>= 14; | |
| 2571 | |||
| 2572 |
2/2✓ Branch 0 taken 1926539 times.
✓ Branch 1 taken 28921515 times.
|
30848054 | if (hasAlpha) { |
| 2573 | 1926539 | A = -0x40000000; | |
| 2574 | |||
| 2575 |
2/2✓ Branch 0 taken 2967339 times.
✓ Branch 1 taken 1926539 times.
|
4893878 | for (j = 0; j < lumFilterSize; j++) |
| 2576 | 2967339 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2577 | |||
| 2578 | 1926539 | A >>= 1; | |
| 2579 | 1926539 | A += 0x20002000; | |
| 2580 | } | ||
| 2581 | |||
| 2582 | 30848054 | Y -= c->yuv2rgb_y_offset; | |
| 2583 | 30848054 | Y *= c->yuv2rgb_y_coeff; | |
| 2584 | 30848054 | Y += (1 << 13) - (1 << 29); | |
| 2585 | 30848054 | R = V * c->yuv2rgb_v2r_coeff; | |
| 2586 | 30848054 | G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; | |
| 2587 | 30848054 | B = U * c->yuv2rgb_u2b_coeff; | |
| 2588 | |||
| 2589 | 30848054 | R = av_clip_uintp2(((Y + R) >> 14) + (1<<15), 16); | |
| 2590 | 30848054 | G = av_clip_uintp2(((Y + G) >> 14) + (1<<15), 16); | |
| 2591 | 30848054 | B = av_clip_uintp2(((Y + B) >> 14) + (1<<15), 16); | |
| 2592 | |||
| 2593 | 30848054 | dest32[0][i] = av_float2int(float_mult * (float)G); | |
| 2594 | 30848054 | dest32[1][i] = av_float2int(float_mult * (float)B); | |
| 2595 | 30848054 | dest32[2][i] = av_float2int(float_mult * (float)R); | |
| 2596 |
2/2✓ Branch 0 taken 1926539 times.
✓ Branch 1 taken 28921515 times.
|
30848054 | if (hasAlpha) |
| 2597 | 1926539 | dest32[3][i] = av_float2int(float_mult * (float)(av_clip_uintp2(A, 30) >> 14)); | |
| 2598 | } | ||
| 2599 |
2/2✓ Branch 1 taken 23008 times.
✓ Branch 2 taken 61683 times.
|
84691 | if ((!isBE(c->opts.dst_format)) != (!HAVE_BIGENDIAN)) { |
| 2600 |
2/2✓ Branch 0 taken 8013056 times.
✓ Branch 1 taken 23008 times.
|
8036064 | for (i = 0; i < dstW; i++) { |
| 2601 | 8013056 | dest32[0][i] = av_bswap32(dest32[0][i]); | |
| 2602 | 8013056 | dest32[1][i] = av_bswap32(dest32[1][i]); | |
| 2603 | 8013056 | dest32[2][i] = av_bswap32(dest32[2][i]); | |
| 2604 |
2/2✓ Branch 0 taken 52864 times.
✓ Branch 1 taken 7960192 times.
|
8013056 | if (hasAlpha) |
| 2605 | 52864 | dest32[3][i] = av_bswap32(dest32[3][i]); | |
| 2606 | } | ||
| 2607 | } | ||
| 2608 | 84691 | } | |
| 2609 | |||
| 2610 | static void | ||
| 2611 | ✗ | yuv2ya8_1_c(SwsInternal *c, const int16_t *buf0, | |
| 2612 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2613 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 2614 | int uvalpha, int y) | ||
| 2615 | { | ||
| 2616 | ✗ | int hasAlpha = !!abuf0; | |
| 2617 | int i; | ||
| 2618 | |||
| 2619 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2620 | ✗ | int Y = (buf0[i] + 64) >> 7; | |
| 2621 | int A; | ||
| 2622 | |||
| 2623 | ✗ | Y = av_clip_uint8(Y); | |
| 2624 | |||
| 2625 | ✗ | if (hasAlpha) { | |
| 2626 | ✗ | A = (abuf0[i] + 64) >> 7; | |
| 2627 | ✗ | if (A & 0x100) | |
| 2628 | ✗ | A = av_clip_uint8(A); | |
| 2629 | } | ||
| 2630 | |||
| 2631 | ✗ | dest[i * 2 ] = Y; | |
| 2632 | ✗ | dest[i * 2 + 1] = hasAlpha ? A : 255; | |
| 2633 | } | ||
| 2634 | ✗ | } | |
| 2635 | |||
| 2636 | static void | ||
| 2637 | ✗ | yuv2ya8_2_c(SwsInternal *c, const int16_t *buf[2], | |
| 2638 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2639 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 2640 | int yalpha, int uvalpha, int y) | ||
| 2641 | { | ||
| 2642 | ✗ | int hasAlpha = abuf && abuf[0] && abuf[1]; | |
| 2643 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 2644 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 2645 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 2646 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 2647 | int i; | ||
| 2648 | |||
| 2649 | av_assert2(yalpha <= 4096U); | ||
| 2650 | |||
| 2651 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2652 | ✗ | int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19; | |
| 2653 | int A; | ||
| 2654 | |||
| 2655 | ✗ | Y = av_clip_uint8(Y); | |
| 2656 | |||
| 2657 | ✗ | if (hasAlpha) { | |
| 2658 | ✗ | A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 19; | |
| 2659 | ✗ | A = av_clip_uint8(A); | |
| 2660 | } | ||
| 2661 | |||
| 2662 | ✗ | dest[i * 2 ] = Y; | |
| 2663 | ✗ | dest[i * 2 + 1] = hasAlpha ? A : 255; | |
| 2664 | } | ||
| 2665 | ✗ | } | |
| 2666 | |||
| 2667 | static void | ||
| 2668 | 9992 | yuv2ya8_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2669 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2670 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2671 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2672 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) | ||
| 2673 | { | ||
| 2674 | 9992 | int hasAlpha = !!alpSrc; | |
| 2675 | int i; | ||
| 2676 | |||
| 2677 |
2/2✓ Branch 0 taken 3486784 times.
✓ Branch 1 taken 9992 times.
|
3496776 | for (i = 0; i < dstW; i++) { |
| 2678 | int j; | ||
| 2679 | 3486784 | int Y = 1 << 18, A = 1 << 18; | |
| 2680 | |||
| 2681 |
2/2✓ Branch 0 taken 3926784 times.
✓ Branch 1 taken 3486784 times.
|
7413568 | for (j = 0; j < lumFilterSize; j++) |
| 2682 | 3926784 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2683 | |||
| 2684 | 3486784 | Y >>= 19; | |
| 2685 |
2/2✓ Branch 0 taken 19122 times.
✓ Branch 1 taken 3467662 times.
|
3486784 | if (Y & 0x100) |
| 2686 | 19122 | Y = av_clip_uint8(Y); | |
| 2687 | |||
| 2688 |
2/2✓ Branch 0 taken 40000 times.
✓ Branch 1 taken 3446784 times.
|
3486784 | if (hasAlpha) { |
| 2689 |
2/2✓ Branch 0 taken 480000 times.
✓ Branch 1 taken 40000 times.
|
520000 | for (j = 0; j < lumFilterSize; j++) |
| 2690 | 480000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2691 | |||
| 2692 | 40000 | A >>= 19; | |
| 2693 | |||
| 2694 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40000 times.
|
40000 | if (A & 0x100) |
| 2695 | ✗ | A = av_clip_uint8(A); | |
| 2696 | } | ||
| 2697 | |||
| 2698 | 3486784 | dest[2 * i ] = Y; | |
| 2699 |
2/2✓ Branch 0 taken 40000 times.
✓ Branch 1 taken 3446784 times.
|
3486784 | dest[2 * i + 1] = hasAlpha ? A : 255; |
| 2700 | } | ||
| 2701 | 9992 | } | |
| 2702 | |||
| 2703 | #define output_pixels(pos, val) \ | ||
| 2704 | if (is_be) { \ | ||
| 2705 | AV_WB16(pos, val); \ | ||
| 2706 | } else { \ | ||
| 2707 | AV_WL16(pos, val); \ | ||
| 2708 | } | ||
| 2709 | |||
| 2710 | static av_always_inline void | ||
| 2711 | 247328 | yuv2ayuv64_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2712 | const int16_t **_lumSrc, int lumFilterSize, | ||
| 2713 | const int16_t *chrFilter, const int16_t **_chrUSrc, | ||
| 2714 | const int16_t **_chrVSrc, int chrFilterSize, | ||
| 2715 | const int16_t **_alpSrc, uint8_t *dest, int dstW, int y, | ||
| 2716 | int A_offset, int Y_offset, int U_offset, int V_offset, int is_be) | ||
| 2717 | { | ||
| 2718 | 247328 | const int32_t **lumSrc = (const int32_t **) _lumSrc, | |
| 2719 | 247328 | **chrUSrc = (const int32_t **) _chrUSrc, | |
| 2720 | 247328 | **chrVSrc = (const int32_t **) _chrVSrc, | |
| 2721 | 247328 | **alpSrc = (const int32_t **) _alpSrc; | |
| 2722 | 247328 | int hasAlpha = !!alpSrc; | |
| 2723 | int i; | ||
| 2724 | |||
| 2725 |
2/2✓ Branch 0 taken 86937856 times.
✓ Branch 1 taken 247328 times.
|
87185184 | for (i = 0; i < dstW; i++) { |
| 2726 | 86937856 | int Y = 1 << 14, U = 1 << 14; | |
| 2727 | 86937856 | int V = 1 << 14, A = 1 << 14; | |
| 2728 | int j; | ||
| 2729 | |||
| 2730 | 86937856 | Y -= 0x40000000; | |
| 2731 | 86937856 | U -= 0x40000000; | |
| 2732 | 86937856 | V -= 0x40000000; | |
| 2733 | 86937856 | A -= 0x40000000; | |
| 2734 | |||
| 2735 |
2/2✓ Branch 0 taken 88697856 times.
✓ Branch 1 taken 86937856 times.
|
175635712 | for (j = 0; j < lumFilterSize; j++) |
| 2736 | 88697856 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2737 | |||
| 2738 |
2/2✓ Branch 0 taken 127626240 times.
✓ Branch 1 taken 86937856 times.
|
214564096 | for (j = 0; j < chrFilterSize; j++) |
| 2739 | 127626240 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2740 | |||
| 2741 |
2/2✓ Branch 0 taken 127626240 times.
✓ Branch 1 taken 86937856 times.
|
214564096 | for (j = 0; j < chrFilterSize; j++) |
| 2742 | 127626240 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2743 | |||
| 2744 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 86857856 times.
|
86937856 | if (hasAlpha) |
| 2745 |
2/2✓ Branch 0 taken 960000 times.
✓ Branch 1 taken 80000 times.
|
1040000 | for (j = 0; j < lumFilterSize; j++) |
| 2746 | 960000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2747 | |||
| 2748 | 86937856 | Y = 0x8000 + av_clip_int16(Y >> 15); | |
| 2749 | 86937856 | U = 0x8000 + av_clip_int16(U >> 15); | |
| 2750 | 86937856 | V = 0x8000 + av_clip_int16(V >> 15); | |
| 2751 |
2/2✓ Branch 0 taken 80000 times.
✓ Branch 1 taken 86857856 times.
|
86937856 | if (hasAlpha) |
| 2752 | 80000 | A = 0x8000 + av_clip_int16(A >> 15); | |
| 2753 | |||
| 2754 |
6/6✓ Branch 0 taken 43468928 times.
✓ Branch 1 taken 43468928 times.
✓ Branch 2 taken 40000 times.
✓ Branch 3 taken 43428928 times.
✓ Branch 4 taken 40000 times.
✓ Branch 5 taken 43428928 times.
|
86937856 | output_pixels(dest + 8 * i + A_offset, hasAlpha ? A : 65535); |
| 2755 |
2/2✓ Branch 0 taken 43468928 times.
✓ Branch 1 taken 43468928 times.
|
86937856 | output_pixels(dest + 8 * i + Y_offset, Y); |
| 2756 |
2/2✓ Branch 0 taken 43468928 times.
✓ Branch 1 taken 43468928 times.
|
86937856 | output_pixels(dest + 8 * i + U_offset, U); |
| 2757 |
2/2✓ Branch 0 taken 43468928 times.
✓ Branch 1 taken 43468928 times.
|
86937856 | output_pixels(dest + 8 * i + V_offset, V); |
| 2758 | } | ||
| 2759 | 247328 | } | |
| 2760 | |||
| 2761 | #define YUV2AYUV64(pixfmt, BE_LE, A, Y, U, V, is_be) \ | ||
| 2762 | static void \ | ||
| 2763 | yuv2 ## pixfmt ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 2764 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 2765 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 2766 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 2767 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \ | ||
| 2768 | { \ | ||
| 2769 | yuv2ayuv64_X_c(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 2770 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 2771 | alpSrc, dest, dstW, y, A, Y, U, V, is_be); \ | ||
| 2772 | } | ||
| 2773 | |||
| 2774 | 9416 | YUV2AYUV64(ayuv64, le, 0, 2, 4, 6, 0) | |
| 2775 | 9416 | YUV2AYUV64(ayuv64, be, 0, 2, 4, 6, 1) | |
| 2776 | |||
| 2777 | 114248 | YUV2AYUV64(xv48, le, 6, 2, 0, 4, 0) | |
| 2778 | 114248 | YUV2AYUV64(xv48, be, 6, 2, 0, 4, 1) | |
| 2779 | |||
| 2780 | #undef output_pixels | ||
| 2781 | |||
| 2782 | static av_always_inline void | ||
| 2783 | 228468 | yuv2v30_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 2784 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2785 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2786 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2787 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y, | ||
| 2788 | int shift) | ||
| 2789 | { | ||
| 2790 | int i; | ||
| 2791 |
2/2✓ Branch 0 taken 79819336 times.
✓ Branch 1 taken 228468 times.
|
80047804 | for (i = 0; i < dstW; i++) { |
| 2792 | 79819336 | int Y = 1 << 16, U = 1 << 16, V = 1 << 16, A = 0x3; | |
| 2793 | int j; | ||
| 2794 | |||
| 2795 |
2/2✓ Branch 0 taken 80699336 times.
✓ Branch 1 taken 79819336 times.
|
160518672 | for (j = 0; j < lumFilterSize; j++) |
| 2796 | 80699336 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2797 | |||
| 2798 |
2/2✓ Branch 0 taken 100163528 times.
✓ Branch 1 taken 79819336 times.
|
179982864 | for (j = 0; j < chrFilterSize; j++) { |
| 2799 | 100163528 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2800 | 100163528 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2801 | } | ||
| 2802 | |||
| 2803 | 79819336 | Y = av_clip_uintp2(Y >> 17, 10); | |
| 2804 | 79819336 | U = av_clip_uintp2(U >> 17, 10); | |
| 2805 | 79819336 | V = av_clip_uintp2(V >> 17, 10); | |
| 2806 | |||
| 2807 |
2/2✓ Branch 0 taken 47541768 times.
✓ Branch 1 taken 32277568 times.
|
79819336 | AV_WL32(dest + 4 * i, U << (shift + 0) | |
| 2808 | Y << (shift + 10) | | ||
| 2809 | (unsigned)V << (shift + 20) | | ||
| 2810 | (unsigned)A << (shift ? 0 : 30 /* xv30le = 30, v30xle = 0 */)); | ||
| 2811 | } | ||
| 2812 | 228468 | } | |
| 2813 | |||
| 2814 | #define V30LE_WRAPPER(name, shift) \ | ||
| 2815 | static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 2816 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 2817 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 2818 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 2819 | const int16_t **alpSrc, uint8_t *dest, int dstW, \ | ||
| 2820 | int y) \ | ||
| 2821 | { \ | ||
| 2822 | yuv2v30_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 2823 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 2824 | alpSrc, dest, dstW, y, shift); \ | ||
| 2825 | } | ||
| 2826 | |||
| 2827 | 91784 | V30LE_WRAPPER(xv30le, 0) | |
| 2828 | 136684 | V30LE_WRAPPER(v30xle, 2) | |
| 2829 | |||
| 2830 | #define output_pixels(pos, val, shift, bits, output_shift) \ | ||
| 2831 | if (is_be) { \ | ||
| 2832 | AV_WB16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \ | ||
| 2833 | } else { \ | ||
| 2834 | AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); \ | ||
| 2835 | } | ||
| 2836 | |||
| 2837 | static void | ||
| 2838 | 183568 | yuv2xv36_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 2839 | const int16_t **lumSrc, int lumFilterSize, | ||
| 2840 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 2841 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 2842 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y, int is_be) | ||
| 2843 | { | ||
| 2844 | int i; | ||
| 2845 |
2/2✓ Branch 0 taken 64555136 times.
✓ Branch 1 taken 183568 times.
|
64738704 | for (i = 0; i < dstW; i++) { |
| 2846 | 64555136 | int Y = 1 << 14, U = 1 << 14, V = 1 << 14, A = 65535; | |
| 2847 | int j; | ||
| 2848 | |||
| 2849 |
2/2✓ Branch 0 taken 65435136 times.
✓ Branch 1 taken 64555136 times.
|
129990272 | for (j = 0; j < lumFilterSize; j++) |
| 2850 | 65435136 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 2851 | |||
| 2852 |
2/2✓ Branch 0 taken 84899328 times.
✓ Branch 1 taken 64555136 times.
|
149454464 | for (j = 0; j < chrFilterSize; j++) { |
| 2853 | 84899328 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2854 | 84899328 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 2855 | } | ||
| 2856 | |||
| 2857 |
2/2✓ Branch 0 taken 32277568 times.
✓ Branch 1 taken 32277568 times.
|
64555136 | output_pixels(dest + 8 * i + 2, Y, 15, 12, 4) |
| 2858 |
2/2✓ Branch 0 taken 32277568 times.
✓ Branch 1 taken 32277568 times.
|
64555136 | output_pixels(dest + 8 * i + 0, U, 15, 12, 4) |
| 2859 |
2/2✓ Branch 0 taken 32277568 times.
✓ Branch 1 taken 32277568 times.
|
64555136 | output_pixels(dest + 8 * i + 4, V, 15, 12, 4) |
| 2860 |
2/2✓ Branch 0 taken 32277568 times.
✓ Branch 1 taken 32277568 times.
|
64555136 | output_pixels(dest + 8 * i + 6, A, 0, 12, 4); |
| 2861 | } | ||
| 2862 | 183568 | } | |
| 2863 | |||
| 2864 | #undef output_pixels | ||
| 2865 | |||
| 2866 | #define YUV2XV36(BE_LE, is_be) \ | ||
| 2867 | static void \ | ||
| 2868 | yuv2xv36 ## BE_LE ##_X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 2869 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 2870 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 2871 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 2872 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) \ | ||
| 2873 | { \ | ||
| 2874 | yuv2xv36_X_c(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 2875 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 2876 | alpSrc, dest, dstW, y, is_be); \ | ||
| 2877 | } | ||
| 2878 | |||
| 2879 | 91784 | YUV2XV36(le, 0) | |
| 2880 | 91784 | YUV2XV36(be, 1) | |
| 2881 | |||
| 2882 | #define output_pixels(pos, A, Y, U, V) \ | ||
| 2883 | if (target == AV_PIX_FMT_AYUV) { \ | ||
| 2884 | dest[pos + 0] = A; \ | ||
| 2885 | dest[pos + 1] = Y; \ | ||
| 2886 | dest[pos + 2] = U; \ | ||
| 2887 | dest[pos + 3] = V; \ | ||
| 2888 | } else if (target == AV_PIX_FMT_UYVA) { \ | ||
| 2889 | dest[pos + 0] = U; \ | ||
| 2890 | dest[pos + 1] = Y; \ | ||
| 2891 | dest[pos + 2] = V; \ | ||
| 2892 | dest[pos + 3] = A; \ | ||
| 2893 | } else { /* AV_PIX_FMT_VUYA || AV_PIX_FMT_VUYX */ \ | ||
| 2894 | dest[pos + 0] = V; \ | ||
| 2895 | dest[pos + 1] = U; \ | ||
| 2896 | dest[pos + 2] = Y; \ | ||
| 2897 | dest[pos + 3] = A; \ | ||
| 2898 | } | ||
| 2899 | |||
| 2900 | static av_always_inline void | ||
| 2901 | 127268 | yuv2ayuv_1_c_template(SwsInternal *c, const int16_t *buf0, | |
| 2902 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2903 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 2904 | int uvalpha, int y, enum AVPixelFormat target) | ||
| 2905 | { | ||
| 2906 | 127268 | int hasAlpha = !!abuf0; | |
| 2907 | int i; | ||
| 2908 | |||
| 2909 |
1/2✓ Branch 0 taken 127268 times.
✗ Branch 1 not taken.
|
127268 | if (uvalpha < 2048) { |
| 2910 |
2/2✓ Branch 0 taken 44257736 times.
✓ Branch 1 taken 127268 times.
|
44385004 | for (i = 0; i < dstW; i++) { |
| 2911 | 44257736 | int Y = (buf0[i] + 64) >> 7; | |
| 2912 | 44257736 | int U = (ubuf[0][i] + 64) >> 7; | |
| 2913 | 44257736 | int V = (vbuf[0][i] + 64) >> 7; | |
| 2914 | 44257736 | int A = 255; | |
| 2915 | |||
| 2916 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44257736 times.
|
44257736 | if (Y & 0x100) |
| 2917 | ✗ | Y = av_clip_uint8(Y); | |
| 2918 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44257736 times.
|
44257736 | if (U & 0x100) |
| 2919 | ✗ | U = av_clip_uint8(U); | |
| 2920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44257736 times.
|
44257736 | if (V & 0x100) |
| 2921 | ✗ | V = av_clip_uint8(V); | |
| 2922 | |||
| 2923 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44257736 times.
|
44257736 | if (hasAlpha) { |
| 2924 | ✗ | A = (abuf0[i] + 64) >> 7; | |
| 2925 | ✗ | if (A & 0x100) | |
| 2926 | ✗ | A = av_clip_uint8(A); | |
| 2927 | } | ||
| 2928 | |||
| 2929 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 44257736 times.
✓ Branch 2 taken 15264200 times.
✓ Branch 3 taken 28993536 times.
|
44257736 | output_pixels(i * 4, A, Y, U, V) |
| 2930 | } | ||
| 2931 | } else { | ||
| 2932 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2933 | ✗ | int Y = (buf0[i] + 64) >> 7; | |
| 2934 | ✗ | int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8; | |
| 2935 | ✗ | int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8; | |
| 2936 | ✗ | int A = 255; | |
| 2937 | |||
| 2938 | ✗ | if (Y & 0x100) | |
| 2939 | ✗ | Y = av_clip_uint8(Y); | |
| 2940 | ✗ | if (U & 0x100) | |
| 2941 | ✗ | U = av_clip_uint8(U); | |
| 2942 | ✗ | if (V & 0x100) | |
| 2943 | ✗ | V = av_clip_uint8(V); | |
| 2944 | |||
| 2945 | ✗ | if (hasAlpha) { | |
| 2946 | ✗ | A = (abuf0[i] + 64) >> 7; | |
| 2947 | ✗ | if (A & 0x100) | |
| 2948 | ✗ | A = av_clip_uint8(A); | |
| 2949 | } | ||
| 2950 | |||
| 2951 | ✗ | output_pixels(i * 4, A, Y, U, V) | |
| 2952 | } | ||
| 2953 | } | ||
| 2954 | 127268 | } | |
| 2955 | |||
| 2956 | static av_always_inline void | ||
| 2957 | ✗ | yuv2ayuv_2_c_template(SwsInternal *c, const int16_t *buf[2], | |
| 2958 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 2959 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 2960 | int yalpha, int uvalpha, int y, | ||
| 2961 | enum AVPixelFormat target) | ||
| 2962 | { | ||
| 2963 | ✗ | int hasAlpha = abuf && abuf[0] && abuf[1]; | |
| 2964 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 2965 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 2966 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], | |
| 2967 | ✗ | *abuf0 = hasAlpha ? abuf[0] : NULL, | |
| 2968 | ✗ | *abuf1 = hasAlpha ? abuf[1] : NULL; | |
| 2969 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 2970 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 2971 | int i; | ||
| 2972 | |||
| 2973 | av_assert2(yalpha <= 4096U); | ||
| 2974 | av_assert2(uvalpha <= 4096U); | ||
| 2975 | |||
| 2976 | ✗ | for (i = 0; i < dstW; i++) { | |
| 2977 | ✗ | int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19; | |
| 2978 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; | |
| 2979 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; | |
| 2980 | ✗ | int A = 255; | |
| 2981 | |||
| 2982 | ✗ | if (Y & 0x100) | |
| 2983 | ✗ | Y = av_clip_uint8(Y); | |
| 2984 | ✗ | if (U & 0x100) | |
| 2985 | ✗ | U = av_clip_uint8(U); | |
| 2986 | ✗ | if (V & 0x100) | |
| 2987 | ✗ | V = av_clip_uint8(V); | |
| 2988 | |||
| 2989 | ✗ | if (hasAlpha) { | |
| 2990 | ✗ | A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 19; | |
| 2991 | ✗ | A = av_clip_uint8(A); | |
| 2992 | } | ||
| 2993 | |||
| 2994 | ✗ | output_pixels(i * 4, A, Y, U, V) | |
| 2995 | } | ||
| 2996 | ✗ | } | |
| 2997 | |||
| 2998 | static av_always_inline void | ||
| 2999 | 40544 | yuv2ayuv_X_c_template(SwsInternal *c, const int16_t *lumFilter, | |
| 3000 | const int16_t **lumSrc, int lumFilterSize, | ||
| 3001 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 3002 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 3003 | const int16_t **alpSrc, uint8_t *dest, int dstW, | ||
| 3004 | int y, enum AVPixelFormat target) | ||
| 3005 | { | ||
| 3006 | int i; | ||
| 3007 | |||
| 3008 |
2/2✓ Branch 0 taken 14149888 times.
✓ Branch 1 taken 40544 times.
|
14190432 | for (i = 0; i < dstW; i++) { |
| 3009 | int j; | ||
| 3010 | 14149888 | int Y = 1 << 18, U = 1 << 18; | |
| 3011 | 14149888 | int V = 1 << 18, A = 255; | |
| 3012 | |||
| 3013 |
2/2✓ Branch 0 taken 15909888 times.
✓ Branch 1 taken 14149888 times.
|
30059776 | for (j = 0; j < lumFilterSize; j++) |
| 3014 | 15909888 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 3015 | |||
| 3016 |
2/2✓ Branch 0 taken 57879552 times.
✓ Branch 1 taken 14149888 times.
|
72029440 | for (j = 0; j < chrFilterSize; j++) |
| 3017 | 57879552 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3018 | |||
| 3019 |
2/2✓ Branch 0 taken 57879552 times.
✓ Branch 1 taken 14149888 times.
|
72029440 | for (j = 0; j < chrFilterSize; j++) |
| 3020 | 57879552 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3021 | |||
| 3022 | 14149888 | Y >>= 19; | |
| 3023 | 14149888 | U >>= 19; | |
| 3024 | 14149888 | V >>= 19; | |
| 3025 | |||
| 3026 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14149888 times.
|
14149888 | if (Y & 0x100) |
| 3027 | ✗ | Y = av_clip_uint8(Y); | |
| 3028 |
2/2✓ Branch 0 taken 560 times.
✓ Branch 1 taken 14149328 times.
|
14149888 | if (U & 0x100) |
| 3029 | 560 | U = av_clip_uint8(U); | |
| 3030 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 14149880 times.
|
14149888 | if (V & 0x100) |
| 3031 | 8 | V = av_clip_uint8(V); | |
| 3032 | |||
| 3033 |
2/2✓ Branch 0 taken 120000 times.
✓ Branch 1 taken 14029888 times.
|
14149888 | if (alpSrc) { |
| 3034 | 120000 | A = 1 << 18; | |
| 3035 | |||
| 3036 |
2/2✓ Branch 0 taken 1440000 times.
✓ Branch 1 taken 120000 times.
|
1560000 | for (j = 0; j < lumFilterSize; j++) |
| 3037 | 1440000 | A += alpSrc[j][i] * (unsigned)lumFilter[j]; | |
| 3038 | |||
| 3039 | 120000 | A >>= 19; | |
| 3040 | |||
| 3041 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 120000 times.
|
120000 | if (A & 0x100) |
| 3042 | ✗ | A = av_clip_uint8(A); | |
| 3043 | } | ||
| 3044 | |||
| 3045 |
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) |
| 3046 | } | ||
| 3047 | 40544 | } | |
| 3048 | |||
| 3049 | #undef output_pixels | ||
| 3050 | |||
| 3051 | #define AYUVPACKEDWRAPPER(name, fmt) \ | ||
| 3052 | static void yuv2 ## name ## _X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 3053 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 3054 | const int16_t *chrFilter, const int16_t **chrUSrc, \ | ||
| 3055 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 3056 | const int16_t **alpSrc, uint8_t *dest, int dstW, \ | ||
| 3057 | int y) \ | ||
| 3058 | { \ | ||
| 3059 | yuv2ayuv_X_c_template(c, lumFilter, lumSrc, lumFilterSize, \ | ||
| 3060 | chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ | ||
| 3061 | alpSrc, dest, dstW, y, fmt); \ | ||
| 3062 | } \ | ||
| 3063 | \ | ||
| 3064 | static void yuv2 ## name ## _2_c(SwsInternal *c, const int16_t *buf[2], \ | ||
| 3065 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 3066 | const int16_t *abuf[2], uint8_t *dest, int dstW, \ | ||
| 3067 | int yalpha, int uvalpha, int y) \ | ||
| 3068 | { \ | ||
| 3069 | yuv2ayuv_2_c_template(c, buf, ubuf, vbuf, abuf, \ | ||
| 3070 | dest, dstW, yalpha, uvalpha, y, fmt); \ | ||
| 3071 | } \ | ||
| 3072 | \ | ||
| 3073 | static void yuv2 ## name ## _1_c(SwsInternal *c, const int16_t *buf0, \ | ||
| 3074 | const int16_t *ubuf[2], const int16_t *vbuf[2], \ | ||
| 3075 | const int16_t *abuf0, uint8_t *dest, int dstW, \ | ||
| 3076 | int uvalpha, int y) \ | ||
| 3077 | { \ | ||
| 3078 | yuv2ayuv_1_c_template(c, buf0, ubuf, vbuf, \ | ||
| 3079 | abuf0, dest, dstW, uvalpha, \ | ||
| 3080 | y, fmt); \ | ||
| 3081 | } | ||
| 3082 | |||
| 3083 | 205856 | AYUVPACKEDWRAPPER(vuyX, AV_PIX_FMT_VUYX) | |
| 3084 | 19984 | AYUVPACKEDWRAPPER(ayuv, AV_PIX_FMT_AYUV) | |
| 3085 | 109784 | AYUVPACKEDWRAPPER(uyva, AV_PIX_FMT_UYVA) | |
| 3086 | |||
| 3087 | #define output_pixel(pos, val, bits) \ | ||
| 3088 | AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift); | ||
| 3089 | |||
| 3090 | #define yuv2y2xx_wrapper(bits) \ | ||
| 3091 | static void \ | ||
| 3092 | yuv2y2 ## bits ## le_X_c(SwsInternal *c, const int16_t *lumFilter, \ | ||
| 3093 | const int16_t **lumSrc, int lumFilterSize, \ | ||
| 3094 | const int16_t *chrFilter, \ | ||
| 3095 | const int16_t **chrUSrc, \ | ||
| 3096 | const int16_t **chrVSrc, int chrFilterSize, \ | ||
| 3097 | const int16_t **alpSrc, \ | ||
| 3098 | uint8_t *dest, int dstW, int y) \ | ||
| 3099 | { \ | ||
| 3100 | int i, j; \ | ||
| 3101 | int shift = 11 + 16 - bits; \ | ||
| 3102 | int output_shift = 16 - bits; \ | ||
| 3103 | for (i = 0; i < ((dstW + 1) >> 1); i++) { \ | ||
| 3104 | int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); \ | ||
| 3105 | int U = 1 << (shift - 1), V = 1 << (shift - 1); \ | ||
| 3106 | \ | ||
| 3107 | for (j = 0; j < lumFilterSize; j++) { \ | ||
| 3108 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; \ | ||
| 3109 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; \ | ||
| 3110 | } \ | ||
| 3111 | \ | ||
| 3112 | for (j = 0; j < chrFilterSize; j++) { \ | ||
| 3113 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; \ | ||
| 3114 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; \ | ||
| 3115 | } \ | ||
| 3116 | \ | ||
| 3117 | output_pixel(dest + 8 * i + 0, Y1, bits); \ | ||
| 3118 | output_pixel(dest + 8 * i + 2, U, bits); \ | ||
| 3119 | output_pixel(dest + 8 * i + 4, Y2, bits); \ | ||
| 3120 | output_pixel(dest + 8 * i + 6, V, bits); \ | ||
| 3121 | } \ | ||
| 3122 | } | ||
| 3123 | |||
| 3124 |
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) |
| 3125 |
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) |
| 3126 | |||
| 3127 | static void | ||
| 3128 | 112520 | yuv2y216le_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 3129 | const int16_t **_lumSrc, int lumFilterSize, | ||
| 3130 | const int16_t *chrFilter, | ||
| 3131 | const int16_t **_chrUSrc, | ||
| 3132 | const int16_t **_chrVSrc, int chrFilterSize, | ||
| 3133 | const int16_t **_alpSrc, | ||
| 3134 | uint8_t *dest, int dstW, int y) | ||
| 3135 | { | ||
| 3136 | 112520 | const int32_t **lumSrc = (const int32_t **)_lumSrc; | |
| 3137 | 112520 | const int32_t **chrUSrc = (const int32_t **)_chrUSrc; | |
| 3138 | 112520 | const int32_t **chrVSrc = (const int32_t **)_chrVSrc; | |
| 3139 | 112520 | int shift = 15; | |
| 3140 | |||
| 3141 |
2/2✓ Branch 0 taken 19788320 times.
✓ Branch 1 taken 112520 times.
|
19900840 | for (int i = 0; i < ((dstW + 1) >> 1); i++) { |
| 3142 | 19788320 | int Y1 = 1 << (shift - 1), Y2 = 1 << (shift - 1); | |
| 3143 | 19788320 | int U = 1 << (shift - 1), V = 1 << (shift - 1); | |
| 3144 | |||
| 3145 | /* See yuv2planeX_16_c_template for details. */ | ||
| 3146 | 19788320 | Y1 -= 0x40000000; | |
| 3147 | 19788320 | U -= 0x40000000; | |
| 3148 | 19788320 | Y2 -= 0x40000000; | |
| 3149 | 19788320 | V -= 0x40000000; | |
| 3150 | |||
| 3151 |
2/2✓ Branch 0 taken 20008320 times.
✓ Branch 1 taken 19788320 times.
|
39796640 | for (int j = 0; j < lumFilterSize; j++) { |
| 3152 | 20008320 | Y1 += lumSrc[j][i * 2] * (unsigned)lumFilter[j]; | |
| 3153 | 20008320 | Y2 += lumSrc[j][i * 2 + 1] * (unsigned)lumFilter[j]; | |
| 3154 | } | ||
| 3155 | |||
| 3156 |
2/2✓ Branch 0 taken 23961984 times.
✓ Branch 1 taken 19788320 times.
|
43750304 | for (int j = 0; j < chrFilterSize; j++) { |
| 3157 | 23961984 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3158 | 23961984 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3159 | } | ||
| 3160 | |||
| 3161 | 19788320 | AV_WL16(dest + 8 * i + 0, 0x8000 + av_clip_int16(Y1 >> shift)); | |
| 3162 | 19788320 | AV_WL16(dest + 8 * i + 2, 0x8000 + av_clip_int16(U >> shift)); | |
| 3163 | 19788320 | AV_WL16(dest + 8 * i + 4, 0x8000 + av_clip_int16(Y2 >> shift)); | |
| 3164 | 19788320 | AV_WL16(dest + 8 * i + 6, 0x8000 + av_clip_int16(V >> shift)); | |
| 3165 | } | ||
| 3166 | 112520 | } | |
| 3167 | |||
| 3168 | static void | ||
| 3169 | 127268 | yuv2vyu444_1_c(SwsInternal *c, const int16_t *buf0, | |
| 3170 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 3171 | const int16_t *abuf0, uint8_t *dest, int dstW, | ||
| 3172 | int uvalpha, int y) | ||
| 3173 | { | ||
| 3174 | int i; | ||
| 3175 | |||
| 3176 |
1/2✓ Branch 0 taken 127268 times.
✗ Branch 1 not taken.
|
127268 | if (uvalpha < 2048) { |
| 3177 |
2/2✓ Branch 0 taken 44257736 times.
✓ Branch 1 taken 127268 times.
|
44385004 | for (i = 0; i < dstW; i++) { |
| 3178 | 44257736 | int Y = (buf0[i] + 64) >> 7; | |
| 3179 | 44257736 | int U = (ubuf[0][i] + 64) >> 7; | |
| 3180 | 44257736 | int V = (vbuf[0][i] + 64) >> 7; | |
| 3181 | |||
| 3182 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44257736 times.
|
44257736 | if (Y & 0x100) |
| 3183 | ✗ | Y = av_clip_uint8(Y); | |
| 3184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44257736 times.
|
44257736 | if (U & 0x100) |
| 3185 | ✗ | U = av_clip_uint8(U); | |
| 3186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44257736 times.
|
44257736 | if (V & 0x100) |
| 3187 | ✗ | V = av_clip_uint8(V); | |
| 3188 | |||
| 3189 | 44257736 | dest[3 * i ] = V; | |
| 3190 | 44257736 | dest[3 * i + 1] = Y; | |
| 3191 | 44257736 | dest[3 * i + 2] = U; | |
| 3192 | } | ||
| 3193 | } else { | ||
| 3194 | ✗ | for (i = 0; i < dstW; i++) { | |
| 3195 | ✗ | int Y = (buf0[i] + 64) >> 7; | |
| 3196 | ✗ | int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8; | |
| 3197 | ✗ | int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8; | |
| 3198 | |||
| 3199 | ✗ | if (Y & 0x100) | |
| 3200 | ✗ | Y = av_clip_uint8(Y); | |
| 3201 | ✗ | if (U & 0x100) | |
| 3202 | ✗ | U = av_clip_uint8(U); | |
| 3203 | ✗ | if (V & 0x100) | |
| 3204 | ✗ | V = av_clip_uint8(V); | |
| 3205 | |||
| 3206 | ✗ | dest[3 * i ] = V; | |
| 3207 | ✗ | dest[3 * i + 1] = Y; | |
| 3208 | ✗ | dest[3 * i + 2] = U; | |
| 3209 | } | ||
| 3210 | } | ||
| 3211 | 127268 | } | |
| 3212 | |||
| 3213 | static void | ||
| 3214 | ✗ | yuv2vyu444_2_c(SwsInternal *c, const int16_t *buf[2], | |
| 3215 | const int16_t *ubuf[2], const int16_t *vbuf[2], | ||
| 3216 | const int16_t *abuf[2], uint8_t *dest, int dstW, | ||
| 3217 | int yalpha, int uvalpha, int y) | ||
| 3218 | { | ||
| 3219 | ✗ | const int16_t *buf0 = buf[0], *buf1 = buf[1], | |
| 3220 | ✗ | *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], | |
| 3221 | ✗ | *vbuf0 = vbuf[0], *vbuf1 = vbuf[1]; | |
| 3222 | ✗ | int yalpha1 = 4096 - yalpha; | |
| 3223 | ✗ | int uvalpha1 = 4096 - uvalpha; | |
| 3224 | int i; | ||
| 3225 | |||
| 3226 | av_assert2(yalpha <= 4096U); | ||
| 3227 | av_assert2(uvalpha <= 4096U); | ||
| 3228 | |||
| 3229 | ✗ | for (i = 0; i < dstW; i++) { | |
| 3230 | ✗ | int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19; | |
| 3231 | ✗ | int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19; | |
| 3232 | ✗ | int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19; | |
| 3233 | |||
| 3234 | ✗ | if (Y & 0x100) | |
| 3235 | ✗ | Y = av_clip_uint8(Y); | |
| 3236 | ✗ | if (U & 0x100) | |
| 3237 | ✗ | U = av_clip_uint8(U); | |
| 3238 | ✗ | if (V & 0x100) | |
| 3239 | ✗ | V = av_clip_uint8(V); | |
| 3240 | |||
| 3241 | ✗ | dest[3 * i ] = V; | |
| 3242 | ✗ | dest[3 * i + 1] = Y; | |
| 3243 | ✗ | dest[3 * i + 2] = U; | |
| 3244 | } | ||
| 3245 | ✗ | } | |
| 3246 | |||
| 3247 | static void | ||
| 3248 | 10568 | yuv2vyu444_X_c(SwsInternal *c, const int16_t *lumFilter, | |
| 3249 | const int16_t **lumSrc, int lumFilterSize, | ||
| 3250 | const int16_t *chrFilter, const int16_t **chrUSrc, | ||
| 3251 | const int16_t **chrVSrc, int chrFilterSize, | ||
| 3252 | const int16_t **alpSrc, uint8_t *dest, int dstW, int y) | ||
| 3253 | { | ||
| 3254 | int i; | ||
| 3255 | |||
| 3256 |
2/2✓ Branch 0 taken 3689536 times.
✓ Branch 1 taken 10568 times.
|
3700104 | for (i = 0; i < dstW; i++) { |
| 3257 | int j; | ||
| 3258 | 3689536 | int Y = 1 << 18, U = 1 << 18; | |
| 3259 | 3689536 | int V = 1 << 18; | |
| 3260 | |||
| 3261 |
2/2✓ Branch 0 taken 4129536 times.
✓ Branch 1 taken 3689536 times.
|
7819072 | for (j = 0; j < lumFilterSize; j++) |
| 3262 | 4129536 | Y += lumSrc[j][i] * (unsigned)lumFilter[j]; | |
| 3263 | |||
| 3264 |
2/2✓ Branch 0 taken 15078144 times.
✓ Branch 1 taken 3689536 times.
|
18767680 | for (j = 0; j < chrFilterSize; j++) |
| 3265 | 15078144 | U += chrUSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3266 | |||
| 3267 |
2/2✓ Branch 0 taken 15078144 times.
✓ Branch 1 taken 3689536 times.
|
18767680 | for (j = 0; j < chrFilterSize; j++) |
| 3268 | 15078144 | V += chrVSrc[j][i] * (unsigned)chrFilter[j]; | |
| 3269 | |||
| 3270 | 3689536 | Y >>= 19; | |
| 3271 | 3689536 | U >>= 19; | |
| 3272 | 3689536 | V >>= 19; | |
| 3273 | |||
| 3274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3689536 times.
|
3689536 | if (Y & 0x100) |
| 3275 | ✗ | Y = av_clip_uint8(Y); | |
| 3276 |
2/2✓ Branch 0 taken 146 times.
✓ Branch 1 taken 3689390 times.
|
3689536 | if (U & 0x100) |
| 3277 | 146 | U = av_clip_uint8(U); | |
| 3278 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3689534 times.
|
3689536 | if (V & 0x100) |
| 3279 | 2 | V = av_clip_uint8(V); | |
| 3280 | |||
| 3281 | 3689536 | dest[3 * i ] = V; | |
| 3282 | 3689536 | dest[3 * i + 1] = Y; | |
| 3283 | 3689536 | dest[3 * i + 2] = U; | |
| 3284 | } | ||
| 3285 | 10568 | } | |
| 3286 | |||
| 3287 | #undef output_pixel | ||
| 3288 | |||
| 3289 | 224169 | av_cold void ff_sws_init_output_funcs(SwsInternal *c, | |
| 3290 | yuv2planar1_fn *yuv2plane1, | ||
| 3291 | yuv2planarX_fn *yuv2planeX, | ||
| 3292 | yuv2interleavedX_fn *yuv2nv12cX, | ||
| 3293 | yuv2packed1_fn *yuv2packed1, | ||
| 3294 | yuv2packed2_fn *yuv2packed2, | ||
| 3295 | yuv2packedX_fn *yuv2packedX, | ||
| 3296 | yuv2anyX_fn *yuv2anyX) | ||
| 3297 | { | ||
| 3298 | 224169 | enum AVPixelFormat dstFormat = c->opts.dst_format; | |
| 3299 | 224169 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat); | |
| 3300 | |||
| 3301 |
4/4✓ Branch 1 taken 32380 times.
✓ Branch 2 taken 191789 times.
✓ Branch 4 taken 18742 times.
✓ Branch 5 taken 13638 times.
|
224169 | if (isSemiPlanarYUV(dstFormat) && isDataInHighBits(dstFormat)) { |
| 3302 |
2/2✓ Branch 0 taken 9333 times.
✓ Branch 1 taken 9409 times.
|
18742 | if (desc->comp[0].depth == 10) { |
| 3303 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7240 times.
|
9333 | *yuv2plane1 = isBE(dstFormat) ? yuv2p010l1_BE_c : yuv2p010l1_LE_c; |
| 3304 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7240 times.
|
9333 | *yuv2planeX = isBE(dstFormat) ? yuv2p010lX_BE_c : yuv2p010lX_LE_c; |
| 3305 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7240 times.
|
9333 | *yuv2nv12cX = isBE(dstFormat) ? yuv2p010cX_BE_c : yuv2p010cX_LE_c; |
| 3306 |
1/2✓ Branch 0 taken 9409 times.
✗ Branch 1 not taken.
|
9409 | } else if (desc->comp[0].depth == 12) { |
| 3307 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7316 times.
|
9409 | *yuv2plane1 = isBE(dstFormat) ? yuv2p012l1_BE_c : yuv2p012l1_LE_c; |
| 3308 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7316 times.
|
9409 | *yuv2planeX = isBE(dstFormat) ? yuv2p012lX_BE_c : yuv2p012lX_LE_c; |
| 3309 |
2/2✓ Branch 1 taken 2093 times.
✓ Branch 2 taken 7316 times.
|
9409 | *yuv2nv12cX = isBE(dstFormat) ? yuv2p012cX_BE_c : yuv2p012cX_LE_c; |
| 3310 | } else | ||
| 3311 | ✗ | av_assert0(0); | |
| 3312 |
4/4✓ Branch 1 taken 13638 times.
✓ Branch 2 taken 191789 times.
✓ Branch 4 taken 157 times.
✓ Branch 5 taken 13481 times.
|
205427 | } else if (isSemiPlanarYUV(dstFormat) && isNBPS(dstFormat)) { |
| 3313 |
1/2✓ Branch 0 taken 157 times.
✗ Branch 1 not taken.
|
157 | if (desc->comp[0].depth == 10) { |
| 3314 |
2/2✓ Branch 1 taken 76 times.
✓ Branch 2 taken 81 times.
|
157 | *yuv2plane1 = isBE(dstFormat) ? yuv2nv20l1_BE_c : yuv2nv20l1_LE_c; |
| 3315 |
2/2✓ Branch 1 taken 76 times.
✓ Branch 2 taken 81 times.
|
157 | *yuv2planeX = isBE(dstFormat) ? yuv2nv20lX_BE_c : yuv2nv20lX_LE_c; |
| 3316 |
2/2✓ Branch 1 taken 76 times.
✓ Branch 2 taken 81 times.
|
157 | *yuv2nv12cX = isBE(dstFormat) ? yuv2nv20cX_BE_c : yuv2nv20cX_LE_c; |
| 3317 | } else | ||
| 3318 | ✗ | av_assert0(0); | |
| 3319 |
2/2✓ Branch 1 taken 35701 times.
✓ Branch 2 taken 169569 times.
|
205270 | } else if (is16BPS(dstFormat)) { |
| 3320 |
2/2✓ Branch 1 taken 9775 times.
✓ Branch 2 taken 25926 times.
|
35701 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c; |
| 3321 |
2/2✓ Branch 1 taken 9775 times.
✓ Branch 2 taken 25926 times.
|
35701 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c; |
| 3322 |
2/2✓ Branch 1 taken 6233 times.
✓ Branch 2 taken 29468 times.
|
35701 | if (isSemiPlanarYUV(dstFormat)) { |
| 3323 |
2/2✓ Branch 1 taken 2589 times.
✓ Branch 2 taken 3644 times.
|
6233 | *yuv2nv12cX = isBE(dstFormat) ? yuv2nv12cX_16BE_c : yuv2nv12cX_16LE_c; |
| 3324 | } | ||
| 3325 |
3/4✓ Branch 1 taken 4370 times.
✓ Branch 2 taken 165199 times.
✓ Branch 4 taken 4370 times.
✗ Branch 5 not taken.
|
169569 | } else if (isDataInHighBits(dstFormat) && isNBPS(dstFormat)) { |
| 3326 |
2/2✓ Branch 0 taken 1422 times.
✓ Branch 1 taken 2948 times.
|
4370 | if (desc->comp[0].depth == 10) { |
| 3327 |
2/2✓ Branch 1 taken 324 times.
✓ Branch 2 taken 1098 times.
|
1422 | *yuv2planeX = isBE(dstFormat) ? yuv2msbplaneX_10BE_c : yuv2msbplaneX_10LE_c; |
| 3328 |
2/2✓ Branch 1 taken 324 times.
✓ Branch 2 taken 1098 times.
|
1422 | *yuv2plane1 = isBE(dstFormat) ? yuv2msbplane1_10BE_c : yuv2msbplane1_10LE_c; |
| 3329 |
1/2✓ Branch 0 taken 2948 times.
✗ Branch 1 not taken.
|
2948 | } else if (desc->comp[0].depth == 12) { |
| 3330 |
2/2✓ Branch 1 taken 1087 times.
✓ Branch 2 taken 1861 times.
|
2948 | *yuv2planeX = isBE(dstFormat) ? yuv2msbplaneX_12BE_c : yuv2msbplaneX_12LE_c; |
| 3331 |
2/2✓ Branch 1 taken 1087 times.
✓ Branch 2 taken 1861 times.
|
2948 | *yuv2plane1 = isBE(dstFormat) ? yuv2msbplane1_12BE_c : yuv2msbplane1_12LE_c; |
| 3332 | } else | ||
| 3333 | ✗ | av_assert0(0); | |
| 3334 |
2/2✓ Branch 1 taken 55536 times.
✓ Branch 2 taken 109663 times.
|
165199 | } else if (isNBPS(dstFormat)) { |
| 3335 |
2/2✓ Branch 0 taken 1806 times.
✓ Branch 1 taken 53730 times.
|
55536 | if (desc->comp[0].depth == 9) { |
| 3336 |
2/2✓ Branch 1 taken 844 times.
✓ Branch 2 taken 962 times.
|
1806 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c; |
| 3337 |
2/2✓ Branch 1 taken 844 times.
✓ Branch 2 taken 962 times.
|
1806 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c; |
| 3338 |
2/2✓ Branch 0 taken 30732 times.
✓ Branch 1 taken 22998 times.
|
53730 | } else if (desc->comp[0].depth == 10) { |
| 3339 |
2/2✓ Branch 1 taken 5095 times.
✓ Branch 2 taken 25637 times.
|
30732 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_10BE_c : yuv2planeX_10LE_c; |
| 3340 |
2/2✓ Branch 1 taken 5095 times.
✓ Branch 2 taken 25637 times.
|
30732 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_10BE_c : yuv2plane1_10LE_c; |
| 3341 |
2/2✓ Branch 0 taken 21389 times.
✓ Branch 1 taken 1609 times.
|
22998 | } else if (desc->comp[0].depth == 12) { |
| 3342 |
2/2✓ Branch 1 taken 5090 times.
✓ Branch 2 taken 16299 times.
|
21389 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_12BE_c : yuv2planeX_12LE_c; |
| 3343 |
2/2✓ Branch 1 taken 5090 times.
✓ Branch 2 taken 16299 times.
|
21389 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_12BE_c : yuv2plane1_12LE_c; |
| 3344 |
1/2✓ Branch 0 taken 1609 times.
✗ Branch 1 not taken.
|
1609 | } else if (desc->comp[0].depth == 14) { |
| 3345 |
2/2✓ Branch 1 taken 753 times.
✓ Branch 2 taken 856 times.
|
1609 | *yuv2planeX = isBE(dstFormat) ? yuv2planeX_14BE_c : yuv2planeX_14LE_c; |
| 3346 |
2/2✓ Branch 1 taken 753 times.
✓ Branch 2 taken 856 times.
|
1609 | *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_14BE_c : yuv2plane1_14LE_c; |
| 3347 | } else | ||
| 3348 | ✗ | av_assert0(0); | |
| 3349 |
2/2✓ Branch 0 taken 110 times.
✓ Branch 1 taken 109553 times.
|
109663 | } else if (dstFormat == AV_PIX_FMT_GRAYF32BE) { |
| 3350 | 110 | *yuv2planeX = yuv2planeX_floatBE_c; | |
| 3351 | 110 | *yuv2plane1 = yuv2plane1_floatBE_c; | |
| 3352 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 109305 times.
|
109553 | } else if (dstFormat == AV_PIX_FMT_GRAYF32LE) { |
| 3353 | 248 | *yuv2planeX = yuv2planeX_floatLE_c; | |
| 3354 | 248 | *yuv2plane1 = yuv2plane1_floatLE_c; | |
| 3355 | } else { | ||
| 3356 | 109305 | *yuv2plane1 = yuv2plane1_8_c; | |
| 3357 | 109305 | *yuv2planeX = yuv2planeX_8_c; | |
| 3358 |
2/2✓ Branch 1 taken 7248 times.
✓ Branch 2 taken 102057 times.
|
109305 | if (isSemiPlanarYUV(dstFormat)) |
| 3359 | 7248 | *yuv2nv12cX = yuv2nv12cX_c; | |
| 3360 | } | ||
| 3361 | |||
| 3362 |
2/2✓ Branch 0 taken 178166 times.
✓ Branch 1 taken 46003 times.
|
224169 | if(c->opts.flags & SWS_FULL_CHR_H_INT) { |
| 3363 |
24/25✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 1644 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 8 times.
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 8 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 3694 times.
✓ Branch 9 taken 1380 times.
✓ Branch 10 taken 3423 times.
✓ Branch 11 taken 8 times.
✓ Branch 12 taken 10 times.
✓ Branch 13 taken 5 times.
✓ Branch 14 taken 352 times.
✓ Branch 15 taken 352 times.
✓ Branch 16 taken 704 times.
✓ Branch 17 taken 403 times.
✓ Branch 18 taken 563 times.
✓ Branch 19 taken 563 times.
✓ Branch 20 taken 25761 times.
✓ Branch 21 taken 340 times.
✓ Branch 22 taken 4286 times.
✓ Branch 23 taken 2441 times.
✗ Branch 24 not taken.
|
46003 | switch (dstFormat) { |
| 3364 | 16 | case AV_PIX_FMT_RGBA: | |
| 3365 | #if CONFIG_SMALL | ||
| 3366 | *yuv2packedX = yuv2rgba32_full_X_c; | ||
| 3367 | *yuv2packed2 = yuv2rgba32_full_2_c; | ||
| 3368 | *yuv2packed1 = yuv2rgba32_full_1_c; | ||
| 3369 | #else | ||
| 3370 | #if CONFIG_SWSCALE_ALPHA | ||
| 3371 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 6 times.
|
16 | if (c->needAlpha) { |
| 3372 | 10 | *yuv2packedX = yuv2rgba32_full_X_c; | |
| 3373 | 10 | *yuv2packed2 = yuv2rgba32_full_2_c; | |
| 3374 | 10 | *yuv2packed1 = yuv2rgba32_full_1_c; | |
| 3375 | } else | ||
| 3376 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3377 | { | ||
| 3378 | 6 | *yuv2packedX = yuv2rgbx32_full_X_c; | |
| 3379 | 6 | *yuv2packed2 = yuv2rgbx32_full_2_c; | |
| 3380 | 6 | *yuv2packed1 = yuv2rgbx32_full_1_c; | |
| 3381 | } | ||
| 3382 | #endif /* !CONFIG_SMALL */ | ||
| 3383 | 16 | break; | |
| 3384 | 16 | case AV_PIX_FMT_ARGB: | |
| 3385 | #if CONFIG_SMALL | ||
| 3386 | *yuv2packedX = yuv2argb32_full_X_c; | ||
| 3387 | *yuv2packed2 = yuv2argb32_full_2_c; | ||
| 3388 | *yuv2packed1 = yuv2argb32_full_1_c; | ||
| 3389 | #else | ||
| 3390 | #if CONFIG_SWSCALE_ALPHA | ||
| 3391 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 6 times.
|
16 | if (c->needAlpha) { |
| 3392 | 10 | *yuv2packedX = yuv2argb32_full_X_c; | |
| 3393 | 10 | *yuv2packed2 = yuv2argb32_full_2_c; | |
| 3394 | 10 | *yuv2packed1 = yuv2argb32_full_1_c; | |
| 3395 | } else | ||
| 3396 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3397 | { | ||
| 3398 | 6 | *yuv2packedX = yuv2xrgb32_full_X_c; | |
| 3399 | 6 | *yuv2packed2 = yuv2xrgb32_full_2_c; | |
| 3400 | 6 | *yuv2packed1 = yuv2xrgb32_full_1_c; | |
| 3401 | } | ||
| 3402 | #endif /* !CONFIG_SMALL */ | ||
| 3403 | 16 | break; | |
| 3404 | 1644 | case AV_PIX_FMT_BGRA: | |
| 3405 | #if CONFIG_SMALL | ||
| 3406 | *yuv2packedX = yuv2bgra32_full_X_c; | ||
| 3407 | *yuv2packed2 = yuv2bgra32_full_2_c; | ||
| 3408 | *yuv2packed1 = yuv2bgra32_full_1_c; | ||
| 3409 | #else | ||
| 3410 | #if CONFIG_SWSCALE_ALPHA | ||
| 3411 |
2/2✓ Branch 0 taken 106 times.
✓ Branch 1 taken 1538 times.
|
1644 | if (c->needAlpha) { |
| 3412 | 106 | *yuv2packedX = yuv2bgra32_full_X_c; | |
| 3413 | 106 | *yuv2packed2 = yuv2bgra32_full_2_c; | |
| 3414 | 106 | *yuv2packed1 = yuv2bgra32_full_1_c; | |
| 3415 | } else | ||
| 3416 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3417 | { | ||
| 3418 | 1538 | *yuv2packedX = yuv2bgrx32_full_X_c; | |
| 3419 | 1538 | *yuv2packed2 = yuv2bgrx32_full_2_c; | |
| 3420 | 1538 | *yuv2packed1 = yuv2bgrx32_full_1_c; | |
| 3421 | } | ||
| 3422 | #endif /* !CONFIG_SMALL */ | ||
| 3423 | 1644 | break; | |
| 3424 | 16 | case AV_PIX_FMT_ABGR: | |
| 3425 | #if CONFIG_SMALL | ||
| 3426 | *yuv2packedX = yuv2abgr32_full_X_c; | ||
| 3427 | *yuv2packed2 = yuv2abgr32_full_2_c; | ||
| 3428 | *yuv2packed1 = yuv2abgr32_full_1_c; | ||
| 3429 | #else | ||
| 3430 | #if CONFIG_SWSCALE_ALPHA | ||
| 3431 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 6 times.
|
16 | if (c->needAlpha) { |
| 3432 | 10 | *yuv2packedX = yuv2abgr32_full_X_c; | |
| 3433 | 10 | *yuv2packed2 = yuv2abgr32_full_2_c; | |
| 3434 | 10 | *yuv2packed1 = yuv2abgr32_full_1_c; | |
| 3435 | } else | ||
| 3436 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3437 | { | ||
| 3438 | 6 | *yuv2packedX = yuv2xbgr32_full_X_c; | |
| 3439 | 6 | *yuv2packed2 = yuv2xbgr32_full_2_c; | |
| 3440 | 6 | *yuv2packed1 = yuv2xbgr32_full_1_c; | |
| 3441 | } | ||
| 3442 | #endif /* !CONFIG_SMALL */ | ||
| 3443 | 16 | break; | |
| 3444 | 8 | case AV_PIX_FMT_RGBA64LE: | |
| 3445 | #if CONFIG_SWSCALE_ALPHA | ||
| 3446 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 3 times.
|
8 | if (c->needAlpha) { |
| 3447 | 5 | *yuv2packedX = yuv2rgba64le_full_X_c; | |
| 3448 | 5 | *yuv2packed2 = yuv2rgba64le_full_2_c; | |
| 3449 | 5 | *yuv2packed1 = yuv2rgba64le_full_1_c; | |
| 3450 | } else | ||
| 3451 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3452 | { | ||
| 3453 | 3 | *yuv2packedX = yuv2rgbx64le_full_X_c; | |
| 3454 | 3 | *yuv2packed2 = yuv2rgbx64le_full_2_c; | |
| 3455 | 3 | *yuv2packed1 = yuv2rgbx64le_full_1_c; | |
| 3456 | } | ||
| 3457 | 8 | break; | |
| 3458 | 5 | case AV_PIX_FMT_RGBA64BE: | |
| 3459 | #if CONFIG_SWSCALE_ALPHA | ||
| 3460 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (c->needAlpha) { |
| 3461 | 5 | *yuv2packedX = yuv2rgba64be_full_X_c; | |
| 3462 | 5 | *yuv2packed2 = yuv2rgba64be_full_2_c; | |
| 3463 | 5 | *yuv2packed1 = yuv2rgba64be_full_1_c; | |
| 3464 | } else | ||
| 3465 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3466 | { | ||
| 3467 | ✗ | *yuv2packedX = yuv2rgbx64be_full_X_c; | |
| 3468 | ✗ | *yuv2packed2 = yuv2rgbx64be_full_2_c; | |
| 3469 | ✗ | *yuv2packed1 = yuv2rgbx64be_full_1_c; | |
| 3470 | } | ||
| 3471 | 5 | break; | |
| 3472 | 8 | case AV_PIX_FMT_BGRA64LE: | |
| 3473 | #if CONFIG_SWSCALE_ALPHA | ||
| 3474 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 3 times.
|
8 | if (c->needAlpha) { |
| 3475 | 5 | *yuv2packedX = yuv2bgra64le_full_X_c; | |
| 3476 | 5 | *yuv2packed2 = yuv2bgra64le_full_2_c; | |
| 3477 | 5 | *yuv2packed1 = yuv2bgra64le_full_1_c; | |
| 3478 | } else | ||
| 3479 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3480 | { | ||
| 3481 | 3 | *yuv2packedX = yuv2bgrx64le_full_X_c; | |
| 3482 | 3 | *yuv2packed2 = yuv2bgrx64le_full_2_c; | |
| 3483 | 3 | *yuv2packed1 = yuv2bgrx64le_full_1_c; | |
| 3484 | } | ||
| 3485 | 8 | break; | |
| 3486 | 5 | case AV_PIX_FMT_BGRA64BE: | |
| 3487 | #if CONFIG_SWSCALE_ALPHA | ||
| 3488 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (c->needAlpha) { |
| 3489 | 5 | *yuv2packedX = yuv2bgra64be_full_X_c; | |
| 3490 | 5 | *yuv2packed2 = yuv2bgra64be_full_2_c; | |
| 3491 | 5 | *yuv2packed1 = yuv2bgra64be_full_1_c; | |
| 3492 | } else | ||
| 3493 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3494 | { | ||
| 3495 | ✗ | *yuv2packedX = yuv2bgrx64be_full_X_c; | |
| 3496 | ✗ | *yuv2packed2 = yuv2bgrx64be_full_2_c; | |
| 3497 | ✗ | *yuv2packed1 = yuv2bgrx64be_full_1_c; | |
| 3498 | } | ||
| 3499 | 5 | break; | |
| 3500 | |||
| 3501 | 3694 | case AV_PIX_FMT_RGB24: | |
| 3502 | 3694 | *yuv2packedX = yuv2rgb24_full_X_c; | |
| 3503 | 3694 | *yuv2packed2 = yuv2rgb24_full_2_c; | |
| 3504 | 3694 | *yuv2packed1 = yuv2rgb24_full_1_c; | |
| 3505 | 3694 | break; | |
| 3506 | 1380 | case AV_PIX_FMT_BGR24: | |
| 3507 | 1380 | *yuv2packedX = yuv2bgr24_full_X_c; | |
| 3508 | 1380 | *yuv2packed2 = yuv2bgr24_full_2_c; | |
| 3509 | 1380 | *yuv2packed1 = yuv2bgr24_full_1_c; | |
| 3510 | 1380 | break; | |
| 3511 | 3423 | case AV_PIX_FMT_RGB48LE: | |
| 3512 | 3423 | *yuv2packedX = yuv2rgb48le_full_X_c; | |
| 3513 | 3423 | *yuv2packed2 = yuv2rgb48le_full_2_c; | |
| 3514 | 3423 | *yuv2packed1 = yuv2rgb48le_full_1_c; | |
| 3515 | 3423 | break; | |
| 3516 | 8 | case AV_PIX_FMT_BGR48LE: | |
| 3517 | 8 | *yuv2packedX = yuv2bgr48le_full_X_c; | |
| 3518 | 8 | *yuv2packed2 = yuv2bgr48le_full_2_c; | |
| 3519 | 8 | *yuv2packed1 = yuv2bgr48le_full_1_c; | |
| 3520 | 8 | break; | |
| 3521 | 10 | case AV_PIX_FMT_RGB48BE: | |
| 3522 | 10 | *yuv2packedX = yuv2rgb48be_full_X_c; | |
| 3523 | 10 | *yuv2packed2 = yuv2rgb48be_full_2_c; | |
| 3524 | 10 | *yuv2packed1 = yuv2rgb48be_full_1_c; | |
| 3525 | 10 | break; | |
| 3526 | 5 | case AV_PIX_FMT_BGR48BE: | |
| 3527 | 5 | *yuv2packedX = yuv2bgr48be_full_X_c; | |
| 3528 | 5 | *yuv2packed2 = yuv2bgr48be_full_2_c; | |
| 3529 | 5 | *yuv2packed1 = yuv2bgr48be_full_1_c; | |
| 3530 | 5 | break; | |
| 3531 | 352 | case AV_PIX_FMT_BGR4_BYTE: | |
| 3532 | 352 | *yuv2packedX = yuv2bgr4_byte_full_X_c; | |
| 3533 | 352 | *yuv2packed2 = yuv2bgr4_byte_full_2_c; | |
| 3534 | 352 | *yuv2packed1 = yuv2bgr4_byte_full_1_c; | |
| 3535 | 352 | break; | |
| 3536 | 352 | case AV_PIX_FMT_RGB4_BYTE: | |
| 3537 | 352 | *yuv2packedX = yuv2rgb4_byte_full_X_c; | |
| 3538 | 352 | *yuv2packed2 = yuv2rgb4_byte_full_2_c; | |
| 3539 | 352 | *yuv2packed1 = yuv2rgb4_byte_full_1_c; | |
| 3540 | 352 | break; | |
| 3541 | 704 | case AV_PIX_FMT_BGR8: | |
| 3542 | 704 | *yuv2packedX = yuv2bgr8_full_X_c; | |
| 3543 | 704 | *yuv2packed2 = yuv2bgr8_full_2_c; | |
| 3544 | 704 | *yuv2packed1 = yuv2bgr8_full_1_c; | |
| 3545 | 704 | break; | |
| 3546 | 403 | case AV_PIX_FMT_RGB8: | |
| 3547 | 403 | *yuv2packedX = yuv2rgb8_full_X_c; | |
| 3548 | 403 | *yuv2packed2 = yuv2rgb8_full_2_c; | |
| 3549 | 403 | *yuv2packed1 = yuv2rgb8_full_1_c; | |
| 3550 | 403 | break; | |
| 3551 | 563 | case AV_PIX_FMT_X2RGB10LE: | |
| 3552 | 563 | *yuv2packedX = yuv2x2rgb10_full_X_c; | |
| 3553 | 563 | *yuv2packed2 = yuv2x2rgb10_full_2_c; | |
| 3554 | 563 | *yuv2packed1 = yuv2x2rgb10_full_1_c; | |
| 3555 | 563 | break; | |
| 3556 | 563 | case AV_PIX_FMT_X2BGR10LE: | |
| 3557 | 563 | *yuv2packedX = yuv2x2bgr10_full_X_c; | |
| 3558 | 563 | *yuv2packed2 = yuv2x2bgr10_full_2_c; | |
| 3559 | 563 | *yuv2packed1 = yuv2x2bgr10_full_1_c; | |
| 3560 | 563 | break; | |
| 3561 | 25761 | case AV_PIX_FMT_GBRP: | |
| 3562 | case AV_PIX_FMT_GBRP9BE: | ||
| 3563 | case AV_PIX_FMT_GBRP9LE: | ||
| 3564 | case AV_PIX_FMT_GBRP10BE: | ||
| 3565 | case AV_PIX_FMT_GBRP10LE: | ||
| 3566 | case AV_PIX_FMT_GBRP12BE: | ||
| 3567 | case AV_PIX_FMT_GBRP12LE: | ||
| 3568 | case AV_PIX_FMT_GBRP14BE: | ||
| 3569 | case AV_PIX_FMT_GBRP14LE: | ||
| 3570 | case AV_PIX_FMT_GBRAP: | ||
| 3571 | case AV_PIX_FMT_GBRAP10BE: | ||
| 3572 | case AV_PIX_FMT_GBRAP10LE: | ||
| 3573 | case AV_PIX_FMT_GBRAP12BE: | ||
| 3574 | case AV_PIX_FMT_GBRAP12LE: | ||
| 3575 | case AV_PIX_FMT_GBRAP14BE: | ||
| 3576 | case AV_PIX_FMT_GBRAP14LE: | ||
| 3577 | 25761 | *yuv2anyX = yuv2gbrp_full_X_c; | |
| 3578 | 25761 | break; | |
| 3579 | 340 | case AV_PIX_FMT_GBRP10MSBBE: | |
| 3580 | case AV_PIX_FMT_GBRP10MSBLE: | ||
| 3581 | case AV_PIX_FMT_GBRP12MSBBE: | ||
| 3582 | case AV_PIX_FMT_GBRP12MSBLE: | ||
| 3583 | 340 | *yuv2anyX = yuv2gbrpmsb_full_X_c; | |
| 3584 | 340 | break; | |
| 3585 | 4286 | case AV_PIX_FMT_GBRP16BE: | |
| 3586 | case AV_PIX_FMT_GBRP16LE: | ||
| 3587 | case AV_PIX_FMT_GBRAP16BE: | ||
| 3588 | case AV_PIX_FMT_GBRAP16LE: | ||
| 3589 | 4286 | *yuv2anyX = yuv2gbrp16_full_X_c; | |
| 3590 | 4286 | break; | |
| 3591 | 2441 | case AV_PIX_FMT_GBRPF32BE: | |
| 3592 | case AV_PIX_FMT_GBRPF32LE: | ||
| 3593 | case AV_PIX_FMT_GBRAPF32BE: | ||
| 3594 | case AV_PIX_FMT_GBRAPF32LE: | ||
| 3595 | 2441 | *yuv2anyX = yuv2gbrpf32_full_X_c; | |
| 3596 | 2441 | break; | |
| 3597 | } | ||
| 3598 |
3/4✓ Branch 0 taken 32828 times.
✓ Branch 1 taken 13175 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 32828 times.
|
46003 | if (!*yuv2packedX && !*yuv2anyX) |
| 3599 | ✗ | goto YUV_PACKED; | |
| 3600 | } else { | ||
| 3601 | 178166 | YUV_PACKED: | |
| 3602 |
21/21✓ Branch 0 taken 167 times.
✓ Branch 1 taken 115 times.
✓ Branch 2 taken 115 times.
✓ Branch 3 taken 115 times.
✓ Branch 4 taken 3547 times.
✓ Branch 5 taken 249 times.
✓ Branch 6 taken 120 times.
✓ Branch 7 taken 115 times.
✓ Branch 8 taken 1488 times.
✓ Branch 9 taken 564 times.
✓ Branch 10 taken 6337 times.
✓ Branch 11 taken 1456 times.
✓ Branch 12 taken 1620 times.
✓ Branch 13 taken 2731 times.
✓ Branch 14 taken 480 times.
✓ Branch 15 taken 1155 times.
✓ Branch 16 taken 78 times.
✓ Branch 17 taken 259 times.
✓ Branch 18 taken 76 times.
✓ Branch 19 taken 76 times.
✓ Branch 20 taken 157303 times.
|
178166 | switch (dstFormat) { |
| 3603 | 167 | case AV_PIX_FMT_RGBA64LE: | |
| 3604 | #if CONFIG_SWSCALE_ALPHA | ||
| 3605 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 167 times.
|
167 | if (c->needAlpha) { |
| 3606 | ✗ | *yuv2packed1 = yuv2rgba64le_1_c; | |
| 3607 | ✗ | *yuv2packed2 = yuv2rgba64le_2_c; | |
| 3608 | ✗ | *yuv2packedX = yuv2rgba64le_X_c; | |
| 3609 | } else | ||
| 3610 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3611 | { | ||
| 3612 | 167 | *yuv2packed1 = yuv2rgbx64le_1_c; | |
| 3613 | 167 | *yuv2packed2 = yuv2rgbx64le_2_c; | |
| 3614 | 167 | *yuv2packedX = yuv2rgbx64le_X_c; | |
| 3615 | } | ||
| 3616 | 167 | break; | |
| 3617 | 115 | case AV_PIX_FMT_RGBA64BE: | |
| 3618 | #if CONFIG_SWSCALE_ALPHA | ||
| 3619 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 115 times.
|
115 | if (c->needAlpha) { |
| 3620 | ✗ | *yuv2packed1 = yuv2rgba64be_1_c; | |
| 3621 | ✗ | *yuv2packed2 = yuv2rgba64be_2_c; | |
| 3622 | ✗ | *yuv2packedX = yuv2rgba64be_X_c; | |
| 3623 | } else | ||
| 3624 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3625 | { | ||
| 3626 | 115 | *yuv2packed1 = yuv2rgbx64be_1_c; | |
| 3627 | 115 | *yuv2packed2 = yuv2rgbx64be_2_c; | |
| 3628 | 115 | *yuv2packedX = yuv2rgbx64be_X_c; | |
| 3629 | } | ||
| 3630 | 115 | break; | |
| 3631 | 115 | case AV_PIX_FMT_BGRA64LE: | |
| 3632 | #if CONFIG_SWSCALE_ALPHA | ||
| 3633 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 115 times.
|
115 | if (c->needAlpha) { |
| 3634 | ✗ | *yuv2packed1 = yuv2bgra64le_1_c; | |
| 3635 | ✗ | *yuv2packed2 = yuv2bgra64le_2_c; | |
| 3636 | ✗ | *yuv2packedX = yuv2bgra64le_X_c; | |
| 3637 | } else | ||
| 3638 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3639 | { | ||
| 3640 | 115 | *yuv2packed1 = yuv2bgrx64le_1_c; | |
| 3641 | 115 | *yuv2packed2 = yuv2bgrx64le_2_c; | |
| 3642 | 115 | *yuv2packedX = yuv2bgrx64le_X_c; | |
| 3643 | } | ||
| 3644 | 115 | break; | |
| 3645 | 115 | case AV_PIX_FMT_BGRA64BE: | |
| 3646 | #if CONFIG_SWSCALE_ALPHA | ||
| 3647 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 115 times.
|
115 | if (c->needAlpha) { |
| 3648 | ✗ | *yuv2packed1 = yuv2bgra64be_1_c; | |
| 3649 | ✗ | *yuv2packed2 = yuv2bgra64be_2_c; | |
| 3650 | ✗ | *yuv2packedX = yuv2bgra64be_X_c; | |
| 3651 | } else | ||
| 3652 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3653 | { | ||
| 3654 | 115 | *yuv2packed1 = yuv2bgrx64be_1_c; | |
| 3655 | 115 | *yuv2packed2 = yuv2bgrx64be_2_c; | |
| 3656 | 115 | *yuv2packedX = yuv2bgrx64be_X_c; | |
| 3657 | } | ||
| 3658 | 115 | break; | |
| 3659 | 3547 | case AV_PIX_FMT_RGB48LE: | |
| 3660 | 3547 | *yuv2packed1 = yuv2rgb48le_1_c; | |
| 3661 | 3547 | *yuv2packed2 = yuv2rgb48le_2_c; | |
| 3662 | 3547 | *yuv2packedX = yuv2rgb48le_X_c; | |
| 3663 | 3547 | break; | |
| 3664 | 249 | case AV_PIX_FMT_RGB48BE: | |
| 3665 | 249 | *yuv2packed1 = yuv2rgb48be_1_c; | |
| 3666 | 249 | *yuv2packed2 = yuv2rgb48be_2_c; | |
| 3667 | 249 | *yuv2packedX = yuv2rgb48be_X_c; | |
| 3668 | 249 | break; | |
| 3669 | 120 | case AV_PIX_FMT_BGR48LE: | |
| 3670 | 120 | *yuv2packed1 = yuv2bgr48le_1_c; | |
| 3671 | 120 | *yuv2packed2 = yuv2bgr48le_2_c; | |
| 3672 | 120 | *yuv2packedX = yuv2bgr48le_X_c; | |
| 3673 | 120 | break; | |
| 3674 | 115 | case AV_PIX_FMT_BGR48BE: | |
| 3675 | 115 | *yuv2packed1 = yuv2bgr48be_1_c; | |
| 3676 | 115 | *yuv2packed2 = yuv2bgr48be_2_c; | |
| 3677 | 115 | *yuv2packedX = yuv2bgr48be_X_c; | |
| 3678 | 115 | break; | |
| 3679 | 1488 | case AV_PIX_FMT_RGB32: | |
| 3680 | case AV_PIX_FMT_BGR32: | ||
| 3681 | #if CONFIG_SMALL | ||
| 3682 | *yuv2packed1 = yuv2rgb32_1_c; | ||
| 3683 | *yuv2packed2 = yuv2rgb32_2_c; | ||
| 3684 | *yuv2packedX = yuv2rgb32_X_c; | ||
| 3685 | #else | ||
| 3686 | #if CONFIG_SWSCALE_ALPHA | ||
| 3687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1488 times.
|
1488 | if (c->needAlpha) { |
| 3688 | ✗ | *yuv2packed1 = yuv2rgba32_1_c; | |
| 3689 | ✗ | *yuv2packed2 = yuv2rgba32_2_c; | |
| 3690 | ✗ | *yuv2packedX = yuv2rgba32_X_c; | |
| 3691 | } else | ||
| 3692 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3693 | { | ||
| 3694 | 1488 | *yuv2packed1 = yuv2rgbx32_1_c; | |
| 3695 | 1488 | *yuv2packed2 = yuv2rgbx32_2_c; | |
| 3696 | 1488 | *yuv2packedX = yuv2rgbx32_X_c; | |
| 3697 | } | ||
| 3698 | #endif /* !CONFIG_SMALL */ | ||
| 3699 | 1488 | break; | |
| 3700 | 564 | case AV_PIX_FMT_RGB32_1: | |
| 3701 | case AV_PIX_FMT_BGR32_1: | ||
| 3702 | #if CONFIG_SMALL | ||
| 3703 | *yuv2packed1 = yuv2rgb32_1_1_c; | ||
| 3704 | *yuv2packed2 = yuv2rgb32_1_2_c; | ||
| 3705 | *yuv2packedX = yuv2rgb32_1_X_c; | ||
| 3706 | #else | ||
| 3707 | #if CONFIG_SWSCALE_ALPHA | ||
| 3708 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 564 times.
|
564 | if (c->needAlpha) { |
| 3709 | ✗ | *yuv2packed1 = yuv2rgba32_1_1_c; | |
| 3710 | ✗ | *yuv2packed2 = yuv2rgba32_1_2_c; | |
| 3711 | ✗ | *yuv2packedX = yuv2rgba32_1_X_c; | |
| 3712 | } else | ||
| 3713 | #endif /* CONFIG_SWSCALE_ALPHA */ | ||
| 3714 | { | ||
| 3715 | 564 | *yuv2packed1 = yuv2rgbx32_1_1_c; | |
| 3716 | 564 | *yuv2packed2 = yuv2rgbx32_1_2_c; | |
| 3717 | 564 | *yuv2packedX = yuv2rgbx32_1_X_c; | |
| 3718 | } | ||
| 3719 | #endif /* !CONFIG_SMALL */ | ||
| 3720 | 564 | break; | |
| 3721 | 6337 | case AV_PIX_FMT_RGB24: | |
| 3722 | 6337 | *yuv2packed1 = yuv2rgb24_1_c; | |
| 3723 | 6337 | *yuv2packed2 = yuv2rgb24_2_c; | |
| 3724 | 6337 | *yuv2packedX = yuv2rgb24_X_c; | |
| 3725 | 6337 | break; | |
| 3726 | 1456 | case AV_PIX_FMT_BGR24: | |
| 3727 | 1456 | *yuv2packed1 = yuv2bgr24_1_c; | |
| 3728 | 1456 | *yuv2packed2 = yuv2bgr24_2_c; | |
| 3729 | 1456 | *yuv2packedX = yuv2bgr24_X_c; | |
| 3730 | 1456 | break; | |
| 3731 | 1620 | case AV_PIX_FMT_RGB565LE: | |
| 3732 | case AV_PIX_FMT_RGB565BE: | ||
| 3733 | case AV_PIX_FMT_BGR565LE: | ||
| 3734 | case AV_PIX_FMT_BGR565BE: | ||
| 3735 | 1620 | *yuv2packed1 = yuv2rgb16_1_c; | |
| 3736 | 1620 | *yuv2packed2 = yuv2rgb16_2_c; | |
| 3737 | 1620 | *yuv2packedX = yuv2rgb16_X_c; | |
| 3738 | 1620 | break; | |
| 3739 | 2731 | case AV_PIX_FMT_RGB555LE: | |
| 3740 | case AV_PIX_FMT_RGB555BE: | ||
| 3741 | case AV_PIX_FMT_BGR555LE: | ||
| 3742 | case AV_PIX_FMT_BGR555BE: | ||
| 3743 | 2731 | *yuv2packed1 = yuv2rgb15_1_c; | |
| 3744 | 2731 | *yuv2packed2 = yuv2rgb15_2_c; | |
| 3745 | 2731 | *yuv2packedX = yuv2rgb15_X_c; | |
| 3746 | 2731 | break; | |
| 3747 | 480 | case AV_PIX_FMT_RGB444LE: | |
| 3748 | case AV_PIX_FMT_RGB444BE: | ||
| 3749 | case AV_PIX_FMT_BGR444LE: | ||
| 3750 | case AV_PIX_FMT_BGR444BE: | ||
| 3751 | 480 | *yuv2packed1 = yuv2rgb12_1_c; | |
| 3752 | 480 | *yuv2packed2 = yuv2rgb12_2_c; | |
| 3753 | 480 | *yuv2packedX = yuv2rgb12_X_c; | |
| 3754 | 480 | break; | |
| 3755 | 1155 | case AV_PIX_FMT_RGB8: | |
| 3756 | case AV_PIX_FMT_BGR8: | ||
| 3757 | 1155 | *yuv2packed1 = yuv2rgb8_1_c; | |
| 3758 | 1155 | *yuv2packed2 = yuv2rgb8_2_c; | |
| 3759 | 1155 | *yuv2packedX = yuv2rgb8_X_c; | |
| 3760 | 1155 | break; | |
| 3761 | 78 | case AV_PIX_FMT_RGB4: | |
| 3762 | case AV_PIX_FMT_BGR4: | ||
| 3763 | 78 | *yuv2packed1 = yuv2rgb4_1_c; | |
| 3764 | 78 | *yuv2packed2 = yuv2rgb4_2_c; | |
| 3765 | 78 | *yuv2packedX = yuv2rgb4_X_c; | |
| 3766 | 78 | break; | |
| 3767 | 259 | case AV_PIX_FMT_RGB4_BYTE: | |
| 3768 | case AV_PIX_FMT_BGR4_BYTE: | ||
| 3769 | 259 | *yuv2packed1 = yuv2rgb4b_1_c; | |
| 3770 | 259 | *yuv2packed2 = yuv2rgb4b_2_c; | |
| 3771 | 259 | *yuv2packedX = yuv2rgb4b_X_c; | |
| 3772 | 259 | break; | |
| 3773 | 76 | case AV_PIX_FMT_X2RGB10LE: | |
| 3774 | case AV_PIX_FMT_X2RGB10BE: | ||
| 3775 | 76 | *yuv2packed1 = yuv2x2rgb10_1_c; | |
| 3776 | 76 | *yuv2packed2 = yuv2x2rgb10_2_c; | |
| 3777 | 76 | *yuv2packedX = yuv2x2rgb10_X_c; | |
| 3778 | 76 | break; | |
| 3779 | 76 | case AV_PIX_FMT_X2BGR10LE: | |
| 3780 | case AV_PIX_FMT_X2BGR10BE: | ||
| 3781 | 76 | *yuv2packed1 = yuv2x2bgr10_1_c; | |
| 3782 | 76 | *yuv2packed2 = yuv2x2bgr10_2_c; | |
| 3783 | 76 | *yuv2packedX = yuv2x2bgr10_X_c; | |
| 3784 | 76 | break; | |
| 3785 | } | ||
| 3786 | } | ||
| 3787 |
24/24✓ Branch 0 taken 1720 times.
✓ Branch 1 taken 806 times.
✓ Branch 2 taken 816 times.
✓ Branch 3 taken 753 times.
✓ Branch 4 taken 1056 times.
✓ Branch 5 taken 1177 times.
✓ Branch 6 taken 86 times.
✓ Branch 7 taken 86 times.
✓ Branch 8 taken 81 times.
✓ Branch 9 taken 1167 times.
✓ Branch 10 taken 81 times.
✓ Branch 11 taken 81 times.
✓ Branch 12 taken 86 times.
✓ Branch 13 taken 859 times.
✓ Branch 14 taken 490 times.
✓ Branch 15 taken 763 times.
✓ Branch 16 taken 763 times.
✓ Branch 17 taken 763 times.
✓ Branch 18 taken 949 times.
✓ Branch 19 taken 949 times.
✓ Branch 20 taken 748 times.
✓ Branch 21 taken 748 times.
✓ Branch 22 taken 934 times.
✓ Branch 23 taken 208207 times.
|
224169 | switch (dstFormat) { |
| 3788 | 1720 | case AV_PIX_FMT_MONOWHITE: | |
| 3789 | 1720 | *yuv2packed1 = yuv2monowhite_1_c; | |
| 3790 | 1720 | *yuv2packed2 = yuv2monowhite_2_c; | |
| 3791 | 1720 | *yuv2packedX = yuv2monowhite_X_c; | |
| 3792 | 1720 | break; | |
| 3793 | 806 | case AV_PIX_FMT_MONOBLACK: | |
| 3794 | 806 | *yuv2packed1 = yuv2monoblack_1_c; | |
| 3795 | 806 | *yuv2packed2 = yuv2monoblack_2_c; | |
| 3796 | 806 | *yuv2packedX = yuv2monoblack_X_c; | |
| 3797 | 806 | break; | |
| 3798 | 816 | case AV_PIX_FMT_YUYV422: | |
| 3799 | 816 | *yuv2packed1 = yuv2yuyv422_1_c; | |
| 3800 | 816 | *yuv2packed2 = yuv2yuyv422_2_c; | |
| 3801 | 816 | *yuv2packedX = yuv2yuyv422_X_c; | |
| 3802 | 816 | break; | |
| 3803 | 753 | case AV_PIX_FMT_YVYU422: | |
| 3804 | 753 | *yuv2packed1 = yuv2yvyu422_1_c; | |
| 3805 | 753 | *yuv2packed2 = yuv2yvyu422_2_c; | |
| 3806 | 753 | *yuv2packedX = yuv2yvyu422_X_c; | |
| 3807 | 753 | break; | |
| 3808 | 1056 | case AV_PIX_FMT_UYVY422: | |
| 3809 | 1056 | *yuv2packed1 = yuv2uyvy422_1_c; | |
| 3810 | 1056 | *yuv2packed2 = yuv2uyvy422_2_c; | |
| 3811 | 1056 | *yuv2packedX = yuv2uyvy422_X_c; | |
| 3812 | 1056 | break; | |
| 3813 | 1177 | case AV_PIX_FMT_VYU444: | |
| 3814 | 1177 | *yuv2packed1 = yuv2vyu444_1_c; | |
| 3815 | 1177 | *yuv2packed2 = yuv2vyu444_2_c; | |
| 3816 | 1177 | *yuv2packedX = yuv2vyu444_X_c; | |
| 3817 | 1177 | break; | |
| 3818 | 86 | case AV_PIX_FMT_YA8: | |
| 3819 | 86 | *yuv2packed1 = yuv2ya8_1_c; | |
| 3820 | 86 | *yuv2packed2 = yuv2ya8_2_c; | |
| 3821 | 86 | *yuv2packedX = yuv2ya8_X_c; | |
| 3822 | 86 | break; | |
| 3823 | 86 | case AV_PIX_FMT_YA16LE: | |
| 3824 | 86 | *yuv2packed1 = yuv2ya16le_1_c; | |
| 3825 | 86 | *yuv2packed2 = yuv2ya16le_2_c; | |
| 3826 | 86 | *yuv2packedX = yuv2ya16le_X_c; | |
| 3827 | 86 | break; | |
| 3828 | 81 | case AV_PIX_FMT_YA16BE: | |
| 3829 | 81 | *yuv2packed1 = yuv2ya16be_1_c; | |
| 3830 | 81 | *yuv2packed2 = yuv2ya16be_2_c; | |
| 3831 | 81 | *yuv2packedX = yuv2ya16be_X_c; | |
| 3832 | 81 | break; | |
| 3833 | 1167 | case AV_PIX_FMT_V30XLE: | |
| 3834 | 1167 | *yuv2packedX = yuv2v30xle_X_c; | |
| 3835 | 1167 | break; | |
| 3836 | 81 | case AV_PIX_FMT_AYUV64LE: | |
| 3837 | 81 | *yuv2packedX = yuv2ayuv64le_X_c; | |
| 3838 | 81 | break; | |
| 3839 | 81 | case AV_PIX_FMT_AYUV64BE: | |
| 3840 | 81 | *yuv2packedX = yuv2ayuv64be_X_c; | |
| 3841 | 81 | break; | |
| 3842 | 86 | case AV_PIX_FMT_AYUV: | |
| 3843 | 86 | *yuv2packed1 = yuv2ayuv_1_c; | |
| 3844 | 86 | *yuv2packed2 = yuv2ayuv_2_c; | |
| 3845 | 86 | *yuv2packedX = yuv2ayuv_X_c; | |
| 3846 | 86 | break; | |
| 3847 | 859 | case AV_PIX_FMT_VUYA: | |
| 3848 | case AV_PIX_FMT_VUYX: | ||
| 3849 | 859 | *yuv2packed1 = yuv2vuyX_1_c; | |
| 3850 | 859 | *yuv2packed2 = yuv2vuyX_2_c; | |
| 3851 | 859 | *yuv2packedX = yuv2vuyX_X_c; | |
| 3852 | 859 | break; | |
| 3853 | 490 | case AV_PIX_FMT_UYVA: | |
| 3854 | 490 | *yuv2packed1 = yuv2uyva_1_c; | |
| 3855 | 490 | *yuv2packed2 = yuv2uyva_2_c; | |
| 3856 | 490 | *yuv2packedX = yuv2uyva_X_c; | |
| 3857 | 490 | break; | |
| 3858 | 763 | case AV_PIX_FMT_XV30LE: | |
| 3859 | 763 | *yuv2packedX = yuv2xv30le_X_c; | |
| 3860 | 763 | break; | |
| 3861 | 763 | case AV_PIX_FMT_XV36LE: | |
| 3862 | 763 | *yuv2packedX = yuv2xv36le_X_c; | |
| 3863 | 763 | break; | |
| 3864 | 763 | case AV_PIX_FMT_XV36BE: | |
| 3865 | 763 | *yuv2packedX = yuv2xv36be_X_c; | |
| 3866 | 763 | break; | |
| 3867 | 949 | case AV_PIX_FMT_XV48LE: | |
| 3868 | 949 | *yuv2packedX = yuv2xv48le_X_c; | |
| 3869 | 949 | break; | |
| 3870 | 949 | case AV_PIX_FMT_XV48BE: | |
| 3871 | 949 | *yuv2packedX = yuv2xv48be_X_c; | |
| 3872 | 949 | break; | |
| 3873 | 748 | case AV_PIX_FMT_Y210LE: | |
| 3874 | 748 | *yuv2packedX = yuv2y210le_X_c; | |
| 3875 | 748 | break; | |
| 3876 | 748 | case AV_PIX_FMT_Y212LE: | |
| 3877 | 748 | *yuv2packedX = yuv2y212le_X_c; | |
| 3878 | 748 | break; | |
| 3879 | 934 | case AV_PIX_FMT_Y216LE: | |
| 3880 | 934 | *yuv2packedX = yuv2y216le_X_c; | |
| 3881 | 934 | break; | |
| 3882 | } | ||
| 3883 | 224169 | } | |
| 3884 |