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 values starting with the given start value. | 20 // Populate a video |frame| with a plaid pattern, cycling from the given |
| 21 // |start_value|. |
21 // Width, height and stride should be set in advance. | 22 // Width, height and stride should be set in advance. |
22 // Memory is allocated within the function. | 23 // Memory is allocated within the function. |
23 void PopulateVideoFrame(VideoFrame* frame, int start_value); | 24 void PopulateVideoFrame(VideoFrame* frame, int start_value); |
24 | 25 |
25 // Populate a video frame with noise. | 26 // Populate a video frame with noise. |
26 void PopulateVideoFrameWithNoise(VideoFrame* frame); | 27 void PopulateVideoFrameWithNoise(VideoFrame* frame); |
27 | 28 |
28 // Populate a video frame from a file. | 29 // Populate a video frame from a file. |
29 // Returns true if frame was populated, false if not (EOF). | 30 // Returns true if frame was populated, false if not (EOF). |
30 bool PopulateVideoFrameFromFile(VideoFrame* frame, FILE* video_file); | 31 bool PopulateVideoFrameFromFile(VideoFrame* frame, FILE* video_file); |
31 | 32 |
32 } // namespace cast | 33 } // namespace cast |
33 } // namespace media | 34 } // namespace media |
OLD | NEW |