• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2018 The WebM 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 VPX_TEST_SVC_TEST_H_
12 #define VPX_TEST_SVC_TEST_H_
13 
14 #include "./vpx_config.h"
15 #include "third_party/googletest/src/include/gtest/gtest.h"
16 #include "test/codec_factory.h"
17 #include "test/encode_test_driver.h"
18 #include "test/i420_video_source.h"
19 #include "test/util.h"
20 #include "test/y4m_video_source.h"
21 #include "vpx/vpx_codec.h"
22 #include "vpx_ports/bitops.h"
23 
24 namespace svc_test {
25 class OnePassCbrSvc : public ::libvpx_test::EncoderTest {
26  public:
OnePassCbrSvc(const::libvpx_test::CodecFactory * codec)27   explicit OnePassCbrSvc(const ::libvpx_test::CodecFactory *codec)
28       : EncoderTest(codec), base_speed_setting_(0), speed_setting_(0),
29         superframe_count_(0), temporal_layer_id_(0), number_temporal_layers_(0),
30         number_spatial_layers_(0) {
31     memset(&svc_params_, 0, sizeof(svc_params_));
32     memset(bits_in_buffer_model_, 0,
33            sizeof(bits_in_buffer_model_[0]) * VPX_MAX_LAYERS);
34     memset(layer_target_avg_bandwidth_, 0,
35            sizeof(layer_target_avg_bandwidth_[0]) * VPX_MAX_LAYERS);
36   }
37 
38  protected:
~OnePassCbrSvc()39   virtual ~OnePassCbrSvc() {}
40 
41   virtual void SetConfig(const int num_temporal_layer) = 0;
42 
43   virtual void SetSvcConfig(const int num_spatial_layer,
44                             const int num_temporal_layer);
45 
46   virtual void PreEncodeFrameHookSetup(::libvpx_test::VideoSource *video,
47                                        ::libvpx_test::Encoder *encoder);
48 
49   virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder);
50 
51   virtual void AssignLayerBitrates();
52 
MismatchHook(const vpx_image_t *,const vpx_image_t *)53   virtual void MismatchHook(const vpx_image_t *, const vpx_image_t *) {}
54 
55   vpx_svc_extra_cfg_t svc_params_;
56   int64_t bits_in_buffer_model_[VPX_MAX_LAYERS];
57   int layer_target_avg_bandwidth_[VPX_MAX_LAYERS];
58   int base_speed_setting_;
59   int speed_setting_;
60   int superframe_count_;
61   int temporal_layer_id_;
62   int number_temporal_layers_;
63   int number_spatial_layers_;
64 };
65 }  // namespace svc_test
66 
67 #endif  // VPX_TEST_SVC_TEST_H_
68