Bug 1060249: disable frame motion/complexity analysis in webrtc on Gonk r=gcp
authorRandell Jesup <rjesup@jesup.org>
Fri, 29 Aug 2014 21:29:17 -0400
changeset 224194 d07a9cabc185cf3d16f9ba527127f813fcec8123
parent 224193 618e47b766b5bab4c98b8f90bef82a783c4ab589
child 224195 899bffa59af5a65f8d0e78a0ddaeab0264790be0
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgcp
bugs1060249
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1060249: disable frame motion/complexity analysis in webrtc on Gonk r=gcp
media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc
media/webrtc/trunk/webrtc/modules/video_processing/main/source/content_analysis.cc
--- a/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_coding/main/source/qm_select.cc
@@ -55,30 +55,40 @@ uint8_t VCMQmMethod::ComputeContentClass
   return content_class_ = 3 * motion_.level + spatial_.level;
 }
 
 void VCMQmMethod::UpdateContent(const VideoContentMetrics*  contentMetrics) {
   content_metrics_ = contentMetrics;
 }
 
 void VCMQmMethod::ComputeMotionNFD() {
+#if defined(WEBRTC_GONK)
+  motion_.value = (kHighMotionNfd + kLowMotionNfd)/2;
+  motion_.level = kDefault;
+#else
   if (content_metrics_) {
     motion_.value = content_metrics_->motion_magnitude;
   }
   // Determine motion level.
   if (motion_.value < kLowMotionNfd) {
     motion_.level = kLow;
   } else if (motion_.value > kHighMotionNfd) {
     motion_.level  = kHigh;
   } else {
     motion_.level = kDefault;
   }
+#endif
 }
 
 void VCMQmMethod::ComputeSpatial() {
+#if defined(WEBRTC_GONK)
+  float scale2 = image_type_ > kVGA ? kScaleTexture : 1.0;
+  spatial_.value = (kHighTexture + kLowTexture)*scale2/2;
+  spatial_.level = kDefault;
+#else
   float spatial_err = 0.0;
   float spatial_err_h = 0.0;
   float spatial_err_v = 0.0;
   if (content_metrics_) {
     spatial_err =  content_metrics_->spatial_pred_err;
     spatial_err_h = content_metrics_->spatial_pred_err_h;
     spatial_err_v = content_metrics_->spatial_pred_err_v;
   }
@@ -90,16 +100,17 @@ void VCMQmMethod::ComputeSpatial() {
 
   if (spatial_.value > scale2 * kHighTexture) {
     spatial_.level = kHigh;
   } else if (spatial_.value < scale2 * kLowTexture) {
     spatial_.level = kLow;
   } else {
     spatial_.level = kDefault;
   }
+#endif
 }
 
 ImageType VCMQmMethod::GetImageType(uint16_t width,
                                     uint16_t height) {
   // Get the image type for the encoder frame size.
   uint32_t image_size = width * height;
   if (image_size == kSizeOfImageType[kQCIF]) {
     return kQCIF;
--- a/media/webrtc/trunk/webrtc/modules/video_processing/main/source/content_analysis.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_processing/main/source/content_analysis.cc
@@ -53,16 +53,17 @@ VideoContentMetrics* VPMContentAnalysis:
   if (inputFrame.IsZeroSize())
     return NULL;
 
   // Init if needed (native dimension change).
   if (width_ != inputFrame.width() || height_ != inputFrame.height()) {
     if (VPM_OK != Initialize(inputFrame.width(), inputFrame.height()))
       return NULL;
   }
+#if !defined(WEBRTC_GONK)
   // Compute motion metrics
   if (ca_Init_) {
     // Only interested in the Y plane.
     orig_frame_ = inputFrame.buffer(kYPlane);
 
     // Compute spatial metrics: 3 spatial prediction errors.
     (this->*ComputeSpatialMetrics)();
 
@@ -70,16 +71,17 @@ VideoContentMetrics* VPMContentAnalysis:
       ComputeMotionMetrics();
     }
 
     // Saving current frame as previous one: Y only.
     memcpy(prev_frame_.get(), orig_frame_, width_ * height_);
 
     first_frame_ =  false;
   }
+#endif
 
   return ContentMetrics();
 }
 
 int32_t VPMContentAnalysis::Release() {
   content_metrics_.reset(NULL);
   prev_frame_.reset(NULL);
 
@@ -118,20 +120,22 @@ int32_t VPMContentAnalysis::Initialize(i
     return VPM_PARAMETER_ERROR;
   }
 
   content_metrics_.reset(new VideoContentMetrics());
   if (!content_metrics_) {
     return VPM_MEMORY;
   }
 
+#if !defined(WEBRTC_GONK)
   prev_frame_.reset(new uint8_t[width_ * height_]);  // Y only.
   if (!prev_frame_) {
     return VPM_MEMORY;
   }
+#endif
 
   // ok, all initialized
   ca_Init_ = true;
   return VPM_OK;
 }
 
 
 // Compute motion metrics: magnitude over non-zero motion vectors,