1 /*
2 * Copyright (c) 2017, 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_mpeg2.h
24 //! \brief    Defines basic MPEG2 types and macros shared by CodecHal, MHW, and DDI layer
25 //! \details  This is the base header for all codec_def MPEG2 files. All codec_def MPEG2 files should include this file which should not contain any DDI specific code.
26 //!
27 #ifndef __CODEC_DEF_COMMON_MPEG2_H__
28 #define __CODEC_DEF_COMMON_MPEG2_H__
29 
30 #include "codec_def_common.h"
31 
32 //!
33 //! \struct CodecMpeg2IqMatrix
34 //! \brief Inverse Quantization Matrix Buffer
35 //!
36 struct CodecMpeg2IqMatrix
37 {
38     int32_t m_loadIntraQuantiserMatrix;         //!< Indicate if intra Quantiser Matrix is available
39     int32_t m_loadNonIntraQuantiserMatrix;      //!< Indicate if non intra Quantiser Matrix is available
40     int32_t m_loadChromaIntraQuantiserMatrix;   //!< Indicate if chroma intra Quantiser Matrix is available
41     int32_t m_loadChromaNonIntraQuantiserMatrix;//!< Indicate if chroma non intra Quantiser Matrix is available
42     uint8_t m_intraQuantiserMatrix[64];         //!< Intra Quantiser Matrix
43     uint8_t m_nonIntraQuantiserMatrix[64];      //!< Non intra Quantiser Matrix
44     uint8_t m_chromaIntraQuantiserMatrix[64];   //!< Chroma intra Quantiser Matrix
45     uint8_t m_chromaNonIntraQuantiserMatrix[64];//!< Chroma non intra Quantiser Matrix
46 };
47 
48 //!
49 //! \struct CodecDecodeMpeg2MbParams
50 //! \brief  Mpeg2 MB parameter
51 //!
52 struct CodecDecodeMpeg2MbParams
53 {
54     int32_t m_mbAddr;  //!< Macroblock address
55     union
56     {
57         struct
58         {
59             uint16_t m_intraMb : 1;           //!< Intra macroblock
60             uint16_t m_motionFwd : 1;         //!< Microblock forward motion
61             uint16_t m_motionBwd : 1;         //!< Microblock backward motion
62             uint16_t m_motion4mv : 1;         //!< Microblock 4MV motion
63             uint16_t m_h261Lpfilter : 1;      //!< low pass filter
64             uint16_t m_fieldResidual : 1;     //!< DCT type
65             uint16_t m_mbScanMethod : 2;      //!< 0: zigzag scan, 1:alternative-vertical, 2: alternative-horizontal
66             uint16_t m_motionType : 2;        //!< Invalid for I pic, for P/B pic
67             uint16_t m_hostResidualDiff : 1;  //!< Host residual difference
68             uint16_t m_reserved : 1;          //!< Reserved
69             uint16_t m_mvertFieldSel : 4;     //!< Motion vertical field select
70         };
71         uint16_t m_value;
72     } MBType;
73     uint16_t m_mbSkipFollowing;                   //!< The number of skipped macroblocks to be generated following the current macroblock.
74     uint32_t m_mbDataLoc;                         //!< Used as an index into residual difference block data buffer.
75     uint16_t m_codedBlockPattern;                 //!< Coded block pattern
76     uint8_t  m_numCoeff[CODEC_NUM_BLOCK_PER_MB];  //!< Indicates the number of coefficients in the residual difference data buffer for each block i of the macroblock.
77     int16_t  m_motionVectors[8];                  //!< Motion vector
78 };
79 
80 #endif  // __CODEC_DEF_COMMON_MPEG2_H__
81