Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / libyuv / include / libyuv / scale.h
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_SCALE_H_  // NOLINT
12 #define INCLUDE_LIBYUV_SCALE_H_
13
14 #include "libyuv/basic_types.h"
15
16 #ifdef __cplusplus
17 namespace libyuv {
18 extern "C" {
19 #endif
20
21 // Supported filtering.
22 typedef enum FilterMode {
23   kFilterNone = 0,  // Point sample; Fastest.
24   kFilterLinear = 1,  // Filter horizontally only.
25   kFilterBilinear = 2,  // Faster than box, but lower quality scaling down.
26   kFilterBox = 3  // Highest quality.
27 } FilterModeEnum;
28
29 // Scale a YUV plane.
30 LIBYUV_API
31 void ScalePlane(const uint8* src, int src_stride,
32                 int src_width, int src_height,
33                 uint8* dst, int dst_stride,
34                 int dst_width, int dst_height,
35                 enum FilterMode filtering);
36
37 LIBYUV_API
38 void ScalePlane_16(const uint16* src, int src_stride,
39                    int src_width, int src_height,
40                    uint16* dst, int dst_stride,
41                    int dst_width, int dst_height,
42                    enum FilterMode filtering);
43
44 // Scales a YUV 4:2:0 image from the src width and height to the
45 // dst width and height.
46 // If filtering is kFilterNone, a simple nearest-neighbor algorithm is
47 // used. This produces basic (blocky) quality at the fastest speed.
48 // If filtering is kFilterBilinear, interpolation is used to produce a better
49 // quality image, at the expense of speed.
50 // If filtering is kFilterBox, averaging is used to produce ever better
51 // quality image, at further expense of speed.
52 // Returns 0 if successful.
53
54 LIBYUV_API
55 int I420Scale(const uint8* src_y, int src_stride_y,
56               const uint8* src_u, int src_stride_u,
57               const uint8* src_v, int src_stride_v,
58               int src_width, int src_height,
59               uint8* dst_y, int dst_stride_y,
60               uint8* dst_u, int dst_stride_u,
61               uint8* dst_v, int dst_stride_v,
62               int dst_width, int dst_height,
63               enum FilterMode filtering);
64
65 LIBYUV_API
66 int I420Scale_16(const uint16* src_y, int src_stride_y,
67                  const uint16* src_u, int src_stride_u,
68                  const uint16* src_v, int src_stride_v,
69                  int src_width, int src_height,
70                  uint16* dst_y, int dst_stride_y,
71                  uint16* dst_u, int dst_stride_u,
72                  uint16* dst_v, int dst_stride_v,
73                  int dst_width, int dst_height,
74                  enum FilterMode filtering);
75
76 #ifdef __cplusplus
77 // Legacy API.  Deprecated.
78 LIBYUV_API
79 int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v,
80           int src_stride_y, int src_stride_u, int src_stride_v,
81           int src_width, int src_height,
82           uint8* dst_y, uint8* dst_u, uint8* dst_v,
83           int dst_stride_y, int dst_stride_u, int dst_stride_v,
84           int dst_width, int dst_height,
85           LIBYUV_BOOL interpolate);
86
87 // Legacy API.  Deprecated.
88 LIBYUV_API
89 int ScaleOffset(const uint8* src_i420, int src_width, int src_height,
90                 uint8* dst_i420, int dst_width, int dst_height, int dst_yoffset,
91                 LIBYUV_BOOL interpolate);
92
93 // For testing, allow disabling of specialized scalers.
94 LIBYUV_API
95 void SetUseReferenceImpl(LIBYUV_BOOL use);
96 #endif  // __cplusplus
97
98 #ifdef __cplusplus
99 }  // extern "C"
100 }  // namespace libyuv
101 #endif
102
103 #endif  // INCLUDE_LIBYUV_SCALE_H_  NOLINT