Changeset 694 in SHVCSoftware for branches/SHM-6-dev
- Timestamp:
- 18 Apr 2014, 19:14:51 (11 years ago)
- Location:
- branches/SHM-6-dev/source
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-6-dev/source/App/TAppDecoder/TAppDecTop.cpp
r688 r694 693 693 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 694 694 const Bool isTff = pcPicTop->isTopField(); 695 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 696 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 697 #if Q0074_SEI_COLOR_MAPPING 698 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() ) 699 { 700 pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId ); 701 pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId ); 702 } 703 #endif 695 704 #if REPN_FORMAT_IN_VPS 696 705 #if Q0200_CONFORMANCE_BL_SIZE 697 Int xScal=1,yScal=1;698 #else 699 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();700 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );701 #endif 702 m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),703 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(),704 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),705 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(),706 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff );706 Int xScal=1,yScal=1; 707 #else 708 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 709 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 710 #endif 711 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot, 712 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 713 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 714 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 715 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset(), isTff ); 707 716 #else 708 717 #if O0194_DIFFERENT_BITDEPTH_EL_BL 709 718 // Compile time bug-fix 710 m_acTVideoIOYuvReconFile[layerId].write( p cPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),711 #else 712 m_cTVideoIOYuvReconFile.write( p cPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),719 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot, 720 #else 721 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 713 722 #endif 714 723 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), … … 727 736 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 728 737 const Bool isTff = pcPicTop->isTopField(); 729 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 738 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 739 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 740 #if Q0074_SEI_COLOR_MAPPING 741 if ( m_cTDecTop.m_ColorMapping->getColorMappingFlag() ) 742 { 743 pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 ); 744 pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 ); 745 } 746 #endif 747 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 730 748 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 731 749 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), … … 800 818 const Window &conf = pcPic->getConformanceWindow(); 801 819 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 820 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 821 #if Q0074_SEI_COLOR_MAPPING 822 if ( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() ) 823 { 824 pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId ); 825 } 826 #endif 827 802 828 #if REPN_FORMAT_IN_VPS 803 829 #if Q0200_CONFORMANCE_BL_SIZE 804 Int xScal=1,yScal=1;805 #else 806 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();807 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );808 #endif 809 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),810 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(),811 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),812 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(),813 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );814 #else 815 m_acTVideoIOYuvReconFile[layerId].write( p cPic->getPicYuvRec(),830 Int xScal=1,yScal=1; 831 #else 832 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 833 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 834 #endif 835 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec, 836 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 837 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 838 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 839 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 840 #else 841 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec, 816 842 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 817 843 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), … … 827 853 { 828 854 #if SYNTAX_OUTPUT 855 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 856 #if Q0074_SEI_COLOR_MAPPING 857 if( m_acTDecTop[layerIdx].m_ColorMapping->getColorMappingFlag() ) 858 { 859 pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx ); 860 } 861 #endif 829 862 const Window &conf = pcPic->getConformanceWindow(); 830 863 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 831 m_cTVideoIOYuvReconFile.write( p cPic->getPicYuvRec(),864 m_cTVideoIOYuvReconFile.write( pPicCYuvRec, 832 865 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 833 866 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), … … 903 936 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 904 937 const Bool isTff = pcPicTop->isTopField(); 938 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 939 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 940 #if Q0074_SEI_COLOR_MAPPING 941 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() ) 942 { 943 pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId ); 944 pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId ); 945 } 946 #endif 905 947 #if REPN_FORMAT_IN_VPS 906 948 #if Q0200_CONFORMANCE_BL_SIZE 907 Int xScal=1,yScal=1;908 #else 909 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();910 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );911 #endif 912 m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),913 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(),914 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),915 conf.getWindowTopOffset() *yScal + defDisp.getWindowTopOffset(),916 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff );949 Int xScal=1,yScal=1; 950 #else 951 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 952 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 953 #endif 954 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot, 955 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(), 956 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(), 957 conf.getWindowTopOffset() *yScal + defDisp.getWindowTopOffset(), 958 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset(), isTff ); 917 959 #else 918 960 #if O0194_DIFFERENT_BITDEPTH_EL_BL 919 961 // Compile time bug-fix 920 m_acTVideoIOYuvReconFile[layerId].write( p cPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),921 #else 922 m_cTVideoIOYuvReconFile[layerId].write( p cPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),962 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot, 963 #else 964 m_cTVideoIOYuvReconFile[layerId].write( pPicCYuvRecTop, pPicCYuvRecBot, 923 965 #endif 924 966 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), … … 937 979 const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window(); 938 980 const Bool isTff = pcPicTop->isTopField(); 939 m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(), 981 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 982 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 983 #if Q0074_SEI_COLOR_MAPPING 984 if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() ) 985 { 986 pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 ); 987 pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 ); 988 } 989 #endif 990 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 940 991 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 941 992 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), … … 1013 1064 const Window &conf = pcPic->getConformanceWindow(); 1014 1065 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1066 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 1067 #if Q0074_SEI_COLOR_MAPPING 1068 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() ) 1069 { 1070 pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId ); 1071 } 1072 #endif 1015 1073 #if REPN_FORMAT_IN_VPS 1016 1074 #if Q0200_CONFORMANCE_BL_SIZE 1017 Int xScal=1,yScal=1;1018 #else 1019 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();1020 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc );1021 #endif 1022 m_acTVideoIOYuvReconFile[layerId].write( pcPic->getPicYuvRec(),1023 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(),1024 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(),1025 conf.getWindowTopOffset() *yScal + defDisp.getWindowTopOffset(),1026 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() );1027 #else 1028 m_acTVideoIOYuvReconFile[layerId].write( p cPic->getPicYuvRec(),1075 Int xScal=1,yScal=1; 1076 #else 1077 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); 1078 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ), yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 1079 #endif 1080 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec, 1081 conf.getWindowLeftOffset() *xScal + defDisp.getWindowLeftOffset(), 1082 conf.getWindowRightOffset() *xScal + defDisp.getWindowRightOffset(), 1083 conf.getWindowTopOffset() *yScal + defDisp.getWindowTopOffset(), 1084 conf.getWindowBottomOffset()*yScal + defDisp.getWindowBottomOffset() ); 1085 #else 1086 m_acTVideoIOYuvReconFile[layerId].write( pPicCYuvRec, 1029 1087 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 1030 1088 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), … … 1041 1099 const Window &conf = pcPic->getConformanceWindow(); 1042 1100 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1043 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 1101 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 1102 #if Q0074_SEI_COLOR_MAPPING 1103 if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() ) 1104 { 1105 pPicCYuvRec = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRec ); 1106 } 1107 #endif 1108 m_cTVideoIOYuvReconFile.write( pPicCYuvRec, 1044 1109 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 1045 1110 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), … … 1118 1183 Int xScal = 1, yScal = 1; 1119 1184 #if REPN_FORMAT_IN_VPS && !Q0200_CONFORMANCE_BL_SIZE 1120 UInt chromaFormatIdc = pic->getSlice(0)->getChromaFormatIdc(); 1121 xScal = TComSPS::getWinUnitX( chromaFormatIdc ); 1122 yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 1123 #endif 1124 m_acTVideoIOYuvReconFile[layerIdx].write( pic->getPicYuvRec(), 1125 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 1126 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 1127 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 1128 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 1185 UInt chromaFormatIdc = pic->getSlice(0)->getChromaFormatIdc(); 1186 xScal = TComSPS::getWinUnitX( chromaFormatIdc ); 1187 yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 1188 #endif 1189 TComPicYuv* pPicCYuvRec = pic->getPicYuvRec(); 1190 #if Q0074_SEI_COLOR_MAPPING 1191 pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx ); 1192 #endif 1193 m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec, 1194 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), 1195 conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(), 1196 conf.getWindowTopOffset() * yScal + defDisp.getWindowTopOffset(), 1197 conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() ); 1129 1198 } 1130 1199 // update POC of display order -
branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.cpp
r677 r694 339 339 string* cfg_ReconFile [MAX_LAYERS]; 340 340 Double* cfg_fQP [MAX_LAYERS]; 341 #if Q0074_SEI_COLOR_MAPPING 342 string* cfg_seiColorMappingFile[MAX_LAYERS]; 343 #endif 341 344 342 345 #if REPN_FORMAT_IN_VPS … … 433 436 cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; 434 437 cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; 438 #if Q0074_SEI_COLOR_MAPPING 439 cfg_seiColorMappingFile[layer] = &m_acLayerCfg[layer].m_cSeiColorMappingFile; 440 #endif 435 441 #if LAYER_CTB 436 442 // coding unit (CU) definition … … 616 622 #endif 617 623 ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") 624 #if Q0074_SEI_COLOR_MAPPING 625 ("SEIColorMappingFile%d", cfg_seiColorMappingFile, string(""), MAX_LAYERS, "File Containing SEI Color Mapping data") 626 #endif 618 627 #else //SVC_EXTENSION 619 628 ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") … … 1486 1495 } 1487 1496 } 1497 1488 1498 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 1489 1499 if (m_interLayerConstrainedTileSetsSEIEnabled) -
branches/SHM-6-dev/source/App/TAppEncoder/TAppEncCfg.h
r677 r694 268 268 Int* m_codedPivotValue; 269 269 Int* m_targetPivotValue; 270 #if Q0074_SEI_COLOR_MAPPING 271 Char* m_pchSEIColorMappingFile; ///< SEI Color Mapping File (initialized from external file) 272 #endif 270 273 Int m_framePackingSEIEnabled; 271 274 Int m_framePackingSEIType; -
branches/SHM-6-dev/source/App/TAppEncoder/TAppEncLayerCfg.h
r644 r694 54 54 Int *m_predLayerIds; 55 55 Int m_numActiveRefLayers; 56 #endif 57 #if Q0074_SEI_COLOR_MAPPING 58 string m_cSeiColorMappingFile; 56 59 #endif 57 60 -
branches/SHM-6-dev/source/App/TAppEncoder/TAppEncTop.cpp
r680 r694 480 480 m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 481 481 m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 482 #if Q0074_SEI_COLOR_MAPPING 483 string cTmp = m_acLayerCfg[layer].m_cSeiColorMappingFile; 484 m_acTEncTop[layer].setColorMappingInfoSEIFile ( cTmp.empty() ? NULL : strdup(cTmp.c_str()) ); 485 #endif 482 486 m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 483 487 m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType ); … … 796 800 m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue ( m_nominalWhiteLevelLumaCodeValue ); 797 801 m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue ( m_extendedWhiteLevelLumaCodeValue ); 802 #if Q0074_SEI_COLOR_MAPPING 803 m_cTEncTop.setColorMappingInfoSEIFile ( m_pchSEIColorMappingFile ); 804 #endif 798 805 m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); 799 806 m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType ); -
branches/SHM-6-dev/source/Lib/TLibCommon/SEI.h
r652 r694 79 79 #endif 80 80 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 81 INTER_LAYER_CONSTRAINED_TILE_SETS = 138 81 INTER_LAYER_CONSTRAINED_TILE_SETS = 138, 82 82 #endif 83 83 #if SUB_BITSTREAM_PROPERTY_SEI 84 ,SUB_BITSTREAM_PROPERTY = 139// Final PayloadType to be defined after finalization84 SUB_BITSTREAM_PROPERTY = 139, // Final PayloadType to be defined after finalization 85 85 #endif 86 86 #if O0164_MULTI_LAYER_HRD 87 ,BSP_NESTING = 140 88 ,BSP_INITIAL_ARRIVAL_TIME = 141 89 ,BSP_HRD = 142 87 BSP_NESTING = 140, 88 BSP_INITIAL_ARRIVAL_TIME = 141, 89 BSP_HRD = 142, 90 #endif 91 #if Q0074_SEI_COLOR_MAPPING 92 COLOR_MAPPING_INFO = 143, 90 93 #endif 91 94 }; … … 405 408 }; 406 409 410 #if Q0074_SEI_COLOR_MAPPING 411 class SEIColorMappingInfo : public SEI 412 { 413 public: 414 PayloadType payloadType() const { return COLOR_MAPPING_INFO; } 415 SEIColorMappingInfo() { 416 } 417 virtual ~SEIColorMappingInfo() {} 418 419 Int m_colorMapId; 420 Bool m_colorMapCancelFlag; 421 Bool m_colorMapPersistenceFlag; 422 Bool m_colorMap_video_signal_type_present_flag; 423 Bool m_colorMap_video_full_range_flag; 424 UChar m_colorMap_primaries; 425 UChar m_colorMap_transfer_characteristics; 426 UChar m_colorMap_matrix_coeffs; 427 UChar m_colorMapModelId; 428 429 Int m_colour_map_coded_data_bit_depth; 430 Int m_colour_map_target_bit_depth; 431 432 Int m_num_input_pivots[3]; 433 Int* m_coded_input_pivot_value[3]; 434 Int* m_target_input_pivot_value[3]; 435 436 Bool m_matrix_flag; 437 Int m_log2_matrix_denom; 438 Int m_matrix_coef[3][3]; 439 440 Int m_num_output_pivots[3]; 441 Int* m_coded_output_pivot_value[3]; 442 Int* m_target_output_pivot_value[3]; 443 }; 444 #endif 445 407 446 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 408 447 class SEIInterLayerConstrainedTileSets : public SEI -
branches/SHM-6-dev/source/Lib/TLibCommon/TComDataCU.cpp
r688 r694 3504 3504 Int topStartL = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowTopOffset(); 3505 3505 #if Q0200_CONFORMANCE_BL_SIZE 3506 leftStartL+=baseColPic->getConformanceWindow().getWindowLeftOffset();3507 topStartL+=baseColPic->getConformanceWindow().getWindowTopOffset();3506 leftStartL += baseColPic->getConformanceWindow().getWindowLeftOffset(); 3507 topStartL += baseColPic->getConformanceWindow().getWindowTopOffset(); 3508 3508 #endif 3509 3509 #else -
branches/SHM-6-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r693 r694 127 127 Int strideEL = pcUsPic->getStride(); 128 128 #if Q0200_CONFORMANCE_BL_SIZE 129 const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();130 widthBL-= (confBL.getWindowLeftOffset()+confBL.getWindowRightOffset());131 heightBL-=(confBL.getWindowBottomOffset()+confBL.getWindowTopOffset());129 const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow(); 130 widthBL -= (confBL.getWindowLeftOffset() + confBL.getWindowRightOffset()); 131 heightBL -= (confBL.getWindowBottomOffset() + confBL.getWindowTopOffset()); 132 132 #endif 133 133 #if P0312_VERT_PHASE_ADJ … … 322 322 Int leftOffset = leftStartL > 0 ? leftStartL : 0; 323 323 #if Q0200_CONFORMANCE_BL_SIZE 324 leftStartL+= confBL.getWindowLeftOffset()<<4;325 topStartL+= confBL.getWindowTopOffset()<<4;324 leftStartL += confBL.getWindowLeftOffset() << 4; 325 topStartL += confBL.getWindowTopOffset() << 4; 326 326 #endif 327 327 #if N0214_INTERMEDIATE_BUFFER_16BITS … … 419 419 heightBL = pcBasePic->getHeight(); 420 420 #if Q0200_CONFORMANCE_BL_SIZE 421 widthBL-= confBL.getWindowLeftOffset()+confBL.getWindowRightOffset();422 heightBL-=confBL.getWindowBottomOffset()+confBL.getWindowTopOffset();421 widthBL -= confBL.getWindowLeftOffset()+confBL.getWindowRightOffset(); 422 heightBL -= confBL.getWindowBottomOffset()+confBL.getWindowTopOffset(); 423 423 #endif 424 424 widthEL = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); -
branches/SHM-6-dev/source/Lib/TLibCommon/TypeDef.h
r693 r694 84 84 85 85 #define O0164_MULTI_LAYER_HRD 1 ///< JCTVC-O0164: Multi-layer HRD operation 86 #define Q0074_SEI_COLOR_MAPPING 1 ///< JCTVC-Q0074, SEI Color Mapping 86 87 87 88 #define O0194_DIFFERENT_BITDEPTH_EL_BL 1 ///< JCTVC-O0194: Support for different bitdepth values for BL and EL, add required configuration parameters (and Some bugfixes when REPN_FORMAT_IN_VPS (JCTVC-N0092) is enabled) -
branches/SHM-6-dev/source/Lib/TLibDecoder/SEIread.cpp
r652 r694 93 93 fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); 94 94 break; 95 #if Q0074_SEI_COLOR_MAPPING 96 case SEI::COLOR_MAPPING_INFO: 97 fprintf( g_hTrace, "===========Color Mapping Info SEI message ===========\n"); 98 break; 99 #endif 95 100 case SEI::SOP_DESCRIPTION: 96 101 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); … … 280 285 xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); 281 286 break; 287 #if Q0074_SEI_COLOR_MAPPING 288 case SEI::COLOR_MAPPING_INFO: 289 sei = new SEIColorMappingInfo; 290 xParseSEIColorMappingInfo((SEIColorMappingInfo&) *sei, payloadSize); 291 break; 292 #endif 282 293 case SEI::SOP_DESCRIPTION: 283 294 sei = new SEISOPDescription; … … 838 849 } 839 850 851 #if Q0074_SEI_COLOR_MAPPING 852 Void SEIReader::xParseSEIColorMappingInfo(SEIColorMappingInfo& sei, UInt /*payloadSize*/) 853 { 854 UInt uiVal; 855 Int iVal; 856 857 READ_UVLC( uiVal, "colour_map_id" ); sei.m_colorMapId = uiVal; 858 READ_FLAG( uiVal, "colour_map_cancel_flag" ); sei.m_colorMapCancelFlag = uiVal; 859 if( !sei.m_colorMapCancelFlag ) 860 { 861 READ_FLAG( uiVal, "colour_map_persistence_flag" ); sei.m_colorMapPersistenceFlag = uiVal; 862 READ_FLAG( uiVal, "colour_map_video_signal_type_present_flag" ); sei.m_colorMap_video_signal_type_present_flag = uiVal; 863 if ( sei.m_colorMap_video_signal_type_present_flag ) { 864 READ_FLAG( uiVal, "colour_map_video_full_range_flag" ); sei.m_colorMap_video_full_range_flag = uiVal; 865 READ_CODE( 8, uiVal, "colour_map_primaries" ); sei.m_colorMap_primaries = uiVal; 866 READ_CODE( 8, uiVal, "colour_map_transfer_characteristics" ); sei.m_colorMap_transfer_characteristics = uiVal; 867 READ_CODE( 8, uiVal, "colour_map_matrix_coeffs" ); sei.m_colorMap_matrix_coeffs = uiVal; 868 } 869 } 870 871 READ_CODE( 5, uiVal, "colour_map_coded_data_bit_depth" ); sei.m_colour_map_coded_data_bit_depth = uiVal; 872 READ_CODE( 5, uiVal, "colour_map_target_bit_depth" ); sei.m_colour_map_target_bit_depth = uiVal; 873 READ_UVLC( uiVal, "colour_map_model_id" ); sei.m_colorMapModelId = uiVal; 874 875 assert( sei.m_colorMapModelId == 0 ); 876 877 for( Int i=0 ; i<3 ; i++ ) 878 { 879 READ_CODE( 8, uiVal, "num_input_pivots_minus1[i]" ); sei.m_num_input_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ; 880 sei.m_coded_input_pivot_value[i] = new Int[ sei.m_num_input_pivots[i] ]; 881 sei.m_target_input_pivot_value[i] = new Int[ sei.m_num_input_pivots[i] ]; 882 if( uiVal > 0 ) 883 { 884 for ( Int j=0 ; j<sei.m_num_input_pivots[i] ; j++ ) 885 { 886 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "coded_input_pivot_value[i][j]" ); sei.m_coded_input_pivot_value[i][j] = uiVal; 887 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "target_input_pivot_value[i][j]" ); sei.m_target_input_pivot_value[i][j] = uiVal; 888 } 889 } 890 else 891 { 892 sei.m_coded_input_pivot_value[i][0] = 0; 893 sei.m_target_input_pivot_value[i][0] = 0; 894 sei.m_coded_input_pivot_value[i][1] = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ; 895 sei.m_target_input_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ; 896 } 897 } 898 899 READ_FLAG( uiVal, "matrix_flag" ); sei.m_matrix_flag = uiVal; 900 if( sei.m_matrix_flag ) 901 { 902 READ_CODE( 4, uiVal, "log2_matrix_denom" ); sei.m_log2_matrix_denom = uiVal; 903 for ( Int i=0 ; i<3 ; i++ ) 904 { 905 for ( Int j=0 ; j<3 ; j++ ) 906 { 907 READ_SVLC( iVal, "matrix_coef[i][j]" ); sei.m_matrix_coef[i][j] = iVal; 908 } 909 } 910 } 911 912 for ( Int i=0 ; i<3 ; i++ ) 913 { 914 READ_CODE( 8, uiVal, "num_output_pivots_minus1[i]" ); sei.m_num_output_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ; 915 sei.m_coded_output_pivot_value[i] = new Int[ sei.m_num_output_pivots[i] ]; 916 sei.m_target_output_pivot_value[i] = new Int[ sei.m_num_output_pivots[i] ]; 917 if( uiVal > 0 ) 918 { 919 for ( Int j=0 ; j<sei.m_num_output_pivots[i] ; j++ ) 920 { 921 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "coded_output_pivot_value[i][j]" ); sei.m_coded_output_pivot_value[i][j] = uiVal; 922 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "target_output_pivot_value[i][j]" ); sei.m_target_output_pivot_value[i][j] = uiVal; 923 } 924 } 925 else 926 { 927 sei.m_coded_output_pivot_value[i][0] = 0; 928 sei.m_target_output_pivot_value[i][0] = 0; 929 sei.m_coded_output_pivot_value[i][1] = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ; 930 sei.m_target_output_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ; 931 } 932 } 933 934 xParseByteAlign(); 935 } 936 #endif 937 840 938 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) 841 939 { -
branches/SHM-6-dev/source/Lib/TLibDecoder/SEIread.h
r644 r694 90 90 Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 91 91 Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 92 #if Q0074_SEI_COLOR_MAPPING 93 Void xParseSEIColorMappingInfo (SEIColorMappingInfo& sei, UInt payloadSize); 94 #endif 92 95 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 93 96 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.cpp
r693 r694 96 96 m_pColorMappedPic = NULL; 97 97 #endif 98 99 #if Q0074_SEI_COLOR_MAPPING 100 m_ColorMapping = new TDecColorMapping(); 101 #endif 98 102 } 99 103 … … 110 114 m_pColorMappedPic = NULL; 111 115 } 116 #endif 117 #if Q0074_SEI_COLOR_MAPPING 118 if ( m_ColorMapping ) delete m_ColorMapping; 112 119 #endif 113 120 } … … 846 853 g_uiMaxCUDepth = sps->getMaxCUDepth(); 847 854 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 855 856 #if Q0074_SEI_COLOR_MAPPING 857 for(Int compID=0; compID<3; compID++) 858 { 859 m_ColorMapping->setColorMapping( compID ? g_bitDepthC : g_bitDepthY, compID ); 860 } 861 #endif 848 862 849 863 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) … … 1876 1890 } 1877 1891 } 1892 #if Q0074_SEI_COLOR_MAPPING 1893 m_ColorMapping->setColorMapping( m_SEIs ); 1894 #endif 1878 1895 } 1879 1896 #else … … 2386 2403 } 2387 2404 #endif 2405 2388 2406 #endif //SVC_EXTENSION 2407 2408 #if Q0074_SEI_COLOR_MAPPING 2409 TDecColorMapping::TDecColorMapping() 2410 { 2411 m_pcColorMappingPic[0] = NULL; 2412 m_pcColorMappingPic[1] = NULL; 2413 2414 m_colorMapCancelFlag = true; 2415 2416 for( Int i=0 ; i<3 ; i++ ) 2417 { 2418 m_lut1d_computed[i] = false; 2419 m_lut1d_input[i] = NULL; 2420 m_coded_input_pivot_value[i] = NULL; 2421 m_target_input_pivot_value[i] = NULL; 2422 } 2423 for( Int i=0 ; i<3 ; i++ ) 2424 { 2425 m_lut1d_output[i] = NULL; 2426 m_coded_output_pivot_value[i] = NULL; 2427 m_target_output_pivot_value[i] = NULL; 2428 } 2429 } 2430 2431 TDecColorMapping::~TDecColorMapping() 2432 { 2433 if ( m_pcColorMappingPic[0] ) delete m_pcColorMappingPic[0]; 2434 if ( m_pcColorMappingPic[1] ) delete m_pcColorMappingPic[1]; 2435 2436 for( Int i=0 ; i<3 ; i++ ) 2437 { 2438 if ( m_lut1d_input[i] ) delete m_lut1d_input[i]; 2439 if ( m_coded_input_pivot_value[i] ) delete m_coded_input_pivot_value[i]; 2440 if ( m_target_input_pivot_value[i] ) delete m_target_input_pivot_value[i]; 2441 } 2442 for( Int i=0 ; i<3 ; i++ ) 2443 { 2444 if ( m_lut1d_output[i] ) delete m_lut1d_output[i]; 2445 if ( m_coded_output_pivot_value[i] ) delete m_coded_output_pivot_value[i]; 2446 if ( m_target_output_pivot_value[i] ) delete m_target_output_pivot_value[i]; 2447 } 2448 } 2449 2450 Void TDecColorMapping::setColorMapping( SEIMessages m_SEIs ) 2451 { 2452 SEIMessages colorMappingInfo = getSeisByType(m_SEIs, SEI::COLOR_MAPPING_INFO) ; 2453 SEIColorMappingInfo *seiColorMappingInfo = NULL; 2454 if (colorMappingInfo.size() !=0) 2455 { 2456 seiColorMappingInfo = (SEIColorMappingInfo*)(*colorMappingInfo.begin()); 2457 2458 m_colorMapId = seiColorMappingInfo->m_colorMapId; 2459 m_colorMapCancelFlag = seiColorMappingInfo->m_colorMapCancelFlag; 2460 if( !m_colorMapCancelFlag ) 2461 { 2462 m_colorMapPersistenceFlag = seiColorMappingInfo->m_colorMapPersistenceFlag; 2463 m_colorMap_video_signal_type_present_flag = seiColorMappingInfo->m_colorMap_video_signal_type_present_flag; 2464 m_colorMap_video_full_range_flag = seiColorMappingInfo->m_colorMap_video_full_range_flag; 2465 m_colorMap_primaries = seiColorMappingInfo->m_colorMap_primaries; 2466 m_colorMap_transfer_characteristics = seiColorMappingInfo->m_colorMap_transfer_characteristics; 2467 m_colorMap_matrix_coeffs = seiColorMappingInfo->m_colorMap_matrix_coeffs; 2468 m_colorMapModelId = seiColorMappingInfo->m_colorMapModelId; 2469 2470 m_colour_map_coded_data_bit_depth = seiColorMappingInfo->m_colour_map_coded_data_bit_depth; 2471 m_colour_map_target_bit_depth = seiColorMappingInfo->m_colour_map_target_bit_depth; 2472 2473 for( Int i=0 ; i<3 ; i++ ) 2474 { 2475 m_num_input_pivots[i] = seiColorMappingInfo->m_num_input_pivots[i]; 2476 if ( m_coded_input_pivot_value[i] ) delete m_coded_input_pivot_value[i]; 2477 if ( m_target_input_pivot_value[i] ) delete m_target_input_pivot_value[i]; 2478 m_coded_input_pivot_value[i] = new Int[ m_num_input_pivots[i] ]; 2479 m_target_input_pivot_value[i] = new Int[ m_num_input_pivots[i] ]; 2480 for( Int j=0 ; j<m_num_input_pivots[i] ; j++ ) 2481 { 2482 m_coded_input_pivot_value[i][j] = seiColorMappingInfo->m_coded_input_pivot_value[i][j]; 2483 m_target_input_pivot_value[i][j] = seiColorMappingInfo->m_target_input_pivot_value[i][j]; 2484 } 2485 } 2486 2487 m_matrix_flag = seiColorMappingInfo->m_matrix_flag; 2488 m_log2_matrix_denom = m_matrix_flag ? (seiColorMappingInfo->m_log2_matrix_denom) : (0) ; 2489 for( Int i=0 ; i<3 ; i++ ) 2490 { 2491 for( Int j=0 ; j<3 ; j++ ) 2492 { 2493 m_matrix_coef[i][j] = seiColorMappingInfo->m_matrix_coef[i][j]; 2494 } 2495 } 2496 2497 for( Int i=0 ; i<3 ; i++ ) 2498 { 2499 m_num_output_pivots[i] = seiColorMappingInfo->m_num_output_pivots[i]; 2500 if ( m_coded_output_pivot_value[i] ) delete m_coded_output_pivot_value[i]; 2501 if ( m_target_output_pivot_value[i] ) delete m_target_output_pivot_value[i]; 2502 m_coded_output_pivot_value[i] = new Int[ m_num_output_pivots[i] ]; 2503 m_target_output_pivot_value[i] = new Int[ m_num_output_pivots[i] ]; 2504 for( Int j=0 ; j<m_num_output_pivots[i] ; j++ ) 2505 { 2506 m_coded_output_pivot_value[i][j] = seiColorMappingInfo->m_coded_output_pivot_value[i][j]; 2507 m_target_output_pivot_value[i][j] = seiColorMappingInfo->m_target_output_pivot_value[i][j]; 2508 } 2509 } 2510 2511 memset( m_lut1d_computed, 0, sizeof( m_lut1d_computed ) ); 2512 } 2513 } 2514 2515 } 2516 2517 Void TDecColorMapping::setColorMapping( Int bitDepth, Int iComp ) 2518 { 2519 if( !m_colorMapCancelFlag && !m_lut1d_computed[iComp] ) 2520 { 2521 2522 if ( m_lut1d_input[iComp] ) delete m_lut1d_input[iComp]; 2523 if ( m_lut1d_output[iComp] ) delete m_lut1d_output[iComp]; 2524 2525 m_lut1d_input[iComp] = new Int[ 1 << bitDepth ]; 2526 m_lut1d_output[iComp] = new Int[ 1 << bitDepth ]; 2527 2528 Int iShift = (m_colour_map_coded_data_bit_depth >= bitDepth) ? (m_colour_map_coded_data_bit_depth - bitDepth) : (0); 2529 Int iShiftPivot = (m_colour_map_coded_data_bit_depth >= bitDepth) ? (0) : (bitDepth - m_colour_map_coded_data_bit_depth); 2530 2531 for( Int k=0 ; k<(1<<bitDepth) ; k++ ) 2532 { 2533 Int iSample = k << iShift ; 2534 if( m_num_input_pivots[iComp] > 1 ) 2535 { 2536 for( Int iPivot=0 ; iPivot<m_num_input_pivots[iComp] ; iPivot++ ) 2537 { 2538 Int iCodedPrev = m_coded_input_pivot_value[iComp][iPivot] << iShiftPivot; 2539 Int iCodedNext = m_coded_input_pivot_value[iComp][iPivot+1] << iShiftPivot; 2540 Int iTargetPrev = m_target_input_pivot_value[iComp][iPivot] << iShiftPivot; 2541 Int iTargetNext = m_target_input_pivot_value[iComp][iPivot+1] << iShiftPivot; 2542 if ( iCodedPrev <= iSample && iSample < iCodedNext ) 2543 { 2544 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) / (Float)(iCodedNext - iCodedPrev) ; 2545 m_lut1d_input[iComp][k] = (Int)( 0.5 + fInterpol ); 2546 iPivot = m_num_input_pivots[iComp]; // stop 2547 } 2548 } 2549 } 2550 else 2551 { 2552 m_lut1d_input[iComp][k] = k; 2553 } 2554 } 2555 2556 iShift = ( (m_colour_map_coded_data_bit_depth >= bitDepth) ? (m_colour_map_coded_data_bit_depth - bitDepth) : (0) ); 2557 Int iOffset = iShift ? (1 << (iShift - 1)) : (0) ; 2558 iShiftPivot = (m_colour_map_target_bit_depth >= bitDepth) ? (0) : (bitDepth - m_colour_map_target_bit_depth) ; 2559 for( Int k=0 ; k<(1<<bitDepth) ; k++ ) 2560 { 2561 Int iSample = k << iShift; 2562 if ( m_num_output_pivots[iComp]>1 ) 2563 { 2564 for( Int iPivot=0 ; iPivot<m_num_output_pivots[iComp] ; iPivot++ ) 2565 { 2566 Int iCodedPrev = m_coded_output_pivot_value[iComp][iPivot] << iShiftPivot; 2567 Int iCodedNext = m_coded_output_pivot_value[iComp][iPivot+1] << iShiftPivot; 2568 Int iTargetPrev = m_target_output_pivot_value[iComp][iPivot] << iShiftPivot; 2569 Int iTargetNext = m_target_output_pivot_value[iComp][iPivot+1] << iShiftPivot; 2570 if ( iCodedPrev <= iSample && iSample < iCodedNext ) 2571 { 2572 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) / (Float)(iCodedNext - iCodedPrev) ; 2573 m_lut1d_output[iComp][k] = ( (Int)(0.5 + fInterpol) + iOffset ) >> iShift ; 2574 iPivot = m_num_output_pivots[iComp]; // stop 2575 } 2576 } 2577 } 2578 else 2579 { 2580 m_lut1d_output[iComp][k] = k; 2581 } 2582 } 2583 2584 m_lut1d_computed[iComp] = true; 2585 } 2586 2587 } 2588 2589 TComPicYuv* TDecColorMapping::getColorMapping( TComPicYuv* pPicYuvRec, Int iTop, Int curlayerId ) 2590 { 2591 if( !m_colorMapCancelFlag ) 2592 { 2593 if( !m_pcColorMappingPic[iTop] ) 2594 { 2595 m_pcColorMappingPic[iTop] = new TComPicYuv; 2596 #if SVC_EXTENSION 2597 m_pcColorMappingPic[iTop]->create( pPicYuvRec->getWidth(), pPicYuvRec->getHeight(), pPicYuvRec->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 2598 #else 2599 m_pcColorMappingPic[iTop]->create( pPicYuvRec->getWidth(), pPicYuvRec->getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 2600 #endif 2601 } 2602 2603 Int iHeight = pPicYuvRec->getHeight(); 2604 Int iWidth = pPicYuvRec->getWidth(); 2605 Int iStride = pPicYuvRec->getStride(); 2606 Int iCStride = pPicYuvRec->getCStride(); 2607 2608 Pel* Lum0 = pPicYuvRec->getLumaAddr(); 2609 Pel* Cb0 = pPicYuvRec->getCbAddr(); 2610 Pel* Cr0 = pPicYuvRec->getCrAddr(); 2611 Pel* Lum1 = m_pcColorMappingPic[iTop]->getLumaAddr(); 2612 Pel* Cb1 = m_pcColorMappingPic[iTop]->getCbAddr(); 2613 Pel* Cr1 = m_pcColorMappingPic[iTop]->getCrAddr(); 2614 2615 #if SVC_EXTENSION 2616 Int bitDepthY = g_bitDepthYLayer[curlayerId]; 2617 Int bitDepthC = g_bitDepthCLayer[curlayerId]; 2618 2619 assert( g_bitDepthY == bitDepthY ); 2620 assert( g_bitDepthC == bitDepthC ); 2621 #else 2622 Int bitDepthY = g_bitDepthY; 2623 Int bitDepthC = g_bitDepthC; 2624 #endif 2625 2626 Int iYShift = (m_colour_map_target_bit_depth >= bitDepthY) ? (m_colour_map_target_bit_depth - bitDepthY) : (0) ; 2627 Int iCShift = (m_colour_map_target_bit_depth >= bitDepthC) ? (m_colour_map_target_bit_depth - bitDepthC) : (0) ; 2628 Int offsetY = (1 << (m_log2_matrix_denom+iYShift - 1)); 2629 Int offsetC = (1 << (m_log2_matrix_denom+iCShift - 1)); 2630 2631 Bool bScaleX = false ; 2632 Bool bScaleY = false ; 2633 Int cShift = 1 ; 2634 2635 Pel* LumPrev0 = Lum0; 2636 for( Int y = 0; y < iHeight ; y++ ) 2637 { 2638 Bool bDoChroma = (y % 2); 2639 for( Int x = 0; x < iWidth ; x++ ) 2640 { 2641 Int s1Y = m_lut1d_input[0][ Lum0[x] ]; 2642 Int s1U = m_lut1d_input[1][ Cb0[x>>1] ]; 2643 Int s1V = m_lut1d_input[2][ Cr0[x>>1] ]; 2644 2645 Int s2Y, s2U, s2V; 2646 if( m_matrix_flag ) 2647 { 2648 s2Y = ( m_matrix_coef[0][0]*s1Y + m_matrix_coef[0][1]*s1U + m_matrix_coef[0][2]*s1V + offsetY ) >> ( m_log2_matrix_denom + iYShift ); 2649 //s2Y = ClipBD( s2Y , bitDepthY ); 2650 s2Y = ClipY( s2Y ); 2651 Lum1[x] = m_lut1d_output[0][ s2Y ]; 2652 } 2653 else 2654 { 2655 s1Y = ( s1Y + offsetY ) >> iYShift ; 2656 //s1Y = ClipBD( s1Y , bitDepthY ); 2657 s1Y = ClipY( s1Y ); 2658 Lum1[x] = m_lut1d_output[0][ s1Y ]; 2659 } 2660 2661 if( bDoChroma && (x%2) ) 2662 { 2663 if( m_matrix_flag ) 2664 { 2665 //s1Y = ( m_lut1d_input[0][ Lum0[x] ] + m_lut1d_input[0][ Lum0[x+1] ] + m_lut1d_input[0][ LumPrev0[x] ] + m_lut1d_input[0][ LumPrev0[x+1] ] + 2 ) >> 2 ; 2666 //s1Y = m_lut1d_input[0][ (Lum0[x] + Lum0[x+1] + LumPrev0[x] + LumPrev0[x+1] + 2)>>2 ] ; 2667 s1Y = m_lut1d_input[0][ Lum0[x] ]; 2668 2669 s2U = ( m_matrix_coef[1][0]*s1Y + m_matrix_coef[1][1]*s1U + m_matrix_coef[1][2]*s1V + offsetC ) >> ( m_log2_matrix_denom + iCShift ) ; 2670 s2V = ( m_matrix_coef[2][0]*s1Y + m_matrix_coef[2][1]*s1U + m_matrix_coef[2][2]*s1V + offsetC ) >> ( m_log2_matrix_denom + iCShift ) ; 2671 //s2U = ClipBD( s2U , bitDepthC ); 2672 //s2V = ClipBD( s2V , bitDepthC ); 2673 s2U = ClipC( s2U ); 2674 s2V = ClipC( s2V ); 2675 Cb1[x>>cShift] = m_lut1d_output[1][ s2U ]; 2676 Cr1[x>>cShift] = m_lut1d_output[2][ s2V ]; 2677 } 2678 else 2679 { 2680 s1U = ( s1U + offsetC ) >> iCShift ; 2681 s1V = ( s1V + offsetC ) >> iCShift ; 2682 //s1U = ClipBD( s1U , bitDepthC ); 2683 //s1V = ClipBD( s1V , bitDepthC ); 2684 s1U = ClipC( s1U ); 2685 s1V = ClipC( s1V ); 2686 Cb1[x>>cShift] = m_lut1d_output[1][ s1U ]; 2687 Cr1[x>>cShift] = m_lut1d_output[2][ s1V ]; 2688 } 2689 } 2690 2691 } 2692 2693 LumPrev0 = Lum0; 2694 Lum0 += iStride; 2695 Lum1 += iStride; 2696 if( bDoChroma ) 2697 { 2698 Cb0 += iCStride; 2699 Cr0 += iCStride; 2700 Cb1 += iCStride; 2701 Cr1 += iCStride; 2702 } 2703 } 2704 2705 return m_pcColorMappingPic[iTop]; 2706 } 2707 2708 return pPicYuvRec; 2709 } 2710 #endif 2711 2389 2712 //! \} -
branches/SHM-6-dev/source/Lib/TLibDecoder/TDecTop.h
r677 r694 64 64 // ==================================================================================================================== 65 65 66 #if Q0074_SEI_COLOR_MAPPING 67 class TDecColorMapping 68 { 69 Int m_colorMapId; 70 Bool m_colorMapCancelFlag; 71 Bool m_colorMapPersistenceFlag; 72 Bool m_colorMap_video_signal_type_present_flag; 73 Bool m_colorMap_video_full_range_flag; 74 UChar m_colorMap_primaries; 75 UChar m_colorMap_transfer_characteristics; 76 UChar m_colorMap_matrix_coeffs; 77 UChar m_colorMapModelId; 78 79 Int m_colour_map_coded_data_bit_depth; 80 Int m_colour_map_target_bit_depth; 81 82 Int m_num_input_pivots[3]; 83 Int* m_coded_input_pivot_value[3]; 84 Int* m_target_input_pivot_value[3]; 85 86 Bool m_matrix_flag; 87 Int m_log2_matrix_denom; 88 Int m_matrix_coef[3][3]; 89 90 Int m_num_output_pivots[3]; 91 Int* m_coded_output_pivot_value[3]; 92 Int* m_target_output_pivot_value[3]; 93 94 Bool m_lut1d_computed[3]; 95 Int* m_lut1d_input[3]; 96 Int* m_lut1d_output[3]; 97 TComPicYuv* m_pcColorMappingPic[2]; 98 99 public: 100 TDecColorMapping(); 101 ~TDecColorMapping(); 102 103 Bool getColorMappingFlag() { return(!m_colorMapCancelFlag);}; 104 105 Void setColorMapping( SEIMessages m_SEIs ); 106 Void setColorMapping( Int bitDepthY, Int bitDepthC ); 107 TComPicYuv* getColorMapping( TComPicYuv* pPicYuvRec, Int iTop=0, Int curlayerId=0 ); 108 };// END CLASS DEFINITION TDecColorMapping 109 #endif 110 66 111 /// decoder class 67 112 class TDecTop … … 159 204 #endif 160 205 public: 206 #if Q0074_SEI_COLOR_MAPPING 207 TDecColorMapping* m_ColorMapping; 208 #endif 209 161 210 TDecTop(); 162 211 virtual ~TDecTop(); -
branches/SHM-6-dev/source/Lib/TLibEncoder/SEIwrite.cpp
r652 r694 87 87 fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n"); 88 88 break; 89 #if Q0074_SEI_COLOR_MAPPING 90 case SEI::COLOR_MAPPING_INFO: 91 fprintf( g_hTrace, "=========== Color Mapping Info SEI message ===========\n"); 92 break; 93 #endif 89 94 case SEI::SOP_DESCRIPTION: 90 95 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); … … 172 177 xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei)); 173 178 break; 179 #if Q0074_SEI_COLOR_MAPPING 180 case SEI::COLOR_MAPPING_INFO: 181 xWriteSEIColorMappingInfo(*static_cast<const SEIColorMappingInfo*>(&sei)); 182 break; 183 #endif 174 184 case SEI::SOP_DESCRIPTION: 175 185 xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei)); … … 566 576 } 567 577 578 #if Q0074_SEI_COLOR_MAPPING 579 Void SEIWriter::xWriteSEIColorMappingInfo(const SEIColorMappingInfo& sei) 580 { 581 WRITE_UVLC( sei.m_colorMapId, "colour_map_id" ); 582 WRITE_FLAG( sei.m_colorMapCancelFlag, "colour_map_cancel_flag" ); 583 if( !sei.m_colorMapCancelFlag ) 584 { 585 WRITE_FLAG( sei.m_colorMapPersistenceFlag, "colour_map_persistence_flag" ); 586 WRITE_FLAG( sei.m_colorMap_video_signal_type_present_flag, "colour_map_video_signal_type_present_flag" ); 587 if ( sei.m_colorMap_video_signal_type_present_flag ) 588 { 589 WRITE_FLAG( sei.m_colorMap_video_full_range_flag, "colour_map_video_full_range_flag" ); 590 WRITE_CODE( sei.m_colorMap_primaries, 8, "colour_map_primaries" ); 591 WRITE_CODE( sei.m_colorMap_transfer_characteristics, 8, "colour_map_transfer_characteristics" ); 592 WRITE_CODE( sei.m_colorMap_matrix_coeffs, 8, "colour_map_matrix_coeffs" ); 593 } 594 } 595 596 WRITE_CODE( sei.m_colour_map_coded_data_bit_depth, 5, "colour_map_coded_data_bit_depth" ); 597 WRITE_CODE( sei.m_colour_map_target_bit_depth, 5, "colour_map_target_bit_depth" ); 598 WRITE_UVLC( sei.m_colorMapModelId, "colour_map_model_id" ); 599 600 assert( sei.m_colorMapModelId == 0 ); 601 602 for( Int i=0 ; i<3 ; i++ ) 603 { 604 WRITE_CODE( sei.m_num_input_pivots[i] - 1, 8, "num_input_pivots_minus1[i]" ); 605 for( Int j=0 ; j<sei.m_num_input_pivots[i] ; j++ ) 606 { 607 WRITE_CODE( sei.m_coded_input_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "coded_input_pivot_value[i][j]" ); 608 WRITE_CODE( sei.m_target_input_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "target_input_pivot_value[i][j]" ); 609 } 610 } 611 612 WRITE_FLAG( sei.m_matrix_flag, "matrix_flag" ); 613 if( sei.m_matrix_flag ) 614 { 615 WRITE_CODE( sei.m_log2_matrix_denom, 4, "log2_matrix_denom" ); 616 for( Int i=0 ; i<3 ; i++ ) 617 { 618 for( Int j=0 ; j<3 ; j++ ) 619 { 620 WRITE_SVLC( sei.m_matrix_coef[i][j], "matrix_coef[i][j]" ); 621 } 622 } 623 } 624 625 for( Int i=0 ; i<3 ; i++ ) 626 { 627 WRITE_CODE( sei.m_num_output_pivots[i] - 1, 8, "num_output_pivots_minus1[i]" ); 628 for( Int j=0 ; j<sei.m_num_output_pivots[i] ; j++ ) 629 { 630 WRITE_CODE( sei.m_coded_output_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "coded_output_pivot_value[i][j]" ); 631 WRITE_CODE( sei.m_target_output_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "target_output_pivot_value[i][j]" ); 632 } 633 } 634 635 xWriteByteAlign(); 636 } 637 #endif 638 568 639 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) 569 640 { -
branches/SHM-6-dev/source/Lib/TLibEncoder/SEIwrite.h
r644 r694 72 72 Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 73 73 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 74 #if Q0074_SEI_COLOR_MAPPING 75 Void SEIWriter::xWriteSEIColorMappingInfo(const SEIColorMappingInfo& sei); 76 #endif 74 77 Void xWriteSEISOPDescription(const SEISOPDescription& sei); 75 78 #if O0164_MULTI_LAYER_HRD -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncCfg.h
r684 r694 248 248 Int* m_codedPivotValue; 249 249 Int* m_targetPivotValue; 250 #if Q0074_SEI_COLOR_MAPPING 251 Char* m_seiColorMappingFile; 252 #endif 250 253 Int m_framePackingSEIEnabled; 251 254 Int m_framePackingSEIType; … … 667 670 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; } 668 671 Int getTMISEIExtendedWhiteLevelLumaCodeValue() { return m_extendedWhiteLevelLumaCodeValue; } 672 #if Q0074_SEI_COLOR_MAPPING 673 Void setColorMappingInfoSEIFile( Char* nameFile ) { m_seiColorMappingFile = nameFile; } 674 Char* getColorMappingInfoSEIFile() { return m_seiColorMappingFile; } 675 #endif 669 676 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 670 677 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r693 r694 327 327 } 328 328 329 #if Q0074_SEI_COLOR_MAPPING 330 SEIColorMappingInfo* TEncGOP::xCreateSEIColorMappingInfo( Char* file ) 331 { 332 SEIColorMappingInfo *seiColorMappingInfo = new SEIColorMappingInfo(); 333 334 FILE* fic = fopen( file, "r" ); 335 336 Int iVal; 337 338 fscanf( fic, "%d", &seiColorMappingInfo->m_colorMapId ); 339 fscanf( fic, "%d", &iVal ); 340 seiColorMappingInfo->m_colorMapCancelFlag = iVal; 341 if( !seiColorMappingInfo->m_colorMapCancelFlag ) 342 { 343 fscanf( fic, "%d", &iVal ); 344 seiColorMappingInfo->m_colorMapPersistenceFlag = iVal; 345 fscanf( fic, "%d", &iVal ); 346 seiColorMappingInfo->m_colorMap_video_signal_type_present_flag = iVal; 347 if( seiColorMappingInfo->m_colorMap_video_signal_type_present_flag ) 348 { 349 fscanf( fic, "%d", &iVal ); 350 seiColorMappingInfo->m_colorMap_video_full_range_flag = iVal; 351 fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_primaries ); 352 fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_transfer_characteristics ); 353 fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_matrix_coeffs ); 354 } 355 } 356 357 fscanf( fic, "%d", &seiColorMappingInfo->m_colour_map_coded_data_bit_depth ); 358 fscanf( fic, "%d", &seiColorMappingInfo->m_colour_map_target_bit_depth ); 359 fscanf( fic, "%d", &iVal ); 360 seiColorMappingInfo->m_colorMapModelId = iVal; 361 362 assert( seiColorMappingInfo->m_colorMapModelId == 0 ); 363 364 for( Int i=0 ; i<3 ; i++ ) 365 { 366 fscanf( fic, "%d", &seiColorMappingInfo->m_num_input_pivots[i] ); 367 seiColorMappingInfo->m_coded_input_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_input_pivots[i] ]; 368 seiColorMappingInfo->m_target_input_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_input_pivots[i] ]; 369 for( Int j=0 ; j<seiColorMappingInfo->m_num_input_pivots[i] ; j++ ) 370 { 371 fscanf( fic, "%d", &seiColorMappingInfo->m_coded_input_pivot_value[i][j] ); 372 fscanf( fic, "%d", &seiColorMappingInfo->m_target_input_pivot_value[i][j] ); 373 } 374 } 375 376 fscanf( fic, "%d", &iVal ); 377 seiColorMappingInfo->m_matrix_flag = iVal; 378 if( seiColorMappingInfo->m_matrix_flag ) 379 { 380 fscanf( fic, "%d", &seiColorMappingInfo->m_log2_matrix_denom ); 381 for( Int i=0 ; i<3 ; i++ ) 382 { 383 for( Int j=0 ; j<3 ; j++ ) 384 { 385 fscanf( fic, "%d", &seiColorMappingInfo->m_matrix_coef[i][j] ); 386 } 387 } 388 } 389 390 for( Int i=0 ; i<3 ; i++ ) 391 { 392 fscanf( fic, "%d", &seiColorMappingInfo->m_num_output_pivots[i] ); 393 seiColorMappingInfo->m_coded_output_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_output_pivots[i] ]; 394 seiColorMappingInfo->m_target_output_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_output_pivots[i] ]; 395 for( Int j=0 ; j<seiColorMappingInfo->m_num_output_pivots[i] ; j++ ) 396 { 397 fscanf( fic, "%d", &seiColorMappingInfo->m_coded_output_pivot_value[i][j] ); 398 fscanf( fic, "%d", &seiColorMappingInfo->m_target_output_pivot_value[i][j] ); 399 } 400 } 401 402 fclose( fic ); 403 404 return seiColorMappingInfo; 405 } 406 #endif 407 329 408 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 330 409 { … … 393 472 delete sei; 394 473 } 474 #if Q0074_SEI_COLOR_MAPPING 475 if(m_pcCfg->getColorMappingInfoSEIFile()) 476 { 477 SEIColorMappingInfo *sei = xCreateSEIColorMappingInfo( m_pcCfg->getColorMappingInfoSEIFile() ); 478 479 #if SVC_EXTENSION 480 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, m_layerId); // temporalId = 0 ? 481 #else 482 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 483 #endif 484 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 485 #if O0164_MULTI_LAYER_HRD 486 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps); 487 #else 488 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 489 #endif 490 writeRBSPTrailingBits(nalu.m_Bitstream); 491 accessUnit.push_back(new NALUnitEBSP(nalu)); 492 delete sei; 493 } 494 #endif 395 495 396 496 #if SVC_EXTENSION -
branches/SHM-6-dev/source/Lib/TLibEncoder/TEncGOP.h
r677 r694 209 209 210 210 SEIToneMappingInfo* xCreateSEIToneMappingInfo(); 211 #if Q0074_SEI_COLOR_MAPPING 212 SEIColorMappingInfo* xCreateSEIColorMappingInfo( Char* file ); 213 #endif 211 214 212 215 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
Note: See TracChangeset for help on using the changeset viewer.