chromium/third_party/libgav1/src/src/symbol_decoder_context_cdfs.inc

// Copyright 2019 The libgav1 Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file is just a convenience to separate out all the CDF constant
// definitions from the symbol decoder context functions.

alignas(kMaxAlignment) constexpr uint16_t kDefaultPartitionCdf
    [kBlockWidthCount][kPartitionContexts][kMaxPartitionTypes + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultSegmentIdCdf[kSegmentIdContexts][kMaxSegments + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultUsePredictedSegmentIdCdf[kUsePredictedSegmentIdContexts]
                                    [kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultSkipCdf[kSkipContexts][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultSkipModeCdf[kSkipModeContexts][kBooleanFieldCdfSize] =;

// This constant is also used for DeltaLf and DeltaLfMulti.
alignas(kMaxAlignment) constexpr uint16_t
    kDefaultDeltaQCdf[kDeltaSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultIntraBlockCopyCdf[kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultIntraFrameYModeCdf[kIntraModeContexts][kIntraModeContexts]
                              [kIntraPredictionModesY + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultYModeCdf[kYModeContexts][kIntraPredictionModesY + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultAngleDeltaCdf[kDirectionalIntraModes][kAngleDeltaSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultUVModeCdf[kBooleanSymbolCount][kIntraPredictionModesY]
                     [kIntraPredictionModesUV + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultCflAlphaSignsCdf[kCflAlphaSignsSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultCflAlphaCdf[kCflAlphaContexts][kCflAlphaSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultUseFilterIntraCdf[kMaxBlockSizes][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultFilterIntraModeCdf[kNumFilterIntraPredictors + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultTxDepthCdf[4][kTxDepthContexts][kMaxTxDepthSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultTxSplitCdf[kTxSplitContexts][kBooleanFieldCdfSize] =;

/* clang-format off */
alignas(kMaxAlignment) constexpr uint16_t kDefaultAllZeroCdf[kCoefficientQuantizerContexts]
                                 [kNumSquareTransformSizes][kAllZeroContexts]
                                 [kBooleanFieldCdfSize] =;
/* clang-format on */

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultInterTxTypeCdf[3][kNumExtendedTransformSizes][kNumTransformTypes +
                                                          1] =;

alignas(kMaxAlignment) constexpr uint16_t kDefaultIntraTxTypeCdf
    [2][kNumExtendedTransformSizes][kIntraPredictionModesY]
    [kNumTransformTypes + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultEobPt16Cdf[kCoefficientQuantizerContexts][kNumPlaneTypes]
                      [kEobPtContexts][kEobPt16SymbolCount + 1] =;
alignas(kMaxAlignment) constexpr uint16_t
    kDefaultEobPt32Cdf[kCoefficientQuantizerContexts][kNumPlaneTypes]
                      [kEobPtContexts][kEobPt32SymbolCount + 1] =;
alignas(kMaxAlignment) constexpr uint16_t
    kDefaultEobPt64Cdf[kCoefficientQuantizerContexts][kNumPlaneTypes]
                      [kEobPtContexts][kEobPt64SymbolCount + 1] =;
alignas(kMaxAlignment) constexpr uint16_t kDefaultEobPt128Cdf
    [kCoefficientQuantizerContexts][kNumPlaneTypes][kEobPtContexts]
    [kEobPt128SymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t kDefaultEobPt256Cdf
    [kCoefficientQuantizerContexts][kNumPlaneTypes][kEobPtContexts]
    [kEobPt256SymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t kDefaultEobPt512Cdf
    [kCoefficientQuantizerContexts][kNumPlaneTypes][kEobPt512SymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultEobPt1024Cdf[kCoefficientQuantizerContexts][kNumPlaneTypes]
                        [kEobPt1024SymbolCount + 1] =;

/* clang-format off */
alignas(kMaxAlignment) constexpr uint16_t kDefaultEobExtraCdf[kCoefficientQuantizerContexts]
                                  [kNumSquareTransformSizes][kNumPlaneTypes]
                                  [kEobExtraContexts][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t kDefaultCoeffBaseEobCdf[kCoefficientQuantizerContexts]
                                      [kNumSquareTransformSizes][kNumPlaneTypes]
                                      [kCoeffBaseEobContexts]
                                      [kCoeffBaseEobSymbolCount + 1] =;
/* clang-format on */

alignas(kMaxAlignment) constexpr uint16_t kDefaultCoeffBaseCdf
    [kCoefficientQuantizerContexts][kNumSquareTransformSizes][kNumPlaneTypes]
    [kCoeffBaseContexts][kCoeffBaseSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t kDefaultCoeffBaseRangeCdf
    [kCoefficientQuantizerContexts][kNumSquareTransformSizes][kNumPlaneTypes]
    [kCoeffBaseRangeContexts][kCoeffBaseRangeSymbolCount + 1] =;

/* clang-format off */
alignas(kMaxAlignment) constexpr uint16_t kDefaultDcSignCdf[kCoefficientQuantizerContexts][kNumPlaneTypes]
                                [kDcSignContexts][kBooleanFieldCdfSize] =;
/* clang-format on */
alignas(kMaxAlignment) constexpr uint16_t
    kDefaultRestorationTypeCdf[kRestorationTypeSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultUseWienerCdf[kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultUseSgrProjCdf[kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultHasPaletteYCdf[kPaletteBlockSizeContexts][kPaletteYModeContexts]
                          [kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultPaletteYSizeCdf[kPaletteBlockSizeContexts]
                           [kPaletteSizeSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultHasPaletteUVCdf[kPaletteUVModeContexts][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultPaletteUVSizeCdf[kPaletteBlockSizeContexts]
                            [kPaletteSizeSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t kDefaultPaletteColorIndexCdf
    [kNumPlaneTypes][kPaletteSizeSymbolCount][kPaletteColorIndexContexts]
    [kPaletteColorIndexSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultIsInterCdf[kIsInterContexts][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultUseCompoundReferenceCdf[kUseCompoundReferenceContexts]
                                   [kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultCompoundReferenceTypeCdf[kCompoundReferenceTypeContexts]
                                    [kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t kDefaultCompoundReferenceCdf
    [kNumCompoundReferenceTypes][kReferenceContexts][3][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultCompoundBackwardReferenceCdf[kReferenceContexts][2]
                                        [kBooleanFieldCdfSize] =;

/* clang-format off */
alignas(kMaxAlignment) constexpr uint16_t kDefaultSingleReferenceCdf[kReferenceContexts][6]
                                         [kBooleanFieldCdfSize] =;
/* clang-format on */

alignas(kMaxAlignment) constexpr uint16_t kDefaultCompoundPredictionModeCdf
    [kCompoundPredictionModeContexts][kNumCompoundInterPredictionModes + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultNewMvCdf[kNewMvContexts][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultZeroMvCdf[kZeroMvContexts][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultReferenceMvCdf[kReferenceMvContexts][kBooleanFieldCdfSize] =;

// This is called drl_mode in the spec where DRL stands for Dynamic Reference
// List.
alignas(kMaxAlignment) constexpr uint16_t
    kDefaultRefMvIndexCdf[kRefMvIndexContexts][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultIsInterIntraCdf[kInterIntraContexts][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultInterIntraModeCdf[kInterIntraContexts][kNumInterIntraModes + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultIsWedgeInterIntraCdf[kMaxBlockSizes][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultWedgeIndexCdf[kMaxBlockSizes][kWedgeIndexSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultUseObmcCdf[kMaxBlockSizes][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMotionModeCdf[kMaxBlockSizes][kNumMotionModes + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultIsExplicitCompoundTypeCdf[kIsExplicitCompoundTypeContexts]
                                     [kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultIsCompoundTypeAverageCdf[kIsCompoundTypeAverageContexts]
                                    [kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultCompoundTypeCdf[kMaxBlockSizes]
                           [kNumExplicitCompoundPredictionTypes + 1] =;

alignas(kMaxAlignment) constexpr uint16_t kDefaultInterpolationFilterCdf
    [kInterpolationFilterContexts][kNumExplicitInterpolationFilters + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvJointCdf[kNumMvJointTypes + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvSignCdf[kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvClassCdf[kMvClassSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvClass0BitCdf[kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvClass0FractionCdf[kBooleanSymbolCount][kMvFractionSymbolCount +
                                                     1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvClass0HighPrecisionCdf[kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvBitCdf[kMvBitSymbolCount][kBooleanFieldCdfSize] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvFractionCdf[kMvFractionSymbolCount + 1] =;

alignas(kMaxAlignment) constexpr uint16_t
    kDefaultMvHighPrecisionCdf[kBooleanFieldCdfSize] =;