modules/video_processing: refactor interface->include + more.

Moved/renamed:
webrtc/modules/video_processing/main/interface -> webrtc/modules/video_processing/include
webrtc/modules/video_processing/main/source/* -> webrtc/modules/video_processing
webrtc/modules/video_processing/main/test/unit_test -> webrtc/modules/video_processing/test

No downstream code seems to use this module.

BUG=webrtc:5095
TESTED=git cl try -c --bot=android_compile_rel --bot=linux_compile_rel --bot=win_compile_rel --bot=mac_compile_rel --bot=ios_rel --bot=linux_gn_rel --bot=win_x64_gn_rel --bot=mac_x64_gn_rel --bot=android_gn_rel -m tryserver.webrtc
R=pbos@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1410663004 .

Cr-Commit-Position: refs/heads/master@{#10697}
diff --git a/webrtc/modules/video_processing/frame_preprocessor.cc b/webrtc/modules/video_processing/frame_preprocessor.cc
new file mode 100644
index 0000000..a3ec3c8
--- /dev/null
+++ b/webrtc/modules/video_processing/frame_preprocessor.cc
@@ -0,0 +1,136 @@
+/*
+ *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/video_processing/frame_preprocessor.h"
+
+namespace webrtc {
+
+VPMFramePreprocessor::VPMFramePreprocessor()
+    : content_metrics_(NULL),
+      resampled_frame_(),
+      enable_ca_(false),
+      frame_cnt_(0) {
+  spatial_resampler_ = new VPMSimpleSpatialResampler();
+  ca_ = new VPMContentAnalysis(true);
+  vd_ = new VPMVideoDecimator();
+}
+
+VPMFramePreprocessor::~VPMFramePreprocessor() {
+  Reset();
+  delete spatial_resampler_;
+  delete ca_;
+  delete vd_;
+}
+
+void  VPMFramePreprocessor::Reset() {
+  ca_->Release();
+  vd_->Reset();
+  content_metrics_ = NULL;
+  spatial_resampler_->Reset();
+  enable_ca_ = false;
+  frame_cnt_ = 0;
+}
+
+void  VPMFramePreprocessor::EnableTemporalDecimation(bool enable) {
+  vd_->EnableTemporalDecimation(enable);
+}
+
+void VPMFramePreprocessor::EnableContentAnalysis(bool enable) {
+  enable_ca_ = enable;
+}
+
+void  VPMFramePreprocessor::SetInputFrameResampleMode(
+    VideoFrameResampling resampling_mode) {
+  spatial_resampler_->SetInputFrameResampleMode(resampling_mode);
+}
+
+int32_t VPMFramePreprocessor::SetTargetResolution(
+    uint32_t width, uint32_t height, uint32_t frame_rate) {
+  if ( (width == 0) || (height == 0) || (frame_rate == 0)) {
+    return VPM_PARAMETER_ERROR;
+  }
+  int32_t ret_val = 0;
+  ret_val = spatial_resampler_->SetTargetFrameSize(width, height);
+
+  if (ret_val < 0) return ret_val;
+
+  vd_->SetTargetFramerate(frame_rate);
+  return VPM_OK;
+}
+
+void VPMFramePreprocessor::SetTargetFramerate(int frame_rate) {
+  if (frame_rate == -1) {
+    vd_->EnableTemporalDecimation(false);
+  } else {
+    vd_->EnableTemporalDecimation(true);
+    vd_->SetTargetFramerate(frame_rate);
+  }
+}
+
+void VPMFramePreprocessor::UpdateIncomingframe_rate() {
+  vd_->UpdateIncomingframe_rate();
+}
+
+uint32_t VPMFramePreprocessor::Decimatedframe_rate() {
+  return vd_->Decimatedframe_rate();
+}
+
+
+uint32_t VPMFramePreprocessor::DecimatedWidth() const {
+  return spatial_resampler_->TargetWidth();
+}
+
+
+uint32_t VPMFramePreprocessor::DecimatedHeight() const {
+  return spatial_resampler_->TargetHeight();
+}
+
+int32_t VPMFramePreprocessor::PreprocessFrame(const VideoFrame& frame,
+                                              VideoFrame** processed_frame) {
+  if (frame.IsZeroSize()) {
+    return VPM_PARAMETER_ERROR;
+  }
+
+  vd_->UpdateIncomingframe_rate();
+
+  if (vd_->DropFrame()) {
+    return 1;  // drop 1 frame
+  }
+
+  // Resizing incoming frame if needed. Otherwise, remains NULL.
+  // We are not allowed to resample the input frame (must make a copy of it).
+  *processed_frame = NULL;
+  if (spatial_resampler_->ApplyResample(frame.width(), frame.height()))  {
+    int32_t ret = spatial_resampler_->ResampleFrame(frame, &resampled_frame_);
+    if (ret != VPM_OK) return ret;
+    *processed_frame = &resampled_frame_;
+  }
+
+  // Perform content analysis on the frame to be encoded.
+  if (enable_ca_) {
+    // Compute new metrics every |kSkipFramesCA| frames, starting with
+    // the first frame.
+    if (frame_cnt_ % kSkipFrameCA == 0) {
+      if (*processed_frame == NULL)  {
+        content_metrics_ = ca_->ComputeContentMetrics(frame);
+      } else {
+        content_metrics_ = ca_->ComputeContentMetrics(resampled_frame_);
+      }
+    }
+    ++frame_cnt_;
+  }
+  return VPM_OK;
+}
+
+VideoContentMetrics* VPMFramePreprocessor::ContentMetrics() const {
+  return content_metrics_;
+}
+
+}  // namespace