Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecGop.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r1179 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 46 46 #include <time.h> 47 47 48 extern Bool g_md5_mismatch; ///< top level flag to signal when there is a decode problem49 50 48 //! \ingroup TLibDecoder 51 49 //! \{ 52 static void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI);50 static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI, const BitDepths &bitDepths, UInt &numChecksumErrors); 53 51 // ==================================================================================================================== 54 52 // Constructor / destructor / initialization / destroy … … 56 54 57 55 TDecGop::TDecGop() 56 : m_numberOfChecksumErrorsDetected(0) 58 57 { 59 58 m_dDecTime = 0; 60 m_pcSbacDecoders = NULL;61 m_pcBinCABACs = NULL;62 59 } 63 60 64 61 TDecGop::~TDecGop() 65 62 { 66 63 67 64 } 68 65 69 66 Void TDecGop::create() 70 67 { 71 68 72 69 } 73 70 … … 77 74 } 78 75 79 Void TDecGop::init( TDecEntropy* pcEntropyDecoder, 80 TDecSbac* pcSbacDecoder, 76 Void TDecGop::init( TDecEntropy* pcEntropyDecoder, 77 TDecSbac* pcSbacDecoder, 81 78 TDecBinCABAC* pcBinCABAC, 82 TDecCavlc* pcCavlcDecoder, 83 TDecSlice* pcSliceDecoder, 79 TDecCavlc* pcCavlcDecoder, 80 TDecSlice* pcSliceDecoder, 84 81 TComLoopFilter* pcLoopFilter, 85 82 TComSampleAdaptiveOffset* pcSAO … … 92 89 m_pcSliceDecoder = pcSliceDecoder; 93 90 m_pcLoopFilter = pcLoopFilter; 94 m_pcSAO = pcSAO; 91 m_pcSAO = pcSAO; 92 m_numberOfChecksumErrorsDetected = 0; 95 93 } 96 94 … … 103 101 // ==================================================================================================================== 104 102 105 Void TDecGop::decompressSlice(TComInputBitstream* pcBitstream, TComPic* & rpcPic)106 { 107 TComSlice* pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx());103 Void TDecGop::decompressSlice(TComInputBitstream* pcBitstream, TComPic* pcPic) 104 { 105 TComSlice* pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); 108 106 // Table of extracted substreams. 109 107 // These must be deallocated AND their internal fifos, too. … … 111 109 112 110 //-- For time output for each slice 113 longiBeforeTime = clock();111 clock_t iBeforeTime = clock(); 114 112 m_pcSbacDecoder->init( (TDecBinIf*)m_pcBinCABAC ); 115 113 m_pcEntropyDecoder->setEntropyDecoder (m_pcSbacDecoder); 116 114 117 UInt uiNumSubstreams = pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() ? pcSlice->getNumEntryPointOffsets()+1 : pcSlice->getPPS()->getNumSubstreams();115 const UInt uiNumSubstreams = pcSlice->getNumberOfSubstreamSizes()+1; 118 116 119 117 // init each couple {EntropyDecoder, Substream} 120 UInt *puiSubstreamSizes = pcSlice->getSubstreamSizes();121 118 ppcSubstreams = new TComInputBitstream*[uiNumSubstreams]; 122 m_pcSbacDecoders = new TDecSbac[uiNumSubstreams];123 m_pcBinCABACs = new TDecBinCABAC[uiNumSubstreams];124 119 for ( UInt ui = 0 ; ui < uiNumSubstreams ; ui++ ) 125 120 { 126 m_pcSbacDecoders[ui].init(&m_pcBinCABACs[ui]); 127 ppcSubstreams[ui] = pcBitstream->extractSubstream(ui+1 < uiNumSubstreams ? puiSubstreamSizes[ui] : pcBitstream->getNumBitsLeft()); 128 } 129 130 for ( UInt ui = 0 ; ui+1 < uiNumSubstreams; ui++ ) 131 { 132 m_pcEntropyDecoder->setEntropyDecoder ( &m_pcSbacDecoders[uiNumSubstreams - 1 - ui] ); 133 m_pcEntropyDecoder->setBitstream ( ppcSubstreams [uiNumSubstreams - 1 - ui] ); 134 m_pcEntropyDecoder->resetEntropy (pcSlice); 135 } 136 137 m_pcEntropyDecoder->setEntropyDecoder ( m_pcSbacDecoder ); 138 m_pcEntropyDecoder->setBitstream ( ppcSubstreams[0] ); 139 m_pcEntropyDecoder->resetEntropy (pcSlice); 140 #if H_3D_NBDV 121 ppcSubstreams[ui] = pcBitstream->extractSubstream(ui+1 < uiNumSubstreams ? (pcSlice->getSubstreamSize(ui)<<3) : pcBitstream->getNumBitsLeft()); 122 } 123 124 #if NH_3D_NBDV 141 125 if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done. 142 126 { 143 Int iColPoc = pcSlice->getRefPOC(RefPicList(1 -pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());144 rpcPic->setNumDdvCandPics(rpcPic->getDisCandRefPictures(iColPoc));127 Int iColPoc = pcSlice->getRefPOC(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx()); 128 pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc)); 145 129 } 146 130 147 131 if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done. 148 132 { 149 rpcPic->checkTemporalIVRef();133 pcPic->checkTemporalIVRef(); 150 134 } 151 135 152 136 if(pcSlice->getIsDepth()) 153 137 { 154 rpcPic->checkTextureRef();155 } 156 #endif 157 #if H_3D138 pcPic->checkTextureRef(); 139 } 140 #endif 141 #if NH_3D 158 142 pcSlice->setDepthToDisparityLUTs(); 159 143 #endif 160 m_pcSbacDecoders[0].load(m_pcSbacDecoder); 161 m_pcSliceDecoder->decompressSlice( ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders); 162 m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiNumSubstreams-1] ); 144 145 m_pcSliceDecoder->decompressSlice( ppcSubstreams, pcPic, m_pcSbacDecoder); 163 146 // deallocate all created substreams, including internal buffers. 164 147 for (UInt ui = 0; ui < uiNumSubstreams; ui++) 165 148 { 166 ppcSubstreams[ui]->deleteFifo();167 149 delete ppcSubstreams[ui]; 168 150 } 169 151 delete[] ppcSubstreams; 170 delete[] m_pcSbacDecoders; m_pcSbacDecoders = NULL;171 delete[] m_pcBinCABACs; m_pcBinCABACs = NULL;172 152 173 153 m_dDecTime += (Double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; 174 154 } 175 155 176 Void TDecGop::filterPicture(TComPic* & rpcPic)177 { 178 TComSlice* pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx());156 Void TDecGop::filterPicture(TComPic* pcPic) 157 { 158 TComSlice* pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); 179 159 180 160 //-- For time output for each slice 181 longiBeforeTime = clock();161 clock_t iBeforeTime = clock(); 182 162 183 163 // deblocking filter 184 164 Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); 185 165 m_pcLoopFilter->setCfg(bLFCrossTileBoundary); 186 m_pcLoopFilter->loopFilterPic( rpcPic ); 166 m_pcLoopFilter->loopFilterPic( pcPic ); 167 187 168 if( pcSlice->getSPS()->getUseSAO() ) 188 169 { 189 m_pcSAO->reconstructBlkSAOParams(rpcPic, rpcPic->getPicSym()->getSAOBlkParam()); 190 m_pcSAO->SAOProcess(rpcPic); 191 m_pcSAO->PCMLFDisableProcess(rpcPic); 192 } 193 #if H_3D 194 rpcPic->compressMotion(2); 195 #endif 196 #if !H_3D 197 rpcPic->compressMotion(); 170 m_pcSAO->reconstructBlkSAOParams(pcPic, pcPic->getPicSym()->getSAOBlkParam()); 171 m_pcSAO->SAOProcess(pcPic); 172 m_pcSAO->PCMLFDisableProcess(pcPic); 173 } 174 #if NH_3D 175 pcPic->compressMotion(2); 176 #else 177 pcPic->compressMotion(); 198 178 #endif 199 179 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 200 if (!pcSlice->isReferenced()) c += 32; 180 if (!pcSlice->isReferenced()) 181 { 182 c += 32; 183 } 201 184 202 185 //-- For time output for each slice 203 #if H_MV204 printf(" \nLayer %2d POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getLayerId(),186 #if NH_MV 187 printf("Layer %2d POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getLayerId(), 205 188 pcSlice->getPOC(), 206 189 pcSlice->getTLayer(), … … 208 191 pcSlice->getSliceQp() ); 209 192 #else 210 printf(" \nPOC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(),211 212 213 193 printf("POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(), 194 pcSlice->getTLayer(), 195 c, 196 pcSlice->getSliceQp() ); 214 197 #endif 215 198 … … 223 206 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) 224 207 { 225 #if H_MV208 #if NH_MV 226 209 if( pcSlice->getLayerId() != pcSlice->getRefLayerId( RefPicList(iRefList), iRefIndex ) ) 227 210 { … … 232 215 #endif 233 216 printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)); 234 #if H_MV217 #if NH_MV 235 218 } 236 219 #endif … … 240 223 if (m_decodedPictureHashSEIEnabled) 241 224 { 242 SEIMessages pictureHashes = getSeisByType( rpcPic->getSEIs(), SEI::DECODED_PICTURE_HASH );225 SEIMessages pictureHashes = getSeisByType(pcPic->getSEIs(), SEI::DECODED_PICTURE_HASH ); 243 226 const SEIDecodedPictureHash *hash = ( pictureHashes.size() > 0 ) ? (SEIDecodedPictureHash*) *(pictureHashes.begin()) : NULL; 244 227 if (pictureHashes.size() > 1) … … 246 229 printf ("Warning: Got multiple decoded picture hash SEI messages. Using first."); 247 230 } 248 calcAndPrintHashStatus(*rpcPic->getPicYuvRec(), hash); 249 } 250 #if !H_MV 251 #if SETTING_PIC_OUTPUT_MARK 252 rpcPic->setOutputMark(rpcPic->getSlice(0)->getPicOutputFlag() ? true : false); 253 #else 254 rpcPic->setOutputMark(true); 255 #endif 256 rpcPic->setReconMark(true); 231 calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash, pcSlice->getSPS()->getBitDepths(), m_numberOfChecksumErrorsDetected); 232 } 233 234 printf("\n"); 235 #if !NH_MV 236 pcPic->setOutputMark(pcPic->getSlice(0)->getPicOutputFlag() ? true : false); 237 pcPic->setReconMark(true); 257 238 #endif 258 239 } … … 269 250 * unk - no SEI message was available for comparison 270 251 */ 271 static void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI)252 static Void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI, const BitDepths &bitDepths, UInt &numChecksumErrors) 272 253 { 273 254 /* calculate MD5sum for entire reconstructed picture */ 274 UChar recon_digest[3][16];255 TComPictureHash recon_digest; 275 256 Int numChar=0; 276 257 const Char* hashType = "\0"; … … 280 261 switch (pictureHashSEI->method) 281 262 { 282 case SEIDecodedPictureHash::MD5: 283 { 284 hashType = "MD5"; 285 calcMD5(pic, recon_digest); 286 numChar = 16; 287 break; 288 } 289 case SEIDecodedPictureHash::CRC: 290 { 291 hashType = "CRC"; 292 calcCRC(pic, recon_digest); 293 numChar = 2; 294 break; 295 } 296 case SEIDecodedPictureHash::CHECKSUM: 297 { 298 hashType = "Checksum"; 299 calcChecksum(pic, recon_digest); 300 numChar = 4; 301 break; 302 } 303 default: 304 { 305 assert (!"unknown hash type"); 306 } 263 case SEIDecodedPictureHash::MD5: 264 { 265 hashType = "MD5"; 266 numChar = calcMD5(pic, recon_digest, bitDepths); 267 break; 268 } 269 case SEIDecodedPictureHash::CRC: 270 { 271 hashType = "CRC"; 272 numChar = calcCRC(pic, recon_digest, bitDepths); 273 break; 274 } 275 case SEIDecodedPictureHash::CHECKSUM: 276 { 277 hashType = "Checksum"; 278 numChar = calcChecksum(pic, recon_digest, bitDepths); 279 break; 280 } 281 default: 282 { 283 assert (!"unknown hash type"); 284 break; 285 } 307 286 } 308 287 } … … 315 294 { 316 295 ok = "(OK)"; 317 for(Int yuvIdx = 0; yuvIdx < 3; yuvIdx++)296 if (recon_digest != pictureHashSEI->m_pictureHash) 318 297 { 319 for (UInt i = 0; i < numChar; i++) 320 { 321 if (recon_digest[yuvIdx][i] != pictureHashSEI->digest[yuvIdx][i]) 322 { 323 ok = "(***ERROR***)"; 324 mismatch = true; 325 } 326 } 298 ok = "(***ERROR***)"; 299 mismatch = true; 327 300 } 328 301 } 329 302 330 printf("[%s:%s,%s] ", hashType, digestToString(recon_digest, numChar), ok);303 printf("[%s:%s,%s] ", hashType, hashToString(recon_digest, numChar).c_str(), ok); 331 304 332 305 if (mismatch) 333 306 { 334 g_md5_mismatch = true;335 printf("[rx%s:%s] ", hashType, digestToString(pictureHashSEI->digest, numChar));307 numChecksumErrors++; 308 printf("[rx%s:%s] ", hashType, hashToString(pictureHashSEI->m_pictureHash, numChar).c_str()); 336 309 } 337 310 }
Note: See TracChangeset for help on using the changeset viewer.