Changeset 1037 in SHVCSoftware


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
Files:
13 edited

Legend:

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

    r1030 r1037  
    16881688  ("SEIMasteringDisplayWhitePoint",                   cfg_DisplayWhitePointCode,     cfg_DisplayWhitePointCode, "Mastering display white point CIE xy coordinates in normalised increments of 1/50000 (e.g. 0.333 = 16667)")
    16891689   
     1690#if P0123_ALPHA_CHANNEL_SEI
     1691  ("SEIAlphaChannelInfo",                     m_alphaSEIEnabled,                        false, "Enables transmission of information associated with alpha channel (default : 0)")
     1692  ("SEIAlphaCancelFlag",                      m_alphaCancelFlag,                         true, "Denotes that this SEI message cancels the persistence of any previously received alpha channel SEI message (default : 1)")
     1693  ("SEIAlphaUseIdc",                          m_alphaUseIdc,                                2, "Denotes the use of the received alpha channel in final picture composition (e.g. pre-multiplied alpha, default : 2)")
     1694  ("SEIAlphaBitDepthMinus8",                  m_alphaBitDepthMinus8,                        0, "Denotes the bit depth associated with the received alpha channel (default : 0)")
     1695  ("SEIAlphaTransparentValue",                m_alphaTransparentValue,                      0, "Denotes the sample value which is considered transparent for alpha blending purposes (default : 0)")
     1696  ("SEIAlphaOpaqueValue",                     m_alphaOpaqueValue,                         255, "Denotes the sample value which is considered opaque for alpha blending purposes (default : 255)")
     1697  ("SEIAlphaIncrementFlag",                   m_alphaIncrementFlag,                     false, "Denotes whether the sample values should be incremented by one for the purposes of alpha blending (default : 0)")
     1698  ("SEIAlphaClipFlag",                        m_alphaClipFlag,                          false, "Denotes whether clipping is applied to the sample values (default : 0)")
     1699  ("SEIAlphaClipType",                        m_alphaClipTypeFlag,                      false, "Denotes the type of clipping applied to the sample values (0 = binary, 1 = linear, default : 0)")
     1700#endif
    16901701#if Q0096_OVERLAY_SEI
    16911702  ("SEIOverlayInfo",                          m_overlaySEIEnabled,                      false, "Control generation of Selectable Overlays SEI messages")
     
    44734484  }
    44744485
     4486#if P0123_ALPHA_CHANNEL_SEI
     4487  if( m_alphaSEIEnabled && !m_alphaCancelFlag )
     4488  {
     4489    xConfirmPara(0 < m_alphaUseIdc || m_alphaUseIdc > 2, "SEIAlphaUseIdc greater than 2 is reserved for future use by ITU-T | ISO/IEC");
     4490    xConfirmPara(m_alphaBitDepthMinus8 < 0 || m_alphaBitDepthMinus8 > 7, "SEIAlphaBitDepthMinus8 shall be in the range 0 to 7 inclusive");
     4491  }
     4492#endif
    44754493#if Q0096_OVERLAY_SEI
    44764494  if( m_overlaySEIEnabled && !m_overlayInfoCancelFlag )
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r1029 r1037  
    436436  Int       m_layersNotPresentSEIEnabled;
    437437#endif
    438 
     438#if P0123_ALPHA_CHANNEL_SEI
     439  Bool      m_alphaSEIEnabled;
     440  Bool      m_alphaCancelFlag;
     441  Int       m_alphaUseIdc;
     442  Int       m_alphaBitDepthMinus8;
     443  Int       m_alphaTransparentValue;
     444  Int       m_alphaOpaqueValue;
     445  Bool      m_alphaIncrementFlag;
     446  Bool      m_alphaClipFlag;
     447  Bool      m_alphaClipTypeFlag;
     448#endif
    439449#if SVC_EXTENSION
    440450#if FAST_INTRA_SHVC
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r1031 r1037  
    612612    m_acTEncTop[layer].setKneeSEIOutputKneePoint                            ( m_kneeSEIOutputKneePoint );
    613613    m_acTEncTop[layer].setMasteringDisplaySEI                               ( m_masteringDisplay );
     614#if P0123_ALPHA_CHANNEL_SEI
     615    m_acTEncTop[layer].setAlphaSEIEnabled                                   ( m_alphaSEIEnabled );
     616    m_acTEncTop[layer].setAlphaCancelFlag                                   ( m_alphaCancelFlag );
     617    m_acTEncTop[layer].setAlphaUseIdc                                       ( m_alphaUseIdc );
     618    m_acTEncTop[layer].setAlphaBitDepthMinus8                               ( m_alphaBitDepthMinus8 );
     619    m_acTEncTop[layer].setAlphaTransparentValue                             ( m_alphaTransparentValue );
     620    m_acTEncTop[layer].setAlphaOpaqueValue                                  ( m_alphaOpaqueValue );
     621    m_acTEncTop[layer].setAlphaIncrementFlag                                ( m_alphaIncrementFlag );
     622    m_acTEncTop[layer].setAlphaClipFlag                                     ( m_alphaClipFlag );
     623    m_acTEncTop[layer].setAlphaClipTypeFlag                                 ( m_alphaClipTypeFlag );
     624#endif
    614625#if Q0096_OVERLAY_SEI
    615626    m_acTEncTop[layer].setOverlaySEIEnabled                                 ( m_overlaySEIEnabled );
  • branches/SHM-dev/source/Lib/TLibCommon/SEI.cpp

    r1029 r1037  
    162162    case SEI::OVERLAY_INFO:                         return "Overlay Information";
    163163#endif
     164#if P0123_ALPHA_CHANNEL_SEI
     165    case SEI::ALPHA_CHANNEL_INFO:                   return "Alpha Channel Information";
     166#endif
    164167#endif
    165168    default:                                        return "Unknown";
  • branches/SHM-dev/source/Lib/TLibCommon/SEI.h

    r1029 r1037  
    121121#endif
    122122#if Q0096_OVERLAY_SEI
    123     OVERLAY_INFO                         = 153,   
     123    OVERLAY_INFO                         = 153,
     124#endif
     125#if P0123_ALPHA_CHANNEL_SEI
     126    ALPHA_CHANNEL_INFO                   = 165,
    124127#endif
    125128  };
     
    670673#endif
    671674
     675#if P0123_ALPHA_CHANNEL_SEI
     676class SEIAlphaChannelInfo : public SEI
     677{
     678public:
     679  PayloadType payloadType() const { return ALPHA_CHANNEL_INFO; }
     680  SEIAlphaChannelInfo() {}
     681  virtual ~SEIAlphaChannelInfo() {}
     682  Bool m_alphaChannelCancelFlag;
     683  UInt m_alphaChannelUseIdc;
     684  UInt m_alphaChannelBitDepthMinus8;
     685  UInt m_alphaTransparentValue;
     686  UInt m_alphaOpaqueValue;
     687  Bool m_alphaChannelIncrFlag;
     688  Bool m_alphaChannelClipFlag;
     689  Bool m_alphaChannelClipTypeFlag;
     690};
     691#endif
     692
    672693#if Q0096_OVERLAY_SEI
    673694class SEIOverlayInfo : public SEI
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r1031 r1037  
    341341# define MAX_OVERLAY_STRING_BYTES        256
    342342#endif
     343#define P0123_ALPHA_CHANNEL_SEI          1      ///< JCTVC-P0123: SEI message for alpha channel information
    343344
    344345#endif // SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibDecoder/SEIread.cpp

    r1029 r1037  
    383383     break;
    384384#endif
     385#if P0123_ALPHA_CHANNEL_SEI
     386   case SEI::ALPHA_CHANNEL_INFO:
     387     sei = new SEIAlphaChannelInfo;
     388     xParseSEIAlphaChannelInfo((SEIAlphaChannelInfo &) *sei, payloadSize, pDecodedMessageOutputStream);
     389     break;
     390#endif
    385391#if Q0096_OVERLAY_SEI
    386392   case SEI::OVERLAY_INFO:
     
    390396#endif
    391397#endif //SVC_EXTENSION
    392       break;
    393     default:
    394       for (UInt i = 0; i < payloadSize; i++)
    395       {
    396         UInt seiByte;
    397         sei_read_code (NULL, 8, seiByte, "unknown prefix SEI payload byte");
    398       }
    399       printf ("Unknown prefix SEI message (payloadType = %d) was found!\n", payloadType);
    400       if (pDecodedMessageOutputStream)
    401       {
    402         (*pDecodedMessageOutputStream) << "Unknown prefix SEI message (payloadType = " << payloadType << ") was found!\n";
    403       }
    404       break;
     398   default:
     399     for (UInt i = 0; i < payloadSize; i++)
     400     {
     401       UInt seiByte;
     402       sei_read_code (NULL, 8, seiByte, "unknown prefix SEI payload byte");
     403     }
     404     printf ("Unknown prefix SEI message (payloadType = %d) was found!\n", payloadType);
     405     if (pDecodedMessageOutputStream)
     406     {
     407       (*pDecodedMessageOutputStream) << "Unknown prefix SEI message (payloadType = " << payloadType << ") was found!\n";
     408     }
     409     break;
    405410    }
    406411  }
     
    18741879}
    18751880
     1881#endif
     1882
     1883#if P0123_ALPHA_CHANNEL_SEI
     1884void SEIReader::xParseSEIAlphaChannelInfo(SEIAlphaChannelInfo &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
     1885{
     1886  UInt value;
     1887  sei_read_flag(pDecodedMessageOutputStream, value, "alpha_channel_cancel_flag"); sei.m_alphaChannelCancelFlag = value;
     1888  if(!sei.m_alphaChannelCancelFlag)
     1889  {
     1890    sei_read_code(pDecodedMessageOutputStream, 3, value, "alpha_channel_use_idc");          sei.m_alphaChannelUseIdc = value;
     1891    sei_read_code(pDecodedMessageOutputStream, 3, value, "alpha_channel_bit_depth_minus8"); sei.m_alphaChannelBitDepthMinus8 = value;
     1892    sei_read_code(pDecodedMessageOutputStream, sei.m_alphaChannelBitDepthMinus8 + 9, value, "alpha_transparent_value"); sei.m_alphaTransparentValue = value;
     1893    sei_read_code(pDecodedMessageOutputStream, sei.m_alphaChannelBitDepthMinus8 + 9, value, "alpha_opaque_value"); sei.m_alphaOpaqueValue = value;
     1894    sei_read_flag(pDecodedMessageOutputStream, value, "alpha_channel_incr_flag");        sei.m_alphaChannelIncrFlag = value;
     1895    sei_read_flag(pDecodedMessageOutputStream, value, "alpha_channel_clip_flag");        sei.m_alphaChannelClipFlag = value;
     1896    if(sei.m_alphaChannelClipFlag)
     1897    {
     1898      sei_read_flag(pDecodedMessageOutputStream, value, "alpha_channel_clip_type_flag"); sei.m_alphaChannelClipTypeFlag = value;
     1899    }
     1900  } 
     1901}
    18761902#endif
    18771903
  • branches/SHM-dev/source/Lib/TLibDecoder/SEIread.h

    r1029 r1037  
    154154  Void xParseSEIFrameFieldInfo                (SEIFrameFieldInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
    155155#endif
     156#if P0123_ALPHA_CHANNEL_SEI
     157  Void xParseSEIAlphaChannelInfo              (SEIAlphaChannelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
     158#endif
    156159#if Q0096_OVERLAY_SEI
    157160  Void xParseSEIOverlayInfo                   (SEIOverlayInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream);
  • 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.