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