Changeset 532 in SHVCSoftware for branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncSbac.cpp
- Timestamp:
- 2 Jan 2014, 07:21:30 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-4.1-dev/source/Lib/TLibEncoder/TEncSbac.cpp
r494 r532 416 416 { 417 417 PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx ); 418 419 418 if ( pcCU->isIntra( uiAbsPartIdx ) ) 420 419 { … … 1394 1393 { 1395 1394 m_pcBinIf->encodeBin( 1, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); 1395 #if HM_CLEANUP_SAO 1396 m_pcBinIf->encodeBinEP( uiCode == 1 ? 0 : 1 ); 1397 #else 1396 1398 m_pcBinIf->encodeBinEP( uiCode <= 4 ? 1 : 0 ); 1399 #endif 1397 1400 } 1398 1401 } … … 1597 1600 } 1598 1601 1602 #if HM_CLEANUP_SAO 1603 Void TEncSbac::codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled) 1604 { 1605 UInt uiSymbol; 1606 if(!sliceEnabled) 1607 { 1608 assert(ctbParam.modeIdc == SAO_MODE_OFF); 1609 return; 1610 } 1611 1612 //type 1613 if(compIdx == SAO_Y || compIdx == SAO_Cb) 1614 { 1615 //sao_type_idx_luma or sao_type_idx_chroma 1616 if(ctbParam.modeIdc == SAO_MODE_OFF) 1617 { 1618 uiSymbol =0; 1619 } 1620 else if(ctbParam.typeIdc == SAO_TYPE_BO) //BO 1621 { 1622 uiSymbol = 1; 1623 } 1624 else 1625 { 1626 assert(ctbParam.typeIdc < SAO_TYPE_START_BO); //EO 1627 uiSymbol = 2; 1628 } 1629 codeSaoTypeIdx(uiSymbol); 1630 } 1631 1632 if(ctbParam.modeIdc == SAO_MODE_NEW) 1633 { 1634 Int numClasses = (ctbParam.typeIdc == SAO_TYPE_BO)?4:NUM_SAO_EO_CLASSES; 1635 Int offset[4]; 1636 Int k=0; 1637 for(Int i=0; i< numClasses; i++) 1638 { 1639 if(ctbParam.typeIdc != SAO_TYPE_BO && i == SAO_CLASS_EO_PLAIN) 1640 { 1641 continue; 1642 } 1643 Int classIdx = (ctbParam.typeIdc == SAO_TYPE_BO)?( (ctbParam.typeAuxInfo+i)% NUM_SAO_BO_CLASSES ):i; 1644 offset[k] = ctbParam.offset[classIdx]; 1645 k++; 1646 } 1647 1648 for(Int i=0; i< 4; i++) 1649 { 1650 codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]), g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs 1651 } 1652 1653 1654 if(ctbParam.typeIdc == SAO_TYPE_BO) 1655 { 1656 for(Int i=0; i< 4; i++) 1657 { 1658 if(offset[i] != 0) 1659 { 1660 codeSAOSign((offset[i]< 0)?1:0); 1661 } 1662 } 1663 1664 codeSaoUflc(NUM_SAO_BO_CLASSES_LOG2, ctbParam.typeAuxInfo ); //sao_band_position 1665 } 1666 else //EO 1667 { 1668 if(compIdx == SAO_Y || compIdx == SAO_Cb) 1669 { 1670 assert(ctbParam.typeIdc - SAO_TYPE_START_EO >=0); 1671 codeSaoUflc(NUM_SAO_EO_TYPES_LOG2, ctbParam.typeIdc - SAO_TYPE_START_EO ); //sao_eo_class_luma or sao_eo_class_chroma 1672 } 1673 } 1674 1675 } 1676 } 1677 1678 1679 Void TEncSbac::codeSAOBlkParam(SAOBlkParam& saoBlkParam 1680 , Bool* sliceEnabled 1681 , Bool leftMergeAvail 1682 , Bool aboveMergeAvail 1683 , Bool onlyEstMergeInfo // = false 1684 ) 1685 { 1686 1687 Bool isLeftMerge = false; 1688 Bool isAboveMerge= false; 1689 1690 if(leftMergeAvail) 1691 { 1692 isLeftMerge = ((saoBlkParam[SAO_Y].modeIdc == SAO_MODE_MERGE) && (saoBlkParam[SAO_Y].typeIdc == SAO_MERGE_LEFT)); 1693 codeSaoMerge( isLeftMerge?1:0 ); //sao_merge_left_flag 1694 } 1695 1696 if( aboveMergeAvail && !isLeftMerge) 1697 { 1698 isAboveMerge = ((saoBlkParam[SAO_Y].modeIdc == SAO_MODE_MERGE) && (saoBlkParam[SAO_Y].typeIdc == SAO_MERGE_ABOVE)); 1699 codeSaoMerge( isAboveMerge?1:0 ); //sao_merge_left_flag 1700 } 1701 1702 if(onlyEstMergeInfo) 1703 { 1704 return; //only for RDO 1705 } 1706 1707 if(!isLeftMerge && !isAboveMerge) //not merge mode 1708 { 1709 for(Int compIdx=0; compIdx < NUM_SAO_COMPONENTS; compIdx++) 1710 { 1711 codeSAOOffsetParam(compIdx, saoBlkParam[compIdx], sliceEnabled[compIdx]); 1712 } 1713 } 1714 } 1715 #endif 1716 1599 1717 //! \}
Note: See TracChangeset for help on using the changeset viewer.