• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 The libgav1 Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef LIBGAV1_SRC_DSP_CONSTANTS_H_
18 #define LIBGAV1_SRC_DSP_CONSTANTS_H_
19 
20 // This file contains DSP related constants that have a direct relationship with
21 // a DSP component.
22 
23 #include <cstdint>
24 
25 #include "src/utils/constants.h"
26 
27 namespace libgav1 {
28 
29 enum {
30   // Documentation variables.
31   kBitdepth8 = 8,
32   kBitdepth10 = 10,
33   kBitdepth12 = 12,
34   // Weights are quadratic from '1' to '1 / block_size', scaled by
35   // 2^kSmoothWeightScale.
36   kSmoothWeightScale = 8,
37   kCflLumaBufferStride = 32,
38   // InterRound0, Section 7.11.3.2.
39   kInterRoundBitsHorizontal = 3,  // 8 & 10-bit.
40   kInterRoundBitsHorizontal12bpp = 5,
41   kInterRoundBitsCompoundVertical = 7,  // 8, 10 & 12-bit compound prediction.
42   kInterRoundBitsVertical = 11,         // 8 & 10-bit, single prediction.
43   kInterRoundBitsVertical12bpp = 9,
44   // Offset applied to 10bpp and 12bpp predictors to allow storing them in
45   // uint16_t. Removed before blending.
46   kCompoundOffset = (1 << 14) + (1 << 13),
47   kCdefSecondaryTap0 = 2,
48   kCdefSecondaryTap1 = 1,
49 };  // anonymous enum
50 
51 extern const int8_t kFilterIntraTaps[kNumFilterIntraPredictors][8][8];
52 
53 // Values in this enum can be derived as the sum of subsampling_x and
54 // subsampling_y (since subsampling_x == 0 && subsampling_y == 1 case is never
55 // allowed by the bitstream).
56 enum SubsamplingType : uint8_t {
57   kSubsamplingType444,  // subsampling_x = 0, subsampling_y = 0.
58   kSubsamplingType422,  // subsampling_x = 1, subsampling_y = 0.
59   kSubsamplingType420,  // subsampling_x = 1, subsampling_y = 1.
60   kNumSubsamplingTypes
61 };
62 
63 extern const uint16_t kSgrScaleParameter[16][2];
64 
65 extern const uint8_t kCdefPrimaryTaps[2][2];
66 
67 extern const int8_t kCdefDirectionsPadded[12][2][2];
68 
69 }  // namespace libgav1
70 
71 #endif  // LIBGAV1_SRC_DSP_CONSTANTS_H_
72