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