Home | History | Annotate | Download | only in libyuv
      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(__i386__) && !defined(__SSE2__))
     24 #define LIBYUV_DISABLE_X86
     25 #endif
     26 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
     27 #if defined(__has_feature)
     28 #if __has_feature(memory_sanitizer)
     29 #define LIBYUV_DISABLE_X86
     30 #endif
     31 #endif
     32 
     33 // GCC >= 4.7.0 required for AVX2.
     34 #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
     35 #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 7))
     36 #define GCC_HAS_AVX2 1
     37 #endif  // GNUC >= 4.7
     38 #endif  // __GNUC__
     39 
     40 // clang >= 3.4.0 required for AVX2.
     41 #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
     42 #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
     43 #define CLANG_HAS_AVX2 1
     44 #endif  // clang >= 3.4
     45 #endif  // __clang__
     46 
     47 // Visual C 2012 required for AVX2.
     48 #if defined(_M_IX86) && !defined(__clang__) && defined(_MSC_VER) && \
     49     _MSC_VER >= 1700
     50 #define VISUALC_HAS_AVX2 1
     51 #endif  // VisualStudio >= 2012
     52 
     53 // The following are available on all x86 platforms:
     54 #if !defined(LIBYUV_DISABLE_X86) && \
     55     (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
     56 #define HAS_FIXEDDIV1_X86
     57 #define HAS_FIXEDDIV_X86
     58 #define HAS_SCALEARGBCOLS_SSE2
     59 #define HAS_SCALEARGBCOLSUP2_SSE2
     60 #define HAS_SCALEARGBFILTERCOLS_SSSE3
     61 #define HAS_SCALEARGBROWDOWN2_SSE2
     62 #define HAS_SCALEARGBROWDOWNEVEN_SSE2
     63 #define HAS_SCALECOLSUP2_SSE2
     64 #define HAS_SCALEFILTERCOLS_SSSE3
     65 #define HAS_SCALEROWDOWN2_SSSE3
     66 #define HAS_SCALEROWDOWN34_SSSE3
     67 #define HAS_SCALEROWDOWN38_SSSE3
     68 #define HAS_SCALEROWDOWN4_SSSE3
     69 #define HAS_SCALEADDROW_SSE2
     70 #endif
     71 
     72 // The following are available on all x86 platforms, but
     73 // require VS2012, clang 3.4 or gcc 4.7.
     74 // The code supports NaCL but requires a new compiler and validator.
     75 #if !defined(LIBYUV_DISABLE_X86) &&                          \
     76     (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2) || \
     77      defined(GCC_HAS_AVX2))
     78 #define HAS_SCALEADDROW_AVX2
     79 #define HAS_SCALEROWDOWN2_AVX2
     80 #define HAS_SCALEROWDOWN4_AVX2
     81 #endif
     82 
     83 // The following are available on Neon platforms:
     84 #if !defined(LIBYUV_DISABLE_NEON) && !defined(__native_client__) && \
     85     (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
     86 #define HAS_SCALEARGBCOLS_NEON
     87 #define HAS_SCALEARGBROWDOWN2_NEON
     88 #define HAS_SCALEARGBROWDOWNEVEN_NEON
     89 #define HAS_SCALEFILTERCOLS_NEON
     90 #define HAS_SCALEROWDOWN2_NEON
     91 #define HAS_SCALEROWDOWN34_NEON
     92 #define HAS_SCALEROWDOWN38_NEON
     93 #define HAS_SCALEROWDOWN4_NEON
     94 #define HAS_SCALEARGBFILTERCOLS_NEON
     95 #endif
     96 
     97 // The following are available on Mips platforms:
     98 #if !defined(LIBYUV_DISABLE_DSPR2) && !defined(__native_client__) && \
     99     defined(__mips__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2)
    100 #define HAS_SCALEROWDOWN2_DSPR2
    101 #define HAS_SCALEROWDOWN4_DSPR2
    102 #define HAS_SCALEROWDOWN34_DSPR2
    103 #define HAS_SCALEROWDOWN38_DSPR2
    104 #define HAS_SCALEADDROW_DSPR2
    105 #endif
    106 
    107 #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
    108 #define HAS_SCALEARGBROWDOWN2_MSA
    109 #define HAS_SCALEARGBROWDOWNEVEN_MSA
    110 #define HAS_SCALEROWDOWN2_MSA
    111 #define HAS_SCALEROWDOWN4_MSA
    112 #define HAS_SCALEROWDOWN38_MSA
    113 #define HAS_SCALEADDROW_MSA
    114 #endif
    115 
    116 // Scale ARGB vertically with bilinear interpolation.
    117 void ScalePlaneVertical(int src_height,
    118                         int dst_width,
    119                         int dst_height,
    120                         int src_stride,
    121                         int dst_stride,
    122                         const uint8* src_argb,
    123                         uint8* dst_argb,
    124                         int x,
    125                         int y,
    126                         int dy,
    127                         int bpp,
    128                         enum FilterMode filtering);
    129 
    130 void ScalePlaneVertical_16(int src_height,
    131                            int dst_width,
    132                            int dst_height,
    133                            int src_stride,
    134                            int dst_stride,
    135                            const uint16* src_argb,
    136                            uint16* dst_argb,
    137                            int x,
    138                            int y,
    139                            int dy,
    140                            int wpp,
    141                            enum FilterMode filtering);
    142 
    143 // Simplify the filtering based on scale factors.
    144 enum FilterMode ScaleFilterReduce(int src_width,
    145                                   int src_height,
    146                                   int dst_width,
    147                                   int dst_height,
    148                                   enum FilterMode filtering);
    149 
    150 // Divide num by div and return as 16.16 fixed point result.
    151 int FixedDiv_C(int num, int div);
    152 int FixedDiv_X86(int num, int div);
    153 // Divide num - 1 by div - 1 and return as 16.16 fixed point result.
    154 int FixedDiv1_C(int num, int div);
    155 int FixedDiv1_X86(int num, int div);
    156 #ifdef HAS_FIXEDDIV_X86
    157 #define FixedDiv FixedDiv_X86
    158 #define FixedDiv1 FixedDiv1_X86
    159 #else
    160 #define FixedDiv FixedDiv_C
    161 #define FixedDiv1 FixedDiv1_C
    162 #endif
    163 
    164 // Compute slope values for stepping.
    165 void ScaleSlope(int src_width,
    166                 int src_height,
    167                 int dst_width,
    168                 int dst_height,
    169                 enum FilterMode filtering,
    170                 int* x,
    171                 int* y,
    172                 int* dx,
    173                 int* dy);
    174 
    175 void ScaleRowDown2_C(const uint8* src_ptr,
    176                      ptrdiff_t src_stride,
    177                      uint8* dst,
    178                      int dst_width);
    179 void ScaleRowDown2_16_C(const uint16* src_ptr,
    180                         ptrdiff_t src_stride,
    181                         uint16* dst,
    182                         int dst_width);
    183 void ScaleRowDown2Linear_C(const uint8* src_ptr,
    184                            ptrdiff_t src_stride,
    185                            uint8* dst,
    186                            int dst_width);
    187 void ScaleRowDown2Linear_16_C(const uint16* src_ptr,
    188                               ptrdiff_t src_stride,
    189                               uint16* dst,
    190                               int dst_width);
    191 void ScaleRowDown2Box_C(const uint8* src_ptr,
    192                         ptrdiff_t src_stride,
    193                         uint8* dst,
    194                         int dst_width);
    195 void ScaleRowDown2Box_Odd_C(const uint8* src_ptr,
    196                             ptrdiff_t src_stride,
    197                             uint8* dst,
    198                             int dst_width);
    199 void ScaleRowDown2Box_16_C(const uint16* src_ptr,
    200                            ptrdiff_t src_stride,
    201                            uint16* dst,
    202                            int dst_width);
    203 void ScaleRowDown4_C(const uint8* src_ptr,
    204                      ptrdiff_t src_stride,
    205                      uint8* dst,
    206                      int dst_width);
    207 void ScaleRowDown4_16_C(const uint16* src_ptr,
    208                         ptrdiff_t src_stride,
    209                         uint16* dst,
    210                         int dst_width);
    211 void ScaleRowDown4Box_C(const uint8* src_ptr,
    212                         ptrdiff_t src_stride,
    213                         uint8* dst,
    214                         int dst_width);
    215 void ScaleRowDown4Box_16_C(const uint16* src_ptr,
    216                            ptrdiff_t src_stride,
    217                            uint16* dst,
    218                            int dst_width);
    219 void ScaleRowDown34_C(const uint8* src_ptr,
    220                       ptrdiff_t src_stride,
    221                       uint8* dst,
    222                       int dst_width);
    223 void ScaleRowDown34_16_C(const uint16* src_ptr,
    224                          ptrdiff_t src_stride,
    225                          uint16* dst,
    226                          int dst_width);
    227 void ScaleRowDown34_0_Box_C(const uint8* src_ptr,
    228                             ptrdiff_t src_stride,
    229                             uint8* d,
    230                             int dst_width);
    231 void ScaleRowDown34_0_Box_16_C(const uint16* src_ptr,
    232                                ptrdiff_t src_stride,
    233                                uint16* d,
    234                                int dst_width);
    235 void ScaleRowDown34_1_Box_C(const uint8* src_ptr,
    236                             ptrdiff_t src_stride,
    237                             uint8* d,
    238                             int dst_width);
    239 void ScaleRowDown34_1_Box_16_C(const uint16* src_ptr,
    240                                ptrdiff_t src_stride,
    241                                uint16* d,
    242                                int dst_width);
    243 void ScaleCols_C(uint8* dst_ptr,
    244                  const uint8* src_ptr,
    245                  int dst_width,
    246                  int x,
    247                  int dx);
    248 void ScaleCols_16_C(uint16* dst_ptr,
    249                     const uint16* src_ptr,
    250                     int dst_width,
    251                     int x,
    252                     int dx);
    253 void ScaleColsUp2_C(uint8* dst_ptr,
    254                     const uint8* src_ptr,
    255                     int dst_width,
    256                     int,
    257                     int);
    258 void ScaleColsUp2_16_C(uint16* dst_ptr,
    259                        const uint16* src_ptr,
    260                        int dst_width,
    261                        int,
    262                        int);
    263 void ScaleFilterCols_C(uint8* dst_ptr,
    264                        const uint8* src_ptr,
    265                        int dst_width,
    266                        int x,
    267                        int dx);
    268 void ScaleFilterCols_16_C(uint16* dst_ptr,
    269                           const uint16* src_ptr,
    270                           int dst_width,
    271                           int x,
    272                           int dx);
    273 void ScaleFilterCols64_C(uint8* dst_ptr,
    274                          const uint8* src_ptr,
    275                          int dst_width,
    276                          int x,
    277                          int dx);
    278 void ScaleFilterCols64_16_C(uint16* dst_ptr,
    279                             const uint16* src_ptr,
    280                             int dst_width,
    281                             int x,
    282                             int dx);
    283 void ScaleRowDown38_C(const uint8* src_ptr,
    284                       ptrdiff_t src_stride,
    285                       uint8* dst,
    286                       int dst_width);
    287 void ScaleRowDown38_16_C(const uint16* src_ptr,
    288                          ptrdiff_t src_stride,
    289                          uint16* dst,
    290                          int dst_width);
    291 void ScaleRowDown38_3_Box_C(const uint8* src_ptr,
    292                             ptrdiff_t src_stride,
    293                             uint8* dst_ptr,
    294                             int dst_width);
    295 void ScaleRowDown38_3_Box_16_C(const uint16* src_ptr,
    296                                ptrdiff_t src_stride,
    297                                uint16* dst_ptr,
    298                                int dst_width);
    299 void ScaleRowDown38_2_Box_C(const uint8* src_ptr,
    300                             ptrdiff_t src_stride,
    301                             uint8* dst_ptr,
    302                             int dst_width);
    303 void ScaleRowDown38_2_Box_16_C(const uint16* src_ptr,
    304                                ptrdiff_t src_stride,
    305                                uint16* dst_ptr,
    306                                int dst_width);
    307 void ScaleAddRow_C(const uint8* src_ptr, uint16* dst_ptr, int src_width);
    308 void ScaleAddRow_16_C(const uint16* src_ptr, uint32* dst_ptr, int src_width);
    309 void ScaleARGBRowDown2_C(const uint8* src_argb,
    310                          ptrdiff_t src_stride,
    311                          uint8* dst_argb,
    312                          int dst_width);
    313 void ScaleARGBRowDown2Linear_C(const uint8* src_argb,
    314                                ptrdiff_t src_stride,
    315                                uint8* dst_argb,
    316                                int dst_width);
    317 void ScaleARGBRowDown2Box_C(const uint8* src_argb,
    318                             ptrdiff_t src_stride,
    319                             uint8* dst_argb,
    320                             int dst_width);
    321 void ScaleARGBRowDownEven_C(const uint8* src_argb,
    322                             ptrdiff_t src_stride,
    323                             int src_stepx,
    324                             uint8* dst_argb,
    325                             int dst_width);
    326 void ScaleARGBRowDownEvenBox_C(const uint8* src_argb,
    327                                ptrdiff_t src_stride,
    328                                int src_stepx,
    329                                uint8* dst_argb,
    330                                int dst_width);
    331 void ScaleARGBCols_C(uint8* dst_argb,
    332                      const uint8* src_argb,
    333                      int dst_width,
    334                      int x,
    335                      int dx);
    336 void ScaleARGBCols64_C(uint8* dst_argb,
    337                        const uint8* src_argb,
    338                        int dst_width,
    339                        int x,
    340                        int dx);
    341 void ScaleARGBColsUp2_C(uint8* dst_argb,
    342                         const uint8* src_argb,
    343                         int dst_width,
    344                         int,
    345                         int);
    346 void ScaleARGBFilterCols_C(uint8* dst_argb,
    347                            const uint8* src_argb,
    348                            int dst_width,
    349                            int x,
    350                            int dx);
    351 void ScaleARGBFilterCols64_C(uint8* dst_argb,
    352                              const uint8* src_argb,
    353                              int dst_width,
    354                              int x,
    355                              int dx);
    356 
    357 // Specialized scalers for x86.
    358 void ScaleRowDown2_SSSE3(const uint8* src_ptr,
    359                          ptrdiff_t src_stride,
    360                          uint8* dst_ptr,
    361                          int dst_width);
    362 void ScaleRowDown2Linear_SSSE3(const uint8* src_ptr,
    363                                ptrdiff_t src_stride,
    364                                uint8* dst_ptr,
    365                                int dst_width);
    366 void ScaleRowDown2Box_SSSE3(const uint8* src_ptr,
    367                             ptrdiff_t src_stride,
    368                             uint8* dst_ptr,
    369                             int dst_width);
    370 void ScaleRowDown2_AVX2(const uint8* src_ptr,
    371                         ptrdiff_t src_stride,
    372                         uint8* dst_ptr,
    373                         int dst_width);
    374 void ScaleRowDown2Linear_AVX2(const uint8* src_ptr,
    375                               ptrdiff_t src_stride,
    376                               uint8* dst_ptr,
    377                               int dst_width);
    378 void ScaleRowDown2Box_AVX2(const uint8* src_ptr,
    379                            ptrdiff_t src_stride,
    380                            uint8* dst_ptr,
    381                            int dst_width);
    382 void ScaleRowDown4_SSSE3(const uint8* src_ptr,
    383                          ptrdiff_t src_stride,
    384                          uint8* dst_ptr,
    385                          int dst_width);
    386 void ScaleRowDown4Box_SSSE3(const uint8* src_ptr,
    387                             ptrdiff_t src_stride,
    388                             uint8* dst_ptr,
    389                             int dst_width);
    390 void ScaleRowDown4_AVX2(const uint8* src_ptr,
    391                         ptrdiff_t src_stride,
    392                         uint8* dst_ptr,
    393                         int dst_width);
    394 void ScaleRowDown4Box_AVX2(const uint8* src_ptr,
    395                            ptrdiff_t src_stride,
    396                            uint8* dst_ptr,
    397                            int dst_width);
    398 
    399 void ScaleRowDown34_SSSE3(const uint8* src_ptr,
    400                           ptrdiff_t src_stride,
    401                           uint8* dst_ptr,
    402                           int dst_width);
    403 void ScaleRowDown34_1_Box_SSSE3(const uint8* src_ptr,
    404                                 ptrdiff_t src_stride,
    405                                 uint8* dst_ptr,
    406                                 int dst_width);
    407 void ScaleRowDown34_0_Box_SSSE3(const uint8* src_ptr,
    408                                 ptrdiff_t src_stride,
    409                                 uint8* dst_ptr,
    410                                 int dst_width);
    411 void ScaleRowDown38_SSSE3(const uint8* src_ptr,
    412                           ptrdiff_t src_stride,
    413                           uint8* dst_ptr,
    414                           int dst_width);
    415 void ScaleRowDown38_3_Box_SSSE3(const uint8* src_ptr,
    416                                 ptrdiff_t src_stride,
    417                                 uint8* dst_ptr,
    418                                 int dst_width);
    419 void ScaleRowDown38_2_Box_SSSE3(const uint8* src_ptr,
    420                                 ptrdiff_t src_stride,
    421                                 uint8* dst_ptr,
    422                                 int dst_width);
    423 void ScaleRowDown2_Any_SSSE3(const uint8* src_ptr,
    424                              ptrdiff_t src_stride,
    425                              uint8* dst_ptr,
    426                              int dst_width);
    427 void ScaleRowDown2Linear_Any_SSSE3(const uint8* src_ptr,
    428                                    ptrdiff_t src_stride,
    429                                    uint8* dst_ptr,
    430                                    int dst_width);
    431 void ScaleRowDown2Box_Any_SSSE3(const uint8* src_ptr,
    432                                 ptrdiff_t src_stride,
    433                                 uint8* dst_ptr,
    434                                 int dst_width);
    435 void ScaleRowDown2Box_Odd_SSSE3(const uint8* src_ptr,
    436                                 ptrdiff_t src_stride,
    437                                 uint8* dst_ptr,
    438                                 int dst_width);
    439 void ScaleRowDown2_Any_AVX2(const uint8* src_ptr,
    440                             ptrdiff_t src_stride,
    441                             uint8* dst_ptr,
    442                             int dst_width);
    443 void ScaleRowDown2Linear_Any_AVX2(const uint8* src_ptr,
    444                                   ptrdiff_t src_stride,
    445                                   uint8* dst_ptr,
    446                                   int dst_width);
    447 void ScaleRowDown2Box_Any_AVX2(const uint8* src_ptr,
    448                                ptrdiff_t src_stride,
    449                                uint8* dst_ptr,
    450                                int dst_width);
    451 void ScaleRowDown2Box_Odd_AVX2(const uint8* src_ptr,
    452                                ptrdiff_t src_stride,
    453                                uint8* dst_ptr,
    454                                int dst_width);
    455 void ScaleRowDown4_Any_SSSE3(const uint8* src_ptr,
    456                              ptrdiff_t src_stride,
    457                              uint8* dst_ptr,
    458                              int dst_width);
    459 void ScaleRowDown4Box_Any_SSSE3(const uint8* src_ptr,
    460                                 ptrdiff_t src_stride,
    461                                 uint8* dst_ptr,
    462                                 int dst_width);
    463 void ScaleRowDown4_Any_AVX2(const uint8* src_ptr,
    464                             ptrdiff_t src_stride,
    465                             uint8* dst_ptr,
    466                             int dst_width);
    467 void ScaleRowDown4Box_Any_AVX2(const uint8* src_ptr,
    468                                ptrdiff_t src_stride,
    469                                uint8* dst_ptr,
    470                                int dst_width);
    471 
    472 void ScaleRowDown34_Any_SSSE3(const uint8* src_ptr,
    473                               ptrdiff_t src_stride,
    474                               uint8* dst_ptr,
    475                               int dst_width);
    476 void ScaleRowDown34_1_Box_Any_SSSE3(const uint8* src_ptr,
    477                                     ptrdiff_t src_stride,
    478                                     uint8* dst_ptr,
    479                                     int dst_width);
    480 void ScaleRowDown34_0_Box_Any_SSSE3(const uint8* src_ptr,
    481                                     ptrdiff_t src_stride,
    482                                     uint8* dst_ptr,
    483                                     int dst_width);
    484 void ScaleRowDown38_Any_SSSE3(const uint8* src_ptr,
    485                               ptrdiff_t src_stride,
    486                               uint8* dst_ptr,
    487                               int dst_width);
    488 void ScaleRowDown38_3_Box_Any_SSSE3(const uint8* src_ptr,
    489                                     ptrdiff_t src_stride,
    490                                     uint8* dst_ptr,
    491                                     int dst_width);
    492 void ScaleRowDown38_2_Box_Any_SSSE3(const uint8* src_ptr,
    493                                     ptrdiff_t src_stride,
    494                                     uint8* dst_ptr,
    495                                     int dst_width);
    496 
    497 void ScaleAddRow_SSE2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
    498 void ScaleAddRow_AVX2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
    499 void ScaleAddRow_Any_SSE2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
    500 void ScaleAddRow_Any_AVX2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
    501 
    502 void ScaleFilterCols_SSSE3(uint8* dst_ptr,
    503                            const uint8* src_ptr,
    504                            int dst_width,
    505                            int x,
    506                            int dx);
    507 void ScaleColsUp2_SSE2(uint8* dst_ptr,
    508                        const uint8* src_ptr,
    509                        int dst_width,
    510                        int x,
    511                        int dx);
    512 
    513 // ARGB Column functions
    514 void ScaleARGBCols_SSE2(uint8* dst_argb,
    515                         const uint8* src_argb,
    516                         int dst_width,
    517                         int x,
    518                         int dx);
    519 void ScaleARGBFilterCols_SSSE3(uint8* dst_argb,
    520                                const uint8* src_argb,
    521                                int dst_width,
    522                                int x,
    523                                int dx);
    524 void ScaleARGBColsUp2_SSE2(uint8* dst_argb,
    525                            const uint8* src_argb,
    526                            int dst_width,
    527                            int x,
    528                            int dx);
    529 void ScaleARGBFilterCols_NEON(uint8* dst_argb,
    530                               const uint8* src_argb,
    531                               int dst_width,
    532                               int x,
    533                               int dx);
    534 void ScaleARGBCols_NEON(uint8* dst_argb,
    535                         const uint8* src_argb,
    536                         int dst_width,
    537                         int x,
    538                         int dx);
    539 void ScaleARGBFilterCols_Any_NEON(uint8* dst_argb,
    540                                   const uint8* src_argb,
    541                                   int dst_width,
    542                                   int x,
    543                                   int dx);
    544 void ScaleARGBCols_Any_NEON(uint8* dst_argb,
    545                             const uint8* src_argb,
    546                             int dst_width,
    547                             int x,
    548                             int dx);
    549 
    550 // ARGB Row functions
    551 void ScaleARGBRowDown2_SSE2(const uint8* src_argb,
    552                             ptrdiff_t src_stride,
    553                             uint8* dst_argb,
    554                             int dst_width);
    555 void ScaleARGBRowDown2Linear_SSE2(const uint8* src_argb,
    556                                   ptrdiff_t src_stride,
    557                                   uint8* dst_argb,
    558                                   int dst_width);
    559 void ScaleARGBRowDown2Box_SSE2(const uint8* src_argb,
    560                                ptrdiff_t src_stride,
    561                                uint8* dst_argb,
    562                                int dst_width);
    563 void ScaleARGBRowDown2_NEON(const uint8* src_ptr,
    564                             ptrdiff_t src_stride,
    565                             uint8* dst,
    566                             int dst_width);
    567 void ScaleARGBRowDown2Linear_NEON(const uint8* src_argb,
    568                                   ptrdiff_t src_stride,
    569                                   uint8* dst_argb,
    570                                   int dst_width);
    571 void ScaleARGBRowDown2Box_NEON(const uint8* src_ptr,
    572                                ptrdiff_t src_stride,
    573                                uint8* dst,
    574                                int dst_width);
    575 void ScaleARGBRowDown2_MSA(const uint8_t* src_argb,
    576                            ptrdiff_t src_stride,
    577                            uint8_t* dst_argb,
    578                            int dst_width);
    579 void ScaleARGBRowDown2Linear_MSA(const uint8_t* src_argb,
    580                                  ptrdiff_t src_stride,
    581                                  uint8_t* dst_argb,
    582                                  int dst_width);
    583 void ScaleARGBRowDown2Box_MSA(const uint8_t* src_argb,
    584                               ptrdiff_t src_stride,
    585                               uint8_t* dst_argb,
    586                               int dst_width);
    587 void ScaleARGBRowDown2_Any_SSE2(const uint8* src_argb,
    588                                 ptrdiff_t src_stride,
    589                                 uint8* dst_argb,
    590                                 int dst_width);
    591 void ScaleARGBRowDown2Linear_Any_SSE2(const uint8* src_argb,
    592                                       ptrdiff_t src_stride,
    593                                       uint8* dst_argb,
    594                                       int dst_width);
    595 void ScaleARGBRowDown2Box_Any_SSE2(const uint8* src_argb,
    596                                    ptrdiff_t src_stride,
    597                                    uint8* dst_argb,
    598                                    int dst_width);
    599 void ScaleARGBRowDown2_Any_NEON(const uint8* src_ptr,
    600                                 ptrdiff_t src_stride,
    601                                 uint8* dst,
    602                                 int dst_width);
    603 void ScaleARGBRowDown2Linear_Any_NEON(const uint8* src_argb,
    604                                       ptrdiff_t src_stride,
    605                                       uint8* dst_argb,
    606                                       int dst_width);
    607 void ScaleARGBRowDown2Box_Any_NEON(const uint8* src_ptr,
    608                                    ptrdiff_t src_stride,
    609                                    uint8* dst,
    610                                    int dst_width);
    611 void ScaleARGBRowDown2_Any_MSA(const uint8_t* src_argb,
    612                                ptrdiff_t src_stride,
    613                                uint8_t* dst_argb,
    614                                int dst_width);
    615 void ScaleARGBRowDown2Linear_Any_MSA(const uint8_t* src_argb,
    616                                      ptrdiff_t src_stride,
    617                                      uint8_t* dst_argb,
    618                                      int dst_width);
    619 void ScaleARGBRowDown2Box_Any_MSA(const uint8_t* src_argb,
    620                                   ptrdiff_t src_stride,
    621                                   uint8_t* dst_argb,
    622                                   int dst_width);
    623 
    624 void ScaleARGBRowDownEven_SSE2(const uint8* src_argb,
    625                                ptrdiff_t src_stride,
    626                                int src_stepx,
    627                                uint8* dst_argb,
    628                                int dst_width);
    629 void ScaleARGBRowDownEvenBox_SSE2(const uint8* src_argb,
    630                                   ptrdiff_t src_stride,
    631                                   int src_stepx,
    632                                   uint8* dst_argb,
    633                                   int dst_width);
    634 void ScaleARGBRowDownEven_NEON(const uint8* src_argb,
    635                                ptrdiff_t src_stride,
    636                                int src_stepx,
    637                                uint8* dst_argb,
    638                                int dst_width);
    639 void ScaleARGBRowDownEvenBox_NEON(const uint8* src_argb,
    640                                   ptrdiff_t src_stride,
    641                                   int src_stepx,
    642                                   uint8* dst_argb,
    643                                   int dst_width);
    644 void ScaleARGBRowDownEven_MSA(const uint8_t* src_argb,
    645                               ptrdiff_t src_stride,
    646                               int32_t src_stepx,
    647                               uint8_t* dst_argb,
    648                               int dst_width);
    649 void ScaleARGBRowDownEvenBox_MSA(const uint8* src_argb,
    650                                  ptrdiff_t src_stride,
    651                                  int src_stepx,
    652                                  uint8* dst_argb,
    653                                  int dst_width);
    654 void ScaleARGBRowDownEven_Any_SSE2(const uint8* src_argb,
    655                                    ptrdiff_t src_stride,
    656                                    int src_stepx,
    657                                    uint8* dst_argb,
    658                                    int dst_width);
    659 void ScaleARGBRowDownEvenBox_Any_SSE2(const uint8* src_argb,
    660                                       ptrdiff_t src_stride,
    661                                       int src_stepx,
    662                                       uint8* dst_argb,
    663                                       int dst_width);
    664 void ScaleARGBRowDownEven_Any_NEON(const uint8* src_argb,
    665                                    ptrdiff_t src_stride,
    666                                    int src_stepx,
    667                                    uint8* dst_argb,
    668                                    int dst_width);
    669 void ScaleARGBRowDownEvenBox_Any_NEON(const uint8* src_argb,
    670                                       ptrdiff_t src_stride,
    671                                       int src_stepx,
    672                                       uint8* dst_argb,
    673                                       int dst_width);
    674 void ScaleARGBRowDownEven_Any_MSA(const uint8_t* src_argb,
    675                                   ptrdiff_t src_stride,
    676                                   int32_t src_stepx,
    677                                   uint8_t* dst_argb,
    678                                   int dst_width);
    679 void ScaleARGBRowDownEvenBox_Any_MSA(const uint8* src_argb,
    680                                      ptrdiff_t src_stride,
    681                                      int src_stepx,
    682                                      uint8* dst_argb,
    683                                      int dst_width);
    684 
    685 // ScaleRowDown2Box also used by planar functions
    686 // NEON downscalers with interpolation.
    687 
    688 // Note - not static due to reuse in convert for 444 to 420.
    689 void ScaleRowDown2_NEON(const uint8* src_ptr,
    690                         ptrdiff_t src_stride,
    691                         uint8* dst,
    692                         int dst_width);
    693 void ScaleRowDown2Linear_NEON(const uint8* src_ptr,
    694                               ptrdiff_t src_stride,
    695                               uint8* dst,
    696                               int dst_width);
    697 void ScaleRowDown2Box_NEON(const uint8* src_ptr,
    698                            ptrdiff_t src_stride,
    699                            uint8* dst,
    700                            int dst_width);
    701 
    702 void ScaleRowDown4_NEON(const uint8* src_ptr,
    703                         ptrdiff_t src_stride,
    704                         uint8* dst_ptr,
    705                         int dst_width);
    706 void ScaleRowDown4Box_NEON(const uint8* src_ptr,
    707                            ptrdiff_t src_stride,
    708                            uint8* dst_ptr,
    709                            int dst_width);
    710 
    711 // Down scale from 4 to 3 pixels. Use the neon multilane read/write
    712 //  to load up the every 4th pixel into a 4 different registers.
    713 // Point samples 32 pixels to 24 pixels.
    714 void ScaleRowDown34_NEON(const uint8* src_ptr,
    715                          ptrdiff_t src_stride,
    716                          uint8* dst_ptr,
    717                          int dst_width);
    718 void ScaleRowDown34_0_Box_NEON(const uint8* src_ptr,
    719                                ptrdiff_t src_stride,
    720                                uint8* dst_ptr,
    721                                int dst_width);
    722 void ScaleRowDown34_1_Box_NEON(const uint8* src_ptr,
    723                                ptrdiff_t src_stride,
    724                                uint8* dst_ptr,
    725                                int dst_width);
    726 
    727 // 32 -> 12
    728 void ScaleRowDown38_NEON(const uint8* src_ptr,
    729                          ptrdiff_t src_stride,
    730                          uint8* dst_ptr,
    731                          int dst_width);
    732 // 32x3 -> 12x1
    733 void ScaleRowDown38_3_Box_NEON(const uint8* src_ptr,
    734                                ptrdiff_t src_stride,
    735                                uint8* dst_ptr,
    736                                int dst_width);
    737 // 32x2 -> 12x1
    738 void ScaleRowDown38_2_Box_NEON(const uint8* src_ptr,
    739                                ptrdiff_t src_stride,
    740                                uint8* dst_ptr,
    741                                int dst_width);
    742 
    743 void ScaleRowDown2_Any_NEON(const uint8* src_ptr,
    744                             ptrdiff_t src_stride,
    745                             uint8* dst,
    746                             int dst_width);
    747 void ScaleRowDown2Linear_Any_NEON(const uint8* src_ptr,
    748                                   ptrdiff_t src_stride,
    749                                   uint8* dst,
    750                                   int dst_width);
    751 void ScaleRowDown2Box_Any_NEON(const uint8* src_ptr,
    752                                ptrdiff_t src_stride,
    753                                uint8* dst,
    754                                int dst_width);
    755 void ScaleRowDown2Box_Odd_NEON(const uint8* src_ptr,
    756                                ptrdiff_t src_stride,
    757                                uint8* dst,
    758                                int dst_width);
    759 void ScaleRowDown4_Any_NEON(const uint8* src_ptr,
    760                             ptrdiff_t src_stride,
    761                             uint8* dst_ptr,
    762                             int dst_width);
    763 void ScaleRowDown4Box_Any_NEON(const uint8* src_ptr,
    764                                ptrdiff_t src_stride,
    765                                uint8* dst_ptr,
    766                                int dst_width);
    767 void ScaleRowDown34_Any_NEON(const uint8* src_ptr,
    768                              ptrdiff_t src_stride,
    769                              uint8* dst_ptr,
    770                              int dst_width);
    771 void ScaleRowDown34_0_Box_Any_NEON(const uint8* src_ptr,
    772                                    ptrdiff_t src_stride,
    773                                    uint8* dst_ptr,
    774                                    int dst_width);
    775 void ScaleRowDown34_1_Box_Any_NEON(const uint8* src_ptr,
    776                                    ptrdiff_t src_stride,
    777                                    uint8* dst_ptr,
    778                                    int dst_width);
    779 // 32 -> 12
    780 void ScaleRowDown38_Any_NEON(const uint8* src_ptr,
    781                              ptrdiff_t src_stride,
    782                              uint8* dst_ptr,
    783                              int dst_width);
    784 // 32x3 -> 12x1
    785 void ScaleRowDown38_3_Box_Any_NEON(const uint8* src_ptr,
    786                                    ptrdiff_t src_stride,
    787                                    uint8* dst_ptr,
    788                                    int dst_width);
    789 // 32x2 -> 12x1
    790 void ScaleRowDown38_2_Box_Any_NEON(const uint8* src_ptr,
    791                                    ptrdiff_t src_stride,
    792                                    uint8* dst_ptr,
    793                                    int dst_width);
    794 
    795 void ScaleAddRow_NEON(const uint8* src_ptr, uint16* dst_ptr, int src_width);
    796 void ScaleAddRow_Any_NEON(const uint8* src_ptr, uint16* dst_ptr, int src_width);
    797 
    798 void ScaleFilterCols_NEON(uint8* dst_ptr,
    799                           const uint8* src_ptr,
    800                           int dst_width,
    801                           int x,
    802                           int dx);
    803 
    804 void ScaleFilterCols_Any_NEON(uint8* dst_ptr,
    805                               const uint8* src_ptr,
    806                               int dst_width,
    807                               int x,
    808                               int dx);
    809 
    810 void ScaleRowDown2_DSPR2(const uint8* src_ptr,
    811                          ptrdiff_t src_stride,
    812                          uint8* dst,
    813                          int dst_width);
    814 void ScaleRowDown2Box_DSPR2(const uint8* src_ptr,
    815                             ptrdiff_t src_stride,
    816                             uint8* dst,
    817                             int dst_width);
    818 void ScaleRowDown4_DSPR2(const uint8* src_ptr,
    819                          ptrdiff_t src_stride,
    820                          uint8* dst,
    821                          int dst_width);
    822 void ScaleRowDown4Box_DSPR2(const uint8* src_ptr,
    823                             ptrdiff_t src_stride,
    824                             uint8* dst,
    825                             int dst_width);
    826 void ScaleRowDown34_DSPR2(const uint8* src_ptr,
    827                           ptrdiff_t src_stride,
    828                           uint8* dst,
    829                           int dst_width);
    830 void ScaleRowDown34_0_Box_DSPR2(const uint8* src_ptr,
    831                                 ptrdiff_t src_stride,
    832                                 uint8* d,
    833                                 int dst_width);
    834 void ScaleRowDown34_1_Box_DSPR2(const uint8* src_ptr,
    835                                 ptrdiff_t src_stride,
    836                                 uint8* d,
    837                                 int dst_width);
    838 void ScaleRowDown38_DSPR2(const uint8* src_ptr,
    839                           ptrdiff_t src_stride,
    840                           uint8* dst,
    841                           int dst_width);
    842 void ScaleRowDown38_2_Box_DSPR2(const uint8* src_ptr,
    843                                 ptrdiff_t src_stride,
    844                                 uint8* dst_ptr,
    845                                 int dst_width);
    846 void ScaleRowDown38_3_Box_DSPR2(const uint8* src_ptr,
    847                                 ptrdiff_t src_stride,
    848                                 uint8* dst_ptr,
    849                                 int dst_width);
    850 void ScaleAddRow_DSPR2(const uint8* src_ptr, uint16* dst_ptr, int src_width);
    851 void ScaleAddRow_Any_DSPR2(const uint8* src_ptr,
    852                            uint16* dst_ptr,
    853                            int src_width);
    854 
    855 void ScaleRowDown2_MSA(const uint8_t* src_ptr,
    856                        ptrdiff_t src_stride,
    857                        uint8_t* dst,
    858                        int dst_width);
    859 void ScaleRowDown2Linear_MSA(const uint8_t* src_ptr,
    860                              ptrdiff_t src_stride,
    861                              uint8_t* dst,
    862                              int dst_width);
    863 void ScaleRowDown2Box_MSA(const uint8_t* src_ptr,
    864                           ptrdiff_t src_stride,
    865                           uint8_t* dst,
    866                           int dst_width);
    867 void ScaleRowDown4_MSA(const uint8_t* src_ptr,
    868                        ptrdiff_t src_stride,
    869                        uint8_t* dst,
    870                        int dst_width);
    871 void ScaleRowDown4Box_MSA(const uint8_t* src_ptr,
    872                           ptrdiff_t src_stride,
    873                           uint8_t* dst,
    874                           int dst_width);
    875 void ScaleRowDown38_MSA(const uint8_t* src_ptr,
    876                         ptrdiff_t src_stride,
    877                         uint8_t* dst,
    878                         int dst_width);
    879 void ScaleRowDown38_2_Box_MSA(const uint8_t* src_ptr,
    880                               ptrdiff_t src_stride,
    881                               uint8_t* dst_ptr,
    882                               int dst_width);
    883 void ScaleRowDown38_3_Box_MSA(const uint8_t* src_ptr,
    884                               ptrdiff_t src_stride,
    885                               uint8_t* dst_ptr,
    886                               int dst_width);
    887 void ScaleAddRow_MSA(const uint8_t* src_ptr, uint16_t* dst_ptr, int src_width);
    888 void ScaleRowDown2_Any_MSA(const uint8_t* src_ptr,
    889                            ptrdiff_t src_stride,
    890                            uint8_t* dst,
    891                            int dst_width);
    892 void ScaleRowDown2Linear_Any_MSA(const uint8_t* src_ptr,
    893                                  ptrdiff_t src_stride,
    894                                  uint8_t* dst,
    895                                  int dst_width);
    896 void ScaleRowDown2Box_Any_MSA(const uint8_t* src_ptr,
    897                               ptrdiff_t src_stride,
    898                               uint8_t* dst,
    899                               int dst_width);
    900 void ScaleRowDown4_Any_MSA(const uint8_t* src_ptr,
    901                            ptrdiff_t src_stride,
    902                            uint8_t* dst,
    903                            int dst_width);
    904 void ScaleRowDown4Box_Any_MSA(const uint8_t* src_ptr,
    905                               ptrdiff_t src_stride,
    906                               uint8_t* dst,
    907                               int dst_width);
    908 void ScaleRowDown38_Any_MSA(const uint8_t* src_ptr,
    909                             ptrdiff_t src_stride,
    910                             uint8_t* dst,
    911                             int dst_width);
    912 void ScaleRowDown38_2_Box_Any_MSA(const uint8_t* src_ptr,
    913                                   ptrdiff_t src_stride,
    914                                   uint8_t* dst_ptr,
    915                                   int dst_width);
    916 void ScaleRowDown38_3_Box_Any_MSA(const uint8_t* src_ptr,
    917                                   ptrdiff_t src_stride,
    918                                   uint8_t* dst_ptr,
    919                                   int dst_width);
    920 void ScaleAddRow_Any_MSA(const uint8_t* src_ptr,
    921                          uint16_t* dst_ptr,
    922                          int src_width);
    923 
    924 #ifdef __cplusplus
    925 }  // extern "C"
    926 }  // namespace libyuv
    927 #endif
    928 
    929 #endif  // INCLUDE_LIBYUV_SCALE_ROW_H_
    930