blob: 51820e24e5ed8fd00f060d6523cc297a5e912d18 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
andrew@webrtc.orgc1354bd2012-07-27 18:21:16 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
Henrik Kjellander0f59a882015-11-18 22:31:24 +010011#ifndef WEBRTC_MODULES_VIDEO_PROCESSING_SPATIAL_RESAMPLER_H_
12#define WEBRTC_MODULES_VIDEO_PROCESSING_SPATIAL_RESAMPLER_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
pbos@webrtc.org6f3d8fc2013-05-27 14:12:16 +000014#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000015
Henrik Kjellanderff761fb2015-11-04 08:31:52 +010016#include "webrtc/modules/include/module_common_types.h"
Henrik Kjellander0f59a882015-11-18 22:31:24 +010017#include "webrtc/modules/video_processing/include/video_processing_defines.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000018
pbos@webrtc.org6f3d8fc2013-05-27 14:12:16 +000019#include "webrtc/common_video/libyuv/include/scaler.h"
20#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000021
22namespace webrtc {
23
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000024class VPMSpatialResampler {
25 public:
mflodman99ab9442015-12-07 22:54:50 -080026 virtual ~VPMSpatialResampler() {}
pbos@webrtc.org1ab45f62013-04-09 13:38:10 +000027 virtual int32_t SetTargetFrameSize(int32_t width, int32_t height) = 0;
mflodman99ab9442015-12-07 22:54:50 -080028 virtual void SetInputFrameResampleMode(
29 VideoFrameResampling resampling_mode) = 0;
mikhal@webrtc.org2ab104e2011-12-09 02:46:22 +000030 virtual void Reset() = 0;
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070031 virtual int32_t ResampleFrame(const VideoFrame& inFrame,
32 VideoFrame* outFrame) = 0;
pbos@webrtc.org1ab45f62013-04-09 13:38:10 +000033 virtual int32_t TargetWidth() = 0;
34 virtual int32_t TargetHeight() = 0;
35 virtual bool ApplyResample(int32_t width, int32_t height) = 0;
niklase@google.com470e71d2011-07-07 08:21:25 +000036};
37
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000038class VPMSimpleSpatialResampler : public VPMSpatialResampler {
39 public:
mikhal@webrtc.org2ab104e2011-12-09 02:46:22 +000040 VPMSimpleSpatialResampler();
41 ~VPMSimpleSpatialResampler();
pbos@webrtc.org1ab45f62013-04-09 13:38:10 +000042 virtual int32_t SetTargetFrameSize(int32_t width, int32_t height);
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000043 virtual void SetInputFrameResampleMode(VideoFrameResampling resampling_mode);
mikhal@webrtc.org2ab104e2011-12-09 02:46:22 +000044 virtual void Reset();
Miguel Casas-Sanchez47650702015-05-29 17:21:40 -070045 virtual int32_t ResampleFrame(const VideoFrame& inFrame,
46 VideoFrame* outFrame);
pbos@webrtc.org1ab45f62013-04-09 13:38:10 +000047 virtual int32_t TargetWidth();
48 virtual int32_t TargetHeight();
49 virtual bool ApplyResample(int32_t width, int32_t height);
niklase@google.com470e71d2011-07-07 08:21:25 +000050
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000051 private:
mflodman99ab9442015-12-07 22:54:50 -080052 VideoFrameResampling resampling_mode_;
53 int32_t target_width_;
54 int32_t target_height_;
55 Scaler scaler_;
niklase@google.com470e71d2011-07-07 08:21:25 +000056};
57
mikhal@webrtc.orgb43d8072013-10-03 16:42:41 +000058} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000059
Henrik Kjellander0f59a882015-11-18 22:31:24 +010060#endif // WEBRTC_MODULES_VIDEO_PROCESSING_SPATIAL_RESAMPLER_H_