Changeset 818 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder
- Timestamp:
- 4 Jul 2014, 09:08:40 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r815 r818 609 609 TEncSbac* pcSbacCoders = NULL; 610 610 TComOutputBitstream* pcSubstreamsOut = NULL; 611 #if Q0108_TSA_STSA612 Int flagTSTA = 0;613 #endif614 611 615 612 xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut, isField ); … … 1563 1560 } 1564 1561 } 1562 1563 arrangeLongtermPicturesInRPS(pcSlice, rcListPic); 1564 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 1565 refPicListModification->setRefPicListModificationFlagL0(0); 1566 refPicListModification->setRefPicListModificationFlagL1(0); 1567 pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 1568 pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 1569 1570 #if SVC_EXTENSION 1571 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 1572 { 1573 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 1574 if ( pocCurr > 0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1575 #else 1576 if (pcSlice->getPOC()>0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1577 #endif 1578 { 1579 pcSlice->setActiveNumILRRefIdx(0); 1580 pcSlice->setInterLayerPredEnabledFlag(0); 1581 } 1582 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 1583 { 1584 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getActiveNumILRRefIdx()); 1585 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getActiveNumILRRefIdx()); 1586 } 1587 else 1588 { 1589 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+pcSlice->getActiveNumILRRefIdx()); 1590 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getActiveNumILRRefIdx()); 1591 } 1592 1593 // check for the reference pictures whether there is at least one either temporal picture or ILRP with sample prediction type 1594 if( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) - pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) - pcSlice->getActiveNumILRRefIdx() == 0 ) 1595 { 1596 Bool foundSamplePredPicture = false; 1597 1598 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 1599 { 1600 if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( pcSlice->getVPS()->getRefLayerId( m_layerId, pcSlice->getInterLayerPredLayerIdc(i) ) ) ) 1601 { 1602 foundSamplePredPicture = true; 1603 break; 1604 } 1605 } 1606 1607 if( !foundSamplePredPicture ) 1608 { 1609 pcSlice->setSliceType(I_SLICE); 1610 pcSlice->setInterLayerPredEnabledFlag(0); 1611 pcSlice->setActiveNumILRRefIdx(0); 1612 } 1613 } 1614 } 1615 #endif //SVC_EXTENSION 1616 1565 1617 #if Q0108_TSA_STSA 1566 else if( ( pcSlice->getTLayer() == 0 && pcSlice->getLayerId() > 0) // only for enhancement layer and with temporal layer 01567 1618 if( ( pcSlice->getTLayer() == 0 && pcSlice->getLayerId() > 0 ) // only for enhancement layer and with temporal layer 0 1619 && !( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N 1568 1620 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R 1569 1621 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N … … 1576 1628 { 1577 1629 Bool isSTSA=true; 1630 Bool isIntra=false; 1631 1632 for( Int i = 0; i < pcSlice->getLayerId(); i++) 1633 { 1634 TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic(); 1635 TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC()); 1636 if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerId(), i) ) 1637 { 1638 if( lowerLayerPic->getSlice(0)->getSliceType() == I_SLICE) 1639 { 1640 isIntra = true; 1641 } 1642 } 1643 } 1644 1578 1645 for(Int ii=iGOPid+1; ii < m_pcCfg->getGOPSize() && isSTSA; ii++) 1579 1646 { … … 1605 1672 } 1606 1673 } 1607 if(isSTSA==true )1674 if(isSTSA==true && isIntra == false) 1608 1675 { 1609 #if !Q0108_TSA_STSA1610 if( pcSlice->getLayerId() > 0 )1611 {1612 Bool oneRefLayerSTSA = false, oneRefLayerNotSTSA = false;1613 for( Int i = 0; i < pcSlice->getLayerId(); i++)1614 {1615 TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic();1616 TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC());1617 if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerId(), i) )1618 {1619 if( ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ) ||1620 ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R )1621 )1622 {1623 if(pcSlice->getTemporalLayerNonReferenceFlag() )1624 {1625 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N);1626 }1627 else1628 {1629 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R );1630 }1631 oneRefLayerSTSA = true;1632 }1633 else1634 {1635 oneRefLayerNotSTSA = true;1636 }1637 }1638 }1639 assert( !( oneRefLayerNotSTSA && oneRefLayerSTSA ) ); // Only one variable should be true - failure of this assert means1640 // that two independent reference layers that are not dependent on1641 // each other, but are reference for current layer have inconsistency1642 if( oneRefLayerNotSTSA /*&& !oneRefLayerSTSA*/ ) // No reference layer is STSA - set current as TRAIL1643 {1644 if(pcSlice->getTemporalLayerNonReferenceFlag() )1645 {1646 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_N );1647 }1648 else1649 {1650 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_R );1651 }1652 }1653 else // This means there is no reference layer picture for current picture in this AU1654 {1655 if(pcSlice->getTemporalLayerNonReferenceFlag() )1656 {1657 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N);1658 }1659 else1660 {1661 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R );1662 }1663 }1664 }1665 #else1666 1676 if(pcSlice->getTemporalLayerNonReferenceFlag()) 1667 1677 { 1668 1678 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N); 1669 flagTSTA = 1;1670 1679 } 1671 1680 else 1672 1681 { 1673 1682 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R); 1674 flagTSTA = 1; 1675 } 1676 #endif 1677 } 1678 } 1679 #endif 1680 1681 arrangeLongtermPicturesInRPS(pcSlice, rcListPic); 1682 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 1683 refPicListModification->setRefPicListModificationFlagL0(0); 1684 refPicListModification->setRefPicListModificationFlagL1(0); 1685 pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 1686 pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 1687 1688 #if SVC_EXTENSION 1689 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 1690 { 1691 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 1692 if ( pocCurr > 0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1693 #else 1694 if (pcSlice->getPOC()>0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1695 #endif 1696 { 1697 pcSlice->setActiveNumILRRefIdx(0); 1698 pcSlice->setInterLayerPredEnabledFlag(0); 1699 } 1700 #if Q0108_TSA_STSA 1701 if( ( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) || flagTSTA == 1 ) 1702 #else 1703 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 1704 #endif 1705 { 1706 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getActiveNumILRRefIdx()); 1707 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getActiveNumILRRefIdx()); 1708 } 1709 else 1710 { 1711 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+pcSlice->getActiveNumILRRefIdx()); 1712 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getActiveNumILRRefIdx()); 1713 } 1714 1715 // check for the reference pictures whether there is at least one either temporal picture or ILRP with sample prediction type 1716 if( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) - pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) - pcSlice->getActiveNumILRRefIdx() == 0 ) 1717 { 1718 Bool foundSamplePredPicture = false; 1719 1720 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 1721 { 1722 if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( pcSlice->getVPS()->getRefLayerId( m_layerId, pcSlice->getInterLayerPredLayerIdc(i) ) ) ) 1723 { 1724 foundSamplePredPicture = true; 1725 break; 1726 } 1727 } 1728 1729 if( !foundSamplePredPicture ) 1730 { 1731 pcSlice->setSliceType(I_SLICE); 1732 pcSlice->setInterLayerPredEnabledFlag(0); 1733 pcSlice->setActiveNumILRRefIdx(0); 1734 } 1735 } 1736 } 1737 #endif //SVC_EXTENSION 1683 } 1684 } 1685 } 1686 #endif 1738 1687 1739 1688 #if ADAPTIVE_QP_SELECTION
Note: See TracChangeset for help on using the changeset viewer.