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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.h

Issue 2489843002: Revert of Extract bitrate allocation of spatial/temporal layers out of codec impl. (Closed)
Patch Set: Created 4 years, 1 month 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 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
2 * 2 *
3 * Use of this source code is governed by a BSD-style license 3 * Use of this source code is governed by a BSD-style license
4 * that can be found in the LICENSE file in the root of the source 4 * that can be found in the LICENSE file in the root of the source
5 * tree. An additional intellectual property rights grant can be found 5 * tree. An additional intellectual property rights grant can be found
6 * in the file PATENTS. All contributing project authors may 6 * in the file PATENTS. All contributing project authors may
7 * be found in the AUTHORS file in the root of the source tree. 7 * be found in the AUTHORS file in the root of the source tree.
8 */ 8 */
9 /* 9 /*
10 * This file defines classes for doing temporal layers with VP8. 10 * This file defines classes for doing temporal layers with VP8.
11 */ 11 */
12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_DEFAULT_TEMPORAL_LAYERS_H_ 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_DEFAULT_TEMPORAL_LAYERS_H_
13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_DEFAULT_TEMPORAL_LAYERS_H_ 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_DEFAULT_TEMPORAL_LAYERS_H_
14 14
15 #include <vector>
16
17 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" 15 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
18 16
19 #include "webrtc/base/optional.h"
20
21 namespace webrtc { 17 namespace webrtc {
22 18
23 class DefaultTemporalLayers : public TemporalLayers { 19 class DefaultTemporalLayers : public TemporalLayers {
24 public: 20 public:
25 DefaultTemporalLayers(int number_of_temporal_layers, 21 DefaultTemporalLayers(int number_of_temporal_layers,
26 uint8_t initial_tl0_pic_idx); 22 uint8_t initial_tl0_pic_idx);
27 virtual ~DefaultTemporalLayers() {} 23 virtual ~DefaultTemporalLayers() {}
28 24
29 // Returns the recommended VP8 encode flags needed. May refresh the decoder 25 // Returns the recommended VP8 encode flags needed. May refresh the decoder
30 // and/or update the reference buffers. 26 // and/or update the reference buffers.
31 int EncodeFlags(uint32_t timestamp) override; 27 int EncodeFlags(uint32_t timestamp) override;
32 28
33 // Update state based on new bitrate target and incoming framerate. 29 bool ConfigureBitrates(int bitrate_kbit,
34 // Returns the bitrate allocation for the active temporal layers. 30 int max_bitrate_kbit,
35 std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps, 31 int framerate,
36 int max_bitrate_kbps, 32 vpx_codec_enc_cfg_t* cfg) override;
37 int framerate) override;
38
39 bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override;
40 33
41 void PopulateCodecSpecific(bool base_layer_sync, 34 void PopulateCodecSpecific(bool base_layer_sync,
42 CodecSpecificInfoVP8* vp8_info, 35 CodecSpecificInfoVP8* vp8_info,
43 uint32_t timestamp) override; 36 uint32_t timestamp) override;
44 37
45 void FrameEncoded(unsigned int size, uint32_t timestamp, int qp) override {} 38 void FrameEncoded(unsigned int size, uint32_t timestamp, int qp) override {}
46 39
40 bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override { return false; }
41
47 int CurrentLayerId() const override; 42 int CurrentLayerId() const override;
48 43
49 private: 44 private:
50 enum TemporalReferences { 45 enum TemporalReferences {
51 // For 1 layer case: reference all (last, golden, and alt ref), but only 46 // For 1 layer case: reference all (last, golden, and alt ref), but only
52 // update last. 47 // update last.
53 kTemporalUpdateLastRefAll = 12, 48 kTemporalUpdateLastRefAll = 12,
54 // First base layer frame for 3 temporal layers, which updates last and 49 // First base layer frame for 3 temporal layers, which updates last and
55 // golden with alt ref dependency. 50 // golden with alt ref dependency.
56 kTemporalUpdateLastAndGoldenRefAltRef = 11, 51 kTemporalUpdateLastAndGoldenRefAltRef = 11,
(...skipping 18 matching lines...) Expand all
75 // First enhancement layer. 70 // First enhancement layer.
76 kTemporalUpdateGolden = 2, 71 kTemporalUpdateGolden = 2,
77 // First enhancement layer without dependency on previous frames in 72 // First enhancement layer without dependency on previous frames in
78 // the first enhancement layer. 73 // the first enhancement layer.
79 kTemporalUpdateGoldenWithoutDependency = 1, 74 kTemporalUpdateGoldenWithoutDependency = 1,
80 // Base layer. 75 // Base layer.
81 kTemporalUpdateLast = 0, 76 kTemporalUpdateLast = 0,
82 }; 77 };
83 enum { kMaxTemporalPattern = 16 }; 78 enum { kMaxTemporalPattern = 16 };
84 79
85 const int number_of_temporal_layers_; 80 int number_of_temporal_layers_;
86 int temporal_ids_length_; 81 int temporal_ids_length_;
87 int temporal_ids_[kMaxTemporalPattern]; 82 int temporal_ids_[kMaxTemporalPattern];
88 int temporal_pattern_length_; 83 int temporal_pattern_length_;
89 TemporalReferences temporal_pattern_[kMaxTemporalPattern]; 84 TemporalReferences temporal_pattern_[kMaxTemporalPattern];
90 uint8_t tl0_pic_idx_; 85 uint8_t tl0_pic_idx_;
91 uint8_t pattern_idx_; 86 uint8_t pattern_idx_;
92 uint32_t timestamp_; 87 uint32_t timestamp_;
93 bool last_base_layer_sync_; 88 bool last_base_layer_sync_;
94 rtc::Optional<std::vector<uint32_t>> new_bitrates_kbps_;
95 }; 89 };
96 90
97 } // namespace webrtc 91 } // namespace webrtc
98 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_DEFAULT_TEMPORAL_LAYERS_H_ 92 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_DEFAULT_TEMPORAL_LAYERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698