Changeset 431 in SHVCSoftware for branches/SHM-3.1-dev/source/App/TAppEncoder


Ignore:
Timestamp:
11 Oct 2013, 05:54:02 (12 years ago)
Author:
seregin
Message:

initial porting of HM12

Location:
branches/SHM-3.1-dev/source/App/TAppEncoder
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r405 r431  
    348348 
    349349#if SVC_EXTENSION
    350   string  cfg_LayerCfgFile  [MAX_LAYERS];
     350  string  cfg_LayerCfgFile   [MAX_LAYERS];
    351351  string  cfg_BitstreamFile;
    352   string* cfg_InputFile     [MAX_LAYERS];
    353   string* cfg_ReconFile     [MAX_LAYERS];
    354   Double* cfg_fQP           [MAX_LAYERS];
     352  string* cfg_InputFile      [MAX_LAYERS];
     353  string* cfg_ReconFile      [MAX_LAYERS];
     354  Double* cfg_fQP            [MAX_LAYERS];
    355355
    356356#if REPN_FORMAT_IN_VPS
     
    565565  ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
    566566#endif
     567
     568  //Field coding parameters
     569  ("FieldCoding", m_isField, false, "Signals if it's a field based coding")
     570  ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not")
    567571  ("FrameSkip,-fs",         m_FrameSkip,          0u, "Number of frames to skip at start of input YUV")
    568572  ("FramesToBeEncoded,f",   m_framesToBeEncoded,   0, "Number of frames to be encoded (default=all)")
     
    862866  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
    863867
     868  if(m_isField)
     869  {
     870#if SVC_EXTENSION
     871    for(Int layer = 0; layer < MAX_LAYERS; layer++)
     872    {
     873      //Frame height
     874      m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight;
     875      //Field height
     876      m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1;
     877    }
     878#else
     879    //Frame height
     880    m_iSourceHeightOrg = m_iSourceHeight;
     881    //Field height
     882    m_iSourceHeight = m_iSourceHeight >> 1;
     883#endif
     884    //number of fields to encode
     885    m_framesToBeEncoded *= 2;
     886  }
     887 
    864888  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    865889  {
     
    11931217        m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;
    11941218        m_iSourceHeight += m_confBottom;
     1219        if ( m_isField )
     1220        {
     1221          m_iSourceHeightOrg += m_confBottom << 1;
     1222          m_aiPad[1] = m_confBottom << 1;
     1223        }
    11951224      }
    11961225      if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0)
     
    15151544#if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    15161545  Int checkGOP=1;
    1517   Int numRefs = 1;
     1546  Int numRefs = m_isField ? 2 : 1;
    15181547#endif
    15191548  Int refList[MAX_NUM_REF_PICS+1];
    15201549  refList[0]=0;
     1550  if(m_isField)
     1551  {
     1552    refList[1] = 1;
     1553  }
    15211554  Bool isOK[MAX_GOP];
    15221555  for(Int i=0; i<MAX_GOP; i++)
     
    15461579  for(UInt layer=0; layer<m_numLayers; layer++)
    15471580  {
    1548     if(m_acLayerCfg[layer].xCheckParameter())
     1581    if(m_acLayerCfg[layer].xCheckParameter(m_isField))
    15491582    {
    15501583      printf("\nError: invalid configuration parameter found in layer %d \n", layer);
     
    21812214  printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    21822215#endif
    2183   printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     2216  if (m_isField)
     2217  {
     2218    printf("Frame/Field          : Field based coding\n");
     2219    printf("Field index          : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     2220    if (m_isTopFieldFirst)
     2221    {
     2222      printf("Field Order            : Top field first\n");
     2223    }
     2224    else
     2225    {
     2226      printf("Field Order            : Bottom field first\n");
     2227    }
     2228  }
     2229  else
     2230  {
     2231    printf("Frame/Field                  : Frame based coding\n");
     2232    printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     2233  }
    21842234  printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    21852235  printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
  • branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncCfg.h

    r402 r431  
    8888  UInt      m_FrameSkip;                                      ///< number of skipped frames from the beginning
    8989  Int       m_iSourceWidth;                                   ///< source width in pixel
    90   Int       m_iSourceHeight;                                  ///< source height in pixel
     90  Int       m_iSourceHeight;                                  ///< source height in pixel (when interlaced = field height)
     91 
     92  Int       m_iSourceHeightOrg;                               ///< original source height in pixel (when interlaced = frame height)
     93 
     94 
    9195  Int       m_conformanceMode;
    9296  Int       m_confLeft;
     
    97101  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
    98102#endif 
     103
     104  Bool      m_isField;                                        ///< enable field coding
     105  Bool      m_isTopFieldFirst;
    99106
    100107  // profile/level
  • branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r389 r431  
    161161Bool confirmPara(Bool bflag, const char* message);
    162162
    163 Bool TAppEncLayerCfg::xCheckParameter()
     163Bool TAppEncLayerCfg::xCheckParameter( Bool isField )
    164164{
    165165  switch (m_conformanceMode)
     
    185185        m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;
    186186        m_iSourceHeight += m_confBottom;
     187        if ( isField )
     188        {
     189          m_iSourceHeightOrg += m_confBottom << 1;
     190          m_aiPad[1] = m_confBottom << 1;
     191        }
    187192      }
    188193      break;
  • branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r403 r431  
    3333  Int       m_iFrameRate;                                     ///< source frame-rates (Hz)
    3434  Int       m_iSourceWidth;                                   ///< source width in pixel
    35   Int       m_iSourceHeight;                                  ///< source height in pixel
     35  Int       m_iSourceHeight;                                  ///< source height in pixel (when interlaced = field height)
     36  Int       m_iSourceHeightOrg;                               ///< original source height in pixel (when interlaced = frame height)
    3637  Int       m_conformanceMode;
    3738  Int       m_confLeft;
     
    104105  Void  xPrintParameter();
    105106#endif
    106   Bool  xCheckParameter();
     107  Bool  xCheckParameter( Bool isField );
    107108
    108109  Void    setAppEncCfg(TAppEncCfg* p) {m_cAppEncCfg = p;          }
     
    113114  Int     getSourceWidth()            {return m_iSourceWidth;     }
    114115  Int     getSourceHeight()           {return m_iSourceHeight;    }
     116  Int     getSourceHeightOrg()        {return m_iSourceHeightOrg; }
    115117  Int     getConformanceMode()        { return m_conformanceMode; }
    116118  Int*    getPad()                    {return m_aiPad;            }
  • branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r427 r431  
    888888}
    889889
    890 Void TAppEncTop::xInitLib()
     890Void TAppEncTop::xInitLib(Bool isFieldCoding)
    891891{
    892892#if SVC_EXTENSION
    893893  for(UInt layer=0; layer<m_numLayers; layer++)
    894894  {
    895     m_acTEncTop[layer].init();
     895    m_acTEncTop[layer].init(isFieldCoding);
    896896  }
    897897#if VPS_RENAME
     
    10911091  vps->setExtensionOffset( 0xffff );
    10921092#endif
    1093 #else
    1094   m_cTEncTop.init();
    1095 #endif
     1093#else //SVC_EXTENSION
     1094  m_cTEncTop.init(isFieldCoding);
     1095#endif //SVC_EXTENSION
    10961096}
    10971097
     
    11241124  xInitLibCfg();
    11251125  xCreateLib();
    1126   xInitLib();
     1126  xInitLib(m_isField);
    11271127
    11281128  // main encoder loop
     
    11361136    // allocate original YUV buffer
    11371137    pcPicYuvOrg[layer] = new TComPicYuv;
     1138    if( m_isField )
     1139    {
    11381140#if SVC_UPSAMPLING
    1139     pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    1140 #else
    1141     pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    1142 #endif
     1141      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1142#else
     1143      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     1144#endif
     1145    }
     1146    else
     1147    {
     1148#if SVC_UPSAMPLING
     1149      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1150#else
     1151      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     1152#endif
     1153    }
    11431154  }
    11441155
     
    11821193          m_iFrameRcvd++;
    11831194          // check end of file
    1184           bEos = (m_iFrameRcvd == m_framesToBeEncoded);
     1195          bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) );
    11851196        }
    11861197
    1187         m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] );
     1198        if ( m_isField )
     1199        {
     1200          m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer], m_isTopFieldFirst );
     1201        }
     1202        else
     1203        {
     1204          m_acTEncTop[layer].encodePrep( pcPicYuvOrg[layer] );
     1205        }
    11881206      }
    11891207
     
    12321250      {
    12331251        // call encoding function for one frame
    1234         m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
     1252        if ( m_isField )
     1253        {
     1254          m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP, m_isTopFieldFirst );
     1255        }
     1256        else
     1257        {
     1258          m_acTEncTop[layer].encode( flush ? 0 : pcPicYuvOrg[layer], m_acListPicYuvRec[layer], outputAccessUnits, iPicIdInGOP );
     1259        }
    12351260      }
    12361261    }
     
    12691294    if (bEos)
    12701295    {
    1271       printOutSummary();
     1296      printOutSummary(m_isTopFieldFirst);
    12721297    }
    12731298
     
    13011326}
    13021327
    1303 Void TAppEncTop::printOutSummary()
     1328Void TAppEncTop::printOutSummary(Bool isField)
    13041329{
    13051330  UInt layer;
     
    13081333  for(layer = 0; layer < m_numLayers; layer++)
    13091334  {
    1310     m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate());
    1311     m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() );
    1312     m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() );
    1313     m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() );
     1335    if(isField)
     1336    {
     1337      m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate());
     1338      m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() );
     1339      m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() );
     1340      m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() );
     1341    }
     1342    else
     1343    {
     1344      m_gcAnalyzeAll[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2);
     1345      m_gcAnalyzeI[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 );
     1346      m_gcAnalyzeP[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 );
     1347      m_gcAnalyzeB[layer].setFrmRate( m_acLayerCfg[layer].getFrameRate() * 2 );
     1348    }
    13141349  }
    13151350
     
    13421377    m_gcAnalyzeB[layer].printOut('b', layer);
    13431378  }
     1379
     1380  if(isField)
     1381  {
     1382    for(layer = 0; layer < m_numLayers; layer++)
     1383    {
     1384      //-- interlaced summary
     1385      m_gcAnalyzeAll_in.setFrmRate( m_acLayerCfg[layer].getFrameRate());
     1386      printf( "\n\nSUMMARY INTERLACED ---------------------------------------------\n" );
     1387      m_gcAnalyzeAll_in.printOutInterlaced('a',  m_gcAnalyzeAll[layer].getBits());
     1388
     1389#if _SUMMARY_OUT_
     1390      m_gcAnalyzeAll_in.printSummaryOutInterlaced();
     1391#endif
     1392    }
     1393  }
    13441394}
    13451395
     
    13601410  xInitLibCfg();
    13611411  xCreateLib();
    1362   xInitLib();
     1412  xInitLib(m_isField);
    13631413
    13641414  // main encoder loop
     
    13691419
    13701420  // allocate original YUV buffer
    1371   pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     1421  if( m_isField )
     1422  {
     1423    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeightOrg, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     1424  }
     1425  else
     1426  {
     1427    pcPicYuvOrg->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     1428  }
    13721429
    13731430  while ( !bEos )
     
    13821439    m_iFrameRcvd++;
    13831440
    1384     bEos = (m_iFrameRcvd == m_framesToBeEncoded);
    1385 
     1441    bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) );
    13861442    Bool flush = 0;
    13871443    // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures
     
    13951451
    13961452    // call encoding function for one frame
     1453    if ( m_isField )
     1454    {
     1455      m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst);
     1456    }
     1457    else
     1458    {
    13971459    m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, m_cListPicYuvRec, outputAccessUnits, iNumEncoded );
     1460    }
    13981461
    13991462    // write bistream to file if necessary
     
    14051468  }
    14061469
    1407   m_cTEncTop.printSummary();
     1470  m_cTEncTop.printSummary(m_isField);
    14081471
    14091472  // delete original YUV buffer
     
    14791542Void TAppEncTop::xWriteRecon(UInt layer, Int iNumEncoded)
    14801543{
    1481   Int i;
    1482 
    1483   TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end();
    1484 
    1485   for ( i = 0; i < iNumEncoded; i++ )
    1486   {
    1487     --iterPicYuvRec;
    1488   }
    1489 
    1490   for ( i = 0; i < iNumEncoded; i++ )
    1491   {
    1492     TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
     1544  if (m_isField)
     1545  {
     1546    //Reinterlace fields
     1547    Int i;
     1548    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end();
     1549
     1550    for ( i = 0; i < iNumEncoded; i++ )
     1551    {
     1552      --iterPicYuvRec;
     1553    }
     1554
     1555    for ( i = 0; i < iNumEncoded/2; i++ )
     1556    {
     1557      TComPicYuv*  pcPicYuvRecTop  = *(iterPicYuvRec++);
     1558      TComPicYuv*  pcPicYuvRecBottom  = *(iterPicYuvRec++);
     1559
    14931560#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    1494     if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed())
    1495 #else
    1496     if (!m_acLayerCfg[layer].getReconFile().empty())
    1497 #endif
    1498     {
    1499       m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(),
    1500         m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() );
     1561      if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRecTop->isReconstructed() && pcPicYuvRecBottom->isReconstructed())
     1562#else
     1563      if (!m_acLayerCfg[layer].getReconFile().empty())
     1564#endif
     1565      {
     1566        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom(), m_isTopFieldFirst );
     1567      }
     1568    }
     1569  }
     1570  else
     1571  {
     1572    Int i;
     1573
     1574    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_acListPicYuvRec[layer].end();
     1575
     1576    for ( i = 0; i < iNumEncoded; i++ )
     1577    {
     1578      --iterPicYuvRec;
     1579    }
     1580
     1581    for ( i = 0; i < iNumEncoded; i++ )
     1582    {
     1583      TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
     1584#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1585      if (!m_acLayerCfg[layer].getReconFile().empty() && pcPicYuvRec->isReconstructed())
     1586#else
     1587      if (!m_acLayerCfg[layer].getReconFile().empty())
     1588#endif
     1589      {
     1590        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(),
     1591          m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() );
     1592      }
    15011593    }
    15021594  }
     
    15051597Void TAppEncTop::xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits)
    15061598{
    1507   Int i;
    1508 
    1509   list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     1599  if (m_isField)
     1600  {
     1601    //Reinterlace fields
     1602    Int i;
     1603    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
    15101604
    15111605#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    1512   for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ )
    1513 #else
    1514   for ( i = 0; i < iNumEncoded; i++ )
    1515 #endif
    1516   {
    1517     const AccessUnit& au = *(iterBitstream++);
    1518     const vector<UInt>& stats = writeAnnexB(bitstreamFile, au);
    1519     rateStatsAccum(au, stats);
     1606    for ( i = 0; i < iNumEncoded/2 && iterBitstream != accessUnits.end(); i++ )
     1607#else
     1608    for ( i = 0; i < iNumEncoded/2; i++ )
     1609#endif
     1610    {     
     1611      const AccessUnit& auTop = *(iterBitstream++);
     1612      const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop);
     1613      rateStatsAccum(auTop, statsTop);
     1614
     1615      const AccessUnit& auBottom = *(iterBitstream++);
     1616      const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom);
     1617      rateStatsAccum(auBottom, statsBottom);
     1618    }
     1619  }
     1620  else
     1621  {
     1622    Int i;
     1623
     1624    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     1625
     1626#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1627    for ( i = 0; i < iNumEncoded && iterBitstream != accessUnits.end(); i++ )
     1628#else
     1629    for ( i = 0; i < iNumEncoded; i++ )
     1630#endif
     1631    {
     1632      const AccessUnit& au = *(iterBitstream++);
     1633      const vector<UInt>& stats = writeAnnexB(bitstreamFile, au);
     1634      rateStatsAccum(au, stats);
     1635    }
    15201636  }
    15211637}
     
    15611677Void TAppEncTop::xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits)
    15621678{
    1563   Int i;
    1564 
    1565   TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
    1566   list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
    1567 
    1568   for ( i = 0; i < iNumEncoded; i++ )
    1569   {
    1570     --iterPicYuvRec;
    1571   }
    1572 
    1573   for ( i = 0; i < iNumEncoded; i++ )
    1574   {
    1575     TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
    1576     if (m_pchReconFile)
    1577     {
     1679  if (m_isField)
     1680  {
     1681    //Reinterlace fields
     1682    Int i;
     1683    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
     1684    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     1685
     1686    for ( i = 0; i < iNumEncoded; i++ )
     1687    {
     1688      --iterPicYuvRec;
     1689    }
     1690
     1691    for ( i = 0; i < iNumEncoded/2; i++ )
     1692    {
     1693      TComPicYuv*  pcPicYuvRecTop  = *(iterPicYuvRec++);
     1694      TComPicYuv*  pcPicYuvRecBottom  = *(iterPicYuvRec++);
     1695
     1696      if (m_pchReconFile)
     1697      {
     1698        m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confLeft, m_confRight, m_confTop, m_confBottom, m_isTopFieldFirst );
     1699      }
     1700
     1701      const AccessUnit& auTop = *(iterBitstream++);
     1702      const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop);
     1703      rateStatsAccum(auTop, statsTop);
     1704
     1705      const AccessUnit& auBottom = *(iterBitstream++);
     1706      const vector<UInt>& statsBottom = writeAnnexB(bitstreamFile, auBottom);
     1707      rateStatsAccum(auBottom, statsBottom);
     1708    }
     1709  }
     1710  else
     1711  {
     1712    Int i;
     1713
     1714    TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end();
     1715    list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin();
     1716
     1717    for ( i = 0; i < iNumEncoded; i++ )
     1718    {
     1719      --iterPicYuvRec;
     1720    }
     1721
     1722    for ( i = 0; i < iNumEncoded; i++ )
     1723    {
     1724      TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
     1725      if (m_pchReconFile)
     1726      {
    15781727#if SYNTAX_OUTPUT
    1579       m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom );
    1580 #endif
    1581     }
    1582 
    1583     const AccessUnit& au = *(iterBitstream++);
    1584     const vector<UInt>& stats = writeAnnexB(bitstreamFile, au);
    1585     rateStatsAccum(au, stats);
     1728        m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom );
     1729#endif
     1730      }
     1731
     1732      const AccessUnit& au = *(iterBitstream++);
     1733      const vector<UInt>& stats = writeAnnexB(bitstreamFile, au);
     1734      rateStatsAccum(au, stats);
     1735    }
    15861736  }
    15871737}
     
    16021752    case NAL_UNIT_CODED_SLICE_TRAIL_R:
    16031753    case NAL_UNIT_CODED_SLICE_TRAIL_N:
    1604     case NAL_UNIT_CODED_SLICE_TSA_R:
     1754    case NAL_UNIT_CODED_SLICE_TLA_R:
    16051755    case NAL_UNIT_CODED_SLICE_TSA_N:
    16061756    case NAL_UNIT_CODED_SLICE_STSA_R:
  • branches/SHM-3.1-dev/source/App/TAppEncoder/TAppEncTop.h

    r313 r431  
    8282  Void  xCreateLib        ();                               ///< create files & encoder class
    8383  Void  xInitLibCfg       ();                               ///< initialize internal variables
    84   Void  xInitLib          ();                               ///< initialize encoder class
     84  Void  xInitLib          (Bool isFieldCoding);             ///< initialize encoder class
    8585  Void  xDestroyLib       ();                               ///< destroy encoder class
    8686 
     
    9999  Void xWriteRecon(UInt layer, Int iNumEncoded);
    100100  Void xWriteStream(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits);
    101   Void printOutSummary();
     101  Void printOutSummary(Bool isField);
    102102#else
    103103  Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); ///< write bitstream to file
Note: See TracChangeset for help on using the changeset viewer.