1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2011, ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | |
---|
35 | |
---|
36 | /** \file TComDepthMapGenerator.h |
---|
37 | \brief depth map generator class (header) |
---|
38 | */ |
---|
39 | |
---|
40 | |
---|
41 | #ifndef __TCOM_DEPTH_MAP_GENERATOR__ |
---|
42 | #define __TCOM_DEPTH_MAP_GENERATOR__ |
---|
43 | |
---|
44 | |
---|
45 | #include "CommonDef.h" |
---|
46 | #include "TComPic.h" |
---|
47 | #include "TComPrediction.h" |
---|
48 | #include "TComSlice.h" |
---|
49 | |
---|
50 | #if H_3D_IV_MERGE |
---|
51 | |
---|
52 | class TComVPSAccess // would be better to have a real VPS buffer |
---|
53 | { |
---|
54 | public: |
---|
55 | TComVPSAccess () { clear(); } |
---|
56 | ~TComVPSAccess() {} |
---|
57 | |
---|
58 | Void clear () { ::memset( m_aacVPS, 0x00, sizeof( m_aacVPS ) ); m_uiActiceVPSId = 0;} |
---|
59 | Void addVPS ( TComVPS* pcVPS ) { m_aacVPS[ pcVPS->getVPSId() ] = pcVPS; } |
---|
60 | TComVPS* getVPS ( UInt uiVPSId ) { return m_aacVPS[ uiVPSId ]; } |
---|
61 | TComVPS* getActiveVPS ( ) { return m_aacVPS[ m_uiActiceVPSId ]; } |
---|
62 | Void setActiveVPSId ( UInt activeVPSId ) { m_uiActiceVPSId = activeVPSId; } |
---|
63 | private: |
---|
64 | TComVPS* m_aacVPS[ MAX_NUM_VPS ]; |
---|
65 | UInt m_uiActiceVPSId; |
---|
66 | }; |
---|
67 | |
---|
68 | |
---|
69 | class TComSPSAccess // would be better to have a real SPS buffer |
---|
70 | { |
---|
71 | public: |
---|
72 | TComSPSAccess () { clear(); } |
---|
73 | ~TComSPSAccess() {} |
---|
74 | |
---|
75 | Void clear () { ::memset( m_aacActiveSPS, 0x00, sizeof( m_aacActiveSPS ) ); } |
---|
76 | Void addSPS ( TComSPS* pcSPS ) { m_aacActiveSPS[ pcSPS->isDepth() ? 1 : 0 ][ pcSPS->getViewIndex() ] = pcSPS; } |
---|
77 | TComSPS* getSPS ( UInt uiViewId, |
---|
78 | Bool bIsDepth = false ) { return m_aacActiveSPS[ bIsDepth ? 1 : 0 ][ uiViewId ]; } |
---|
79 | |
---|
80 | UInt getPdm () { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getPredDepthMapGeneration(); } return 0; } |
---|
81 | |
---|
82 | private: |
---|
83 | TComSPS* m_aacActiveSPS[ 2 ][ MAX_VIEW_NUM ]; |
---|
84 | }; |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | class TComAUPicAccess // would be better to have a real decoded picture buffer |
---|
89 | { |
---|
90 | public: |
---|
91 | TComAUPicAccess () : m_iLastPoc( 0 ), m_uiMaxViewId( 0 ) { clear(); } |
---|
92 | ~TComAUPicAccess() {} |
---|
93 | |
---|
94 | Void clear () { ::memset( m_aacCurrAUPics, 0x00, sizeof( m_aacCurrAUPics ) ); } |
---|
95 | Void addPic ( TComPic* pcPic ) { if( m_iLastPoc != pcPic->getPOC() ) |
---|
96 | { |
---|
97 | clear(); |
---|
98 | m_iLastPoc = pcPic->getPOC(); |
---|
99 | } |
---|
100 | m_aacCurrAUPics[ pcPic->getSPS()->isDepth() ? 1 : 0 ][ pcPic->getSPS()->getViewIndex() ] = pcPic; |
---|
101 | if( pcPic->getSPS()->getViewIndex() > m_uiMaxViewId ) |
---|
102 | { |
---|
103 | m_uiMaxViewId = pcPic->getSPS()->getViewIndex(); |
---|
104 | } |
---|
105 | } |
---|
106 | TComPic* getPic ( UInt uiViewId, |
---|
107 | Bool bIsDepth = false ) { return m_aacCurrAUPics[ bIsDepth ? 1 : 0 ][ uiViewId ]; } |
---|
108 | UInt getMaxVId () { return m_uiMaxViewId; } |
---|
109 | |
---|
110 | private: |
---|
111 | Int m_iLastPoc; |
---|
112 | UInt m_uiMaxViewId; |
---|
113 | TComPic* m_aacCurrAUPics[ 2 ][ MAX_VIEW_NUM ]; |
---|
114 | }; |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | class TComDepthMapGenerator |
---|
119 | { |
---|
120 | public: |
---|
121 | TComDepthMapGenerator (); |
---|
122 | ~TComDepthMapGenerator(); |
---|
123 | |
---|
124 | Void create ( Bool bDecoder, UInt uiPicWidth, UInt uiPicHeight, UInt uiMaxCUDepth, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiOrgBitDepth, UInt uiSubSampExpX, UInt uiSubSampExpY ); |
---|
125 | Void destroy (); |
---|
126 | |
---|
127 | Void init( TComPrediction* pcPrediction, TComVPSAccess* pcVPSAccess, TComSPSAccess* pcSPSAccess, TComAUPicAccess* pcAUPicAccess ); |
---|
128 | Void uninit (); |
---|
129 | |
---|
130 | Void initViewComponent ( TComPic* pcPic ); |
---|
131 | |
---|
132 | UInt getSubSampExpX () { return m_uiSubSampExpX; } |
---|
133 | UInt getSubSampExpY () { return m_uiSubSampExpY; } |
---|
134 | |
---|
135 | |
---|
136 | Bool getPdmCandidate ( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge ); |
---|
137 | |
---|
138 | |
---|
139 | private: |
---|
140 | // general parameters |
---|
141 | Bool m_bCreated; |
---|
142 | Bool m_bInit; |
---|
143 | Bool m_bDecoder; |
---|
144 | TComPrediction* m_pcPrediction; |
---|
145 | TComVPSAccess* m_pcVPSAccess; |
---|
146 | TComSPSAccess* m_pcSPSAccess; |
---|
147 | TComAUPicAccess* m_pcAUPicAccess; |
---|
148 | UInt m_uiSubSampExpX; |
---|
149 | UInt m_uiSubSampExpY; |
---|
150 | |
---|
151 | // conversion parameters |
---|
152 | UInt m_uiCurrViewIndex; |
---|
153 | Bool m_bPDMAvailable; |
---|
154 | }; |
---|
155 | |
---|
156 | |
---|
157 | |
---|
158 | #endif |
---|
159 | #endif // __TCOM_DEPTH_MAP_GENERATOR__ |
---|
160 | |
---|
161 | |
---|
162 | |
---|
163 | |
---|