1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* Copyright (c) 2018 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VPX_TEST_SVC_TEST_H_
#define VPX_TEST_SVC_TEST_H_
#include "./vpx_config.h"
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/codec_factory.h"
#include "test/encode_test_driver.h"
#include "test/i420_video_source.h"
#include "test/util.h"
#include "test/y4m_video_source.h"
#include "vpx/vpx_codec.h"
#include "vpx_ports/bitops.h"
namespace svc_test {
class OnePassCbrSvc : public ::libvpx_test::EncoderTest {
public:
explicit OnePassCbrSvc(const ::libvpx_test::CodecFactory *codec)
: EncoderTest(codec), base_speed_setting_(0), speed_setting_(0),
superframe_count_(0), temporal_layer_id_(0), number_temporal_layers_(0),
number_spatial_layers_(0) {
memset(&svc_params_, 0, sizeof(svc_params_));
memset(bits_in_buffer_model_, 0,
sizeof(bits_in_buffer_model_[0]) * VPX_MAX_LAYERS);
memset(layer_target_avg_bandwidth_, 0,
sizeof(layer_target_avg_bandwidth_[0]) * VPX_MAX_LAYERS);
}
protected:
virtual ~OnePassCbrSvc() {}
virtual void PreEncodeFrameHookSetup(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder);
virtual void PostEncodeFrameHook(::libvpx_test::Encoder *encoder);
virtual void AssignLayerBitrates();
virtual void MismatchHook(const vpx_image_t *, const vpx_image_t *) {}
vpx_svc_extra_cfg_t svc_params_;
int64_t bits_in_buffer_model_[VPX_MAX_LAYERS];
int layer_target_avg_bandwidth_[VPX_MAX_LAYERS];
int base_speed_setting_;
int speed_setting_;
int superframe_count_;
int temporal_layer_id_;
int number_temporal_layers_;
int number_spatial_layers_;
};
} // namespace svc_test
#endif // VPX_TEST_SVC_TEST_H_
|