Changeset 1187 in 3DVCSoftware for branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp
- Timestamp:
- 8 Apr 2015, 15:26:52 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp
r1185 r1187 54 54 m_pDepthBlock = (Int*) malloc(MAX_NUM_SPU_W*MAX_NUM_SPU_W*sizeof(Int)); 55 55 if (m_pDepthBlock == NULL) 56 { 56 57 printf("ERROR: UKTGHU, No memory allocated.\n"); 58 } 57 59 #endif 58 60 } … … 62 64 #if H_3D_VSP 63 65 if (m_pDepthBlock != NULL) 64 free(m_pDepthBlock); 66 { 67 free(m_pDepthBlock); 68 } 65 69 m_cYuvDepthOnVsp.destroy(); 66 70 #endif … … 513 517 514 518 #if H_3D_DIM_DMM 515 if( dimType == DMM4_IDX && dmm4Segmentation == NULL ) { dmmSegmentation->destroy(); delete dmmSegmentation; } 519 if( dimType == DMM4_IDX && dmm4Segmentation == NULL ) 520 { 521 dmmSegmentation->destroy(); 522 delete dmmSegmentation; 523 } 516 524 #endif 517 525 } … … 635 643 // segmentation of texture block --> mask IDs 636 644 Pel* pDepthBlockStart = pDepthPels; 637 645 638 646 // first compute average of depth block for thresholding 639 647 Int iSumDepth = 0; … … 648 656 Int iBlkX = ( pcCU->getAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2); 649 657 Int iBlkY = ( pcCU->getAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2); 658 650 659 UInt t=0; 651 660 652 661 for (Int y=0; y<uiSize; y+=iSubSample) 653 662 { 654 663 for (Int x=0; x<uiSize; x+=iSubSample) 655 {656 if (iBlkX+x>iPictureWidth)657 {658 Int depthPel = pDepthPels[t];659 iSumDepth += depthPel;660 }661 else662 {663 Int depthPel = pDepthPels[x];664 t=x;665 iSumDepth += depthPel;666 }667 }668 664 { 665 if (iBlkX+x>iPictureWidth) 666 { 667 Int depthPel = pDepthPels[t]; 668 iSumDepth += depthPel; 669 } 670 else 671 { 672 Int depthPel = pDepthPels[x]; 673 t=x; 674 iSumDepth += depthPel; 675 } 676 } 677 669 678 // next row 670 679 if (!(iBlkY+y+4>iPictureHeight)) 671 pDepthPels += uiDepthStride*iSubSample; 672 } 673 680 { 681 pDepthPels += uiDepthStride*iSubSample; 682 } 683 } 684 674 685 Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample]; // respect sub-sampling factor 675 686 Int iMean = iSumDepth >> iSizeInBits*2; // iMean /= (uiSize*uiSize); 676 687 677 688 // start again for segmentation 678 689 pDepthPels = pDepthBlockStart; 679 690 680 691 // start mapping process 681 692 Int matchedPartSum[2][2] = {{0,0},{0,0}}; // counter for each part size and boolean option 682 693 PartSize virtualPartSizes[2] = { SIZE_Nx2N, SIZE_2NxN}; 683 694 684 695 UInt uiHalfSize = uiSize>>1; 685 696 for (Int y=0; y<uiSize; y+=iSubSample) … … 688 699 { 689 700 Int depthPel = 0; 690 if (iBlkX+x>iPictureWidth)691 {692 depthPel = pDepthPels[t];693 }694 else695 {696 depthPel = pDepthPels[x];697 t=x;698 }699 701 if (iBlkX+x>iPictureWidth) 702 { 703 depthPel = pDepthPels[t]; 704 } 705 else 706 { 707 depthPel = pDepthPels[x]; 708 t=x; 709 } 710 700 711 // decide which segment this pixel belongs to 701 712 Int ucSegment = (Int)(depthPel>iMean); 702 713 703 714 // Matched Filter to find optimal (conventional) partitioning 704 715 705 716 // SIZE_Nx2N 706 717 if(x<uiHalfSize) // left … … 712 723 matchedPartSum[0][1-ucSegment]++; 713 724 } 714 725 715 726 // SIZE_2NxN 716 727 if(y<uiHalfSize) // top … … 723 734 } 724 735 } 725 736 726 737 // next row 727 738 if (!(iBlkY+y+4>iPictureHeight)) 728 pDepthPels += uiDepthStride*iSubSample; 729 } 730 739 { 740 pDepthPels += uiDepthStride*iSubSample; 741 } 742 } 743 731 744 PartSize matchedPartSize = SIZE_NONE; 732 745 733 746 Int iMaxMatchSum = 0; 734 747 for(Int p=0; p<2; p++) // loop over partition … … 743 756 } 744 757 } 745 758 746 759 AOF( matchedPartSize != SIZE_NONE ); 747 760 748 761 return matchedPartSize; 749 762 } … … 761 774 uiMaxDepth = pDepthPels[ 0 ]; 762 775 iSumDepth = pDepthPels[ 0 ]; 763 UInt t=0;776 764 777 Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth(); 765 778 Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(); … … 835 848 836 849 // generate mask 850 UInt t=0; 837 851 UInt uiSumPix[2] = {0,0}; 838 852 for (Int y=0; y<uiHeight; y++) … … 952 966 } 953 967 954 if ( tmpTar ) { xFree(tmpTar); tmpTar = NULL; } 968 if ( tmpTar ) 969 { 970 xFree(tmpTar); 971 tmpTar = NULL; 972 } 955 973 956 974 // now combine chroma … … 1055 1073 } 1056 1074 1057 if ( tmpTarU ) { xFree(tmpTarU); tmpTarU = NULL; } 1058 if ( tmpTarV ) { xFree(tmpTarV); tmpTarV = NULL; } 1075 if( tmpTarU ) 1076 { 1077 xFree(tmpTarU); 1078 tmpTarU = NULL; 1079 } 1080 if ( tmpTarV ) 1081 { 1082 xFree(tmpTarV); 1083 tmpTarV = NULL; 1084 } 1059 1085 } 1060 1086 #endif … … 1243 1269 pcCU->clipMv(cMv); 1244 1270 #if H_MV 1245 pcCU->checkM V_V(cMv, eRefPicList, iRefIdx );1271 pcCU->checkMvVertRest(cMv, eRefPicList, iRefIdx ); 1246 1272 #endif 1247 1273 #if H_3D_ARP … … 2367 2393 for( UInt k = 0; k < (patternStride * patternStride); k++ ) 2368 2394 { 2369 if( true == biSegPattern[k] ) { ptrDst[k] = valDC2; } 2370 else { ptrDst[k] = valDC1; } 2395 if( true == biSegPattern[k] ) 2396 { 2397 ptrDst[k] = valDC2; 2398 } 2399 else 2400 { 2401 ptrDst[k] = valDC1; 2402 } 2371 2403 } 2372 2404 } … … 2378 2410 for( UInt uiX = 0; uiX < patternStride; uiX++ ) 2379 2411 { 2380 if( true == biSegPattern[uiX] ) { piTemp[uiX] = valDC2; } 2381 else { piTemp[uiX] = valDC1; } 2412 if( true == biSegPattern[uiX] ) 2413 { 2414 piTemp[uiX] = valDC2; 2415 } 2416 else 2417 { 2418 piTemp[uiX] = valDC1; 2419 } 2382 2420 } 2383 2421 piTemp += dstStride; … … 2449 2487 Int iSumPix[2]; 2450 2488 memset(iSumPix, 0, sizeof(Int)*2); 2489 2451 2490 for( Int i = 0; i < uiNumSegments; i++ ) 2452 2491 { 2453 rpSegMeans[i] = 0; 2454 } 2455 if (orgDC == false) 2492 rpSegMeans[i] = 0; 2493 } 2494 2495 if ( !orgDC ) 2456 2496 { 2457 2497 Pel* pLeftTop = pOrig; … … 2473 2513 subSamplePix = 1; 2474 2514 } 2515 2475 2516 for (Int y=0; y<uiSize; y+=subSamplePix) 2476 2517 { … … 2492 2533 { 2493 2534 if( iSumPix[ucSeg] > 0 ) 2535 { 2494 2536 rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg]; 2537 } 2495 2538 else 2539 { 2496 2540 rpSegMeans[ucSeg] = 0; // this happens for zero-segments 2541 } 2497 2542 } 2498 2543 }
Note: See TracChangeset for help on using the changeset viewer.