Home | History | Annotate | Download | only in libyuv
      1 /*
      2  *  Copyright 2011 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_ROTATE_H_  // NOLINT
     12 #define INCLUDE_LIBYUV_ROTATE_H_
     13 
     14 #include "libyuv/basic_types.h"
     15 
     16 #ifdef __cplusplus
     17 namespace libyuv {
     18 extern "C" {
     19 #endif
     20 
     21 // Supported rotation.
     22 typedef enum RotationMode {
     23   kRotate0 = 0,  // No rotation.
     24   kRotate90 = 90,  // Rotate 90 degrees clockwise.
     25   kRotate180 = 180,  // Rotate 180 degrees.
     26   kRotate270 = 270,  // Rotate 270 degrees clockwise.
     27 
     28   // Deprecated.
     29   kRotateNone = 0,
     30   kRotateClockwise = 90,
     31   kRotateCounterClockwise = 270,
     32 } RotationModeEnum;
     33 
     34 // Rotate I420 frame.
     35 LIBYUV_API
     36 int I420Rotate(const uint8* src_y, int src_stride_y,
     37                const uint8* src_u, int src_stride_u,
     38                const uint8* src_v, int src_stride_v,
     39                uint8* dst_y, int dst_stride_y,
     40                uint8* dst_u, int dst_stride_u,
     41                uint8* dst_v, int dst_stride_v,
     42                int src_width, int src_height, enum RotationMode mode);
     43 
     44 // Rotate NV12 input and store in I420.
     45 LIBYUV_API
     46 int NV12ToI420Rotate(const uint8* src_y, int src_stride_y,
     47                      const uint8* src_uv, int src_stride_uv,
     48                      uint8* dst_y, int dst_stride_y,
     49                      uint8* dst_u, int dst_stride_u,
     50                      uint8* dst_v, int dst_stride_v,
     51                      int src_width, int src_height, enum RotationMode mode);
     52 
     53 // Rotate a plane by 0, 90, 180, or 270.
     54 LIBYUV_API
     55 int RotatePlane(const uint8* src, int src_stride,
     56                 uint8* dst, int dst_stride,
     57                 int src_width, int src_height, enum RotationMode mode);
     58 
     59 // Rotate planes by 90, 180, 270. Deprecated.
     60 LIBYUV_API
     61 void RotatePlane90(const uint8* src, int src_stride,
     62                    uint8* dst, int dst_stride,
     63                    int width, int height);
     64 
     65 LIBYUV_API
     66 void RotatePlane180(const uint8* src, int src_stride,
     67                     uint8* dst, int dst_stride,
     68                     int width, int height);
     69 
     70 LIBYUV_API
     71 void RotatePlane270(const uint8* src, int src_stride,
     72                     uint8* dst, int dst_stride,
     73                     int width, int height);
     74 
     75 LIBYUV_API
     76 void RotateUV90(const uint8* src, int src_stride,
     77                 uint8* dst_a, int dst_stride_a,
     78                 uint8* dst_b, int dst_stride_b,
     79                 int width, int height);
     80 
     81 // Rotations for when U and V are interleaved.
     82 // These functions take one input pointer and
     83 // split the data into two buffers while
     84 // rotating them. Deprecated.
     85 LIBYUV_API
     86 void RotateUV180(const uint8* src, int src_stride,
     87                  uint8* dst_a, int dst_stride_a,
     88                  uint8* dst_b, int dst_stride_b,
     89                  int width, int height);
     90 
     91 LIBYUV_API
     92 void RotateUV270(const uint8* src, int src_stride,
     93                  uint8* dst_a, int dst_stride_a,
     94                  uint8* dst_b, int dst_stride_b,
     95                  int width, int height);
     96 
     97 // The 90 and 270 functions are based on transposes.
     98 // Doing a transpose with reversing the read/write
     99 // order will result in a rotation by +- 90 degrees.
    100 // Deprecated.
    101 LIBYUV_API
    102 void TransposePlane(const uint8* src, int src_stride,
    103                     uint8* dst, int dst_stride,
    104                     int width, int height);
    105 
    106 LIBYUV_API
    107 void TransposeUV(const uint8* src, int src_stride,
    108                  uint8* dst_a, int dst_stride_a,
    109                  uint8* dst_b, int dst_stride_b,
    110                  int width, int height);
    111 
    112 #ifdef __cplusplus
    113 }  // extern "C"
    114 }  // namespace libyuv
    115 #endif
    116 
    117 #endif  // INCLUDE_LIBYUV_ROTATE_H_  NOLINT
    118