webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
scale.h
Go to the documentation of this file.
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_
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.
28 
29 // Scale a YUV plane.
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 
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 
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 
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,
73  int dst_width, int dst_height,
74  enum FilterMode filtering);
75 
76 #ifdef __cplusplus
77 // Legacy API. Deprecated.
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,
84  int dst_width, int dst_height,
85  LIBYUV_BOOL interpolate);
86 
87 // Legacy API. Deprecated.
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.
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_
uint8_t * dst_v
Definition: peerconnection_jni.cc:2274
LIBYUV_API void ScalePlane_16(const uint16 *src, int src_stride, int src_width, int src_height, uint16 *dst, int dst_stride, int dst_width, int dst_height, enum FilterMode filtering)
Definition: scale.cc:1461
FilterMode
Definition: scale.h:22
LIBYUV_API void ScalePlane(const uint8 *src, int src_stride, int src_width, int src_height, uint8 *dst, int dst_stride, int dst_width, int dst_height, enum FilterMode filtering)
Definition: scale.cc:1380
jobject jint jint jint jobject jint dst_stride
Definition: peerconnection_jni.cc:2184
enum FilterMode FilterModeEnum
Definition: scale.h:25
uint8_t * dst_y
Definition: peerconnection_jni.cc:2270
unsigned char uint8
Definition: basic_types.h:62
int dst_height
Definition: convert.cc:32
GLenum GLenum dst
Definition: gl2ext.h:304
LIBYUV_API int ScaleOffset(const uint8 *src, int src_width, int src_height, uint8 *dst, int dst_width, int dst_height, int dst_yoffset, LIBYUV_BOOL interpolate)
Definition: scale.cc:1631
uint8_t * src_u
Definition: peerconnection_jni.cc:2263
uint8_t * src_y
Definition: peerconnection_jni.cc:2261
#define LIBYUV_BOOL
Definition: basic_types.h:106
GLenum src
Definition: gl2ext.h:304
size_t dst_stride_v
Definition: peerconnection_jni.cc:2275
LIBYUV_API int I420Scale_16(const uint16 *src_y, int src_stride_y, const uint16 *src_u, int src_stride_u, const uint16 *src_v, int src_stride_v, int src_width, int src_height, uint16 *dst_y, int dst_stride_y, uint16 *dst_u, int dst_stride_u, uint16 *dst_v, int dst_stride_v, int dst_width, int dst_height, enum FilterMode filtering)
Definition: scale.cc:1578
Definition: basictypes_test.cc:14
int dst_width
Definition: convert.cc:32
#define LIBYUV_API
Definition: basic_types.h:102
size_t dst_stride_u
Definition: peerconnection_jni.cc:2273
unsigned short uint16
Definition: basic_types.h:60
Definition: scale.h:24
uint8_t * dst_u
Definition: peerconnection_jni.cc:2272
DOMString use
Definition: WebCryptoAPI.idl:102
size_t dst_stride_y
Definition: peerconnection_jni.cc:2271
uint8_t * src_v
Definition: peerconnection_jni.cc:2265
Definition: scale.h:26
LIBYUV_API int I420Scale(const uint8 *src_y, int src_stride_y, const uint8 *src_u, int src_stride_u, const uint8 *src_v, int src_stride_v, int src_width, int src_height, uint8 *dst_y, int dst_stride_y, uint8 *dst_u, int dst_stride_u, uint8 *dst_v, int dst_stride_v, int dst_width, int dst_height, enum FilterMode filtering)
Definition: scale.cc:1546
jobject jint jint jint src_stride
Definition: peerconnection_jni.cc:2183
Definition: scale.h:23