niklase@google.com | 77ae29b | 2011-05-30 11:22:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 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 | // This file implements a class that can be used for scaling frames. |
| 12 | #ifndef WEBRTC_MODULES_UTILITY_SOURCE_FRAME_SCALER_H_ |
| 13 | #define WEBRTC_MODULES_UTILITY_SOURCE_FRAME_SCALER_H_ |
| 14 | |
| 15 | #ifdef WEBRTC_MODULE_UTILITY_VIDEO |
| 16 | |
| 17 | #include "engine_configurations.h" |
| 18 | #include "module_common_types.h" |
| 19 | #include "typedefs.h" |
| 20 | |
| 21 | namespace webrtc |
| 22 | { |
| 23 | // TODO (perkj): add interpolator. Current implementation only support scaling |
| 24 | // (up or down) where the width and height are scaled by a constant factor 2-4. |
| 25 | // Also remove NO_INTERPOLATOR. |
| 26 | |
| 27 | // Disable usage of the old intertpolator implementation. |
| 28 | #define NO_INTERPOLATOR 1 |
| 29 | |
| 30 | |
| 31 | class VideoFrame; |
| 32 | class FrameScaler |
| 33 | { |
| 34 | public: |
| 35 | FrameScaler(); |
| 36 | ~FrameScaler(); |
| 37 | |
| 38 | // Re-size videoFrame so that it has the width outWidth and height |
| 39 | // outHeight. |
| 40 | WebRtc_Word32 ResizeFrameIfNeeded(VideoFrame& videoFrame, |
| 41 | WebRtc_UWord32 outWidth, |
| 42 | WebRtc_UWord32 outHeight); |
| 43 | private: |
| 44 | typedef WebRtc_Word8* VideoInterpolator; |
| 45 | VideoInterpolator*_ptrVideoInterpolator; |
| 46 | |
| 47 | VideoFrame _interpolatorBuffer; |
| 48 | WebRtc_UWord32 _outWidth; |
| 49 | WebRtc_UWord32 _outHeight; |
| 50 | WebRtc_UWord32 _inWidth; |
| 51 | WebRtc_UWord32 _inHeight; |
| 52 | |
| 53 | }; |
| 54 | #endif // WEBRTC_MODULE_UTILITY_VIDEO |
| 55 | } // namespace webrtc |
| 56 | #endif // WEBRTC_MODULES_UTILITY_SOURCE_FRAME_SCALER_H_ |