Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Unified Diff: webrtc/modules/video_processing/spatial_resampler.cc

Issue 2020593002: Refactor scaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Clarify some comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_processing/spatial_resampler.cc
diff --git a/webrtc/modules/video_processing/spatial_resampler.cc b/webrtc/modules/video_processing/spatial_resampler.cc
index cdbe0efac14cf285daeb20b1aa8edb2cfb3b7192..62c3d380e9bf085d3c64d0e068d38a8d1dbe4583 100644
--- a/webrtc/modules/video_processing/spatial_resampler.cc
+++ b/webrtc/modules/video_processing/spatial_resampler.cc
@@ -13,10 +13,7 @@
namespace webrtc {
VPMSimpleSpatialResampler::VPMSimpleSpatialResampler()
- : resampling_mode_(kFastRescaling),
- target_width_(0),
- target_height_(0),
- scaler_() {}
+ : resampling_mode_(kFastRescaling), target_width_(0), target_height_(0) {}
VPMSimpleSpatialResampler::~VPMSimpleSpatialResampler() {}
@@ -56,26 +53,17 @@ int32_t VPMSimpleSpatialResampler::ResampleFrame(const VideoFrame& inFrame,
return VPM_OK;
}
- // Setting scaler
- // TODO(mikhal/marpan): Should we allow for setting the filter mode in
- // _scale.Set() with |resampling_mode_|?
- int ret_val = 0;
- ret_val = scaler_.Set(inFrame.width(), inFrame.height(), target_width_,
- target_height_, kI420, kI420, kScaleBox);
- if (ret_val < 0)
- return ret_val;
+ rtc::scoped_refptr<I420Buffer> scaled(buffer_pool_.CreateBuffer
+ (target_width_, target_height_));
- ret_val = scaler_.Scale(inFrame, outFrame);
+ I420Buffer::CenterCropAndScale(scaled, inFrame.video_frame_buffer());
nisse-webrtc 2016/06/02 12:17:50 Not sure if this call needs cropping? The target s
+ outFrame->set_video_frame_buffer(scaled);
// Setting time parameters to the output frame.
- // Timestamp will be reset in Scale call above, so we should set it after.
outFrame->set_timestamp(inFrame.timestamp());
outFrame->set_render_time_ms(inFrame.render_time_ms());
- if (ret_val == 0)
- return VPM_OK;
- else
- return VPM_SCALE_ERROR;
+ return VPM_OK;
}
int32_t VPMSimpleSpatialResampler::TargetHeight() {

Powered by Google App Engine
This is Rietveld 408576698