Changeset 294 in 3DVCSoftware for branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
- Timestamp:
- 19 Feb 2013, 20:33:52 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp
r292 r294 161 161 //DF flag 162 162 WRITE_FLAG(pcAPS->getLoopFilterOffsetInAPS()?1:0, "aps_deblocking_filter_flag"); 163 #if !SAO_UNIT_INTERLEAVING 164 //SAO flag 165 WRITE_FLAG( pcAPS->getSaoEnabled()?1:0, "aps_sample_adaptive_offset_flag"); 166 #endif 167 #if !LCU_SYNTAX_ALF 168 //ALF flag 169 WRITE_FLAG( pcAPS->getAlfEnabled()?1:0, "aps_adaptive_loop_filter_flag"); 170 #endif 171 } 172 #if LCU_SYNTAX_ALF 163 } 173 164 Void TEncCavlc::codeAPSAlflag(UInt uiCode) 174 165 { 175 166 WRITE_FLAG(uiCode, "aps_adaptive_loop_filter_flag"); 176 167 } 177 #endif178 168 179 169 Void TEncCavlc::codeDFFlag(UInt uiCode, const Char *pSymbolName) … … 186 176 } 187 177 188 #if RPS_IN_SPS189 178 Void TEncCavlc::codeShortTermRefPicSet( TComSPS* pcSPS, TComReferencePictureSet* rps ) 190 #else191 Void TEncCavlc::codeShortTermRefPicSet( TComPPS* pcPPS, TComReferencePictureSet* rps )192 #endif193 179 { 194 180 #if PRINT_RPS_INFO … … 245 231 xTracePPSHeader (pcPPS); 246 232 #endif 247 #if !RPS_IN_SPS248 TComRPSList* rpsList = pcPPS->getRPSList();249 #endif250 233 251 234 WRITE_UVLC( pcPPS->getPPSId(), "pic_parameter_set_id" ); 252 235 WRITE_UVLC( pcPPS->getSPSId(), "seq_parameter_set_id" ); 253 236 254 #if MULTIBITS_DATA_HIDING255 237 WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); 256 238 if( pcPPS->getSignHideFlag() ) … … 258 240 WRITE_CODE(pcPPS->getTSIG(), 4, "sign_hiding_threshold"); 259 241 } 260 #endif261 242 #if CABAC_INIT_FLAG 262 243 WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); 263 #endif264 #if !RPS_IN_SPS265 // RPS is put before entropy_coding_mode_flag266 // since entropy_coding_mode_flag will probably be removed from the WD267 TComReferencePictureSet* rps;268 269 WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" );270 for(UInt i=0; i < rpsList->getNumberOfReferencePictureSets(); i++)271 {272 rps = rpsList->getReferencePictureSet(i);273 codeShortTermRefPicSet(pcPPS,rps);274 }275 WRITE_FLAG( pcPPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_present_flag" );276 244 #endif 277 245 // entropy_coding_mode_flag … … 280 248 if (pcPPS->getEntropyCodingMode()) 281 249 { 282 #if !WPP_SIMPLIFICATION 283 WRITE_UVLC( pcPPS->getEntropyCodingSynchro(), "entropy_coding_synchro" ); 284 WRITE_FLAG( pcPPS->getCabacIstateReset() ? 1 : 0, "cabac_istate_reset" ); 285 #endif 286 #if !TILES_OR_ENTROPY_SYNC_IDC 287 #if !WPP_SIMPLIFICATION 288 if ( pcPPS->getEntropyCodingSynchro() ) 289 #endif 290 { 291 WRITE_UVLC( pcPPS->getNumSubstreams()-1, "num_substreams_minus1" ); 292 } 293 #endif 294 } 295 #if !H0566_TLA 296 WRITE_UVLC( pcPPS->getNumTLayerSwitchingFlags(), "num_temporal_layer_switching_point_flags" ); 297 for( UInt i = 0; i < pcPPS->getNumTLayerSwitchingFlags(); i++ ) 298 { 299 WRITE_FLAG( pcPPS->getTLayerSwitchingFlag( i ) ? 1 : 0 , "temporal_layer_switching_point_flag" ); 300 } 301 #endif 250 } 302 251 // num_ref_idx_l0_default_active_minus1 303 252 // num_ref_idx_l1_default_active_minus1 … … 313 262 WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) 314 263 WRITE_CODE( pcPPS->getWPBiPredIdc(), 2, "weighted_bipred_idc" ); // Use of Weighting Bi-Prediction (B_SLICE) 315 #if H0388316 264 WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); 317 #endif318 #if TILES_OR_ENTROPY_SYNC_IDC319 265 if(pcPPS->getSPS()->getTilesOrEntropyCodingSyncIdc()==1) 320 266 { 321 #endif322 267 WRITE_FLAG( pcPPS->getColumnRowInfoPresent(), "tile_info_present_flag" ); 323 268 WRITE_FLAG( pcPPS->getTileBehaviorControlPresentFlag(), "tile_control_present_flag"); … … 347 292 if(iNumColTilesMinus1 !=0 || iNumRowTilesMinus1 !=0) 348 293 { 349 #if !REMOVE_TILE_DEPENDENCE350 WRITE_FLAG( pcPPS->getTileBoundaryIndependenceIdr(), "tile_boundary_independence_flag" );351 if(pcPPS->getTileBoundaryIndependenceIdr() == 1)352 {353 #endif354 294 WRITE_FLAG( pcPPS->getLFCrossTileBoundaryFlag()?1 : 0, "loop_filter_across_tile_flag"); 355 #if !REMOVE_TILE_DEPENDENCE 356 } 357 #endif 358 } 359 } 360 #if TILES_OR_ENTROPY_SYNC_IDC 295 } 296 } 361 297 } 362 298 else if(pcPPS->getSPS()->getTilesOrEntropyCodingSyncIdc()==2) … … 364 300 WRITE_UVLC( pcPPS->getNumSubstreams()-1, "num_substreams_minus1" ); 365 301 } 366 #endif 367 368 #if DBL_CONTROL 302 369 303 WRITE_FLAG( pcPPS->getDeblockingFilterControlPresent()?1 : 0, "deblocking_filter_control_present_flag"); 370 #endif371 #if PARALLEL_MERGE372 304 WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); 373 #endif374 305 WRITE_FLAG( 0, "pps_extension_flag" ); 375 306 } … … 531 462 WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (), "pic_width_in_luma_samples" ); 532 463 WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(), "pic_height_in_luma_samples" ); 533 #if PIC_CROPPING534 464 WRITE_FLAG( pcSPS->getPicCroppingFlag(), "pic_cropping_flag" ); 535 465 if (pcSPS->getPicCroppingFlag()) … … 540 470 WRITE_UVLC( pcSPS->getPicCropBottomOffset(), "pic_crop_bottom_offset" ); 541 471 } 542 #endif543 472 544 473 #if FULL_NBIT … … 566 495 567 496 WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); 568 #if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER569 497 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 570 498 { … … 573 501 WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "max_latency_increase[i]" ); 574 502 } 575 #else576 WRITE_UVLC( pcSPS->getMaxNumberOfReferencePictures(), "max_num_ref_pics" );577 WRITE_UVLC( pcSPS->getNumReorderFrames(), "num_reorder_frames" );578 WRITE_UVLC(pcSPS->getMaxDecFrameBuffering(), "max_dec_frame_buffering" );579 WRITE_UVLC(pcSPS->getMaxLatencyIncrease(), "max_latency_increase" );580 #endif581 503 assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); 582 504 … … 589 511 } 590 512 591 #if H0412_REF_PIC_LIST_RESTRICTION592 513 WRITE_FLAG( pcSPS->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag" ); 593 514 if( pcSPS->getRestrictedRefPicListsFlag() ) … … 595 516 WRITE_FLAG( pcSPS->getListsModificationPresentFlag(), "lists_modification_present_flag" ); 596 517 } 597 #endif598 518 WRITE_UVLC( log2MinCUSize - 3, "log2_min_coding_block_size_minus3" ); 599 519 WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth, "log2_diff_max_min_coding_block_size" ); … … 621 541 WRITE_FLAG( pcSPS->getUseSAO() ? 1 : 0, "sample_adaptive_offset_enabled_flag"); 622 542 WRITE_FLAG( pcSPS->getUseALF () ? 1 : 0, "adaptive_loop_filter_enabled_flag"); 623 #if LCU_SYNTAX_ALF624 543 if(pcSPS->getUseALF()) 625 544 { 626 545 WRITE_FLAG( (pcSPS->getUseALFCoefInSlice()) ? 1 : 0, "alf_coef_in_slice_flag"); 627 546 } 628 #endif629 547 630 548 if( pcSPS->getUsePCM() ) … … 637 555 WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0, "temporal_id_nesting_flag" ); 638 556 639 #if RPS_IN_SPS640 557 TComRPSList* rpsList = pcSPS->getRPSList(); 641 558 TComReferencePictureSet* rps; … … 648 565 } 649 566 WRITE_FLAG( pcSPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_present_flag" ); 650 #endif651 #if !PIC_CROPPING652 //!!!KS: Syntax not in WD !!!653 654 xWriteUvlc ( pcSPS->getPad (0) );655 xWriteUvlc ( pcSPS->getPad (1) );656 #endif657 567 // AMVP mode for each depth 658 568 for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++) … … 661 571 } 662 572 663 #if TILES_WPP_ENTRY_POINT_SIGNALLING664 573 Int tilesOrEntropyCodingSyncIdc = 0; 665 574 if ( pcSPS->getNumColumnsMinus1() > 0 || pcSPS->getNumRowsMinus1() > 0) … … 673 582 pcSPS->setTilesOrEntropyCodingSyncIdc( tilesOrEntropyCodingSyncIdc ); 674 583 WRITE_CODE(tilesOrEntropyCodingSyncIdc, 2, "tiles_or_entropy_coding_sync_idc"); 675 #endif 676 677 #if TILES_OR_ENTROPY_SYNC_IDC 584 678 585 if(tilesOrEntropyCodingSyncIdc == 1) 679 586 { 680 #endif681 587 WRITE_UVLC( pcSPS->getNumColumnsMinus1(), "num_tile_columns_minus1" ); 682 588 WRITE_UVLC( pcSPS->getNumRowsMinus1(), "num_tile_rows_minus1" ); … … 697 603 if( pcSPS->getNumColumnsMinus1() !=0 || pcSPS->getNumRowsMinus1() != 0) 698 604 { 699 #if !REMOVE_TILE_DEPENDENCE700 WRITE_FLAG( pcSPS->getTileBoundaryIndependenceIdr(), "tile_boundary_independence_flag" );701 if(pcSPS->getTileBoundaryIndependenceIdr() == 1)702 {703 #endif704 605 WRITE_FLAG( pcSPS->getLFCrossTileBoundaryFlag()?1 : 0, "loop_filter_across_tile_flag"); 705 #if !REMOVE_TILE_DEPENDENCE 706 } 707 #endif 708 } 709 #if TILES_OR_ENTROPY_SYNC_IDC 710 } 711 #endif 606 } 607 } 712 608 WRITE_FLAG( 1, "sps_extension_flag" ); 713 609 #if !QC_MVHEVC_B0046 … … 896 792 WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "pic_parameter_set_id" ); 897 793 #endif 898 #if H0388899 794 if( pcSlice->getPPS()->getOutputFlagPresentFlag() ) 900 795 { 901 796 WRITE_FLAG( pcSlice->getPicOutputFlag() ? 1 : 0, "pic_output_flag" ); 902 797 } 903 #endif904 798 #if QC_REM_IDV_B0046 905 799 if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_IDR && pcSlice->getViewId() == 0) … … 924 818 { 925 819 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); 926 #if RPS_IN_SPS927 820 codeShortTermRefPicSet(pcSlice->getSPS(), rps); 928 #else929 codeShortTermRefPicSet(pcSlice->getPPS(), rps);930 #endif931 821 } 932 822 else … … 935 825 WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" ); 936 826 } 937 #if RPS_IN_SPS938 827 if(pcSlice->getSPS()->getLongTermRefsPresent()) 939 #else940 if(pcSlice->getPPS()->getLongTermRefsPresent())941 #endif942 828 { 943 829 WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics"); 944 830 Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC(); 945 831 Int prev = 0; 946 #if LTRP_MULT947 832 Int prevDeltaPocLt=0; 948 833 Int currDeltaPocLt=0; 949 #endif950 834 for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--) 951 835 { 952 836 WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt"); 953 837 954 #if LTRP_MULT955 838 currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt; 956 839 … … 983 866 } 984 867 prevDeltaPocLt=currDeltaPocLt; 985 #endif986 868 prev = rps->getDeltaPOC(i); 987 869 WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag"); … … 995 877 { 996 878 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); 997 #if RPS_IN_SPS998 879 codeShortTermRefPicSet(pcSlice->getSPS(), rps); 999 #else1000 codeShortTermRefPicSet(pcSlice->getPPS(), rps);1001 #endif1002 880 } 1003 881 else … … 1006 884 WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" ); 1007 885 } 1008 #if RPS_IN_SPS1009 886 if(pcSlice->getSPS()->getLongTermRefsPresent()) 1010 #else1011 if(pcSlice->getPPS()->getLongTermRefsPresent())1012 #endif1013 887 { 1014 888 WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics"); 1015 889 Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC(); 1016 890 Int prev = 0; 1017 #if LTRP_MULT1018 891 Int prevDeltaPocLt=0; 1019 892 Int currDeltaPocLt=0; 1020 #endif1021 893 for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--) 1022 894 { 1023 895 WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt"); 1024 896 1025 #if LTRP_MULT1026 897 currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt; 1027 898 … … 1054 925 } 1055 926 prevDeltaPocLt=currDeltaPocLt; 1056 #endif1057 927 prev = rps->getDeltaPOC(i); 1058 928 WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag"); … … 1066 936 if (pcSlice->getSPS()->getUseALF()) 1067 937 { 1068 #if !LCU_SYNTAX_ALF1069 if (pcSlice->getAlfEnabledFlag())1070 {1071 assert (pcSlice->getAPS()->getAlfEnabled());1072 }1073 #endif1074 938 WRITE_FLAG( pcSlice->getAlfEnabledFlag(), "ALF on/off flag in slice header" ); 1075 939 } 1076 940 if (pcSlice->getSPS()->getUseSAO()) 1077 941 { 1078 #if SAO_UNIT_INTERLEAVING1079 942 WRITE_FLAG( pcSlice->getSaoInterleavingFlag(), "SAO interleaving flag" ); 1080 #endif1081 943 assert (pcSlice->getSaoEnabledFlag() == pcSlice->getAPS()->getSaoEnabled()); 1082 944 WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "SAO on/off flag in slice header" ); 1083 #if SAO_UNIT_INTERLEAVING1084 945 if (pcSlice->getSaoInterleavingFlag()&&pcSlice->getSaoEnabledFlag() ) 1085 946 { … … 1087 948 WRITE_FLAG( pcSlice->getAPS()->getSaoParam()->bSaoFlag[2], "SAO on/off flag for Cr in slice header" ); 1088 949 } 1089 #endif1090 950 } 1091 951 WRITE_UVLC( pcSlice->getAPS()->getAPSID(), "aps_id"); … … 1110 970 pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 1111 971 } 1112 #if H0412_REF_PIC_LIST_RESTRICTION1113 972 if( pcSlice->getSPS()->getListsModificationPresentFlag() ) 1114 973 { 1115 #endif1116 974 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 1117 #if H0137_0138_LIST_MODIFICATION1118 975 if( !pcSlice->isIntra() ) 1119 976 { … … 1158 1015 } 1159 1016 } 1160 #else 1161 if(!pcSlice->isIntra()) 1162 { 1163 WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0() ? 1 : 0, "ref_pic_list_modification_flag" ); 1164 for(Int i = 0; i < refPicListModification->getNumberOfRefPicListModificationsL0(); i++) 1165 { 1166 WRITE_UVLC( refPicListModification->getListIdcL0(i), "ref_pic_list_modification_idc"); 1167 WRITE_UVLC( refPicListModification->getRefPicSetIdxL0(i), "ref_pic_set_idx"); 1168 } 1169 if(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0()) 1170 WRITE_UVLC( 3, "ref_pic_list_modification_idc"); 1171 } 1172 if(pcSlice->isInterB()) 1173 { 1174 WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1() ? 1 : 0, "ref_pic_list_modification_flag" ); 1175 for(Int i = 0; i < refPicListModification->getNumberOfRefPicListModificationsL1(); i++) 1176 { 1177 WRITE_UVLC( refPicListModification->getListIdcL1(i), "ref_pic_list_modification_idc"); 1178 WRITE_UVLC( refPicListModification->getRefPicSetIdxL1(i), "ref_pic_set_idx"); 1179 } 1180 if(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1()) 1181 WRITE_UVLC( 3, "ref_pic_list_modification_idc"); 1182 } 1183 #endif 1184 } 1185 #if H0412_REF_PIC_LIST_RESTRICTION 1186 } 1187 #endif 1017 } 1018 } 1188 1019 // ref_pic_list_combination( ) 1189 1020 // maybe move to own function? … … 1195 1026 WRITE_UVLC( pcSlice->getNumRefIdx(REF_PIC_LIST_C) - 1, "num_ref_idx lc_active_minus1"); 1196 1027 1197 #if H0412_REF_PIC_LIST_RESTRICTION1198 1028 if( pcSlice->getSPS()->getListsModificationPresentFlag() ) 1199 1029 { 1200 #endif1201 1030 WRITE_FLAG( pcSlice->getRefPicListModificationFlagLC() ? 1 : 0, "ref_pic_list_modification_flag_lc" ); 1202 1031 if(pcSlice->getRefPicListModificationFlagLC()) … … 1205 1034 { 1206 1035 WRITE_FLAG( pcSlice->getListIdFromIdxOfLC(i), "pic_from_list_0_flag" ); 1207 #if H0137_0138_LIST_MODIFICATION1208 1036 if (((pcSlice->getListIdFromIdxOfLC(i)==REF_PIC_LIST_0) && pcSlice->getNumRefIdx( REF_PIC_LIST_0 )>1 ) || ((pcSlice->getListIdFromIdxOfLC(i)==REF_PIC_LIST_1) && pcSlice->getNumRefIdx( REF_PIC_LIST_1 )>1 ) ) 1209 1037 { 1210 1038 WRITE_UVLC( pcSlice->getRefIdxFromIdxOfLC(i), "ref_idx_list_curr" ); 1211 1039 } 1212 #else1213 WRITE_UVLC( pcSlice->getRefIdxFromIdxOfLC(i), "ref_idx_list_curr" );1214 #endif1215 1040 } 1216 1041 } 1217 #if H0412_REF_PIC_LIST_RESTRICTION 1218 } 1219 #endif 1042 } 1220 1043 } 1221 1044 } 1222 1045 1223 #if H0111_MVD_L1_ZERO1224 1046 if (pcSlice->isInterB()) 1225 1047 { 1226 1048 WRITE_FLAG( pcSlice->getMvdL1ZeroFlag() ? 1 : 0, "mvd_l1_zero_flag"); 1227 1049 } 1228 #endif1229 1050 1230 1051 if(pcSlice->getPPS()->getEntropyCodingMode() && !pcSlice->isIntra()) … … 1249 1070 Int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 ); 1250 1071 WRITE_SVLC( iCode, "slice_qp_delta" ); 1251 #if DBL_CONTROL1252 1072 if (pcSlice->getPPS()->getDeblockingFilterControlPresent()) 1253 1073 { … … 1256 1076 WRITE_FLAG(pcSlice->getInheritDblParamFromAPS(), "inherit_dbl_param_from_APS_flag"); 1257 1077 } 1258 #else1259 WRITE_FLAG(pcSlice->getInheritDblParamFromAPS(), "inherit_dbl_param_from_APS_flag");1260 #endif1261 1078 if (!pcSlice->getInheritDblParamFromAPS()) 1262 1079 { … … 1268 1085 } 1269 1086 } 1270 #if DBL_CONTROL 1271 } 1272 #endif 1087 } 1273 1088 if ( pcSlice->getSliceType() == B_SLICE ) 1274 1089 { … … 1341 1156 \param pcSlice Where we find the substream size information. 1342 1157 */ 1343 #if TILES_WPP_ENTRY_POINT_SIGNALLING1344 1158 Void TEncCavlc::codeTilesWPPEntryPoint( TComSlice* pSlice ) 1345 1159 { … … 1441 1255 delete [] entryPointOffset; 1442 1256 } 1443 #else1444 Void TEncCavlc::codeSliceHeaderSubstreamTable( TComSlice* pcSlice )1445 {1446 UInt uiNumSubstreams = pcSlice->getPPS()->getNumSubstreams();1447 UInt*puiSubstreamSizes = pcSlice->getSubstreamSizes();1448 1449 // Write header information for all substreams except the last.1450 for (UInt ui = 0; ui+1 < uiNumSubstreams; ui++)1451 {1452 UInt uiNumbits = puiSubstreamSizes[ui];1453 1454 //the 2 first bits are used to give the size of the header1455 if ( uiNumbits < (1<<8) )1456 {1457 xWriteCode(0, 2 );1458 xWriteCode(uiNumbits, 8 );1459 }1460 else if ( uiNumbits < (1<<16) )1461 {1462 xWriteCode(1, 2 );1463 xWriteCode(uiNumbits, 16 );1464 }1465 else if ( uiNumbits < (1<<24) )1466 {1467 xWriteCode(2, 2 );1468 xWriteCode(uiNumbits, 24 );1469 }1470 else if ( uiNumbits < (1<<31) )1471 {1472 xWriteCode(3, 2 );1473 xWriteCode(uiNumbits, 32 );1474 }1475 else1476 {1477 printf("Error in codeSliceHeaderTable\n");1478 exit(-1);1479 }1480 }1481 }1482 #endif1483 1257 1484 1258 Void TEncCavlc::codeTerminatingBit ( UInt uilsLast ) … … 1599 1373 } 1600 1374 1601 #if BURST_IPCM1602 1375 /** Code I_PCM information. 1603 1376 * \param pcCU pointer to CU … … 1611 1384 assert(0); 1612 1385 } 1613 #else1614 /** Code I_PCM information.1615 * \param pcCU pointer to CU1616 * \param uiAbsPartIdx CU index1617 * \returns Void1618 *1619 * If I_PCM flag indicates that the CU is I_PCM, code its PCM alignment bits and codes.1620 */1621 Void TEncCavlc::codeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx)1622 {1623 UInt uiIPCM = (pcCU->getIPCMFlag(uiAbsPartIdx) == true)? 1 : 0;1624 1625 xWriteFlag(uiIPCM);1626 1627 if (uiIPCM)1628 {1629 xWritePCMAlignZero();1630 1631 UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();1632 UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx;1633 UInt uiChromaOffset = uiLumaOffset>>2;1634 1635 Pel* piPCMSample;1636 UInt uiWidth;1637 UInt uiHeight;1638 UInt uiSampleBits;1639 UInt uiX, uiY;1640 1641 piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset;1642 uiWidth = pcCU->getWidth(uiAbsPartIdx);1643 uiHeight = pcCU->getHeight(uiAbsPartIdx);1644 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();1645 1646 for(uiY = 0; uiY < uiHeight; uiY++)1647 {1648 for(uiX = 0; uiX < uiWidth; uiX++)1649 {1650 UInt uiSample = piPCMSample[uiX];1651 1652 xWriteCode(uiSample, uiSampleBits);1653 }1654 piPCMSample += uiWidth;1655 }1656 1657 piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;1658 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;1659 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;1660 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();1661 1662 for(uiY = 0; uiY < uiHeight; uiY++)1663 {1664 for(uiX = 0; uiX < uiWidth; uiX++)1665 {1666 UInt uiSample = piPCMSample[uiX];1667 1668 xWriteCode(uiSample, uiSampleBits);1669 }1670 piPCMSample += uiWidth;1671 }1672 1673 piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;1674 uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;1675 uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;1676 uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();1677 1678 for(uiY = 0; uiY < uiHeight; uiY++)1679 {1680 for(uiX = 0; uiX < uiWidth; uiX++)1681 {1682 UInt uiSample = piPCMSample[uiX];1683 1684 xWriteCode(uiSample, uiSampleBits);1685 }1686 piPCMSample += uiWidth;1687 }1688 }1689 }1690 #endif1691 1386 1692 1387 Void TEncCavlc::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 1719 1414 Int iDQp = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx ); 1720 1415 1721 #if H0736_AVC_STYLE_QP_RANGE1722 1416 Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); 1723 1417 iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2); 1724 #endif1725 1418 1726 1419 xWriteSvlc( iDQp ); … … 1753 1446 xWriteSvlc( iCode ); 1754 1447 } 1755 #if LCU_SYNTAX_ALF1756 1448 /** Code the fixed length code (smaller than one max value) in OSALF 1757 1449 * \param idx: coded value … … 1778 1470 } 1779 1471 } 1780 #endif1781 1472 1782 1473 Void TEncCavlc::codeSaoFlag( UInt uiCode ) … … 1794 1485 xWriteSvlc( iCode ); 1795 1486 } 1796 #if SAO_UNIT_INTERLEAVING1797 1487 /** Code SAO run. 1798 1488 * \param uiCode … … 1818 1508 WRITE_CODE( uiCode, uiLength, "sao_run_diff"); 1819 1509 } 1820 #endif1821 1510 1822 1511 Void TEncCavlc::estBit( estBitsSbacStruct* pcEstBitsCabac, Int width, Int height, TextType eTType ) … … 2123 1812 Void TEncCavlc::xCodeScalingList(TComScalingList* scalingList, UInt sizeId, UInt listId) 2124 1813 { 2125 #if SCALING_LIST2126 1814 Int coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); 2127 1815 UInt* scan = g_auiFrameScanXY [ (sizeId == 0)? 1 : 2]; 2128 #else2129 Int coefNum = (Int)g_scalingListSize[sizeId];2130 UInt* scan = g_auiFrameScanXY [ sizeId + 1];2131 #endif2132 1816 Int nextCoef = SCALING_LIST_START_VALUE; 2133 1817 Int data; 2134 1818 Int *src = scalingList->getScalingListAddress(sizeId, listId); 2135 #if SCALING_LIST2136 1819 if(sizeId > SCALING_LIST_8x8 && scalingList->getUseDefaultScalingMatrixFlag(sizeId,listId)) 2137 1820 { … … 2164 1847 } 2165 1848 } 2166 #else2167 for(Int i=0;i<coefNum;i++)2168 {2169 data = src[scan[i]] - nextCoef;2170 nextCoef = src[scan[i]];2171 if(data > 127)2172 {2173 data = data - 256;2174 }2175 if(data < -128)2176 {2177 data = data + 256;2178 }2179 2180 WRITE_SVLC( data, "delta_coef");2181 }2182 #endif2183 1849 } 2184 1850 Bool TComScalingList::checkPredMode(UInt sizeId, UInt listId) … … 2186 1852 for(Int predListIdx = (Int)listId -1 ; predListIdx >= 0; predListIdx--) 2187 1853 { 2188 #if SCALING_LIST2189 1854 if( !memcmp(getScalingListAddress(sizeId,listId),getScalingListAddress(sizeId, predListIdx),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix 2190 1855 && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value 2191 #else2192 if( !memcmp(getScalingListAddress(sizeId,listId),getScalingListAddress(sizeId, predListIdx),sizeof(Int)*(Int)g_scalingListSize[sizeId])) // check value of matrix2193 #endif2194 1856 { 2195 1857 setRefMatrixId(sizeId, listId, predListIdx);
Note: See TracChangeset for help on using the changeset viewer.