• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef RTC_TOOLS_FRAME_ANALYZER_REFERENCE_LESS_VIDEO_ANALYSIS_LIB_H_
12 #define RTC_TOOLS_FRAME_ANALYZER_REFERENCE_LESS_VIDEO_ANALYSIS_LIB_H_
13 
14 #include <stddef.h>
15 
16 #include <string>
17 #include <vector>
18 
19 #include "api/scoped_refptr.h"
20 #include "rtc_tools/video_file_reader.h"
21 
22 // Returns true if the frame is frozen based on psnr and ssim freezing
23 // threshold values.
24 bool frozen_frame(std::vector<double> psnr_per_frame,
25                   std::vector<double> ssim_per_frame,
26                   size_t frame);
27 
28 // Returns the vector of identical cluster of frames that are frozen
29 // and appears continuously.
30 std::vector<int> find_frame_clusters(const std::vector<double>& psnr_per_frame,
31                                      const std::vector<double>& ssim_per_frame);
32 
33 // Prints various freezing metrics like identical frames,
34 // total unique frames etc.
35 void print_freezing_metrics(const std::vector<double>& psnr_per_frame,
36                             const std::vector<double>& ssim_per_frame);
37 
38 // Compute the metrics like freezing score based on PSNR and SSIM values for a
39 // given video file.
40 void compute_metrics(const rtc::scoped_refptr<webrtc::test::Video>& video,
41                      std::vector<double>* psnr_per_frame,
42                      std::vector<double>* ssim_per_frame);
43 
44 // Compute freezing score metrics and prints the metrics
45 // for a list of video files.
46 int run_analysis(const std::string& video_file);
47 
48 #endif  // RTC_TOOLS_FRAME_ANALYZER_REFERENCE_LESS_VIDEO_ANALYSIS_LIB_H_
49