1 /*
2 * Copyright (c) 2021-2022, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file     codec_def_common_vvc.h
24 //! \brief    Defines VVC types and macros shared by CodecHal Decoder/Encoder, MHW, and DDI layer
25 //! \details  This is the base header for all codec_def VVC files. All codec_def vvc files should include this file which should not contain any DDI specific code.
26 //!
27 #ifndef __CODEC_DEF_COMMON_VVC_H__
28 #define __CODEC_DEF_COMMON_VVC_H__
29 
30 #include "codec_def_common.h"
31 
32 static const uint32_t vvcMinBlockWidth          = 8;              // Min block width
33 static const uint32_t vvcMinBlockHeight         = 8;              // Min block height
34 static const uint32_t vvcCtu32                  = 32;             // CTU 32x32
35 static const uint32_t vvcCtu64                  = 64;             // CTU 64x64
36 static const uint32_t vvcCtu128                 = 128;            // CTU 128x128
37 static const uint32_t vvcMaxTileWCtb32          = 263;            // Max Tile Width for CTU 32x32
38 static const uint32_t vvcMaxTileWCtb64          = 131;            // Max Tile Width for CTU 64x64
39 static const uint32_t vvcMaxTileWCtb128         = 65;             // Max Tile Width for CTU 128x128
40 
41 //!
42 //! \enum     vvcSliceType
43 //! \brief    VVC slice type
44 //!
45 enum VvcSliceType
46 {
47     vvcSliceB  = 0,
48     vvcSliceP  = 1,
49     vvcSliceI  = 2
50 };
51 
52 //!
53 //! \enum VvcSurfaceId
54 //! VVC surface ID
55 //!
56 enum VvcSurfaceId
57 {
58     vvcReconPic         = 0,    //!< reconstructed picture
59     vvcSrcInputPic      = 1,    //!< input source picture of downscaled resolution (encoder only)
60     vvcOrigUpscaledSrc  = 3,    //!< input source picture of original resolution (encoder only)
61     vvcRefPic0          = 17,    //!< reference frame 0
62     vvcRefPic1          = 18,    //!< reference frame 1
63     vvcRefPic2          = 19,    //!< reference frame 2
64     vvcRefPic3          = 20,    //!< reference frame 3
65     vvcRefPic4          = 21,    //!< reference frame 4
66     vvcRefPic5          = 22,    //!< reference frame 5
67     vvcRefPic6          = 23,    //!< reference frame 6
68     vvcRefPic7          = 24,    //!< reference frame 7
69     vvcRefPic8          = 25,    //!< reference frame 8
70     vvcRefPic9          = 26,    //!< reference frame 9
71     vvcRefPic10         = 27,    //!< reference frame 10
72     vvcRefPic11         = 28,    //!< reference frame 11
73     vvcRefPic12         = 29,    //!< reference frame 12
74     vvcRefPic13         = 30,    //!< reference frame 13
75     vvcRefPic14         = 31,    //!< reference frame 14
76 };
77 
78 // Forward Declarations
79 typedef struct _CODEC_REF_LIST_VVC CODEC_REF_LIST_VVC, *PCODEC_REF_LIST_VVC;
80 
81 //!
82 //! \struct   _CODEC_REF_LIST_VVC
83 //! \brief    Codec reference list with VVC supported
84 //!
85 
86 struct _CODEC_REF_LIST_VVC : public _CODEC_REF_LIST
87 {
88     // Codec specific parameters
89     // VVC
90     struct
91     {
92         uint16_t        m_ppsPicWidthInLumaSamples;             // [8..16888]
93         uint16_t        m_ppsPicHeightInLumaSamples;            // [8..16888]
94         int32_t         m_ppsScalingWinLeftOffset;
95         int32_t         m_ppsScalingWinRightOffset;
96         int32_t         m_ppsScalingWinTopOffset;
97         int32_t         m_ppsScalingWinBottomOffset;
98         uint16_t        m_spsNumSubpicsMinus1;
99 
100         uint32_t        m_currPicScalWinWidthL;
101         uint32_t        m_currPicScalWinHeightL;
102 
103         bool            m_spsHorCollocatedChromaFlag;
104         bool            m_spsVerCollocatedChromaFlag;
105     };
106 };
107 
108 struct VvcRefFrameAttributes
109 {
110     int32_t                         m_refscalingwinleftoffset;
111     int32_t                         m_refscalingwinrightoffset;
112     int32_t                         m_refscalingwintopoffset;
113     int32_t                         m_refscalingwinbottomoffset;
114     uint16_t                        m_refpicwidth;
115     uint16_t                        m_refpicheight;
116     uint32_t                        m_currPicScalWinWidthL;
117     uint32_t                        m_currPicScalWinHeightL;
118 };
119 
120 
121 #endif  // __CODEC_DEF_COMMON_VVC_H__
122