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                                          const int16 convert_table[1024][4]);
     33 
     34 MEDIA_EXPORT void ConvertYUVAToARGB_C(const uint8* yplane,
     35                                       const uint8* uplane,
     36                                       const uint8* vplane,
     37                                       const uint8* aplane,
     38                                       uint8* rgbframe,
     39                                       int width,
     40                                       int height,
     41                                       int ystride,
     42                                       int uvstride,
     43                                       int avstride,
     44                                       int rgbstride,
     45                                       YUVType yuv_type);
     46 
     47 MEDIA_EXPORT void ConvertYUVAToARGBRow_C(const uint8* yplane,
     48                                          const uint8* uplane,
     49                                          const uint8* vplane,
     50                                          const uint8* aplane,
     51                                          uint8* rgbframe,
     52                                          ptrdiff_t width,
     53                                          const int16 convert_table[1024][4]);
     54 
     55 MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane,
     56                                         const uint8* uplane,
     57                                         const uint8* vplane,
     58                                         uint8* rgbframe,
     59                                         int width,
     60                                         int height,
     61                                         int ystride,
     62                                         int uvstride,
     63                                         int rgbstride,
     64                                         YUVType yuv_type);
     65 
     66 MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane,
     67                                         const uint8* uplane,
     68                                         const uint8* vplane,
     69                                         const uint8* aplane,
     70                                         uint8* rgbframe,
     71                                         int width,
     72                                         int height,
     73                                         int ystride,
     74                                         int uvstride,
     75                                         int avstride,
     76                                         int rgbstride,
     77                                         YUVType yuv_type);
     78 
     79 MEDIA_EXPORT void ScaleYUVToRGB32Row_C(const uint8* y_buf,
     80                                        const uint8* u_buf,
     81                                        const uint8* v_buf,
     82                                        uint8* rgb_buf,
     83                                        ptrdiff_t width,
     84                                        ptrdiff_t source_dx,
     85                                        const int16 convert_table[1024][4]);
     86 
     87 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_C(
     88     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     const int16 convert_table[1024][4]);
     95 
     96 MEDIA_EXPORT void LinearScaleYUVToRGB32RowWithRange_C(
     97     const uint8* y_buf,
     98     const uint8* u_buf,
     99     const uint8* v_buf,
    100     uint8* rgb_buf,
    101     int dest_width,
    102     int source_x,
    103     int source_dx,
    104     const int16 convert_table[1024][4]);
    105 
    106 }  // namespace media
    107 
    108 // Assembly functions are declared without namespace.
    109 extern "C" {
    110 
    111 // We use ptrdiff_t instead of int for yasm routine parameters to portably
    112 // sign-extend int. On Win64, MSVC does not sign-extend the value in the stack
    113 // home of int function parameters, and yasm routines are unaware of this lack
    114 // of extension and fault.  ptrdiff_t is portably sign-extended and fixes this
    115 // issue on at least Win64.  The C-equivalent RowProc versions' prototypes
    116 // include the same change to ptrdiff_t to reuse the typedefs.
    117 
    118 MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane,
    119                                            const uint8* uplane,
    120                                            const uint8* vplane,
    121                                            const uint8* aplane,
    122                                            uint8* rgbframe,
    123                                            ptrdiff_t width,
    124                                            const int16 convert_table[1024][4]);
    125 
    126 MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane,
    127                                            const uint8* uplane,
    128                                            const uint8* vplane,
    129                                            uint8* rgbframe,
    130                                            ptrdiff_t width,
    131                                            const int16 convert_table[1024][4]);
    132 
    133 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf,
    134                                          const uint8* u_buf,
    135                                          const uint8* v_buf,
    136                                          uint8* rgb_buf,
    137                                          ptrdiff_t width,
    138                                          ptrdiff_t source_dx,
    139                                          const int16 convert_table[1024][4]);
    140 
    141 MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(
    142     const uint8* y_buf,
    143     const uint8* u_buf,
    144     const uint8* v_buf,
    145     uint8* rgb_buf,
    146     ptrdiff_t width,
    147     ptrdiff_t source_dx,
    148     const int16 convert_table[1024][4]);
    149 
    150 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(
    151     const uint8* y_buf,
    152     const uint8* u_buf,
    153     const uint8* v_buf,
    154     uint8* rgb_buf,
    155     ptrdiff_t width,
    156     ptrdiff_t source_dx,
    157     const int16 convert_table[1024][4]);
    158 
    159 MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX_X64(
    160     const uint8* y_buf,
    161     const uint8* u_buf,
    162     const uint8* v_buf,
    163     uint8* rgb_buf,
    164     ptrdiff_t width,
    165     ptrdiff_t source_dx,
    166     const int16 convert_table[1024][4]);
    167 
    168 }  // extern "C"
    169 
    170 #endif  // MEDIA_BASE_SIMD_CONVERT_YUV_TO_RGB_H_
    171