Index: webrtc/modules/video_coding/codecs/vp8/temporal_layers.h |
diff --git a/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h b/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h |
index 12917fd38948e24ea1c82fc192832e4bfed525d3..471daa636e29d70e67f860cb0d9ed525e5d5bfb1 100644 |
--- a/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h |
+++ b/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h |
@@ -24,52 +24,57 @@ namespace webrtc { |
struct CodecSpecificInfoVP8; |
-enum TemporalBufferFlags { |
- kNone = 0, |
- kReference = 1, |
- kUpdate = 2, |
- kReferenceAndUpdate = kReference | kUpdate, |
-}; |
- |
+// TODO(pbos): Remove along with layer_sync and freeze_entropy, they are |
+// derivable from picture_idx and should be exposed with |
+// TL::IsLayerSync(TL::FrameConfig). |
enum TemporalFlags { kLayerSync = 1, kFreezeEntropy = 2 }; |
-struct TemporalReferences { |
- TemporalReferences(TemporalBufferFlags last, |
- TemporalBufferFlags golden, |
- TemporalBufferFlags arf); |
- TemporalReferences(TemporalBufferFlags last, |
- TemporalBufferFlags golden, |
- TemporalBufferFlags arf, |
- int extra_flags); |
- |
- const bool drop_frame; |
- const TemporalBufferFlags last_buffer_flags; |
- const TemporalBufferFlags golden_buffer_flags; |
- const TemporalBufferFlags arf_buffer_flags; |
- |
- // TODO(pbos): Consider breaking these out of here and returning only a |
- // pattern index that needs to be returned to fill CodecSpecificInfoVP8 or |
- // EncodeFlags. |
- const bool layer_sync; |
- const bool freeze_entropy; |
- |
- private: |
- TemporalReferences(TemporalBufferFlags last, |
- TemporalBufferFlags golden, |
- TemporalBufferFlags arf, |
- bool layer_sync, |
- bool freeze_entropy); |
-}; |
- |
class TemporalLayers { |
public: |
+ enum BufferFlags { |
+ kNone = 0, |
+ kReference = 1, |
+ kUpdate = 2, |
+ kReferenceAndUpdate = kReference | kUpdate, |
+ }; |
+ |
+ struct FrameConfig { |
+ FrameConfig(); |
+ |
+ FrameConfig(BufferFlags last, BufferFlags golden, BufferFlags arf); |
+ FrameConfig(BufferFlags last, |
+ BufferFlags golden, |
+ BufferFlags arf, |
+ int extra_flags); |
+ |
+ bool drop_frame; |
+ BufferFlags last_buffer_flags; |
+ BufferFlags golden_buffer_flags; |
+ BufferFlags arf_buffer_flags; |
+ |
+ // TODO(pbos): Consider breaking these out of here and returning only a |
+ // pattern index that needs to be returned to fill CodecSpecificInfoVP8 or |
+ // EncodeFlags. |
+ bool layer_sync; |
+ bool freeze_entropy; |
+ |
+ int pattern_idx; |
+ |
+ private: |
+ FrameConfig(BufferFlags last, |
+ BufferFlags golden, |
+ BufferFlags arf, |
+ bool layer_sync, |
+ bool freeze_entropy); |
+ }; |
+ |
// Factory for TemporalLayer strategy. Default behavior is a fixed pattern |
// of temporal layers. See default_temporal_layers.cc |
virtual ~TemporalLayers() {} |
// Returns the recommended VP8 encode flags needed. May refresh the decoder |
// and/or update the reference buffers. |
- virtual TemporalReferences UpdateLayerConfig(uint32_t timestamp) = 0; |
+ virtual FrameConfig UpdateLayerConfig(uint32_t timestamp) = 0; |
// Update state based on new bitrate target and incoming framerate. |
// Returns the bitrate allocation for the active temporal layers. |
@@ -81,17 +86,19 @@ class TemporalLayers { |
// Returns true iff the configuration was actually modified. |
virtual bool UpdateConfiguration(vpx_codec_enc_cfg_t* cfg) = 0; |
- virtual void PopulateCodecSpecific(bool is_keyframe, |
- CodecSpecificInfoVP8* vp8_info, |
- uint32_t timestamp) = 0; |
+ virtual void PopulateCodecSpecific( |
+ bool is_keyframe, |
+ const TemporalLayers::FrameConfig& tl_config, |
+ CodecSpecificInfoVP8* vp8_info, |
+ uint32_t timestamp) = 0; |
virtual void FrameEncoded(unsigned int size, int qp) = 0; |
- virtual int CurrentLayerId() const = 0; |
- |
// Returns the current tl0_pic_idx, so it can be reused in future |
// instantiations. |
virtual uint8_t Tl0PicIdx() const = 0; |
+ virtual int GetTemporalLayerId( |
+ const TemporalLayers::FrameConfig& tl_config) const = 0; |
}; |
class TemporalLayersListener; |