| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 | 10 |
| 11 #include <memory> |
| 12 |
| 11 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 13 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
| 12 #include "webrtc/modules/video_processing/include/video_processing.h" | 14 #include "webrtc/modules/video_processing/include/video_processing.h" |
| 13 #include "webrtc/modules/video_processing/content_analysis.h" | 15 #include "webrtc/modules/video_processing/content_analysis.h" |
| 14 #include "webrtc/modules/video_processing/test/video_processing_unittest.h" | 16 #include "webrtc/modules/video_processing/test/video_processing_unittest.h" |
| 15 | 17 |
| 16 namespace webrtc { | 18 namespace webrtc { |
| 17 | 19 |
| 18 #if defined(WEBRTC_IOS) | 20 #if defined(WEBRTC_IOS) |
| 19 TEST_F(VideoProcessingTest, DISABLED_ContentAnalysis) { | 21 TEST_F(VideoProcessingTest, DISABLED_ContentAnalysis) { |
| 20 #else | 22 #else |
| 21 TEST_F(VideoProcessingTest, ContentAnalysis) { | 23 TEST_F(VideoProcessingTest, ContentAnalysis) { |
| 22 #endif | 24 #endif |
| 23 VPMContentAnalysis ca__c(false); | 25 VPMContentAnalysis ca__c(false); |
| 24 VPMContentAnalysis ca__sse(true); | 26 VPMContentAnalysis ca__sse(true); |
| 25 VideoContentMetrics* _cM_c; | 27 VideoContentMetrics* _cM_c; |
| 26 VideoContentMetrics* _cM_SSE; | 28 VideoContentMetrics* _cM_SSE; |
| 27 | 29 |
| 28 ca__c.Initialize(width_, height_); | 30 ca__c.Initialize(width_, height_); |
| 29 ca__sse.Initialize(width_, height_); | 31 ca__sse.Initialize(width_, height_); |
| 30 | 32 |
| 31 rtc::scoped_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]); | 33 std::unique_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]); |
| 32 while (fread(video_buffer.get(), 1, frame_length_, source_file_) == | 34 while (fread(video_buffer.get(), 1, frame_length_, source_file_) == |
| 33 frame_length_) { | 35 frame_length_) { |
| 34 // Using ConvertToI420 to add stride to the image. | 36 // Using ConvertToI420 to add stride to the image. |
| 35 EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, width_, height_, | 37 EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, width_, height_, |
| 36 0, kVideoRotation_0, &video_frame_)); | 38 0, kVideoRotation_0, &video_frame_)); |
| 37 _cM_c = ca__c.ComputeContentMetrics(video_frame_); | 39 _cM_c = ca__c.ComputeContentMetrics(video_frame_); |
| 38 _cM_SSE = ca__sse.ComputeContentMetrics(video_frame_); | 40 _cM_SSE = ca__sse.ComputeContentMetrics(video_frame_); |
| 39 | 41 |
| 40 ASSERT_EQ(_cM_c->spatial_pred_err, _cM_SSE->spatial_pred_err); | 42 ASSERT_EQ(_cM_c->spatial_pred_err, _cM_SSE->spatial_pred_err); |
| 41 ASSERT_EQ(_cM_c->spatial_pred_err_v, _cM_SSE->spatial_pred_err_v); | 43 ASSERT_EQ(_cM_c->spatial_pred_err_v, _cM_SSE->spatial_pred_err_v); |
| 42 ASSERT_EQ(_cM_c->spatial_pred_err_h, _cM_SSE->spatial_pred_err_h); | 44 ASSERT_EQ(_cM_c->spatial_pred_err_h, _cM_SSE->spatial_pred_err_h); |
| 43 ASSERT_EQ(_cM_c->motion_magnitude, _cM_SSE->motion_magnitude); | 45 ASSERT_EQ(_cM_c->motion_magnitude, _cM_SSE->motion_magnitude); |
| 44 } | 46 } |
| 45 ASSERT_NE(0, feof(source_file_)) << "Error reading source file"; | 47 ASSERT_NE(0, feof(source_file_)) << "Error reading source file"; |
| 46 } | 48 } |
| 47 | 49 |
| 48 } // namespace webrtc | 50 } // namespace webrtc |
| OLD | NEW |