Changeset 294 in 3DVCSoftware for branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp
- Timestamp:
- 19 Feb 2013, 20:33:52 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-5.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp
r292 r294 52 52 Void TEncEntropy::encodeSliceHeader ( TComSlice* pcSlice ) 53 53 { 54 #if SAO_UNIT_INTERLEAVING55 54 if (pcSlice->getSPS()->getUseSAO()) 56 55 { … … 68 67 } 69 68 } 70 #endif71 69 72 70 m_pcEntropyCoderIf->codeSliceHeader( pcSlice ); … … 74 72 } 75 73 76 #if TILES_WPP_ENTRY_POINT_SIGNALLING77 74 Void TEncEntropy::encodeTilesWPPEntryPoint( TComSlice* pSlice ) 78 75 { 79 76 m_pcEntropyCoderIf->codeTilesWPPEntryPoint( pSlice ); 80 77 } 81 #else82 Void TEncEntropy::encodeSliceHeaderSubstreamTable( TComSlice* pcSlice )83 {84 m_pcEntropyCoderIf->codeSliceHeaderSubstreamTable( pcSlice );85 }86 #endif87 78 88 79 Void TEncEntropy::encodeTerminatingBit ( UInt uiIsLast ) … … 98 89 } 99 90 100 #if OL_FLUSH101 91 Void TEncEntropy::encodeFlush() 102 92 { … … 107 97 m_pcEntropyCoderIf->encodeStart(); 108 98 } 109 #endif110 99 111 100 Void TEncEntropy::encodeSEI(const SEI& sei) … … 157 146 uiAbsPartIdx = 0; 158 147 } 159 #if BURST_IPCM160 148 if( !bRD ) 161 149 { … … 165 153 } 166 154 } 167 #endif168 155 m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx ); 169 156 } … … 226 213 // m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->realfiltNo); 227 214 228 #if !LCU_SYNTAX_ALF229 m_pcEntropyCoderIf->codeAlfFlag(pAlfParam->alf_pcr_region_flag);230 #endif231 #if !ALF_SINGLE_FILTER_SHAPE232 m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->filter_shape);233 #endif234 215 Int noFilters = min(pAlfParam->filters_per_group-1, 2); 235 216 m_pcEntropyCoderIf->codeAlfUvlc(noFilters); … … 241 222 else if (noFilters == 2) 242 223 { 243 #if LCU_SYNTAX_ALF244 #if ALF_16_BA_GROUPS245 224 Int numMergeFlags = 16; 246 #else247 Int numMergeFlags = 15;248 #endif249 #else250 #if ALF_16_BA_GROUPS251 Int numMergeFlags = 16;252 #else253 Int numMergeFlags = pAlfParam->alf_pcr_region_flag ? 16 : 15;254 #endif255 #endif256 225 for (Int i=1; i<numMergeFlags; i++) 257 226 { … … 285 254 pDepthInt = pDepthIntTabShapes[ALFp->filter_shape]; 286 255 maxScanVal = 0; 287 #if ALF_SINGLE_FILTER_SHAPE288 256 int minScanVal = MIN_SCAN_POS_CROSS; 289 #else290 int minScanVal = ( ALFp->filter_shape==ALF_STAR5x5 ) ? 0 : MIN_SCAN_POS_CROSS;291 #endif292 257 293 258 for(i = 0; i < sqrFiltLength; i++) … … 355 320 // Coding parameters 356 321 ALFp->minKStart = minKStart; 357 #if !LCU_SYNTAX_ALF358 ALFp->maxScanVal = maxScanVal;359 #endif360 322 for(scanPos = minScanVal; scanPos < maxScanVal; scanPos++) 361 323 { … … 363 325 } 364 326 365 #if LCU_SYNTAX_ALF366 327 if (ALFp->filters_per_group == 1) 367 328 { … … 370 331 else 371 332 { 372 #endif373 333 len += writeFilterCodingParams(minKStart, minScanVal, maxScanVal, kMinTab); 374 334 375 335 // Filter coefficients 376 336 len += writeFilterCoeffs(sqrFiltLength, filters_per_group, pDepthInt, ALFp->coeffmulti, kMinTab); 377 #if LCU_SYNTAX_ALF 378 } 379 #endif 337 } 380 338 381 339 return len; … … 415 373 { 416 374 scanPos = pDepthInt[i] - 1; 417 #if LCU_SYNTAX_ALF418 375 Int k = (filters_per_group == 1) ? kMinTab[i] : kMinTab[scanPos]; 419 376 golombEncode(FilterCoeff[ind][i], k); 420 #else421 golombEncode(FilterCoeff[ind][i], kMinTab[scanPos]);422 #endif423 377 } 424 378 } … … 526 480 #endif 527 481 528 #if LCU_SYNTAX_ALF529 482 /** parse the fixed length code (smaller than one max value) in ALF 530 483 * \param run: coded value … … 793 746 794 747 } 795 #endif796 748 797 749 798 750 Void TEncEntropy::encodeAlfParam(ALFParam* pAlfParam) 799 751 { 800 #if LCU_SYNTAX_ALF801 752 const Int numCoeff = (Int)ALF_MAX_NUM_COEF; 802 753 … … 826 777 } 827 778 } 828 #else829 if (!pAlfParam->alf_flag)830 {831 return;832 }833 Int pos;834 codeAux(pAlfParam);835 codeFilt(pAlfParam);836 837 // filter parameters for chroma838 m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->chroma_idc);839 if(pAlfParam->chroma_idc)840 {841 #if !ALF_SINGLE_FILTER_SHAPE842 m_pcEntropyCoderIf->codeAlfUvlc(pAlfParam->filter_shape_chroma);843 #endif844 // filter coefficients for chroma845 for(pos=0; pos<pAlfParam->num_coeff_chroma; pos++)846 {847 m_pcEntropyCoderIf->codeAlfSvlc(pAlfParam->coeff_chroma[pos]);848 }849 }850 #endif851 779 } 852 780 … … 907 835 uiAbsPartIdx = 0; 908 836 } 909 #if BURST_IPCM910 837 if( !bRD ) 911 838 { … … 915 842 } 916 843 } 917 #endif918 844 919 845 #if !RWTH_SDC_DLT_B0036 … … 943 869 uiAbsPartIdx = 0; 944 870 } 945 #if BURST_IPCM946 871 if( !bRD ) 947 872 { … … 951 876 } 952 877 } 953 #endif954 878 955 879 m_pcEntropyCoderIf->codeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); … … 969 893 uiAbsPartIdx = 0; 970 894 } 971 #if BURST_IPCM972 895 if( !bRD ) 973 896 { … … 977 900 } 978 901 } 979 #endif980 902 #if RWTH_SDC_DLT_B0036 981 903 if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx) ) … … 1031 953 } 1032 954 1033 #if BURST_IPCM1034 955 Int numIPCM = 0; 1035 956 Bool firstIPCMFlag = false; … … 1047 968 } 1048 969 m_pcEntropyCoderIf->codeIPCMInfo ( pcCU, uiAbsPartIdx, numIPCM, firstIPCMFlag); 1049 #else 1050 m_pcEntropyCoderIf->codeIPCMInfo ( pcCU, uiAbsPartIdx ); 1051 #endif 1052 1053 } 1054 1055 #if UNIFIED_TRANSFORM_TREE 970 971 } 972 1056 973 Void TEncEntropy::xEncodeTransform( TComDataCU* pcCU,UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP ) 1057 #else1058 Void TEncEntropy::xEncodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 )1059 #endif1060 974 { 1061 975 const UInt uiSubdiv = pcCU->getTransformIdx( uiAbsPartIdx ) + pcCU->getDepth( uiAbsPartIdx ) > uiDepth; 1062 976 const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth; 1063 #if UNIFIED_TRANSFORM_TREE1064 977 UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA , uiTrIdx ); 1065 978 UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); … … 1084 997 } 1085 998 } 1086 #endif // UNIFIED_TRANSFORM_TREE1087 999 {//CABAC 1088 1000 if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) … … 1164 1076 if( uiSubdiv ) 1165 1077 { 1166 #if UNIFIED_TRANSFORM_TREE1167 1078 UInt size; 1168 1079 width >>= 1; … … 1170 1081 size = width*height; 1171 1082 uiTrIdx++; 1172 #endif // UNIFIED_TRANSFORM_TREE1173 1083 ++uiDepth; 1174 #if UNIFIED_TRANSFORM_TREE1175 1084 const UInt partNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); 1176 #else1177 const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);1178 #endif1179 1085 1180 1086 UInt uiCurrentCbfY = 0; … … 1182 1088 UInt uiCurrentCbfV = 0; 1183 1089 1184 #if UNIFIED_TRANSFORM_TREE1185 1090 UInt nsAddr = 0; 1186 1091 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 0, uiDepth - pcCU->getDepth( uiAbsPartIdx ) ); … … 1198 1103 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 3, uiDepth - pcCU->getDepth( uiAbsPartIdx ) ); 1199 1104 xEncodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, 3, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP ); 1200 #else // UNIFIED_TRANSFORM_TREE1201 UInt nsAddr = 0;1202 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 0, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );1203 xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 0, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );1204 1205 uiAbsPartIdx += uiQPartNum;1206 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 1, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );1207 xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 1, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );1208 1209 uiAbsPartIdx += uiQPartNum;1210 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 2, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );1211 xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 2, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );1212 1213 uiAbsPartIdx += uiQPartNum;1214 nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, 3, uiDepth - pcCU->getDepth( uiAbsPartIdx ) );1215 xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, 3, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );1216 #endif // UNIFIED_TRANSFORM_TREE1217 1105 1218 1106 uiYCbfFront3 += uiCurrentCbfY; … … 1258 1146 } 1259 1147 1260 #if UNIFIED_TRANSFORM_TREE1261 1148 if ( cbfY || cbfU || cbfV ) 1262 1149 { … … 1310 1197 } 1311 1198 } 1312 #endif // UNIFIED_TRANSFORM_TREE 1313 } 1314 } 1315 } 1316 1317 #if !UNIFIED_TRANSFORM_TREE 1318 // transform index 1319 Void TEncEntropy::encodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD ) 1320 { 1321 assert( !bRD ); // parameter bRD can be removed 1322 if( bRD ) 1323 { 1324 uiAbsPartIdx = 0; 1325 } 1326 1327 DTRACE_CABAC_VL( g_nSymbolCounter++ ) 1328 DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" ) 1329 DTRACE_CABAC_V( uiDepth ) 1330 DTRACE_CABAC_T( "\n" ) 1331 UInt temp = 0; 1332 UInt temp1 = 0; 1333 UInt temp2 = 0; 1334 xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 ); 1335 } 1336 #endif // !UNIFIED_TRANSFORM_TREE 1199 } 1200 } 1201 } 1202 1337 1203 1338 1204 // Intra direction for Luma … … 1550 1416 1551 1417 // texture 1552 #if !UNIFIED_TRANSFORM_TREE1553 Void TEncEntropy::xEncodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP )1554 {1555 UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2;1556 UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx );1557 UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );1558 UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );1559 1560 if( uiLog2TrSize == 2 )1561 {1562 UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );1563 if( ( uiAbsPartIdx % uiQPDiv ) == 0 )1564 {1565 m_uiBakAbsPartIdx = uiAbsPartIdx;1566 m_uiBakChromaOffset = uiChromaOffset;1567 }1568 else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )1569 {1570 uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );1571 uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );1572 }1573 }1574 1575 if ( uiCbfY || uiCbfU || uiCbfV )1576 {1577 // dQP: only for LCU once1578 if ( pcCU->getSlice()->getPPS()->getUseDQP() )1579 {1580 if ( bCodeDQP )1581 {1582 encodeQP( pcCU, uiAbsPartIdx );1583 bCodeDQP = false;1584 }1585 }1586 UInt uiLumaTrMode, uiChromaTrMode;1587 pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode );1588 const UInt uiStopTrMode = uiLumaTrMode;1589 1590 assert(1); // as long as quadtrees are not used for residual transform1591 1592 if( uiTrIdx == uiStopTrMode )1593 {1594 if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) )1595 {1596 Int trWidth = uiWidth;1597 Int trHeight = uiHeight;1598 pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );1599 m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );1600 }1601 1602 uiWidth >>= 1;1603 uiHeight >>= 1;1604 1605 if( uiLog2TrSize == 2 )1606 {1607 UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );1608 if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )1609 {1610 uiWidth <<= 1;1611 uiHeight <<= 1;1612 Int trWidth = uiWidth;1613 Int trHeight = uiHeight;1614 pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight );1615 if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )1616 {1617 m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );1618 }1619 if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )1620 {1621 m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );1622 }1623 }1624 }1625 else1626 {1627 Int trWidth = uiWidth;1628 Int trHeight = uiHeight;1629 pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );1630 if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )1631 {1632 m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );1633 }1634 if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )1635 {1636 m_pcEntropyCoderIf->codeCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );1637 }1638 }1639 }1640 else1641 {1642 {1643 DTRACE_CABAC_VL( g_nSymbolCounter++ );1644 DTRACE_CABAC_T( "\tgoing down\tdepth=" );1645 DTRACE_CABAC_V( uiDepth );1646 DTRACE_CABAC_T( "\ttridx=" );1647 DTRACE_CABAC_V( uiTrIdx );1648 DTRACE_CABAC_T( "\n" );1649 }1650 if( uiCurrTrIdx <= uiTrIdx )1651 assert(1);1652 1653 UInt uiSize;1654 uiWidth >>= 1;1655 uiHeight >>= 1;1656 uiSize = uiWidth*uiHeight;1657 uiDepth++;1658 uiTrIdx++;1659 1660 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);1661 UInt uiIdx = uiAbsPartIdx;1662 1663 {1664 xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );1665 uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum;1666 1667 xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );1668 uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum;1669 1670 xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );1671 uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum;1672 1673 xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );1674 }1675 {1676 DTRACE_CABAC_VL( g_nSymbolCounter++ );1677 DTRACE_CABAC_T( "\tgoing up\n" );1678 }1679 }1680 }1681 }1682 #endif // !UNIFIED_TRANSFORM_TREE1683 1418 1684 1419 /** encode coefficients … … 1718 1453 DTRACE_CABAC_V( uiDepth ) 1719 1454 DTRACE_CABAC_T( "\n" ) 1720 #if !UNIFIED_TRANSFORM_TREE1721 UInt temp = 0;1722 UInt temp1 = 0;1723 UInt temp2 = 0;1724 xEncodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );1725 #endif // !UNIFIED_TRANSFORM_TREE1726 1455 } 1727 1456 else … … 1747 1476 } 1748 1477 } 1749 #if !UNIFIED_TRANSFORM_TREE1750 encodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );1751 #endif1752 1478 } 1753 1479 … … 1768 1494 #endif 1769 1495 1770 #if UNIFIED_TRANSFORM_TREE1771 1496 UInt temp = 0; 1772 1497 UInt temp1 = 0; 1773 1498 UInt temp2 = 0; 1774 1499 xEncodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP ); 1775 #else // UNIFIED_TRANSFORM_TREE1776 xEncodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP );1777 #endif // UNIFIED_TRANSFORM_TREE1778 1500 1779 1501 #if FIX_MPI_B0065 … … 1797 1519 } 1798 1520 1799 #if SAO_UNIT_INTERLEAVING1800 1521 /** Encode SAO Offset 1801 1522 * \param saoLcuParam SAO LCU paramters … … 1985 1706 } 1986 1707 } 1987 #else1988 /** Encode SAO for one partition1989 * \param pSaoParam, iPartIdx1990 */1991 Void TEncEntropy::encodeSaoOnePart(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)1992 {1993 SAOQTPart* pAlfPart = NULL;1994 pAlfPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);1995 1996 UInt uiSymbol;1997 1998 if(!pAlfPart->bSplit)1999 {2000 if (pAlfPart->bEnableFlag)2001 {2002 uiSymbol = pAlfPart->iBestType + 1;2003 }2004 else2005 {2006 uiSymbol = 0;2007 }2008 2009 m_pcEntropyCoderIf->codeSaoUvlc(uiSymbol);2010 2011 if (pAlfPart->bEnableFlag)2012 {2013 for(Int i=0; i< pAlfPart->iLength; i++)2014 {2015 m_pcEntropyCoderIf->codeSaoSvlc(pAlfPart->iOffset[i]);2016 }2017 }2018 return;2019 }2020 2021 //split2022 if (pAlfPart->PartLevel < pSaoParam->iMaxSplitLevel)2023 {2024 for (Int i=0;i<NUM_DOWN_PART;i++)2025 {2026 encodeSaoOnePart(pSaoParam, pAlfPart->DownPartsIdx[i], iYCbCr);2027 }2028 }2029 }2030 2031 /** Encode quadtree split flag2032 * \param pSaoParam, iPartIdx2033 */2034 Void TEncEntropy::encodeQuadTreeSplitFlag(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)2035 {2036 SAOQTPart* pSaoPart = NULL;2037 pSaoPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);2038 2039 if(pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel)2040 {2041 //send one flag2042 m_pcEntropyCoderIf->codeSaoFlag( (pSaoPart->bSplit)?(1):(0) );2043 2044 if(pSaoPart->bSplit)2045 {2046 for (Int i=0;i<NUM_DOWN_PART;i++)2047 {2048 encodeQuadTreeSplitFlag(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr);2049 }2050 }2051 }2052 }2053 /** Encode SAO parameters2054 * \param pSaoParam2055 */2056 Void TEncEntropy::encodeSaoParam(SAOParam* pSaoParam)2057 {2058 if (pSaoParam->bSaoFlag[0])2059 {2060 encodeQuadTreeSplitFlag(pSaoParam, 0, 0);2061 encodeSaoOnePart(pSaoParam, 0, 0);2062 m_pcEntropyCoderIf->codeSaoFlag(pSaoParam->bSaoFlag[1]);2063 if (pSaoParam->bSaoFlag[1])2064 {2065 encodeQuadTreeSplitFlag(pSaoParam, 0, 1);2066 encodeSaoOnePart(pSaoParam, 0, 1);2067 }2068 m_pcEntropyCoderIf->codeSaoFlag(pSaoParam->bSaoFlag[2]);2069 if (pSaoParam->bSaoFlag[2])2070 {2071 encodeQuadTreeSplitFlag(pSaoParam, 0, 2);2072 encodeSaoOnePart(pSaoParam, 0, 2);2073 }2074 }2075 }2076 #endif2077 1708 2078 1709 Int TEncEntropy::countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize )
Note: See TracChangeset for help on using the changeset viewer.