Changeset 928 in SHVCSoftware for branches/SHM-upgrade/source/App/TAppDecoder
- Timestamp:
- 16 Dec 2014, 19:17:49 (10 years ago)
- Location:
- branches/SHM-upgrade/source/App/TAppDecoder
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-upgrade/source/App/TAppDecoder/TAppDecCfg.cpp
r916 r928 73 73 Int olsIdx; 74 74 #endif 75 #if CONFORMANCE_BITSTREAM_MODE 76 string cfg_confPrefix; 77 #endif 75 78 #if AVC_BASE 76 79 string cfg_BLReconFile; … … 102 105 #if OUTPUT_LAYER_SET_INDEX 103 106 ("OutpuLayerSetIdx,-olsidx", olsIdx, -1, "Index of output layer set to be decoded.") 107 #endif 108 #if CONFORMANCE_BITSTREAM_MODE 109 ("ConformanceBitstremMode,-confMode", m_confModeFlag, false, "Enable generation of conformance bitstream metadata; True: Generate metadata, False: No metadata generated") 110 ("ConformanceMetadataPrefix,-confPrefix", cfg_confPrefix, string(""), "Prefix for the file name of the conformance data. Default name - 'decodedBitstream'") 104 111 #endif 105 112 #else … … 160 167 assert( m_tgtLayerId < MAX_NUM_LAYER_IDS ); 161 168 #endif 162 #if OUTPUT_LAYER_SET_INDEX 169 #if OUTPUT_LAYER_SET_INDEX 170 #if CONFORMANCE_BITSTREAM_MODE 171 if( m_confModeFlag ) 172 { 173 assert( olsIdx != -1 ); // In the conformance mode, target output layer set index is to be explicitly specified. 174 175 if( cfg_confPrefix.empty() ) 176 { 177 m_confPrefix = string("decodedBitstream"); 178 } 179 else 180 { 181 m_confPrefix = cfg_confPrefix; 182 } 183 // Open metadata file and write 184 char fileNameSuffix[255]; 185 sprintf(fileNameSuffix, "%s-OLS%d.opl", m_confPrefix.c_str(), olsIdx); // olsIdx is the target output layer set index. 186 m_metadataFileName = string(fileNameSuffix); 187 m_metadataFileRefresh = true; 188 189 // Decoded layer YUV files 190 for(UInt layer=0; layer<= m_tgtLayerId; layer++) 191 { 192 sprintf(fileNameSuffix, "%s-L%d.yuv", m_confPrefix.c_str(), layer); // olsIdx is the target output layer set index. 193 m_decodedYuvLayerFileName[layer] = std::string( fileNameSuffix ); 194 m_decodedYuvLayerRefresh[layer] = true; 195 } 196 } 197 #endif 163 198 this->getCommonDecoderParams()->setTargetOutputLayerSetIdx( olsIdx ); 164 199 this->getCommonDecoderParams()->setTargetLayerId ( m_tgtLayerId ); -
branches/SHM-upgrade/source/App/TAppDecoder/TAppDecCfg.h
r916 r928 94 94 CommonDecoderParams m_commonDecoderParams; 95 95 #endif 96 #if CONFORMANCE_BITSTREAM_MODE 97 Bool m_confModeFlag; 98 std::string m_confPrefix; 99 std::string m_metadataFileName; 100 Bool m_metadataFileRefresh; 101 std::string m_decodedYuvLayerFileName[63]; 102 Bool m_decodedYuvLayerRefresh[63]; 103 #endif 96 104 97 105 public: … … 131 139 CommonDecoderParams* getCommonDecoderParams() {return &m_commonDecoderParams;} 132 140 #endif 141 #if CONFORMANCE_BITSTREAM_MODE 142 Bool const getConfModeFlag() { return m_confModeFlag; } 143 std::string const getConfPrefix() { return m_confPrefix;} 144 std::string const getMetadataFileName() { return m_metadataFileName; } 145 Bool const getMetadataFileRefresh() {return m_metadataFileRefresh; } 146 Void setMetadataFileRefresh(Bool const x) {m_metadataFileRefresh = x; } 147 Void setDecodedYuvLayerFileName(Int layerId, std::string x) { m_decodedYuvLayerFileName[layerId] = x; } 148 std::string const getDecodedYuvLayerFileName(Int layerId) { return m_decodedYuvLayerFileName[layerId]; } 149 Bool const getDecodedYuvLayerRefresh(Int const layerId) {return m_decodedYuvLayerRefresh[layerId]; } 150 Void setDecodedYuvLayerRefresh(Int const layerId, Bool const x) {m_decodedYuvLayerRefresh[layerId] = x; } 151 #endif 133 152 }; 134 153 -
branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.cpp
r918 r928 48 48 #include "TLibCommon/TComCodingStatistics.h" 49 49 #endif 50 #if CONFORMANCE_BITSTREAM_MODE 51 #include "TLibCommon/TComPicYuv.h" 52 #include "libmd5/MD5.h" 53 #endif 50 54 51 55 //! \ingroup TAppDecoder … … 630 634 m_acTDecTop[layer].setNumLayer( m_tgtLayerId + 1 ); 631 635 #if OUTPUT_LAYER_SET_INDEX 632 m_acTDecTop[layer].setCommonDecoderParams( this->getCommonDecoderParams() ); 633 #endif 634 } 636 m_acTDecTop[layer].setCommonDecoderParams( &m_commonDecoderParams ); 637 #endif 638 } 639 #if CONFORMANCE_BITSTREAM_MODE 640 for(UInt layer = 0; layer <= MAX_LAYERS; layer++) 641 { 642 m_acTDecTop[layer].setConfModeFlag ( m_confModeFlag ); 643 } 644 #endif 635 645 #else 636 646 m_cTDecTop.init(); … … 1408 1418 1409 1419 xOutputAndMarkPic( pic, m_pchReconFile[layerIdx], layerIdx, m_aiPOCLastDisplay[layerIdx], dpbStatus ); 1420 1421 #if CONFORMANCE_BITSTREAM_MODE 1422 FILE *fptr; 1423 if( m_confModeFlag ) 1424 { 1425 if( m_metadataFileRefresh ) 1426 { 1427 fptr = fopen( this->getMetadataFileName().c_str(), "w" ); 1428 fprintf(fptr, " LayerId POC MD5\n"); 1429 fprintf(fptr, "------------------------\n"); 1430 } 1431 else 1432 { 1433 fptr = fopen( this->getMetadataFileName().c_str(), "a+" ); 1434 } 1435 this->setMetadataFileRefresh(false); 1436 1437 TComDigest recon_digest; 1438 calcMD5(*pic->getPicYuvRec(), recon_digest); 1439 fprintf(fptr, "%8d%9d MD5:%s\n", pic->getLayerId(), pic->getSlice(0)->getPOC(), digestToString(recon_digest, 16)); 1440 fclose(fptr); 1441 1442 // Output all picutres "decoded" in that layer that have POC less than the current picture 1443 std::vector<TComPic> *layerBuffer = (m_acTDecTop->getLayerDec(pic->getLayerId()))->getConfListPic(); 1444 // Write all pictures to the file. 1445 if( this->getDecodedYuvLayerRefresh(layerIdx) ) 1446 { 1447 if (!m_outputBitDepth[CHANNEL_TYPE_LUMA]) { m_outputBitDepth[CHANNEL_TYPE_LUMA] = g_bitDepth[CHANNEL_TYPE_LUMA]; } 1448 if (!m_outputBitDepth[CHANNEL_TYPE_CHROMA]) { m_outputBitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepth[CHANNEL_TYPE_CHROMA]; } 1449 1450 char tempFileName[256]; 1451 strcpy(tempFileName, this->getDecodedYuvLayerFileName( layerIdx ).c_str()); 1452 m_confReconFile[layerIdx].open(tempFileName, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode 1453 this->setDecodedYuvLayerRefresh( layerIdx, false ); 1454 } 1455 const Window &conf = pic->getConformanceWindow(); 1456 const Window &defDisp = m_respectDefDispWindow ? pic->getDefDisplayWindow() : Window(); 1457 Int xScal = 1, yScal = 1; 1458 #if REPN_FORMAT_IN_VPS 1459 UInt chromaFormatIdc = pic->getSlice(0)->getChromaFormatIdc(); 1460 xScal = TComSPS::getWinUnitX( chromaFormatIdc ); 1461 yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 1462 #endif 1463 std::vector<TComPic>::iterator iterPic; 1464 for(iterPic = layerBuffer->begin(); iterPic != layerBuffer->end(); iterPic++) 1465 { 1466 TComPic checkPic = *iterPic; 1467 if( checkPic.getPOC() <= pic->getPOC() ) 1468 { 1469 TComPicYuv* pPicCYuvRec = checkPic.getPicYuvRec(); 1470 m_confReconFile[layerIdx].write( pPicCYuvRec, m_outputColourSpaceConvert, 1471 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 1472 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 1473 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 1474 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 1475 layerBuffer->erase(iterPic); 1476 iterPic = layerBuffer->begin(); // Ensure doesn't go to infinite loop 1477 if(layerBuffer->size() == 0) 1478 { 1479 break; 1480 } 1481 } 1482 } 1483 } 1484 // Now to remove the pictures that have been output 1485 #endif 1410 1486 1411 1487 listOfPocsInEachLayer[layerIdx].erase( it ); -
branches/SHM-upgrade/source/App/TAppDecoder/TAppDecTop.h
r916 r928 74 74 // for output control 75 75 #if SVC_EXTENSION 76 #if CONFORMANCE_BITSTREAM_MODE 77 TVideoIOYuv m_confReconFile[63]; ///< decode YUV files 78 #endif 76 79 Int m_aiPOCLastDisplay [MAX_LAYERS]; ///< last POC in display order 77 80 #else
Note: See TracChangeset for help on using the changeset viewer.