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