Home | History | Annotate | Download | only in simd
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_
      6 #define MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "media/base/yuv_convert.h"
     10 
     11 namespace media {
     12 
     13 // These methods are exported for testing purposes only.  Library users should
     14 // only call the methods listed in yuv_convert.h.
     15 
     16 MEDIA_EXPORT void ConvertYUVToRGB32_C(const uint8* yplane,
     17                                       const uint8* uplane,
     18                                       const uint8* vplane,
     19                                       uint8* rgbframe,
     20                                       int width,
     21                                       int height,
     22                                       int ystride,
     23                                       int uvstride,
     24                                       int rgbstride,
     25                                       YUVType yuv_type);
     26 
     27 MEDIA_EXPORT void ConvertYUVToRGB32Row_C(const uint8* yplane,
     28                                          const uint8* uplane,
     29                                          const uint8* vplane,
     30                                          uint8* rgbframe,
     31                                          ptrdiff_t width);
     32 
     33 MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane,
     34                                       const uint8* uplane,
     35                                       const uint8* vplane,
     36                                       const uint8* aplane,
     37                                       uint8* rgbframe,
     38                                       int width,
     39                                       int height,
     40                                       int ystride,
     41                                       int uvstride,
     42                                       int avstride,
     43                                       int rgbstride,
     44                                       YUVType yuv_type);
     45 
     46 MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane,
     47                                          const uint8* uplane,
     48                                          const uint8* vplane,
     49                                          const uint8* aplane,
     50                                          uint8* rgbframe,
     51                                          ptrdiff_t width);
     52 
     53 MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane,
     54                                         const uint8* uplane,
     55                                         const uint8* vplane,
     56                                         uint8* rgbframe,
     57                                         int width,
     58                                         int height,
     59                                         int ystride,
     60                                         int uvstride,
     61                                         int rgbstride,
     62                                         YUVType yuv_type);
     63 
     64 MEDIA_EXPORT void ConvertYUVToRGB32_MMX(const uint8* yplane,
     65                                         const uint8* uplane,
     66                                         const uint8* vplane,
     67                                         uint8* rgbframe,
     68                                         int width,
     69                                         int height,
     70                                         int ystride,
     71                                         int uvstride,
     72                                         int rgbstride,
     73                                         YUVType yuv_type);
     74 
     75 MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane,
     76                                         const uint8* uplane,
     77                                         const uint8* vplane,
     78                                         const uint8* aplane,
     79                                         uint8* rgbframe,
     80                                         int width,
     81                                         int height,
     82                                         int ystride,
     83                                         int uvstride,
     84                                         int avstride,
     85                                         int rgbstride,
     86                                         YUVType yuv_type);
     87 
     88 MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf,
     89                                        const uint8* u_buf,
     90                                        const uint8* v_buf,
     91                                        uint8* rgb_buf,
     92                                        ptrdiff_t width,
     93                                        ptrdiff_t source_dx);
     94 
     95 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(const uint8* y_buf,
     96                                              const uint8* u_buf,
     97                                              const uint8* v_buf,
     98                                              uint8* rgb_buf,
     99                                              ptrdiff_t width,
    100                                              ptrdiff_t source_dx);
    101 
    102 MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C(const uint8* y_buf,
    103                                                       const uint8* u_buf,
    104                                                       const uint8* v_buf,
    105                                                       uint8* rgb_buf,
    106                                                       int dest_width,
    107                                                       int source_x,
    108                                                       int source_dx);
    109 
    110 }  // namespace media
    111 
    112 // Assembly functions are declared without namespace.
    113 extern "C" {
    114 
    115 // We use ptrdiff_t instead of int for yasm routine parameters to portably
    116 // sign-extend int. On Win64, MSVC does not sign-extend the value in the stack
    117 // home of int function parameters, and yasm routines are unaware of this lack
    118 // of extension and fault.  ptrdiff_t is portably sign-extended and fixes this
    119 // issue on at least Win64.  The C-equivalent RowProc versions' prototypes
    120 // include the same change to ptrdiff_t to reuse the typedefs.
    121 
    122 MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8* yplane,
    123                                            const uint8* uplane,
    124                                            const uint8* vplane,
    125                                            uint8* rgbframe,
    126                                            ptrdiff_t width);
    127 
    128 MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane,
    129                                            const uint8* uplane,
    130                                            const uint8* vplane,
    131                                            const uint8* aplane,
    132                                            uint8* rgbframe,
    133                                            ptrdiff_t width);
    134 
    135 MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane,
    136                                            const uint8* uplane,
    137                                            const uint8* vplane,
    138                                            uint8* rgbframe,
    139                                            ptrdiff_t width);
    140 
    141 MEDIA_EXPORT void ScaleYUVToRGB32Row_MMX(const uint8* y_buf,
    142                                          const uint8* u_buf,
    143                                          const uint8* v_buf,
    144                                          uint8* rgb_buf,
    145                                          ptrdiff_t width,
    146                                          ptrdiff_t source_dx);
    147 
    148 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf,
    149                                          const uint8* u_buf,
    150                                          const uint8* v_buf,
    151                                          uint8* rgb_buf,
    152                                          ptrdiff_t width,
    153                                          ptrdiff_t source_dx);
    154 
    155 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(const uint8* y_buf,
    156                                               const uint8* u_buf,
    157                                               const uint8* v_buf,
    158                                               uint8* rgb_buf,
    159                                               ptrdiff_t width,
    160                                               ptrdiff_t source_dx);
    161 
    162 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX(const uint8* y_buf,
    163                                                const uint8* u_buf,
    164                                                const uint8* v_buf,
    165                                                uint8* rgb_buf,
    166                                                ptrdiff_t width,
    167                                                ptrdiff_t source_dx);
    168 
    169 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf,
    170                                                const uint8* u_buf,
    171                                                const uint8* v_buf,
    172                                                uint8* rgb_buf,
    173                                                ptrdiff_t width,
    174                                                ptrdiff_t source_dx);
    175 
    176 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(const uint8* y_buf,
    177                                                    const uint8* u_buf,
    178                                                    const uint8* v_buf,
    179                                                    uint8* rgb_buf,
    180                                                    ptrdiff_t width,
    181                                                    ptrdiff_t source_dx);
    182 
    183 }  // extern "C"
    184 
    185 #endif  // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_
    186