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