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-2012, ITU/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 ITU/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 | /** \file TAppEncTop.cpp |
---|
35 | \brief Encoder application class |
---|
36 | */ |
---|
37 | |
---|
38 | #include <list> |
---|
39 | #include <fstream> |
---|
40 | #include <stdlib.h> |
---|
41 | #include <stdio.h> |
---|
42 | #include <fcntl.h> |
---|
43 | #include <assert.h> |
---|
44 | |
---|
45 | #include "TAppEncTop.h" |
---|
46 | #include "TLibEncoder/AnnexBwrite.h" |
---|
47 | |
---|
48 | using namespace std; |
---|
49 | |
---|
50 | //! \ingroup TAppEncoder |
---|
51 | //! \{ |
---|
52 | |
---|
53 | // ==================================================================================================================== |
---|
54 | // Constructor / destructor / initialization / destroy |
---|
55 | // ==================================================================================================================== |
---|
56 | |
---|
57 | TAppEncTop::TAppEncTop() |
---|
58 | { |
---|
59 | m_totalBytes = 0; |
---|
60 | m_essentialBytes = 0; |
---|
61 | } |
---|
62 | |
---|
63 | TAppEncTop::~TAppEncTop() |
---|
64 | { |
---|
65 | } |
---|
66 | |
---|
67 | Void TAppEncTop::xInitLibCfg() |
---|
68 | { |
---|
69 | #if VIDYO_VPS_INTEGRATION |
---|
70 | UInt layerId = 0; |
---|
71 | // TODO: fix the assumption here that the temporal structures are all equal across all layers??? |
---|
72 | m_cVPS.setMaxTLayers( m_maxTempLayer[0] ); |
---|
73 | m_cVPS.setMaxLayers( m_iNumberOfViews * (m_bUsingDepthMaps ? 2:1) ); |
---|
74 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
75 | { |
---|
76 | m_cVPS.setNumReorderPics( m_numReorderPics[0][i], i ); |
---|
77 | m_cVPS.setMaxDecPicBuffering( m_maxDecPicBuffering[0][i], i ); |
---|
78 | } |
---|
79 | #endif |
---|
80 | |
---|
81 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
82 | { |
---|
83 | m_frameRcvd.push_back(0); |
---|
84 | m_acTEncTopList.push_back(new TEncTop); |
---|
85 | m_acTVideoIOYuvInputFileList.push_back(new TVideoIOYuv); |
---|
86 | m_acTVideoIOYuvReconFileList.push_back(new TVideoIOYuv); |
---|
87 | m_picYuvRec.push_back(new TComList<TComPicYuv*>) ; |
---|
88 | |
---|
89 | m_acTEncTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
---|
90 | m_acTEncTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
---|
91 | m_acTEncTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
---|
92 | m_acTEncTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
---|
93 | #if PIC_CROPPING |
---|
94 | m_acTEncTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); |
---|
95 | m_acTEncTopList[iViewIdx]->setCropLeft ( m_cropLeft ); |
---|
96 | m_acTEncTopList[iViewIdx]->setCropRight ( m_cropRight ); |
---|
97 | m_acTEncTopList[iViewIdx]->setCropTop ( m_cropTop ); |
---|
98 | m_acTEncTopList[iViewIdx]->setCropBottom ( m_cropBottom ); |
---|
99 | #endif |
---|
100 | m_acTEncTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
---|
101 | m_acTEncTopList[iViewIdx]->setViewId ( iViewIdx ); |
---|
102 | m_acTEncTopList[iViewIdx]->setIsDepth ( false ); |
---|
103 | m_acTEncTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
---|
104 | #if VIDYO_VPS_INTEGRATION |
---|
105 | layerId = iViewIdx * (m_bUsingDepthMaps ? 2:1); |
---|
106 | m_acTEncTopList[iViewIdx]->setLayerId ( layerId ); |
---|
107 | m_cVPS.setDepthFlag ( false, layerId ); |
---|
108 | m_cVPS.setViewId ( iViewIdx, layerId ); |
---|
109 | m_cVPS.setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ], layerId ); |
---|
110 | // TODO: set correct dependentFlag and dependentLayer |
---|
111 | m_cVPS.setDependentFlag ( iViewIdx ? true:false, layerId ); |
---|
112 | m_cVPS.setDependentLayer ( layerId - (m_bUsingDepthMaps ? 2:1), layerId ); |
---|
113 | #endif |
---|
114 | |
---|
115 | m_acTEncTopList[iViewIdx]->setCamParPrecision ( m_cCameraData.getCamParsCodedPrecision () ); |
---|
116 | m_acTEncTopList[iViewIdx]->setCamParInSliceHeader ( m_cCameraData.getVaryingCameraParameters() ); |
---|
117 | m_acTEncTopList[iViewIdx]->setCodedScale ( m_cCameraData.getCodedScale () ); |
---|
118 | m_acTEncTopList[iViewIdx]->setCodedOffset ( m_cCameraData.getCodedOffset () ); |
---|
119 | |
---|
120 | //====== Coding Structure ======== |
---|
121 | m_acTEncTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); |
---|
122 | m_acTEncTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
123 | m_acTEncTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
---|
124 | m_acTEncTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); |
---|
125 | m_acTEncTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); |
---|
126 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
127 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
128 | { |
---|
129 | m_acTEncTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); |
---|
130 | m_acTEncTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); |
---|
131 | } |
---|
132 | #else |
---|
133 | m_acTEncTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); |
---|
134 | m_acTEncTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); |
---|
135 | #endif |
---|
136 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
137 | { |
---|
138 | m_acTEncTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
139 | } |
---|
140 | m_acTEncTopList[iViewIdx]->setQP ( m_aiQP[0] ); |
---|
141 | |
---|
142 | m_acTEncTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
---|
143 | m_acTEncTopList[iViewIdx]->setPad ( m_aiPad ); |
---|
144 | |
---|
145 | #if H0566_TLA |
---|
146 | m_acTEncTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); |
---|
147 | #else |
---|
148 | m_acTEncTopList[iViewIdx]->setTLayering ( m_bTLayering ); |
---|
149 | m_acTEncTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); |
---|
150 | #endif |
---|
151 | |
---|
152 | m_acTEncTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); |
---|
153 | |
---|
154 | m_acTEncTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); |
---|
155 | m_acTEncTopList[iViewIdx]->setUseAMP( m_enableAMP ); |
---|
156 | |
---|
157 | //===== Slice ======== |
---|
158 | |
---|
159 | //====== Loop/Deblock Filter ======== |
---|
160 | m_acTEncTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[0] ); |
---|
161 | m_acTEncTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); |
---|
162 | m_acTEncTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
163 | m_acTEncTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
164 | #if DBL_CONTROL |
---|
165 | m_acTEncTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
166 | #endif |
---|
167 | |
---|
168 | //====== Motion search ======== |
---|
169 | m_acTEncTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
---|
170 | m_acTEncTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
---|
171 | m_acTEncTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
---|
172 | |
---|
173 | //====== Quality control ======== |
---|
174 | m_acTEncTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
175 | m_acTEncTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
176 | |
---|
177 | m_acTEncTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); |
---|
178 | m_acTEncTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); |
---|
179 | |
---|
180 | #if ADAPTIVE_QP_SELECTION |
---|
181 | m_acTEncTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
182 | #endif |
---|
183 | |
---|
184 | #if LOSSLESS_CODING |
---|
185 | Int lowestQP; |
---|
186 | #if H0736_AVC_STYLE_QP_RANGE |
---|
187 | lowestQP = - ( (Int)(6*(g_uiBitDepth + g_uiBitIncrement - 8)) ); |
---|
188 | #else |
---|
189 | lowestQP = 0; |
---|
190 | #endif |
---|
191 | if ((m_iMaxDeltaQP == 0 ) && (m_aiQP[0] == lowestQP) && (m_useLossless == true)) |
---|
192 | { |
---|
193 | m_bUseAdaptiveQP = false; |
---|
194 | } |
---|
195 | #endif |
---|
196 | |
---|
197 | m_acTEncTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
198 | m_acTEncTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
199 | |
---|
200 | #if HHI_VSO |
---|
201 | //====== VSO ========= |
---|
202 | m_acTEncTopList[iViewIdx]->setForceLambdaScaleVSO ( false ); |
---|
203 | m_acTEncTopList[iViewIdx]->setLambdaScaleVSO ( 1 ); |
---|
204 | m_acTEncTopList[iViewIdx]->setVSOMode ( 0 ); |
---|
205 | m_acTEncTopList[iViewIdx]->setUseVSO ( false ); |
---|
206 | #if SAIT_VSO_EST_A0033 |
---|
207 | m_acTEncTopList[iViewIdx]->setUseEstimatedVSD ( false ); |
---|
208 | #endif |
---|
209 | #if LGE_WVSO_A0119 |
---|
210 | m_acTEncTopList[iViewIdx]->setUseWVSO ( false ); |
---|
211 | #endif |
---|
212 | #endif |
---|
213 | |
---|
214 | #if DEPTH_MAP_GENERATION |
---|
215 | m_acTEncTopList[iViewIdx]->setPredDepthMapGeneration ( m_uiPredDepthMapGeneration ); |
---|
216 | m_acTEncTopList[iViewIdx]->setPdmPrecision ( (UInt)m_cCameraData.getPdmPrecision () ); |
---|
217 | m_acTEncTopList[iViewIdx]->setPdmScaleNomDelta ( m_cCameraData.getPdmScaleNomDelta () ); |
---|
218 | m_acTEncTopList[iViewIdx]->setPdmOffset ( m_cCameraData.getPdmOffset () ); |
---|
219 | #endif |
---|
220 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
221 | m_acTEncTopList[iViewIdx]->setMultiviewMvPredMode ( m_uiMultiviewMvPredMode ); |
---|
222 | m_acTEncTopList[iViewIdx]->setMultiviewMvRegMode ( iViewIdx ? m_uiMultiviewMvRegMode : 0 ); |
---|
223 | m_acTEncTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( iViewIdx ? m_dMultiviewMvRegLambdaScale : 0.0 ); |
---|
224 | #endif |
---|
225 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
226 | m_acTEncTopList[iViewIdx]->setMultiviewResPredMode ( m_uiMultiviewResPredMode ); |
---|
227 | #endif |
---|
228 | |
---|
229 | //====== Tool list ======== |
---|
230 | m_acTEncTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
---|
231 | m_acTEncTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
232 | m_acTEncTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
---|
233 | m_acTEncTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
---|
234 | m_acTEncTopList[iViewIdx]->setUseALF ( m_abUseALF[0] ); |
---|
235 | m_acTEncTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
---|
236 | #if LOSSLESS_CODING |
---|
237 | m_acTEncTopList[iViewIdx]->setUseLossless ( m_useLossless ); |
---|
238 | #endif |
---|
239 | m_acTEncTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; |
---|
240 | |
---|
241 | m_acTEncTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
---|
242 | m_acTEncTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
---|
243 | m_acTEncTopList[iViewIdx]->setdQPs ( m_aidQP ); |
---|
244 | m_acTEncTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[0] ); |
---|
245 | #if !PIC_CROPPING |
---|
246 | m_acTEncTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
---|
247 | #endif |
---|
248 | m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
249 | m_acTEncTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
250 | m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
251 | m_acTEncTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
252 | m_acTEncTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
---|
253 | m_acTEncTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); |
---|
254 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
255 | m_acTEncTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
256 | #endif |
---|
257 | m_acTEncTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
258 | #if HHI_INTERVIEW_SKIP |
---|
259 | m_acTEncTopList[iViewIdx]->setInterViewSkip ( iViewIdx>0 ? m_bInterViewSkip : false ); |
---|
260 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
261 | m_acTEncTopList[iViewIdx]->setInterViewSkipLambdaScale ( iViewIdx>0 ? (UInt)m_dInterViewSkipLambdaScale : 1 ); |
---|
262 | #endif |
---|
263 | #endif |
---|
264 | m_acTEncTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
---|
265 | m_acTEncTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
266 | m_acTEncTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
267 | m_acTEncTopList[iViewIdx]->setUsePCM ( m_usePCM ); |
---|
268 | m_acTEncTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
269 | |
---|
270 | //====== Weighted Prediction ======== |
---|
271 | m_acTEncTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
---|
272 | m_acTEncTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
---|
273 | //====== Slice ======== |
---|
274 | m_acTEncTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
---|
275 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
276 | |
---|
277 | //====== Entropy Slice ======== |
---|
278 | m_acTEncTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
---|
279 | m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
---|
280 | int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
281 | if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) |
---|
282 | { |
---|
283 | m_acTEncTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
284 | } |
---|
285 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) |
---|
286 | { |
---|
287 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
288 | } |
---|
289 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
290 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) |
---|
291 | { |
---|
292 | m_acTEncTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
293 | } |
---|
294 | #endif |
---|
295 | m_acTEncTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); |
---|
296 | if(m_iSliceMode == 0 ) |
---|
297 | { |
---|
298 | m_bLFCrossSliceBoundaryFlag = true; |
---|
299 | } |
---|
300 | m_acTEncTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
301 | m_acTEncTopList[iViewIdx]->setUseSAO ( m_abUseSAO[0] ); |
---|
302 | #if LGE_ILLUCOMP_B0045 |
---|
303 | m_acTEncTopList[iViewIdx]->setUseIC ( m_bUseIC ); |
---|
304 | #endif |
---|
305 | #if SAO_UNIT_INTERLEAVING |
---|
306 | m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
307 | m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); |
---|
308 | #endif |
---|
309 | m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
310 | m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
311 | |
---|
312 | m_acTEncTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
---|
313 | |
---|
314 | m_acTEncTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); |
---|
315 | m_acTEncTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); |
---|
316 | #if !REMOVE_TILE_DEPENDENCE |
---|
317 | m_acTEncTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); |
---|
318 | #endif |
---|
319 | m_acTEncTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); |
---|
320 | m_acTEncTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); |
---|
321 | if(m_iUniformSpacingIdr==0) |
---|
322 | { |
---|
323 | m_acTEncTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); |
---|
324 | m_acTEncTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); |
---|
325 | } |
---|
326 | m_acTEncTopList[iViewIdx]->xCheckGSParameters(); |
---|
327 | m_acTEncTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); |
---|
328 | m_acTEncTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); |
---|
329 | m_acTEncTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); |
---|
330 | |
---|
331 | Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); |
---|
332 | m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; |
---|
333 | m_acTEncTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); |
---|
334 | m_acTEncTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); |
---|
335 | #if !REMOVE_TILE_DEPENDENCE |
---|
336 | if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) |
---|
337 | #else |
---|
338 | if(uiTilesCount == 1) |
---|
339 | #endif |
---|
340 | { |
---|
341 | m_bLFCrossTileBoundaryFlag = true; |
---|
342 | } |
---|
343 | m_acTEncTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
344 | m_acTEncTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
345 | m_acTEncTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); |
---|
346 | m_acTEncTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
347 | #if TMVP_DEPTH_SWITCH |
---|
348 | m_acTEncTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP[0] ); |
---|
349 | #else |
---|
350 | m_acTEncTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); |
---|
351 | #endif |
---|
352 | m_acTEncTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); |
---|
353 | m_acTEncTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); |
---|
354 | #if MULTIBITS_DATA_HIDING |
---|
355 | m_acTEncTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); |
---|
356 | m_acTEncTopList[iViewIdx]->setTSIG(m_signHidingThreshold); |
---|
357 | #endif |
---|
358 | |
---|
359 | #if LCU_SYNTAX_ALF |
---|
360 | if(uiTilesCount > 1) |
---|
361 | { |
---|
362 | m_bALFParamInSlice = false; |
---|
363 | m_bALFPicBasedEncode = true; |
---|
364 | } |
---|
365 | m_acTEncTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); |
---|
366 | m_acTEncTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); |
---|
367 | #endif |
---|
368 | |
---|
369 | //====== Depth tools ======== |
---|
370 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
371 | m_acTEncTopList[iViewIdx]->setUseDMM ( false ); |
---|
372 | #endif |
---|
373 | #if OL_QTLIMIT_PREDCODING_B0068 |
---|
374 | m_acTEncTopList[iViewIdx]->setUseQTLPC ( false ); |
---|
375 | #endif |
---|
376 | #if HHI_MPI |
---|
377 | m_acTEncTopList[iViewIdx]->setUseMVI( false ); |
---|
378 | #endif |
---|
379 | #if RWTH_SDC_DLT_B0036 |
---|
380 | m_acTEncTopList[iViewIdx]->setUseDLT ( false ); |
---|
381 | m_acTEncTopList[iViewIdx]->setUseSDC ( false ); |
---|
382 | #endif |
---|
383 | } |
---|
384 | if( m_bUsingDepthMaps ) |
---|
385 | { |
---|
386 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
387 | { |
---|
388 | m_depthFrameRcvd.push_back(0); |
---|
389 | m_acTEncDepthTopList.push_back(new TEncTop); |
---|
390 | m_acTVideoIOYuvDepthInputFileList.push_back(new TVideoIOYuv); |
---|
391 | m_acTVideoIOYuvDepthReconFileList.push_back(new TVideoIOYuv); |
---|
392 | m_picYuvDepthRec.push_back(new TComList<TComPicYuv*>) ; |
---|
393 | |
---|
394 | m_acTEncDepthTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
---|
395 | m_acTEncDepthTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
---|
396 | m_acTEncDepthTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
---|
397 | m_acTEncDepthTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
---|
398 | #if PIC_CROPPING |
---|
399 | m_acTEncDepthTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); |
---|
400 | m_acTEncDepthTopList[iViewIdx]->setCropLeft ( m_cropLeft ); |
---|
401 | m_acTEncDepthTopList[iViewIdx]->setCropRight ( m_cropRight ); |
---|
402 | m_acTEncDepthTopList[iViewIdx]->setCropTop ( m_cropTop ); |
---|
403 | m_acTEncDepthTopList[iViewIdx]->setCropBottom ( m_cropBottom ); |
---|
404 | #endif |
---|
405 | m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
---|
406 | m_acTEncDepthTopList[iViewIdx]->setViewId ( iViewIdx ); |
---|
407 | m_acTEncDepthTopList[iViewIdx]->setIsDepth ( true ); |
---|
408 | m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
---|
409 | #if VIDYO_VPS_INTEGRATION |
---|
410 | layerId = iViewIdx * 2 + 1; |
---|
411 | m_acTEncDepthTopList[iViewIdx]->setLayerId ( layerId ); |
---|
412 | m_cVPS.setDepthFlag ( true, layerId ); |
---|
413 | m_cVPS.setViewId ( iViewIdx, layerId ); |
---|
414 | m_cVPS.setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ], layerId ); |
---|
415 | m_cVPS.setDependentFlag ( true, layerId ); |
---|
416 | m_cVPS.setDependentLayer ( layerId-1, layerId); |
---|
417 | #endif |
---|
418 | m_acTEncDepthTopList[iViewIdx]->setCamParPrecision ( 0 ); |
---|
419 | m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader ( false ); |
---|
420 | m_acTEncDepthTopList[iViewIdx]->setCodedScale ( 0 ); |
---|
421 | m_acTEncDepthTopList[iViewIdx]->setCodedOffset ( 0 ); |
---|
422 | |
---|
423 | //====== Coding Structure ======== |
---|
424 | m_acTEncDepthTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); |
---|
425 | m_acTEncDepthTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
426 | m_acTEncDepthTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
---|
427 | m_acTEncDepthTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); |
---|
428 | m_acTEncDepthTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); |
---|
429 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
430 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
431 | { |
---|
432 | m_acTEncDepthTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); |
---|
433 | m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); |
---|
434 | } |
---|
435 | #else |
---|
436 | m_acTEncDepthTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); |
---|
437 | m_acTEncDepthTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); |
---|
438 | #endif |
---|
439 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
440 | { |
---|
441 | m_acTEncDepthTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
442 | } |
---|
443 | m_acTEncDepthTopList[iViewIdx]->setQP ( m_aiQP[1] ); |
---|
444 | |
---|
445 | m_acTEncDepthTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
---|
446 | m_acTEncDepthTopList[iViewIdx]->setPad ( m_aiPad ); |
---|
447 | |
---|
448 | #if H0566_TLA |
---|
449 | m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); |
---|
450 | #else |
---|
451 | m_acTEncDepthTopList[iViewIdx]->setTLayering ( m_bTLayering ); |
---|
452 | m_acTEncDepthTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); |
---|
453 | #endif |
---|
454 | |
---|
455 | m_acTEncDepthTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); |
---|
456 | |
---|
457 | m_acTEncDepthTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); |
---|
458 | m_acTEncDepthTopList[iViewIdx]->setUseAMP( m_enableAMP ); |
---|
459 | |
---|
460 | //===== Slice ======== |
---|
461 | |
---|
462 | //====== Loop/Deblock Filter ======== |
---|
463 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[1] ); |
---|
464 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); |
---|
465 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
466 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
467 | #if DBL_CONTROL |
---|
468 | m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
469 | #endif |
---|
470 | |
---|
471 | //====== Motion search ======== |
---|
472 | m_acTEncDepthTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
---|
473 | m_acTEncDepthTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
---|
474 | m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
---|
475 | |
---|
476 | //====== Quality control ======== |
---|
477 | m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
478 | m_acTEncDepthTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
479 | |
---|
480 | m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); |
---|
481 | m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); |
---|
482 | |
---|
483 | #if ADAPTIVE_QP_SELECTION |
---|
484 | m_acTEncDepthTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
485 | #endif |
---|
486 | |
---|
487 | m_acTEncDepthTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
488 | m_acTEncDepthTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
489 | |
---|
490 | //====== Tool list ======== |
---|
491 | m_acTEncDepthTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
---|
492 | m_acTEncDepthTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
493 | m_acTEncDepthTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
---|
494 | m_acTEncDepthTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
---|
495 | m_acTEncDepthTopList[iViewIdx]->setUseALF ( m_abUseALF[1] ); |
---|
496 | m_acTEncDepthTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
---|
497 | #if LOSSLESS_CODING |
---|
498 | m_acTEncDepthTopList[iViewIdx]->setUseLossless ( m_useLossless ); |
---|
499 | #endif |
---|
500 | m_acTEncDepthTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; |
---|
501 | |
---|
502 | m_acTEncDepthTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
---|
503 | m_acTEncDepthTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
---|
504 | m_acTEncDepthTopList[iViewIdx]->setdQPs ( m_aidQPdepth ); |
---|
505 | m_acTEncDepthTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[1] ); |
---|
506 | #if !PIC_CROPPING |
---|
507 | m_acTEncDepthTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
---|
508 | #endif |
---|
509 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
510 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
511 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
512 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
513 | m_acTEncDepthTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
---|
514 | m_acTEncDepthTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); |
---|
515 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
516 | m_acTEncDepthTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
517 | #endif |
---|
518 | m_acTEncDepthTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
519 | #if HHI_INTERVIEW_SKIP |
---|
520 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkip ( 0 ); |
---|
521 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
522 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkipLambdaScale ( 1 ); |
---|
523 | #endif |
---|
524 | #endif |
---|
525 | m_acTEncDepthTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
---|
526 | m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
527 | m_acTEncDepthTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
528 | m_acTEncDepthTopList[iViewIdx]->setUsePCM ( m_usePCM ); |
---|
529 | m_acTEncDepthTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
530 | //====== VSO ======== |
---|
531 | #if HHI_VSO |
---|
532 | m_acTEncDepthTopList[iViewIdx]->setUseVSO ( m_bUseVSO ); //GT: might be enabled/disabled later for VSO Mode 4 |
---|
533 | m_acTEncDepthTopList[iViewIdx]->setForceLambdaScaleVSO ( m_bForceLambdaScaleVSO ); |
---|
534 | m_acTEncDepthTopList[iViewIdx]->setLambdaScaleVSO ( m_dLambdaScaleVSO ); |
---|
535 | #if HHI_VSO_DIST_INT |
---|
536 | m_acTEncDepthTopList[iViewIdx]->setAllowNegDist ( m_bAllowNegDist ); |
---|
537 | #endif |
---|
538 | m_acTEncDepthTopList[iViewIdx]->setVSOMode ( m_uiVSOMode ); |
---|
539 | |
---|
540 | #if SAIT_VSO_EST_A0033 |
---|
541 | m_acTEncDepthTopList[iViewIdx]->setUseEstimatedVSD ( m_bUseEstimatedVSD ); |
---|
542 | #endif |
---|
543 | #if LGE_WVSO_A0119 |
---|
544 | m_acTEncDepthTopList[iViewIdx]->setUseWVSO ( m_bUseWVSO ); |
---|
545 | #endif |
---|
546 | #endif |
---|
547 | |
---|
548 | #if DEPTH_MAP_GENERATION |
---|
549 | m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration ( 0 ); |
---|
550 | #endif |
---|
551 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
552 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvPredMode ( 0 ); |
---|
553 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegMode ( 0 ); |
---|
554 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( 0.0 ); |
---|
555 | #endif |
---|
556 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
557 | m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode ( 0 ); |
---|
558 | #endif |
---|
559 | |
---|
560 | //====== Weighted Prediction ======== |
---|
561 | m_acTEncDepthTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
---|
562 | m_acTEncDepthTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
---|
563 | //====== Slice ======== |
---|
564 | m_acTEncDepthTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
---|
565 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
566 | |
---|
567 | //====== Entropy Slice ======== |
---|
568 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
---|
569 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
---|
570 | int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
571 | if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) |
---|
572 | { |
---|
573 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
574 | } |
---|
575 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) |
---|
576 | { |
---|
577 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
578 | } |
---|
579 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
580 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) |
---|
581 | { |
---|
582 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
583 | } |
---|
584 | #endif |
---|
585 | m_acTEncDepthTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); |
---|
586 | if(m_iSliceMode == 0 ) |
---|
587 | { |
---|
588 | m_bLFCrossSliceBoundaryFlag = true; |
---|
589 | } |
---|
590 | m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
591 | m_acTEncDepthTopList[iViewIdx]->setUseSAO ( m_abUseSAO[1] ); |
---|
592 | #if LGE_ILLUCOMP_B0045 |
---|
593 | m_acTEncDepthTopList[iViewIdx]->setUseIC ( false ); |
---|
594 | #endif |
---|
595 | #if SAO_UNIT_INTERLEAVING |
---|
596 | m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
597 | m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); |
---|
598 | #endif |
---|
599 | m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
600 | m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
601 | |
---|
602 | m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
---|
603 | |
---|
604 | m_acTEncDepthTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); |
---|
605 | m_acTEncDepthTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); |
---|
606 | #if !REMOVE_TILE_DEPENDENCE |
---|
607 | m_acTEncDepthTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); |
---|
608 | #endif |
---|
609 | m_acTEncDepthTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); |
---|
610 | m_acTEncDepthTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); |
---|
611 | if(m_iUniformSpacingIdr==0) |
---|
612 | { |
---|
613 | m_acTEncDepthTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); |
---|
614 | m_acTEncDepthTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); |
---|
615 | } |
---|
616 | m_acTEncDepthTopList[iViewIdx]->xCheckGSParameters(); |
---|
617 | m_acTEncDepthTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); |
---|
618 | m_acTEncDepthTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); |
---|
619 | m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); |
---|
620 | |
---|
621 | Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); |
---|
622 | m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; |
---|
623 | m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); |
---|
624 | m_acTEncDepthTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); |
---|
625 | #if !REMOVE_TILE_DEPENDENCE |
---|
626 | if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) |
---|
627 | #else |
---|
628 | if(uiTilesCount == 1) |
---|
629 | #endif |
---|
630 | { |
---|
631 | m_bLFCrossTileBoundaryFlag = true; |
---|
632 | } |
---|
633 | m_acTEncDepthTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
634 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
635 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); |
---|
636 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
637 | #if TMVP_DEPTH_SWITCH |
---|
638 | m_acTEncDepthTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP[1] ); |
---|
639 | #else |
---|
640 | m_acTEncDepthTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); |
---|
641 | #endif |
---|
642 | m_acTEncDepthTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); |
---|
643 | m_acTEncDepthTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); |
---|
644 | #if MULTIBITS_DATA_HIDING |
---|
645 | m_acTEncDepthTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); |
---|
646 | m_acTEncDepthTopList[iViewIdx]->setTSIG(m_signHidingThreshold); |
---|
647 | #endif |
---|
648 | |
---|
649 | #if LCU_SYNTAX_ALF |
---|
650 | if(uiTilesCount > 1) |
---|
651 | { |
---|
652 | m_bALFParamInSlice = false; |
---|
653 | m_bALFPicBasedEncode = true; |
---|
654 | } |
---|
655 | m_acTEncDepthTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); |
---|
656 | m_acTEncDepthTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); |
---|
657 | #endif |
---|
658 | |
---|
659 | //====== Depth tools ======== |
---|
660 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
661 | m_acTEncDepthTopList[iViewIdx]->setUseDMM ( m_bUseDMM ); |
---|
662 | #endif |
---|
663 | #if OL_QTLIMIT_PREDCODING_B0068 |
---|
664 | m_acTEncDepthTopList[iViewIdx]->setUseQTLPC (m_bUseQTLPC); |
---|
665 | #endif |
---|
666 | #if HHI_MPI |
---|
667 | m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI ); |
---|
668 | #endif |
---|
669 | #if RWTH_SDC_DLT_B0036 |
---|
670 | m_acTEncDepthTopList[iViewIdx]->setUseDLT ( m_bUseDLT ); |
---|
671 | m_acTEncDepthTopList[iViewIdx]->setUseSDC ( m_bUseSDC ); |
---|
672 | #endif |
---|
673 | } |
---|
674 | } |
---|
675 | |
---|
676 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
677 | else if( m_uiMultiviewMvRegMode ) |
---|
678 | { |
---|
679 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
680 | { |
---|
681 | m_acTVideoIOYuvDepthInputFileList.push_back( new TVideoIOYuv ); |
---|
682 | } |
---|
683 | } |
---|
684 | #endif |
---|
685 | |
---|
686 | #if HHI_VSO |
---|
687 | if ( m_bUseVSO ) |
---|
688 | { |
---|
689 | if ( m_uiVSOMode == 4 ) |
---|
690 | { |
---|
691 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
692 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip ); |
---|
693 | #else |
---|
694 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 ); |
---|
695 | #endif |
---|
696 | |
---|
697 | for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ ) |
---|
698 | { |
---|
699 | for (Int iContent = 0; iContent < 2; iContent++ ) |
---|
700 | { |
---|
701 | Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent); |
---|
702 | Bool bUseVSO = (iNumOfModels != 0); |
---|
703 | |
---|
704 | TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; |
---|
705 | pcEncTop->setUseVSO( bUseVSO ); |
---|
706 | pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL ); |
---|
707 | |
---|
708 | for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ ) |
---|
709 | { |
---|
710 | Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode; |
---|
711 | |
---|
712 | m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ; |
---|
713 | m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode ); |
---|
714 | } |
---|
715 | } |
---|
716 | } |
---|
717 | } |
---|
718 | else |
---|
719 | { |
---|
720 | AOT(true); |
---|
721 | } |
---|
722 | #if LGE_WVSO_A0119 |
---|
723 | for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ ) |
---|
724 | { |
---|
725 | for (Int iContent = 0; iContent < 2; iContent++ ) |
---|
726 | { |
---|
727 | TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; |
---|
728 | pcEncTop->setUseWVSO ( m_bUseWVSO ); |
---|
729 | pcEncTop->setVSOWeight( m_iVSOWeight ); |
---|
730 | pcEncTop->setVSDWeight( m_iVSDWeight ); |
---|
731 | pcEncTop->setDWeight ( m_iDWeight ); |
---|
732 | } |
---|
733 | } |
---|
734 | #endif |
---|
735 | } |
---|
736 | #endif |
---|
737 | |
---|
738 | #if HHI_INTERVIEW_SKIP |
---|
739 | m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 ); |
---|
740 | #endif |
---|
741 | |
---|
742 | } |
---|
743 | |
---|
744 | Void TAppEncTop::xCreateLib() |
---|
745 | { |
---|
746 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
747 | { |
---|
748 | m_acTVideoIOYuvInputFileList[iViewIdx]->open( m_pchInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
749 | m_acTVideoIOYuvInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
750 | |
---|
751 | if (m_pchReconFileList[iViewIdx]) |
---|
752 | m_acTVideoIOYuvReconFileList[iViewIdx]->open(m_pchReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
---|
753 | m_acTEncTopList[iViewIdx]->create(); |
---|
754 | if( m_bUsingDepthMaps ) |
---|
755 | { |
---|
756 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
757 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
758 | |
---|
759 | if (m_pchDepthReconFileList[iViewIdx]) |
---|
760 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->open(m_pchDepthReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
---|
761 | m_acTEncDepthTopList[iViewIdx]->create(); |
---|
762 | } |
---|
763 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
764 | else if( m_uiMultiviewMvRegMode ) |
---|
765 | { |
---|
766 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
767 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); |
---|
768 | } |
---|
769 | #endif |
---|
770 | } |
---|
771 | } |
---|
772 | |
---|
773 | Void TAppEncTop::xDestroyLib() |
---|
774 | { |
---|
775 | // Video I/O |
---|
776 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
777 | { |
---|
778 | m_acTVideoIOYuvInputFileList[iViewIdx]->close(); |
---|
779 | m_acTVideoIOYuvReconFileList[iViewIdx]->close(); |
---|
780 | delete m_acTVideoIOYuvInputFileList[iViewIdx] ; |
---|
781 | m_acTVideoIOYuvInputFileList[iViewIdx] = NULL; |
---|
782 | delete m_acTVideoIOYuvReconFileList[iViewIdx] ; |
---|
783 | m_acTVideoIOYuvReconFileList[iViewIdx] = NULL; |
---|
784 | m_acTEncTopList[iViewIdx]->deletePicBuffer(); |
---|
785 | m_acTEncTopList[iViewIdx]->destroy(); |
---|
786 | delete m_acTEncTopList[iViewIdx] ; |
---|
787 | m_acTEncTopList[iViewIdx] = NULL; |
---|
788 | delete m_picYuvRec[iViewIdx] ; |
---|
789 | m_picYuvRec[iViewIdx] = NULL; |
---|
790 | |
---|
791 | if( iViewIdx < Int( m_acTVideoIOYuvDepthInputFileList.size() ) && m_acTVideoIOYuvDepthInputFileList[iViewIdx] ) |
---|
792 | { |
---|
793 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->close( ); |
---|
794 | delete m_acTVideoIOYuvDepthInputFileList[iViewIdx]; |
---|
795 | m_acTVideoIOYuvDepthInputFileList[iViewIdx] = NULL; |
---|
796 | } |
---|
797 | if( iViewIdx < Int( m_acTVideoIOYuvDepthReconFileList.size() ) && m_acTVideoIOYuvDepthReconFileList[iViewIdx] ) |
---|
798 | { |
---|
799 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->close () ; |
---|
800 | delete m_acTVideoIOYuvDepthReconFileList[iViewIdx]; |
---|
801 | m_acTVideoIOYuvDepthReconFileList[iViewIdx] = NULL; |
---|
802 | } |
---|
803 | if( iViewIdx < Int( m_acTEncDepthTopList.size() ) && m_acTEncDepthTopList[iViewIdx] ) |
---|
804 | { |
---|
805 | m_acTEncDepthTopList[iViewIdx]->deletePicBuffer(); |
---|
806 | m_acTEncDepthTopList[iViewIdx]->destroy(); |
---|
807 | delete m_acTEncDepthTopList[iViewIdx]; |
---|
808 | m_acTEncDepthTopList[iViewIdx] = NULL; |
---|
809 | } |
---|
810 | if( iViewIdx < Int( m_picYuvDepthRec.size() ) && m_picYuvDepthRec[iViewIdx] ) |
---|
811 | { |
---|
812 | delete m_picYuvDepthRec[iViewIdx] ; |
---|
813 | m_picYuvDepthRec[iViewIdx] = NULL; |
---|
814 | } |
---|
815 | } |
---|
816 | } |
---|
817 | |
---|
818 | Void TAppEncTop::xInitLib() |
---|
819 | { |
---|
820 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
821 | { |
---|
822 | m_acTEncTopList[iViewIdx]->init( this ); |
---|
823 | } |
---|
824 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
825 | { |
---|
826 | m_acTEncTopList[iViewIdx]->setTEncTopList( &m_acTEncTopList ); |
---|
827 | } |
---|
828 | if ( m_bUsingDepthMaps ) |
---|
829 | { |
---|
830 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
831 | { |
---|
832 | m_acTEncDepthTopList[iViewIdx]->init( this ); |
---|
833 | } |
---|
834 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
835 | { |
---|
836 | m_acTEncDepthTopList[iViewIdx]->setTEncTopList( &m_acTEncDepthTopList ); |
---|
837 | } |
---|
838 | } |
---|
839 | } |
---|
840 | |
---|
841 | // ==================================================================================================================== |
---|
842 | // Public member functions |
---|
843 | // ==================================================================================================================== |
---|
844 | |
---|
845 | /** |
---|
846 | - create internal class |
---|
847 | - initialize internal variable |
---|
848 | - until the end of input YUV file, call encoding function in TEncTop class |
---|
849 | - delete allocated buffers |
---|
850 | - destroy internal class |
---|
851 | . |
---|
852 | */ |
---|
853 | Void TAppEncTop::encode() |
---|
854 | { |
---|
855 | fstream bitstreamFile(m_pchBitstreamFile, fstream::binary | fstream::out); |
---|
856 | if (!bitstreamFile) |
---|
857 | { |
---|
858 | fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pchBitstreamFile); |
---|
859 | exit(EXIT_FAILURE); |
---|
860 | } |
---|
861 | |
---|
862 | TComPicYuv* pcPicYuvOrg = new TComPicYuv; |
---|
863 | TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; |
---|
864 | TComPicYuv* pcPdmDepthOrg = new TComPicYuv; |
---|
865 | TComPicYuv* pcPicYuvRec = NULL; |
---|
866 | TComPicYuv* pcDepthPicYuvRec = NULL; |
---|
867 | |
---|
868 | // initialize internal class & member variables |
---|
869 | xInitLibCfg(); |
---|
870 | xCreateLib(); |
---|
871 | xInitLib(); |
---|
872 | |
---|
873 | // main encoder loop |
---|
874 | Bool allEos = false; |
---|
875 | std::vector<Bool> eos ; |
---|
876 | std::vector<Bool> depthEos ; |
---|
877 | Int maxGopSize = 0; |
---|
878 | Int gopSize = 1; |
---|
879 | |
---|
880 | list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process |
---|
881 | maxGopSize = (std::max)(maxGopSize, m_acTEncTopList[0]->getGOPSize()); |
---|
882 | |
---|
883 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
884 | { |
---|
885 | eos.push_back( false ); |
---|
886 | depthEos.push_back( false ); |
---|
887 | |
---|
888 | #if RWTH_SDC_DLT_B0036 |
---|
889 | if( m_bUsingDepthMaps && m_bUseDLT ) |
---|
890 | xAnalyzeInputBaseDepth(iViewIdx, m_iIntraPeriod); |
---|
891 | #endif |
---|
892 | } |
---|
893 | |
---|
894 | // allocate original YUV buffer |
---|
895 | pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
896 | pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
897 | |
---|
898 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
899 | if( m_uiMultiviewMvRegMode ) |
---|
900 | { |
---|
901 | pcPdmDepthOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
902 | } |
---|
903 | #endif |
---|
904 | |
---|
905 | while ( !allEos ) |
---|
906 | { |
---|
907 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
908 | { |
---|
909 | Int frmCnt = 0; |
---|
910 | while ( !eos[iViewIdx] && !(frmCnt == gopSize)) |
---|
911 | { |
---|
912 | // get buffers |
---|
913 | xGetBuffer(pcPicYuvRec, iViewIdx, false); |
---|
914 | |
---|
915 | // read input YUV file |
---|
916 | m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad ); |
---|
917 | |
---|
918 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
919 | if( m_uiMultiviewMvRegMode && iViewIdx ) |
---|
920 | { |
---|
921 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcPdmDepthOrg, m_aiPad, m_bUsingDepthMaps ); |
---|
922 | } |
---|
923 | #endif |
---|
924 | |
---|
925 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
926 | m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg, ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) ); |
---|
927 | #else |
---|
928 | m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg ); |
---|
929 | #endif |
---|
930 | |
---|
931 | // increase number of received frames |
---|
932 | m_frameRcvd[iViewIdx]++; |
---|
933 | frmCnt++; |
---|
934 | // check end of file |
---|
935 | eos[iViewIdx] = ( m_acTVideoIOYuvInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
---|
936 | eos[iViewIdx] = ( m_frameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : eos[iViewIdx] ); |
---|
937 | allEos = allEos|eos[iViewIdx] ; |
---|
938 | } |
---|
939 | if( m_bUsingDepthMaps ) |
---|
940 | { |
---|
941 | Int frmCntDepth = 0; |
---|
942 | while ( !depthEos[iViewIdx] && !(frmCntDepth == gopSize)) |
---|
943 | { |
---|
944 | // get buffers |
---|
945 | xGetBuffer(pcDepthPicYuvRec, iViewIdx, true); |
---|
946 | |
---|
947 | // read input YUV file |
---|
948 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad ); |
---|
949 | |
---|
950 | m_acTEncDepthTopList[iViewIdx]->initNewPic( pcDepthPicYuvOrg ); |
---|
951 | |
---|
952 | // increase number of received frames |
---|
953 | m_depthFrameRcvd[iViewIdx]++; |
---|
954 | frmCntDepth++; |
---|
955 | // check end of file |
---|
956 | depthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
---|
957 | depthEos[iViewIdx] = ( m_depthFrameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : depthEos[iViewIdx] ); |
---|
958 | allEos = allEos|depthEos[iViewIdx] ; |
---|
959 | } |
---|
960 | } |
---|
961 | } |
---|
962 | for ( Int gopId=0; gopId < gopSize; gopId++ ) |
---|
963 | { |
---|
964 | Int iNumEncoded = 0; |
---|
965 | UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId ); |
---|
966 | if ( iNextPoc < m_iFrameToBeEncoded ) |
---|
967 | { |
---|
968 | m_cCameraData.update( iNextPoc ); |
---|
969 | } |
---|
970 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
971 | { |
---|
972 | #if SAIT_VSO_EST_A0033 |
---|
973 | if( m_bUseVSO && iNextPoc < m_iFrameToBeEncoded ) |
---|
974 | { |
---|
975 | m_cCameraData.xSetDispCoeff( iNextPoc, iViewIdx ); |
---|
976 | m_acTEncDepthTopList[iViewIdx]->setDispCoeff( m_cCameraData.getDispCoeff() ); |
---|
977 | } |
---|
978 | #endif |
---|
979 | iNumEncoded = 0; |
---|
980 | // call encoding function for one frame |
---|
981 | m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId ); |
---|
982 | xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, iViewIdx, false); |
---|
983 | outputAccessUnits.clear(); |
---|
984 | if( m_bUsingDepthMaps ) |
---|
985 | { |
---|
986 | Int iNumDepthEncoded = 0; |
---|
987 | // call encoding function for one depth frame |
---|
988 | m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId ); |
---|
989 | xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true); |
---|
990 | outputAccessUnits.clear(); |
---|
991 | } |
---|
992 | } |
---|
993 | #if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED |
---|
994 | for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
995 | { |
---|
996 | if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] ) |
---|
997 | { |
---|
998 | m_acTEncTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
999 | } |
---|
1000 | if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] ) |
---|
1001 | { |
---|
1002 | m_acTEncDepthTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
1003 | } |
---|
1004 | } |
---|
1005 | #endif |
---|
1006 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
1007 | { |
---|
1008 | m_acTEncTopList[iViewIdx]->compressMotion( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
1009 | if( m_bUsingDepthMaps ) |
---|
1010 | { |
---|
1011 | m_acTEncDepthTopList[iViewIdx]->compressMotion( m_acTEncDepthTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
1012 | } |
---|
1013 | } |
---|
1014 | } |
---|
1015 | gopSize = maxGopSize; |
---|
1016 | } |
---|
1017 | // delete original YUV buffer |
---|
1018 | pcPicYuvOrg->destroy(); |
---|
1019 | delete pcPicYuvOrg; |
---|
1020 | pcPicYuvOrg = NULL; |
---|
1021 | pcDepthPicYuvOrg->destroy(); |
---|
1022 | delete pcDepthPicYuvOrg; |
---|
1023 | pcDepthPicYuvOrg = NULL; |
---|
1024 | |
---|
1025 | if ( pcPdmDepthOrg != NULL ) |
---|
1026 | { |
---|
1027 | pcPdmDepthOrg->destroy(); |
---|
1028 | delete pcPdmDepthOrg; |
---|
1029 | pcPdmDepthOrg = NULL; |
---|
1030 | }; |
---|
1031 | |
---|
1032 | |
---|
1033 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
1034 | { |
---|
1035 | m_acTEncTopList[iViewIdx]->printOutSummary(m_acTEncTopList[iViewIdx]->getNumAllPicCoded()); |
---|
1036 | if ( m_bUsingDepthMaps ) |
---|
1037 | { |
---|
1038 | m_acTEncDepthTopList[iViewIdx]->printOutSummary(m_acTEncDepthTopList[iViewIdx]->getNumAllPicCoded()); |
---|
1039 | } |
---|
1040 | } |
---|
1041 | |
---|
1042 | // delete buffers & classes |
---|
1043 | xDeleteBuffer(); |
---|
1044 | xDestroyLib(); |
---|
1045 | |
---|
1046 | return; |
---|
1047 | } |
---|
1048 | |
---|
1049 | TEncTop* TAppEncTop::getTEncTop( Int viewId, Bool isDepth ) |
---|
1050 | { |
---|
1051 | if ( isDepth ) |
---|
1052 | { |
---|
1053 | return m_acTEncDepthTopList[viewId]; |
---|
1054 | } |
---|
1055 | else |
---|
1056 | { |
---|
1057 | return m_acTEncTopList[viewId]; |
---|
1058 | } |
---|
1059 | } |
---|
1060 | |
---|
1061 | |
---|
1062 | // ==================================================================================================================== |
---|
1063 | // Protected member functions |
---|
1064 | // ==================================================================================================================== |
---|
1065 | |
---|
1066 | /** |
---|
1067 | - application has picture buffer list with size of GOP |
---|
1068 | - picture buffer list acts as ring buffer |
---|
1069 | - end of the list has the latest picture |
---|
1070 | . |
---|
1071 | */ |
---|
1072 | Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, Bool isDepth) |
---|
1073 | { |
---|
1074 | assert( m_iGOPSize > 0 ); |
---|
1075 | |
---|
1076 | if( !isDepth ) |
---|
1077 | { |
---|
1078 | if ( m_picYuvRec[iViewIdx]->size() == (UInt)m_iGOPSize ) |
---|
1079 | { |
---|
1080 | rpcPicYuvRec = m_picYuvRec[iViewIdx]->popFront(); |
---|
1081 | } |
---|
1082 | else |
---|
1083 | { |
---|
1084 | rpcPicYuvRec = new TComPicYuv; |
---|
1085 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
1086 | } |
---|
1087 | m_picYuvRec[iViewIdx]->pushBack( rpcPicYuvRec ); |
---|
1088 | } |
---|
1089 | else |
---|
1090 | { |
---|
1091 | if ( m_picYuvDepthRec[iViewIdx]->size() == (UInt)m_iGOPSize ) |
---|
1092 | { |
---|
1093 | rpcPicYuvRec = m_picYuvDepthRec[iViewIdx]->popFront(); |
---|
1094 | } |
---|
1095 | else |
---|
1096 | { |
---|
1097 | rpcPicYuvRec = new TComPicYuv; |
---|
1098 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
1099 | } |
---|
1100 | m_picYuvDepthRec[iViewIdx]->pushBack( rpcPicYuvRec ); |
---|
1101 | } |
---|
1102 | } |
---|
1103 | |
---|
1104 | Void TAppEncTop::xDeleteBuffer( ) |
---|
1105 | { |
---|
1106 | for(Int iViewIdx=0; iViewIdx<m_picYuvRec.size(); iViewIdx++) |
---|
1107 | { |
---|
1108 | if(m_picYuvRec[iViewIdx]) |
---|
1109 | { |
---|
1110 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[iViewIdx]->begin(); |
---|
1111 | Int iSize = Int( m_picYuvRec[iViewIdx]->size() ); |
---|
1112 | for ( Int i = 0; i < iSize; i++ ) |
---|
1113 | { |
---|
1114 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
1115 | if(pcPicYuvRec) |
---|
1116 | { |
---|
1117 | pcPicYuvRec->destroy(); |
---|
1118 | delete pcPicYuvRec; |
---|
1119 | pcPicYuvRec = NULL; |
---|
1120 | } |
---|
1121 | } |
---|
1122 | } |
---|
1123 | } |
---|
1124 | for(Int iViewIdx=0; iViewIdx<m_picYuvDepthRec.size(); iViewIdx++) |
---|
1125 | { |
---|
1126 | if(m_picYuvDepthRec[iViewIdx]) |
---|
1127 | { |
---|
1128 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvDepthRec[iViewIdx]->begin(); |
---|
1129 | Int iSize = Int( m_picYuvDepthRec[iViewIdx]->size() ); |
---|
1130 | for ( Int i = 0; i < iSize; i++ ) |
---|
1131 | { |
---|
1132 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
1133 | if(pcPicYuvRec) |
---|
1134 | { |
---|
1135 | pcPicYuvRec->destroy(); |
---|
1136 | delete pcPicYuvRec; |
---|
1137 | pcPicYuvRec = NULL; |
---|
1138 | } |
---|
1139 | } |
---|
1140 | } |
---|
1141 | } |
---|
1142 | } |
---|
1143 | |
---|
1144 | /** \param iNumEncoded number of encoded frames |
---|
1145 | */ |
---|
1146 | Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, Int iViewIdx, Bool isDepth ) |
---|
1147 | { |
---|
1148 | Int i; |
---|
1149 | |
---|
1150 | if( iNumEncoded > 0 ) |
---|
1151 | { |
---|
1152 | TComList<TComPicYuv*>::iterator iterPicYuvRec = !isDepth ? m_picYuvRec[iViewIdx]->end() : m_picYuvDepthRec[iViewIdx]->end(); |
---|
1153 | |
---|
1154 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
1155 | { |
---|
1156 | --iterPicYuvRec; |
---|
1157 | } |
---|
1158 | |
---|
1159 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
1160 | { |
---|
1161 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
1162 | if( !isDepth ) |
---|
1163 | { |
---|
1164 | if (m_pchReconFileList[iViewIdx]) |
---|
1165 | { |
---|
1166 | #if PIC_CROPPING |
---|
1167 | m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); |
---|
1168 | #else |
---|
1169 | m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); |
---|
1170 | #endif |
---|
1171 | } |
---|
1172 | } |
---|
1173 | else |
---|
1174 | { |
---|
1175 | if (m_pchDepthReconFileList[iViewIdx]) |
---|
1176 | { |
---|
1177 | #if PIC_CROPPING |
---|
1178 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); |
---|
1179 | #else |
---|
1180 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); |
---|
1181 | #endif |
---|
1182 | } |
---|
1183 | } |
---|
1184 | } |
---|
1185 | } |
---|
1186 | if( ! accessUnits.empty() ) |
---|
1187 | { |
---|
1188 | list<AccessUnit>::iterator aUIter; |
---|
1189 | for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ ) |
---|
1190 | { |
---|
1191 | const vector<unsigned>& stats = writeAnnexB(bitstreamFile, *aUIter); |
---|
1192 | rateStatsAccum(*aUIter, stats); |
---|
1193 | } |
---|
1194 | } |
---|
1195 | } |
---|
1196 | |
---|
1197 | |
---|
1198 | TComPicYuv* TAppEncTop::xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ) |
---|
1199 | { |
---|
1200 | TComPic* pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth); |
---|
1201 | TComPicYuv* pcPicYuv = NULL; |
---|
1202 | |
---|
1203 | if (pcPic != NULL) |
---|
1204 | { |
---|
1205 | if( bRecon ) |
---|
1206 | { |
---|
1207 | if ( pcPic->getReconMark() ) |
---|
1208 | { |
---|
1209 | pcPicYuv = pcPic->getPicYuvRec(); |
---|
1210 | } |
---|
1211 | } |
---|
1212 | else |
---|
1213 | { |
---|
1214 | pcPicYuv = pcPic->getPicYuvOrg(); |
---|
1215 | } |
---|
1216 | }; |
---|
1217 | |
---|
1218 | return pcPicYuv; |
---|
1219 | }; |
---|
1220 | |
---|
1221 | /** |
---|
1222 | * |
---|
1223 | */ |
---|
1224 | void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<unsigned>& annexBsizes) |
---|
1225 | { |
---|
1226 | AccessUnit::const_iterator it_au = au.begin(); |
---|
1227 | vector<unsigned>::const_iterator it_stats = annexBsizes.begin(); |
---|
1228 | |
---|
1229 | for (; it_au != au.end(); it_au++, it_stats++) |
---|
1230 | { |
---|
1231 | switch ((*it_au)->m_nalUnitType) |
---|
1232 | { |
---|
1233 | case NAL_UNIT_CODED_SLICE: |
---|
1234 | #if H0566_TLA |
---|
1235 | case NAL_UNIT_CODED_SLICE_IDV: |
---|
1236 | case NAL_UNIT_CODED_SLICE_TLA: |
---|
1237 | case NAL_UNIT_CODED_SLICE_CRA: |
---|
1238 | #else |
---|
1239 | case NAL_UNIT_CODED_SLICE_DATAPART_A: |
---|
1240 | case NAL_UNIT_CODED_SLICE_DATAPART_B: |
---|
1241 | case NAL_UNIT_CODED_SLICE_CDR: |
---|
1242 | #endif |
---|
1243 | case NAL_UNIT_CODED_SLICE_IDR: |
---|
1244 | case NAL_UNIT_SPS: |
---|
1245 | case NAL_UNIT_PPS: |
---|
1246 | #if VIDYO_VPS_INTEGRATION |
---|
1247 | case NAL_UNIT_VPS: |
---|
1248 | #endif |
---|
1249 | m_essentialBytes += *it_stats; |
---|
1250 | break; |
---|
1251 | default: |
---|
1252 | break; |
---|
1253 | } |
---|
1254 | |
---|
1255 | m_totalBytes += *it_stats; |
---|
1256 | } |
---|
1257 | } |
---|
1258 | |
---|
1259 | #if HHI_INTERVIEW_SKIP |
---|
1260 | Void TAppEncTop::getUsedPelsMap( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedSplsMap ) |
---|
1261 | { |
---|
1262 | AOT( iViewIdx <= 0); |
---|
1263 | AOT( iViewIdx >= m_iNumberOfViews ); |
---|
1264 | AOF( m_cCameraData.getCurFrameId() == iPoc ); |
---|
1265 | Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx]; |
---|
1266 | Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0]; |
---|
1267 | |
---|
1268 | AOT( iViewSIdx == iFirstViewSIdx ); |
---|
1269 | |
---|
1270 | Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx); |
---|
1271 | |
---|
1272 | m_cUsedPelsRenderer.setShiftLUTs( |
---|
1273 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
---|
1274 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
1275 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
1276 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
---|
1277 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
1278 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
1279 | -1 |
---|
1280 | ); |
---|
1281 | |
---|
1282 | TComPicYuv* pcPicYuvDepth = xGetPicYuvFromView(0, iPoc, true, true ); |
---|
1283 | AOF( pcPicYuvDepth); |
---|
1284 | |
---|
1285 | m_cUsedPelsRenderer.getUsedSamplesMap( pcPicYuvDepth, pcPicYuvUsedSplsMap, bFirstIsLeft ); |
---|
1286 | } |
---|
1287 | #endif |
---|
1288 | #if HHI_VSO |
---|
1289 | Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset ) |
---|
1290 | { |
---|
1291 | m_cRendererModel.setupPart( iHorOffset, Min( g_uiMaxCUHeight, m_iSourceHeight - iHorOffset ) ); |
---|
1292 | Int iEncViewSIdx = m_cCameraData.getBaseId2SortedId()[ iEncViewIdx ]; |
---|
1293 | |
---|
1294 | // setup base views |
---|
1295 | Int iNumOfBV = m_cRenModStrParser.getNumOfBaseViewsForView( iEncViewSIdx, iEncContent ); |
---|
1296 | |
---|
1297 | for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ ) |
---|
1298 | { |
---|
1299 | Int iBaseViewSIdx; |
---|
1300 | Int iVideoDistMode; |
---|
1301 | Int iDepthDistMode; |
---|
1302 | |
---|
1303 | m_cRenModStrParser.getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode ); |
---|
1304 | |
---|
1305 | AOT( iVideoDistMode < 0 || iVideoDistMode > 2 ); |
---|
1306 | |
---|
1307 | Int iBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iBaseViewSIdx ]; |
---|
1308 | |
---|
1309 | TComPicYuv* pcPicYuvVideoRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, true ); |
---|
1310 | TComPicYuv* pcPicYuvDepthRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , true ); |
---|
1311 | TComPicYuv* pcPicYuvVideoOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, false ); |
---|
1312 | TComPicYuv* pcPicYuvDepthOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , false ); |
---|
1313 | |
---|
1314 | TComPicYuv* pcPicYuvVideoRef = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg : NULL; |
---|
1315 | TComPicYuv* pcPicYuvDepthRef = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg : NULL; |
---|
1316 | |
---|
1317 | TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg : pcPicYuvVideoRec; |
---|
1318 | TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg : pcPicYuvDepthRec; |
---|
1319 | |
---|
1320 | AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) ); |
---|
1321 | AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) ); |
---|
1322 | AOT( pcPicYuvDepthTest == NULL ); |
---|
1323 | AOT( pcPicYuvVideoTest == NULL ); |
---|
1324 | |
---|
1325 | m_cRendererModel.setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef ); |
---|
1326 | } |
---|
1327 | |
---|
1328 | m_cRendererModel.setErrorMode( iEncViewSIdx, iEncContent, 0 ); |
---|
1329 | // setup virtual views |
---|
1330 | Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iEncViewSIdx, iEncContent ); |
---|
1331 | for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ ) |
---|
1332 | { |
---|
1333 | Int iOrgRefBaseViewSIdx; |
---|
1334 | Int iLeftBaseViewSIdx; |
---|
1335 | Int iRightBaseViewSIdx; |
---|
1336 | Int iSynthViewRelNum; |
---|
1337 | Int iModelNum; |
---|
1338 | Int iBlendMode; |
---|
1339 | m_cRenModStrParser.getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum ); |
---|
1340 | |
---|
1341 | Int iLeftBaseViewIdx = -1; |
---|
1342 | Int iRightBaseViewIdx = -1; |
---|
1343 | |
---|
1344 | TComPicYuv* pcPicYuvOrgRef = NULL; |
---|
1345 | Int** ppiShiftLUTLeft = NULL; |
---|
1346 | Int** ppiShiftLUTRight = NULL; |
---|
1347 | Int** ppiBaseShiftLUTLeft = NULL; |
---|
1348 | Int** ppiBaseShiftLUTRight = NULL; |
---|
1349 | |
---|
1350 | |
---|
1351 | Int iDistToLeft = -1; |
---|
1352 | |
---|
1353 | Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum ); |
---|
1354 | |
---|
1355 | if ( iLeftBaseViewSIdx != -1 ) |
---|
1356 | { |
---|
1357 | iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ]; |
---|
1358 | ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ]; |
---|
1359 | } |
---|
1360 | |
---|
1361 | if ( iRightBaseViewSIdx != -1 ) |
---|
1362 | { |
---|
1363 | iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ]; |
---|
1364 | ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ]; |
---|
1365 | } |
---|
1366 | |
---|
1367 | if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 ) |
---|
1368 | { |
---|
1369 | iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx); |
---|
1370 | ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ]; |
---|
1371 | ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ]; |
---|
1372 | |
---|
1373 | } |
---|
1374 | |
---|
1375 | if ( iOrgRefBaseViewSIdx != -1 ) |
---|
1376 | { |
---|
1377 | pcPicYuvOrgRef = xGetPicYuvFromView( m_cCameraData.getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , iPoc, false, false ); |
---|
1378 | AOF ( pcPicYuvOrgRef ); |
---|
1379 | } |
---|
1380 | |
---|
1381 | m_cRendererModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef ); |
---|
1382 | } |
---|
1383 | } |
---|
1384 | #endif |
---|
1385 | |
---|
1386 | |
---|
1387 | |
---|
1388 | /* |
---|
1389 | void TAppEncTop::printRateSummary() |
---|
1390 | { |
---|
1391 | double time = (double) m_iFrameRcvd / m_iFrameRate; |
---|
1392 | printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); |
---|
1393 | #if VERBOSE_RATE |
---|
1394 | printf("Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time); |
---|
1395 | #endif |
---|
1396 | } |
---|
1397 | */ |
---|
1398 | |
---|
1399 | std::vector<TComPic*> TAppEncTop::getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ) |
---|
1400 | { |
---|
1401 | std::vector<TComPic*> apcRefPics( sps->getNumberOfUsableInterViewRefs(), (TComPic*)NULL ); |
---|
1402 | for( Int k = 0; k < sps->getNumberOfUsableInterViewRefs(); k++ ) |
---|
1403 | { |
---|
1404 | TComPic* pcRefPic = xGetPicFromView( sps->getUsableInterViewRef( k ) + viewId, poc, isDepth ); |
---|
1405 | assert( pcRefPic != NULL ); |
---|
1406 | apcRefPics[k] = pcRefPic; |
---|
1407 | } |
---|
1408 | return apcRefPics; |
---|
1409 | } |
---|
1410 | |
---|
1411 | TComPic* TAppEncTop::xGetPicFromView( Int viewIdx, Int poc, Bool isDepth ) |
---|
1412 | { |
---|
1413 | assert( ( viewIdx >= 0 ) && ( viewIdx < m_iNumberOfViews ) ); |
---|
1414 | |
---|
1415 | TComList<TComPic*>* apcListPic = (isDepth ? m_acTEncDepthTopList[viewIdx] : m_acTEncTopList[viewIdx])->getListPic() ; |
---|
1416 | |
---|
1417 | TComPic* pcPic = NULL; |
---|
1418 | for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++) |
---|
1419 | { |
---|
1420 | if( (*it)->getPOC() == poc ) |
---|
1421 | { |
---|
1422 | pcPic = *it ; |
---|
1423 | break ; |
---|
1424 | } |
---|
1425 | } |
---|
1426 | |
---|
1427 | return pcPic; |
---|
1428 | }; |
---|
1429 | |
---|
1430 | #if RWTH_SDC_DLT_B0036 |
---|
1431 | Void TAppEncTop::xAnalyzeInputBaseDepth(Int iViewIdx, UInt uiNumFrames) |
---|
1432 | { |
---|
1433 | TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; |
---|
1434 | // allocate original YUV buffer |
---|
1435 | pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
1436 | |
---|
1437 | TVideoIOYuv* depthVideoFile = new TVideoIOYuv; |
---|
1438 | |
---|
1439 | UInt uiMaxDepthValue = g_uiIBDI_MAX; |
---|
1440 | |
---|
1441 | Bool abValidDepths[256]; |
---|
1442 | |
---|
1443 | depthVideoFile->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
1444 | |
---|
1445 | // initialize boolean array |
---|
1446 | for(Int p=0; p<=uiMaxDepthValue; p++) |
---|
1447 | abValidDepths[p] = false; |
---|
1448 | |
---|
1449 | Int iHeight = pcDepthPicYuvOrg->getHeight(); |
---|
1450 | Int iWidth = pcDepthPicYuvOrg->getWidth(); |
---|
1451 | Int iStride = pcDepthPicYuvOrg->getStride(); |
---|
1452 | |
---|
1453 | Pel* pInDM = pcDepthPicYuvOrg->getLumaAddr(); |
---|
1454 | |
---|
1455 | for(Int uiFrame=0; uiFrame < uiNumFrames; uiFrame++ ) |
---|
1456 | { |
---|
1457 | depthVideoFile->read( pcDepthPicYuvOrg, m_aiPad, false ); |
---|
1458 | |
---|
1459 | // check all pixel values |
---|
1460 | for (Int i=0; i<iHeight; i++) |
---|
1461 | { |
---|
1462 | Int rowOffset = i*iStride; |
---|
1463 | |
---|
1464 | for (Int j=0; j<iWidth; j++) |
---|
1465 | { |
---|
1466 | Pel depthValue = pInDM[rowOffset+j]; |
---|
1467 | abValidDepths[depthValue] = true; |
---|
1468 | } |
---|
1469 | } |
---|
1470 | } |
---|
1471 | |
---|
1472 | depthVideoFile->close(); |
---|
1473 | |
---|
1474 | pcDepthPicYuvOrg->destroy(); |
---|
1475 | delete pcDepthPicYuvOrg; |
---|
1476 | |
---|
1477 | // convert boolean array to idx2Depth LUT |
---|
1478 | UInt* auiIdx2DepthValue = (UInt*) calloc(uiMaxDepthValue, sizeof(UInt)); |
---|
1479 | UInt uiNumDepthValues = 0; |
---|
1480 | for(UInt p=0; p<=uiMaxDepthValue; p++) |
---|
1481 | { |
---|
1482 | if( abValidDepths[p] == true) |
---|
1483 | { |
---|
1484 | auiIdx2DepthValue[uiNumDepthValues++] = p; |
---|
1485 | } |
---|
1486 | } |
---|
1487 | |
---|
1488 | if( uiNumFrames == 0 || ceil(Log2(uiNumDepthValues)) == ceil(Log2(g_uiIBDI_MAX)) ) |
---|
1489 | { |
---|
1490 | // don't use DLT |
---|
1491 | m_acTEncDepthTopList[iViewIdx]->setUseDLT(false); |
---|
1492 | m_acTEncDepthTopList[iViewIdx]->getSPS()->setUseDLT(false); |
---|
1493 | } |
---|
1494 | |
---|
1495 | // assign LUT |
---|
1496 | if( m_acTEncDepthTopList[iViewIdx]->getUseDLT() ) |
---|
1497 | m_acTEncDepthTopList[iViewIdx]->getSPS()->setDepthLUTs(auiIdx2DepthValue, uiNumDepthValues); |
---|
1498 | else |
---|
1499 | m_acTEncDepthTopList[iViewIdx]->getSPS()->setDepthLUTs(); |
---|
1500 | |
---|
1501 | // free temporary memory |
---|
1502 | free(auiIdx2DepthValue); |
---|
1503 | } |
---|
1504 | #endif |
---|
1505 | |
---|
1506 | //! \} |
---|