• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2  * \copy
3  *     Copyright (c)  2013, Cisco Systems
4  *     All rights reserved.
5  *
6  *     Redistribution and use in source and binary forms, with or without
7  *     modification, are permitted provided that the following conditions
8  *     are met:
9  *
10  *        * Redistributions of source code must retain the above copyright
11  *          notice, this list of conditions and the following disclaimer.
12  *
13  *        * Redistributions in binary form must reproduce the above copyright
14  *          notice, this list of conditions and the following disclaimer in
15  *          the documentation and/or other materials provided with the
16  *          distribution.
17  *
18  *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24  *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28  *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  *     POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 //macroblock.h
34 #ifndef WELS_MACROBLOCK_H__
35 #define WELS_MACROBLOCK_H__
36 
37 #include "typedefs.h"
38 #include "wels_const.h"
39 #include "wels_common_basis.h"
40 #include "macros.h"
41 
42 namespace WelsEnc {
43 
44 //struct Mb_s;
45 
46 /* MB syntax and context, refer to Page 399 in JVT X201wcm */
47 // keep the most essential level pData structure be 64 Bytes, which matches cache line size; if so, the order with structure maybe negligible.
48 // pls take care when modify MB structure size
49 typedef struct TagMB {
50 /*************************mb_layer() syntax and generated********************************/
51 /*mb_layer():*/
52 Mb_Type         uiMbType;       // including MB detailed partition type, number and type of reference list
53 uint8_t         uiSubMbType[4]; // sub MB types
54 int32_t         iMbXY;          // offset position of MB top left point based
55 int16_t         iMbX;           // position of MB in horizontal axis [0..32767]
56 int16_t         iMbY;           // position of MB in vertical axis [0..32767]
57 
58 uint8_t         uiNeighborAvail;        // avail && same_slice: LEFT_MB_POS:0x01, TOP_MB_POS:0x02, TOPRIGHT_MB_POS = 0x04 ,TOPLEFT_MB_POS = 0x08;
59 uint8_t         uiCbp;
60 
61 SMVUnitXY*      sMv;
62 int8_t*         pRefIndex;
63 
64 int32_t*        pSadCost;          // mb sad. set to 0 for intra mb
65 int8_t*         pIntra4x4PredMode; // [MB_BLOCK4x4_NUM]
66 int8_t*         pNonZeroCount;     // [MB_LUMA_CHROMA_BLOCK4x4_NUM]
67 
68 SMVUnitXY       sP16x16Mv;
69 
70 uint8_t         uiLumaQp;       // uiLumaQp: pPps->iInitialQp + sSliceHeader->delta_qp + mb->dquant.
71 uint8_t         uiChromaQp;
72 uint16_t        uiSliceIdc;     // 2^16=65536 > MaxFS(36864) of level 5.1; AVC: iFirstMbInSlice?; SVC: (iFirstMbInSlice << 7) | ((uiDependencyId << 4) | uiQualityId);
73 uint32_t        uiChromPredMode;
74 int32_t         iLumaDQp;
75 SMVUnitXY       sMvd[MB_BLOCK4x4_NUM]; //only for CABAC writing; storage structure the same as sMv, in 4x4 scan order.
76 int32_t         iCbpDc;
77 //uint8_t         reserved_filling_bytes[1];      // not deleting this line for further changes of this structure. filling bytes reserved to make structure aligned with 4 bytes, higher cache hit on less structure size by 2 cache lines( 2 * 64 bytes) once hit
78 } SMB, *PMb;
79 
80 }
81 
82 #endif//WELS_MACROBLOCK_H__
83