1 /* 2 * Copyright (c) 2021 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_VPX_INTERNAL_VPX_RATECTRL_RTC_H_ 12 #define VPX_VPX_INTERNAL_VPX_RATECTRL_RTC_H_ 13 14 #include "vpx/vpx_encoder.h" 15 16 namespace libvpx { 17 18 enum class RcFrameType { kKeyFrame = 0, kInterFrame = 1 }; 19 20 enum class FrameDropDecision { 21 kOk, // Frame is encoded. 22 kDrop, // Frame is dropped. 23 }; 24 25 struct VpxRateControlRtcConfig { 26 public: VpxRateControlRtcConfigVpxRateControlRtcConfig27 VpxRateControlRtcConfig() { 28 width = 1280; 29 height = 720; 30 max_quantizer = 63; 31 min_quantizer = 2; 32 target_bandwidth = 1000; 33 buf_initial_sz = 600; 34 buf_optimal_sz = 600; 35 buf_sz = 1000; 36 undershoot_pct = overshoot_pct = 50; 37 max_intra_bitrate_pct = 50; 38 max_inter_bitrate_pct = 0; 39 framerate = 30.0; 40 ts_number_layers = 1; 41 rc_mode = VPX_CBR; 42 aq_mode = 0; 43 layer_target_bitrate[0] = static_cast<int>(target_bandwidth); 44 ts_rate_decimator[0] = 1; 45 frame_drop_thresh = 0; 46 is_screen = false; 47 } 48 49 int width; 50 int height; 51 // 0-63 52 int max_quantizer; 53 int min_quantizer; 54 int64_t target_bandwidth; 55 int64_t buf_initial_sz; 56 int64_t buf_optimal_sz; 57 int64_t buf_sz; 58 int undershoot_pct; 59 int overshoot_pct; 60 int max_intra_bitrate_pct; 61 int max_inter_bitrate_pct; 62 double framerate; 63 // Number of temporal layers 64 int ts_number_layers; 65 int layer_target_bitrate[VPX_MAX_LAYERS]; 66 int ts_rate_decimator[VPX_TS_MAX_LAYERS]; 67 // vbr, cbr 68 enum vpx_rc_mode rc_mode; 69 int aq_mode; 70 int frame_drop_thresh; 71 bool is_screen; 72 }; 73 } // namespace libvpx 74 #endif // VPX_VPX_INTERNAL_VPX_RATECTRL_RTC_H_ 75