| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2012 The WebRTC 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 /* | |
| 12 * Interface to the LibYuv scaling functionality | |
| 13 */ | |
| 14 | |
| 15 #ifndef WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_SCALER_H_ | |
| 16 #define WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_SCALER_H_ | |
| 17 | |
| 18 #include "webrtc/common_video/include/i420_buffer_pool.h" | |
| 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | |
| 20 #include "webrtc/typedefs.h" | |
| 21 #include "webrtc/video_frame.h" | |
| 22 | |
| 23 namespace webrtc { | |
| 24 | |
| 25 // Supported scaling types | |
| 26 // Note: Must have the same values as libyuv::FilterMode. | |
| 27 enum ScaleMethod { | |
| 28 kScalePoint, // no interpolation | |
| 29 kFilterLinear, | |
| 30 kScaleBilinear, | |
| 31 kScaleBox | |
| 32 }; | |
| 33 | |
| 34 class Scaler { | |
| 35 public: | |
| 36 Scaler(); | |
| 37 ~Scaler(); | |
| 38 | |
| 39 // Set interpolation properties: | |
| 40 // | |
| 41 // Return value: 0 - OK | |
| 42 // -1 - parameter error | |
| 43 int Set(int src_width, int src_height, | |
| 44 int dst_width, int dst_height, | |
| 45 VideoType src_video_type, VideoType dst_video_type, | |
| 46 ScaleMethod method); | |
| 47 | |
| 48 // Scale frame | |
| 49 // Memory is allocated by this object and recycled using |buffer_pool_|. | |
| 50 // Return value: 0 - OK, | |
| 51 // -1 - parameter error | |
| 52 // -2 - scaler not set | |
| 53 int Scale(const VideoFrame& src_frame, VideoFrame* dst_frame); | |
| 54 | |
| 55 private: | |
| 56 // Determine if the VideoTypes are currently supported. | |
| 57 bool SupportedVideoType(VideoType src_video_type, | |
| 58 VideoType dst_video_type); | |
| 59 | |
| 60 ScaleMethod method_; | |
| 61 int src_width_; | |
| 62 int src_height_; | |
| 63 int dst_width_; | |
| 64 int dst_height_; | |
| 65 bool set_; | |
| 66 I420BufferPool buffer_pool_; | |
| 67 }; | |
| 68 | |
| 69 } // namespace webrtc | |
| 70 | |
| 71 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_SCALER_H_ | |
| OLD | NEW |