- Timestamp:
- 7 Feb 2013, 02:16:51 (12 years ago)
- Location:
- trunk/source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r2 r28 98 98 m_acTEncTop[layer].setFrameToBeEncoded ( m_iFrameToBeEncoded ); 99 99 100 #if REF_IDX_MFM 101 if(layer == 0) 102 m_acTEncTop[layer].setMFMEnabledFlag(false); 103 else 104 m_acTEncTop[layer].setMFMEnabledFlag(true); 105 #endif 100 106 // set layer ID 101 107 m_acTEncTop[layer].setLayerId ( layer ); -
trunk/source/Lib/TLibCommon/TComDataCU.cpp
r12 r28 2143 2143 #endif 2144 2144 2145 #if REF_IDX_ME_ZEROMV 2146 Bool TComDataCU::xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1) 2147 { 2148 Bool checkZeroMVILR = true; 2149 2150 if(uhInterDir&0x1) //list0 2151 { 2152 Int refIdxL0 = cMvFieldL0.getRefIdx(); 2153 if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->getIsILR()) 2154 checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0); 2155 } 2156 if(uhInterDir&0x2) //list1 2157 { 2158 Int refIdxL1 = cMvFieldL1.getRefIdx(); 2159 if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->getIsILR()) 2160 checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0); 2161 } 2162 2163 return checkZeroMVILR; 2164 } 2165 2166 Bool TComDataCU::xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx) 2167 { 2168 RefPicList eRefPicList = iRefList > 0? REF_PIC_LIST_1: REF_PIC_LIST_0; 2169 assert(eRefPicList == REF_PIC_LIST_1); 2170 2171 Bool checkZeroMVILR = true; 2172 2173 if(getSlice()->getRefPic(eRefPicList, iRefIdx)->getIsILR()) 2174 { 2175 AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo(); 2176 TComMv cMv = pcAMVPInfo->m_acMvCand[MvpIdx]; 2177 checkZeroMVILR &= (cMv.getHor() == 0 && cMv.getVer() == 0); 2178 } 2179 2180 return checkZeroMVILR; 2181 } 2182 #endif 2183 2145 2184 UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx ) 2146 2185 { -
trunk/source/Lib/TLibCommon/TComDataCU.h
r2 r28 562 562 UInt getCtxIntraBLFlag ( UInt uiAbsPartIdx ); 563 563 #endif 564 564 565 #if REF_IDX_ME_ZEROMV 566 Bool xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1); 567 Bool xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx); 568 #endif 569 565 570 UInt getSliceStartCU ( UInt pos ) { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU]; } 566 571 UInt getDependentSliceStartCU ( UInt pos ) { return m_uiDependentSliceStartCU[pos-m_uiAbsIdxInLCU]; } … … 591 596 #endif 592 597 }; 598 599 593 600 594 601 namespace RasterAddress -
trunk/source/Lib/TLibCommon/TComMotionInfo.h
r2 r28 158 158 Void compress(Char* pePredMode, Int scale); 159 159 #endif 160 161 #if REF_IDX_MFM 162 Void setMvField( TComMvField const & mvField, Int iIdx) 163 { 164 m_pcMv[iIdx] = mvField.getMv(); 165 m_piRefIdx[iIdx] = mvField.getRefIdx(); 166 return; 167 } 168 169 Void setMvField( TComMv cMv, Int iRefIdx, Int iIdx) 170 { 171 m_pcMv[iIdx] = cMv; 172 m_piRefIdx[iIdx] = iRefIdx; 173 return; 174 } 175 #endif 160 176 }; 161 177 -
trunk/source/Lib/TLibCommon/TComPic.cpp
r21 r28 68 68 , m_bSpatialEnhLayer( false ) 69 69 , m_pcFullPelBaseRec( NULL ) 70 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE 70 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM 71 71 , m_bIsILR (false) 72 72 #endif 73 73 74 #endif 74 75 { … … 554 555 upsampledRowWidthCroma); 555 556 } 557 558 #if REF_IDX_MFM 559 Void TComPic::deriveUnitIdxBase( UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx ) 560 { 561 //pixel in the base layer 562 563 UInt uiPelX = (uiUpsamplePelX<<1)/ratio; 564 UInt uiPelY = (uiUpsamplePelY<<1)/ratio; 565 UInt uiBaseWidth = getPicYuvRec()->getWidth(); 566 UInt uiBaseHeight = getPicYuvRec()->getHeight(); 567 568 UInt uiWidthInCU = ( uiBaseWidth % g_uiMaxCUWidth ) ? uiBaseWidth /g_uiMaxCUWidth + 1 : uiBaseWidth /g_uiMaxCUWidth; 569 UInt uiHeightInCU = ( uiBaseHeight% g_uiMaxCUHeight ) ? uiBaseHeight/ g_uiMaxCUHeight + 1 : uiBaseHeight/ g_uiMaxCUHeight; 570 571 uiPelX = (UInt)Clip3<UInt>(0, uiWidthInCU * g_uiMaxCUWidth - 1, uiPelX); 572 uiPelY = (UInt)Clip3<UInt>(0, uiHeightInCU * g_uiMaxCUHeight - 1, uiPelY); 573 574 uiBaseCUAddr = uiPelY / g_uiMaxCUHeight * uiWidthInCU + uiPelX / g_uiMaxCUWidth; 575 576 UInt uiWidthMinPU = g_uiMaxCUWidth / (1<<g_uiMaxCUDepth); 577 UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth); 578 579 UInt uiAbsPelX = uiPelX - (uiPelX / g_uiMaxCUWidth) * g_uiMaxCUWidth; 580 UInt uiAbsPelY = uiPelY - (uiPelY / g_uiMaxCUHeight) * g_uiMaxCUHeight; 581 582 UInt RasterIdx = uiAbsPelY / uiHeightMinPU * (g_uiMaxCUWidth/uiWidthMinPU) + uiAbsPelX / uiWidthMinPU; 583 uiBaseAbsPartIdx = g_auiRasterToZscan[RasterIdx]; 584 585 return; 586 } 587 588 589 590 591 Void TComPic::copyUpsampledMvField(TComPic* pcPicBase) 592 { 593 594 595 596 Int iBWidth = pcPicBase->getPicYuvRec()->getWidth () - pcPicBase->getPicYuvRec()->getPicCropLeftOffset() - pcPicBase->getPicYuvRec()->getPicCropRightOffset(); 597 Int iBHeight = pcPicBase->getPicYuvRec()->getHeight() - pcPicBase->getPicYuvRec()->getPicCropTopOffset() - pcPicBase->getPicYuvRec()->getPicCropBottomOffset(); 598 599 Int iEWidth = getPicYuvRec()->getWidth() - getPicYuvRec()->getPicCropLeftOffset() - getPicYuvRec()->getPicCropRightOffset(); 600 Int iEHeight = getPicYuvRec()->getHeight() - getPicYuvRec()->getPicCropTopOffset() - getPicYuvRec()->getPicCropBottomOffset(); 601 602 603 UInt upSampleRatio = 0; 604 if(iEWidth == iBWidth && iEHeight == iBHeight) 605 { 606 upSampleRatio = 2; 607 } 608 else if(2*iEWidth == 3*iBWidth && 2*iEHeight == 3*iBHeight) 609 { 610 upSampleRatio = 3; 611 } 612 else if(iEWidth == 2*iBWidth && iEHeight == 2*iBHeight) 613 { 614 upSampleRatio = 4; 615 } 616 else 617 { 618 assert(0); 619 } 620 621 for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++) //each LCU 622 { 623 UInt uiNumPartitions = 1<<(g_uiMaxCUDepth<<1); 624 625 TComDataCU* pcCUDes = getCU(cuIdx); 626 627 UInt uiWidthMinPU = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth); 628 UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth); 629 Int unitNum = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) ); 630 631 for(UInt uiAbsPartIdx = 0; uiAbsPartIdx < uiNumPartitions; uiAbsPartIdx+=unitNum ) //each 16x16 unit 632 { 633 //pixel position of each unit in up-sampled layer 634 UInt uiPelX = pcCUDes->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 635 UInt uiPelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 636 UInt uiBaseCUAddr, uiBaseAbsPartIdx; 637 pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx); 638 if( (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode 639 { 640 for(UInt list = 0; list < 2; list++) //each list 641 { 642 TComMv cMv = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getMv(uiBaseAbsPartIdx); 643 Int refIdx = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getRefIdx(uiBaseAbsPartIdx); 644 645 Int Hor = ((Int)upSampleRatio * cMv.getHor())/2 ; 646 Int Ver = ((Int)upSampleRatio * cMv.getVer())/2 ; 647 648 TComMv cScaledMv(Hor, Ver); 649 TComMvField sMvField; 650 sMvField.setMvField(cScaledMv, refIdx); 651 652 pcCUDes->getCUMvField((RefPicList)list)->setMvField(sMvField, uiAbsPartIdx); 653 pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTER); 654 } 655 } 656 657 else 658 { 659 TComMvField zeroMvField; //zero MV and invalid reference index 660 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, uiAbsPartIdx); 661 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, uiAbsPartIdx); 662 pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTRA); 663 } 664 665 for(UInt i = 1; i < unitNum; i++ ) 666 { 667 pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(uiAbsPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiAbsPartIdx), uiAbsPartIdx + i); 668 pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(uiAbsPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiAbsPartIdx), uiAbsPartIdx + i); 669 pcCUDes->setPredictionMode(uiAbsPartIdx+i, pcCUDes->getPredictionMode(uiAbsPartIdx)) ; 670 } 671 } 672 memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(char)*uiNumPartitions); 673 } 674 } 556 675 #endif 557 676 677 #endif 678 558 679 //! \} -
trunk/source/Lib/TLibCommon/TComPic.h
r21 r28 88 88 Bool m_bSpatialEnhLayer; // whether current layer is a spatial enhancement layer, 89 89 TComPicYuv* m_pcFullPelBaseRec; // upsampled base layer recontruction for difference domain inter prediction 90 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE 90 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM 91 91 Bool m_bIsILR; // Is ILR picture 92 92 #endif … … 118 118 TComPicYuv* getFullPelBaseRec () { return m_pcFullPelBaseRec; } 119 119 #endif 120 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE 120 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM 121 121 Void setIsILR( Bool bIsILR) {m_bIsILR = bIsILR;} 122 122 Bool getIsILR() {return m_bIsILR;} 123 #endif 124 125 #if REF_IDX_MFM 126 Void copyUpsampledMvField ( TComPic* pcPicBase ); 127 Void deriveUnitIdxBase ( UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx ); 123 128 #endif 124 129 -
trunk/source/Lib/TLibCommon/TComPicYuv.h
r2 r28 129 129 #endif 130 130 131 #if JCTVC_L0178 132 Void setWidth ( Int iPicWidth ) { m_iPicWidth = iPicWidth; } 133 #endif 131 134 Int getStride () { return (m_iPicWidth ) + (m_iLumaMarginX <<1); } 132 135 Int getCStride () { return (m_iPicWidth >> 1) + (m_iChromaMarginX<<1); } -
trunk/source/Lib/TLibCommon/TComSlice.cpp
r11 r28 519 519 if(getSPS()->getLayerId() && m_eSliceType != I_SLICE) 520 520 { 521 #if REF_IDX_MFM 522 assert(iRefPicNum == 1); 523 if( getPOC() != 0 ) 524 { 525 pIlpPicList[0]->copyUpsampledMvField(getBaseColPic()); 526 } 527 #endif 521 528 //add to list 0; 522 529 Int iOffset; … … 546 553 } 547 554 } 555 556 #if REF_IDX_MFM 557 Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic *pcRefPicBL ) 558 { 559 //set reference picture POC of each ILP reference 560 Int thePoc = ilpPic[0]->getPOC(); 561 assert(thePoc >= 0); 562 assert(thePoc == pcRefPicBL->getPOC()); 563 564 //initialize reference POC of ILP 565 for(Int refIdx = 0; refIdx < MAX_NUM_REF; refIdx++) 566 { 567 ilpPic[0]->getSlice(0)->setRefPOC(0, REF_PIC_LIST_0, refIdx); 568 ilpPic[0]->getSlice(0)->setRefPOC(0, REF_PIC_LIST_1, refIdx); 569 570 ilpPic[0]->getSlice(0)->setRefPic(NULL, REF_PIC_LIST_0, refIdx); 571 ilpPic[0]->getSlice(0)->setRefPic(NULL, REF_PIC_LIST_1, refIdx); 572 } 573 574 //set reference POC of ILP 575 ilpPic[0]->getSlice(0)->setNumRefIdx(REF_PIC_LIST_0, pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0)); 576 assert(ilpPic[0]->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0) <= MAX_NUM_REF); 577 ilpPic[0]->getSlice(0)->setNumRefIdx(REF_PIC_LIST_1, pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1)); 578 assert(ilpPic[0]->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1) <= MAX_NUM_REF); 579 580 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0); refIdx++) 581 { 582 ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx); 583 } 584 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1); refIdx++) 585 { 586 ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx); 587 } 588 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0); refIdx++) 589 { 590 ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx); 591 } 592 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1); refIdx++) 593 { 594 ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx); 595 } 596 return; 597 } 598 #endif 599 548 600 #endif 549 601 -
trunk/source/Lib/TLibCommon/TComSlice.h
r11 r28 649 649 UInt m_layerId; 650 650 #endif 651 #if REF_IDX_MFM 652 Bool m_bMFMEnabledFlag; 653 #endif 651 654 public: 652 655 TComSPS(); … … 837 840 UInt getLayerId() { return m_layerId; } 838 841 #endif 842 #if REF_IDX_MFM 843 Void setMFMEnabledFlag(Bool flag) {m_bMFMEnabledFlag = flag;} 844 Bool getMFMEnabledFlag() {return m_bMFMEnabledFlag;} 845 #endif 839 846 }; 840 847 … … 1448 1455 TComPicYuv* getFullPelBaseRec () { return m_pcFullPelBaseRec; } 1449 1456 #endif 1457 1458 #if REF_IDX_MFM 1459 Void setRefPOCListILP(TComPic** ilpPic, TComPic *pcRefPicBL); 1460 #endif 1461 1450 1462 Void setRefPicList ( TComList<TComPic*>& rcListPic ); 1451 1463 Void setRefPOCList (); -
trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r18 r28 143 143 Int iEHeight = pcUsPic->getHeight() - pcUsPic->getPicCropTopOffset() - pcUsPic->getPicCropBottomOffset(); 144 144 Int iEStride = pcUsPic->getStride(); 145 145 146 Pel* piTempBufY = pcTempPic->getLumaAddr(); 147 Pel* piSrcBufY = pcBasePic->getLumaAddr(); 148 Pel* piDstBufY = pcUsPic->getLumaAddr(); 149 150 Pel* piSrcY; 151 Pel* piDstY; 152 153 Pel* piTempBufU = pcTempPic->getCbAddr(); 154 Pel* piSrcBufU = pcBasePic->getCbAddr(); 155 Pel* piDstBufU = pcUsPic->getCbAddr(); 156 157 Pel* piTempBufV = pcTempPic->getCrAddr(); 158 Pel* piSrcBufV = pcBasePic->getCrAddr(); 159 Pel* piDstBufV = pcUsPic->getCrAddr(); 160 161 Pel* piSrcU; 162 Pel* piDstU; 163 Pel* piSrcV; 164 Pel* piDstV; 165 166 #if JCTVC_L0178 167 Pel *tempBufRight = NULL, *tempBufBottom = NULL; 168 Int tempBufSizeRight = 0, tempBufSizeBottom = 0; 169 170 if ( pcBasePic->getPicCropRightOffset() ) 171 { 172 tempBufSizeRight = pcBasePic->getPicCropRightOffset() * pcBasePic->getHeight(); 173 } 174 175 if( pcBasePic->getPicCropBottomOffset() ) 176 { 177 tempBufSizeBottom = pcBasePic->getPicCropBottomOffset() * pcBasePic->getWidth (); 178 } 179 180 if( tempBufSizeRight ) 181 { 182 tempBufRight = (Pel *) xMalloc(Pel, tempBufSizeRight + (tempBufSizeRight>>1) ); 183 assert( tempBufRight ); 184 } 185 186 if( tempBufSizeBottom ) 187 { 188 tempBufBottom = (Pel *) xMalloc(Pel, tempBufSizeBottom + (tempBufSizeBottom>>1) ); 189 assert( tempBufBottom ); 190 } 191 192 #endif 193 146 194 #if PHASE_DERIVATION_IN_INTEGER 147 195 Int iRefPos16 = 0; … … 179 227 #endif 180 228 181 Pel* piTempBufY = pcTempPic->getLumaAddr(); 182 Pel* piSrcBufY = pcBasePic->getLumaAddr(); 183 Pel* piDstBufY = pcUsPic->getLumaAddr(); 184 185 Pel* piSrcY; 186 Pel* piDstY; 229 187 230 188 231 assert ( iEWidth == 2*iBWidth || 2*iEWidth == 3*iBWidth ); 189 232 assert ( iEHeight == 2*iBHeight || 2*iEHeight == 3*iBHeight ); 190 233 234 #if JCTVC_L0178 235 // save the cropped region to copy back to the base picture since the base picture might be used as a reference picture 236 if( tempBufSizeRight ) 237 { 238 piSrcY = piSrcBufY + iBWidth; 239 piDstY = tempBufRight; 240 for( i = 0; i < pcBasePic->getHeight(); i++ ) 241 { 242 memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getPicCropRightOffset()); 243 piSrcY += iBStride; 244 piDstY += pcBasePic->getPicCropRightOffset(); 245 } 246 247 if(pcBasePic->getPicCropRightOffset()>>1) 248 { 249 Int iBStrideChroma = (iBStride>>1); 250 piSrcU = piSrcBufU + (iBWidth>>1); 251 piDstU = tempBufRight + pcBasePic->getPicCropRightOffset() * pcBasePic->getHeight(); 252 piSrcV = piSrcBufV + (iBWidth>>1); 253 piDstV = piDstU + (pcBasePic->getPicCropRightOffset()>>1) * (pcBasePic->getHeight()>>1); 254 255 for( i = 0; i < pcBasePic->getHeight()>>1; i++ ) 256 { 257 memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getPicCropRightOffset()>>1)); 258 piSrcU += iBStrideChroma; 259 piDstU += (pcBasePic->getPicCropRightOffset()>>1); 260 261 memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getPicCropRightOffset()>>1)); 262 piSrcV += iBStrideChroma; 263 piDstV += (pcBasePic->getPicCropRightOffset()>>1); 264 } 265 } 266 267 pcBasePic->setWidth(iBWidth); 268 } 269 270 if( tempBufSizeBottom ) 271 { 272 piSrcY = piSrcBufY + iBHeight * iBStride; 273 piDstY = tempBufBottom; 274 for( i = 0; i < pcBasePic->getPicCropBottomOffset(); i++ ) 275 { 276 memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getWidth()); 277 piSrcY += iBStride; 278 piDstY += pcBasePic->getWidth(); 279 } 280 281 if(pcBasePic->getPicCropBottomOffset()>>1) 282 { 283 Int iBStrideChroma = (iBStride>>1); 284 piSrcU = piSrcBufU + (iBHeight>>1) * iBStrideChroma; 285 piDstU = tempBufBottom + pcBasePic->getPicCropBottomOffset() * pcBasePic->getWidth(); 286 piSrcV = piSrcBufV + (iBHeight>>1) * iBStrideChroma; 287 piDstV = piDstU + (pcBasePic->getPicCropBottomOffset()>>1) * (pcBasePic->getWidth()>>1); 288 289 for( i = 0; i < pcBasePic->getPicCropBottomOffset()>>1; i++ ) 290 { 291 memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getWidth()>>1)); 292 piSrcU += iBStrideChroma; 293 piDstU += (pcBasePic->getWidth()>>1); 294 295 memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getWidth()>>1)); 296 piSrcV += iBStrideChroma; 297 piDstV += (pcBasePic->getWidth()>>1); 298 } 299 } 300 301 pcBasePic->setHeight(iBHeight); 302 } 303 #endif 304 191 305 pcBasePic->setBorderExtension(false); 192 306 pcBasePic->extendPicBorder (); // extend the border. … … 278 392 279 393 //========== UV component upsampling =========== 280 Pel* piTempBufU = pcTempPic->getCbAddr();281 Pel* piSrcBufU = pcBasePic->getCbAddr();282 Pel* piDstBufU = pcUsPic->getCbAddr();283 284 Pel* piTempBufV = pcTempPic->getCrAddr();285 Pel* piSrcBufV = pcBasePic->getCrAddr();286 Pel* piDstBufV = pcUsPic->getCrAddr();287 288 Pel* piSrcU;289 Pel* piDstU;290 Pel* piSrcV;291 Pel* piDstV;292 394 293 395 iEWidth >>= 1; … … 405 507 pcTempPic->setBorderExtension(false); 406 508 pcBasePic->setBorderExtension(false); 509 510 #if JCTVC_L0178 511 // copy back the saved cropped region 512 if( tempBufSizeRight ) 513 { 514 // put the correct width back 515 pcBasePic->setWidth(pcBasePic->getWidth()+pcBasePic->getPicCropRightOffset()); 516 } 517 if( tempBufSizeBottom ) 518 { 519 pcBasePic->setHeight(pcBasePic->getHeight()+pcBasePic->getPicCropBottomOffset()); 520 } 521 522 iBWidth = pcBasePic->getWidth () - pcBasePic->getPicCropLeftOffset() - pcBasePic->getPicCropRightOffset(); 523 iBHeight = pcBasePic->getHeight() - pcBasePic->getPicCropTopOffset() - pcBasePic->getPicCropBottomOffset(); 524 525 iBStride = pcBasePic->getStride(); 526 527 if( tempBufSizeRight ) 528 { 529 piSrcY = tempBufRight; 530 piDstY = piSrcBufY + iBWidth; 531 532 for( i = 0; i < pcBasePic->getHeight(); i++ ) 533 { 534 memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getPicCropRightOffset()); 535 piSrcY += pcBasePic->getPicCropRightOffset(); 536 piDstY += iBStride; 537 } 538 539 if(pcBasePic->getPicCropRightOffset()>>1) 540 { 541 Int iBStrideChroma = (iBStride>>1); 542 piSrcU = tempBufRight + pcBasePic->getPicCropRightOffset() * pcBasePic->getHeight(); 543 piDstU = piSrcBufU + (iBWidth>>1); 544 piSrcV = piSrcU + (pcBasePic->getPicCropRightOffset()>>1) * (pcBasePic->getHeight()>>1); 545 piDstV = piSrcBufV + (iBWidth>>1); 546 547 for( i = 0; i < pcBasePic->getHeight()>>1; i++ ) 548 { 549 memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getPicCropRightOffset()>>1)); 550 piSrcU += (pcBasePic->getPicCropRightOffset()>>1); 551 piDstU += iBStrideChroma; 552 553 memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getPicCropRightOffset()>>1)); 554 piSrcV += (pcBasePic->getPicCropRightOffset()>>1); 555 piDstV += iBStrideChroma; 556 } 557 } 558 } 559 560 if( tempBufSizeBottom ) 561 { 562 piDstY = piSrcBufY + iBHeight * iBStride; 563 piSrcY = tempBufBottom; 564 for( i = 0; i < pcBasePic->getPicCropBottomOffset(); i++ ) 565 { 566 memcpy(piDstY, piSrcY, sizeof(Pel) * pcBasePic->getWidth()); 567 piDstY += iBStride; 568 piSrcY += pcBasePic->getWidth(); 569 } 570 571 if(pcBasePic->getPicCropBottomOffset()>>1) 572 { 573 Int iBStrideChroma = (iBStride>>1); 574 piSrcU = tempBufBottom + pcBasePic->getPicCropBottomOffset() * pcBasePic->getWidth(); 575 piDstU = piSrcBufU + (iBHeight>>1) * iBStrideChroma; 576 piSrcV = piSrcU + (pcBasePic->getPicCropBottomOffset()>>1) * (pcBasePic->getWidth()>>1); 577 piDstV = piSrcBufV + (iBHeight>>1) * iBStrideChroma; 578 579 for( i = 0; i < pcBasePic->getPicCropBottomOffset()>>1; i++ ) 580 { 581 memcpy(piDstU, piSrcU, sizeof(Pel) * (pcBasePic->getWidth()>>1)); 582 piSrcU += (pcBasePic->getWidth()>>1); 583 piDstU += iBStrideChroma; 584 585 memcpy(piDstV, piSrcV, sizeof(Pel) * (pcBasePic->getWidth()>>1)); 586 piSrcV += (pcBasePic->getWidth()>>1); 587 piDstV += iBStrideChroma; 588 } 589 } 590 591 } 592 593 if( tempBufSizeRight ) 594 { 595 xFree( tempBufRight ); 596 } 597 if( tempBufSizeBottom ) 598 { 599 xFree( tempBufBottom ); 600 } 601 #endif 407 602 } 408 603 #endif //SVC_EXTENSION -
trunk/source/Lib/TLibCommon/TypeDef.h
r21 r28 60 60 #define REF_IDX_ME_ZEROMV 1 ///< L0051: use zero motion for inter-layer reference picture (without fractional ME) 61 61 #define ENCODER_FAST_MODE 1 ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1. 62 #define REF_IDX_MFM 1 ///< L0336: motion vector mapping of inter-layer reference picture 62 63 #else 63 64 #define INTRA_BL 1 ///< inter-layer texture prediction … … 72 73 #define SVC_BL_CAND_INTRA 0 ///< Intra Base Mode Prediction hook as an example 73 74 #endif 75 #endif 76 77 #if SVC_UPSAMPLING 78 #define JCTVC_L0178 1 ///< implementation of JCTVC-L0178 (code only supports right and bottom croppping offsets) 74 79 #endif 75 80 -
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r2 r28 844 844 #endif 845 845 READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" ); pcSPS->setTMVPFlagsPresent(uiCode); 846 #if REF_IDX_MFM 847 if(pcSPS->getLayerId() > 0) 848 { 849 READ_FLAG( uiCode, "sps_enh_mfm_enable_flag" ); 850 pcSPS->setMFMEnabledFlag( uiCode ? true : false ); 851 assert(pcSPS->getMFMEnabledFlag()); 852 } 853 #endif 846 854 #if SUPPORT_FOR_VUI 847 855 READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); -
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r2 r28 287 287 288 288 rpcPic->compressMotion(); 289 290 289 291 Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B'); 290 292 if (!pcSlice->isReferenced()) c += 32; -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r21 r28 164 164 m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true); 165 165 #endif 166 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV 166 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || REF_IDX_MFM 167 167 m_cIlpPic[j]->setIsILR(true); 168 168 #endif … … 270 270 rpcPic->getPicSym()->allocSaoParam(&m_cSAO); 271 271 #endif 272 273 272 274 m_cListPic.pushBack( rpcPic ); 273 275 … … 316 318 rpcPic->getPicSym()->allocSaoParam(&m_cSAO); 317 319 #endif 320 321 318 322 } 319 323 … … 768 772 { 769 773 setILRPic(pcPic); 774 #if REF_IDX_MFM 775 pcSlice->setRefPOCListILP(m_ppcTDecTop[m_layerId]->m_cIlpPic, pcSlice->getBaseColPic()); 776 #endif 777 770 778 pcSlice->addRefPicList ( m_cIlpPic, 771 779 1, … … 880 888 m_cEntropyDecoder.decodeSPS( sps ); 881 889 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 890 #if REF_IDX_MFM 891 m_pcSPS = sps; 892 setMFMEnabledFlag(sps->getMFMEnabledFlag()); 893 #endif 882 894 #if !REMOVE_ALF 883 895 m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); -
trunk/source/Lib/TLibDecoder/TDecTop.h
r2 r28 80 80 ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets 81 81 #endif 82 83 #if REF_IDX_MFM 84 TComSPS* m_pcSPS; 85 Bool m_bMFMEnabledFlag; 86 #endif 87 82 88 TComSlice* m_apcSlicePilot; 83 89 … … 170 176 Void setILRPic(TComPic *pcPic); 171 177 #endif 178 #if REF_IDX_MFM 179 TComSPS* getSPS() {return m_pcSPS;} 180 Void setMFMEnabledFlag(Bool flag) {m_bMFMEnabledFlag = flag;} 181 Bool getMFMEnabledFlag() {return m_bMFMEnabledFlag;} 182 #endif 183 172 184 protected: 173 185 Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); -
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r2 r28 600 600 #endif 601 601 WRITE_FLAG( pcSPS->getTMVPFlagsPresent() ? 1 : 0, "sps_temporal_mvp_enable_flag" ); 602 #if REF_IDX_MFM 603 if( pcSPS->getLayerId() > 0 ) 604 { 605 assert(pcSPS->getMFMEnabledFlag()); 606 WRITE_FLAG( pcSPS->getMFMEnabledFlag() ? 1 : 0, "sps_enh_mfm_enable_flag" ); 607 } 608 #endif 602 609 #if SUPPORT_FOR_VUI 603 610 WRITE_FLAG( pcSPS->getVuiParametersPresentFlag(), "vui_parameters_present_flag" ); -
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r20 r28 1351 1351 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 1352 1352 { 1353 #if REF_IDX_ME_ZEROMV 1354 Bool bZeroMVILR = rpcTempCU->xCheckZeroMVILRMerge(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]); 1355 if(bZeroMVILR) 1356 { 1357 #endif 1353 1358 if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1)) 1354 1359 { … … 1402 1407 } 1403 1408 } 1409 #if REF_IDX_ME_ZEROMV 1410 } 1411 #endif 1404 1412 } 1405 1413 -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r2 r28 465 465 #endif 466 466 467 #if REF_IDX_FRAMEWORK 468 if (pcSlice->getSliceType() == B_SLICE) 469 pcSlice->setColFromL0Flag(1-uiColDir); 470 #endif 471 467 472 // Set reference list 468 473 pcSlice->setRefPicList ( rcListPic ); … … 471 476 { 472 477 m_pcEncTop->setILRPic(pcPic); 478 479 #if REF_IDX_MFM 480 pcSlice->setRefPOCListILP(m_pcEncTop->getIlpList(), pcSlice->getBaseColPic()); 481 #endif 473 482 pcSlice->addRefPicList ( m_pcEncTop->getIlpList(), 1); 483 484 #if REF_IDX_MFM 485 Bool found = false; 486 UInt ColFromL0Flag = pcSlice->getColFromL0Flag(); 487 UInt ColRefIdx = pcSlice->getColRefIdx(); 488 for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++) 489 { 490 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getIsILR() ) 491 { 492 ColRefIdx = colIdx; 493 found = true; 494 break; 495 } 496 } 497 498 if( found == false ) 499 { 500 ColFromL0Flag = 1 - ColFromL0Flag; 501 for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++) 502 { 503 if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getIsILR() ) 504 { 505 ColRefIdx = colIdx; 506 found = true; 507 break; 508 } 509 } 510 } 511 512 if(found == true) 513 { 514 pcSlice->setColFromL0Flag(ColFromL0Flag); 515 pcSlice->setColRefIdx(ColRefIdx); 516 } 517 #endif 474 518 } 475 519 #endif … … 495 539 if (pcSlice->getSliceType() == B_SLICE) 496 540 { 541 #if !REF_IDX_FRAMEWORK 497 542 pcSlice->setColFromL0Flag(1-uiColDir); 543 #endif 498 544 Bool bLowDelay = true; 499 545 Int iCurrPOC = pcSlice->getPOC(); -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r21 r28 3211 3211 for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand ) 3212 3212 { 3213 #if REF_IDX_ME_ZEROMV 3214 Bool bZeroMVILR = pcCU->xCheckZeroMVILRMerge(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]); 3215 if(bZeroMVILR) 3216 { 3217 #endif 3213 3218 UInt uiCostCand = MAX_UINT; 3214 3219 UInt uiBitsCand = 0; … … 3234 3239 uiMergeIndex = uiMergeCand; 3235 3240 } 3241 #if REF_IDX_ME_ZEROMV 3242 } 3243 #endif 3236 3244 } 3237 3245 } … … 3420 3428 if(pcCU->getSlice()->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist) 3421 3429 { 3430 #if REF_IDX_ME_ZEROMV 3431 Bool bZeroMVILR = pcCU->xCheckZeroMVILRMvdL1Zero(iRefList, iRefIdxTemp, aaiMvpIdx[iRefList][iRefIdxTemp]); 3432 if(bZeroMVILR) 3433 { 3434 #endif 3422 3435 bestBiPDist = biPDistTemp; 3423 3436 bestBiPMvpL1 = aaiMvpIdx[iRefList][iRefIdxTemp]; 3424 3437 bestBiPRefIdxL1 = iRefIdxTemp; 3438 #if REF_IDX_ME_ZEROMV 3439 } 3440 #endif 3425 3441 } 3426 3442 … … 3560 3576 } 3561 3577 // Bi-directional prediction 3578 #if REF_IDX_ME_ZEROMV 3579 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) && !(pcCU->getSlice()->getMvdL1ZeroFlag() && bestBiPDist == MAX_INT) ) 3580 #else 3562 3581 if ( (pcCU->getSlice()->isInterB()) && (pcCU->isBipredRestriction(iPartIdx) == false) ) 3582 #endif 3563 3583 { 3564 3584 -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r21 r28 85 85 memset(m_cIlpPic, 0, sizeof(m_cIlpPic)); 86 86 #endif 87 #if REF_IDX_MFM 88 m_bMFMEnabledFlag = false; 89 #endif 87 90 } 88 91 … … 394 397 m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true); 395 398 #endif 396 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE 399 #if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM 397 400 m_cIlpPic[j]->setIsILR(true); 398 401 #endif … … 599 602 // mark it should be extended 600 603 rpcPic->getPicYuvRec()->setBorderExtension(false); 604 601 605 } 602 606 … … 605 609 #if SVC_EXTENSION 606 610 m_cSPS.setLayerId(m_layerId); 611 #endif 612 #if REF_IDX_MFM 613 m_cSPS.setMFMEnabledFlag(m_bMFMEnabledFlag); 607 614 #endif 608 615 -
trunk/source/Lib/TLibEncoder/TEncTop.h
r2 r28 140 140 TComPic* m_cIlpPic[MAX_NUM_REF]; ///< Inter layer Prediction picture = upsampled picture 141 141 #endif 142 #if REF_IDX_MFM 143 Bool m_bMFMEnabledFlag; 144 #endif 142 145 protected: 143 146 Void xGetNewPicBuffer ( TComPic*& rpcPic ); ///< get picture buffer which will be processed … … 228 231 Void setILRPic(TComPic *pcPic); 229 232 #endif 233 #if REF_IDX_MFM 234 Void setMFMEnabledFlag (Bool flag) {m_bMFMEnabledFlag = flag;} 235 Bool getMFMEnabledFlag() {return m_bMFMEnabledFlag;} 236 #endif 230 237 231 238 };
Note: See TracChangeset for help on using the changeset viewer.