OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Utility functions for video testing. | 5 // Utility functions for video testing. |
6 | 6 |
7 #include "media/base/video_frame.h" | 7 #include "media/base/video_frame.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 namespace cast { | 10 namespace cast { |
11 | 11 |
12 // Compute and return PSNR between two frames. | 12 // Compute and return PSNR between two frames. |
13 double I420PSNR(const scoped_refptr<media::VideoFrame>& frame1, | 13 double I420PSNR(const scoped_refptr<media::VideoFrame>& frame1, |
14 const scoped_refptr<media::VideoFrame>& frame2); | 14 const scoped_refptr<media::VideoFrame>& frame2); |
15 | 15 |
16 // Compute and return SSIM between two frames. | 16 // Compute and return SSIM between two frames. |
17 double I420SSIM(const scoped_refptr<media::VideoFrame>& frame1, | 17 double I420SSIM(const scoped_refptr<media::VideoFrame>& frame1, |
18 const scoped_refptr<media::VideoFrame>& frame2); | 18 const scoped_refptr<media::VideoFrame>& frame2); |
19 | 19 |
20 // Populate a video |frame| with a plaid pattern, cycling from the given | 20 // Populate a video frame with values starting with the given start value. |
21 // |start_value|. | |
22 // Width, height and stride should be set in advance. | 21 // Width, height and stride should be set in advance. |
23 // Memory is allocated within the function. | 22 // Memory is allocated within the function. |
24 void PopulateVideoFrame(VideoFrame* frame, int start_value); | 23 void PopulateVideoFrame(VideoFrame* frame, int start_value); |
25 | 24 |
26 // Populate a video frame with noise. | 25 // Populate a video frame with noise. |
27 void PopulateVideoFrameWithNoise(VideoFrame* frame); | 26 void PopulateVideoFrameWithNoise(VideoFrame* frame); |
28 | 27 |
29 // Populate a video frame from a file. | 28 // Populate a video frame from a file. |
30 // Returns true if frame was populated, false if not (EOF). | 29 // Returns true if frame was populated, false if not (EOF). |
31 bool PopulateVideoFrameFromFile(VideoFrame* frame, FILE* video_file); | 30 bool PopulateVideoFrameFromFile(VideoFrame* frame, FILE* video_file); |
32 | 31 |
33 } // namespace cast | 32 } // namespace cast |
34 } // namespace media | 33 } // namespace media |
OLD | NEW |