Changeset 655 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPrediction.cpp
- Timestamp:
- 23 Oct 2013, 23:01:30 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComPrediction.cpp
r622 r655 39 39 #include "TComPrediction.h" 40 40 41 #if SHARP_ILLUCOMP_REFINE_E004642 #define IC_REG_COST_SHIFT 743 #define IC_CONST_SHIFT 544 #define IC_SHIFT_DIFF 1245 #endif46 47 41 //! \ingroup TLibCommon 48 42 //! \{ … … 69 63 if (m_pDepthBlock != NULL) 70 64 free(m_pDepthBlock); 71 #if NTT_VSP_COMMON_E0207_E020872 65 m_cYuvDepthOnVsp.destroy(); 73 #endif74 66 #endif 75 67 … … 129 121 m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight ); 130 122 #endif 131 #if NTT_VSP_COMMON_E0207_E0208123 #if H_3D_VSP 132 124 m_cYuvDepthOnVsp.create( g_uiMaxCUWidth, g_uiMaxCUHeight ); 133 125 #endif … … 143 135 } 144 136 #if H_3D_IC 145 #if SHARP_ILLUCOMP_REFINE_E0046146 137 m_uiaShift[0] = 0; 147 138 for( Int i = 1; i < 64; i++ ) … … 149 140 m_uiaShift[i] = ( (1 << 15) + i/2 ) / i; 150 141 } 151 #else152 for( Int i = 1; i < 64; i++ )153 {154 m_uiaShift[i-1] = ( (1 << 15) + i/2 ) / i;155 }156 #endif157 142 #endif 158 143 } … … 456 441 dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]); 457 442 } break; 458 #if !SEC_DMM2_E0146_HHIFIX459 case( DMM2_IDX ):460 {461 UInt uiTabIdx = 0;462 if( bFastEnc ) { uiTabIdx = pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ); }463 else464 {465 uiTabIdx = xPredWedgeFromIntra( pcCU, uiAbsPartIdx, iWidth, iHeight, pcCU->getDmm2DeltaEnd( uiAbsPartIdx ) );466 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, uiAbsPartIdx, (pcCU->getDepth(0) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1)) );467 }468 dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]);469 } break;470 #endif471 443 case( DMM3_IDX ): 472 444 { … … 709 681 #endif 710 682 , bICFlag ); 711 #if SHARP_ILLUCOMP_REFINE_E0046712 683 bICFlag = bICFlag && (iWidth > 8); 713 #endif714 684 xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi 715 685 #if H_3D_ARP … … 731 701 // Get depth reference 732 702 Int depthRefViewIdx = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan; 703 #if H_3D_FCO_VSP_DONBDV_E0163 704 TComPic* pRefPicBaseDepth = 0; 705 Bool bIsCurrDepthCoded = false; 706 pRefPicBaseDepth = pcCU->getSlice()->getIvPic( true, pcCU->getSlice()->getViewIndex() ); 707 if ( pRefPicBaseDepth->getPicYuvRec() != NULL ) 708 { 709 bIsCurrDepthCoded = true; 710 } 711 else 712 { 713 pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx ); 714 } 715 #else 733 716 TComPic* pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx ); 717 #endif 734 718 assert(pRefPicBaseDepth != NULL); 735 719 TComPicYuv* pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec(); … … 752 736 pcCU->clipMv(cDv); 753 737 754 #if NTT_VSP_COMMON_E0207_E0208 738 #if H_3D_FCO_VSP_DONBDV_E0163 739 if ( bIsCurrDepthCoded ) 740 { 741 cDv.setZero(); 742 } 743 #endif 755 744 // fetch virtual depth map 756 #if NTT_VSP_VECTOR_CLIP_E0208757 745 pcBaseViewDepthPicYuv->extendPicBorder(); 758 #endif759 746 xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp ); 760 747 // sub-PU based compensation 761 748 xPredInterLumaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi ); 762 749 xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi ); 763 #else764 UInt uiAbsPartIdx = pcCU->getZorderIdxInCU();765 Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];766 Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];767 xPredInterLumaBlkFromDM ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, &cDv, uiPartAddr, iBlkX, iBlkY, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );768 xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, &cDv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );769 #endif770 771 750 } 772 751 #endif … … 984 963 if ( yFrac == 0 ) 985 964 { 986 #if MTK_CLIPPING_ALIGN_IC_E0168965 #if H_3D_IC 987 966 m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac, !bi || bICFlag 988 967 #else … … 996 975 else if ( xFrac == 0 ) 997 976 { 998 #if MTK_CLIPPING_ALIGN_IC_E0168977 #if H_3D_IC 999 978 m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi || bICFlag 1000 979 #else … … 1019 998 #endif 1020 999 ); 1021 #if MTK_CLIPPING_ALIGN_IC_E01681000 #if H_3D_IC 1022 1001 m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height, yFrac, false, !bi || bICFlag 1023 1002 #else … … 1033 1012 if( bICFlag ) 1034 1013 { 1035 #if SHARP_ILLUCOMP_REFINE_E00461036 1014 Int a, b, i, j; 1037 1015 const Int iShift = IC_CONST_SHIFT; 1038 1016 1039 1017 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_LUMA ); 1040 #else1041 Int a, b, iShift, i, j;1042 1043 xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_LUMA );1044 #endif1045 1018 1046 1019 … … 1049 1022 for ( j = 0; j < width; j++ ) 1050 1023 { 1051 #if !MTK_CLIPPING_ALIGN_IC_E01681052 if( bi )1053 {1054 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY;1055 dst[j] = ( ( a*dst[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1 << iIFshift ) - IF_INTERNAL_OFFS;1056 }1057 else1058 #endif1059 1024 dst[j] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, ( ( a*dst[j] ) >> iShift ) + b ); 1060 1025 } 1061 1026 dst += dstStride; 1062 1027 } 1063 #if MTK_CLIPPING_ALIGN_IC_E0168 1028 1064 1029 if(bi) 1065 1030 { … … 1076 1041 } 1077 1042 } 1078 #endif1079 1043 } 1080 1044 #endif … … 1127 1091 if ( yFrac == 0 ) 1128 1092 { 1129 #if MTK_CLIPPING_ALIGN_IC_E01681093 #if H_3D_IC 1130 1094 m_if.filterHorChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag 1131 1095 #else … … 1136 1100 #endif 1137 1101 ); 1138 #if MTK_CLIPPING_ALIGN_IC_E01681102 #if H_3D_IC 1139 1103 m_if.filterHorChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag 1140 1104 #else … … 1148 1112 else if ( xFrac == 0 ) 1149 1113 { 1150 #if MTK_CLIPPING_ALIGN_IC_E01681114 #if H_3D_IC 1151 1115 m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag 1152 1116 #else … … 1157 1121 #endif 1158 1122 ); 1159 #if MTK_CLIPPING_ALIGN_IC_E01681123 #if H_3D_IC 1160 1124 m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag 1161 1125 #else … … 1174 1138 #endif 1175 1139 ); 1176 #if MTK_CLIPPING_ALIGN_IC_E01681140 #if H_3D_IC 1177 1141 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight , yFrac, false, !bi || bICFlag 1178 1142 #else … … 1189 1153 #endif 1190 1154 ); 1191 #if MTK_CLIPPING_ALIGN_IC_E01681155 #if H_3D_IC 1192 1156 m_if.filterVerChroma(extY + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight , yFrac, false, !bi || bICFlag 1193 1157 #else … … 1203 1167 if( bICFlag ) 1204 1168 { 1205 #if SHARP_ILLUCOMP_REFINE_E00461206 1169 Int a, b, i, j; 1207 1170 const Int iShift = IC_CONST_SHIFT; 1208 1171 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_U ); // Cb 1209 #else1210 Int a, b, iShift, i, j;1211 xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_U ); // Cb1212 #endif1213 1172 for ( i = 0; i < cxHeight; i++ ) 1214 1173 { 1215 1174 for ( j = 0; j < cxWidth; j++ ) 1216 1175 { 1217 #if !MTK_CLIPPING_ALIGN_IC_E01681218 if( bi )1219 {1220 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;1221 dstCb[j] = ( ( a*dstCb[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1<<iIFshift ) - IF_INTERNAL_OFFS;1222 }1223 else1224 #endif1225 1176 dstCb[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCb[j] ) >> iShift ) + b ); 1226 1177 } 1227 1178 dstCb += dstStride; 1228 1179 } 1229 #if SHARP_ILLUCOMP_REFINE_E00461230 1180 xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_V ); // Cr 1231 #else1232 xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_V ); // Cr1233 #endif1234 1181 for ( i = 0; i < cxHeight; i++ ) 1235 1182 { 1236 1183 for ( j = 0; j < cxWidth; j++ ) 1237 1184 { 1238 #if !MTK_CLIPPING_ALIGN_IC_E01681239 if( bi )1240 {1241 Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;1242 dstCr[j] = ( ( a*dstCr[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1<<iIFshift ) - IF_INTERNAL_OFFS;1243 }1244 else1245 #endif1246 1185 dstCr[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCr[j] ) >> iShift ) + b ); 1247 1186 } 1248 1187 dstCr += dstStride; 1249 1188 } 1250 #if MTK_CLIPPING_ALIGN_IC_E0168 1189 1251 1190 if(bi) 1252 1191 { … … 1268 1207 } 1269 1208 } 1270 #endif1271 1209 } 1272 1210 #endif … … 1323 1261 Int k, l, bottomLeft, topRight; 1324 1262 Int horPred; 1325 Int leftColumn[MAX_CU_SIZE ], topRow[MAX_CU_SIZE], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE];1263 Int leftColumn[MAX_CU_SIZE+1], topRow[MAX_CU_SIZE+1], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE]; 1326 1264 UInt blkSize = width; 1327 1265 UInt offset2D = width; … … 1417 1355 } 1418 1356 1419 #if !SHARP_ILLUCOMP_REFINE_E00461420 /** Function for counting leading number of zeros/ones1421 * \param x input value1422 \ This function counts leading number of zeros for positive numbers and1423 \ leading number of ones for negative numbers. This can be implemented in1424 \ single instructure cycle on many processors.1425 */1426 1427 Short CountLeadingZerosOnes (Short x)1428 {1429 Short clz;1430 Short i;1431 1432 if(x == 0)1433 {1434 clz = 0;1435 }1436 else1437 {1438 if (x == -1)1439 {1440 clz = 15;1441 }1442 else1443 {1444 if(x < 0)1445 {1446 x = ~x;1447 }1448 clz = 15;1449 for(i = 0;i < 15;++i)1450 {1451 if(x)1452 {1453 clz --;1454 }1455 x = x >> 1;1456 }1457 }1458 }1459 return clz;1460 }1461 #endif1462 1357 1463 1358 /** Function for deriving LM illumination compensation. 1464 1359 */ 1465 #if SHARP_ILLUCOMP_REFINE_E00461466 1360 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType ) 1467 #else1468 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType )1469 #endif1470 1361 { 1471 1362 TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec(); … … 1495 1386 1496 1387 Int x = 0, y = 0, xx = 0, xy = 0; 1497 #if SHARP_ILLUCOMP_REFINE_E00461498 1388 Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12); 1499 #endif1500 1389 1501 1390 if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelY > 0 && iRefY > 0 ) … … 1519 1408 } 1520 1409 1521 #if SHARP_ILLUCOMP_REFINE_E00461522 1410 for( j = 0; j < uiWidth; j+=2 ) 1523 #else1524 for( j = 0; j < uiWidth; j++ )1525 #endif1526 1411 { 1527 1412 x += pRef[j]; 1528 1413 y += pRec[j]; 1529 #if SHARP_ILLUCOMP_REFINE_E00461530 1414 xx += (pRef[j] * pRef[j])>>precShift; 1531 1415 xy += (pRef[j] * pRec[j])>>precShift; 1532 #else 1533 xx += pRef[j] * pRef[j]; 1534 xy += pRef[j] * pRec[j]; 1535 #endif 1536 } 1537 #if SHARP_ILLUCOMP_REFINE_E0046 1416 } 1538 1417 iCountShift += g_aucConvertToBit[ uiWidth ] + 1; 1539 #else1540 iCountShift += g_aucConvertToBit[ uiWidth ] + 2;1541 #endif1542 1418 } 1543 1419 … … 1563 1439 } 1564 1440 1565 #if SHARP_ILLUCOMP_REFINE_E00461566 1441 for( i = 0; i < uiHeight; i+=2 ) 1567 #else1568 for( i = 0; i < uiHeight; i++ )1569 #endif1570 1442 { 1571 1443 x += pRef[0]; 1572 1444 y += pRec[0]; 1573 #if SHARP_ILLUCOMP_REFINE_E0046 1445 1574 1446 xx += (pRef[0] * pRef[0])>>precShift; 1575 1447 xy += (pRef[0] * pRec[0])>>precShift; … … 1577 1449 pRef += iRefStride*2; 1578 1450 pRec += iRecStride*2; 1579 #else 1580 xx += pRef[0] * pRef[0]; 1581 xy += pRef[0] * pRec[0]; 1582 1583 pRef += iRefStride; 1584 pRec += iRecStride; 1585 #endif 1586 } 1587 #if SHARP_ILLUCOMP_REFINE_E0046 1451 } 1588 1452 iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 1 ); 1589 #else 1590 iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 2 ); 1591 #endif 1592 } 1593 1594 #if SHARP_ILLUCOMP_REFINE_E0046 1453 } 1454 1595 1455 xy += xx >> IC_REG_COST_SHIFT; 1596 1456 xx += xx >> IC_REG_COST_SHIFT; … … 1599 1459 const Int iShift = IC_CONST_SHIFT; 1600 1460 { 1601 #else1602 Int iTempShift = ( ( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC ) + g_aucConvertToBit[ uiWidth ] + 3 - 15;1603 1604 if( iTempShift > 0 )1605 {1606 x = ( x + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;1607 y = ( y + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;1608 xx = ( xx + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;1609 xy = ( xy + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;1610 iCountShift -= iTempShift;1611 }1612 1613 iShift = 13;1614 1615 if( iCountShift == 0 )1616 {1617 a = 1;1618 b = 0;1619 iShift = 0;1620 }1621 else1622 {1623 Int a1 = ( xy << iCountShift ) - y * x;1624 Int a2 = ( xx << iCountShift ) - x * x;1625 #endif1626 1461 { 1627 1462 const Int iShiftA2 = 6; 1628 #if !SHARP_ILLUCOMP_REFINE_E00461629 const Int iShiftA1 = 15;1630 #endif1631 1463 const Int iAccuracyShift = 15; 1632 1464 … … 1636 1468 Int a2s = a2; 1637 1469 1638 #if SHARP_ILLUCOMP_REFINE_E00461639 1470 a1 = Clip3(0, 2*a2, a1); 1640 1471 iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2; 1641 1472 iScaleShiftA1 = iScaleShiftA2 - IC_SHIFT_DIFF; 1642 #else1643 iScaleShiftA1 = GetMSB( abs( a1 ) ) - iShiftA1;1644 iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2;1645 #endif1646 1473 1647 1474 if( iScaleShiftA1 < 0 ) … … 1662 1489 a1s = a1 >> iScaleShiftA1; 1663 1490 1664 #if SHARP_ILLUCOMP_REFINE_E00461665 1491 a = a1s * m_uiaShift[ a2s ]; 1666 1492 a = a >> iScaleShiftA; 1667 #else1668 if (a2s >= 1)1669 {1670 a = a1s * m_uiaShift[ a2s - 1];1671 }1672 else1673 {1674 a = 0;1675 }1676 1677 if( iScaleShiftA < 0 )1678 {1679 a = a << -iScaleShiftA;1680 }1681 else1682 {1683 a = a >> iScaleShiftA;1684 }1685 1686 a = Clip3( -( 1 << 15 ), ( 1 << 15 ) - 1, a );1687 1688 Int minA = -(1 << (6));1689 Int maxA = (1 << 6) - 1;1690 if( a <= maxA && a >= minA )1691 {1692 // do nothing1693 }1694 else1695 {1696 Short n = CountLeadingZerosOnes( a );1697 a = a >> (9-n);1698 iShift -= (9-n);1699 }1700 #endif1701 1493 b = ( y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift; 1702 1494 } … … 1706 1498 1707 1499 #if H_3D_VSP 1708 1709 #if NTT_VSP_COMMON_E0207_E02081710 1500 // not fully support iRatioTxtPerDepth* != 1 1711 1501 Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY ) … … 1715 1505 1716 1506 Int refDepStride = picRefDepth->getStride(); 1717 1718 #if NTT_VSP_VECTOR_CLIP_E02081719 1507 1720 1508 Int refDepOffset = ( (mv->getHor()+2) >> 2 ) + ( (mv->getVer()+2) >> 2 ) * refDepStride; … … 1736 1524 refDepth += refDepOffset; 1737 1525 1738 #else // NTT_VSP_VECTOR_CLIP_E02081739 1740 Int widthDepth = picRefDepth->getWidth();1741 Int heightDepth = picRefDepth->getHeight();1742 Int posX, posY;1743 cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture1744 posX /= ratioTxtPerDepthX; // texture position -> depth postion1745 posY /= ratioTxtPerDepthY;1746 1747 posX = Clip3(0, widthDepth-width, posX + ((mv->getHor()+2)>>2));1748 posY = Clip3(0, heightDepth-height, posY + ((mv->getVer()+2)>>2));1749 1750 Pel *refDepth = picRefDepth->getLumaAddr() + posX + posY * refDepStride;1751 1752 #endif // NTT_VSP_VECTOR_CLIP_E02081753 1754 1526 Int depStride = yuvDepth->getStride(); 1755 1527 Pel *depth = yuvDepth->getLumaAddr(); 1756 1757 #if NTT_VSP_ADAPTIVE_SPLIT_E02071758 1528 1759 1529 if( width<8 || height<8 ) … … 1894 1664 } 1895 1665 1896 #else // NTT_VSP_ADAPTIVE_SPLIT_E0207 1897 1898 Int rightOffset = nTxtPerDepthX - 1; 1899 Int depStrideBlock = depStride * nTxtPerDepthY; 1900 Int refDepStrideBlock = refDepStride * nTxtPerDepthY; 1901 Pel *refDepthTop = refDepth; 1902 Pel *refDepthBot = refDepthTop + (nTxtPerDepthY-1)*refDepStride; 1903 1904 for( Int y=0; y<height; y+= nTxtPerDepthY ) 1905 { 1906 for( Int x=0; x<width; x+=nTxtPerDepthX ) 1907 { 1908 Pel maxDepth = refDepthTop[x] > refDepthBot[x] ? refDepthTop[x] : refDepthBot[x]; 1909 1910 if( maxDepth < refDepthTop[x+rightOffset] ) 1911 { 1912 maxDepth = refDepthTop[x+rightOffset]; 1913 } 1914 if( maxDepth < refDepthBot[x+rightOffset] ) 1915 { 1916 maxDepth = refDepthBot[x+rightOffset]; 1917 } 1918 1919 depth[x] = maxDepth; 1920 1921 } 1922 refDepthTop += refDepStrideBlock; 1923 refDepthBot += refDepStrideBlock; 1924 depth += depStrideBlock; 1925 } 1926 1927 #endif // NTT_VSP_ADAPTIVE_SPLIT_E0207 1666 1928 1667 } 1929 1668 … … 1943 1682 Pel *dst = yuvDst->getLumaAddr(partAddr); 1944 1683 Pel *depth = yuvDepth->getLumaAddr(); 1945 1946 #if !(NTT_VSP_DC_BUGFIX_E0208)1947 Int widthLuma = picRef->getWidth();1948 Int posX, posY;1949 cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture1950 #endif1951 1684 1952 1685 #if H_3D_VSP_BLOCKSIZE == 1 … … 2021 1754 Int xFrac = disparity & 0x3; 2022 1755 2023 #if NTT_VSP_DC_BUGFIX_E02082024 2025 1756 dv.setHor( disparity ); 2026 1757 cu->clipMv( dv ); … … 2038 1769 assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 ); 2039 1770 m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi ); 2040 2041 #else // NTT_VSP_DC_BUGFIX_E02082042 2043 for( Int j=0; j < nTxtPerDepthX; j++ )2044 {2045 Int refOffset = xTxt+j + (disparity >> 2);2046 #if H_3D_VSP_CONSTRAINED2047 if(refOffset<minRelativePos || refOffset>maxRelativePos)2048 {2049 xFrac = 0;2050 }2051 refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);2052 #endif2053 Int absX = posX + refOffset;2054 2055 if (xFrac == 0)2056 {2057 absX = Clip3(0, widthLuma-1, absX);2058 }2059 else2060 {2061 absX = Clip3(4, widthLuma-5, absX);2062 }2063 2064 refOffset = absX - posX;2065 assert( ref[refOffset] >= 0 && ref[refOffset] <= 255 );2066 2067 m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );2068 }2069 2070 #endif // NTT_VSP_DC_BUGFIX_E02082071 2072 1771 } 2073 1772 ref += refStrideBlock; … … 2101 1800 Pel *depth = yuvDepth->getLumaAddr(); 2102 1801 2103 #if !(NTT_VSP_DC_BUGFIX_E0208)2104 Int widthChroma = picRef->getWidth() >> 1;2105 Int posX, posY;2106 cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture2107 posX >>= 1;2108 posY >>= 1;2109 #endif2110 2111 1802 #if H_3D_VSP_BLOCKSIZE == 1 2112 1803 #if H_3D_VSP_CONSTRAINED … … 2173 1864 Int xFrac = disparity & 0x7; 2174 1865 2175 #if NTT_VSP_DC_BUGFIX_E02082176 2177 1866 dv.setHor( disparity ); 2178 1867 cu->clipMv( dv ); … … 2193 1882 m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi ); 2194 1883 m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi ); 2195 2196 #else // NTT_VSP_DC_BUGFIX_E02082197 2198 for( Int j=0; j < nTxtPerDepthX; j++ )2199 {2200 Int refOffset = xTxt+j + (disparity >> 3);2201 #if H_3D_VSP_CONSTRAINED2202 if(refOffset<minRelativePos || refOffset>maxRelativePos)2203 {2204 xFrac = 0;2205 }2206 refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);2207 #endif2208 Int absX = posX + refOffset;2209 2210 if (xFrac == 0)2211 {2212 absX = Clip3(0, widthChroma-1, absX);2213 }2214 else2215 {2216 absX = Clip3(4, widthChroma-5, absX);2217 }2218 2219 refOffset = absX - posX;2220 assert( refCb[refOffset] >= 0 && refCb[refOffset] <= 255 );2221 assert( refCr[refOffset] >= 0 && refCr[refOffset] <= 255 );2222 2223 m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );2224 m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );2225 }2226 2227 #endif // NTT_VSP_DC_BUGFIX_E02082228 1884 } 2229 1885 refCb += refStrideBlock; … … 2233 1889 depth += depStrideBlock; 2234 1890 } 2235 2236 } 2237 #else // NTT_VSP_COMMON_E0207_E0208 2238 2239 // Input: 2240 // refPic: Ref picture. Full picture, with padding 2241 // posX, posY: PU position, texture 2242 // sizeX, sizeY: PU size 2243 // partAddr: z-order index 2244 // dv: disparity vector. derived from neighboring blocks 2245 // 2246 // Output: dstPic, PU predictor 64x64 2247 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr,Int posX, Int posY 2248 , Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi ) 2249 { 2250 Int widthLuma; 2251 Int heightLuma; 2252 2253 if (isDepth) 2254 { 2255 widthLuma = pPicBaseDepth->getWidth(); 2256 heightLuma = pPicBaseDepth->getHeight(); 2257 } 2258 else 2259 { 2260 widthLuma = refPic->getWidth(); 2261 heightLuma = refPic->getHeight(); 2262 } 2263 2264 #if H_3D_VSP_BLOCKSIZE != 1 2265 Int widthDepth = pPicBaseDepth->getWidth(); 2266 Int heightDepth = pPicBaseDepth->getHeight(); 2267 #endif 2268 2269 #if H_3D_VSP_CONSTRAINED 2270 Int widthDepth = pPicBaseDepth->getWidth(); 2271 Int heightDepth = pPicBaseDepth->getHeight(); 2272 #endif 2273 2274 Int nTxtPerDepthX = widthLuma / ( pPicBaseDepth->getWidth() ); // texture pixel # per depth pixel 2275 Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() ); 2276 2277 Int refStride = refPic->getStride(); 2278 Int dstStride = dstPic->getStride(); 2279 Int depStride = pPicBaseDepth->getStride(); 2280 Int depthPosX = Clip3(0, widthLuma - sizeX, (posX/nTxtPerDepthX) + ((dv->getHor()+2)>>2)); 2281 Int depthPosY = Clip3(0, heightLuma- sizeY, (posY/nTxtPerDepthY) + ((dv->getVer()+2)>>2)); 2282 Pel *ref = refPic->getLumaAddr() + posX + posY * refStride; 2283 Pel *dst = dstPic->getLumaAddr(partAddr); 2284 Pel *depth = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride; 2285 2286 #if H_3D_VSP_BLOCKSIZE != 1 2287 #if H_3D_VSP_BLOCKSIZE == 2 2288 Int dW = sizeX>>1; 2289 Int dH = sizeY>>1; 2290 #endif 2291 #if H_3D_VSP_BLOCKSIZE == 4 2292 Int dW = sizeX>>2; 2293 Int dH = sizeY>>2; 2294 #endif 2295 { 2296 Pel* depthi = depth; 2297 for (Int j = 0; j < dH; j++) 2298 { 2299 for (Int i = 0; i < dW; i++) 2300 { 2301 Pel* depthTmp; 2302 #if H_3D_VSP_BLOCKSIZE == 2 2303 if (depthPosX + (i<<1) < widthDepth) 2304 depthTmp = depthi + (i << 1); 2305 else 2306 depthTmp = depthi + (widthDepth - depthPosX - 1); 2307 #endif 2308 #if H_3D_VSP_BLOCKSIZE == 4 2309 if (depthPosX + (i<<2) < widthDepth) 2310 depthTmp = depthi + (i << 2); 2311 else 2312 depthTmp = depthi + (widthDepth - depthPosX - 1); 2313 #endif 2314 Int maxV = 0; 2315 for (Int blockj = 0; blockj < H_3D_VSP_BLOCKSIZE; blockj+=(H_3D_VSP_BLOCKSIZE-1)) 2316 { 2317 Int iX = 0; 2318 for (Int blocki = 0; blocki < H_3D_VSP_BLOCKSIZE; blocki+=(H_3D_VSP_BLOCKSIZE-1)) 2319 { 2320 if (maxV < depthTmp[iX]) 2321 maxV = depthTmp[iX]; 2322 #if H_3D_VSP_BLOCKSIZE == 2 2323 if (depthPosX + (i<<1) + blocki < widthDepth - 1) 2324 #else // H_3D_VSP_BLOCKSIZE == 4 2325 if (depthPosX + (i<<2) + blocki < widthDepth - 1) 2326 #endif 2327 iX = (H_3D_VSP_BLOCKSIZE-1); 2328 } 2329 #if H_3D_VSP_BLOCKSIZE == 2 2330 if (depthPosY + (j<<1) + blockj < heightDepth - 1) 2331 #else // H_3D_VSP_BLOCKSIZE == 4 2332 if (depthPosY + (j<<2) + blockj < heightDepth - 1) 2333 #endif 2334 depthTmp += depStride * (H_3D_VSP_BLOCKSIZE-1); 2335 } 2336 m_pDepthBlock[i+j*dW] = maxV; 2337 } // end of i < dW 2338 #if H_3D_VSP_BLOCKSIZE == 2 2339 if (depthPosY + ((j+1)<<1) < heightDepth) 2340 depthi += (depStride << 1); 2341 else 2342 depthi = depth + (heightDepth-depthPosY-1)*depStride; 2343 #endif 2344 #if H_3D_VSP_BLOCKSIZE == 4 2345 if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1 2346 depthi += (depStride << 2); 2347 else 2348 depthi = depth + (heightDepth-depthPosY-1)*depStride; // the last line 2349 #endif 2350 } 2351 } 2352 #endif // H_3D_VSP_BLOCKSIZE != 1 2353 2354 #if H_3D_VSP_BLOCKSIZE == 1 2355 #if H_3D_VSP_CONSTRAINED 2356 //get LUT based horizontal reference range 2357 Int range = xGetConstrainedSize(sizeX, sizeY); 2358 2359 // The minimum depth value 2360 Int minRelativePos = MAX_INT; 2361 Int maxRelativePos = MIN_INT; 2362 2363 Pel* depthTemp, *depthInitial=depth; 2364 for (Int yTxt = 0; yTxt < sizeY; yTxt++) 2365 { 2366 for (Int xTxt = 0; xTxt < sizeX; xTxt++) 2367 { 2368 if (depthPosX+xTxt < widthDepth) 2369 depthTemp = depthInitial + xTxt; 2370 else 2371 depthTemp = depthInitial + (widthDepth - depthPosX - 1); 2372 2373 Int disparity = pShiftLUT[ *depthTemp ]; // << iShiftPrec; 2374 Int disparityInt = disparity >> 2; 2375 2376 if( disparity <= 0) 2377 { 2378 if (minRelativePos > disparityInt+xTxt) 2379 minRelativePos = disparityInt+xTxt; 2380 } 2381 else 2382 { 2383 if (maxRelativePos < disparityInt+xTxt) 2384 maxRelativePos = disparityInt+xTxt; 2385 } 2386 } 2387 if (depthPosY+yTxt < heightDepth) 2388 depthInitial = depthInitial + depStride; 2389 } 2390 2391 Int disparity_tmp = pShiftLUT[ *depth ]; // << iShiftPrec; 2392 if (disparity_tmp <= 0) 2393 maxRelativePos = minRelativePos + range -1 ; 2394 else 2395 minRelativePos = maxRelativePos - range +1 ; 2396 #endif 2397 #endif // H_3D_VSP_BLOCKSIZE == 1 2398 2399 #if H_3D_VSP_BLOCKSIZE != 1 2400 Int yDepth = 0; 2401 #endif 2402 for ( Int yTxt = 0; yTxt < sizeY; yTxt += nTxtPerDepthY ) 2403 { 2404 for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth++ ) 2405 { 2406 Pel repDepth = 0; // to store the depth value used for warping 2407 #if H_3D_VSP_BLOCKSIZE == 1 2408 repDepth = depth[xDepth]; 2409 #endif 2410 #if H_3D_VSP_BLOCKSIZE == 2 2411 repDepth = m_pDepthBlock[(xTxt>>1) + (yTxt>>1)*dW]; 2412 #endif 2413 #if H_3D_VSP_BLOCKSIZE == 4 2414 repDepth = m_pDepthBlock[(xTxt>>2) + (yTxt>>2)*dW]; 2415 #endif 2416 2417 assert( repDepth >= 0 && repDepth <= 255 ); 2418 Int disparity = pShiftLUT[ repDepth ]; // remove << iShiftPrec ?? 2419 Int refOffset = xTxt + (disparity >> 2); 2420 Int xFrac = disparity & 0x3; 2421 #if H_3D_VSP_CONSTRAINED 2422 if(refOffset<minRelativePos || refOffset>maxRelativePos) 2423 xFrac = 0; 2424 refOffset = Clip3(minRelativePos, maxRelativePos, refOffset); 2425 #endif 2426 Int absX = posX + refOffset; 2427 2428 if (xFrac == 0) 2429 absX = Clip3(0, widthLuma-1, absX); 2430 else 2431 absX = Clip3(4, widthLuma-5, absX); 2432 2433 refOffset = absX - posX; 2434 2435 assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 ); 2436 m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi ); 2437 } 2438 ref += refStride*nTxtPerDepthY; 2439 dst += dstStride*nTxtPerDepthY; 2440 depth += depStride; 2441 #if H_3D_VSP_BLOCKSIZE != 1 2442 yDepth++; 2443 #endif 2444 2445 } 2446 } 2447 2448 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv*dv, UInt partAddr, Int posX, Int posY 2449 , Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi) 2450 { 2451 Int refStride = refPic->getCStride(); 2452 Int dstStride = dstPic->getCStride(); 2453 Int depStride = pPicBaseDepth->getStride(); 2454 2455 Int widthChroma, heightChroma; 2456 if( isDepth) 2457 { 2458 widthChroma = pPicBaseDepth->getWidth()>>1; 2459 heightChroma = pPicBaseDepth->getHeight()>>1; 2460 } 2461 else 2462 { 2463 widthChroma = refPic->getWidth()>>1; 2464 heightChroma = refPic->getHeight()>>1; 2465 } 2466 2467 // Below is only for Texture chroma component 2468 2469 Int widthDepth = pPicBaseDepth->getWidth(); 2470 Int heightDepth = pPicBaseDepth->getHeight(); 2471 2472 Int nTxtPerDepthX, nTxtPerDepthY; // Number of texture samples per one depth sample 2473 Int nDepthPerTxtX, nDepthPerTxtY; // Number of depth samples per one texture sample 2474 2475 Int depthPosX; // Starting position in depth image 2476 Int depthPosY; 2477 2478 if ( widthChroma > widthDepth ) 2479 { 2480 nTxtPerDepthX = widthChroma / widthDepth; 2481 nDepthPerTxtX = 1; 2482 depthPosX = posX / nTxtPerDepthX + ((dv->getHor()+2)>>2); 2483 } 2484 else 2485 { 2486 nTxtPerDepthX = 1; 2487 nDepthPerTxtX = widthDepth / widthChroma; 2488 depthPosX = posX * nDepthPerTxtX + ((dv->getHor()+2)>>2); 2489 } 2490 depthPosX = Clip3(0, widthDepth - (sizeX<<1), depthPosX); 2491 if ( heightChroma > heightDepth ) 2492 { 2493 nTxtPerDepthY = heightChroma / heightDepth; 2494 nDepthPerTxtY = 1; 2495 depthPosY = posY / nTxtPerDepthY + ((dv->getVer()+2)>>2); 2496 } 2497 else 2498 { 2499 nTxtPerDepthY = 1; 2500 nDepthPerTxtY = heightDepth / heightChroma; 2501 depthPosY = posY * nDepthPerTxtY + ((dv->getVer()+2)>>2); 2502 } 2503 depthPosY = Clip3(0, heightDepth - (sizeY<<1), depthPosY); 2504 2505 Pel *refCb = refPic->getCbAddr() + posX + posY * refStride; 2506 Pel *refCr = refPic->getCrAddr() + posX + posY * refStride; 2507 Pel *dstCb = dstPic->getCbAddr(partAddr); 2508 Pel *dstCr = dstPic->getCrAddr(partAddr); 2509 Pel *depth = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride; // move the pointer to the current depth pixel position 2510 2511 Int refStrideBlock = refStride * nTxtPerDepthY; 2512 Int dstStrideBlock = dstStride * nTxtPerDepthY; 2513 Int depStrideBlock = depStride * nDepthPerTxtY; 2514 2515 if ( widthChroma > widthDepth ) // We assume 2516 { 2517 assert( heightChroma > heightDepth ); 2518 printf("This branch should never been reached.\n"); 2519 exit(0); 2520 } 2521 else 2522 { 2523 #if H_3D_VSP_BLOCKSIZE == 1 2524 Int dW = sizeX; 2525 Int dH = sizeY; 2526 Int sW = 2; // search window size 2527 Int sH = 2; 2528 #endif 2529 #if H_3D_VSP_BLOCKSIZE == 2 2530 Int dW = sizeX; 2531 Int dH = sizeY; 2532 Int sW = 2; // search window size 2533 Int sH = 2; 2534 #endif 2535 #if H_3D_VSP_BLOCKSIZE == 4 2536 Int dW = sizeX>>1; 2537 Int dH = sizeY>>1; 2538 Int sW = 4; // search window size 2539 Int sH = 4; 2540 #endif 2541 2542 { 2543 Pel* depthi = depth; 2544 for (Int j = 0; j < dH; j++) 2545 { 2546 for (Int i = 0; i < dW; i++) 2547 { 2548 Pel* depthTmp; 2549 #if H_3D_VSP_BLOCKSIZE == 1 2550 depthTmp = depthi + (i << 1); 2551 #endif 2552 #if H_3D_VSP_BLOCKSIZE == 2 2553 if (depthPosX + (i<<1) < widthDepth) 2554 depthTmp = depthi + (i << 1); 2555 else 2556 depthTmp = depthi + (widthDepth - depthPosX - 1); 2557 #endif 2558 #if H_3D_VSP_BLOCKSIZE == 4 2559 if (depthPosX + (i<<2) < widthDepth) 2560 depthTmp = depthi + (i << 2); 2561 else 2562 depthTmp = depthi + (widthDepth - depthPosX - 1); 2563 #endif 2564 Int maxV = 0; 2565 for (Int blockj = 0; blockj < sH; blockj+=(sH-1)) 2566 { 2567 Int iX = 0; 2568 for (Int blocki = 0; blocki < sW; blocki+=(sW-1)) 2569 { 2570 if (maxV < depthTmp[iX]) 2571 maxV = depthTmp[iX]; 2572 if (depthPosX + i*sW + blocki < widthDepth - 1) 2573 iX = (sW-1); 2574 } 2575 if (depthPosY + j*sH + blockj < heightDepth - 1) 2576 depthTmp += depStride * (sH-1); 2577 } 2578 m_pDepthBlock[i+j*dW] = maxV; 2579 } // end of i < dW 2580 #if H_3D_VSP_BLOCKSIZE == 1 2581 if (depthPosY + ((j+1)<<1) < heightDepth) 2582 depthi += (depStride << 1); 2583 else 2584 depthi = depth + (heightDepth-1)*depStride; 2585 #endif 2586 #if H_3D_VSP_BLOCKSIZE == 2 2587 if (depthPosY + ((j+1)<<1) < heightDepth) 2588 depthi += (depStride << 1); 2589 else 2590 depthi = depth + (heightDepth-depthPosY-1)*depStride; 2591 #endif 2592 #if H_3D_VSP_BLOCKSIZE == 4 2593 if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1 2594 depthi += (depStride << 2); 2595 else 2596 depthi = depth + (heightDepth-depthPosY-1)*depStride; // the last line 2597 #endif 2598 } 2599 } 2600 2601 2602 #if H_3D_VSP_BLOCKSIZE == 1 2603 #if H_3D_VSP_CONSTRAINED 2604 //get LUT based horizontal reference range 2605 Int range = xGetConstrainedSize(sizeX, sizeY, false); 2606 2607 // The minimum depth value 2608 Int minRelativePos = MAX_INT; 2609 Int maxRelativePos = MIN_INT; 2610 2611 Int depthTmp; 2612 for (Int yTxt=0; yTxt<sizeY; yTxt++) 2613 { 2614 for (Int xTxt=0; xTxt<sizeX; xTxt++) 2615 { 2616 depthTmp = m_pDepthBlock[xTxt+yTxt*dW]; 2617 Int disparity = pShiftLUT[ depthTmp ]; // << iShiftPrec; 2618 Int disparityInt = disparity >> 3;//in chroma resolution 2619 2620 if (disparityInt < 0) 2621 { 2622 if (minRelativePos > disparityInt+xTxt) 2623 minRelativePos = disparityInt+xTxt; 2624 } 2625 else 2626 { 2627 if (maxRelativePos < disparityInt+xTxt) 2628 maxRelativePos = disparityInt+xTxt; 2629 } 2630 } 2631 } 2632 2633 depthTmp = m_pDepthBlock[0]; 2634 Int disparity_tmp = pShiftLUT[ depthTmp ]; // << iShiftPrec; 2635 if ( disparity_tmp < 0 ) 2636 maxRelativePos = minRelativePos + range - 1; 2637 else 2638 minRelativePos = maxRelativePos - range + 1; 2639 2640 #endif // H_3D_VSP_CONSTRAINED 2641 #endif // H_3D_VSP_BLOCKSIZE == 1 2642 2643 // (sizeX, sizeY) is Chroma block size 2644 for ( Int yTxt = 0, yDepth = 0; yTxt < sizeY; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY ) 2645 { 2646 for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX ) 2647 { 2648 Pel repDepth = 0; // to store the depth value used for warping 2649 #if H_3D_VSP_BLOCKSIZE == 1 2650 repDepth = m_pDepthBlock[(xTxt) + (yTxt)*dW]; 2651 #endif 2652 #if H_3D_VSP_BLOCKSIZE == 2 2653 repDepth = m_pDepthBlock[(xTxt) + (yTxt)*dW]; 2654 #endif 2655 #if H_3D_VSP_BLOCKSIZE == 4 2656 repDepth = m_pDepthBlock[(xTxt>>1) + (yTxt>>1)*dW]; 2657 #endif 2658 2659 // calculate the offset in the reference picture 2660 Int disparity = pShiftLUT[ repDepth ]; // Remove << iShiftPrec; 2661 Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image 2662 Int xFrac = disparity & 0x7; 2663 #if H_3D_VSP_CONSTRAINED 2664 if(refOffset < minRelativePos || refOffset > maxRelativePos) 2665 xFrac = 0; 2666 refOffset = Clip3(minRelativePos, maxRelativePos, refOffset); 2667 #endif 2668 Int absX = posX + refOffset; 2669 2670 if (xFrac == 0) 2671 absX = Clip3(0, widthChroma-1, absX); 2672 else 2673 absX = Clip3(4, widthChroma-5, absX); 2674 2675 refOffset = absX - posX; 2676 2677 assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 ); 2678 assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 ); 2679 m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi); 2680 m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi); 2681 } 2682 refCb += refStrideBlock; 2683 refCr += refStrideBlock; 2684 dstCb += dstStrideBlock; 2685 dstCr += dstStrideBlock; 2686 depth += depStrideBlock; 2687 } 2688 } 2689 2690 } 2691 2692 #endif // NTT_VSP_COMMON_E0207_E0208 1891 } 1892 2693 1893 2694 1894 #if H_3D_VSP_CONSTRAINED … … 2768 1968 2769 1969 #if H_3D_DIM_DMM 2770 #if !SEC_DMM2_E0146_HHIFIX2771 UInt TComPrediction::xPredWedgeFromIntra( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd )2772 {2773 UInt uiThisBlockSize = uiWidth;2774 2775 TComDataCU* pcTempCU;2776 UInt uiTempPartIdx;2777 // 1st: try continue above wedgelet2778 pcTempCU = pcCU->getPUAbove( uiTempPartIdx, pcCU->getZorderIdxInCU() + uiAbsPartIdx );2779 if( pcTempCU && isDimMode( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ) )2780 {2781 UInt dimType = getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) );2782 if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType )2783 {2784 // get offset between current and reference block2785 UInt uiOffsetX = 0, uiOffsetY = 0;2786 xGetBlockOffset( pcCU, uiAbsPartIdx, pcTempCU, uiTempPartIdx, uiOffsetX, uiOffsetY );2787 2788 // get reference wedgelet2789 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[(pcTempCU->getWidth( uiTempPartIdx )>>((pcTempCU->getPartitionSize( uiTempPartIdx ) == SIZE_NxN) ? 1 : 0))])];2790 TComWedgelet* pcRefWedgelet = &(pacWedgeList->at( pcTempCU->getDmmWedgeTabIdx( dimType, uiTempPartIdx ) ) );2791 2792 // find wedgelet, if direction is suitable for continue wedge2793 if( pcRefWedgelet->checkPredDirAbovePossible( uiThisBlockSize, uiOffsetX ) )2794 {2795 UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;2796 pcRefWedgelet->getPredDirStartEndAbove( uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, uiThisBlockSize, uiOffsetX, iDeltaEnd );2797 return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );2798 }2799 }2800 }2801 2802 // 2nd: try continue left wedglelet2803 pcTempCU = pcCU->getPULeft( uiTempPartIdx, pcCU->getZorderIdxInCU() + uiAbsPartIdx );2804 if( pcTempCU && isDimMode( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ) )2805 {2806 UInt dimType = getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) );2807 if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType )2808 {2809 // get offset between current and reference block2810 UInt uiOffsetX = 0, uiOffsetY = 0;2811 xGetBlockOffset( pcCU, uiAbsPartIdx, pcTempCU, uiTempPartIdx, uiOffsetX, uiOffsetY );2812 2813 // get reference wedgelet2814 WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[(pcTempCU->getWidth( uiTempPartIdx )>>((pcTempCU->getPartitionSize( uiTempPartIdx ) == SIZE_NxN) ? 1 : 0))])];2815 TComWedgelet* pcRefWedgelet = &(pacWedgeList->at( pcTempCU->getDmmWedgeTabIdx( dimType, uiTempPartIdx ) ) );2816 2817 // find wedgelet, if direction is suitable for continue wedge2818 if( pcRefWedgelet->checkPredDirLeftPossible( uiThisBlockSize, uiOffsetY ) )2819 {2820 UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;2821 pcRefWedgelet->getPredDirStartEndLeft( uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, uiThisBlockSize, uiOffsetY, iDeltaEnd );2822 return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );2823 }2824 }2825 }2826 2827 // 3rd: (default) make wedglet from intra dir and max slope point2828 Int iSlopeX = 0, iSlopeY = 0;2829 UInt uiStartPosX = 0, uiStartPosY = 0;2830 if( xGetWedgeIntraDirPredData( pcCU, uiAbsPartIdx, uiThisBlockSize, iSlopeX, iSlopeY, uiStartPosX, uiStartPosY ) )2831 {2832 UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;2833 xGetWedgeIntraDirStartEnd( pcCU, uiAbsPartIdx, uiThisBlockSize, iSlopeX, iSlopeY, uiStartPosX, uiStartPosY, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, iDeltaEnd );2834 return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );2835 }2836 2837 return 0;2838 }2839 #endif2840 2841 1970 UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx ) 2842 1971 { … … 2847 1976 Int uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255; 2848 1977 2849 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX2850 1978 assert( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 ); 2851 1979 return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx); 2852 #else2853 if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 ) { return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx); }2854 else { return g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])].at(intraTabIdx).getPatternIdx(); }2855 #endif2856 1980 } 2857 1981 … … 2875 1999 } 2876 2000 2877 #if SCU_HS_DMM4_REMOVE_DIV_E0242 2878 Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2; 2879 iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2; 2880 #else 2881 iDC /= (uiWidth*uiHeight); 2882 #endif 2001 Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2; // 2002 iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2; // iDC /= (uiWidth*uiHeight); 2003 2883 2004 piRefBlkY = cTempYuv.getLumaAddr(); 2884 2005 … … 2907 2028 } 2908 2029 } 2909 2910 #if !SEC_DMM2_E0146_HHIFIX 2911 Void TComPrediction::xGetBlockOffset( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY ) 2912 { 2913 ruiOffsetX = 0; 2914 ruiOffsetY = 0; 2915 2916 // get offset between current and above/left block 2917 UInt uiThisOriginX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; 2918 UInt uiThisOriginY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; 2919 2920 UInt uiNumPartInRefCU = pcRefCU->getTotalNumPart(); 2921 UInt uiMaxDepthRefCU = 0; 2922 while( uiNumPartInRefCU > 1 ) 2923 { 2924 uiNumPartInRefCU >>= 2; 2925 uiMaxDepthRefCU++; 2926 } 2927 2928 UInt uiDepthRefPU = (pcRefCU->getDepth(uiRefAbsPartIdx)) + (pcRefCU->getPartitionSize(uiRefAbsPartIdx) == SIZE_2Nx2N ? 0 : 1); 2929 UInt uiShifts = (uiMaxDepthRefCU - uiDepthRefPU)*2; 2930 UInt uiRefBlockOriginPartIdx = (uiRefAbsPartIdx>>uiShifts)<<uiShifts; 2931 2932 UInt uiRefOriginX = pcRefCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiRefBlockOriginPartIdx] ]; 2933 UInt uiRefOriginY = pcRefCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiRefBlockOriginPartIdx] ]; 2934 2935 if( (uiThisOriginX - uiRefOriginX) > 0 ) { ruiOffsetX = (UInt)(uiThisOriginX - uiRefOriginX); } 2936 if( (uiThisOriginY - uiRefOriginY) > 0 ) { ruiOffsetY = (UInt)(uiThisOriginY - uiRefOriginY); } 2937 } 2938 2939 Bool TComPrediction::xGetWedgeIntraDirPredData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int& riSlopeX, Int& riSlopeY, UInt& ruiStartPosX, UInt& ruiStartPosY ) 2940 { 2941 riSlopeX = 0, riSlopeY = 0, ruiStartPosX = 0, ruiStartPosY = 0; 2942 2943 // 1st step: get wedge start point (max. slope) 2944 Int* piSource = pcCU->getPattern()->getAdiOrgBuf( uiBlockSize, uiBlockSize, m_piYuvExt ); 2945 Int iSourceStride = ( uiBlockSize<<1 ) + 1; 2946 2947 UInt uiSlopeMaxAbove = 0, uiPosSlopeMaxAbove = 0; 2948 for( UInt uiPosHor = 0; uiPosHor < (uiBlockSize-1); uiPosHor++ ) 2949 { 2950 if( abs( piSource[uiPosHor+1] - piSource[uiPosHor] ) > uiSlopeMaxAbove ) 2951 { 2952 uiSlopeMaxAbove = abs( piSource[uiPosHor+1] - piSource[uiPosHor] ); 2953 uiPosSlopeMaxAbove = uiPosHor; 2954 } 2955 } 2956 2957 UInt uiSlopeMaxLeft = 0, uiPosSlopeMaxLeft = 0; 2958 for( UInt uiPosVer = 0; uiPosVer < (uiBlockSize-1); uiPosVer++ ) 2959 { 2960 if( abs( piSource[(uiPosVer+1)*iSourceStride] - piSource[uiPosVer*iSourceStride] ) > uiSlopeMaxLeft ) 2961 { 2962 uiSlopeMaxLeft = abs( piSource[(uiPosVer+1)*iSourceStride] - piSource[uiPosVer*iSourceStride] ); 2963 uiPosSlopeMaxLeft = uiPosVer; 2964 } 2965 } 2966 2967 if( uiSlopeMaxAbove == 0 && uiSlopeMaxLeft == 0 ) 2968 { 2969 return false; 2970 } 2971 2972 ruiStartPosX = ( uiSlopeMaxAbove > uiSlopeMaxLeft ) ? uiPosSlopeMaxAbove : 0; 2973 ruiStartPosY = ( uiSlopeMaxLeft >= uiSlopeMaxAbove ) ? uiPosSlopeMaxLeft : 0; 2974 2975 // 2nd step: derive wedge direction 2976 Int uiPreds[3] = {-1, -1, -1}; 2977 Int iMode = -1; 2978 Int iPredNum = pcCU->getIntraDirLumaPredictor( uiAbsPartIdx, uiPreds, &iMode ); 2979 2980 UInt uiDirMode = 0; 2981 if( iMode >= 0 ) { iPredNum = iMode; } 2982 if( iPredNum == 1 ) { uiDirMode = uiPreds[0]; } 2983 if( iPredNum == 2 ) { uiDirMode = uiPreds[1]; } 2984 2985 if( uiDirMode < 2 ) { return false; } // no planar & DC 2986 2987 Bool modeHor = (uiDirMode < 18); 2988 Bool modeVer = !modeHor; 2989 Int intraPredAngle = modeVer ? (Int)uiDirMode - VER_IDX : modeHor ? -((Int)uiDirMode - HOR_IDX) : 0; 2990 Int absAng = abs(intraPredAngle); 2991 Int signAng = intraPredAngle < 0 ? -1 : 1; 2992 Int angTable[9] = {0,2,5,9,13,17,21,26,32}; 2993 absAng = angTable[absAng]; 2994 intraPredAngle = signAng * absAng; 2995 2996 // 3rd step: set slope for direction 2997 if( modeHor ) 2998 { 2999 riSlopeX = ( intraPredAngle > 0 ) ? -32 : 32; 3000 riSlopeY = ( intraPredAngle > 0 ) ? intraPredAngle : -intraPredAngle; 3001 } 3002 else if( modeVer ) 3003 { 3004 riSlopeX = ( intraPredAngle > 0 ) ? intraPredAngle : -intraPredAngle; 3005 riSlopeY = ( intraPredAngle > 0 ) ? -32 : 32; 3006 } 3007 3008 return true; 3009 } 3010 3011 Void TComPrediction::xGetWedgeIntraDirStartEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int iDeltaX, Int iDeltaY, UInt uiPMSPosX, UInt uiPMSPosY, UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, Int iDeltaEnd ) 3012 { 3013 ruhXs = 0; 3014 ruhYs = 0; 3015 ruhXe = 0; 3016 ruhYe = 0; 3017 3018 // scaling of start pos and block size to wedge resolution 3019 UInt uiScaledStartPosX = 0; 3020 UInt uiScaledStartPosY = 0; 3021 UInt uiScaledBlockSize = 0; 3022 WedgeResolution eWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiBlockSize]]; 3023 switch( eWedgeRes ) 3024 { 3025 case( DOUBLE_PEL ): { uiScaledStartPosX = (uiPMSPosX>>1); uiScaledStartPosY = (uiPMSPosY>>1); uiScaledBlockSize = (uiBlockSize>>1); break; } 3026 case( FULL_PEL ): { uiScaledStartPosX = uiPMSPosX; uiScaledStartPosY = uiPMSPosY; uiScaledBlockSize = uiBlockSize; break; } 3027 case( HALF_PEL ): { uiScaledStartPosX = (uiPMSPosX<<1); uiScaledStartPosY = (uiPMSPosY<<1); uiScaledBlockSize = (uiBlockSize<<1); break; } 3028 } 3029 Int iMaxPos = (Int)uiScaledBlockSize - 1; 3030 3031 // case above 3032 if( uiScaledStartPosX > 0 && uiScaledStartPosY == 0 ) 3033 { 3034 ruhXs = (UChar)uiScaledStartPosX; 3035 ruhYs = 0; 3036 3037 if( iDeltaY == 0 ) 3038 { 3039 if( iDeltaX < 0 ) 3040 { 3041 ruhXe = 0; 3042 ruhYe = (UChar)std::min( std::max( iDeltaEnd, 0 ), iMaxPos ); 3043 return; 3044 } 3045 else 3046 { 3047 ruhXe = (UChar)iMaxPos; 3048 ruhYe = (UChar)std::min( std::max( -iDeltaEnd, 0 ), iMaxPos ); 3049 std::swap( ruhXs, ruhXe ); 3050 std::swap( ruhYs, ruhYe ); 3051 return; 3052 } 3053 } 3054 3055 // regular case 3056 Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iMaxPos * ((Double)iDeltaX / (Double)iDeltaY) ); 3057 3058 if( iVirtualEndX < 0 ) 3059 { 3060 Int iYe = roftoi( (Double)(0 - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) + iDeltaEnd; 3061 if( iYe < (Int)uiScaledBlockSize ) 3062 { 3063 ruhXe = 0; 3064 ruhYe = (UChar)std::max( iYe, 0 ); 3065 return; 3066 } 3067 else 3068 { 3069 ruhXe = (UChar)std::min( (iYe - iMaxPos), iMaxPos ); 3070 ruhYe = (UChar)iMaxPos; 3071 return; 3072 } 3073 } 3074 else if( iVirtualEndX > iMaxPos ) 3075 { 3076 Int iYe = roftoi( (Double)(iMaxPos - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) - iDeltaEnd; 3077 if( iYe < (Int)uiScaledBlockSize ) 3078 { 3079 ruhXe = (UChar)iMaxPos; 3080 ruhYe = (UChar)std::max( iYe, 0 ); 3081 std::swap( ruhXs, ruhXe ); 3082 std::swap( ruhYs, ruhYe ); 3083 return; 3084 } 3085 else 3086 { 3087 ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 ); 3088 ruhYe = (UChar)iMaxPos; 3089 return; 3090 } 3091 } 3092 else 3093 { 3094 Int iXe = iVirtualEndX + iDeltaEnd; 3095 if( iXe < 0 ) 3096 { 3097 ruhXe = 0; 3098 ruhYe = (UChar)std::max( (iMaxPos + iXe), 0 ); 3099 return; 3100 } 3101 else if( iXe > iMaxPos ) 3102 { 3103 ruhXe = (UChar)iMaxPos; 3104 ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 ); 3105 std::swap( ruhXs, ruhXe ); 3106 std::swap( ruhYs, ruhYe ); 3107 return; 3108 } 3109 else 3110 { 3111 ruhXe = (UChar)iXe; 3112 ruhYe = (UChar)iMaxPos; 3113 return; 3114 } 3115 } 3116 } 3117 3118 // case left 3119 if( uiScaledStartPosY > 0 && uiScaledStartPosX == 0 ) 3120 { 3121 ruhXs = 0; 3122 ruhYs = (UChar)uiScaledStartPosY; 3123 3124 if( iDeltaX == 0 ) 3125 { 3126 if( iDeltaY < 0 ) 3127 { 3128 ruhXe = (UChar)std::min( std::max( -iDeltaEnd, 0 ), iMaxPos ); 3129 ruhYe = 0; 3130 std::swap( ruhXs, ruhXe ); 3131 std::swap( ruhYs, ruhYe ); 3132 return; 3133 } 3134 else 3135 { 3136 ruhXe = (UChar)std::min( std::max( iDeltaEnd, 0 ), iMaxPos ); 3137 ruhYe = (UChar)iMaxPos; 3138 return; 3139 } 3140 } 3141 3142 // regular case 3143 Int iVirtualEndY = (Int)ruhYs + roftoi( (Double)iMaxPos * ((Double)iDeltaY / (Double)iDeltaX) ); 3144 3145 if( iVirtualEndY < 0 ) 3146 { 3147 Int iXe = roftoi( (Double)(0 - (Int)ruhYs ) * ((Double)iDeltaX / (Double)iDeltaY) ) - iDeltaEnd; 3148 if( iXe < (Int)uiScaledBlockSize ) 3149 { 3150 ruhXe = (UChar)std::max( iXe, 0 ); 3151 ruhYe = 0; 3152 std::swap( ruhXs, ruhXe ); 3153 std::swap( ruhYs, ruhYe ); 3154 return; 3155 } 3156 else 3157 { 3158 ruhXe = (UChar)iMaxPos; 3159 ruhYe = (UChar)std::min( (iXe - iMaxPos), iMaxPos ); 3160 std::swap( ruhXs, ruhXe ); 3161 std::swap( ruhYs, ruhYe ); 3162 return; 3163 } 3164 } 3165 else if( iVirtualEndY > (uiScaledBlockSize-1) ) 3166 { 3167 Int iXe = roftoi( (Double)((Int)(uiScaledBlockSize-1) - (Int)ruhYs ) * ((Double)iDeltaX / (Double)iDeltaY) ) + iDeltaEnd; 3168 if( iXe < (Int)uiScaledBlockSize ) 3169 { 3170 ruhXe = (UChar)std::max( iXe, 0 ); 3171 ruhYe = (UChar)(uiScaledBlockSize-1); 3172 return; 3173 } 3174 else 3175 { 3176 ruhXe = (UChar)iMaxPos; 3177 ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 ); 3178 std::swap( ruhXs, ruhXe ); 3179 std::swap( ruhYs, ruhYe ); 3180 return; 3181 } 3182 } 3183 else 3184 { 3185 Int iYe = iVirtualEndY - iDeltaEnd; 3186 if( iYe < 0 ) 3187 { 3188 ruhXe = (UChar)std::max( (iMaxPos + iYe), 0 ); 3189 ruhYe = 0; 3190 std::swap( ruhXs, ruhXe ); 3191 std::swap( ruhYs, ruhYe ); 3192 return; 3193 } 3194 else if( iYe > iMaxPos ) 3195 { 3196 ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 ); 3197 ruhYe = (UChar)iMaxPos; 3198 return; 3199 } 3200 else 3201 { 3202 ruhXe = (UChar)iMaxPos; 3203 ruhYe = (UChar)iYe; 3204 std::swap( ruhXs, ruhXe ); 3205 std::swap( ruhYs, ruhYe ); 3206 return; 3207 } 3208 } 3209 } 3210 3211 // case origin 3212 if( uiScaledStartPosX == 0 && uiScaledStartPosY == 0 ) 3213 { 3214 if( iDeltaX*iDeltaY < 0 ) 3215 { 3216 return; 3217 } 3218 3219 ruhXs = 0; 3220 ruhYs = 0; 3221 3222 if( iDeltaY == 0 ) 3223 { 3224 ruhXe = (UChar)iMaxPos; 3225 ruhYe = 0; 3226 std::swap( ruhXs, ruhXe ); 3227 std::swap( ruhYs, ruhYe ); 3228 return; 3229 } 3230 3231 if( iDeltaX == 0 ) 3232 { 3233 ruhXe = 0; 3234 ruhYe = (UChar)iMaxPos; 3235 return; 3236 } 3237 3238 Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iMaxPos * ((Double)iDeltaX / (Double)iDeltaY) ); 3239 3240 if( iVirtualEndX > iMaxPos ) 3241 { 3242 Int iYe = roftoi( (Double)((Int)iMaxPos - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) - iDeltaEnd; 3243 if( iYe < (Int)uiScaledBlockSize ) 3244 { 3245 ruhXe = (UChar)(uiScaledBlockSize-1); 3246 ruhYe = (UChar)std::max( iYe, 0 ); 3247 std::swap( ruhXs, ruhXe ); 3248 std::swap( ruhYs, ruhYe ); 3249 return; 3250 } 3251 else 3252 { 3253 ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 ); 3254 ruhYe = (UChar)(uiScaledBlockSize-1); 3255 return; 3256 } 3257 } 3258 else 3259 { 3260 Int iXe = iVirtualEndX + iDeltaEnd; 3261 if( iXe < 0 ) 3262 { 3263 ruhXe = 0; 3264 ruhYe = (UChar)std::max( (iMaxPos + iXe), 0 ); 3265 return; 3266 } 3267 else if( iXe > iMaxPos ) 3268 { 3269 ruhXe = (UChar)(uiScaledBlockSize-1); 3270 ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 ); 3271 std::swap( ruhXs, ruhXe ); 3272 std::swap( ruhYs, ruhYe ); 3273 return; 3274 } 3275 else 3276 { 3277 ruhXe = (UChar)iXe; 3278 ruhYe = (UChar)(uiScaledBlockSize-1); 3279 return; 3280 } 3281 } 3282 } 3283 } 3284 3285 UInt TComPrediction::xGetWedgePatternIdx( UInt uiBlockSize, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe ) 3286 { 3287 WedgeRefList* pcWedgeRefList = &g_dmmWedgeRefLists[(g_aucConvertToBit[uiBlockSize])]; 3288 for( UInt uiIdx = 0; uiIdx < pcWedgeRefList->size(); uiIdx++ ) 3289 { 3290 TComWedgeRef* pcTestWedgeRef = &(pcWedgeRefList->at(uiIdx)); 3291 if( pcTestWedgeRef->getStartX() == uhXs && pcTestWedgeRef->getStartY() == uhYs && pcTestWedgeRef->getEndX() == uhXe && pcTestWedgeRef->getEndY() == uhYe ) 3292 { 3293 return pcTestWedgeRef->getRefIdx(); 3294 } 3295 } 3296 return 0; 3297 } 3298 #endif 3299 #endif 2030 #endif 2031 3300 2032 #if H_3D_DIM_RBC 3301 2033 Void TComPrediction::xDeltaDCQuantScaleUp( TComDataCU* pcCU, Pel& rDeltaDC ) … … 3327 2059 #if H_3D_DIM_SDC 3328 2060 Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride 3329 #if KWU_SDC_SIMPLE_DC_E01173330 2061 ,UInt uiIntraMode 3331 2062 ,Bool orgDC 3332 #endif3333 2063 ) 3334 2064 { … … 3338 2068 memset(iSumPix, 0, sizeof(Int)*2); 3339 2069 3340 #if KWU_SDC_SIMPLE_DC_E01173341 2070 if (orgDC == false) 3342 2071 { … … 3364 2093 return; 3365 2094 } 3366 #endif3367 2095 3368 2096 Int subSamplePix;
Note: See TracChangeset for help on using the changeset viewer.