1 | |
---|
2 | |
---|
3 | /** \file TComPicYuv.h |
---|
4 | \brief picture YUV buffer class (header) |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __TCOMPICYUV__ |
---|
8 | #define __TCOMPICYUV__ |
---|
9 | |
---|
10 | #include <stdio.h> |
---|
11 | #include "CommonDef.h" |
---|
12 | |
---|
13 | // ==================================================================================================================== |
---|
14 | // Class definition |
---|
15 | // ==================================================================================================================== |
---|
16 | |
---|
17 | /// picture YUV buffer class |
---|
18 | class TComPicYuv |
---|
19 | { |
---|
20 | private: |
---|
21 | |
---|
22 | // ------------------------------------------------------------------------------------------------ |
---|
23 | // YUV buffer |
---|
24 | // ------------------------------------------------------------------------------------------------ |
---|
25 | |
---|
26 | Pel* m_apiPicBufY; ///< Buffer (including margin) |
---|
27 | Pel* m_apiPicBufU; |
---|
28 | Pel* m_apiPicBufV; |
---|
29 | |
---|
30 | Pel* m_piPicOrgY; ///< m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma |
---|
31 | Pel* m_piPicOrgU; |
---|
32 | Pel* m_piPicOrgV; |
---|
33 | |
---|
34 | // ------------------------------------------------------------------------------------------------ |
---|
35 | // Parameter for general YUV buffer usage |
---|
36 | // ------------------------------------------------------------------------------------------------ |
---|
37 | |
---|
38 | Int m_iPicWidth; ///< Width of picture |
---|
39 | Int m_iPicHeight; ///< Height of picture |
---|
40 | |
---|
41 | Int m_iCuWidth; ///< Width of Coding Unit (CU) |
---|
42 | Int m_iCuHeight; ///< Height of Coding Unit (CU) |
---|
43 | UInt m_uiMaxCuDepth; ///< maximum coding unit depth |
---|
44 | Int m_iBaseUnitWidth; ///< Width of Base Unit (with maximum depth or minimum size, m_iCuWidth >> Max. Depth) |
---|
45 | Int m_iBaseUnitHeight; ///< Height of Base Unit (with maximum depth or minimum size, m_iCuHeight >> Max. Depth) |
---|
46 | Int m_iNumCuInWidth; |
---|
47 | |
---|
48 | Int m_iLumaMarginX; |
---|
49 | Int m_iLumaMarginY; |
---|
50 | Int m_iChromaMarginX; |
---|
51 | Int m_iChromaMarginY; |
---|
52 | |
---|
53 | Bool m_bIsBorderExtended; |
---|
54 | |
---|
55 | protected: |
---|
56 | Void xExtendPicCompBorder (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY); |
---|
57 | Void xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal ); |
---|
58 | |
---|
59 | public: |
---|
60 | TComPicYuv (); |
---|
61 | virtual ~TComPicYuv(); |
---|
62 | |
---|
63 | // ------------------------------------------------------------------------------------------------ |
---|
64 | // Memory management |
---|
65 | // ------------------------------------------------------------------------------------------------ |
---|
66 | |
---|
67 | Void create ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth ); |
---|
68 | Void destroy (); |
---|
69 | |
---|
70 | Void createLuma ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uhMaxCUDepth ); |
---|
71 | Void destroyLuma (); |
---|
72 | |
---|
73 | // ------------------------------------------------------------------------------------------------ |
---|
74 | // Get information of picture |
---|
75 | // ------------------------------------------------------------------------------------------------ |
---|
76 | |
---|
77 | Int getWidth () { return m_iPicWidth; } |
---|
78 | Int getHeight () { return m_iPicHeight; } |
---|
79 | |
---|
80 | UInt getMaxCuWidth () { return (UInt)m_iCuWidth; } |
---|
81 | UInt getMaxCuHeight() { return (UInt)m_iCuHeight; } |
---|
82 | UInt getMaxCuDepth () { return m_uiMaxCuDepth; } |
---|
83 | |
---|
84 | Int getStride () { return (m_iPicWidth ) + (m_iLumaMarginX <<1); } |
---|
85 | Int getCStride () { return (m_iPicWidth >> 1) + (m_iChromaMarginX<<1); } |
---|
86 | |
---|
87 | Int getLumaMargin () { return m_iLumaMarginX; } |
---|
88 | Int getChromaMargin () { return m_iChromaMarginX;} |
---|
89 | |
---|
90 | Void getLumaMinMax( Int* pMin, Int* pMax ); |
---|
91 | |
---|
92 | // ------------------------------------------------------------------------------------------------ |
---|
93 | // Access function for picture buffer |
---|
94 | // ------------------------------------------------------------------------------------------------ |
---|
95 | |
---|
96 | // Access starting position of picture buffer with margin |
---|
97 | Pel* getBufY () { return m_apiPicBufY; } |
---|
98 | Pel* getBufU () { return m_apiPicBufU; } |
---|
99 | Pel* getBufV () { return m_apiPicBufV; } |
---|
100 | |
---|
101 | // Access starting position of original picture |
---|
102 | Pel* getLumaAddr () { return m_piPicOrgY; } |
---|
103 | Pel* getCbAddr () { return m_piPicOrgU; } |
---|
104 | Pel* getCrAddr () { return m_piPicOrgV; } |
---|
105 | |
---|
106 | // Access starting position of original picture for specific coding unit (CU) or partition unit (PU) |
---|
107 | Pel* getLumaAddr ( Int iCuAddr ); |
---|
108 | Pel* getCbAddr ( Int iCuAddr ); |
---|
109 | Pel* getCrAddr ( Int iCuAddr ); |
---|
110 | Pel* getLumaAddr ( Int iCuAddr, Int uiAbsZorderIdx ); |
---|
111 | Pel* getCbAddr ( Int iCuAddr, Int uiAbsZorderIdx ); |
---|
112 | Pel* getCrAddr ( Int iCuAddr, Int uiAbsZorderIdx ); |
---|
113 | |
---|
114 | // ------------------------------------------------------------------------------------------------ |
---|
115 | // Miscellaneous |
---|
116 | // ------------------------------------------------------------------------------------------------ |
---|
117 | |
---|
118 | // sample to block and block to sample conversion |
---|
119 | Void getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY ); |
---|
120 | Void getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx ); |
---|
121 | |
---|
122 | // Copy function to picture |
---|
123 | Void copyToPic ( TComPicYuv* pcPicYuvDst ); |
---|
124 | Void copyToPicLuma ( TComPicYuv* pcPicYuvDst ); |
---|
125 | Void copyToPicCb ( TComPicYuv* pcPicYuvDst ); |
---|
126 | Void copyToPicCr ( TComPicYuv* pcPicYuvDst ); |
---|
127 | |
---|
128 | // Extend function of picture buffer |
---|
129 | Void extendPicBorder (); |
---|
130 | |
---|
131 | // Dump picture |
---|
132 | Void dump (char* pFileName, Bool bAdd = false); |
---|
133 | |
---|
134 | // Set border extension flag |
---|
135 | Void setBorderExtension(Bool b) { m_bIsBorderExtended = b; } |
---|
136 | #if FIXED_ROUNDING_FRAME_MEMORY |
---|
137 | Void xFixedRoundingPic(); |
---|
138 | #endif |
---|
139 | |
---|
140 | // Set Function |
---|
141 | Void setLumaTo ( Pel pVal ); |
---|
142 | Void setChromaTo ( Pel pVal ); |
---|
143 | |
---|
144 | };// END CLASS DEFINITION TComPicYuv |
---|
145 | |
---|
146 | void calcMD5(TComPicYuv& pic, unsigned char digest[16]); |
---|
147 | |
---|
148 | #endif // __TCOMPICYUV__ |
---|
149 | |
---|