Changeset 1037 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
27 Feb 2015, 21:05:56 (10 years ago)
Author:
seregin
Message:

implementation of alpha channel SEI (JCTVC-P0123) with macro P0123_ALPHA_CHANNEL_SEI, patch was provided by Matteo Naccari <Matteo.Naccari@…>

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

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r1029 r1037  
    209209     break;
    210210#endif
     211#if P0123_ALPHA_CHANNEL_SEI
     212   case SEI::ALPHA_CHANNEL_INFO:
     213     xWriteSEIAlphaChannelInfo(*static_cast<const SEIAlphaChannelInfo*>(&sei));
     214     break;
     215#endif
    211216#if Q0096_OVERLAY_SEI
    212217   case SEI::OVERLAY_INFO:
     
    14171422#endif
    14181423
     1424#if P0123_ALPHA_CHANNEL_SEI
     1425Void SEIWriter::xWriteSEIAlphaChannelInfo(const SEIAlphaChannelInfo &sei)
     1426{
     1427  WRITE_FLAG(sei.m_alphaChannelCancelFlag, "alpha_channel_cancel_flag");
     1428  if(!sei.m_alphaChannelCancelFlag)
     1429  {
     1430    WRITE_CODE(sei.m_alphaChannelUseIdc, 3, "alpha_channel_use_idc");
     1431    WRITE_CODE(sei.m_alphaChannelBitDepthMinus8, 3, "alpha_channel_bit_depth_minus8");
     1432    WRITE_CODE(sei.m_alphaTransparentValue, sei.m_alphaChannelBitDepthMinus8 + 9, "alpha_transparent_value");
     1433    WRITE_CODE(sei.m_alphaOpaqueValue, sei.m_alphaChannelBitDepthMinus8 + 9, "alpha_opaque_value");
     1434    WRITE_FLAG(sei.m_alphaChannelIncrFlag, "alpha_channel_incr_flag");
     1435    WRITE_FLAG(sei.m_alphaChannelClipFlag, "alpha_channel_clip_flag");
     1436    if(sei.m_alphaChannelClipFlag)
     1437    {
     1438      WRITE_FLAG(sei.m_alphaChannelClipTypeFlag, "alpha_channel_clip_type_flag");
     1439    }
     1440  }
     1441  xWriteByteAlign();
     1442}
     1443#endif
     1444
    14191445#if Q0096_OVERLAY_SEI
    14201446Void SEIWriter::xWriteSEIOverlayInfo(const SEIOverlayInfo &sei)
  • branches/SHM-dev/source/Lib/TLibEncoder/SEIwrite.h

    r1029 r1037  
    131131  Void xWriteSEIVPSRewriting(const SEIVPSRewriting &sei);
    132132#endif
     133#if P0123_ALPHA_CHANNEL_SEI
     134  Void xWriteSEIAlphaChannelInfo(const SEIAlphaChannelInfo &sei);
     135#endif
    133136#if Q0096_OVERLAY_SEI
    134137  Void xWriteSEIOverlayInfo(const SEIOverlayInfo &sei);
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r1029 r1037  
    415415#endif
    416416#if Q0048_CGS_3D_ASYMLUT
    417   Int  m_nCGSFlag;
    418   Int  m_nCGSMaxOctantDepth;
    419   Int  m_nCGSMaxYPartNumLog2;
    420   Int  m_nCGSLUTBit;
     417  Int       m_nCGSFlag;
     418  Int       m_nCGSMaxOctantDepth;
     419  Int       m_nCGSMaxYPartNumLog2;
     420  Int       m_nCGSLUTBit;
    421421#if R0151_CGS_3D_ASYMLUT_IMPROVE
    422   Int  m_nCGSAdaptiveChroma;
     422  Int       m_nCGSAdaptiveChroma;
    423423#endif
    424424#if R0179_ENC_OPT_3DLUT_SIZE
    425   Int  m_nCGSLutSizeRDO;
    426 #endif
     425  Int       m_nCGSLutSizeRDO;
     426#endif
     427#endif
     428#if P0123_ALPHA_CHANNEL_SEI
     429  Bool      m_alphaSEIEnabled;
     430  Bool      m_alphaCancelFlag;
     431  Int       m_alphaUseIdc;
     432  Int       m_alphaBitDepthMinus8;
     433  Int       m_alphaTransparentValue;
     434  Int       m_alphaOpaqueValue;
     435  Bool      m_alphaIncrementFlag;
     436  Int       m_alphaClipFlag;
     437  Int       m_alphaClipTypeFlag;
    427438#endif
    428439#if Q0096_OVERLAY_SEI
     
    9941005
    9951006#if Q0189_TMVP_CONSTRAINTS
    996   Void  setTMVPConstraintsSEIEnabled(Int b)                { m_TMVPConstraintsSEIEnabled = b; }
    997   Int   getTMVPConstraintsSEIEnabled()                {  return m_TMVPConstraintsSEIEnabled; }
    998 
     1007  Void  setTMVPConstraintsSEIEnabled(Int b)                  { m_TMVPConstraintsSEIEnabled = b; }
     1008  Int   getTMVPConstraintsSEIEnabled()                       {  return m_TMVPConstraintsSEIEnabled; }
     1009
     1010#endif
     1011#if P0123_ALPHA_CHANNEL_SEI
     1012  Void  setAlphaSEIEnabled(Bool b)                           { m_alphaSEIEnabled       = b; }
     1013  Bool  getAlphaSEIEnabled()                                 { return m_alphaSEIEnabled; }
     1014  Void  setAlphaCancelFlag(Bool b)                           { m_alphaCancelFlag       = b; }
     1015  Bool  getAlphaCancelFlag()                                 { return m_alphaCancelFlag; }
     1016  Void  setAlphaUseIdc(Int idc)                              { m_alphaUseIdc           = idc; }
     1017  Int   getAlphaUseIdc()                                     { return m_alphaUseIdc; }
     1018  Void  setAlphaBitDepthMinus8(Int d)                        { m_alphaBitDepthMinus8   = d; }
     1019  Int   getAlphaBitDepthMinus8()                             { return m_alphaBitDepthMinus8; }
     1020  Void  setAlphaTransparentValue(Int v)                      { m_alphaTransparentValue = v; }
     1021  Int   getAlphaTransparentValue()                           { return m_alphaTransparentValue; }
     1022  Void  setAlphaOpaqueValue(Int v)                           { m_alphaOpaqueValue      = v; }
     1023  Int   getAlphaOpaqueValue()                                { return m_alphaOpaqueValue; }
     1024  Void  setAlphaIncrementFlag(Bool b)                        { m_alphaIncrementFlag    = b; }
     1025  Int   getAlphaIncrementFlag()                              { return m_alphaIncrementFlag; }
     1026  Void  setAlphaClipFlag(Bool b)                             { m_alphaClipFlag         = b; }
     1027  Bool  getAlphaClipFlag()                                   { return m_alphaClipFlag; }
     1028  Void  setAlphaClipTypeFlag(Bool b)                         { m_alphaClipTypeFlag     = b; }
     1029  Bool  getAlphaClipTypeFlag()                               { return m_alphaClipTypeFlag; }
    9991030#endif
    10001031#if Q0074_COLOUR_REMAPPING_SEI
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1035 r1037  
    684684#else
    685685    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     686#endif
     687    writeRBSPTrailingBits(nalu.m_Bitstream);
     688    accessUnit.push_back(new NALUnitEBSP(nalu));
     689    delete sei;
     690  }
     691#endif
     692
     693#if P0123_ALPHA_CHANNEL_SEI
     694  if( m_pcCfg->getAlphaSEIEnabled() && m_pcEncTop->getVPS()->getScalabilityId(m_layerId, AUX_ID) && m_pcEncTop->getVPS()->getDimensionId(m_layerId, m_pcEncTop->getVPS()->getNumScalabilityTypes() - 1) == AUX_ALPHA )
     695  {
     696    SEIAlphaChannelInfo *sei = xCreateSEIAlphaChannelInfo();
     697    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     698#if O0164_MULTI_LAYER_HRD
     699    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     700#else
     701    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
    686702#endif
    687703    writeRBSPTrailingBits(nalu.m_Bitstream);
     
    43644380}
    43654381
     4382#if P0123_ALPHA_CHANNEL_SEI
     4383SEIAlphaChannelInfo* TEncGOP::xCreateSEIAlphaChannelInfo()
     4384{
     4385  SEIAlphaChannelInfo *sei = new SEIAlphaChannelInfo();
     4386  sei->m_alphaChannelCancelFlag = m_pcCfg->getAlphaCancelFlag();
     4387  if(!sei->m_alphaChannelCancelFlag)
     4388  {
     4389    sei->m_alphaChannelUseIdc = m_pcCfg->getAlphaUseIdc();
     4390    sei->m_alphaChannelBitDepthMinus8 = m_pcCfg->getAlphaBitDepthMinus8();
     4391    sei->m_alphaTransparentValue = m_pcCfg->getAlphaTransparentValue();
     4392    sei->m_alphaOpaqueValue = m_pcCfg->getAlphaOpaqueValue();
     4393    sei->m_alphaChannelIncrFlag = m_pcCfg->getAlphaIncrementFlag();
     4394    sei->m_alphaChannelClipFlag = m_pcCfg->getAlphaClipFlag();
     4395    sei->m_alphaChannelClipTypeFlag = m_pcCfg->getAlphaClipTypeFlag();
     4396  }
     4397  return sei;
     4398}
     4399#endif
    43664400#if Q0096_OVERLAY_SEI
    43674401SEIOverlayInfo* TEncGOP::xCreateSEIOverlayInfo()
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h

    r1029 r1037  
    262262#endif
    263263#endif
     264#if P0123_ALPHA_CHANNEL_SEI
     265  SEIAlphaChannelInfo* xCreateSEIAlphaChannelInfo();
     266#endif
    264267#if Q0096_OVERLAY_SEI
    265268  SEIOverlayInfo* xCreateSEIOverlayInfo();
Note: See TracChangeset for help on using the changeset viewer.