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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 2309743002: Move the QP scaling thresholds to the relevant encoders (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 16 matching lines...) Expand all
27 #include "webrtc/modules/include/module_common_types.h" 27 #include "webrtc/modules/include/module_common_types.h"
28 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 28 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
29 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" 29 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h"
30 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" 30 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h"
31 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" 31 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
32 #include "webrtc/system_wrappers/include/clock.h" 32 #include "webrtc/system_wrappers/include/clock.h"
33 33
34 namespace webrtc { 34 namespace webrtc {
35 namespace { 35 namespace {
36 36
37 // QP is obtained from VP8-bitstream for HW, so the QP corresponds to the
38 // bitstream range of [0, 127] and not the user-level range of [0,63].
39 static const int kLowVp8QpThreshold = 29;
40 static const int kHighVp8QpThreshold = 95;
41
magjed_webrtc 2016/09/06 07:49:09 nit: remove extra line
42
37 enum { kVp8ErrorPropagationTh = 30 }; 43 enum { kVp8ErrorPropagationTh = 30 };
38 enum { kVp832ByteAlign = 32 }; 44 enum { kVp832ByteAlign = 32 };
39 45
40 // VP8 denoiser states. 46 // VP8 denoiser states.
41 enum denoiserState { 47 enum denoiserState {
42 kDenoiserOff, 48 kDenoiserOff,
43 kDenoiserOnYOnly, 49 kDenoiserOnYOnly,
44 kDenoiserOnYUV, 50 kDenoiserOnYUV,
45 kDenoiserOnYUVAggressive, 51 kDenoiserOnYUVAggressive,
46 // Adaptive mode defaults to kDenoiserOnYUV on key frame, but may switch 52 // Adaptive mode defaults to kDenoiserOnYUV on key frame, but may switch
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 inst->simulcastStream[stream_idx].height, kVp832ByteAlign); 602 inst->simulcastStream[stream_idx].height, kVp832ByteAlign);
597 SetStreamState(stream_bitrates[stream_idx] > 0, stream_idx); 603 SetStreamState(stream_bitrates[stream_idx] > 0, stream_idx);
598 configurations_[i].rc_target_bitrate = stream_bitrates[stream_idx]; 604 configurations_[i].rc_target_bitrate = stream_bitrates[stream_idx];
599 temporal_layers_[stream_idx]->ConfigureBitrates( 605 temporal_layers_[stream_idx]->ConfigureBitrates(
600 stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate, 606 stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate,
601 &configurations_[i]); 607 &configurations_[i]);
602 } 608 }
603 } 609 }
604 610
605 rps_.Init(); 611 rps_.Init();
606 quality_scaler_.Init(QualityScaler::kLowVp8QpThreshold, 612 quality_scaler_.Init(kLowVp8QpThreshold,
607 QualityScaler::kBadVp8QpThreshold, codec_.startBitrate, 613 kHighVp8QpThreshold, codec_.startBitrate,
608 codec_.width, codec_.height, codec_.maxFramerate); 614 codec_.width, codec_.height, codec_.maxFramerate);
609 615
610 // Only apply scaling to improve for single-layer streams. The scaling metrics 616 // Only apply scaling to improve for single-layer streams. The scaling metrics
611 // use frame drops as a signal and is only applicable when we drop frames. 617 // use frame drops as a signal and is only applicable when we drop frames.
612 quality_scaler_enabled_ = encoders_.size() == 1 && 618 quality_scaler_enabled_ = encoders_.size() == 1 &&
613 configurations_[0].rc_dropframe_thresh > 0 && 619 configurations_[0].rc_dropframe_thresh > 0 &&
614 codec_.codecSpecific.VP8.automaticResizeOn; 620 codec_.codecSpecific.VP8.automaticResizeOn;
615 621
616 return InitAndSetControlSettings(); 622 return InitAndSetControlSettings();
617 } 623 }
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 return -1; 1410 return -1;
1405 } 1411 }
1406 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != 1412 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) !=
1407 VPX_CODEC_OK) { 1413 VPX_CODEC_OK) {
1408 return -1; 1414 return -1;
1409 } 1415 }
1410 return 0; 1416 return 0;
1411 } 1417 }
1412 1418
1413 } // namespace webrtc 1419 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698