1 | |
---|
2 | #ifndef __TCOM3DASYMLUT__ |
---|
3 | #define __TCOM3DASYMLUT__ |
---|
4 | |
---|
5 | #include "TypeDef.h" |
---|
6 | |
---|
7 | #if Q0048_CGS_3D_ASYMLUT |
---|
8 | |
---|
9 | typedef struct _SYUVP |
---|
10 | { |
---|
11 | Pel Y , U , V; |
---|
12 | }SYUVP; |
---|
13 | |
---|
14 | typedef struct _SCuboid // vertexes for tetrahedral interpolation |
---|
15 | { |
---|
16 | SYUVP P[4]; // YUV: P0(0,0,0), P1(0,1,0), P3(0,1,1), P7(1,1,1) |
---|
17 | }SCuboid; |
---|
18 | |
---|
19 | class TComPicYuv; |
---|
20 | |
---|
21 | class TCom3DAsymLUT |
---|
22 | { |
---|
23 | public: |
---|
24 | TCom3DAsymLUT(); |
---|
25 | virtual ~TCom3DAsymLUT(); |
---|
26 | |
---|
27 | virtual Void create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 ); |
---|
28 | virtual Void destroy(); |
---|
29 | |
---|
30 | Int getMaxOctantDepth() { return m_nMaxOctantDepth; } |
---|
31 | Int getCurOctantDepth() { return m_nCurOctantDepth; } |
---|
32 | Int getInputBitDepthY() { return m_nInputBitDepthY; } |
---|
33 | Int getOutputBitDepthY() { return m_nOutputBitDepthY; } |
---|
34 | Int getInputBitDepthC() { return m_nInputBitDepthC; } |
---|
35 | Int getOutputBitDepthC() { return m_nOutputBitDepthC; } |
---|
36 | Int getResQuantBit() { return m_nResQuanBit; } |
---|
37 | Void setResQuantBit(Int n){ m_nResQuanBit = n; } |
---|
38 | Int getMaxYPartNumLog2() { return m_nMaxYPartNumLog2; } |
---|
39 | Int getCurYPartNumLog2() { return m_nCurYPartNumLog2; } |
---|
40 | |
---|
41 | Void colorMapping( TComPicYuv * pcPicSrc, TComPicYuv * pcPicDst ); |
---|
42 | Void copy3DAsymLUT( TCom3DAsymLUT * pSrc ); |
---|
43 | |
---|
44 | SYUVP xGetCuboidVertexPredAll( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx , SCuboid *** pCurCuboid=NULL ); |
---|
45 | SYUVP getCuboidVertexResTree( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx ); |
---|
46 | Void setCuboidVertexResTree( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx , Int deltaY , Int deltaU , Int deltaV ); |
---|
47 | |
---|
48 | |
---|
49 | private: |
---|
50 | Int m_nMaxOctantDepth; |
---|
51 | Int m_nCurOctantDepth; |
---|
52 | Int m_nInputBitDepthY; |
---|
53 | Int m_nOutputBitDepthY; |
---|
54 | Int m_nInputBitDepthC; |
---|
55 | Int m_nOutputBitDepthC; |
---|
56 | Int m_nDeltaBitDepthC; |
---|
57 | Int m_nDeltaBitDepth; |
---|
58 | Int m_nMaxYPartNumLog2; |
---|
59 | Int m_nCurYPartNumLog2; |
---|
60 | Int m_nMaxPartNumLog2; |
---|
61 | Int m_nYSize; |
---|
62 | Int m_nUSize; |
---|
63 | Int m_nVSize; |
---|
64 | Int m_nYShift2Idx; |
---|
65 | Int m_nUShift2Idx; |
---|
66 | Int m_nVShift2Idx; |
---|
67 | Int m_nMappingShift; |
---|
68 | Int m_nMappingOffset; |
---|
69 | Int m_nResQuanBit; |
---|
70 | SCuboid *** m_pCuboid; |
---|
71 | const static Int m_nVertexIdxOffset[4][3]; |
---|
72 | |
---|
73 | protected: |
---|
74 | template <class T> |
---|
75 | Void xAllocate3DArray( T*** &p , Int xSize , Int ySize , Int zSize ); |
---|
76 | template <class T> |
---|
77 | Void xReset3DArray( T*** &p , Int xSize , Int ySize , Int zSize ); |
---|
78 | template <class T> |
---|
79 | Void xFree3DArray( T *** &p ); |
---|
80 | |
---|
81 | Void xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 ); |
---|
82 | SYUVP xGetCuboidVertexPredA( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx ); |
---|
83 | Pel xMapY( Pel y , Pel u , Pel v ); |
---|
84 | SYUVP xMapUV( Pel y , Pel u , Pel v ); |
---|
85 | Int xGetMaxPartNumLog2() { return m_nMaxPartNumLog2; } |
---|
86 | Int xGetYSize() { return m_nYSize; } |
---|
87 | Int xGetUSize() { return m_nUSize; } |
---|
88 | Int xGetVSize() { return m_nVSize; } |
---|
89 | Int xGetYShift2Idx() { return m_nYShift2Idx; } |
---|
90 | Int xGetUShift2Idx() { return m_nUShift2Idx; } |
---|
91 | Int xGetVShift2Idx() { return m_nVShift2Idx; } |
---|
92 | SCuboid & xGetCuboid( Int yIdx , Int uIdx , Int vIdx ){ return m_pCuboid[yIdx][uIdx][vIdx]; } |
---|
93 | Void xSaveCuboids( SCuboid *** pSrcCuboid ); |
---|
94 | }; |
---|
95 | |
---|
96 | template <class T> |
---|
97 | Void TCom3DAsymLUT::xAllocate3DArray( T *** &p , Int xSize , Int ySize , Int zSize ) |
---|
98 | { |
---|
99 | p = new T**[xSize]; |
---|
100 | p[0] = new T*[xSize*ySize]; |
---|
101 | for( Int x = 1 ; x < xSize ; x++ ) |
---|
102 | p[x] = p[x-1] + ySize; |
---|
103 | p[0][0] = new T[xSize*ySize*zSize]; |
---|
104 | for( Int x = 0 ; x < xSize ; x++ ) |
---|
105 | { |
---|
106 | for( Int y = 0 ; y < ySize ; y++ ) |
---|
107 | p[x][y] = p[0][0] + x * ySize * zSize + y * zSize; |
---|
108 | } |
---|
109 | } |
---|
110 | |
---|
111 | template <class T> |
---|
112 | Void TCom3DAsymLUT::xFree3DArray( T *** &p ) |
---|
113 | { |
---|
114 | if( p != NULL ) |
---|
115 | { |
---|
116 | if( p[0] != NULL ) |
---|
117 | { |
---|
118 | if( p[0][0] != NULL ) |
---|
119 | delete [] p[0][0]; |
---|
120 | delete [] p[0]; |
---|
121 | } |
---|
122 | delete [] p; |
---|
123 | p = NULL; |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | template <class T> |
---|
128 | Void TCom3DAsymLUT::xReset3DArray( T*** &p , Int xSize , Int ySize , Int zSize ) |
---|
129 | { |
---|
130 | memset( p[0][0] , 0 , sizeof( T ) * xSize * ySize * zSize ); |
---|
131 | } |
---|
132 | |
---|
133 | #endif |
---|
134 | |
---|
135 | #endif |
---|