Skip to content

Commit

Permalink
Revert 3269
Browse files Browse the repository at this point in the history
> Will now only require near-perfect PSNR and SSIM.
> 
> BUG=
> TEST=Ran test and checked we accept somewhat lower values.
> 
> Review URL: https://webrtc-codereview.appspot.com/964031

[email protected]
Review URL: https://webrtc-codereview.appspot.com/989004

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@3270 4adac7df-926f-26a2-2b94-8c16560cd09d
  • Loading branch information
[email protected] committed Dec 12, 2012
1 parent 01ba015 commit a0fc158
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion common_video/libyuv/include/webrtc_libyuv.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ enum VideoType {
};

// This is the max PSNR value our algorithms can return.
const double kPerfectPSNR = 48.0f;
const double kInfinitePSNR = 48.0f;

// Conversion between the RawVideoType and the LibYuv videoType.
// TODO(wu): Consolidate types into one type throughout WebRtc.
Expand Down
4 changes: 2 additions & 2 deletions common_video/libyuv/webrtc_libyuv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ double I420PSNR(const I420VideoFrame* ref_frame,
test_frame->width(), test_frame->height());
// LibYuv sets the max psnr value to 128, we restrict it here.
// In case of 0 mse in one frame, 128 can skew the results significantly.
return (psnr > kPerfectPSNR) ? kPerfectPSNR : psnr;
return (psnr > kInfinitePSNR) ? kInfinitePSNR : psnr;
}

// Compute SSIM for an I420 frame (all planes)
Expand Down Expand Up @@ -409,7 +409,7 @@ double I420PSNR(const uint8_t* ref_frame,
width, height);
// LibYuv sets the max psnr value to 128, we restrict it here.
// In case of 0 mse in one frame, 128 can skew the results significantly.
return (psnr > kPerfectPSNR) ? kPerfectPSNR : psnr;
return (psnr > kInfinitePSNR) ? kInfinitePSNR : psnr;
}
// Compute SSIM for an I420 frame (all planes)
double I420SSIM(const uint8_t* ref_frame,
Expand Down
2 changes: 1 addition & 1 deletion test/testsupport/metrics/video_metrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace webrtc {
namespace test {

// Copy here so our callers won't need to include libyuv for this constant.
double kMetricsPerfectPSNR = kPerfectPSNR;
double kMetricsInfinitePSNR = kInfinitePSNR;

// Used for calculating min and max values.
static bool LessForFrameResultValue (const FrameResult& s1,
Expand Down
2 changes: 1 addition & 1 deletion test/testsupport/metrics/video_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace webrtc {
namespace test {

// The highest PSNR value our algorithms will return.
extern double kMetricsPerfectPSNR;
extern double kMetricsInfinitePSNR;

// Contains video quality metrics result for a single frame.
struct FrameResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ TEST_F(ViEVideoVerificationTest, RunsBaseStandardTestWithoutErrors) {
// However, it's hard to make 100% stringent requirements on the video engine
// since for instance the jitter buffer has non-deterministic elements. If it
// breaks five times in a row though, you probably introduced a bug.
const double kReasonablePsnr = webrtc::test::kMetricsPerfectPSNR - 2.0f;
const double kReasonableSsim = 0.99f;
const int kNumAttempts = 5;
for (int attempt = 0; attempt < kNumAttempts; ++attempt) {
InitializeFileRenderers();
Expand All @@ -174,19 +172,20 @@ TEST_F(ViEVideoVerificationTest, RunsBaseStandardTestWithoutErrors) {

double actual_psnr = 0;
double actual_ssim = 0;
CompareFiles(input_file_, remote_file, &actual_psnr, &actual_ssim);
CompareFiles(local_preview, remote_file, &actual_psnr, &actual_ssim);

TearDownFileRenderers();

if (actual_psnr > kReasonablePsnr && actual_ssim > kReasonableSsim) {
if (actual_psnr == webrtc::test::kMetricsInfinitePSNR &&
actual_ssim == 1.0f) {
// Test successful.
return;
} else {
ViETest::Log("Retrying; attempt %d of %d.", attempt + 1, kNumAttempts);
}
}

FAIL() << "Failed to achieve near-perfect PSNR and SSIM results after " <<
FAIL() << "Failed to achieve perfect PSNR and SSIM results after " <<
kNumAttempts << " attempts.";
}

Expand Down

0 comments on commit a0fc158

Please sign in to comment.