Home | History | Annotate | Download | only in codec
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef REMOTING_CODEC_CODEC_TEST_H_
      6 #define REMOTING_CODEC_CODEC_TEST_H_
      7 
      8 #include <list>
      9 
     10 #include "base/memory/ref_counted.h"
     11 
     12 namespace webrtc {
     13 class DesktopFrame;
     14 class DesktopSize;
     15 }
     16 
     17 namespace remoting {
     18 
     19 class VideoDecoder;
     20 class VideoEncoder;
     21 
     22 // Generate test data and test the encoder for a regular encoding sequence.
     23 // This will test encoder test and the sequence of messages sent.
     24 //
     25 // If |strict| is set to true then this routine will make sure the updated
     26 // rects match dirty rects.
     27 void TestVideoEncoder(VideoEncoder* encoder, bool strict);
     28 
     29 // Generate test data and test the encoder and decoder pair.
     30 //
     31 // If |strict| is set to true, this routine will make sure the updated rects
     32 // are correct.
     33 void TestVideoEncoderDecoder(VideoEncoder* encoder,
     34                              VideoDecoder* decoder,
     35                              bool strict);
     36 
     37 // Generate a frame containing a gradient, and test the encoder and decoder
     38 // pair.
     39 void TestVideoEncoderDecoderGradient(VideoEncoder* encoder,
     40                                      VideoDecoder* decoder,
     41                                      const webrtc::DesktopSize& screen_size,
     42                                      const webrtc::DesktopSize& view_size,
     43                                      double max_error_limit,
     44                                      double mean_error_limit);
     45 
     46 // Run sufficient encoding iterations to measure the FPS of the specified
     47 // encoder. The caller may supply one or more DesktopFrames to encode, which
     48 // will be cycled through until timing is complete. If the caller does not
     49 // supply any frames then a single full-frame of randomized pixels is used.
     50 float MeasureVideoEncoderFpsWithSize(VideoEncoder* encoder,
     51                                      const webrtc::DesktopSize& size);
     52 float MeasureVideoEncoderFpsWithFrames(
     53     VideoEncoder* encoder,
     54     const std::list<webrtc::DesktopFrame*>& frames);
     55 
     56 }  // namespace remoting
     57 
     58 #endif  // REMOTING_CODEC_CODEC_TEST_H_
     59