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

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

Issue 2769263002: Base screenshare layers on TemporalReferences. (Closed)
Patch Set: feedback Created 3 years, 9 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
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> 15 #include <vector>
16 16
17 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" 17 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h"
18 18
19 #include "webrtc/base/optional.h" 19 #include "webrtc/base/optional.h"
20 20
21 namespace webrtc { 21 namespace webrtc {
22 22
23 enum TemporalBufferUsage {
24 kNone = 0,
25 kReference = 1,
26 kUpdate = 2,
27 kReferenceAndUpdate = kReference | kUpdate,
28 };
29 enum TemporalFlags { kLayerSync = 1, kFreezeEntropy = 2 };
30
31 struct TemporalReferences {
32 TemporalReferences(TemporalBufferUsage last,
33 TemporalBufferUsage golden,
34 TemporalBufferUsage arf);
35 TemporalReferences(TemporalBufferUsage last,
36 TemporalBufferUsage golden,
37 TemporalBufferUsage arf,
38 int extra_flags);
39
40 const bool reference_last;
41 const bool update_last;
42 const bool reference_golden;
43 const bool update_golden;
44 const bool reference_arf;
45 const bool update_arf;
46
47 // TODO(pbos): Consider breaking these out of here and returning only a
48 // pattern index that needs to be returned to fill CodecSpecificInfoVP8 or
49 // EncodeFlags.
50 const bool layer_sync;
51 const bool freeze_entropy;
52
53 private:
54 TemporalReferences(TemporalBufferUsage last,
55 TemporalBufferUsage golden,
56 TemporalBufferUsage arf,
57 bool layer_sync,
58 bool freeze_entropy);
59 };
60
61 class DefaultTemporalLayers : public TemporalLayers { 23 class DefaultTemporalLayers : public TemporalLayers {
62 public: 24 public:
63 DefaultTemporalLayers(int number_of_temporal_layers, 25 DefaultTemporalLayers(int number_of_temporal_layers,
64 uint8_t initial_tl0_pic_idx); 26 uint8_t initial_tl0_pic_idx);
65 virtual ~DefaultTemporalLayers() {} 27 virtual ~DefaultTemporalLayers() {}
66 28
67 // Returns the recommended VP8 encode flags needed. May refresh the decoder 29 // Returns the recommended VP8 encode flags needed. May refresh the decoder
68 // and/or update the reference buffers. 30 // and/or update the reference buffers.
69 int EncodeFlags(uint32_t timestamp) override; 31 TemporalReferences UpdateLayerConfig(uint32_t timestamp) override;
70 32
71 // Update state based on new bitrate target and incoming framerate. 33 // Update state based on new bitrate target and incoming framerate.
72 // Returns the bitrate allocation for the active temporal layers. 34 // Returns the bitrate allocation for the active temporal layers.
73 std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps, 35 std::vector<uint32_t> OnRatesUpdated(int bitrate_kbps,
74 int max_bitrate_kbps, 36 int max_bitrate_kbps,
75 int framerate) override; 37 int framerate) override;
76 38
77 bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override; 39 bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) override;
78 40
79 void PopulateCodecSpecific(bool base_layer_sync, 41 void PopulateCodecSpecific(bool frame_is_keyframe,
80 CodecSpecificInfoVP8* vp8_info, 42 CodecSpecificInfoVP8* vp8_info,
81 uint32_t timestamp) override; 43 uint32_t timestamp) override;
82 44
83 void FrameEncoded(unsigned int size, uint32_t timestamp, int qp) override {} 45 void FrameEncoded(unsigned int size, int qp) override {}
84 46
85 int CurrentLayerId() const override; 47 int CurrentLayerId() const override;
86 48
87 private: 49 private:
88 const size_t num_layers_; 50 const size_t num_layers_;
89 const std::vector<unsigned int> temporal_ids_; 51 const std::vector<unsigned int> temporal_ids_;
90 const std::vector<TemporalReferences> temporal_pattern_; 52 const std::vector<TemporalReferences> temporal_pattern_;
91 53
92 uint8_t tl0_pic_idx_; 54 uint8_t tl0_pic_idx_;
93 uint8_t pattern_idx_; 55 uint8_t pattern_idx_;
94 uint32_t timestamp_; 56 uint32_t timestamp_;
95 bool last_base_layer_sync_; 57 bool last_base_layer_sync_;
96 rtc::Optional<std::vector<uint32_t>> new_bitrates_kbps_; 58 rtc::Optional<std::vector<uint32_t>> new_bitrates_kbps_;
97 }; 59 };
98 60
99 } // namespace webrtc 61 } // namespace webrtc
100 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_DEFAULT_TEMPORAL_LAYERS_H_ 62 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_DEFAULT_TEMPORAL_LAYERS_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp8/default_temporal_layers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698