1 /* 2 * Copyright (c) 2011 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 WEBRTC_MODULES_VIDEO_CODING_TEST_QUALITY_MODSE_TEST_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_TEST_QUALITY_MODSE_TEST_H_ 13 14 #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" 15 #include "webrtc/modules/video_coding/main/test/normal_test.h" 16 #include "webrtc/modules/video_processing/main/interface/video_processing.h" 17 #include "webrtc/system_wrappers/interface/data_log.h" 18 19 int qualityModeTest(const CmdArgs& args); 20 21 class QualityModesTest : public NormalTest 22 { 23 public: 24 QualityModesTest(webrtc::VideoCodingModule* vcm, 25 webrtc::Clock* clock); 26 virtual ~QualityModesTest(); 27 int32_t Perform(const CmdArgs& args); 28 29 private: 30 31 void Setup(const CmdArgs& args); 32 void Print(); 33 void Teardown(); 34 void SsimComp(); 35 36 webrtc::VideoProcessingModule* _vpm; 37 38 int _width; 39 int _height; 40 float _frameRate; 41 int _nativeWidth; 42 int _nativeHeight; 43 float _nativeFrameRate; 44 45 uint32_t _numFramesDroppedVPM; 46 bool _flagSSIM; 47 std::string filename_testvideo_; 48 std::string fv_outfilename_; 49 50 std::string feature_table_name_; 51 52 }; // end of QualityModesTest class 53 54 class VCMQMDecodeCompleCallback: public webrtc::VCMReceiveCallback 55 { 56 public: 57 VCMQMDecodeCompleCallback( 58 FILE* decodedFile, 59 int frame_rate, 60 std::string feature_table_name); 61 virtual ~VCMQMDecodeCompleCallback(); 62 void SetUserReceiveCallback(webrtc::VCMReceiveCallback* receiveCallback); 63 // will write decoded frame into file 64 int32_t FrameToRender(webrtc::I420VideoFrame& videoFrame); 65 int32_t DecodedBytes(); 66 void SetOriginalFrameDimensions(int32_t width, int32_t height); 67 int32_t buildInterpolator(); 68 // Check if last frame is dropped, if so, repeat the last rendered frame. 69 void WriteEnd(int input_tot_frame_count); 70 71 private: 72 FILE* _decodedFile; 73 uint32_t _decodedBytes; 74 // QualityModesTest& _test; 75 int _origWidth; 76 int _origHeight; 77 int _decWidth; 78 int _decHeight; 79 // VideoInterpolator* _interpolator; 80 uint8_t* _decBuffer; 81 uint32_t _frameCnt; // debug 82 webrtc::I420VideoFrame last_frame_; 83 int frame_rate_; 84 int frames_cnt_since_drop_; 85 std::string feature_table_name_; 86 87 88 89 }; // end of VCMQMDecodeCompleCallback class 90 91 class QMTestVideoSettingsCallback : public webrtc::VCMQMSettingsCallback 92 { 93 public: 94 QMTestVideoSettingsCallback(); 95 // update VPM with QM settings 96 int32_t SetVideoQMSettings(const uint32_t frameRate, 97 const uint32_t width, 98 const uint32_t height); 99 // register VPM used by test 100 void RegisterVPM(webrtc::VideoProcessingModule* vpm); 101 void RegisterVCM(webrtc::VideoCodingModule* vcm); 102 bool Updated(); 103 104 private: 105 webrtc::VideoProcessingModule* _vpm; 106 webrtc::VideoCodingModule* _vcm; 107 bool _updated; 108 }; 109 110 111 #endif // WEBRTC_MODULES_VIDEO_CODING_TEST_QUALITY_MODSE_TEST_H_ 112