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_decode_mpeg2.h 24 //! \brief Defines decode MPEG2 types and macros shared by CodecHal, MHW, and DDI layer 25 //! \details Applies to MPEG2 decode only. Should not contain any DDI specific code. 26 //! 27 #ifndef __CODEC_DEF_DECODE_MPEG2_H__ 28 #define __CODEC_DEF_DECODE_MPEG2_H__ 29 30 #include "codec_def_common_mpeg2.h" 31 32 #define CODEC_MPEG2_BATCH_BUFFERS_NUM 3 //! number of batch buffers 33 #define CODEC_MPEG2_BYTES_PER_MB 512 //! bitstream size per macroblock 34 #define CODEC_MPEG2_IDCTBLOCK_SIZE 64 //! IDCT block size 35 36 #define CODEC_MPEG2_MB_MOTION_FORWARD 2 //!< Bit 1 37 #define CODEC_MPEG2_MB_MOTION_BACKWARD 4 //!< Bit 2 38 39 //! 40 //! \struct CodecDecodeMpeg2PicParams 41 //! \brief Mpeg2 picture parameter 42 //! 43 struct CodecDecodeMpeg2PicParams 44 { 45 CODEC_PICTURE m_currPic; //!< The current frame surface 46 uint16_t m_forwardRefIdx; //!< Forward reference index 47 uint16_t m_backwardRefIdx; //!< Backward reference index 48 uint32_t m_topFieldFirst; //!< Indicate that the first field of the reconstructed frame is the top field 49 bool m_secondField; //!< Indicate the second field 50 uint32_t m_statusReportFeedbackNumber; //!< The status report feedback data 51 52 union 53 { 54 struct 55 { 56 uint16_t m_reserved0 : 6; //!< Reserved 57 uint16_t m_scanOrder : 1; //!< Indicate the scan order 58 uint16_t m_intraVlcFormat : 1; //!< Intra VLC format 59 uint16_t m_quantizerScaleType : 1; //!< Quantizer scan type 60 uint16_t m_concealmentMVFlag : 1; //!< Concealment MV flag 61 uint16_t m_frameDctPrediction : 1; //!< Frame DCT prediction 62 uint16_t m_topFieldFirst : 1; //!< First frame first 63 uint16_t m_reserved1 : 2; //!< Reserved 64 uint16_t m_intraDCPrecision : 2; //!< Intra DC precision 65 }; 66 struct 67 { 68 uint16_t m_value; //!< word 0 value 69 }; 70 } W0; 71 union 72 { 73 struct 74 { 75 uint16_t m_fcode11 : 4; //!< Used for backward vertical motion vector prediction 76 uint16_t m_fcode10 : 4; //!< Used for backward horizontal motion vector prediction 77 uint16_t m_fcode01 : 4; //!< Used for forward vertical motion vector prediction 78 uint16_t m_fcode00 : 4; //!< Used for forward horizontal motion vector prediction 79 }; 80 struct 81 { 82 uint16_t m_value; //!< word 1 value 83 }; 84 } W1; 85 86 uint16_t m_horizontalSize; //!< Picture horizontal size 87 uint16_t m_verticalSize; //!< Picture vertical size 88 int32_t m_pictureCodingType; //!< Picture coding type 89 }; 90 91 //! 92 //! \struct CodecDecodeMpeg2SliceParams 93 //! \brief Mpeg2 slice parameter 94 //! 95 struct CodecDecodeMpeg2SliceParams 96 { 97 uint32_t m_sliceDataSize; //!< Number of bits for this slice 98 uint32_t m_sliceDataOffset; //!< Offset to the first byte of slice data 99 uint32_t m_macroblockOffset; //!< Offset to the first bit of MB from the first byte of slice data 100 uint32_t m_sliceHorizontalPosition; //!< The horizontal position of the first macroblock in the slice 101 uint32_t m_sliceVerticalPosition; //!< The vertical position of the first macroblock in the slice 102 int32_t m_quantiserScaleCode; //!< Quantiser scale code 103 uint32_t m_numMbsForSlice; //!< The number of macroblocks in the slice 104 bool m_numMbsForSliceOverflow; //!< NumMbsForSlice > max allowable Mbs 105 uint8_t m_reservedBits; //!< for WAs 106 uint8_t m_startCodeBitOffset; //!< Start code bit offset 107 }; 108 109 #endif // __CODEC_DEF_DECODE_MPEG2_H__ 110 111