| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * Copyright (C) 2001-2011 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 <inttypes.h> | ||
| 22 | #include <string.h> | ||
| 23 | #include <math.h> | ||
| 24 | #include <stdio.h> | ||
| 25 | #include "config.h" | ||
| 26 | #include "libavutil/attributes.h" | ||
| 27 | #include "swscale.h" | ||
| 28 | #include "swscale_internal.h" | ||
| 29 | #include "rgb2rgb.h" | ||
| 30 | #include "libavutil/intreadwrite.h" | ||
| 31 | #include "libavutil/avutil.h" | ||
| 32 | #include "libavutil/mathematics.h" | ||
| 33 | #include "libavutil/mem_internal.h" | ||
| 34 | #include "libavutil/bswap.h" | ||
| 35 | #include "libavutil/pixdesc.h" | ||
| 36 | #include "libavutil/avassert.h" | ||
| 37 | #include "libavutil/avconfig.h" | ||
| 38 | |||
| 39 | DECLARE_ALIGNED(8, static const uint8_t, dithers)[8][8][8]={ | ||
| 40 | { | ||
| 41 | { 0, 1, 0, 1, 0, 1, 0, 1,}, | ||
| 42 | { 1, 0, 1, 0, 1, 0, 1, 0,}, | ||
| 43 | { 0, 1, 0, 1, 0, 1, 0, 1,}, | ||
| 44 | { 1, 0, 1, 0, 1, 0, 1, 0,}, | ||
| 45 | { 0, 1, 0, 1, 0, 1, 0, 1,}, | ||
| 46 | { 1, 0, 1, 0, 1, 0, 1, 0,}, | ||
| 47 | { 0, 1, 0, 1, 0, 1, 0, 1,}, | ||
| 48 | { 1, 0, 1, 0, 1, 0, 1, 0,}, | ||
| 49 | },{ | ||
| 50 | { 1, 2, 1, 2, 1, 2, 1, 2,}, | ||
| 51 | { 3, 0, 3, 0, 3, 0, 3, 0,}, | ||
| 52 | { 1, 2, 1, 2, 1, 2, 1, 2,}, | ||
| 53 | { 3, 0, 3, 0, 3, 0, 3, 0,}, | ||
| 54 | { 1, 2, 1, 2, 1, 2, 1, 2,}, | ||
| 55 | { 3, 0, 3, 0, 3, 0, 3, 0,}, | ||
| 56 | { 1, 2, 1, 2, 1, 2, 1, 2,}, | ||
| 57 | { 3, 0, 3, 0, 3, 0, 3, 0,}, | ||
| 58 | },{ | ||
| 59 | { 2, 4, 3, 5, 2, 4, 3, 5,}, | ||
| 60 | { 6, 0, 7, 1, 6, 0, 7, 1,}, | ||
| 61 | { 3, 5, 2, 4, 3, 5, 2, 4,}, | ||
| 62 | { 7, 1, 6, 0, 7, 1, 6, 0,}, | ||
| 63 | { 2, 4, 3, 5, 2, 4, 3, 5,}, | ||
| 64 | { 6, 0, 7, 1, 6, 0, 7, 1,}, | ||
| 65 | { 3, 5, 2, 4, 3, 5, 2, 4,}, | ||
| 66 | { 7, 1, 6, 0, 7, 1, 6, 0,}, | ||
| 67 | },{ | ||
| 68 | { 4, 8, 7, 11, 4, 8, 7, 11,}, | ||
| 69 | { 12, 0, 15, 3, 12, 0, 15, 3,}, | ||
| 70 | { 6, 10, 5, 9, 6, 10, 5, 9,}, | ||
| 71 | { 14, 2, 13, 1, 14, 2, 13, 1,}, | ||
| 72 | { 4, 8, 7, 11, 4, 8, 7, 11,}, | ||
| 73 | { 12, 0, 15, 3, 12, 0, 15, 3,}, | ||
| 74 | { 6, 10, 5, 9, 6, 10, 5, 9,}, | ||
| 75 | { 14, 2, 13, 1, 14, 2, 13, 1,}, | ||
| 76 | },{ | ||
| 77 | { 9, 17, 15, 23, 8, 16, 14, 22,}, | ||
| 78 | { 25, 1, 31, 7, 24, 0, 30, 6,}, | ||
| 79 | { 13, 21, 11, 19, 12, 20, 10, 18,}, | ||
| 80 | { 29, 5, 27, 3, 28, 4, 26, 2,}, | ||
| 81 | { 8, 16, 14, 22, 9, 17, 15, 23,}, | ||
| 82 | { 24, 0, 30, 6, 25, 1, 31, 7,}, | ||
| 83 | { 12, 20, 10, 18, 13, 21, 11, 19,}, | ||
| 84 | { 28, 4, 26, 2, 29, 5, 27, 3,}, | ||
| 85 | },{ | ||
| 86 | { 18, 34, 30, 46, 17, 33, 29, 45,}, | ||
| 87 | { 50, 2, 62, 14, 49, 1, 61, 13,}, | ||
| 88 | { 26, 42, 22, 38, 25, 41, 21, 37,}, | ||
| 89 | { 58, 10, 54, 6, 57, 9, 53, 5,}, | ||
| 90 | { 16, 32, 28, 44, 19, 35, 31, 47,}, | ||
| 91 | { 48, 0, 60, 12, 51, 3, 63, 15,}, | ||
| 92 | { 24, 40, 20, 36, 27, 43, 23, 39,}, | ||
| 93 | { 56, 8, 52, 4, 59, 11, 55, 7,}, | ||
| 94 | },{ | ||
| 95 | { 18, 34, 30, 46, 17, 33, 29, 45,}, | ||
| 96 | { 50, 2, 62, 14, 49, 1, 61, 13,}, | ||
| 97 | { 26, 42, 22, 38, 25, 41, 21, 37,}, | ||
| 98 | { 58, 10, 54, 6, 57, 9, 53, 5,}, | ||
| 99 | { 16, 32, 28, 44, 19, 35, 31, 47,}, | ||
| 100 | { 48, 0, 60, 12, 51, 3, 63, 15,}, | ||
| 101 | { 24, 40, 20, 36, 27, 43, 23, 39,}, | ||
| 102 | { 56, 8, 52, 4, 59, 11, 55, 7,}, | ||
| 103 | },{ | ||
| 104 | { 36, 68, 60, 92, 34, 66, 58, 90,}, | ||
| 105 | { 100, 4,124, 28, 98, 2,122, 26,}, | ||
| 106 | { 52, 84, 44, 76, 50, 82, 42, 74,}, | ||
| 107 | { 116, 20,108, 12,114, 18,106, 10,}, | ||
| 108 | { 32, 64, 56, 88, 38, 70, 62, 94,}, | ||
| 109 | { 96, 0,120, 24,102, 6,126, 30,}, | ||
| 110 | { 48, 80, 40, 72, 54, 86, 46, 78,}, | ||
| 111 | { 112, 16,104, 8,118, 22,110, 14,}, | ||
| 112 | }}; | ||
| 113 | |||
| 114 | |||
| 115 | 2480 | static void fillPlane(uint8_t *plane, int stride, int width, int height, int y, | |
| 116 | uint8_t val) | ||
| 117 | { | ||
| 118 | int i; | ||
| 119 | 2480 | uint8_t *ptr = plane + stride * y; | |
| 120 |
2/2✓ Branch 0 taken 218880 times.
✓ Branch 1 taken 2480 times.
|
221360 | for (i = 0; i < height; i++) { |
| 121 | 218880 | memset(ptr, val, width); | |
| 122 | 218880 | ptr += stride; | |
| 123 | } | ||
| 124 | 2480 | } | |
| 125 | |||
| 126 | 3214 | void ff_copyPlane(const uint8_t *src, int srcStride, | |
| 127 | int srcSliceY, int srcSliceH, int width, | ||
| 128 | uint8_t *dst, int dstStride) | ||
| 129 | { | ||
| 130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3214 times.
|
3214 | if (!srcSliceH) |
| 131 | ✗ | return; | |
| 132 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3214 times.
|
3214 | av_assert0(srcSliceH > 0); |
| 133 | |||
| 134 | 3214 | dst += dstStride * srcSliceY; | |
| 135 |
3/4✓ Branch 0 taken 2113 times.
✓ Branch 1 taken 1101 times.
✓ Branch 2 taken 2113 times.
✗ Branch 3 not taken.
|
3214 | if (dstStride == srcStride && srcStride > 0) { |
| 136 | 2113 | memcpy(dst, src, (srcSliceH - 1) * dstStride + width); | |
| 137 | } else { | ||
| 138 | int i; | ||
| 139 |
2/2✓ Branch 0 taken 48348 times.
✓ Branch 1 taken 1101 times.
|
49449 | for (i = 0; i < srcSliceH; i++) { |
| 140 | 48348 | memcpy(dst, src, width); | |
| 141 | 48348 | src += srcStride; | |
| 142 | 48348 | dst += dstStride; | |
| 143 | } | ||
| 144 | } | ||
| 145 | } | ||
| 146 | |||
| 147 | 984 | static int planarToNv12Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 148 | const int srcStride[], int srcSliceY, | ||
| 149 | int srcSliceH, uint8_t *const dstParam[], | ||
| 150 | const int dstStride[]) | ||
| 151 | { | ||
| 152 | 984 | uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
| 153 | |||
| 154 | 984 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w, | |
| 155 | dstParam[0], dstStride[0]); | ||
| 156 | |||
| 157 |
2/2✓ Branch 0 taken 502 times.
✓ Branch 1 taken 482 times.
|
984 | if (c->opts.dst_format == AV_PIX_FMT_NV12) |
| 158 | 502 | interleaveBytes(src[1], src[2], dst, c->chrSrcW, (srcSliceH + 1) / 2, | |
| 159 | 502 | srcStride[1], srcStride[2], dstStride[1]); | |
| 160 | else | ||
| 161 | 482 | interleaveBytes(src[2], src[1], dst, c->chrSrcW, (srcSliceH + 1) / 2, | |
| 162 | 482 | srcStride[2], srcStride[1], dstStride[1]); | |
| 163 | |||
| 164 | 984 | return srcSliceH; | |
| 165 | } | ||
| 166 | |||
| 167 | 900 | static int nv12ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 168 | const int srcStride[], int srcSliceY, | ||
| 169 | int srcSliceH, uint8_t *const dstParam[], | ||
| 170 | const int dstStride[]) | ||
| 171 | { | ||
| 172 | 900 | uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
| 173 | 900 | uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
| 174 | |||
| 175 | 900 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w, | |
| 176 | dstParam[0], dstStride[0]); | ||
| 177 | |||
| 178 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 450 times.
|
900 | if (c->opts.src_format == AV_PIX_FMT_NV12) |
| 179 | 450 | deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, (srcSliceH + 1) / 2, | |
| 180 | 450 | srcStride[1], dstStride[1], dstStride[2]); | |
| 181 | else | ||
| 182 | 450 | deinterleaveBytes(src[1], dst2, dst1, c->chrSrcW, (srcSliceH + 1) / 2, | |
| 183 | 450 | srcStride[1], dstStride[2], dstStride[1]); | |
| 184 | |||
| 185 | 900 | return srcSliceH; | |
| 186 | } | ||
| 187 | |||
| 188 | 468 | static int planarToNv24Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 189 | const int srcStride[], int srcSliceY, | ||
| 190 | int srcSliceH, uint8_t *const dstParam[], | ||
| 191 | const int dstStride[]) | ||
| 192 | { | ||
| 193 | 468 | uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY; | |
| 194 | |||
| 195 | 468 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w, | |
| 196 | dstParam[0], dstStride[0]); | ||
| 197 | |||
| 198 |
1/2✓ Branch 0 taken 468 times.
✗ Branch 1 not taken.
|
468 | if (c->opts.dst_format == AV_PIX_FMT_NV24) |
| 199 | 468 | interleaveBytes(src[1], src[2], dst, c->chrSrcW, srcSliceH, | |
| 200 | 468 | srcStride[1], srcStride[2], dstStride[1]); | |
| 201 | else | ||
| 202 | ✗ | interleaveBytes(src[2], src[1], dst, c->chrSrcW, srcSliceH, | |
| 203 | ✗ | srcStride[2], srcStride[1], dstStride[1]); | |
| 204 | |||
| 205 | 468 | return srcSliceH; | |
| 206 | } | ||
| 207 | |||
| 208 | 469 | static int nv24ToPlanarWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 209 | const int srcStride[], int srcSliceY, | ||
| 210 | int srcSliceH, uint8_t *const dstParam[], | ||
| 211 | const int dstStride[]) | ||
| 212 | { | ||
| 213 | 469 | uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY; | |
| 214 | 469 | uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY; | |
| 215 | |||
| 216 | 469 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w, | |
| 217 | dstParam[0], dstStride[0]); | ||
| 218 | |||
| 219 |
1/2✓ Branch 0 taken 469 times.
✗ Branch 1 not taken.
|
469 | if (c->opts.src_format == AV_PIX_FMT_NV24) |
| 220 | 469 | deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, srcSliceH, | |
| 221 | 469 | srcStride[1], dstStride[1], dstStride[2]); | |
| 222 | else | ||
| 223 | ✗ | deinterleaveBytes(src[1], dst2, dst1, c->chrSrcW, srcSliceH, | |
| 224 | ✗ | srcStride[1], dstStride[2], dstStride[1]); | |
| 225 | |||
| 226 | 469 | return srcSliceH; | |
| 227 | } | ||
| 228 | |||
| 229 | 258 | static void nv24_to_yuv420p_chroma(uint8_t *dst1, int dstStride1, | |
| 230 | uint8_t *dst2, int dstStride2, | ||
| 231 | const uint8_t *src, int srcStride, | ||
| 232 | int w, int h) | ||
| 233 | { | ||
| 234 | 258 | const uint8_t *src1 = src; | |
| 235 | 258 | const uint8_t *src2 = src + srcStride; | |
| 236 | // average 4 pixels into 1 (interleaved U and V) | ||
| 237 |
2/2✓ Branch 0 taken 3792 times.
✓ Branch 1 taken 258 times.
|
4050 | for (int y = 0; y < h; y += 2) { |
| 238 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3792 times.
|
3792 | if (y + 1 == h) |
| 239 | ✗ | src2 = src1; | |
| 240 |
2/2✓ Branch 0 taken 677760 times.
✓ Branch 1 taken 3792 times.
|
681552 | for (int x = 0; x < w; x++) { |
| 241 | 677760 | dst1[x] = (src1[4 * x + 0] + src1[4 * x + 2] + | |
| 242 | 677760 | src2[4 * x + 0] + src2[4 * x + 2]) >> 2; | |
| 243 | 677760 | dst2[x] = (src1[4 * x + 1] + src1[4 * x + 3] + | |
| 244 | 677760 | src2[4 * x + 1] + src2[4 * x + 3]) >> 2; | |
| 245 | } | ||
| 246 | 3792 | src1 += srcStride * 2; | |
| 247 | 3792 | src2 += srcStride * 2; | |
| 248 | 3792 | dst1 += dstStride1; | |
| 249 | 3792 | dst2 += dstStride2; | |
| 250 | } | ||
| 251 | 258 | } | |
| 252 | |||
| 253 | 258 | static int nv24ToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 254 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 255 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 256 | { | ||
| 257 | 258 | uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
| 258 | 258 | uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
| 259 | |||
| 260 | 258 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w, | |
| 261 | dstParam[0], dstStride[0]); | ||
| 262 | |||
| 263 |
2/2✓ Branch 0 taken 246 times.
✓ Branch 1 taken 12 times.
|
258 | if (c->opts.src_format == AV_PIX_FMT_NV24) |
| 264 | 246 | nv24_to_yuv420p_chroma(dst1, dstStride[1], dst2, dstStride[2], | |
| 265 | 246 | src[1], srcStride[1], c->opts.src_w / 2, srcSliceH); | |
| 266 | else | ||
| 267 | 12 | nv24_to_yuv420p_chroma(dst2, dstStride[2], dst1, dstStride[1], | |
| 268 | 12 | src[1], srcStride[1], c->opts.src_w / 2, srcSliceH); | |
| 269 | |||
| 270 | 258 | return srcSliceH; | |
| 271 | } | ||
| 272 | |||
| 273 | ✗ | static int planarToP01xWrapper(SwsInternal *c, const uint8_t *const src8[], | |
| 274 | const int srcStride[], int srcSliceY, | ||
| 275 | int srcSliceH, uint8_t *const dstParam8[], | ||
| 276 | const int dstStride[]) | ||
| 277 | { | ||
| 278 | ✗ | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->opts.src_format); | |
| 279 | ✗ | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 280 | ✗ | const uint16_t **src = (const uint16_t**)src8; | |
| 281 | ✗ | uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY); | |
| 282 | ✗ | uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2); | |
| 283 | int x, y; | ||
| 284 | |||
| 285 | /* Calculate net shift required for values. */ | ||
| 286 | ✗ | const int shift[3] = { | |
| 287 | ✗ | dst_format->comp[0].depth + dst_format->comp[0].shift - | |
| 288 | ✗ | src_format->comp[0].depth - src_format->comp[0].shift, | |
| 289 | ✗ | dst_format->comp[1].depth + dst_format->comp[1].shift - | |
| 290 | ✗ | src_format->comp[1].depth - src_format->comp[1].shift, | |
| 291 | ✗ | dst_format->comp[2].depth + dst_format->comp[2].shift - | |
| 292 | ✗ | src_format->comp[2].depth - src_format->comp[2].shift, | |
| 293 | }; | ||
| 294 | |||
| 295 | ✗ | av_assert0(!(srcStride[0] % 2 || srcStride[1] % 2 || srcStride[2] % 2 || | |
| 296 | dstStride[0] % 2 || dstStride[1] % 2)); | ||
| 297 | |||
| 298 | ✗ | for (y = 0; y < srcSliceH; y++) { | |
| 299 | ✗ | uint16_t *tdstY = dstY; | |
| 300 | ✗ | const uint16_t *tsrc0 = src[0]; | |
| 301 | ✗ | for (x = c->opts.src_w; x > 0; x--) { | |
| 302 | ✗ | *tdstY++ = *tsrc0++ << shift[0]; | |
| 303 | } | ||
| 304 | ✗ | src[0] += srcStride[0] / 2; | |
| 305 | ✗ | dstY += dstStride[0] / 2; | |
| 306 | |||
| 307 | ✗ | if (!(y & 1)) { | |
| 308 | ✗ | uint16_t *tdstUV = dstUV; | |
| 309 | ✗ | const uint16_t *tsrc1 = src[1]; | |
| 310 | ✗ | const uint16_t *tsrc2 = src[2]; | |
| 311 | ✗ | for (x = c->opts.src_w / 2; x > 0; x--) { | |
| 312 | ✗ | *tdstUV++ = *tsrc1++ << shift[1]; | |
| 313 | ✗ | *tdstUV++ = *tsrc2++ << shift[2]; | |
| 314 | } | ||
| 315 | ✗ | src[1] += srcStride[1] / 2; | |
| 316 | ✗ | src[2] += srcStride[2] / 2; | |
| 317 | ✗ | dstUV += dstStride[1] / 2; | |
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | ✗ | return srcSliceH; | |
| 322 | } | ||
| 323 | |||
| 324 | #if AV_HAVE_BIGENDIAN | ||
| 325 | #define output_pixel(p, v) do { \ | ||
| 326 | uint16_t *pp = (p); \ | ||
| 327 | AV_WL16(pp, (v)); \ | ||
| 328 | } while(0) | ||
| 329 | #else | ||
| 330 | #define output_pixel(p, v) (*p) = (v) | ||
| 331 | #endif | ||
| 332 | |||
| 333 | 64 | static int planar8ToP01xleWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 334 | const int srcStride[], int srcSliceY, | ||
| 335 | int srcSliceH, uint8_t *const dstParam8[], | ||
| 336 | const int dstStride[]) | ||
| 337 | { | ||
| 338 | 64 | const uint8_t *src0 = src[0], *src1 = src[1], *src2 = src[2]; | |
| 339 | 64 | uint16_t *dstY = (uint16_t*)(dstParam8[0] + dstStride[0] * srcSliceY); | |
| 340 | 64 | uint16_t *dstUV = (uint16_t*)(dstParam8[1] + dstStride[1] * srcSliceY / 2); | |
| 341 | int x, y, t; | ||
| 342 | |||
| 343 |
2/4✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
|
64 | av_assert0(!(dstStride[0] % 2 || dstStride[1] % 2)); |
| 344 | |||
| 345 |
2/2✓ Branch 0 taken 18432 times.
✓ Branch 1 taken 64 times.
|
18496 | for (y = 0; y < srcSliceH; y++) { |
| 346 | 18432 | uint16_t *tdstY = dstY; | |
| 347 | 18432 | const uint8_t *tsrc0 = src0; | |
| 348 |
2/2✓ Branch 0 taken 6488064 times.
✓ Branch 1 taken 18432 times.
|
6506496 | for (x = c->opts.src_w; x > 0; x--) { |
| 349 | 6488064 | t = *tsrc0++; | |
| 350 | 6488064 | output_pixel(tdstY++, t << 8); | |
| 351 | } | ||
| 352 | 18432 | src0 += srcStride[0]; | |
| 353 | 18432 | dstY += dstStride[0] / 2; | |
| 354 | |||
| 355 |
2/2✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 9216 times.
|
18432 | if (!(y & 1)) { |
| 356 | 9216 | uint16_t *tdstUV = dstUV; | |
| 357 | 9216 | const uint8_t *tsrc1 = src1; | |
| 358 | 9216 | const uint8_t *tsrc2 = src2; | |
| 359 |
2/2✓ Branch 0 taken 1622016 times.
✓ Branch 1 taken 9216 times.
|
1631232 | for (x = c->opts.src_w / 2; x > 0; x--) { |
| 360 | 1622016 | t = *tsrc1++; | |
| 361 | 1622016 | output_pixel(tdstUV++, t << 8); | |
| 362 | 1622016 | t = *tsrc2++; | |
| 363 | 1622016 | output_pixel(tdstUV++, t << 8); | |
| 364 | } | ||
| 365 | 9216 | src1 += srcStride[1]; | |
| 366 | 9216 | src2 += srcStride[2]; | |
| 367 | 9216 | dstUV += dstStride[1] / 2; | |
| 368 | } | ||
| 369 | } | ||
| 370 | |||
| 371 | 64 | return srcSliceH; | |
| 372 | } | ||
| 373 | |||
| 374 | #undef output_pixel | ||
| 375 | |||
| 376 | ✗ | static int planarToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 377 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 378 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 379 | { | ||
| 380 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
| 381 | |||
| 382 | ✗ | yv12toyuy2(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH, srcStride[0], | |
| 383 | ✗ | srcStride[1], dstStride[0]); | |
| 384 | |||
| 385 | ✗ | return srcSliceH; | |
| 386 | } | ||
| 387 | |||
| 388 | ✗ | static int planarToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 389 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 390 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 391 | { | ||
| 392 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
| 393 | |||
| 394 | ✗ | yv12touyvy(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH, srcStride[0], | |
| 395 | ✗ | srcStride[1], dstStride[0]); | |
| 396 | |||
| 397 | ✗ | return srcSliceH; | |
| 398 | } | ||
| 399 | |||
| 400 | ✗ | static int yuv422pToYuy2Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 401 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 402 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 403 | { | ||
| 404 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
| 405 | |||
| 406 | ✗ | yuv422ptoyuy2(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH, srcStride[0], | |
| 407 | ✗ | srcStride[1], dstStride[0]); | |
| 408 | |||
| 409 | ✗ | return srcSliceH; | |
| 410 | } | ||
| 411 | |||
| 412 | ✗ | static int yuv422pToUyvyWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 413 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 414 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 415 | { | ||
| 416 | ✗ | uint8_t *dst = dstParam[0] + dstStride[0] * srcSliceY; | |
| 417 | |||
| 418 | ✗ | yuv422ptouyvy(src[0], src[1], src[2], dst, c->opts.src_w, srcSliceH, srcStride[0], | |
| 419 | ✗ | srcStride[1], dstStride[0]); | |
| 420 | |||
| 421 | ✗ | return srcSliceH; | |
| 422 | } | ||
| 423 | |||
| 424 | ✗ | static int yuyvToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 425 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 426 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 427 | { | ||
| 428 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
| 429 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
| 430 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
| 431 | |||
| 432 | ✗ | yuyvtoyuv420(ydst, udst, vdst, src[0], c->opts.src_w, srcSliceH, dstStride[0], | |
| 433 | ✗ | dstStride[1], srcStride[0]); | |
| 434 | |||
| 435 | ✗ | if (dstParam[3]) | |
| 436 | ✗ | fillPlane(dstParam[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255); | |
| 437 | |||
| 438 | ✗ | return srcSliceH; | |
| 439 | } | ||
| 440 | |||
| 441 | ✗ | static int yuyvToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 442 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 443 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 444 | { | ||
| 445 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
| 446 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY; | |
| 447 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY; | |
| 448 | |||
| 449 | ✗ | yuyvtoyuv422(ydst, udst, vdst, src[0], c->opts.src_w, srcSliceH, dstStride[0], | |
| 450 | ✗ | dstStride[1], srcStride[0]); | |
| 451 | |||
| 452 | ✗ | return srcSliceH; | |
| 453 | } | ||
| 454 | |||
| 455 | ✗ | static int uyvyToYuv420Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 456 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 457 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 458 | { | ||
| 459 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
| 460 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY / 2; | |
| 461 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY / 2; | |
| 462 | |||
| 463 | ✗ | uyvytoyuv420(ydst, udst, vdst, src[0], c->opts.src_w, srcSliceH, dstStride[0], | |
| 464 | ✗ | dstStride[1], srcStride[0]); | |
| 465 | |||
| 466 | ✗ | if (dstParam[3]) | |
| 467 | ✗ | fillPlane(dstParam[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255); | |
| 468 | |||
| 469 | ✗ | return srcSliceH; | |
| 470 | } | ||
| 471 | |||
| 472 | ✗ | static int uyvyToYuv422Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 473 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 474 | uint8_t *const dstParam[], const int dstStride[]) | ||
| 475 | { | ||
| 476 | ✗ | uint8_t *ydst = dstParam[0] + dstStride[0] * srcSliceY; | |
| 477 | ✗ | uint8_t *udst = dstParam[1] + dstStride[1] * srcSliceY; | |
| 478 | ✗ | uint8_t *vdst = dstParam[2] + dstStride[2] * srcSliceY; | |
| 479 | |||
| 480 | ✗ | uyvytoyuv422(ydst, udst, vdst, src[0], c->opts.src_w, srcSliceH, dstStride[0], | |
| 481 | ✗ | dstStride[1], srcStride[0]); | |
| 482 | |||
| 483 | ✗ | return srcSliceH; | |
| 484 | } | ||
| 485 | |||
| 486 | ✗ | static void gray8aToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, | |
| 487 | const uint8_t *palette) | ||
| 488 | { | ||
| 489 | int i; | ||
| 490 | ✗ | for (i = 0; i < num_pixels; i++) | |
| 491 | ✗ | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i << 1]] | (src[(i << 1) + 1] << 24); | |
| 492 | ✗ | } | |
| 493 | |||
| 494 | ✗ | static void gray8aToPacked32_1(const uint8_t *src, uint8_t *dst, int num_pixels, | |
| 495 | const uint8_t *palette) | ||
| 496 | { | ||
| 497 | int i; | ||
| 498 | |||
| 499 | ✗ | for (i = 0; i < num_pixels; i++) | |
| 500 | ✗ | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i << 1]] | src[(i << 1) + 1]; | |
| 501 | ✗ | } | |
| 502 | |||
| 503 | ✗ | static void gray8aToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, | |
| 504 | const uint8_t *palette) | ||
| 505 | { | ||
| 506 | int i; | ||
| 507 | |||
| 508 | ✗ | for (i = 0; i < num_pixels; i++) { | |
| 509 | //FIXME slow? | ||
| 510 | ✗ | dst[0] = palette[src[i << 1] * 4 + 0]; | |
| 511 | ✗ | dst[1] = palette[src[i << 1] * 4 + 1]; | |
| 512 | ✗ | dst[2] = palette[src[i << 1] * 4 + 2]; | |
| 513 | ✗ | dst += 3; | |
| 514 | } | ||
| 515 | ✗ | } | |
| 516 | |||
| 517 | ✗ | static void gray8aToPlanar8(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, | |
| 518 | uint8_t *dst2, uint8_t *dstA, int num_pixels, | ||
| 519 | const uint8_t *palette) | ||
| 520 | { | ||
| 521 | ✗ | for (int i = 0; i < num_pixels; i++) { | |
| 522 | ✗ | const uint8_t *rgb = &palette[src[i << 1] * 4]; | |
| 523 | ✗ | dst0[i] = rgb[0]; | |
| 524 | ✗ | dst1[i] = rgb[1]; | |
| 525 | ✗ | dst2[i] = rgb[2]; | |
| 526 | ✗ | if (dstA) | |
| 527 | ✗ | dstA[i] = src[(i << 1) + 1]; | |
| 528 | } | ||
| 529 | ✗ | } | |
| 530 | |||
| 531 | 7488 | static void pal8ToPlanar8(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, | |
| 532 | uint8_t *dst2, uint8_t *dstA, int num_pixels, | ||
| 533 | const uint8_t *palette) | ||
| 534 | { | ||
| 535 |
2/2✓ Branch 0 taken 2635776 times.
✓ Branch 1 taken 7488 times.
|
2643264 | for (int i = 0; i < num_pixels; i++) { |
| 536 | 2635776 | const uint8_t *rgba = &palette[src[i] * 4]; | |
| 537 | 2635776 | dst0[i] = rgba[0]; | |
| 538 | 2635776 | dst1[i] = rgba[1]; | |
| 539 | 2635776 | dst2[i] = rgba[2]; | |
| 540 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2635776 times.
|
2635776 | if (dstA) |
| 541 | ✗ | dstA[i] = rgba[3]; | |
| 542 | } | ||
| 543 | 7488 | } | |
| 544 | |||
| 545 | 1469 | static int bswap_16bpc(SwsInternal *c, const uint8_t *const src[], | |
| 546 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 547 | uint8_t *const dst[], const int dstStride[]) | ||
| 548 | { | ||
| 549 | int i, j, p; | ||
| 550 | |||
| 551 |
2/2✓ Branch 0 taken 5876 times.
✓ Branch 1 taken 1469 times.
|
7345 | for (p = 0; p < 4; p++) { |
| 552 | 5876 | int srcstr = srcStride[p] / 2; | |
| 553 | 5876 | int dststr = dstStride[p] / 2; | |
| 554 | 5876 | uint16_t *dstPtr = (uint16_t *) dst[p]; | |
| 555 | 5876 | const uint16_t *srcPtr = (const uint16_t *) src[p]; | |
| 556 | 5876 | int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr)); | |
| 557 |
3/4✓ Branch 0 taken 4407 times.
✓ Branch 1 taken 1469 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4407 times.
|
5876 | if(!dstPtr || !srcPtr) |
| 558 | 1469 | continue; | |
| 559 | 4407 | dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; | |
| 560 |
2/2✓ Branch 0 taken 189824 times.
✓ Branch 1 taken 4407 times.
|
194231 | for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { |
| 561 |
2/2✓ Branch 0 taken 69253120 times.
✓ Branch 1 taken 189824 times.
|
69442944 | for (j = 0; j < min_stride; j++) { |
| 562 | 69253120 | dstPtr[j] = av_bswap16(srcPtr[j]); | |
| 563 | } | ||
| 564 | 189824 | srcPtr += srcstr; | |
| 565 | 189824 | dstPtr += dststr; | |
| 566 | } | ||
| 567 | } | ||
| 568 | |||
| 569 | 1469 | return srcSliceH; | |
| 570 | } | ||
| 571 | |||
| 572 | 13 | static int bswap_32bpc(SwsInternal *c, const uint8_t *const src[], | |
| 573 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 574 | uint8_t *const dst[], const int dstStride[]) | ||
| 575 | { | ||
| 576 | int i, j, p; | ||
| 577 | |||
| 578 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 13 times.
|
65 | for (p = 0; p < 4; p++) { |
| 579 | 52 | int srcstr = srcStride[p] / 4; | |
| 580 | 52 | int dststr = dstStride[p] / 4; | |
| 581 | 52 | uint32_t *dstPtr = (uint32_t *) dst[p]; | |
| 582 | 52 | const uint32_t *srcPtr = (const uint32_t *) src[p]; | |
| 583 | 52 | int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr)); | |
| 584 |
3/4✓ Branch 0 taken 39 times.
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39 times.
|
52 | if(!dstPtr || !srcPtr) |
| 585 | 13 | continue; | |
| 586 | 39 | dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr; | |
| 587 |
2/2✓ Branch 0 taken 11232 times.
✓ Branch 1 taken 39 times.
|
11271 | for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) { |
| 588 |
2/2✓ Branch 0 taken 3953664 times.
✓ Branch 1 taken 11232 times.
|
3964896 | for (j = 0; j < min_stride; j++) { |
| 589 | 3953664 | dstPtr[j] = av_bswap32(srcPtr[j]); | |
| 590 | } | ||
| 591 | 11232 | srcPtr += srcstr; | |
| 592 | 11232 | dstPtr += dststr; | |
| 593 | } | ||
| 594 | } | ||
| 595 | |||
| 596 | 13 | return srcSliceH; | |
| 597 | } | ||
| 598 | |||
| 599 | |||
| 600 | 32597 | static int palToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], | |
| 601 | int srcSliceY, int srcSliceH, uint8_t *const dst[], | ||
| 602 | const int dstStride[]) | ||
| 603 | { | ||
| 604 | 32597 | const enum AVPixelFormat srcFormat = c->opts.src_format; | |
| 605 | 32597 | const enum AVPixelFormat dstFormat = c->opts.dst_format; | |
| 606 | 32597 | void (*conv)(const uint8_t *src, uint8_t *dst, int num_pixels, | |
| 607 | const uint8_t *palette) = NULL; | ||
| 608 | int i; | ||
| 609 | 32597 | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
| 610 | 32597 | const uint8_t *srcPtr = src[0]; | |
| 611 | |||
| 612 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32597 times.
|
32597 | if (srcFormat == AV_PIX_FMT_YA8) { |
| 613 | ✗ | switch (dstFormat) { | |
| 614 | ✗ | case AV_PIX_FMT_RGB32 : conv = gray8aToPacked32; break; | |
| 615 | ✗ | case AV_PIX_FMT_BGR32 : conv = gray8aToPacked32; break; | |
| 616 | ✗ | case AV_PIX_FMT_BGR32_1: conv = gray8aToPacked32_1; break; | |
| 617 | ✗ | case AV_PIX_FMT_RGB32_1: conv = gray8aToPacked32_1; break; | |
| 618 | ✗ | case AV_PIX_FMT_RGB24 : conv = gray8aToPacked24; break; | |
| 619 | ✗ | case AV_PIX_FMT_BGR24 : conv = gray8aToPacked24; break; | |
| 620 | } | ||
| 621 |
1/2✓ Branch 1 taken 32597 times.
✗ Branch 2 not taken.
|
32597 | } else if (usePal(srcFormat)) { |
| 622 |
3/7✓ Branch 0 taken 2556 times.
✓ Branch 1 taken 1952 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 28089 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
32597 | switch (dstFormat) { |
| 623 | 2556 | case AV_PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break; | |
| 624 | 1952 | case AV_PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break; | |
| 625 | ✗ | case AV_PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break; | |
| 626 | ✗ | case AV_PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break; | |
| 627 | 28089 | case AV_PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break; | |
| 628 | ✗ | case AV_PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break; | |
| 629 | } | ||
| 630 | } | ||
| 631 | |||
| 632 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32597 times.
|
32597 | if (!conv) |
| 633 | ✗ | av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", | |
| 634 | av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); | ||
| 635 | else { | ||
| 636 |
2/2✓ Branch 0 taken 814886 times.
✓ Branch 1 taken 32597 times.
|
847483 | for (i = 0; i < srcSliceH; i++) { |
| 637 | 814886 | conv(srcPtr, dstPtr, c->opts.src_w, (uint8_t *) c->pal_rgb); | |
| 638 | 814886 | srcPtr += srcStride[0]; | |
| 639 | 814886 | dstPtr += dstStride[0]; | |
| 640 | } | ||
| 641 | } | ||
| 642 | |||
| 643 | 32597 | return srcSliceH; | |
| 644 | } | ||
| 645 | |||
| 646 | 234 | static int palToGbrpWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 647 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 648 | uint8_t *const dst[], const int dstStride[]) | ||
| 649 | { | ||
| 650 | 234 | const enum AVPixelFormat srcFormat = c->opts.src_format; | |
| 651 | 234 | const enum AVPixelFormat dstFormat = c->opts.dst_format; | |
| 652 | 234 | void (*conv)(const uint8_t *src, uint8_t *dstG, uint8_t *dstB, uint8_t *dstR, | |
| 653 | uint8_t *dstA, int num_pixels, const uint8_t *palette) = NULL; | ||
| 654 | |||
| 655 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 234 times.
|
234 | const int num_planes = isALPHA(dstFormat) ? 4 : 3; |
| 656 | 234 | const uint8_t *srcPtr = src[0]; | |
| 657 | 234 | uint8_t *dstPtr[4] = {0}; | |
| 658 |
2/2✓ Branch 0 taken 702 times.
✓ Branch 1 taken 234 times.
|
936 | for (int i = 0; i < num_planes; i++) |
| 659 | 702 | dstPtr[i] = dst[i] + dstStride[i] * srcSliceY; | |
| 660 | |||
| 661 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 234 times.
|
234 | if (srcFormat == AV_PIX_FMT_YA8) { |
| 662 | ✗ | switch (dstFormat) { | |
| 663 | ✗ | case AV_PIX_FMT_GBRP: conv = gray8aToPlanar8; break; | |
| 664 | ✗ | case AV_PIX_FMT_GBRAP: conv = gray8aToPlanar8; break; | |
| 665 | } | ||
| 666 |
1/2✓ Branch 1 taken 234 times.
✗ Branch 2 not taken.
|
234 | } else if (usePal(srcFormat)) { |
| 667 |
1/3✓ Branch 0 taken 234 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
234 | switch (dstFormat) { |
| 668 | 234 | case AV_PIX_FMT_GBRP: conv = pal8ToPlanar8; break; | |
| 669 | ✗ | case AV_PIX_FMT_GBRAP: conv = pal8ToPlanar8; break; | |
| 670 | } | ||
| 671 | } | ||
| 672 | |||
| 673 | av_assert1(conv); | ||
| 674 |
2/2✓ Branch 0 taken 7488 times.
✓ Branch 1 taken 234 times.
|
7722 | for (int y = 0; y < srcSliceH; y++) { |
| 675 | 7488 | conv(srcPtr, dstPtr[0], dstPtr[1], dstPtr[2], dstPtr[3], c->opts.src_w, | |
| 676 | 7488 | (uint8_t *) c->pal_rgb); | |
| 677 | 7488 | srcPtr += srcStride[0]; | |
| 678 |
2/2✓ Branch 0 taken 22464 times.
✓ Branch 1 taken 7488 times.
|
29952 | for (int i = 0; i < num_planes; i++) |
| 679 | 22464 | dstPtr[i] += dstStride[i]; | |
| 680 | } | ||
| 681 | |||
| 682 | 234 | return srcSliceH; | |
| 683 | } | ||
| 684 | |||
| 685 | 2576 | static void packed16togbra16(const uint8_t *src, int srcStride, | |
| 686 | uint16_t *dst[], const int dstStride[], int srcSliceH, | ||
| 687 | int src_alpha, int swap, int shift, int width) | ||
| 688 | { | ||
| 689 | int x, h, i; | ||
| 690 | 2576 | int dst_alpha = dst[3] != NULL; | |
| 691 |
2/2✓ Branch 0 taken 82624 times.
✓ Branch 1 taken 2576 times.
|
85200 | for (h = 0; h < srcSliceH; h++) { |
| 692 | 82624 | uint16_t *src_line = (uint16_t *)(src + srcStride * h); | |
| 693 |
3/4✓ Branch 0 taken 256 times.
✓ Branch 1 taken 22464 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 59904 times.
|
82624 | switch (swap) { |
| 694 | 256 | case 3: | |
| 695 |
3/4✓ Branch 0 taken 128 times.
✓ Branch 1 taken 128 times.
✓ Branch 2 taken 128 times.
✗ Branch 3 not taken.
|
256 | if (src_alpha && dst_alpha) { |
| 696 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 128 times.
|
16512 | for (x = 0; x < width; x++) { |
| 697 | 16384 | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 698 | 16384 | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 699 | 16384 | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 700 | 16384 | dst[3][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 701 | } | ||
| 702 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
|
128 | } else if (dst_alpha) { |
| 703 | ✗ | for (x = 0; x < width; x++) { | |
| 704 | ✗ | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 705 | ✗ | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 706 | ✗ | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 707 | ✗ | dst[3][x] = av_bswap16(0xFFFF >> shift); | |
| 708 | } | ||
| 709 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128 times.
|
128 | } else if (src_alpha) { |
| 710 | ✗ | for (x = 0; x < width; x++) { | |
| 711 | ✗ | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 712 | ✗ | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 713 | ✗ | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 714 | ✗ | src_line++; | |
| 715 | } | ||
| 716 | } else { | ||
| 717 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 128 times.
|
16512 | for (x = 0; x < width; x++) { |
| 718 | 16384 | dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 719 | 16384 | dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 720 | 16384 | dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift); | |
| 721 | } | ||
| 722 | } | ||
| 723 | 256 | break; | |
| 724 | 22464 | case 2: | |
| 725 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22464 | if (src_alpha && dst_alpha) { |
| 726 | ✗ | for (x = 0; x < width; x++) { | |
| 727 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
| 728 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
| 729 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
| 730 | ✗ | dst[3][x] = av_bswap16(*src_line++ >> shift); | |
| 731 | } | ||
| 732 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
|
22464 | } else if (dst_alpha) { |
| 733 | ✗ | for (x = 0; x < width; x++) { | |
| 734 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
| 735 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
| 736 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
| 737 | ✗ | dst[3][x] = av_bswap16(0xFFFF >> shift); | |
| 738 | } | ||
| 739 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
|
22464 | } else if (src_alpha) { |
| 740 | ✗ | for (x = 0; x < width; x++) { | |
| 741 | ✗ | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
| 742 | ✗ | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
| 743 | ✗ | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
| 744 | ✗ | src_line++; | |
| 745 | } | ||
| 746 | } else { | ||
| 747 |
2/2✓ Branch 0 taken 7907328 times.
✓ Branch 1 taken 22464 times.
|
7929792 | for (x = 0; x < width; x++) { |
| 748 | 7907328 | dst[0][x] = av_bswap16(*src_line++ >> shift); | |
| 749 | 7907328 | dst[1][x] = av_bswap16(*src_line++ >> shift); | |
| 750 | 7907328 | dst[2][x] = av_bswap16(*src_line++ >> shift); | |
| 751 | } | ||
| 752 | } | ||
| 753 | 22464 | break; | |
| 754 | ✗ | case 1: | |
| 755 | ✗ | if (src_alpha && dst_alpha) { | |
| 756 | ✗ | for (x = 0; x < width; x++) { | |
| 757 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
| 758 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
| 759 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
| 760 | ✗ | dst[3][x] = av_bswap16(*src_line++) >> shift; | |
| 761 | } | ||
| 762 | ✗ | } else if (dst_alpha) { | |
| 763 | ✗ | for (x = 0; x < width; x++) { | |
| 764 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
| 765 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
| 766 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
| 767 | ✗ | dst[3][x] = 0xFFFF >> shift; | |
| 768 | } | ||
| 769 | ✗ | } else if (src_alpha) { | |
| 770 | ✗ | for (x = 0; x < width; x++) { | |
| 771 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
| 772 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
| 773 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
| 774 | ✗ | src_line++; | |
| 775 | } | ||
| 776 | } else { | ||
| 777 | ✗ | for (x = 0; x < width; x++) { | |
| 778 | ✗ | dst[0][x] = av_bswap16(*src_line++) >> shift; | |
| 779 | ✗ | dst[1][x] = av_bswap16(*src_line++) >> shift; | |
| 780 | ✗ | dst[2][x] = av_bswap16(*src_line++) >> shift; | |
| 781 | } | ||
| 782 | } | ||
| 783 | ✗ | break; | |
| 784 | 59904 | default: | |
| 785 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 59904 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
59904 | if (src_alpha && dst_alpha) { |
| 786 | ✗ | for (x = 0; x < width; x++) { | |
| 787 | ✗ | dst[0][x] = *src_line++ >> shift; | |
| 788 | ✗ | dst[1][x] = *src_line++ >> shift; | |
| 789 | ✗ | dst[2][x] = *src_line++ >> shift; | |
| 790 | ✗ | dst[3][x] = *src_line++ >> shift; | |
| 791 | } | ||
| 792 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59904 times.
|
59904 | } else if (dst_alpha) { |
| 793 | ✗ | for (x = 0; x < width; x++) { | |
| 794 | ✗ | dst[0][x] = *src_line++ >> shift; | |
| 795 | ✗ | dst[1][x] = *src_line++ >> shift; | |
| 796 | ✗ | dst[2][x] = *src_line++ >> shift; | |
| 797 | ✗ | dst[3][x] = 0xFFFF >> shift; | |
| 798 | } | ||
| 799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59904 times.
|
59904 | } else if (src_alpha) { |
| 800 | ✗ | for (x = 0; x < width; x++) { | |
| 801 | ✗ | dst[0][x] = *src_line++ >> shift; | |
| 802 | ✗ | dst[1][x] = *src_line++ >> shift; | |
| 803 | ✗ | dst[2][x] = *src_line++ >> shift; | |
| 804 | ✗ | src_line++; | |
| 805 | } | ||
| 806 | } else { | ||
| 807 |
2/2✓ Branch 0 taken 21086208 times.
✓ Branch 1 taken 59904 times.
|
21146112 | for (x = 0; x < width; x++) { |
| 808 | 21086208 | dst[0][x] = *src_line++ >> shift; | |
| 809 | 21086208 | dst[1][x] = *src_line++ >> shift; | |
| 810 | 21086208 | dst[2][x] = *src_line++ >> shift; | |
| 811 | } | ||
| 812 | } | ||
| 813 | } | ||
| 814 |
4/4✓ Branch 0 taken 330496 times.
✓ Branch 1 taken 128 times.
✓ Branch 2 taken 248000 times.
✓ Branch 3 taken 82496 times.
|
330624 | for (i = 0; i < 4 && dst[i]; i++) |
| 815 | 248000 | dst[i] += dstStride[i] >> 1; | |
| 816 | } | ||
| 817 | 2576 | } | |
| 818 | |||
| 819 | 936 | static void packed30togbra10(const uint8_t *src, int srcStride, | |
| 820 | uint16_t *dst[], const int dstStride[], int srcSliceH, | ||
| 821 | int swap, int bpc, int shift, int width) | ||
| 822 | { | ||
| 823 | int x, h, i; | ||
| 824 | 936 | int dst_alpha = dst[3] != NULL; | |
| 825 | 936 | int scale_high = bpc - 10, scale_low = 10 - scale_high; | |
| 826 | 936 | uint16_t alpha_val = (1U << bpc) - 1; | |
| 827 |
2/2✓ Branch 0 taken 29952 times.
✓ Branch 1 taken 936 times.
|
30888 | for (h = 0; h < srcSliceH; h++) { |
| 828 | 29952 | uint32_t *src_line = (uint32_t *)(src + srcStride * h); | |
| 829 | unsigned component; | ||
| 830 | |||
| 831 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29952 times.
|
29952 | switch (swap) { |
| 832 | ✗ | case 3: | |
| 833 | case 2: | ||
| 834 | ✗ | if (dst_alpha) { | |
| 835 | ✗ | for (x = 0; x < width; x++) { | |
| 836 | ✗ | unsigned p = AV_RL32(src_line); | |
| 837 | ✗ | component = (p >> 20) & 0x3FF; | |
| 838 | ✗ | dst[0][x] = av_bswap16((component << scale_high | component >> scale_low) << shift); | |
| 839 | ✗ | component = (p >> 10) & 0x3FF; | |
| 840 | ✗ | dst[1][x] = av_bswap16((component << scale_high | component >> scale_low) << shift); | |
| 841 | ✗ | component = p & 0x3FF; | |
| 842 | ✗ | dst[2][x] = av_bswap16((component << scale_high | component >> scale_low) << shift); | |
| 843 | ✗ | dst[3][x] = av_bswap16(alpha_val) << shift; | |
| 844 | ✗ | src_line++; | |
| 845 | } | ||
| 846 | } else { | ||
| 847 | ✗ | for (x = 0; x < width; x++) { | |
| 848 | ✗ | unsigned p = AV_RL32(src_line); | |
| 849 | ✗ | component = (p >> 20) & 0x3FF; | |
| 850 | ✗ | dst[0][x] = av_bswap16((component << scale_high | component >> scale_low) << shift); | |
| 851 | ✗ | component = (p >> 10) & 0x3FF; | |
| 852 | ✗ | dst[1][x] = av_bswap16((component << scale_high | component >> scale_low) << shift); | |
| 853 | ✗ | component = p & 0x3FF; | |
| 854 | ✗ | dst[2][x] = av_bswap16((component << scale_high | component >> scale_low) << shift); | |
| 855 | ✗ | src_line++; | |
| 856 | } | ||
| 857 | } | ||
| 858 | ✗ | break; | |
| 859 | 29952 | default: | |
| 860 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29952 times.
|
29952 | if (dst_alpha) { |
| 861 | ✗ | for (x = 0; x < width; x++) { | |
| 862 | ✗ | unsigned p = AV_RL32(src_line); | |
| 863 | ✗ | component = (p >> 20) & 0x3FF; | |
| 864 | ✗ | dst[0][x] = (component << scale_high | component >> scale_low) << shift; | |
| 865 | ✗ | component = (p >> 10) & 0x3FF; | |
| 866 | ✗ | dst[1][x] = (component << scale_high | component >> scale_low) << shift; | |
| 867 | ✗ | component = p & 0x3FF; | |
| 868 | ✗ | dst[2][x] = (component << scale_high | component >> scale_low) << shift; | |
| 869 | ✗ | dst[3][x] = alpha_val << shift; | |
| 870 | ✗ | src_line++; | |
| 871 | } | ||
| 872 | } else { | ||
| 873 |
2/2✓ Branch 0 taken 10543104 times.
✓ Branch 1 taken 29952 times.
|
10573056 | for (x = 0; x < width; x++) { |
| 874 | 10543104 | unsigned p = AV_RL32(src_line); | |
| 875 | 10543104 | component = (p >> 20) & 0x3FF; | |
| 876 | 10543104 | dst[0][x] = (component << scale_high | component >> scale_low) << shift; | |
| 877 | 10543104 | component = (p >> 10) & 0x3FF; | |
| 878 | 10543104 | dst[1][x] = (component << scale_high | component >> scale_low) << shift; | |
| 879 | 10543104 | component = p & 0x3FF; | |
| 880 | 10543104 | dst[2][x] = (component << scale_high | component >> scale_low) << shift; | |
| 881 | 10543104 | src_line++; | |
| 882 | } | ||
| 883 | } | ||
| 884 | 29952 | break; | |
| 885 | } | ||
| 886 |
3/4✓ Branch 0 taken 119808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 89856 times.
✓ Branch 3 taken 29952 times.
|
119808 | for (i = 0; i < 4 && dst[i]; i++) |
| 887 | 89856 | dst[i] += dstStride[i] >> 1; | |
| 888 | } | ||
| 889 | 936 | } | |
| 890 | |||
| 891 | 3512 | static int Rgb16ToPlanarRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 892 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 893 | uint8_t *const dst[], const int dstStride[]) | ||
| 894 | { | ||
| 895 | 3512 | uint16_t *dst2013[] = { (uint16_t *)dst[2], (uint16_t *)dst[0], (uint16_t *)dst[1], (uint16_t *)dst[3] }; | |
| 896 | 3512 | uint16_t *dst1023[] = { (uint16_t *)dst[1], (uint16_t *)dst[0], (uint16_t *)dst[2], (uint16_t *)dst[3] }; | |
| 897 | 3512 | int stride2013[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] }; | |
| 898 | 3512 | int stride1023[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] }; | |
| 899 | 3512 | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->opts.src_format); | |
| 900 | 3512 | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 901 | 3512 | int bpc = dst_format->comp[0].depth; | |
| 902 | 3512 | int shift = dst_format->comp[0].shift; | |
| 903 | 3512 | int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA; | |
| 904 | 3512 | int swap = 0; | |
| 905 | int i; | ||
| 906 | |||
| 907 | 3512 | if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) || | |
| 908 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3510 times.
|
3512 | !HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE) |
| 909 | 2 | swap++; | |
| 910 | 3512 | if ( HAVE_BIGENDIAN && !(dst_format->flags & AV_PIX_FMT_FLAG_BE) || | |
| 911 |
2/2✓ Branch 0 taken 704 times.
✓ Branch 1 taken 2808 times.
|
3512 | !HAVE_BIGENDIAN && dst_format->flags & AV_PIX_FMT_FLAG_BE) |
| 912 | 704 | swap += 2; | |
| 913 | |||
| 914 |
1/2✓ Branch 0 taken 3512 times.
✗ Branch 1 not taken.
|
3512 | if ((dst_format->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) != |
| 915 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3512 times.
|
3512 | (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB) || bpc < 9) { |
| 916 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported conversion to planar RGB %s -> %s\n", | |
| 917 | ✗ | src_format->name, dst_format->name); | |
| 918 | ✗ | return srcSliceH; | |
| 919 | } | ||
| 920 | |||
| 921 |
4/4✓ Branch 0 taken 14048 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 10537 times.
✓ Branch 3 taken 3511 times.
|
14049 | for (i = 0; i < 4 && dst[i]; i++) { |
| 922 | 10537 | dst2013[i] += stride2013[i] * srcSliceY / 2; | |
| 923 | 10537 | dst1023[i] += stride1023[i] * srcSliceY / 2; | |
| 924 | } | ||
| 925 | |||
| 926 |
3/5✓ Branch 0 taken 2576 times.
✓ Branch 1 taken 468 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 468 times.
✗ Branch 4 not taken.
|
3512 | switch (c->opts.src_format) { |
| 927 | 2576 | case AV_PIX_FMT_RGB48LE: | |
| 928 | case AV_PIX_FMT_RGB48BE: | ||
| 929 | case AV_PIX_FMT_RGBA64LE: | ||
| 930 | case AV_PIX_FMT_RGBA64BE: | ||
| 931 | 2576 | packed16togbra16(src[0], srcStride[0], | |
| 932 | dst2013, stride2013, srcSliceH, alpha, swap, | ||
| 933 | 16 - bpc, c->opts.src_w); | ||
| 934 | 2576 | break; | |
| 935 | 468 | case AV_PIX_FMT_X2RGB10LE: | |
| 936 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 468 times.
|
468 | av_assert0(bpc >= 10); |
| 937 | 468 | packed30togbra10(src[0], srcStride[0], | |
| 938 | dst2013, stride2013, srcSliceH, swap, | ||
| 939 | bpc, shift, c->opts.src_w); | ||
| 940 | 468 | break; | |
| 941 | ✗ | case AV_PIX_FMT_BGR48LE: | |
| 942 | case AV_PIX_FMT_BGR48BE: | ||
| 943 | case AV_PIX_FMT_BGRA64LE: | ||
| 944 | case AV_PIX_FMT_BGRA64BE: | ||
| 945 | ✗ | packed16togbra16(src[0], srcStride[0], | |
| 946 | dst1023, stride1023, srcSliceH, alpha, swap, | ||
| 947 | 16 - bpc, c->opts.src_w); | ||
| 948 | ✗ | break; | |
| 949 | 468 | case AV_PIX_FMT_X2BGR10LE: | |
| 950 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 468 times.
|
468 | av_assert0(bpc >= 10); |
| 951 | 468 | packed30togbra10(src[0], srcStride[0], | |
| 952 | dst1023, stride1023, srcSliceH, swap, | ||
| 953 | bpc, shift, c->opts.src_w); | ||
| 954 | 468 | break; | |
| 955 | ✗ | default: | |
| 956 | ✗ | av_log(c, AV_LOG_ERROR, | |
| 957 | "unsupported conversion to planar RGB %s -> %s\n", | ||
| 958 | ✗ | src_format->name, dst_format->name); | |
| 959 | } | ||
| 960 | |||
| 961 | 3512 | return srcSliceH; | |
| 962 | } | ||
| 963 | |||
| 964 | 2614 | static void gbr16ptopacked16(const uint16_t *src[], const int srcStride[], | |
| 965 | uint8_t *dst, int dstStride, int srcSliceH, | ||
| 966 | int alpha, int swap, int bpp, int width) | ||
| 967 | { | ||
| 968 | int x, h, i; | ||
| 969 | 2614 | int src_alpha = src[3] != NULL; | |
| 970 | 2614 | int scale_high = 16 - bpp, scale_low = (bpp - 8) * 2; | |
| 971 |
2/2✓ Branch 0 taken 87552 times.
✓ Branch 1 taken 2614 times.
|
90166 | for (h = 0; h < srcSliceH; h++) { |
| 972 | 87552 | uint16_t *dest = (uint16_t *)(dst + dstStride * h); | |
| 973 | uint16_t component; | ||
| 974 | |||
| 975 |
2/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 22464 times.
✓ Branch 3 taken 65088 times.
|
87552 | switch(swap) { |
| 976 | ✗ | case 3: | |
| 977 | ✗ | if (alpha && !src_alpha) { | |
| 978 | ✗ | for (x = 0; x < width; x++) { | |
| 979 | ✗ | component = av_bswap16(src[0][x]); | |
| 980 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 981 | ✗ | component = av_bswap16(src[1][x]); | |
| 982 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 983 | ✗ | component = av_bswap16(src[2][x]); | |
| 984 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 985 | ✗ | *dest++ = 0xffff; | |
| 986 | } | ||
| 987 | ✗ | } else if (alpha && src_alpha) { | |
| 988 | ✗ | for (x = 0; x < width; x++) { | |
| 989 | ✗ | component = av_bswap16(src[0][x]); | |
| 990 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 991 | ✗ | component = av_bswap16(src[1][x]); | |
| 992 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 993 | ✗ | component = av_bswap16(src[2][x]); | |
| 994 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 995 | ✗ | component = av_bswap16(src[3][x]); | |
| 996 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 997 | } | ||
| 998 | } else { | ||
| 999 | ✗ | for (x = 0; x < width; x++) { | |
| 1000 | ✗ | component = av_bswap16(src[0][x]); | |
| 1001 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 1002 | ✗ | component = av_bswap16(src[1][x]); | |
| 1003 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 1004 | ✗ | component = av_bswap16(src[2][x]); | |
| 1005 | ✗ | *dest++ = av_bswap16(component << scale_high | component >> scale_low); | |
| 1006 | } | ||
| 1007 | } | ||
| 1008 | ✗ | break; | |
| 1009 | ✗ | case 2: | |
| 1010 | ✗ | if (alpha && !src_alpha) { | |
| 1011 | ✗ | for (x = 0; x < width; x++) { | |
| 1012 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
| 1013 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
| 1014 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
| 1015 | ✗ | *dest++ = 0xffff; | |
| 1016 | } | ||
| 1017 | ✗ | } else if (alpha && src_alpha) { | |
| 1018 | ✗ | for (x = 0; x < width; x++) { | |
| 1019 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
| 1020 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
| 1021 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
| 1022 | ✗ | *dest++ = av_bswap16(src[3][x] << scale_high | src[3][x] >> scale_low); | |
| 1023 | } | ||
| 1024 | } else { | ||
| 1025 | ✗ | for (x = 0; x < width; x++) { | |
| 1026 | ✗ | *dest++ = av_bswap16(src[0][x] << scale_high | src[0][x] >> scale_low); | |
| 1027 | ✗ | *dest++ = av_bswap16(src[1][x] << scale_high | src[1][x] >> scale_low); | |
| 1028 | ✗ | *dest++ = av_bswap16(src[2][x] << scale_high | src[2][x] >> scale_low); | |
| 1029 | } | ||
| 1030 | } | ||
| 1031 | ✗ | break; | |
| 1032 | 22464 | case 1: | |
| 1033 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22464 | if (alpha && !src_alpha) { |
| 1034 | ✗ | for (x = 0; x < width; x++) { | |
| 1035 | ✗ | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
| 1036 | ✗ | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
| 1037 | ✗ | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
| 1038 | ✗ | *dest++ = 0xffff; | |
| 1039 | } | ||
| 1040 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 22464 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
22464 | } else if (alpha && src_alpha) { |
| 1041 | ✗ | for (x = 0; x < width; x++) { | |
| 1042 | ✗ | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
| 1043 | ✗ | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
| 1044 | ✗ | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
| 1045 | ✗ | *dest++ = av_bswap16(src[3][x]) << scale_high | av_bswap16(src[3][x]) >> scale_low; | |
| 1046 | } | ||
| 1047 | } else { | ||
| 1048 |
2/2✓ Branch 0 taken 7907328 times.
✓ Branch 1 taken 22464 times.
|
7929792 | for (x = 0; x < width; x++) { |
| 1049 | 7907328 | *dest++ = av_bswap16(src[0][x]) << scale_high | av_bswap16(src[0][x]) >> scale_low; | |
| 1050 | 7907328 | *dest++ = av_bswap16(src[1][x]) << scale_high | av_bswap16(src[1][x]) >> scale_low; | |
| 1051 | 7907328 | *dest++ = av_bswap16(src[2][x]) << scale_high | av_bswap16(src[2][x]) >> scale_low; | |
| 1052 | } | ||
| 1053 | } | ||
| 1054 | 22464 | break; | |
| 1055 | 65088 | default: | |
| 1056 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 65088 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
65088 | if (alpha && !src_alpha) { |
| 1057 | ✗ | for (x = 0; x < width; x++) { | |
| 1058 | ✗ | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
| 1059 | ✗ | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
| 1060 | ✗ | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
| 1061 | ✗ | *dest++ = 0xffff; | |
| 1062 | } | ||
| 1063 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 65088 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
65088 | } else if (alpha && src_alpha) { |
| 1064 | ✗ | for (x = 0; x < width; x++) { | |
| 1065 | ✗ | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
| 1066 | ✗ | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
| 1067 | ✗ | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
| 1068 | ✗ | *dest++ = src[3][x] << scale_high | src[3][x] >> scale_low; | |
| 1069 | } | ||
| 1070 | } else { | ||
| 1071 |
2/2✓ Branch 0 taken 23325696 times.
✓ Branch 1 taken 65088 times.
|
23390784 | for (x = 0; x < width; x++) { |
| 1072 | 23325696 | *dest++ = src[0][x] << scale_high | src[0][x] >> scale_low; | |
| 1073 | 23325696 | *dest++ = src[1][x] << scale_high | src[1][x] >> scale_low; | |
| 1074 | 23325696 | *dest++ = src[2][x] << scale_high | src[2][x] >> scale_low; | |
| 1075 | } | ||
| 1076 | } | ||
| 1077 | } | ||
| 1078 |
2/2✓ Branch 0 taken 262656 times.
✓ Branch 1 taken 87552 times.
|
350208 | for (i = 0; i < 3 + src_alpha; i++) |
| 1079 | 262656 | src[i] += srcStride[i] >> 1; | |
| 1080 | } | ||
| 1081 | 2614 | } | |
| 1082 | |||
| 1083 | 936 | static void gbr16ptopacked30(const uint16_t *src[], const int srcStride[], | |
| 1084 | uint8_t *dst, int dstStride, int srcSliceH, | ||
| 1085 | int swap, int shift, int width) | ||
| 1086 | { | ||
| 1087 | int x, h, i; | ||
| 1088 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 936 times.
|
936 | av_assert0(shift >= 0); |
| 1089 |
2/2✓ Branch 0 taken 29952 times.
✓ Branch 1 taken 936 times.
|
30888 | for (h = 0; h < srcSliceH; h++) { |
| 1090 | 29952 | uint8_t *dest = dst + dstStride * h; | |
| 1091 | |||
| 1092 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29952 times.
|
29952 | switch(swap) { |
| 1093 | ✗ | case 3: | |
| 1094 | case 1: | ||
| 1095 | ✗ | for (x = 0; x < width; x++) { | |
| 1096 | ✗ | unsigned C0 = av_bswap16(src[0][x]) >> shift; | |
| 1097 | ✗ | unsigned C1 = av_bswap16(src[1][x]) >> shift; | |
| 1098 | ✗ | unsigned C2 = av_bswap16(src[2][x]) >> shift; | |
| 1099 | ✗ | AV_WL32(dest + 4 * x, (3U << 30) + (C0 << 20) + (C1 << 10) + C2); | |
| 1100 | } | ||
| 1101 | ✗ | break; | |
| 1102 | 29952 | default: | |
| 1103 |
2/2✓ Branch 0 taken 10543104 times.
✓ Branch 1 taken 29952 times.
|
10573056 | for (x = 0; x < width; x++) { |
| 1104 | 10543104 | unsigned C0 = src[0][x] >> shift; | |
| 1105 | 10543104 | unsigned C1 = src[1][x] >> shift; | |
| 1106 | 10543104 | unsigned C2 = src[2][x] >> shift; | |
| 1107 | 10543104 | AV_WL32(dest + 4 * x, (3U << 30) + (C0 << 20) + (C1 << 10) + C2); | |
| 1108 | } | ||
| 1109 | 29952 | break; | |
| 1110 | } | ||
| 1111 |
2/2✓ Branch 0 taken 89856 times.
✓ Branch 1 taken 29952 times.
|
119808 | for (i = 0; i < 3; i++) |
| 1112 | 89856 | src[i] += srcStride[i] >> 1; | |
| 1113 | } | ||
| 1114 | 936 | } | |
| 1115 | |||
| 1116 | |||
| 1117 | 3550 | static int planarRgb16ToRgb16Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 1118 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 1119 | uint8_t *const dst[], const int dstStride[]) | ||
| 1120 | { | ||
| 1121 | 3550 | const uint16_t *src102[] = { (uint16_t *)src[1], (uint16_t *)src[0], (uint16_t *)src[2], (uint16_t *)src[3] }; | |
| 1122 | 3550 | const uint16_t *src201[] = { (uint16_t *)src[2], (uint16_t *)src[0], (uint16_t *)src[1], (uint16_t *)src[3] }; | |
| 1123 | 3550 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] }; | |
| 1124 | 3550 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] }; | |
| 1125 | 3550 | const AVPixFmtDescriptor *src_format = av_pix_fmt_desc_get(c->opts.src_format); | |
| 1126 | 3550 | const AVPixFmtDescriptor *dst_format = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 1127 | 3550 | int bits_per_sample = src_format->comp[0].depth; | |
| 1128 | 3550 | int shift = src_format->comp[0].shift; | |
| 1129 | 3550 | int swap = 0; | |
| 1130 | 3550 | if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) || | |
| 1131 |
2/2✓ Branch 0 taken 702 times.
✓ Branch 1 taken 2848 times.
|
3550 | !HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE) |
| 1132 | 702 | swap++; | |
| 1133 | 3550 | if ( HAVE_BIGENDIAN && !(dst_format->flags & AV_PIX_FMT_FLAG_BE) || | |
| 1134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3550 times.
|
3550 | !HAVE_BIGENDIAN && dst_format->flags & AV_PIX_FMT_FLAG_BE) |
| 1135 | ✗ | swap += 2; | |
| 1136 | |||
| 1137 |
1/2✓ Branch 0 taken 3550 times.
✗ Branch 1 not taken.
|
3550 | if ((src_format->flags & (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB)) != |
| 1138 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3550 times.
|
3550 | (AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB) || |
| 1139 | bits_per_sample <= 8) { | ||
| 1140 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
| 1141 | ✗ | src_format->name, dst_format->name); | |
| 1142 | ✗ | return srcSliceH; | |
| 1143 | } | ||
| 1144 |
3/7✗ Branch 0 not taken.
✓ Branch 1 taken 2614 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 468 times.
✓ Branch 5 taken 468 times.
✗ Branch 6 not taken.
|
3550 | switch (c->opts.dst_format) { |
| 1145 | ✗ | case AV_PIX_FMT_BGR48LE: | |
| 1146 | case AV_PIX_FMT_BGR48BE: | ||
| 1147 | ✗ | gbr16ptopacked16(src102, stride102, | |
| 1148 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1149 | srcSliceH, 0, swap, bits_per_sample, c->opts.src_w); | ||
| 1150 | ✗ | break; | |
| 1151 | 2614 | case AV_PIX_FMT_RGB48LE: | |
| 1152 | case AV_PIX_FMT_RGB48BE: | ||
| 1153 | 2614 | gbr16ptopacked16(src201, stride201, | |
| 1154 | 2614 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1155 | srcSliceH, 0, swap, bits_per_sample, c->opts.src_w); | ||
| 1156 | 2614 | break; | |
| 1157 | ✗ | case AV_PIX_FMT_RGBA64LE: | |
| 1158 | case AV_PIX_FMT_RGBA64BE: | ||
| 1159 | ✗ | gbr16ptopacked16(src201, stride201, | |
| 1160 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1161 | srcSliceH, 1, swap, bits_per_sample, c->opts.src_w); | ||
| 1162 | ✗ | break; | |
| 1163 | ✗ | case AV_PIX_FMT_BGRA64LE: | |
| 1164 | case AV_PIX_FMT_BGRA64BE: | ||
| 1165 | ✗ | gbr16ptopacked16(src102, stride102, | |
| 1166 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1167 | srcSliceH, 1, swap, bits_per_sample, c->opts.src_w); | ||
| 1168 | ✗ | break; | |
| 1169 | 468 | case AV_PIX_FMT_X2RGB10LE: | |
| 1170 | 468 | gbr16ptopacked30(src201, stride201, | |
| 1171 | 468 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1172 | 468 | srcSliceH, swap, bits_per_sample + shift - 10, c->opts.src_w); | |
| 1173 | 468 | break; | |
| 1174 | 468 | case AV_PIX_FMT_X2BGR10LE: | |
| 1175 | 468 | gbr16ptopacked30(src102, stride102, | |
| 1176 | 468 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1177 | 468 | srcSliceH, swap, bits_per_sample + shift - 10, c->opts.src_w); | |
| 1178 | 468 | break; | |
| 1179 | ✗ | default: | |
| 1180 | ✗ | av_log(c, AV_LOG_ERROR, | |
| 1181 | "unsupported planar RGB conversion %s -> %s\n", | ||
| 1182 | ✗ | src_format->name, dst_format->name); | |
| 1183 | } | ||
| 1184 | |||
| 1185 | 3550 | return srcSliceH; | |
| 1186 | } | ||
| 1187 | |||
| 1188 | 495 | static void gbr24ptopacked24(const uint8_t *src[], const int srcStride[], | |
| 1189 | uint8_t *dst, int dstStride, int srcSliceH, | ||
| 1190 | int width) | ||
| 1191 | { | ||
| 1192 | int x, h, i; | ||
| 1193 |
2/2✓ Branch 0 taken 15360 times.
✓ Branch 1 taken 495 times.
|
15855 | for (h = 0; h < srcSliceH; h++) { |
| 1194 | 15360 | uint8_t *dest = dst + dstStride * h; | |
| 1195 |
2/2✓ Branch 0 taken 5320704 times.
✓ Branch 1 taken 15360 times.
|
5336064 | for (x = 0; x < width; x++) { |
| 1196 | 5320704 | *dest++ = src[0][x]; | |
| 1197 | 5320704 | *dest++ = src[1][x]; | |
| 1198 | 5320704 | *dest++ = src[2][x]; | |
| 1199 | } | ||
| 1200 | |||
| 1201 |
2/2✓ Branch 0 taken 46080 times.
✓ Branch 1 taken 15360 times.
|
61440 | for (i = 0; i < 3; i++) |
| 1202 | 46080 | src[i] += srcStride[i]; | |
| 1203 | } | ||
| 1204 | 495 | } | |
| 1205 | |||
| 1206 | 234 | static void gbr24ptopacked32(const uint8_t *src[], const int srcStride[], | |
| 1207 | uint8_t *dst, int dstStride, int srcSliceH, | ||
| 1208 | int alpha_first, int width) | ||
| 1209 | { | ||
| 1210 | int x, h, i; | ||
| 1211 |
2/2✓ Branch 0 taken 7488 times.
✓ Branch 1 taken 234 times.
|
7722 | for (h = 0; h < srcSliceH; h++) { |
| 1212 | 7488 | uint8_t *dest = dst + dstStride * h; | |
| 1213 | |||
| 1214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7488 times.
|
7488 | if (alpha_first) { |
| 1215 | ✗ | for (x = 0; x < width; x++) { | |
| 1216 | ✗ | *dest++ = 0xff; | |
| 1217 | ✗ | *dest++ = src[0][x]; | |
| 1218 | ✗ | *dest++ = src[1][x]; | |
| 1219 | ✗ | *dest++ = src[2][x]; | |
| 1220 | } | ||
| 1221 | } else { | ||
| 1222 |
2/2✓ Branch 0 taken 2635776 times.
✓ Branch 1 taken 7488 times.
|
2643264 | for (x = 0; x < width; x++) { |
| 1223 | 2635776 | *dest++ = src[0][x]; | |
| 1224 | 2635776 | *dest++ = src[1][x]; | |
| 1225 | 2635776 | *dest++ = src[2][x]; | |
| 1226 | 2635776 | *dest++ = 0xff; | |
| 1227 | } | ||
| 1228 | } | ||
| 1229 | |||
| 1230 |
2/2✓ Branch 0 taken 22464 times.
✓ Branch 1 taken 7488 times.
|
29952 | for (i = 0; i < 3; i++) |
| 1231 | 22464 | src[i] += srcStride[i]; | |
| 1232 | } | ||
| 1233 | 234 | } | |
| 1234 | |||
| 1235 | 324 | static void gbraptopacked32(const uint8_t *src[], const int srcStride[], | |
| 1236 | uint8_t *dst, int dstStride, int srcSliceH, | ||
| 1237 | int alpha_first, int width) | ||
| 1238 | { | ||
| 1239 | int x, h, i; | ||
| 1240 |
2/2✓ Branch 0 taken 14640 times.
✓ Branch 1 taken 324 times.
|
14964 | for (h = 0; h < srcSliceH; h++) { |
| 1241 | 14640 | uint8_t *dest = dst + dstStride * h; | |
| 1242 | |||
| 1243 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14640 times.
|
14640 | if (alpha_first) { |
| 1244 | ✗ | for (x = 0; x < width; x++) { | |
| 1245 | ✗ | *dest++ = src[3][x]; | |
| 1246 | ✗ | *dest++ = src[0][x]; | |
| 1247 | ✗ | *dest++ = src[1][x]; | |
| 1248 | ✗ | *dest++ = src[2][x]; | |
| 1249 | } | ||
| 1250 | } else { | ||
| 1251 |
2/2✓ Branch 0 taken 9484800 times.
✓ Branch 1 taken 14640 times.
|
9499440 | for (x = 0; x < width; x++) { |
| 1252 | 9484800 | *dest++ = src[0][x]; | |
| 1253 | 9484800 | *dest++ = src[1][x]; | |
| 1254 | 9484800 | *dest++ = src[2][x]; | |
| 1255 | 9484800 | *dest++ = src[3][x]; | |
| 1256 | } | ||
| 1257 | } | ||
| 1258 | |||
| 1259 |
2/2✓ Branch 0 taken 58560 times.
✓ Branch 1 taken 14640 times.
|
73200 | for (i = 0; i < 4; i++) |
| 1260 | 58560 | src[i] += srcStride[i]; | |
| 1261 | } | ||
| 1262 | 324 | } | |
| 1263 | |||
| 1264 | 333 | static int planarRgbaToRgbWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 1265 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 1266 | uint8_t *const dst[], const int dstStride[]) | ||
| 1267 | { | ||
| 1268 | 333 | int alpha_first = 0; | |
| 1269 | 333 | const uint8_t *src102[] = { src[1], src[0], src[2], src[3] }; | |
| 1270 | 333 | const uint8_t *src201[] = { src[2], src[0], src[1], src[3] }; | |
| 1271 | 333 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2], srcStride[3] }; | |
| 1272 | 333 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1], srcStride[3] }; | |
| 1273 | |||
| 1274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 333 times.
|
333 | if (c->opts.src_format != AV_PIX_FMT_GBRAP) { |
| 1275 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
| 1276 | ✗ | av_get_pix_fmt_name(c->opts.src_format), | |
| 1277 | ✗ | av_get_pix_fmt_name(c->opts.dst_format)); | |
| 1278 | ✗ | return srcSliceH; | |
| 1279 | } | ||
| 1280 | |||
| 1281 |
3/7✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 99 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 225 times.
✗ Branch 6 not taken.
|
333 | switch (c->opts.dst_format) { |
| 1282 | ✗ | case AV_PIX_FMT_BGR24: | |
| 1283 | ✗ | gbr24ptopacked24(src102, stride102, | |
| 1284 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1285 | srcSliceH, c->opts.src_w); | ||
| 1286 | ✗ | break; | |
| 1287 | |||
| 1288 | 9 | case AV_PIX_FMT_RGB24: | |
| 1289 | 9 | gbr24ptopacked24(src201, stride201, | |
| 1290 | 9 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1291 | srcSliceH, c->opts.src_w); | ||
| 1292 | 9 | break; | |
| 1293 | |||
| 1294 | ✗ | case AV_PIX_FMT_ARGB: | |
| 1295 | ✗ | alpha_first = 1; | |
| 1296 | av_fallthrough; | ||
| 1297 | 99 | case AV_PIX_FMT_RGBA: | |
| 1298 | 99 | gbraptopacked32(src201, stride201, | |
| 1299 | 99 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1300 | srcSliceH, alpha_first, c->opts.src_w); | ||
| 1301 | 99 | break; | |
| 1302 | |||
| 1303 | ✗ | case AV_PIX_FMT_ABGR: | |
| 1304 | ✗ | alpha_first = 1; | |
| 1305 | av_fallthrough; | ||
| 1306 | 225 | case AV_PIX_FMT_BGRA: | |
| 1307 | 225 | gbraptopacked32(src102, stride102, | |
| 1308 | 225 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1309 | srcSliceH, alpha_first, c->opts.src_w); | ||
| 1310 | 225 | break; | |
| 1311 | |||
| 1312 | ✗ | default: | |
| 1313 | ✗ | av_log(c, AV_LOG_ERROR, | |
| 1314 | "unsupported planar RGB conversion %s -> %s\n", | ||
| 1315 | ✗ | av_get_pix_fmt_name(c->opts.src_format), | |
| 1316 | ✗ | av_get_pix_fmt_name(c->opts.dst_format)); | |
| 1317 | } | ||
| 1318 | |||
| 1319 | 333 | return srcSliceH; | |
| 1320 | } | ||
| 1321 | |||
| 1322 | 720 | static int planarRgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 1323 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 1324 | uint8_t *const dst[], const int dstStride[]) | ||
| 1325 | { | ||
| 1326 | 720 | int alpha_first = 0; | |
| 1327 | 720 | const uint8_t *src102[] = { src[1], src[0], src[2] }; | |
| 1328 | 720 | const uint8_t *src201[] = { src[2], src[0], src[1] }; | |
| 1329 | 720 | int stride102[] = { srcStride[1], srcStride[0], srcStride[2] }; | |
| 1330 | 720 | int stride201[] = { srcStride[2], srcStride[0], srcStride[1] }; | |
| 1331 | |||
| 1332 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 720 times.
|
720 | if (c->opts.src_format != AV_PIX_FMT_GBRP) { |
| 1333 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", | |
| 1334 | ✗ | av_get_pix_fmt_name(c->opts.src_format), | |
| 1335 | ✗ | av_get_pix_fmt_name(c->opts.dst_format)); | |
| 1336 | ✗ | return srcSliceH; | |
| 1337 | } | ||
| 1338 | |||
| 1339 |
3/7✓ Branch 0 taken 234 times.
✓ Branch 1 taken 252 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 234 times.
✗ Branch 6 not taken.
|
720 | switch (c->opts.dst_format) { |
| 1340 | 234 | case AV_PIX_FMT_BGR24: | |
| 1341 | 234 | gbr24ptopacked24(src102, stride102, | |
| 1342 | 234 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1343 | srcSliceH, c->opts.src_w); | ||
| 1344 | 234 | break; | |
| 1345 | |||
| 1346 | 252 | case AV_PIX_FMT_RGB24: | |
| 1347 | 252 | gbr24ptopacked24(src201, stride201, | |
| 1348 | 252 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1349 | srcSliceH, c->opts.src_w); | ||
| 1350 | 252 | break; | |
| 1351 | |||
| 1352 | ✗ | case AV_PIX_FMT_ARGB: | |
| 1353 | ✗ | alpha_first = 1; | |
| 1354 | av_fallthrough; | ||
| 1355 | ✗ | case AV_PIX_FMT_RGBA: | |
| 1356 | ✗ | gbr24ptopacked32(src201, stride201, | |
| 1357 | ✗ | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1358 | srcSliceH, alpha_first, c->opts.src_w); | ||
| 1359 | ✗ | break; | |
| 1360 | |||
| 1361 | ✗ | case AV_PIX_FMT_ABGR: | |
| 1362 | ✗ | alpha_first = 1; | |
| 1363 | av_fallthrough; | ||
| 1364 | 234 | case AV_PIX_FMT_BGRA: | |
| 1365 | 234 | gbr24ptopacked32(src102, stride102, | |
| 1366 | 234 | dst[0] + srcSliceY * dstStride[0], dstStride[0], | |
| 1367 | srcSliceH, alpha_first, c->opts.src_w); | ||
| 1368 | 234 | break; | |
| 1369 | |||
| 1370 | ✗ | default: | |
| 1371 | ✗ | av_log(c, AV_LOG_ERROR, | |
| 1372 | "unsupported planar RGB conversion %s -> %s\n", | ||
| 1373 | ✗ | av_get_pix_fmt_name(c->opts.src_format), | |
| 1374 | ✗ | av_get_pix_fmt_name(c->opts.dst_format)); | |
| 1375 | } | ||
| 1376 | |||
| 1377 | 720 | return srcSliceH; | |
| 1378 | } | ||
| 1379 | |||
| 1380 | 45 | static int planarRgbToplanarRgbWrapper(SwsInternal *c, | |
| 1381 | const uint8_t *const src[], const int srcStride[], | ||
| 1382 | int srcSliceY, int srcSliceH, | ||
| 1383 | uint8_t *const dst[], const int dstStride[]) | ||
| 1384 | { | ||
| 1385 | 45 | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w, | |
| 1386 | dst[0], dstStride[0]); | ||
| 1387 | 45 | ff_copyPlane(src[1], srcStride[1], srcSliceY, srcSliceH, c->opts.src_w, | |
| 1388 | 45 | dst[1], dstStride[1]); | |
| 1389 | 45 | ff_copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->opts.src_w, | |
| 1390 | 45 | dst[2], dstStride[2]); | |
| 1391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if (dst[3]) { |
| 1392 | ✗ | if (is16BPS(c->opts.dst_format) || isNBPS(c->opts.dst_format)) { | |
| 1393 | ✗ | const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 1394 | ✗ | fillPlane16(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 1, | |
| 1395 | ✗ | desc_dst->comp[3].depth, isBE(c->opts.dst_format)); | |
| 1396 | } else { | ||
| 1397 | ✗ | fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255); | |
| 1398 | } | ||
| 1399 | } | ||
| 1400 | |||
| 1401 | 45 | return srcSliceH; | |
| 1402 | } | ||
| 1403 | |||
| 1404 | 991 | static void packedtogbr24p(const uint8_t *src, int srcStride, | |
| 1405 | uint8_t *const dst[], const int dstStride[], int srcSliceH, | ||
| 1406 | int alpha_first, int inc_size, int width) | ||
| 1407 | { | ||
| 1408 | uint8_t *dest[3]; | ||
| 1409 | int x, h; | ||
| 1410 | |||
| 1411 | 991 | dest[0] = dst[0]; | |
| 1412 | 991 | dest[1] = dst[1]; | |
| 1413 | 991 | dest[2] = dst[2]; | |
| 1414 | |||
| 1415 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 991 times.
|
991 | if (alpha_first) |
| 1416 | ✗ | src++; | |
| 1417 | |||
| 1418 |
2/2✓ Branch 0 taken 28848 times.
✓ Branch 1 taken 991 times.
|
29839 | for (h = 0; h < srcSliceH; h++) { |
| 1419 |
2/2✓ Branch 0 taken 9756480 times.
✓ Branch 1 taken 28848 times.
|
9785328 | for (x = 0; x < width; x++) { |
| 1420 | 9756480 | dest[0][x] = src[0]; | |
| 1421 | 9756480 | dest[1][x] = src[1]; | |
| 1422 | 9756480 | dest[2][x] = src[2]; | |
| 1423 | |||
| 1424 | 9756480 | src += inc_size; | |
| 1425 | } | ||
| 1426 | 28848 | src += srcStride - width * inc_size; | |
| 1427 | 28848 | dest[0] += dstStride[0]; | |
| 1428 | 28848 | dest[1] += dstStride[1]; | |
| 1429 | 28848 | dest[2] += dstStride[2]; | |
| 1430 | } | ||
| 1431 | 991 | } | |
| 1432 | |||
| 1433 | 991 | static int rgbToPlanarRgbWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 1434 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 1435 | uint8_t *const dst[], const int dstStride[]) | ||
| 1436 | { | ||
| 1437 | 991 | int alpha_first = 0; | |
| 1438 | 991 | int stride102[] = { dstStride[1], dstStride[0], dstStride[2] }; | |
| 1439 | 991 | int stride201[] = { dstStride[2], dstStride[0], dstStride[1] }; | |
| 1440 | 991 | uint8_t *dst102[] = { dst[1] + srcSliceY * dstStride[1], | |
| 1441 | 991 | dst[0] + srcSliceY * dstStride[0], | |
| 1442 | 991 | dst[2] + srcSliceY * dstStride[2] }; | |
| 1443 | 991 | uint8_t *dst201[] = { dst[2] + srcSliceY * dstStride[2], | |
| 1444 | 991 | dst[0] + srcSliceY * dstStride[0], | |
| 1445 | 991 | dst[1] + srcSliceY * dstStride[1] }; | |
| 1446 | |||
| 1447 |
3/7✓ Branch 0 taken 523 times.
✓ Branch 1 taken 234 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 234 times.
✗ Branch 6 not taken.
|
991 | switch (c->opts.src_format) { |
| 1448 | 523 | case AV_PIX_FMT_RGB24: | |
| 1449 | 523 | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201, | |
| 1450 | stride201, srcSliceH, alpha_first, 3, c->opts.src_w); | ||
| 1451 | 523 | break; | |
| 1452 | 234 | case AV_PIX_FMT_BGR24: | |
| 1453 | 234 | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102, | |
| 1454 | stride102, srcSliceH, alpha_first, 3, c->opts.src_w); | ||
| 1455 | 234 | break; | |
| 1456 | ✗ | case AV_PIX_FMT_ARGB: | |
| 1457 | ✗ | alpha_first = 1; | |
| 1458 | av_fallthrough; | ||
| 1459 | ✗ | case AV_PIX_FMT_RGBA: | |
| 1460 | ✗ | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst201, | |
| 1461 | stride201, srcSliceH, alpha_first, 4, c->opts.src_w); | ||
| 1462 | ✗ | break; | |
| 1463 | ✗ | case AV_PIX_FMT_ABGR: | |
| 1464 | ✗ | alpha_first = 1; | |
| 1465 | av_fallthrough; | ||
| 1466 | 234 | case AV_PIX_FMT_BGRA: | |
| 1467 | 234 | packedtogbr24p((const uint8_t *) src[0], srcStride[0], dst102, | |
| 1468 | stride102, srcSliceH, alpha_first, 4, c->opts.src_w); | ||
| 1469 | 234 | break; | |
| 1470 | ✗ | default: | |
| 1471 | ✗ | av_log(c, AV_LOG_ERROR, | |
| 1472 | "unsupported planar RGB conversion %s -> %s\n", | ||
| 1473 | ✗ | av_get_pix_fmt_name(c->opts.src_format), | |
| 1474 | ✗ | av_get_pix_fmt_name(c->opts.dst_format)); | |
| 1475 | } | ||
| 1476 | |||
| 1477 | 991 | return srcSliceH; | |
| 1478 | } | ||
| 1479 | |||
| 1480 | ✗ | static void packed24togbrap(const uint8_t *src, int srcStride, | |
| 1481 | uint8_t *const dst[], const int dstStride[], | ||
| 1482 | int srcSliceH, int width) | ||
| 1483 | { | ||
| 1484 | uint8_t *dest[4]; | ||
| 1485 | int x, h; | ||
| 1486 | |||
| 1487 | ✗ | dest[0] = dst[0]; | |
| 1488 | ✗ | dest[1] = dst[1]; | |
| 1489 | ✗ | dest[2] = dst[2]; | |
| 1490 | ✗ | dest[3] = dst[3]; | |
| 1491 | |||
| 1492 | ✗ | for (h = 0; h < srcSliceH; h++) { | |
| 1493 | ✗ | for (x = 0; x < width; x++) { | |
| 1494 | ✗ | dest[0][x] = src[x * 3 + 0]; | |
| 1495 | ✗ | dest[1][x] = src[x * 3 + 1]; | |
| 1496 | ✗ | dest[2][x] = src[x * 3 + 2]; | |
| 1497 | ✗ | dest[3][x] = 0xff; | |
| 1498 | } | ||
| 1499 | ✗ | src += srcStride; | |
| 1500 | ✗ | dest[0] += dstStride[0]; | |
| 1501 | ✗ | dest[1] += dstStride[1]; | |
| 1502 | ✗ | dest[2] += dstStride[2]; | |
| 1503 | ✗ | dest[3] += dstStride[3]; | |
| 1504 | } | ||
| 1505 | ✗ | } | |
| 1506 | |||
| 1507 | 216 | static void packed32togbrap(const uint8_t *src, int srcStride, | |
| 1508 | uint8_t *const dst[], const int dstStride[], | ||
| 1509 | int srcSliceH, int alpha_first, int width) | ||
| 1510 | { | ||
| 1511 | uint8_t *dest[4]; | ||
| 1512 | int x, h; | ||
| 1513 | |||
| 1514 | 216 | dest[0] = dst[0]; | |
| 1515 | 216 | dest[1] = dst[1]; | |
| 1516 | 216 | dest[2] = dst[2]; | |
| 1517 | 216 | dest[3] = dst[3]; | |
| 1518 | |||
| 1519 |
2/2✓ Branch 0 taken 3844 times.
✓ Branch 1 taken 216 times.
|
4060 | for (h = 0; h < srcSliceH; h++) { |
| 1520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3844 times.
|
3844 | if (alpha_first) { |
| 1521 | ✗ | for (x = 0; x < width; x++) { | |
| 1522 | ✗ | dest[0][x] = src[x * 4 + 1]; | |
| 1523 | ✗ | dest[1][x] = src[x * 4 + 2]; | |
| 1524 | ✗ | dest[2][x] = src[x * 4 + 3]; | |
| 1525 | ✗ | dest[3][x] = src[x * 4 + 0]; | |
| 1526 | } | ||
| 1527 | } else { | ||
| 1528 |
2/2✓ Branch 0 taken 988832 times.
✓ Branch 1 taken 3844 times.
|
992676 | for (x = 0; x < width; x++) { |
| 1529 | 988832 | dest[0][x] = src[x * 4 + 0]; | |
| 1530 | 988832 | dest[1][x] = src[x * 4 + 1]; | |
| 1531 | 988832 | dest[2][x] = src[x * 4 + 2]; | |
| 1532 | 988832 | dest[3][x] = src[x * 4 + 3]; | |
| 1533 | } | ||
| 1534 | } | ||
| 1535 | 3844 | src += srcStride; | |
| 1536 | 3844 | dest[0] += dstStride[0]; | |
| 1537 | 3844 | dest[1] += dstStride[1]; | |
| 1538 | 3844 | dest[2] += dstStride[2]; | |
| 1539 | 3844 | dest[3] += dstStride[3]; | |
| 1540 | } | ||
| 1541 | 216 | } | |
| 1542 | |||
| 1543 | 216 | static int rgbToPlanarRgbaWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 1544 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 1545 | uint8_t *const dst[], const int dstStride[]) | ||
| 1546 | { | ||
| 1547 | 216 | int alpha_first = 0; | |
| 1548 | 216 | int stride102[] = { dstStride[1], dstStride[0], dstStride[2], dstStride[3] }; | |
| 1549 | 216 | int stride201[] = { dstStride[2], dstStride[0], dstStride[1], dstStride[3] }; | |
| 1550 | 216 | uint8_t *dst102[] = { dst[1] + srcSliceY * dstStride[1], | |
| 1551 | 216 | dst[0] + srcSliceY * dstStride[0], | |
| 1552 | 216 | dst[2] + srcSliceY * dstStride[2], | |
| 1553 | 216 | dst[3] + srcSliceY * dstStride[3] }; | |
| 1554 | 216 | uint8_t *dst201[] = { dst[2] + srcSliceY * dstStride[2], | |
| 1555 | 216 | dst[0] + srcSliceY * dstStride[0], | |
| 1556 | 216 | dst[1] + srcSliceY * dstStride[1], | |
| 1557 | 216 | dst[3] + srcSliceY * dstStride[3] }; | |
| 1558 | |||
| 1559 |
2/7✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 171 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 45 times.
✗ Branch 6 not taken.
|
216 | switch (c->opts.src_format) { |
| 1560 | ✗ | case AV_PIX_FMT_RGB24: | |
| 1561 | ✗ | packed24togbrap((const uint8_t *) src[0], srcStride[0], dst201, | |
| 1562 | stride201, srcSliceH, c->opts.src_w); | ||
| 1563 | ✗ | break; | |
| 1564 | ✗ | case AV_PIX_FMT_BGR24: | |
| 1565 | ✗ | packed24togbrap((const uint8_t *) src[0], srcStride[0], dst102, | |
| 1566 | stride102, srcSliceH, c->opts.src_w); | ||
| 1567 | ✗ | break; | |
| 1568 | ✗ | case AV_PIX_FMT_ARGB: | |
| 1569 | ✗ | alpha_first = 1; | |
| 1570 | av_fallthrough; | ||
| 1571 | 171 | case AV_PIX_FMT_RGBA: | |
| 1572 | 171 | packed32togbrap((const uint8_t *) src[0], srcStride[0], dst201, | |
| 1573 | stride201, srcSliceH, alpha_first, c->opts.src_w); | ||
| 1574 | 171 | break; | |
| 1575 | ✗ | case AV_PIX_FMT_ABGR: | |
| 1576 | ✗ | alpha_first = 1; | |
| 1577 | av_fallthrough; | ||
| 1578 | 45 | case AV_PIX_FMT_BGRA: | |
| 1579 | 45 | packed32togbrap((const uint8_t *) src[0], srcStride[0], dst102, | |
| 1580 | stride102, srcSliceH, alpha_first, c->opts.src_w); | ||
| 1581 | 45 | break; | |
| 1582 | ✗ | default: | |
| 1583 | ✗ | av_log(c, AV_LOG_ERROR, | |
| 1584 | "unsupported planar RGB conversion %s -> %s\n", | ||
| 1585 | ✗ | av_get_pix_fmt_name(c->opts.src_format), | |
| 1586 | ✗ | av_get_pix_fmt_name(c->opts.dst_format)); | |
| 1587 | } | ||
| 1588 | |||
| 1589 | 216 | return srcSliceH; | |
| 1590 | } | ||
| 1591 | |||
| 1592 | #define BAYER_GBRG | ||
| 1593 | #define BAYER_8 | ||
| 1594 | #define BAYER_RENAME(x) bayer_gbrg8_to_##x | ||
| 1595 | #include "bayer_template.c" | ||
| 1596 | |||
| 1597 | #define BAYER_GBRG | ||
| 1598 | #define BAYER_16LE | ||
| 1599 | #define BAYER_RENAME(x) bayer_gbrg16le_to_##x | ||
| 1600 | #include "bayer_template.c" | ||
| 1601 | |||
| 1602 | #define BAYER_GBRG | ||
| 1603 | #define BAYER_16BE | ||
| 1604 | #define BAYER_RENAME(x) bayer_gbrg16be_to_##x | ||
| 1605 | #include "bayer_template.c" | ||
| 1606 | |||
| 1607 | #define BAYER_GRBG | ||
| 1608 | #define BAYER_8 | ||
| 1609 | #define BAYER_RENAME(x) bayer_grbg8_to_##x | ||
| 1610 | #include "bayer_template.c" | ||
| 1611 | |||
| 1612 | #define BAYER_GRBG | ||
| 1613 | #define BAYER_16LE | ||
| 1614 | #define BAYER_RENAME(x) bayer_grbg16le_to_##x | ||
| 1615 | #include "bayer_template.c" | ||
| 1616 | |||
| 1617 | #define BAYER_GRBG | ||
| 1618 | #define BAYER_16BE | ||
| 1619 | #define BAYER_RENAME(x) bayer_grbg16be_to_##x | ||
| 1620 | #include "bayer_template.c" | ||
| 1621 | |||
| 1622 | #define BAYER_BGGR | ||
| 1623 | #define BAYER_8 | ||
| 1624 | #define BAYER_RENAME(x) bayer_bggr8_to_##x | ||
| 1625 | #include "bayer_template.c" | ||
| 1626 | |||
| 1627 | #define BAYER_BGGR | ||
| 1628 | #define BAYER_16LE | ||
| 1629 | #define BAYER_RENAME(x) bayer_bggr16le_to_##x | ||
| 1630 | #include "bayer_template.c" | ||
| 1631 | |||
| 1632 | #define BAYER_BGGR | ||
| 1633 | #define BAYER_16BE | ||
| 1634 | #define BAYER_RENAME(x) bayer_bggr16be_to_##x | ||
| 1635 | #include "bayer_template.c" | ||
| 1636 | |||
| 1637 | #define BAYER_RGGB | ||
| 1638 | #define BAYER_8 | ||
| 1639 | #define BAYER_RENAME(x) bayer_rggb8_to_##x | ||
| 1640 | #include "bayer_template.c" | ||
| 1641 | |||
| 1642 | #define BAYER_RGGB | ||
| 1643 | #define BAYER_16LE | ||
| 1644 | #define BAYER_RENAME(x) bayer_rggb16le_to_##x | ||
| 1645 | #include "bayer_template.c" | ||
| 1646 | |||
| 1647 | #define BAYER_RGGB | ||
| 1648 | #define BAYER_16BE | ||
| 1649 | #define BAYER_RENAME(x) bayer_rggb16be_to_##x | ||
| 1650 | #include "bayer_template.c" | ||
| 1651 | |||
| 1652 | ✗ | static int bayer_to_rgb24_wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 1653 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 1654 | uint8_t *const dst[], const int dstStride[]) | ||
| 1655 | { | ||
| 1656 | ✗ | uint8_t *dstPtr= dst[0] + srcSliceY * dstStride[0]; | |
| 1657 | ✗ | const uint8_t *srcPtr= src[0]; | |
| 1658 | int i; | ||
| 1659 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
| 1660 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
| 1661 | |||
| 1662 | ✗ | switch(c->opts.src_format) { | |
| 1663 | #define CASE(pixfmt, prefix) \ | ||
| 1664 | case pixfmt: copy = bayer_##prefix##_to_rgb24_copy; \ | ||
| 1665 | interpolate = bayer_##prefix##_to_rgb24_interpolate; \ | ||
| 1666 | break; | ||
| 1667 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
| 1668 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
| 1669 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
| 1670 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
| 1671 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
| 1672 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
| 1673 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
| 1674 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
| 1675 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
| 1676 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
| 1677 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
| 1678 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
| 1679 | #undef CASE | ||
| 1680 | ✗ | default: return 0; | |
| 1681 | } | ||
| 1682 | |||
| 1683 | ✗ | av_assert0(srcSliceH > 1); | |
| 1684 | |||
| 1685 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w); | |
| 1686 | ✗ | srcPtr += 2 * srcStride[0]; | |
| 1687 | ✗ | dstPtr += 2 * dstStride[0]; | |
| 1688 | |||
| 1689 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
| 1690 | ✗ | interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w); | |
| 1691 | ✗ | srcPtr += 2 * srcStride[0]; | |
| 1692 | ✗ | dstPtr += 2 * dstStride[0]; | |
| 1693 | } | ||
| 1694 | |||
| 1695 | ✗ | if (i + 1 == srcSliceH) { | |
| 1696 | ✗ | copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->opts.src_w); | |
| 1697 | ✗ | } else if (i < srcSliceH) | |
| 1698 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w); | |
| 1699 | ✗ | return srcSliceH; | |
| 1700 | } | ||
| 1701 | |||
| 1702 | ✗ | static int bayer_to_rgb48_wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 1703 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 1704 | uint8_t *const dst[], const int dstStride[]) | ||
| 1705 | { | ||
| 1706 | ✗ | uint8_t *dstPtr= dst[0] + srcSliceY * dstStride[0]; | |
| 1707 | ✗ | const uint8_t *srcPtr= src[0]; | |
| 1708 | int i; | ||
| 1709 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
| 1710 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dst, int dst_stride, int width); | ||
| 1711 | |||
| 1712 | ✗ | switch(c->opts.src_format) { | |
| 1713 | #define CASE(pixfmt, prefix) \ | ||
| 1714 | case pixfmt: copy = bayer_##prefix##_to_rgb48_copy; \ | ||
| 1715 | interpolate = bayer_##prefix##_to_rgb48_interpolate; \ | ||
| 1716 | break; | ||
| 1717 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
| 1718 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
| 1719 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
| 1720 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
| 1721 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
| 1722 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
| 1723 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
| 1724 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
| 1725 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
| 1726 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
| 1727 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
| 1728 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
| 1729 | #undef CASE | ||
| 1730 | ✗ | default: return 0; | |
| 1731 | } | ||
| 1732 | |||
| 1733 | ✗ | av_assert0(srcSliceH > 1); | |
| 1734 | |||
| 1735 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w); | |
| 1736 | ✗ | srcPtr += 2 * srcStride[0]; | |
| 1737 | ✗ | dstPtr += 2 * dstStride[0]; | |
| 1738 | |||
| 1739 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
| 1740 | ✗ | interpolate(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w); | |
| 1741 | ✗ | srcPtr += 2 * srcStride[0]; | |
| 1742 | ✗ | dstPtr += 2 * dstStride[0]; | |
| 1743 | } | ||
| 1744 | |||
| 1745 | ✗ | if (i + 1 == srcSliceH) { | |
| 1746 | ✗ | copy(srcPtr, -srcStride[0], dstPtr, -dstStride[0], c->opts.src_w); | |
| 1747 | ✗ | } else if (i < srcSliceH) | |
| 1748 | ✗ | copy(srcPtr, srcStride[0], dstPtr, dstStride[0], c->opts.src_w); | |
| 1749 | ✗ | return srcSliceH; | |
| 1750 | } | ||
| 1751 | |||
| 1752 | ✗ | static int bayer_to_yv12_wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 1753 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 1754 | uint8_t *const dst[], const int dstStride[]) | ||
| 1755 | { | ||
| 1756 | ✗ | const uint8_t *srcPtr= src[0]; | |
| 1757 | ✗ | uint8_t *dstY= dst[0] + srcSliceY * dstStride[0]; | |
| 1758 | ✗ | uint8_t *dstU= dst[1] + srcSliceY * dstStride[1] / 2; | |
| 1759 | ✗ | uint8_t *dstV= dst[2] + srcSliceY * dstStride[2] / 2; | |
| 1760 | int i; | ||
| 1761 | void (*copy) (const uint8_t *src, int src_stride, uint8_t *dstY, uint8_t *dstU, uint8_t *dstV, int luma_stride, int width, const int32_t *rgb2yuv); | ||
| 1762 | void (*interpolate)(const uint8_t *src, int src_stride, uint8_t *dstY, uint8_t *dstU, uint8_t *dstV, int luma_stride, int width, const int32_t *rgb2yuv); | ||
| 1763 | |||
| 1764 | ✗ | switch(c->opts.src_format) { | |
| 1765 | #define CASE(pixfmt, prefix) \ | ||
| 1766 | case pixfmt: copy = bayer_##prefix##_to_yv12_copy; \ | ||
| 1767 | interpolate = bayer_##prefix##_to_yv12_interpolate; \ | ||
| 1768 | break; | ||
| 1769 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR8, bggr8) | |
| 1770 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16LE, bggr16le) | |
| 1771 | ✗ | CASE(AV_PIX_FMT_BAYER_BGGR16BE, bggr16be) | |
| 1772 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB8, rggb8) | |
| 1773 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16LE, rggb16le) | |
| 1774 | ✗ | CASE(AV_PIX_FMT_BAYER_RGGB16BE, rggb16be) | |
| 1775 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG8, gbrg8) | |
| 1776 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16LE, gbrg16le) | |
| 1777 | ✗ | CASE(AV_PIX_FMT_BAYER_GBRG16BE, gbrg16be) | |
| 1778 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG8, grbg8) | |
| 1779 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16LE, grbg16le) | |
| 1780 | ✗ | CASE(AV_PIX_FMT_BAYER_GRBG16BE, grbg16be) | |
| 1781 | #undef CASE | ||
| 1782 | ✗ | default: return 0; | |
| 1783 | } | ||
| 1784 | |||
| 1785 | ✗ | av_assert0(srcSliceH > 1); | |
| 1786 | |||
| 1787 | ✗ | copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->opts.src_w, c->input_rgb2yuv_table); | |
| 1788 | ✗ | srcPtr += 2 * srcStride[0]; | |
| 1789 | ✗ | dstY += 2 * dstStride[0]; | |
| 1790 | ✗ | dstU += dstStride[1]; | |
| 1791 | ✗ | dstV += dstStride[1]; | |
| 1792 | |||
| 1793 | ✗ | for (i = 2; i < srcSliceH - 2; i += 2) { | |
| 1794 | ✗ | interpolate(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->opts.src_w, c->input_rgb2yuv_table); | |
| 1795 | ✗ | srcPtr += 2 * srcStride[0]; | |
| 1796 | ✗ | dstY += 2 * dstStride[0]; | |
| 1797 | ✗ | dstU += dstStride[1]; | |
| 1798 | ✗ | dstV += dstStride[1]; | |
| 1799 | } | ||
| 1800 | |||
| 1801 | ✗ | if (i + 1 == srcSliceH) { | |
| 1802 | ✗ | copy(srcPtr, -srcStride[0], dstY, dstU, dstV, -dstStride[0], c->opts.src_w, c->input_rgb2yuv_table); | |
| 1803 | ✗ | } else if (i < srcSliceH) | |
| 1804 | ✗ | copy(srcPtr, srcStride[0], dstY, dstU, dstV, dstStride[0], c->opts.src_w, c->input_rgb2yuv_table); | |
| 1805 | ✗ | return srcSliceH; | |
| 1806 | } | ||
| 1807 | |||
| 1808 | #define isRGBA32(x) ( \ | ||
| 1809 | (x) == AV_PIX_FMT_ARGB \ | ||
| 1810 | || (x) == AV_PIX_FMT_RGBA \ | ||
| 1811 | || (x) == AV_PIX_FMT_BGRA \ | ||
| 1812 | || (x) == AV_PIX_FMT_ABGR \ | ||
| 1813 | ) | ||
| 1814 | |||
| 1815 | #define isRGBA64(x) ( \ | ||
| 1816 | (x) == AV_PIX_FMT_RGBA64LE \ | ||
| 1817 | || (x) == AV_PIX_FMT_RGBA64BE \ | ||
| 1818 | || (x) == AV_PIX_FMT_BGRA64LE \ | ||
| 1819 | || (x) == AV_PIX_FMT_BGRA64BE \ | ||
| 1820 | ) | ||
| 1821 | |||
| 1822 | #define isRGB48(x) ( \ | ||
| 1823 | (x) == AV_PIX_FMT_RGB48LE \ | ||
| 1824 | || (x) == AV_PIX_FMT_RGB48BE \ | ||
| 1825 | || (x) == AV_PIX_FMT_BGR48LE \ | ||
| 1826 | || (x) == AV_PIX_FMT_BGR48BE \ | ||
| 1827 | ) | ||
| 1828 | |||
| 1829 | #define isAYUV(x) ( \ | ||
| 1830 | (x) == AV_PIX_FMT_AYUV \ | ||
| 1831 | || (x) == AV_PIX_FMT_VUYA \ | ||
| 1832 | || (x) == AV_PIX_FMT_VUYX \ | ||
| 1833 | || (x) == AV_PIX_FMT_UYVA \ | ||
| 1834 | ) | ||
| 1835 | |||
| 1836 | #define isX2RGB(x) ( \ | ||
| 1837 | (x) == AV_PIX_FMT_X2RGB10LE \ | ||
| 1838 | || (x) == AV_PIX_FMT_X2BGR10LE \ | ||
| 1839 | ) | ||
| 1840 | |||
| 1841 | /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ | ||
| 1842 | typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int); | ||
| 1843 | 21502 | static rgbConvFn findRgbConvFn(SwsInternal *c) | |
| 1844 | { | ||
| 1845 | 21502 | const enum AVPixelFormat srcFormat = c->opts.src_format; | |
| 1846 | 21502 | const enum AVPixelFormat dstFormat = c->opts.dst_format; | |
| 1847 | 21502 | const int srcId = c->srcFormatBpp; | |
| 1848 | 21502 | const int dstId = c->dstFormatBpp; | |
| 1849 | 21502 | rgbConvFn conv = NULL; | |
| 1850 | |||
| 1851 | #define IS_NOT_NE(Bpp, desc) \ | ||
| 1852 | (Bpp == 2 && (!(desc->flags & AV_PIX_FMT_FLAG_BE) != !HAVE_BIGENDIAN)) | ||
| 1853 | |||
| 1854 | #define CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst) | ||
| 1855 | |||
| 1856 |
13/16✓ Branch 0 taken 21237 times.
✓ Branch 1 taken 265 times.
✓ Branch 2 taken 20906 times.
✓ Branch 3 taken 331 times.
✓ Branch 4 taken 16278 times.
✓ Branch 5 taken 4628 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 16276 times.
✓ Branch 8 taken 5226 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 5226 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 4732 times.
✓ Branch 13 taken 494 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4732 times.
|
21502 | if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) { |
| 1857 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 494 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
494 | if ( CONV_IS(ABGR, RGBA) |
| 1858 |
3/4✓ Branch 0 taken 244 times.
✓ Branch 1 taken 250 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 244 times.
|
494 | || CONV_IS(ARGB, BGRA) |
| 1859 |
3/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 220 times.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
250 | || CONV_IS(BGRA, ARGB) |
| 1860 |
3/4✓ Branch 0 taken 220 times.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 220 times.
|
494 | || CONV_IS(RGBA, ABGR)) conv = shuffle_bytes_3210; |
| 1861 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 250 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
250 | else if (CONV_IS(ABGR, ARGB) |
| 1862 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 250 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
250 | || CONV_IS(ARGB, ABGR)) conv = shuffle_bytes_0321; |
| 1863 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 250 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
250 | else if (CONV_IS(ABGR, BGRA) |
| 1864 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 250 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
250 | || CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230; |
| 1865 |
3/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 220 times.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
250 | else if (CONV_IS(BGRA, RGBA) |
| 1866 |
3/4✓ Branch 0 taken 220 times.
✓ Branch 1 taken 30 times.
✓ Branch 2 taken 220 times.
✗ Branch 3 not taken.
|
250 | || CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103; |
| 1867 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
30 | else if (CONV_IS(BGRA, ABGR) |
| 1868 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30 | || CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012; |
| 1869 |
13/16✓ Branch 0 taken 20746 times.
✓ Branch 1 taken 262 times.
✓ Branch 2 taken 20735 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 20734 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20734 times.
✓ Branch 8 taken 254 times.
✓ Branch 9 taken 20 times.
✓ Branch 10 taken 253 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 253 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 253 times.
|
21008 | } else if (isRGB48(srcFormat) && isRGB48(dstFormat)) { |
| 1870 |
2/4✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
|
21 | if (CONV_IS(RGB48LE, BGR48LE) |
| 1871 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
21 | || CONV_IS(BGR48LE, RGB48LE) |
| 1872 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
21 | || CONV_IS(RGB48BE, BGR48BE) |
| 1873 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
21 | || CONV_IS(BGR48BE, RGB48BE)) conv = rgb48tobgr48_nobswap; |
| 1874 |
2/4✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
|
21 | else if (CONV_IS(RGB48LE, BGR48BE) |
| 1875 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
21 | || CONV_IS(BGR48LE, RGB48BE) |
| 1876 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
21 | || CONV_IS(RGB48BE, BGR48LE) |
| 1877 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
21 | || CONV_IS(BGR48BE, RGB48LE)) conv = rgb48tobgr48_bswap; |
| 1878 |
11/16✓ Branch 0 taken 20746 times.
✓ Branch 1 taken 241 times.
✓ Branch 2 taken 20735 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 20734 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20734 times.
✓ Branch 8 taken 253 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 253 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 253 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 253 times.
|
20987 | } else if (isRGB48(srcFormat) && isRGBA64(dstFormat)) { |
| 1879 | ✗ | if (CONV_IS(RGB48LE, BGRA64LE) | |
| 1880 | ✗ | || CONV_IS(BGR48LE, RGBA64LE) | |
| 1881 | ✗ | || CONV_IS(RGB48BE, BGRA64BE) | |
| 1882 | ✗ | || CONV_IS(BGR48BE, RGBA64BE)) conv = rgb48tobgr64_nobswap; | |
| 1883 | ✗ | else if (CONV_IS(RGB48LE, BGRA64BE) | |
| 1884 | ✗ | || CONV_IS(BGR48LE, RGBA64BE) | |
| 1885 | ✗ | || CONV_IS(RGB48BE, BGRA64LE) | |
| 1886 | ✗ | || CONV_IS(BGR48BE, RGBA64LE)) conv = rgb48tobgr64_bswap; | |
| 1887 | ✗ | if (CONV_IS(RGB48LE, RGBA64LE) | |
| 1888 | ✗ | || CONV_IS(BGR48LE, BGRA64LE) | |
| 1889 | ✗ | || CONV_IS(RGB48BE, RGBA64BE) | |
| 1890 | ✗ | || CONV_IS(BGR48BE, BGRA64BE)) conv = rgb48to64_nobswap; | |
| 1891 | ✗ | else if (CONV_IS(RGB48LE, RGBA64BE) | |
| 1892 | ✗ | || CONV_IS(BGR48LE, BGRA64BE) | |
| 1893 | ✗ | || CONV_IS(RGB48BE, RGBA64LE) | |
| 1894 | ✗ | || CONV_IS(BGR48BE, BGRA64LE)) conv = rgb48to64_bswap; | |
| 1895 |
11/16✓ Branch 0 taken 20986 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 20975 times.
✓ Branch 3 taken 11 times.
✓ Branch 4 taken 20974 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 20974 times.
✓ Branch 8 taken 13 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 13 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 13 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 13 times.
|
20987 | } else if (isRGBA64(srcFormat) && isRGB48(dstFormat)) { |
| 1896 | ✗ | if (CONV_IS(RGBA64LE, BGR48LE) | |
| 1897 | ✗ | || CONV_IS(BGRA64LE, RGB48LE) | |
| 1898 | ✗ | || CONV_IS(RGBA64BE, BGR48BE) | |
| 1899 | ✗ | || CONV_IS(BGRA64BE, RGB48BE)) conv = rgb64tobgr48_nobswap; | |
| 1900 | ✗ | else if (CONV_IS(RGBA64LE, BGR48BE) | |
| 1901 | ✗ | || CONV_IS(BGRA64LE, RGB48BE) | |
| 1902 | ✗ | || CONV_IS(RGBA64BE, BGR48LE) | |
| 1903 | ✗ | || CONV_IS(BGRA64BE, RGB48LE)) conv = rgb64tobgr48_bswap; | |
| 1904 | ✗ | else if (CONV_IS(RGBA64LE, RGB48LE) | |
| 1905 | ✗ | || CONV_IS(BGRA64LE, BGR48LE) | |
| 1906 | ✗ | || CONV_IS(RGBA64BE, RGB48BE) | |
| 1907 | ✗ | || CONV_IS(BGRA64BE, BGR48BE)) conv = rgb64to48_nobswap; | |
| 1908 | ✗ | else if (CONV_IS(RGBA64LE, RGB48BE) | |
| 1909 | ✗ | || CONV_IS(BGRA64LE, BGR48BE) | |
| 1910 | ✗ | || CONV_IS(RGBA64BE, RGB48LE) | |
| 1911 | ✗ | || CONV_IS(BGRA64BE, BGR48LE)) conv = rgb64to48_bswap; | |
| 1912 |
9/12✓ Branch 0 taken 20703 times.
✓ Branch 1 taken 284 times.
✓ Branch 2 taken 284 times.
✓ Branch 3 taken 20419 times.
✓ Branch 4 taken 80 times.
✓ Branch 5 taken 488 times.
✓ Branch 6 taken 80 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 80 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 80 times.
|
20987 | } else if (isX2RGB(srcFormat) && isRGB48(dstFormat)) { |
| 1913 |
3/4✓ Branch 0 taken 244 times.
✓ Branch 1 taken 244 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 244 times.
|
488 | if (CONV_IS(X2RGB10LE, RGB48LE) |
| 1914 |
2/4✓ Branch 0 taken 244 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 244 times.
|
488 | || CONV_IS(X2BGR10LE, BGR48LE)) conv = HAVE_BIGENDIAN ? x2rgb10to48_bswap |
| 1915 | : x2rgb10to48_nobswap; | ||
| 1916 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 244 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
244 | else if (CONV_IS(X2RGB10LE, RGB48BE) |
| 1917 |
2/4✓ Branch 0 taken 244 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 244 times.
|
244 | || CONV_IS(X2BGR10LE, BGR48BE)) conv = HAVE_BIGENDIAN ? x2rgb10to48_nobswap |
| 1918 | : x2rgb10to48_bswap; | ||
| 1919 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 244 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
244 | else if (CONV_IS(X2RGB10LE, BGR48LE) |
| 1920 |
2/4✓ Branch 0 taken 244 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 244 times.
✗ Branch 3 not taken.
|
244 | || CONV_IS(X2BGR10LE, RGB48LE)) conv = HAVE_BIGENDIAN ? x2rgb10tobgr48_bswap |
| 1921 | : x2rgb10tobgr48_nobswap; | ||
| 1922 | ✗ | else if (CONV_IS(X2RGB10LE, BGR48BE) | |
| 1923 | ✗ | || CONV_IS(X2BGR10LE, RGB48BE)) conv = HAVE_BIGENDIAN ? x2rgb10tobgr48_nobswap | |
| 1924 | : x2rgb10tobgr48_bswap; | ||
| 1925 |
8/12✓ Branch 0 taken 20459 times.
✓ Branch 1 taken 40 times.
✓ Branch 2 taken 40 times.
✓ Branch 3 taken 20419 times.
✓ Branch 4 taken 80 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 80 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 80 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 80 times.
|
20499 | } else if (isX2RGB(srcFormat) && isRGBA64(dstFormat)) { |
| 1926 | ✗ | if (CONV_IS(X2RGB10LE, RGBA64LE) | |
| 1927 | ✗ | || CONV_IS(X2BGR10LE, BGRA64LE)) conv = HAVE_BIGENDIAN ? x2rgb10to64_bswap | |
| 1928 | : x2rgb10to64_nobswap; | ||
| 1929 | ✗ | else if (CONV_IS(X2RGB10LE, RGBA64BE) | |
| 1930 | ✗ | || CONV_IS(X2BGR10LE, BGRA64BE)) conv = HAVE_BIGENDIAN ? x2rgb10to64_nobswap | |
| 1931 | : x2rgb10to64_bswap; | ||
| 1932 | ✗ | else if (CONV_IS(X2RGB10LE, BGRA64LE) | |
| 1933 | ✗ | || CONV_IS(X2BGR10LE, RGBA64LE)) conv = HAVE_BIGENDIAN ? x2rgb10tobgr64_bswap | |
| 1934 | : x2rgb10tobgr64_nobswap; | ||
| 1935 | ✗ | else if (CONV_IS(X2RGB10LE, BGRA64BE) | |
| 1936 | ✗ | || CONV_IS(X2BGR10LE, RGBA64BE)) conv = HAVE_BIGENDIAN ? x2rgb10tobgr64_nobswap | |
| 1937 | : x2rgb10tobgr64_bswap; | ||
| 1938 |
4/16✓ Branch 0 taken 20499 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20499 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20499 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 20499 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
20499 | } else if (isAYUV(srcFormat) && isAYUV(dstFormat)) { |
| 1939 | /* VUYX only for dst, to avoid copying undefined bytes */ | ||
| 1940 | ✗ | if ( CONV_IS(AYUV, VUYA) | |
| 1941 | ✗ | || CONV_IS(AYUV, VUYX) | |
| 1942 | ✗ | || CONV_IS(VUYA, AYUV)) conv = shuffle_bytes_3210; | |
| 1943 | ✗ | else if (CONV_IS(AYUV, UYVA)) conv = shuffle_bytes_2130; | |
| 1944 | ✗ | else if (CONV_IS(VUYA, UYVA)) conv = shuffle_bytes_1203; | |
| 1945 | ✗ | else if (CONV_IS(UYVA, AYUV)) conv = shuffle_bytes_3102; | |
| 1946 | ✗ | else if (CONV_IS(UYVA, VUYA) | |
| 1947 | ✗ | || CONV_IS(UYVA, VUYX)) conv = shuffle_bytes_2013; | |
| 1948 | } else | ||
| 1949 | /* BGR -> BGR */ | ||
| 1950 |
5/6✓ Branch 1 taken 2454 times.
✓ Branch 2 taken 18045 times.
✓ Branch 4 taken 2454 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 16727 times.
✓ Branch 7 taken 3772 times.
|
40998 | if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) || |
| 1951 |
2/2✓ Branch 2 taken 15798 times.
✓ Branch 3 taken 929 times.
|
37226 | (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) { |
| 1952 |
7/14✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 8903 times.
✓ Branch 8 taken 1984 times.
✓ Branch 9 taken 4506 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 162 times.
✓ Branch 13 taken 223 times.
|
15798 | switch (srcId | (dstId << 16)) { |
| 1953 | ✗ | case 0x000F000C: conv = rgb12to15; break; | |
| 1954 | ✗ | case 0x000F0010: conv = rgb16to15; break; | |
| 1955 | 10 | case 0x000F0018: conv = rgb24to15; break; | |
| 1956 | ✗ | case 0x000F0020: conv = rgb32to15; break; | |
| 1957 | ✗ | case 0x0010000F: conv = rgb15to16; break; | |
| 1958 | 10 | case 0x00100018: conv = rgb24to16; break; | |
| 1959 | ✗ | case 0x00100020: conv = rgb32to16; break; | |
| 1960 | 8903 | case 0x0018000F: conv = rgb15to24; break; | |
| 1961 | 1984 | case 0x00180010: conv = rgb16to24; break; | |
| 1962 | 4506 | case 0x00180020: conv = rgb32to24; break; | |
| 1963 | ✗ | case 0x0020000F: conv = rgb15to32; break; | |
| 1964 | ✗ | case 0x00200010: conv = rgb16to32; break; | |
| 1965 | 162 | case 0x00200018: conv = rgb24to32; break; | |
| 1966 | } | ||
| 1967 |
6/6✓ Branch 1 taken 2414 times.
✓ Branch 2 taken 2287 times.
✓ Branch 4 taken 187 times.
✓ Branch 5 taken 2227 times.
✓ Branch 6 taken 929 times.
✓ Branch 7 taken 1545 times.
|
7175 | } else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) || |
| 1968 |
2/2✓ Branch 2 taken 419 times.
✓ Branch 3 taken 510 times.
|
3403 | (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) { |
| 1969 |
5/17✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1595 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 828 times.
✓ Branch 12 taken 72 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 128 times.
✓ Branch 16 taken 23 times.
|
2646 | switch (srcId | (dstId << 16)) { |
| 1970 | ✗ | case 0x000C000C: conv = rgb12tobgr12; break; | |
| 1971 | ✗ | case 0x000F000F: conv = rgb15tobgr15; break; | |
| 1972 | ✗ | case 0x000F0010: conv = rgb16tobgr15; break; | |
| 1973 | ✗ | case 0x000F0018: conv = rgb24tobgr15; break; | |
| 1974 | ✗ | case 0x000F0020: conv = rgb32tobgr15; break; | |
| 1975 | ✗ | case 0x0010000F: conv = rgb15tobgr16; break; | |
| 1976 | ✗ | case 0x00100010: conv = rgb16tobgr16; break; | |
| 1977 | ✗ | case 0x00100018: conv = rgb24tobgr16; break; | |
| 1978 | ✗ | case 0x00100020: conv = rgb32tobgr16; break; | |
| 1979 | 1595 | case 0x0018000F: conv = rgb15tobgr24; break; | |
| 1980 | ✗ | case 0x00180010: conv = rgb16tobgr24; break; | |
| 1981 | 828 | case 0x00180018: conv = rgb24tobgr24; break; | |
| 1982 | 72 | case 0x00180020: conv = rgb32tobgr24; break; | |
| 1983 | ✗ | case 0x0020000F: conv = rgb15tobgr32; break; | |
| 1984 | ✗ | case 0x00200010: conv = rgb16tobgr32; break; | |
| 1985 | 128 | case 0x00200018: conv = rgb24tobgr32; break; | |
| 1986 | } | ||
| 1987 | } | ||
| 1988 | |||
| 1989 | if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) && !isRGBA32(srcFormat) && ALT32_CORR<0) | ||
| 1990 | return NULL; | ||
| 1991 | |||
| 1992 | // Maintain symmetry between endianness | ||
| 1993 |
2/2✓ Branch 0 taken 3436 times.
✓ Branch 1 taken 18066 times.
|
21502 | if (c->opts.flags & SWS_BITEXACT) |
| 1994 |
7/12✓ Branch 0 taken 3386 times.
✓ Branch 1 taken 50 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3386 times.
✓ Branch 4 taken 50 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 50 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 50 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 50 times.
✗ Branch 11 not taken.
|
3436 | if ((dstFormat == AV_PIX_FMT_RGB32 || dstFormat == AV_PIX_FMT_BGR32 ) && !isRGBA32(srcFormat) && ALT32_CORR>0) |
| 1995 | 50 | return NULL; | |
| 1996 | |||
| 1997 | 21452 | return conv; | |
| 1998 | } | ||
| 1999 | |||
| 2000 | /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ | ||
| 2001 | 18557 | static int rgbToRgbWrapper(SwsInternal *c, const uint8_t *const src[], const int srcStride[], | |
| 2002 | int srcSliceY, int srcSliceH, uint8_t *const dst[], | ||
| 2003 | const int dstStride[]) | ||
| 2004 | |||
| 2005 | { | ||
| 2006 | 18557 | const enum AVPixelFormat srcFormat = c->opts.src_format; | |
| 2007 | 18557 | const enum AVPixelFormat dstFormat = c->opts.dst_format; | |
| 2008 | 18557 | const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->opts.src_format); | |
| 2009 | 18557 | const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2010 | 18557 | const int srcBpp = desc_src->comp[0].step; | |
| 2011 | 18557 | const int dstBpp = desc_dst->comp[0].step; | |
| 2012 | 18557 | rgbConvFn conv = findRgbConvFn(c); | |
| 2013 | |||
| 2014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18557 times.
|
18557 | if (!conv) { |
| 2015 | ✗ | av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n", | |
| 2016 | av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); | ||
| 2017 | } else { | ||
| 2018 | 18557 | const uint8_t *srcPtr = src[0]; | |
| 2019 | 18557 | uint8_t *dstPtr = dst[0]; | |
| 2020 |
3/4✓ Branch 0 taken 12312 times.
✓ Branch 1 taken 6245 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12312 times.
|
18557 | int src_bswap = IS_NOT_NE(srcBpp, desc_src); |
| 2021 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 18557 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
18557 | int dst_bswap = IS_NOT_NE(dstBpp, desc_dst); |
| 2022 | |||
| 2023 |
4/6✓ Branch 0 taken 18557 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✓ Branch 3 taken 18314 times.
✓ Branch 4 taken 243 times.
✗ Branch 5 not taken.
|
18557 | if ((srcFormat == AV_PIX_FMT_RGB32_1 || srcFormat == AV_PIX_FMT_BGR32_1) && |
| 2024 |
4/6✓ Branch 0 taken 243 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 234 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
243 | !isRGBA32(dstFormat)) |
| 2025 | 9 | srcPtr += ALT32_CORR; | |
| 2026 | |||
| 2027 |
4/6✓ Branch 0 taken 18557 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 18548 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
18557 | if ((dstFormat == AV_PIX_FMT_RGB32_1 || dstFormat == AV_PIX_FMT_BGR32_1) && |
| 2028 |
3/6✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | !isRGBA32(srcFormat)) { |
| 2029 | int i; | ||
| 2030 | av_assert0(ALT32_CORR == 1); | ||
| 2031 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 9 times.
|
265 | for (i = 0; i < srcSliceH; i++) |
| 2032 | 256 | dstPtr[dstStride[0] * (srcSliceY + i)] = 255; | |
| 2033 | 9 | dstPtr += ALT32_CORR; | |
| 2034 | } | ||
| 2035 | |||
| 2036 |
3/4✓ Branch 0 taken 13728 times.
✓ Branch 1 taken 4829 times.
✓ Branch 2 taken 13728 times.
✗ Branch 3 not taken.
|
18557 | if (dstStride[0] * srcBpp == srcStride[0] * dstBpp && srcStride[0] > 0 && |
| 2037 |
3/6✓ Branch 0 taken 13728 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13728 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13728 times.
✗ Branch 5 not taken.
|
13728 | !(srcStride[0] % srcBpp) && !dst_bswap && !src_bswap) |
| 2038 | 13728 | conv(srcPtr, dstPtr + dstStride[0] * srcSliceY, | |
| 2039 | 13728 | (srcSliceH - 1) * srcStride[0] + c->opts.src_w * srcBpp); | |
| 2040 | else { | ||
| 2041 | int i, j; | ||
| 2042 | 4829 | dstPtr += dstStride[0] * srcSliceY; | |
| 2043 | |||
| 2044 |
2/2✓ Branch 0 taken 183137 times.
✓ Branch 1 taken 4829 times.
|
187966 | for (i = 0; i < srcSliceH; i++) { |
| 2045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 183137 times.
|
183137 | if(src_bswap) { |
| 2046 | ✗ | for(j=0; j<c->opts.src_w; j++) | |
| 2047 | ✗ | ((uint16_t*)c->formatConvBuffer)[j] = av_bswap16(((uint16_t*)srcPtr)[j]); | |
| 2048 | ✗ | conv(c->formatConvBuffer, dstPtr, c->opts.src_w * srcBpp); | |
| 2049 | }else | ||
| 2050 | 183137 | conv(srcPtr, dstPtr, c->opts.src_w * srcBpp); | |
| 2051 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 183137 times.
|
183137 | if(dst_bswap) |
| 2052 | ✗ | for(j=0; j<c->opts.src_w; j++) | |
| 2053 | ✗ | ((uint16_t*)dstPtr)[j] = av_bswap16(((uint16_t*)dstPtr)[j]); | |
| 2054 | 183137 | srcPtr += srcStride[0]; | |
| 2055 | 183137 | dstPtr += dstStride[0]; | |
| 2056 | } | ||
| 2057 | } | ||
| 2058 | } | ||
| 2059 | 18557 | return srcSliceH; | |
| 2060 | } | ||
| 2061 | |||
| 2062 | ✗ | static int bgr24ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 2063 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 2064 | uint8_t *const dst[], const int dstStride[]) | ||
| 2065 | { | ||
| 2066 | ✗ | ff_rgb24toyv12( | |
| 2067 | src[0], | ||
| 2068 | ✗ | dst[0] + srcSliceY * dstStride[0], | |
| 2069 | ✗ | dst[1] + (srcSliceY >> 1) * dstStride[1], | |
| 2070 | ✗ | dst[2] + (srcSliceY >> 1) * dstStride[2], | |
| 2071 | c->opts.src_w, srcSliceH, | ||
| 2072 | ✗ | dstStride[0], dstStride[1], srcStride[0], | |
| 2073 | ✗ | c->input_rgb2yuv_table); | |
| 2074 | ✗ | if (dst[3]) | |
| 2075 | ✗ | fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255); | |
| 2076 | ✗ | return srcSliceH; | |
| 2077 | } | ||
| 2078 | |||
| 2079 | ✗ | static int yvu9ToYv12Wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 2080 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 2081 | uint8_t *const dst[], const int dstStride[]) | ||
| 2082 | { | ||
| 2083 | ✗ | ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->opts.src_w, | |
| 2084 | dst[0], dstStride[0]); | ||
| 2085 | |||
| 2086 | ✗ | planar2x(src[1], dst[1] + dstStride[1] * (srcSliceY >> 1), c->chrSrcW, | |
| 2087 | ✗ | srcSliceH >> 2, srcStride[1], dstStride[1]); | |
| 2088 | ✗ | planar2x(src[2], dst[2] + dstStride[2] * (srcSliceY >> 1), c->chrSrcW, | |
| 2089 | ✗ | srcSliceH >> 2, srcStride[2], dstStride[2]); | |
| 2090 | ✗ | if (dst[3]) | |
| 2091 | ✗ | fillPlane(dst[3], dstStride[3], c->opts.src_w, srcSliceH, srcSliceY, 255); | |
| 2092 | ✗ | return srcSliceH; | |
| 2093 | } | ||
| 2094 | |||
| 2095 | ✗ | static int uint_y_to_float_y_wrapper(SwsInternal *c, const uint8_t *const src[], | |
| 2096 | const int srcStride[], int srcSliceY, | ||
| 2097 | int srcSliceH, uint8_t *const dst[], const int dstStride[]) | ||
| 2098 | { | ||
| 2099 | int y, x; | ||
| 2100 | ✗ | ptrdiff_t dstStrideFloat = dstStride[0] >> 2; | |
| 2101 | ✗ | const uint8_t *srcPtr = src[0]; | |
| 2102 | ✗ | float *dstPtr = (float *)(dst[0] + dstStride[0] * srcSliceY); | |
| 2103 | |||
| 2104 | ✗ | for (y = 0; y < srcSliceH; ++y){ | |
| 2105 | ✗ | for (x = 0; x < c->opts.src_w; ++x){ | |
| 2106 | ✗ | dstPtr[x] = c->uint2float_lut[srcPtr[x]]; | |
| 2107 | } | ||
| 2108 | ✗ | srcPtr += srcStride[0]; | |
| 2109 | ✗ | dstPtr += dstStrideFloat; | |
| 2110 | } | ||
| 2111 | |||
| 2112 | ✗ | return srcSliceH; | |
| 2113 | } | ||
| 2114 | |||
| 2115 | ✗ | static int float_y_to_uint_y_wrapper(SwsInternal *c, | |
| 2116 | const uint8_t *const src[], | ||
| 2117 | const int srcStride[], int srcSliceY, | ||
| 2118 | int srcSliceH, uint8_t *const dst[], | ||
| 2119 | const int dstStride[]) | ||
| 2120 | { | ||
| 2121 | int y, x; | ||
| 2122 | ✗ | ptrdiff_t srcStrideFloat = srcStride[0] >> 2; | |
| 2123 | ✗ | const float *srcPtr = (const float *)src[0]; | |
| 2124 | ✗ | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
| 2125 | |||
| 2126 | ✗ | for (y = 0; y < srcSliceH; ++y){ | |
| 2127 | ✗ | for (x = 0; x < c->opts.src_w; ++x){ | |
| 2128 | ✗ | dstPtr[x] = av_clip_uint8(lrintf(255.0f * srcPtr[x])); | |
| 2129 | } | ||
| 2130 | ✗ | srcPtr += srcStrideFloat; | |
| 2131 | ✗ | dstPtr += dstStride[0]; | |
| 2132 | } | ||
| 2133 | |||
| 2134 | ✗ | return srcSliceH; | |
| 2135 | } | ||
| 2136 | |||
| 2137 | /* unscaled copy like stuff (assumes nearly identical formats) */ | ||
| 2138 | 495 | static int packedCopyWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 2139 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 2140 | uint8_t *const dst[], const int dstStride[]) | ||
| 2141 | { | ||
| 2142 |
2/4✓ Branch 0 taken 495 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 495 times.
✗ Branch 3 not taken.
|
495 | if (dstStride[0] == srcStride[0] && srcStride[0] > 0) |
| 2143 | 495 | memcpy(dst[0] + dstStride[0] * srcSliceY, src[0], srcSliceH * dstStride[0]); | |
| 2144 | else { | ||
| 2145 | int i; | ||
| 2146 | ✗ | const uint8_t *srcPtr = src[0]; | |
| 2147 | ✗ | uint8_t *dstPtr = dst[0] + dstStride[0] * srcSliceY; | |
| 2148 | |||
| 2149 | ✗ | const int length = FFMIN(FFABS(dstStride[0]), FFABS(srcStride[0])); | |
| 2150 | ✗ | for (i = 0; i < srcSliceH; i++) { | |
| 2151 | ✗ | memcpy(dstPtr, srcPtr, length); | |
| 2152 | ✗ | srcPtr += srcStride[0]; | |
| 2153 | ✗ | dstPtr += dstStride[0]; | |
| 2154 | } | ||
| 2155 | } | ||
| 2156 | 495 | return srcSliceH; | |
| 2157 | } | ||
| 2158 | |||
| 2159 | #define DITHER_COPY(dst, dstStride, src, srcStride, bswap, dbswap)\ | ||
| 2160 | unsigned shift= src_depth-dst_depth, tmp;\ | ||
| 2161 | unsigned bias = 1 << (shift - 1);\ | ||
| 2162 | if (c->opts.dither == SWS_DITHER_NONE) {\ | ||
| 2163 | for (i = 0; i < height; i++) {\ | ||
| 2164 | for (j = 0; j < length-7; j+=8) {\ | ||
| 2165 | tmp = ((bswap(src[j+0]) >> src_shift) + bias)>>shift; dst[j+0] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2166 | tmp = ((bswap(src[j+1]) >> src_shift) + bias)>>shift; dst[j+1] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2167 | tmp = ((bswap(src[j+2]) >> src_shift) + bias)>>shift; dst[j+2] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2168 | tmp = ((bswap(src[j+3]) >> src_shift) + bias)>>shift; dst[j+3] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2169 | tmp = ((bswap(src[j+4]) >> src_shift) + bias)>>shift; dst[j+4] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2170 | tmp = ((bswap(src[j+5]) >> src_shift) + bias)>>shift; dst[j+5] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2171 | tmp = ((bswap(src[j+6]) >> src_shift) + bias)>>shift; dst[j+6] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2172 | tmp = ((bswap(src[j+7]) >> src_shift) + bias)>>shift; dst[j+7] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2173 | }\ | ||
| 2174 | for (; j < length; j++) {\ | ||
| 2175 | tmp = (bswap(src[j]) + bias)>>shift; dst[j] = dbswap(tmp - (tmp>>dst_depth) << dst_shift);\ | ||
| 2176 | }\ | ||
| 2177 | dst += dstStride;\ | ||
| 2178 | src += srcStride;\ | ||
| 2179 | }\ | ||
| 2180 | } else if (shiftonly) {\ | ||
| 2181 | for (i = 0; i < height; i++) {\ | ||
| 2182 | const uint8_t *dither= dithers[shift-1][i&7];\ | ||
| 2183 | for (j = 0; j < length-7; j+=8) {\ | ||
| 2184 | tmp = ((bswap(src[j+0]) >> src_shift) + dither[0])>>shift; dst[j+0] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2185 | tmp = ((bswap(src[j+1]) >> src_shift) + dither[1])>>shift; dst[j+1] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2186 | tmp = ((bswap(src[j+2]) >> src_shift) + dither[2])>>shift; dst[j+2] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2187 | tmp = ((bswap(src[j+3]) >> src_shift) + dither[3])>>shift; dst[j+3] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2188 | tmp = ((bswap(src[j+4]) >> src_shift) + dither[4])>>shift; dst[j+4] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2189 | tmp = ((bswap(src[j+5]) >> src_shift) + dither[5])>>shift; dst[j+5] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2190 | tmp = ((bswap(src[j+6]) >> src_shift) + dither[6])>>shift; dst[j+6] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2191 | tmp = ((bswap(src[j+7]) >> src_shift) + dither[7])>>shift; dst[j+7] = dbswap((tmp - (tmp>>dst_depth)) << dst_shift);\ | ||
| 2192 | }\ | ||
| 2193 | for (; j < length; j++) {\ | ||
| 2194 | tmp = (bswap(src[j]) + dither[j&7])>>shift; dst[j] = dbswap(tmp - (tmp>>dst_depth) << dst_shift);\ | ||
| 2195 | }\ | ||
| 2196 | dst += dstStride;\ | ||
| 2197 | src += srcStride;\ | ||
| 2198 | }\ | ||
| 2199 | } else {\ | ||
| 2200 | for (i = 0; i < height; i++) {\ | ||
| 2201 | const uint8_t *dither= dithers[shift-1][i&7];\ | ||
| 2202 | for (j = 0; j < length-7; j+=8) {\ | ||
| 2203 | tmp = bswap(src[j+0]) >> src_shift; dst[j+0] = dbswap(((tmp - (tmp>>dst_depth) + dither[0])>>shift) << dst_shift);\ | ||
| 2204 | tmp = bswap(src[j+1]) >> src_shift; dst[j+1] = dbswap(((tmp - (tmp>>dst_depth) + dither[1])>>shift) << dst_shift);\ | ||
| 2205 | tmp = bswap(src[j+2]) >> src_shift; dst[j+2] = dbswap(((tmp - (tmp>>dst_depth) + dither[2])>>shift) << dst_shift);\ | ||
| 2206 | tmp = bswap(src[j+3]) >> src_shift; dst[j+3] = dbswap(((tmp - (tmp>>dst_depth) + dither[3])>>shift) << dst_shift);\ | ||
| 2207 | tmp = bswap(src[j+4]) >> src_shift; dst[j+4] = dbswap(((tmp - (tmp>>dst_depth) + dither[4])>>shift) << dst_shift);\ | ||
| 2208 | tmp = bswap(src[j+5]) >> src_shift; dst[j+5] = dbswap(((tmp - (tmp>>dst_depth) + dither[5])>>shift) << dst_shift);\ | ||
| 2209 | tmp = bswap(src[j+6]) >> src_shift; dst[j+6] = dbswap(((tmp - (tmp>>dst_depth) + dither[6])>>shift) << dst_shift);\ | ||
| 2210 | tmp = bswap(src[j+7]) >> src_shift; dst[j+7] = dbswap(((tmp - (tmp>>dst_depth) + dither[7])>>shift) << dst_shift);\ | ||
| 2211 | }\ | ||
| 2212 | for (; j < length; j++) {\ | ||
| 2213 | tmp = bswap(src[j]); dst[j] = dbswap((tmp - (tmp>>dst_depth) + dither[j&7])>>shift);\ | ||
| 2214 | }\ | ||
| 2215 | dst += dstStride;\ | ||
| 2216 | src += srcStride;\ | ||
| 2217 | }\ | ||
| 2218 | } | ||
| 2219 | |||
| 2220 | 31417 | static int planarCopyWrapper(SwsInternal *c, const uint8_t *const src[], | |
| 2221 | const int srcStride[], int srcSliceY, int srcSliceH, | ||
| 2222 | uint8_t *const dst[], const int dstStride[]) | ||
| 2223 | { | ||
| 2224 | 31417 | const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->opts.src_format); | |
| 2225 | 31417 | const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->opts.dst_format); | |
| 2226 | int plane, i, j; | ||
| 2227 |
4/4✓ Branch 0 taken 115738 times.
✓ Branch 1 taken 3810 times.
✓ Branch 2 taken 88131 times.
✓ Branch 3 taken 27607 times.
|
119548 | for (plane = 0; plane < 4 && dst[plane] != NULL; plane++) { |
| 2228 |
4/4✓ Branch 0 taken 56714 times.
✓ Branch 1 taken 31417 times.
✓ Branch 2 taken 3810 times.
✓ Branch 3 taken 52904 times.
|
88131 | int length = (plane == 0 || plane == 3) ? c->opts.src_w : AV_CEIL_RSHIFT(c->opts.src_w, c->chrDstHSubSample); |
| 2229 |
4/4✓ Branch 0 taken 56714 times.
✓ Branch 1 taken 31417 times.
✓ Branch 2 taken 52904 times.
✓ Branch 3 taken 3810 times.
|
88131 | int y = (plane == 0 || plane == 3) ? srcSliceY: AV_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample); |
| 2230 |
4/4✓ Branch 0 taken 56714 times.
✓ Branch 1 taken 31417 times.
✓ Branch 2 taken 52904 times.
✓ Branch 3 taken 3810 times.
|
88131 | int height = (plane == 0 || plane == 3) ? srcSliceH: AV_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample); |
| 2231 | 88131 | const uint8_t *srcPtr = src[plane]; | |
| 2232 | 88131 | uint8_t *dstPtr = dst[plane] + dstStride[plane] * y; | |
| 2233 |
8/8✓ Branch 0 taken 56765 times.
✓ Branch 1 taken 31366 times.
✓ Branch 2 taken 35227 times.
✓ Branch 3 taken 21538 times.
✓ Branch 4 taken 35149 times.
✓ Branch 5 taken 78 times.
✓ Branch 6 taken 31339 times.
✓ Branch 7 taken 3810 times.
|
88131 | int shiftonly = plane == 1 || plane == 2 || (!c->opts.src_range && plane == 0); |
| 2234 |
4/4✓ Branch 0 taken 31366 times.
✓ Branch 1 taken 56765 times.
✓ Branch 3 taken 9828 times.
✓ Branch 4 taken 21538 times.
|
88131 | if (plane == 1 && isSemiPlanarYUV(c->opts.dst_format)) |
| 2235 | 9828 | length *= 2; | |
| 2236 | |||
| 2237 | // ignore palette for GRAY8 | ||
| 2238 |
3/4✓ Branch 0 taken 31366 times.
✓ Branch 1 taken 56765 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 31366 times.
|
88131 | if (plane == 1 && desc_dst->nb_components < 3) continue; |
| 2239 |
9/10✓ Branch 0 taken 85402 times.
✓ Branch 1 taken 2729 times.
✓ Branch 2 taken 31366 times.
✓ Branch 3 taken 54036 times.
✓ Branch 4 taken 31366 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1081 times.
✓ Branch 7 taken 84321 times.
✓ Branch 8 taken 9 times.
✓ Branch 9 taken 1072 times.
|
88131 | if (!src[plane] || (plane == 1 && desc_src->nb_components < 3) || (plane == 3 && desc_src->nb_components <= 3)) { |
| 2240 |
4/4✓ Branch 1 taken 2668 times.
✓ Branch 2 taken 70 times.
✓ Branch 4 taken 188 times.
✓ Branch 5 taken 2480 times.
|
5476 | if (is16BPS(c->opts.dst_format) || isNBPS(c->opts.dst_format)) { |
| 2241 | 516 | fillPlane16(dst[plane], dstStride[plane], length, height, y, | |
| 2242 | 258 | plane == 3, desc_dst->comp[plane].depth, | |
| 2243 | 258 | isBE(c->opts.dst_format)); | |
| 2244 | } else { | ||
| 2245 |
1/2✓ Branch 0 taken 2480 times.
✗ Branch 1 not taken.
|
2480 | fillPlane(dst[plane], dstStride[plane], length, height, y, |
| 2246 | (plane == 3) ? 255 : 128); | ||
| 2247 | } | ||
| 2248 | } else { | ||
| 2249 |
4/4✓ Branch 1 taken 33706 times.
✓ Branch 2 taken 51687 times.
✓ Branch 4 taken 14623 times.
✓ Branch 5 taken 19083 times.
|
85393 | if(isNBPS(c->opts.src_format) || isNBPS(c->opts.dst_format) |
| 2250 |
2/2✓ Branch 2 taken 7813 times.
✓ Branch 3 taken 6810 times.
|
14623 | || (is16BPS(c->opts.src_format) != is16BPS(c->opts.dst_format)) |
| 2251 | 78583 | ) { | |
| 2252 | 78583 | const int src_depth = desc_src->comp[plane].depth; | |
| 2253 | 78583 | const int dst_depth = desc_dst->comp[plane].depth; | |
| 2254 | 78583 | const int src_shift = desc_src->comp[plane].shift; | |
| 2255 | 78583 | const int dst_shift = desc_dst->comp[plane].shift; | |
| 2256 | 78583 | const uint16_t *srcPtr2 = (const uint16_t *) srcPtr; | |
| 2257 | 78583 | uint16_t *dstPtr2 = (uint16_t*)dstPtr; | |
| 2258 | |||
| 2259 |
2/2✓ Branch 0 taken 23436 times.
✓ Branch 1 taken 55147 times.
|
78583 | if (dst_depth == 8) { |
| 2260 | av_assert1(src_depth > 8); | ||
| 2261 |
2/2✓ Branch 1 taken 13638 times.
✓ Branch 2 taken 9798 times.
|
23436 | if(isBE(c->opts.src_format) == HAVE_BIGENDIAN){ |
| 2262 |
20/22✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 11298 times.
✓ Branch 2 taken 3953664 times.
✓ Branch 3 taken 74880 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 74880 times.
✓ Branch 6 taken 74880 times.
✓ Branch 7 taken 2340 times.
✓ Branch 8 taken 10770 times.
✓ Branch 9 taken 528 times.
✓ Branch 10 taken 22693080 times.
✓ Branch 11 taken 819304 times.
✓ Branch 12 taken 5100 times.
✓ Branch 13 taken 819304 times.
✓ Branch 14 taken 819304 times.
✓ Branch 15 taken 10770 times.
✓ Branch 16 taken 608256 times.
✓ Branch 17 taken 50688 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 50688 times.
✓ Branch 20 taken 50688 times.
✓ Branch 21 taken 528 times.
|
28218610 | DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, , ) |
| 2263 | } else { | ||
| 2264 |
13/22✗ Branch 0 not taken.
✓ Branch 1 taken 9798 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 9270 times.
✓ Branch 9 taken 528 times.
✓ Branch 10 taken 12925440 times.
✓ Branch 11 taken 575424 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 575424 times.
✓ Branch 14 taken 575424 times.
✓ Branch 15 taken 9270 times.
✓ Branch 16 taken 608256 times.
✓ Branch 17 taken 50688 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 50688 times.
✓ Branch 20 taken 50688 times.
✓ Branch 21 taken 528 times.
|
14169606 | DITHER_COPY(dstPtr, dstStride[plane], srcPtr2, srcStride[plane]/2, av_bswap16, ) |
| 2265 | } | ||
| 2266 |
2/2✓ Branch 0 taken 18028 times.
✓ Branch 1 taken 37119 times.
|
55147 | } else if (src_depth == 8) { |
| 2267 |
2/2✓ Branch 0 taken 978544 times.
✓ Branch 1 taken 18028 times.
|
996572 | for (i = 0; i < height; i++) { |
| 2268 | #define COPY816(w)\ | ||
| 2269 | if (shiftonly) {\ | ||
| 2270 | for (j = 0; j < length; j++)\ | ||
| 2271 | w(&dstPtr2[j], (srcPtr[j]<<(dst_depth-8)) << dst_shift);\ | ||
| 2272 | } else {\ | ||
| 2273 | for (j = 0; j < length; j++)\ | ||
| 2274 | w(&dstPtr2[j], ((srcPtr[j]<<(dst_depth-8)) |\ | ||
| 2275 | (srcPtr[j]>>(2*8-dst_depth))) << dst_shift);\ | ||
| 2276 | } | ||
| 2277 |
2/2✓ Branch 1 taken 311808 times.
✓ Branch 2 taken 666736 times.
|
978544 | if(isBE(c->opts.dst_format)){ |
| 2278 |
6/6✓ Branch 0 taken 311040 times.
✓ Branch 1 taken 768 times.
✓ Branch 2 taken 102795264 times.
✓ Branch 3 taken 311040 times.
✓ Branch 4 taken 73728 times.
✓ Branch 5 taken 768 times.
|
103180800 | COPY816(AV_WB16) |
| 2279 | } else { | ||
| 2280 |
6/6✓ Branch 0 taken 665968 times.
✓ Branch 1 taken 768 times.
✓ Branch 2 taken 239140524 times.
✓ Branch 3 taken 665968 times.
✓ Branch 4 taken 73728 times.
✓ Branch 5 taken 768 times.
|
239880988 | COPY816(AV_WL16) |
| 2281 | } | ||
| 2282 | 978544 | dstPtr2 += dstStride[plane]/2; | |
| 2283 | 978544 | srcPtr += srcStride[plane]; | |
| 2284 | } | ||
| 2285 |
2/2✓ Branch 0 taken 24951 times.
✓ Branch 1 taken 12168 times.
|
37119 | } else if (src_depth <= dst_depth) { |
| 2286 | 24951 | unsigned shift = dst_depth - src_depth; | |
| 2287 |
2/2✓ Branch 0 taken 797488 times.
✓ Branch 1 taken 24951 times.
|
822439 | for (i = 0; i < height; i++) { |
| 2288 | 797488 | j = 0; | |
| 2289 |
4/4✓ Branch 1 taken 617776 times.
✓ Branch 2 taken 179712 times.
✓ Branch 3 taken 361024 times.
✓ Branch 4 taken 256752 times.
|
1415264 | if(isBE(c->opts.src_format) == HAVE_BIGENDIAN && |
| 2290 |
1/2✓ Branch 1 taken 361024 times.
✗ Branch 2 not taken.
|
978800 | isBE(c->opts.dst_format) == HAVE_BIGENDIAN && |
| 2291 | shiftonly) { | ||
| 2292 | #if HAVE_FAST_64BIT | ||
| 2293 |
2/2✓ Branch 0 taken 35617536 times.
✓ Branch 1 taken 361024 times.
|
35978560 | for (; j < length - 3; j += 4) { |
| 2294 | 35617536 | uint64_t v = AV_RN64A(srcPtr2 + j) >> src_shift; | |
| 2295 | 35617536 | AV_WN64A(dstPtr2 + j, (v << shift) << dst_shift); | |
| 2296 | } | ||
| 2297 | #else | ||
| 2298 | for (; j < length - 1; j += 2) { | ||
| 2299 | uint32_t v = AV_RN32A(srcPtr2 + j) >> src_shift; | ||
| 2300 | AV_WN32A(dstPtr2 + j, (v << shift) << dst_shift); | ||
| 2301 | } | ||
| 2302 | #endif | ||
| 2303 | } | ||
| 2304 | #define COPY_UP(r,w) \ | ||
| 2305 | if(shiftonly){\ | ||
| 2306 | for (; j < length; j++){ \ | ||
| 2307 | unsigned int v= r(&srcPtr2[j]) >> src_shift;\ | ||
| 2308 | w(&dstPtr2[j], (v << shift) << dst_shift);\ | ||
| 2309 | }\ | ||
| 2310 | }else{\ | ||
| 2311 | for (; j < length; j++){ \ | ||
| 2312 | unsigned int v= r(&srcPtr2[j]) >> src_shift;\ | ||
| 2313 | w(&dstPtr2[j], ((v << shift) | (v>>(2*src_depth-dst_depth))) << dst_shift);\ | ||
| 2314 | }\ | ||
| 2315 | } | ||
| 2316 |
2/2✓ Branch 1 taken 179712 times.
✓ Branch 2 taken 617776 times.
|
797488 | if(isBE(c->opts.src_format)){ |
| 2317 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 179712 times.
|
179712 | if(isBE(c->opts.dst_format)){ |
| 2318 | ✗ | COPY_UP(AV_RB16, AV_WB16) | |
| 2319 | } else { | ||
| 2320 |
3/6✓ Branch 0 taken 179712 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 71165952 times.
✓ Branch 3 taken 179712 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
71345664 | COPY_UP(AV_RB16, AV_WL16) |
| 2321 | } | ||
| 2322 | } else { | ||
| 2323 |
2/2✓ Branch 1 taken 256752 times.
✓ Branch 2 taken 361024 times.
|
617776 | if(isBE(c->opts.dst_format)){ |
| 2324 |
3/6✓ Branch 0 taken 256752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104638464 times.
✓ Branch 3 taken 256752 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
104895216 | COPY_UP(AV_RL16, AV_WB16) |
| 2325 | } else { | ||
| 2326 |
2/6✓ Branch 0 taken 361024 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 361024 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
361024 | COPY_UP(AV_RL16, AV_WL16) |
| 2327 | } | ||
| 2328 | } | ||
| 2329 | 797488 | dstPtr2 += dstStride[plane]/2; | |
| 2330 | 797488 | srcPtr2 += srcStride[plane]/2; | |
| 2331 | } | ||
| 2332 | } else { /* src_depth > dst_depth */ | ||
| 2333 |
2/2✓ Branch 1 taken 7956 times.
✓ Branch 2 taken 4212 times.
|
12168 | if(isBE(c->opts.src_format) == HAVE_BIGENDIAN){ |
| 2334 |
2/2✓ Branch 1 taken 6084 times.
✓ Branch 2 taken 1872 times.
|
7956 | if(isBE(c->opts.dst_format) == HAVE_BIGENDIAN){ |
| 2335 |
13/22✓ Branch 0 taken 1872 times.
✓ Branch 1 taken 4212 times.
✓ Branch 2 taken 2965248 times.
✓ Branch 3 taken 59904 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 59904 times.
✓ Branch 6 taken 59904 times.
✓ Branch 7 taken 1872 times.
✓ Branch 8 taken 4212 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6918912 times.
✓ Branch 11 taken 134784 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 134784 times.
✓ Branch 14 taken 134784 times.
✓ Branch 15 taken 4212 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
10084932 | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , ) |
| 2336 | } else { | ||
| 2337 |
6/22✓ Branch 0 taken 1872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2965248 times.
✓ Branch 3 taken 59904 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 59904 times.
✓ Branch 6 taken 59904 times.
✓ Branch 7 taken 1872 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
3027024 | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, , av_bswap16) |
| 2338 | } | ||
| 2339 | }else{ | ||
| 2340 |
1/2✓ Branch 1 taken 4212 times.
✗ Branch 2 not taken.
|
4212 | if(isBE(c->opts.dst_format) == HAVE_BIGENDIAN){ |
| 2341 |
7/22✗ Branch 0 not taken.
✓ Branch 1 taken 4212 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 4212 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6918912 times.
✓ Branch 11 taken 134784 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 134784 times.
✓ Branch 14 taken 134784 times.
✓ Branch 15 taken 4212 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
7057908 | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, ) |
| 2342 | } else { | ||
| 2343 | ✗ | DITHER_COPY(dstPtr2, dstStride[plane]/2, srcPtr2, srcStride[plane]/2, av_bswap16, av_bswap16) | |
| 2344 | } | ||
| 2345 | } | ||
| 2346 | } | ||
| 2347 |
5/6✓ Branch 1 taken 3602 times.
✓ Branch 2 taken 3208 times.
✓ Branch 4 taken 3602 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2432 times.
✓ Branch 7 taken 1170 times.
|
12844 | } else if (is16BPS(c->opts.src_format) && is16BPS(c->opts.dst_format) && |
| 2348 | 3602 | isBE(c->opts.src_format) != isBE(c->opts.dst_format)) { | |
| 2349 | |||
| 2350 |
2/2✓ Branch 0 taken 90792 times.
✓ Branch 1 taken 2432 times.
|
93224 | for (i = 0; i < height; i++) { |
| 2351 |
2/2✓ Branch 0 taken 40458240 times.
✓ Branch 1 taken 90792 times.
|
40549032 | for (j = 0; j < length; j++) |
| 2352 | 40458240 | ((uint16_t *) dstPtr)[j] = av_bswap16(((const uint16_t *) srcPtr)[j]); | |
| 2353 | 90792 | srcPtr += srcStride[plane]; | |
| 2354 | 90792 | dstPtr += dstStride[plane]; | |
| 2355 | } | ||
| 2356 |
4/6✓ Branch 1 taken 13 times.
✓ Branch 2 taken 4365 times.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13 times.
✗ Branch 7 not taken.
|
4404 | } else if (isFloat(c->opts.src_format) && isFloat(c->opts.dst_format) && |
| 2357 | 13 | isBE(c->opts.src_format) != isBE(c->opts.dst_format)) { /* swap float plane */ | |
| 2358 |
2/2✓ Branch 0 taken 3744 times.
✓ Branch 1 taken 13 times.
|
3757 | for (i = 0; i < height; i++) { |
| 2359 |
2/2✓ Branch 0 taken 1317888 times.
✓ Branch 1 taken 3744 times.
|
1321632 | for (j = 0; j < length; j++) |
| 2360 | 1317888 | ((uint32_t *) dstPtr)[j] = av_bswap32(((const uint32_t *) srcPtr)[j]); | |
| 2361 | 3744 | srcPtr += srcStride[plane]; | |
| 2362 | 3744 | dstPtr += dstStride[plane]; | |
| 2363 | } | ||
| 2364 |
2/2✓ Branch 0 taken 2754 times.
✓ Branch 1 taken 1611 times.
|
4365 | } else if (dstStride[plane] == srcStride[plane] && |
| 2365 |
3/4✓ Branch 0 taken 2754 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1584 times.
✓ Branch 3 taken 1170 times.
|
2754 | srcStride[plane] > 0 && srcStride[plane] == length) { |
| 2366 | 1584 | memcpy(dst[plane] + dstStride[plane] * y, src[plane], | |
| 2367 | 1584 | height * dstStride[plane]); | |
| 2368 | } else { | ||
| 2369 |
3/4✓ Branch 1 taken 1170 times.
✓ Branch 2 taken 1611 times.
✓ Branch 4 taken 1170 times.
✗ Branch 5 not taken.
|
2781 | if (is16BPS(c->opts.src_format) && is16BPS(c->opts.dst_format)) |
| 2370 | 1170 | length *= 2; | |
| 2371 |
1/4✗ Branch 1 not taken.
✓ Branch 2 taken 1611 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1611 | else if (isFloat(c->opts.src_format) && isFloat(c->opts.dst_format)) |
| 2372 | ✗ | length *= 4; | |
| 2373 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1611 times.
|
1611 | else if (desc_src->comp[0].depth == 1) |
| 2374 | ✗ | length >>= 3; // monowhite/black | |
| 2375 |
2/2✓ Branch 0 taken 98400 times.
✓ Branch 1 taken 2781 times.
|
101181 | for (i = 0; i < height; i++) { |
| 2376 | 98400 | memcpy(dstPtr, srcPtr, length); | |
| 2377 | 98400 | srcPtr += srcStride[plane]; | |
| 2378 | 98400 | dstPtr += dstStride[plane]; | |
| 2379 | } | ||
| 2380 | } | ||
| 2381 | } | ||
| 2382 | } | ||
| 2383 | 31417 | return srcSliceH; | |
| 2384 | } | ||
| 2385 | |||
| 2386 | |||
| 2387 | #define IS_DIFFERENT_ENDIANESS(src_fmt, dst_fmt, pix_fmt) \ | ||
| 2388 | ((src_fmt == pix_fmt ## BE && dst_fmt == pix_fmt ## LE) || \ | ||
| 2389 | (src_fmt == pix_fmt ## LE && dst_fmt == pix_fmt ## BE)) | ||
| 2390 | |||
| 2391 | |||
| 2392 | 45447 | void ff_get_unscaled_swscale(SwsInternal *c) | |
| 2393 | { | ||
| 2394 | 45447 | const enum AVPixelFormat srcFormat = c->opts.src_format; | |
| 2395 | 45447 | const enum AVPixelFormat dstFormat = c->opts.dst_format; | |
| 2396 | 45447 | const int flags = c->opts.flags; | |
| 2397 | 45447 | const int dstH = c->opts.dst_h; | |
| 2398 | 45447 | const int dstW = c->opts.dst_w; | |
| 2399 | int needsDither; | ||
| 2400 | |||
| 2401 | 45447 | needsDither = isAnyRGB(dstFormat) && | |
| 2402 |
4/4✓ Branch 0 taken 16146 times.
✓ Branch 1 taken 29301 times.
✓ Branch 2 taken 3753 times.
✓ Branch 3 taken 12393 times.
|
49200 | c->dstFormatBpp < 24 && |
| 2403 |
3/4✓ Branch 0 taken 2247 times.
✓ Branch 1 taken 1506 times.
✓ Branch 3 taken 2247 times.
✗ Branch 4 not taken.
|
3753 | (c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat))); |
| 2404 | |||
| 2405 | /* yv12_to_nv12 */ | ||
| 2406 |
6/6✓ Branch 0 taken 39247 times.
✓ Branch 1 taken 6200 times.
✓ Branch 2 taken 840 times.
✓ Branch 3 taken 38407 times.
✓ Branch 4 taken 6979 times.
✓ Branch 5 taken 61 times.
|
45447 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) && |
| 2407 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 6957 times.
|
6979 | (dstFormat == AV_PIX_FMT_NV12 || dstFormat == AV_PIX_FMT_NV21)) { |
| 2408 | 83 | c->convert_unscaled = planarToNv12Wrapper; | |
| 2409 | } | ||
| 2410 | /* yv24_to_nv24 */ | ||
| 2411 |
6/6✓ Branch 0 taken 44242 times.
✓ Branch 1 taken 1205 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 44042 times.
✓ Branch 4 taken 1385 times.
✓ Branch 5 taken 20 times.
|
45447 | if ((srcFormat == AV_PIX_FMT_YUV444P || srcFormat == AV_PIX_FMT_YUVA444P) && |
| 2412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1385 times.
|
1385 | (dstFormat == AV_PIX_FMT_NV24 || dstFormat == AV_PIX_FMT_NV42)) { |
| 2413 | 20 | c->convert_unscaled = planarToNv24Wrapper; | |
| 2414 | } | ||
| 2415 | /* nv12_to_yv12 */ | ||
| 2416 |
4/4✓ Branch 0 taken 756 times.
✓ Branch 1 taken 44691 times.
✓ Branch 2 taken 746 times.
✓ Branch 3 taken 10 times.
|
45447 | if (dstFormat == AV_PIX_FMT_YUV420P && |
| 2417 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 736 times.
|
746 | (srcFormat == AV_PIX_FMT_NV12 || srcFormat == AV_PIX_FMT_NV21)) { |
| 2418 | 20 | c->convert_unscaled = nv12ToPlanarWrapper; | |
| 2419 | } | ||
| 2420 | /* nv24_to_yv24 */ | ||
| 2421 |
4/4✓ Branch 0 taken 1062 times.
✓ Branch 1 taken 44385 times.
✓ Branch 2 taken 1041 times.
✓ Branch 3 taken 21 times.
|
45447 | if (dstFormat == AV_PIX_FMT_YUV444P && |
| 2422 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1041 times.
|
1041 | (srcFormat == AV_PIX_FMT_NV24 || srcFormat == AV_PIX_FMT_NV42)) { |
| 2423 | 21 | c->convert_unscaled = nv24ToPlanarWrapper; | |
| 2424 | } | ||
| 2425 | /* yuv2bgr */ | ||
| 2426 |
6/6✓ Branch 0 taken 39247 times.
✓ Branch 1 taken 6200 times.
✓ Branch 2 taken 38222 times.
✓ Branch 3 taken 1025 times.
✓ Branch 4 taken 840 times.
✓ Branch 5 taken 37382 times.
|
45447 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P || |
| 2427 |
2/2✓ Branch 1 taken 5484 times.
✓ Branch 2 taken 2581 times.
|
8065 | srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) && |
| 2428 |
5/8✓ Branch 0 taken 2520 times.
✓ Branch 1 taken 2964 times.
✓ Branch 2 taken 2520 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2520 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2520 times.
✗ Branch 7 not taken.
|
5484 | !(flags & SWS_ACCURATE_RND) && (c->opts.dither == SWS_DITHER_BAYER || c->opts.dither == SWS_DITHER_AUTO) && !(dstH & 1)) { |
| 2429 | 2520 | c->convert_unscaled = ff_yuv2rgb_get_func_ptr(c); | |
| 2430 | 2520 | c->dst_slice_align = 2; | |
| 2431 | } | ||
| 2432 | /* yuv420p1x_to_p01x */ | ||
| 2433 |
5/6✓ Branch 0 taken 45278 times.
✓ Branch 1 taken 169 times.
✓ Branch 2 taken 45278 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 45161 times.
✓ Branch 5 taken 117 times.
|
45447 | if ((srcFormat == AV_PIX_FMT_YUV420P10 || srcFormat == AV_PIX_FMT_YUVA420P10 || |
| 2434 |
1/2✓ Branch 0 taken 45161 times.
✗ Branch 1 not taken.
|
45161 | srcFormat == AV_PIX_FMT_YUV420P12 || |
| 2435 |
2/2✓ Branch 0 taken 45021 times.
✓ Branch 1 taken 140 times.
|
45161 | srcFormat == AV_PIX_FMT_YUV420P14 || |
| 2436 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 45021 times.
✓ Branch 2 taken 426 times.
✗ Branch 3 not taken.
|
45447 | srcFormat == AV_PIX_FMT_YUV420P16 || srcFormat == AV_PIX_FMT_YUVA420P16) && |
| 2437 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 426 times.
|
426 | (dstFormat == AV_PIX_FMT_P010 || dstFormat == AV_PIX_FMT_P016)) { |
| 2438 | ✗ | c->convert_unscaled = planarToP01xWrapper; | |
| 2439 | } | ||
| 2440 | /* yuv420p_to_p01xle */ | ||
| 2441 |
6/6✓ Branch 0 taken 39247 times.
✓ Branch 1 taken 6200 times.
✓ Branch 2 taken 840 times.
✓ Branch 3 taken 38407 times.
✓ Branch 4 taken 7028 times.
✓ Branch 5 taken 12 times.
|
45447 | if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) && |
| 2442 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 7016 times.
|
7028 | (dstFormat == AV_PIX_FMT_P010LE || dstFormat == AV_PIX_FMT_P016LE)) { |
| 2443 | 24 | c->convert_unscaled = planar8ToP01xleWrapper; | |
| 2444 | } | ||
| 2445 | |||
| 2446 |
6/6✓ Branch 0 taken 115 times.
✓ Branch 1 taken 45332 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 111 times.
✓ Branch 5 taken 3 times.
|
45447 | if (srcFormat == AV_PIX_FMT_YUV410P && !(dstH & 3) && |
| 2447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
|
111 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && |
| 2448 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | !(flags & SWS_BITEXACT)) { |
| 2449 | ✗ | c->convert_unscaled = yvu9ToYv12Wrapper; | |
| 2450 | ✗ | c->dst_slice_align = 4; | |
| 2451 | } | ||
| 2452 | |||
| 2453 | /* bgr24toYV12 */ | ||
| 2454 |
4/4✓ Branch 0 taken 293 times.
✓ Branch 1 taken 45154 times.
✓ Branch 2 taken 273 times.
✓ Branch 3 taken 20 times.
|
45447 | if (srcFormat == AV_PIX_FMT_BGR24 && |
| 2455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 273 times.
|
273 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P) && |
| 2456 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
20 | !(flags & SWS_ACCURATE_RND) && !(dstW&1)) |
| 2457 | ✗ | c->convert_unscaled = bgr24ToYv12Wrapper; | |
| 2458 | |||
| 2459 | /* AYUV/VUYA/UYVA -> AYUV/VUYA/UYVA */ | ||
| 2460 |
12/18✓ Branch 0 taken 45315 times.
✓ Branch 1 taken 132 times.
✓ Branch 2 taken 45183 times.
✓ Branch 3 taken 132 times.
✓ Branch 4 taken 44940 times.
✓ Branch 5 taken 243 times.
✓ Branch 6 taken 136 times.
✓ Branch 7 taken 44804 times.
✓ Branch 8 taken 643 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 643 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 643 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 643 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
45447 | if (isAYUV(srcFormat) && isAYUV(dstFormat) && findRgbConvFn(c)) |
| 2461 | ✗ | c->convert_unscaled = rgbToRgbWrapper; | |
| 2462 | |||
| 2463 | /* RGB/BGR -> RGB/BGR (no dither needed forms) */ | ||
| 2464 |
6/6✓ Branch 1 taken 15966 times.
✓ Branch 2 taken 29481 times.
✓ Branch 4 taken 2945 times.
✓ Branch 5 taken 13021 times.
✓ Branch 7 taken 583 times.
✓ Branch 8 taken 2362 times.
|
45447 | if (isAnyRGB(srcFormat) && isAnyRGB(dstFormat) && findRgbConvFn(c) |
| 2465 |
3/4✓ Branch 0 taken 20 times.
✓ Branch 1 taken 563 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20 times.
|
583 | && (!needsDither || (c->opts.flags&(SWS_FAST_BILINEAR|SWS_POINT)))) |
| 2466 | 563 | c->convert_unscaled = rgbToRgbWrapper; | |
| 2467 | |||
| 2468 | /* RGB to planar RGB */ | ||
| 2469 |
5/6✓ Branch 0 taken 994 times.
✓ Branch 1 taken 44453 times.
✓ Branch 2 taken 994 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1078 times.
✓ Branch 5 taken 44369 times.
|
45447 | if ((srcFormat == AV_PIX_FMT_GBRP && dstFormat == AV_PIX_FMT_GBRAP) || |
| 2470 |
3/4✓ Branch 0 taken 1078 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1063 times.
✓ Branch 3 taken 44384 times.
|
45447 | (srcFormat == AV_PIX_FMT_GBRP10 && dstFormat == AV_PIX_FMT_GBRAP10) || |
| 2471 |
3/4✓ Branch 0 taken 1063 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45314 times.
|
45447 | (srcFormat == AV_PIX_FMT_GBRP12 && dstFormat == AV_PIX_FMT_GBRAP12) || |
| 2472 |
3/4✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 439 times.
✓ Branch 3 taken 45008 times.
|
45447 | (srcFormat == AV_PIX_FMT_GBRP14 && dstFormat == AV_PIX_FMT_GBRAP14) || |
| 2473 |
3/4✓ Branch 0 taken 439 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 193 times.
✓ Branch 3 taken 45254 times.
|
45447 | (srcFormat == AV_PIX_FMT_GBRP16 && dstFormat == AV_PIX_FMT_GBRAP16) || |
| 2474 |
4/4✓ Branch 0 taken 183 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45304 times.
|
45447 | (srcFormat == AV_PIX_FMT_GBRAP && dstFormat == AV_PIX_FMT_GBRP) || |
| 2475 |
3/4✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45304 times.
|
45437 | (srcFormat == AV_PIX_FMT_GBRAP10 && dstFormat == AV_PIX_FMT_GBRP10) || |
| 2476 |
3/4✓ Branch 0 taken 133 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✓ Branch 3 taken 45305 times.
|
45437 | (srcFormat == AV_PIX_FMT_GBRAP12 && dstFormat == AV_PIX_FMT_GBRP12) || |
| 2477 |
3/4✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✓ Branch 3 taken 45302 times.
|
45437 | (srcFormat == AV_PIX_FMT_GBRAP14 && dstFormat == AV_PIX_FMT_GBRP14) || |
| 2478 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 135 times.
|
135 | (srcFormat == AV_PIX_FMT_GBRAP16 && dstFormat == AV_PIX_FMT_GBRP16)) |
| 2479 | 10 | c->convert_unscaled = planarRgbToplanarRgbWrapper; | |
| 2480 | |||
| 2481 | #define isByteRGB(f) ( \ | ||
| 2482 | f == AV_PIX_FMT_RGB32 || \ | ||
| 2483 | f == AV_PIX_FMT_RGB32_1 || \ | ||
| 2484 | f == AV_PIX_FMT_RGB24 || \ | ||
| 2485 | f == AV_PIX_FMT_BGR32 || \ | ||
| 2486 | f == AV_PIX_FMT_BGR32_1 || \ | ||
| 2487 | f == AV_PIX_FMT_BGR24) | ||
| 2488 | |||
| 2489 |
12/16✓ Branch 0 taken 994 times.
✓ Branch 1 taken 44453 times.
✓ Branch 3 taken 994 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 984 times.
✓ Branch 6 taken 10 times.
✓ Branch 7 taken 984 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 954 times.
✓ Branch 10 taken 30 times.
✓ Branch 11 taken 954 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 954 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 10 times.
✓ Branch 16 taken 944 times.
|
45447 | if (srcFormat == AV_PIX_FMT_GBRP && isPlanar(srcFormat) && isByteRGB(dstFormat)) |
| 2490 | 50 | c->convert_unscaled = planarRgbToRgbWrapper; | |
| 2491 | |||
| 2492 |
11/14✓ Branch 0 taken 193 times.
✓ Branch 1 taken 45254 times.
✓ Branch 2 taken 183 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 183 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 173 times.
✓ Branch 7 taken 10 times.
✓ Branch 8 taken 163 times.
✓ Branch 9 taken 10 times.
✓ Branch 10 taken 163 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 163 times.
|
45447 | if (srcFormat == AV_PIX_FMT_GBRAP && isByteRGB(dstFormat)) |
| 2493 | 30 | c->convert_unscaled = planarRgbaToRgbWrapper; | |
| 2494 | |||
| 2495 |
6/6✓ Branch 0 taken 44238 times.
✓ Branch 1 taken 1209 times.
✓ Branch 2 taken 44095 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 43962 times.
✓ Branch 5 taken 133 times.
|
45447 | if ((srcFormat == AV_PIX_FMT_RGB48LE || srcFormat == AV_PIX_FMT_RGB48BE || |
| 2496 |
4/4✓ Branch 0 taken 43830 times.
✓ Branch 1 taken 132 times.
✓ Branch 2 taken 43697 times.
✓ Branch 3 taken 133 times.
|
43962 | srcFormat == AV_PIX_FMT_BGR48LE || srcFormat == AV_PIX_FMT_BGR48BE || |
| 2497 |
4/4✓ Branch 0 taken 43554 times.
✓ Branch 1 taken 143 times.
✓ Branch 2 taken 43421 times.
✓ Branch 3 taken 133 times.
|
43697 | srcFormat == AV_PIX_FMT_RGBA64LE || srcFormat == AV_PIX_FMT_RGBA64BE || |
| 2498 |
3/4✓ Branch 0 taken 132 times.
✓ Branch 1 taken 43289 times.
✓ Branch 2 taken 2158 times.
✗ Branch 3 not taken.
|
45447 | srcFormat == AV_PIX_FMT_BGRA64LE || srcFormat == AV_PIX_FMT_BGRA64BE) && |
| 2499 |
3/4✓ Branch 0 taken 2158 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2128 times.
✓ Branch 3 taken 30 times.
|
2158 | (dstFormat == AV_PIX_FMT_GBRP9LE || dstFormat == AV_PIX_FMT_GBRP9BE || |
| 2500 |
4/4✓ Branch 0 taken 2118 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 2088 times.
✓ Branch 3 taken 30 times.
|
2128 | dstFormat == AV_PIX_FMT_GBRP10LE || dstFormat == AV_PIX_FMT_GBRP10BE || |
| 2501 |
3/4✓ Branch 0 taken 2078 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 2078 times.
✗ Branch 3 not taken.
|
2088 | dstFormat == AV_PIX_FMT_GBRP12LE || dstFormat == AV_PIX_FMT_GBRP12BE || |
| 2502 |
3/4✓ Branch 0 taken 2078 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2058 times.
✓ Branch 3 taken 20 times.
|
2078 | dstFormat == AV_PIX_FMT_GBRP14LE || dstFormat == AV_PIX_FMT_GBRP14BE || |
| 2503 |
3/4✓ Branch 0 taken 2047 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 2047 times.
✗ Branch 3 not taken.
|
2058 | dstFormat == AV_PIX_FMT_GBRP16LE || dstFormat == AV_PIX_FMT_GBRP16BE || |
| 2504 |
2/4✓ Branch 0 taken 2047 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2047 times.
✗ Branch 3 not taken.
|
2047 | dstFormat == AV_PIX_FMT_GBRAP10LE || dstFormat == AV_PIX_FMT_GBRAP10BE || |
| 2505 |
2/4✓ Branch 0 taken 2047 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2047 times.
✗ Branch 3 not taken.
|
2047 | dstFormat == AV_PIX_FMT_GBRAP12LE || dstFormat == AV_PIX_FMT_GBRAP12BE || |
| 2506 |
2/4✓ Branch 0 taken 2047 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2047 times.
✗ Branch 3 not taken.
|
2047 | dstFormat == AV_PIX_FMT_GBRAP14LE || dstFormat == AV_PIX_FMT_GBRAP14BE || |
| 2507 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2046 times.
|
2047 | dstFormat == AV_PIX_FMT_GBRAP16LE || dstFormat == AV_PIX_FMT_GBRAP16BE )) |
| 2508 | 112 | c->convert_unscaled = Rgb16ToPlanarRgb16Wrapper; | |
| 2509 | |||
| 2510 |
4/4✓ Branch 1 taken 17113 times.
✓ Branch 2 taken 28334 times.
✓ Branch 3 taken 3590 times.
✓ Branch 4 taken 13523 times.
|
62560 | if (av_pix_fmt_desc_get(dstFormat)->comp[0].depth >= 10 && |
| 2511 |
4/4✓ Branch 2 taken 3104 times.
✓ Branch 3 taken 486 times.
✓ Branch 4 taken 3084 times.
✓ Branch 5 taken 20 times.
|
20703 | isPlanarRGB(dstFormat) && !isFloat(dstFormat) && |
| 2512 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 3064 times.
|
3084 | (srcFormat == AV_PIX_FMT_X2RGB10LE || srcFormat == AV_PIX_FMT_X2BGR10LE)) |
| 2513 | 40 | c->convert_unscaled = Rgb16ToPlanarRgb16Wrapper; | |
| 2514 | |||
| 2515 |
6/6✓ Branch 0 taken 45314 times.
✓ Branch 1 taken 133 times.
✓ Branch 2 taken 45182 times.
✓ Branch 3 taken 132 times.
✓ Branch 4 taken 44743 times.
✓ Branch 5 taken 439 times.
|
45447 | if ((srcFormat == AV_PIX_FMT_GBRP9LE || srcFormat == AV_PIX_FMT_GBRP9BE || |
| 2516 |
4/4✓ Branch 0 taken 44451 times.
✓ Branch 1 taken 292 times.
✓ Branch 2 taken 43373 times.
✓ Branch 3 taken 1078 times.
|
44743 | srcFormat == AV_PIX_FMT_GBRP16LE || srcFormat == AV_PIX_FMT_GBRP16BE || |
| 2517 |
4/4✓ Branch 0 taken 43131 times.
✓ Branch 1 taken 242 times.
✓ Branch 2 taken 42068 times.
✓ Branch 3 taken 1063 times.
|
43373 | srcFormat == AV_PIX_FMT_GBRP10LE || srcFormat == AV_PIX_FMT_GBRP10BE || |
| 2518 |
4/4✓ Branch 0 taken 41826 times.
✓ Branch 1 taken 242 times.
✓ Branch 2 taken 41693 times.
✓ Branch 3 taken 133 times.
|
42068 | srcFormat == AV_PIX_FMT_GBRP12LE || srcFormat == AV_PIX_FMT_GBRP12BE || |
| 2519 |
4/4✓ Branch 0 taken 41561 times.
✓ Branch 1 taken 132 times.
✓ Branch 2 taken 41428 times.
✓ Branch 3 taken 133 times.
|
41693 | srcFormat == AV_PIX_FMT_GBRP14LE || srcFormat == AV_PIX_FMT_GBRP14BE || |
| 2520 |
4/4✓ Branch 0 taken 41296 times.
✓ Branch 1 taken 132 times.
✓ Branch 2 taken 41163 times.
✓ Branch 3 taken 133 times.
|
41428 | srcFormat == AV_PIX_FMT_GBRAP10LE || srcFormat == AV_PIX_FMT_GBRAP10BE || |
| 2521 |
4/4✓ Branch 0 taken 41031 times.
✓ Branch 1 taken 132 times.
✓ Branch 2 taken 40899 times.
✓ Branch 3 taken 132 times.
|
41163 | srcFormat == AV_PIX_FMT_GBRAP12LE || srcFormat == AV_PIX_FMT_GBRAP12BE || |
| 2522 |
4/4✓ Branch 0 taken 40767 times.
✓ Branch 1 taken 132 times.
✓ Branch 2 taken 40632 times.
✓ Branch 3 taken 135 times.
|
40899 | srcFormat == AV_PIX_FMT_GBRAP14LE || srcFormat == AV_PIX_FMT_GBRAP14BE || |
| 2523 |
4/4✓ Branch 0 taken 132 times.
✓ Branch 1 taken 40500 times.
✓ Branch 2 taken 4826 times.
✓ Branch 3 taken 121 times.
|
45447 | srcFormat == AV_PIX_FMT_GBRAP16LE || srcFormat == AV_PIX_FMT_GBRAP16BE) && |
| 2524 |
2/4✓ Branch 0 taken 4826 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4826 times.
✗ Branch 3 not taken.
|
4826 | (dstFormat == AV_PIX_FMT_RGB48LE || dstFormat == AV_PIX_FMT_RGB48BE || |
| 2525 |
2/4✓ Branch 0 taken 4826 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4826 times.
✗ Branch 3 not taken.
|
4826 | dstFormat == AV_PIX_FMT_BGR48LE || dstFormat == AV_PIX_FMT_BGR48BE || |
| 2526 |
2/4✓ Branch 0 taken 4826 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4826 times.
✗ Branch 3 not taken.
|
4826 | dstFormat == AV_PIX_FMT_RGBA64LE || dstFormat == AV_PIX_FMT_RGBA64BE || |
| 2527 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4826 times.
|
4826 | dstFormat == AV_PIX_FMT_BGRA64LE || dstFormat == AV_PIX_FMT_BGRA64BE)) |
| 2528 | 121 | c->convert_unscaled = planarRgb16ToRgb16Wrapper; | |
| 2529 | |||
| 2530 |
4/4✓ Branch 1 taken 22227 times.
✓ Branch 2 taken 23220 times.
✓ Branch 3 taken 5631 times.
✓ Branch 4 taken 16596 times.
|
67674 | if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth >= 10 && |
| 2531 |
4/4✓ Branch 2 taken 5212 times.
✓ Branch 3 taken 419 times.
✓ Branch 4 taken 5192 times.
✓ Branch 5 taken 20 times.
|
27858 | isPlanarRGB(srcFormat) && !isFloat(srcFormat) && |
| 2532 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 5172 times.
|
5192 | (dstFormat == AV_PIX_FMT_X2RGB10LE || dstFormat == AV_PIX_FMT_X2BGR10LE)) |
| 2533 | 40 | c->convert_unscaled = planarRgb16ToRgb16Wrapper; | |
| 2534 | |||
| 2535 |
4/4✓ Branch 1 taken 19407 times.
✓ Branch 2 taken 26040 times.
✓ Branch 3 taken 3252 times.
✓ Branch 4 taken 16155 times.
|
64854 | if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth == 8 && |
| 2536 |
2/2✓ Branch 1 taken 111 times.
✓ Branch 2 taken 3141 times.
|
22659 | isPackedRGB(srcFormat) && dstFormat == AV_PIX_FMT_GBRP) |
| 2537 | 111 | c->convert_unscaled = rgbToPlanarRgbWrapper; | |
| 2538 | |||
| 2539 |
4/4✓ Branch 1 taken 19407 times.
✓ Branch 2 taken 26040 times.
✓ Branch 3 taken 3252 times.
✓ Branch 4 taken 16155 times.
|
64854 | if (av_pix_fmt_desc_get(srcFormat)->comp[0].depth == 8 && |
| 2540 |
2/2✓ Branch 1 taken 100 times.
✓ Branch 2 taken 3152 times.
|
22659 | isPackedRGB(srcFormat) && dstFormat == AV_PIX_FMT_GBRAP) |
| 2541 | 100 | c->convert_unscaled = rgbToPlanarRgbaWrapper; | |
| 2542 | |||
| 2543 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 45447 times.
|
45447 | if (isBayer(srcFormat)) { |
| 2544 | ✗ | c->dst_slice_align = 2; | |
| 2545 | ✗ | if (dstFormat == AV_PIX_FMT_RGB24) | |
| 2546 | ✗ | c->convert_unscaled = bayer_to_rgb24_wrapper; | |
| 2547 | ✗ | else if (dstFormat == AV_PIX_FMT_RGB48) | |
| 2548 | ✗ | c->convert_unscaled = bayer_to_rgb48_wrapper; | |
| 2549 | ✗ | else if (dstFormat == AV_PIX_FMT_YUV420P) | |
| 2550 | ✗ | c->convert_unscaled = bayer_to_yv12_wrapper; | |
| 2551 | ✗ | else if (!isBayer(dstFormat)) { | |
| 2552 | ✗ | av_log(c, AV_LOG_ERROR, "unsupported bayer conversion\n"); | |
| 2553 | ✗ | av_assert0(0); | |
| 2554 | } | ||
| 2555 | } | ||
| 2556 | |||
| 2557 | /* bswap 16 bits per pixel/component packed formats */ | ||
| 2558 |
3/10✗ Branch 0 not taken.
✓ Branch 1 taken 45447 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 45447 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 45447 times.
|
45447 | if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_BGGR16) || |
| 2559 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45447 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45447 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_RGGB16) || |
| 2560 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45447 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45447 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_GBRG16) || |
| 2561 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45447 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45315 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BAYER_GRBG16) || |
| 2562 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✓ Branch 3 taken 45315 times.
✓ Branch 4 taken 132 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45315 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR444) || |
| 2563 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45314 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45315 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR48) || |
| 2564 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✓ Branch 3 taken 45295 times.
✓ Branch 4 taken 152 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45315 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR555) || |
| 2565 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✓ Branch 3 taken 45315 times.
✓ Branch 4 taken 132 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45315 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGR565) || |
| 2566 |
5/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45314 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45447 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_BGRA64) || |
| 2567 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45447 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 50 times.
✓ Branch 7 taken 45397 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY9) || |
| 2568 |
6/8✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 45397 times.
✓ Branch 4 taken 50 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 50 times.
✓ Branch 7 taken 45397 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY10) || |
| 2569 |
5/8✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 45397 times.
✓ Branch 4 taken 50 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45447 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY12) || |
| 2570 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45447 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 90 times.
✓ Branch 7 taken 45357 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY14) || |
| 2571 |
7/8✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 62 times.
✓ Branch 3 taken 45385 times.
✓ Branch 4 taken 60 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 10 times.
✓ Branch 7 taken 45435 times.
|
45447 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GRAY16) || |
| 2572 |
4/8✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45445 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45313 times.
|
45445 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YA16) || |
| 2573 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✓ Branch 3 taken 45313 times.
✓ Branch 4 taken 132 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45313 times.
|
45445 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_AYUV64) || |
| 2574 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45312 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 242 times.
✓ Branch 7 taken 45203 times.
|
45445 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP9) || |
| 2575 |
8/8✓ Branch 0 taken 232 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 1078 times.
✓ Branch 3 taken 44357 times.
✓ Branch 4 taken 1068 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 242 times.
✓ Branch 7 taken 45183 times.
|
45445 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10) || |
| 2576 |
8/8✓ Branch 0 taken 232 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 1063 times.
✓ Branch 3 taken 44352 times.
✓ Branch 4 taken 1053 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45273 times.
|
45425 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12) || |
| 2577 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45272 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 292 times.
✓ Branch 7 taken 45113 times.
|
45405 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP14) || |
| 2578 |
8/8✓ Branch 0 taken 282 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 439 times.
✓ Branch 3 taken 44956 times.
✓ Branch 4 taken 427 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45251 times.
|
45405 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP16) || |
| 2579 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45250 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45251 times.
|
45383 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP10MSB) || |
| 2580 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45250 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45251 times.
|
45383 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRP12MSB) || |
| 2581 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45250 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45251 times.
|
45383 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP10) || |
| 2582 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45250 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45251 times.
|
45383 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP12) || |
| 2583 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✓ Branch 3 taken 45251 times.
✓ Branch 4 taken 132 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45251 times.
|
45383 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP14) || |
| 2584 |
7/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✓ Branch 3 taken 45248 times.
✓ Branch 4 taken 133 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45249 times.
|
45383 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAP16) || |
| 2585 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✓ Branch 3 taken 45249 times.
✓ Branch 4 taken 132 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 143 times.
✓ Branch 7 taken 45238 times.
|
45381 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB444) || |
| 2586 |
7/8✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1209 times.
✓ Branch 3 taken 44172 times.
✓ Branch 4 taken 1208 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45248 times.
|
45381 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB48) || |
| 2587 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
✓ Branch 3 taken 45022 times.
✓ Branch 4 taken 358 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45248 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB555) || |
| 2588 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 277 times.
✓ Branch 3 taken 45103 times.
✓ Branch 4 taken 277 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 143 times.
✓ Branch 7 taken 45237 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGB565) || |
| 2589 |
6/8✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45247 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 242 times.
✓ Branch 7 taken 45138 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_RGBA64) || |
| 2590 |
6/8✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 242 times.
✓ Branch 3 taken 45138 times.
✓ Branch 4 taken 242 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 272 times.
✓ Branch 7 taken 45108 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_XV36) || |
| 2591 |
5/8✓ Branch 0 taken 272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 272 times.
✓ Branch 3 taken 45108 times.
✓ Branch 4 taken 272 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45380 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_XV48) || |
| 2592 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45380 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45380 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_XYZ12) || |
| 2593 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 45360 times.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 110 times.
✓ Branch 7 taken 45270 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P9) || |
| 2594 |
6/8✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169 times.
✓ Branch 3 taken 45211 times.
✓ Branch 4 taken 169 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 110 times.
✓ Branch 7 taken 45270 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P10) || |
| 2595 |
5/8✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 117 times.
✓ Branch 3 taken 45263 times.
✓ Branch 4 taken 117 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45380 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P12) || |
| 2596 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45380 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 140 times.
✓ Branch 7 taken 45240 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P14) || |
| 2597 |
5/8✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140 times.
✓ Branch 3 taken 45240 times.
✓ Branch 4 taken 140 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45380 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV420P16) || |
| 2598 |
5/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 45370 times.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 110 times.
✓ Branch 7 taken 45270 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P9) || |
| 2599 |
6/8✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 161 times.
✓ Branch 3 taken 45219 times.
✓ Branch 4 taken 161 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 110 times.
✓ Branch 7 taken 45270 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P10) || |
| 2600 |
5/8✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113 times.
✓ Branch 3 taken 45267 times.
✓ Branch 4 taken 113 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 45380 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P12) || |
| 2601 |
3/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45380 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 140 times.
✓ Branch 7 taken 45240 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P14) || |
| 2602 |
7/8✓ Branch 0 taken 140 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 150 times.
✓ Branch 3 taken 45230 times.
✓ Branch 4 taken 140 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 110 times.
✓ Branch 7 taken 45260 times.
|
45380 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV422P16) || |
| 2603 |
6/8✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110 times.
✓ Branch 3 taken 45260 times.
✓ Branch 4 taken 110 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 110 times.
✓ Branch 7 taken 45260 times.
|
45370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV440P10) || |
| 2604 |
6/8✓ Branch 0 taken 110 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 110 times.
✓ Branch 3 taken 45260 times.
✓ Branch 4 taken 110 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45238 times.
|
45370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV440P12) || |
| 2605 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45237 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 242 times.
✓ Branch 7 taken 45128 times.
|
45370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P9) || |
| 2606 |
8/8✓ Branch 0 taken 232 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 1082 times.
✓ Branch 3 taken 44278 times.
✓ Branch 4 taken 1072 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 242 times.
✓ Branch 7 taken 45108 times.
|
45370 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P10) || |
| 2607 |
8/8✓ Branch 0 taken 232 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 1084 times.
✓ Branch 3 taken 44256 times.
✓ Branch 4 taken 1074 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 132 times.
✓ Branch 7 taken 45198 times.
|
45350 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P12) || |
| 2608 |
6/8✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133 times.
✓ Branch 3 taken 45197 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 272 times.
✓ Branch 7 taken 45058 times.
|
45330 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P14) || |
| 2609 |
8/8✓ Branch 0 taken 262 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 451 times.
✓ Branch 3 taken 44869 times.
✓ Branch 4 taken 441 times.
✓ Branch 5 taken 10 times.
✓ Branch 6 taken 242 times.
✓ Branch 7 taken 45068 times.
|
45330 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P16) || |
| 2610 |
6/8✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✓ Branch 3 taken 45067 times.
✓ Branch 4 taken 243 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 242 times.
✓ Branch 7 taken 45068 times.
|
45310 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P10MSB) || |
| 2611 |
4/6✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 243 times.
✓ Branch 3 taken 45067 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 243 times.
|
45310 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_YUV444P12MSB)) |
| 2612 | 137 | c->convert_unscaled = bswap_16bpc; | |
| 2613 | |||
| 2614 | /* bswap 32 bits per pixel/component formats */ | ||
| 2615 |
6/10✗ Branch 0 not taken.
✓ Branch 1 taken 45447 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 35 times.
✓ Branch 5 taken 45412 times.
✓ Branch 6 taken 34 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 45446 times.
|
45447 | if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRPF32) || |
| 2616 |
1/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 45446 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
45446 | IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, AV_PIX_FMT_GBRAPF32)) |
| 2617 | 1 | c->convert_unscaled = bswap_32bpc; | |
| 2618 | |||
| 2619 |
2/2✓ Branch 1 taken 1414 times.
✓ Branch 2 taken 44033 times.
|
45447 | if (usePal(srcFormat)) { |
| 2620 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1404 times.
|
1414 | switch (dstFormat) { |
| 2621 | 10 | case AV_PIX_FMT_GBRP: | |
| 2622 | case AV_PIX_FMT_GBRAP: | ||
| 2623 | 10 | c->convert_unscaled = palToGbrpWrapper; | |
| 2624 | 10 | break; | |
| 2625 | 1404 | default: | |
| 2626 |
9/12✓ Branch 0 taken 1364 times.
✓ Branch 1 taken 40 times.
✓ Branch 2 taken 1364 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 622 times.
✓ Branch 5 taken 742 times.
✓ Branch 6 taken 573 times.
✓ Branch 7 taken 49 times.
✓ Branch 8 taken 573 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 573 times.
|
1404 | if (isByteRGB(dstFormat)) |
| 2627 | 831 | c->convert_unscaled = palToRgbWrapper; | |
| 2628 | 1404 | break; | |
| 2629 | } | ||
| 2630 | } | ||
| 2631 | |||
| 2632 |
2/2✓ Branch 0 taken 1025 times.
✓ Branch 1 taken 44422 times.
|
45447 | if (srcFormat == AV_PIX_FMT_YUV422P) { |
| 2633 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1025 times.
|
1025 | if (dstFormat == AV_PIX_FMT_YUYV422) |
| 2634 | ✗ | c->convert_unscaled = yuv422pToYuy2Wrapper; | |
| 2635 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1025 times.
|
1025 | else if (dstFormat == AV_PIX_FMT_UYVY422) |
| 2636 | ✗ | c->convert_unscaled = yuv422pToUyvyWrapper; | |
| 2637 | } | ||
| 2638 | |||
| 2639 | /* uint Y to float Y */ | ||
| 2640 |
3/4✓ Branch 0 taken 70 times.
✓ Branch 1 taken 45377 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 70 times.
|
45447 | if (srcFormat == AV_PIX_FMT_GRAY8 && dstFormat == AV_PIX_FMT_GRAYF32){ |
| 2641 | ✗ | c->convert_unscaled = uint_y_to_float_y_wrapper; | |
| 2642 | } | ||
| 2643 | |||
| 2644 | /* float Y to uint Y */ | ||
| 2645 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 45446 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
45447 | if (srcFormat == AV_PIX_FMT_GRAYF32 && dstFormat == AV_PIX_FMT_GRAY8){ |
| 2646 | ✗ | c->convert_unscaled = float_y_to_uint_y_wrapper; | |
| 2647 | } | ||
| 2648 | |||
| 2649 | /* LQ converters if -sws 0 or -sws 4*/ | ||
| 2650 |
2/2✓ Branch 0 taken 104 times.
✓ Branch 1 taken 45343 times.
|
45447 | if (c->opts.flags&(SWS_FAST_BILINEAR|SWS_POINT)) { |
| 2651 | /* yv12_to_yuy2 */ | ||
| 2652 |
3/4✓ Branch 0 taken 42 times.
✓ Branch 1 taken 62 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 42 times.
|
104 | if (srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUVA420P) { |
| 2653 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
|
62 | if (dstFormat == AV_PIX_FMT_YUYV422) |
| 2654 | ✗ | c->convert_unscaled = planarToYuy2Wrapper; | |
| 2655 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
|
62 | else if (dstFormat == AV_PIX_FMT_UYVY422) |
| 2656 | ✗ | c->convert_unscaled = planarToUyvyWrapper; | |
| 2657 | } | ||
| 2658 | } | ||
| 2659 |
3/4✓ Branch 0 taken 111 times.
✓ Branch 1 taken 45336 times.
✓ Branch 2 taken 111 times.
✗ Branch 3 not taken.
|
45447 | if (srcFormat == AV_PIX_FMT_YUYV422 && |
| 2660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
|
111 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P)) |
| 2661 | ✗ | c->convert_unscaled = yuyvToYuv420Wrapper; | |
| 2662 |
3/4✓ Branch 0 taken 111 times.
✓ Branch 1 taken 45336 times.
✓ Branch 2 taken 111 times.
✗ Branch 3 not taken.
|
45447 | if (srcFormat == AV_PIX_FMT_UYVY422 && |
| 2663 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 111 times.
|
111 | (dstFormat == AV_PIX_FMT_YUV420P || dstFormat == AV_PIX_FMT_YUVA420P)) |
| 2664 | ✗ | c->convert_unscaled = uyvyToYuv420Wrapper; | |
| 2665 |
3/4✓ Branch 0 taken 111 times.
✓ Branch 1 taken 45336 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 111 times.
|
45447 | if (srcFormat == AV_PIX_FMT_YUYV422 && dstFormat == AV_PIX_FMT_YUV422P) |
| 2666 | ✗ | c->convert_unscaled = yuyvToYuv422Wrapper; | |
| 2667 |
3/4✓ Branch 0 taken 111 times.
✓ Branch 1 taken 45336 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 111 times.
|
45447 | if (srcFormat == AV_PIX_FMT_UYVY422 && dstFormat == AV_PIX_FMT_YUV422P) |
| 2668 | ✗ | c->convert_unscaled = uyvyToYuv422Wrapper; | |
| 2669 |
4/4✓ Branch 0 taken 756 times.
✓ Branch 1 taken 44691 times.
✓ Branch 2 taken 690 times.
✓ Branch 3 taken 66 times.
|
45447 | if (dstFormat == AV_PIX_FMT_YUV420P && |
| 2670 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 634 times.
|
690 | (srcFormat == AV_PIX_FMT_NV24 || srcFormat == AV_PIX_FMT_NV42)) |
| 2671 | 122 | c->convert_unscaled = nv24ToYuv420Wrapper; | |
| 2672 | |||
| 2673 | #define isPlanarGray(x) (isGray(x) && !isALPHA(x)) | ||
| 2674 | |||
| 2675 | /* simple copy */ | ||
| 2676 |
4/4✓ Branch 0 taken 45125 times.
✓ Branch 1 taken 322 times.
✓ Branch 2 taken 840 times.
✓ Branch 3 taken 44285 times.
|
45447 | if ( srcFormat == dstFormat || |
| 2677 |
3/4✓ Branch 0 taken 840 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6009 times.
✓ Branch 3 taken 39116 times.
|
45125 | (srcFormat == AV_PIX_FMT_YUVA420P && dstFormat == AV_PIX_FMT_YUV420P) || |
| 2678 |
4/4✓ Branch 0 taken 5980 times.
✓ Branch 1 taken 29 times.
✓ Branch 2 taken 44940 times.
✓ Branch 3 taken 156 times.
|
51105 | (srcFormat == AV_PIX_FMT_YUV420P && dstFormat == AV_PIX_FMT_YUVA420P) || |
| 2679 |
7/10✓ Branch 4 taken 44529 times.
✓ Branch 5 taken 411 times.
✓ Branch 7 taken 24415 times.
✓ Branch 8 taken 20114 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 24415 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 27032 times.
✓ Branch 16 taken 17497 times.
|
134565 | (isFloat(srcFormat) == isFloat(dstFormat) && isFloat16(srcFormat) == isFloat16(dstFormat)) && ((isPlanarYUV(srcFormat) && isPlanarGray(dstFormat)) || |
| 2680 |
3/6✗ Branch 2 not taken.
✓ Branch 3 taken 27032 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
✓ Branch 8 taken 44526 times.
|
116090 | (isPlanarYUV(dstFormat) && isPlanarGray(srcFormat)) || |
| 2681 |
5/8✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 3 times.
✓ Branch 10 taken 24415 times.
✓ Branch 11 taken 20111 times.
|
89058 | (isPlanarGray(dstFormat) && isPlanarGray(srcFormat)) || |
| 2682 |
2/2✓ Branch 2 taken 12091 times.
✓ Branch 3 taken 12324 times.
|
68941 | (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat) && |
| 2683 |
2/2✓ Branch 0 taken 7204 times.
✓ Branch 1 taken 4887 times.
|
12091 | c->chrDstHSubSample == c->chrSrcHSubSample && |
| 2684 |
4/4✓ Branch 0 taken 6024 times.
✓ Branch 1 taken 1180 times.
✓ Branch 2 taken 4691 times.
✓ Branch 3 taken 1333 times.
|
13228 | c->chrDstVSubSample == c->chrSrcVSubSample && |
| 2685 |
1/2✓ Branch 2 taken 4691 times.
✗ Branch 3 not taken.
|
10715 | isSemiPlanarYUV(srcFormat) == isSemiPlanarYUV(dstFormat) && |
| 2686 | 4691 | isSwappedChroma(srcFormat) == isSwappedChroma(dstFormat)))) | |
| 2687 | { | ||
| 2688 |
2/2✓ Branch 1 taken 50 times.
✓ Branch 2 taken 4995 times.
|
5045 | if (isPacked(c->opts.src_format)) { |
| 2689 | 50 | c->convert_unscaled = packedCopyWrapper; | |
| 2690 | } else { /* Planar YUV or gray */ | ||
| 2691 | 4995 | c->convert_unscaled = planarCopyWrapper; | |
| 2692 |
2/2✓ Branch 0 taken 4495 times.
✓ Branch 1 taken 500 times.
|
4995 | if (c->opts.dither != SWS_DITHER_NONE) |
| 2693 | 4495 | c->dst_slice_align = 8 << c->chrDstVSubSample; | |
| 2694 | } | ||
| 2695 | } | ||
| 2696 | |||
| 2697 | 45447 | ff_sws_init_xyzdsp(c); | |
| 2698 | |||
| 2699 | #if ARCH_PPC | ||
| 2700 | ff_get_unscaled_swscale_ppc(c); | ||
| 2701 | #elif ARCH_ARM | ||
| 2702 | ff_get_unscaled_swscale_arm(c); | ||
| 2703 | #elif ARCH_AARCH64 | ||
| 2704 | ff_get_unscaled_swscale_aarch64(c); | ||
| 2705 | #endif | ||
| 2706 | 45447 | } | |
| 2707 | |||
| 2708 | /* Convert the palette to the same packed 32-bit format as the palette */ | ||
| 2709 | 97576 | void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, | |
| 2710 | int num_pixels, const uint8_t *palette) | ||
| 2711 | { | ||
| 2712 | int i; | ||
| 2713 | |||
| 2714 |
2/2✓ Branch 0 taken 30214048 times.
✓ Branch 1 taken 97576 times.
|
30311624 | for (i = 0; i < num_pixels; i++) |
| 2715 | 30214048 | ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i]]; | |
| 2716 | 97576 | } | |
| 2717 | |||
| 2718 | /* Palette format: ABCD -> dst format: ABC */ | ||
| 2719 | 717310 | void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, | |
| 2720 | int num_pixels, const uint8_t *palette) | ||
| 2721 | { | ||
| 2722 | int i; | ||
| 2723 | |||
| 2724 |
2/2✓ Branch 0 taken 273951884 times.
✓ Branch 1 taken 717310 times.
|
274669194 | for (i = 0; i < num_pixels; i++) { |
| 2725 | //FIXME slow? | ||
| 2726 | 273951884 | dst[0] = palette[src[i] * 4 + 0]; | |
| 2727 | 273951884 | dst[1] = palette[src[i] * 4 + 1]; | |
| 2728 | 273951884 | dst[2] = palette[src[i] * 4 + 2]; | |
| 2729 | 273951884 | dst += 3; | |
| 2730 | } | ||
| 2731 | 717310 | } | |
| 2732 |