OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/modules/video_processing/content_analysis.h" | 10 #include "webrtc/modules/video_processing/content_analysis.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const VideoFrame& inputFrame) { | 53 const VideoFrame& inputFrame) { |
54 if (inputFrame.IsZeroSize()) | 54 if (inputFrame.IsZeroSize()) |
55 return NULL; | 55 return NULL; |
56 | 56 |
57 // Init if needed (native dimension change). | 57 // Init if needed (native dimension change). |
58 if (width_ != inputFrame.width() || height_ != inputFrame.height()) { | 58 if (width_ != inputFrame.width() || height_ != inputFrame.height()) { |
59 if (VPM_OK != Initialize(inputFrame.width(), inputFrame.height())) | 59 if (VPM_OK != Initialize(inputFrame.width(), inputFrame.height())) |
60 return NULL; | 60 return NULL; |
61 } | 61 } |
62 // Only interested in the Y plane. | 62 // Only interested in the Y plane. |
63 orig_frame_ = inputFrame.buffer(kYPlane); | 63 orig_frame_ = inputFrame.video_frame_buffer()->DataY(); |
64 | 64 |
65 // Compute spatial metrics: 3 spatial prediction errors. | 65 // Compute spatial metrics: 3 spatial prediction errors. |
66 (this->*ComputeSpatialMetrics)(); | 66 (this->*ComputeSpatialMetrics)(); |
67 | 67 |
68 // Compute motion metrics | 68 // Compute motion metrics |
69 if (first_frame_ == false) | 69 if (first_frame_ == false) |
70 ComputeMotionMetrics(); | 70 ComputeMotionMetrics(); |
71 | 71 |
72 // Saving current frame as previous one: Y only. | 72 // Saving current frame as previous one: Y only. |
73 memcpy(prev_frame_, orig_frame_, width_ * height_); | 73 memcpy(prev_frame_, orig_frame_, width_ * height_); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 content_metrics_->spatial_pred_err = spatial_pred_err_; | 272 content_metrics_->spatial_pred_err = spatial_pred_err_; |
273 content_metrics_->spatial_pred_err_h = spatial_pred_err_h_; | 273 content_metrics_->spatial_pred_err_h = spatial_pred_err_h_; |
274 content_metrics_->spatial_pred_err_v = spatial_pred_err_v_; | 274 content_metrics_->spatial_pred_err_v = spatial_pred_err_v_; |
275 // Motion metric: normalized temporal difference (MAD). | 275 // Motion metric: normalized temporal difference (MAD). |
276 content_metrics_->motion_magnitude = motion_magnitude_; | 276 content_metrics_->motion_magnitude = motion_magnitude_; |
277 | 277 |
278 return content_metrics_; | 278 return content_metrics_; |
279 } | 279 } |
280 | 280 |
281 } // namespace webrtc | 281 } // namespace webrtc |
OLD | NEW |