| OLD | NEW |
| 1 /* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 1 /* Copyright (c) 2011 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 the interface for doing temporal layers with VP8. | 10 * This file defines the interface for doing temporal layers with VP8. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 FrameConfig(BufferFlags last, | 40 FrameConfig(BufferFlags last, |
| 41 BufferFlags golden, | 41 BufferFlags golden, |
| 42 BufferFlags arf, | 42 BufferFlags arf, |
| 43 FreezeEntropy); | 43 FreezeEntropy); |
| 44 | 44 |
| 45 bool drop_frame; | 45 bool drop_frame; |
| 46 BufferFlags last_buffer_flags; | 46 BufferFlags last_buffer_flags; |
| 47 BufferFlags golden_buffer_flags; | 47 BufferFlags golden_buffer_flags; |
| 48 BufferFlags arf_buffer_flags; | 48 BufferFlags arf_buffer_flags; |
| 49 | 49 |
| 50 // TODO(pbos): Consider breaking these out of here and returning only a | 50 // The encoder layer ID is used to utilize the correct bitrate allocator |
| 51 // pattern index that needs to be returned to fill CodecSpecificInfoVP8 or | 51 // inside the encoder. It does not control references nor determine which |
| 52 // EncodeFlags. | 52 // "actual" temporal layer this is. The packetizer temporal index determines |
| 53 // which layer the encoded frame should be packetized into. |
| 54 // Normally these are the same, but current temporal-layer strategies for |
| 55 // screenshare use one bitrate allocator for all layers, but attempt to |
| 56 // packetize / utilize references to split a stream into multiple layers, |
| 57 // with different quantizer settings, to hit target bitrate. |
| 58 // TODO(pbos): Screenshare layers are being reconsidered at the time of |
| 59 // writing, we might be able to remove this distinction, and have a temporal |
| 60 // layer imply both (the normal case). |
| 61 int encoder_layer_id; |
| 62 int packetizer_temporal_idx; |
| 63 |
| 53 bool layer_sync; | 64 bool layer_sync; |
| 65 |
| 54 bool freeze_entropy; | 66 bool freeze_entropy; |
| 55 | 67 |
| 56 int pattern_idx; | |
| 57 | |
| 58 bool operator==(const FrameConfig& o) const { | 68 bool operator==(const FrameConfig& o) const { |
| 59 return drop_frame == o.drop_frame && | 69 return drop_frame == o.drop_frame && |
| 60 last_buffer_flags == o.last_buffer_flags && | 70 last_buffer_flags == o.last_buffer_flags && |
| 61 golden_buffer_flags == o.golden_buffer_flags && | 71 golden_buffer_flags == o.golden_buffer_flags && |
| 62 arf_buffer_flags == o.arf_buffer_flags && | 72 arf_buffer_flags == o.arf_buffer_flags && |
| 63 layer_sync == o.layer_sync && freeze_entropy == o.freeze_entropy && | 73 layer_sync == o.layer_sync && freeze_entropy == o.freeze_entropy && |
| 64 pattern_idx == o.pattern_idx; | 74 encoder_layer_id == o.encoder_layer_id && |
| 75 packetizer_temporal_idx == o.packetizer_temporal_idx; |
| 65 } | 76 } |
| 66 bool operator!=(const FrameConfig& o) const { return !(*this == o); } | 77 bool operator!=(const FrameConfig& o) const { return !(*this == o); } |
| 67 | 78 |
| 68 private: | 79 private: |
| 69 FrameConfig(BufferFlags last, | 80 FrameConfig(BufferFlags last, |
| 70 BufferFlags golden, | 81 BufferFlags golden, |
| 71 BufferFlags arf, | 82 BufferFlags arf, |
| 72 bool freeze_entropy); | 83 bool freeze_entropy); |
| 73 }; | 84 }; |
| 74 | 85 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 94 bool is_keyframe, | 105 bool is_keyframe, |
| 95 const TemporalLayers::FrameConfig& tl_config, | 106 const TemporalLayers::FrameConfig& tl_config, |
| 96 CodecSpecificInfoVP8* vp8_info, | 107 CodecSpecificInfoVP8* vp8_info, |
| 97 uint32_t timestamp) = 0; | 108 uint32_t timestamp) = 0; |
| 98 | 109 |
| 99 virtual void FrameEncoded(unsigned int size, int qp) = 0; | 110 virtual void FrameEncoded(unsigned int size, int qp) = 0; |
| 100 | 111 |
| 101 // Returns the current tl0_pic_idx, so it can be reused in future | 112 // Returns the current tl0_pic_idx, so it can be reused in future |
| 102 // instantiations. | 113 // instantiations. |
| 103 virtual uint8_t Tl0PicIdx() const = 0; | 114 virtual uint8_t Tl0PicIdx() const = 0; |
| 104 virtual int GetTemporalLayerId( | |
| 105 const TemporalLayers::FrameConfig& tl_config) const = 0; | |
| 106 }; | 115 }; |
| 107 | 116 |
| 108 class TemporalLayersListener; | 117 class TemporalLayersListener; |
| 109 class TemporalLayersFactory { | 118 class TemporalLayersFactory { |
| 110 public: | 119 public: |
| 111 TemporalLayersFactory() : listener_(nullptr) {} | 120 TemporalLayersFactory() : listener_(nullptr) {} |
| 112 virtual ~TemporalLayersFactory() {} | 121 virtual ~TemporalLayersFactory() {} |
| 113 virtual TemporalLayers* Create(int simulcast_id, | 122 virtual TemporalLayers* Create(int simulcast_id, |
| 114 int temporal_layers, | 123 int temporal_layers, |
| 115 uint8_t initial_tl0_pic_idx) const; | 124 uint8_t initial_tl0_pic_idx) const; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 133 public: | 142 public: |
| 134 TemporalLayersListener() {} | 143 TemporalLayersListener() {} |
| 135 virtual ~TemporalLayersListener() {} | 144 virtual ~TemporalLayersListener() {} |
| 136 | 145 |
| 137 virtual void OnTemporalLayersCreated(int simulcast_id, | 146 virtual void OnTemporalLayersCreated(int simulcast_id, |
| 138 TemporalLayers* layers) = 0; | 147 TemporalLayers* layers) = 0; |
| 139 }; | 148 }; |
| 140 | 149 |
| 141 } // namespace webrtc | 150 } // namespace webrtc |
| 142 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_TEMPORAL_LAYERS_H_ | 151 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_TEMPORAL_LAYERS_H_ |
| OLD | NEW |