aboutsummaryrefslogtreecommitdiff
path: root/vpx/internal/vpx_ratectrl_rtc.h
blob: 01d64b14b77f065e3682873893eb7ea25ed18914 (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
63
64
65
66
67
68
69
70
71
72
73
74
/*
 *  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_VPX_INTERNAL_VPX_RATECTRL_RTC_H_
#define VPX_VPX_INTERNAL_VPX_RATECTRL_RTC_H_

#include "vpx/vpx_encoder.h"

namespace libvpx {

enum class RcFrameType { kKeyFrame = 0, kInterFrame = 1 };

enum class FrameDropDecision {
  kOk,    // Frame is encoded.
  kDrop,  // Frame is dropped.
};

struct VpxRateControlRtcConfig {
 public:
  VpxRateControlRtcConfig() {
    width = 1280;
    height = 720;
    max_quantizer = 63;
    min_quantizer = 2;
    target_bandwidth = 1000;
    buf_initial_sz = 600;
    buf_optimal_sz = 600;
    buf_sz = 1000;
    undershoot_pct = overshoot_pct = 50;
    max_intra_bitrate_pct = 50;
    max_inter_bitrate_pct = 0;
    framerate = 30.0;
    ts_number_layers = 1;
    rc_mode = VPX_CBR;
    aq_mode = 0;
    layer_target_bitrate[0] = static_cast<int>(target_bandwidth);
    ts_rate_decimator[0] = 1;
    frame_drop_thresh = 0;
    is_screen = false;
  }

  int width;
  int height;
  // 0-63
  int max_quantizer;
  int min_quantizer;
  int64_t target_bandwidth;
  int64_t buf_initial_sz;
  int64_t buf_optimal_sz;
  int64_t buf_sz;
  int undershoot_pct;
  int overshoot_pct;
  int max_intra_bitrate_pct;
  int max_inter_bitrate_pct;
  double framerate;
  // Number of temporal layers
  int ts_number_layers;
  int layer_target_bitrate[VPX_MAX_LAYERS];
  int ts_rate_decimator[VPX_TS_MAX_LAYERS];
  // vbr, cbr
  enum vpx_rc_mode rc_mode;
  int aq_mode;
  int frame_drop_thresh;
  bool is_screen;
};
}  // namespace libvpx
#endif  // VPX_VPX_INTERNAL_VPX_RATECTRL_RTC_H_