Changeset 713 in SHVCSoftware for trunk/source/Lib/TLibEncoder
- Timestamp:
- 21 Apr 2014, 04:44:16 (12 years ago)
- Location:
- trunk
- Files:
-
- 20 edited
- 2 copied
-
. (modified) (1 prop)
-
source (modified) (1 prop)
-
source/Lib/TLibEncoder/AnnexBwrite.h (modified) (1 diff)
-
source/Lib/TLibEncoder/NALwrite.cpp (modified) (1 diff)
-
source/Lib/TLibEncoder/SEIwrite.cpp (modified) (6 diffs)
-
source/Lib/TLibEncoder/SEIwrite.h (modified) (1 diff)
-
source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp (copied) (copied from branches/SHM-6-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp)
-
source/Lib/TLibEncoder/TEnc3DAsymLUT.h (copied) (copied from branches/SHM-6-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.h)
-
source/Lib/TLibEncoder/TEncCavlc.cpp (modified) (20 diffs)
-
source/Lib/TLibEncoder/TEncCavlc.h (modified) (4 diffs)
-
source/Lib/TLibEncoder/TEncCfg.h (modified) (6 diffs)
-
source/Lib/TLibEncoder/TEncEntropy.cpp (modified) (2 diffs)
-
source/Lib/TLibEncoder/TEncEntropy.h (modified) (3 diffs)
-
source/Lib/TLibEncoder/TEncGOP.cpp (modified) (28 diffs)
-
source/Lib/TLibEncoder/TEncGOP.h (modified) (5 diffs)
-
source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp (modified) (15 diffs)
-
source/Lib/TLibEncoder/TEncSbac.cpp (modified) (1 diff)
-
source/Lib/TLibEncoder/TEncSbac.h (modified) (2 diffs)
-
source/Lib/TLibEncoder/TEncSearch.cpp (modified) (3 diffs)
-
source/Lib/TLibEncoder/TEncSlice.cpp (modified) (6 diffs)
-
source/Lib/TLibEncoder/TEncTop.cpp (modified) (3 diffs)
-
source/Lib/TLibEncoder/TEncTop.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-6-dev (added) merged: 651-712
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-6-dev/source (added) merged: 652-678,680,683-684,686-691,693-700,702-705,707-711
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibEncoder/AnnexBwrite.h
r595 r713 58 58 59 59 static const Char start_code_prefix[] = {0,0,0,1}; 60 if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_ SPS || nalu.m_nalUnitType == NAL_UNIT_PPS)60 if (it == au.begin() || nalu.m_nalUnitType == NAL_UNIT_VPS || nalu.m_nalUnitType == NAL_UNIT_SPS || nalu.m_nalUnitType == NAL_UNIT_PPS) 61 61 { 62 62 /* From AVC, When any of the following conditions are fulfilled, the -
trunk/source/Lib/TLibEncoder/NALwrite.cpp
r595 r713 91 91 vector<uint8_t>& rbsp = nalu.m_Bitstream.getFIFO(); 92 92 93 #if P0130_EOB 94 if (rbsp.size() == 0) return; 95 #endif 93 if (rbsp.size() == 0) 94 { 95 return; 96 } 96 97 97 98 for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();) -
trunk/source/Lib/TLibEncoder/SEIwrite.cpp
r644 r713 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)); … … 333 343 Void SEIWriter::xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei) 334 344 { 335 WRITE_CODE(sei.activeVPSId, 4, "active_vps_id");336 WRITE_FLAG(sei.m_ fullRandomAccessFlag, "full_random_access_flag");337 WRITE_FLAG(sei.m_noParam SetUpdateFlag, "no_param_set_update_flag");345 WRITE_CODE(sei.activeVPSId, 4, "active_video_parameter_set_id"); 346 WRITE_FLAG(sei.m_selfContainedCvsFlag, "self_contained_cvs_flag"); 347 WRITE_FLAG(sei.m_noParameterSetUpdateFlag, "no_parameter_set_update_flag"); 338 348 WRITE_UVLC(sei.numSpsIdsMinus1, "num_sps_ids_minus1"); 339 349 340 assert (sei.activeSeqParamSetId.size() == (sei.numSpsIdsMinus1 + 1)); 341 342 for (Int i = 0; i < sei.activeSeqParamSetId.size(); i++) 343 { 344 WRITE_UVLC(sei.activeSeqParamSetId[i], "active_seq_param_set_id"); 345 } 346 347 UInt uiBits = m_pcBitIf->getNumberOfWrittenBits(); 348 UInt uiAlignedBits = ( 8 - (uiBits&7) ) % 8; 349 if(uiAlignedBits) 350 { 351 WRITE_FLAG(1, "alignment_bit" ); 352 uiAlignedBits--; 353 while(uiAlignedBits--) 354 { 355 WRITE_FLAG(0, "alignment_bit" ); 356 } 357 } 350 assert (sei.activeSeqParameterSetId.size() == (sei.numSpsIdsMinus1 + 1)); 351 352 for (Int i = 0; i < sei.activeSeqParameterSetId.size(); i++) 353 { 354 WRITE_UVLC(sei.activeSeqParameterSetId[i], "active_seq_parameter_set_id"); 355 } 356 xWriteByteAlign(); 358 357 } 359 358 … … 550 549 { 551 550 WRITE_CODE( sei.m_cameraIsoSpeedValue, 32, "camera_iso_speed_value" ); 551 } 552 WRITE_CODE( sei.m_exposureIndexIdc, 8, "exposure_index_idc" ); 553 if( sei.m_exposureIndexIdc == 255) //Extended_ISO 554 { 555 WRITE_CODE( sei.m_exposureIndexValue, 32, "exposure_index_value" ); 552 556 } 553 557 WRITE_FLAG( sei.m_exposureCompensationValueSignFlag, "exposure_compensation_value_sign_flag" ); … … 572 576 } 573 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 574 639 Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei) 575 640 { … … 633 698 for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++) 634 699 { 700 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 635 701 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id" ); 636 702 WRITE_UVLC( sei.m_nestingOpIdx[i], "nesting_op_idx" ); -
trunk/source/Lib/TLibEncoder/SEIwrite.h
r644 r713 72 72 Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei); 73 73 Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei); 74 #if Q0074_SEI_COLOR_MAPPING 75 Void xWriteSEIColorMappingInfo(const SEIColorMappingInfo& sei); 76 #endif 74 77 Void xWriteSEISOPDescription(const SEISOPDescription& sei); 75 78 #if O0164_MULTI_LAYER_HRD -
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r649 r713 154 154 155 155 156 Void TEncCavlc::codePPS( TComPPS* pcPPS ) 156 Void TEncCavlc::codePPS( TComPPS* pcPPS 157 #if Q0048_CGS_3D_ASYMLUT 158 , TEnc3DAsymLUT * pc3DAsymLUT 159 #endif 160 ) 157 161 { 158 162 #if ENC_DEC_TRACE … … 268 272 { 269 273 WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag() ? 1 : 0, "poc_reset_info_present_flag" ); 274 #if Q0048_CGS_3D_ASYMLUT 275 UInt uiPos = getNumberOfWrittenBits(); 276 WRITE_FLAG( pcPPS->getCGSFlag() , "colour_mapping_enabled_flag" ); 277 if( pcPPS->getCGSFlag() ) 278 { 279 assert( pc3DAsymLUT != NULL ); 280 xCode3DAsymLUT( pc3DAsymLUT ); 281 } 282 pc3DAsymLUT->setPPSBit( getNumberOfWrittenBits() - uiPos ); 283 #endif 270 284 #endif 271 285 } … … 495 509 if (conf.getWindowEnabledFlag()) 496 510 { 511 #if REPN_FORMAT_IN_VPS 512 WRITE_UVLC( conf.getWindowLeftOffset(), "conf_win_left_offset" ); 513 WRITE_UVLC( conf.getWindowRightOffset(), "conf_win_right_offset" ); 514 WRITE_UVLC( conf.getWindowTopOffset(), "conf_win_top_offset" ); 515 WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_bottom_offset" ); 516 #else 497 517 WRITE_UVLC( conf.getWindowLeftOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_left_offset" ); 498 518 WRITE_UVLC( conf.getWindowRightOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_right_offset" ); 499 519 WRITE_UVLC( conf.getWindowTopOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_top_offset" ); 500 520 WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" ); 521 #endif 501 522 } 502 523 … … 777 798 } 778 799 } 779 #if !VPS_EXTNS 780 WRITE_FLAG( 0, "vps_extension_flag" ); 781 #else 782 WRITE_FLAG( 1, "vps_extension_flag" ); 783 if(1) // Should be conditioned on the value of vps_extension_flag 800 #if VPS_EXTNS 801 // When MaxLayersMinus1 is greater than 0, vps_extension_flag shall be equal to 1. 802 if( pcVPS->getMaxLayers() > 1 ) 803 { 804 assert( pcVPS->getVpsExtensionFlag() == true ); 805 } 806 807 WRITE_FLAG( pcVPS->getVpsExtensionFlag() ? 1 : 0, "vps_extension_flag" ); 808 809 if( pcVPS->getVpsExtensionFlag() ) 784 810 { 785 811 while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 ) … … 797 823 WRITE_FLAG( 0, "vps_extension2_flag" ); // Flag value of 1 reserved 798 824 } 825 #else 826 WRITE_FLAG( 0, "vps_extension_flag" ); 799 827 #endif 800 828 //future extensions here.. … … 996 1024 } 997 1025 #else 998 Int numOutputLayerSets = vps->getNumOutputLayerSets() ; 999 assert( numOutputLayerSets - (Int)vps->getNumLayerSets() >= 0 ); 1026 Int numOutputLayerSets = vps->getNumOutputLayerSets(); 1027 Int numAddOutputLayerSets = numOutputLayerSets - (Int)vps->getNumLayerSets(); 1028 1029 // The value of num_add_output_layer_sets shall be in the range of 0 to 1023, inclusive. 1030 assert( numAddOutputLayerSets >= 0 && numAddOutputLayerSets < 1024 ); 1031 1032 #if Q0165_NUM_ADD_OUTPUT_LAYER_SETS 1033 if( vps->getNumLayerSets() > 1 ) 1034 { 1035 WRITE_UVLC( numAddOutputLayerSets, "num_add_output_layer_sets" ); 1036 WRITE_CODE( vps->getDefaultTargetOutputLayerIdc(), 2, "default_target_output_layer_idc" ); 1037 } 1038 #else 1000 1039 WRITE_UVLC( numOutputLayerSets - vps->getNumLayerSets(), "num_add_output_layer_sets" ); 1001 1040 #endif 1041 #endif 1042 1043 #if !Q0165_NUM_ADD_OUTPUT_LAYER_SETS 1002 1044 if( numOutputLayerSets > 1 ) 1003 1045 { … … 1012 1054 #endif 1013 1055 } 1056 #endif 1014 1057 1015 1058 for(i = 1; i < numOutputLayerSets; i++) … … 1059 1102 WRITE_FLAG(vps->getAltOuputLayerFlag(i), "alt_output_layer_flag[i]"); 1060 1103 } 1104 1105 #if Q0165_OUTPUT_LAYER_SET 1106 assert( NumOutputLayersInOutputLayerSet[i]>0 ); 1107 #endif 1108 1061 1109 #endif 1062 1110 } … … 1072 1120 1073 1121 #if REPN_FORMAT_IN_VPS 1122 #if Q0195_REP_FORMAT_CLEANUP 1123 // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. 1124 assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 ); 1125 1126 WRITE_UVLC( vps->getVpsNumRepFormats() - 1, "vps_num_rep_formats_minus1" ); 1127 1128 for(i = 0; i < vps->getVpsNumRepFormats(); i++) 1129 { 1130 // Write rep_format_structures 1131 codeRepFormat( vps->getVpsRepFormat(i) ); 1132 } 1133 1134 if( vps->getVpsNumRepFormats() > 1 ) 1135 { 1136 WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag"); 1137 } 1138 else 1139 { 1140 // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0 1141 assert( !vps->getRepFormatIdxPresentFlag() ); 1142 } 1143 1144 if( vps->getRepFormatIdxPresentFlag() ) 1145 { 1146 for(i = 1; i < vps->getMaxLayers(); i++) 1147 { 1148 Int numBits = 1; 1149 while ((1 << numBits) < (vps->getVpsNumRepFormats())) 1150 { 1151 numBits++; 1152 } 1153 WRITE_CODE( vps->getVpsRepFormatIdx(i), numBits, "vps_rep_format_idx[i]" ); 1154 } 1155 } 1156 #else 1074 1157 WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag"); 1075 1158 1076 1159 if( vps->getRepFormatIdxPresentFlag() ) 1077 1160 { 1161 // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. 1162 assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 ); 1163 1078 1164 #if O0096_REP_FORMAT_INDEX 1079 1165 #if !VPS_EXTN_UEV_CODING … … 1115 1201 } 1116 1202 } 1203 #endif 1117 1204 #endif 1118 1205 … … 1181 1268 1182 1269 #if P0307_VPS_NON_VUI_EXTENSION 1270 // The value of vps_non_vui_extension_length shall be in the range of 0 to 4096, inclusive. 1271 assert( vps->getVpsNonVuiExtLength() >= 0 && vps->getVpsNonVuiExtLength() <= 4096 ); 1272 1183 1273 WRITE_UVLC( vps->getVpsNonVuiExtLength(), "vps_non_vui_extension_length" ); 1184 1274 #if P0307_VPS_NON_VUI_EXT_UPDATE … … 1216 1306 #else 1217 1307 #if P0307_REMOVE_VPS_VUI_OFFSET 1218 WRITE_FLAG( 1, "vps_vui_present_flag" );1219 1308 vps->setVpsVuiPresentFlag(true); 1309 WRITE_FLAG( vps->getVpsVuiPresentFlag() ? 1 : 0, "vps_vui_present_flag" ); 1220 1310 #endif 1221 1311 if(vps->getVpsVuiPresentFlag()) // Should be conditioned on the value of vps_vui_present_flag … … 1238 1328 #endif 1239 1329 #if REPN_FORMAT_IN_VPS 1240 Void TEncCavlc::codeRepFormat ( RepFormat *repFormat )1330 Void TEncCavlc::codeRepFormat( RepFormat *repFormat ) 1241 1331 { 1242 1332 #if REPN_FORMAT_CONTROL_FLAG 1243 WRITE_FLAG ( repFormat->getChromaAndBitDepthVpsPresentFlag(), "chroma_and_bit_depth_vps_presenet_flag"); 1244 1245 WRITE_CODE ( repFormat->getPicWidthVpsInLumaSamples (), 16, "pic_width_in_luma_samples" ); 1246 WRITE_CODE ( repFormat->getPicHeightVpsInLumaSamples(), 16, "pic_height_in_luma_samples" ); 1247 1248 if ( repFormat->getChromaAndBitDepthVpsPresentFlag() ) 1249 { 1250 WRITE_CODE( repFormat->getChromaFormatVpsIdc(), 2, "chroma_format_idc" ); 1251 1252 if( repFormat->getChromaFormatVpsIdc() == 3 ) 1253 { 1254 WRITE_FLAG( repFormat->getSeparateColourPlaneVpsFlag(), "separate_colour_plane_flag"); 1255 } 1256 1257 assert( repFormat->getBitDepthVpsLuma() >= 8 ); 1258 assert( repFormat->getBitDepthVpsChroma() >= 8 ); 1259 WRITE_CODE( repFormat->getBitDepthVpsLuma() - 8, 4, "bit_depth_luma_minus8" ); 1260 WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_chroma_minus8" ); 1261 } 1333 WRITE_CODE( repFormat->getPicWidthVpsInLumaSamples (), 16, "pic_width_vps_in_luma_samples" ); 1334 WRITE_CODE( repFormat->getPicHeightVpsInLumaSamples(), 16, "pic_height_vps_in_luma_samples" ); 1335 WRITE_FLAG( repFormat->getChromaAndBitDepthVpsPresentFlag(), "chroma_and_bit_depth_vps_present_flag" ); 1336 1337 if( repFormat->getChromaAndBitDepthVpsPresentFlag() ) 1338 { 1339 WRITE_CODE( repFormat->getChromaFormatVpsIdc(), 2, "chroma_format_vps_idc" ); 1340 1341 if( repFormat->getChromaFormatVpsIdc() == 3 ) 1342 { 1343 WRITE_FLAG( repFormat->getSeparateColourPlaneVpsFlag(), "separate_colour_plane_vps_flag" ); 1344 } 1345 1346 assert( repFormat->getBitDepthVpsLuma() >= 8 ); 1347 assert( repFormat->getBitDepthVpsChroma() >= 8 ); 1348 WRITE_CODE( repFormat->getBitDepthVpsLuma() - 8, 4, "bit_depth_vps_luma_minus8" ); 1349 WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_vps_chroma_minus8" ); 1350 } 1262 1351 #else 1263 1352 WRITE_CODE( repFormat->getChromaFormatVpsIdc(), 2, "chroma_format_idc" ); … … 1275 1364 WRITE_CODE( repFormat->getBitDepthVpsLuma() - 8, 4, "bit_depth_luma_minus8" ); 1276 1365 WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_chroma_minus8" ); 1277 #endif 1278 1366 #endif 1279 1367 } 1280 1368 #endif … … 1375 1463 if( vps->getBitRatePresentVpsFlag() ) 1376 1464 { 1377 WRITE_FLAG( vps->getBitRatePresentFlag( i, j), "bit_rate_present_ vps_flag[i][j]" );1465 WRITE_FLAG( vps->getBitRatePresentFlag( i, j), "bit_rate_present_flag[i][j]" ); 1378 1466 } 1379 1467 if( vps->getPicRatePresentVpsFlag() ) 1380 1468 { 1381 WRITE_FLAG( vps->getPicRatePresentFlag( i, j), "pic_rate_present_ vps_flag[i][j]" );1469 WRITE_FLAG( vps->getPicRatePresentFlag( i, j), "pic_rate_present_flag[i][j]" ); 1382 1470 } 1383 1471 if( vps->getBitRatePresentFlag(i, j) ) … … 1466 1554 #endif 1467 1555 #if HIGHER_LAYER_IRAP_SKIP_FLAG 1556 // When single_layer_for_non_irap_flag is equal to 0, higher_layer_irap_skip_flag shall be equal to 0 1557 if( !vps->getSingleLayerForNonIrapFlag() ) 1558 { 1559 assert( !vps->getHigherLayerIrapSkipFlag() ); 1560 } 1561 1468 1562 WRITE_FLAG(vps->getHigherLayerIrapSkipFlag(), "higher_layer_irap_skip_flag" ); 1469 1563 #endif … … 1564 1658 for(i = 1; i < vps->getMaxLayers(); i++) 1565 1659 { 1566 if( vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0)1567 { 1568 if ((vps->getSPSId(i) == 0) && (vps->getPPSId(i) == 0))1660 if( vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0 ) 1661 { 1662 if( (vps->getSPSId(i) == 0) && (vps->getPPSId(i) == 0) ) 1569 1663 { 1570 1664 vps->setBaseLayerPSCompatibilityFlag(i, 1); 1571 WRITE_FLAG(vps->getBaseLayerPSCompatibilityFlag(i), "base_layer_parameter_set_compatibility_flag" );1572 1665 } 1573 1666 else … … 1575 1668 vps->setBaseLayerPSCompatibilityFlag(i, 0); 1576 1669 } 1670 WRITE_FLAG(vps->getBaseLayerPSCompatibilityFlag(i), "base_layer_parameter_set_compatibility_flag" ); 1577 1671 } 1578 1672 } … … 1612 1706 if ( pcSlice->getRapPicFlag() ) 1613 1707 { 1614 #if NO_OUTPUT_OF_PRIOR_PICS1615 WRITE_FLAG( pcSlice->getNoOutput OfPriorPicsFlag(), "no_output_of_prior_pics_flag" );1708 #if SETTING_NO_OUT_PIC_PRIOR 1709 WRITE_FLAG( pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag" ); 1616 1710 #else 1617 1711 WRITE_FLAG( 0, "no_output_of_prior_pics_flag" ); … … 2616 2710 return true; 2617 2711 } 2712 2713 #if Q0048_CGS_3D_ASYMLUT 2714 Void TEncCavlc::xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) 2715 { 2716 assert( pc3DAsymLUT->getCurOctantDepth() < 4 ); 2717 WRITE_CODE( pc3DAsymLUT->getCurOctantDepth() , 2 , "cm_octant_depth" ); 2718 assert( pc3DAsymLUT->getCurYPartNumLog2() < 4 ); 2719 WRITE_CODE( pc3DAsymLUT->getCurYPartNumLog2() , 2 , "cm_y_part_num_log2" ); 2720 assert( pc3DAsymLUT->getInputBitDepthY() < 16 ); 2721 WRITE_CODE( pc3DAsymLUT->getInputBitDepthY() - 8 , 3 , "cm_input_bit_depth_minus8" ); 2722 WRITE_SVLC(pc3DAsymLUT->getInputBitDepthC()-pc3DAsymLUT->getInputBitDepthY(), "cm_input_bit_depth_chroma delta"); 2723 assert( pc3DAsymLUT->getOutputBitDepthY() < 16 ); 2724 WRITE_CODE( pc3DAsymLUT->getOutputBitDepthY() - 8 , 3 , "cm_output_bit_depth_minus8" ); 2725 WRITE_SVLC(pc3DAsymLUT->getOutputBitDepthC()-pc3DAsymLUT->getOutputBitDepthY(), "cm_output_bit_depth_chroma_delta"); 2726 assert( pc3DAsymLUT->getResQuantBit() < 4 ); 2727 WRITE_CODE( pc3DAsymLUT->getResQuantBit() , 2 , "cm_res_quant_bit" ); 2728 2729 xCode3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); 2730 } 2731 2732 Void TEncCavlc::xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ) 2733 { 2734 UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); 2735 if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) 2736 WRITE_FLAG( uiOctantSplit , "split_octant_flag" ); 2737 Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); 2738 if( uiOctantSplit ) 2739 { 2740 Int nHalfLength = nLength >> 1; 2741 for( Int l = 0 ; l < 2 ; l++ ) 2742 { 2743 for( Int m = 0 ; m < 2 ; m++ ) 2744 { 2745 for( Int n = 0 ; n < 2 ; n++ ) 2746 { 2747 xCode3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength ); 2748 } 2749 } 2750 } 2751 } 2752 else 2753 { 2754 for( Int l = 0 ; l < nYPartNum ; l++ ) 2755 { 2756 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 2757 { 2758 SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx ); 2759 UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0; 2760 WRITE_FLAG( uiCodeVertex , "coded_vertex_flag" ); 2761 if( uiCodeVertex ) 2762 { 2763 WRITE_SVLC( sRes.Y , "resY" ); 2764 WRITE_SVLC( sRes.U , "resU" ); 2765 WRITE_SVLC( sRes.V , "resV" ); 2766 } 2767 } 2768 } 2769 } 2770 } 2771 #endif 2618 2772 //! \} -
trunk/source/Lib/TLibEncoder/TEncCavlc.h
r644 r713 48 48 #include "TEncEntropy.h" 49 49 #include "SyntaxElementWriter.h" 50 #if Q0048_CGS_3D_ASYMLUT 51 #include "../TLibCommon/TCom3DAsymLUT.h" 52 #include "TEnc3DAsymLUT.h" 53 #endif 50 54 51 55 //! \ingroup TLibEncoder … … 53 57 54 58 class TEncTop; 59 #if Q0048_CGS_3D_ASYMLUT 60 class TCom3DAsymLUT; 61 #endif 55 62 56 63 // ==================================================================================================================== … … 90 97 Void codeVUI ( TComVUI *pcVUI, TComSPS* pcSPS ); 91 98 Void codeSPS ( TComSPS* pcSPS ); 92 Void codePPS ( TComPPS* pcPPS ); 99 Void codePPS ( TComPPS* pcPPS 100 #if Q0048_CGS_3D_ASYMLUT 101 , TEnc3DAsymLUT * pc3DAsymLUT 102 #endif 103 ); 93 104 Void codeSliceHeader ( TComSlice* pcSlice ); 94 105 Void codePTL ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1); … … 162 173 Void codeVpsDpbSizeTable (TComVPS *vps); 163 174 #endif 175 #if Q0048_CGS_3D_ASYMLUT 176 protected: 177 Void xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 178 Void xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 179 #endif 164 180 #endif //SVC_EXTENSION 165 181 -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r644 r713 235 235 Int m_cameraIsoSpeedIdc; 236 236 Int m_cameraIsoSpeedValue; 237 Int m_exposureIndexIdc; 238 Int m_exposureIndexValue; 237 239 Int m_exposureCompensationValueSignFlag; 238 240 Int m_exposureCompensationValueNumerator; … … 246 248 Int* m_codedPivotValue; 247 249 Int* m_targetPivotValue; 250 #if Q0074_SEI_COLOR_MAPPING 251 Char* m_seiColorMappingFile; 252 #endif 248 253 Int m_framePackingSEIEnabled; 249 254 Int m_framePackingSEIType; … … 362 367 UInt m_bottomRightTileIndex[1024]; 363 368 UInt m_ilcIdc[1024]; 369 #endif 370 #if Q0048_CGS_3D_ASYMLUT 371 Int m_nCGSFlag; 372 Int m_nCGSMaxOctantDepth; 373 Int m_nCGSMaxYPartNumLog2; 374 Int m_nCGSLUTBit; 364 375 #endif 365 376 #endif //SVC_EXTENSION … … 639 650 Void setTMISEICameraIsoSpeedValue(Int b) { m_cameraIsoSpeedValue = b; } 640 651 Int getTMISEICameraIsoSpeedValue() { return m_cameraIsoSpeedValue; } 652 Void setTMISEIExposureIndexIdc(Int b) { m_exposureIndexIdc = b; } 653 Int getTMISEIExposurIndexIdc() { return m_exposureIndexIdc; } 654 Void setTMISEIExposureIndexValue(Int b) { m_exposureIndexValue = b; } 655 Int getTMISEIExposurIndexValue() { return m_exposureIndexValue; } 641 656 Void setTMISEIExposureCompensationValueSignFlag(Int b) { m_exposureCompensationValueSignFlag = b; } 642 657 Int getTMISEIExposureCompensationValueSignFlag() { return m_exposureCompensationValueSignFlag; } … … 655 670 Void setTMISEIExtendedWhiteLevelLumaCodeValue(Int b) { m_extendedWhiteLevelLumaCodeValue =b; } 656 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 657 676 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } 658 677 Int getFramePackingArrangementSEIEnabled() { return m_framePackingSEIEnabled; } … … 898 917 UInt getIlcIdc(UInt b) { return m_ilcIdc[b]; } 899 918 #endif 919 #if Q0048_CGS_3D_ASYMLUT 920 Void setCGSFlag(Int n) { m_nCGSFlag = n; } 921 Int getCGSFlag() { return m_nCGSFlag; } 922 Void setCGSMaxOctantDepth(Int n) { m_nCGSMaxOctantDepth = n; } 923 Int getCGSMaxOctantDepth() { return m_nCGSMaxOctantDepth; } 924 Void setCGSMaxYPartNumLog2(Int n) { m_nCGSMaxYPartNumLog2 = n; } 925 Int getCGSMaxYPartNumLog2() { return m_nCGSMaxYPartNumLog2; } 926 Void setCGSLUTBit(Int n) { m_nCGSLUTBit = n; } 927 Int getCGSLUTBit() { return m_nCGSLUTBit; } 928 #endif 900 929 #endif 901 930 }; -
trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
r644 r713 79 79 } 80 80 81 #if Q0048_CGS_3D_ASYMLUT 82 Void TEncEntropy::encodePPS( TComPPS* pcPPS, TEnc3DAsymLUT * pc3DAsymLUT ) 83 { 84 m_pcEntropyCoderIf->codePPS( pcPPS, pc3DAsymLUT ); 85 return; 86 } 87 #else 81 88 Void TEncEntropy::encodePPS( TComPPS* pcPPS ) 82 89 { … … 84 91 return; 85 92 } 93 #endif 86 94 87 95 Void TEncEntropy::encodeSPS( TComSPS* pcSPS ) -
trunk/source/Lib/TLibEncoder/TEncEntropy.h
r644 r713 50 50 class TEncCavlc; 51 51 class SEI; 52 #if Q0048_CGS_3D_ASYMLUT 53 class TEnc3DAsymLUT; 54 #endif 52 55 53 56 // ==================================================================================================================== … … 70 73 virtual Void codeVPS ( TComVPS* pcVPS ) = 0; 71 74 virtual Void codeSPS ( TComSPS* pcSPS ) = 0; 72 virtual Void codePPS ( TComPPS* pcPPS ) = 0; 75 virtual Void codePPS ( TComPPS* pcPPS 76 #if Q0048_CGS_3D_ASYMLUT 77 , TEnc3DAsymLUT * pc3DAsymLUT 78 #endif 79 ) = 0; 73 80 virtual Void codeSliceHeader ( TComSlice* pcSlice ) = 0; 74 81 … … 156 163 // SPS 157 164 Void encodeSPS ( TComSPS* pcSPS ); 158 Void encodePPS ( TComPPS* pcPPS ); 165 Void encodePPS ( TComPPS* pcPPS 166 #if Q0048_CGS_3D_ASYMLUT 167 , TEnc3DAsymLUT * pc3DAsymLUT 168 #endif 169 ); 159 170 Void encodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); 160 171 Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r644 r713 75 75 m_iNumPicCoded = 0; //Niko 76 76 m_bFirst = true; 77 #if ALLOW_RECOVERY_POINT_AS_RAP 78 m_iLastRecoveryPicPOC = 0; 79 #endif 77 80 78 81 m_pcCfg = NULL; … … 103 106 m_pcPredSearch = NULL; 104 107 #endif 108 #if Q0048_CGS_3D_ASYMLUT 109 m_temp = NULL; 110 m_pColorMappedPic = NULL; 111 #endif 105 112 return; 106 113 } … … 108 115 TEncGOP::~TEncGOP() 109 116 { 117 #if Q0048_CGS_3D_ASYMLUT 118 if(m_pColorMappedPic) 119 { 120 m_pColorMappedPic->destroy(); 121 delete m_pColorMappedPic; 122 m_pColorMappedPic = NULL; 123 } 124 if(m_temp) 125 { 126 free_mem2DintWithPad(m_temp, m_iTap>>1, 0); 127 m_temp = NULL; 128 } 129 #endif 110 130 } 111 131 … … 157 177 m_pcPredSearch = pcTEncTop->getPredSearch(); ///< encoder search class 158 178 #endif 179 #if Q0048_CGS_3D_ASYMLUT 180 if( pcTEncTop->getLayerId() ) 181 { 182 m_Enc3DAsymLUTPicUpdate.create( m_pcCfg->getCGSMaxOctantDepth() , g_bitDepthYLayer[pcTEncTop->getLayerId()-1] , g_bitDepthCLayer[pcTEncTop->getLayerId()-1] , g_bitDepthYLayer[pcTEncTop->getLayerId()] , g_bitDepthCLayer[pcTEncTop->getLayerId()] , m_pcCfg->getCGSMaxYPartNumLog2() /*, m_pcCfg->getCGSPhaseAlignment()*/ ); 183 m_Enc3DAsymLUTPPS.create( m_pcCfg->getCGSMaxOctantDepth() , g_bitDepthYLayer[pcTEncTop->getLayerId()-1] , g_bitDepthCLayer[pcTEncTop->getLayerId()-1] , g_bitDepthYLayer[pcTEncTop->getLayerId()] , g_bitDepthCLayer[pcTEncTop->getLayerId()] , m_pcCfg->getCGSMaxYPartNumLog2() /*, m_pcCfg->getCGSPhaseAlignment()*/ ); 184 if(!m_pColorMappedPic) 185 { 186 m_pColorMappedPic = new TComPicYuv; 187 m_pColorMappedPic->create( m_ppcTEncTop[0]->getSourceWidth(), m_ppcTEncTop[0]->getSourceHeight(), CHROMA_420, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 188 } 189 } 190 #endif 159 191 } 160 192 … … 163 195 SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets(); 164 196 seiActiveParameterSets->activeVPSId = m_pcCfg->getVPS()->getVPSId(); 165 seiActiveParameterSets->m_ fullRandomAccessFlag = false;166 seiActiveParameterSets->m_noParam SetUpdateFlag = false;197 seiActiveParameterSets->m_selfContainedCvsFlag = false; 198 seiActiveParameterSets->m_noParameterSetUpdateFlag = false; 167 199 seiActiveParameterSets->numSpsIdsMinus1 = 0; 168 seiActiveParameterSets->activeSeqParam SetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1);169 seiActiveParameterSets->activeSeqParam SetId[0] = sps->getSPSId();200 seiActiveParameterSets->activeSeqParameterSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1); 201 seiActiveParameterSets->activeSeqParameterSetId[0] = sps->getSPSId(); 170 202 return seiActiveParameterSets; 171 203 } 172 173 204 174 205 SEIFramePacking* TEncGOP::xCreateSEIFramePacking() … … 271 302 seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue(); 272 303 assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 ); 304 seiToneMappingInfo->m_exposureIndexIdc = m_pcCfg->getTMISEIExposurIndexIdc(); 305 seiToneMappingInfo->m_exposureIndexValue = m_pcCfg->getTMISEIExposurIndexValue(); 306 assert( seiToneMappingInfo->m_exposureIndexValue !=0 ); 273 307 seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag(); 274 308 seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator(); … … 293 327 } 294 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, retval; 337 338 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMapId ); 339 retval = fscanf( fic, "%d", &iVal ); 340 seiColorMappingInfo->m_colorMapCancelFlag = iVal; 341 if( !seiColorMappingInfo->m_colorMapCancelFlag ) 342 { 343 retval = fscanf( fic, "%d", &iVal ); 344 seiColorMappingInfo->m_colorMapPersistenceFlag = iVal; 345 retval = 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 retval = fscanf( fic, "%d", &iVal ); 350 seiColorMappingInfo->m_colorMap_video_full_range_flag = iVal; 351 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_primaries ); 352 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_transfer_characteristics ); 353 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_matrix_coeffs ); 354 } 355 } 356 357 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colour_map_coded_data_bit_depth ); 358 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colour_map_target_bit_depth ); 359 retval = 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 retval = 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 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_coded_input_pivot_value[i][j] ); 372 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_target_input_pivot_value[i][j] ); 373 } 374 } 375 376 retval = fscanf( fic, "%d", &iVal ); 377 seiColorMappingInfo->m_matrix_flag = iVal; 378 if( seiColorMappingInfo->m_matrix_flag ) 379 { 380 retval = 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 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_matrix_coef[i][j] ); 386 } 387 } 388 } 389 390 for( Int i=0 ; i<3 ; i++ ) 391 { 392 retval = 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 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_coded_output_pivot_value[i][j] ); 398 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_target_output_pivot_value[i][j] ); 399 } 400 } 401 402 fclose( fic ); 403 404 if( retval != 1 ) 405 { 406 printf("Error: can't read color mapping information\n"); 407 } 408 409 return seiColorMappingInfo; 410 } 411 #endif 412 295 413 Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps) 296 414 { … … 359 477 delete sei; 360 478 } 479 #if Q0074_SEI_COLOR_MAPPING 480 if(m_pcCfg->getColorMappingInfoSEIFile()) 481 { 482 SEIColorMappingInfo *sei = xCreateSEIColorMappingInfo( m_pcCfg->getColorMappingInfoSEIFile() ); 483 484 #if SVC_EXTENSION 485 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, m_layerId); // temporalId = 0 ? 486 #else 487 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); 488 #endif 489 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 490 #if O0164_MULTI_LAYER_HRD 491 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps); 492 #else 493 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps); 494 #endif 495 writeRBSPTrailingBits(nalu.m_Bitstream); 496 accessUnit.push_back(new NALUnitEBSP(nalu)); 497 delete sei; 498 } 499 #endif 361 500 362 501 #if SVC_EXTENSION … … 435 574 UInt *accumNalsDU = NULL; 436 575 SEIDecodingUnitInfo decodingUnitInfoSEI; 576 #if EFFICIENT_FIELD_IRAP 577 Int IRAPGOPid = -1; 578 Bool IRAPtoReorder = false; 579 Bool swapIRAPForward = false; 580 if(isField) 581 { 582 Int pocCurr; 583 #if SVC_EXTENSION 584 for ( Int iGOPid=iPicIdInGOP; iGOPid < iPicIdInGOP+1; iGOPid++ ) 585 #else 586 for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) 587 #endif 588 { 589 // determine actual POC 590 if(iPOCLast == 0) //case first frame or first top field 591 { 592 pocCurr=0; 593 } 594 else if(iPOCLast == 1 && isField) //case first bottom field, just like the first frame, the poc computation is not right anymore, we set the right value 595 { 596 pocCurr = 1; 597 } 598 else 599 { 600 pocCurr = iPOCLast - iNumPicRcvd + m_pcCfg->getGOPEntry(iGOPid).m_POC - isField; 601 } 602 603 // check if POC corresponds to IRAP 604 NalUnitType tmpUnitType = getNalUnitType(pocCurr, m_iLastIDR, isField); 605 if(tmpUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && tmpUnitType <= NAL_UNIT_CODED_SLICE_CRA) // if picture is an IRAP 606 { 607 if(pocCurr%2 == 0 && iGOPid < m_iGopSize-1 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid+1).m_POC-1) 608 { // if top field and following picture in enc order is associated bottom field 609 IRAPGOPid = iGOPid; 610 IRAPtoReorder = true; 611 swapIRAPForward = true; 612 break; 613 } 614 if(pocCurr%2 != 0 && iGOPid > 0 && m_pcCfg->getGOPEntry(iGOPid).m_POC == m_pcCfg->getGOPEntry(iGOPid-1).m_POC+1) 615 { 616 // if picture is an IRAP remember to process it first 617 IRAPGOPid = iGOPid; 618 IRAPtoReorder = true; 619 swapIRAPForward = false; 620 break; 621 } 622 } 623 } 624 } 625 #endif 437 626 #if SVC_EXTENSION 438 627 for ( Int iGOPid=iPicIdInGOP; iGOPid < iPicIdInGOP+1; iGOPid++ ) … … 441 630 #endif 442 631 { 632 #if EFFICIENT_FIELD_IRAP 633 if(IRAPtoReorder) 634 { 635 if(swapIRAPForward) 636 { 637 if(iGOPid == IRAPGOPid) 638 { 639 iGOPid = IRAPGOPid +1; 640 } 641 else if(iGOPid == IRAPGOPid +1) 642 { 643 iGOPid = IRAPGOPid; 644 } 645 } 646 else 647 { 648 if(iGOPid == IRAPGOPid -1) 649 { 650 iGOPid = IRAPGOPid; 651 } 652 else if(iGOPid == IRAPGOPid) 653 { 654 iGOPid = IRAPGOPid -1; 655 } 656 } 657 } 658 #endif 443 659 UInt uiColDir = 1; 444 660 //-- For time output for each slice … … 510 726 if(pocCurr>=m_pcCfg->getFramesToBeEncoded()) 511 727 { 728 #if EFFICIENT_FIELD_IRAP 729 if(IRAPtoReorder) 730 { 731 if(swapIRAPForward) 732 { 733 if(iGOPid == IRAPGOPid) 734 { 735 iGOPid = IRAPGOPid +1; 736 IRAPtoReorder = false; 737 } 738 else if(iGOPid == IRAPGOPid +1) 739 { 740 iGOPid --; 741 } 742 } 743 else 744 { 745 if(iGOPid == IRAPGOPid) 746 { 747 iGOPid = IRAPGOPid -1; 748 } 749 else if(iGOPid == IRAPGOPid -1) 750 { 751 iGOPid = IRAPGOPid; 752 IRAPtoReorder = false; 753 } 754 } 755 } 756 #endif 512 757 continue; 513 758 } … … 803 1048 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(); 804 1049 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(); 805 1050 #if Q0200_CONFORMANCE_BL_SIZE 1051 Int chromaFormatIdc = pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc(); 1052 const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getConformanceWindow(); 1053 widthBL -= ( confBL.getWindowLeftOffset() + confBL.getWindowRightOffset() ) * TComSPS::getWinUnitX( chromaFormatIdc ); 1054 heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc ); 1055 #endif 806 1056 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 807 1057 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); … … 813 1063 g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 814 1064 1065 #if Q0048_CGS_3D_ASYMLUT 1066 TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(); 1067 if( pcSlice->getPPS()->getCGSFlag() ) 1068 { 1069 if(g_posScalingFactor[refLayerIdc][0] < (1<<16) || g_posScalingFactor[refLayerIdc][1] < (1<<16)) //if(pcPic->isSpatialEnhLayer(refLayerIdc)) 1070 { 1071 //downsampling; 1072 downScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()); 1073 //pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()->dump("ds.yuv", true, true); 1074 m_Enc3DAsymLUTPPS.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()); 1075 m_Enc3DAsymLUTPicUpdate.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg()); 1076 } 1077 else 1078 { 1079 m_Enc3DAsymLUTPPS.setDsOrigPic(pcPic->getPicYuvOrg()); 1080 m_Enc3DAsymLUTPicUpdate.setDsOrigPic(pcPic->getPicYuvOrg()); 1081 } 1082 1083 Bool bSignalPPS = m_bSeqFirst; 1084 bSignalPPS |= m_pcCfg->getGOPSize() > 1 ? pocCurr % m_pcCfg->getIntraPeriod() == 0 : pocCurr % m_pcCfg->getFrameRate() == 0; 1085 xDetermin3DAsymLUT( pcSlice , pcPic , refLayerIdc , m_pcCfg , bSignalPPS ); 1086 m_Enc3DAsymLUTPPS.colorMapping( pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), m_pColorMappedPic ); 1087 pBaseColRec = m_pColorMappedPic; 1088 } 1089 #endif 815 1090 #if SVC_UPSAMPLING 816 1091 if( pcPic->isSpatialEnhLayer(refLayerIdc)) 817 1092 { 818 /*#if O0098_SCALED_REF_LAYER_ID819 Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));820 #else821 Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);822 #endif*/823 1093 #if P0312_VERT_PHASE_ADJ 824 1094 //when PhasePositionEnableFlag is equal to 1, set vertPhasePositionFlag to 0 if BL is top field and 1 if bottom … … 830 1100 #if O0215_PHASE_ALIGNMENT 831 1101 #if O0194_JOINT_US_BITSHIFT 832 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 1102 #if Q0048_CGS_3D_ASYMLUT 1103 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() ); 1104 #else 1105 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getVPS()->getPhaseAlignFlag() ); 1106 #endif 1107 #else 1108 #if Q0048_CGS_3D_ASYMLUT 1109 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 833 1110 #else 834 1111 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 835 1112 #endif 1113 #endif 836 1114 #else 837 1115 #if O0194_JOINT_US_BITSHIFT 1116 #if Q0048_CGS_3D_ASYMLUT 1117 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 1118 #else 838 1119 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 1120 #endif 1121 #else 1122 #if Q0048_CGS_3D_ASYMLUT 1123 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 839 1124 #else 840 1125 m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 841 1126 #endif 842 1127 #endif 1128 #endif 843 1129 } 844 1130 else 845 1131 { 1132 #if Q0048_CGS_3D_ASYMLUT 1133 pcPic->setFullPelBaseRec( refLayerIdc, pBaseColRec ); 1134 #else 846 1135 pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() ); 1136 #endif 847 1137 } 848 1138 pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) ); … … 856 1146 } 857 1147 858 #if !O0225_TID_BASED_IL_RPS_DERIV 1148 #if !O0225_TID_BASED_IL_RPS_DERIV || Q0060_MAX_TID_REF_EQUAL_TO_ZERO 859 1149 pcSlice->setActiveNumILRRefIdx( activeNumILRRefIdxTmp ); 860 1150 #endif … … 932 1222 } 933 1223 934 // Do decoding refresh marking if any 935 #if NO_CLRAS_OUTPUT_FLAG 936 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pcEncTop->getNoClrasOutputFlag()); 937 #else 938 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic); 939 #endif 940 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); 941 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 1224 #if EFFICIENT_FIELD_IRAP 942 1225 #if FIX1172 943 1226 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP … … 954 1237 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 955 1238 #endif 956 1239 #endif 1240 // Do decoding refresh marking if any 1241 #if NO_CLRAS_OUTPUT_FLAG 1242 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic, m_pcEncTop->getNoClrasOutputFlag()); 1243 #else 1244 pcSlice->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, rcListPic); 1245 #endif 1246 m_pcEncTop->selectReferencePictureSet(pcSlice, pocCurr, iGOPid); 1247 pcSlice->getRPS()->setNumberOfLongtermPictures(0); 1248 #if EFFICIENT_FIELD_IRAP 1249 #else 1250 #if FIX1172 1251 if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1252 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1253 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP 1254 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL 1255 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP 1256 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // IRAP picture 1257 { 1258 m_associatedIRAPType = pcSlice->getNalUnitType(); 1259 m_associatedIRAPPOC = pocCurr; 1260 } 1261 pcSlice->setAssociatedIRAPType(m_associatedIRAPType); 1262 pcSlice->setAssociatedIRAPPOC(m_associatedIRAPPOC); 1263 #endif 1264 #endif 1265 1266 #if ALLOW_RECOVERY_POINT_AS_RAP 1267 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false, m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3) != 0) || (pcSlice->isIRAP()) 1268 #if EFFICIENT_FIELD_IRAP 1269 || (isField && pcSlice->getAssociatedIRAPType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getAssociatedIRAPType() <= NAL_UNIT_CODED_SLICE_CRA && pcSlice->getAssociatedIRAPPOC() == pcSlice->getPOC()+1) 1270 #endif 1271 ) 1272 { 1273 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP(), m_iLastRecoveryPicPOC, m_pcCfg->getDecodingRefreshType() == 3); 1274 } 1275 #else 957 1276 if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP())) 958 1277 { 959 1278 pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP()); 960 1279 } 1280 #endif 961 1281 #if ALIGNED_BUMPING 962 1282 pcSlice->checkLeadingPictureRestrictions(rcListPic); … … 1743 2063 assert( pcSlice->getPPS()->getPPSId() == 0 || pcSlice->getPPS()->getPPSId() == m_layerId || m_pcEncTop->getVPS()->getRecursiveRefLayerFlag(m_layerId, pcSlice->getPPS()->getPPSId()) ); 1744 2064 #endif 1745 m_pcEntropyCoder->encodePPS(pcSlice->getPPS()); 2065 m_pcEntropyCoder->encodePPS(pcSlice->getPPS() 2066 #if Q0048_CGS_3D_ASYMLUT 2067 , & m_Enc3DAsymLUTPPS 2068 #endif 2069 ); 1746 2070 writeRBSPTrailingBits(nalu.m_Bitstream); 1747 2071 accessUnit.push_back(new NALUnitEBSP(nalu)); … … 1776 2100 m_bSeqFirst = false; 1777 2101 } 2102 #if Q0048_CGS_3D_ASYMLUT 2103 else if( m_pcCfg->getCGSFlag() && pcSlice->getLayerId() && pcSlice->getCGSOverWritePPS() ) 2104 { 2105 #if SVC_EXTENSION 2106 OutputNALUnit nalu(NAL_UNIT_PPS, 0, m_layerId); 2107 #endif 2108 2109 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2110 m_pcEntropyCoder->encodePPS(pcSlice->getPPS() , &m_Enc3DAsymLUTPPS ); 2111 writeRBSPTrailingBits(nalu.m_Bitstream); 2112 accessUnit.push_back(new NALUnitEBSP(nalu)); 2113 } 2114 #endif 1778 2115 1779 2116 if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP … … 1849 2186 pictureTimingSEI.m_auCpbRemovalDelay = std::min<Int>(std::max<Int>(1, m_totalCoded - m_lastBPSEI), static_cast<Int>(pow(2, static_cast<double>(pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getCpbRemovalDelayLengthMinus1()+1)))); // Syntax element signalled as minus, hence the . 1850 2187 #if POC_RESET_FLAG 1851 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pocCurr - m_totalCoded; 1852 #else 1853 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded; 2188 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pocCurr - m_totalCoded; 2189 #else 2190 pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(pcSlice->getSPS()->getMaxTLayers()-1) + pcSlice->getPOC() - m_totalCoded; 2191 #endif 2192 #if EFFICIENT_FIELD_IRAP 2193 if(IRAPGOPid > 0 && IRAPGOPid < m_iGopSize) 2194 { 2195 // if pictures have been swapped there is likely one more picture delay on their tid. Very rough approximation 2196 pictureTimingSEI.m_picDpbOutputDelay ++; 2197 } 1854 2198 #endif 1855 2199 Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2; … … 1975 2319 #endif 1976 2320 sei_recovery_point.m_brokenLinkFlag = false; 2321 #if ALLOW_RECOVERY_POINT_AS_RAP 2322 if(m_pcCfg->getDecodingRefreshType() == 3) 2323 { 2324 m_iLastRecoveryPicPOC = pocCurr; 2325 } 2326 #endif 1977 2327 1978 2328 #if O0164_MULTI_LAYER_HRD … … 2110 2460 } 2111 2461 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2462 2463 #if SETTING_NO_OUT_PIC_PRIOR 2464 if (pcSlice->isIRAP()) 2465 { 2466 if (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_IDR_N_LP) 2467 { 2468 pcSlice->setNoRaslOutputFlag(true); 2469 } 2470 //the inference for NoOutputPriorPicsFlag 2471 if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag()) 2472 { 2473 if (pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) 2474 { 2475 pcSlice->setNoOutputPriorPicsFlag(true); 2476 } 2477 } 2478 } 2479 #endif 2480 2112 2481 tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits(); 2113 2482 m_pcEntropyCoder->encodeSliceHeader(pcSlice); … … 2657 3026 2658 3027 delete[] pcSubstreamsOut; 3028 3029 #if EFFICIENT_FIELD_IRAP 3030 if(IRAPtoReorder) 3031 { 3032 if(swapIRAPForward) 3033 { 3034 if(iGOPid == IRAPGOPid) 3035 { 3036 iGOPid = IRAPGOPid +1; 3037 IRAPtoReorder = false; 3038 } 3039 else if(iGOPid == IRAPGOPid +1) 3040 { 3041 iGOPid --; 3042 } 3043 } 3044 else 3045 { 3046 if(iGOPid == IRAPGOPid) 3047 { 3048 iGOPid = IRAPGOPid -1; 3049 } 3050 else if(iGOPid == IRAPGOPid -1) 3051 { 3052 iGOPid = IRAPGOPid; 3053 IRAPtoReorder = false; 3054 } 3055 } 3056 } 3057 #endif 2659 3058 } 2660 3059 delete pcBitstreamRedirect; … … 2918 3317 case NAL_UNIT_CODED_SLICE_CRA: return "CRA"; 2919 3318 case NAL_UNIT_CODED_SLICE_RADL_R: return "RADL_R"; 3319 case NAL_UNIT_CODED_SLICE_RADL_N: return "RADL_N"; 2920 3320 case NAL_UNIT_CODED_SLICE_RASL_R: return "RASL_R"; 3321 case NAL_UNIT_CODED_SLICE_RASL_N: return "RASL_N"; 2921 3322 case NAL_UNIT_VPS: return "VPS"; 2922 3323 case NAL_UNIT_SPS: return "SPS"; … … 3080 3481 pcSlice->getTLayer(), 3081 3482 c, 3082 NaluToStr( pcSlice->getNalUnitType() ).data() .3483 NaluToStr( pcSlice->getNalUnitType() ).data(), 3083 3484 pcSlice->getSliceQp(), 3084 3485 uibits ); … … 3134 3535 printf("]"); 3135 3536 } 3537 #if Q0048_CGS_3D_ASYMLUT 3538 pcPic->setFrameBit( (Int)uibits ); 3539 if( m_layerId && pcSlice->getPPS()->getCGSFlag() ) 3540 { 3541 m_Enc3DAsymLUTPicUpdate.updatePicCGSBits( pcSlice , m_Enc3DAsymLUTPPS.getPPSBit() ); 3542 } 3543 #endif 3136 3544 } 3137 3545 … … 3316 3724 return NAL_UNIT_CODED_SLICE_IDR_W_RADL; 3317 3725 } 3726 #if EFFICIENT_FIELD_IRAP 3727 if(isField && pocCurr == 1) 3728 { 3729 // to avoid the picture becoming an IRAP 3730 return NAL_UNIT_CODED_SLICE_TRAIL_R; 3731 } 3732 #endif 3733 3734 #if ALLOW_RECOVERY_POINT_AS_RAP 3735 if(m_pcCfg->getDecodingRefreshType() != 3 && (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0) 3736 #else 3318 3737 if ((pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0) 3738 #endif 3319 3739 { 3320 3740 if (m_pcCfg->getDecodingRefreshType() == 1) … … 3828 4248 #endif 3829 4249 4250 #if Q0048_CGS_3D_ASYMLUT 4251 Void TEncGOP::xDetermin3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS ) 4252 { 4253 Int nCGSFlag = pSlice->getPPS()->getCGSFlag(); 4254 m_Enc3DAsymLUTPPS.setPPSBit( 0 ); 4255 Double dErrorUpdatedPPS = 0 , dErrorPPS = 0; 4256 dErrorUpdatedPPS = m_Enc3DAsymLUTPicUpdate.derive3DAsymLUT( pSlice , pCurPic , refLayerIdc , pCfg , bSignalPPS , m_pcEncTop->getElRapSliceTypeB() ); 4257 if( bSignalPPS ) 4258 { 4259 m_Enc3DAsymLUTPPS.copy3DAsymLUT( &m_Enc3DAsymLUTPicUpdate ); 4260 pSlice->setCGSOverWritePPS( 1 ); // regular PPS update 4261 } 4262 else if( nCGSFlag ) 4263 { 4264 dErrorPPS = m_Enc3DAsymLUTPPS.estimateDistWithCur3DAsymLUT( pCurPic , refLayerIdc ); 4265 Double dFactor = pCfg->getIntraPeriod() == 1 ? 0.99 : 0.9; 4266 pSlice->setCGSOverWritePPS( dErrorUpdatedPPS < dFactor * dErrorPPS ); 4267 if( pSlice->getCGSOverWritePPS() ) 4268 { 4269 m_Enc3DAsymLUTPPS.copy3DAsymLUT( &m_Enc3DAsymLUTPicUpdate ); 4270 } 4271 } 4272 pSlice->getPPS()->setCGSOutputBitDepthY( m_Enc3DAsymLUTPPS.getOutputBitDepthY() ); 4273 pSlice->getPPS()->setCGSOutputBitDepthC( m_Enc3DAsymLUTPPS.getOutputBitDepthC() ); 4274 } 4275 4276 Void TEncGOP::downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest) 4277 { 4278 Int inputBitDepth = g_bitDepthYLayer[m_layerId]; 4279 Int outputBitDepth = g_bitDepthYLayer[m_layerId]; 4280 { 4281 pcYuvSrc->setBorderExtension(false); 4282 pcYuvSrc->extendPicBorder (); // extend the border. 4283 pcYuvSrc->setBorderExtension(false); 4284 4285 Int iWidth = pcYuvSrc->getWidth(); 4286 Int iHeight =pcYuvSrc->getHeight(); 4287 4288 if(!m_temp) 4289 initDs(iWidth, iHeight, m_pcCfg->getIntraPeriod()>1); 4290 4291 filterImg(pcYuvSrc->getLumaAddr(), pcYuvSrc->getStride(), pcYuvDest->getLumaAddr(), pcYuvDest->getStride(), iHeight, iWidth, inputBitDepth-outputBitDepth, 0); 4292 filterImg(pcYuvSrc->getCbAddr(), pcYuvSrc->getCStride(), pcYuvDest->getCbAddr(), pcYuvDest->getCStride(), iHeight>>1, iWidth>>1, inputBitDepth-outputBitDepth, 1); 4293 filterImg(pcYuvSrc->getCrAddr(), pcYuvSrc->getCStride(), pcYuvDest->getCrAddr(), pcYuvDest->getCStride(), iHeight>>1, iWidth>>1, inputBitDepth-outputBitDepth, 2); 4294 } 4295 } 4296 const int TEncGOP::m_phase_filter_0_t0[4][13]={ 4297 {0, 2, -3, -9, 6, 39, 58, 39, 6, -9, -3, 2, 0}, 4298 {0, 0, 0, -2, 8,-20, 116, 34, -10, 2, 0, 0, 0}, //{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, // 4299 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4300 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8,-1, 1} 4301 }; 4302 4303 const int TEncGOP::m_phase_filter_0_t1[4][13]={ 4304 {0, 4, 0, -12, 0, 40, 64, 40, 0, -12, 0, 4, 0}, 4305 {0, 0, 0, -2, 8,-20, 116,34,-10, 2, 0, 0, 0}, //{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, // 4306 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4307 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8,-1, 1} 4308 }; 4309 const int TEncGOP::m_phase_filter_0_t1_chroma[4][13]={ 4310 {0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0}, 4311 {0, 0, 0, -2, 8,-20, 116,34,-10, 2, 0, 0, 0}, //{0, 1, -1, -8, -1, 31, 57, 47, 13, -7, -5, 1, 0}, // 4312 {0, 1, 0, -7, -5, 22, 53, 53, 22, -5, -7, 0, 1}, 4313 {0, 0, 1, -5, -7, 13, 47, 57, 31, -1, -8,-1, 1} 4314 }; 4315 4316 const int TEncGOP::m_phase_filter_1[8][13]={ 4317 {0, 0, 5, -6, -10,37, 76, 37,-10, -6, 5, 0, 0}, 4318 {0, -1, 5, -3, -12,29, 75, 45, -7, -8, 5, 0, 0}, 4319 {0, -1, 4, -1, -13,22, 73, 52, -3, -10, 4, 1, 0}, 4320 {0, -1, 4, 1, -13,14, 70, 59, 2, -12, 3, 2, -1}, 4321 {0, -1, 3, 2, -13, 8, 65, 65, 8, -13, 2, 3, -1}, 4322 {0, -1, 2, 3, -12, 2, 59, 70, 14, -13, 1, 4, -1}, 4323 {0, 0, 1, 4, -10,-3, 52, 73, 22, -13,-1, 4, -1}, 4324 {0, 0, 0, 5, -8,-7, 45, 75, 29, -12,-3, 5, -1} 4325 }; 4326 4327 Void TEncGOP::filterImg( 4328 Pel *src, 4329 Int iSrcStride, 4330 Pel *dst, 4331 Int iDstStride, 4332 Int height1, 4333 Int width1, 4334 Int shift, 4335 Int plane) 4336 { 4337 Int length = m_iTap; 4338 Int height2,width2; 4339 Int k,iSum; 4340 Int i0, div_i0, i1; 4341 Int j0, div_j0, j1; 4342 const Int *p_filter; 4343 Pel *p_src, *p_dst; 4344 Pel *p_src_line, *p_dst_line; 4345 Int **p_temp, *p_tmp; 4346 Int shift2 = 2*7+shift; 4347 Int shift_round = (1 << (shift2 - 1)); 4348 Int iMax = (1<<(g_bitDepthY-shift))-1; 4349 height2 = (height1 * m_iM) / m_iN; 4350 width2 = (width1 * m_iM) / m_iN; 4351 4352 m_phase_filter = plane? m_phase_filter_chroma : m_phase_filter_luma; 4353 4354 // horizontal filtering 4355 p_src_line = src; 4356 for(j1 = 0; j1 < height1; j1++) 4357 { 4358 i0=-m_iN; 4359 p_tmp = m_temp[j1]; 4360 4361 for(i1 = 0; i1 < width2; i1++) 4362 { 4363 i0 += m_iN; 4364 div_i0 = (i0 / m_iM); 4365 p_src = p_src_line + ( div_i0 - (length >> 1)); 4366 p_filter = m_phase_filter[i0 - div_i0 * m_iM]; // phase_filter[i0 % M] 4367 iSum = 0; 4368 for(k = 0; k < length; k++) 4369 { 4370 iSum += (*p_src++) * (*p_filter++); 4371 } 4372 *p_tmp++ = iSum; 4373 } 4374 p_src_line += iSrcStride; 4375 } 4376 4377 // pad temp (vertical) 4378 for (k=-(length>>1); k<0; k++) 4379 memcpy(m_temp[k], m_temp[0], width2*sizeof(int)); 4380 for (k=height1; k<(height1+(length>>1)); k++) 4381 memcpy(m_temp[k], m_temp[k-1], (width2)* sizeof(int)); 4382 4383 // vertical filtering 4384 j0 = (plane == 0) ? -m_iN : -(m_iN-1); 4385 4386 p_dst_line = dst; 4387 for(j1 = 0; j1 < height2; j1++) 4388 { 4389 j0 += m_iN; 4390 div_j0 = (j0 / m_iM); 4391 p_dst = p_dst_line; 4392 p_temp = &m_temp[div_j0 - (length>>1)]; 4393 p_filter = m_phase_filter[j0 - div_j0 * m_iM]; // phase_filter[j0 % M] 4394 for(i1 = 0; i1 < width2;i1++) 4395 { 4396 iSum=0; 4397 for(k = 0; k < length; k++) 4398 { 4399 iSum += p_temp[k][i1] * p_filter[k]; 4400 } 4401 iSum=((iSum + shift_round) >> shift2); 4402 *p_dst++ = (short)(iSum > iMax ? iMax : (iSum < 0 ? 0 : iSum)); 4403 } 4404 p_dst_line += iDstStride; 4405 } 4406 } 4407 4408 Void TEncGOP::initDs(Int iWidth, Int iHeight, Int iType) 4409 { 4410 m_iTap = 13; 4411 if(g_posScalingFactor[0][0] == (1<<15)) 4412 { 4413 m_iM = 4; 4414 m_iN = 8; 4415 m_phase_filter_luma = iType? m_phase_filter_0_t1 : m_phase_filter_0_t0; 4416 m_phase_filter_chroma = m_phase_filter_0_t1_chroma; 4417 } 4418 else 4419 { 4420 m_iM = 8; 4421 m_iN = 12; 4422 m_phase_filter_luma = m_phase_filter_chroma = m_phase_filter_1; 4423 m_phase_filter = m_phase_filter_1; 4424 } 4425 4426 get_mem2DintWithPad (&m_temp, iHeight, iWidth*m_iM/m_iN, m_iTap>>1, 0); 4427 } 4428 4429 Int TEncGOP::get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX) 4430 { 4431 Int i; 4432 Int *curr = NULL; 4433 Int iHeight, iWidth; 4434 4435 iHeight = dim0+2*iPadY; 4436 iWidth = dim1+2*iPadX; 4437 (*array2D) = (Int**)malloc(iHeight*sizeof(Int*)); 4438 *(*array2D) = (Int* )xMalloc(Int, iHeight*iWidth); 4439 4440 (*array2D)[0] += iPadX; 4441 curr = (*array2D)[0]; 4442 for(i = 1 ; i < iHeight; i++) 4443 { 4444 curr += iWidth; 4445 (*array2D)[i] = curr; 4446 } 4447 (*array2D) = &((*array2D)[iPadY]); 4448 4449 return 0; 4450 } 4451 4452 Void TEncGOP::free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX) 4453 { 4454 if (array2D) 4455 { 4456 if (*array2D) 4457 xFree(array2D[-iPadY]-iPadX); 4458 else 4459 printf("free_mem2DintWithPad: trying to free unused memory\r\nPress Any Key\r\n"); 4460 4461 free (&array2D[-iPadY]); 4462 } 4463 else 4464 { 4465 printf("free_mem2DintWithPad: trying to free unused memory\r\nPress Any Key\r\n"); 4466 } 4467 } 4468 #endif 3830 4469 #endif //SVC_EXTENSION 3831 4470 -
trunk/source/Lib/TLibEncoder/TEncGOP.h
r644 r713 54 54 #include "TEncSbac.h" 55 55 #include "SEIwrite.h" 56 #if Q0048_CGS_3D_ASYMLUT 57 #include "TEnc3DAsymLUT.h" 58 #endif 56 59 57 60 #include "TEncAnalyze.h" … … 82 85 Int m_iNumPicCoded; 83 86 Bool m_bFirst; 87 #if ALLOW_RECOVERY_POINT_AS_RAP 88 Int m_iLastRecoveryPicPOC; 89 #endif 84 90 85 91 // Access channel … … 132 138 TEncSearch* m_pcPredSearch; ///< encoder search class 133 139 #endif 140 #if Q0048_CGS_3D_ASYMLUT 141 TEnc3DAsymLUT m_Enc3DAsymLUTPicUpdate; 142 TEnc3DAsymLUT m_Enc3DAsymLUTPPS; 143 TComPicYuv* m_pColorMappedPic; 144 145 Int m_iTap; 146 const Int (*m_phase_filter)[13]; 147 const Int (*m_phase_filter_luma)[13]; 148 const Int (*m_phase_filter_chroma)[13]; 149 Int m_iM, m_iN; 150 static const Int m_phase_filter_0_t0[4][13]; 151 static const Int m_phase_filter_0_t1[4][13]; 152 static const Int m_phase_filter_0_t1_chroma[4][13]; 153 static const Int m_phase_filter_1[8][13]; 154 Int **m_temp; 155 #endif 134 156 #endif 135 157 … … 187 209 188 210 SEIToneMappingInfo* xCreateSEIToneMappingInfo(); 211 #if Q0074_SEI_COLOR_MAPPING 212 SEIColorMappingInfo* xCreateSEIColorMappingInfo( Char* file ); 213 #endif 189 214 190 215 Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps); … … 214 239 SEIScalableNesting* xCreateBspNestingSEI(TComSlice *pcSlice); 215 240 #endif 241 #if Q0048_CGS_3D_ASYMLUT 242 Void xDetermin3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS ); 243 Void downScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest); 244 Void downScaleComponent2x2( const Pel* pSrc, Pel* pDest, const Int iSrcStride, const Int iDestStride, const Int iSrcWidth, const Int iSrcHeight, const Int inputBitDepth, const Int outputBitDepth ); 245 inline Short xClip( Short x , Int bitdepth ); 246 Void initDs(Int iWidth, Int iHeight, Int iType); 247 Void filterImg( 248 Pel *src, 249 Int iSrcStride, 250 Pel *dst, 251 Int iDstStride, 252 Int height1, 253 Int width1, 254 Int shift, 255 Int plane); 256 257 Int get_mem2DintWithPad(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX); 258 Void free_mem2DintWithPad(Int **array2D, Int iPadY, Int iPadX); 259 #endif 216 260 #endif //SVC_EXTENSION 217 261 };// END CLASS DEFINITION TEncGOP -
trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
r644 r713 952 952 for (y=0; y<endY; y++) 953 953 { 954 #if SAO_SGN_FUNC 955 signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]); 956 #else 954 957 signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]]; 958 #endif 955 959 for (x=startX; x<endX; x++) 956 960 { 961 #if SAO_SGN_FUNC 962 signRight = (Char)sgn(srcLine[x] - srcLine[x+1]); 963 #else 957 964 signRight = (Char)m_sign[srcLine[x] - srcLine[x+1]]; 965 #endif 958 966 edgeType = signRight + signLeft; 959 967 signLeft = -signRight; … … 975 983 for(y=0; y<skipLinesB[typeIdx]; y++) 976 984 { 985 #if SAO_SGN_FUNC 986 signLeft = (Char)sgn(srcLine[startX] - srcLine[startX-1]); 987 #else 977 988 signLeft = (Char)m_sign[srcLine[startX] - srcLine[startX-1]]; 989 #endif 978 990 for (x=startX; x<endX; x++) 979 991 { 992 #if SAO_SGN_FUNC 993 signRight = (Char)sgn(srcLine[x] - srcLine[x+1]); 994 #else 980 995 signRight = (Char)m_sign[srcLine[x] - srcLine[x+1]]; 996 #endif 981 997 edgeType = signRight + signLeft; 982 998 signLeft = -signRight; … … 1026 1042 #endif 1027 1043 { 1044 #if SAO_SGN_FUNC 1045 signUpLine[x] = (Char)sgn(srcLine[x] - srcLineAbove[x]); 1046 #else 1028 1047 signUpLine[x] = (Char)m_sign[srcLine[x] - srcLineAbove[x]]; 1048 #endif 1029 1049 } 1030 1050 … … 1040 1060 #endif 1041 1061 { 1062 #if SAO_SGN_FUNC 1063 signDown = (Char)sgn(srcLine[x] - srcLineBelow[x]); 1064 #else 1042 1065 signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x]]; 1066 #endif 1043 1067 edgeType = signDown + signUpLine[x]; 1044 1068 signUpLine[x]= -signDown; … … 1065 1089 for (x=startX; x<endX; x++) 1066 1090 { 1091 #if SAO_SGN_FUNC 1092 edgeType = sgn(srcLine[x] - srcLineBelow[x]) + sgn(srcLine[x] - srcLineAbove[x]); 1093 #else 1067 1094 edgeType = m_sign[srcLine[x] - srcLineBelow[x]] + m_sign[srcLine[x] - srcLineAbove[x]]; 1095 #endif 1068 1096 diff [edgeType] += (orgLine[x] - srcLine[x]); 1069 1097 count[edgeType] ++; … … 1108 1136 for (x=startX; x<endX+1; x++) 1109 1137 { 1138 #if SAO_SGN_FUNC 1139 signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x-1]); 1140 #else 1110 1141 signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x-1]]; 1142 #endif 1111 1143 } 1112 1144 … … 1122 1154 for(x=firstLineStartX; x<firstLineEndX; x++) 1123 1155 { 1156 #if SAO_SGN_FUNC 1157 edgeType = sgn(srcLine[x] - srcLineAbove[x-1]) - signUpLine[x+1]; 1158 #else 1124 1159 edgeType = m_sign[srcLine[x] - srcLineAbove[x-1]] - signUpLine[x+1]; 1160 #endif 1125 1161 diff [edgeType] += (orgLine[x] - srcLine[x]); 1126 1162 count[edgeType] ++; … … 1137 1173 for (x=startX; x<endX; x++) 1138 1174 { 1175 #if SAO_SGN_FUNC 1176 signDown = (Char)sgn(srcLine[x] - srcLineBelow[x+1]); 1177 #else 1139 1178 signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x+1]] ; 1179 #endif 1140 1180 edgeType = signDown + signUpLine[x]; 1141 1181 diff [edgeType] += (orgLine[x] - srcLine[x]); … … 1144 1184 signDownLine[x+1] = -signDown; 1145 1185 } 1186 #if SAO_SGN_FUNC 1187 signDownLine[startX] = (Char)sgn(srcLineBelow[startX] - srcLine[startX-1]); 1188 #else 1146 1189 signDownLine[startX] = (Char)m_sign[srcLineBelow[startX] - srcLine[startX-1]]; 1190 #endif 1147 1191 1148 1192 signTmpLine = signUpLine; … … 1168 1212 for (x=startX; x< endX; x++) 1169 1213 { 1214 #if SAO_SGN_FUNC 1215 edgeType = sgn(srcLine[x] - srcLineBelow[x+1]) + sgn(srcLine[x] - srcLineAbove[x-1]); 1216 #else 1170 1217 edgeType = m_sign[srcLine[x] - srcLineBelow[x+1]] + m_sign[srcLine[x] - srcLineAbove[x-1]]; 1218 #endif 1171 1219 diff [edgeType] += (orgLine[x] - srcLine[x]); 1172 1220 count[edgeType] ++; … … 1206 1254 for (x=startX-1; x<endX; x++) 1207 1255 { 1256 #if SAO_SGN_FUNC 1257 signUpLine[x] = (Char)sgn(srcLineBelow[x] - srcLine[x+1]); 1258 #else 1208 1259 signUpLine[x] = (Char)m_sign[srcLineBelow[x] - srcLine[x+1]]; 1260 #endif 1209 1261 } 1210 1262 … … 1225 1277 for(x=firstLineStartX; x<firstLineEndX; x++) 1226 1278 { 1279 #if SAO_SGN_FUNC 1280 edgeType = sgn(srcLine[x] - srcLineAbove[x+1]) - signUpLine[x-1]; 1281 #else 1227 1282 edgeType = m_sign[srcLine[x] - srcLineAbove[x+1]] - signUpLine[x-1]; 1283 #endif 1228 1284 diff [edgeType] += (orgLine[x] - srcLine[x]); 1229 1285 count[edgeType] ++; … … 1240 1296 for(x=startX; x<endX; x++) 1241 1297 { 1298 #if SAO_SGN_FUNC 1299 signDown = (Char)sgn(srcLine[x] - srcLineBelow[x-1]); 1300 #else 1242 1301 signDown = (Char)m_sign[srcLine[x] - srcLineBelow[x-1]] ; 1302 #endif 1243 1303 edgeType = signDown + signUpLine[x]; 1244 1304 … … 1248 1308 signUpLine[x-1] = -signDown; 1249 1309 } 1310 #if SAO_SGN_FUNC 1311 signUpLine[endX-1] = (Char)sgn(srcLineBelow[endX-1] - srcLine[endX]); 1312 #else 1250 1313 signUpLine[endX-1] = (Char)m_sign[srcLineBelow[endX-1] - srcLine[endX]]; 1314 #endif 1251 1315 srcLine += srcStride; 1252 1316 orgLine += orgStride; … … 1267 1331 for (x=startX; x<endX; x++) 1268 1332 { 1333 #if SAO_SGN_FUNC 1334 edgeType = sgn(srcLine[x] - srcLineBelow[x-1]) + sgn(srcLine[x] - srcLineAbove[x+1]); 1335 #else 1269 1336 edgeType = m_sign[srcLine[x] - srcLineBelow[x-1]] + m_sign[srcLine[x] - srcLineAbove[x+1]]; 1337 #endif 1270 1338 diff [edgeType] += (orgLine[x] - srcLine[x]); 1271 1339 count[edgeType] ++; -
trunk/source/Lib/TLibEncoder/TEncSbac.cpp
r644 r713 248 248 } 249 249 250 Void TEncSbac::codePPS( TComPPS* pcPPS ) 250 Void TEncSbac::codePPS( TComPPS* pcPPS 251 #if Q0048_CGS_3D_ASYMLUT 252 , TEnc3DAsymLUT * pc3DAsymLUT 253 #endif 254 ) 251 255 { 252 256 assert (0); -
trunk/source/Lib/TLibEncoder/TEncSbac.h
r644 r713 92 92 Void codeVPS ( TComVPS* pcVPS ); 93 93 Void codeSPS ( TComSPS* pcSPS ); 94 Void codePPS ( TComPPS* pcPPS ); 94 Void codePPS ( TComPPS* pcPPS 95 #if Q0048_CGS_3D_ASYMLUT 96 , TEnc3DAsymLUT * pc3DAsymLUT 97 #endif 98 ); 95 99 Void codeSliceHeader ( TComSlice* pcSlice ); 96 100 Void codeTilesWPPEntryPoint( TComSlice* pSlice ); 97 #if POC_RESET_IDC_SIGNALLING98 Void codeSliceHeaderExtn ( TComSlice* pSlice, Int shBitsWrittenTillNow );99 #endif100 101 Void codeTerminatingBit ( UInt uilsLast ); 101 102 Void codeSliceFinish (); … … 108 109 109 110 #if SVC_EXTENSION 111 #if POC_RESET_IDC_SIGNALLING 112 Void codeSliceHeaderExtn ( TComSlice* pSlice, Int shBitsWrittenTillNow ); 113 #endif 110 114 Void codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal); 111 115 Void codeSAOBlkParam(SAOBlkParam& saoBlkParam -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r595 r713 2398 2398 { 2399 2399 UInt uiDepth = pcCU->getDepth(0); 2400 UInt uiNumPU = pcCU->getNumPart Inter();2400 UInt uiNumPU = pcCU->getNumPartitions(); 2401 2401 UInt uiInitTrDepth = pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1; 2402 2402 UInt uiWidth = pcCU->getWidth (0) >> uiInitTrDepth; … … 3130 3130 TComMv cMvTemp[2][33]; 3131 3131 3132 Int iNumPart = pcCU->getNumPart Inter();3132 Int iNumPart = pcCU->getNumPartitions(); 3133 3133 Int iNumPredDir = pcCU->getSlice()->isInterP() ? 1 : 2; 3134 3134 … … 4612 4612 4613 4613 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] ); 4614 #if 0 // check 4615 { 4616 m_pcEntropyCoder->resetBits(); 4617 m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0) ); 4618 const UInt uiBitsForCoeff = m_pcEntropyCoder->getNumberOfWrittenBits(); 4619 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] ); 4620 if( uiBitsForCoeff != uiBits ) 4621 assert( 0 ); 4622 } 4623 #endif 4614 4624 4615 uiBits = 0; 4625 4616 { -
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r644 r713 225 225 Int depth; 226 226 { 227 #if FIX_FIELD_DEPTH 228 Int poc = rpcSlice->getPOC(); 229 if(isField) 230 { 231 poc = (poc/2)%(m_pcCfg->getGOPSize()/2); 232 } 233 else 234 { 235 poc = poc%m_pcCfg->getGOPSize(); 236 } 237 #else 227 238 Int poc = rpcSlice->getPOC()%m_pcCfg->getGOPSize(); 239 #endif 228 240 if ( poc == 0 ) 229 241 { … … 248 260 } 249 261 } 262 #if FIX_FIELD_DEPTH 263 #if HARMONIZE_GOP_FIRST_FIELD_COUPLE 264 if(poc != 0) 265 { 266 #endif 267 if(isField && rpcSlice->getPOC()%2 == 1) 268 { 269 depth ++; 270 } 271 #if HARMONIZE_GOP_FIRST_FIELD_COUPLE 272 } 273 #endif 274 #endif 250 275 } 251 276 … … 254 279 255 280 eSliceType=B_SLICE; 281 #if EFFICIENT_FIELD_IRAP 282 if(!(isField && pocLast == 1)) 283 { 284 #endif // EFFICIENT_FIELD_IRAP 285 #if ALLOW_RECOVERY_POINT_AS_RAP 286 if(m_pcCfg->getDecodingRefreshType() == 3) 287 { 288 eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 289 } 290 else 291 { 256 292 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 293 } 294 #else 295 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 296 #endif 297 #if EFFICIENT_FIELD_IRAP 298 } 299 #endif 257 300 258 301 rpcSlice->setSliceType ( eSliceType ); … … 423 466 #if HB_LAMBDA_FOR_LDC 424 467 // restore original slice type 468 469 #if EFFICIENT_FIELD_IRAP 470 if(!(isField && pocLast == 1)) 471 { 472 #endif // EFFICIENT_FIELD_IRAP 473 #if ALLOW_RECOVERY_POINT_AS_RAP 474 if(m_pcCfg->getDecodingRefreshType() == 3) 475 { 476 eSliceType = (pocLast == 0 || (pocCurr) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 477 478 } 479 else 480 { 425 481 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 482 } 483 #else 484 eSliceType = (pocLast == 0 || (pocCurr - isField) % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 485 #endif 486 #if EFFICIENT_FIELD_IRAP 487 } 488 #endif // EFFICIENT_FIELD_IRAP 426 489 427 490 #if SVC_EXTENSION … … 544 607 // store lambda 545 608 slice->setSliceQp( sliceQP ); 609 #if ADAPTIVE_QP_SELECTION 546 610 slice->setSliceQpBase ( sliceQP ); 611 #endif 547 612 m_pcRdCost ->setLambda( lambda ); 548 613 // for RDO … … 1041 1106 1042 1107 m_pcRateCtrl->setRCQP( estQP ); 1108 #if ADAPTIVE_QP_SELECTION 1043 1109 pcCU->getSlice()->setSliceQpBase( estQP ); 1110 #endif 1044 1111 } 1045 1112 -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r644 r713 795 795 Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] ); 796 796 797 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths ) 797 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths 798 #if Q0048_CGS_3D_ASYMLUT 799 || m_cPPS.getCGSFlag() > 0 800 #endif 801 #if LAYER_CTB 802 || pcEncTopBase->getSPS()->getMaxCUWidth() != m_cSPS.getMaxCUWidth() || pcEncTopBase->getSPS()->getMaxCUHeight() != m_cSPS.getMaxCUHeight() || pcEncTopBase->getSPS()->getMaxCUDepth() != m_cSPS.getMaxCUDepth() 803 #endif 804 ) 798 805 #else 799 806 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) … … 857 864 Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] ); 858 865 859 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths ) 866 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths 867 #if Q0048_CGS_3D_ASYMLUT 868 || m_cPPS.getCGSFlag() > 0 869 #endif 870 #if LAYER_CTB 871 || pcEncTopBase->getSPS()->getMaxCUWidth() != m_cSPS.getMaxCUWidth() || pcEncTopBase->getSPS()->getMaxCUHeight() != m_cSPS.getMaxCUHeight() || pcEncTopBase->getSPS()->getMaxCUDepth() != m_cSPS.getMaxCUDepth() 872 #endif 873 ) 860 874 #else 861 875 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) … … 1188 1202 } 1189 1203 #endif 1204 #if Q0048_CGS_3D_ASYMLUT 1205 m_cPPS.setCGSFlag( m_nCGSFlag ); 1206 #endif 1190 1207 } 1191 1208 -
trunk/source/Lib/TLibEncoder/TEncTop.h
r644 r713 273 273 274 274 /// encode several number of pictures until end-of-sequence 275 Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,275 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, 276 276 std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff); 277 277
Note: See TracChangeset for help on using the changeset viewer.