зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1332139: Remove LIBVPX_SVC hack for vp9 needed to work with libvpx 1.4 from webrtc r=ng
This commit is contained in:
Родитель
422acb55ec
Коммит
33fe82dde6
|
@ -114,19 +114,14 @@ int VP9EncoderImpl::Release() {
|
|||
bool VP9EncoderImpl::ExplicitlyConfiguredSpatialLayers() const {
|
||||
// We check target_bitrate_bps of the 0th layer to see if the spatial layers
|
||||
// (i.e. bitrates) were explicitly configured.
|
||||
#ifdef LIBVPX_SVC
|
||||
return num_spatial_layers_ > 1 &&
|
||||
codec_.spatialLayers[0].target_bitrate_bps > 0;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VP9EncoderImpl::SetSvcRates() {
|
||||
uint8_t i = 0;
|
||||
|
||||
if (ExplicitlyConfiguredSpatialLayers()) {
|
||||
#ifdef LIBVPX_SVC
|
||||
if (num_temporal_layers_ > 1) {
|
||||
LOG(LS_ERROR) << "Multiple temporal layers when manually specifying "
|
||||
"spatial layers not implemented yet!";
|
||||
|
@ -143,12 +138,10 @@ bool VP9EncoderImpl::SetSvcRates() {
|
|||
codec_.spatialLayers[i].target_bitrate_bps /
|
||||
total_bitrate_bps);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
float rate_ratio[VPX_MAX_LAYERS] = {0};
|
||||
float total = 0;
|
||||
|
||||
#ifdef LIBVPX_SVC
|
||||
for (i = 0; i < num_spatial_layers_; ++i) {
|
||||
if (svc_internal_.svc_params.scaling_factor_num[i] <= 0 ||
|
||||
svc_internal_.svc_params.scaling_factor_den[i] <= 0) {
|
||||
|
@ -160,10 +153,6 @@ bool VP9EncoderImpl::SetSvcRates() {
|
|||
svc_internal_.svc_params.scaling_factor_den[i];
|
||||
total += rate_ratio[i];
|
||||
}
|
||||
#else
|
||||
rate_ratio[0] = 1;
|
||||
total = 1;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < num_spatial_layers_; ++i) {
|
||||
config_->ss_target_bitrate[i] = static_cast<unsigned int>(
|
||||
|
@ -398,7 +387,6 @@ int VP9EncoderImpl::NumberOfThreads(int width,
|
|||
}
|
||||
|
||||
int VP9EncoderImpl::InitAndSetControlSettings(const VideoCodec* inst) {
|
||||
#ifdef LIBVPX_SVC
|
||||
// Set QP-min/max per spatial and temporal layer.
|
||||
int tot_num_layers = num_spatial_layers_ * num_temporal_layers_;
|
||||
for (int i = 0; i < tot_num_layers; ++i) {
|
||||
|
@ -422,7 +410,6 @@ int VP9EncoderImpl::InitAndSetControlSettings(const VideoCodec* inst) {
|
|||
scaling_factor_num /= 2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!SetSvcRates()) {
|
||||
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
|
||||
|
@ -437,7 +424,6 @@ int VP9EncoderImpl::InitAndSetControlSettings(const VideoCodec* inst) {
|
|||
vpx_codec_control(encoder_, VP9E_SET_AQ_MODE,
|
||||
inst->codecSpecific.VP9.adaptiveQpMode ? 3 : 0);
|
||||
|
||||
#ifdef LIBVPX_SVC
|
||||
vpx_codec_control(
|
||||
encoder_, VP9E_SET_SVC,
|
||||
(num_temporal_layers_ > 1 || num_spatial_layers_ > 1) ? 1 : 0);
|
||||
|
@ -445,8 +431,6 @@ int VP9EncoderImpl::InitAndSetControlSettings(const VideoCodec* inst) {
|
|||
vpx_codec_control(encoder_, VP9E_SET_SVC_PARAMETERS,
|
||||
&svc_internal_.svc_params);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Register callback for getting each spatial layer.
|
||||
vpx_codec_priv_output_cx_pkt_cb_pair_t cbp = {
|
||||
VP9EncoderImpl::EncoderOutputCodedPacketCallback,
|
||||
|
@ -539,7 +523,6 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image,
|
|||
flags = VPX_EFLAG_FORCE_KF;
|
||||
}
|
||||
|
||||
#ifdef LIBVPX_SVC
|
||||
if (is_flexible_mode_) {
|
||||
SuperFrameRefSettings settings;
|
||||
|
||||
|
@ -561,7 +544,6 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image,
|
|||
vpx_codec_control(encoder_, VP9E_SET_SVC_LAYER_ID, &layer_id);
|
||||
vpx_codec_control(encoder_, VP9E_SET_SVC_REF_FRAME_CONFIG, &enc_layer_conf);
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(codec_.maxFramerate > 0);
|
||||
uint32_t duration = 90000 / codec_.maxFramerate;
|
||||
|
@ -699,7 +681,6 @@ void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
|
|||
vp9_info->temporal_up_switch = gof_.temporal_up_switch[vp9_info->gof_idx];
|
||||
}
|
||||
|
||||
#ifdef LIBVPX_SVC
|
||||
if (vp9_info->ss_data_available) {
|
||||
vp9_info->spatial_layer_resolution_present = true;
|
||||
for (size_t i = 0; i < vp9_info->num_spatial_layers; ++i) {
|
||||
|
@ -710,10 +691,9 @@ void VP9EncoderImpl::PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
|
|||
svc_internal_.svc_params.scaling_factor_num[i] /
|
||||
svc_internal_.svc_params.scaling_factor_den[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!vp9_info->flexible_mode) {
|
||||
vp9_info->gof.CopyGofInfoVP9(gof_);
|
||||
if (!vp9_info->flexible_mode) {
|
||||
vp9_info->gof.CopyGofInfoVP9(gof_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,7 +751,6 @@ int VP9EncoderImpl::GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt) {
|
|||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
#ifdef LIBVPX_SVC
|
||||
vpx_svc_ref_frame_config VP9EncoderImpl::GenerateRefsAndFlags(
|
||||
const SuperFrameRefSettings& settings) {
|
||||
static const vpx_enc_frame_flags_t kAllFlags =
|
||||
|
@ -873,7 +852,6 @@ vpx_svc_ref_frame_config VP9EncoderImpl::GenerateRefsAndFlags(
|
|||
++frames_encoded_;
|
||||
return sf_conf;
|
||||
}
|
||||
#endif
|
||||
|
||||
int VP9EncoderImpl::SetChannelParameters(uint32_t packet_loss, int64_t rtt) {
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
#include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
|
||||
#include "webrtc/modules/video_coding/codecs/vp9/vp9_frame_buffer_pool.h"
|
||||
|
||||
#ifdef LIBVPX_SVC
|
||||
#include "vpx/svc_context.h"
|
||||
#endif
|
||||
#include "vpx/vpx_decoder.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
|
||||
|
@ -84,7 +82,6 @@ class VP9EncoderImpl : public VP9Encoder {
|
|||
bool ExplicitlyConfiguredSpatialLayers() const;
|
||||
bool SetSvcRates();
|
||||
|
||||
#ifdef LIBVPX_SVC
|
||||
// Used for flexible mode to set the flags and buffer references used
|
||||
// by the encoder. Also calculates the references used by the RTP
|
||||
// packetizer.
|
||||
|
@ -93,7 +90,6 @@ class VP9EncoderImpl : public VP9Encoder {
|
|||
// state used to calculate references.
|
||||
vpx_svc_ref_frame_config GenerateRefsAndFlags(
|
||||
const SuperFrameRefSettings& settings);
|
||||
#endif
|
||||
|
||||
virtual int GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt);
|
||||
|
||||
|
@ -120,9 +116,7 @@ class VP9EncoderImpl : public VP9Encoder {
|
|||
vpx_codec_ctx_t* encoder_;
|
||||
vpx_codec_enc_cfg_t* config_;
|
||||
vpx_image_t* raw_;
|
||||
#ifdef LIBVPX_SVC
|
||||
SvcInternal_t svc_internal_;
|
||||
#endif
|
||||
const VideoFrame* input_image_;
|
||||
GofInfoVP9 gof_; // Contains each frame's temporal information for
|
||||
// non-flexible mode.
|
||||
|
|
Загрузка…
Ссылка в новой задаче