webrtc_m130/webrtc/modules/video_processing/test/content_metrics_test.cc
terelius f55f58d45d Revert of Enable video processing unittest to take video clips as param. (patchset #1 id:1 of https://codereview.webrtc.org/1907353004/ )
Reason for revert:
Candidate culprit CL for breaking the gtest initialization on DrMemory.

Original issue's description:
> Enable video processing unittest to take video clips as param.
>
> This change enables video processing unittest (including all tests under
> it, e.g. denoiser test) to use a set of video clips as param, which is
> important if we want to do a regression test on the visual quality
> offline.
>
> BUG=
>
> Committed: https://crrev.com/6d94e5224a3d3b1a6d66a428dbe75af7106e8d60
> Cr-Commit-Position: refs/heads/master@{#12485}

TBR=marpan@webrtc.org,jackychen@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

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

Cr-Commit-Position: refs/heads/master@{#12490}
2016-04-25 14:36:55 +00:00

51 lines
1.9 KiB
C++

/*
* Copyright (c) 2011 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 <memory>
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
#include "webrtc/modules/video_processing/include/video_processing.h"
#include "webrtc/modules/video_processing/content_analysis.h"
#include "webrtc/modules/video_processing/test/video_processing_unittest.h"
namespace webrtc {
#if defined(WEBRTC_IOS)
TEST_F(VideoProcessingTest, DISABLED_ContentAnalysis) {
#else
TEST_F(VideoProcessingTest, ContentAnalysis) {
#endif
VPMContentAnalysis ca__c(false);
VPMContentAnalysis ca__sse(true);
VideoContentMetrics* _cM_c;
VideoContentMetrics* _cM_SSE;
ca__c.Initialize(width_, height_);
ca__sse.Initialize(width_, height_);
std::unique_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]);
while (fread(video_buffer.get(), 1, frame_length_, source_file_) ==
frame_length_) {
// Using ConvertToI420 to add stride to the image.
EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, width_, height_,
0, kVideoRotation_0, &video_frame_));
_cM_c = ca__c.ComputeContentMetrics(video_frame_);
_cM_SSE = ca__sse.ComputeContentMetrics(video_frame_);
ASSERT_EQ(_cM_c->spatial_pred_err, _cM_SSE->spatial_pred_err);
ASSERT_EQ(_cM_c->spatial_pred_err_v, _cM_SSE->spatial_pred_err_v);
ASSERT_EQ(_cM_c->spatial_pred_err_h, _cM_SSE->spatial_pred_err_h);
ASSERT_EQ(_cM_c->motion_magnitude, _cM_SSE->motion_magnitude);
}
ASSERT_NE(0, feof(source_file_)) << "Error reading source file";
}
} // namespace webrtc