Changeset 928 in SHVCSoftware
- Timestamp:
- 16 Dec 2014, 19:17:49 (10 years ago)
- Location:
- branches/SHM-upgrade/source
- Files:
-
- 9 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 -
branches/SHM-upgrade/source/App/TAppEncoder/TAppEncTop.cpp
r918 r928 1616 1616 vps->deriveNumberOfSubDpbs(); 1617 1617 #endif 1618 vps->setOutputLayerFlag( 0, 0, 1 ); 1618 1619 1619 1620 // derive OutputLayerFlag[i][j] -
branches/SHM-upgrade/source/Lib/TLibCommon/TypeDef.h
r917 r928 46 46 #define MAX_LAYERS 8 ///< max number of layers the codec is supposed to handle 47 47 48 #define CONFORMANCE_BITSTREAM_MODE 1 ///< In order to generate the metadata related to conformance bitstreams 48 49 #define SIGNALLING_BITRATE_PICRATE_FIX 1 ///< Fix for signalling of bitrate and picture rate info in VPS VUI to be more aligned to JCTVC-R1008 49 50 #define INFERENCE_POC_MSB_VAL_PRESENT 1 ///< JCTVC-Q0146 -- poc_msb_val_present_flag shall be equal to 0 when slice_header_extension_length is (inferred to be ) equal to 0 -
branches/SHM-upgrade/source/Lib/TLibDecoder/TDecGop.cpp
r921 r928 45 45 #if SVC_EXTENSION 46 46 #include "TDecTop.h" 47 #if CONFORMANCE_BITSTREAM_MODE 48 #include <algorithm> 49 #endif 47 50 #endif 48 51 … … 50 53 51 54 extern Bool g_md5_mismatch; ///< top level flag to signal when there is a decode problem 55 56 #if CONFORMANCE_BITSTREAM_MODE 57 Bool pocCompareFunction( TComPic &pic1, TComPic &pic2 ) 58 { 59 return (pic1.getPOC() < pic2.getPOC()); 60 } 61 #endif 52 62 53 63 //! \ingroup TLibDecoder … … 241 251 calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash); 242 252 } 253 #if CONFORMANCE_BITSTREAM_MODE 254 if( this->getLayerDec(pcPic->getLayerId())->getConfModeFlag() ) 255 { 256 // Add this reconstructed picture to the parallel buffer. 257 std::vector<TComPic> *thisLayerBuffer = (this->getLayerDec(pcPic->getLayerId()))->getConfListPic(); 258 thisLayerBuffer->push_back(*pcPic); 259 std::sort( thisLayerBuffer->begin(), thisLayerBuffer->end(), pocCompareFunction ); 260 } 261 #endif 243 262 #if Q0074_COLOUR_REMAPPING_SEI 244 263 if (m_colourRemapSEIEnabled) -
branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.cpp
r916 r928 129 129 m_pocDecrementedInDPBFlag = false; 130 130 #endif 131 #if CONFORMANCE_BITSTREAM_MODE 132 m_confModeFlag = false; 133 #endif 131 134 } 132 135 … … 2960 2963 { 2961 2964 // Check if the target decoded layer is the highest layer in the list 2965 #if !CONFORMANCE_BITSTREAM_MODE 2962 2966 assert( params->getTargetOutputLayerSetIdx() < vps->getNumLayerSets() ); 2967 #endif 2963 2968 Int layerSetIdx = vps->getOutputLayerSetIdx( params->getTargetOutputLayerSetIdx() ); // Index to the layer set 2969 #if !CONFORMANCE_BITSTREAM_MODE 2964 2970 assert( params->getTargetLayerId() == vps->getNumLayersInIdList( layerSetIdx ) - 1); 2971 #endif 2965 2972 2966 2973 Bool layerSetMatchFlag = true; -
branches/SHM-upgrade/source/Lib/TLibDecoder/TDecTop.h
r916 r928 170 170 // When new VPS is activated, this should be re-initialized to -1 171 171 #endif 172 #if CONFORMANCE_BITSTREAM_MODE 173 Bool m_confModeFlag; 174 std::vector<TComPic> m_confListPic; // Dynamic buffer for storing pictures for conformance purposes 175 #endif 172 176 public: 173 177 #if POC_RESET_RESTRICTIONS … … 304 308 Void assignSubDpbs(TComVPS *vps); 305 309 #endif 310 #if CONFORMANCE_BITSTREAM_MODE 311 std::vector<TComPic>* getConfListPic() {return &m_confListPic; } 312 // std::string const getDecodedYuvLayerFileName(Int layerId) { return m_decodedYuvLayerFileName[layerId]; } 313 Bool const getConfModeFlag() { return m_confModeFlag; } 314 Void setConfModeFlag(Bool x) { m_confModeFlag = x; } 315 #endif 306 316 #endif //SVC_EXTENSION 307 317
Note: See TracChangeset for help on using the changeset viewer.