1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84

media / base / svc_scalability_mode.h [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_BASE_SVC_SCALABILITY_MODE_H_
#define MEDIA_BASE_SVC_SCALABILITY_MODE_H_

#include <cstddef>
#include <vector>

#include "media/base/media_export.h"

namespace media {

// This enum class is the corresponding implementation with WebRTC-SVC.
// See https://www.w3.org/TR/webrtc-svc/#scalabilitymodes* for the detail.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. Please keep the consistency with
// VideoEncoderUseCase in tools/metrics/histograms/enums.xml.
enum class SVCScalabilityMode : int {
  kL1T1 = 0,
  kL1T2 = 1,
  kL1T3 = 2,
  kL2T1 = 3,
  kL2T2 = 4,
  kL2T3 = 5,
  kL3T1 = 6,
  kL3T2 = 7,
  kL3T3 = 8,
  kL2T1h = 9,
  kL2T2h = 10,
  kL2T3h = 11,
  kS2T1 = 12,
  kS2T2 = 13,
  kS2T3 = 14,
  kS2T1h = 15,
  kS2T2h = 16,
  kS2T3h = 17,
  kS3T1 = 18,
  kS3T2 = 19,
  kS3T3 = 20,
  kS3T1h = 21,
  kS3T2h = 22,
  kS3T3h = 23,
  kL2T1Key = 24,
  kL2T2Key = 25,
  kL2T2KeyShift = 26,
  kL2T3Key = 27,
  kL2T3KeyShift = 28,
  kL3T1Key = 29,
  kL3T2Key = 30,
  kL3T2KeyShift = 31,
  kL3T3Key = 32,
  kL3T3KeyShift = 33,
  kL3T1h = 34,
  kL3T2h = 35,
  kL3T3h = 36,

  kMaxValue = kL3T3h,
};

enum class SVCInterLayerPredMode : int {
  kOff = 0,      // Inter-layer prediction is disabled.
  kOn = 1,       // Inter-layer prediction is enabled.
  kOnKeyPic = 2  // Inter-layer prediction is enabled for key picture.
};

// Gets the WebRTC-SVC Spec defined scalability mode name.
MEDIA_EXPORT const char* GetScalabilityModeName(
    SVCScalabilityMode scalability_mode);

// Gets the SVCScalabilityMode from |num_spatial_layers|,
// |num_temporal_layers| and |inter_layer_pred|.
MEDIA_EXPORT SVCScalabilityMode
GetSVCScalabilityMode(const size_t num_spatial_layers,
                      const size_t num_temporal_layers,
                      SVCInterLayerPredMode inter_layer_pred);

// Gets the supported SVCScalabilityModes by hardware encoders.
MEDIA_EXPORT std::vector<SVCScalabilityMode>
GetSupportedScalabilityModesByHWEncoderForTesting();
}  // namespace media

#endif  // MEDIA_BASE_SVC_SCALABILITY_MODE_H_