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

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: fix namespace issue in videoToolbox encoder 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;
pbos-webrtc 2016/09/12 19:51:49 Should be declared in the same place as the androi
40 static const int kHighVp8QpThreshold = 95;
41
37 enum { kVp8ErrorPropagationTh = 30 }; 42 enum { kVp8ErrorPropagationTh = 30 };
38 enum { kVp832ByteAlign = 32 }; 43 enum { kVp832ByteAlign = 32 };
39 44
40 // VP8 denoiser states. 45 // VP8 denoiser states.
41 enum denoiserState { 46 enum denoiserState {
42 kDenoiserOff, 47 kDenoiserOff,
43 kDenoiserOnYOnly, 48 kDenoiserOnYOnly,
44 kDenoiserOnYUV, 49 kDenoiserOnYUV,
45 kDenoiserOnYUVAggressive, 50 kDenoiserOnYUVAggressive,
46 // Adaptive mode defaults to kDenoiserOnYUV on key frame, but may switch 51 // 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); 601 inst->simulcastStream[stream_idx].height, kVp832ByteAlign);
597 SetStreamState(stream_bitrates[stream_idx] > 0, stream_idx); 602 SetStreamState(stream_bitrates[stream_idx] > 0, stream_idx);
598 configurations_[i].rc_target_bitrate = stream_bitrates[stream_idx]; 603 configurations_[i].rc_target_bitrate = stream_bitrates[stream_idx];
599 temporal_layers_[stream_idx]->ConfigureBitrates( 604 temporal_layers_[stream_idx]->ConfigureBitrates(
600 stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate, 605 stream_bitrates[stream_idx], inst->maxBitrate, inst->maxFramerate,
601 &configurations_[i]); 606 &configurations_[i]);
602 } 607 }
603 } 608 }
604 609
605 rps_.Init(); 610 rps_.Init();
606 quality_scaler_.Init(QualityScaler::kLowVp8QpThreshold, 611 quality_scaler_.Init(kLowVp8QpThreshold,
607 QualityScaler::kBadVp8QpThreshold, codec_.startBitrate, 612 kHighVp8QpThreshold, codec_.startBitrate,
608 codec_.width, codec_.height, codec_.maxFramerate); 613 codec_.width, codec_.height, codec_.maxFramerate);
609 614
610 // Only apply scaling to improve for single-layer streams. The scaling metrics 615 // 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. 616 // use frame drops as a signal and is only applicable when we drop frames.
612 quality_scaler_enabled_ = encoders_.size() == 1 && 617 quality_scaler_enabled_ = encoders_.size() == 1 &&
613 configurations_[0].rc_dropframe_thresh > 0 && 618 configurations_[0].rc_dropframe_thresh > 0 &&
614 codec_.codecSpecific.VP8.automaticResizeOn; 619 codec_.codecSpecific.VP8.automaticResizeOn;
615 620
616 return InitAndSetControlSettings(); 621 return InitAndSetControlSettings();
617 } 622 }
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 return -1; 1409 return -1;
1405 } 1410 }
1406 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) != 1411 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) !=
1407 VPX_CODEC_OK) { 1412 VPX_CODEC_OK) {
1408 return -1; 1413 return -1;
1409 } 1414 }
1410 return 0; 1415 return 0;
1411 } 1416 }
1412 1417
1413 } // namespace webrtc 1418 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698