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


Ignore:
Timestamp:
20 Aug 2015, 20:54:17 (10 years ago)
Author:
seregin
Message:

port rev 4594

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

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/SEI.cpp

    r1442 r1460  
    150150    case SEI::CHROMA_RESAMPLING_FILTER_HINT:        return "Chroma sampling filter hint";
    151151#if Q0074_COLOUR_REMAPPING_SEI
    152     case SEI::COLOUR_REMAPPING_INFO:                return "Colour Remapping Information";
     152    case SEI::COLOUR_REMAPPING_INFO:                return "Colour remapping info";
    153153#endif
    154154#if SVC_EXTENSION
     
    196196}
    197197#endif
    198 
    199 #if Q0074_COLOUR_REMAPPING_SEI
    200 Void  SEIColourRemappingInfo::copyFrom( SEIColourRemappingInfo const * SeiCriInput)
    201 {
    202   m_colourRemapId                         = SeiCriInput->m_colourRemapId;
    203   m_colourRemapCancelFlag                 = SeiCriInput->m_colourRemapCancelFlag;
    204   m_colourRemapPersistenceFlag            = SeiCriInput->m_colourRemapPersistenceFlag;
    205   m_colourRemapVideoSignalInfoPresentFlag = SeiCriInput->m_colourRemapVideoSignalInfoPresentFlag;
    206   m_colourRemapFullRangeFlag              = SeiCriInput->m_colourRemapFullRangeFlag;
    207   m_colourRemapPrimaries                  = SeiCriInput->m_colourRemapPrimaries;
    208   m_colourRemapTransferFunction           = SeiCriInput->m_colourRemapTransferFunction;
    209   m_colourRemapMatrixCoefficients         = SeiCriInput->m_colourRemapMatrixCoefficients;
    210   m_colourRemapInputBitDepth              = SeiCriInput->m_colourRemapInputBitDepth;
    211   m_colourRemapBitDepth                   = SeiCriInput->m_colourRemapBitDepth;
    212 
    213   for( Int c=0 ; c<3 ; c++ )
    214   {
    215     m_preLutNumValMinus1[c] = SeiCriInput->m_preLutNumValMinus1[c];
    216     m_preLutCodedValue[c].resize(m_preLutNumValMinus1[c]+1);
    217     m_preLutTargetValue[c].resize(m_preLutNumValMinus1[c]+1);
    218     for ( Int i=0 ; i <= SeiCriInput->m_preLutNumValMinus1[c] ; i++ )
    219     {
    220         m_preLutCodedValue[c][i]   = SeiCriInput->m_preLutCodedValue[c][i];
    221         m_preLutTargetValue[c][i]  = SeiCriInput->m_preLutTargetValue[c][i];
    222     }
    223   }
    224    
    225   m_colourRemapMatrixPresentFlag  = SeiCriInput->m_colourRemapMatrixPresentFlag;
    226   m_log2MatrixDenom               = SeiCriInput->m_log2MatrixDenom;
    227 
    228   for ( Int c=0 ; c<3 ; c++ )
    229     for ( Int i=0 ; i<3 ; i++ )
    230       m_colourRemapCoeffs[c][i] = SeiCriInput->m_colourRemapCoeffs[c][i];
    231 
    232   for( Int c=0 ; c<3 ; c++ )
    233   {
    234     m_postLutNumValMinus1[c] = SeiCriInput->m_postLutNumValMinus1[c];
    235     m_postLutCodedValue[c].resize(m_postLutNumValMinus1[c]+1);
    236     m_postLutTargetValue[c].resize(m_postLutNumValMinus1[c]+1);
    237     for ( Int i=0 ; i <= m_postLutNumValMinus1[c] ; i++ )
    238     {
    239         m_postLutCodedValue[c][i]  = SeiCriInput->m_postLutCodedValue[c][i];
    240         m_postLutTargetValue[c][i] = SeiCriInput->m_postLutTargetValue[c][i];
    241     }
    242   }
    243 }
    244 #endif
  • branches/SHM-dev/source/Lib/TLibCommon/SEI.h

    r1459 r1460  
    459459};
    460460
     461#if Q0074_COLOUR_REMAPPING_SEI
     462class SEIColourRemappingInfo : public SEI
     463{
     464public:
     465
     466  struct CRIlut
     467  {
     468    Int codedValue;
     469    Int targetValue;
     470    bool operator < (const CRIlut& a) const
     471    {
     472      return codedValue < a.codedValue;
     473    }
     474  };
     475
     476  PayloadType payloadType() const { return COLOUR_REMAPPING_INFO; }
     477  SEIColourRemappingInfo() {}
     478  ~SEIColourRemappingInfo() {}
     479
     480  Void copyFrom( const SEIColourRemappingInfo &seiCriInput)
     481  {
     482    (*this) = seiCriInput;
     483  }
     484
     485  UInt                m_colourRemapId;
     486  Bool                m_colourRemapCancelFlag;
     487  Bool                m_colourRemapPersistenceFlag;
     488  Bool                m_colourRemapVideoSignalInfoPresentFlag;
     489  Bool                m_colourRemapFullRangeFlag;
     490  Int                 m_colourRemapPrimaries;
     491  Int                 m_colourRemapTransferFunction;
     492  Int                 m_colourRemapMatrixCoefficients;
     493  Int                 m_colourRemapInputBitDepth;
     494  Int                 m_colourRemapBitDepth;
     495  Int                 m_preLutNumValMinus1[3];
     496  std::vector<CRIlut> m_preLut[3];
     497  Bool                m_colourRemapMatrixPresentFlag;
     498  Int                 m_log2MatrixDenom;
     499  Int                 m_colourRemapCoeffs[3][3];
     500  Int                 m_postLutNumValMinus1[3];
     501  std::vector<CRIlut> m_postLut[3];
     502};
     503#endif
     504
    461505class SEIChromaResamplingFilterHint : public SEI
    462506{
     
    673717#endif
    674718
    675 #if Q0074_COLOUR_REMAPPING_SEI
    676 struct TComSEIColourRemappingInfo
    677 {
    678   std::string             m_colourRemapSEIFile;
    679   Int                     m_colourRemapSEIId;
    680   Bool                    m_colourRemapSEICancelFlag;
    681   Bool                    m_colourRemapSEIPersistenceFlag;
    682   Bool                    m_colourRemapSEIVideoSignalInfoPresentFlag;
    683   Bool                    m_colourRemapSEIFullRangeFlag;
    684   Int                     m_colourRemapSEIPrimaries;
    685   Int                     m_colourRemapSEITransferFunction;
    686   Int                     m_colourRemapSEIMatrixCoefficients;
    687   Int                     m_colourRemapSEIInputBitDepth;
    688   Int                     m_colourRemapSEIBitDepth;
    689   Int                     m_colourRemapSEIPreLutNumValMinus1[3];
    690   Int*                    m_colourRemapSEIPreLutCodedValue[3];
    691   Int*                    m_colourRemapSEIPreLutTargetValue[3];
    692   Bool                    m_colourRemapSEIMatrixPresentFlag;
    693   Int                     m_colourRemapSEILog2MatrixDenom;
    694   Int                     m_colourRemapSEICoeffs[3][3];
    695   Int                     m_colourRemapSEIPostLutNumValMinus1[3];
    696   Int*                    m_colourRemapSEIPostLutCodedValue[3];
    697   Int*                    m_colourRemapSEIPostLutTargetValue[3];
    698 };
    699 
    700 class SEIColourRemappingInfo : public SEI
    701 {
    702 public:
    703   PayloadType payloadType() const { return COLOUR_REMAPPING_INFO; }
    704   SEIColourRemappingInfo() {}
    705   ~SEIColourRemappingInfo() {}
    706 
    707   Void  copyFrom( SEIColourRemappingInfo const * SeiCriInput);
    708  
    709   Int   m_colourRemapId;
    710   Bool  m_colourRemapCancelFlag;
    711   Bool  m_colourRemapPersistenceFlag;
    712   Bool  m_colourRemapVideoSignalInfoPresentFlag;
    713   Bool  m_colourRemapFullRangeFlag;
    714   Int   m_colourRemapPrimaries;
    715   Int   m_colourRemapTransferFunction;
    716   Int   m_colourRemapMatrixCoefficients;
    717   Int   m_colourRemapInputBitDepth;
    718   Int   m_colourRemapBitDepth;
    719   Int   m_preLutNumValMinus1[3];
    720   std::vector<Int> m_preLutCodedValue[3];
    721   std::vector<Int> m_preLutTargetValue[3];
    722   Bool  m_colourRemapMatrixPresentFlag;
    723   Int   m_log2MatrixDenom;
    724   Int   m_colourRemapCoeffs[3][3];
    725   Int   m_postLutNumValMinus1[3];
    726   std::vector<Int> m_postLutCodedValue[3];
    727   std::vector<Int> m_postLutTargetValue[3];
    728 };
    729 #endif
    730 
    731719#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    732720class SEIInterLayerConstrainedTileSets : public SEI
  • branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.cpp

    r1442 r1460  
    296296
    297297// NOTE: This function is never called, but may be useful for developers.
    298 Void TComPicYuv::dump (const std::string &fileName, const BitDepths &bitDepths, Bool bAdd) const
    299 {
    300   FILE* pFile = fopen (fileName.c_str(), bAdd?"ab":"wb");
     298Void TComPicYuv::dump (const std::string &fileName, const BitDepths &bitDepths, const Bool bAppend, const Bool bForceTo8Bit) const
     299{
     300  FILE *pFile = fopen (fileName.c_str(), bAppend?"ab":"wb");
     301
     302  Bool is16bit=false;
     303  for(Int comp = 0; comp < getNumberValidComponents() && !bForceTo8Bit; comp++)
     304  {
     305    if (bitDepths.recon[toChannelType(ComponentID(comp))]>8)
     306    {
     307      is16bit=true;
     308    }
     309  }
    301310
    302311  for(Int comp = 0; comp < getNumberValidComponents(); comp++)
    303312  {
    304313    const ComponentID  compId = ComponentID(comp);
    305     const Int          shift  = bitDepths.recon[toChannelType(compId)] - 8;
    306     const Int          offset = (shift>0)?(1<<(shift-1)):0;
    307314    const Pel         *pi     = getAddr(compId);
    308315    const Int          stride = getStride(compId);
     
    310317    const Int          width  = getWidth(compId);
    311318
    312     for (Int y = 0; y < height; y++ )
    313     {
    314       for (Int x = 0; x < width; x++ )
    315       {
    316         UChar uc = (UChar)Clip3<Pel>(0, 255, (pi[x]+offset)>>shift);
    317         fwrite( &uc, sizeof(UChar), 1, pFile );
    318       }
    319       pi += stride;
    320     }
    321   }
    322 
    323   fclose(pFile);
    324 }
    325 
    326 Void TComPicYuv::dump( const std::string &fileName, const Bool bAdd, const Int bitDepth )
    327 {
    328   FILE* pFile = fopen (fileName.c_str(), bAdd?"ab":"wb");
    329 
    330   if( bitDepth == 8 )
    331   {
    332     dump( fileName, bitDepth, bAdd );
    333     return;
    334   }
    335 
    336   for(Int chan = 0; chan < getNumberValidComponents(); chan++)
    337   {
    338     const ComponentID  ch     = ComponentID(chan);
    339     const Pel         *pi     = getAddr(ch);
    340     const Int          stride = getStride(ch);
    341     const Int          height = getHeight(ch);
    342     const Int          width  = getWidth(ch);
    343 
    344     for (Int y = 0; y < height; y++ )
    345     {
    346       for (Int x = 0; x < width; x++ )
    347       {
    348         Pel pix = pi[x];
    349 
    350         UChar uc = pix & 0xff;     
    351         fwrite( &uc, sizeof(UChar), 1, pFile );
    352         uc = (pix >> 8) & 0xff;     
    353         fwrite( &uc, sizeof(UChar), 1, pFile );
    354       }
    355       pi += stride;
    356     }
    357   }
    358  
     319    if (is16bit)
     320    {
     321      for (Int y = 0; y < height; y++ )
     322      {
     323        for (Int x = 0; x < width; x++ )
     324        {
     325          UChar uc = (UChar)((pi[x]>>0) & 0xff);
     326          fwrite( &uc, sizeof(UChar), 1, pFile );
     327          uc = (UChar)((pi[x]>>8) & 0xff);
     328          fwrite( &uc, sizeof(UChar), 1, pFile );
     329        }
     330        pi += stride;
     331      }
     332    }
     333    else
     334    {
     335      const Int shift  = bitDepths.recon[toChannelType(compId)] - 8;
     336      const Int offset = (shift>0)?(1<<(shift-1)):0;
     337      for (Int y = 0; y < height; y++ )
     338      {
     339        for (Int x = 0; x < width; x++ )
     340        {
     341          UChar uc = (UChar)Clip3<Pel>(0, 255, (pi[x]+offset)>>shift);
     342          fwrite( &uc, sizeof(UChar), 1, pFile );
     343        }
     344        pi += stride;
     345      }
     346    }
     347  }
     348
    359349  fclose(pFile);
    360350}
  • branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.h

    r1442 r1460  
    180180
    181181  //  Dump picture
    182   Void          dump              (const std::string &fileName, const BitDepths &bitDepths, Bool bAdd = false) const ;
     182  Void          dump              (const std::string &fileName, const BitDepths &bitDepths, const Bool bAppend=false, const Bool bForceTo8Bit=false) const ;
    183183
    184184  // Set border extension flag
     
    196196#endif
    197197
    198   Void          dump( const std::string &fileName, const Bool bAdd, const Int bitDepth );
    199 
    200198};// END CLASS DEFINITION TComPicYuv
    201199
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r1459 r1460  
    127127
    128128#endif // SVC_EXTENSION
    129 #define Q0074_COLOUR_REMAPPING_SEI       1      ///< JCTVC-Q0074, JCTVC-R0344: SEI Colour Remapping Information
    130129
    131130//! \ingroup TLibCommon
     
    166165#define T0196_SELECTIVE_RDOQ                              1 ///< selective RDOQ
    167166#define U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 1
     167#define Q0074_COLOUR_REMAPPING_SEI                        1      ///< JCTVC-Q0074, JCTVC-R0344: SEI Colour Remapping Information
    168168
    169169// ====================================================================================================================
     
    377377  NUMBER_INPUT_COLOUR_SPACE_CONVERSIONS = 4
    378378};
     379
     380#if Q0074_COLOUR_REMAPPING_SEI
     381enum MATRIX_COEFFICIENTS // Table E.5 (Matrix coefficients)
     382{
     383  MATRIX_COEFFICIENTS_RGB                           = 0,
     384  MATRIX_COEFFICIENTS_BT709                         = 1,
     385  MATRIX_COEFFICIENTS_UNSPECIFIED                   = 2,
     386  MATRIX_COEFFICIENTS_RESERVED_BY_ITUISOIEC         = 3,
     387  MATRIX_COEFFICIENTS_USFCCT47                      = 4,
     388  MATRIX_COEFFICIENTS_BT601_625                     = 5,
     389  MATRIX_COEFFICIENTS_BT601_525                     = 6,
     390  MATRIX_COEFFICIENTS_SMPTE240                      = 7,
     391  MATRIX_COEFFICIENTS_YCGCO                         = 8,
     392  MATRIX_COEFFICIENTS_BT2020_NON_CONSTANT_LUMINANCE = 9,
     393  MATRIX_COEFFICIENTS_BT2020_CONSTANT_LUMINANCE     = 10,
     394};
     395#endif
    379396
    380397enum DeblockEdgeDir
Note: See TracChangeset for help on using the changeset viewer.