Changeset 849 in SHVCSoftware


Ignore:
Timestamp:
29 Jul 2014, 14:03:05 (10 years ago)
Author:
sharp
Message:

JCTVC-R0340 Resampling modifications (Macro:R0340_RESAMPLING_MODIFICATION)

Include generic phase (R0209), ref. region offset (R0013), move scaled ref offset to PPS (R0013), remove clip to scaled ref window (R0220) and ref offset signal change (R0220).

From: Tomoyuki Yamamoto <yamamoto.tomoyuki@…>

Location:
branches/SHM-dev
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/BQTerrace-2x.cfg

    r752 r849  
    2222IntraPeriod1                  : 64          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
     31
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/BQTerrace-SNR.cfg

    r595 r849  
    2222IntraPeriod1                  : 64          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 4        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/BasketballDrive-2x.cfg

    r752 r849  
    2222IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
     31
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/BasketballDrive-SNR.cfg

    r595 r849  
    2222IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 4        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/Cactus-2x.cfg

    r752 r849  
    2222IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
     31
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/Cactus-SNR.cfg

    r595 r849  
    2222IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 4        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/Kimono-2x.cfg

    r752 r849  
    2222IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/Kimono-SNR.cfg

    r595 r849  
    2222IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 4        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/ParkScene-2x.cfg

    r752 r849  
    2222IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
  • branches/SHM-dev/cfg/per-sequence-svc-avcbase/ParkScene-SNR.cfg

    r595 r849  
    2222IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2323ConformanceMode1              : 1           # conformance mode
    24 NumScaledRefLayerOffsets1     : 1           # Number of scaled entry offsets for this layer
    25 ScaledRefLayerId1             : 0           # Scaled reference layer ID
    26 ScaledRefLayerBottomOffset1   : -4          # offset for spatial alignment of the base and enhancement layers
     24NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     25ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     26ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     27RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     28RefRegionBottomOffset1           : 4        # List of ref region bottom offsets
     29ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
    2730QP1                           : 20
  • branches/SHM-dev/cfg/per-sequence-svc/BQTerrace-2x.cfg

    r713 r849  
    2424ConformanceMode1              : 1           # conformance mode
    2525QP1                           : 20
     26
     27#============= Reference location offset parameters ==================
     28NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     29ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     30ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     31RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     32RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     33ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
  • branches/SHM-dev/cfg/per-sequence-svc/BasketballDrive-2x.cfg

    r713 r849  
    2424ConformanceMode1              : 1           # conformance mode
    2525QP1                           : 20
     26
     27#============= Reference location offset parameters ==================
     28NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     29ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     30ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     31RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     32RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     33ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
  • branches/SHM-dev/cfg/per-sequence-svc/Cactus-2x.cfg

    r713 r849  
    2424ConformanceMode1              : 1           # conformance mode
    2525QP1                           : 20
     26
     27#============= Reference location offset parameters ==================
     28NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     29ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     30ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     31RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     32RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     33ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
  • branches/SHM-dev/cfg/per-sequence-svc/Kimono-2x.cfg

    r713 r849  
    2424ConformanceMode1              : 1           # conformance mode
    2525QP1                           : 20
     26
     27#============= Reference location offset parameters ==================
     28NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     29ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     30ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     31RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     32RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     33ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
  • branches/SHM-dev/cfg/per-sequence-svc/ParkScene-2x.cfg

    r713 r849  
    2424ConformanceMode1              : 1           # conformance mode
    2525QP1                           : 20
     26
     27#============= Reference location offset parameters ==================
     28NumScaledRefLayerOffsets1        : 1        # Number of reference location offset parameters
     29ScaledRefLayerId1                : 0        # List of ref layer id (i-th entry for i-th ref loc offset parameters)
     30ScaledRefLayerOffsetPresentFlag1 : 0        # List of scaled ref layer offset present flags
     31RefRegionOffsetPresentFlag1      : 1        # List of ref region offset present flags
     32RefRegionBottomOffset1           : 2        # List of ref region bottom offsets
     33ResamplePhaseSetPresentFlag1     : 0        # List of resample phase set present flags
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r829 r849  
    384384  string    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
    385385  Int*      cfg_numScaledRefLayerOffsets[MAX_LAYERS];
     386#if REF_REGION_OFFSET
     387  string    cfg_scaledRefLayerOffsetPresentFlag [MAX_LAYERS];
     388  string    cfg_refRegionOffsetPresentFlag      [MAX_LAYERS];
     389  string    cfg_refRegionLeftOffset   [MAX_LAYERS];
     390  string    cfg_refRegionTopOffset    [MAX_LAYERS];
     391  string    cfg_refRegionRightOffset  [MAX_LAYERS];
     392  string    cfg_refRegionBottomOffset [MAX_LAYERS];
     393#endif
     394#if R0209_GENERIC_PHASE
     395  string    cfg_resamplePhaseSetPresentFlag [MAX_LAYERS];
     396  string    cfg_phaseHorLuma   [MAX_LAYERS];
     397  string    cfg_phaseVerLuma   [MAX_LAYERS];
     398  string    cfg_phaseHorChroma [MAX_LAYERS];
     399  string    cfg_phaseVerChroma [MAX_LAYERS];
     400#else
    386401#if P0312_VERT_PHASE_ADJ
    387402  string    cfg_vertPhasePositionEnableFlag[MAX_LAYERS];
     403#endif
    388404#endif
    389405
     
    395411  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
    396412  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
     413#if REF_REGION_OFFSET
     414  string*    cfg_scaledRefLayerOffsetPresentFlagPtr [MAX_LAYERS];
     415  string*    cfg_refRegionOffsetPresentFlagPtr      [MAX_LAYERS];
     416  string*    cfg_refRegionLeftOffsetPtr   [MAX_LAYERS];
     417  string*    cfg_refRegionTopOffsetPtr    [MAX_LAYERS];
     418  string*    cfg_refRegionRightOffsetPtr  [MAX_LAYERS];
     419  string*    cfg_refRegionBottomOffsetPtr [MAX_LAYERS];
     420#endif
     421#if R0209_GENERIC_PHASE
     422  string*    cfg_resamplePhaseSetPresentFlagPtr [MAX_LAYERS];
     423  string*    cfg_phaseHorLumaPtr   [MAX_LAYERS];
     424  string*    cfg_phaseVerLumaPtr   [MAX_LAYERS];
     425  string*    cfg_phaseHorChromaPtr [MAX_LAYERS];
     426  string*    cfg_phaseVerChromaPtr [MAX_LAYERS];
     427#endif
    397428#if P0312_VERT_PHASE_ADJ
    398429  string*    cfg_vertPhasePositionEnableFlagPtr[MAX_LAYERS];
     
    466497#if P0312_VERT_PHASE_ADJ
    467498      cfg_vertPhasePositionEnableFlagPtr[layer] = &cfg_vertPhasePositionEnableFlag[layer];
     499#endif
     500#if REF_REGION_OFFSET
     501      cfg_scaledRefLayerOffsetPresentFlagPtr [layer] = &cfg_scaledRefLayerOffsetPresentFlag [layer];
     502      cfg_refRegionOffsetPresentFlagPtr      [layer] = &cfg_refRegionOffsetPresentFlag      [layer];
     503      cfg_refRegionLeftOffsetPtr  [layer] = &cfg_refRegionLeftOffset  [layer];
     504      cfg_refRegionTopOffsetPtr   [layer] = &cfg_refRegionTopOffset   [layer];
     505      cfg_refRegionRightOffsetPtr [layer] = &cfg_refRegionRightOffset [layer];
     506      cfg_refRegionBottomOffsetPtr[layer] = &cfg_refRegionBottomOffset[layer];
     507#endif
     508#if R0209_GENERIC_PHASE
     509      cfg_resamplePhaseSetPresentFlagPtr [layer] = &cfg_resamplePhaseSetPresentFlag [layer];
     510      cfg_phaseHorLumaPtr   [layer] = &cfg_phaseHorLuma   [layer];
     511      cfg_phaseVerLumaPtr   [layer] = &cfg_phaseVerLuma   [layer];
     512      cfg_phaseHorChromaPtr [layer] = &cfg_phaseHorChroma [layer];
     513      cfg_phaseVerChromaPtr [layer] = &cfg_phaseVerChroma [layer];
    468514#endif
    469515    }
     
    597643  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    598644  " bottom-right luma sample of the EL picture, in units of two luma samples")
     645#if REF_REGION_OFFSET
     646  ("ScaledRefLayerOffsetPresentFlag%d",      cfg_scaledRefLayerOffsetPresentFlagPtr,     string(""), MAX_LAYERS, "presense flag of scaled reference layer offsets")
     647  ("RefRegionOffsetPresentFlag%d",           cfg_refRegionOffsetPresentFlagPtr,          string(""), MAX_LAYERS, "presense flag of reference region offsets")
     648  ("RefRegionLeftOffset%d",   cfg_refRegionLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of ref region with respect to"
     649                                                                 " top-left luma sample of the BL picture, in units of two luma samples")
     650  ("RefRegionTopOffset%d",    cfg_refRegionTopOffsetPtr,   string(""), MAX_LAYERS,   "Vertical offset of top-left luma sample of ref region with respect to"
     651                                                                 " top-left luma sample of the BL picture, in units of two luma samples")
     652  ("RefRegionRightOffset%d",  cfg_refRegionRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of ref region with respect to"
     653                                                                 " bottom-right luma sample of the BL picture, in units of two luma samples")
     654  ("RefRegionBottomOffset%d", cfg_refRegionBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of ref region with respect to"
     655                                                                 " bottom-right luma sample of the BL picture, in units of two luma samples")
     656#endif
     657#if R0209_GENERIC_PHASE
     658  ("ResamplePhaseSetPresentFlag%d",  cfg_resamplePhaseSetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of resample phase set")
     659  ("PhaseHorLuma%d",   cfg_phaseHorLumaPtr,   string(""), MAX_LAYERS, "luma shift in the horizontal direction used in resampling proces")
     660  ("PhaseVerLuma%d",   cfg_phaseVerLumaPtr,   string(""), MAX_LAYERS, "luma shift in the vertical   direction used in resampling proces")
     661  ("PhaseHorChroma%d", cfg_phaseHorChromaPtr, string(""), MAX_LAYERS, "chroma shift in the horizontal direction used in resampling proces")
     662  ("PhaseVerChroma%d", cfg_phaseVerChromaPtr, string(""), MAX_LAYERS, "chroma shift in the vertical   direction used in resampling proces")
     663#endif
    599664#if P0312_VERT_PHASE_ADJ
    600665  ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d")
     
    11871252      assert( strcmp(cfg_scaledRefLayerId[layer].c_str(),  ""));
    11881253#endif
     1254#if REF_REGION_OFFSET
     1255      Bool srloFlag =
     1256        strcmp(cfg_scaledRefLayerLeftOffset   [layer].c_str(), "") ||
     1257        strcmp(cfg_scaledRefLayerRightOffset  [layer].c_str(), "") ||
     1258        strcmp(cfg_scaledRefLayerTopOffset    [layer].c_str(), "") ||
     1259        strcmp(cfg_scaledRefLayerBottomOffset [layer].c_str(), "");
     1260      Bool rroFlag =
     1261        strcmp(cfg_refRegionLeftOffset   [layer].c_str(), "") ||
     1262        strcmp(cfg_refRegionRightOffset  [layer].c_str(), "") ||
     1263        strcmp(cfg_refRegionTopOffset    [layer].c_str(), "") ||
     1264        strcmp(cfg_refRegionBottomOffset [layer].c_str(), "");
     1265#if R0209_GENERIC_PHASE
     1266      Bool phaseSetFlag =
     1267        strcmp(cfg_phaseHorLuma   [layer].c_str(), "") ||
     1268        strcmp(cfg_phaseVerLuma  [layer].c_str(), "") ||
     1269        strcmp(cfg_phaseHorChroma    [layer].c_str(), "") ||
     1270        strcmp(cfg_phaseVerChroma [layer].c_str(), "");
     1271      assert( srloFlag || rroFlag || phaseSetFlag);
     1272#else
     1273      assert( srloFlag || rroFlag );
     1274#endif
     1275#else
    11891276#if P0312_VERT_PHASE_ADJ
    11901277      assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  "") ||
     
    11991286              strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") );
    12001287#endif
     1288#endif
    12011289    }
    12021290
     
    12191307#endif
    12201308
     1309#if REF_REGION_OFFSET
     1310    // Presense Flag //
     1311    if(strcmp(cfg_scaledRefLayerOffsetPresentFlag[layer].c_str(),  ""))
     1312    {
     1313      cfgStringToArray( &tempArray, cfg_scaledRefLayerOffsetPresentFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "ScaledRefLayerOffsetPresentFlag");
     1314      if(tempArray)
     1315      {
     1316        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     1317        {
     1318          m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] = tempArray[i];
     1319        }
     1320        delete [] tempArray; tempArray = NULL;
     1321      }
     1322    }
     1323#endif
     1324
    12211325    // Left offset //
    12221326    if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  ""))
     
    12891393    }
    12901394#endif
    1291   }
     1395#if REF_REGION_OFFSET
     1396    // Presense Flag //
     1397    if(strcmp(cfg_refRegionOffsetPresentFlag[layer].c_str(),  ""))
     1398    {
     1399      cfgStringToArray( &tempArray, cfg_refRegionOffsetPresentFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionOffsetPresentFlag");
     1400      if(tempArray)
     1401      {
     1402        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     1403        {
     1404          m_acLayerCfg[layer].m_refRegionOffsetPresentFlag[i] = tempArray[i];
     1405        }
     1406        delete [] tempArray; tempArray = NULL;
     1407      }
     1408    }
     1409
     1410    // Left offset //
     1411    if(strcmp(cfg_refRegionLeftOffset[layer].c_str(),  ""))
     1412    {
     1413      cfgStringToArray( &tempArray, cfg_refRegionLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionLeftOffset");
     1414      if(tempArray)
     1415      {
     1416        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     1417        {
     1418          m_acLayerCfg[layer].m_refRegionLeftOffset[i] = tempArray[i];
     1419        }
     1420        delete [] tempArray; tempArray = NULL;
     1421      }
     1422    }
     1423
     1424    // Top offset //
     1425    if(strcmp(cfg_refRegionTopOffset[layer].c_str(),  ""))
     1426    {
     1427      cfgStringToArray( &tempArray, cfg_refRegionTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionTopOffset");
     1428      if(tempArray)
     1429      {
     1430        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     1431        {
     1432          m_acLayerCfg[layer].m_refRegionTopOffset[i] = tempArray[i];
     1433        }
     1434        delete [] tempArray; tempArray = NULL;
     1435      }
     1436    }
     1437
     1438    // Right offset //
     1439    if(strcmp(cfg_refRegionRightOffset[layer].c_str(),  ""))
     1440    {
     1441      cfgStringToArray( &tempArray, cfg_refRegionRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionRightOffset");
     1442      if(tempArray)
     1443      {
     1444        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     1445        {
     1446          m_acLayerCfg[layer].m_refRegionRightOffset[i] = tempArray[i];
     1447        }
     1448        delete [] tempArray; tempArray = NULL;
     1449      }
     1450    }
     1451
     1452    // Bottom offset //
     1453    if(strcmp(cfg_refRegionBottomOffset[layer].c_str(),  ""))
     1454    {
     1455      cfgStringToArray( &tempArray, cfg_refRegionBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionBottomOffset");
     1456      if(tempArray)
     1457      {
     1458        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     1459        {
     1460          m_acLayerCfg[layer].m_refRegionBottomOffset[i] = tempArray[i];
     1461        }
     1462        delete [] tempArray; tempArray = NULL;
     1463      }
     1464    }
     1465#endif
     1466#if R0209_GENERIC_PHASE
     1467    Int numPhaseSet = m_acLayerCfg[layer].m_numScaledRefLayerOffsets;
     1468
     1469    // Presense Flag //
     1470    if(strcmp(cfg_resamplePhaseSetPresentFlag[layer].c_str(),  ""))
     1471    {
     1472      cfgStringToArray( &tempArray, cfg_resamplePhaseSetPresentFlag[layer], numPhaseSet, "resamplePhaseSetPresentFlag");
     1473      if(tempArray)
     1474      {
     1475        for(Int i = 0; i < numPhaseSet; i++)
     1476        {
     1477          m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] = tempArray[i];
     1478        }
     1479        delete [] tempArray; tempArray = NULL;
     1480      }
     1481    }
     1482
     1483    // Luma horizontal phase //
     1484    if(strcmp(cfg_phaseHorLuma[layer].c_str(),  ""))
     1485    {
     1486      cfgStringToArray( &tempArray, cfg_phaseHorLuma[layer], numPhaseSet, "phaseHorLuma");
     1487      if(tempArray)
     1488      {
     1489        for(Int i = 0; i < numPhaseSet; i++)
     1490        {
     1491          m_acLayerCfg[layer].m_phaseHorLuma[i] = tempArray[i];
     1492        }
     1493        delete [] tempArray; tempArray = NULL;
     1494      }
     1495    }
     1496
     1497    // Luma vertical phase //
     1498    if(strcmp(cfg_phaseVerLuma[layer].c_str(),  ""))
     1499    {
     1500      cfgStringToArray( &tempArray, cfg_phaseVerLuma[layer], numPhaseSet, "phaseVerLuma");
     1501      if(tempArray)
     1502      {
     1503        for(Int i = 0; i < numPhaseSet; i++)
     1504        {
     1505          m_acLayerCfg[layer].m_phaseVerLuma[i] = tempArray[i];
     1506        }
     1507        delete [] tempArray; tempArray = NULL;
     1508      }
     1509    }
     1510
     1511    // Chroma horizontal phase //
     1512    if(strcmp(cfg_phaseHorChroma[layer].c_str(),  ""))
     1513    {
     1514      cfgStringToArray( &tempArray, cfg_phaseHorChroma[layer], numPhaseSet, "phaseHorChroma");
     1515      if(tempArray)
     1516      {
     1517        for(Int i = 0; i < numPhaseSet; i++)
     1518        {
     1519          m_acLayerCfg[layer].m_phaseHorChroma[i] = tempArray[i];
     1520        }
     1521        delete [] tempArray; tempArray = NULL;
     1522      }
     1523    }
     1524
     1525    // Chroma vertical phase //
     1526    if(strcmp(cfg_phaseVerChroma[layer].c_str(),  ""))
     1527    {
     1528      cfgStringToArray( &tempArray, cfg_phaseVerChroma[layer], numPhaseSet, "phaseVerChroma");
     1529      if(tempArray)
     1530      {
     1531        for(Int i = 0; i < numPhaseSet; i++)
     1532        {
     1533          m_acLayerCfg[layer].m_phaseVerChroma[i] = tempArray[i];
     1534        }
     1535        delete [] tempArray; tempArray = NULL;
     1536      }
     1537    }
     1538#endif
     1539  }
     1540
    12921541#if VPS_EXTN_DIRECT_REF_LAYERS
    12931542  for(Int layer = 0; layer < MAX_LAYERS; layer++)
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r823 r849  
    6060  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
    6161  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
     62#if REF_REGION_OFFSET
     63  ::memset(m_scaledRefLayerOffsetPresentFlag, 0, sizeof(m_scaledRefLayerOffsetPresentFlag));
     64  ::memset(m_refRegionOffsetPresentFlag, 0, sizeof(m_refRegionOffsetPresentFlag));
     65  ::memset(m_refRegionLeftOffset,   0, sizeof(m_refRegionLeftOffset));
     66  ::memset(m_refRegionTopOffset,    0, sizeof(m_refRegionTopOffset));
     67  ::memset(m_refRegionRightOffset,  0, sizeof(m_refRegionRightOffset));
     68  ::memset(m_refRegionBottomOffset, 0, sizeof(m_refRegionBottomOffset));
     69#endif
     70#if R0209_GENERIC_PHASE
     71  ::memset(m_resamplePhaseSetPresentFlag, 0, sizeof(m_resamplePhaseSetPresentFlag));
     72  ::memset(m_phaseHorLuma,   0, sizeof(m_phaseHorLuma));
     73  ::memset(m_phaseVerLuma,   0, sizeof(m_phaseVerLuma));
     74  ::memset(m_phaseHorChroma, 0, sizeof(m_phaseHorChroma));
     75  ::memset(m_phaseVerChroma, 0, sizeof(m_phaseVerChroma));
     76#else
    6277#if P0312_VERT_PHASE_ADJ
    6378  ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag));
     79#endif
    6480#endif
    6581}
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncLayerCfg.h

    r823 r849  
    9898  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
    9999  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
    100 #if P0312_VERT_PHASE_ADJ
     100#if REF_REGION_OFFSET
     101  Bool      m_scaledRefLayerOffsetPresentFlag [MAX_LAYERS];
     102  Bool      m_refRegionOffsetPresentFlag      [MAX_LAYERS];
     103  Int       m_refRegionLeftOffset  [MAX_LAYERS];
     104  Int       m_refRegionTopOffset   [MAX_LAYERS];
     105  Int       m_refRegionRightOffset [MAX_LAYERS];
     106  Int       m_refRegionBottomOffset[MAX_LAYERS];
     107#endif
     108#if P0312_VERT_PHASE_ADJ
    101109  Bool      m_vertPhasePositionEnableFlag[MAX_LAYERS];
     110#endif
     111#if R0209_GENERIC_PHASE
     112  Int       m_phaseHorLuma  [MAX_LAYERS];
     113  Int       m_phaseVerLuma  [MAX_LAYERS];
     114  Int       m_phaseHorChroma[MAX_LAYERS];
     115  Int       m_phaseVerChroma[MAX_LAYERS];
     116  Bool      m_resamplePhaseSetPresentFlag [MAX_LAYERS];
    102117#endif
    103118
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r835 r849  
    351351        }
    352352      }
     353#if REF_REGION_OFFSET
     354      for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     355      {
     356#if AUXILIARY_PICTURES
     357        Int cf = m_acLayerCfg[i].m_chromaFormatIDC;
     358        Int rlSubWidthC  = ( cf == CHROMA_420 || cf == CHROMA_422 ) ? 2 : 1;
     359        Int rlSubHeightC = ( cf == CHROMA_420 ) ? 2 : 1;
     360#else
     361        Int rlSubWidthC  = 2;
     362        Int rlSubHeightC = 2;
     363#endif
     364        m_acTEncTop[layer].setRefRegionOffsetPresentFlag( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag );
     365        m_acTEncTop[layer].getRefLayerWindow(i).setWindow( rlSubWidthC  * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC  * m_acLayerCfg[layer].m_refRegionRightOffset[i],
     366                                                           rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i],  rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]);
     367      }
     368#endif
    353369    }
    354370    else
     
    622638    if( layer > 0 )
    623639    {
     640#if REF_REGION_OFFSET
     641#if AUXILIARY_PICTURES
     642      Int cf = m_acLayerCfg[layer].m_chromaFormatIDC;
     643      Int subWidthC  = ( cf == CHROMA_420 || cf == CHROMA_422 ) ? 2 : 1;
     644      Int subHeightC = ( cf == CHROMA_420 ) ? 2 : 1;
     645#else
     646      Int subWidthC  = 2;
     647      Int subHeightC = 2;
     648#endif
     649#endif
    624650      m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets );
    625651      for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     
    628654        m_acTEncTop[layer].setScaledRefLayerId(i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
    629655#endif
     656#if REF_REGION_OFFSET
     657        m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] );
     658        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC  * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     659                                                                 subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i],  subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     660#else
    630661#if P0312_VERT_PHASE_ADJ
    631662        m_acTEncTop[layer].setVertPhasePositionEnableFlag( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     
    635666        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    636667                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     668#endif
     669#endif
     670#if R0209_GENERIC_PHASE
     671        m_acTEncTop[layer].setResamplePhaseSetPresentFlag( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] );
     672        m_acTEncTop[layer].setPhaseHorLuma( i, m_acLayerCfg[layer].m_phaseHorLuma[i] );
     673        m_acTEncTop[layer].setPhaseVerLuma( i, m_acLayerCfg[layer].m_phaseVerLuma[i] );
     674        m_acTEncTop[layer].setPhaseHorChroma( i, m_acLayerCfg[layer].m_phaseHorChroma[i] );
     675        m_acTEncTop[layer].setPhaseVerChroma( i, m_acLayerCfg[layer].m_phaseVerChroma[i] );
    637676#endif
    638677      }
  • branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r828 r849  
    35093509#endif
    35103510
     3511#if MOVE_SCALED_OFFSET_TO_PPS
     3512#if O0098_SCALED_REF_LAYER_ID
     3513  Int leftStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowLeftOffset();
     3514  Int topStartL  = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowTopOffset();
     3515#else
     3516  Int leftStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset();
     3517  Int topStartL  = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
     3518#endif
     3519#else
    35113520#if O0098_SCALED_REF_LAYER_ID
    35123521  Int leftStartL = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowLeftOffset();
     
    35163525  Int topStartL  = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
    35173526#endif
    3518 
     3527#endif
     3528
     3529#if REF_REGION_OFFSET
     3530  const Window &windowRL = baseColPic->getSlice(0)->getPPS()->getRefLayerWindow(refLayerIdc);
     3531  Int iBX = (((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16) + windowRL.getWindowLeftOffset();
     3532  Int iBY = (((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16) + windowRL.getWindowTopOffset();
     3533#else
    35193534#if Q0200_CONFORMANCE_BL_SIZE
    35203535  Int chromaFormatIdc = baseColPic->getSlice(0)->getChromaFormatIdc();
     
    35253540  Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    35263541#endif
     3542#endif
    35273543
    35283544#if REF_IDX_MFM
  • branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.cpp

    r815 r849  
    796796#else
    797797#if O0194_JOINT_US_BITSHIFT
     798#if REF_REGION_OFFSET
     799Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow )
     800{
     801  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, altRefWindow );
     802}
     803#else
    798804Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
    799805{
    800806  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window);
    801807}
     808#endif
    802809#else
    803810Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
  • branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.h

    r815 r849  
    126126#else
    127127#if O0194_JOINT_US_BITSHIFT
     128#if REF_REGION_OFFSET
     129  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow );
     130#else
    128131  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     132#endif
    129133#else
    130134  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp

    r848 r849  
    571571        UInt refLayerId = m_pcVPS->getRefLayerId( m_layerId, refLayerIdc );
    572572#if RESAMPLING_CONSTRAINT_BUG_FIX
     573#if MOVE_SCALED_OFFSET_TO_PPS
     574#if O0098_SCALED_REF_LAYER_ID
     575        const Window &scalEL = getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     576#else
     577        const Window &scalEL = getPPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]);
     578#endif
     579#else
    573580#if O0098_SCALED_REF_LAYER_ID
    574581        const Window &scalEL = getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
    575582#else
    576583        const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]);
     584#endif
    577585#endif
    578586        Int scalingOffset = ((scalEL.getWindowLeftOffset()   == 0 ) &&
     
    30613069, m_layerId                   ( 0 )
    30623070, m_extensionFlag             ( false )
     3071#if !MOVE_SCALED_OFFSET_TO_PPS
    30633072, m_numScaledRefLayerOffsets  ( 0 )
     3073#endif
    30643074#if REPN_FORMAT_IN_VPS
    30653075, m_updateRepFormatFlag       (false)
     
    30843094  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
    30853095
     3096#if !MOVE_SCALED_OFFSET_TO_PPS
    30863097#if P0312_VERT_PHASE_ADJ
    30873098  ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag));
     3099#endif
    30883100#endif
    30893101}
     
    32173229const Int TComSPS::m_winUnitY[]={1,2,1,1};
    32183230
     3231#if !MOVE_SCALED_OFFSET_TO_PPS
    32193232#if O0098_SCALED_REF_LAYER_ID
    32203233Window& TComSPS::getScaledRefLayerWindowForLayer(Int layerId)
     
    32333246  return win;
    32343247}
     3248#endif
     3249#if REF_REGION_OFFSET
     3250Window& TComSPS::getRefLayerWindowForLayer(Int layerId)
     3251{
     3252  static Window win;
     3253
     3254  for (Int i = 0; i < m_numRefLayerOffsets; i++)
     3255  {
     3256    if (layerId == m_refLayerId[i])
     3257    {
     3258      return m_refLayerWindow[i];
     3259    }
     3260  }
     3261
     3262  win.resetWindow();  // reference region offsets are inferred to be zero when not present
     3263  return win;
     3264}
     3265#endif
    32353266#endif
    32363267
     
    32763307, m_pocResetInfoPresentFlag   (false)
    32773308#endif
     3309#if MOVE_SCALED_OFFSET_TO_PPS
     3310, m_numScaledRefLayerOffsets  ( 0 )
     3311#endif
    32783312#if Q0048_CGS_3D_ASYMLUT
    32793313, m_nCGSFlag(0)
     
    32843318{
    32853319  m_scalingList = new TComScalingList;
     3320#if REF_REGION_OFFSET
     3321  ::memset(m_scaledRefLayerOffsetPresentFlag,   0, sizeof(m_scaledRefLayerOffsetPresentFlag));
     3322  ::memset(m_refRegionOffsetPresentFlag,   0, sizeof(m_refRegionOffsetPresentFlag));
     3323#endif
     3324#if R0209_GENERIC_PHASE
     3325  ::memset(m_resamplePhaseSetPresentFlag,   0, sizeof(m_resamplePhaseSetPresentFlag));
     3326  ::memset(m_phaseHorLuma,   0, sizeof(m_phaseHorLuma));
     3327  ::memset(m_phaseVerLuma,   0, sizeof(m_phaseVerLuma));
     3328  ::memset(m_phaseHorChroma, 0, sizeof(m_phaseHorChroma));
     3329  ::memset(m_phaseVerChroma, 0, sizeof(m_phaseVerChroma));
     3330#endif
    32863331}
    32873332
     
    32933338  delete m_scalingList;
    32943339}
     3340
     3341#if MOVE_SCALED_OFFSET_TO_PPS
     3342#if O0098_SCALED_REF_LAYER_ID
     3343Window& TComPPS::getScaledRefLayerWindowForLayer(Int layerId)
     3344{
     3345  static Window win;
     3346
     3347  for (Int i = 0; i < m_numScaledRefLayerOffsets; i++)
     3348  {
     3349    if (layerId == m_scaledRefLayerId[i])
     3350    {
     3351      return m_scaledRefLayerWindow[i];
     3352    }
     3353  }
     3354
     3355  win.resetWindow();  // scaled reference layer offsets are inferred to be zero when not present
     3356  return win;
     3357}
     3358#endif
     3359#if REF_REGION_OFFSET
     3360Window& TComPPS::getRefLayerWindowForLayer(Int layerId)
     3361{
     3362  static Window win;
     3363
     3364  for (Int i = 0; i < m_numScaledRefLayerOffsets; i++)
     3365  {
     3366    if (layerId == m_scaledRefLayerId[i])
     3367    {
     3368      return m_refLayerWindow[i];
     3369    }
     3370  }
     3371
     3372  win.resetWindow();  // reference region offsets are inferred to be zero when not present
     3373  return win;
     3374}
     3375#endif
     3376#endif
    32953377
    32963378TComReferencePictureSet::TComReferencePictureSet()
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h

    r848 r849  
    12431243
    12441244  Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
    1245 #if P0312_VERT_PHASE_ADJ 
     1245#if P0312_VERT_PHASE_ADJ
    12461246  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; m_vertPhasePositionEnableFlag = false; }
    12471247#else
     
    12561256  Int           getWindowBottomOffset() const     { return m_enabledFlag ? m_winBottomOffset: 0; }
    12571257  Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
    1258 
    12591258#if P0312_VERT_PHASE_ADJ
    12601259  Bool          getVertPhasePositionEnableFlag() const     { return m_vertPhasePositionEnableFlag;  }
    12611260  Void          setVertPhasePositionEnableFlag(Bool val)    { m_vertPhasePositionEnableFlag = val;  }
     1261#endif
     1262
     1263#if P0312_VERT_PHASE_ADJ
    12621264  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom, Bool vertPhasePositionEnableFlag = 0)
    12631265#else
     
    15321534 Bool         m_vertPhasePositionEnableFlag[MAX_LAYERS];
    15331535#endif
     1536#if !MOVE_SCALED_OFFSET_TO_PPS
    15341537#if O0098_SCALED_REF_LAYER_ID
    15351538  UInt        m_scaledRefLayerId[MAX_LAYERS];
    15361539#endif
    15371540  Window      m_scaledRefLayerWindow[MAX_LAYERS];
     1541#endif
    15381542#if REPN_FORMAT_IN_VPS
    1539   Bool        m_updateRepFormatFlag;
     1543  Bool m_updateRepFormatFlag;
    15401544#if O0096_REP_FORMAT_INDEX
    15411545  UInt        m_updateRepFormatIndex;
     
    15471551#endif
    15481552#endif //SVC_EXTENSION
     1553
    15491554public:
    15501555  TComSPS();
     
    16931698  Int      getExtensionFlag()                  { return m_extensionFlag;  }
    16941699  Void     setExtensionFlag(Int n)             { m_extensionFlag = n;     }
     1700#if !MOVE_SCALED_OFFSET_TO_PPS
    16951701  UInt     getNumScaledRefLayerOffsets()       { return m_numScaledRefLayerOffsets; }
    16961702  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
     
    17051711#endif
    17061712  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
     1713#endif
    17071714#if REPN_FORMAT_IN_VPS
    17081715  Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
     
    18161823#if POC_RESET_IDC
    18171824  Bool     m_pocResetInfoPresentFlag;
     1825#endif
     1826#if MOVE_SCALED_OFFSET_TO_PPS
     1827  UInt     m_numScaledRefLayerOffsets;
     1828#if O0098_SCALED_REF_LAYER_ID
     1829  UInt     m_scaledRefLayerId[MAX_LAYERS];
     1830#endif
     1831  Window   m_scaledRefLayerWindow[MAX_LAYERS];
     1832#if REF_REGION_OFFSET
     1833  Window   m_refLayerWindow[MAX_LAYERS];
     1834  Bool     m_scaledRefLayerOffsetPresentFlag[MAX_LAYERS];
     1835  Bool     m_refRegionOffsetPresentFlag[MAX_LAYERS];
     1836#endif
     1837#if R0209_GENERIC_PHASE
     1838  Int      m_phaseHorLuma[MAX_LAYERS];
     1839  Int      m_phaseVerLuma[MAX_LAYERS];
     1840  Int      m_phaseHorChroma[MAX_LAYERS];
     1841  Int      m_phaseVerChroma[MAX_LAYERS];
     1842  Bool     m_resamplePhaseSetPresentFlag[MAX_LAYERS];
     1843#endif
    18181844#endif
    18191845#if Q0048_CGS_3D_ASYMLUT
     
    19441970  Bool getPocResetInfoPresentFlag   ()                    { return m_pocResetInfoPresentFlag; }
    19451971  Void setPocResetInfoPresentFlag   (const Bool val)      { m_pocResetInfoPresentFlag = val; }
     1972#endif
     1973#if MOVE_SCALED_OFFSET_TO_PPS
     1974  UInt     getNumScaledRefLayerOffsets()       { return m_numScaledRefLayerOffsets; }
     1975  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
     1976#if O0098_SCALED_REF_LAYER_ID
     1977  UInt     getScaledRefLayerId(Int x)          { return m_scaledRefLayerId[x]; }
     1978  Void     setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id;   }
     1979  Window&  getScaledRefLayerWindowForLayer( Int layerId );
     1980#endif
     1981  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
     1982#if REF_REGION_OFFSET
     1983  Window&  getRefLayerWindowForLayer( Int layerId );
     1984  Window&  getRefLayerWindow( Int x )   { return m_refLayerWindow[x]; }
     1985  Bool getScaledRefLayerOffsetPresentFlag(Int x) { return m_scaledRefLayerOffsetPresentFlag[x]; }
     1986  Void setScaledRefLayerOffsetPresentFlag(Int x, Bool b) { m_scaledRefLayerOffsetPresentFlag[x] = b; }
     1987  Bool getRefRegionOffsetPresentFlag(Int x) { return m_refRegionOffsetPresentFlag[x]; }
     1988  Void setRefRegionOffsetPresentFlag(Int x, Bool b) { m_refRegionOffsetPresentFlag[x] = b; }
     1989#endif
     1990#if R0209_GENERIC_PHASE
     1991  Int getPhaseHorLuma(Int x) { return m_phaseHorLuma[x]; }
     1992  Int getPhaseVerLuma(Int x) { return m_phaseVerLuma[x]; }
     1993  Int getPhaseHorChroma(Int x) { return m_phaseHorChroma[x]; }
     1994  Int getPhaseVerChroma(Int x) { return m_phaseVerChroma[x]; }
     1995  Void setPhaseHorLuma(Int x, Int val) { m_phaseHorLuma[x] = val; }
     1996  Void setPhaseVerLuma(Int x, Int val) { m_phaseVerLuma[x] = val; }
     1997  Void setPhaseHorChroma(Int x, Int val) { m_phaseHorChroma[x] = val; }
     1998  Void setPhaseVerChroma(Int x, Int val) { m_phaseVerChroma[x] = val; }
     1999  Bool getResamplePhaseSetPresentFlag(Int x) { return m_resamplePhaseSetPresentFlag[x]; }
     2000  Void setResamplePhaseSetPresentFlag(Int x, Bool b) { m_resamplePhaseSetPresentFlag[x] = b; }
     2001#endif
    19462002#endif
    19472003#if Q0048_CGS_3D_ASYMLUT
  • branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r815 r849  
    5959#else
    6060#if O0194_JOINT_US_BITSHIFT
     61#if REF_REGION_OFFSET
     62Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow )
     63#else
    6164Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     65#endif
    6266#else
    6367Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     
    7579#endif
    7680
     81#if MOVE_SCALED_OFFSET_TO_PPS
     82#if O0098_SCALED_REF_LAYER_ID
     83  const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     84#else
     85  const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc);
     86#endif
     87#if REF_REGION_OFFSET
     88  const Window &windowRL = currSlice->getPPS()->getRefLayerWindow(refLayerIdc);
     89#endif
     90#else
    7791#if O0098_SCALED_REF_LAYER_ID
    7892  const Window &scalEL = currSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
    7993#else
    8094  const Window &scalEL = currSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
     95#endif
    8196#endif
    8297
     
    91106
    92107#if Q0200_CONFORMANCE_BL_SIZE
     108  const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
     109#endif
     110#if Q0200_CONFORMANCE_BL_SIZE || REF_REGION_OFFSET
    93111  Int chromaFormatIdc = currSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
    94   const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();
    95112  Int xScal = TComSPS::getWinUnitX( chromaFormatIdc );
    96113  Int yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     114#endif
     115#if R0209_GENERIC_PHASE
     116  Int phaseHorLuma   = currSlice->getPPS()->getPhaseHorLuma(refLayerIdc);
     117  Int phaseVerLuma   = currSlice->getPPS()->getPhaseVerLuma(refLayerIdc);
     118  Int phaseHorChroma = currSlice->getPPS()->getPhaseHorChroma(refLayerIdc);
     119  Int phaseVerChroma;
     120  if (currSlice->getPPS()->getResamplePhaseSetPresentFlag(refLayerIdc))
     121  {
     122    phaseVerChroma = currSlice->getPPS()->getPhaseVerChroma(refLayerIdc);
     123  }
     124  else
     125  {
     126    Int refRegionHeight = heightBL - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset();
     127    phaseVerChroma = (4 * heightEL + (refRegionHeight >> 1)) / refRegionHeight - 4;
     128  }
    97129#endif
    98130#if P0312_VERT_PHASE_ADJ
     
    223255    Int   shiftY = 16;
    224256
     257#if R0209_GENERIC_PHASE
     258    Int phaseX = phaseHorLuma;
     259    Int phaseY = phaseVerLuma;
     260    Int addX = ( ( phaseX * scaleX + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     261    Int addY = ( ( phaseY * scaleY + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     262#if REF_REGION_OFFSET
     263    Int refOffsetX = windowRL.getWindowLeftOffset() << 4;
     264    Int refOffsetY = windowRL.getWindowTopOffset()  << 4;
     265#else
     266#if Q0200_CONFORMANCE_BL_SIZE
     267    Int refOffsetX = ( confBL.getWindowLeftOffset() * xScal ) << 4;
     268    Int refOffsetY = ( confBL.getWindowTopOffset()  * yScal ) << 4;
     269#endif
     270#endif
     271#else
    225272#if O0215_PHASE_ALIGNMENT //for Luma, if Phase 0, then both PhaseX  and PhaseY should be 0. If symmetric: both PhaseX and PhaseY should be 2
    226273    Int   phaseX = 2*phaseAlignFlag;
     
    258305#endif
    259306
     307#if REF_REGION_OFFSET
     308    Int refOffsetX = windowRL.getWindowLeftOffset() << 4;
     309    Int refOffsetY = windowRL.getWindowTopOffset() << 4;
     310#else
    260311#if Q0200_CONFORMANCE_BL_SIZE
    261312    deltaX -= ( confBL.getWindowLeftOffset() * xScal ) << 4;
    262313    deltaY -= ( confBL.getWindowTopOffset() * yScal ) << 4;
    263314#endif
     315#endif
     316#endif
    264317
    265318    Int shiftXM4 = shiftX - 4;
     
    272325    heightBL = min<Int>( pcBasePic->getHeight(), heightEL );
    273326
     327#if R0220_REMOVE_EL_CLIP
     328    Int phaseXL = scalEL.getWindowLeftOffset();
     329    Int phaseYL = scalEL.getWindowTopOffset();
     330    Int rlClipL = -(NTAPS_US_LUMA>>1);
     331    Int rlClipR = widthBL -1 + (NTAPS_US_LUMA>>1);
     332    Int rlClipT = -(NTAPS_US_LUMA>>1);
     333    Int rlClipB = heightBL - 1 + (NTAPS_US_LUMA>>1);
     334#else
    274335    Int leftStartL = scalEL.getWindowLeftOffset();
    275336    Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
     
    277338    Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
    278339    Int leftOffset = leftStartL > 0 ? leftStartL : 0;
     340#endif
    279341#if O0194_JOINT_US_BITSHIFT
    280342    // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     
    293355    for( i = 0; i < widthEL; i++ )
    294356    {
     357#if R0220_REMOVE_EL_CLIP
     358      Int x = i;
     359#if R0209_GENERIC_PHASE
     360      refPos16 = (((x - phaseXL)*scaleX - addX) >> shiftXM4) + refOffsetX;
     361#else
     362#if REF_REGION_OFFSET
     363      refPos16 = (((x - phaseXL)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetX;
     364#else
     365      refPos16 = (((x - phaseXL)*scaleX + addX) >> shiftXM4) - deltaX;
     366#endif
     367#endif
     368#else
    295369      Int x = Clip3( leftStartL, rightEndL - 1, i );
     370#if REF_REGION_OFFSET
     371      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetX;
     372#else
    296373      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
     374#endif
     375#endif
    297376      phase    = refPos16 & 15;
    298377      refPos   = refPos16 >> 4;
     378#if R0220_REMOVE_EL_CLIP
     379      refPos   = Clip3( rlClipL, rlClipR, refPos );
     380#endif
    299381      coeff = m_lumaFilter[phase];
    300382
     
    325407    for( j = 0; j < pcTempPic->getHeight(); j++ )
    326408    {
     409#if R0220_REMOVE_EL_CLIP
     410      Int y = j;
     411#if R0209_GENERIC_PHASE
     412      refPos16 = ((( y - phaseYL )*scaleY - addY) >> shiftYM4) + refOffsetY;
     413#else
     414#if REF_REGION_OFFSET
     415      refPos16 = ((( y - phaseYL )*scaleY + addY) >> shiftYM4) - deltaY + refOffsetY;
     416#else
     417      refPos16 = ((( y - pahseYL )*scaleY + addY) >> shiftYM4) - deltaY;
     418#endif
     419#endif
     420#else
    327421      Int y = Clip3(topStartL, bottomEndL - 1, j);
     422#if REF_REGION_OFFSET
     423      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY + refOffsetY;
     424#else
    328425      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
     426#endif
     427#endif
    329428      phase    = refPos16 & 15;
    330429      refPos   = refPos16 >> 4;
     430#if R0220_REMOVE_EL_CLIP
     431      refPos = Clip3( rlClipT, rlClipB, refPos );
     432#endif
    331433      coeff = m_lumaFilter[phase];
    332434
    333435      piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
    334436      Pel* piDstY0 = piDstBufY + j * strideEL;
    335       piDstY = piDstY0 + leftOffset;
    336       piSrcY += leftOffset;
    337 
    338       for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
     437
     438#if R0220_REMOVE_EL_CLIP
     439      piDstY = piDstY0;
     440
     441      for( i = pcTempPic->getWidth(); i > 0; i-- )
    339442      {
    340443        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     
    342445        piDstY++;
    343446      }
     447#else
     448      piDstY = piDstY0 + leftOffset;
     449      piSrcY += leftOffset;
     450
     451      for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
     452      {
     453        *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
     454        piSrcY++;
     455        piDstY++;
     456      }
    344457
    345458      for( i = rightEndL; i < pcTempPic->getWidth(); i++ )
     
    355468        piDstY++;
    356469      }
    357 
     470#endif
    358471    }
    359472
     
    374487    strideEL  = pcUsPic->getCStride();
    375488
     489#if R0220_REMOVE_EL_CLIP
     490    Int srlLOffsetC = scalEL.getWindowLeftOffset() >> 1;
     491    Int srlTOffsetC = scalEL.getWindowTopOffset() >> 1;
     492    rlClipL = -(NTAPS_US_CHROMA>>1);
     493    rlClipR = widthBL -1 + (NTAPS_US_CHROMA>>1);
     494    rlClipT = -(NTAPS_US_CHROMA>>1);
     495    rlClipB = heightBL - 1 + (NTAPS_US_CHROMA>>1);
     496#else
    376497    Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
    377498    Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
     
    379500    Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
    380501    leftOffset = leftStartC > 0 ? leftStartC : 0;
     502#endif
    381503    shiftX = 16;
    382504    shiftY = 16;
    383505
     506#if R0209_GENERIC_PHASE
     507    addX = ( ( phaseHorChroma * scaleX + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     508    addY = ( ( phaseVerChroma * scaleY + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     509    Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4;
     510    Int refOffsetYC = (windowRL.getWindowTopOffset()  / yScal) << 4;
     511#else
    384512#if O0215_PHASE_ALIGNMENT
    385513    Int phaseXC = phaseAlignFlag;
     
    417545#endif
    418546
     547#if REF_REGION_OFFSET
     548    Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4;
     549    Int refOffsetYC  = (windowRL.getWindowTopOffset()  / yScal) << 4;
     550#else
    419551#if Q0200_CONFORMANCE_BL_SIZE
    420552    deltaX -= ( ( confBL.getWindowLeftOffset() * xScal ) >> 1 ) << 4;
    421553    deltaY  -= ( ( confBL.getWindowTopOffset() * yScal ) >> 1 ) << 4;
     554#endif
     555#endif
    422556#endif
    423557
     
    447581    for( i = 0; i < widthEL; i++ )
    448582    {
     583#if R0220_REMOVE_EL_CLIP
     584      Int x = i;
     585#if R0209_GENERIC_PHASE
     586      refPos16 = (((x - srlLOffsetC)*scaleX - addX) >> shiftXM4) + refOffsetXC;
     587#else
     588#if REF_REGION_OFFSET
     589      refPos16 = (((x - srlLOffsetC)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetXC;
     590#else
     591      refPos16 = (((x - srlLOffsetC)*scaleX + addX) >> shiftXM4) - deltaX;
     592#endif
     593#endif
     594#else
    449595      Int x = Clip3(leftStartC, rightEndC - 1, i);
     596#if REF_REGION_OFFSET
     597      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetXC;
     598#else
    450599      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
     600#endif
     601#endif
    451602      phase    = refPos16 & 15;
    452603      refPos   = refPos16 >> 4;
     604#if R0220_REMOVE_EL_CLIP
     605      refPos   = Clip3(rlClipL, rlClipR, refPos);
     606#endif
    453607      coeff = m_chromaFilter[phase];
    454608
     
    485639    for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
    486640    {
     641#if R0220_REMOVE_EL_CLIP
     642      Int y = j;
     643#if R0209_GENERIC_PHASE
     644      refPos16 = (((y - srlTOffsetC)*scaleX - addY) >> shiftYM4) + refOffsetYC;
     645#else
     646#if REF_REGION_OFFSET
     647      refPos16 = (((y - srlTOffsetC)*scaleY + addY) >> shiftYM4) - deltaY + refOffsetYC;
     648#else
     649      refPos16 = (((y - srlTOffsetC)*scaleY + addY) >> shiftYM4) - deltaY;
     650#endif
     651#endif
     652#else
    487653      Int y = Clip3(topStartC, bottomEndC - 1, j);
     654#if REF_REGION_OFFSET
     655      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY + refOffsetYC;
     656#else
    488657      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
     658#endif
     659#endif
    489660      phase    = refPos16 & 15;
    490661      refPos   = refPos16 >> 4;
     662#if R0220_REMOVE_EL_CLIP
     663      refPos = Clip3(rlClipT, rlClipB, refPos);
     664#endif
    491665      coeff = m_chromaFilter[phase];
    492666
     
    496670      Pel* piDstU0 = piDstBufU + j*strideEL;
    497671      Pel* piDstV0 = piDstBufV + j*strideEL;
    498       piDstU = piDstU0 + leftOffset;
    499       piDstV = piDstV0 + leftOffset;
    500       piSrcU += leftOffset;
    501       piSrcV += leftOffset;
    502 
    503       for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
     672
     673#if R0220_REMOVE_EL_CLIP
     674      piDstU = piDstU0;
     675      piDstV = piDstV0;
     676
     677      for( i = pcTempPic->getWidth() >> 1; i > 0; i-- )
    504678      {
    505679        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     
    510684        piDstV++;
    511685      }
     686#else
     687      piDstU = piDstU0 + leftOffset;
     688      piDstV = piDstV0 + leftOffset;
     689      piSrcU += leftOffset;
     690      piSrcV += leftOffset;
     691
     692      for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
     693      {
     694        *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
     695        *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
     696        piSrcU++;
     697        piSrcV++;
     698        piDstU++;
     699        piDstV++;
     700      }
    512701
    513702      for( i = rightEndC; i < pcTempPic->getWidth() >> 1; i++ )
     
    528717        piDstV++;
    529718      }
     719#endif
    530720
    531721    }
  • branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.h

    r713 r849  
    5151#else
    5252#if O0194_JOINT_US_BITSHIFT
     53#if REF_REGION_OFFSET
     54  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow );
     55#else
    5356  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     57#endif
    5458#else
    5559  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r848 r849  
    6262#define Q0146_SSH_EXT_DATA_BIT           1      ///< JCTVC-Q0146; Bug-fix -- the SSH_EXT_DATA_BIT can have any value -- not required to be 1
    6363
    64 #define Q0200_CONFORMANCE_BL_SIZE        1      ///< JCTVC-Q0200; use conformance picture size in re-sampling processs
    65 #define P0312_VERT_PHASE_ADJ             1      ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)
    66 #if P0312_VERT_PHASE_ADJ
    67 #define Q0120_PHASE_CALCULATION          1      ///< JCTVC-Q0120 phase offset derivation for combination of spatial scalibility and field coding.
    68 #endif
    6964#define P0130_EOB                        1      ///< JCTVC-P0130, set layer Id of EOB NALU to be fixed to 0
    7065#define T_ID_EOB_BUG_FIX                 1      ///< Bug fix for the value of temporal id of EOB NALU. It must be set to 0
     
    235230#define HRD_BPB                          1      ///< JCTVC-Q0101 Bitstream Partition Buffering Proposals
    236231#define DPB_CONSTRAINTS                  1      ///< JCTVC-Q0100 RPS DPB constraints
     232
     233#define R0340_RESAMPLING_MODIFICATION    1      ///< JCTVC-R0340: set of changes regarding resampling (as listed below)
     234#if R0340_RESAMPLING_MODIFICATION
     235#define MOVE_SCALED_OFFSET_TO_PPS        1      ///< JCTVC-R0013: move scaled reference layer offset from SPS to PPS
     236#if MOVE_SCALED_OFFSET_TO_PPS
     237#define REF_REGION_OFFSET                1      ///< JCTVC-Q0159/R0220: reference region offset
     238#define R0209_GENERIC_PHASE              1      ///< JCTVC-R0209: resampling with generic phase
     239#define R0220_REMOVE_EL_CLIP             1      ///< JCTVC-R0220: remove clip to scaled ref window in resampling process
     240#endif
     241#else
     242#define Q0200_CONFORMANCE_BL_SIZE        1      ///< JCTVC-Q0200; use conformance picture size in re-sampling processs
     243#define P0312_VERT_PHASE_ADJ             1      ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)
     244#if P0312_VERT_PHASE_ADJ
     245#define Q0120_PHASE_CALCULATION          1      ///< JCTVC-Q0120 phase offset derivation for combination of spatial scalibility and field coding.
     246#endif
     247#endif
    237248
    238249/// scalability types
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r848 r849  
    359359      READ_FLAG( uiCode, "poc_reset_info_present_flag" );
    360360      pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false);
     361#if REF_REGION_OFFSET
     362      READ_UVLC( uiCode,      "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode);
     363      for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++)
     364      {
     365        READ_CODE( 6, uiCode,  "scaled_ref_layer_id" );  pcPPS->setScaledRefLayerId( i, uiCode );
     366        READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" );   pcPPS->setScaledRefLayerOffsetPresentFlag( i, uiCode );
     367        if (uiCode)
     368        {
     369          Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i);
     370          READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
     371          READ_SVLC( iCode, "scaled_ref_layer_top_offset" );     scaledWindow.setWindowTopOffset   (iCode << 1);
     372          READ_SVLC( iCode, "scaled_ref_layer_right_offset" );   scaledWindow.setWindowRightOffset (iCode << 1);
     373          READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" );  scaledWindow.setWindowBottomOffset(iCode << 1);
     374#if P0312_VERT_PHASE_ADJ
     375          READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode);  pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode);
     376#endif
     377        }
     378        READ_FLAG( uiCode, "ref_region_offset_present_flag" );   pcPPS->setRefRegionOffsetPresentFlag( i, uiCode );
     379        if (uiCode)
     380        {
     381          Window& refWindow = pcPPS->getRefLayerWindow(i);
     382          READ_SVLC( iCode, "ref_region_left_offset" );    refWindow.setWindowLeftOffset  (iCode << 1);
     383          READ_SVLC( iCode, "ref_region_top_offset" );     refWindow.setWindowTopOffset   (iCode << 1);
     384          READ_SVLC( iCode, "ref_region_right_offset" );   refWindow.setWindowRightOffset (iCode << 1);
     385          READ_SVLC( iCode, "ref_region_bottom_offset" );  refWindow.setWindowBottomOffset(iCode << 1);
     386        }
     387#if R0209_GENERIC_PHASE
     388        READ_FLAG( uiCode, "resample_phase_set_present_flag" );   pcPPS->setResamplePhaseSetPresentFlag( i, uiCode );
     389        if (uiCode)
     390        {
     391          READ_UVLC( uiCode, "phase_hor_luma" );    pcPPS->setPhaseHorLuma ( i, uiCode );
     392          READ_UVLC( uiCode, "phase_ver_luma" );    pcPPS->setPhaseVerLuma ( i, uiCode );
     393          READ_UVLC( uiCode, "phase_hor_chroma_plus8" );  pcPPS->setPhaseHorChroma (i, uiCode - 8);
     394          READ_UVLC( uiCode, "phase_ver_chroma_plus8" );  pcPPS->setPhaseVerChroma (i, uiCode - 8);
     395        }
     396#endif
     397      }
     398#else
     399#if MOVE_SCALED_OFFSET_TO_PPS
     400      READ_UVLC( uiCode,      "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode);
     401      for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++)
     402      {
     403        Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i);
     404#if O0098_SCALED_REF_LAYER_ID
     405        READ_CODE( 6,  uiCode,  "scaled_ref_layer_id" );       pcPPS->setScaledRefLayerId( i, uiCode );
     406#endif
     407        READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
     408        READ_SVLC( iCode, "scaled_ref_layer_top_offset" );     scaledWindow.setWindowTopOffset   (iCode << 1);
     409        READ_SVLC( iCode, "scaled_ref_layer_right_offset" );   scaledWindow.setWindowRightOffset (iCode << 1);
     410        READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" );  scaledWindow.setWindowBottomOffset(iCode << 1);
     411#if P0312_VERT_PHASE_ADJ
     412        READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode);  pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode);
     413#endif
     414      }
     415#endif
     416#endif
    361417#if Q0048_CGS_3D_ASYMLUT
    362418      READ_FLAG( uiCode , "colour_mapping_enabled_flag" );
     
    897953  assert( uiCode == 0 );
    898954
     955#if !MOVE_SCALED_OFFSET_TO_PPS
    899956  if( pcSPS->getLayerId() > 0 )
    900957  {
     
    916973    }
    917974  }
     975#endif
    918976}
    919977#endif
     
    30273085  }
    30283086#if P0312_VERT_PHASE_ADJ
    3029   for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
    3030   {
    3031     UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i);
    3032     if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
    3033     {
    3034       READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc );
    3035     }
     3087    for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
     3088    {
     3089      UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i);
     3090#if !MOVE_SCALED_OFFSET_TO_PPS
     3091      if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
     3092#else
     3093      if( rpcSlice->getPPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
     3094#endif
     3095      {
     3096        READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc );
     3097      }
    30363098  }
    30373099#endif
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r834 r849  
    350350      for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ )
    351351      {
     352#if MOVE_SCALED_OFFSET_TO_PPS
     353#if O0098_SCALED_REF_LAYER_ID
     354        const Window scalEL = pcSlice->getPPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     355#else
     356        const Window scalEL = pcSlice->getPPS()->getScaledRefLayerWindow(i);
     357#endif
     358#else
    352359#if O0098_SCALED_REF_LAYER_ID
    353360        const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     
    355362        const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(i);
    356363#endif
     364#endif
     365#if REF_REGION_OFFSET
     366        const Window refEL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     367        Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0
     368                             && refEL.getWindowLeftOffset() == 0 && refEL.getWindowRightOffset() == 0 && refEL.getWindowTopOffset() == 0 && refEL.getWindowBottomOffset() == 0 );
     369#else
    357370        Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
     371#endif
    358372
    359373#if VPS_EXTN_DIRECT_REF_LAYERS
     
    763777
    764778#if P0312_VERT_PHASE_ADJ
     779#if MOVE_SCALED_OFFSET_TO_PPS
     780  if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 )
     781  {   
     782    for(Int i = 0; i < activePPS->getNumScaledRefLayerOffsets(); i++)
     783    {
     784      UInt scaledRefLayerId = activePPS->getScaledRefLayerId(i);
     785      if( activePPS->getVertPhasePositionEnableFlag( scaledRefLayerId ) )
     786      {
     787        printf("\nWarning: LayerId = %d: vert_phase_position_enable_flag[%d] = 1, however indication vert_phase_position_in_use_flag = 0\n", m_layerId, scaledRefLayerId );
     788        break;
     789      }
     790    }
     791  }
     792#else
    765793  if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 )
    766794  {   
     
    775803    }
    776804  }
     805#endif
    777806#endif
    778807
     
    17261755#endif
    17271756
     1757#if MOVE_SCALED_OFFSET_TO_PPS
     1758#if O0098_SCALED_REF_LAYER_ID
     1759        const Window &scalEL = pcSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     1760#else
     1761        const Window &scalEL = pcSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc);
     1762#endif
     1763#else
    17281764#if O0098_SCALED_REF_LAYER_ID
    17291765        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
     
    17311767        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
    17321768#endif
    1733 
     1769#endif
     1770
     1771#if REF_REGION_OFFSET
     1772        const Window &windowRL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
     1773        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth() - windowRL.getWindowLeftOffset() - windowRL.getWindowRightOffset();
     1774        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset();
     1775#else
    17341776        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
    17351777        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
     
    17401782        heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc );
    17411783#endif
     1784#endif
    17421785        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    17431786        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     
    17861829#else
    17871830#if Q0048_CGS_3D_ASYMLUT
    1788             m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
    1789 #else
    1790             m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1831#if MOVE_SCALED_OFFSET_TO_PPS
     1832          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     1833#else
     1834          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     1835#endif
     1836#else
     1837          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
    17911838#endif
    17921839#endif
     
    17941841#if O0194_JOINT_US_BITSHIFT
    17951842#if Q0048_CGS_3D_ASYMLUT
    1796             m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    1797 #else
    1798             m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1843#if REF_REGION_OFFSET
     1844          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, altRL );
     1845#else
     1846          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1847#endif
     1848#else
     1849          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
    17991850#endif
    18001851#else
  • branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp

    r825 r849  
    462462  TComSlice * pSlice = pCurPic->getSlice(pCurPic->getCurrSliceIdx());
    463463  UInt refLayerId = pSlice->getVPS()->getRefLayerId(pSlice->getLayerId(), refLayerIdc);
     464#if MOVE_SCALED_OFFSET_TO_PPS
     465  const Window &scalEL = pSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId);
     466#else
    464467  const Window &scalEL = pSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId);
     468#endif
    465469  TComPicYuv *pcRecPicBL = pSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
    466470  // borders of down-sampled picture
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r839 r849  
    273273    {
    274274      WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag() ? 1 : 0, "poc_reset_info_present_flag" );
     275#if REF_REGION_OFFSET
     276      WRITE_UVLC( pcPPS->getNumScaledRefLayerOffsets(),      "num_scaled_ref_layer_offsets" );
     277      for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++)
     278      {
     279        WRITE_CODE( pcPPS->getScaledRefLayerId(i), 6, "scaled_ref_layer_id" );
     280        WRITE_FLAG( pcPPS->getScaledRefLayerOffsetPresentFlag(i) ? 1 : 0, "scaled_ref_layer_offset_prsent_flag" );
     281        if (pcPPS->getScaledRefLayerOffsetPresentFlag(i))
     282        {
     283          Window scaledWindow = pcPPS->getScaledRefLayerWindow(i);
     284          WRITE_SVLC( scaledWindow.getWindowLeftOffset()   >> 1, "scaled_ref_layer_left_offset" );
     285          WRITE_SVLC( scaledWindow.getWindowTopOffset()    >> 1, "scaled_ref_layer_top_offset" );
     286          WRITE_SVLC( scaledWindow.getWindowRightOffset()  >> 1, "scaled_ref_layer_right_offset" );
     287          WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" );
     288        }
     289        WRITE_FLAG( pcPPS->getRefRegionOffsetPresentFlag(i) ? 1 : 0, "ref_region_offset_prsent_flag" );
     290        if (pcPPS->getRefRegionOffsetPresentFlag(i))
     291        {
     292          Window refWindow = pcPPS->getRefLayerWindow(i);
     293          WRITE_SVLC( refWindow.getWindowLeftOffset()   >> 1, "ref_layer_left_offset" );
     294          WRITE_SVLC( refWindow.getWindowTopOffset()    >> 1, "ref_layer_top_offset" );
     295          WRITE_SVLC( refWindow.getWindowRightOffset()  >> 1, "ref_layer_right_offset" );
     296          WRITE_SVLC( refWindow.getWindowBottomOffset() >> 1, "ref_layer_bottom_offset" );
     297        }
     298#if R0209_GENERIC_PHASE
     299        WRITE_FLAG( pcPPS->getResamplePhaseSetPresentFlag(i) ? 1 : 0, "resample_phase_set_present_flag" );
     300        if (pcPPS->getResamplePhaseSetPresentFlag(i))
     301        {
     302          WRITE_UVLC( pcPPS->getPhaseHorLuma(i), "phase_hor_luma" );
     303          WRITE_UVLC( pcPPS->getPhaseVerLuma(i), "phase_ver_luma" );
     304          WRITE_UVLC( pcPPS->getPhaseHorChroma(i) + 8, "phase_hor_chroma_plus8" );
     305          WRITE_UVLC( pcPPS->getPhaseVerChroma(i) + 8, "phase_ver_chroma_plus8" );
     306        }
     307#endif
     308      }
     309#else
     310#if MOVE_SCALED_OFFSET_TO_PPS
     311      WRITE_UVLC( pcPPS->getNumScaledRefLayerOffsets(),      "num_scaled_ref_layer_offsets" );
     312      for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++)
     313      {
     314        Window scaledWindow = pcPPS->getScaledRefLayerWindow(i);
     315#if O0098_SCALED_REF_LAYER_ID
     316        WRITE_CODE( pcPPS->getScaledRefLayerId(i), 6,          "scaled_ref_layer_id" );
     317#endif
     318        WRITE_SVLC( scaledWindow.getWindowLeftOffset()   >> 1, "scaled_ref_layer_left_offset" );
     319        WRITE_SVLC( scaledWindow.getWindowTopOffset()    >> 1, "scaled_ref_layer_top_offset" );
     320        WRITE_SVLC( scaledWindow.getWindowRightOffset()  >> 1, "scaled_ref_layer_right_offset" );
     321        WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" );
     322      }
     323#endif
     324#endif
    275325#if Q0048_CGS_3D_ASYMLUT
    276326      UInt uiPos = getNumberOfWrittenBits();
     
    672722  WRITE_FLAG( 0, "inter_view_mv_vert_constraint_flag" );
    673723
     724#if !MOVE_SCALED_OFFSET_TO_PPS
    674725  if( pcSPS->getLayerId() > 0 )
    675726  {
     
    690741    }
    691742  }
     743#endif
    692744}
    693745#endif //SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncCfg.h

    r825 r849  
    411411
    412412  Window   &getConformanceWindow()                           { return m_conformanceWindow; }
    413 #if P0312_VERT_PHASE_ADJ
     413#if P0312_VERT_PHASE_ADJ && !R0209_GENERIC_PHASE
    414414  Void      setConformanceWindow (Int confLeft, Int confRight, Int confTop, Int confBottom ) { m_conformanceWindow.setWindow (confLeft, confRight, confTop, confBottom, false); }
    415415#else
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r842 r849  
    11321132#endif
    11331133
     1134#if REF_REGION_OFFSET
     1135        const Window &windowRL  = m_pcEncTop->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
     1136        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth() - windowRL.getWindowLeftOffset() - windowRL.getWindowRightOffset();
     1137        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset();
     1138#else
    11341139        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
    11351140        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
     
    11401145        heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc );
    11411146#endif
     1147#endif
    11421148        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    11431149        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     
    12091215#if O0194_JOINT_US_BITSHIFT
    12101216#if Q0048_CGS_3D_ASYMLUT
    1211             m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
    1212 #else
    1213             m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1217#if REF_REGION_OFFSET
     1218          m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, altRL );
     1219#else
     1220          m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL );
     1221#endif
     1222#else
     1223          m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
    12141224#endif
    12151225#else
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r830 r849  
    779779        for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ )
    780780        {
     781#if MOVE_SCALED_OFFSET_TO_PPS
     782#if O0098_SCALED_REF_LAYER_ID
     783          const Window scalEL = getPPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     784#else
     785          const Window scalEL = getPPS()->getScaledRefLayerWindow(i);
     786#endif
     787#else
    781788#if O0098_SCALED_REF_LAYER_ID
    782789          const Window scalEL = getSPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     
    784791          const Window scalEL = getSPS()->getScaledRefLayerWindow(i);
    785792#endif
     793#endif
     794#if REF_REGION_OFFSET
     795          const Window altRL  = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     796          Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0
     797                               && altRL.getWindowLeftOffset() == 0 && altRL.getWindowRightOffset() == 0 && altRL.getWindowTopOffset() == 0 && altRL.getWindowBottomOffset() == 0);
     798#else
    786799          Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
     800#endif
    787801
    788802#if VPS_EXTN_DIRECT_REF_LAYERS
     
    839853        for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ )
    840854        {
     855#if MOVE_SCALED_OFFSET_TO_PPS
     856#if O0098_SCALED_REF_LAYER_ID
     857          const Window scalEL = getPPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     858#else
     859          const Window scalEL = getPPS()->getScaledRefLayerWindow(i);
     860#endif
     861#else
    841862#if O0098_SCALED_REF_LAYER_ID
    842863          const Window scalEL = getSPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     
    844865          const Window scalEL = getSPS()->getScaledRefLayerWindow(i);
    845866#endif
     867#endif
     868#if REF_REGION_OFFSET
     869          const Window altRL  = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i));
     870          Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0
     871                               && altRL.getWindowLeftOffset() == 0 && altRL.getWindowRightOffset() == 0 && altRL.getWindowTopOffset() == 0 && altRL.getWindowBottomOffset() == 0);
     872#else
    846873          Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
     874#endif
    847875
    848876#if VPS_EXTN_DIRECT_REF_LAYERS
     
    918946  m_cSPS.setLayerId(m_layerId);
    919947#endif
     948#if !MOVE_SCALED_OFFSET_TO_PPS
    920949  m_cSPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets);
    921950  for(Int i = 0; i < m_cSPS.getNumScaledRefLayerOffsets(); i++)
     
    929958#endif
    930959  }
     960#endif
    931961#endif //SVC_EXTENSION
    932962  ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL();
     
    12051235  }
    12061236#endif
     1237#if MOVE_SCALED_OFFSET_TO_PPS
     1238  m_cPPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets);
     1239  for(Int i = 0; i < m_cPPS.getNumScaledRefLayerOffsets(); i++)
     1240  {
     1241#if O0098_SCALED_REF_LAYER_ID
     1242    m_cPPS.setScaledRefLayerId(i, m_scaledRefLayerId[i]);
     1243#endif
     1244    m_cPPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i];
     1245#if REF_REGION_OFFSET
     1246    m_cPPS.getRefLayerWindow(i) = m_refLayerWindow[i];
     1247    m_cPPS.setScaledRefLayerOffsetPresentFlag( m_scaledRefLayerId[i], m_scaledRefLayerOffsetPresentFlag[i] );
     1248    m_cPPS.setRefRegionOffsetPresentFlag( m_scaledRefLayerId[i], m_refRegionOffsetPresentFlag[i] );
     1249#endif
     1250#if R0209_GENERIC_PHASE
     1251    m_cPPS.setResamplePhaseSetPresentFlag( m_scaledRefLayerId[i], m_resamplePhaseSetPresentFlag[i] );
     1252    m_cPPS.setPhaseHorLuma( m_scaledRefLayerId[i], m_phaseHorLuma[i] );
     1253    m_cPPS.setPhaseVerLuma( m_scaledRefLayerId[i], m_phaseVerLuma[i] );
     1254    m_cPPS.setPhaseHorChroma( m_scaledRefLayerId[i], m_phaseHorChroma[i] );
     1255    m_cPPS.setPhaseVerChroma( m_scaledRefLayerId[i], m_phaseVerChroma[i] );
     1256#endif
     1257#if P0312_VERT_PHASE_ADJ
     1258    m_cPPS.setVertPhasePositionEnableFlag( m_scaledRefLayerId[i], m_scaledRefLayerWindow[i].getVertPhasePositionEnableFlag() );
     1259#endif
     1260  }
     1261#endif
    12071262#if Q0048_CGS_3D_ASYMLUT
    12081263  m_cPPS.setCGSFlag( m_nCGSFlag );
     
    16821737  return win;
    16831738}
     1739#if REF_REGION_OFFSET
     1740Window& TEncTop::getRefLayerWindowForLayer(Int layerId)
     1741{
     1742  static Window win;
     1743
     1744  for (Int i = 0; i < m_numScaledRefLayerOffsets; i++)
     1745  {
     1746    if (layerId == m_refLayerId[i])
     1747    {
     1748      return m_refLayerWindow[i];
     1749    }
     1750  }
     1751
     1752  win.resetWindow();  // reference offsets are inferred to be zero when not present
     1753  return win;
     1754}
     1755#endif
    16841756#endif
    16851757
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.h

    r820 r849  
    136136#endif
    137137  Window                  m_scaledRefLayerWindow[MAX_LAYERS];
     138#if REF_REGION_OFFSET
     139  UInt                    m_numRefLayerOffsets;
     140  UInt                    m_refLayerId[MAX_LAYERS];
     141  Window                  m_refLayerWindow[MAX_LAYERS];
     142  Bool                    m_scaledRefLayerOffsetPresentFlag[MAX_LAYERS];
     143  Bool                    m_refRegionOffsetPresentFlag[MAX_LAYERS];
     144#endif
     145#if R0209_GENERIC_PHASE
     146  Int                     m_phaseHorLuma  [MAX_LAYERS];
     147  Int                     m_phaseVerLuma  [MAX_LAYERS];
     148  Int                     m_phaseHorChroma[MAX_LAYERS];
     149  Int                     m_phaseVerChroma[MAX_LAYERS];
     150  Int                     m_resamplePhaseSetPresentFlag[MAX_LAYERS];
     151#endif
    138152#if P0312_VERT_PHASE_ADJ
    139153  Bool                    m_vertPhasePositionEnableFlag[MAX_LAYERS];
     
    229243#endif
    230244  Window&   getScaledRefLayerWindow(Int x)                 { return m_scaledRefLayerWindow[x];        }
     245#if REF_REGION_OFFSET
     246  Void      setNumRefLayerOffsets(Int x) { m_numRefLayerOffsets = x; }
     247  UInt      getNumRefLayerOffsets() { return m_numRefLayerOffsets; }
     248  Void      setRefLayerId(Int x, UInt id) { m_refLayerId[x] = id;   }
     249  UInt      getRefLayerId(Int x)          { return m_refLayerId[x]; }
     250  Window&   getRefLayerWindowForLayer(Int layerId);
     251  Window&   getRefLayerWindow(Int x)            { return m_refLayerWindow[x]; }
     252  Bool      getScaledRefLayerOffsetPresentFlag(Int x) { return m_scaledRefLayerOffsetPresentFlag[x]; }
     253  Void      setScaledRefLayerOffsetPresentFlag(Int x, Bool b) { m_scaledRefLayerOffsetPresentFlag[x] = b; }
     254  Bool      getRefRegionOffsetPresentFlag(Int x) { return m_refRegionOffsetPresentFlag[x]; }
     255  Void      setRefRegionOffsetPresentFlag(Int x, Bool b) { m_refRegionOffsetPresentFlag[x] = b; }
     256#endif
    231257#if P0312_VERT_PHASE_ADJ
    232258  Void      setVertPhasePositionEnableFlag(Int x, Bool b)  { m_vertPhasePositionEnableFlag[x] = b;    }
    233259  UInt      getVertPhasePositionEnableFlag(Int x)          { return m_vertPhasePositionEnableFlag[x]; }
     260#endif
     261#if R0209_GENERIC_PHASE
     262  Int getPhaseHorLuma(Int x) { return m_phaseHorLuma[x]; }
     263  Int getPhaseVerLuma(Int x) { return m_phaseVerLuma[x]; }
     264  Int getPhaseHorChroma(Int x) { return m_phaseHorChroma[x]; }
     265  Int getPhaseVerChroma(Int x) { return m_phaseVerChroma[x]; }
     266  Void setPhaseHorLuma(Int x, Int val) { m_phaseHorLuma[x] = val; }
     267  Void setPhaseVerLuma(Int x, Int val) { m_phaseVerLuma[x] = val; }
     268  Void setPhaseHorChroma(Int x, Int val) { m_phaseHorChroma[x] = val; }
     269  Void setPhaseVerChroma(Int x, Int val) { m_phaseVerChroma[x] = val; }
     270  Bool getResamplePhaseSetPresentFlag(Int x) { return m_resamplePhaseSetPresentFlag[x]; }
     271  Void setResamplePhaseSetPresentFlag(Int x, Bool b) { m_resamplePhaseSetPresentFlag[x] = b; }
    234272#endif
    235273
Note: See TracChangeset for help on using the changeset viewer.