Changeset 288 in SHVCSoftware for branches/SHM-2.1-dev/source/App/TAppEncoder


Ignore:
Timestamp:
12 Jun 2013, 03:37:28 (12 years ago)
Author:
qualcomm
Message:

Changes made to signaling of scaled reference layer offsets.

Patch incorporating changes made to signaling of scaled reference layer offsets during SHVC editing. The number of sets of scaled reference layer offsets is signaled. Changes to configuration files also included.

From: Adarsh K. Ramasubramonian <aramasub@…>

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

Legend:

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

    r282 r288  
    345345#endif
    346346#if SCALED_REF_LAYER_OFFSETS
    347   Int*    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
    348   Int*    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
    349   Int*    cfg_scaledRefLayerRightOffset [MAX_LAYERS];
    350   Int*    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
     347  string    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
     348  string    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
     349  string    cfg_scaledRefLayerRightOffset [MAX_LAYERS];
     350  string    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
     351  Int*      cfg_numScaledRefLayerOffsets[MAX_LAYERS];
     352
     353  string*    cfg_scaledRefLayerLeftOffsetPtr   [MAX_LAYERS];
     354  string*    cfg_scaledRefLayerTopOffsetPtr    [MAX_LAYERS];
     355  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
     356  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
    351357#endif
    352358#if RC_SHVC_HARMONIZATION
     
    376382#endif
    377383#if SCALED_REF_LAYER_OFFSETS
    378     cfg_scaledRefLayerLeftOffset  [layer] = &m_acLayerCfg[layer].m_scaledRefLayerLeftOffset;
    379     cfg_scaledRefLayerTopOffset   [layer] = &m_acLayerCfg[layer].m_scaledRefLayerTopOffset;
    380     cfg_scaledRefLayerRightOffset [layer] = &m_acLayerCfg[layer].m_scaledRefLayerRightOffset;
    381     cfg_scaledRefLayerBottomOffset[layer] = &m_acLayerCfg[layer].m_scaledRefLayerBottomOffset;
     384    cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets;
     385    for(Int i = 0; i < MAX_LAYERS; i++)
     386    {
     387      cfg_scaledRefLayerLeftOffsetPtr  [layer] = &cfg_scaledRefLayerLeftOffset[layer]  ;
     388      cfg_scaledRefLayerTopOffsetPtr   [layer] = &cfg_scaledRefLayerTopOffset[layer]   ;
     389      cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer] ;
     390      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
     391    }
    382392#endif
    383393#if RC_SHVC_HARMONIZATION
     
    452462  ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    453463#if SCALED_REF_LAYER_OFFSETS
    454   ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffset,  0, MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
     464  ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
     465  ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
    455466                                                                 " top-left luma sample of the EL picture, in units of two luma samples")
    456   ("ScaledRefLayerTopOffset%d",    cfg_scaledRefLayerTopOffset,   0, MAX_LAYERS,   "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
     467  ("ScaledRefLayerTopOffset%d",    cfg_scaledRefLayerTopOffsetPtr,   string(""), MAX_LAYERS,   "Vertical offset of top-left luma sample of scaled base layer picture with respect to"
    457468                                                                 " top-left luma sample of the EL picture, in units of two luma samples")
    458   ("ScaledRefLayerRightOffset%d",  cfg_scaledRefLayerRightOffset, 0, MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
     469  ("ScaledRefLayerRightOffset%d",  cfg_scaledRefLayerRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of scaled base layer picture with respect to"
    459470                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
    460   ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffset,0, MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
     471  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    461472                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
    462473#endif
     
    892903    m_pRowHeight = NULL;
    893904  }
     905#if SCALED_REF_LAYER_OFFSETS
     906  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     907  {
     908    // If number of scaled ref. layer offsets is non-zero, at least one of the offsets should be specified
     909    if(m_acLayerCfg[layer].m_numScaledRefLayerOffsets)
     910    {
     911      assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  "") ||
     912              strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") ||
     913              strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),   "") ||
     914              strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"")
     915            );
     916    }
     917
     918    Int *tempArray = NULL;   // Contain the value
     919    // Left offset //
     920    if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  ""))
     921    {
     922      cfgStringToArray( &tempArray, cfg_scaledRefLayerLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "LeftOffset");
     923      if(tempArray)
     924      {
     925        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     926        {
     927          m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i] = tempArray[i];
     928        }
     929        delete [] tempArray; tempArray = NULL;
     930      }
     931    }
     932
     933    // Top offset //
     934    if(strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),  ""))
     935    {
     936      cfgStringToArray( &tempArray, cfg_scaledRefLayerTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "TopOffset");
     937      if(tempArray)
     938      {
     939        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     940        {
     941          m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i] = tempArray[i];
     942        }
     943        delete [] tempArray; tempArray = NULL;
     944      }
     945    }
     946
     947    // Right offset //
     948    if(strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(),  ""))
     949    {
     950      cfgStringToArray( &tempArray, cfg_scaledRefLayerRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RightOffset");
     951      if(tempArray)
     952      {
     953        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     954        {
     955          m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i] = tempArray[i];
     956        }
     957        delete [] tempArray; tempArray = NULL;
     958      }
     959    }
     960
     961    // Bottom offset //
     962    if(strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),  ""))
     963    {
     964      cfgStringToArray( &tempArray, cfg_scaledRefLayerBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "BottomOffset");
     965      if(tempArray)
     966      {
     967        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     968        {
     969          m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i] = tempArray[i];
     970        }
     971        delete [] tempArray; tempArray = NULL;
     972      }
     973    }
     974  }
     975#endif
    894976#if VPS_EXTN_DIRECT_REF_LAYERS
    895977  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     
    20962178}
    20972179
     2180#if SCALED_REF_LAYER_OFFSETS
     2181Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString)
     2182{
     2183  Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str());
     2184  if( numEntries > 0 )
     2185  {
     2186    Char *arrayEntry;
     2187    Int i = 0;
     2188    *arr = new Int[numEntries];
     2189
     2190    arrayEntry = strtok( tempChar, " ,");
     2191    while(arrayEntry != NULL)
     2192    {
     2193      if( i >= numEntries )
     2194      {
     2195        printf( "%c: The number of entries specified is larger than the allowed number.\n", logString );
     2196        exit( EXIT_FAILURE );
     2197      }
     2198      *( *arr + i ) = atoi( arrayEntry );
     2199      arrayEntry = strtok(NULL, " ,");
     2200      i++;
     2201    }
     2202    if( i < numEntries )
     2203    {
     2204      printf( "%c: Some entries are not specified.\n", logString );
     2205      exit( EXIT_FAILURE );
     2206    }
     2207  }
     2208  else
     2209  {
     2210    *arr = NULL;
     2211  }
     2212}
     2213#endif
    20982214//! \}
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncCfg.h

    r245 r288  
    390390  Char* getBLSyntaxFile()           { return m_BLSyntaxFile;      }
    391391#endif
     392#if SCALED_REF_LAYER_OFFSETS
     393  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
     394#endif
    392395#endif
    393396};// END CLASS DEFINITION TAppEncCfg
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r211 r288  
    3535  m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
    3636  m_aiPad[1] = m_aiPad[0] = 0;
     37#if SCALED_REF_LAYER_OFFSETS
     38  m_numScaledRefLayerOffsets = 0;
     39  ::memset(m_scaledRefLayerLeftOffset,   0, sizeof(m_scaledRefLayerLeftOffset));
     40  ::memset(m_scaledRefLayerTopOffset,    0, sizeof(m_scaledRefLayerTopOffset));
     41  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
     42  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
     43#endif
    3744}
    3845
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r282 r288  
    6868  TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
    6969#if SCALED_REF_LAYER_OFFSETS
    70   Int       m_scaledRefLayerLeftOffset;
    71   Int       m_scaledRefLayerTopOffset;
    72   Int       m_scaledRefLayerRightOffset;
    73   Int       m_scaledRefLayerBottomOffset;
     70  Int       m_numScaledRefLayerOffsets  ;
     71  Int       m_scaledRefLayerLeftOffset  [MAX_LAYERS];
     72  Int       m_scaledRefLayerTopOffset   [MAX_LAYERS];
     73  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
     74  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
    7475#endif 
    7576public:
  • branches/SHM-2.1-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r282 r288  
    451451    if( layer > 0 )
    452452    {
    453       m_acTEncTop[layer].getScaledRefLayerWindow().setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset, 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset,
    454                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset, 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset); 
     453      m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
     454      for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     455      {
     456        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     457                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); 
     458      }
    455459    }
    456460#endif
Note: See TracChangeset for help on using the changeset viewer.