Changeset 856 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibDecoder/SEIread.cpp
- Timestamp:
- 11 Aug 2014, 19:11:02 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibDecoder/SEIread.cpp
r847 r856 98 98 break; 99 99 #endif 100 #if Q0074_ SEI_COLOR_MAPPING101 case SEI::COLO R_MAPPING_INFO:102 fprintf( g_hTrace, "===========Colo r Mapping InfoSEI message ===========\n");100 #if Q0074_COLOUR_REMAPPING_SEI 101 case SEI::COLOUR_REMAPPING_INFO: 102 fprintf( g_hTrace, "===========Colour Remapping Information SEI message ===========\n"); 103 103 break; 104 104 #endif … … 132 132 fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n"); 133 133 break; 134 #if !REMOVE_BSP_HRD_SEI 134 135 case SEI::BSP_HRD: 135 136 fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n"); 136 137 break; 138 #endif 137 139 #endif 138 140 #if Q0078_ADD_LAYER_SETS … … 304 306 break; 305 307 #endif 306 #if Q0074_ SEI_COLOR_MAPPING307 case SEI::COLO R_MAPPING_INFO:308 sei = new SEIColo rMappingInfo;309 xParseSEIColo rMappingInfo((SEIColorMappingInfo&) *sei, payloadSize);308 #if Q0074_COLOUR_REMAPPING_SEI 309 case SEI::COLOUR_REMAPPING_INFO: 310 sei = new SEIColourRemappingInfo; 311 xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize); 310 312 break; 311 313 #endif … … 923 925 #endif 924 926 925 #if Q0074_ SEI_COLOR_MAPPING926 Void SEIReader::xParseSEIColo rMappingInfo(SEIColorMappingInfo& sei, UInt /*payloadSize*/)927 #if Q0074_COLOUR_REMAPPING_SEI 928 Void SEIReader::xParseSEIColourRemappingInfo(SEIColourRemappingInfo& sei, UInt /*payloadSize*/) 927 929 { 928 930 UInt uiVal; 929 931 Int iVal; 930 932 931 READ_UVLC( uiVal, "colour_map_id" ); sei.m_colorMapId = uiVal; 932 READ_FLAG( uiVal, "colour_map_cancel_flag" ); sei.m_colorMapCancelFlag = uiVal; 933 if( !sei.m_colorMapCancelFlag ) 934 { 935 READ_FLAG( uiVal, "colour_map_persistence_flag" ); sei.m_colorMapPersistenceFlag = uiVal; 936 READ_FLAG( uiVal, "colour_map_video_signal_type_present_flag" ); sei.m_colorMap_video_signal_type_present_flag = uiVal; 937 if ( sei.m_colorMap_video_signal_type_present_flag ) { 938 READ_FLAG( uiVal, "colour_map_video_full_range_flag" ); sei.m_colorMap_video_full_range_flag = uiVal; 939 READ_CODE( 8, uiVal, "colour_map_primaries" ); sei.m_colorMap_primaries = uiVal; 940 READ_CODE( 8, uiVal, "colour_map_transfer_characteristics" ); sei.m_colorMap_transfer_characteristics = uiVal; 941 READ_CODE( 8, uiVal, "colour_map_matrix_coeffs" ); sei.m_colorMap_matrix_coeffs = uiVal; 942 } 943 } 944 945 READ_CODE( 5, uiVal, "colour_map_coded_data_bit_depth" ); sei.m_colour_map_coded_data_bit_depth = uiVal; 946 READ_CODE( 5, uiVal, "colour_map_target_bit_depth" ); sei.m_colour_map_target_bit_depth = uiVal; 947 READ_UVLC( uiVal, "colour_map_model_id" ); sei.m_colorMapModelId = uiVal; 948 949 assert( sei.m_colorMapModelId == 0 ); 933 READ_UVLC( uiVal, "colour_remap_id" ); sei.m_colourRemapId = uiVal; 934 READ_FLAG( uiVal, "colour_remap_cancel_flag" ); sei.m_colourRemapCancelFlag = uiVal; 935 if( !sei.m_colourRemapCancelFlag ) 936 { 937 READ_FLAG( uiVal, "colour_remap_persistence_flag" ); sei.m_colourRemapPersistenceFlag = uiVal; 938 READ_FLAG( uiVal, "colour_remap_video_signal_type_present_flag" ); sei.m_colourRemapVideoSignalTypePresentFlag = uiVal; 939 if ( sei.m_colourRemapVideoSignalTypePresentFlag ) 940 { 941 READ_FLAG( uiVal, "colour_remap_video_full_range_flag" ); sei.m_colourRemapVideoFullRangeFlag = uiVal; 942 READ_CODE( 8, uiVal, "colour_remap_primaries" ); sei.m_colourRemapPrimaries = uiVal; 943 READ_CODE( 8, uiVal, "colour_remap_transfer_characteristics" ); sei.m_colourRemapTransferCharacteristics = uiVal; 944 READ_CODE( 8, uiVal, "colour_remap_matrix_coeffs" ); sei.m_colourRemapMatrixCoeffs = uiVal; 945 } 946 READ_CODE( 8, uiVal, "colour_remap_coded_data_bit_depth" ); sei.m_colourRemapCodedDataBitDepth = uiVal; 947 READ_CODE( 8, uiVal, "colour_remap_target_bit_depth" ); sei.m_colourRemapTargetBitDepth = uiVal; 950 948 951 for( Int i=0 ; i<3 ; i++ ) 952 { 953 READ_CODE( 8, uiVal, "num_input_pivots_minus1[i]" ); sei.m_num_input_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ; 954 sei.m_coded_input_pivot_value[i] = new Int[ sei.m_num_input_pivots[i] ]; 955 sei.m_target_input_pivot_value[i] = new Int[ sei.m_num_input_pivots[i] ]; 956 if( uiVal > 0 ) 957 { 958 for ( Int j=0 ; j<sei.m_num_input_pivots[i] ; j++ ) 959 { 960 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; 961 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; 962 } 963 } 964 else 965 { 966 sei.m_coded_input_pivot_value[i][0] = 0; 967 sei.m_target_input_pivot_value[i][0] = 0; 968 sei.m_coded_input_pivot_value[i][1] = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ; 969 sei.m_target_input_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ; 970 } 971 } 972 973 READ_FLAG( uiVal, "matrix_flag" ); sei.m_matrix_flag = uiVal; 974 if( sei.m_matrix_flag ) 975 { 976 READ_CODE( 4, uiVal, "log2_matrix_denom" ); sei.m_log2_matrix_denom = uiVal; 977 for ( Int i=0 ; i<3 ; i++ ) 978 { 979 for ( Int j=0 ; j<3 ; j++ ) 980 { 981 READ_SVLC( iVal, "matrix_coef[i][j]" ); sei.m_matrix_coef[i][j] = iVal; 982 } 983 } 984 } 985 986 for ( Int i=0 ; i<3 ; i++ ) 987 { 988 READ_CODE( 8, uiVal, "num_output_pivots_minus1[i]" ); sei.m_num_output_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ; 989 sei.m_coded_output_pivot_value[i] = new Int[ sei.m_num_output_pivots[i] ]; 990 sei.m_target_output_pivot_value[i] = new Int[ sei.m_num_output_pivots[i] ]; 991 if( uiVal > 0 ) 992 { 993 for ( Int j=0 ; j<sei.m_num_output_pivots[i] ; j++ ) 994 { 995 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; 996 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; 997 } 998 } 999 else 1000 { 1001 sei.m_coded_output_pivot_value[i][0] = 0; 1002 sei.m_target_output_pivot_value[i][0] = 0; 1003 sei.m_coded_output_pivot_value[i][1] = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ; 1004 sei.m_target_output_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ; 949 for( Int c=0 ; c<3 ; c++ ) 950 { 951 READ_CODE( 8, uiVal, "pre_lut_num_val_minus1[c]" ); sei.m_preLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 952 sei.m_preLutCodedValue[c].resize(sei.m_preLutNumValMinus1[c]+1); 953 sei.m_preLutTargetValue[c].resize(sei.m_preLutNumValMinus1[c]+1); 954 if( uiVal> 0 ) 955 for ( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ ) 956 { 957 READ_CODE( (( sei.m_colourRemapCodedDataBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_coded_value[c][i]" ); sei.m_preLutCodedValue[c][i] = uiVal; 958 READ_CODE( (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_target_value[c][i]" ); sei.m_preLutTargetValue[c][i] = uiVal; 959 } 960 else // pre_lut_num_val_minus1[c] == 0 961 { 962 sei.m_preLutCodedValue[c][0] = 0; 963 sei.m_preLutTargetValue[c][0] = 0; 964 sei.m_preLutCodedValue[c][1] = (1 << sei.m_colourRemapCodedDataBitDepth) - 1 ; 965 sei.m_preLutTargetValue[c][1] = (1 << sei.m_colourRemapTargetBitDepth) - 1 ; 966 } 967 } 968 969 READ_FLAG( uiVal, "colour_remap_matrix_present_flag" ); sei.m_colourRemapMatrixPresentFlag = uiVal; 970 if( sei.m_colourRemapMatrixPresentFlag ) 971 { 972 READ_CODE( 4, uiVal, "log2_matrix_denom" ); sei.m_log2MatrixDenom = uiVal; 973 for ( Int c=0 ; c<3 ; c++ ) 974 for ( Int i=0 ; i<3 ; i++ ) 975 { 976 READ_SVLC( iVal, "colour_remap_coeffs[c][i]" ); sei.m_colourRemapCoeffs[c][i] = iVal; 977 } 978 } 979 else // setting default matrix (I3) 980 { 981 sei.m_log2MatrixDenom = 0; 982 for ( Int c=0 ; c<3 ; c++ ) 983 for ( Int i=0 ; i<3 ; i++ ) 984 sei.m_colourRemapCoeffs[c][i] = (c==i) ? 1 : 0; 985 } 986 for( Int c=0 ; c<3 ; c++ ) 987 { 988 READ_CODE( 8, uiVal, "post_lut_num_val_minus1[c]" ); sei.m_postLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 989 sei.m_postLutCodedValue[c].resize(sei.m_postLutNumValMinus1[c]+1); 990 sei.m_postLutTargetValue[c].resize(sei.m_postLutNumValMinus1[c]+1); 991 if( uiVal > 0 ) 992 for ( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ ) 993 { 994 READ_CODE( (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_coded_value[c][i]" ); sei.m_postLutCodedValue[c][i] = uiVal; 995 READ_CODE( (( sei.m_colourRemapTargetBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_target_value[c][i]" ); sei.m_postLutTargetValue[c][i] = uiVal; 996 } 997 else 998 { 999 sei.m_postLutCodedValue[c][0] = 0; 1000 sei.m_postLutTargetValue[c][0] = 0; 1001 sei.m_postLutTargetValue[c][1] = (1 << sei.m_colourRemapTargetBitDepth) - 1; 1002 sei.m_postLutCodedValue[c][1] = (1 << sei.m_colourRemapTargetBitDepth) - 1; 1003 } 1005 1004 } 1006 1005 }
Note: See TracChangeset for help on using the changeset viewer.