Changeset 42 in 3DVCSoftware for trunk/source/App


Ignore:
Timestamp:
26 Mar 2012, 18:05:40 (13 years ago)
Author:
tech
Message:

Nokia (Flexible Coding Order)
Ericsson ( High Level Syntax )
changes

Location:
trunk/source/App
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r21 r42  
    126126  NalUnitType eNalUnitType;
    127127
     128#if FLEX_CODING_ORDER
     129  Int iDepthViewIdx = 0;
     130  Bool bCountDepthViewIdx = false;              // a flag which avoid repeating assign a value to iDepthViewIdx   
     131  Bool bNewPictureType =true;
     132  Bool bFirstDepth = false;
     133#endif
    128134 
    129135  while ( !bEos )
     
    136142      if( bIsDepth )
    137143      {
     144#if FLEX_CODING_ORDER
     145                  if (!bFirstSliceDecoded) m_acTDecDepthTopList[iDepthViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx] ,bNewPictureType);
     146                  m_acTDecDepthTopList[iDepthViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx]);
     147
     148#else
    138149        if (!bFirstSliceDecoded) m_acTDecDepthTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx] );
    139150        m_acTDecDepthTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx]);
     151#endif
    140152      }
    141153      else
    142154      {
     155#if FLEX_CODING_ORDER
     156                  if (!bFirstSliceDecoded) m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx], bNewPictureType);
     157#else
    143158        if (!bFirstSliceDecoded) m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx] );
    144         m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]);
     159#endif
     160                m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]);
    145161      }
    146162      if( pcListPic )
     
    156172    Bool bNewPicture;
    157173    if( bIsDepth )
     174#if FLEX_CODING_ORDER
     175                  bNewPicture = m_acTDecDepthTopList[iDepthViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx], bNewPictureType);
     176#else
    158177      bNewPicture = m_acTDecDepthTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx] );
     178#endif
    159179    else
     180#if FLEX_CODING_ORDER
     181                bNewPicture = m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx], bNewPictureType );
     182#else
    160183      bNewPicture = m_acTDecTopList[iViewIdx]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx] );
     184#endif
    161185    bFirstSliceDecoded   = true;
     186
     187#if FLEX_CODING_ORDER
     188          if (eNalUnitType == NAL_UNIT_SPS)
     189          {
     190                  if( cComSPS.isDepth() && (m_bUsingDepth==false) )  // expected not using depth, but bitstream are using depth
     191                  {                                                     // know from sps
     192                          assert( cComSPS.getViewId() == 0 && iDepthViewIdx == 0 && !bIsDepth );
     193                          startUsingDepth() ;
     194                  }
     195                  if (cComSPS.isDepth())
     196                  {
     197                          if (cComSPS.getViewId() >= m_acTVideoIOYuvDepthReconFileList.size())
     198                          {
     199                                  assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() );
     200                                  increaseNumberOfViews(cComSPS.getViewId()+1);
     201                          }
     202                       
     203                          m_acTDecDepthTopList[cComSPS.getViewId()]->setSPS(cComSPS);
     204                  }
     205                  else
     206                  {
     207                          if (cComSPS.getViewId() >= m_acTVideoIOYuvReconFileList.size())
     208                          {
     209                                  assert( cComSPS.getViewId() == m_acTVideoIOYuvReconFileList.size() );
     210                                  increaseNumberOfViews(cComSPS.getViewId()+1);
     211                          }
     212                          m_acTDecTopList[cComSPS.getViewId()]->setSPS(cComSPS);
     213                  }
     214                  bEos = m_cTVideoIOBitstreamFile.readBits( pcBitstream );
     215                  assert( !bEos);
     216                  if( cComSPS.isDepth() )
     217                          m_acTDecDepthTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiDepthPOCLastDisplayList[cComSPS.getViewId()], bNewPictureType); // decode PPS
     218                  else
     219                          m_acTDecTopList[cComSPS.getViewId()]->decode( bEos, pcBitstream, uiPOC, pcListPic, eNalUnitType, cComSPS, m_iSkipFrame, m_aiPOCLastDisplayList[cComSPS.getViewId()], bNewPictureType); // decode PPS
     220                  assert( eNalUnitType == NAL_UNIT_PPS );
     221          }
     222#else
    162223
    163224    if( eNalUnitType == NAL_UNIT_SPS )
     
    188249      assert( eNalUnitType == NAL_UNIT_PPS );
    189250    }
     251
     252#endif
    190253    assert( eNalUnitType != NAL_UNIT_SEI ); // not yet supported for MVC
    191254    if (bNewPicture)
    192255    {
    193256      if( bIsDepth )
     257#if FLEX_CODING_ORDER
     258        m_acTDecDepthTopList[iDepthViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iDepthViewIdx]);
     259#else
    194260        m_acTDecDepthTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiDepthPOCLastDisplayList[iViewIdx]);
     261#endif
    195262      else
    196263        m_acTDecTopList[iViewIdx]->executeDeblockAndAlf( bEos, pcBitstream, uiPOC, pcListPic, m_iSkipFrame, m_aiPOCLastDisplayList[iViewIdx]);
     
    199266      bFirstSliceDecoded = false;
    200267
    201       if( m_bUsingDepth && !bIsDepth )
    202       {
    203         bIsDepth = true;
     268#if FLEX_CODING_ORDER
     269      if (m_bUsingDepth)
     270      {
     271        bIsDepth = bNewPictureType;       
     272
     273      }
     274      if (bCountDepthViewIdx == false )
     275      {
     276        bCountDepthViewIdx = true;
     277        if (bIsDepth == true)
     278        {
     279          bFirstDepth = true;
     280          bCountDepthViewIdx = true;
     281        }
     282        if (!bFirstDepth && !bIsDepth)
     283        {
     284          iViewIdx++;
     285          bCountDepthViewIdx = false;
     286        }
     287
    204288      }
    205289      else
    206290      {
    207         bIsDepth = false;
    208         if( iViewIdx<m_acTDecTopList.size()-1)
    209         {
    210           iViewIdx++ ;
     291        if (bIsDepth)
     292        {
     293          iDepthViewIdx++;
    211294        }
    212295        else
    213296        {
     297          iViewIdx ++;
     298        }
     299
     300        if (iViewIdx >= m_acTDecTopList.size() || iDepthViewIdx >= m_acTDecDepthTopList.size())
     301        {
     302          bFirstDepth = false;
    214303          iViewIdx = 0;
    215 
     304          iDepthViewIdx = 0;
     305          bCountDepthViewIdx = false;
    216306          // end of access unit: delete extra pic buffers
    217307          Int iNumViews = (Int)m_acTVideoIOYuvReconFileList.size();
     
    244334        }
    245335      }
     336         
     337#else
     338
     339      if( m_bUsingDepth && !bIsDepth )
     340      {
     341        bIsDepth = true;
     342      }
     343      else
     344      {
     345        bIsDepth = false;
     346        if( iViewIdx<m_acTDecTopList.size()-1)
     347        {
     348          iViewIdx++ ;
     349        }
     350        else
     351        {
     352          iViewIdx = 0;
     353
     354          // end of access unit: delete extra pic buffers
     355          Int iNumViews = (Int)m_acTVideoIOYuvReconFileList.size();
     356          for( Int iVId = 0; iVId < iNumViews; iVId++ )
     357          {
     358            if( iVId < (Int)m_acTDecTopList.size() &&  m_acTDecTopList[iVId] )
     359            {
     360              m_acTDecTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC );
     361            }
     362            if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] )
     363            {
     364              m_acTDecDepthTopList[iVId]->deleteExtraPicBuffers( (Int)uiPOC );
     365            }
     366          }
     367
     368#if AMVP_BUFFERCOMPRESS
     369          // compress motion for entire access unit
     370          for( Int iVId = 0; iVId < iNumViews; iVId++ )
     371          {
     372            if( iVId < (Int)m_acTDecTopList.size() &&  m_acTDecTopList[iVId] )
     373            {
     374              m_acTDecTopList[iVId]->compressMotion( (Int)uiPOC );
     375            }
     376            if( iVId < (Int)m_acTDecDepthTopList.size() && m_acTDecDepthTopList[iVId] )
     377            {
     378              m_acTDecDepthTopList[iVId]->compressMotion( (Int)uiPOC );
     379            }
     380          }
     381#endif
     382        }
     383          }
     384#endif
    246385    }
    247386#else
     
    506645      m_acTDecDepthTopList.back()->create() ;
    507646      m_acTDecDepthTopList.back()->init( this, false );
    508       m_acTDecDepthTopList.back()->setViewIdx((Int)m_acTDecTopList.size()-1);
     647#if FLEX_CODING_ORDER
     648      Int iNumofgen = (Int)m_acTDecDepthTopList.size();
     649      m_acTDecDepthTopList.back()->setViewIdx(iNumofgen-1);
     650#else
     651          m_acTDecDepthTopList.back()->setViewIdx((Int)m_acTDecTopList.size()-1);
     652#endif
     653
    509654      m_acTDecDepthTopList.back()->setPictureDigestEnabled(m_pictureDigestEnabled);
    510655      m_acTDecDepthTopList.back()->setToDepth( true );
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r21 r42  
    110110    free (m_pchBitstreamFile) ;
    111111
     112#if FLEX_CODING_ORDER
     113  if (m_pchMVCJointCodingOrder != NULL)
     114  {
     115          free(m_pchMVCJointCodingOrder) ;
     116  }
     117#endif
    112118  for(Int i = 0; i< m_pchDepthReconFileList.size(); i++ )
    113119  {
     
    153159  string cfg_ReconFile;
    154160  string cfg_dQPFile;
     161
     162#if FLEX_CODING_ORDER
     163  string cfg_JointCodingOrdering;
     164#endif
     165
    155166  po::Options opts;
    156167  opts.addOptions()
     
    191202  ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
    192203
     204#if FLEX_CODING_ORDER
     205  ("FCO",               m_b3DVFlexOrder,   false, "flexible coding order flag" )
     206  ("CodingOrder",               cfg_JointCodingOrdering,  string(""), "The coding order for joint texture-depth coding")
     207#endif
    193208
    194209  /* Unit definition parameters */
     
    380395
    381396
     397#if FLEX_CODING_ORDER
     398  m_pchMVCJointCodingOrder      = cfg_JointCodingOrdering.empty()?NULL:strdup(cfg_JointCodingOrdering.c_str());
     399  // If flexible order is enabled and if depth comes before the texture for a view, disable VSO
     400
     401#if HHI_VSO && DISABLE_FCO_FOR_VSO
     402  Bool depthComesFirst = false;
     403  if ( m_b3DVFlexOrder )
     404  {
     405    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
     406    {
     407      for ( Int ii=1; ii<12; ii+=2 )
     408      {
     409        Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
     410        if ( iViewIdxCfg == iViewIdx )
     411        {
     412          if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
     413          {
     414            depthComesFirst = true;
     415            break;
     416          }
     417          else
     418          {
     419            assert(m_pchMVCJointCodingOrder[ii-1]=='T');
     420          }
     421        }
     422      }
     423    }
     424  }
     425  if (depthComesFirst)
     426  {
     427    m_bUseVSO = false;         
     428  }
     429#endif
     430#endif
     431
    382432// GT FIX
    383433  if ( m_bUsingDepthMaps )
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r5 r42  
    8181  Bool      m_bUsingDepthMaps ;
    8282
     83#if FLEX_CODING_ORDER
     84  char*         m_pchMVCJointCodingOrder;               ///<  texture-depth coding order
     85  Bool          m_b3DVFlexOrder;                ///<  flexible coding order flag
     86#endif
     87
    8388
    8489  // coding structure
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r21 r42  
    145145#endif
    146146
     147#if BITSTREAM_EXTRACTION
     148    m_acTEncTopList[iViewIdx]->setLayerId                      ( ( (UInt)iViewIdx ) << 1 );
     149#endif
    147150    m_acTEncTopList[iViewIdx]->setViewId                       ( (UInt)iViewIdx );
    148151    m_acTEncTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
     
    235238    for(Int iViewIdx=0; iViewIdx<m_iNumberOfViews; iViewIdx++)
    236239    {
     240#if FLEX_CODING_ORDER
     241      // Detect whether depth comes before than texture for this view
     242      Bool isDepthFirst = false;
     243      if ( m_b3DVFlexOrder )
     244      {
     245        for ( Int ii=1; ii<12; ii+=2 )
     246        {
     247          Int iViewIdxCfg = (Int)(m_pchMVCJointCodingOrder[ii]-'0');
     248          if ( iViewIdxCfg == iViewIdx )
     249          {
     250            if ( m_pchMVCJointCodingOrder[ii-1]=='D' ) // depth comes first for this view
     251            {
     252              isDepthFirst = true;
     253            }
     254            else
     255            {
     256              assert(m_pchMVCJointCodingOrder[ii-1]=='T');
     257            }
     258            break;
     259          }
     260        }
     261      }
     262#endif
    237263      m_iDepthFrameRcvdVector.push_back(0) ;
    238264      m_acTEncDepthTopList.push_back(new TEncTop);
     
    314340#endif
    315341
     342#if BITSTREAM_EXTRACTION
     343      m_acTEncDepthTopList[iViewIdx]->setLayerId                      ( ( ( (UInt)iViewIdx ) << 1 ) + 1 );
     344#endif
    316345      m_acTEncDepthTopList[iViewIdx]->setViewId                       ( (UInt)iViewIdx );
    317346      m_acTEncDepthTopList[iViewIdx]->setViewOrderIdx                 ( m_cCameraData.getViewOrderIndex()[ iViewIdx ] );
     
    354383      m_acTEncDepthTopList[iViewIdx]->setUseDMM( m_bUseDMM );
    355384#endif
     385#if FLEX_CODING_ORDER && HHI_DMM_PRED_TEX
     386      m_acTEncDepthTopList[iViewIdx]->setUseDMM34( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseDMM );
     387#endif
    356388#if CONSTRAINED_INTRA_PRED
    357389      m_acTEncDepthTopList[iViewIdx]->setUseConstrainedIntraPred      ( m_bUseConstrainedIntraPred );
     
    380412#endif
    381413#if HHI_MPI
     414#if FLEX_CODING_ORDER
     415      m_acTEncDepthTopList[iViewIdx]->setUseMVI( (m_b3DVFlexOrder && isDepthFirst) ? false : m_bUseMVI );
     416#else
    382417      m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
    383418#endif
    384 
     419#endif
     420     
    385421      m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled);
    386422
     
    591627  std::vector<Bool>  bDepthEos ;
    592628  std::vector<Bool>  bContinueReadingDepthPics ;
    593 
    594629  for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
    595630  {
     
    689724#endif
    690725
     726#if FLEX_CODING_ORDER
     727    if (m_b3DVFlexOrder)
     728    {
     729      Int i=0;
     730      Int iViewIdx = 0;
     731      bool bThisViewContinueReadingPics = false;
     732      bool bThisViewContinueReadingDepthPics = false;
     733      Int iNumberofDepthViews = m_bUsingDepthMaps?m_iNumberOfViews:0;
     734      for(Int j=0; j < (m_iNumberOfViews+ iNumberofDepthViews); j++ )     // Start encoding
     735      {
     736        if (m_pchMVCJointCodingOrder[i]=='T')
     737        {
     738          i++;
     739          assert(isdigit(m_pchMVCJointCodingOrder[i]));
     740          iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
     741          bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx];
     742          m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics );
     743          bContinueReadingPics[iViewIdx]=bThisViewContinueReadingPics;
     744          bAllContinueReadingPics = bAllContinueReadingPics||bContinueReadingPics[iViewIdx];
     745
     746          if(pcBitstream->getNumberOfWrittenBits()!=0)
     747          {
     748            m_cTVideoIOBitsFile.writeBits( pcBitstream );
     749          }
     750          pcBitstream->resetBits(); //GT: also done later in ....
     751          pcBitstream->rewindStreamPacket( );
     752          // write bistream to file if necessary
     753          xWriteOutput( iViewIdx ); //GT: Write Reconfiles (when gop is complete?)
     754          i++;
     755        }
     756        else if ( m_pchMVCJointCodingOrder[i] == 'D')
     757        {
     758          i++;
     759          if( m_bUsingDepthMaps )
     760          {
     761            assert(isdigit(m_pchMVCJointCodingOrder[i]));
     762            iViewIdx = (Int)(m_pchMVCJointCodingOrder[i]-'0');
     763            bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx];
     764            m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics );
     765            bContinueReadingDepthPics[iViewIdx]=bThisViewContinueReadingDepthPics;
     766
     767            bAllContinueReadingDepthPics = bAllContinueReadingDepthPics||bContinueReadingDepthPics[iViewIdx];
     768            if(pcBitstream->getNumberOfWrittenBits()!=0)
     769            {
     770              m_cTVideoIOBitsFile.writeBits( pcBitstream );
     771            }
     772            pcBitstream->resetBits();
     773            pcBitstream->rewindStreamPacket( );
     774            // write bistream to file if necessary
     775            xWriteOutput( iViewIdx, true );
     776            i++;
     777          }
     778        }
     779      }
     780    }
     781    else
     782    {
     783#endif
    691784    //GT: Encode
    692785    for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )     // Start encoding
     
    723816      }
    724817    }
    725 
     818#if FLEX_CODING_ORDER
     819        }
     820#endif
    726821    // delete extra picture buffers
    727822    if( bCurrPocCoded )
Note: See TracChangeset for help on using the changeset viewer.