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 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 };
     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, 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, RotationMode mode);
     52 
     53 // Rotate planes by 90, 180, 270
     54 LIBYUV_API
     55 void RotatePlane90(const uint8* src, int src_stride,
     56                    uint8* dst, int dst_stride,
     57                    int width, int height);
     58 
     59 LIBYUV_API
     60 void RotatePlane180(const uint8* src, int src_stride,
     61                     uint8* dst, int dst_stride,
     62                     int width, int height);
     63 
     64 LIBYUV_API
     65 void RotatePlane270(const uint8* src, int src_stride,
     66                     uint8* dst, int dst_stride,
     67                     int width, int height);
     68 
     69 LIBYUV_API
     70 void RotateUV90(const uint8* src, int src_stride,
     71                 uint8* dst_a, int dst_stride_a,
     72                 uint8* dst_b, int dst_stride_b,
     73                 int width, int height);
     74 
     75 // Rotations for when U and V are interleaved.
     76 // These functions take one input pointer and
     77 // split the data into two buffers while
     78 // rotating them.
     79 LIBYUV_API
     80 void RotateUV180(const uint8* src, int src_stride,
     81                  uint8* dst_a, int dst_stride_a,
     82                  uint8* dst_b, int dst_stride_b,
     83                  int width, int height);
     84 
     85 LIBYUV_API
     86 void RotateUV270(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 // The 90 and 270 functions are based on transposes.
     92 // Doing a transpose with reversing the read/write
     93 // order will result in a rotation by +- 90 degrees.
     94 LIBYUV_API
     95 void TransposePlane(const uint8* src, int src_stride,
     96                     uint8* dst, int dst_stride,
     97                     int width, int height);
     98 
     99 LIBYUV_API
    100 void TransposeUV(const uint8* src, int src_stride,
    101                  uint8* dst_a, int dst_stride_a,
    102                  uint8* dst_b, int dst_stride_b,
    103                  int width, int height);
    104 
    105 #ifdef __cplusplus
    106 }  // extern "C"
    107 }  // namespace libyuv
    108 #endif
    109 
    110 #endif  // INCLUDE_LIBYUV_ROTATE_H_  NOLINT
    111