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]->setWVSO ( 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 SAO_UNIT_INTERLEAVING |
---|
303 | m_acTEncTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
304 | m_acTEncTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); |
---|
305 | #endif |
---|
306 | m_acTEncTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
307 | m_acTEncTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
308 | |
---|
309 | m_acTEncTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
---|
310 | |
---|
311 | m_acTEncTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); |
---|
312 | m_acTEncTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); |
---|
313 | #if !REMOVE_TILE_DEPENDENCE |
---|
314 | m_acTEncTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); |
---|
315 | #endif |
---|
316 | m_acTEncTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); |
---|
317 | m_acTEncTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); |
---|
318 | if(m_iUniformSpacingIdr==0) |
---|
319 | { |
---|
320 | m_acTEncTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); |
---|
321 | m_acTEncTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); |
---|
322 | } |
---|
323 | m_acTEncTopList[iViewIdx]->xCheckGSParameters(); |
---|
324 | m_acTEncTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); |
---|
325 | m_acTEncTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); |
---|
326 | m_acTEncTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); |
---|
327 | |
---|
328 | Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); |
---|
329 | m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; |
---|
330 | m_acTEncTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); |
---|
331 | m_acTEncTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); |
---|
332 | #if !REMOVE_TILE_DEPENDENCE |
---|
333 | if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) |
---|
334 | #else |
---|
335 | if(uiTilesCount == 1) |
---|
336 | #endif |
---|
337 | { |
---|
338 | m_bLFCrossTileBoundaryFlag = true; |
---|
339 | } |
---|
340 | m_acTEncTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
341 | m_acTEncTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
342 | m_acTEncTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); |
---|
343 | m_acTEncTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
344 | m_acTEncTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); |
---|
345 | m_acTEncTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); |
---|
346 | m_acTEncTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); |
---|
347 | #if MULTIBITS_DATA_HIDING |
---|
348 | m_acTEncTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); |
---|
349 | m_acTEncTopList[iViewIdx]->setTSIG(m_signHidingThreshold); |
---|
350 | #endif |
---|
351 | |
---|
352 | #if LCU_SYNTAX_ALF |
---|
353 | if(uiTilesCount > 1) |
---|
354 | { |
---|
355 | m_bALFParamInSlice = false; |
---|
356 | m_bALFPicBasedEncode = true; |
---|
357 | } |
---|
358 | m_acTEncTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); |
---|
359 | m_acTEncTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); |
---|
360 | #endif |
---|
361 | |
---|
362 | //====== Depth tools ======== |
---|
363 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
364 | m_acTEncTopList[iViewIdx]->setUseDMM ( false ); |
---|
365 | #endif |
---|
366 | #if HHI_MPI |
---|
367 | m_acTEncTopList[iViewIdx]->setUseMVI( false ); |
---|
368 | #endif |
---|
369 | } |
---|
370 | if( m_bUsingDepthMaps ) |
---|
371 | { |
---|
372 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
373 | { |
---|
374 | m_depthFrameRcvd.push_back(0); |
---|
375 | m_acTEncDepthTopList.push_back(new TEncTop); |
---|
376 | m_acTVideoIOYuvDepthInputFileList.push_back(new TVideoIOYuv); |
---|
377 | m_acTVideoIOYuvDepthReconFileList.push_back(new TVideoIOYuv); |
---|
378 | m_picYuvDepthRec.push_back(new TComList<TComPicYuv*>) ; |
---|
379 | |
---|
380 | m_acTEncDepthTopList[iViewIdx]->setFrameRate ( m_iFrameRate ); |
---|
381 | m_acTEncDepthTopList[iViewIdx]->setFrameSkip ( m_FrameSkip ); |
---|
382 | m_acTEncDepthTopList[iViewIdx]->setSourceWidth ( m_iSourceWidth ); |
---|
383 | m_acTEncDepthTopList[iViewIdx]->setSourceHeight ( m_iSourceHeight ); |
---|
384 | #if PIC_CROPPING |
---|
385 | m_acTEncDepthTopList[iViewIdx]->setCroppingMode ( m_croppingMode ); |
---|
386 | m_acTEncDepthTopList[iViewIdx]->setCropLeft ( m_cropLeft ); |
---|
387 | m_acTEncDepthTopList[iViewIdx]->setCropRight ( m_cropRight ); |
---|
388 | m_acTEncDepthTopList[iViewIdx]->setCropTop ( m_cropTop ); |
---|
389 | m_acTEncDepthTopList[iViewIdx]->setCropBottom ( m_cropBottom ); |
---|
390 | #endif |
---|
391 | m_acTEncDepthTopList[iViewIdx]->setFrameToBeEncoded ( m_iFrameToBeEncoded ); |
---|
392 | m_acTEncDepthTopList[iViewIdx]->setViewId ( iViewIdx ); |
---|
393 | m_acTEncDepthTopList[iViewIdx]->setIsDepth ( true ); |
---|
394 | m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] ); |
---|
395 | #if VIDYO_VPS_INTEGRATION |
---|
396 | layerId = iViewIdx * 2 + 1; |
---|
397 | m_acTEncDepthTopList[iViewIdx]->setLayerId ( layerId ); |
---|
398 | m_cVPS.setDepthFlag ( true, layerId ); |
---|
399 | m_cVPS.setViewId ( iViewIdx, layerId ); |
---|
400 | m_cVPS.setViewOrderIdx ( m_cCameraData.getViewOrderIndex()[ iViewIdx ], layerId ); |
---|
401 | m_cVPS.setDependentFlag ( true, layerId ); |
---|
402 | m_cVPS.setDependentLayer ( layerId-1, layerId); |
---|
403 | #endif |
---|
404 | m_acTEncDepthTopList[iViewIdx]->setCamParPrecision ( 0 ); |
---|
405 | m_acTEncDepthTopList[iViewIdx]->setCamParInSliceHeader ( false ); |
---|
406 | m_acTEncDepthTopList[iViewIdx]->setCodedScale ( 0 ); |
---|
407 | m_acTEncDepthTopList[iViewIdx]->setCodedOffset ( 0 ); |
---|
408 | |
---|
409 | //====== Coding Structure ======== |
---|
410 | m_acTEncDepthTopList[iViewIdx]->setIntraPeriod ( m_iIntraPeriod ); |
---|
411 | m_acTEncDepthTopList[iViewIdx]->setDecodingRefreshType ( m_iDecodingRefreshType ); |
---|
412 | m_acTEncDepthTopList[iViewIdx]->setGOPSize ( m_iGOPSize ); |
---|
413 | m_acTEncDepthTopList[iViewIdx]->setGopList ( m_GOPListsMvc[iViewIdx] ); |
---|
414 | m_acTEncDepthTopList[iViewIdx]->setExtraRPSs ( m_extraRPSs[iViewIdx] ); |
---|
415 | #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER |
---|
416 | for(Int i = 0; i < MAX_TLAYER; i++) |
---|
417 | { |
---|
418 | m_acTEncDepthTopList[iViewIdx]->setNumReorderPics ( m_numReorderPics[iViewIdx][i], i ); |
---|
419 | m_acTEncDepthTopList[iViewIdx]->setMaxDecPicBuffering ( m_maxDecPicBuffering[iViewIdx][i], i ); |
---|
420 | } |
---|
421 | #else |
---|
422 | m_acTEncDepthTopList[iViewIdx]->setNumReorderFrames ( m_numReorderFrames ); |
---|
423 | m_acTEncDepthTopList[iViewIdx]->setMaxNumberOfReferencePictures ( m_maxNumberOfReferencePictures ); |
---|
424 | #endif |
---|
425 | for( UInt uiLoop = 0; uiLoop < MAX_TLAYER; ++uiLoop ) |
---|
426 | { |
---|
427 | m_acTEncDepthTopList[iViewIdx]->setLambdaModifier( uiLoop, m_adLambdaModifier[ uiLoop ] ); |
---|
428 | } |
---|
429 | m_acTEncDepthTopList[iViewIdx]->setQP ( m_aiQP[1] ); |
---|
430 | |
---|
431 | m_acTEncDepthTopList[iViewIdx]->setTemporalLayerQPOffset ( m_aiTLayerQPOffset ); |
---|
432 | m_acTEncDepthTopList[iViewIdx]->setPad ( m_aiPad ); |
---|
433 | |
---|
434 | #if H0566_TLA |
---|
435 | m_acTEncDepthTopList[iViewIdx]->setMaxTempLayer ( m_maxTempLayer[iViewIdx] ); |
---|
436 | #else |
---|
437 | m_acTEncDepthTopList[iViewIdx]->setTLayering ( m_bTLayering ); |
---|
438 | m_acTEncDepthTopList[iViewIdx]->setTLayerSwitchingFlag ( m_abTLayerSwitchingFlag ); |
---|
439 | #endif |
---|
440 | |
---|
441 | m_acTEncDepthTopList[iViewIdx]->setDisInter4x4 ( m_bDisInter4x4); |
---|
442 | |
---|
443 | m_acTEncDepthTopList[iViewIdx]->setUseNSQT( m_enableNSQT ); |
---|
444 | m_acTEncDepthTopList[iViewIdx]->setUseAMP( m_enableAMP ); |
---|
445 | |
---|
446 | //===== Slice ======== |
---|
447 | |
---|
448 | //====== Loop/Deblock Filter ======== |
---|
449 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterDisable ( m_abLoopFilterDisable[1] ); |
---|
450 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterOffsetInAPS ( m_loopFilterOffsetInAPS ); |
---|
451 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterBetaOffset ( m_loopFilterBetaOffsetDiv2 ); |
---|
452 | m_acTEncDepthTopList[iViewIdx]->setLoopFilterTcOffset ( m_loopFilterTcOffsetDiv2 ); |
---|
453 | #if DBL_CONTROL |
---|
454 | m_acTEncDepthTopList[iViewIdx]->setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent); |
---|
455 | #endif |
---|
456 | |
---|
457 | //====== Motion search ======== |
---|
458 | m_acTEncDepthTopList[iViewIdx]->setFastSearch ( m_iFastSearch ); |
---|
459 | m_acTEncDepthTopList[iViewIdx]->setSearchRange ( m_iSearchRange ); |
---|
460 | m_acTEncDepthTopList[iViewIdx]->setBipredSearchRange ( m_bipredSearchRange ); |
---|
461 | |
---|
462 | //====== Quality control ======== |
---|
463 | m_acTEncDepthTopList[iViewIdx]->setMaxDeltaQP ( m_iMaxDeltaQP ); |
---|
464 | m_acTEncDepthTopList[iViewIdx]->setMaxCuDQPDepth ( m_iMaxCuDQPDepth ); |
---|
465 | |
---|
466 | m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset ( m_iChromaQpOffset ); |
---|
467 | m_acTEncDepthTopList[iViewIdx]->setChromaQpOffset2nd ( m_iChromaQpOffset2nd ); |
---|
468 | |
---|
469 | #if ADAPTIVE_QP_SELECTION |
---|
470 | m_acTEncDepthTopList[iViewIdx]->setUseAdaptQpSelect ( m_bUseAdaptQpSelect ); |
---|
471 | #endif |
---|
472 | |
---|
473 | m_acTEncDepthTopList[iViewIdx]->setUseAdaptiveQP ( m_bUseAdaptiveQP ); |
---|
474 | m_acTEncDepthTopList[iViewIdx]->setQPAdaptationRange ( m_iQPAdaptationRange ); |
---|
475 | |
---|
476 | //====== Tool list ======== |
---|
477 | m_acTEncDepthTopList[iViewIdx]->setUseSBACRD ( m_bUseSBACRD ); |
---|
478 | m_acTEncDepthTopList[iViewIdx]->setDeltaQpRD ( m_uiDeltaQpRD ); |
---|
479 | m_acTEncDepthTopList[iViewIdx]->setUseASR ( m_bUseASR ); |
---|
480 | m_acTEncDepthTopList[iViewIdx]->setUseHADME ( m_bUseHADME ); |
---|
481 | m_acTEncDepthTopList[iViewIdx]->setUseALF ( m_abUseALF[1] ); |
---|
482 | m_acTEncDepthTopList[iViewIdx]->setALFEncodePassReduction ( m_iALFEncodePassReduction ); |
---|
483 | #if LOSSLESS_CODING |
---|
484 | m_acTEncDepthTopList[iViewIdx]->setUseLossless ( m_useLossless ); |
---|
485 | #endif |
---|
486 | m_acTEncDepthTopList[iViewIdx]->setALFMaxNumberFilters ( m_iALFMaxNumberFilters ) ; |
---|
487 | |
---|
488 | m_acTEncDepthTopList[iViewIdx]->setUseLComb ( m_bUseLComb ); |
---|
489 | m_acTEncDepthTopList[iViewIdx]->setLCMod ( m_bLCMod ); |
---|
490 | m_acTEncDepthTopList[iViewIdx]->setdQPs ( m_aidQPdepth ); |
---|
491 | m_acTEncDepthTopList[iViewIdx]->setUseRDOQ ( m_abUseRDOQ[1] ); |
---|
492 | #if !PIC_CROPPING |
---|
493 | m_acTEncDepthTopList[iViewIdx]->setUsePAD ( m_bUsePAD ); |
---|
494 | #endif |
---|
495 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MaxSize ( m_uiQuadtreeTULog2MaxSize ); |
---|
496 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTULog2MinSize ( m_uiQuadtreeTULog2MinSize ); |
---|
497 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthInter ( m_uiQuadtreeTUMaxDepthInter ); |
---|
498 | m_acTEncDepthTopList[iViewIdx]->setQuadtreeTUMaxDepthIntra ( m_uiQuadtreeTUMaxDepthIntra ); |
---|
499 | m_acTEncDepthTopList[iViewIdx]->setUseFastEnc ( m_bUseFastEnc ); |
---|
500 | m_acTEncDepthTopList[iViewIdx]->setUseEarlyCU ( m_bUseEarlyCU ); |
---|
501 | #if FAST_DECISION_FOR_MRG_RD_COST |
---|
502 | m_acTEncDepthTopList[iViewIdx]->setUseFastDecisionForMerge ( m_useFastDecisionForMerge ); |
---|
503 | #endif |
---|
504 | m_acTEncDepthTopList[iViewIdx]->setUseCbfFastMode ( m_bUseCbfFastMode ); |
---|
505 | #if HHI_INTERVIEW_SKIP |
---|
506 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkip ( 0 ); |
---|
507 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
508 | m_acTEncDepthTopList[iViewIdx]->setInterViewSkipLambdaScale ( 1 ); |
---|
509 | #endif |
---|
510 | #endif |
---|
511 | m_acTEncDepthTopList[iViewIdx]->setUseLMChroma ( m_bUseLMChroma ); |
---|
512 | m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred ( m_bUseConstrainedIntraPred ); |
---|
513 | m_acTEncDepthTopList[iViewIdx]->setPCMLog2MinSize ( m_uiPCMLog2MinSize); |
---|
514 | m_acTEncDepthTopList[iViewIdx]->setUsePCM ( m_usePCM ); |
---|
515 | m_acTEncDepthTopList[iViewIdx]->setPCMLog2MaxSize ( m_pcmLog2MaxSize); |
---|
516 | //====== VSO ======== |
---|
517 | #if HHI_VSO |
---|
518 | m_acTEncDepthTopList[iViewIdx]->setUseVSO ( m_bUseVSO ); //GT: might be enabled/disabled later for VSO Mode 4 |
---|
519 | m_acTEncDepthTopList[iViewIdx]->setForceLambdaScaleVSO ( m_bForceLambdaScaleVSO ); |
---|
520 | m_acTEncDepthTopList[iViewIdx]->setLambdaScaleVSO ( m_dLambdaScaleVSO ); |
---|
521 | #if HHI_VSO_DIST_INT |
---|
522 | m_acTEncDepthTopList[iViewIdx]->setAllowNegDist ( m_bAllowNegDist ); |
---|
523 | #endif |
---|
524 | m_acTEncDepthTopList[iViewIdx]->setVSOMode ( m_uiVSOMode ); |
---|
525 | |
---|
526 | #if SAIT_VSO_EST_A0033 |
---|
527 | m_acTEncDepthTopList[iViewIdx]->setUseEstimatedVSD ( m_bUseEstimatedVSD ); |
---|
528 | #endif |
---|
529 | #if LGE_WVSO_A0119 |
---|
530 | m_acTEncDepthTopList[iViewIdx]->setWVSO ( m_bWVSO ); |
---|
531 | #endif |
---|
532 | #endif |
---|
533 | |
---|
534 | #if DEPTH_MAP_GENERATION |
---|
535 | m_acTEncDepthTopList[iViewIdx]->setPredDepthMapGeneration ( 0 ); |
---|
536 | #endif |
---|
537 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
538 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvPredMode ( 0 ); |
---|
539 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegMode ( 0 ); |
---|
540 | m_acTEncDepthTopList[iViewIdx]->setMultiviewMvRegLambdaScale ( 0.0 ); |
---|
541 | #endif |
---|
542 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
543 | m_acTEncDepthTopList[iViewIdx]->setMultiviewResPredMode ( 0 ); |
---|
544 | #endif |
---|
545 | |
---|
546 | //====== Weighted Prediction ======== |
---|
547 | m_acTEncDepthTopList[iViewIdx]->setUseWP ( m_bUseWeightPred ); |
---|
548 | m_acTEncDepthTopList[iViewIdx]->setWPBiPredIdc ( m_uiBiPredIdc ); |
---|
549 | //====== Slice ======== |
---|
550 | m_acTEncDepthTopList[iViewIdx]->setSliceMode ( m_iSliceMode ); |
---|
551 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
552 | |
---|
553 | //====== Entropy Slice ======== |
---|
554 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceMode ( m_iEntropySliceMode ); |
---|
555 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument ); |
---|
556 | int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1); |
---|
557 | if(m_iEntropySliceMode==SHARP_FIXED_NUMBER_OF_LCU_IN_ENTROPY_SLICE) |
---|
558 | { |
---|
559 | m_acTEncDepthTopList[iViewIdx]->setEntropySliceArgument ( m_iEntropySliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
560 | } |
---|
561 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_LCU_IN_SLICE) |
---|
562 | { |
---|
563 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument * ( iNumPartInCU >> ( m_iSliceGranularity << 1 ) ) ); |
---|
564 | } |
---|
565 | #if FIXED_NUMBER_OF_TILES_SLICE_MODE |
---|
566 | if(m_iSliceMode==AD_HOC_SLICES_FIXED_NUMBER_OF_TILES_IN_SLICE) |
---|
567 | { |
---|
568 | m_acTEncDepthTopList[iViewIdx]->setSliceArgument ( m_iSliceArgument ); |
---|
569 | } |
---|
570 | #endif |
---|
571 | m_acTEncDepthTopList[iViewIdx]->setSliceGranularity ( m_iSliceGranularity ); |
---|
572 | if(m_iSliceMode == 0 ) |
---|
573 | { |
---|
574 | m_bLFCrossSliceBoundaryFlag = true; |
---|
575 | } |
---|
576 | m_acTEncDepthTopList[iViewIdx]->setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
577 | m_acTEncDepthTopList[iViewIdx]->setUseSAO ( m_abUseSAO[1] ); |
---|
578 | #if SAO_UNIT_INTERLEAVING |
---|
579 | m_acTEncDepthTopList[iViewIdx]->setMaxNumOffsetsPerPic (m_maxNumOffsetsPerPic); |
---|
580 | m_acTEncDepthTopList[iViewIdx]->setSaoInterleavingFlag (m_saoInterleavingFlag); |
---|
581 | #endif |
---|
582 | m_acTEncDepthTopList[iViewIdx]->setPCMInputBitDepthFlag ( m_bPCMInputBitDepthFlag); |
---|
583 | m_acTEncDepthTopList[iViewIdx]->setPCMFilterDisableFlag ( m_bPCMFilterDisableFlag); |
---|
584 | |
---|
585 | m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled); |
---|
586 | |
---|
587 | m_acTEncDepthTopList[iViewIdx]->setColumnRowInfoPresent ( m_iColumnRowInfoPresent ); |
---|
588 | m_acTEncDepthTopList[iViewIdx]->setUniformSpacingIdr ( m_iUniformSpacingIdr ); |
---|
589 | #if !REMOVE_TILE_DEPENDENCE |
---|
590 | m_acTEncDepthTopList[iViewIdx]->setTileBoundaryIndependenceIdr( m_iTileBoundaryIndependenceIdr ); |
---|
591 | #endif |
---|
592 | m_acTEncDepthTopList[iViewIdx]->setNumColumnsMinus1 ( m_iNumColumnsMinus1 ); |
---|
593 | m_acTEncDepthTopList[iViewIdx]->setNumRowsMinus1 ( m_iNumRowsMinus1 ); |
---|
594 | if(m_iUniformSpacingIdr==0) |
---|
595 | { |
---|
596 | m_acTEncDepthTopList[iViewIdx]->setColumnWidth ( m_pchColumnWidth ); |
---|
597 | m_acTEncDepthTopList[iViewIdx]->setRowHeight ( m_pchRowHeight ); |
---|
598 | } |
---|
599 | m_acTEncDepthTopList[iViewIdx]->xCheckGSParameters(); |
---|
600 | m_acTEncDepthTopList[iViewIdx]->setTileLocationInSliceHeaderFlag ( m_iTileLocationInSliceHeaderFlag ); |
---|
601 | m_acTEncDepthTopList[iViewIdx]->setTileMarkerFlag ( m_iTileMarkerFlag ); |
---|
602 | m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerEntryPoints ( m_iMaxTileMarkerEntryPoints ); |
---|
603 | |
---|
604 | Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1); |
---|
605 | m_dMaxTileMarkerOffset = ((Double)uiTilesCount) / m_iMaxTileMarkerEntryPoints; |
---|
606 | m_acTEncDepthTopList[iViewIdx]->setMaxTileMarkerOffset ( m_dMaxTileMarkerOffset ); |
---|
607 | m_acTEncDepthTopList[iViewIdx]->setTileBehaviorControlPresentFlag( m_iTileBehaviorControlPresentFlag ); |
---|
608 | #if !REMOVE_TILE_DEPENDENCE |
---|
609 | if(m_iTileBoundaryIndependenceIdr == 0 || uiTilesCount == 1) |
---|
610 | #else |
---|
611 | if(uiTilesCount == 1) |
---|
612 | #endif |
---|
613 | { |
---|
614 | m_bLFCrossTileBoundaryFlag = true; |
---|
615 | } |
---|
616 | m_acTEncDepthTopList[iViewIdx]->setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); |
---|
617 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontSynchro ( m_iWaveFrontSynchro ); |
---|
618 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontFlush ( m_iWaveFrontFlush ); |
---|
619 | m_acTEncDepthTopList[iViewIdx]->setWaveFrontSubstreams ( m_iWaveFrontSubstreams ); |
---|
620 | m_acTEncDepthTopList[iViewIdx]->setEnableTMVP ( m_enableTMVP ); |
---|
621 | m_acTEncDepthTopList[iViewIdx]->setUseScalingListId ( m_useScalingListId ); |
---|
622 | m_acTEncDepthTopList[iViewIdx]->setScalingListFile ( m_scalingListFile ); |
---|
623 | #if MULTIBITS_DATA_HIDING |
---|
624 | m_acTEncDepthTopList[iViewIdx]->setSignHideFlag(m_signHideFlag); |
---|
625 | m_acTEncDepthTopList[iViewIdx]->setTSIG(m_signHidingThreshold); |
---|
626 | #endif |
---|
627 | |
---|
628 | #if LCU_SYNTAX_ALF |
---|
629 | if(uiTilesCount > 1) |
---|
630 | { |
---|
631 | m_bALFParamInSlice = false; |
---|
632 | m_bALFPicBasedEncode = true; |
---|
633 | } |
---|
634 | m_acTEncDepthTopList[iViewIdx]->setALFParamInSlice ( m_bALFParamInSlice); |
---|
635 | m_acTEncDepthTopList[iViewIdx]->setALFPicBasedEncode ( m_bALFPicBasedEncode); |
---|
636 | #endif |
---|
637 | |
---|
638 | //====== Depth tools ======== |
---|
639 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
640 | m_acTEncDepthTopList[iViewIdx]->setUseDMM ( m_bUseDMM ); |
---|
641 | #endif |
---|
642 | #if HHI_MPI |
---|
643 | m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI ); |
---|
644 | #endif |
---|
645 | } |
---|
646 | } |
---|
647 | |
---|
648 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
649 | else if( m_uiMultiviewMvRegMode ) |
---|
650 | { |
---|
651 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
652 | { |
---|
653 | m_acTVideoIOYuvDepthInputFileList.push_back( new TVideoIOYuv ); |
---|
654 | } |
---|
655 | } |
---|
656 | #endif |
---|
657 | |
---|
658 | #if HHI_VSO |
---|
659 | if ( m_bUseVSO ) |
---|
660 | { |
---|
661 | if ( m_uiVSOMode == 4 ) |
---|
662 | { |
---|
663 | #if HHI_VSO_SPEEDUP_A0033 |
---|
664 | #if LGE_VSO_EARLY_SKIP_A0093 |
---|
665 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip ); |
---|
666 | #else |
---|
667 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 ); |
---|
668 | #endif |
---|
669 | #else |
---|
670 | m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, LOG2_DISP_PREC_LUT, 0 ); |
---|
671 | #endif |
---|
672 | |
---|
673 | for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ ) |
---|
674 | { |
---|
675 | for (Int iContent = 0; iContent < 2; iContent++ ) |
---|
676 | { |
---|
677 | Int iNumOfModels = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent); |
---|
678 | Bool bUseVSO = (iNumOfModels != 0); |
---|
679 | |
---|
680 | TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; |
---|
681 | pcEncTop->setUseVSO( bUseVSO ); |
---|
682 | pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL ); |
---|
683 | |
---|
684 | for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ ) |
---|
685 | { |
---|
686 | Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode; |
---|
687 | |
---|
688 | m_cRenModStrParser.getSingleModelData ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ; |
---|
689 | m_cRendererModel .createSingleModel ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode ); |
---|
690 | } |
---|
691 | } |
---|
692 | } |
---|
693 | } |
---|
694 | else |
---|
695 | { |
---|
696 | AOT(true); |
---|
697 | } |
---|
698 | #if LGE_WVSO_A0119 |
---|
699 | for ( Int iViewNum = 0; iViewNum < m_iNumberOfViews; iViewNum++ ) |
---|
700 | { |
---|
701 | for (Int iContent = 0; iContent < 2; iContent++ ) |
---|
702 | { |
---|
703 | TEncTop* pcEncTop = ( iContent == 0 ) ? m_acTEncTopList[iViewNum] : m_acTEncDepthTopList[iViewNum]; |
---|
704 | pcEncTop->setWVSO( m_bWVSO ); |
---|
705 | pcEncTop->setVSOWeight( m_iVSOWeight ); |
---|
706 | pcEncTop->setVSDWeight( m_iVSDWeight ); |
---|
707 | pcEncTop->setDWeight( m_iDWeight ); |
---|
708 | } |
---|
709 | } |
---|
710 | #endif |
---|
711 | } |
---|
712 | #endif |
---|
713 | |
---|
714 | #if HHI_INTERVIEW_SKIP |
---|
715 | m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 ); |
---|
716 | #endif |
---|
717 | |
---|
718 | } |
---|
719 | |
---|
720 | Void TAppEncTop::xCreateLib() |
---|
721 | { |
---|
722 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
723 | { |
---|
724 | m_acTVideoIOYuvInputFileList[iViewIdx]->open( m_pchInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
725 | m_acTVideoIOYuvInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
726 | |
---|
727 | if (m_pchReconFileList[iViewIdx]) |
---|
728 | m_acTVideoIOYuvReconFileList[iViewIdx]->open(m_pchReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
---|
729 | m_acTEncTopList[iViewIdx]->create(); |
---|
730 | if( m_bUsingDepthMaps ) |
---|
731 | { |
---|
732 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
733 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]); |
---|
734 | |
---|
735 | if (m_pchDepthReconFileList[iViewIdx]) |
---|
736 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->open(m_pchDepthReconFileList[iViewIdx], true, m_uiOutputBitDepth, m_uiInternalBitDepth); // write mode |
---|
737 | m_acTEncDepthTopList[iViewIdx]->create(); |
---|
738 | } |
---|
739 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
740 | else if( m_uiMultiviewMvRegMode ) |
---|
741 | { |
---|
742 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->open( m_pchDepthInputFileList[iViewIdx], false, m_uiInputBitDepth, m_uiInternalBitDepth ); // read mode |
---|
743 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->skipFrames(m_FrameSkip, m_iSourceWidth, m_iSourceHeight); |
---|
744 | } |
---|
745 | #endif |
---|
746 | } |
---|
747 | } |
---|
748 | |
---|
749 | Void TAppEncTop::xDestroyLib() |
---|
750 | { |
---|
751 | // Video I/O |
---|
752 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
753 | { |
---|
754 | m_acTVideoIOYuvInputFileList[iViewIdx]->close(); |
---|
755 | m_acTVideoIOYuvReconFileList[iViewIdx]->close(); |
---|
756 | delete m_acTVideoIOYuvInputFileList[iViewIdx] ; |
---|
757 | m_acTVideoIOYuvInputFileList[iViewIdx] = NULL; |
---|
758 | delete m_acTVideoIOYuvReconFileList[iViewIdx] ; |
---|
759 | m_acTVideoIOYuvReconFileList[iViewIdx] = NULL; |
---|
760 | m_acTEncTopList[iViewIdx]->deletePicBuffer(); |
---|
761 | m_acTEncTopList[iViewIdx]->destroy(); |
---|
762 | delete m_acTEncTopList[iViewIdx] ; |
---|
763 | m_acTEncTopList[iViewIdx] = NULL; |
---|
764 | delete m_picYuvRec[iViewIdx] ; |
---|
765 | m_picYuvRec[iViewIdx] = NULL; |
---|
766 | |
---|
767 | if( iViewIdx < Int( m_acTVideoIOYuvDepthInputFileList.size() ) && m_acTVideoIOYuvDepthInputFileList[iViewIdx] ) |
---|
768 | { |
---|
769 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->close( ); |
---|
770 | delete m_acTVideoIOYuvDepthInputFileList[iViewIdx]; |
---|
771 | m_acTVideoIOYuvDepthInputFileList[iViewIdx] = NULL; |
---|
772 | } |
---|
773 | if( iViewIdx < Int( m_acTVideoIOYuvDepthReconFileList.size() ) && m_acTVideoIOYuvDepthReconFileList[iViewIdx] ) |
---|
774 | { |
---|
775 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->close () ; |
---|
776 | delete m_acTVideoIOYuvDepthReconFileList[iViewIdx]; |
---|
777 | m_acTVideoIOYuvDepthReconFileList[iViewIdx] = NULL; |
---|
778 | } |
---|
779 | if( iViewIdx < Int( m_acTEncDepthTopList.size() ) && m_acTEncDepthTopList[iViewIdx] ) |
---|
780 | { |
---|
781 | m_acTEncDepthTopList[iViewIdx]->deletePicBuffer(); |
---|
782 | m_acTEncDepthTopList[iViewIdx]->destroy(); |
---|
783 | delete m_acTEncDepthTopList[iViewIdx]; |
---|
784 | m_acTEncDepthTopList[iViewIdx] = NULL; |
---|
785 | } |
---|
786 | if( iViewIdx < Int( m_picYuvDepthRec.size() ) && m_picYuvDepthRec[iViewIdx] ) |
---|
787 | { |
---|
788 | delete m_picYuvDepthRec[iViewIdx] ; |
---|
789 | m_picYuvDepthRec[iViewIdx] = NULL; |
---|
790 | } |
---|
791 | } |
---|
792 | } |
---|
793 | |
---|
794 | Void TAppEncTop::xInitLib() |
---|
795 | { |
---|
796 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
797 | { |
---|
798 | m_acTEncTopList[iViewIdx]->init( this ); |
---|
799 | } |
---|
800 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
801 | { |
---|
802 | m_acTEncTopList[iViewIdx]->setTEncTopList( &m_acTEncTopList ); |
---|
803 | } |
---|
804 | if ( m_bUsingDepthMaps ) |
---|
805 | { |
---|
806 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
807 | { |
---|
808 | m_acTEncDepthTopList[iViewIdx]->init( this ); |
---|
809 | } |
---|
810 | for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++) |
---|
811 | { |
---|
812 | m_acTEncDepthTopList[iViewIdx]->setTEncTopList( &m_acTEncDepthTopList ); |
---|
813 | } |
---|
814 | } |
---|
815 | } |
---|
816 | |
---|
817 | // ==================================================================================================================== |
---|
818 | // Public member functions |
---|
819 | // ==================================================================================================================== |
---|
820 | |
---|
821 | /** |
---|
822 | - create internal class |
---|
823 | - initialize internal variable |
---|
824 | - until the end of input YUV file, call encoding function in TEncTop class |
---|
825 | - delete allocated buffers |
---|
826 | - destroy internal class |
---|
827 | . |
---|
828 | */ |
---|
829 | Void TAppEncTop::encode() |
---|
830 | { |
---|
831 | fstream bitstreamFile(m_pchBitstreamFile, fstream::binary | fstream::out); |
---|
832 | if (!bitstreamFile) |
---|
833 | { |
---|
834 | fprintf(stderr, "\nfailed to open bitstream file `%s' for writing\n", m_pchBitstreamFile); |
---|
835 | exit(EXIT_FAILURE); |
---|
836 | } |
---|
837 | |
---|
838 | TComPicYuv* pcPicYuvOrg = new TComPicYuv; |
---|
839 | TComPicYuv* pcDepthPicYuvOrg = new TComPicYuv; |
---|
840 | TComPicYuv* pcPdmDepthOrg = new TComPicYuv; |
---|
841 | TComPicYuv* pcPicYuvRec = NULL; |
---|
842 | TComPicYuv* pcDepthPicYuvRec = NULL; |
---|
843 | |
---|
844 | // initialize internal class & member variables |
---|
845 | xInitLibCfg(); |
---|
846 | xCreateLib(); |
---|
847 | xInitLib(); |
---|
848 | |
---|
849 | // main encoder loop |
---|
850 | Bool allEos = false; |
---|
851 | std::vector<Bool> eos ; |
---|
852 | std::vector<Bool> depthEos ; |
---|
853 | Int maxGopSize = 0; |
---|
854 | Int gopSize = 1; |
---|
855 | |
---|
856 | list<AccessUnit> outputAccessUnits; ///< list of access units to write out. is populated by the encoding process |
---|
857 | maxGopSize = (std::max)(maxGopSize, m_acTEncTopList[0]->getGOPSize()); |
---|
858 | |
---|
859 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
860 | { |
---|
861 | eos.push_back( false ); |
---|
862 | depthEos.push_back( false ); |
---|
863 | } |
---|
864 | |
---|
865 | // allocate original YUV buffer |
---|
866 | pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
867 | pcDepthPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
868 | |
---|
869 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
870 | if( m_uiMultiviewMvRegMode ) |
---|
871 | { |
---|
872 | pcPdmDepthOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
873 | } |
---|
874 | #endif |
---|
875 | |
---|
876 | while ( !allEos ) |
---|
877 | { |
---|
878 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
879 | { |
---|
880 | Int frmCnt = 0; |
---|
881 | while ( !eos[iViewIdx] && !(frmCnt == gopSize)) |
---|
882 | { |
---|
883 | // get buffers |
---|
884 | xGetBuffer(pcPicYuvRec, iViewIdx, false); |
---|
885 | |
---|
886 | // read input YUV file |
---|
887 | m_acTVideoIOYuvInputFileList[iViewIdx]->read( pcPicYuvOrg, m_aiPad ); |
---|
888 | |
---|
889 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
890 | if( m_uiMultiviewMvRegMode && iViewIdx ) |
---|
891 | { |
---|
892 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcPdmDepthOrg, m_aiPad, m_bUsingDepthMaps ); |
---|
893 | } |
---|
894 | #endif |
---|
895 | |
---|
896 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
897 | m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg, ( m_uiMultiviewMvRegMode && iViewIdx ? pcPdmDepthOrg : 0 ) ); |
---|
898 | #else |
---|
899 | m_acTEncTopList[iViewIdx]->initNewPic( pcPicYuvOrg ); |
---|
900 | #endif |
---|
901 | |
---|
902 | // increase number of received frames |
---|
903 | m_frameRcvd[iViewIdx]++; |
---|
904 | frmCnt++; |
---|
905 | // check end of file |
---|
906 | eos[iViewIdx] = ( m_acTVideoIOYuvInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
---|
907 | eos[iViewIdx] = ( m_frameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : eos[iViewIdx] ); |
---|
908 | allEos = allEos|eos[iViewIdx] ; |
---|
909 | } |
---|
910 | if( m_bUsingDepthMaps ) |
---|
911 | { |
---|
912 | Int frmCntDepth = 0; |
---|
913 | while ( !depthEos[iViewIdx] && !(frmCntDepth == gopSize)) |
---|
914 | { |
---|
915 | // get buffers |
---|
916 | xGetBuffer(pcDepthPicYuvRec, iViewIdx, true); |
---|
917 | |
---|
918 | // read input YUV file |
---|
919 | m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad ); |
---|
920 | |
---|
921 | m_acTEncDepthTopList[iViewIdx]->initNewPic( pcDepthPicYuvOrg ); |
---|
922 | |
---|
923 | // increase number of received frames |
---|
924 | m_depthFrameRcvd[iViewIdx]++; |
---|
925 | frmCntDepth++; |
---|
926 | // check end of file |
---|
927 | depthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ? true : false ); |
---|
928 | depthEos[iViewIdx] = ( m_depthFrameRcvd[iViewIdx] == m_iFrameToBeEncoded ? true : depthEos[iViewIdx] ); |
---|
929 | allEos = allEos|depthEos[iViewIdx] ; |
---|
930 | } |
---|
931 | } |
---|
932 | } |
---|
933 | for ( Int gopId=0; gopId < gopSize; gopId++ ) |
---|
934 | { |
---|
935 | Int iNumEncoded = 0; |
---|
936 | UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId ); |
---|
937 | if ( iNextPoc < m_iFrameToBeEncoded ) |
---|
938 | { |
---|
939 | m_cCameraData.update( iNextPoc ); |
---|
940 | } |
---|
941 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
942 | { |
---|
943 | #if SAIT_VSO_EST_A0033 |
---|
944 | if( m_bUseVSO && iNextPoc < m_iFrameToBeEncoded ) |
---|
945 | { |
---|
946 | m_cCameraData.xSetDispCoeff( iNextPoc, iViewIdx ); |
---|
947 | m_acTEncDepthTopList[iViewIdx]->setDispCoeff( m_cCameraData.getDispCoeff() ); |
---|
948 | } |
---|
949 | #endif |
---|
950 | iNumEncoded = 0; |
---|
951 | // call encoding function for one frame |
---|
952 | m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId ); |
---|
953 | xWriteOutput(bitstreamFile, iNumEncoded, outputAccessUnits, iViewIdx, false); |
---|
954 | outputAccessUnits.clear(); |
---|
955 | if( m_bUsingDepthMaps ) |
---|
956 | { |
---|
957 | Int iNumDepthEncoded = 0; |
---|
958 | // call encoding function for one depth frame |
---|
959 | m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId ); |
---|
960 | xWriteOutput(bitstreamFile, iNumDepthEncoded, outputAccessUnits, iViewIdx, true); |
---|
961 | outputAccessUnits.clear(); |
---|
962 | } |
---|
963 | } |
---|
964 | #if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED |
---|
965 | for( Int iViewIdx = 0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
966 | { |
---|
967 | if( iViewIdx < (Int)m_acTEncTopList.size() && m_acTEncTopList[iViewIdx] ) |
---|
968 | { |
---|
969 | m_acTEncTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
970 | } |
---|
971 | if( iViewIdx < (Int)m_acTEncDepthTopList.size() && m_acTEncDepthTopList[iViewIdx] ) |
---|
972 | { |
---|
973 | m_acTEncDepthTopList[iViewIdx]->deleteExtraPicBuffers( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
974 | } |
---|
975 | } |
---|
976 | #endif |
---|
977 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
978 | { |
---|
979 | m_acTEncTopList[iViewIdx]->compressMotion( m_acTEncTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
980 | if( m_bUsingDepthMaps ) |
---|
981 | { |
---|
982 | m_acTEncDepthTopList[iViewIdx]->compressMotion( m_acTEncDepthTopList[iViewIdx]->getGOPEncoder()->getPocLastCoded() ); |
---|
983 | } |
---|
984 | } |
---|
985 | } |
---|
986 | gopSize = maxGopSize; |
---|
987 | } |
---|
988 | // delete original YUV buffer |
---|
989 | pcPicYuvOrg->destroy(); |
---|
990 | delete pcPicYuvOrg; |
---|
991 | pcPicYuvOrg = NULL; |
---|
992 | pcDepthPicYuvOrg->destroy(); |
---|
993 | delete pcDepthPicYuvOrg; |
---|
994 | pcDepthPicYuvOrg = NULL; |
---|
995 | |
---|
996 | for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ ) |
---|
997 | { |
---|
998 | m_acTEncTopList[iViewIdx]->printOutSummary(m_acTEncTopList[iViewIdx]->getNumAllPicCoded()); |
---|
999 | if ( m_bUsingDepthMaps ) |
---|
1000 | { |
---|
1001 | m_acTEncDepthTopList[iViewIdx]->printOutSummary(m_acTEncDepthTopList[iViewIdx]->getNumAllPicCoded()); |
---|
1002 | } |
---|
1003 | } |
---|
1004 | |
---|
1005 | // delete buffers & classes |
---|
1006 | xDeleteBuffer(); |
---|
1007 | xDestroyLib(); |
---|
1008 | |
---|
1009 | return; |
---|
1010 | } |
---|
1011 | |
---|
1012 | TEncTop* TAppEncTop::getTEncTop( Int viewId, Bool isDepth ) |
---|
1013 | { |
---|
1014 | if ( isDepth ) |
---|
1015 | { |
---|
1016 | return m_acTEncDepthTopList[viewId]; |
---|
1017 | } |
---|
1018 | else |
---|
1019 | { |
---|
1020 | return m_acTEncTopList[viewId]; |
---|
1021 | } |
---|
1022 | } |
---|
1023 | |
---|
1024 | |
---|
1025 | // ==================================================================================================================== |
---|
1026 | // Protected member functions |
---|
1027 | // ==================================================================================================================== |
---|
1028 | |
---|
1029 | /** |
---|
1030 | - application has picture buffer list with size of GOP |
---|
1031 | - picture buffer list acts as ring buffer |
---|
1032 | - end of the list has the latest picture |
---|
1033 | . |
---|
1034 | */ |
---|
1035 | Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, Bool isDepth) |
---|
1036 | { |
---|
1037 | assert( m_iGOPSize > 0 ); |
---|
1038 | |
---|
1039 | if( !isDepth ) |
---|
1040 | { |
---|
1041 | if ( m_picYuvRec[iViewIdx]->size() == (UInt)m_iGOPSize ) |
---|
1042 | { |
---|
1043 | rpcPicYuvRec = m_picYuvRec[iViewIdx]->popFront(); |
---|
1044 | } |
---|
1045 | else |
---|
1046 | { |
---|
1047 | rpcPicYuvRec = new TComPicYuv; |
---|
1048 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
1049 | } |
---|
1050 | m_picYuvRec[iViewIdx]->pushBack( rpcPicYuvRec ); |
---|
1051 | } |
---|
1052 | else |
---|
1053 | { |
---|
1054 | if ( m_picYuvDepthRec[iViewIdx]->size() == (UInt)m_iGOPSize ) |
---|
1055 | { |
---|
1056 | rpcPicYuvRec = m_picYuvDepthRec[iViewIdx]->popFront(); |
---|
1057 | } |
---|
1058 | else |
---|
1059 | { |
---|
1060 | rpcPicYuvRec = new TComPicYuv; |
---|
1061 | rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth ); |
---|
1062 | } |
---|
1063 | m_picYuvDepthRec[iViewIdx]->pushBack( rpcPicYuvRec ); |
---|
1064 | } |
---|
1065 | } |
---|
1066 | |
---|
1067 | Void TAppEncTop::xDeleteBuffer( ) |
---|
1068 | { |
---|
1069 | for(Int iViewIdx=0; iViewIdx<m_picYuvRec.size(); iViewIdx++) |
---|
1070 | { |
---|
1071 | if(m_picYuvRec[iViewIdx]) |
---|
1072 | { |
---|
1073 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvRec[iViewIdx]->begin(); |
---|
1074 | Int iSize = Int( m_picYuvRec[iViewIdx]->size() ); |
---|
1075 | for ( Int i = 0; i < iSize; i++ ) |
---|
1076 | { |
---|
1077 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
1078 | if(pcPicYuvRec) |
---|
1079 | { |
---|
1080 | pcPicYuvRec->destroy(); |
---|
1081 | delete pcPicYuvRec; |
---|
1082 | pcPicYuvRec = NULL; |
---|
1083 | } |
---|
1084 | } |
---|
1085 | } |
---|
1086 | } |
---|
1087 | for(Int iViewIdx=0; iViewIdx<m_picYuvDepthRec.size(); iViewIdx++) |
---|
1088 | { |
---|
1089 | if(m_picYuvDepthRec[iViewIdx]) |
---|
1090 | { |
---|
1091 | TComList<TComPicYuv*>::iterator iterPicYuvRec = m_picYuvDepthRec[iViewIdx]->begin(); |
---|
1092 | Int iSize = Int( m_picYuvDepthRec[iViewIdx]->size() ); |
---|
1093 | for ( Int i = 0; i < iSize; i++ ) |
---|
1094 | { |
---|
1095 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
1096 | if(pcPicYuvRec) |
---|
1097 | { |
---|
1098 | pcPicYuvRec->destroy(); |
---|
1099 | delete pcPicYuvRec; |
---|
1100 | pcPicYuvRec = NULL; |
---|
1101 | } |
---|
1102 | } |
---|
1103 | } |
---|
1104 | } |
---|
1105 | } |
---|
1106 | |
---|
1107 | /** \param iNumEncoded number of encoded frames |
---|
1108 | */ |
---|
1109 | Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, Int iViewIdx, Bool isDepth ) |
---|
1110 | { |
---|
1111 | Int i; |
---|
1112 | |
---|
1113 | if( iNumEncoded > 0 ) |
---|
1114 | { |
---|
1115 | TComList<TComPicYuv*>::iterator iterPicYuvRec = !isDepth ? m_picYuvRec[iViewIdx]->end() : m_picYuvDepthRec[iViewIdx]->end(); |
---|
1116 | |
---|
1117 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
1118 | { |
---|
1119 | --iterPicYuvRec; |
---|
1120 | } |
---|
1121 | |
---|
1122 | for ( i = 0; i < iNumEncoded; i++ ) |
---|
1123 | { |
---|
1124 | TComPicYuv* pcPicYuvRec = *(iterPicYuvRec++); |
---|
1125 | if( !isDepth ) |
---|
1126 | { |
---|
1127 | if (m_pchReconFileList[iViewIdx]) |
---|
1128 | { |
---|
1129 | #if PIC_CROPPING |
---|
1130 | m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); |
---|
1131 | #else |
---|
1132 | m_acTVideoIOYuvReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); |
---|
1133 | #endif |
---|
1134 | } |
---|
1135 | } |
---|
1136 | else |
---|
1137 | { |
---|
1138 | if (m_pchDepthReconFileList[iViewIdx]) |
---|
1139 | { |
---|
1140 | #if PIC_CROPPING |
---|
1141 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_cropLeft, m_cropRight, m_cropTop, m_cropBottom ); |
---|
1142 | #else |
---|
1143 | m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPicYuvRec, m_aiPad ); |
---|
1144 | #endif |
---|
1145 | } |
---|
1146 | } |
---|
1147 | } |
---|
1148 | } |
---|
1149 | if( ! accessUnits.empty() ) |
---|
1150 | { |
---|
1151 | list<AccessUnit>::iterator aUIter; |
---|
1152 | for( aUIter = accessUnits.begin(); aUIter != accessUnits.end(); aUIter++ ) |
---|
1153 | { |
---|
1154 | const vector<unsigned>& stats = writeAnnexB(bitstreamFile, *aUIter); |
---|
1155 | rateStatsAccum(*aUIter, stats); |
---|
1156 | } |
---|
1157 | } |
---|
1158 | } |
---|
1159 | |
---|
1160 | |
---|
1161 | TComPicYuv* TAppEncTop::xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ) |
---|
1162 | { |
---|
1163 | TComPic* pcPic = xGetPicFromView( iViewIdx, iPoc, bDepth); |
---|
1164 | TComPicYuv* pcPicYuv = NULL; |
---|
1165 | |
---|
1166 | if (pcPic != NULL) |
---|
1167 | { |
---|
1168 | if( bRecon ) |
---|
1169 | { |
---|
1170 | if ( pcPic->getReconMark() ) |
---|
1171 | { |
---|
1172 | pcPicYuv = pcPic->getPicYuvRec(); |
---|
1173 | } |
---|
1174 | } |
---|
1175 | else |
---|
1176 | { |
---|
1177 | pcPicYuv = pcPic->getPicYuvOrg(); |
---|
1178 | } |
---|
1179 | }; |
---|
1180 | |
---|
1181 | return pcPicYuv; |
---|
1182 | }; |
---|
1183 | |
---|
1184 | /** |
---|
1185 | * |
---|
1186 | */ |
---|
1187 | void TAppEncTop::rateStatsAccum(const AccessUnit& au, const std::vector<unsigned>& annexBsizes) |
---|
1188 | { |
---|
1189 | AccessUnit::const_iterator it_au = au.begin(); |
---|
1190 | vector<unsigned>::const_iterator it_stats = annexBsizes.begin(); |
---|
1191 | |
---|
1192 | for (; it_au != au.end(); it_au++, it_stats++) |
---|
1193 | { |
---|
1194 | switch ((*it_au)->m_nalUnitType) |
---|
1195 | { |
---|
1196 | case NAL_UNIT_CODED_SLICE: |
---|
1197 | #if H0566_TLA |
---|
1198 | case NAL_UNIT_CODED_SLICE_IDV: |
---|
1199 | case NAL_UNIT_CODED_SLICE_TLA: |
---|
1200 | case NAL_UNIT_CODED_SLICE_CRA: |
---|
1201 | #else |
---|
1202 | case NAL_UNIT_CODED_SLICE_DATAPART_A: |
---|
1203 | case NAL_UNIT_CODED_SLICE_DATAPART_B: |
---|
1204 | case NAL_UNIT_CODED_SLICE_CDR: |
---|
1205 | #endif |
---|
1206 | case NAL_UNIT_CODED_SLICE_IDR: |
---|
1207 | case NAL_UNIT_SPS: |
---|
1208 | case NAL_UNIT_PPS: |
---|
1209 | #if VIDYO_VPS_INTEGRATION |
---|
1210 | case NAL_UNIT_VPS: |
---|
1211 | #endif |
---|
1212 | m_essentialBytes += *it_stats; |
---|
1213 | break; |
---|
1214 | default: |
---|
1215 | break; |
---|
1216 | } |
---|
1217 | |
---|
1218 | m_totalBytes += *it_stats; |
---|
1219 | } |
---|
1220 | } |
---|
1221 | |
---|
1222 | #if HHI_INTERVIEW_SKIP |
---|
1223 | Void TAppEncTop::getUsedPelsMap( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedSplsMap ) |
---|
1224 | { |
---|
1225 | AOT( iViewIdx <= 0); |
---|
1226 | AOT( iViewIdx >= m_iNumberOfViews ); |
---|
1227 | AOF( m_cCameraData.getCurFrameId() == iPoc ); |
---|
1228 | Int iViewSIdx = m_cCameraData.getBaseId2SortedId()[iViewIdx]; |
---|
1229 | Int iFirstViewSIdx = m_cCameraData.getBaseId2SortedId()[0]; |
---|
1230 | |
---|
1231 | AOT( iViewSIdx == iFirstViewSIdx ); |
---|
1232 | |
---|
1233 | Bool bFirstIsLeft = (iFirstViewSIdx < iViewSIdx); |
---|
1234 | |
---|
1235 | m_cUsedPelsRenderer.setShiftLUTs( |
---|
1236 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
---|
1237 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
1238 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
1239 | m_cCameraData.getBaseViewShiftLUTD()[0][iViewIdx], |
---|
1240 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
1241 | m_cCameraData.getBaseViewShiftLUTI()[0][iViewIdx], |
---|
1242 | -1 |
---|
1243 | ); |
---|
1244 | |
---|
1245 | TComPicYuv* pcPicYuvDepth = xGetPicYuvFromView(0, iPoc, true, true ); |
---|
1246 | AOF( pcPicYuvDepth); |
---|
1247 | |
---|
1248 | m_cUsedPelsRenderer.getUsedSamplesMap( pcPicYuvDepth, pcPicYuvUsedSplsMap, bFirstIsLeft ); |
---|
1249 | } |
---|
1250 | #endif |
---|
1251 | #if HHI_VSO |
---|
1252 | #if HHI_VSO_SPEEDUP_A0033 |
---|
1253 | Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset ) |
---|
1254 | { |
---|
1255 | m_cRendererModel.setHorOffset( iHorOffset ); |
---|
1256 | #else |
---|
1257 | Void TAppEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent ) |
---|
1258 | { |
---|
1259 | #endif |
---|
1260 | Int iEncViewSIdx = m_cCameraData.getBaseId2SortedId()[ iEncViewIdx ]; |
---|
1261 | |
---|
1262 | // setup base views |
---|
1263 | Int iNumOfBV = m_cRenModStrParser.getNumOfBaseViewsForView( iEncViewSIdx, iEncContent ); |
---|
1264 | |
---|
1265 | for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ ) |
---|
1266 | { |
---|
1267 | Int iBaseViewSIdx; |
---|
1268 | Int iVideoDistMode; |
---|
1269 | Int iDepthDistMode; |
---|
1270 | |
---|
1271 | m_cRenModStrParser.getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode ); |
---|
1272 | |
---|
1273 | AOT( iVideoDistMode < 0 || iVideoDistMode > 2 ); |
---|
1274 | |
---|
1275 | Int iBaseViewIdx = m_cCameraData.getBaseSortedId2Id()[ iBaseViewSIdx ]; |
---|
1276 | |
---|
1277 | TComPicYuv* pcPicYuvVideoRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, true ); |
---|
1278 | TComPicYuv* pcPicYuvDepthRec = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , true ); |
---|
1279 | TComPicYuv* pcPicYuvVideoOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, false, false ); |
---|
1280 | TComPicYuv* pcPicYuvDepthOrg = xGetPicYuvFromView( iBaseViewIdx, iPoc, true , false ); |
---|
1281 | |
---|
1282 | TComPicYuv* pcPicYuvVideoRef = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg : NULL; |
---|
1283 | TComPicYuv* pcPicYuvDepthRef = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg : NULL; |
---|
1284 | |
---|
1285 | TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg : pcPicYuvVideoRec; |
---|
1286 | TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg : pcPicYuvDepthRec; |
---|
1287 | |
---|
1288 | AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) ); |
---|
1289 | AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) ); |
---|
1290 | AOT( pcPicYuvDepthTest == NULL ); |
---|
1291 | AOT( pcPicYuvVideoTest == NULL ); |
---|
1292 | |
---|
1293 | m_cRendererModel.setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef ); |
---|
1294 | } |
---|
1295 | |
---|
1296 | m_cRendererModel.setErrorMode( iEncViewSIdx, iEncContent, 0 ); |
---|
1297 | // setup virtual views |
---|
1298 | Int iNumOfSV = m_cRenModStrParser.getNumOfModelsForView( iEncViewSIdx, iEncContent ); |
---|
1299 | for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ ) |
---|
1300 | { |
---|
1301 | Int iOrgRefBaseViewSIdx; |
---|
1302 | Int iLeftBaseViewSIdx; |
---|
1303 | Int iRightBaseViewSIdx; |
---|
1304 | Int iSynthViewRelNum; |
---|
1305 | Int iModelNum; |
---|
1306 | Int iBlendMode; |
---|
1307 | m_cRenModStrParser.getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum ); |
---|
1308 | |
---|
1309 | Int iLeftBaseViewIdx = -1; |
---|
1310 | Int iRightBaseViewIdx = -1; |
---|
1311 | |
---|
1312 | TComPicYuv* pcPicYuvOrgRef = NULL; |
---|
1313 | Int** ppiShiftLUTLeft = NULL; |
---|
1314 | Int** ppiShiftLUTRight = NULL; |
---|
1315 | Int** ppiBaseShiftLUTLeft = NULL; |
---|
1316 | Int** ppiBaseShiftLUTRight = NULL; |
---|
1317 | |
---|
1318 | |
---|
1319 | Int iDistToLeft = -1; |
---|
1320 | |
---|
1321 | Int iSynthViewIdx = m_cCameraData.synthRelNum2Idx( iSynthViewRelNum ); |
---|
1322 | |
---|
1323 | if ( iLeftBaseViewSIdx != -1 ) |
---|
1324 | { |
---|
1325 | iLeftBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [ iLeftBaseViewSIdx ]; |
---|
1326 | ppiShiftLUTLeft = m_cCameraData.getSynthViewShiftLUTI()[ iLeftBaseViewIdx ][ iSynthViewIdx ]; |
---|
1327 | } |
---|
1328 | |
---|
1329 | if ( iRightBaseViewSIdx != -1 ) |
---|
1330 | { |
---|
1331 | iRightBaseViewIdx = m_cCameraData.getBaseSortedId2Id() [iRightBaseViewSIdx ]; |
---|
1332 | ppiShiftLUTRight = m_cCameraData.getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ]; |
---|
1333 | } |
---|
1334 | |
---|
1335 | if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 ) |
---|
1336 | { |
---|
1337 | iDistToLeft = m_cCameraData.getRelDistLeft( iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx); |
---|
1338 | ppiBaseShiftLUTLeft = m_cCameraData.getBaseViewShiftLUTI() [ iLeftBaseViewIdx ][ iRightBaseViewIdx ]; |
---|
1339 | ppiBaseShiftLUTRight = m_cCameraData.getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx ]; |
---|
1340 | |
---|
1341 | } |
---|
1342 | |
---|
1343 | if ( iOrgRefBaseViewSIdx != -1 ) |
---|
1344 | { |
---|
1345 | pcPicYuvOrgRef = xGetPicYuvFromView( m_cCameraData.getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , iPoc, false, false ); |
---|
1346 | AOF ( pcPicYuvOrgRef ); |
---|
1347 | } |
---|
1348 | |
---|
1349 | m_cRendererModel.setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef ); |
---|
1350 | } |
---|
1351 | } |
---|
1352 | #endif |
---|
1353 | |
---|
1354 | |
---|
1355 | |
---|
1356 | /* |
---|
1357 | void TAppEncTop::printRateSummary() |
---|
1358 | { |
---|
1359 | double time = (double) m_iFrameRcvd / m_iFrameRate; |
---|
1360 | printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time); |
---|
1361 | #if VERBOSE_RATE |
---|
1362 | printf("Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time); |
---|
1363 | #endif |
---|
1364 | } |
---|
1365 | */ |
---|
1366 | |
---|
1367 | std::vector<TComPic*> TAppEncTop::getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ) |
---|
1368 | { |
---|
1369 | std::vector<TComPic*> apcRefPics( sps->getNumberOfUsableInterViewRefs(), (TComPic*)NULL ); |
---|
1370 | for( Int k = 0; k < sps->getNumberOfUsableInterViewRefs(); k++ ) |
---|
1371 | { |
---|
1372 | TComPic* pcRefPic = xGetPicFromView( sps->getUsableInterViewRef( k ) + viewId, poc, isDepth ); |
---|
1373 | assert( pcRefPic != NULL ); |
---|
1374 | apcRefPics[k] = pcRefPic; |
---|
1375 | } |
---|
1376 | return apcRefPics; |
---|
1377 | } |
---|
1378 | |
---|
1379 | TComPic* TAppEncTop::xGetPicFromView( Int viewIdx, Int poc, Bool isDepth ) |
---|
1380 | { |
---|
1381 | assert( ( viewIdx >= 0 ) && ( viewIdx < m_iNumberOfViews ) ); |
---|
1382 | |
---|
1383 | TComList<TComPic*>* apcListPic = (isDepth ? m_acTEncDepthTopList[viewIdx] : m_acTEncTopList[viewIdx])->getListPic() ; |
---|
1384 | |
---|
1385 | TComPic* pcPic = NULL; |
---|
1386 | for(TComList<TComPic*>::iterator it=apcListPic->begin(); it!=apcListPic->end(); it++) |
---|
1387 | { |
---|
1388 | if( (*it)->getPOC() == poc ) |
---|
1389 | { |
---|
1390 | pcPic = *it ; |
---|
1391 | break ; |
---|
1392 | } |
---|
1393 | } |
---|
1394 | |
---|
1395 | return pcPic; |
---|
1396 | }; |
---|
1397 | |
---|
1398 | //! \} |
---|