2 * Copyright (c) 2018 The WebM project authors. All Rights Reserved.
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.
11 #ifndef VPX_TEST_SVC_TEST_H_
12 #define VPX_TEST_SVC_TEST_H_
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"
25 class OnePassCbrSvc : public ::libvpx_test::EncoderTest {
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);
39 virtual ~OnePassCbrSvc() {}
41 virtual void SetConfig(const int num_temporal_layer) = 0;
43 virtual void SetSvcConfig(const int num_spatial_layer,
44 const int num_temporal_layer);
46 virtual void PreEncodeFrameHookSetup(::libvpx_test::VideoSource *video,
47 ::libvpx_test::Encoder *encoder);
49 virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder);
51 virtual void AssignLayerBitrates();
53 virtual void MismatchHook(const vpx_image_t *, const vpx_image_t *) {}
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_;
60 int superframe_count_;
61 int temporal_layer_id_;
62 int number_temporal_layers_;
63 int number_spatial_layers_;
65 } // namespace svc_test
67 #endif // VPX_TEST_SVC_TEST_H_