tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

scalability_structure_test_helpers.h (2180B)


      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_SVC_SCALABILITY_STRUCTURE_TEST_HELPERS_H_
     11 #define MODULES_VIDEO_CODING_SVC_SCALABILITY_STRUCTURE_TEST_HELPERS_H_
     12 
     13 #include <stdint.h>
     14 
     15 #include <vector>
     16 
     17 #include "api/array_view.h"
     18 #include "api/video/video_bitrate_allocation.h"
     19 #include "common_video/generic_frame_descriptor/generic_frame_info.h"
     20 #include "modules/video_coding/chain_diff_calculator.h"
     21 #include "modules/video_coding/frame_dependencies_calculator.h"
     22 #include "modules/video_coding/svc/scalable_video_controller.h"
     23 
     24 namespace webrtc {
     25 
     26 // Creates bitrate allocation with non-zero bitrate for given number of temporal
     27 // layers for each spatial layer.
     28 VideoBitrateAllocation EnableTemporalLayers(int s0, int s1 = 0, int s2 = 0);
     29 
     30 class ScalabilityStructureWrapper {
     31 public:
     32  explicit ScalabilityStructureWrapper(ScalableVideoController& structure)
     33      : structure_controller_(structure) {}
     34 
     35  std::vector<GenericFrameInfo> GenerateFrames(int num_temporal_units) {
     36    std::vector<GenericFrameInfo> frames;
     37    GenerateFrames(num_temporal_units, frames);
     38    return frames;
     39  }
     40  void GenerateFrames(int num_temporal_units,
     41                      std::vector<GenericFrameInfo>& frames);
     42 
     43  // Returns false and ADD_FAILUREs for frames with invalid references.
     44  // In particular validates no frame frame reference to frame before frames[0].
     45  // In error messages frames are indexed starting with 0.
     46  bool FrameReferencesAreValid(ArrayView<const GenericFrameInfo> frames) const;
     47 
     48 private:
     49  ScalableVideoController& structure_controller_;
     50  FrameDependenciesCalculator frame_deps_calculator_;
     51  ChainDiffCalculator chain_diff_calculator_;
     52  int64_t frame_id_ = 0;
     53 };
     54 
     55 }  // namespace webrtc
     56 
     57 #endif  // MODULES_VIDEO_CODING_SVC_SCALABILITY_STRUCTURE_TEST_HELPERS_H_