tor-browser

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

scalability_mode_util.h (2161B)


      1 /*
      2 *  Copyright (c) 2022 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 
     11 #ifndef MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_
     12 #define MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_
     13 
     14 #include <optional>
     15 
     16 #include "absl/strings/string_view.h"
     17 #include "api/video_codecs/scalability_mode.h"
     18 #include "api/video_codecs/video_codec.h"
     19 #include "rtc_base/system/rtc_export.h"
     20 
     21 namespace webrtc {
     22 
     23 enum class ScalabilityModeResolutionRatio {
     24  kTwoToOne,    // The resolution ratio between spatial layers is 2:1.
     25  kThreeToTwo,  // The resolution ratio between spatial layers is 1.5:1.
     26 };
     27 
     28 static constexpr char kDefaultScalabilityModeStr[] = "L1T2";
     29 
     30 // Scalability mode to be used if falling back to default scalability mode is
     31 // unsupported.
     32 static constexpr char kNoLayeringScalabilityModeStr[] = "L1T1";
     33 
     34 RTC_EXPORT std::optional<ScalabilityMode> MakeScalabilityMode(
     35    int num_spatial_layers,
     36    int num_temporal_layers,
     37    InterLayerPredMode inter_layer_pred,
     38    std::optional<ScalabilityModeResolutionRatio> ratio,
     39    bool shift);
     40 
     41 RTC_EXPORT std::optional<ScalabilityMode> ScalabilityModeFromString(
     42    absl::string_view scalability_mode_string);
     43 
     44 InterLayerPredMode ScalabilityModeToInterLayerPredMode(
     45    ScalabilityMode scalability_mode);
     46 
     47 int ScalabilityModeToNumSpatialLayers(ScalabilityMode scalability_mode);
     48 
     49 int ScalabilityModeToNumTemporalLayers(ScalabilityMode scalability_mode);
     50 
     51 std::optional<ScalabilityModeResolutionRatio> ScalabilityModeToResolutionRatio(
     52    ScalabilityMode scalability_mode);
     53 
     54 bool ScalabilityModeIsShiftMode(ScalabilityMode scalability_mode);
     55 
     56 ScalabilityMode LimitNumSpatialLayers(ScalabilityMode scalability_mode,
     57                                      int max_spatial_layers);
     58 
     59 }  // namespace webrtc
     60 
     61 #endif  // MODULES_VIDEO_CODING_SVC_SCALABILITY_MODE_UTIL_H_