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