Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Unified Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 2398963003: Move usage of QualityScaler to ViEEncoder. (Closed)
Patch Set: implement getQPThresholds for various wrappers Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
index 439f6afa3ed444e0365e0968f23894b91275bd78..553ab2a061829fb95676ddcd739f5083c8f00255 100644
--- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
@@ -122,8 +122,7 @@ VP8EncoderImpl::VP8EncoderImpl()
token_partitions_(VP8_ONE_TOKENPARTITION),
down_scale_requested_(false),
down_scale_bitrate_(0),
- key_frame_request_(kMaxSimulcastStreams, false),
- quality_scaler_enabled_(false) {
+ key_frame_request_(kMaxSimulcastStreams, false) {
uint32_t seed = rtc::Time32();
srand(seed);
@@ -260,13 +259,10 @@ int VP8EncoderImpl::SetRates(uint32_t new_bitrate_kbit,
return WEBRTC_VIDEO_CODEC_ERROR;
}
}
- quality_scaler_.ReportFramerate(new_framerate);
return WEBRTC_VIDEO_CODEC_OK;
}
void VP8EncoderImpl::OnDroppedFrame() {
- if (quality_scaler_enabled_)
- quality_scaler_.ReportDroppedFrame();
}
const char* VP8EncoderImpl::ImplementationName() const {
@@ -556,15 +552,6 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
}
rps_.Init();
- quality_scaler_.Init(codec_.codecType, codec_.startBitrate, codec_.width,
- codec_.height, codec_.maxFramerate);
-
- // Only apply scaling to improve for single-layer streams. The scaling metrics
- // use frame drops as a signal and is only applicable when we drop frames.
- quality_scaler_enabled_ = encoders_.size() == 1 &&
magjed_webrtc 2016/10/19 13:00:12 ditto: This logic seems to be gone?
- configurations_[0].rc_dropframe_thresh > 0 &&
- codec_.codecSpecific.VP8.automaticResizeOn;
-
return InitAndSetControlSettings();
}
@@ -697,20 +684,13 @@ int VP8EncoderImpl::Encode(const VideoFrame& frame,
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
rtc::scoped_refptr<VideoFrameBuffer> input_image = frame.video_frame_buffer();
-
- if (quality_scaler_enabled_) {
- quality_scaler_.OnEncodeFrame(frame.width(), frame.height());
- input_image = quality_scaler_.GetScaledBuffer(input_image);
-
- if (input_image->width() != codec_.width ||
- input_image->height() != codec_.height) {
- int ret =
- UpdateCodecFrameSize(input_image->width(), input_image->height());
- if (ret < 0)
- return ret;
- }
+ if (input_image->width() != codec_.width ||
+ input_image->height() != codec_.height) {
+ int ret = UpdateCodecFrameSize(input_image->width(),
+ input_image->height());
+ if (ret < 0)
+ return ret;
}
-
// Since we are extracting raw pointers from |input_image| to
// |raw_images_[0]|, the resolution of these frames must match. Note that
// |input_image| might be scaled from |frame|. In that case, the resolution of
@@ -1007,9 +987,6 @@ int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image,
codec_.simulcastStream[stream_idx].height;
encoded_images_[encoder_idx]._encodedWidth =
codec_.simulcastStream[stream_idx].width;
- encoded_images_[encoder_idx]
- .adapt_reason_.quality_resolution_downscales =
- quality_scaler_enabled_ ? quality_scaler_.downscale_shift() : -1;
// Report once per frame (lowest stream always sent).
encoded_images_[encoder_idx].adapt_reason_.bw_resolutions_disabled =
(stream_idx == 0) ? bw_resolutions_disabled : -1;
@@ -1024,18 +1001,13 @@ int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image,
}
}
}
- if (encoders_.size() == 1 && send_stream_[0]) {
- if (encoded_images_[0]._length > 0) {
- int qp_128;
- vpx_codec_control(&encoders_[0], VP8E_GET_LAST_QUANTIZER, &qp_128);
- quality_scaler_.ReportQP(qp_128);
- } else {
- quality_scaler_.ReportDroppedFrame();
- }
- }
return result;
}
+QualityScaler::Settings VP8EncoderImpl::GetQPThresholds() const {
+ return QualityScaler::Settings(true);
+}
+
int VP8EncoderImpl::SetChannelParameters(uint32_t packetLoss, int64_t rtt) {
rps_.SetRtt(rtt);
return WEBRTC_VIDEO_CODEC_OK;

Powered by Google App Engine
This is Rietveld 408576698