Changeset 475 in SHVCSoftware for branches/SHM-4.0-dev/source/App


Ignore:
Timestamp:
15 Nov 2013, 14:55:37 (11 years ago)
Author:
nokia
Message:

Integrate auxiliary picture layers (JCTVC-O0041)

Location:
branches/SHM-4.0-dev/source/App/TAppEncoder
Files:
5 edited

Legend:

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

    r471 r475  
    224224}
    225225
     226#if AUXILIARY_PICTURES
     227static inline ChromaFormat numberToChromaFormat(const Int val)
     228{
     229  switch (val)
     230  {
     231    case 400: return CHROMA_400; break;
     232    case 420: return CHROMA_420; break;
     233    case 422: return CHROMA_422; break;
     234    case 444: return CHROMA_444; break;
     235    default:  return NUM_CHROMA_FORMAT;
     236  }
     237}
     238#endif
     239
    226240#if SVC_EXTENSION
    227241void TAppEncCfg::getDirFilename(string& filename, string& dir, const string path)
     
    363377  UInt*      cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS];
    364378#endif
     379#if AUXILIARY_PICTURES
     380  Int      cfg_tmpChromaFormatIDC  [MAX_LAYERS];
     381  Int      cfg_tmpInputChromaFormat[MAX_LAYERS];
     382  Int*     cfg_auxId               [MAX_LAYERS];
     383#endif
    365384#if VPS_EXTN_DIRECT_REF_LAYERS
    366385#if M0457_PREDICTION_INDICATIONS
     
    477496    cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
    478497#endif
     498#if AUXILIARY_PICTURES
     499    cfg_auxId[layer]                = &m_acLayerCfg[layer].m_auxId;
     500#endif
    479501  }
    480502#if AVC_BASE
     
    533555#endif
    534556  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
     557#if AUXILIARY_PICTURES
     558  ("InputChromaFormat%d",     cfg_tmpInputChromaFormat,  420, MAX_LAYERS, "InputChromaFormatIDC for layer %d")
     559  ("ChromaFormatIDC%d,-cf",   cfg_tmpChromaFormatIDC,    420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d")
     560  ("AuxId%d",                 cfg_auxId,                 0,   MAX_LAYERS, "Auxilary picture ID for layer %d (0: Not aux pic, 1: Alpha plane, 2: Depth picture, 3: Cb enh, 4: Cr enh")
     561#endif
    535562  ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    536563#if SCALABILITY_MASK_E0104
    537564  ("ScalabilityMask1",        m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)")
    538565  ("ScalabilityMask2",        m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" )
     566#if AUXILIARY_PICTURES
     567  ("ScalabilityMask3",        m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" )
     568#endif
    539569#else
    540570  ("ScalabilityMask0",        m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)")
     
    597627  ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    598628  ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
     629#if AUXILIARY_PICTURES
     630  ("InputChromaFormat",     tmpInputChromaFormat,                       420, "InputChromaFormatIDC")
     631  ("ChromaFormatIDC,-cf",   tmpChromaFormat,                             0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     632#endif
    599633  ("ConformanceMode",       m_conformanceMode,     0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
    600634  ("HorizontalPadding,-pdx",m_aiPad[0],            0, "Horizontal source padding for conformance window mode 2")
     
    12111245      m_acLayerCfg[layer].m_refLayerIds = NULL;
    12121246    }
     1247  }
     1248#endif
     1249#if AUXILIARY_PICTURES
     1250  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     1251  {
     1252    m_acLayerCfg[layer].m_InputChromaFormat =  numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]);
     1253    m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormat ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer])));
    12131254  }
    12141255#endif
     
    22512292  }
    22522293#endif
     2294#if AUXILIARY_PICTURES
     2295  for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
     2296  {
     2297    xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 4, "AuxId must be in range 0 to 4");
     2298    xConfirmPara(m_acLayerCfg[layer].m_auxId > 0 && m_acLayerCfg[layer].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture");
     2299  }
     2300#endif
    22532301#undef xConfirmPara
    22542302  if (check_failed)
     
    23312379  printf("Multiview                     : %d\n", m_scalabilityMask[1] );
    23322380  printf("Scalable                      : %d\n", m_scalabilityMask[2] );
     2381#if AUXILIARY_PICTURES
     2382  printf("Auxiliary pictures            : %d\n", m_scalabilityMask[3] );
     2383#endif
    23332384#else
    23342385  printf("Multiview                     : %d\n", m_scalabilityMask[0] );
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncCfg.h

    r471 r475  
    101101  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
    102102#endif 
    103 
     103#if AUXILIARY_PICTURES
     104  ChromaFormat m_InputChromaFormatIDC;
     105#endif
    104106  Bool      m_isField;                                        ///< enable field coding
    105107  Bool      m_isTopFieldFirst;
     
    172174  Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
    173175  Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
     176#endif
     177#if AUXILIARY_PICTURES
     178  ChromaFormat m_chromaFormatIDC;
    174179#endif
    175180
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r468 r475  
    2222//! \{
    2323
     24
     25#if AUXILIARY_PICTURES
     26static inline ChromaFormat numberToChromaFormat(const Int val)
     27{
     28  switch (val)
     29  {
     30    case 400: return CHROMA_400; break;
     31    case 420: return CHROMA_420; break;
     32    case 422: return CHROMA_422; break;
     33    case 444: return CHROMA_444; break;
     34    default:  return NUM_CHROMA_FORMAT;
     35  }
     36}
     37#endif
    2438
    2539// ====================================================================================================================
     
    7589  string cfg_ReconFile;
    7690  string cfg_dQPFile;
     91#if AUXILIARY_PICTURES
     92  Int tmpInputChromaFormat;
     93  Int tmpChromaFormat;
     94#endif
     95
    7796  po::Options opts;
    7897  opts.addOptions()
     
    85104    ("SourceHeight,-hgt",     m_iSourceHeight, 0, "Source picture height")
    86105    ("CroppingMode",          m_conformanceMode,  0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     106#if AUXILIARY_PICTURES
     107    ("InputChromaFormat",     tmpInputChromaFormat,  420, "InputChromaFormatIDC")
     108    ("ChromaFormatIDC",       tmpChromaFormat,    420, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     109#endif
    87110    ("CropLeft",              m_confLeft,      0, "Left cropping/padding for cropping mode 3")
    88111    ("CropRight",             m_confRight,     0, "Right cropping/padding for cropping mode 3")
     
    103126  m_cReconFile = cfg_ReconFile;
    104127  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
     128#if AUXILIARY_PICTURES
     129  m_InputChromaFormat = numberToChromaFormat(tmpInputChromaFormat);
     130  m_chromaFormatIDC   = ((tmpChromaFormat == 0) ? (m_InputChromaFormat) : (numberToChromaFormat(tmpChromaFormat)));
     131#endif
    105132
    106133  // reading external dQP description from file
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r471 r475  
    4444  Double    m_fQP;                                            ///< QP value of key-picture (floating point)
    4545#if SVC_EXTENSION
     46#if AUXILIARY_PICTURES
     47  ChromaFormat m_chromaFormatIDC;
     48  ChromaFormat m_InputChromaFormat;
     49  Int          m_auxId;
     50#endif
    4651#if VPS_EXTN_DIRECT_REF_LAYERS
    4752#if M0457_PREDICTION_INDICATIONS
     
    141146  Int     getConfTop()                {return m_confTop;          }
    142147  Int     getConfBottom()             {return m_confBottom;       }
     148#if AUXILIARY_PICTURES
     149  ChromaFormat getInputChromaFormat()   {return m_InputChromaFormat;}
     150  ChromaFormat getChromaFormatIDC()     {return m_chromaFormatIDC;  }
     151  Int          getAuxId()               {return m_auxId;            }
     152#endif
    143153
    144154  Int     getIntQP()                  {return m_iQP;              }
  • branches/SHM-4.0-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r471 r475  
    103103      for( UInt idx = 0; idx < layer; idx++ )
    104104      {
     105#if AUXILIARY_PICTURES
     106        if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight() &&
     107            m_acLayerCfg[layer].getChromaFormatIDC() == m_acLayerCfg[idx].getChromaFormatIDC() )
     108#else
    105109        if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight() )
     110#endif
    106111        {
    107112          found = true;
     
    144149    repFormat->setPicWidthVpsInLumaSamples  ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
    145150    repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
     151#if AUXILIARY_PICTURES
     152    repFormat->setChromaFormatVpsIdc        ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() );
     153#else
    146154    repFormat->setChromaFormatVpsIdc        ( 1                                             );  // Need modification to change for each layer - corresponds to 420
     155#endif
    147156    repFormat->setSeparateColourPlaneVpsFlag( 0                                             );  // Need modification to change for each layer
    148157#if O0194_DIFFERENT_BITDEPTH_EL_BL
     
    595604    m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
    596605#endif
     606#if AUXILIARY_PICTURES
     607    m_acTEncTop[layer].setChromaFormatIDC( m_acLayerCfg[layer].m_chromaFormatIDC );
     608#endif
    597609  }
    598610}
     
    10251037      scalabilityTypes += m_scalabilityMask[i];
    10261038    }
     1039#if AUXILIARY_PICTURES
     1040    assert( scalabilityTypes <= 2 );
     1041#else
    10271042    assert( scalabilityTypes == 1 );
     1043#endif
    10281044    vps->setNumScalabilityTypes(scalabilityTypes);
    10291045  }
     
    10461062    vps->setDimensionId(i, 0, i);
    10471063  }
     1064#if AUXILIARY_PICTURES
     1065  if (m_scalabilityMask[3])
     1066  {
     1067    UInt maxAuxId = 0;
     1068    UInt auxDimIdLen = 0;
     1069    for(i = 1; i < vps->getMaxLayers(); i++)
     1070    {
     1071      if (m_acLayerCfg[i].getAuxId() > maxAuxId)
     1072      {
     1073        maxAuxId = m_acLayerCfg[i].getAuxId();
     1074      }
     1075    }
     1076    while((1 << auxDimIdLen) < (maxAuxId + 1))
     1077    {
     1078      auxDimIdLen++;
     1079    }
     1080    vps->setDimensionIdLen(1, auxDimIdLen);
     1081    for(i = 1; i < vps->getMaxLayers(); i++)
     1082    {
     1083      vps->setDimensionId(i, 1, m_acLayerCfg[i].getAuxId());
     1084    }
     1085  }
     1086#endif
    10481087#endif
    10491088#if N0120_MAX_TID_REF_PRESENT_FLAG
     
    12551294#if SVC_UPSAMPLING
    12561295#if LAYER_CTB
     1296#if AUXILIARY_PICTURES
     1297      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1298#else
    12571299      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1300#endif
     1301#else
     1302#if AUXILIARY_PICTURES
     1303      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    12581304#else
    12591305      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1306#endif
    12601307#endif
    12611308#else
     
    12671314#if SVC_UPSAMPLING
    12681315#if LAYER_CTB
     1316#if AUXILIARY_PICTURES
     1317      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1318#else
    12691319      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1320#endif
     1321#else
     1322#if AUXILIARY_PICTURES
     1323      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    12701324#else
    12711325      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1326#endif
    12721327#endif
    12731328#else
     
    13251380        // read input YUV file
    13261381        m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() );
     1382
     1383#if AUXILIARY_PICTURES
     1384        if (m_acLayerCfg[layer].getChromaFormatIDC() == CHROMA_400)
     1385        {
     1386          pcPicYuvOrg[layer]->convertToMonochrome();
     1387        }
     1388#endif
    13271389
    13281390        if(layer == m_numLayers-1)
     
    16801742#if SVC_UPSAMPLING
    16811743#if LAYER_CTB
     1744#if AUXILIARY_PICTURES
     1745    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1746#else
    16821747    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1748#endif
     1749#else
     1750#if AUXILIARY_PICTURES
     1751    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
    16831752#else
    16841753    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1754#endif
    16851755#endif
    16861756#else
Note: See TracChangeset for help on using the changeset viewer.