blob: 496ef9eaad5e70ec310e6ca0ef6180dd3636a18d (
plain)
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) 2021 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_VP8_RATECTRL_RTC_H_
#define VPX_VP8_RATECTRL_RTC_H_
#include <cstdint>
#include <cstring>
#include <memory>
#include "vpx/internal/vpx_ratectrl_rtc.h"
struct VP8_COMP;
namespace libvpx {
struct VP8RateControlRtcConfig : public VpxRateControlRtcConfig {
public:
VP8RateControlRtcConfig() {
memset(&layer_target_bitrate, 0, sizeof(layer_target_bitrate));
memset(&ts_rate_decimator, 0, sizeof(ts_rate_decimator));
}
};
struct VP8FrameParamsQpRTC {
RcFrameType frame_type;
int temporal_layer_id;
};
class VP8RateControlRTC {
public:
static std::unique_ptr<VP8RateControlRTC> Create(
const VP8RateControlRtcConfig &cfg);
~VP8RateControlRTC();
bool UpdateRateControl(const VP8RateControlRtcConfig &rc_cfg);
// GetQP() needs to be called after ComputeQP() to get the latest QP
int GetQP() const;
// GetLoopfilterLevel() needs to be called after ComputeQP() since loopfilter
// level is calculated from frame qp.
int GetLoopfilterLevel() const;
// int GetLoopfilterLevel() const;
void ComputeQP(const VP8FrameParamsQpRTC &frame_params);
// Feedback to rate control with the size of current encoded frame
void PostEncodeUpdate(uint64_t encoded_frame_size);
private:
VP8RateControlRTC() {}
bool InitRateControl(const VP8RateControlRtcConfig &cfg);
struct VP8_COMP *cpi_;
int q_;
};
} // namespace libvpx
#endif // VPX_VP8_RATECTRL_RTC_H_
|