webrtc/test/testsupport/metrics/video_metrics.h
phoglund@webrtc.org 1144ba2268 Base and codec tests now run verify output and render to file instead of to screen.
Rewrote the codec test to render to file and do video comparisons.

Refactored the coded tests somewhat. I still need to figure out how to do comparison in the automated case.

Added video analysis to the test. This will make sure that the system output roughly the right thing.

Moved the video metrics library into the test_support library. Made the metrics library available in the automated tests.

Made sure no one passes in too large YUV videos into the autotest.

The standard test's output now gets captured for both the left and right windows.

Wrote a rendering device which just writes the raw frames to file, for analysis. Updated the base standard test to dump its left window output to file. We don't do anything with it yet though.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/249001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@931 4adac7df-926f-26a2-2b94-8c16560cd09d
2011-11-11 09:01:03 +00:00

70 lines
2.3 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.
*/
#ifndef WEBRTC_MODULES_VIDEO_CODING_TEST_VIDEO_METRICS_H_
#define WEBRTC_MODULES_VIDEO_CODING_TEST_VIDEO_METRICS_H_
#include "typedefs.h"
#include <limits>
#include <vector>
// Contains video quality metrics result for a single frame.
struct FrameResult {
WebRtc_Word32 frame_number;
double value;
};
// Result from a PSNR/SSIM calculation operation.
// The frames in this data structure are 0-indexed.
struct QualityMetricsResult {
QualityMetricsResult() :
average(0.0),
min(std::numeric_limits<double>::max()),
max(std::numeric_limits<double>::min()),
min_frame_number(-1),
max_frame_number(-1)
{};
double average;
double min;
double max;
WebRtc_Word32 min_frame_number;
WebRtc_Word32 max_frame_number;
std::vector<FrameResult> frames;
};
// PSNR & SSIM calculations
// PSNR values are filled into the QualityMetricsResult struct.
// If the result is std::numerical_limits<double>::max() the videos were
// equal. Otherwise, PSNR values are in decibel (higher is better). This
// algorithm only compares up to the point when the shortest video ends.
WebRtc_Word32
PsnrFromFiles(const WebRtc_Word8 *refFileName,
const WebRtc_Word8 *testFileName, WebRtc_Word32 width,
WebRtc_Word32 height, QualityMetricsResult *result);
// SSIM values are filled into the QualityMetricsResult struct.
// Values range between -1 and 1, where 1 means the files were identical. This
// algorithm only compares up to the point when the shortest video ends.
WebRtc_Word32
SsimFromFiles(const WebRtc_Word8 *refFileName,
const WebRtc_Word8 *testFileName, WebRtc_Word32 width,
WebRtc_Word32 height, QualityMetricsResult *result);
double
SsimFrame(WebRtc_UWord8 *img1, WebRtc_UWord8 *img2, WebRtc_Word32 stride_img1,
WebRtc_Word32 stride_img2, WebRtc_Word32 width, WebRtc_Word32 height);
#endif // WEBRTC_MODULES_VIDEO_CODING_TEST_VIDEO_METRICS_H_