1 /*
2  *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #ifndef MODULES_VIDEO_CODING_CODECS_AV1_SCALABILITY_STRUCTURE_L1T2_H_
11 #define MODULES_VIDEO_CODING_CODECS_AV1_SCALABILITY_STRUCTURE_L1T2_H_
12 
13 #include <bitset>
14 #include <vector>
15 
16 #include "api/transport/rtp/dependency_descriptor.h"
17 #include "common_video/generic_frame_descriptor/generic_frame_info.h"
18 #include "modules/video_coding/codecs/av1/scalable_video_controller.h"
19 
20 namespace webrtc {
21 
22 class ScalabilityStructureL1T2 : public ScalableVideoController {
23  public:
24   ~ScalabilityStructureL1T2() override;
25 
26   StreamLayersConfig StreamConfig() const override;
27   FrameDependencyStructure DependencyStructure() const override;
28 
29   std::vector<LayerFrameConfig> NextFrameConfig(bool restart) override;
30   absl::optional<GenericFrameInfo> OnEncodeDone(
31       LayerFrameConfig config) override;
32 
33   void OnRatesUpdated(const VideoBitrateAllocation& bitrates) override;
34 
35  private:
36   enum FramePattern {
37     kKeyFrame,
38     kDeltaFrameT1,
39     kDeltaFrameT0,
40   };
41 
42   FramePattern next_pattern_ = kKeyFrame;
43   std::bitset<32> active_decode_targets_ = 0b11;
44 };
45 
46 }  // namespace webrtc
47 
48 #endif  // MODULES_VIDEO_CODING_CODECS_AV1_SCALABILITY_STRUCTURE_L1T2_H_
49