Changeset 38 in SHVCSoftware for branches/SHM-1.1-dev/source/Lib/TLibCommon


Ignore:
Timestamp:
20 Feb 2013, 21:24:20 (12 years ago)
Author:
seregin
Message:

AVC_SYNTAX: initial porting of the AVC metadata file reading

Location:
branches/SHM-1.1-dev/source/Lib/TLibCommon
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/CommonDef.h

    r14 r38  
    5656// ====================================================================================================================
    5757
    58 #define NV_VERSION        "1.0"                 ///< Current software version
     58#define NV_VERSION        "1.1"                 ///< Current software version
    5959
    6060// ====================================================================================================================
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r33 r38  
    383383  m_layerId          = pcPic->getLayerId();
    384384#endif
    385 
    386385  for(int i=0; i<pcPic->getNumPartInCU(); i++)
    387386  {
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComMotionInfo.h

    r28 r38  
    141141  Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
    142142
     143#if AVC_SYNTAX
     144  Void           setMv    (TComMv cMv,  Int iIdx )         { m_pcMv    [iIdx] = cMv; }
     145  Void           setRefIdx(Int iRefIdx, Int iIdx   )       { m_piRefIdx[iIdx] =  iRefIdx; }
     146#endif
     147
    143148  Void setNumPartition( Int iNumPart )
    144149  {
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComPic.cpp

    r33 r38  
    669669#endif
    670670
     671#if AVC_SYNTAX
     672Void TComPic::readBLSyntax( fstream* filestream, UInt numBytes )
     673{
     674  if( !filestream->good() )
     675  {
     676    return;
     677  }
     678
     679  UInt   uiWidth      = this->getPicYuvRec()->getWidth() - this->getPicYuvRec()->getPicCropLeftOffset() - this->getPicYuvRec()->getPicCropRightOffset();
     680  UInt   uiHeight     = this->getPicYuvRec()->getHeight() - this->getPicYuvRec()->getPicCropTopOffset() - this->getPicYuvRec()->getPicCropBottomOffset();
     681  UInt64 uiPOC        = (UInt64)this->getPOC();
     682  UInt   uiPartWidth  = uiWidth / 4;
     683  UInt   uiPartHeight = uiHeight / 4;
     684
     685  UInt uiNumPartInWidth    = this->getNumPartInWidth();
     686  UInt uiNumPartInHeight   = this->getNumPartInHeight();
     687  UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();
     688
     689  UInt64 uiPos = (UInt64)uiPOC * uiWidth * uiHeight * numBytes / 16;
     690   
     691  filestream->seekg( uiPos, ios_base::beg );
     692
     693  for( Int i = 0; i < this->getNumCUsInFrame(); i++ )
     694  {
     695    TComDataCU* pcCU = this->getCU( i );
     696    pcCU->initCU( this, i );
     697  }
     698
     699  for( Int i = 0; i < uiPartHeight; i++ )
     700  {
     701    for( Int j = 0; j < uiPartWidth; j++ )
     702    {
     703      UInt uiX = ( j / uiNumPartInWidth );
     704      UInt uiY = ( i / uiNumPartInHeight );
     705
     706      UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;
     707      UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );
     708      uiPartAddr = g_auiRasterToZscan[uiPartAddr];
     709     
     710      TComDataCU* pcCU = this->getCU( uiLCUAddr );
     711     
     712      TComMv mv;
     713      Short temp;
     714
     715      // RefIdxL0
     716      Char refIdxL0 = -1;
     717      filestream->read( &refIdxL0, 1 );
     718      assert( refIdxL0 >= -1 );
     719      pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, uiPartAddr );
     720
     721      // RefIdxL1
     722      Char refIdxL1 = -1;
     723      filestream->read( &refIdxL1, 1 );
     724      assert( refIdxL1 >= -1 );
     725      pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, uiPartAddr );
     726
     727      // MV L0
     728      temp = 0;
     729      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     730      mv.setHor( (Short)temp );
     731      temp = 0;
     732      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     733      mv.setVer( (Short)temp );
     734      pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, uiPartAddr );
     735
     736      // MV L1
     737      temp = 0;
     738      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     739      mv.setHor( (Short)temp );
     740      temp = 0;
     741      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     742      mv.setVer( (Short)temp );
     743      pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, uiPartAddr );
     744
     745      // set dependent information
     746      pcCU->setPredictionMode( uiPartAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER );
     747      UInt uiInterDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && pcCU->getSlice()->isInterB() ) * 2;
     748      assert( uiInterDir >= 0 && uiInterDir <= 3 );
     749      pcCU->setInterDir( uiPartAddr, uiInterDir );
     750    }
     751  }
     752}
     753#endif
     754
     755#if SYNTAX_OUTPUT
     756Void TComPic::wrireBLSyntax( fstream* filestream, UInt numBytes )
     757{
     758  if( !filestream->good() )
     759  {
     760    return;
     761  }
     762
     763  UInt   uiWidth      = this->getPicYuvRec()->getWidth() - getSlice(0)->getSPS()->getPicCropLeftOffset() - getSlice(0)->getSPS()->getPicCropRightOffset();
     764  UInt   uiHeight     = this->getPicYuvRec()->getHeight() - getSlice(0)->getSPS()->getPicCropTopOffset() - getSlice(0)->getSPS()->getPicCropBottomOffset();
     765  UInt64 uiPOC        = (UInt64)this->getPOC();
     766  UInt   uiPartWidth  = uiWidth / 4;
     767  UInt   uiPartHeight = uiHeight / 4;
     768
     769  UInt uiNumPartInWidth    = this->getNumPartInWidth();
     770  UInt uiNumPartInHeight   = this->getNumPartInHeight();
     771  UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();
     772
     773  filestream->seekg( uiPOC * uiWidth * uiHeight * numBytes / 16 );
     774   
     775  for( Int i = 0; i < uiPartHeight; i++ )
     776  {
     777    for( Int j = 0; j < uiPartWidth; j++ )
     778    {
     779      UInt uiX = ( j / uiNumPartInWidth );
     780      UInt uiY = ( i / uiNumPartInHeight );
     781
     782      UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;
     783      UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );
     784      uiPartAddr = g_auiRasterToZscan[uiPartAddr];
     785     
     786      TComDataCU* pcCU = this->getCU( uiLCUAddr );
     787     
     788      TComMv mv;
     789      Short temp;
     790      Char refIdxL0 = NOT_VALID, refIdxL1 = NOT_VALID;
     791
     792      // RefIdx
     793      if( !pcCU->isIntra( uiPartAddr ) )
     794      {
     795        refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr );
     796        refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr );
     797      }
     798      assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 );
     799      filestream->put( refIdxL0 );
     800      filestream->put( refIdxL1 );
     801
     802      // MV L0
     803      mv.setZero();
     804      if( refIdxL0 >= 0 )
     805      {
     806        mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     807      }
     808      temp = (Short)mv.getHor();
     809      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     810      temp = (Short)mv.getVer();
     811      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     812
     813      // MV L1
     814      mv.setZero();
     815      if( refIdxL1 >= 0 )
     816      {
     817        mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     818      }
     819      temp = (Short)mv.getHor();
     820      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     821      temp = (Short)mv.getVer();
     822      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     823    }
     824  }
     825}
     826#endif
     827
     828
    671829//! \}
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComPic.h

    r28 r38  
    4444#include "TComPicYuv.h"
    4545#include "TComBitStream.h"
     46#if AVC_BASE || SYNTAX_OUTPUT
     47#include <fstream>
     48#endif
     49
    4650
    4751//! \ingroup TLibCommon
     
    209213  Void  copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut);
    210214#endif
     215#if AVC_SYNTAX
     216  Void readBLSyntax( fstream* filestream, UInt numBytes );
     217#endif
     218#if SYNTAX_OUTPUT
     219  Void wrireBLSyntax( fstream* filestream, UInt numBytes );
     220#endif
     221
    211222};// END CLASS DEFINITION TComPic
    212223
     
    214225
    215226#endif // __TCOMPIC__
     227
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComPicSym.h

    r2 r38  
    125125  UInt        getNumberOfCUsInFrame()   { return m_uiNumCUsInFrame;  }
    126126  TComDataCU*&  getCU( UInt uiCUAddr )  { return m_apcTComDataCU[uiCUAddr];     }
     127
     128#if AVC_SYNTAX
     129  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
     130  UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
     131  UInt        getMaxDepth()             { return m_uhTotalDepth;               }
     132#endif
    127133 
    128134  Void        setSlice(TComSlice* p, UInt i) { m_apcTComSlice[i] = p;           }
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TypeDef.h

    r28 r38  
    4040
    4141#define SVC_EXTENSION                    1
     42
     43#define SYNTAX_BYTES                     10      ///< number of bytes taken by syntaxes per 4x4 block [RefIdxL0(1byte), RefIdxL1(1byte), MVxL0(2bytes), MVyL0(2bytes), MVxL1(2bytes), MVyL1(2bytes)]
     44
    4245#if SVC_EXTENSION
    4346#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     
    4952#define BUGFIX_925                       1      ///< bug fix ticket #925
    5053#define ENCODER_BUGFIX                   1      ///< L0167: encoder bug fix for inter mode
    51 
    5254#define CHROMA_UPSAMPLING                1      ///< L0335: Chroma upsampling with 5 bits coefficients
    5355
    54 #define AVC_BASE                         0      ///< YUV BL reading for AVC base SVC
    55 
     56#define AVC_BASE                         1      ///< YUV BL reading for AVC base SVC
    5657#define REF_IDX_FRAMEWORK                0      ///< inter-layer reference framework
     58
     59#if AVC_BASE
     60#define AVC_SYNTAX                       1      ///< Syntax reading for AVC base
     61#endif
    5762
    5863#if REF_IDX_FRAMEWORK
     
    6065#define REF_IDX_ME_ZEROMV                1      ///< L0051: use zero motion for inter-layer reference picture (without fractional ME)
    6166#define ENCODER_FAST_MODE                1      ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1.
     67#if !AVC_BASE || AVC_SYNTAX
    6268#define REF_IDX_MFM                      1      ///< L0336: motion vector mapping of inter-layer reference picture
     69#endif
    6370#else
    6471#define INTRA_BL                         1      ///< inter-layer texture prediction
     
    6976
    7077// Hooks
    71 #if !AVC_BASE
     78#if !AVC_BASE || AVC_SYNTAX
    7279#define SVC_MVP                          1      ///< motion hook for merge mode as an example
     80#if !AVC_SYNTAX
    7381#define SVC_BL_CAND_INTRA                0      ///< Intra Base Mode Prediction hook as an example
    7482#endif
     
    8088
    8189#endif
     90#endif
     91#else
     92#define SYNTAX_OUTPUT                    1
    8293#endif
    8394
Note: See TracChangeset for help on using the changeset viewer.