OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The LibYuv project authors. All Rights Reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef INCLUDE_LIBYUV_SCALE_H_ | 11 #ifndef INCLUDE_LIBYUV_SCALE_H_ // NOLINT |
12 #define INCLUDE_LIBYUV_SCALE_H_ | 12 #define INCLUDE_LIBYUV_SCALE_H_ |
13 | 13 |
14 #include "third_party/libyuv/include/libyuv/basic_types.h" | 14 #include "basic_types.h" |
15 | 15 |
16 #ifdef __cplusplus | 16 #ifdef __cplusplus |
17 namespace libyuv { | 17 namespace libyuv { |
18 extern "C" { | 18 extern "C" { |
19 #endif | 19 #endif |
20 | 20 |
21 // Supported filtering | 21 // Supported filtering. |
22 typedef enum { | 22 typedef enum FilterMode { |
23 kFilterNone = 0, // Point sample; Fastest | 23 kFilterNone = 0, // Point sample; Fastest. |
24 kFilterBilinear = 1, // Faster than box, but lower quality scaling down. | 24 kFilterLinear = 1, // Filter horizontally only. |
25 kFilterBox = 2 // Highest quality | 25 kFilterBilinear = 2, // Faster than box, but lower quality scaling down. |
| 26 kFilterBox = 3 // Highest quality. |
26 } FilterModeEnum; | 27 } FilterModeEnum; |
27 | 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 void ScalePlane_16(const uint16* src, int src_stride, |
| 38 int src_width, int src_height, |
| 39 uint16* dst, int dst_stride, |
| 40 int dst_width, int dst_height, |
| 41 enum FilterMode filtering); |
| 42 |
28 // Scales a YUV 4:2:0 image from the src width and height to the | 43 // Scales a YUV 4:2:0 image from the src width and height to the |
29 // dst width and height. | 44 // dst width and height. |
30 // If filtering is kFilterNone, a simple nearest-neighbor algorithm is | 45 // If filtering is kFilterNone, a simple nearest-neighbor algorithm is |
31 // used. This produces basic (blocky) quality at the fastest speed. | 46 // used. This produces basic (blocky) quality at the fastest speed. |
32 // If filtering is kFilterBilinear, interpolation is used to produce a better | 47 // If filtering is kFilterBilinear, interpolation is used to produce a better |
33 // quality image, at the expense of speed. | 48 // quality image, at the expense of speed. |
34 // If filtering is kFilterBox, averaging is used to produce ever better | 49 // If filtering is kFilterBox, averaging is used to produce ever better |
35 // quality image, at further expense of speed. | 50 // quality image, at further expense of speed. |
36 // Returns 0 if successful. | 51 // Returns 0 if successful. |
37 | 52 |
| 53 LIBYUV_API |
38 int I420Scale(const uint8* src_y, int src_stride_y, | 54 int I420Scale(const uint8* src_y, int src_stride_y, |
39 const uint8* src_u, int src_stride_u, | 55 const uint8* src_u, int src_stride_u, |
40 const uint8* src_v, int src_stride_v, | 56 const uint8* src_v, int src_stride_v, |
41 int src_width, int src_height, | 57 int src_width, int src_height, |
42 uint8* dst_y, int dst_stride_y, | 58 uint8* dst_y, int dst_stride_y, |
43 uint8* dst_u, int dst_stride_u, | 59 uint8* dst_u, int dst_stride_u, |
44 uint8* dst_v, int dst_stride_v, | 60 uint8* dst_v, int dst_stride_v, |
45 int dst_width, int dst_height, | 61 int dst_width, int dst_height, |
46 FilterModeEnum filtering); | 62 enum FilterMode filtering); |
47 | 63 |
48 // Legacy API. Deprecated | 64 LIBYUV_API |
| 65 int I420Scale_16(const uint16* src_y, int src_stride_y, |
| 66 const uint16* src_u, int src_stride_u, |
| 67 const uint16* src_v, int src_stride_v, |
| 68 int src_width, int src_height, |
| 69 uint16* dst_y, int dst_stride_y, |
| 70 uint16* dst_u, int dst_stride_u, |
| 71 uint16* dst_v, int dst_stride_v, |
| 72 int dst_width, int dst_height, |
| 73 enum FilterMode filtering); |
| 74 |
| 75 #ifdef __cplusplus |
| 76 // Legacy API. Deprecated. |
| 77 LIBYUV_API |
49 int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v, | 78 int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v, |
50 int src_stride_y, int src_stride_u, int src_stride_v, | 79 int src_stride_y, int src_stride_u, int src_stride_v, |
51 int src_width, int src_height, | 80 int src_width, int src_height, |
52 uint8* dst_y, uint8* dst_u, uint8* dst_v, | 81 uint8* dst_y, uint8* dst_u, uint8* dst_v, |
53 int dst_stride_y, int dst_stride_u, int dst_stride_v, | 82 int dst_stride_y, int dst_stride_u, int dst_stride_v, |
54 int dst_width, int dst_height, | 83 int dst_width, int dst_height, |
55 int interpolate); | 84 LIBYUV_BOOL interpolate); |
56 | 85 |
57 // Legacy API. Deprecated | 86 // Legacy API. Deprecated. |
58 int ScaleOffset(const uint8* src, int src_width, int src_height, | 87 LIBYUV_API |
59 uint8* dst, int dst_width, int dst_height, int dst_yoffset, | 88 int ScaleOffset(const uint8* src_i420, int src_width, int src_height, |
60 int interpolate); | 89 uint8* dst_i420, int dst_width, int dst_height, int dst_yoffset, |
| 90 LIBYUV_BOOL interpolate); |
61 | 91 |
62 // For testing, allow disabling of optimizations. | 92 // For testing, allow disabling of specialized scalers. |
63 void SetUseReferenceImpl(int use); | 93 LIBYUV_API |
| 94 void SetUseReferenceImpl(LIBYUV_BOOL use); |
| 95 #endif // __cplusplus |
64 | 96 |
65 #ifdef __cplusplus | 97 #ifdef __cplusplus |
66 } // extern "C" | 98 } // extern "C" |
67 } // namespace libyuv | 99 } // namespace libyuv |
68 #endif | 100 #endif |
69 | 101 |
70 #endif // INCLUDE_LIBYUV_SCALE_H_ | 102 #endif // INCLUDE_LIBYUV_SCALE_H_ NOLINT |
OLD | NEW |