Changeset 1029 in SHVCSoftware for branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp
- Timestamp:
- 26 Feb 2015, 00:21:54 (10 years ago)
- Location:
- branches/SHM-dev
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev
- Property svn:mergeinfo changed
-
branches/SHM-dev/source
- Property svn:mergeinfo changed
-
branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp
r1005 r1029 41 41 #include <fcntl.h> 42 42 #include <assert.h> 43 #include <iostream> 43 44 44 #include "TAppDecTop.h" 45 45 #include "TLibDecoder/AnnexBread.h" 46 46 #include "TLibDecoder/NALread.h" 47 #if RExt__DECODER_DEBUG_BIT_STATISTICS 48 #include "TLibCommon/TComCodingStatistics.h" 49 #endif 50 #if CONFORMANCE_BITSTREAM_MODE 47 51 #include "TLibCommon/TComPicYuv.h" 48 52 #include "libmd5/MD5.h" 53 #endif 54 49 55 //! \ingroup TAppDecoder 50 56 //! \{ … … 83 89 #if SVC_EXTENSION 84 90 #if FIX_CONF_MODE 85 for(Int i = 0; i < = MAX_VPS_LAYER_ID_PLUS1-1; i++ )91 for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++ ) 86 92 #else 87 93 for( Int i = 0; i <= m_tgtLayerId; i++ ) … … 137 143 InputByteStream bytestream(bitstreamFile); 138 144 145 if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-") 146 { 147 m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out); 148 if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good()) 149 { 150 fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str()); 151 exit(EXIT_FAILURE); 152 } 153 } 154 139 155 // create & initialize internal classes 140 156 xCreateDecLib(); 141 xInitDecLib (); 157 xInitDecLib (); 142 158 143 159 // main decoder loop … … 147 163 148 164 #if FIX_CONF_MODE 149 for(UInt layer = 0; layer < = MAX_VPS_LAYER_ID_PLUS1-1; layer++)165 for(UInt layer = 0; layer < MAX_VPS_LAYER_ID_PLUS1; layer++) 150 166 #else 151 167 for(UInt layer=0; layer<=m_tgtLayerId; layer++) … … 177 193 * requires the TDecTop::decode() method to be called again with the same 178 194 * nal unit. */ 195 #if RExt__DECODER_DEBUG_BIT_STATISTICS 196 TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics()); 197 streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes()); 198 #else 179 199 streampos location = bitstreamFile.tellg(); 200 #endif 180 201 AnnexBStats stats = AnnexBStats(); 181 202 … … 183 204 InputNALUnit nalu; 184 205 byteStreamNALUnit(bytestream, nalUnit, stats); 206 185 207 // call actual decoding function 186 208 Bool bNewPicture = false; 187 209 Bool bNewPOC = false; 210 188 211 if (nalUnit.empty()) 189 212 { … … 221 244 * [1] except for the first NAL unit in the file 222 245 * (but bNewPicture doesn't happen then) */ 246 #if RExt__DECODER_DEBUG_BIT_STATISTICS 247 bitstreamFile.seekg(location); 248 bytestream.reset(); 249 TComCodingStatistics::SetStatistics(backupStats); 250 #else 223 251 bitstreamFile.seekg(location-streamoff(3)); 224 252 bytestream.reset(); 253 #endif 225 254 } 226 255 #if POC_RESET_IDC_DECODER … … 232 261 bitstreamFile.seekg(location); 233 262 bytestream.reset(); 263 #if RExt__DECODER_DEBUG_BIT_STATISTICS 264 TComCodingStatistics::SetStatistics(backupStats); 265 #endif 234 266 } 235 267 #endif … … 238 270 239 271 #if POC_RESET_IDC_DECODER 240 if ((bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || (m_acTDecTop[nalu.m_layerId].getParseIdc() == 0) || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) 241 #else 242 if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) 272 if ( ( (bNewPicture && m_acTDecTop[nalu.m_layerId].getParseIdc() == 3) || m_acTDecTop[nalu.m_layerId].getParseIdc() == 0 || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && 273 !m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence() ) 274 #else 275 if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && 276 !m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence() ) 243 277 #endif 244 278 { 245 279 #if O0194_DIFFERENT_BITDEPTH_EL_BL 246 280 //Bug fix: The bit depth was not set correctly for each layer when doing DBF 247 g_bitDepth Y = g_bitDepthYLayer[curLayerId];248 g_bitDepth C = g_bitDepthCLayer[curLayerId];281 g_bitDepth[CHANNEL_TYPE_LUMA] = g_bitDepthLayer[CHANNEL_TYPE_LUMA][curLayerId]; 282 g_bitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepthLayer[CHANNEL_TYPE_CHROMA][curLayerId]; 249 283 #endif 250 284 if (!loopFiltered[curLayerId] || bitstreamFile) … … 256 290 m_acTDecTop[curLayerId].earlyPicMarking(m_iMaxTemporalLayer, m_targetDecLayerIdSet); 257 291 #endif 292 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 293 { 294 m_acTDecTop[nalu.m_layerId].setFirstSliceInSequence(true); 295 } 296 } 297 else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && 298 m_acTDecTop[nalu.m_layerId].getFirstSliceInSequence () ) 299 { 300 m_acTDecTop[nalu.m_layerId].setFirstSliceInPicture (true); 258 301 } 259 302 … … 269 312 if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] ) 270 313 { 271 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } 272 if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; } 273 274 m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 314 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 315 { 316 if (m_outputBitDepth[channelType] == 0) m_outputBitDepth[channelType] = g_bitDepth[channelType]; 317 } 318 m_acTVideoIOYuvReconFile[curLayerId].open( m_pchReconFile[curLayerId], true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode 275 319 276 320 openedReconFile[curLayerId] = true; … … 362 406 363 407 #if FIX_CONF_MODE 364 for(UInt layer = layerIdmin; layer < = MAX_VPS_LAYER_ID_PLUS1-1; layer++)408 for(UInt layer = layerIdmin; layer < MAX_VPS_LAYER_ID_PLUS1; layer++) 365 409 #else 366 410 for(UInt layer = layerIdmin; layer <= m_tgtLayerId; layer++) … … 390 434 391 435 InputByteStream bytestream(bitstreamFile); 436 437 if (!m_outputDecodedSEIMessagesFilename.empty() && m_outputDecodedSEIMessagesFilename!="-") 438 { 439 m_seiMessageFileStream.open(m_outputDecodedSEIMessagesFilename.c_str(), std::ios::out); 440 if (!m_seiMessageFileStream.is_open() || !m_seiMessageFileStream.good()) 441 { 442 fprintf(stderr, "\nUnable to open file `%s' for writing decoded SEI messages\n", m_outputDecodedSEIMessagesFilename.c_str()); 443 exit(EXIT_FAILURE); 444 } 445 } 392 446 393 447 // create & initialize internal classes … … 406 460 * requires the TDecTop::decode() method to be called again with the same 407 461 * nal unit. */ 462 #if RExt__DECODER_DEBUG_BIT_STATISTICS 463 TComCodingStatistics::TComCodingStatisticsData backupStats(TComCodingStatistics::GetStatistics()); 464 streampos location = bitstreamFile.tellg() - streampos(bytestream.GetNumBufferedBytes()); 465 #else 408 466 streampos location = bitstreamFile.tellg(); 467 #endif 409 468 AnnexBStats stats = AnnexBStats(); 410 469 … … 429 488 if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) ) 430 489 { 431 432 490 bNewPicture = false; 491 } 433 492 else 434 493 { … … 441 500 * [1] except for the first NAL unit in the file 442 501 * (but bNewPicture doesn't happen then) */ 502 #if RExt__DECODER_DEBUG_BIT_STATISTICS 503 bitstreamFile.seekg(location); 504 bytestream.reset(); 505 TComCodingStatistics::SetStatistics(backupStats); 506 #else 443 507 bitstreamFile.seekg(location-streamoff(3)); 444 508 bytestream.reset(); 445 } 446 } 447 } 448 if (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) 509 #endif 510 } 511 } 512 } 513 514 if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS) && 515 !m_cTDecTop.getFirstSliceInSequence () ) 449 516 { 450 517 if (!loopFiltered || bitstreamFile) … … 453 520 } 454 521 loopFiltered = (nalu.m_nalUnitType == NAL_UNIT_EOS); 455 } 456 #if !FIX_WRITING_OUTPUT 457 #if SETTING_NO_OUT_PIC_PRIOR 458 if (bNewPicture && m_cTDecTop.getNoOutputPriorPicsFlag()) 459 { 460 m_cTDecTop.checkNoOutputPriorPics( pcListPic ); 461 } 462 #endif 463 #endif 522 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 523 { 524 m_cTDecTop.setFirstSliceInSequence(true); 525 } 526 } 527 else if ( (bNewPicture || !bitstreamFile || nalu.m_nalUnitType == NAL_UNIT_EOS ) && 528 m_cTDecTop.getFirstSliceInSequence () ) 529 { 530 m_cTDecTop.setFirstSliceInPicture (true); 531 } 464 532 465 533 if( pcListPic ) … … 467 535 if ( m_pchReconFile && !openedReconFile ) 468 536 { 469 if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; } 470 if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; } 471 472 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode 537 for (UInt channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++) 538 { 539 if (m_outputBitDepth[channelType] == 0) m_outputBitDepth[channelType] = g_bitDepth[channelType]; 540 } 541 542 m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode 473 543 openedReconFile = true; 474 544 } 475 #if FIX_WRITING_OUTPUT476 545 // write reconstruction to file 477 546 if( bNewPicture ) … … 479 548 xWriteOutput( pcListPic, nalu.m_temporalId ); 480 549 } 481 #if SETTING_NO_OUT_PIC_PRIOR482 550 if ( (bNewPicture || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA) && m_cTDecTop.getNoOutputPriorPicsFlag() ) 483 551 { … … 485 553 m_cTDecTop.setNoOutputPriorPicsFlag (false); 486 554 } 487 #endif488 #endif489 555 if ( bNewPicture && 490 556 ( nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL … … 498 564 if (nalu.m_nalUnitType == NAL_UNIT_EOS) 499 565 { 500 #if FIX_OUTPUT_EOS501 566 xWriteOutput( pcListPic, nalu.m_temporalId ); 502 #else 503 xFlushOutput( pcListPic ); 504 #endif 567 m_cTDecTop.setFirstSliceInPicture (false); 505 568 } 506 569 // write reconstruction to file -- for additional bumping as defined in C.5.2.3 507 #if FIX_WRITING_OUTPUT508 570 if(!bNewPicture && nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL_N && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_VCL31) 509 #else510 if(bNewPicture)511 #endif512 571 { 513 572 xWriteOutput( pcListPic, nalu.m_temporalId ); … … 534 593 // initialize global variables 535 594 initROM(); 595 536 596 #if FIX_CONF_MODE 537 for(UInt layer = 0; layer < = MAX_VPS_LAYER_ID_PLUS1-1; layer++)597 for(UInt layer = 0; layer < MAX_VPS_LAYER_ID_PLUS1; layer++) 538 598 #else 539 599 for(UInt layer = 0; layer <= m_tgtLayerId; layer++) … … 559 619 // destroy ROM 560 620 destroyROM(); 621 561 622 #if FIX_CONF_MODE 562 for(UInt layer = 0; layer < = MAX_VPS_LAYER_ID_PLUS1-1; layer++)623 for(UInt layer = 0; layer < MAX_VPS_LAYER_ID_PLUS1; layer++) 563 624 #else 564 625 for(UInt layer = 0; layer <= m_tgtLayerId; layer++) … … 589 650 #if SVC_EXTENSION 590 651 #if FIX_CONF_MODE 591 for(UInt layer = 0; layer < = MAX_VPS_LAYER_ID_PLUS1-1; layer++)652 for(UInt layer = 0; layer < MAX_VPS_LAYER_ID_PLUS1; layer++) 592 653 #else 593 654 for(UInt layer = 0; layer <= m_tgtLayerId; layer++) … … 605 666 #endif 606 667 #if OUTPUT_LAYER_SET_INDEX 607 m_acTDecTop[layer].setCommonDecoderParams( this->getCommonDecoderParams());668 m_acTDecTop[layer].setCommonDecoderParams( &m_commonDecoderParams ); 608 669 #endif 609 670 } … … 615 676 #endif 616 677 { 617 m_acTDecTop[layer].setConfModeFlag ( this->getConfModeFlag());678 m_acTDecTop[layer].setConfModeFlag( m_confModeFlag ); 618 679 } 619 680 #endif … … 621 682 m_cTDecTop.init(); 622 683 m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 684 #if O0043_BEST_EFFORT_DECODING 685 m_cTDecTop.setForceDecodeBitDepth(m_forceDecodeBitDepth); 686 #endif 687 if (!m_outputDecodedSEIMessagesFilename.empty()) 688 { 689 std::ostream &os=m_seiMessageFileStream.is_open() ? m_seiMessageFileStream : std::cout; 690 m_cTDecTop.setDecodedSEIMessageOutputStream(&os); 691 } 623 692 #if Q0074_COLOUR_REMAPPING_SEI 624 693 m_cTDecTop.setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled); … … 673 742 #endif 674 743 { 675 numPicsNotYetDisplayed++;744 numPicsNotYetDisplayed++; 676 745 dpbFullness++; 677 746 } … … 682 751 iterPic++; 683 752 } 684 iterPic = pcListPic->begin(); 753 754 iterPic = pcListPic->begin(); 755 685 756 if (numPicsNotYetDisplayed>2) 686 757 { … … 720 791 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 721 792 const Bool isTff = pcPicTop->isTopField(); 722 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 723 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 793 794 Bool display = true; 795 if( m_decodedNoDisplaySEIEnabled ) 796 { 797 SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY ); 798 const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL; 799 if( (nd != NULL) && nd->m_noDisplay ) 800 { 801 display = false; 802 } 803 } 804 805 if (display) 806 { 724 807 #if REPN_FORMAT_IN_VPS 725 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 726 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 727 728 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot, 729 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 730 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 731 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 732 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff ); 733 #else 734 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot, 735 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 736 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 737 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 738 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 739 #endif 808 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 809 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 810 811 m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 812 m_outputColourSpaceConvert, 813 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 814 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 815 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 816 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 817 #else 818 m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 819 m_outputColourSpaceConvert, 820 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 821 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 822 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 823 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 824 #endif 825 } 740 826 } 741 827 … … 748 834 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 749 835 const Bool isTff = pcPicTop->isTopField(); 750 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 751 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 752 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 753 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 754 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 755 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 756 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 836 837 Bool display = true; 838 if( m_decodedNoDisplaySEIEnabled ) 839 { 840 SEIMessages noDisplay = getSeisByType(pcPic->getSEIs(), SEI::NO_DISPLAY ); 841 const SEINoDisplay *nd = ( noDisplay.size() > 0 ) ? (SEINoDisplay*) *(noDisplay.begin()) : NULL; 842 if( (nd != NULL) && nd->m_noDisplay ) 843 { 844 display = false; 845 } 846 } 847 848 if (display) 849 { 850 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 851 m_outputColourSpaceConvert, 852 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 853 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 854 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 855 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 856 } 757 857 } 758 858 … … 800 900 { 801 901 iterPic = pcListPic->begin(); 902 802 903 while (iterPic != pcListPic->end()) 803 904 { … … 813 914 { 814 915 // write to file 815 numPicsNotYetDisplayed--;916 numPicsNotYetDisplayed--; 816 917 if(pcPic->getSlice(0)->isReferenced() == false) 817 918 { … … 822 923 { 823 924 const Window &conf = pcPic->getConformanceWindow(); 824 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 825 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 925 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 826 926 #if REPN_FORMAT_IN_VPS 827 927 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 828 928 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 829 929 830 m_acTVideoIOYuvReconFile[layerId].write( p PicCYuvRec,930 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert, 831 931 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 832 932 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), … … 834 934 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 835 935 #else 836 m_acTVideoIOYuvReconFile[layerId].write( p PicCYuvRec,936 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert, 837 937 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 838 938 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), … … 847 947 if ( m_pchReconFile ) 848 948 { 849 const Window &conf = pcPic->getConformanceWindow();949 const Window &conf = pcPic->getConformanceWindow(); 850 950 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 951 851 952 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 852 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 853 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 854 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 855 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 953 m_outputColourSpaceConvert, 954 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 955 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 956 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 957 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 856 958 } 857 959 … … 921 1023 const Window &conf = pcPicTop->getConformanceWindow(); 922 1024 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 923 const Bool isTff = pcPicTop->isTopField(); 924 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 925 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 1025 const Bool isTff = pcPicTop->isTopField(); 926 1026 #if REPN_FORMAT_IN_VPS 927 1027 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 928 1028 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 929 1029 930 m_acTVideoIOYuvReconFile[layerId].write( p PicCYuvRecTop, pPicCYuvRecBot,1030 m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), m_outputColourSpaceConvert, 931 1031 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(), 932 1032 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(), 933 1033 conf.getWindowTopOffset() *yScal + defDisp.getWindowTopOffset(), 934 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );935 #else 936 m_acTVideoIOYuvReconFile[layerId].write( p PicCYuvRecTop, pPicCYuvRecBot,1034 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 1035 #else 1036 m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), m_outputColourSpaceConvert, 937 1037 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 938 1038 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 939 1039 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 940 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );1040 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 941 1041 #endif 942 1042 } … … 950 1050 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 951 1051 const Bool isTff = pcPicTop->isTopField(); 952 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 953 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 954 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 955 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 956 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 957 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 958 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff ); 1052 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 1053 m_outputColourSpaceConvert, 1054 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 1055 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 1056 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 1057 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), NUM_CHROMA_FORMAT, isTff ); 959 1058 } 960 1059 … … 1027 1126 { 1028 1127 const Window &conf = pcPic->getConformanceWindow(); 1029 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1030 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 1128 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1031 1129 #if REPN_FORMAT_IN_VPS 1032 1130 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 1033 1131 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 1034 1132 1035 m_acTVideoIOYuvReconFile[layerId].write( p PicCYuvRec,1133 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert, 1036 1134 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(), 1037 1135 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(), … … 1039 1137 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() ); 1040 1138 #else 1041 m_acTVideoIOYuvReconFile[layerId].write( p PicCYuvRec,1139 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(), m_outputColourSpaceConvert, 1042 1140 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 1043 1141 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), … … 1052 1150 if ( m_pchReconFile ) 1053 1151 { 1054 const Window &conf = pcPic->getConformanceWindow();1152 const Window &conf = pcPic->getConformanceWindow(); 1055 1153 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1056 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 1057 m_cTVideoIOYuvReconFile.write( pPicCYuvRec, 1058 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 1059 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 1060 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 1061 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 1154 1155 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 1156 m_outputColourSpaceConvert, 1157 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 1158 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 1159 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 1160 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 1062 1161 } 1063 1162 … … 1143 1242 #endif 1144 1243 TComPicYuv* pPicCYuvRec = pic->getPicYuvRec(); 1145 m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec, 1244 m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec, m_outputColourSpaceConvert, 1146 1245 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 1147 1246 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), … … 1149 1248 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 1150 1249 } 1151 1152 1250 // update POC of display order 1153 1251 pocLastDisplay = pic->getPOC(); … … 1405 1503 #if CONFORMANCE_BITSTREAM_MODE 1406 1504 FILE *fptr; 1407 if( this->getConfModeFlag())1408 { 1409 if( this->getMetadataFileRefresh())1505 if( m_confModeFlag ) 1506 { 1507 if( m_metadataFileRefresh ) 1410 1508 { 1411 1509 fptr = fopen( this->getMetadataFileName().c_str(), "w" ); … … 1418 1516 } 1419 1517 this->setMetadataFileRefresh(false); 1420 UChar recon_digest[3][16]; 1421 calcMD5(*pic->getPicYuvRec(), recon_digest); 1422 fprintf(fptr, "%8d%9d MD5:%s\n", pic->getLayerId(), pic->getSlice(0)->getPOC(), digestToString(recon_digest, 16)); 1518 1519 TComDigest recon_digest; 1520 Int numChar = calcMD5(*pic->getPicYuvRec(), recon_digest); 1521 fprintf(fptr, "%8d%9d MD5:%s\n", pic->getLayerId(), pic->getSlice(0)->getPOC(), digestToString(recon_digest, numChar).c_str()); 1423 1522 fclose(fptr); 1424 1523 } 1425 1524 #endif 1426 1427 1525 1428 1526 listOfPocsInEachLayer[layerIdx].erase( it ); … … 1434 1532 } 1435 1533 #if !FIX_ALIGN_BUMPING 1436 #// Update sub-DPB status1534 // Update sub-DPB status 1437 1535 for( Int subDpbIdx = 0; subDpbIdx < dpbStatus.m_numSubDpbs; subDpbIdx++) 1438 1536 { … … 1440 1538 } 1441 1539 #endif 1442 dpbStatus.m_numAUsNotDisplayed--; 1540 dpbStatus.m_numAUsNotDisplayed--; 1443 1541 1444 1542 #if CONFORMANCE_BITSTREAM_MODE 1445 if( this->getConfModeFlag())1543 if( m_confModeFlag ) 1446 1544 { 1447 1545 for( Int dpbLayerCtr = 0; dpbLayerCtr < dpbStatus.m_numLayers; dpbLayerCtr++) … … 1453 1551 if( this->getDecodedYuvLayerRefresh(layerIdx) ) 1454 1552 { 1455 if (!m_outputBitDepth Y) { m_outputBitDepthY = g_bitDepthY; }1456 if (!m_outputBitDepth C) { m_outputBitDepthC = g_bitDepthC; }1553 if (!m_outputBitDepth[CHANNEL_TYPE_LUMA]) { m_outputBitDepth[CHANNEL_TYPE_LUMA] = g_bitDepth[CHANNEL_TYPE_LUMA]; } 1554 if (!m_outputBitDepth[CHANNEL_TYPE_CHROMA]) { m_outputBitDepth[CHANNEL_TYPE_CHROMA] = g_bitDepth[CHANNEL_TYPE_CHROMA]; } 1457 1555 1458 1556 char tempFileName[256]; 1459 1557 strcpy(tempFileName, this->getDecodedYuvLayerFileName( layerIdx ).c_str()); 1460 m_confReconFile[layerIdx].open(tempFileName, true, m_outputBitDepth Y, m_outputBitDepthC, g_bitDepthY, g_bitDepthC); // write mode1558 m_confReconFile[layerIdx].open(tempFileName, true, m_outputBitDepth, m_outputBitDepth, g_bitDepth ); // write mode 1461 1559 this->setDecodedYuvLayerRefresh( layerIdx, false ); 1462 1560 } … … 1468 1566 const Window &conf = checkPic.getConformanceWindow(); 1469 1567 const Window &defDisp = m_respectDefDispWindow ? checkPic.getDefDisplayWindow() : Window(); 1470 Int xScal = 1568 Int xScal = 1, yScal = 1; 1471 1569 #if REPN_FORMAT_IN_VPS 1472 1570 UInt chromaFormatIdc = checkPic.getSlice(0)->getChromaFormatIdc(); … … 1477 1575 { 1478 1576 TComPicYuv* pPicCYuvRec = checkPic.getPicYuvRec(); 1479 m_confReconFile[layerIdx].write( pPicCYuvRec, 1577 m_confReconFile[layerIdx].write( pPicCYuvRec, m_outputColourSpaceConvert, 1480 1578 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 1481 1579 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), … … 1493 1591 } 1494 1592 #endif 1593 1495 1594 // Remove the picture from the listOfPocs 1496 1595 listOfPocs.erase( listOfPocs.begin() ); 1497 1596 } 1498 1499 1597 1500 1598 TComVPS *TAppDecTop::findDpbParametersFromVps(std::vector<Int> const &listOfPocs, std::vector<Int> const *listOfPocsInEachLayer, std::vector<Int> const *listOfPocsPositionInEachLayer, DpbStatus &maxDpbLimit)
Note: See TracChangeset for help on using the changeset viewer.