diff options
author | Jerome Jiang <jianj@google.com> | 2021-08-31 10:22:22 -0700 |
---|---|---|
committer | Jerome Jiang <jianj@google.com> | 2021-09-10 10:46:26 -0700 |
commit | 65a1751e5b98bf7f1d21bcbfdef352af34fb205d (patch) | |
tree | aea196d324f1f5c09861f015bbfa08da2773e672 /vpx | |
parent | ca40ca9bed87687eb0b534bf3974c95182dd29a1 (diff) | |
download | libvpx-65a1751e5b98bf7f1d21bcbfdef352af34fb205d.tar.gz |
Add vp8 support to rc lib
For 1 layer CBR only.
Support for temporal layers comes later.
Rename the library to libvpxrc
Bug: b/188853141
Change-Id: Ib7f977b64c05b1a0596870cb7f8e6768cb483850
Diffstat (limited to 'vpx')
-rw-r--r-- | vpx/internal/vpx_ratectrl_rtc.h | 62 | ||||
-rw-r--r-- | vpx/vp8cx.h | 2 | ||||
-rw-r--r-- | vpx/vpx_codec.mk | 1 |
3 files changed, 64 insertions, 1 deletions
diff --git a/vpx/internal/vpx_ratectrl_rtc.h b/vpx/internal/vpx_ratectrl_rtc.h new file mode 100644 index 000000000..0474e0a85 --- /dev/null +++ b/vpx/internal/vpx_ratectrl_rtc.h @@ -0,0 +1,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_VPX_RATECTRL_RTC_H_ +#define VPX_VPX_RATECTRL_RTC_H_ + +#include "vpx/vpx_encoder.h" + +namespace libvpx { +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; + } + + 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; +}; +} // namespace libvpx +#endif diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h index 17afac754..28bd86174 100644 --- a/vpx/vp8cx.h +++ b/vpx/vp8cx.h @@ -747,7 +747,7 @@ enum vp8e_enc_control_id { * * This will turn off cyclic refresh for vp8. * - * With those, the rate control is expected to work exactly the same as the + * With this, the rate control is expected to work exactly the same as the * interface provided in vp8_ratectrl_rtc.cc/h * * Supported in codecs: VP8 diff --git a/vpx/vpx_codec.mk b/vpx/vpx_codec.mk index 350dc247b..de86579d5 100644 --- a/vpx/vpx_codec.mk +++ b/vpx/vpx_codec.mk @@ -33,6 +33,7 @@ API_SRCS-yes += vpx_decoder.h API_SRCS-yes += src/vpx_encoder.c API_SRCS-yes += vpx_encoder.h API_SRCS-yes += internal/vpx_codec_internal.h +API_SRCS-yes += internal/vpx_ratectrl_rtc.h API_SRCS-yes += src/vpx_codec.c API_SRCS-yes += src/vpx_image.c API_SRCS-yes += vpx_codec.h |