Changeset 77 in 3DVCSoftware for trunk/source/Lib/TLibEncoder
- Timestamp:
- 14 Jun 2012, 16:38:29 (13 years ago)
- Location:
- trunk/source/Lib/TLibEncoder
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibEncoder/NALwrite.cpp
r56 r77 64 64 #endif 65 65 66 #if VIDYO_VPS_INTEGRATION 67 bsNALUHeader.write(nalu.m_temporalId, 3); // temporal_id 68 bsNALUHeader.write(nalu.m_layerId + 1, 5); // layer_id_plus1 69 #else 66 70 #if H0388 67 71 bsNALUHeader.write(nalu.m_temporalId, 3); // temporal_id … … 90 94 } 91 95 #endif 96 #endif 97 92 98 out.write(bsNALUHeader.getByteStream(), bsNALUHeader.getByteStreamLength()); 93 99 … … 201 207 naluDest.m_nalRefIDC = naluSrc.m_nalRefIDC; 202 208 #endif 209 #if !VIDYO_VPS_INTEGRATION 203 210 naluDest.m_viewId = naluSrc.m_viewId; 204 211 naluDest.m_isDepth = naluSrc.m_isDepth; 212 #endif 205 213 naluDest.m_temporalId = naluSrc.m_temporalId; 214 #if VIDYO_VPS_INTEGRATION 215 naluDest.m_layerId = naluSrc.m_layerId; 216 #else 217 206 218 #if !H0388 207 219 naluDest.m_OutputFlag = naluSrc.m_OutputFlag; 208 220 #endif 221 #endif 209 222 naluDest.m_Bitstream = naluSrc.m_Bitstream; 210 223 } -
trunk/source/Lib/TLibEncoder/NALwrite.h
r56 r77 62 62 NalRefIdc nalRefIDC, 63 63 #endif 64 #if VIDYO_VPS_INTEGRATION 65 unsigned layerId, 66 #else 64 67 Int viewId, 65 68 Bool isDepth, 69 #endif 66 70 unsigned temporalID = 0) 67 71 #if NAL_REF_FLAG 72 #if VIDYO_VPS_INTEGRATION 73 : NALUnit(nalUnitType, nalRefFlag, layerId, temporalID) 74 #else 68 75 : NALUnit(nalUnitType, nalRefFlag, viewId, isDepth, temporalID) 76 #endif 77 #else 78 #if VIDYO_VPS_INTEGRATION 79 : NALUnit(nalUnitType, nalRefIDC, layerId, temporalID) 69 80 #else 70 81 : NALUnit(nalUnitType, nalRefIDC, viewId, isDepth, temporalID) 82 #endif 71 83 #endif 72 84 , m_Bitstream() -
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r56 r77 375 375 } 376 376 377 #if VIDYO_VPS_INTEGRATION 378 Void TEncCavlc::codeVPS( TComVPS* pcVPS ) 379 { 380 WRITE_CODE( pcVPS->getMaxTLayers() - 1, 3, "max_temporal_layers_minus1" ); 381 WRITE_CODE( pcVPS->getMaxLayers() - 1, 5, "max_layers_minus1" ); 382 WRITE_FLAG( pcVPS->getTemporalNestingFlag() - 1, "temporal_id_nesting_flag" ); 383 WRITE_UVLC( pcVPS->getVPSId(), "video_parameter_set_id" ); 384 for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) 385 { 386 WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i), "max_dec_pic_buffering[i]" ); 387 WRITE_UVLC( pcVPS->getNumReorderPics(i), "num_reorder_pics[i]" ); 388 WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "max_latency_increase[i]" ); 389 } 390 391 WRITE_CODE( 1, 1, "bit_equal_to_one" ); 392 393 if( pcVPS->getMaxLayers() - 1 > 0 ) 394 { 395 WRITE_UVLC( pcVPS->getExtensionType(), "extension_type" ); 396 397 for(UInt i=1; i <= pcVPS->getMaxLayers()-1; i++) 398 { 399 WRITE_FLAG( pcVPS->getDependentFlag(i), "dependent_flag[i]" ); 400 if( pcVPS->getDependentFlag(i) ) 401 { 402 WRITE_UVLC( i - pcVPS->getDependentLayer(i) - 1, "delta_reference_layer_id_minus1[i]" ); 403 if( pcVPS->getExtensionType() == VPS_EXTENSION_TYPE_MULTI_VIEW ) 404 { 405 WRITE_UVLC( pcVPS->getViewId(i), "view_id[i]" ); 406 WRITE_FLAG( pcVPS->getDepthFlag(i), "depth_flag[i]" ); 407 WRITE_SVLC( pcVPS->getViewOrderIdx(i), "view_order_idx[i]" ); 408 } 409 410 } 411 } 412 } 413 414 WRITE_FLAG( 0, "vps_extension_flag" ); 415 416 //future extensions here.. 417 418 return; 419 } 420 #endif 421 377 422 #if HHI_MPI 378 423 Void TEncCavlc::codeSPS( TComSPS* pcSPS, Bool bIsDepth ) … … 388 433 WRITE_CODE( pcSPS->getLevelIdc (), 8, "level_idc" ); 389 434 WRITE_UVLC( pcSPS->getSPSId (), "seq_parameter_set_id" ); 435 #if VIDYO_VPS_INTEGRATION 436 WRITE_UVLC( pcSPS->getVPSId (), "video_parameter_set_id" ); 437 #endif 390 438 WRITE_UVLC( pcSPS->getChromaFormatIdc (), "chroma_format_idc" ); 391 439 WRITE_CODE( pcSPS->getMaxTLayers() - 1, 3, "max_temporal_layers_minus1" ); … … 727 775 { 728 776 WRITE_CODE( (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC()), pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); 729 730 if( pcSlice->get NalUnitType() != NAL_UNIT_CODED_SLICE_IDV )777 #if HHI_FIX 778 if( pcSlice->getPOC() == 0 && pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDV ) 731 779 { 732 780 TComReferencePictureSet* rps = pcSlice->getRPS(); … … 799 847 } 800 848 } 849 if( pcSlice->getPOC() != 0 ) 850 #else 851 if( pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDV ) 852 #endif 853 { 854 TComReferencePictureSet* rps = pcSlice->getRPS(); 855 if(pcSlice->getRPSidx() < 0) 856 { 857 WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); 858 #if RPS_IN_SPS 859 codeShortTermRefPicSet(pcSlice->getSPS(), rps); 860 #else 861 codeShortTermRefPicSet(pcSlice->getPPS(), rps); 862 #endif 863 } 864 else 865 { 866 WRITE_FLAG( 1, "short_term_ref_pic_set_sps_flag"); 867 WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" ); 868 } 869 #if RPS_IN_SPS 870 if(pcSlice->getSPS()->getLongTermRefsPresent()) 871 #else 872 if(pcSlice->getPPS()->getLongTermRefsPresent()) 873 #endif 874 { 875 WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics"); 876 Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC(); 877 Int prev = 0; 878 #if LTRP_MULT 879 Int prevDeltaPocLt=0; 880 Int currDeltaPocLt=0; 881 #endif 882 for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--) 883 { 884 WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt"); 885 886 #if LTRP_MULT 887 currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt; 888 889 Int deltaMsbCycle=0; 890 if( (i==(rps->getNumberOfPictures()-1)) ) 891 { 892 deltaMsbCycle=((-rps->getDeltaPOC(i))/maxPocLsb)-1; 893 } 894 else if( prevDeltaPocLt!=currDeltaPocLt ) 895 { 896 deltaMsbCycle=((-rps->getDeltaPOC(i))/maxPocLsb)-1; 897 if( ((prevDeltaPocLt==maxPocLsb-1) && (currDeltaPocLt==maxPocLsb+1)) || ((prevDeltaPocLt==maxPocLsb-2) && (currDeltaPocLt==maxPocLsb))) 898 { 899 deltaMsbCycle=deltaMsbCycle-1; 900 } 901 } 902 else 903 { 904 deltaMsbCycle=((rps->getDeltaPOC(i+1)-rps->getDeltaPOC(i))/maxPocLsb)-1; 905 } 906 907 if(deltaMsbCycle>=0) 908 { 909 WRITE_FLAG( 1, "delta_poc_msb_present_flag"); 910 WRITE_UVLC(deltaMsbCycle, "delta_poc_msb_cycle_lt_minus1"); 911 } 912 else 913 { 914 WRITE_FLAG( 0, "delta_poc_msb_present_flag"); 915 } 916 prevDeltaPocLt=currDeltaPocLt; 917 #endif 918 prev = rps->getDeltaPOC(i); 919 WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag"); 920 } 921 } 922 } 801 923 } 802 924 -
trunk/source/Lib/TLibEncoder/TEncCavlc.h
r56 r77 114 114 UInt getCoeffCost () { return m_uiCoeffCost; } 115 115 116 #if VIDYO_VPS_INTEGRATION 117 Void codeVPS ( TComVPS* pcVPS ); 118 #endif 119 116 120 #if HHI_MPI 117 121 Void codeSPS ( TComSPS* pcSPS, Bool bIsDepth ); -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r56 r77 290 290 #endif 291 291 292 #if VIDYO_VPS_INTEGRATION 293 UInt m_layerId; 294 #endif 295 292 296 Int m_viewId; 293 297 Bool m_isDepth; … … 765 769 Int getTSIG() { return m_signHidingThreshold; } 766 770 #endif 771 #if VIDYO_VPS_INTEGRATION 772 Void setLayerId ( UInt layerId ) { m_layerId = layerId; } 773 UInt getLayerId () { return m_layerId; } 774 #endif 767 775 768 776 Void setViewId ( Int viewId ) { m_viewId = viewId; } -
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r61 r77 604 604 if( bResPredAllowed ) 605 605 { 606 bResPredAvailable = rpcBestCU->getResidualSamples( 0, m_ppcResPredTmp[uiDepth] ); 606 bResPredAvailable = rpcBestCU->getResidualSamples( 0, 607 #if QC_SIMPLIFIEDIVRP_M24938 608 true , 609 #endif 610 m_ppcResPredTmp[uiDepth] ); 607 611 } 608 612 … … 698 702 if( bResPredAllowed ) 699 703 { 700 bResPredAvailable = rpcBestCU->getResidualSamples( 0, m_ppcResPredTmp[uiDepth] ); 704 bResPredAvailable = rpcBestCU->getResidualSamples( 0, 705 #if QC_SIMPLIFIEDIVRP_M24938 706 true, 707 #endif 708 m_ppcResPredTmp[uiDepth] ); 701 709 } 702 710 … … 1903 1911 1904 1912 #if HHI_INTER_VIEW_RESIDUAL_PRED 1913 #if !LG_RESTRICTEDRESPRED_M24766 1905 1914 if( rpcTempCU->getResPredFlag( 0 ) ) 1906 1915 { // subtract residual prediction from original in motion search … … 1908 1917 } 1909 1918 #endif 1919 #endif 1910 1920 1911 1921 #if AMP_MRG 1912 1922 rpcTempCU->setMergeAMP (true); 1913 1923 #if HHI_INTERVIEW_SKIP 1924 #if LG_RESTRICTEDRESPRED_M24766 1925 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcResPredTmp[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG ); 1926 #else 1914 1927 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG ); 1928 #endif 1915 1929 #else 1916 1930 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG ); … … 1925 1939 1926 1940 #if HHI_INTER_VIEW_RESIDUAL_PRED 1941 #if !LG_RESTRICTEDRESPRED_M24766 1927 1942 if( rpcTempCU->getResPredFlag( 0 ) ) 1928 1943 { // add residual prediction to original again 1929 1944 m_ppcOrigYuv[uhDepth]->add( m_ppcResPredTmp [uhDepth], rpcTempCU->getWidth( 0 ), rpcTempCU->getHeight( 0 ) ); 1930 1945 } 1946 #endif 1931 1947 #endif 1932 1948 -
trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
r56 r77 121 121 } 122 122 123 #if VIDYO_VPS_INTEGRATION 124 Void TEncEntropy::encodeVPS( TComVPS* pcVPS ) 125 { 126 m_pcEntropyCoderIf->codeVPS( pcVPS ); 127 return; 128 } 129 #endif 130 131 #if VIDYO_VPS_INTEGRATION 132 Void codeVPS ( TComVPS* pcVPS ); 133 #endif 134 123 135 #if HHI_MPI 124 136 Void TEncEntropy::encodeSPS( TComSPS* pcSPS, Bool bIsDepth ) … … 471 483 ROTVS( pcCU->isIntra ( uiAbsPartIdx ) ); 472 484 ROFVS( pcCU->getResPredAvail ( uiAbsPartIdx ) ); 473 485 #if LG_RESTRICTEDRESPRED_M24766 486 Int iPUResiPredShift[4]; 487 pcCU->getPUResiPredShift(iPUResiPredShift, uiAbsPartIdx); 488 if(iPUResiPredShift[0] >= 0 || iPUResiPredShift[1] >= 0 || iPUResiPredShift[2] >= 0 || iPUResiPredShift[3] >= 0 ) 489 #endif 474 490 // encode flag 475 491 m_pcEntropyCoderIf->codeResPredFlag( pcCU, uiAbsPartIdx ); -
trunk/source/Lib/TLibEncoder/TEncEntropy.h
r56 r77 76 76 virtual UInt getCoeffCost () = 0; 77 77 78 #if VIDYO_VPS_INTEGRATION 79 virtual Void codeVPS ( TComVPS* pcVPS ) = 0; 80 #endif 81 78 82 #if HHI_MPI 79 83 virtual Void codeSPS ( TComSPS* pcSPS, Bool bIsDepth ) = 0; … … 229 233 230 234 public: 235 #if VIDYO_VPS_INTEGRATION 236 Void encodeVPS ( TComVPS* pcVPS); 237 #endif 231 238 // SPS 232 239 #if HHI_MPI -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r56 r77 246 246 247 247 std::vector<TComAPS>& vAPS = m_pcEncTop->getAPS(); 248 #if VIDYO_VPS_INTEGRATION 249 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, uiPOCCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getEncTop()->getVPS(), m_pcEncTop->getSPS(), m_pcEncTop->getPPS() ); 250 #else 248 251 m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, uiPOCCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() ); 252 #endif 249 253 pcSlice->setLastIDR(m_iLastIDR); 250 254 pcSlice->setSliceIdx(0); … … 809 813 if ( m_bSeqFirst ) 810 814 { 815 #if VIDYO_VPS_INTEGRATION 816 { 817 OutputNALUnit nalu(NAL_UNIT_VPS, true, m_pcEncTop->getLayerId()); 818 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 819 m_pcEntropyCoder->encodeVPS(m_pcEncTop->getEncTop()->getVPS()); 820 writeRBSPTrailingBits(nalu.m_Bitstream); 821 accessUnit.push_back(new NALUnitEBSP(nalu)); 822 } 823 #endif 811 824 #if NAL_REF_FLAG 825 #if VIDYO_VPS_INTEGRATION 826 OutputNALUnit nalu(NAL_UNIT_SPS, true, m_pcEncTop->getLayerId()); 827 #else 812 828 OutputNALUnit nalu(NAL_UNIT_SPS, true, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth()); 829 #endif 813 830 #else 814 831 OutputNALUnit nalu(NAL_UNIT_SPS, NAL_REF_IDC_PRIORITY_HIGHEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth()); … … 827 844 828 845 #if NAL_REF_FLAG 846 #if VIDYO_VPS_INTEGRATION 847 nalu = NALUnit(NAL_UNIT_PPS, true, m_pcEncTop->getLayerId()); 848 #else 829 849 nalu = NALUnit(NAL_UNIT_PPS, true, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth()); 850 #endif 830 851 #else 831 852 nalu = NALUnit(NAL_UNIT_PPS, NAL_REF_IDC_PRIORITY_HIGHEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth()); … … 954 975 #if H0388 955 976 #if NAL_REF_FLAG 956 OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced(), m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer() ); 957 #else 958 OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced() ? NAL_REF_IDC_PRIORITY_HIGHEST: NAL_REF_IDC_PRIORITY_LOWEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer() ); 959 #endif 960 #else 961 OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced() ? NAL_REF_IDC_PRIORITY_HIGHEST: NAL_REF_IDC_PRIORITY_LOWEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer(), true); 962 #endif 977 OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced(), 978 #if !VIDYO_VPS_INTEGRATION 979 m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer() ); 980 #else 981 m_pcEncTop->getLayerId(), pcSlice->getTLayer() ); 982 #endif 983 #else 984 OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced() ? NAL_REF_IDC_PRIORITY_HIGHEST: NAL_REF_IDC_PRIORITY_LOWEST, 985 #if !VIDYO_VPS_INTEGRATION 986 m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer() ); 987 #else 988 m_pcEncTop->getLayerId(), pcSlice->getTLayer() ); 989 #endif 990 #endif 991 #else 992 OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->isReferenced() ? NAL_REF_IDC_PRIORITY_HIGHEST: NAL_REF_IDC_PRIORITY_LOWEST, 993 #if !VIDYO_VPS_INTEGRATION 994 m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth(), pcSlice->getTLayer(), true ); 995 #else 996 m_pcEncTop->getLayerId(), pcSlice->getTLayer(), true ); 997 #endif 998 999 #endif 1000 963 1001 Bool bEntropySlice = (!pcSlice->isNextSlice()); 964 1002 if (!bEntropySlice) … … 1414 1452 { 1415 1453 #if NAL_REF_FLAG 1454 #if VIDYO_VPS_INTEGRATION 1455 OutputNALUnit nalu(NAL_UNIT_APS, true, m_pcEncTop->getLayerId()); 1456 #else 1416 1457 OutputNALUnit nalu(NAL_UNIT_APS, true, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth()); 1458 #endif 1417 1459 #else 1418 1460 OutputNALUnit nalu(NAL_UNIT_APS, NAL_REF_IDC_PRIORITY_HIGHEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth()); … … 1476 1518 1477 1519 #if NAL_REF_FLAG 1520 #if VIDYO_VPS_INTEGRATION 1521 OutputNALUnit nalu(NAL_UNIT_SEI, false, m_pcEncTop->getLayerId()); 1522 #else 1478 1523 OutputNALUnit nalu(NAL_UNIT_SEI, false, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth()); 1524 #endif 1479 1525 #else 1480 1526 OutputNALUnit nalu(NAL_UNIT_SEI, NAL_REF_IDC_PRIORITY_LOWEST, m_pcEncTop->getViewId(), m_pcEncTop->getIsDepth()); … … 1962 2008 1963 2009 #if HHI_VSO 2010 #if HHI_VSO_SYNTH_DIST_OUT 1964 2011 if ( m_pcRdCost->getUseRenModel() ) 1965 2012 { … … 1975 2022 } 1976 2023 else 2024 #endif 1977 2025 #endif 1978 2026 { -
trunk/source/Lib/TLibEncoder/TEncSbac.cpp
r58 r77 342 342 } 343 343 344 #if VIDYO_VPS_INTEGRATION 345 Void TEncSbac::codeVPS( TComVPS* pcVPS ) 346 { 347 assert (0); 348 return; 349 } 350 #endif 351 344 352 #if HHI_MPI 345 353 Void TEncSbac::codeSPS( TComSPS* pcSPS, Bool bIsDepth ) -
trunk/source/Lib/TLibEncoder/TEncSbac.h
r56 r77 98 98 //--SBAC RD 99 99 100 #if VIDYO_VPS_INTEGRATION 101 Void codeVPS ( TComVPS* pcVPS ); 102 #endif 103 100 104 #if HHI_MPI 101 105 Void codeSPS ( TComSPS* pcSPS, Bool bIsDepth ); -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r56 r77 2505 2505 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand ) 2506 2506 #else 2507 #if LG_RESTRICTEDRESPRED_M24766 2508 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* rpcResiPredYuv, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost ) 2509 #else 2507 2510 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost ) 2511 #endif 2508 2512 #endif 2509 2513 { … … 2553 2557 const int maxNumMergeCand = MRG_MAX_NUM_CANDS_SIGNALED + ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); 2554 2558 #endif 2555 2559 #if LG_RESTRICTEDRESPRED_M24766 2560 Int iPUResiPredShift[4]; 2561 Int iLastAddResiShift = -1000; 2562 #endif 2556 2563 ruiCost = MAX_UINT; 2557 2564 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) … … 2565 2572 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 2566 2573 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 2567 2574 #if LG_RESTRICTEDRESPRED_M24766 2575 Int iAddResiShift; 2576 UInt uiPartAddr; 2577 Int iRoiWidth, iRoiHeight; 2578 2579 pcCU->getPartIndexAndSize( iPUIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 2580 iAddResiShift = pcCU->getResiPredMode(uiPartAddr); 2581 iAddResiShift = (pcCU->getSlice()->getPPS()->getUseWP() || pcCU->getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1 - iAddResiShift : -1); 2582 2583 if( pcCU->getResPredFlag( 0 )) 2584 { // subtract residual prediction from original in motion search 2585 if(iLastAddResiShift != iAddResiShift) 2586 { 2587 //add subtracted residual last time 2588 if(iLastAddResiShift >= 0) 2589 { 2590 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iLastAddResiShift; 2591 pcYuvOrg->add(iPUResiPredShift, ePartSize, rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 )); 2592 } 2593 //subtract residual 2594 if(iAddResiShift >= 0) 2595 { 2596 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iAddResiShift; 2597 pcYuvOrg->add(iPUResiPredShift, ePartSize, rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ), true ); 2598 } 2599 iLastAddResiShift = iAddResiShift; 2600 } 2601 } 2602 #endif 2568 2603 xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); 2569 2604 uiBitsCand = uiMergeCand + 1; … … 2587 2622 } 2588 2623 } 2624 #if LG_RESTRICTEDRESPRED_M24766 2625 if( pcCU->getResPredFlag( 0 ) && iLastAddResiShift >= 0) 2626 { 2627 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iLastAddResiShift; 2628 pcYuvOrg->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 )); 2629 } 2630 #endif 2589 2631 } 2590 2632 … … 2599 2641 */ 2600 2642 #if AMP_MRG 2643 #if LG_RESTRICTEDRESPRED_M24766 2644 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* rpcResiPredYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG ) 2645 #else 2601 2646 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG ) 2647 #endif 2602 2648 #else 2603 2649 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes ) … … 2702 2748 for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) uiCostTempL0[iNumRef] = MAX_UINT; 2703 2749 UInt uiBitsTempL0[MAX_NUM_REF]; 2704 2750 #if LG_RESTRICTEDRESPRED_M24766 2751 Int iPUResiPredShift[4] = {0, 0, 0, 0}; 2752 #endif 2705 2753 xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits); 2706 2754 … … 2718 2766 { 2719 2767 #endif 2720 2768 #if LG_RESTRICTEDRESPRED_M24766 2769 Bool bLastResiFlag = false; 2770 #endif 2721 2771 // Uni-directional prediction 2722 2772 for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ ) … … 2726 2776 for ( Int iRefIdxTemp = 0; iRefIdxTemp < pcCU->getSlice()->getNumRefIdx(eRefPicList); iRefIdxTemp++ ) 2727 2777 { 2778 #if LG_RESTRICTEDRESPRED_M24766 2779 if( pcCU->getResPredFlag( 0 )) 2780 { 2781 if(pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp)) 2782 { // subtract residual prediction from original in motion search 2783 if(!bLastResiFlag) 2784 pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ), true ); 2785 bLastResiFlag = true; 2786 } 2787 else 2788 { 2789 if(bLastResiFlag) 2790 pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 )); 2791 bLastResiFlag = false; 2792 } 2793 } 2794 #endif 2728 2795 uiBitsTemp = uiMbBits[iRefList]; 2729 2796 if ( pcCU->getSlice()->getNumRefIdx(eRefPicList) > 1 ) … … 2889 2956 } 2890 2957 } 2958 #if LG_RESTRICTEDRESPRED_M24766 2959 if( pcCU->getResPredFlag( 0 ) && bLastResiFlag) 2960 { // subtract residual prediction from original in motion search 2961 pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 )); 2962 } 2963 #endif 2891 2964 // Bi-directional prediction 2892 2965 if ( pcCU->getSlice()->isInterB() ) 2893 2966 { 2894 2967 #if LG_RESTRICTEDRESPRED_M24766 2968 Int iLastAddResiShift = -1000; 2969 #endif 2895 2970 cMvBi[0] = cMv[0]; cMvBi[1] = cMv[1]; 2896 2971 iRefIdxBi[0] = iRefIdx[0]; iRefIdxBi[1] = iRefIdx[1]; … … 2994 3069 #else 2995 3070 uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; 3071 #endif 3072 #if LG_RESTRICTEDRESPRED_M24766 3073 Int iAddResiShift = -1, iPredFrom = 0; 3074 Int iBestRefIdx = pcCU->getCUMvField(eRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0)->getRefIdx(uiPartAddr); 3075 3076 iPredFrom = iBestRefIdx >= 0 ? 3 : 1; 3077 if(iBestRefIdx >= 0 && pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0, iBestRefIdx)) 3078 iAddResiShift++; 3079 if(pcCU->getSlice()->getViewId() == pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxTemp)) 3080 iAddResiShift++; 3081 iAddResiShift = (pcCU->getSlice()->getPPS()->getUseWP() || iPredFrom != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); 3082 3083 if( pcCU->getResPredFlag( 0 ) ) 3084 { 3085 if(iLastAddResiShift != iAddResiShift) 3086 { 3087 //add substracted residual last time 3088 if(iLastAddResiShift >= 0 ) 3089 { 3090 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iLastAddResiShift; 3091 pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 )); 3092 } 3093 //substract residual 3094 if(iAddResiShift >= 0) 3095 { 3096 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iAddResiShift; 3097 pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ), true ); 3098 } 3099 iLastAddResiShift = iAddResiShift; 3100 } 3101 } 2996 3102 #endif 2997 3103 // call ME … … 3049 3155 } 3050 3156 } // for loop-iter 3157 #if LG_RESTRICTEDRESPRED_M24766 3158 if( pcCU->getResPredFlag( 0 ) && iLastAddResiShift >= 0) 3159 { 3160 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = iLastAddResiShift; 3161 pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 )); 3162 } 3163 #endif 3051 3164 } // if (B_SLICE) 3052 3165 #if ZERO_MVD_EST … … 3255 3368 if (bTestNormalMC) 3256 3369 { 3370 #if LG_RESTRICTEDRESPRED_M24766 3371 Int iAddResiShift = pcCU->getResiPredMode(uiPartAddr); 3372 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = \ 3373 (pcCU->getSlice()->getPPS()->getUseWP() || pcCU->getInterDir(uiPartAddr) != 3)? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1); 3374 if(pcCU->getResPredFlag(0) && iAddResiShift >= 0) 3375 { 3376 pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 ), true); 3377 } 3378 #endif 3257 3379 xGetInterPredictionError( pcCU, pcOrgYuv, iPartIdx, uiMEError, m_pcEncCfg->getUseHADME() ); 3258 3380 uiMECost = uiMEError + m_pcRdCost->getCost( uiMEBits ); 3381 #if LG_RESTRICTEDRESPRED_M24766 3382 if(pcCU->getResPredFlag(0) && iAddResiShift >= 0) 3383 { 3384 pcOrgYuv->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcResiPredYuv, pcCU->getWidth( 0 ), pcCU->getHeight( 0 )); 3385 } 3386 #endif 3259 3387 } 3260 3388 #else … … 3274 3402 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand); 3275 3403 #else 3404 #if LG_RESTRICTEDRESPRED_M24766 3405 xMergeEstimation( pcCU, pcOrgYuv, rpcResiPredYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost ); 3406 #else 3276 3407 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost ); 3408 #endif 3277 3409 #endif 3278 3410 if ( uiMRGCost < uiMECost ) … … 4116 4248 UInt uiWidth = pcCU->getWidth ( 0 ); 4117 4249 UInt uiHeight = pcCU->getHeight( 0 ); 4118 4250 #if LG_RESTRICTEDRESPRED_M24766 4251 Int iPUResiPredShift[4]; 4252 #endif 4119 4253 // No residual coding : SKIP mode 4120 4254 if ( ePredMode == MODE_SKIP && bSkipRes ) … … 4128 4262 if( pcCU->getResPredFlag( 0 ) ) 4129 4263 { 4264 #if LG_RESTRICTEDRESPRED_M24766 4265 pcCU->getPUResiPredShift(iPUResiPredShift, 0); 4266 rpcYuvRec->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcYuvResPrd, uiWidth, uiHeight ); 4267 #else 4130 4268 rpcYuvRec->add( rpcYuvResPrd, uiWidth, uiHeight ); 4269 #endif 4131 4270 rpcYuvRec->clip( uiWidth, uiHeight ); 4132 4271 } … … 4237 4376 else 4238 4377 { 4378 #if LG_RESTRICTEDRESPRED_M24766 4379 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = 0; 4380 rpcYuvResi->subtract(iPUResiPredShift, pcCU->getPartitionSize(0), pcYuvOrg, pcYuvPred, 0, uiWidth ); 4381 #else 4239 4382 rpcYuvResi->subtract( pcYuvOrg, pcYuvPred, 0, uiWidth ); 4383 #endif 4240 4384 #if HHI_INTER_VIEW_RESIDUAL_PRED 4241 4385 // subtract residual prediction 4242 4386 if( pcCU->getResPredFlag( 0 ) ) 4243 4387 { 4388 #if LG_RESTRICTEDRESPRED_M24766 4389 pcCU->getPUResiPredShift(iPUResiPredShift, 0); 4390 rpcYuvResi->subtract(iPUResiPredShift, pcCU->getPartitionSize(0), rpcYuvResi, rpcYuvResPrd, 0, uiWidth ); 4391 #else 4244 4392 rpcYuvResi->subtract( rpcYuvResi, rpcYuvResPrd, 0, uiWidth ); 4393 #endif 4245 4394 } 4246 4395 #endif … … 4456 4605 { 4457 4606 pcYuvPred->copyToPartYuv( rpcYuvRec, 0 ); 4607 #if LG_RESTRICTEDRESPRED_M24766 4608 pcCU->getPUResiPredShift(iPUResiPredShift, 0); 4609 rpcYuvRec->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcYuvResPrd, uiWidth, uiHeight ); 4610 iPUResiPredShift[0] = iPUResiPredShift[1] = iPUResiPredShift[2] = iPUResiPredShift[3] = 0; 4611 rpcYuvRec->add(iPUResiPredShift, pcCU->getPartitionSize(0), rpcYuvResiBest, uiWidth, uiHeight ); 4612 #else 4458 4613 rpcYuvRec->add( rpcYuvResPrd, uiWidth, uiHeight ); 4459 4614 rpcYuvRec->add( rpcYuvResiBest, uiWidth, uiHeight ); 4615 #endif 4460 4616 rpcYuvRec->clip( uiWidth, uiHeight ); 4461 4617 } -
trunk/source/Lib/TLibEncoder/TEncSearch.h
r56 r77 188 188 Void predInterSearch ( TComDataCU* pcCU, 189 189 TComYuv* pcOrgYuv, 190 #if LG_RESTRICTEDRESPRED_M24766 191 TComYuv* rpcResiPredYuv, 192 #endif 190 193 TComYuv*& rpcPredYuv, 191 194 TComYuv*& rpcResiYuv, … … 440 443 Void xMergeEstimation ( TComDataCU* pcCU, 441 444 TComYuv* pcYuvOrg, 445 #if LG_RESTRICTEDRESPRED_M24766 446 TComYuv* rpcResiPredYuv, 447 #endif 442 448 Int iPartIdx, 443 449 UInt& uiInterDir, -
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r56 r77 161 161 \param pPPS PPS associated with the slice 162 162 */ 163 #if VIDYO_VPS_INTEGRATION 164 Void TEncSlice::initEncSlice( TComPic* pcPic, Int iPOCLast, UInt uiPOCCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS * pVPS, TComSPS* pSPS, TComPPS *pPPS ) 165 #else 163 166 Void TEncSlice::initEncSlice( TComPic* pcPic, Int iPOCLast, UInt uiPOCCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS ) 167 #endif 164 168 { 165 169 Double dQP; … … 167 171 168 172 rpcSlice = pcPic->getSlice(0); 173 #if VIDYO_VPS_INTEGRATION 174 rpcSlice->setVPS( pVPS ); 175 #endif 169 176 rpcSlice->setSPS( pSPS ); 170 177 rpcSlice->setPPS( pPPS ); -
trunk/source/Lib/TLibEncoder/TEncSlice.h
r56 r77 110 110 111 111 /// preparation of slice encoding (reference marking, QP and lambda) 112 #if VIDYO_VPS_INTEGRATION 113 Void initEncSlice ( TComPic* pcPic, Int iPOCLast, UInt uiPOCCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComVPS* pVPS, TComSPS* pSPS, TComPPS *pPPS ); 114 #else 112 115 Void initEncSlice ( TComPic* pcPic, Int iPOCLast, UInt uiPOCCurr, Int iNumPicRcvd, Int iGOPid, TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS ); 113 116 #endif 114 117 // compress and encode slice 115 118 Void precompressSlice ( TComPic*& rpcPic ); ///< precompress slice for multi-loop opt. -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r56 r77 348 348 349 349 #if DEPTH_MAP_GENERATION 350 #if VIDYO_VPS_INTEGRATION 351 m_cDepthMapGenerator.init( (TComPrediction*)this->getPredSearch(), m_pcTAppEncTop->getVPSAccess(), m_pcTAppEncTop->getSPSAccess(), m_pcTAppEncTop->getAUPicAccess() ); 352 #else 350 353 m_cDepthMapGenerator.init( (TComPrediction*)this->getPredSearch(), m_pcTAppEncTop->getSPSAccess(), m_pcTAppEncTop->getAUPicAccess() ); 354 #endif 351 355 #endif 352 356 #if HHI_INTER_VIEW_RESIDUAL_PRED … … 977 981 Void TEncTop::selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid,TComList<TComPic*>& listPic ) 978 982 { 983 #if HHI_FIX 984 if( slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDV && POCCurr == 0 ) 985 #else 979 986 if( slice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDV ) 987 #endif 980 988 { 981 989 TComReferencePictureSet* rps = slice->getLocalRPS();
Note: See TracChangeset for help on using the changeset viewer.