Ticket #646: collocated_from_l0_bug.patch
File collocated_from_l0_bug.patch, 9.4 KB (added by bheng, 12 years ago) |
---|
-
source/Lib/TLibCommon/TComDataCU.cpp
3694 3694 TComMv cColMv; 3695 3695 3696 3696 // use coldir. 3697 TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx());3697 TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx()); 3698 3698 TComDataCU *pColCU = pColPic->getCU( uiCUAddr ); 3699 3699 if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE) 3700 3700 { … … 3708 3708 { 3709 3709 return false; 3710 3710 } 3711 eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList( 1-getSlice()->getColDir());3711 eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag()); 3712 3712 3713 3713 Int iColRefIdx = pColCU->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(uiAbsPartAddr); 3714 3714 … … 3831 3831 Int iCurrPOC = m_pcSlice->getPOC(); 3832 3832 3833 3833 // use coldir. 3834 TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), getSlice()->getColRefIdx());3834 TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx()); 3835 3835 TComDataCU *pColCU = pColPic->getCU( m_uiCUAddr ); 3836 3836 3837 3837 Int iColPOC = pColCU->getSlice()->getPOC(); -
source/Lib/TLibCommon/TComSlice.cpp
74 74 , m_pcSPS ( NULL ) 75 75 , m_pcPPS ( NULL ) 76 76 , m_pcPic ( NULL ) 77 , m_ uiColDir ( 0)77 , m_colFromL0 ( 1 ) 78 78 , m_colRefIdx ( 0 ) 79 79 #if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA 80 80 , m_dLambdaLuma( 0.0 ) … … 160 160 m_aiNumRefIdx[0] = 0; 161 161 m_aiNumRefIdx[1] = 0; 162 162 163 m_ uiColDir = 0;163 m_colFromL0 = 1; 164 164 165 165 m_colRefIdx = 0; 166 166 initEqualRef(); … … 553 553 { 554 554 Int i; 555 555 TComSlice* curSlice = pic->getSlice(curSliceIdx); 556 Int currColRefPOC = curSlice->getRefPOC( RefPicList( curSlice->getColDir()), curSlice->getColRefIdx());556 Int currColRefPOC = curSlice->getRefPOC( RefPicList(1-curSlice->getColFromL0Flag()), curSlice->getColRefIdx()); 557 557 TComSlice* preSlice; 558 558 Int preColRefPOC; 559 559 for(i=curSliceIdx-1; i>=0; i--) … … 561 561 preSlice = pic->getSlice(i); 562 562 if(preSlice->getSliceType() != I_SLICE) 563 563 { 564 preColRefPOC = preSlice->getRefPOC( RefPicList( preSlice->getColDir()), preSlice->getColRefIdx());564 preColRefPOC = preSlice->getRefPOC( RefPicList(1-preSlice->getColFromL0Flag()), preSlice->getColRefIdx()); 565 565 if(currColRefPOC != preColRefPOC) 566 566 { 567 567 printf("Collocated_ref_idx shall always be the same for all slices of a coded picture!\n"); … … 769 769 m_iAPSId = pSrc->m_iAPSId; 770 770 #endif 771 771 772 m_ uiColDir = pSrc->m_uiColDir;772 m_colFromL0 = pSrc->m_colFromL0; 773 773 m_colRefIdx = pSrc->m_colRefIdx; 774 774 #if ALF_CHROMA_LAMBDA || SAO_CHROMA_LAMBDA 775 775 m_dLambdaLuma = pSrc->m_dLambdaLuma; -
source/Lib/TLibCommon/TComSlice.h
1212 1212 #if !REMOVE_APS 1213 1213 TComAPS* m_pcAPS; //!< pointer to APS parameter object 1214 1214 #endif 1215 UInt m_ uiColDir; // direction to get colocated CUs1215 UInt m_colFromL0; // collocated picture from List0 flag 1216 1216 1217 1217 UInt m_colRefIdx; 1218 1218 … … 1354 1354 TComPic* getRefPic ( RefPicList e, Int iRefIdx) { return m_apcRefPicList[e][iRefIdx]; } 1355 1355 Int getRefPOC ( RefPicList e, Int iRefIdx) { return m_aiRefPOCList[e][iRefIdx]; } 1356 1356 Int getDepth () { return m_iDepth; } 1357 UInt getCol Dir () { return m_uiColDir;}1357 UInt getColFromL0Flag () { return m_colFromL0; } 1358 1358 Bool getColRefIdx () { return m_colRefIdx; } 1359 1359 Void checkColRefIdx (UInt curSliceIdx, TComPic* pic); 1360 1360 Bool getCheckLDC () { return m_bCheckLDC; } … … 1417 1417 1418 1418 Void setRefPicList ( TComList<TComPic*>& rcListPic ); 1419 1419 Void setRefPOCList (); 1420 Void setCol Dir ( UInt uiDir ) { m_uiColDir = uiDir; }1420 Void setColFromL0Flag ( UInt colFromL0 ) { m_colFromL0 = colFromL0; } 1421 1421 Void setColRefIdx ( UInt refIdx) { m_colRefIdx = refIdx; } 1422 1422 Void setCheckLDC ( Bool b ) { m_bCheckLDC = b; } 1423 1423 Void setMvdL1ZeroFlag ( Bool b) { m_bLMvdL1Zero = b; } -
source/Lib/TLibDecoder/TDecCAVLC.cpp
1433 1433 if ( rpcSlice->getSliceType() == B_SLICE ) 1434 1434 { 1435 1435 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 1436 rpcSlice->setCol Dir(uiCode);1436 rpcSlice->setColFromL0Flag(uiCode); 1437 1437 } 1438 1438 else 1439 1439 { 1440 rpcSlice->setCol Dir( 0);1440 rpcSlice->setColFromL0Flag( 1 ); 1441 1441 } 1442 1442 1443 1443 if ( rpcSlice->getSliceType() != I_SLICE && 1444 ((rpcSlice->getCol Dir()==0&& rpcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)||1445 (rpcSlice->getCol Dir() ==1&& rpcSlice->getNumRefIdx(REF_PIC_LIST_1)>1)))1444 ((rpcSlice->getColFromL0Flag()==1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)|| 1445 (rpcSlice->getColFromL0Flag() ==0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1)>1))) 1446 1446 { 1447 1447 READ_UVLC( uiCode, "collocated_ref_idx" ); 1448 1448 rpcSlice->setColRefIdx(uiCode); … … 1514 1514 if ( rpcSlice->getSliceType() == B_SLICE ) 1515 1515 { 1516 1516 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 1517 rpcSlice->setCol Dir(uiCode);1517 rpcSlice->setColFromL0Flag(uiCode); 1518 1518 } 1519 1519 1520 1520 if ( rpcSlice->getSliceType() != I_SLICE && 1521 ((rpcSlice->getCol Dir()==0&& rpcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)||1522 (rpcSlice->getCol Dir() ==1&& rpcSlice->getNumRefIdx(REF_PIC_LIST_1)>1)))1521 ((rpcSlice->getColFromL0Flag()==1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)|| 1522 (rpcSlice->getColFromL0Flag() ==0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1)>1))) 1523 1523 { 1524 1524 READ_UVLC( uiCode, "collocated_ref_idx" ); 1525 1525 rpcSlice->setColRefIdx(uiCode); -
source/Lib/TLibEncoder/TEncCavlc.cpp
1009 1009 { 1010 1010 if ( pcSlice->getSliceType() == B_SLICE ) 1011 1011 { 1012 WRITE_FLAG( pcSlice->getCol Dir(), "collocated_from_l0_flag" );1012 WRITE_FLAG( pcSlice->getColFromL0Flag(), "collocated_from_l0_flag" ); 1013 1013 } 1014 1014 1015 1015 if ( pcSlice->getSliceType() != I_SLICE && 1016 ((pcSlice->getCol Dir()==0&& pcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)||1017 (pcSlice->getCol Dir()==1&& pcSlice->getNumRefIdx(REF_PIC_LIST_1)>1)))1016 ((pcSlice->getColFromL0Flag()==1 && pcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)|| 1017 (pcSlice->getColFromL0Flag()==0 && pcSlice->getNumRefIdx(REF_PIC_LIST_1)>1))) 1018 1018 { 1019 1019 WRITE_UVLC( pcSlice->getColRefIdx(), "collocated_ref_idx" ); 1020 1020 } … … 1059 1059 { 1060 1060 if ( pcSlice->getSliceType() == B_SLICE ) 1061 1061 { 1062 WRITE_FLAG( pcSlice->getCol Dir(), "collocated_from_l0_flag" );1062 WRITE_FLAG( pcSlice->getColFromL0Flag(), "collocated_from_l0_flag" ); 1063 1063 } 1064 1064 1065 1065 if ( pcSlice->getSliceType() != I_SLICE && 1066 ((pcSlice->getCol Dir()==0&& pcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)||1067 (pcSlice->getCol Dir()==1&& pcSlice->getNumRefIdx(REF_PIC_LIST_1)>1)))1066 ((pcSlice->getColFromL0Flag()==1 && pcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)|| 1067 (pcSlice->getColFromL0Flag()==0 && pcSlice->getNumRefIdx(REF_PIC_LIST_1)>1))) 1068 1068 { 1069 1069 WRITE_UVLC( pcSlice->getColRefIdx(), "collocated_ref_idx" ); 1070 1070 } -
source/Lib/TLibEncoder/TEncGOP.cpp
426 426 427 427 if (pcSlice->getSliceType() == B_SLICE) 428 428 { 429 pcSlice->setCol Dir(uiColDir);429 pcSlice->setColFromL0Flag(1-uiColDir); 430 430 Bool bLowDelay = true; 431 431 Int iCurrPOC = pcSlice->getPOC(); 432 432 Int iRefIdx = 0; … … 486 486 } 487 487 else 488 488 { 489 // Note: pcSlice->getCol Dir() is assumed to be always 1and getcolRefIdx() is always 0.489 // Note: pcSlice->getColFromL0Flag() is assumed to be always 0 and getcolRefIdx() is always 0. 490 490 pcSlice->setEnableTMVPFlag(1); 491 491 } 492 492 pcSlice->getSPS()->setTMVPFlagsPresent(1);