Changeset 1470 in SHVCSoftware for branches/SHM-dev/source/App/TAppDecoder
- Timestamp:
- 9 Sep 2015, 18:31:04 (9 years ago)
- Location:
- branches/SHM-dev/source/App/TAppDecoder
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp
r1467 r1470 64 64 #if Q0074_COLOUR_REMAPPING_SEI 65 65 : m_pcSeiColourRemappingInfoPrevious(NULL) 66 , m_pcPicYuvColourRemapped(NULL)67 66 #endif 68 67 { … … 80 79 #if Q0074_COLOUR_REMAPPING_SEI 81 80 ,m_pcSeiColourRemappingInfoPrevious(NULL) 82 ,m_pcPicYuvColourRemapped(NULL)83 81 #endif 84 82 { … … 137 135 Void TAppDecTop::decode() 138 136 { 139 Int poc;137 Int poc; 140 138 TComList<TComPic*>* pcListPic = NULL; 141 139 … … 161 159 // create & initialize internal classes 162 160 xCreateDecLib(); 163 xInitDecLib (); 161 xInitDecLib (); 162 163 #if Q0074_COLOUR_REMAPPING_SEI 164 // clear contents of colour-remap-information-SEI output file 165 if (!m_colourRemapSEIFileName.empty()) 166 { 167 std::ofstream ofile(m_colourRemapSEIFileName.c_str()); 168 if (!ofile.good() || !ofile.is_open()) 169 { 170 fprintf(stderr, "\nUnable to open file '%s' for writing colour-remap-information-SEI video\n", m_colourRemapSEIFileName.c_str()); 171 exit(EXIT_FAILURE); 172 } 173 } 174 #endif 164 175 165 176 // main decoder loop … … 446 457 m_iPOCLastDisplay += m_iSkipFrame; // set the last displayed POC correctly for skip forward. 447 458 459 #if Q0074_COLOUR_REMAPPING_SEI 460 // clear contents of colour-remap-information-SEI output file 461 if (!m_colourRemapSEIFileName.empty()) 462 { 463 std::ofstream ofile(m_colourRemapSEIFileName.c_str()); 464 if (!ofile.good() || !ofile.is_open()) 465 { 466 fprintf(stderr, "\nUnable to open file '%s' for writing colour-remap-information-SEI video\n", m_colourRemapSEIFileName.c_str()); 467 exit(EXIT_FAILURE); 468 } 469 } 470 #endif 471 448 472 // main decoder loop 449 473 Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen) … … 645 669 m_cTDecTop.destroy(); 646 670 #endif 671 #if Q0074_COLOUR_REMAPPING_SEI 672 if (m_pcSeiColourRemappingInfoPrevious != NULL) 673 { 674 delete m_pcSeiColourRemappingInfoPrevious; 675 m_pcSeiColourRemappingInfoPrevious = NULL; 676 } 677 #endif 647 678 } 648 679 … … 688 719 delete m_pcSeiColourRemappingInfoPrevious; 689 720 m_pcSeiColourRemappingInfoPrevious = NULL; 690 }691 if (m_pcPicYuvColourRemapped != NULL)692 {693 m_pcPicYuvColourRemapped->destroy();694 delete m_pcPicYuvColourRemapped;695 m_pcPicYuvColourRemapped = NULL;696 721 } 697 722 #endif … … 929 954 if (!m_colourRemapSEIFileName.empty()) 930 955 { 931 xOutputColourRemapPic(pcPic , activeSPS);956 xOutputColourRemapPic(pcPic); 932 957 } 933 958 #endif … … 1101 1126 if (!m_colourRemapSEIFileName.empty()) 1102 1127 { 1103 xOutputColourRemapPic(pcPic , &(pcPic->getPicSym()->getSPS()));1128 xOutputColourRemapPic(pcPic); 1104 1129 } 1105 1130 #endif … … 1164 1189 #if Q0074_COLOUR_REMAPPING_SEI 1165 1190 1166 Void TAppDecTop::xOutputColourRemapPic(TComPic* pcPic, const TComSPS* activeSPS) 1167 { 1191 Void TAppDecTop::xOutputColourRemapPic(TComPic* pcPic) 1192 { 1193 const TComSPS &sps=pcPic->getPicSym()->getSPS(); 1168 1194 SEIMessages colourRemappingInfo = getSeisByType(pcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO ); 1169 1195 SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL; … … 1175 1201 if (seiColourRemappingInfo) 1176 1202 { 1177 applyColourRemapping(*pcPic->getPicYuvRec(), *seiColourRemappingInfo, *activeSPS); 1203 applyColourRemapping(*pcPic->getPicYuvRec(), *seiColourRemappingInfo, sps); 1204 1205 // save the last CRI SEI received 1206 if (m_pcSeiColourRemappingInfoPrevious == NULL) 1207 { 1208 m_pcSeiColourRemappingInfoPrevious = new SEIColourRemappingInfo(); 1209 } 1210 m_pcSeiColourRemappingInfoPrevious->copyFrom(*seiColourRemappingInfo); 1178 1211 } 1179 1212 else // using the last CRI SEI received 1180 1213 { 1214 // TODO: prevent persistence of CRI SEI across C(L)VS. 1181 1215 if (m_pcSeiColourRemappingInfoPrevious != NULL) 1182 1216 { … … 1185 1219 printf("Warning No SEI-CRI message is present for the current picture, persistence of the CRI is not managed\n"); 1186 1220 } 1187 SEIColourRemappingInfo *seiColourRemappingInfoCopy; 1188 seiColourRemappingInfoCopy = m_pcSeiColourRemappingInfoPrevious; 1189 applyColourRemapping(*pcPic->getPicYuvRec(), *seiColourRemappingInfoCopy, *activeSPS); 1190 } 1191 } 1192 1193 // save the last CRI SEI received 1194 if( seiColourRemappingInfo != NULL) 1195 { 1196 if (m_pcSeiColourRemappingInfoPrevious != NULL) 1197 { 1198 delete m_pcSeiColourRemappingInfoPrevious; 1199 m_pcSeiColourRemappingInfoPrevious = NULL; 1200 } 1201 m_pcSeiColourRemappingInfoPrevious = new SEIColourRemappingInfo(); 1202 m_pcSeiColourRemappingInfoPrevious->copyFrom(*seiColourRemappingInfo); 1221 applyColourRemapping(*pcPic->getPicYuvRec(), *m_pcSeiColourRemappingInfoPrevious, sps); 1222 } 1203 1223 } 1204 1224 } … … 1373 1393 { 1374 1394 const Int maxBitDepth = 16; 1375 Bool firstPicture = true;1376 1395 1377 1396 // create colour remapped picture 1378 if ( m_pcPicYuvColourRemapped == NULL )1379 { 1380 const ChromaFormat chromaFormatIDC = pic.getChromaFormat();1397 if( !criSEI.m_colourRemapCancelFlag && pic.getChromaFormat()!=CHROMA_400) // 4:0:0 not supported. 1398 { 1399 const Int iHeight = pic.getHeight(COMPONENT_Y); 1381 1400 const Int iWidth = pic.getWidth(COMPONENT_Y); 1382 const Int iHeight = pic.getHeight(COMPONENT_Y); 1383 const UInt uiMaxCuWidth = activeSPS.getMaxCUWidth(); 1384 const UInt uiMaxCuHeight = activeSPS.getMaxCUHeight(); 1385 const UInt uiMaxDepth = activeSPS.getMaxTotalCUDepth(); 1386 m_pcPicYuvColourRemapped = new TComPicYuv; 1387 m_pcPicYuvColourRemapped->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true ); 1388 } 1389 else 1390 { 1391 firstPicture = false; 1392 } 1393 1394 if( !criSEI.m_colourRemapCancelFlag ) 1395 { 1396 const Int iHeight = pic.getHeight(COMPONENT_Y); 1397 const Int iWidth = pic.getWidth(COMPONENT_Y); 1398 const Int iStride = pic.getStride(COMPONENT_Y); 1399 const Int iCStride = pic.getStride(COMPONENT_Cb); 1400 const Bool b444 = ( pic.getChromaFormat() == CHROMA_444 ); 1401 const Bool b422 = ( pic.getChromaFormat() == CHROMA_422 ); 1402 const Bool b420 = ( pic.getChromaFormat() == CHROMA_420 ); 1401 const ChromaFormat chromaFormatIDC = pic.getChromaFormat(); 1402 1403 TComPicYuv picYuvColourRemapped; 1404 picYuvColourRemapped.createWithoutCUInfo( iWidth, iHeight, chromaFormatIDC ); 1405 1406 const Int iStrideIn = pic.getStride(COMPONENT_Y); 1407 const Int iCStrideIn = pic.getStride(COMPONENT_Cb); 1408 const Int iStrideOut = picYuvColourRemapped.getStride(COMPONENT_Y); 1409 const Int iCStrideOut = picYuvColourRemapped.getStride(COMPONENT_Cb); 1410 const Bool b444 = ( pic.getChromaFormat() == CHROMA_444 ); 1411 const Bool b422 = ( pic.getChromaFormat() == CHROMA_422 ); 1412 const Bool b420 = ( pic.getChromaFormat() == CHROMA_420 ); 1403 1413 1404 1414 std::vector<Int> preLut[3]; … … 1411 1421 YUVIn[COMPONENT_Cb] = pic.getAddr(COMPONENT_Cb); 1412 1422 YUVIn[COMPONENT_Cr] = pic.getAddr(COMPONENT_Cr); 1413 YUVOut[COMPONENT_Y] = m_pcPicYuvColourRemapped->getAddr(COMPONENT_Y);1414 YUVOut[COMPONENT_Cb] = m_pcPicYuvColourRemapped->getAddr(COMPONENT_Cb);1415 YUVOut[COMPONENT_Cr] = m_pcPicYuvColourRemapped->getAddr(COMPONENT_Cr);1416 1417 Int bitDepth = criSEI.m_colourRemapBitDepth;1418 BitDepths bitDepthsCriFile;1419 bitDepthsCriFile.recon[CHANNEL_TYPE_LUMA] = bitDepth;1423 YUVOut[COMPONENT_Y] = picYuvColourRemapped.getAddr(COMPONENT_Y); 1424 YUVOut[COMPONENT_Cb] = picYuvColourRemapped.getAddr(COMPONENT_Cb); 1425 YUVOut[COMPONENT_Cr] = picYuvColourRemapped.getAddr(COMPONENT_Cr); 1426 1427 const Int bitDepth = criSEI.m_colourRemapBitDepth; 1428 BitDepths bitDepthsCriFile; 1429 bitDepthsCriFile.recon[CHANNEL_TYPE_LUMA] = bitDepth; 1420 1430 bitDepthsCriFile.recon[CHANNEL_TYPE_CHROMA] = bitDepth; // Different bitdepth is not implemented 1421 1431 … … 1483 1493 } 1484 1494 1485 YUVIn[COMPONENT_Y] += iStride ;1486 YUVOut[COMPONENT_Y] += iStride ;1495 YUVIn[COMPONENT_Y] += iStrideIn; 1496 YUVOut[COMPONENT_Y] += iStrideOut; 1487 1497 if( !(b420 && !(y&1)) ) 1488 1498 { 1489 YUVIn[COMPONENT_Cb] += iCStride ;1490 YUVIn[COMPONENT_Cr] += iCStride ;1491 YUVOut[COMPONENT_Cb] += iCStride ;1492 YUVOut[COMPONENT_Cr] += iCStride ;1499 YUVIn[COMPONENT_Cb] += iCStrideIn; 1500 YUVIn[COMPONENT_Cr] += iCStrideIn; 1501 YUVOut[COMPONENT_Cb] += iCStrideOut; 1502 YUVOut[COMPONENT_Cr] += iCStrideOut; 1493 1503 } 1494 1504 } 1495 1505 //Write remapped picture in display order 1496 m_pcPicYuvColourRemapped->dump( m_colourRemapSEIFileName, bitDepthsCriFile, !firstPicture ); 1506 picYuvColourRemapped.dump( m_colourRemapSEIFileName, bitDepthsCriFile, true ); 1507 picYuvColourRemapped.destroy(); 1497 1508 } 1498 1509 } … … 1521 1532 1522 1533 #if Q0074_COLOUR_REMAPPING_SEI 1523 if (!m_colourRemapSEIFileName.empty())1524 { 1525 xOutputColourRemapPic(pic , pic->getSlice(0)->getSPS());1534 if( !m_colourRemapSEIFileName.empty() ) 1535 { 1536 xOutputColourRemapPic(pic); 1526 1537 } 1527 1538 #endif -
branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.h
r1460 r1470 83 83 #if Q0074_COLOUR_REMAPPING_SEI 84 84 SEIColourRemappingInfo* m_pcSeiColourRemappingInfoPrevious; 85 TComPicYuv* m_pcPicYuvColourRemapped; ///< Colour Remapped picture86 85 #endif 87 86 … … 129 128 private: 130 129 Void applyColourRemapping(const TComPicYuv& pic, SEIColourRemappingInfo& pCriSEI, const TComSPS &activeSPS); 131 Void xOutputColourRemapPic(TComPic* pcPic , const TComSPS* activeSPS);130 Void xOutputColourRemapPic(TComPic* pcPic); 132 131 #endif 133 132 #if ALIGNED_BUMPING
Note: See TracChangeset for help on using the changeset viewer.