1/* 2 * Copyright (c) 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 "third_party/libyuv/include/libyuv/basic_types.h" 15 16#ifdef __cplusplus 17namespace libyuv { 18extern "C" { 19#endif 20 21// Supported filtering 22typedef enum { 23 kFilterNone = 0, // Point sample; Fastest 24 kFilterBilinear = 1, // Faster than box, but lower quality scaling down. 25 kFilterBox = 2 // Highest quality 26}FilterMode; 27 28// Scales a YUV 4:2:0 image from the src width and height to the 29// dst width and height. 30// If filtering is kFilterNone, a simple nearest-neighbor algorithm is 31// used. This produces basic (blocky) quality at the fastest speed. 32// If filtering is kFilterBilinear, interpolation is used to produce a better 33// quality image, at the expense of speed. 34// If filtering is kFilterBox, averaging is used to produce ever better 35// quality image, at further expense of speed. 36// Returns 0 if successful. 37 38int I420Scale(const uint8* src_y, int src_stride_y, 39 const uint8* src_u, int src_stride_u, 40 const uint8* src_v, int src_stride_v, 41 int src_width, int src_height, 42 uint8* dst_y, int dst_stride_y, 43 uint8* dst_u, int dst_stride_u, 44 uint8* dst_v, int dst_stride_v, 45 int dst_width, int dst_height, 46 FilterMode filtering); 47 48// Legacy API. Deprecated 49int 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, 51 int src_width, int src_height, 52 uint8* dst_y, uint8* dst_u, uint8* dst_v, 53 int dst_stride_y, int dst_stride_u, int dst_stride_v, 54 int dst_width, int dst_height, 55 int interpolate); 56 57// Legacy API. Deprecated 58int ScaleOffset(const uint8* src, int src_width, int src_height, 59 uint8* dst, int dst_width, int dst_height, int dst_yoffset, 60 int interpolate); 61 62// For testing, allow disabling of optimizations. 63void SetUseReferenceImpl(int use); 64 65#ifdef __cplusplus 66} // extern "C" 67} // namespace libyuv 68#endif 69 70#endif // INCLUDE_LIBYUV_SCALE_H_ 71