Changeset 608 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
- Timestamp:
- 1 Sep 2013, 22:47:26 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
r443 r608 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 2, ITU/ISO/IEC6 * Copyright (c) 2010-2013, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 62 62 TComSampleAdaptiveOffset::TComSampleAdaptiveOffset() 63 63 { 64 #if !LGE_SAO_MIGRATION_D009165 m_pcPic = NULL;66 #endif67 m_iOffsetBo = NULL;68 64 m_pClipTable = NULL; 69 65 m_pClipTableBase = NULL; 66 m_pChromaClipTable = NULL; 67 m_pChromaClipTableBase = NULL; 68 m_iOffsetBo = NULL; 69 m_iChromaOffsetBo = NULL; 70 70 m_lumaTableBo = NULL; 71 m_chromaTableBo = NULL; 71 72 m_iUpBuff1 = NULL; 72 73 m_iUpBuff2 = NULL; 73 74 m_iUpBufft = NULL; 74 75 ipSwap = NULL; 75 #if !LGE_SAO_MIGRATION_D009176 m_pcYuvTmp = NULL;77 #endif78 76 79 77 m_pTmpU1 = NULL; … … 81 79 m_pTmpL1 = NULL; 82 80 m_pTmpL2 = NULL; 83 m_iLcuPartIdx = NULL;84 81 } 85 82 … … 88 85 89 86 } 90 91 #if !LGE_SAO_MIGRATION_D009192 const Int TComSampleAdaptiveOffset::m_aiNumPartsInRow[5] =93 {94 1, //level 095 2, //level 196 4, //level 297 8, //level 398 16 //level 499 };100 101 const Int TComSampleAdaptiveOffset::m_aiNumPartsLevel[5] =102 {103 1, //level 0104 4, //level 1105 16, //level 2106 64, //level 3107 256 //level 4108 };109 #endif110 87 111 88 const Int TComSampleAdaptiveOffset::m_aiNumCulPartsLevel[5] = … … 130 107 0 131 108 }; 132 #if !LGE_SAO_MIGRATION_D0091 133 const UInt TComSampleAdaptiveOffset::m_iWeightSao[MAX_NUM_SAO_TYPE] = 134 { 135 2, 136 2, 137 2, 138 2, 139 1 140 }; 141 142 const UInt TComSampleAdaptiveOffset::m_auiEoTable2D[9] = 143 { 144 1, //0 145 2, //1 146 3, //2 147 0, //3 148 0, //4 149 0, //5 150 4, //6 151 5, //7 152 6 153 }; 154 #endif 155 156 Int TComSampleAdaptiveOffset::m_iNumClass[MAX_NUM_SAO_TYPE] = 109 110 const Int TComSampleAdaptiveOffset::m_iNumClass[MAX_NUM_SAO_TYPE] = 157 111 { 158 112 SAO_EO_LEN, … … 163 117 }; 164 118 165 UInt TComSampleAdaptiveOffset::m_uiMaxDepth = SAO_MAX_DEPTH;119 const UInt TComSampleAdaptiveOffset::m_uiMaxDepth = SAO_MAX_DEPTH; 166 120 167 121 … … 169 123 * \param level, row, col 170 124 */ 171 Int TComSampleAdaptiveOffset::convertLevelRowCol2Idx( int level, int row, int col)125 Int TComSampleAdaptiveOffset::convertLevelRowCol2Idx(Int level, Int row, Int col) 172 126 { 173 127 Int idx; … … 194 148 return idx; 195 149 } 196 #if !LGE_SAO_MIGRATION_D0091 197 /** convert quadtree Idx to Level, Row, and Col 198 * \param idx, *level, *row, *col 199 */ 200 void TComSampleAdaptiveOffset::convertIdx2LevelRowCol(int idx, int *level, int *row, int *col) 201 { 202 if (idx == 0) 203 { 204 *level = 0; 205 *row = 0; 206 *col = 0; 207 } 208 else if (idx>=1 && idx<=4) 209 { 210 *level = 1; 211 *row = (idx-1) / 2; 212 *col = (idx-1) % 2; 213 } 214 else if (idx>=5 && idx<=20) 215 { 216 *level = 2; 217 *row = (idx-5) / 4; 218 *col = (idx-5) % 4; 219 } 220 else if (idx>=21 && idx<=84) 221 { 222 *level = 3; 223 *row = (idx-21) / 8; 224 *col = (idx-21) % 8; 225 } 226 else // (idx>=85 && idx<=340) 227 { 228 *level = 4; 229 *row = (idx-85) / 16; 230 *col = (idx-85) % 16; 231 } 232 } 233 #endif 150 234 151 /** create SampleAdaptiveOffset memory. 235 152 * \param 236 153 */ 237 Void TComSampleAdaptiveOffset::create( UInt uiSourceWidth, UInt uiSourceHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight , UInt uiMaxCUDepth)154 Void TComSampleAdaptiveOffset::create( UInt uiSourceWidth, UInt uiSourceHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight ) 238 155 { 239 156 m_iPicWidth = uiSourceWidth; … … 249 166 m_iNumCuInHeight += ( m_iPicHeight % m_uiMaxCUHeight ) ? 1 : 0; 250 167 251 Int iMaxSplitLevelHeight = (Int)(logf(( float)m_iNumCuInHeight)/logf(2.0));252 Int iMaxSplitLevelWidth = (Int)(logf(( float)m_iNumCuInWidth )/logf(2.0));168 Int iMaxSplitLevelHeight = (Int)(logf((Float)m_iNumCuInHeight)/logf(2.0)); 169 Int iMaxSplitLevelWidth = (Int)(logf((Float)m_iNumCuInWidth )/logf(2.0)); 253 170 254 171 m_uiMaxSplitLevel = (iMaxSplitLevelHeight < iMaxSplitLevelWidth)?(iMaxSplitLevelHeight):(iMaxSplitLevelWidth); … … 258 175 m_iNumTotalParts = max(3,m_aiNumCulPartsLevel[m_uiMaxSplitLevel]); 259 176 260 UInt uiInternalBitDepth = g_uiBitDepth+g_uiBitIncrement; 261 UInt uiPixelRange = 1<<uiInternalBitDepth; 262 UInt uiBoRangeShift = uiInternalBitDepth - SAO_BO_BITS; 263 264 m_lumaTableBo = new Pel [uiPixelRange]; 265 for (Int k2=0; k2<uiPixelRange; k2++) 266 { 267 m_lumaTableBo[k2] = 1 + (k2>>uiBoRangeShift); 268 } 177 UInt uiPixelRangeY = 1 << g_bitDepthY; 178 UInt uiBoRangeShiftY = g_bitDepthY - SAO_BO_BITS; 179 180 m_lumaTableBo = new Pel [uiPixelRangeY]; 181 for (Int k2=0; k2<uiPixelRangeY; k2++) 182 { 183 m_lumaTableBo[k2] = 1 + (k2>>uiBoRangeShiftY); 184 } 185 186 UInt uiPixelRangeC = 1 << g_bitDepthC; 187 UInt uiBoRangeShiftC = g_bitDepthC - SAO_BO_BITS; 188 189 m_chromaTableBo = new Pel [uiPixelRangeC]; 190 for (Int k2=0; k2<uiPixelRangeC; k2++) 191 { 192 m_chromaTableBo[k2] = 1 + (k2>>uiBoRangeShiftC); 193 } 194 269 195 m_iUpBuff1 = new Int[m_iPicWidth+2]; 270 196 m_iUpBuff2 = new Int[m_iPicWidth+2]; … … 276 202 Pel i; 277 203 278 UInt uiMaxY = g_uiIBDI_MAX;204 UInt uiMaxY = (1 << g_bitDepthY) - 1;; 279 205 UInt uiMinY = 0; 280 206 … … 301 227 m_pClipTable = &(m_pClipTableBase[iCRangeExt]); 302 228 303 m_iLcuPartIdx = new Int [m_iNumCuInHeight*m_iNumCuInWidth]; 229 UInt uiMaxC = (1 << g_bitDepthC) - 1; 230 UInt uiMinC = 0; 231 232 Int iCRangeExtC = uiMaxC>>1; 233 234 m_pChromaClipTableBase = new Pel[uiMaxC+2*iCRangeExtC]; 235 m_iChromaOffsetBo = new Int[uiMaxC+2*iCRangeExtC]; 236 237 for(i=0;i<(uiMinC+iCRangeExtC);i++) 238 { 239 m_pChromaClipTableBase[i] = uiMinC; 240 } 241 242 for(i=uiMinC+iCRangeExtC;i<(uiMaxC+ iCRangeExtC);i++) 243 { 244 m_pChromaClipTableBase[i] = i-iCRangeExtC; 245 } 246 247 for(i=uiMaxC+iCRangeExtC;i<(uiMaxC+2*iCRangeExtC);i++) 248 { 249 m_pChromaClipTableBase[i] = uiMaxC; 250 } 251 252 m_pChromaClipTable = &(m_pChromaClipTableBase[iCRangeExtC]); 253 304 254 m_pTmpL1 = new Pel [m_uiMaxCUHeight+1]; 305 255 m_pTmpL2 = new Pel [m_uiMaxCUHeight+1]; … … 326 276 } 327 277 328 #if LGE_SAO_MIGRATION_D0091 278 if (m_pChromaClipTableBase) 279 { 280 delete [] m_pChromaClipTableBase; m_pChromaClipTableBase = NULL; 281 } 282 if (m_iChromaOffsetBo) 283 { 284 delete [] m_iChromaOffsetBo; m_iChromaOffsetBo = NULL; 285 } 286 if (m_chromaTableBo) 287 { 288 delete[] m_chromaTableBo; m_chromaTableBo = NULL; 289 } 290 329 291 if (m_iUpBuff1) 330 292 { 331 332 293 m_iUpBuff1--; 294 delete [] m_iUpBuff1; m_iUpBuff1 = NULL; 333 295 } 334 296 if (m_iUpBuff2) 335 297 { 336 337 298 m_iUpBuff2--; 299 delete [] m_iUpBuff2; m_iUpBuff2 = NULL; 338 300 } 339 301 if (m_iUpBufft) 340 302 { 341 m_iUpBufft--; 342 delete [] m_iUpBufft; m_iUpBufft = NULL; 343 } 344 #else 345 m_iUpBuff1--; 346 m_iUpBuff2--; 347 m_iUpBufft--; 348 349 if (m_iUpBuff1) 350 { 351 delete [] m_iUpBuff1; m_iUpBuff1 = NULL; 352 } 353 if (m_iUpBuff2) 354 { 355 delete [] m_iUpBuff2; m_iUpBuff2 = NULL; 356 } 357 if (m_iUpBufft) 358 { 303 m_iUpBufft--; 359 304 delete [] m_iUpBufft; m_iUpBufft = NULL; 360 305 } 361 #endif362 306 if (m_pTmpL1) 363 307 { … … 375 319 { 376 320 delete [] m_pTmpU2; m_pTmpU2 = NULL; 377 }378 if(m_iLcuPartIdx)379 {380 delete []m_iLcuPartIdx; m_iLcuPartIdx = NULL;381 321 } 382 322 } … … 394 334 initSAOParam(pcSaoParam, 0, 0, 0, -1, 0, m_iNumCuInWidth-1, 0, m_iNumCuInHeight-1,1); 395 335 initSAOParam(pcSaoParam, 0, 0, 0, -1, 0, m_iNumCuInWidth-1, 0, m_iNumCuInHeight-1,2); 396 #if !LGE_SAO_MIGRATION_D0091397 for(Int j=0;j<MAX_NUM_SAO_TYPE;j++)398 {399 pcSaoParam->iNumClass[j] = m_iNumClass[j];400 }401 #endif402 336 pcSaoParam->numCuInWidth = m_iNumCuInWidth; 403 337 pcSaoParam->numCuInHeight = m_iNumCuInHeight; … … 433 367 pSaoPart->iLength = 0; 434 368 435 #if LGE_SAO_MIGRATION_D0091436 369 pSaoPart->subTypeIdx = 0; 437 #else438 pSaoPart->bandPosition = 0;439 #endif440 370 441 371 for (j=0;j<MAX_NUM_SAO_OFFSETS;j++) … … 546 476 for(Int c=0; c<iNumComponet; c++) 547 477 { 548 #if LGE_SAO_MIGRATION_D0091 549 if (c<2) 550 { 478 if (c<2) 479 { 551 480 pcSaoParam->bSaoFlag[c] = 0; 552 } 553 #else 554 pcSaoParam->bSaoFlag[c] = 0; 555 #endif 481 } 556 482 for(Int i=0; i< m_aiNumCulPartsLevel[m_uiMaxSplitLevel]; i++) 557 483 { … … 563 489 pcSaoParam->psSaoPart[c][i].iMinDist = MAX_INT; 564 490 pcSaoParam->psSaoPart[c][i].iMinRate = MAX_INT; 565 #if LGE_SAO_MIGRATION_D0091566 491 pcSaoParam->psSaoPart[c][i].subTypeIdx = 0; 567 #else568 pcSaoParam->psSaoPart[c][i].bandPosition = 0;569 #endif570 492 for (Int j=0;j<MAX_NUM_SAO_OFFSETS;j++) 571 493 { … … 587 509 * \param x 588 510 */ 589 inline int xSign(int x)590 { 591 return ((x >> 31) | (( int)( (((unsigned int) -x)) >> 31)));511 inline Int xSign(Int x) 512 { 513 return ((x >> 31) | ((Int)( (((UInt) -x)) >> 31))); 592 514 } 593 515 594 516 /** initialize variables for SAO process 595 517 * \param pcPic picture data pointer 596 * \param numSlicesInPic number of slices in picture 597 */ 598 Void TComSampleAdaptiveOffset::createPicSaoInfo(TComPic* pcPic, Int numSlicesInPic) 518 */ 519 Void TComSampleAdaptiveOffset::createPicSaoInfo(TComPic* pcPic) 599 520 { 600 521 m_pcPic = pcPic; 601 m_uiNumSlicesInPic = numSlicesInPic;602 #if LGE_SAO_MIGRATION_D0091603 m_iSGDepth = 0;604 #else605 m_iSGDepth = pcPic->getSliceGranularityForNDBFilter();606 #endif607 522 m_bUseNIF = ( pcPic->getIndependentSliceBoundaryForNDBFilter() || pcPic->getIndependentTileBoundaryForNDBFilter() ); 608 523 if(m_bUseNIF) … … 650 565 posOffset = (yPos* stride) + xPos; 651 566 652 processSaoBlock(pPicDec+ posOffset, pPicRest+ posOffset, stride, iSaoType, xPos, yPos, width, height, pbBorderAvail);567 processSaoBlock(pPicDec+ posOffset, pPicRest+ posOffset, stride, iSaoType, width, height, pbBorderAvail, iYCbCr); 653 568 } 654 569 } … … 666 581 * \param pbBorderAvail availabilities of block border pixels 667 582 */ 668 Void TComSampleAdaptiveOffset::processSaoBlock(Pel* pDec, Pel* pRest, Int stride, Int saoType, UInt xPos, UInt yPos, UInt width, UInt height, Bool* pbBorderAvail)583 Void TComSampleAdaptiveOffset::processSaoBlock(Pel* pDec, Pel* pRest, Int stride, Int saoType, UInt width, UInt height, Bool* pbBorderAvail, Int iYCbCr) 669 584 { 670 585 //variables … … 672 587 Int signLeft,signRight,signDown,signDown1; 673 588 UInt edgeType; 589 Pel *pClipTbl = (iYCbCr==0)?m_pClipTable:m_pChromaClipTable; 590 Int *pOffsetBo = (iYCbCr==0)?m_iOffsetBo: m_iChromaOffsetBo; 674 591 675 592 switch (saoType) … … 689 606 signLeft = -signRight; 690 607 691 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];608 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 692 609 } 693 610 pDec += stride; … … 717 634 m_iUpBuff1[x]= -signDown; 718 635 719 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];636 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 720 637 } 721 638 pDec += stride; … … 744 661 x= 0; 745 662 edgeType = xSign(pDec[x] - pDec[x- posShift]) - m_iUpBuff1[x+1] + 2; 746 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];663 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 747 664 748 665 } … … 752 669 { 753 670 edgeType = xSign(pDec[x] - pDec[x- posShift]) - m_iUpBuff1[x+1] + 2; 754 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];671 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 755 672 } 756 673 } … … 766 683 signDown1 = xSign(pDec[x] - pDec[x+ posShift]) ; 767 684 edgeType = signDown1 + m_iUpBuff1[x] + 2; 768 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];685 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 769 686 770 687 m_iUpBufft[x+1] = -signDown1; … … 786 703 { 787 704 edgeType = xSign(pDec[x] - pDec[x+ posShift]) + m_iUpBuff1[x] + 2; 788 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];705 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 789 706 } 790 707 } … … 793 710 x= width -1; 794 711 edgeType = xSign(pDec[x] - pDec[x+ posShift]) + m_iUpBuff1[x] + 2; 795 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];712 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 796 713 } 797 714 break; … … 818 735 { 819 736 edgeType = xSign(pDec[x] - pDec[x- posShift]) -m_iUpBuff1[x-1] + 2; 820 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];737 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 821 738 } 822 739 } … … 825 742 x= width-1; 826 743 edgeType = xSign(pDec[x] - pDec[x- posShift]) -m_iUpBuff1[x-1] + 2; 827 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];744 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 828 745 } 829 746 pDec += stride; … … 838 755 edgeType = signDown1 + m_iUpBuff1[x] + 2; 839 756 840 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];757 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 841 758 m_iUpBuff1[x-1] = -signDown1; 842 759 } … … 852 769 x= 0; 853 770 edgeType = xSign(pDec[x] - pDec[x+ posShift]) + m_iUpBuff1[x] + 2; 854 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];771 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 855 772 856 773 } … … 860 777 { 861 778 edgeType = xSign(pDec[x] - pDec[x+ posShift]) + m_iUpBuff1[x] + 2; 862 pRest[x] = m_pClipTable[pDec[x] + m_iOffsetEo[edgeType]];779 pRest[x] = pClipTbl[pDec[x] + m_iOffsetEo[edgeType]]; 863 780 } 864 781 } … … 871 788 for (x=0; x< width; x++) 872 789 { 873 pRest[x] = m_iOffsetBo[pDec[x]];790 pRest[x] = pOffsetBo[pDec[x]]; 874 791 } 875 792 pRest += stride; … … 916 833 Pel *pTmpL; 917 834 Pel *pTmpU; 835 Pel *pClipTbl = NULL; 836 Int *pOffsetBo = NULL; 918 837 919 838 iPicWidthTmp = m_iPicWidth >> iIsChroma; … … 965 884 } 966 885 886 pClipTbl = (iYCbCr==0)? m_pClipTable:m_pChromaClipTable; 887 pOffsetBo = (iYCbCr==0)? m_iOffsetBo:m_iChromaOffsetBo; 888 967 889 switch (iSaoType) 968 890 { … … 980 902 iSignLeft = -iSignRight; 981 903 982 pRec[x] = m_pClipTable[pRec[x] + m_iOffsetEo[uiEdgeType]];904 pRec[x] = pClipTbl[pRec[x] + m_iOffsetEo[uiEdgeType]]; 983 905 } 984 906 pRec += iStride; … … 1005 927 uiEdgeType = iSignDown + m_iUpBuff1[x] + 2; 1006 928 m_iUpBuff1[x]= -iSignDown; 1007 pRec[x] = m_pClipTable[pRec[x] + m_iOffsetEo[uiEdgeType]]; 929 930 pRec[x] = pClipTbl[pRec[x] + m_iOffsetEo[uiEdgeType]]; 1008 931 } 1009 932 pRec += iStride; … … 1036 959 uiEdgeType = iSignDown1 + m_iUpBuff1[x] + 2; 1037 960 m_iUpBufft[x+1] = -iSignDown1; 1038 pRec[x] = m_pClipTable[pRec[x] + m_iOffsetEo[uiEdgeType]];961 pRec[x] = pClipTbl[pRec[x] + m_iOffsetEo[uiEdgeType]]; 1039 962 } 1040 963 m_iUpBufft[iStartX] = iSignDown2; … … 1071 994 uiEdgeType = iSignDown1 + m_iUpBuff1[x] + 2; 1072 995 m_iUpBuff1[x-1] = -iSignDown1; 1073 pRec[x] = m_pClipTable[pRec[x] + m_iOffsetEo[uiEdgeType]];996 pRec[x] = pClipTbl[pRec[x] + m_iOffsetEo[uiEdgeType]]; 1074 997 for (x=iStartX+1; x<iEndX; x++) 1075 998 { … … 1077 1000 uiEdgeType = iSignDown1 + m_iUpBuff1[x] + 2; 1078 1001 m_iUpBuff1[x-1] = -iSignDown1; 1079 pRec[x] = m_pClipTable[pRec[x] + m_iOffsetEo[uiEdgeType]];1002 pRec[x] = pClipTbl[pRec[x] + m_iOffsetEo[uiEdgeType]]; 1080 1003 } 1081 1004 m_iUpBuff1[iEndX-1] = xSign(pRec[iEndX-1 + iStride] - pRec[iEndX]); … … 1091 1014 for (x=0; x<iLcuWidth; x++) 1092 1015 { 1093 pRec[x] = m_iOffsetBo[pRec[x]];1016 pRec[x] = pOffsetBo[pRec[x]]; 1094 1017 } 1095 1018 pRec += iStride; … … 1109 1032 * \param pcPic, pcSaoParam 1110 1033 */ 1111 Void TComSampleAdaptiveOffset::SAOProcess(TComPic* pcPic, SAOParam* pcSaoParam) 1112 { 1113 #if LGE_SAO_MIGRATION_D0091 1114 if (pcSaoParam->bSaoFlag[0] || pcSaoParam->bSaoFlag[1]) 1115 #else 1116 if (pcSaoParam->bSaoFlag[0]) 1117 #endif 1118 { 1119 #if FULL_NBIT 1120 m_uiSaoBitIncrease = g_uiBitDepth + (g_uiBitDepth-8) - min((Int)(g_uiBitDepth + (g_uiBitDepth-8)), 10); 1121 #else 1122 m_uiSaoBitIncrease = g_uiBitDepth + g_uiBitIncrement - min((Int)(g_uiBitDepth + g_uiBitIncrement), 10); 1123 #endif 1034 Void TComSampleAdaptiveOffset::SAOProcess(SAOParam* pcSaoParam) 1035 { 1036 { 1037 m_uiSaoBitIncreaseY = max(g_bitDepthY - 10, 0); 1038 m_uiSaoBitIncreaseC = max(g_bitDepthC - 10, 0); 1124 1039 1125 1040 if(m_bUseNIF) … … 1127 1042 m_pcPic->getPicYuvRec()->copyToPic(m_pcYuvTmp); 1128 1043 } 1129 #if LGE_SAO_MIGRATION_D00911130 1044 if (m_saoLcuBasedOptimization) 1131 #else1132 if (m_saoInterleavingFlag)1133 #endif1134 1045 { 1135 1046 pcSaoParam->oneUnitFlag[0] = 0; … … 1138 1049 } 1139 1050 Int iY = 0; 1140 #if LGE_SAO_MIGRATION_D0091 1141 if (pcSaoParam->bSaoFlag[0]) 1142 { 1143 processSaoUnitAll( pcSaoParam->saoLcuParam[iY], pcSaoParam->oneUnitFlag[iY], iY); 1144 } 1145 if(pcSaoParam->bSaoFlag[1]) 1146 { 1147 processSaoUnitAll( pcSaoParam->saoLcuParam[1], pcSaoParam->oneUnitFlag[1], 1);//Cb 1148 processSaoUnitAll( pcSaoParam->saoLcuParam[2], pcSaoParam->oneUnitFlag[2], 2);//Cr 1149 } 1150 #else 1151 processSaoUnitAll( pcSaoParam->saoLcuParam[iY], pcSaoParam->oneUnitFlag[iY], iY); 1152 1153 Int iCb = 1; 1154 Int iCr = 2; 1155 if (pcSaoParam->bSaoFlag[iCb]) 1156 { 1157 processSaoUnitAll( pcSaoParam->saoLcuParam[iCb], pcSaoParam->oneUnitFlag[iCb], iCb); 1158 } 1159 if (pcSaoParam->bSaoFlag[iCr]) 1160 { 1161 processSaoUnitAll( pcSaoParam->saoLcuParam[iCr], pcSaoParam->oneUnitFlag[iCr], iCr); 1162 } 1163 #endif 1051 { 1052 processSaoUnitAll( pcSaoParam->saoLcuParam[iY], pcSaoParam->oneUnitFlag[iY], iY); 1053 } 1054 { 1055 processSaoUnitAll( pcSaoParam->saoLcuParam[1], pcSaoParam->oneUnitFlag[1], 1);//Cb 1056 processSaoUnitAll( pcSaoParam->saoLcuParam[2], pcSaoParam->oneUnitFlag[2], 2);//Cr 1057 } 1164 1058 m_pcPic = NULL; 1165 1059 } … … 1212 1106 memcpy(m_pTmpU1, pRec, sizeof(Pel)*picWidthTmp); 1213 1107 1214 int i;1108 Int i; 1215 1109 UInt edgeType; 1216 1110 Pel* ppLumaTable = NULL; 1111 Pel* pClipTable = NULL; 1112 Int* pOffsetBo = NULL; 1217 1113 Int typeIdx; 1218 1114 1219 #if LGE_SAO_MIGRATION_D00911220 1115 Int offset[LUMA_GROUP_NUM+1]; 1221 #else1222 static Int offset[LUMA_GROUP_NUM+1];1223 #endif1224 1116 Int idxX; 1225 1117 Int idxY; … … 1231 1123 Int isChroma = (yCbCr == 0) ? 0:1; 1232 1124 Bool mergeLeftFlag; 1233 #if LGE_SAO_MIGRATION_D0091 1125 Int saoBitIncrease = (yCbCr == 0) ? m_uiSaoBitIncreaseY : m_uiSaoBitIncreaseC; 1126 1127 pOffsetBo = (yCbCr==0) ? m_iOffsetBo : m_iChromaOffsetBo; 1128 1234 1129 offset[0] = 0; 1235 #endif1236 1130 for (idxY = 0; idxY< frameHeightInCU; idxY++) 1237 1131 { … … 1269 1163 { 1270 1164 addr = idxY * frameWidthInCU + idxX; 1165 1271 1166 if (oneUnitFlag) 1272 1167 { … … 1292 1187 for (i=0; i<saoLcuParam[addr].length; i++) 1293 1188 { 1294 #if LGE_SAO_MIGRATION_D0091 1295 offset[ (saoLcuParam[addr].subTypeIdx +i)%SAO_MAX_BO_CLASSES +1] = saoLcuParam[addr].offset[i] << m_uiSaoBitIncrease; 1296 #else 1297 offset[ (saoLcuParam[addr].bandPosition +i)%SAO_MAX_BO_CLASSES +1] = saoLcuParam[addr].offset[i] << m_uiSaoBitIncrease; 1298 #endif 1189 offset[ (saoLcuParam[addr].subTypeIdx +i)%SAO_MAX_BO_CLASSES +1] = saoLcuParam[addr].offset[i] << saoBitIncrease; 1299 1190 } 1300 1191 1301 ppLumaTable = m_lumaTableBo; 1302 1303 #if FULL_NBIT 1304 for (i=0;i<(1<<(g_uiBitDepth));i++) 1305 #else 1306 for (i=0;i<(1<<(g_uiBitIncrement+8));i++) 1307 #endif 1192 ppLumaTable = (yCbCr==0)?m_lumaTableBo:m_chromaTableBo; 1193 pClipTable = (yCbCr==0)?m_pClipTable:m_pChromaClipTable; 1194 1195 Int bitDepth = (yCbCr==0) ? g_bitDepthY : g_bitDepthC; 1196 for (i=0;i<(1<<bitDepth);i++) 1308 1197 { 1309 m_iOffsetBo[i] = m_pClipTable[i + offset[ppLumaTable[i]]];1198 pOffsetBo[i] = pClipTable[i + offset[ppLumaTable[i]]]; 1310 1199 } 1311 1200 … … 1315 1204 for (i=0;i<saoLcuParam[addr].length;i++) 1316 1205 { 1317 offset[i+1] = saoLcuParam[addr].offset[i] << m_uiSaoBitIncrease;1206 offset[i+1] = saoLcuParam[addr].offset[i] << saoBitIncrease; 1318 1207 } 1319 1208 for (edgeType=0;edgeType<6;edgeType++) … … 1375 1264 saoLcuParam[i].offset[j] = 0; 1376 1265 } 1377 #if LGE_SAO_MIGRATION_D0091 1378 saoLcuParam[i].subTypeIdx = 0; 1379 #else 1380 saoLcuParam[i].bandPosition = 0; 1381 #endif 1266 saoLcuParam[i].subTypeIdx = 0; 1382 1267 } 1383 1268 } … … 1428 1313 saoLcuParam[addr].partIdxTmp = (Int)partIdx; 1429 1314 saoLcuParam[addr].typeIdx = saoQTPart[partIdx].iBestType; 1430 #if LGE_SAO_MIGRATION_D0091 1431 saoLcuParam[addr].subTypeIdx = saoQTPart[partIdx].subTypeIdx; 1432 #else 1433 saoLcuParam[addr].bandPosition = saoQTPart[partIdx].bandPosition; 1434 #endif 1315 saoLcuParam[addr].subTypeIdx = saoQTPart[partIdx].subTypeIdx; 1435 1316 if (saoLcuParam[addr].typeIdx!=-1) 1436 1317 { … … 1444 1325 { 1445 1326 saoLcuParam[addr].length = 0; 1446 #if LGE_SAO_MIGRATION_D00911447 1327 saoLcuParam[addr].subTypeIdx = saoQTPart[partIdx].subTypeIdx; 1448 #else1449 saoLcuParam[addr].bandPosition = saoQTPart[partIdx].bandPosition;1450 #endif1451 1328 for (j=0;j<MAX_NUM_SAO_OFFSETS;j++) 1452 1329 { … … 1458 1335 } 1459 1336 1460 #if LGE_SAO_MIGRATION_D00911461 1337 Void TComSampleAdaptiveOffset::resetSaoUnit(SaoLcuParam* saoUnit) 1462 1338 { … … 1507 1383 { 1508 1384 Bool bPCMFilter = (pcPic->getSlice(0)->getSPS()->getUsePCM() && pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag())? true : false; 1509 #if LOSSLESS_CODING 1510 if(bPCMFilter || pcPic->getSlice(0)->getSPS()->getUseLossless()) 1511 #else 1512 if(bPCMFilter) 1513 #endif 1514 { 1515 for( UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame() ; uiCUAddr++ ) 1516 { 1517 TComDataCU* pcCU = pcPic->getCU(uiCUAddr); 1518 xPCMCURestoration(pcCU, 0, 0); 1519 } 1385 1386 if(bPCMFilter || pcPic->getSlice(0)->getPPS()->getTransquantBypassEnableFlag()) 1387 { 1388 for( UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame() ; uiCUAddr++ ) 1389 { 1390 TComDataCU* pcCU = pcPic->getCU(uiCUAddr); 1391 1392 xPCMCURestoration(pcCU, 0, 0); 1393 } 1520 1394 } 1521 1395 } … … 1583 1457 uiWidth = (g_uiMaxCUWidth >> uiDepth); 1584 1458 uiHeight = (g_uiMaxCUHeight >> uiDepth); 1585 if ( pcCU->isLosslessCoded(uiAbsZorderIdx) )1459 if ( pcCU->isLosslessCoded(uiAbsZorderIdx) && !pcCU->getIPCMFlag(uiAbsZorderIdx) ) 1586 1460 { 1587 1461 uiPcmLeftShiftBit = 0; … … 1589 1463 else 1590 1464 { 1591 uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement- pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();1465 uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); 1592 1466 } 1593 1467 } … … 1608 1482 uiWidth = ((g_uiMaxCUWidth >> uiDepth)/2); 1609 1483 uiHeight = ((g_uiMaxCUWidth >> uiDepth)/2); 1610 if ( pcCU->isLosslessCoded(uiAbsZorderIdx) )1484 if ( pcCU->isLosslessCoded(uiAbsZorderIdx) && !pcCU->getIPCMFlag(uiAbsZorderIdx) ) 1611 1485 { 1612 1486 uiPcmLeftShiftBit = 0; … … 1614 1488 else 1615 1489 { 1616 uiPcmLeftShiftBit = g_ uiBitDepth + g_uiBitIncrement- pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();1490 uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); 1617 1491 } 1618 1492 } … … 1628 1502 } 1629 1503 } 1630 #endif 1504 1631 1505 //! \}
Note: See TracChangeset for help on using the changeset viewer.