[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 |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
| 6 | * Copyright (c) 2010-2011, ISO/IEC |
---|
| 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | |
---|
[5] | 35 | |
---|
[2] | 36 | /** \file TEncTop.cpp |
---|
| 37 | \brief encoder class |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | #include "../TLibCommon/CommonDef.h" |
---|
| 41 | #include "TEncTop.h" |
---|
| 42 | |
---|
| 43 | #include "TEncGOP.h" |
---|
| 44 | #include "../../App/TAppEncoder/TAppEncTop.h" |
---|
| 45 | |
---|
| 46 | // ==================================================================================================================== |
---|
| 47 | // Constructor / destructor / create / destroy |
---|
| 48 | // ==================================================================================================================== |
---|
| 49 | |
---|
| 50 | TEncTop::TEncTop() |
---|
| 51 | { |
---|
| 52 | m_iPOCLast = -1; |
---|
| 53 | m_iNumPicRcvd = 0; |
---|
| 54 | m_uiNumAllPicCoded = 0; |
---|
| 55 | m_pppcRDSbacCoder = NULL; |
---|
| 56 | m_pppcBinCoderCABAC = NULL; |
---|
| 57 | m_cRDGoOnSbacCoder.init( &m_cRDGoOnBinCoderCABAC ); |
---|
| 58 | #if ENC_DEC_TRACE |
---|
| 59 | g_hTrace = fopen( "TraceEnc.txt", "wb" ); |
---|
| 60 | g_bJustDoIt = g_bEncDecTraceDisable; |
---|
| 61 | g_nSymbolCounter = 0; |
---|
| 62 | #endif |
---|
| 63 | m_bSeqFirst = true; |
---|
| 64 | m_iFrameNumInCodingOrder = 0; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | TEncTop::~TEncTop() |
---|
| 68 | { |
---|
| 69 | #if ENC_DEC_TRACE |
---|
| 70 | fclose( g_hTrace ); |
---|
| 71 | #endif |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | Void TEncTop::create () |
---|
| 75 | { |
---|
| 76 | // initialize global variables |
---|
| 77 | if(m_uiViewId<1 && !m_bIsDepth) |
---|
| 78 | initROM(); |
---|
| 79 | |
---|
| 80 | // create processing unit classes |
---|
| 81 | m_cPicEncoder. create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight ); |
---|
| 82 | m_cSliceEncoder. create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
| 83 | m_cCuEncoder. create( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight ); |
---|
| 84 | #if MTK_SAO |
---|
| 85 | if (m_bUseSAO) |
---|
| 86 | { |
---|
| 87 | m_cEncSAO.create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
| 88 | m_cEncSAO.createEncBuffer(); |
---|
| 89 | } |
---|
| 90 | #endif |
---|
| 91 | m_cAdaptiveLoopFilter.create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
| 92 | m_cLoopFilter. create( g_uiMaxCUDepth ); |
---|
[5] | 93 | #if DEPTH_MAP_GENERATION |
---|
[21] | 94 | m_cDepthMapGenerator. create( false, getSourceWidth(), getSourceHeight(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement, PDM_SUB_SAMP_EXP_X(m_uiPredDepthMapGeneration), PDM_SUB_SAMP_EXP_Y(m_uiPredDepthMapGeneration) ); |
---|
[5] | 95 | #endif |
---|
| 96 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 97 | m_cResidualGenerator. create( false, getSourceWidth(), getSourceHeight(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement ); |
---|
[5] | 98 | #endif |
---|
[2] | 99 | |
---|
| 100 | #if MQT_BA_RA && MQT_ALF_NPASS |
---|
| 101 | if(m_bUseALF) |
---|
| 102 | { |
---|
| 103 | m_cAdaptiveLoopFilter.createAlfGlobalBuffers(m_iALFEncodePassReduction); |
---|
| 104 | } |
---|
| 105 | #endif |
---|
| 106 | |
---|
| 107 | // if SBAC-based RD optimization is used |
---|
| 108 | if( m_bUseSBACRD ) |
---|
| 109 | { |
---|
| 110 | UInt uiNumCEnc = 1 + Max( g_uiMaxCUDepth, AO_MAX_DEPTH ); // HS: prevents crash in SAO for small maximum CU sizes |
---|
| 111 | m_pppcRDSbacCoder = new TEncSbac** [uiNumCEnc]; |
---|
| 112 | m_pppcBinCoderCABAC = new TEncBinCABAC** [uiNumCEnc]; |
---|
| 113 | |
---|
| 114 | for ( Int iDepth = 0; iDepth < uiNumCEnc; iDepth++ ) |
---|
| 115 | { |
---|
| 116 | m_pppcRDSbacCoder[iDepth] = new TEncSbac* [CI_NUM]; |
---|
| 117 | m_pppcBinCoderCABAC[iDepth] = new TEncBinCABAC* [CI_NUM]; |
---|
| 118 | |
---|
| 119 | for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) |
---|
| 120 | { |
---|
| 121 | m_pppcRDSbacCoder[iDepth][iCIIdx] = new TEncSbac; |
---|
| 122 | m_pppcBinCoderCABAC [iDepth][iCIIdx] = new TEncBinCABAC; |
---|
| 123 | m_pppcRDSbacCoder [iDepth][iCIIdx]->init( m_pppcBinCoderCABAC [iDepth][iCIIdx] ); |
---|
| 124 | } |
---|
| 125 | } |
---|
| 126 | } |
---|
| 127 | |
---|
[5] | 128 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 129 | if( g_aacWedgeLists.empty() && m_bUseDMM && m_bIsDepth ) |
---|
[2] | 130 | { |
---|
| 131 | initWedgeLists(); |
---|
| 132 | } |
---|
| 133 | #endif |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | Void TEncTop::destroy () |
---|
| 137 | { |
---|
| 138 | #if MQT_BA_RA && MQT_ALF_NPASS |
---|
| 139 | if(m_bUseALF) |
---|
| 140 | { |
---|
| 141 | m_cAdaptiveLoopFilter.destroyAlfGlobalBuffers(); |
---|
| 142 | } |
---|
| 143 | #endif |
---|
| 144 | |
---|
| 145 | // destroy processing unit classes |
---|
| 146 | m_cPicEncoder. destroy(); |
---|
| 147 | m_cSliceEncoder. destroy(); |
---|
| 148 | m_cCuEncoder. destroy(); |
---|
| 149 | #if MTK_SAO |
---|
| 150 | if (m_cSPS.getUseSAO()) |
---|
| 151 | { |
---|
| 152 | m_cEncSAO.destroy(); |
---|
| 153 | m_cEncSAO.destoryEncBuffer(); |
---|
| 154 | } |
---|
| 155 | #endif |
---|
| 156 | m_cAdaptiveLoopFilter.destroy(); |
---|
| 157 | m_cLoopFilter. destroy(); |
---|
[5] | 158 | #if DEPTH_MAP_GENERATION |
---|
[2] | 159 | m_cDepthMapGenerator. destroy(); |
---|
[5] | 160 | #endif |
---|
| 161 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 162 | m_cResidualGenerator. destroy(); |
---|
[5] | 163 | #endif |
---|
[2] | 164 | |
---|
| 165 | // SBAC RD |
---|
| 166 | if( m_bUseSBACRD ) |
---|
| 167 | { |
---|
| 168 | Int iDepth; |
---|
| 169 | for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) |
---|
| 170 | { |
---|
| 171 | for (Int iCIIdx = 0; iCIIdx < CI_NUM; iCIIdx ++ ) |
---|
| 172 | { |
---|
| 173 | delete m_pppcRDSbacCoder[iDepth][iCIIdx]; |
---|
| 174 | delete m_pppcBinCoderCABAC[iDepth][iCIIdx]; |
---|
| 175 | } |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | for ( iDepth = 0; iDepth < g_uiMaxCUDepth+1; iDepth++ ) |
---|
| 179 | { |
---|
| 180 | delete [] m_pppcRDSbacCoder[iDepth]; |
---|
| 181 | delete [] m_pppcBinCoderCABAC[iDepth]; |
---|
| 182 | } |
---|
| 183 | |
---|
| 184 | delete [] m_pppcRDSbacCoder; |
---|
| 185 | delete [] m_pppcBinCoderCABAC; |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | // destroy ROM |
---|
| 189 | if(m_uiViewId<1 && !m_bIsDepth) |
---|
| 190 | destroyROM(); |
---|
| 191 | |
---|
| 192 | return; |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | Void TEncTop::init( TAppEncTop* pcTAppEncTop ) |
---|
| 196 | { |
---|
| 197 | UInt *aTable4=NULL, *aTable8=NULL; |
---|
| 198 | #if QC_MOD_LCEC |
---|
| 199 | UInt* aTableLastPosVlcIndex=NULL; |
---|
| 200 | #endif |
---|
| 201 | // initialize SPS |
---|
| 202 | xInitSPS(); |
---|
| 203 | |
---|
| 204 | #if CONSTRAINED_INTRA_PRED |
---|
| 205 | // initialize PPS |
---|
| 206 | xInitPPS(); |
---|
| 207 | #endif |
---|
| 208 | |
---|
| 209 | // initialize processing unit classes |
---|
| 210 | m_cPicEncoder. init( this ); |
---|
| 211 | m_cSliceEncoder.init( this ); |
---|
| 212 | m_cCuEncoder. init( this ); |
---|
| 213 | |
---|
| 214 | m_pcTAppEncTop = pcTAppEncTop; |
---|
[5] | 215 | #if DEPTH_MAP_GENERATION |
---|
[2] | 216 | m_cDepthMapGenerator.init( (TComPrediction*)this->getPredSearch(), m_pcTAppEncTop->getSPSAccess(), m_pcTAppEncTop->getAUPicAccess() ); |
---|
[5] | 217 | #endif |
---|
| 218 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 219 | m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator ); |
---|
[5] | 220 | #endif |
---|
[2] | 221 | |
---|
| 222 | // initialize transform & quantization class |
---|
| 223 | m_pcCavlcCoder = getCavlcCoder(); |
---|
| 224 | #if !CAVLC_COEF_LRG_BLK |
---|
| 225 | aTable8 = m_pcCavlcCoder->GetLP8Table(); |
---|
| 226 | #endif |
---|
| 227 | aTable4 = m_pcCavlcCoder->GetLP4Table(); |
---|
| 228 | #if QC_MOD_LCEC |
---|
| 229 | aTableLastPosVlcIndex=m_pcCavlcCoder->GetLastPosVlcIndexTable(); |
---|
| 230 | |
---|
| 231 | m_cTrQuant.init( g_uiMaxCUWidth, g_uiMaxCUHeight, 1 << m_uiQuadtreeTULog2MaxSize, m_iSymbolMode, aTable4, aTable8, |
---|
| 232 | aTableLastPosVlcIndex, m_bUseRDOQ, true ); |
---|
| 233 | #else |
---|
| 234 | m_cTrQuant.init( g_uiMaxCUWidth, g_uiMaxCUHeight, 1 << m_uiQuadtreeTULog2MaxSize, m_iSymbolMode, aTable4, aTable8, m_bUseRDOQ, true ); |
---|
| 235 | #endif |
---|
| 236 | |
---|
| 237 | // initialize encoder search class |
---|
| 238 | m_cSearch.init( this, &m_cTrQuant, m_iSearchRange, m_bipredSearchRange, m_iFastSearch, 0, &m_cEntropyCoder, &m_cRdCost, getRDSbacCoder(), getRDGoOnSbacCoder() ); |
---|
| 239 | m_cSeqIter = TEncSeqStructure::Iterator( m_cSequenceStructure, 0, 0 ); |
---|
| 240 | m_bPicWaitingForCoding = false ; |
---|
| 241 | |
---|
| 242 | #if MQT_ALF_NPASS |
---|
| 243 | if(m_bUseALF) |
---|
| 244 | { |
---|
| 245 | m_cAdaptiveLoopFilter.setALFEncodePassReduction( m_iALFEncodePassReduction ); |
---|
| 246 | } |
---|
| 247 | #endif |
---|
| 248 | } |
---|
| 249 | |
---|
| 250 | // ==================================================================================================================== |
---|
| 251 | // Public member functions |
---|
| 252 | // ==================================================================================================================== |
---|
| 253 | |
---|
| 254 | Void TEncTop::deletePicBuffer() |
---|
| 255 | { |
---|
| 256 | TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); |
---|
| 257 | Int iSize = Int( m_cListPic.size() ); |
---|
| 258 | |
---|
| 259 | for ( Int i = 0; i < iSize; i++ ) |
---|
| 260 | { |
---|
| 261 | TComPic* pcPic = *(iterPic++); |
---|
| 262 | |
---|
| 263 | pcPic->destroy(); |
---|
| 264 | delete pcPic; |
---|
| 265 | pcPic = NULL; |
---|
| 266 | } |
---|
| 267 | } |
---|
| 268 | |
---|
| 269 | /** |
---|
| 270 | - Application has picture buffer list with size of GOP + 1 |
---|
| 271 | - Picture buffer list acts like as ring buffer |
---|
| 272 | - End of the list has the latest picture |
---|
| 273 | . |
---|
| 274 | \param bEos true if end-of-sequence is reached |
---|
| 275 | \param pcPicYuvOrg original YUV picture |
---|
| 276 | \retval rcListPicYuvRecOut list of reconstruction YUV pictures |
---|
| 277 | \retval rcListBitstreamOut list of output bitstreams |
---|
| 278 | \retval iNumEncoded number of encoded pictures |
---|
| 279 | */ |
---|
| 280 | Void TEncTop::encode( bool bEos, std::map<PicOrderCnt, TComPicYuv*>& rcMapPicYuvRecOut, TComBitstream* pcBitstreamOut, Bool& bNewPicNeeded ) |
---|
| 281 | { |
---|
| 282 | |
---|
| 283 | // TComBitstream* pcBitstreamOut ; |
---|
| 284 | TComPicYuv* pcPicYuvRecOut; |
---|
| 285 | TComPic* pcOrgRefList[2][MAX_REF_PIC_NUM]; //GT: not used? |
---|
| 286 | TComPic* pcPic ; |
---|
| 287 | |
---|
| 288 | bool bSomethingCoded = false ; |
---|
[42] | 289 | #if FLEX_CODING_ORDER |
---|
| 290 | if (TEncTop::m_bPicWaitingForCoding ) |
---|
| 291 | #else |
---|
[2] | 292 | if (m_bPicWaitingForCoding ) |
---|
[42] | 293 | #endif |
---|
[2] | 294 | { |
---|
| 295 | std::map<Int, TComPic*>::iterator cIter = m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() ); |
---|
| 296 | const bool bPictureAvailable = cIter != m_acInputPicMap.end(); |
---|
| 297 | if (bPictureAvailable) //GT: it is possible that poc to code is not in input-picmap, but m_bPicWaitingForCoding is true, since current poc is beyond sequence-end |
---|
| 298 | { |
---|
| 299 | assert( m_acOutputPicMap.find( m_cSeqIter.getPoc() ) != m_acOutputPicMap.end() ); |
---|
| 300 | pcPicYuvRecOut = m_acOutputPicMap[m_cSeqIter.getPoc()]; |
---|
| 301 | m_acOutputPicMap.erase( m_cSeqIter.getPoc() ); |
---|
| 302 | pcPic = cIter->second ; |
---|
| 303 | |
---|
[5] | 304 | #if DEPTH_MAP_GENERATION |
---|
[2] | 305 | // add extra pic buffers |
---|
| 306 | Bool bNeedPrdDepthMapBuf = ( m_uiPredDepthMapGeneration > 0 ); |
---|
| 307 | if( bNeedPrdDepthMapBuf && !pcPic->getPredDepthMap() ) |
---|
| 308 | { |
---|
[21] | 309 | pcPic->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(m_uiPredDepthMapGeneration), PDM_SUB_SAMP_EXP_Y(m_uiPredDepthMapGeneration) ); |
---|
[2] | 310 | } |
---|
[5] | 311 | #endif |
---|
[2] | 312 | |
---|
| 313 | // needed? dont think so |
---|
| 314 | TComPicYuv cPicOrg; |
---|
| 315 | cPicOrg.create( pcPic->getPicYuvOrg()->getWidth(), pcPic->getPicYuvOrg()->getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
| 316 | pcPic->getPicYuvOrg()->copyToPic( &cPicOrg ); |
---|
| 317 | xSetPicProperties( pcPic) ; |
---|
| 318 | m_cPicEncoder.compressPic( pcBitstreamOut, cPicOrg, pcPic, pcPicYuvRecOut, pcOrgRefList, m_bSeqFirst, m_cListPic); |
---|
| 319 | bSomethingCoded = true; |
---|
| 320 | m_acInputPicMap.erase( cIter ); |
---|
| 321 | cPicOrg.destroy() ; |
---|
| 322 | assert( rcMapPicYuvRecOut.find( pcPic->getPOC() ) == rcMapPicYuvRecOut.end() ); |
---|
| 323 | rcMapPicYuvRecOut[pcPic->getPOC()] = pcPicYuvRecOut; |
---|
| 324 | } |
---|
| 325 | else if(m_uiViewId==-1) |
---|
| 326 | printf("\nPOC %4d skipped due to sequence end", Int(m_cSeqIter.getPoc()) ); |
---|
| 327 | else |
---|
| 328 | { |
---|
| 329 | if( m_bIsDepth ) |
---|
| 330 | { |
---|
| 331 | printf("\nDepth View \t%4d\t POC %4d skipped due to sequence end", m_uiViewId, Int(m_cSeqIter.getPoc() )); |
---|
| 332 | } |
---|
| 333 | else |
---|
| 334 | { |
---|
| 335 | printf("\nView \t\t%4d\t POC %4d skipped due to sequence end", m_uiViewId, Int(m_cSeqIter.getPoc() )); |
---|
| 336 | } |
---|
| 337 | } |
---|
| 338 | ++m_cSeqIter; //GT: increment, even bPictureAvailable might be false, (POC beyond sequence end); |
---|
| 339 | |
---|
| 340 | Bool hitSeqEndButHasToCode = bEos && !m_acInputPicMap.empty(); |
---|
| 341 | if( (m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() ) != m_acInputPicMap.end()) || hitSeqEndButHasToCode ) //GT: new poc also in InputList |
---|
| 342 | { |
---|
| 343 | m_bPicWaitingForCoding = true; |
---|
| 344 | bNewPicNeeded = false ; |
---|
| 345 | } |
---|
| 346 | else |
---|
| 347 | { |
---|
| 348 | m_bPicWaitingForCoding = false; |
---|
| 349 | bNewPicNeeded = true ; |
---|
| 350 | } |
---|
| 351 | } |
---|
| 352 | |
---|
| 353 | |
---|
| 354 | if(bSomethingCoded && !m_bPicWaitingForCoding ) //GT: no gaps any more |
---|
| 355 | { |
---|
| 356 | m_uiNumAllPicCoded += m_iNumPicRcvd; |
---|
| 357 | m_iNumPicRcvd = 0; |
---|
| 358 | } |
---|
| 359 | |
---|
| 360 | |
---|
| 361 | if (bEos&&m_uiViewId==-1) |
---|
| 362 | { |
---|
| 363 | printOutSummary (m_uiNumAllPicCoded); |
---|
| 364 | } |
---|
| 365 | } |
---|
| 366 | |
---|
| 367 | |
---|
| 368 | Void TEncTop::receivePic( bool bEos, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvRec, TComPicYuv* pcOrgPdmDepth ) |
---|
| 369 | { |
---|
| 370 | if( !m_bPicWaitingForCoding ) //GT: insert pcPicYuvOrg in m_acInputPicMap and m_cListPic |
---|
| 371 | { |
---|
| 372 | TComPic* pcPicCurr = NULL; |
---|
| 373 | xGetNewPicBuffer( pcPicCurr ); //GT: assigns next POC to input pic and stores it in m_cListPic |
---|
| 374 | pcPicYuvOrg->copyToPic( pcPicCurr->getPicYuvOrg() ); |
---|
[5] | 375 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 376 | if( m_uiMultiviewMvRegMode ) |
---|
| 377 | { |
---|
| 378 | AOF( pcOrgPdmDepth ); |
---|
| 379 | AOF( pcPicCurr->getOrgDepthMap() ); |
---|
| 380 | pcOrgPdmDepth->copyToPic( pcPicCurr->getOrgDepthMap() ); |
---|
| 381 | } |
---|
| 382 | else |
---|
| 383 | { |
---|
| 384 | AOT( pcOrgPdmDepth ); |
---|
| 385 | AOT( pcPicCurr->getOrgDepthMap() ); |
---|
| 386 | } |
---|
[5] | 387 | #endif |
---|
[2] | 388 | m_acInputPicMap.insert( std::make_pair(pcPicCurr->getPOC(), pcPicCurr)); //GT: input pic to m_acInputPicMap |
---|
| 389 | assert( m_acOutputPicMap.find( pcPicCurr->getPOC() ) == m_acOutputPicMap.end() ); |
---|
| 390 | m_acOutputPicMap[pcPicCurr->getPOC()] = pcPicYuvRec; |
---|
| 391 | } |
---|
| 392 | |
---|
| 393 | bool hitSeqEndButHasToCode = bEos && !m_acInputPicMap.empty(); //GT: End of sequence has been reached, but still pictures to code left |
---|
| 394 | m_bPicWaitingForCoding = m_bPicWaitingForCoding || hitSeqEndButHasToCode ; |
---|
| 395 | |
---|
| 396 | if( m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() ) != m_acInputPicMap.end() ) //GT: If poc to code is in input-picmap; not necessary |
---|
| 397 | { |
---|
| 398 | m_bPicWaitingForCoding = true; |
---|
| 399 | } |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | |
---|
| 403 | Void |
---|
| 404 | TEncTop::deleteExtraPicBuffers( Int iPoc ) |
---|
| 405 | { |
---|
| 406 | TComPic* pcPic = 0; |
---|
| 407 | TComList<TComPic*>::iterator cIter = m_cListPic.begin(); |
---|
| 408 | TComList<TComPic*>::iterator cEnd = m_cListPic.end (); |
---|
| 409 | for( ; cIter != cEnd; cIter++ ) |
---|
| 410 | { |
---|
| 411 | if( (*cIter)->getPOC() == iPoc ) |
---|
| 412 | { |
---|
| 413 | pcPic = *cIter; |
---|
| 414 | break; |
---|
| 415 | } |
---|
| 416 | } |
---|
| 417 | AOF( pcPic ); |
---|
| 418 | if ( pcPic ) |
---|
| 419 | { |
---|
| 420 | pcPic->removeOriginalBuffer (); |
---|
[5] | 421 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 422 | pcPic->removeOrgDepthMapBuffer(); |
---|
[5] | 423 | #endif |
---|
| 424 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 425 | pcPic->removeResidualBuffer (); |
---|
[5] | 426 | #endif |
---|
| 427 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 428 | pcPic->removeUsedPelsMapBuffer(); |
---|
[5] | 429 | #endif |
---|
[2] | 430 | } |
---|
| 431 | } |
---|
| 432 | |
---|
| 433 | |
---|
| 434 | #if AMVP_BUFFERCOMPRESS |
---|
| 435 | Void |
---|
| 436 | TEncTop::compressMotion( Int iPoc ) |
---|
| 437 | { |
---|
| 438 | TComPic* pcPic = 0; |
---|
| 439 | TComList<TComPic*>::iterator cIter = m_cListPic.begin(); |
---|
| 440 | TComList<TComPic*>::iterator cEnd = m_cListPic.end (); |
---|
| 441 | for( ; cIter != cEnd; cIter++ ) |
---|
| 442 | { |
---|
| 443 | if( (*cIter)->getPOC() == iPoc ) |
---|
| 444 | { |
---|
| 445 | pcPic = *cIter; |
---|
| 446 | break; |
---|
| 447 | } |
---|
| 448 | } |
---|
| 449 | AOF( pcPic ); |
---|
| 450 | if ( pcPic ) |
---|
| 451 | { |
---|
| 452 | pcPic->compressMotion(); |
---|
| 453 | } |
---|
| 454 | } |
---|
| 455 | #endif |
---|
| 456 | |
---|
| 457 | |
---|
| 458 | |
---|
| 459 | // ==================================================================================================================== |
---|
| 460 | // Protected member functions |
---|
| 461 | // ==================================================================================================================== |
---|
| 462 | |
---|
| 463 | /** |
---|
| 464 | - Application has picture buffer list with size of GOP + 1 |
---|
| 465 | - Picture buffer list acts like as ring buffer |
---|
| 466 | - End of the list has the latest picture |
---|
| 467 | . |
---|
| 468 | \retval rpcPic obtained picture buffer |
---|
| 469 | */ |
---|
| 470 | Void TEncTop::xGetNewPicBuffer ( TComPic*& rpcPic ) |
---|
| 471 | { |
---|
| 472 | TComSlice::sortPicList(m_cListPic); |
---|
| 473 | |
---|
| 474 | // bug-fix - erase frame memory (previous GOP) which is not used for reference any more |
---|
| 475 | if (m_cListPic.size() >= m_uiCodedPictureStoreSize ) // 2) // K. Lee bug fix - for multiple reference > 2 |
---|
| 476 | { |
---|
| 477 | rpcPic = m_cListPic.popFront(); |
---|
| 478 | |
---|
| 479 | // is it necessary without long-term reference? |
---|
| 480 | } |
---|
| 481 | else |
---|
| 482 | { |
---|
| 483 | rpcPic = new TComPic; |
---|
| 484 | rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
| 485 | } |
---|
| 486 | |
---|
| 487 | m_cListPic.pushBack( rpcPic ); |
---|
| 488 | rpcPic->setReconMark (false); |
---|
| 489 | |
---|
| 490 | m_iPOCLast++; |
---|
| 491 | m_iNumPicRcvd++; |
---|
| 492 | |
---|
| 493 | rpcPic->addOriginalBuffer(); |
---|
[5] | 494 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 495 | if( m_uiMultiviewMvRegMode ) |
---|
| 496 | { |
---|
| 497 | rpcPic->addOrgDepthMapBuffer(); |
---|
| 498 | } |
---|
[5] | 499 | #endif |
---|
| 500 | |
---|
| 501 | #if HHI_INTERVIEW_SKIP |
---|
| 502 | if( getInterViewSkip() ) |
---|
[2] | 503 | { |
---|
| 504 | rpcPic->addUsedPelsMapBuffer(); |
---|
| 505 | } |
---|
[5] | 506 | #endif |
---|
[2] | 507 | |
---|
| 508 | rpcPic->setCurrSliceIdx( 0 ); // MW |
---|
| 509 | rpcPic->getSlice(0)->setPOC( m_iPOCLast ); |
---|
| 510 | |
---|
| 511 | // mark it should be extended |
---|
| 512 | rpcPic->getPicYuvRec()->setBorderExtension(false); |
---|
| 513 | } |
---|
| 514 | |
---|
| 515 | |
---|
| 516 | Void TEncTop::xInitSPS() |
---|
| 517 | { |
---|
| 518 | m_cSPS.setWidth ( m_iSourceWidth ); |
---|
| 519 | m_cSPS.setHeight ( m_iSourceHeight ); |
---|
| 520 | m_cSPS.setPad ( m_aiPad ); |
---|
| 521 | m_cSPS.setMaxCUWidth ( g_uiMaxCUWidth ); |
---|
| 522 | m_cSPS.setMaxCUHeight ( g_uiMaxCUHeight ); |
---|
| 523 | m_cSPS.setMaxCUDepth ( g_uiMaxCUDepth ); |
---|
| 524 | m_cSPS.setMinTrDepth ( 0 ); |
---|
| 525 | m_cSPS.setMaxTrDepth ( 1 ); |
---|
| 526 | |
---|
| 527 | m_cSPS.setUseALF ( m_bUseALF ); |
---|
| 528 | |
---|
| 529 | m_cSPS.setQuadtreeTULog2MaxSize( m_uiQuadtreeTULog2MaxSize ); |
---|
| 530 | m_cSPS.setQuadtreeTULog2MinSize( m_uiQuadtreeTULog2MinSize ); |
---|
| 531 | m_cSPS.setQuadtreeTUMaxDepthInter( m_uiQuadtreeTUMaxDepthInter ); |
---|
| 532 | m_cSPS.setQuadtreeTUMaxDepthIntra( m_uiQuadtreeTUMaxDepthIntra ); |
---|
| 533 | |
---|
| 534 | m_cSPS.setUseDQP ( m_iMaxDeltaQP != 0 ); |
---|
[5] | 535 | #if !HHI_NO_LowDelayCoding |
---|
[2] | 536 | m_cSPS.setUseLDC ( m_bUseLDC ); |
---|
| 537 | #endif |
---|
| 538 | m_cSPS.setUsePAD ( m_bUsePAD ); |
---|
| 539 | |
---|
| 540 | m_cSPS.setUseMRG ( m_bUseMRG ); // SOPH: |
---|
| 541 | |
---|
| 542 | #if LM_CHROMA |
---|
| 543 | m_cSPS.setUseLMChroma ( m_bUseLMChroma ); |
---|
| 544 | #endif |
---|
| 545 | |
---|
| 546 | m_cSPS.setMaxTrSize ( 1 << m_uiQuadtreeTULog2MaxSize ); |
---|
| 547 | |
---|
[42] | 548 | #if BITSTREAM_EXTRACTION |
---|
| 549 | m_cSPS.setLayerId( m_uiLayerId ); |
---|
| 550 | #endif |
---|
| 551 | |
---|
[2] | 552 | if( m_bIsDepth ) |
---|
| 553 | { |
---|
| 554 | m_cSPS.initMultiviewSPSDepth ( m_uiViewId, m_iViewOrderIdx ); |
---|
[5] | 555 | #if DEPTH_MAP_GENERATION |
---|
[2] | 556 | m_cSPS.setPredDepthMapGeneration( m_uiViewId, true ); |
---|
[5] | 557 | #endif |
---|
| 558 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 559 | m_cSPS.setMultiviewResPredMode ( 0 ); |
---|
[5] | 560 | #endif |
---|
[2] | 561 | } |
---|
| 562 | else |
---|
| 563 | { |
---|
| 564 | m_cSPS.initMultiviewSPS ( m_uiViewId, m_iViewOrderIdx, m_uiCamParPrecision, m_bCamParInSliceHeader, m_aaiCodedScale, m_aaiCodedOffset ); |
---|
| 565 | if( m_uiViewId ) |
---|
| 566 | { |
---|
[5] | 567 | #if DEPTH_MAP_GENERATION |
---|
| 568 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 569 | m_cSPS.setPredDepthMapGeneration( m_uiViewId, false, m_uiPredDepthMapGeneration, m_uiMultiviewMvPredMode, m_uiPdmPrecision, m_aaiPdmScaleNomDelta, m_aaiPdmOffset ); |
---|
[5] | 570 | #else |
---|
| 571 | m_cSPS.setPredDepthMapGeneration( m_uiViewId, false, m_uiPredDepthMapGeneration, 0, m_uiPdmPrecision, m_aaiPdmScaleNomDelta, m_aaiPdmOffset ); |
---|
| 572 | #endif |
---|
| 573 | #endif |
---|
| 574 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 575 | m_cSPS.setMultiviewResPredMode ( m_uiMultiviewResPredMode ); |
---|
[5] | 576 | #endif |
---|
[2] | 577 | } |
---|
| 578 | else |
---|
| 579 | { |
---|
[5] | 580 | #if DEPTH_MAP_GENERATION |
---|
[2] | 581 | m_cSPS.setPredDepthMapGeneration( m_uiViewId, false ); |
---|
[5] | 582 | #endif |
---|
| 583 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 584 | m_cSPS.setMultiviewResPredMode ( 0 ); |
---|
[5] | 585 | #endif |
---|
[2] | 586 | } |
---|
| 587 | } |
---|
| 588 | m_cSPS.setSPSId( ( m_uiViewId << 1 ) + ( m_bIsDepth ? 1 : 0 ) ); |
---|
| 589 | |
---|
| 590 | #if DCM_COMB_LIST |
---|
| 591 | m_cSPS.setUseLComb ( m_bUseLComb ); |
---|
| 592 | m_cSPS.setLCMod ( m_bLCMod ); |
---|
| 593 | #endif |
---|
| 594 | |
---|
| 595 | Int i; |
---|
| 596 | #if HHI_AMVP_OFF |
---|
| 597 | for ( i = 0; i < g_uiMaxCUDepth; i++ ) |
---|
| 598 | { |
---|
| 599 | m_cSPS.setAMVPMode( i, AM_NONE ); |
---|
| 600 | } |
---|
| 601 | #else |
---|
| 602 | for ( i = 0; i < g_uiMaxCUDepth; i++ ) |
---|
| 603 | { |
---|
| 604 | m_cSPS.setAMVPMode( i, AM_EXPL ); |
---|
| 605 | } |
---|
| 606 | #endif |
---|
| 607 | |
---|
| 608 | |
---|
| 609 | #if HHI_RMP_SWITCH |
---|
| 610 | m_cSPS.setUseRMP( m_bUseRMP ); |
---|
| 611 | #endif |
---|
| 612 | |
---|
| 613 | m_cSPS.setBitDepth ( g_uiBitDepth ); |
---|
| 614 | m_cSPS.setBitIncrement( g_uiBitIncrement ); |
---|
| 615 | |
---|
| 616 | #if MTK_NONCROSS_INLOOP_FILTER |
---|
| 617 | m_cSPS.setLFCrossSliceBoundaryFlag( m_bLFCrossSliceBoundaryFlag ); |
---|
| 618 | #endif |
---|
| 619 | #if MTK_SAO |
---|
| 620 | m_cSPS.setUseSAO ( m_bUseSAO ); |
---|
| 621 | #endif |
---|
[5] | 622 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
| 623 | m_cSPS.setUseDMM( m_bUseDMM ); |
---|
[2] | 624 | #endif |
---|
[42] | 625 | #if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER |
---|
| 626 | m_cSPS.setUseDMM34( m_bUseDMM34 ); |
---|
| 627 | #endif |
---|
[5] | 628 | #if HHI_MPI |
---|
[2] | 629 | m_cSPS.setUseMVI( m_bUseMVI ); |
---|
[5] | 630 | #endif |
---|
[2] | 631 | |
---|
| 632 | m_cSPS.setCodedPictureBufferSize( m_uiCodedPictureStoreSize ); |
---|
| 633 | } |
---|
| 634 | |
---|
| 635 | #if CONSTRAINED_INTRA_PRED |
---|
| 636 | Void TEncTop::xInitPPS() |
---|
| 637 | { |
---|
[42] | 638 | #if BITSTREAM_EXTRACTION |
---|
| 639 | m_cPPS.setLayerId( m_uiLayerId ); |
---|
| 640 | #endif |
---|
| 641 | |
---|
[2] | 642 | m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred ); |
---|
| 643 | m_cPPS.setPPSId( ( m_uiViewId << 1 ) + ( m_bIsDepth ? 1 : 0 ) ); |
---|
| 644 | m_cPPS.setSPSId( ( m_uiViewId << 1 ) + ( m_bIsDepth ? 1 : 0 ) ); |
---|
| 645 | |
---|
| 646 | #ifdef WEIGHT_PRED |
---|
| 647 | m_cPPS.setUseWP( m_bUseWeightPred ); |
---|
| 648 | m_cPPS.setWPBiPredIdc( m_uiBiPredIdc ); |
---|
| 649 | #endif |
---|
| 650 | } |
---|
| 651 | #endif |
---|
| 652 | |
---|
| 653 | |
---|
| 654 | Void TEncTop::setTEncTopList(std::vector<TEncTop*>* pacTEncTopList ) |
---|
| 655 | { |
---|
| 656 | assert(m_uiViewId!=-1); // not to be set for single view coding |
---|
| 657 | |
---|
| 658 | m_pacTEncTopList=pacTEncTopList; |
---|
| 659 | |
---|
| 660 | } |
---|
| 661 | |
---|
| 662 | |
---|
| 663 | Void TEncTop::printOutSummary(UInt uiNumAllPicCoded) |
---|
| 664 | { |
---|
| 665 | assert (uiNumAllPicCoded == m_cAnalyzeAll.getNumPic()); |
---|
| 666 | |
---|
| 667 | //--CFG_KDY |
---|
| 668 | m_cAnalyzeAll.setFrmRate( getFrameRate() ); |
---|
| 669 | m_cAnalyzeI.setFrmRate( getFrameRate() ); |
---|
| 670 | m_cAnalyzeP.setFrmRate( getFrameRate() ); |
---|
| 671 | m_cAnalyzeB.setFrmRate( getFrameRate() ); |
---|
| 672 | |
---|
| 673 | //-- all |
---|
| 674 | if(m_uiViewId==-1) |
---|
| 675 | printf( "\n\nSUMMARY --------------------------------------------------------\n" ); |
---|
| 676 | else { |
---|
| 677 | if ( m_bIsDepth ) |
---|
| 678 | { |
---|
| 679 | printf( "\n\nSUMMARY ---------------------------------------------- DEPTH %2d\n", m_uiViewId ); |
---|
| 680 | } |
---|
| 681 | else |
---|
| 682 | { |
---|
| 683 | printf( "\n\nSUMMARY ---------------------------------------------- VIDEO %2d\n", m_uiViewId ); |
---|
| 684 | } |
---|
| 685 | }; |
---|
| 686 | m_cAnalyzeAll.printOut('a'); |
---|
| 687 | |
---|
| 688 | printf( "\n\nI Slices--------------------------------------------------------\n" ); |
---|
| 689 | m_cAnalyzeI.printOut('i'); |
---|
| 690 | |
---|
| 691 | printf( "\n\nP Slices--------------------------------------------------------\n" ); |
---|
| 692 | m_cAnalyzeP.printOut('p'); |
---|
| 693 | |
---|
| 694 | printf( "\n\nB Slices--------------------------------------------------------\n" ); |
---|
| 695 | m_cAnalyzeB.printOut('b'); |
---|
| 696 | |
---|
| 697 | #if _SUMMARY_OUT_ |
---|
| 698 | m_cAnalyzeAll.printSummaryOut(); |
---|
| 699 | #endif |
---|
| 700 | #if _SUMMARY_PIC_ |
---|
| 701 | m_cAnalyzeI.printSummary('I'); |
---|
| 702 | m_cAnalyzeP.printSummary('P'); |
---|
| 703 | m_cAnalyzeB.printSummary('B'); |
---|
| 704 | #endif |
---|
| 705 | } |
---|
| 706 | |
---|
| 707 | Void TEncTop::xSetRefPics( TComPic* pcPic, RefPicList eRefPicList ) |
---|
| 708 | { |
---|
| 709 | assert(m_cSeqIter.getFrameDescriptor().getAllowedRelativeRefPocs( eRefPicList, pcPic->getViewIdx() ).size() == m_cSeqIter.getFrameDescriptor().getAllowedReferenceViewIdx( eRefPicList, pcPic->getViewIdx()).size()); |
---|
| 710 | #if 1 |
---|
| 711 | // check if refPic is available |
---|
| 712 | Int iNumberOfRefs = 0; |
---|
| 713 | std::vector<Int> aiRefPocs ; |
---|
| 714 | std::vector<Int> aiRefViews ; |
---|
| 715 | |
---|
| 716 | for( Int i=0; i<(Int)m_cSeqIter.getFrameDescriptor().getAllowedRelativeRefPocs( eRefPicList, pcPic->getViewIdx() ).size(); i++ ) |
---|
| 717 | { |
---|
| 718 | Int iRefPoc = m_cSeqIter.getFrameDescriptor().getAllowedRelativeRefPocs( eRefPicList, pcPic->getViewIdx() )[i]+pcPic->getPOC() ; |
---|
| 719 | Int iRefViewIdx = m_cSeqIter.getFrameDescriptor().getAllowedReferenceViewIdx( eRefPicList, pcPic->getViewIdx() )[i]; |
---|
| 720 | Bool bFoundRefPic = false; |
---|
| 721 | |
---|
| 722 | if( iRefPoc == pcPic->getPOC() ) // interview |
---|
| 723 | { |
---|
| 724 | assert( iRefViewIdx < (Int)m_uiViewId ); |
---|
| 725 | aiRefPocs.push_back(iRefPoc); |
---|
| 726 | aiRefViews.push_back(iRefViewIdx); |
---|
| 727 | iNumberOfRefs++ ; |
---|
| 728 | bFoundRefPic = true ; |
---|
| 729 | continue; |
---|
| 730 | } |
---|
| 731 | else if ( iRefViewIdx < 0 ) // temporal |
---|
| 732 | { |
---|
| 733 | for( TComList<TComPic*>::iterator it = m_cListPic.begin(); it!=m_cListPic.end(); it++) |
---|
| 734 | { |
---|
| 735 | if( (*it)->getViewIdx() == pcPic->getViewIdx() && (*it)->getPOC() == iRefPoc && (*it)->getReconMark() ) |
---|
| 736 | { |
---|
| 737 | aiRefPocs.push_back(iRefPoc); |
---|
| 738 | aiRefViews.push_back(m_uiViewId); |
---|
| 739 | bFoundRefPic = true ; |
---|
| 740 | iNumberOfRefs++ ; |
---|
| 741 | break; |
---|
| 742 | } |
---|
| 743 | } |
---|
| 744 | if( (iRefPoc < pcPic->getPOC()) && !bFoundRefPic ) |
---|
| 745 | { |
---|
| 746 | printf("\nInconsistence in GOP-String!"); |
---|
| 747 | assert(0); |
---|
| 748 | } |
---|
| 749 | } |
---|
| 750 | } |
---|
| 751 | for ( Int i=0; i< iNumberOfRefs; i++) |
---|
| 752 | { |
---|
| 753 | pcPic->setRefViewIdx( aiRefViews[i], eRefPicList, i ); |
---|
| 754 | pcPic->setRefPOC(aiRefPocs[i], eRefPicList, i ); |
---|
| 755 | } |
---|
| 756 | pcPic->setNumRefs( iNumberOfRefs, eRefPicList ); |
---|
| 757 | #else |
---|
| 758 | for( Int i=0; i<(Int)m_cSeqIter.getFrameDescriptor().getAllowedRelativeRefPocs( eRefPicList, pcPic->getViewIdx() ).size(); i++ ) |
---|
| 759 | { |
---|
| 760 | const int iRefViewIdx = m_cSeqIter.getFrameDescriptor().getAllowedReferenceViewIdx( eRefPicList, pcPic->getViewIdx() )[i]; |
---|
| 761 | if( iRefViewIdx < 0 ) |
---|
| 762 | { |
---|
| 763 | // temporal reference from current view |
---|
| 764 | pcPic->setRefViewIdx( m_iViewIdx, eRefPicList, i ); |
---|
| 765 | } |
---|
| 766 | else |
---|
| 767 | { |
---|
| 768 | pcPic->setRefViewIdx( iRefViewIdx, eRefPicList, i ); |
---|
| 769 | } |
---|
| 770 | pcPic->setRefPOC(m_cSeqIter.getFrameDescriptor().getAllowedRelativeRefPocs( eRefPicList, pcPic->getViewIdx() )[i]+pcPic->getPOC(), eRefPicList, i ); |
---|
| 771 | } |
---|
| 772 | pcPic->setNumRefs( m_cSeqIter.getFrameDescriptor().getAllowedRelativeRefPocs( eRefPicList, pcPic->getViewIdx() ).size(), eRefPicList ); |
---|
| 773 | #endif |
---|
| 774 | } |
---|
| 775 | |
---|
| 776 | Void TEncTop::xCheckSliceType(TComPic* pcPic) |
---|
| 777 | { |
---|
| 778 | if( pcPic->getNumRefs(REF_PIC_LIST_0) == 0 && pcPic->getNumRefs(REF_PIC_LIST_1) == 0 && pcPic->getSliceType() == I_SLICE ) |
---|
| 779 | { |
---|
| 780 | return ; |
---|
| 781 | } |
---|
| 782 | if( pcPic->getNumRefs(REF_PIC_LIST_0) != 0 && pcPic->getNumRefs(REF_PIC_LIST_1) == 0 && pcPic->getSliceType() == P_SLICE ) |
---|
| 783 | { |
---|
| 784 | return ; |
---|
| 785 | } |
---|
| 786 | if( pcPic->getNumRefs(REF_PIC_LIST_0) != 0 && pcPic->getNumRefs(REF_PIC_LIST_1) != 0 && pcPic->getSliceType() == B_SLICE ) |
---|
| 787 | { |
---|
| 788 | return ; |
---|
| 789 | } |
---|
| 790 | if( pcPic->getNumRefs(REF_PIC_LIST_0) == 0 && pcPic->getNumRefs(REF_PIC_LIST_1) == 0 ) |
---|
| 791 | { |
---|
| 792 | pcPic->setSliceType(I_SLICE) ; |
---|
| 793 | return; |
---|
| 794 | } |
---|
| 795 | if( pcPic->getNumRefs(REF_PIC_LIST_0) != 0 && pcPic->getNumRefs(REF_PIC_LIST_1) == 0 ) |
---|
| 796 | { |
---|
| 797 | pcPic->setSliceType(P_SLICE) ; |
---|
| 798 | return; |
---|
| 799 | } |
---|
| 800 | |
---|
| 801 | assert(0); |
---|
| 802 | } |
---|
| 803 | |
---|
| 804 | |
---|
| 805 | Void TEncTop::xSetPicProperties(TComPic* pcPic) |
---|
| 806 | { |
---|
| 807 | pcPic->setSliceType( m_cSeqIter.getFrameDescriptor().getSliceType(m_uiViewId) ); |
---|
| 808 | pcPic->setReferenced( m_cSeqIter.getFrameDescriptor().getStoreForRef(m_uiViewId) ); |
---|
| 809 | pcPic->setColDir( m_cSeqIter.getFrameDescriptor().getColDir() ) ; |
---|
| 810 | const Bool bQpChangePointPassed = m_iFrameNumInCodingOrder++ >= getQpChangeFrame(); |
---|
| 811 | const Int iQpChangeOffset = bQpChangePointPassed ? ( m_bIsDepth ? getQpChangeOffsetDepth() : getQpChangeOffsetVideo() ) : 0; |
---|
| 812 | pcPic->setQP(max(MIN_QP,min(MAX_QP, m_iQP+ m_aiTLayerQPOffset[m_cSeqIter.getFrameDescriptor().getTEncSeqStructureLayer(m_uiViewId)] + iQpChangeOffset )) ); |
---|
| 813 | pcPic->setViewIdx( m_uiViewId ); |
---|
[21] | 814 | #if SONY_COLPIC_AVAILABILITY |
---|
| 815 | pcPic->setViewOrderIdx(m_iViewOrderIdx); |
---|
| 816 | #endif |
---|
[2] | 817 | #if 0 |
---|
| 818 | pcPic->setNumRefs(0, REF_PIC_LIST_0); |
---|
| 819 | pcPic->setNumRefs(0, REF_PIC_LIST_1); |
---|
| 820 | |
---|
| 821 | |
---|
| 822 | if( m_cSeqIter.getFrameDescriptor().getSliceType(m_iViewIdx)== P_SLICE || m_cSeqIter.getFrameDescriptor().getSliceType(m_iViewIdx)== B_SLICE) |
---|
| 823 | { |
---|
| 824 | xSetRefPics( pcPic, REF_PIC_LIST_0 ); |
---|
| 825 | } |
---|
| 826 | if( m_cSeqIter.getFrameDescriptor().getSliceType(m_iViewIdx)== B_SLICE) |
---|
| 827 | { |
---|
| 828 | xSetRefPics( pcPic, REF_PIC_LIST_1 ); |
---|
| 829 | } |
---|
| 830 | #else |
---|
| 831 | xSetRefPics( pcPic, REF_PIC_LIST_0 ); |
---|
| 832 | xSetRefPics( pcPic, REF_PIC_LIST_1 ); |
---|
| 833 | xCheckSliceType( pcPic ); |
---|
| 834 | #endif |
---|
| 835 | |
---|
| 836 | pcPic->setScaleOffset( m_aaiCodedScale, m_aaiCodedOffset ); |
---|
| 837 | } |
---|