1 /* 2 * Copyright 2013 The LibYuv Project Authors. All rights reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef INCLUDE_LIBYUV_SCALE_ROW_H_ 12 #define INCLUDE_LIBYUV_SCALE_ROW_H_ 13 14 #include "libyuv/basic_types.h" 15 #include "libyuv/scale.h" 16 17 #ifdef __cplusplus 18 namespace libyuv { 19 extern "C" { 20 #endif 21 22 #if defined(__pnacl__) || defined(__CLR_VER) || \ 23 (defined(__native_client__) && defined(__x86_64__)) || \ 24 (defined(__i386__) && !defined(__SSE__) && !defined(__clang__)) 25 #define LIBYUV_DISABLE_X86 26 #endif 27 #if defined(__native_client__) 28 #define LIBYUV_DISABLE_NEON 29 #endif 30 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505 31 #if defined(__has_feature) 32 #if __has_feature(memory_sanitizer) 33 #define LIBYUV_DISABLE_X86 34 #endif 35 #endif 36 // GCC >= 4.7.0 required for AVX2. 37 #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__)) 38 #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7)) 39 #define GCC_HAS_AVX2 1 40 #endif // GNUC >= 4.7 41 #endif // __GNUC__ 42 43 // clang >= 3.4.0 required for AVX2. 44 #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__)) 45 #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4)) 46 #define CLANG_HAS_AVX2 1 47 #endif // clang >= 3.4 48 #endif // __clang__ 49 50 // Visual C 2012 required for AVX2. 51 #if defined(_M_IX86) && !defined(__clang__) && defined(_MSC_VER) && \ 52 _MSC_VER >= 1700 53 #define VISUALC_HAS_AVX2 1 54 #endif // VisualStudio >= 2012 55 56 // The following are available on all x86 platforms: 57 #if !defined(LIBYUV_DISABLE_X86) && \ 58 (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__)) 59 #define HAS_FIXEDDIV1_X86 60 #define HAS_FIXEDDIV_X86 61 #define HAS_SCALEADDROW_SSE2 62 #define HAS_SCALEARGBCOLS_SSE2 63 #define HAS_SCALEARGBCOLSUP2_SSE2 64 #define HAS_SCALEARGBFILTERCOLS_SSSE3 65 #define HAS_SCALEARGBROWDOWN2_SSE2 66 #define HAS_SCALEARGBROWDOWNEVEN_SSE2 67 #define HAS_SCALECOLSUP2_SSE2 68 #define HAS_SCALEFILTERCOLS_SSSE3 69 #define HAS_SCALEROWDOWN2_SSSE3 70 #define HAS_SCALEROWDOWN34_SSSE3 71 #define HAS_SCALEROWDOWN38_SSSE3 72 #define HAS_SCALEROWDOWN4_SSSE3 73 #endif 74 75 // The following are available on all x86 platforms, but 76 // require VS2012, clang 3.4 or gcc 4.7. 77 // The code supports NaCL but requires a new compiler and validator. 78 #if !defined(LIBYUV_DISABLE_X86) && \ 79 (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2) || \ 80 defined(GCC_HAS_AVX2)) 81 #define HAS_SCALEADDROW_AVX2 82 #define HAS_SCALEROWDOWN2_AVX2 83 #define HAS_SCALEROWDOWN4_AVX2 84 #endif 85 86 // The following are available on Neon platforms: 87 #if !defined(LIBYUV_DISABLE_NEON) && \ 88 (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__)) 89 #define HAS_SCALEADDROW_NEON 90 #define HAS_SCALEARGBCOLS_NEON 91 #define HAS_SCALEARGBFILTERCOLS_NEON 92 #define HAS_SCALEARGBROWDOWN2_NEON 93 #define HAS_SCALEARGBROWDOWNEVEN_NEON 94 #define HAS_SCALEFILTERCOLS_NEON 95 #define HAS_SCALEROWDOWN2_NEON 96 #define HAS_SCALEROWDOWN34_NEON 97 #define HAS_SCALEROWDOWN38_NEON 98 #define HAS_SCALEROWDOWN4_NEON 99 #endif 100 101 #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa) 102 #define HAS_SCALEADDROW_MSA 103 #define HAS_SCALEARGBCOLS_MSA 104 #define HAS_SCALEARGBFILTERCOLS_MSA 105 #define HAS_SCALEARGBROWDOWN2_MSA 106 #define HAS_SCALEARGBROWDOWNEVEN_MSA 107 #define HAS_SCALEFILTERCOLS_MSA 108 #define HAS_SCALEROWDOWN2_MSA 109 #define HAS_SCALEROWDOWN34_MSA 110 #define HAS_SCALEROWDOWN38_MSA 111 #define HAS_SCALEROWDOWN4_MSA 112 #endif 113 114 #if !defined(LIBYUV_DISABLE_MMI) && defined(_MIPS_ARCH_LOONGSON3A) 115 #define HAS_FIXEDDIV1_MIPS 116 #define HAS_FIXEDDIV_MIPS 117 #define HAS_SCALEADDROW_16_MMI 118 #define HAS_SCALEADDROW_MMI 119 #define HAS_SCALEARGBCOLS_MMI 120 #define HAS_SCALEARGBCOLSUP2_MMI 121 #define HAS_SCALEARGBROWDOWN2_MMI 122 #define HAS_SCALEARGBROWDOWNEVEN_MMI 123 #define HAS_SCALECOLS_16_MMI 124 #define HAS_SCALECOLS_MMI 125 #define HAS_SCALEROWDOWN2_16_MMI 126 #define HAS_SCALEROWDOWN2_MMI 127 #define HAS_SCALEROWDOWN4_16_MMI 128 #define HAS_SCALEROWDOWN4_MMI 129 #endif 130 131 // Scale ARGB vertically with bilinear interpolation. 132 void ScalePlaneVertical(int src_height, 133 int dst_width, 134 int dst_height, 135 int src_stride, 136 int dst_stride, 137 const uint8_t* src_argb, 138 uint8_t* dst_argb, 139 int x, 140 int y, 141 int dy, 142 int bpp, 143 enum FilterMode filtering); 144 145 void ScalePlaneVertical_16(int src_height, 146 int dst_width, 147 int dst_height, 148 int src_stride, 149 int dst_stride, 150 const uint16_t* src_argb, 151 uint16_t* dst_argb, 152 int x, 153 int y, 154 int dy, 155 int wpp, 156 enum FilterMode filtering); 157 158 // Simplify the filtering based on scale factors. 159 enum FilterMode ScaleFilterReduce(int src_width, 160 int src_height, 161 int dst_width, 162 int dst_height, 163 enum FilterMode filtering); 164 165 // Divide num by div and return as 16.16 fixed point result. 166 int FixedDiv_C(int num, int div); 167 int FixedDiv_X86(int num, int div); 168 int FixedDiv_MIPS(int num, int div); 169 // Divide num - 1 by div - 1 and return as 16.16 fixed point result. 170 int FixedDiv1_C(int num, int div); 171 int FixedDiv1_X86(int num, int div); 172 int FixedDiv1_MIPS(int num, int div); 173 #ifdef HAS_FIXEDDIV_X86 174 #define FixedDiv FixedDiv_X86 175 #define FixedDiv1 FixedDiv1_X86 176 #elif defined HAS_FIXEDDIV_MIPS 177 #define FixedDiv FixedDiv_MIPS 178 #define FixedDiv1 FixedDiv1_MIPS 179 #else 180 #define FixedDiv FixedDiv_C 181 #define FixedDiv1 FixedDiv1_C 182 #endif 183 184 // Compute slope values for stepping. 185 void ScaleSlope(int src_width, 186 int src_height, 187 int dst_width, 188 int dst_height, 189 enum FilterMode filtering, 190 int* x, 191 int* y, 192 int* dx, 193 int* dy); 194 195 void ScaleRowDown2_C(const uint8_t* src_ptr, 196 ptrdiff_t src_stride, 197 uint8_t* dst, 198 int dst_width); 199 void ScaleRowDown2_16_C(const uint16_t* src_ptr, 200 ptrdiff_t src_stride, 201 uint16_t* dst, 202 int dst_width); 203 void ScaleRowDown2Linear_C(const uint8_t* src_ptr, 204 ptrdiff_t src_stride, 205 uint8_t* dst, 206 int dst_width); 207 void ScaleRowDown2Linear_16_C(const uint16_t* src_ptr, 208 ptrdiff_t src_stride, 209 uint16_t* dst, 210 int dst_width); 211 void ScaleRowDown2Box_C(const uint8_t* src_ptr, 212 ptrdiff_t src_stride, 213 uint8_t* dst, 214 int dst_width); 215 void ScaleRowDown2Box_Odd_C(const uint8_t* src_ptr, 216 ptrdiff_t src_stride, 217 uint8_t* dst, 218 int dst_width); 219 void ScaleRowDown2Box_16_C(const uint16_t* src_ptr, 220 ptrdiff_t src_stride, 221 uint16_t* dst, 222 int dst_width); 223 void ScaleRowDown4_C(const uint8_t* src_ptr, 224 ptrdiff_t src_stride, 225 uint8_t* dst, 226 int dst_width); 227 void ScaleRowDown4_16_C(const uint16_t* src_ptr, 228 ptrdiff_t src_stride, 229 uint16_t* dst, 230 int dst_width); 231 void ScaleRowDown4Box_C(const uint8_t* src_ptr, 232 ptrdiff_t src_stride, 233 uint8_t* dst, 234 int dst_width); 235 void ScaleRowDown4Box_16_C(const uint16_t* src_ptr, 236 ptrdiff_t src_stride, 237 uint16_t* dst, 238 int dst_width); 239 void ScaleRowDown34_C(const uint8_t* src_ptr, 240 ptrdiff_t src_stride, 241 uint8_t* dst, 242 int dst_width); 243 void ScaleRowDown34_16_C(const uint16_t* src_ptr, 244 ptrdiff_t src_stride, 245 uint16_t* dst, 246 int dst_width); 247 void ScaleRowDown34_0_Box_C(const uint8_t* src_ptr, 248 ptrdiff_t src_stride, 249 uint8_t* d, 250 int dst_width); 251 void ScaleRowDown34_0_Box_16_C(const uint16_t* src_ptr, 252 ptrdiff_t src_stride, 253 uint16_t* d, 254 int dst_width); 255 void ScaleRowDown34_1_Box_C(const uint8_t* src_ptr, 256 ptrdiff_t src_stride, 257 uint8_t* d, 258 int dst_width); 259 void ScaleRowDown34_1_Box_16_C(const uint16_t* src_ptr, 260 ptrdiff_t src_stride, 261 uint16_t* d, 262 int dst_width); 263 void ScaleCols_C(uint8_t* dst_ptr, 264 const uint8_t* src_ptr, 265 int dst_width, 266 int x, 267 int dx); 268 void ScaleCols_16_C(uint16_t* dst_ptr, 269 const uint16_t* src_ptr, 270 int dst_width, 271 int x, 272 int dx); 273 void ScaleColsUp2_C(uint8_t* dst_ptr, 274 const uint8_t* src_ptr, 275 int dst_width, 276 int, 277 int); 278 void ScaleColsUp2_16_C(uint16_t* dst_ptr, 279 const uint16_t* src_ptr, 280 int dst_width, 281 int, 282 int); 283 void ScaleFilterCols_C(uint8_t* dst_ptr, 284 const uint8_t* src_ptr, 285 int dst_width, 286 int x, 287 int dx); 288 void ScaleFilterCols_16_C(uint16_t* dst_ptr, 289 const uint16_t* src_ptr, 290 int dst_width, 291 int x, 292 int dx); 293 void ScaleFilterCols64_C(uint8_t* dst_ptr, 294 const uint8_t* src_ptr, 295 int dst_width, 296 int x32, 297 int dx); 298 void ScaleFilterCols64_16_C(uint16_t* dst_ptr, 299 const uint16_t* src_ptr, 300 int dst_width, 301 int x32, 302 int dx); 303 void ScaleRowDown38_C(const uint8_t* src_ptr, 304 ptrdiff_t src_stride, 305 uint8_t* dst, 306 int dst_width); 307 void ScaleRowDown38_16_C(const uint16_t* src_ptr, 308 ptrdiff_t src_stride, 309 uint16_t* dst, 310 int dst_width); 311 void ScaleRowDown38_3_Box_C(const uint8_t* src_ptr, 312 ptrdiff_t src_stride, 313 uint8_t* dst_ptr, 314 int dst_width); 315 void ScaleRowDown38_3_Box_16_C(const uint16_t* src_ptr, 316 ptrdiff_t src_stride, 317 uint16_t* dst_ptr, 318 int dst_width); 319 void ScaleRowDown38_2_Box_C(const uint8_t* src_ptr, 320 ptrdiff_t src_stride, 321 uint8_t* dst_ptr, 322 int dst_width); 323 void ScaleRowDown38_2_Box_16_C(const uint16_t* src_ptr, 324 ptrdiff_t src_stride, 325 uint16_t* dst_ptr, 326 int dst_width); 327 void ScaleAddRow_C(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width); 328 void ScaleAddRow_16_C(const uint16_t* src_ptr, 329 uint32_t* dst_ptr, 330 int src_width); 331 void ScaleARGBRowDown2_C(const uint8_t* src_argb, 332 ptrdiff_t src_stride, 333 uint8_t* dst_argb, 334 int dst_width); 335 void ScaleARGBRowDown2Linear_C(const uint8_t* src_argb, 336 ptrdiff_t src_stride, 337 uint8_t* dst_argb, 338 int dst_width); 339 void ScaleARGBRowDown2Box_C(const uint8_t* src_argb, 340 ptrdiff_t src_stride, 341 uint8_t* dst_argb, 342 int dst_width); 343 void ScaleARGBRowDownEven_C(const uint8_t* src_argb, 344 ptrdiff_t src_stride, 345 int src_stepx, 346 uint8_t* dst_argb, 347 int dst_width); 348 void ScaleARGBRowDownEvenBox_C(const uint8_t* src_argb, 349 ptrdiff_t src_stride, 350 int src_stepx, 351 uint8_t* dst_argb, 352 int dst_width); 353 void ScaleARGBCols_C(uint8_t* dst_argb, 354 const uint8_t* src_argb, 355 int dst_width, 356 int x, 357 int dx); 358 void ScaleARGBCols64_C(uint8_t* dst_argb, 359 const uint8_t* src_argb, 360 int dst_width, 361 int x32, 362 int dx); 363 void ScaleARGBColsUp2_C(uint8_t* dst_argb, 364 const uint8_t* src_argb, 365 int dst_width, 366 int, 367 int); 368 void ScaleARGBFilterCols_C(uint8_t* dst_argb, 369 const uint8_t* src_argb, 370 int dst_width, 371 int x, 372 int dx); 373 void ScaleARGBFilterCols64_C(uint8_t* dst_argb, 374 const uint8_t* src_argb, 375 int dst_width, 376 int x32, 377 int dx); 378 379 // Specialized scalers for x86. 380 void ScaleRowDown2_SSSE3(const uint8_t* src_ptr, 381 ptrdiff_t src_stride, 382 uint8_t* dst_ptr, 383 int dst_width); 384 void ScaleRowDown2Linear_SSSE3(const uint8_t* src_ptr, 385 ptrdiff_t src_stride, 386 uint8_t* dst_ptr, 387 int dst_width); 388 void ScaleRowDown2Box_SSSE3(const uint8_t* src_ptr, 389 ptrdiff_t src_stride, 390 uint8_t* dst_ptr, 391 int dst_width); 392 void ScaleRowDown2_AVX2(const uint8_t* src_ptr, 393 ptrdiff_t src_stride, 394 uint8_t* dst_ptr, 395 int dst_width); 396 void ScaleRowDown2Linear_AVX2(const uint8_t* src_ptr, 397 ptrdiff_t src_stride, 398 uint8_t* dst_ptr, 399 int dst_width); 400 void ScaleRowDown2Box_AVX2(const uint8_t* src_ptr, 401 ptrdiff_t src_stride, 402 uint8_t* dst_ptr, 403 int dst_width); 404 void ScaleRowDown4_SSSE3(const uint8_t* src_ptr, 405 ptrdiff_t src_stride, 406 uint8_t* dst_ptr, 407 int dst_width); 408 void ScaleRowDown4Box_SSSE3(const uint8_t* src_ptr, 409 ptrdiff_t src_stride, 410 uint8_t* dst_ptr, 411 int dst_width); 412 void ScaleRowDown4_AVX2(const uint8_t* src_ptr, 413 ptrdiff_t src_stride, 414 uint8_t* dst_ptr, 415 int dst_width); 416 void ScaleRowDown4Box_AVX2(const uint8_t* src_ptr, 417 ptrdiff_t src_stride, 418 uint8_t* dst_ptr, 419 int dst_width); 420 421 void ScaleRowDown34_SSSE3(const uint8_t* src_ptr, 422 ptrdiff_t src_stride, 423 uint8_t* dst_ptr, 424 int dst_width); 425 void ScaleRowDown34_1_Box_SSSE3(const uint8_t* src_ptr, 426 ptrdiff_t src_stride, 427 uint8_t* dst_ptr, 428 int dst_width); 429 void ScaleRowDown34_0_Box_SSSE3(const uint8_t* src_ptr, 430 ptrdiff_t src_stride, 431 uint8_t* dst_ptr, 432 int dst_width); 433 void ScaleRowDown38_SSSE3(const uint8_t* src_ptr, 434 ptrdiff_t src_stride, 435 uint8_t* dst_ptr, 436 int dst_width); 437 void ScaleRowDown38_3_Box_SSSE3(const uint8_t* src_ptr, 438 ptrdiff_t src_stride, 439 uint8_t* dst_ptr, 440 int dst_width); 441 void ScaleRowDown38_2_Box_SSSE3(const uint8_t* src_ptr, 442 ptrdiff_t src_stride, 443 uint8_t* dst_ptr, 444 int dst_width); 445 void ScaleRowDown2_Any_SSSE3(const uint8_t* src_ptr, 446 ptrdiff_t src_stride, 447 uint8_t* dst_ptr, 448 int dst_width); 449 void ScaleRowDown2Linear_Any_SSSE3(const uint8_t* src_ptr, 450 ptrdiff_t src_stride, 451 uint8_t* dst_ptr, 452 int dst_width); 453 void ScaleRowDown2Box_Any_SSSE3(const uint8_t* src_ptr, 454 ptrdiff_t src_stride, 455 uint8_t* dst_ptr, 456 int dst_width); 457 void ScaleRowDown2Box_Odd_SSSE3(const uint8_t* src_ptr, 458 ptrdiff_t src_stride, 459 uint8_t* dst_ptr, 460 int dst_width); 461 void ScaleRowDown2_Any_AVX2(const uint8_t* src_ptr, 462 ptrdiff_t src_stride, 463 uint8_t* dst_ptr, 464 int dst_width); 465 void ScaleRowDown2Linear_Any_AVX2(const uint8_t* src_ptr, 466 ptrdiff_t src_stride, 467 uint8_t* dst_ptr, 468 int dst_width); 469 void ScaleRowDown2Box_Any_AVX2(const uint8_t* src_ptr, 470 ptrdiff_t src_stride, 471 uint8_t* dst_ptr, 472 int dst_width); 473 void ScaleRowDown2Box_Odd_AVX2(const uint8_t* src_ptr, 474 ptrdiff_t src_stride, 475 uint8_t* dst_ptr, 476 int dst_width); 477 void ScaleRowDown4_Any_SSSE3(const uint8_t* src_ptr, 478 ptrdiff_t src_stride, 479 uint8_t* dst_ptr, 480 int dst_width); 481 void ScaleRowDown4Box_Any_SSSE3(const uint8_t* src_ptr, 482 ptrdiff_t src_stride, 483 uint8_t* dst_ptr, 484 int dst_width); 485 void ScaleRowDown4_Any_AVX2(const uint8_t* src_ptr, 486 ptrdiff_t src_stride, 487 uint8_t* dst_ptr, 488 int dst_width); 489 void ScaleRowDown4Box_Any_AVX2(const uint8_t* src_ptr, 490 ptrdiff_t src_stride, 491 uint8_t* dst_ptr, 492 int dst_width); 493 494 void ScaleRowDown34_Any_SSSE3(const uint8_t* src_ptr, 495 ptrdiff_t src_stride, 496 uint8_t* dst_ptr, 497 int dst_width); 498 void ScaleRowDown34_1_Box_Any_SSSE3(const uint8_t* src_ptr, 499 ptrdiff_t src_stride, 500 uint8_t* dst_ptr, 501 int dst_width); 502 void ScaleRowDown34_0_Box_Any_SSSE3(const uint8_t* src_ptr, 503 ptrdiff_t src_stride, 504 uint8_t* dst_ptr, 505 int dst_width); 506 void ScaleRowDown38_Any_SSSE3(const uint8_t* src_ptr, 507 ptrdiff_t src_stride, 508 uint8_t* dst_ptr, 509 int dst_width); 510 void ScaleRowDown38_3_Box_Any_SSSE3(const uint8_t* src_ptr, 511 ptrdiff_t src_stride, 512 uint8_t* dst_ptr, 513 int dst_width); 514 void ScaleRowDown38_2_Box_Any_SSSE3(const uint8_t* src_ptr, 515 ptrdiff_t src_stride, 516 uint8_t* dst_ptr, 517 int dst_width); 518 519 void ScaleAddRow_SSE2(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width); 520 void ScaleAddRow_AVX2(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width); 521 void ScaleAddRow_Any_SSE2(const uint8_t* src_ptr, 522 uint16_t* dst_ptr, 523 int src_width); 524 void ScaleAddRow_Any_AVX2(const uint8_t* src_ptr, 525 uint16_t* dst_ptr, 526 int src_width); 527 528 void ScaleFilterCols_SSSE3(uint8_t* dst_ptr, 529 const uint8_t* src_ptr, 530 int dst_width, 531 int x, 532 int dx); 533 void ScaleColsUp2_SSE2(uint8_t* dst_ptr, 534 const uint8_t* src_ptr, 535 int dst_width, 536 int x, 537 int dx); 538 539 // ARGB Column functions 540 void ScaleARGBCols_SSE2(uint8_t* dst_argb, 541 const uint8_t* src_argb, 542 int dst_width, 543 int x, 544 int dx); 545 void ScaleARGBFilterCols_SSSE3(uint8_t* dst_argb, 546 const uint8_t* src_argb, 547 int dst_width, 548 int x, 549 int dx); 550 void ScaleARGBColsUp2_SSE2(uint8_t* dst_argb, 551 const uint8_t* src_argb, 552 int dst_width, 553 int x, 554 int dx); 555 void ScaleARGBFilterCols_NEON(uint8_t* dst_argb, 556 const uint8_t* src_argb, 557 int dst_width, 558 int x, 559 int dx); 560 void ScaleARGBCols_NEON(uint8_t* dst_argb, 561 const uint8_t* src_argb, 562 int dst_width, 563 int x, 564 int dx); 565 void ScaleARGBFilterCols_Any_NEON(uint8_t* dst_ptr, 566 const uint8_t* src_ptr, 567 int dst_width, 568 int x, 569 int dx); 570 void ScaleARGBCols_Any_NEON(uint8_t* dst_ptr, 571 const uint8_t* src_ptr, 572 int dst_width, 573 int x, 574 int dx); 575 void ScaleARGBFilterCols_MSA(uint8_t* dst_argb, 576 const uint8_t* src_argb, 577 int dst_width, 578 int x, 579 int dx); 580 void ScaleARGBCols_MSA(uint8_t* dst_argb, 581 const uint8_t* src_argb, 582 int dst_width, 583 int x, 584 int dx); 585 void ScaleARGBFilterCols_Any_MSA(uint8_t* dst_ptr, 586 const uint8_t* src_ptr, 587 int dst_width, 588 int x, 589 int dx); 590 void ScaleARGBCols_Any_MSA(uint8_t* dst_ptr, 591 const uint8_t* src_ptr, 592 int dst_width, 593 int x, 594 int dx); 595 void ScaleARGBCols_MMI(uint8_t* dst_argb, 596 const uint8_t* src_argb, 597 int dst_width, 598 int x, 599 int dx); 600 void ScaleARGBCols_Any_MMI(uint8_t* dst_ptr, 601 const uint8_t* src_ptr, 602 int dst_width, 603 int x, 604 int dx); 605 606 // ARGB Row functions 607 void ScaleARGBRowDown2_SSE2(const uint8_t* src_argb, 608 ptrdiff_t src_stride, 609 uint8_t* dst_argb, 610 int dst_width); 611 void ScaleARGBRowDown2Linear_SSE2(const uint8_t* src_argb, 612 ptrdiff_t src_stride, 613 uint8_t* dst_argb, 614 int dst_width); 615 void ScaleARGBRowDown2Box_SSE2(const uint8_t* src_argb, 616 ptrdiff_t src_stride, 617 uint8_t* dst_argb, 618 int dst_width); 619 void ScaleARGBRowDown2_NEON(const uint8_t* src_ptr, 620 ptrdiff_t src_stride, 621 uint8_t* dst, 622 int dst_width); 623 void ScaleARGBRowDown2Linear_NEON(const uint8_t* src_argb, 624 ptrdiff_t src_stride, 625 uint8_t* dst_argb, 626 int dst_width); 627 void ScaleARGBRowDown2Box_NEON(const uint8_t* src_ptr, 628 ptrdiff_t src_stride, 629 uint8_t* dst, 630 int dst_width); 631 void ScaleARGBRowDown2_MSA(const uint8_t* src_argb, 632 ptrdiff_t src_stride, 633 uint8_t* dst_argb, 634 int dst_width); 635 void ScaleARGBRowDown2Linear_MSA(const uint8_t* src_argb, 636 ptrdiff_t src_stride, 637 uint8_t* dst_argb, 638 int dst_width); 639 void ScaleARGBRowDown2Box_MSA(const uint8_t* src_argb, 640 ptrdiff_t src_stride, 641 uint8_t* dst_argb, 642 int dst_width); 643 void ScaleARGBRowDown2_MMI(const uint8_t* src_argb, 644 ptrdiff_t src_stride, 645 uint8_t* dst_argb, 646 int dst_width); 647 void ScaleARGBRowDown2Linear_MMI(const uint8_t* src_argb, 648 ptrdiff_t src_stride, 649 uint8_t* dst_argb, 650 int dst_width); 651 void ScaleARGBRowDown2Box_MMI(const uint8_t* src_argb, 652 ptrdiff_t src_stride, 653 uint8_t* dst_argb, 654 int dst_width); 655 void ScaleARGBRowDown2_Any_SSE2(const uint8_t* src_ptr, 656 ptrdiff_t src_stride, 657 uint8_t* dst_ptr, 658 int dst_width); 659 void ScaleARGBRowDown2Linear_Any_SSE2(const uint8_t* src_ptr, 660 ptrdiff_t src_stride, 661 uint8_t* dst_ptr, 662 int dst_width); 663 void ScaleARGBRowDown2Box_Any_SSE2(const uint8_t* src_ptr, 664 ptrdiff_t src_stride, 665 uint8_t* dst_ptr, 666 int dst_width); 667 void ScaleARGBRowDown2_Any_NEON(const uint8_t* src_ptr, 668 ptrdiff_t src_stride, 669 uint8_t* dst_ptr, 670 int dst_width); 671 void ScaleARGBRowDown2Linear_Any_NEON(const uint8_t* src_ptr, 672 ptrdiff_t src_stride, 673 uint8_t* dst_ptr, 674 int dst_width); 675 void ScaleARGBRowDown2Box_Any_NEON(const uint8_t* src_ptr, 676 ptrdiff_t src_stride, 677 uint8_t* dst_ptr, 678 int dst_width); 679 void ScaleARGBRowDown2_Any_MSA(const uint8_t* src_ptr, 680 ptrdiff_t src_stride, 681 uint8_t* dst_ptr, 682 int dst_width); 683 void ScaleARGBRowDown2Linear_Any_MSA(const uint8_t* src_ptr, 684 ptrdiff_t src_stride, 685 uint8_t* dst_ptr, 686 int dst_width); 687 void ScaleARGBRowDown2Box_Any_MSA(const uint8_t* src_ptr, 688 ptrdiff_t src_stride, 689 uint8_t* dst_ptr, 690 int dst_width); 691 void ScaleARGBRowDown2_Any_MMI(const uint8_t* src_ptr, 692 ptrdiff_t src_stride, 693 uint8_t* dst_ptr, 694 int dst_width); 695 void ScaleARGBRowDown2Linear_Any_MMI(const uint8_t* src_ptr, 696 ptrdiff_t src_stride, 697 uint8_t* dst_ptr, 698 int dst_width); 699 void ScaleARGBRowDown2Box_Any_MMI(const uint8_t* src_ptr, 700 ptrdiff_t src_stride, 701 uint8_t* dst_ptr, 702 int dst_width); 703 void ScaleARGBRowDownEven_SSE2(const uint8_t* src_argb, 704 ptrdiff_t src_stride, 705 int src_stepx, 706 uint8_t* dst_argb, 707 int dst_width); 708 void ScaleARGBRowDownEvenBox_SSE2(const uint8_t* src_argb, 709 ptrdiff_t src_stride, 710 int src_stepx, 711 uint8_t* dst_argb, 712 int dst_width); 713 void ScaleARGBRowDownEven_NEON(const uint8_t* src_argb, 714 ptrdiff_t src_stride, 715 int src_stepx, 716 uint8_t* dst_argb, 717 int dst_width); 718 void ScaleARGBRowDownEvenBox_NEON(const uint8_t* src_argb, 719 ptrdiff_t src_stride, 720 int src_stepx, 721 uint8_t* dst_argb, 722 int dst_width); 723 void ScaleARGBRowDownEven_MSA(const uint8_t* src_argb, 724 ptrdiff_t src_stride, 725 int32_t src_stepx, 726 uint8_t* dst_argb, 727 int dst_width); 728 void ScaleARGBRowDownEvenBox_MSA(const uint8_t* src_argb, 729 ptrdiff_t src_stride, 730 int src_stepx, 731 uint8_t* dst_argb, 732 int dst_width); 733 void ScaleARGBRowDownEven_MMI(const uint8_t* src_argb, 734 ptrdiff_t src_stride, 735 int32_t src_stepx, 736 uint8_t* dst_argb, 737 int dst_width); 738 void ScaleARGBRowDownEvenBox_MMI(const uint8_t* src_argb, 739 ptrdiff_t src_stride, 740 int src_stepx, 741 uint8_t* dst_argb, 742 int dst_width); 743 void ScaleARGBRowDownEven_Any_SSE2(const uint8_t* src_ptr, 744 ptrdiff_t src_stride, 745 int src_stepx, 746 uint8_t* dst_ptr, 747 int dst_width); 748 void ScaleARGBRowDownEvenBox_Any_SSE2(const uint8_t* src_ptr, 749 ptrdiff_t src_stride, 750 int src_stepx, 751 uint8_t* dst_ptr, 752 int dst_width); 753 void ScaleARGBRowDownEven_Any_NEON(const uint8_t* src_ptr, 754 ptrdiff_t src_stride, 755 int src_stepx, 756 uint8_t* dst_ptr, 757 int dst_width); 758 void ScaleARGBRowDownEvenBox_Any_NEON(const uint8_t* src_ptr, 759 ptrdiff_t src_stride, 760 int src_stepx, 761 uint8_t* dst_ptr, 762 int dst_width); 763 void ScaleARGBRowDownEven_Any_MSA(const uint8_t* src_ptr, 764 ptrdiff_t src_stride, 765 int32_t src_stepx, 766 uint8_t* dst_ptr, 767 int dst_width); 768 void ScaleARGBRowDownEvenBox_Any_MSA(const uint8_t* src_ptr, 769 ptrdiff_t src_stride, 770 int src_stepx, 771 uint8_t* dst_ptr, 772 int dst_width); 773 void ScaleARGBRowDownEven_Any_MMI(const uint8_t* src_ptr, 774 ptrdiff_t src_stride, 775 int32_t src_stepx, 776 uint8_t* dst_ptr, 777 int dst_width); 778 void ScaleARGBRowDownEvenBox_Any_MMI(const uint8_t* src_ptr, 779 ptrdiff_t src_stride, 780 int src_stepx, 781 uint8_t* dst_ptr, 782 int dst_width); 783 784 // ScaleRowDown2Box also used by planar functions 785 // NEON downscalers with interpolation. 786 787 // Note - not static due to reuse in convert for 444 to 420. 788 void ScaleRowDown2_NEON(const uint8_t* src_ptr, 789 ptrdiff_t src_stride, 790 uint8_t* dst, 791 int dst_width); 792 void ScaleRowDown2Linear_NEON(const uint8_t* src_ptr, 793 ptrdiff_t src_stride, 794 uint8_t* dst, 795 int dst_width); 796 void ScaleRowDown2Box_NEON(const uint8_t* src_ptr, 797 ptrdiff_t src_stride, 798 uint8_t* dst, 799 int dst_width); 800 801 void ScaleRowDown4_NEON(const uint8_t* src_ptr, 802 ptrdiff_t src_stride, 803 uint8_t* dst_ptr, 804 int dst_width); 805 void ScaleRowDown4Box_NEON(const uint8_t* src_ptr, 806 ptrdiff_t src_stride, 807 uint8_t* dst_ptr, 808 int dst_width); 809 810 // Down scale from 4 to 3 pixels. Use the neon multilane read/write 811 // to load up the every 4th pixel into a 4 different registers. 812 // Point samples 32 pixels to 24 pixels. 813 void ScaleRowDown34_NEON(const uint8_t* src_ptr, 814 ptrdiff_t src_stride, 815 uint8_t* dst_ptr, 816 int dst_width); 817 void ScaleRowDown34_0_Box_NEON(const uint8_t* src_ptr, 818 ptrdiff_t src_stride, 819 uint8_t* dst_ptr, 820 int dst_width); 821 void ScaleRowDown34_1_Box_NEON(const uint8_t* src_ptr, 822 ptrdiff_t src_stride, 823 uint8_t* dst_ptr, 824 int dst_width); 825 826 // 32 -> 12 827 void ScaleRowDown38_NEON(const uint8_t* src_ptr, 828 ptrdiff_t src_stride, 829 uint8_t* dst_ptr, 830 int dst_width); 831 // 32x3 -> 12x1 832 void ScaleRowDown38_3_Box_NEON(const uint8_t* src_ptr, 833 ptrdiff_t src_stride, 834 uint8_t* dst_ptr, 835 int dst_width); 836 // 32x2 -> 12x1 837 void ScaleRowDown38_2_Box_NEON(const uint8_t* src_ptr, 838 ptrdiff_t src_stride, 839 uint8_t* dst_ptr, 840 int dst_width); 841 842 void ScaleRowDown2_Any_NEON(const uint8_t* src_ptr, 843 ptrdiff_t src_stride, 844 uint8_t* dst_ptr, 845 int dst_width); 846 void ScaleRowDown2Linear_Any_NEON(const uint8_t* src_ptr, 847 ptrdiff_t src_stride, 848 uint8_t* dst_ptr, 849 int dst_width); 850 void ScaleRowDown2Box_Any_NEON(const uint8_t* src_ptr, 851 ptrdiff_t src_stride, 852 uint8_t* dst_ptr, 853 int dst_width); 854 void ScaleRowDown2Box_Odd_NEON(const uint8_t* src_ptr, 855 ptrdiff_t src_stride, 856 uint8_t* dst_ptr, 857 int dst_width); 858 void ScaleRowDown4_Any_NEON(const uint8_t* src_ptr, 859 ptrdiff_t src_stride, 860 uint8_t* dst_ptr, 861 int dst_width); 862 void ScaleRowDown4Box_Any_NEON(const uint8_t* src_ptr, 863 ptrdiff_t src_stride, 864 uint8_t* dst_ptr, 865 int dst_width); 866 void ScaleRowDown34_Any_NEON(const uint8_t* src_ptr, 867 ptrdiff_t src_stride, 868 uint8_t* dst_ptr, 869 int dst_width); 870 void ScaleRowDown34_0_Box_Any_NEON(const uint8_t* src_ptr, 871 ptrdiff_t src_stride, 872 uint8_t* dst_ptr, 873 int dst_width); 874 void ScaleRowDown34_1_Box_Any_NEON(const uint8_t* src_ptr, 875 ptrdiff_t src_stride, 876 uint8_t* dst_ptr, 877 int dst_width); 878 // 32 -> 12 879 void ScaleRowDown38_Any_NEON(const uint8_t* src_ptr, 880 ptrdiff_t src_stride, 881 uint8_t* dst_ptr, 882 int dst_width); 883 // 32x3 -> 12x1 884 void ScaleRowDown38_3_Box_Any_NEON(const uint8_t* src_ptr, 885 ptrdiff_t src_stride, 886 uint8_t* dst_ptr, 887 int dst_width); 888 // 32x2 -> 12x1 889 void ScaleRowDown38_2_Box_Any_NEON(const uint8_t* src_ptr, 890 ptrdiff_t src_stride, 891 uint8_t* dst_ptr, 892 int dst_width); 893 894 void ScaleAddRow_NEON(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width); 895 void ScaleAddRow_Any_NEON(const uint8_t* src_ptr, 896 uint16_t* dst_ptr, 897 int src_width); 898 899 void ScaleFilterCols_NEON(uint8_t* dst_ptr, 900 const uint8_t* src_ptr, 901 int dst_width, 902 int x, 903 int dx); 904 905 void ScaleFilterCols_Any_NEON(uint8_t* dst_ptr, 906 const uint8_t* src_ptr, 907 int dst_width, 908 int x, 909 int dx); 910 911 void ScaleRowDown2_MSA(const uint8_t* src_ptr, 912 ptrdiff_t src_stride, 913 uint8_t* dst, 914 int dst_width); 915 void ScaleRowDown2Linear_MSA(const uint8_t* src_ptr, 916 ptrdiff_t src_stride, 917 uint8_t* dst, 918 int dst_width); 919 void ScaleRowDown2Box_MSA(const uint8_t* src_ptr, 920 ptrdiff_t src_stride, 921 uint8_t* dst, 922 int dst_width); 923 void ScaleRowDown4_MSA(const uint8_t* src_ptr, 924 ptrdiff_t src_stride, 925 uint8_t* dst, 926 int dst_width); 927 void ScaleRowDown4Box_MSA(const uint8_t* src_ptr, 928 ptrdiff_t src_stride, 929 uint8_t* dst, 930 int dst_width); 931 void ScaleRowDown38_MSA(const uint8_t* src_ptr, 932 ptrdiff_t src_stride, 933 uint8_t* dst, 934 int dst_width); 935 void ScaleRowDown38_2_Box_MSA(const uint8_t* src_ptr, 936 ptrdiff_t src_stride, 937 uint8_t* dst_ptr, 938 int dst_width); 939 void ScaleRowDown38_3_Box_MSA(const uint8_t* src_ptr, 940 ptrdiff_t src_stride, 941 uint8_t* dst_ptr, 942 int dst_width); 943 void ScaleAddRow_MSA(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width); 944 void ScaleFilterCols_MSA(uint8_t* dst_ptr, 945 const uint8_t* src_ptr, 946 int dst_width, 947 int x, 948 int dx); 949 void ScaleRowDown34_MSA(const uint8_t* src_ptr, 950 ptrdiff_t src_stride, 951 uint8_t* dst, 952 int dst_width); 953 void ScaleRowDown34_0_Box_MSA(const uint8_t* src_ptr, 954 ptrdiff_t src_stride, 955 uint8_t* d, 956 int dst_width); 957 void ScaleRowDown34_1_Box_MSA(const uint8_t* src_ptr, 958 ptrdiff_t src_stride, 959 uint8_t* d, 960 int dst_width); 961 962 void ScaleRowDown2_Any_MSA(const uint8_t* src_ptr, 963 ptrdiff_t src_stride, 964 uint8_t* dst_ptr, 965 int dst_width); 966 void ScaleRowDown2Linear_Any_MSA(const uint8_t* src_ptr, 967 ptrdiff_t src_stride, 968 uint8_t* dst_ptr, 969 int dst_width); 970 void ScaleRowDown2Box_Any_MSA(const uint8_t* src_ptr, 971 ptrdiff_t src_stride, 972 uint8_t* dst_ptr, 973 int dst_width); 974 void ScaleRowDown4_Any_MSA(const uint8_t* src_ptr, 975 ptrdiff_t src_stride, 976 uint8_t* dst_ptr, 977 int dst_width); 978 void ScaleRowDown4Box_Any_MSA(const uint8_t* src_ptr, 979 ptrdiff_t src_stride, 980 uint8_t* dst_ptr, 981 int dst_width); 982 void ScaleRowDown38_Any_MSA(const uint8_t* src_ptr, 983 ptrdiff_t src_stride, 984 uint8_t* dst_ptr, 985 int dst_width); 986 void ScaleRowDown38_2_Box_Any_MSA(const uint8_t* src_ptr, 987 ptrdiff_t src_stride, 988 uint8_t* dst_ptr, 989 int dst_width); 990 void ScaleRowDown38_3_Box_Any_MSA(const uint8_t* src_ptr, 991 ptrdiff_t src_stride, 992 uint8_t* dst_ptr, 993 int dst_width); 994 void ScaleAddRow_Any_MSA(const uint8_t* src_ptr, 995 uint16_t* dst_ptr, 996 int src_width); 997 void ScaleFilterCols_Any_MSA(uint8_t* dst_ptr, 998 const uint8_t* src_ptr, 999 int dst_width, 1000 int x, 1001 int dx); 1002 void ScaleRowDown34_Any_MSA(const uint8_t* src_ptr, 1003 ptrdiff_t src_stride, 1004 uint8_t* dst_ptr, 1005 int dst_width); 1006 void ScaleRowDown34_0_Box_Any_MSA(const uint8_t* src_ptr, 1007 ptrdiff_t src_stride, 1008 uint8_t* dst_ptr, 1009 int dst_width); 1010 void ScaleRowDown34_1_Box_Any_MSA(const uint8_t* src_ptr, 1011 ptrdiff_t src_stride, 1012 uint8_t* dst_ptr, 1013 int dst_width); 1014 1015 void ScaleRowDown2_MMI(const uint8_t* src_ptr, 1016 ptrdiff_t src_stride, 1017 uint8_t* dst, 1018 int dst_width); 1019 void ScaleRowDown2_16_MMI(const uint16_t* src_ptr, 1020 ptrdiff_t src_stride, 1021 uint16_t* dst, 1022 int dst_width); 1023 void ScaleRowDown2Linear_MMI(const uint8_t* src_ptr, 1024 ptrdiff_t src_stride, 1025 uint8_t* dst, 1026 int dst_width); 1027 void ScaleRowDown2Linear_16_MMI(const uint16_t* src_ptr, 1028 ptrdiff_t src_stride, 1029 uint16_t* dst, 1030 int dst_width); 1031 void ScaleRowDown2Box_MMI(const uint8_t* src_ptr, 1032 ptrdiff_t src_stride, 1033 uint8_t* dst, 1034 int dst_width); 1035 void ScaleRowDown2Box_16_MMI(const uint16_t* src_ptr, 1036 ptrdiff_t src_stride, 1037 uint16_t* dst, 1038 int dst_width); 1039 void ScaleRowDown2Box_Odd_MMI(const uint8_t* src_ptr, 1040 ptrdiff_t src_stride, 1041 uint8_t* dst, 1042 int dst_width); 1043 void ScaleRowDown4_MMI(const uint8_t* src_ptr, 1044 ptrdiff_t src_stride, 1045 uint8_t* dst, 1046 int dst_width); 1047 void ScaleRowDown4_16_MMI(const uint16_t* src_ptr, 1048 ptrdiff_t src_stride, 1049 uint16_t* dst, 1050 int dst_width); 1051 void ScaleRowDown4Box_MMI(const uint8_t* src_ptr, 1052 ptrdiff_t src_stride, 1053 uint8_t* dst, 1054 int dst_width); 1055 void ScaleRowDown4Box_16_MMI(const uint16_t* src_ptr, 1056 ptrdiff_t src_stride, 1057 uint16_t* dst, 1058 int dst_width); 1059 void ScaleAddRow_MMI(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width); 1060 void ScaleAddRow_16_MMI(const uint16_t* src_ptr, 1061 uint32_t* dst_ptr, 1062 int src_width); 1063 void ScaleColsUp2_MMI(uint8_t* dst_ptr, 1064 const uint8_t* src_ptr, 1065 int dst_width, 1066 int x, 1067 int dx); 1068 void ScaleColsUp2_16_MMI(uint16_t* dst_ptr, 1069 const uint16_t* src_ptr, 1070 int dst_width, 1071 int x, 1072 int dx); 1073 void ScaleARGBColsUp2_MMI(uint8_t* dst_argb, 1074 const uint8_t* src_argb, 1075 int dst_width, 1076 int x, 1077 int dx); 1078 1079 void ScaleRowDown2_Any_MMI(const uint8_t* src_ptr, 1080 ptrdiff_t src_stride, 1081 uint8_t* dst_ptr, 1082 int dst_width); 1083 void ScaleRowDown2Linear_Any_MMI(const uint8_t* src_ptr, 1084 ptrdiff_t src_stride, 1085 uint8_t* dst_ptr, 1086 int dst_width); 1087 void ScaleRowDown2Box_Any_MMI(const uint8_t* src_ptr, 1088 ptrdiff_t src_stride, 1089 uint8_t* dst_ptr, 1090 int dst_width); 1091 void ScaleRowDown4_Any_MMI(const uint8_t* src_ptr, 1092 ptrdiff_t src_stride, 1093 uint8_t* dst_ptr, 1094 int dst_width); 1095 void ScaleRowDown4Box_Any_MMI(const uint8_t* src_ptr, 1096 ptrdiff_t src_stride, 1097 uint8_t* dst_ptr, 1098 int dst_width); 1099 void ScaleAddRow_Any_MMI(const uint8_t* src_ptr, 1100 uint16_t* dst_ptr, 1101 int src_width); 1102 #ifdef __cplusplus 1103 } // extern "C" 1104 } // namespace libyuv 1105 #endif 1106 1107 #endif // INCLUDE_LIBYUV_SCALE_ROW_H_ 1108