Changeset 494 in SHVCSoftware for trunk


Ignore:
Timestamp:
16 Nov 2013, 22:09:25 (11 years ago)
Author:
seregin
Message:

reintegrate branch SHM-4.0-dev

Location:
trunk
Files:
86 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/cfg

  • trunk/cfg/encoder_intra_he10.cfg

    r2 r494  
    4343
    4444#=========== Misc. ============
    45 InternalBitDepth              : 10          # internal bit-depth = BitDepth + BitIncrement
     45#InternalBitDepth             : 10          # codec operating bit-depth
     46InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     47InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    4648
    4749#=========== Coding Tools =================
  • trunk/cfg/encoder_intra_main.cfg

    r310 r494  
    4848
    4949#=========== Misc. ============
    50 InternalBitDepth              : 8           # codec operating bit-depth
     50#InternalBitDepth             : 8           # codec operating bit-depth
     51InternalBitDepth0             : 8           # codec operating bit-depth for layer 0
     52InternalBitDepth1             : 8           # codec operating bit-depth for layer 1
    5153
    5254#=========== Coding Tools =================
  • trunk/cfg/encoder_intra_main10.cfg

    r310 r494  
    4848
    4949#=========== Misc. ============
    50 InternalBitDepth              : 10          # codec operating bit-depth
     50#InternalBitDepth             : 10          # codec operating bit-depth
     51InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     52InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5153
    5254#=========== Coding Tools =================
  • trunk/cfg/encoder_lowdelay_P_he10.cfg

    r310 r494  
    5050
    5151#=========== Misc. ============
    52 InternalBitDepth              : 10          # internal bit-depth = BitDepth + BitIncrement
     52#InternalBitDepth             : 10          # internal bit-depth = BitDepth + BitIncrement
     53InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     54InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5355
    5456#=========== Coding Tools =================
  • trunk/cfg/encoder_lowdelay_P_main.cfg

    r442 r494  
    5353
    5454#=========== Misc. ============
    55 InternalBitDepth              : 8           # codec operating bit-depth
     55#InternalBitDepth             : 8           # codec operating bit-depth
     56InternalBitDepth0             : 8           # codec operating bit-depth for layer 0
     57InternalBitDepth1             : 8           # codec operating bit-depth for layer 1
    5658
    5759#=========== Coding Tools =================
  • trunk/cfg/encoder_lowdelay_P_main10.cfg

    r442 r494  
    5555
    5656#=========== Misc. ============
    57 InternalBitDepth              : 10          # codec operating bit-depth
     57#InternalBitDepth             : 10          # codec operating bit-depth
     58InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     59InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5860
    5961#=========== Coding Tools =================
  • trunk/cfg/encoder_lowdelay_he10.cfg

    r310 r494  
    4848
    4949#=========== Misc. ============
    50 InternalBitDepth              : 10          # internal bit-depth = BitDepth + BitIncrement
     50#InternalBitDepth             : 10          # codec operating bit-depth
     51InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     52InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5153
    5254#=========== Coding Tools =================
  • trunk/cfg/encoder_lowdelay_main.cfg

    r442 r494  
    5353
    5454#=========== Misc. ============
    55 InternalBitDepth              : 8           # codec operating bit-depth
     55#InternalBitDepth             : 8           # codec operating bit-depth
     56InternalBitDepth0             : 8           # codec operating bit-depth for layer 0
     57InternalBitDepth1             : 8           # codec operating bit-depth for layer 1
    5658
    5759#=========== Coding Tools =================
  • trunk/cfg/encoder_lowdelay_main10.cfg

    r442 r494  
    5353
    5454#=========== Misc. ============
    55 InternalBitDepth              : 10          # codec operating bit-depth
     55#InternalBitDepth             : 10          # codec operating bit-depth
     56InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     57InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    5658
    5759#=========== Coding Tools =================
  • trunk/cfg/encoder_randomaccess_he10.cfg

    r345 r494  
    2828Frame8:  B    7   4        0.68     0           2                4         -1 -3 -7 1             1      -2        5         1 1 1 1 0
    2929
    30 FrameEL1:  B    8   1        0.442    0           4                4         -8 -10 -12 -16         0
    31 FrameEL2:  B    4   2        0.3536   0           2                3         -4 -6  4               1       4        5         1 1 0 0 1
    32 FrameEL3:  B    2   3        0.3536   0           2                4         -2 -4  2 6             1       2        4         1 1 1 1
    33 FrameEL4:  B    1   4        0.68     0           2                4         -1  1  3 7             1       1        5         1 0 1 1 1
    34 FrameEL5:  B    3   4        0.68     0           2                4         -1 -3  1 5             1      -2        5         1 1 1 1 0
    35 FrameEL6:  B    6   3        0.3536   0           2                4         -2 -4 -6 2             0
    36 FrameEL7:  B    5   4        0.68     0           2                4         -1 -5  1 3             0
    37 FrameEL8:  B    7   4        0.68     0           2                4         -1 -3 -7 1             0
    38 
    3930ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    4031
     
    6253
    6354#=========== Misc. ============
    64 InternalBitDepth              : 10          # internal bit-depth = BitDepth + BitIncrement
     55#InternalBitDepth             : 10          # codec operating bit-depth
     56InternalBitDepth0             : 10          # codec operating bit-depth for layer 0
     57InternalBitDepth1             : 10          # codec operating bit-depth for layer 1
    6558
    6659#=========== Coding Tools =================
  • trunk/cfg/encoder_randomaccess_main.cfg

    r442 r494  
    3131Frame7:  B    5   4        0.68     0            0              0           2                4         -1 -5  1 3             1       1        5         1 0 1 1 1         0
    3232Frame8:  B    7   4        0.68     0            0              0           2                4         -1 -3 -7 1             1      -2        5         1 1 1 1 0         0
    33 
    34 FrameEL1:  B    8   1        0.442    0            0              0           4                4         -8 -10 -12 -16         0                                          0
    35 FrameEL2:  B    4   2        0.3536   0            0              0           2                3         -4 -6  4               1       4        5         1 1 0 0 1       0
    36 FrameEL3:  B    2   3        0.3536   0            0              0           2                4         -2 -4  2 6             1       2        4         1 1 1 1         0
    37 FrameEL4:  B    1   4        0.68     0            0              0           2                4         -1  1  3 7             1       1        5         1 0 1 1 1       0
    38 FrameEL5:  B    3   4        0.68     0            0              0           2                4         -1 -3  1 5             1      -2        5         1 1 1 1 0       0
    39 FrameEL6:  B    6   3        0.3536   0            0              0           2                4         -2 -4 -6 2             0                                          1    1 1 0 1
    40 FrameEL7:  B    5   4        0.68     0            0              0           2                4         -1 -5  1 3             0                                          0
    41 FrameEL8:  B    7   4        0.68     0            0              0           2                4         -1 -3 -7 1             0                                          1    1 1 0 1
    4233#=========== Motion Search =============
    4334FastSearch                    : 1           # 0:Full search  1:TZ search
     
    6556
    6657#=========== Misc. ============
    67 InternalBitDepth              : 8           # codec operating bit-depth
     58#InternalBitDepth             : 8           # codec operating bit-depth
     59InternalBitDepth0             : 8           # codec operating bit-depth for layer 0
     60InternalBitDepth1             : 8           # codec operating bit-depth for layer 1
    6861
    6962#=========== Coding Tools =================
  • trunk/cfg/encoder_randomaccess_main10.cfg

    r442 r494  
    3131Frame7:  B    5   4        0.68     0            0              0           2                4         -1 -5  1 3             1       1        5         1 0 1 1 1         0
    3232Frame8:  B    7   4        0.68     0            0              0           2                4         -1 -3 -7 1             1      -2        5         1 1 1 1 0         0
    33 
    34 FrameEL1:  B    8   1        0.442    0            0              0           4                4         -8 -10 -12 -16         0                                          0
    35 FrameEL2:  B    4   2        0.3536   0            0              0           2                3         -4 -6  4               1       4        5         1 1 0 0 1       0
    36 FrameEL3:  B    2   3        0.3536   0            0              0           2                4         -2 -4  2 6             1       2        4         1 1 1 1         0
    37 FrameEL4:  B    1   4        0.68     0            0              0           2                4         -1  1  3 7             1       1        5         1 0 1 1 1       0
    38 FrameEL5:  B    3   4        0.68     0            0              0           2                4         -1 -3  1 5             1      -2        5         1 1 1 1 0       0
    39 FrameEL6:  B    6   3        0.3536   0            0              0           2                4         -2 -4 -6 2             0                                          1    1 1 0 1
    40 FrameEL7:  B    5   4        0.68     0            0              0           2                4         -1 -5  1 3             0                                          0
    41 FrameEL8:  B    7   4        0.68     0            0              0           2                4         -1 -3 -7 1             0                                          1    1 1 0 1
    4233#=========== Motion Search =============
    4334FastSearch                    : 1           # 0:Full search  1:TZ search
     
    6556
    6657#=========== Misc. ============
    67 InternalBitDepth              : 10          # codec operating bit-depth
     58#InternalBitDepth             : 10           # codec operating bit-depth
     59InternalBitDepth0             : 10           # codec operating bit-depth for layer 0
     60InternalBitDepth1             : 10           # codec operating bit-depth for layer 1
    6861
    6962#=========== Coding Tools =================
  • trunk/cfg/layers.cfg

    r442 r494  
    33ScalabilityMask1              : 0           # Multiview
    44ScalabilityMask2              : 1           # Scalable
     5ScalabilityMask3              : 0           # Auxiliary pictures
    56AdaptiveResolutionChange      : 0           # Resolution change frame (0: disable)
    67MaxTidRefPresentFlag          : 1           # max_tid_ref_present_flag (0=not present, 1=present(default))
  • trunk/cfg/per-sequence-svc/BQTerrace-1.5x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 600         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : BQTerrace_1280x720_60_zerophase_0.9pi.yuv
    77FrameRate0                    : 60          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1280        # Input  frame width
    910SourceHeight0                 : 720         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 64          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : BQTerrace_1920x1080_60.yuv
    1617FrameRate1                    : 60          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 64          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/BQTerrace-2x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 600         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : BQTerrace_960x540_60_zerophase_0.9pi.yuv
    77FrameRate0                    : 60          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 960         # Input  frame width
    910SourceHeight0                 : 540         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 64          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : BQTerrace_1920x1080_60.yuv
    1617FrameRate1                    : 60          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 64          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/BQTerrace-SNR.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 600         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : BQTerrace_1920x1080_60.yuv
    77FrameRate0                    : 60          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1920        # Input  frame width
    910SourceHeight0                 : 1080        # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 64          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : BQTerrace_1920x1080_60.yuv
    1617FrameRate1                    : 60          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 0                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 0           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 64          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/BasketballDrive-1.5x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 500         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : BasketballDrive_1280x720_50_zerophase_0.9pi.yuv
    77FrameRate0                    : 50          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1280        # Input  frame width
    910SourceHeight0                 : 720         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 48          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : BasketballDrive_1920x1080_50.yuv
    1617FrameRate1                    : 50          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/BasketballDrive-2x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 500         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : BasketballDrive_960x540_50_zerophase_0.9pi.yuv
    77FrameRate0                    : 50          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 960         # Input  frame width
    910SourceHeight0                 : 540         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 48          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : BasketballDrive_1920x1080_50.yuv
    1617FrameRate1                    : 50          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/BasketballDrive-SNR.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 500         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : BasketballDrive_1920x1080_50.yuv
    77FrameRate0                    : 50          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1920        # Input  frame width
    910SourceHeight0                 : 1080        # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 48          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : BasketballDrive_1920x1080_50.yuv
    1617FrameRate1                    : 50          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 0                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 0           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/Cactus-1.5x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 500         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : Cactus_1280x720_50_zerophase_0.9pi.yuv
    77FrameRate0                    : 50          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1280        # Input  frame width
    910SourceHeight0                 : 720         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 48          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : Cactus_1920x1080_50.yuv
    1617FrameRate1                    : 50          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/Cactus-2x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 500         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : Cactus_960x540_50_zerophase_0.9pi.yuv
    77FrameRate0                    : 50          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 960         # Input  frame width
    910SourceHeight0                 : 540         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 48          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : Cactus_1920x1080_50.yuv
    1617FrameRate1                    : 50          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/Cactus-SNR.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 500         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : Cactus_1920x1080_50.yuv
    77FrameRate0                    : 50          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1920        # Input  frame width
    910SourceHeight0                 : 1080        # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 48          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : Cactus_1920x1080_50.yuv
    1617FrameRate1                    : 50          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 0                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 0           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 48          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/Kimono-1.5x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 240         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : Kimono1_1280x720_24_zerophase_0.9pi.yuv
    77FrameRate0                    : 24          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1280        # Input  frame width
    910SourceHeight0                 : 720         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 24          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : Kimono1_1920x1080_24.yuv
    1617FrameRate1                    : 24          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/Kimono-2x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 240         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    6 InputFile0                    : Kimono1_960x540_24_zerophase_0.9pi.yuv
     6InputFile0                    : O:/Kimono1_960x540_24_zerophase_0.9pi.yuv
    77FrameRate0                    : 24          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 960         # Input  frame width
    910SourceHeight0                 : 540         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 24          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
    1314QP0                           : 22
    1415
    15 InputFile1                    : Kimono1_1920x1080_24.yuv
     16InputFile1                    : O:/Kimono1_1920x1080_24.yuv
    1617FrameRate1                    : 24          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/Kimono-SNR.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 240         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : Kimono1_1920x1080_24.yuv
    77FrameRate0                    : 24          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1920        # Input  frame width
    910SourceHeight0                 : 1080        # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 24          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : Kimono1_1920x1080_24.yuv
    1617FrameRate1                    : 24          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 0                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 0           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/ParkScene-1.5x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 240         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : ParkScene_1280x720_24_zerophase_0.9pi.yuv
    77FrameRate0                    : 24          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1280        # Input  frame width
    910SourceHeight0                 : 720         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 24          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : ParkScene_1920x1080_24.yuv
    1617FrameRate1                    : 24          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/ParkScene-2x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 240         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : ParkScene_960x540_24_zerophase_0.9pi.yuv
    77FrameRate0                    : 24          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 960         # Input  frame width
    910SourceHeight0                 : 540         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 24          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : ParkScene_1920x1080_24.yuv
    1617FrameRate1                    : 24          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/ParkScene-SNR.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 240         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : ParkScene_1920x1080_24.yuv
    77FrameRate0                    : 24          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1920        # Input  frame width
    910SourceHeight0                 : 1080        # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 24          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : ParkScene_1920x1080_24.yuv
    1617FrameRate1                    : 24          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 1920        # Input  frame width
    1820SourceHeight1                 : 1080        # Input  frame height
    19 RepFormatIdx1                             : 0                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 0           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 24          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/PeopleOnStreet-2x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 150         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : PeopleOnStreet_1280x800_30_crop_zerophase_0.9pi.yuv
    77FrameRate0                    : 30          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1280        # Input  frame width
    910SourceHeight0                 : 800         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 32          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : PeopleOnStreet_2560x1600_30_crop.yuv
    1617FrameRate1                    : 30          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 2560        # Input  frame width
    1820SourceHeight1                 : 1600        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 32          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/PeopleOnStreet-SNR.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 150         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : PeopleOnStreet_2560x1600_30_crop.yuv
    77FrameRate0                    : 30          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 2560        # Input  frame width
    910SourceHeight0                 : 1600        # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 32          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : PeopleOnStreet_2560x1600_30_crop.yuv
    1617FrameRate1                    : 30          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 2560        # Input  frame width
    1820SourceHeight1                 : 1600        # Input  frame height
    19 RepFormatIdx1                             : 0                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 0           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 32          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/Traffic-2x.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 150         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : Traffic_1280x800_30_crop_zerophase_0.9pi.yuv
    77FrameRate0                    : 30          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 1280        # Input  frame width
    910SourceHeight0                 : 800         # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 32          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : Traffic_2560x1600_30_crop.yuv
    1617FrameRate1                    : 30          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 2560        # Input  frame width
    1820SourceHeight1                 : 1600        # Input  frame height
    19 RepFormatIdx1                             : 1                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 1           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 32          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/cfg/per-sequence-svc/Traffic-SNR.cfg

    r442 r494  
    1 InputBitDepth                 : 8           # Input bitdepth
    21FrameSkip                     : 0           # Number of frames to be skipped in input
    32FramesToBeEncoded             : 150         # Number of frames to be coded
     3PhaseAlignment                : 0           # Sample location alignment between layers (0: zero position aligned, 1: central position aligned)
    44
    55#======== File I/O ===============
    66InputFile0                    : Traffic_2560x1600_30_crop.yuv
    77FrameRate0                    : 30          # Frame Rate per second
     8InputBitDepth0                : 8           # Input bitdepth for layer 0
    89SourceWidth0                  : 2560        # Input  frame width
    910SourceHeight0                 : 1600        # Input  frame height
    10 RepFormatIdx0                             : 0                   # Index of corresponding rep_format() in the VPS
     11RepFormatIdx0                 : 0           # Index of corresponding rep_format() in the VPS
    1112IntraPeriod0                  : 32          # Period of I-Frame ( -1 = only first)
    1213ConformanceMode0              : 1           # conformance mode
     
    1516InputFile1                    : Traffic_2560x1600_30_crop.yuv
    1617FrameRate1                    : 30          # Frame Rate per second
     18InputBitDepth1                : 8           # Input bitdepth for layer 1
    1719SourceWidth1                  : 2560        # Input  frame width
    1820SourceHeight1                 : 1600        # Input  frame height
    19 RepFormatIdx1                             : 0                   # Index of corresponding rep_format() in the VPS
     21RepFormatIdx1                 : 0           # Index of corresponding rep_format() in the VPS
    2022IntraPeriod1                  : 32          # Period of I-Frame ( -1 = only first)
    2123ConformanceMode1              : 1           # conformance mode
  • trunk/source

  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r442 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    8080    m_pchBitstreamFile = NULL;
    8181  }
    82 #if SVC_EXTENSION   
     82#if SVC_EXTENSION
    8383  for( Int i = 0; i < m_tgtLayerId; i++ )
    8484  {
     
    8888      m_pchReconFile[i] = NULL;
    8989    }
    90   } 
     90  }
    9191#if AVC_BASE
    9292  if( m_pchBLReconFile )
     
    225225    if (bNewPicture || !bitstreamFile)
    226226    {
     227#if O0194_DIFFERENT_BITDEPTH_EL_BL
     228      //Bug fix: The bit depth was not set correctly for each layer when doing DBF
     229      g_bitDepthY = g_bitDepthYLayer[curLayerId];
     230      g_bitDepthC = g_bitDepthCLayer[curLayerId];
     231#endif
    227232      m_acTDecTop[curLayerId].executeLoopFilters(poc, pcListPic);
    228233#if EARLY_REF_PIC_MARKING
     
    235240      if ( m_pchReconFile[curLayerId] && !openedReconFile[curLayerId] )
    236241      {
    237         if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }       
     242        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    238243        if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    239244
     
    242247        openedReconFile[curLayerId] = true;
    243248      }
    244       if ( bNewPicture && bNewPOC && 
     249      if ( bNewPicture && bNewPOC &&
    245250           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    246251            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
     
    276281  }
    277282#endif
    278   pcBLPic.destroy(); 
     283  pcBLPic.destroy();
    279284
    280285  for(UInt layer = layerIdmin; layer <= m_tgtLayerId; layer++)
     
    285290    m_acTDecTop[layer].deletePicBuffer();
    286291  }
    287  
     292
    288293  // destroy internal classes
    289294  xDestroyDecLib();
     
    394399        openedReconFile = true;
    395400      }
    396       if ( bNewPicture && 
     401      if ( bNewPicture &&
    397402           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    398403            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
     
    410415    }
    411416  }
    412  
     417
    413418#if SYNTAX_OUTPUT
    414419  if( streamSyntaxFile.is_open() )
     
    417422  }
    418423#endif
    419  
     424
    420425  xFlushOutput( pcListPic );
    421426  // delete buffers
    422427  m_cTDecTop.deletePicBuffer();
    423  
     428
    424429  // destroy internal classes
    425430  xDestroyDecLib();
     
    435440#if SVC_EXTENSION
    436441  // initialize global variables
    437   initROM(); 
     442  initROM();
    438443
    439444  for(UInt layer = 0; layer <= m_tgtLayerId; layer++)
     
    445450    m_acTDecTop[layer].create();
    446451
    447     m_acTDecTop[layer].setLayerDec(m_apcTDecTop);   
     452    m_acTDecTop[layer].setLayerDec(m_apcTDecTop);
    448453  }
    449454#else
     
    474479    m_cTVideoIOYuvReconFile. close();
    475480  }
    476  
     481
    477482  // destroy decoder class
    478483  m_cTDecTop.destroy();
     
    566571
    567572#else
     573#if O0194_DIFFERENT_BITDEPTH_EL_BL
     574          // Compile time bug-fix
     575          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     576#else
    568577          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     578#endif
    569579            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    570580            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    723733  {
    724734    return;
    725   } 
     735  }
    726736  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    727737
     
    759769
    760770#else
     771#if O0194_DIFFERENT_BITDEPTH_EL_BL
     772          // Compile time bug-fix
     773          m_acTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     774#else
    761775          m_cTVideoIOYuvReconFile[layerId].write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     776#endif
    762777            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    763778            conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    913928        pcPic = NULL;
    914929      }
    915 #endif   
     930#endif
    916931#endif
    917932      iterPic++;
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r442 r494  
    221221  }
    222222#endif
    223 #if EXTERNAL_USEDBYCURR_N0082
    224   if(entry.m_numRefPics>0){
    225     in>>entry.m_UseExtusedByCurrPic;
    226     if(entry.m_UseExtusedByCurrPic)
    227     {
    228       for ( Int i = 0; i < entry.m_numRefPics; i++ )
    229       {
    230         in>>entry.m_ExtusedByCurrPic[i];
    231       }
    232     }
    233   }
    234 #endif
    235223  return in;
    236224}
     225
     226#if AUXILIARY_PICTURES
     227static inline ChromaFormat numberToChromaFormat(const Int val)
     228{
     229  switch (val)
     230  {
     231    case 400: return CHROMA_400; break;
     232    case 420: return CHROMA_420; break;
     233    case 422: return CHROMA_422; break;
     234    case 444: return CHROMA_444; break;
     235    default:  return NUM_CHROMA_FORMAT;
     236  }
     237}
     238#endif
    237239
    238240#if SVC_EXTENSION
     
    362364  Int*    cfg_IntraPeriod   [MAX_LAYERS];
    363365  Int*    cfg_conformanceMode  [MAX_LAYERS];
     366#if LAYER_CTB
     367  // coding unit (CU) definition
     368  UInt*      cfg_uiMaxCUWidth[MAX_LAYERS];                                   ///< max. CU width in pixel
     369  UInt*      cfg_uiMaxCUHeight[MAX_LAYERS];                                  ///< max. CU height in pixel
     370  UInt*      cfg_uiMaxCUDepth[MAX_LAYERS];                                   ///< max. CU depth
     371 
     372  // transfom unit (TU) definition
     373  UInt*      cfg_uiQuadtreeTULog2MaxSize[MAX_LAYERS];
     374  UInt*      cfg_uiQuadtreeTULog2MinSize[MAX_LAYERS];
     375 
     376  UInt*      cfg_uiQuadtreeTUMaxDepthInter[MAX_LAYERS];
     377  UInt*      cfg_uiQuadtreeTUMaxDepthIntra[MAX_LAYERS];
     378#endif
     379#if AUXILIARY_PICTURES
     380  Int      cfg_tmpChromaFormatIDC  [MAX_LAYERS];
     381  Int      cfg_tmpInputChromaFormat[MAX_LAYERS];
     382  Int*     cfg_auxId               [MAX_LAYERS];
     383#endif
    364384#if VPS_EXTN_DIRECT_REF_LAYERS
    365385#if M0457_PREDICTION_INDICATIONS
     
    379399  string* cfg_predLayerIdsPtr    [MAX_LAYERS];
    380400#endif
    381 #if SCALED_REF_LAYER_OFFSETS
    382401  string    cfg_scaledRefLayerLeftOffset [MAX_LAYERS];
    383402  string    cfg_scaledRefLayerTopOffset [MAX_LAYERS];
     
    390409  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
    391410  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
    392 #endif
    393411#if RC_SHVC_HARMONIZATION
    394412  Bool*   cfg_RCEnableRateControl  [MAX_LAYERS];
     
    400418  Bool*   cfg_RCForceIntraQP       [MAX_LAYERS];
    401419#endif
     420#if O0194_DIFFERENT_BITDEPTH_EL_BL
     421  Int*    cfg_InputBitDepthY    [MAX_LAYERS];
     422  Int*    cfg_InternalBitDepthY [MAX_LAYERS];
     423  Int*    cfg_InputBitDepthC    [MAX_LAYERS];
     424  Int*    cfg_InternalBitDepthC [MAX_LAYERS];
     425  Int*    cfg_OutputBitDepthY   [MAX_LAYERS];
     426  Int*    cfg_OutputBitDepthC   [MAX_LAYERS];
     427#endif
    402428#if N0120_MAX_TID_REF_CFG
    403429  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
     
    416442    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    417443    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
     444#if LAYER_CTB
     445    // coding unit (CU) definition
     446    cfg_uiMaxCUWidth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUWidth;
     447    cfg_uiMaxCUHeight[layer] = &m_acLayerCfg[layer].m_uiMaxCUHeight;
     448    cfg_uiMaxCUDepth[layer]  = &m_acLayerCfg[layer].m_uiMaxCUDepth;
     449
     450    // transfom unit (TU) definition.
     451    cfg_uiQuadtreeTULog2MaxSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize;
     452    cfg_uiQuadtreeTULog2MinSize[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize;
     453
     454    cfg_uiQuadtreeTUMaxDepthInter[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter;
     455    cfg_uiQuadtreeTUMaxDepthIntra[layer] = &m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra;
     456#endif
    418457#if VPS_EXTN_DIRECT_REF_LAYERS
    419458#if M0457_PREDICTION_INDICATIONS
     
    429468    cfg_predLayerIdsPtr     [layer]  = &cfg_predLayerIds[layer];
    430469#endif
    431 #if SCALED_REF_LAYER_OFFSETS
    432470    cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets;
    433471    for(Int i = 0; i < MAX_LAYERS; i++)
     
    438476      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
    439477    }
    440 #endif
    441478#if RC_SHVC_HARMONIZATION
    442479    cfg_RCEnableRateControl[layer]   = &m_acLayerCfg[layer].m_RCEnableRateControl;
     
    448485    cfg_RCForceIntraQP[layer]        = &m_acLayerCfg[layer].m_RCForceIntraQP;
    449486#endif
     487#if O0194_DIFFERENT_BITDEPTH_EL_BL
     488  cfg_InputBitDepthY   [layer] = &m_acLayerCfg[layer].m_inputBitDepthY;
     489  cfg_InternalBitDepthY[layer] = &m_acLayerCfg[layer].m_internalBitDepthY;
     490  cfg_InputBitDepthC   [layer] = &m_acLayerCfg[layer].m_inputBitDepthC;
     491  cfg_InternalBitDepthC[layer] = &m_acLayerCfg[layer].m_internalBitDepthC;
     492  cfg_OutputBitDepthY  [layer] = &m_acLayerCfg[layer].m_outputBitDepthY;
     493  cfg_OutputBitDepthC  [layer] = &m_acLayerCfg[layer].m_outputBitDepthC;
     494#endif
    450495#if N0120_MAX_TID_REF_CFG
    451496    cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
    452497#endif
     498#if AUXILIARY_PICTURES
     499    cfg_auxId[layer]                = &m_acLayerCfg[layer].m_auxId;
     500#endif
    453501  }
    454502#if AVC_BASE
     
    461509  string  cfg_tileSets;
    462510#endif
    463 #else
     511#else //SVC_EXTENSION
    464512  string cfg_InputFile;
    465513  string cfg_BitstreamFile;
    466514  string cfg_ReconFile;
    467515  string cfg_dQPFile;
    468 #endif
     516#endif //SVC_EXTENSION
    469517  string cfg_ColumnWidth;
    470518  string cfg_RowHeight;
     
    487535  ("FrameRate%d,-fr%d",       cfg_FrameRate,  0, MAX_LAYERS, "Frame rate for layer %d")
    488536  ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
     537#if O0215_PHASE_ALIGNMENT
     538  ("PhaseAlignment",          m_phaseAlignFlag, false, "indicate the sample location alignment between layers (0: zero position aligned, 1: central position aligned)")
     539#endif
    489540#if REPN_FORMAT_IN_VPS
    490541  ("RepFormatIdx%d",          cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS")
     
    504555#endif
    505556  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
     557#if AUXILIARY_PICTURES
     558  ("InputChromaFormat%d",     cfg_tmpInputChromaFormat,  420, MAX_LAYERS, "InputChromaFormatIDC for layer %d")
     559  ("ChromaFormatIDC%d,-cf",   cfg_tmpChromaFormatIDC,    420, MAX_LAYERS, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat) for layer %d")
     560  ("AuxId%d",                 cfg_auxId,                 0,   MAX_LAYERS, "Auxilary picture ID for layer %d (0: Not aux pic, 1: Alpha plane, 2: Depth picture, 3: Cb enh, 4: Cr enh")
     561#endif
    506562  ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    507563#if SCALABILITY_MASK_E0104
    508564  ("ScalabilityMask1",        m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)")
    509565  ("ScalabilityMask2",        m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" )
     566#if AUXILIARY_PICTURES
     567  ("ScalabilityMask3",        m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" )
     568#endif
    510569#else
    511570  ("ScalabilityMask0",        m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)")
     
    513572#endif
    514573  ("BitstreamFile,b",         cfg_BitstreamFile, string(""), "Bitstream output file name")
     574#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    515575  ("InputBitDepth",           m_inputBitDepthY,    8, "Bit-depth of input file")
    516576  ("OutputBitDepth",          m_outputBitDepthY,   0, "Bit-depth of output file (default:InternalBitDepth)")
     
    520580  ("OutputBitDepthC",         m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    521581  ("InternalBitDepthC",       m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    522 #if SCALED_REF_LAYER_OFFSETS
     582#endif
    523583  ("NumScaledRefLayerOffsets%d",    cfg_numScaledRefLayerOffsets,     0, MAX_LAYERS,  "Number of scaled offset layer sets ")
    524584  ("ScaledRefLayerLeftOffset%d",   cfg_scaledRefLayerLeftOffsetPtr,  string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of scaled base layer picture with respect to"
     
    530590  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    531591                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
     592#if O0194_DIFFERENT_BITDEPTH_EL_BL
     593  ("InputBitDepth%d",       cfg_InputBitDepthY,    8, MAX_LAYERS, "Bit-depth of input file for layer %d")
     594  ("InternalBitDepth%d",    cfg_InternalBitDepthY, 0, MAX_LAYERS, "Bit-depth the codec operates at. (default:InputBitDepth) for layer %d ")
     595//                                                       "If different to InputBitDepth, source data will be converted")
     596  ("InputBitDepthC%d",      cfg_InputBitDepthC,    0, MAX_LAYERS, "As per InputBitDepth but for chroma component. (default:InputBitDepth) for layer %d")
     597  ("InternalBitDepthC%d",   cfg_InternalBitDepthC, 0, MAX_LAYERS, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth) for layer %d")
     598  ("OutputBitDepth%d",      cfg_OutputBitDepthY,   0, MAX_LAYERS, "Bit-depth of output file (default:InternalBitDepth)")
     599  ("OutputBitDepthC%d",     cfg_OutputBitDepthC,   0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    532600#endif
    533601#if N0120_MAX_TID_REF_CFG
     
    546614  ("IlSampleOnlyPred%d",       m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices")
    547615#endif
    548 #else
     616#else //SVC_EXTENSION
    549617  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    550618  ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
     
    559627  ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    560628  ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
     629#if AUXILIARY_PICTURES
     630  ("InputChromaFormat",     tmpInputChromaFormat,                       420, "InputChromaFormatIDC")
     631  ("ChromaFormatIDC,-cf",   tmpChromaFormat,                             0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     632#endif
    561633  ("ConformanceMode",       m_conformanceMode,     0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance")
    562634  ("HorizontalPadding,-pdx",m_aiPad[0],            0, "Horizontal source padding for conformance window mode 2")
     
    567639  ("ConfBottom",            m_confBottom,          0, "Bottom offset for window conformance mode 3")
    568640  ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
    569 #endif
     641#endif //SVC_EXTENSION
    570642
    571643  //Field coding parameters
     
    574646  ("FrameSkip,-fs",         m_FrameSkip,          0u, "Number of frames to skip at start of input YUV")
    575647  ("FramesToBeEncoded,f",   m_framesToBeEncoded,   0, "Number of frames to be encoded (default=all)")
    576  
    577648  // Profile and level
    578649  ("Profile", m_profile,   Profile::NONE, "Profile to be used when encoding (Incomplete)")
     
    585656  ("FrameOnly",         m_frameOnlyConstraintFlag, false, "Indicate that the bitstream contains only frames")
    586657
     658#if LAYER_CTB
     659  // Unit definition parameters
     660  ("MaxCUWidth%d",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     661  ("MaxCUHeight%d",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     662  // todo: remove defaults from MaxCUSize
     663  ("MaxCUSize%d,s%d",           cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     664  ("MaxCUSize%d,s%d",           cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     665  ("MaxPartitionDepth%d,h%d",   cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     666 
     667  ("QuadtreeTULog2MaxSize%d",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     668  ("QuadtreeTULog2MinSize%d",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     669 
     670  ("QuadtreeTUMaxDepthIntra%d", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     671  ("QuadtreeTUMaxDepthInter%d", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     672
     673
     674  // set the same CU realted settings across all the layers if config file parameters are not layer specific
     675  ("MaxCUWidth",              cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU width")
     676  ("MaxCUHeight",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU height")
     677  // todo: remove defaults from MaxCUSize
     678  ("MaxCUSize,s",             cfg_uiMaxCUWidth,             64u, MAX_LAYERS, "Maximum CU size")
     679  ("MaxCUSize,s",             cfg_uiMaxCUHeight,            64u, MAX_LAYERS, "Maximum CU size")
     680  ("MaxPartitionDepth,h",     cfg_uiMaxCUDepth,              4u, MAX_LAYERS, "CU depth")
     681 
     682  ("QuadtreeTULog2MaxSize",   cfg_uiQuadtreeTULog2MaxSize,   6u, MAX_LAYERS, "Maximum TU size in logarithm base 2")
     683  ("QuadtreeTULog2MinSize",   cfg_uiQuadtreeTULog2MinSize,   2u, MAX_LAYERS, "Minimum TU size in logarithm base 2")
     684 
     685  ("QuadtreeTUMaxDepthIntra", cfg_uiQuadtreeTUMaxDepthIntra, 1u, MAX_LAYERS, "Depth of TU tree for intra CUs")
     686  ("QuadtreeTUMaxDepthInter", cfg_uiQuadtreeTUMaxDepthInter, 2u, MAX_LAYERS, "Depth of TU tree for inter CUs")
     687#else
    587688  // Unit definition parameters
    588689  ("MaxCUWidth",              m_uiMaxCUWidth,             64u)
     
    598699  ("QuadtreeTUMaxDepthIntra", m_uiQuadtreeTUMaxDepthIntra, 1u, "Depth of TU tree for intra CUs")
    599700  ("QuadtreeTUMaxDepthInter", m_uiQuadtreeTUMaxDepthInter, 2u, "Depth of TU tree for inter CUs")
     701#endif
    600702 
    601703  // Coding structure paramters
     
    864966    opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry());
    865967  }
    866 #if FINAL_RPL_CHANGE_N0082
    867   for(Int i=1; i<MAX_GOP+1; i++) {
    868     std::ostringstream cOSS;
    869     cOSS<<"FrameEL"<<i;
    870     opts.addOptions()(cOSS.str(), m_acLayerCfg[1].m_GOPListLayer[i-1], GOPEntry());
    871   }
    872 #endif
    873968  po::setDefaults(opts);
    874969  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
     
    9211016  m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());
    9221017#endif
    923 #else
     1018#else //SVC_EXTENSION
    9241019  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
    9251020  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    9261021  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    9271022  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    928 #endif
     1023#endif //SVC_EXTENSION
    9291024
    9301025  Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str());
     
    9851080    m_pRowHeight = NULL;
    9861081  }
    987 #if SCALED_REF_LAYER_OFFSETS
     1082#if SVC_EXTENSION
    9881083  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    9891084  {
     
    10551150    }
    10561151  }
    1057 #endif
    10581152#if VPS_EXTN_DIRECT_REF_LAYERS
    10591153#if M0457_PREDICTION_INDICATIONS
     
    11531247  }
    11541248#endif
     1249#if AUXILIARY_PICTURES
     1250  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     1251  {
     1252    m_acLayerCfg[layer].m_InputChromaFormat =  numberToChromaFormat(cfg_tmpChromaFormatIDC[layer]);
     1253    m_acLayerCfg[layer].m_chromaFormatIDC = ((cfg_tmpChromaFormatIDC[layer] == 0) ? (m_acLayerCfg[layer].m_InputChromaFormat ) : (numberToChromaFormat(cfg_tmpChromaFormatIDC[layer])));
     1254  }
     1255#endif
    11551256  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    11561257  {
     
    11851286  }
    11861287#endif
     1288#endif //SVC_EXTENSION
    11871289  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    11881290
    1189 #if REPN_FORMAT_IN_VPS_123
     1291  /* rules for input, output and internal bitdepths as per help text */
     1292#if O0194_DIFFERENT_BITDEPTH_EL_BL
    11901293  for(Int layer = 0; layer < MAX_LAYERS; layer++)
    11911294  {
    1192     m_acLayerCfg[layer].setSourceHeight( m_repFormatCfg[ m_acLayerCfg[layer].getRepFormatIdx() ].m_picHeightInLumaSamples);
    1193     m_acLayerCfg[layer].setSourceWidth ( m_repFormatCfg[ m_acLayerCfg[layer].getRepFormatIdx() ].m_picWidthInLumaSamples );
    1194   }
    1195 #endif
    1196   /* rules for input, output and internal bitdepths as per help text */
     1295    if (!m_acLayerCfg[layer].m_internalBitDepthY) { m_acLayerCfg[layer].m_internalBitDepthY = m_acLayerCfg[layer].m_inputBitDepthY; }
     1296    if (!m_acLayerCfg[layer].m_internalBitDepthC) { m_acLayerCfg[layer].m_internalBitDepthC = m_acLayerCfg[layer].m_internalBitDepthY; }
     1297    if (!m_acLayerCfg[layer].m_inputBitDepthC) { m_acLayerCfg[layer].m_inputBitDepthC = m_acLayerCfg[layer].m_inputBitDepthY; }
     1298    if (!m_acLayerCfg[layer].m_outputBitDepthY) { m_acLayerCfg[layer].m_outputBitDepthY = m_acLayerCfg[layer].m_internalBitDepthY; }
     1299    if (!m_acLayerCfg[layer].m_outputBitDepthC) { m_acLayerCfg[layer].m_outputBitDepthC = m_acLayerCfg[layer].m_internalBitDepthC; }
     1300  }
     1301#else
    11971302  if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
    11981303  if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }
     
    12001305  if (!m_outputBitDepthY) { m_outputBitDepthY = m_internalBitDepthY; }
    12011306  if (!m_outputBitDepthC) { m_outputBitDepthC = m_internalBitDepthC; }
     1307#endif
    12021308
    12031309#if !SVC_EXTENSION
     
    14111517 
    14121518  // set global varibles
     1519#if LAYER_CTB
     1520  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1521  {
     1522    xSetGlobal(layer);
     1523  }
     1524#else
    14131525  xSetGlobal();
     1526#endif
    14141527 
    14151528  // print-out parameters
     
    14501563#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
    14511564  // check range of parameters
     1565#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1566  for(UInt layer=0; layer<m_numLayers; layer++)
     1567  {
     1568    xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
     1569    xConfirmPara( m_acLayerCfg[layer].m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
     1570  }
     1571#else
    14521572  xConfirmPara( m_inputBitDepthY < 8,                                                     "InputBitDepth must be at least 8" );
    14531573  xConfirmPara( m_inputBitDepthC < 8,                                                     "InputBitDepthC must be at least 8" );
     1574#endif
    14541575#if !SVC_EXTENSION 
    14551576  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
     
    14711592  xConfirmPara( m_bipredSearchRange < 0 ,                                                   "Search Range must be more than 0" );
    14721593  xConfirmPara( m_iMaxDeltaQP > 7,                                                          "Absolute Delta QP exceeds supported range (0 to 7)" );
     1594#if LAYER_CTB
     1595  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     1596  {
     1597    xConfirmPara( m_iMaxCuDQPDepth > m_acLayerCfg[layer].m_uiMaxCUDepth - 1,                "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
     1598  }
     1599#else
    14731600  xConfirmPara( m_iMaxCuDQPDepth > m_uiMaxCUDepth - 1,                                          "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth" );
     1601#endif
    14741602
    14751603  xConfirmPara( m_cbQpOffset < -12,   "Min. Chroma Cb QP Offset is -12" );
     
    14851613  }
    14861614#endif
     1615#if !LAYER_CTB
    14871616  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
    14881617  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
    14891618  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
    14901619  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     1620#endif
    14911621#if !SVC_EXTENSION
    14921622  xConfirmPara( (m_iSourceWidth  % (m_uiMaxCUWidth  >> (m_uiMaxCUDepth-1)))!=0,             "Resulting coded frame width must be a multiple of the minimum CU size");
     
    14941624#endif
    14951625 
     1626#if !LAYER_CTB
    14961627  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
    14971628  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     
    15071638  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
    15081639  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
     1640#endif
    15091641 
    15101642  xConfirmPara(  m_maxNumMergeCand < 1,  "MaxNumMergeCand must be 1 or greater.");
     
    15541686#endif
    15551687
     1688#if !LAYER_CTB
    15561689  // max CU width and height should be power of 2
    15571690  UInt ui = m_uiMaxCUWidth;
     
    15691702      xConfirmPara( ui != 1 , "Height should be 2^n");
    15701703  }
    1571 
     1704#endif
    15721705
    15731706  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
     
    15901723#endif
    15911724 
    1592 #if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
     1725
    15931726  Bool verifiedGOP=false;
    1594 #endif
    15951727  Bool errorGOP=false;
    1596 #if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    15971728  Int checkGOP=1;
    15981729  Int numRefs = m_isField ? 2 : 1;
    1599 #endif
    16001730  Int refList[MAX_NUM_REF_PICS+1];
    16011731  refList[0]=0;
     
    16091739    isOK[i]=false;
    16101740  }
    1611 #if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    16121741  Int numOK=0;
    1613 #endif
    16141742#if !SVC_EXTENSION
    16151743  xConfirmPara( m_iIntraPeriod >=0&&(m_iIntraPeriod%m_iGOPSize!=0), "Intra period must be a multiple of GOPSize, or -1" );
     
    16541782  }
    16551783#endif
    1656 #if FINAL_RPL_CHANGE_N0082
    1657   for(UInt layer=0; layer<m_numLayers; layer++)
    1658   {
    1659     if (m_acLayerCfg[layer].m_GOPListLayer[0].m_POC<0)
    1660     {
    1661       memcpy( m_acLayerCfg[layer].m_GOPListLayer, m_GOPList, sizeof(GOPEntry)*MAX_GOP );
    1662     }
    1663     errorGOP = xconfirmExtraGOP( m_acLayerCfg[layer].m_GOPListLayer );
    1664     xConfirmPara(errorGOP,"Invalid GOP structure given");
    1665   }
    1666 #if TEMP_SCALABILITY_FIX
    1667   if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6  && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7  &&
    1668     m_acLayerCfg[1].m_GOPListLayer[5].m_temporalId == 0 && m_acLayerCfg[1].m_GOPListLayer[7].m_temporalId == 0)
    1669 #else
    1670   //tentative for encoder
    1671   if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6  && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 )
    1672 #endif
    1673   {
    1674     //RA, POC5
    1675     m_acLayerCfg[1].m_GOPListLayer[5].m_usedByCurrPic[2] = 0;
    1676     m_acLayerCfg[1].m_GOPListLayer[5].m_refIdc[2] = 0;
    1677     //RA, POC7
    1678     m_acLayerCfg[1].m_GOPListLayer[7].m_usedByCurrPic[2] = 0;
    1679     m_acLayerCfg[1].m_GOPListLayer[7].m_refIdc[2] = 0;
    1680   }
    1681 #endif
    1682 #if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
     1784
    16831785  m_extraRPSs=0;
    16841786  //start looping through frames in coding order until we can verify that the GOP structure is correct.
     
    18761978  }
    18771979  xConfirmPara(errorGOP,"Invalid GOP structure given");
    1878 #endif
    1879 #if EXTERNAL_USEDBYCURR_N0082
    1880   for(UInt layer=0; layer<m_numLayers; layer++)
    1881   {
    1882     for (Int i=0; i< m_iGOPSize; i++){
    1883       if (m_acLayerCfg[layer].m_GOPListLayer[i].m_UseExtusedByCurrPic == 1 )
    1884       {
    1885         for(Int j=0; j<m_acLayerCfg[layer].m_GOPListLayer[i].m_numRefPics; j++ )
    1886         {
    1887           m_acLayerCfg[layer].m_GOPListLayer[i].m_usedByCurrPic[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j];
    1888           m_acLayerCfg[layer].m_GOPListLayer[i].m_refIdc[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j];
    1889         }
    1890       }
    1891     }
    1892   }
    1893 #endif
     1980
    18941981  m_maxTempLayer = 1;
    18951982  for(Int i=0; i<m_iGOPSize; i++)
     
    19662053    Int m_iSourceWidth = m_acLayerCfg[layer].m_iSourceWidth;
    19672054    Int m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight;
     2055#if LAYER_CTB
     2056    Int m_uiMaxCUWidth = m_acLayerCfg[layer].m_uiMaxCUWidth;
     2057    Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight;
     2058#endif
    19682059#endif
    19692060  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
     
    22012292  }
    22022293#endif
     2294#if AUXILIARY_PICTURES
     2295  for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
     2296  {
     2297    xConfirmPara(m_acLayerCfg[layer].m_auxId < 0 || m_acLayerCfg[layer].m_auxId > 4, "AuxId must be in range 0 to 4");
     2298    xConfirmPara(m_acLayerCfg[layer].m_auxId > 0 && m_acLayerCfg[layer].m_chromaFormatIDC != CHROMA_400, "Auxiliary picture must be monochrome picture");
     2299  }
     2300#endif
    22032301#undef xConfirmPara
    22042302  if (check_failed)
     
    22102308/** \todo use of global variables should be removed later
    22112309 */
     2310#if LAYER_CTB
     2311Void TAppEncCfg::xSetGlobal(UInt layerId)
     2312{
     2313  // set max CU width & height
     2314  g_auiLayerMaxCUWidth[layerId]  = m_acLayerCfg[layerId].m_uiMaxCUWidth;
     2315  g_auiLayerMaxCUHeight[layerId] = m_acLayerCfg[layerId].m_uiMaxCUHeight;
     2316 
     2317  // compute actual CU depth with respect to config depth and max transform size
     2318  g_auiLayerAddCUDepth[layerId]  = 0;
     2319  while( (m_acLayerCfg[layerId].m_uiMaxCUWidth>>m_acLayerCfg[layerId].m_uiMaxCUDepth) > ( 1 << ( m_acLayerCfg[layerId].m_uiQuadtreeTULog2MinSize + g_auiLayerAddCUDepth[layerId] )  ) ) g_auiLayerAddCUDepth[layerId]++;
     2320 
     2321  m_acLayerCfg[layerId].m_uiMaxCUDepth += g_auiLayerAddCUDepth[layerId];
     2322  g_auiLayerAddCUDepth[layerId]++;
     2323  g_auiLayerMaxCUDepth[layerId] = m_acLayerCfg[layerId].m_uiMaxCUDepth;
     2324 
     2325#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2326  // set internal bit-depth to constant value to make sure to be updated later
     2327  g_bitDepthY = -1;
     2328  g_bitDepthC = -1;
     2329 
     2330  g_uiPCMBitDepthLuma = -1;
     2331  g_uiPCMBitDepthChroma = -1;
     2332#else
     2333  // set internal bit-depth and constants
     2334  g_bitDepthY = m_internalBitDepthY;
     2335  g_bitDepthC = m_internalBitDepthC;
     2336 
     2337  g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
     2338  g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
     2339#endif
     2340}
     2341#else
    22122342Void TAppEncCfg::xSetGlobal()
    22132343{
     
    22242354  g_uiMaxCUDepth = m_uiMaxCUDepth;
    22252355 
    2226   // set internal bit-depth and constants
     2356#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2357  // set internal bit-depth to constant value to make sure to be updated later
     2358  g_bitDepthY = -1;
     2359  g_bitDepthC = -1;
     2360 
     2361  g_uiPCMBitDepthLuma = -1;
     2362  g_uiPCMBitDepthChroma = -1;
     2363#else
    22272364  g_bitDepthY = m_internalBitDepthY;
    22282365  g_bitDepthC = m_internalBitDepthC;
     
    22302367  g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_inputBitDepthY : m_internalBitDepthY;
    22312368  g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_inputBitDepthC : m_internalBitDepthC;
     2369#endif
    22322370}
     2371#endif
    22332372
    22342373Void TAppEncCfg::xPrintParameter()
     
    22402379  printf("Multiview                     : %d\n", m_scalabilityMask[1] );
    22412380  printf("Scalable                      : %d\n", m_scalabilityMask[2] );
     2381#if AUXILIARY_PICTURES
     2382  printf("Auxiliary pictures            : %d\n", m_scalabilityMask[3] );
     2383#endif
    22422384#else
    22432385  printf("Multiview                     : %d\n", m_scalabilityMask[0] );
     
    22842426    printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
    22852427  }
     2428#if !LAYER_CTB
    22862429  printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    22872430  printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
    22882431  printf("Max RQT depth inter          : %d\n", m_uiQuadtreeTUMaxDepthInter);
    22892432  printf("Max RQT depth intra          : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     2433#endif
    22902434  printf("Min PCM size                 : %d\n", 1 << m_uiPCMLog2MinSize);
    22912435  printf("Motion search range          : %d\n", m_iSearchRange );
     
    23042448  printf("QP adaptation                : %d (range=%d)\n", m_bUseAdaptiveQP, (m_bUseAdaptiveQP ? m_iQPAdaptationRange : 0) );
    23052449  printf("GOP size                     : %d\n", m_iGOPSize );
     2450#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    23062451  printf("Internal bit depth           : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
    23072452  printf("PCM sample bit depth         : (Y:%d, C:%d)\n", g_uiPCMBitDepthLuma, g_uiPCMBitDepthChroma );
     2453#endif
     2454#if O0215_PHASE_ALIGNMENT
     2455  printf("cross-layer sample alignment : %d\n", m_phaseAlignFlag);
     2456#endif
    23082457#if RATE_CONTROL_LAMBDA_DOMAIN
    23092458#if !RC_SHVC_HARMONIZATION
     
    23312480 
    23322481  printf("TOOL CFG: ");
     2482#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    23332483  printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC);
     2484#endif
    23342485  printf("HAD:%d ", m_bUseHADME           );
    23352486  printf("SRD:%d ", m_bUseSBACRD          );
     
    23622513  printf("CIP:%d ", m_bUseConstrainedIntraPred);
    23632514  printf("SAO:%d ", (m_bUseSAO)?(1):(0));
     2515#if !LAYER_CTB
    23642516  printf("PCM:%d ", (m_usePCM && (1<<m_uiPCMLog2MinSize) <= m_uiMaxCUWidth)? 1 : 0);
     2517#endif
    23652518  printf("SAOLcuBasedOptimization:%d ", (m_saoLcuBasedOptimization)?(1):(0));
    23662519
     
    23942547  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    23952548#endif
     2549  printf("O0194_DIFFERENT_BITDEPTH_EL_BL: %d ", O0194_DIFFERENT_BITDEPTH_EL_BL);
     2550  printf("O0194_JOINT_US_BITSHIFT: %d ", O0194_JOINT_US_BITSHIFT);
     2551  printf("O0194_WEIGHTED_PREDICTION_CGS: %d ",O0194_WEIGHTED_PREDICTION_CGS);
    23962552  printf("\n\n");
    23972553 
     
    24082564}
    24092565
    2410 #if SCALED_REF_LAYER_OFFSETS
     2566#if SVC_EXTENSION
    24112567Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString)
    24122568{
     
    24412597  }
    24422598}
    2443 #endif
    2444 
    2445 #if FINAL_RPL_CHANGE_N0082
    2446 Bool  TAppEncCfg::xconfirmExtraGOP (GOPEntry * ge)
    2447 {
    2448   Bool verifiedGOP=false;
    2449   Bool errorGOP=false;
    2450   Int checkGOP=1;
    2451   Int numRefs = 1;
    2452   Int refList[MAX_NUM_REF_PICS+1];
    2453   refList[0]=0;
    2454   Bool isOK[MAX_GOP];
    2455   for(Int i=0; i<MAX_GOP; i++)
    2456   {
    2457     isOK[i]=false;
    2458   }
    2459   Int numOK=0;
    2460 
    2461   m_extraRPSs=0;
    2462   //start looping through frames in coding order until we can verify that the GOP structure is correct.
    2463   while(!verifiedGOP&&!errorGOP)
    2464   {
    2465     Int curGOP = (checkGOP-1)%m_iGOPSize;
    2466     Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + ge[curGOP].m_POC;   
    2467     if(ge[curGOP].m_POC<0)
    2468     {
    2469       printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
    2470       errorGOP=true;
    2471     }
    2472     else
    2473     {
    2474       //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
    2475       Bool beforeI = false;
    2476       for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)
    2477       {
    2478         Int absPOC = curPOC+ge[curGOP].m_referencePics[i];
    2479         if(absPOC < 0)
    2480         {
    2481           beforeI=true;
    2482         }
    2483         else
    2484         {
    2485           Bool found=false;
    2486           for(Int j=0; j<numRefs; j++)
    2487           {
    2488             if(refList[j]==absPOC)
    2489             {
    2490               found=true;
    2491               for(Int k=0; k<m_iGOPSize; k++)
    2492               {
    2493                 if(absPOC%m_iGOPSize == ge[k].m_POC%m_iGOPSize)
    2494                 {
    2495                   if(ge[k].m_temporalId==ge[curGOP].m_temporalId)
    2496                   {
    2497                     ge[k].m_refPic = true;
    2498                   }
    2499                   ge[curGOP].m_usedByCurrPic[i]=ge[k].m_temporalId<=ge[curGOP].m_temporalId;
    2500                 }
    2501               }
    2502             }
    2503           }
    2504           if(!found)
    2505           {
    2506             printf("\nError: ref pic %d is not available for GOP frame %d\n",ge[curGOP].m_referencePics[i],curGOP+1);
    2507             errorGOP=true;
    2508           }
    2509         }
    2510       }
    2511       if(!beforeI&&!errorGOP)
    2512       {
    2513         //all ref frames were present
    2514         if(!isOK[curGOP])
    2515         {
    2516           numOK++;
    2517           isOK[curGOP]=true;
    2518           if(numOK==m_iGOPSize)
    2519           {
    2520             verifiedGOP=true;
    2521           }
    2522         }
    2523       }
    2524       else
    2525       {
    2526         //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
    2527         ge[m_iGOPSize+m_extraRPSs]=ge[curGOP];
    2528         Int newRefs=0;
    2529         for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)
    2530         {
    2531           Int absPOC = curPOC+ge[curGOP].m_referencePics[i];
    2532           if(absPOC>=0)
    2533           {
    2534             ge[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=ge[curGOP].m_referencePics[i];
    2535             ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=ge[curGOP].m_usedByCurrPic[i];
    2536             newRefs++;
    2537           }
    2538         }
    2539         Int numPrefRefs = ge[curGOP].m_numRefPicsActive;
    2540        
    2541         for(Int offset = -1; offset>-checkGOP; offset--)
    2542         {
    2543           //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.
    2544           Int offGOP = (checkGOP-1+offset)%m_iGOPSize;
    2545           Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + ge[offGOP].m_POC;
    2546           if(offPOC>=0&&ge[offGOP].m_temporalId<=ge[curGOP].m_temporalId)
    2547           {
    2548             Bool newRef=false;
    2549             for(Int i=0; i<numRefs; i++)
    2550             {
    2551               if(refList[i]==offPOC)
    2552               {
    2553                 newRef=true;
    2554               }
    2555             }
    2556             for(Int i=0; i<newRefs; i++)
    2557             {
    2558               if(ge[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC)
    2559               {
    2560                 newRef=false;
    2561               }
    2562             }
    2563             if(newRef)
    2564             {
    2565               Int insertPoint=newRefs;
    2566               //this picture can be added, find appropriate place in list and insert it.
    2567               if(ge[offGOP].m_temporalId==ge[curGOP].m_temporalId)
    2568               {
    2569                 ge[offGOP].m_refPic = true;
    2570               }
    2571               for(Int j=0; j<newRefs; j++)
    2572               {
    2573                 if(ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0)
    2574                 {
    2575                   insertPoint = j;
    2576                   break;
    2577                 }
    2578               }
    2579               Int prev = offPOC-curPOC;
    2580               Int prevUsed = ge[offGOP].m_temporalId<=ge[curGOP].m_temporalId;
    2581               for(Int j=insertPoint; j<newRefs+1; j++)
    2582               {
    2583                 Int newPrev = ge[m_iGOPSize+m_extraRPSs].m_referencePics[j];
    2584                 Int newUsed = ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j];
    2585                 ge[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev;
    2586                 ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed;
    2587                 prevUsed=newUsed;
    2588                 prev=newPrev;
    2589               }
    2590               newRefs++;
    2591             }
    2592           }
    2593           if(newRefs>=numPrefRefs)
    2594           {
    2595             break;
    2596           }
    2597         }
    2598         ge[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs;
    2599         ge[m_iGOPSize+m_extraRPSs].m_POC = curPOC;
    2600         if (m_extraRPSs == 0)
    2601         {
    2602           ge[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0;
    2603           ge[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0;
    2604         }
    2605         else
    2606         {
    2607           Int rIdx =  m_iGOPSize + m_extraRPSs - 1;
    2608           Int refPOC = ge[rIdx].m_POC;
    2609           Int refPics = ge[rIdx].m_numRefPics;
    2610           Int newIdc=0;
    2611           for(Int i = 0; i<= refPics; i++)
    2612           {
    2613             Int deltaPOC = ((i != refPics)? ge[rIdx].m_referencePics[i] : 0);  // check if the reference abs POC is >= 0
    2614             Int absPOCref = refPOC+deltaPOC;
    2615             Int refIdc = 0;
    2616             for (Int j = 0; j < ge[m_iGOPSize+m_extraRPSs].m_numRefPics; j++)
    2617             {
    2618               if ( (absPOCref - curPOC) == ge[m_iGOPSize+m_extraRPSs].m_referencePics[j])
    2619               {
    2620                 if (ge[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j])
    2621                 {
    2622                   refIdc = 1;
    2623                 }
    2624                 else
    2625                 {
    2626                   refIdc = 2;
    2627                 }
    2628               }
    2629             }
    2630             ge[m_iGOPSize+m_extraRPSs].m_refIdc[newIdc]=refIdc;
    2631             newIdc++;
    2632           }
    2633           ge[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 1; 
    2634           ge[m_iGOPSize+m_extraRPSs].m_numRefIdc = newIdc;
    2635           ge[m_iGOPSize+m_extraRPSs].m_deltaRPS = refPOC - ge[m_iGOPSize+m_extraRPSs].m_POC;
    2636         }
    2637         curGOP=m_iGOPSize+m_extraRPSs;
    2638         m_extraRPSs++;
    2639       }
    2640       numRefs=0;
    2641       for(Int i = 0; i< ge[curGOP].m_numRefPics; i++)
    2642       {
    2643         Int absPOC = curPOC+ge[curGOP].m_referencePics[i];
    2644         if(absPOC >= 0)
    2645         {
    2646           refList[numRefs]=absPOC;
    2647           numRefs++;
    2648         }
    2649       }
    2650       refList[numRefs]=curPOC;
    2651       numRefs++;
    2652     }
    2653     checkGOP++;
    2654   }
    2655 
    2656   return errorGOP; //update
    2657 }
    2658 #endif
     2599
     2600#endif //SVC_EXTENSION
    26592601//! \}
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r442 r494  
    101101  Int       m_aiPad[2];                                       ///< number of padded pixels for width and height
    102102#endif 
    103 
     103#if AUXILIARY_PICTURES
     104  ChromaFormat m_InputChromaFormatIDC;
     105#endif
    104106  Bool      m_isField;                                        ///< enable field coding
    105107  Bool      m_isTopFieldFirst;
     
    150152  Int       m_maxTempLayer;                                  ///< Max temporal layer
    151153
     154#if !LAYER_CTB
    152155  // coding unit (CU) definition
    153156  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
     
    161164  UInt      m_uiQuadtreeTUMaxDepthInter;
    162165  UInt      m_uiQuadtreeTUMaxDepthIntra;
     166#endif
    163167 
    164168  // coding tools (bit-depth)
     169#if !O0194_DIFFERENT_BITDEPTH_EL_BL
    165170  Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
    166171  Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
     
    169174  Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
    170175  Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
     176#endif
     177#if AUXILIARY_PICTURES
     178  ChromaFormat m_chromaFormatIDC;
     179#endif
    171180
    172181  // coding tools (PCM bit-depth)
     
    354363#endif
    355364  // internal member functions
     365#if LAYER_CTB
     366  Void  xSetGlobal      (UInt layerId);                       ///< set global variables
     367#else
    356368  Void  xSetGlobal      ();                                   ///< set global variables
     369#endif
    357370  Void  xCheckParameter ();                                   ///< check validity of configuration values
    358371  Void  xPrintParameter ();                                   ///< print configuration values
    359372  Void  xPrintUsage     ();                                   ///< print usage
    360 #if FINAL_RPL_CHANGE_N0082
    361   Bool  xconfirmExtraGOP (GOPEntry * ge);
    362 #endif
    363373#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    364374  Int       m_adaptiveResolutionChange;                       ///< Indicate adaptive resolution change frame
     
    375385  UInt      m_ilcIdc[1024];
    376386#endif
     387#if O0215_PHASE_ALIGNMENT
     388  bool m_phaseAlignFlag;
     389#endif
    377390public:
    378391  TAppEncCfg();
     
    388401  Int  getNumLayer()               {return m_numLayers;        }
    389402  Int  getGOPSize()                {return m_iGOPSize;          }
     403#if O0194_DIFFERENT_BITDEPTH_EL_BL
     404  UInt getInternalBitDepthY(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthY; }
     405  UInt getInternalBitDepthC(Int iLayer)      {return m_acLayerCfg[iLayer].m_internalBitDepthC; }
     406  Bool getPCMInputBitDepthFlag()             {return m_bPCMInputBitDepthFlag;                  }
     407#else
    390408  UInt getInternalBitDepthY()      {return m_internalBitDepthY; }
    391409  UInt getInternalBitDepthC()      {return m_internalBitDepthC; }
     410#endif
     411#if !LAYER_CTB
    392412  UInt getMaxCUWidth()             {return m_uiMaxCUWidth;      }
    393413  UInt getMaxCUHeight()            {return m_uiMaxCUHeight;     }
    394414  UInt getMaxCUDepth()             {return m_uiMaxCUDepth;      }
     415#endif
    395416  Int  getDecodingRefreshType()    {return m_iDecodingRefreshType; }
    396417  Int  getWaveFrontSynchro()        { return m_iWaveFrontSynchro; }
     
    399420  Char* getBLSyntaxFile()           { return m_BLSyntaxFile;      }
    400421#endif
    401 #if SCALED_REF_LAYER_OFFSETS
    402422  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
    403 #endif
    404423#if REPN_FORMAT_IN_VPS
    405424  RepFormatCfg* getRepFormatCfg(Int i)  { return &m_repFormatCfg[i]; }
    406425#endif
     426#if LAYER_CTB
     427  Bool getUsePCM()                  { return m_usePCM;               }
     428  UInt getPCMLog2MinSize  ()        { return  m_uiPCMLog2MinSize;    }
     429#endif
    407430#endif
    408431};// END CLASS DEFINITION TAppEncCfg
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r442 r494  
    2222//! \{
    2323
     24
     25#if AUXILIARY_PICTURES
     26static inline ChromaFormat numberToChromaFormat(const Int val)
     27{
     28  switch (val)
     29  {
     30    case 400: return CHROMA_400; break;
     31    case 420: return CHROMA_420; break;
     32    case 422: return CHROMA_422; break;
     33    case 444: return CHROMA_444; break;
     34    default:  return NUM_CHROMA_FORMAT;
     35  }
     36}
     37#endif
    2438
    2539// ====================================================================================================================
     
    3852  m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
    3953  m_aiPad[1] = m_aiPad[0] = 0;
    40 #if SCALED_REF_LAYER_OFFSETS
    4154  m_numScaledRefLayerOffsets = 0;
    4255  ::memset(m_scaledRefLayerLeftOffset,   0, sizeof(m_scaledRefLayerLeftOffset));
     
    4457  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
    4558  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
    46 #endif
    4759}
    4860
     
    7789  string cfg_ReconFile;
    7890  string cfg_dQPFile;
     91#if AUXILIARY_PICTURES
     92  Int tmpInputChromaFormat;
     93  Int tmpChromaFormat;
     94#endif
     95
    7996  po::Options opts;
    8097  opts.addOptions()
     
    87104    ("SourceHeight,-hgt",     m_iSourceHeight, 0, "Source picture height")
    88105    ("CroppingMode",          m_conformanceMode,  0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     106#if AUXILIARY_PICTURES
     107    ("InputChromaFormat",     tmpInputChromaFormat,  420, "InputChromaFormatIDC")
     108    ("ChromaFormatIDC",       tmpChromaFormat,    420, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)")
     109#endif
    89110    ("CropLeft",              m_confLeft,      0, "Left cropping/padding for cropping mode 3")
    90111    ("CropRight",             m_confRight,     0, "Right cropping/padding for cropping mode 3")
     
    105126  m_cReconFile = cfg_ReconFile;
    106127  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
     128#if AUXILIARY_PICTURES
     129  m_InputChromaFormat = numberToChromaFormat(tmpInputChromaFormat);
     130  m_chromaFormatIDC   = ((tmpChromaFormat == 0) ? (m_InputChromaFormat) : (numberToChromaFormat(tmpChromaFormat)));
     131#endif
    107132
    108133  // reading external dQP description from file
     
    142167  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
    143168  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
     169#if O0194_DIFFERENT_BITDEPTH_EL_BL
     170  printf("Input bit depth               : (Y:%d, C:%d)\n", m_inputBitDepthY   , m_inputBitDepthC    );
     171  printf("Internal bit depth            : (Y:%d, C:%d)\n", m_internalBitDepthY, m_internalBitDepthC );
     172  printf("PCM sample bit depth          : (Y:%d, C:%d)\n", m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepthY : m_internalBitDepthY, m_cAppEncCfg->getPCMInputBitDepthFlag() ? m_inputBitDepthC : m_internalBitDepthC );
     173#endif
     174#if LAYER_CTB
     175  printf("CU size / depth               : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
     176  printf("RQT trans. size (min / max)   : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     177  printf("Max RQT depth inter           : %d\n", m_uiQuadtreeTUMaxDepthInter);
     178  printf("Max RQT depth intra           : %d\n", m_uiQuadtreeTUMaxDepthIntra);
     179#endif
    144180  printf("QP                            : %5.2f\n", m_fQP );
    145181  printf("Intra period                  : %d\n", m_iIntraPeriod );
     
    157193#endif
    158194  printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);
     195#if LAYER_CTB
     196  printf("PCM:%d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0);
     197#endif
    159198}
    160199
     
    175214    {
    176215      // automatic padding to minimum CU size
     216#if LAYER_CTB
     217      Int minCuSize = m_uiMaxCUHeight >> (m_uiMaxCUDepth - 1);
     218#else
    177219      Int minCuSize = m_cAppEncCfg->getMaxCUHeight() >> (m_cAppEncCfg->getMaxCUDepth() - 1);
     220#endif
    178221      if (m_iSourceWidth % minCuSize)
    179222      {
     
    240283  }
    241284
     285#if LAYER_CTB
     286  UInt maxCUWidth = m_uiMaxCUWidth;
     287  UInt maxCUHeight = m_uiMaxCUHeight;
     288  UInt maxCUDepth = m_uiMaxCUDepth;
     289#else
    242290  UInt maxCUWidth = m_cAppEncCfg->getMaxCUWidth();
    243291  UInt maxCUHeight = m_cAppEncCfg->getMaxCUHeight();
    244292  UInt maxCUDepth = m_cAppEncCfg->getMaxCUDepth();
     293#endif
    245294  bool check_failed = false; /* abort if there is a fatal configuration problem */
    246295#define xConfirmPara(a,b) check_failed |= confirmPara(a,b)
     
    255304  }
    256305
     306#if O0194_DIFFERENT_BITDEPTH_EL_BL
     307  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     308  {
     309    xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY(layer) - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
     310  }
     311#else
    257312  xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
    258 
    259 
    260   m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + m_cAppEncCfg->getMaxCUHeight() - 1) / m_cAppEncCfg->getMaxCUHeight() : 1;
     313#endif
     314
     315
     316  m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1;
    261317  xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
    262318  xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" );
     
    273329  xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    274330  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     331
     332#if LAYER_CTB 
     333  xConfirmPara( (m_uiMaxCUWidth  >> m_uiMaxCUDepth) < 4,                                    "Minimum partition width size should be larger than or equal to 8");
     334  xConfirmPara( (m_uiMaxCUHeight >> m_uiMaxCUDepth) < 4,                                    "Minimum partition height size should be larger than or equal to 8");
     335  xConfirmPara( m_uiMaxCUWidth < 16,                                                        "Maximum partition width size should be larger than or equal to 16");
     336  xConfirmPara( m_uiMaxCUHeight < 16,                                                       "Maximum partition height size should be larger than or equal to 16");
     337  xConfirmPara( m_uiQuadtreeTULog2MinSize < 2,                                        "QuadtreeTULog2MinSize must be 2 or greater.");
     338  xConfirmPara( m_uiQuadtreeTULog2MaxSize > 5,                                        "QuadtreeTULog2MaxSize must be 5 or smaller.");
     339  xConfirmPara( (1<<m_uiQuadtreeTULog2MaxSize) > m_uiMaxCUWidth,                                        "QuadtreeTULog2MaxSize must be log2(maxCUSize) or smaller.");
     340  xConfirmPara( m_uiQuadtreeTULog2MaxSize < m_uiQuadtreeTULog2MinSize,                "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
     341  xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUWidth >>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
     342  xConfirmPara( (1<<m_uiQuadtreeTULog2MinSize)>(m_uiMaxCUHeight>>(m_uiMaxCUDepth-1)), "QuadtreeTULog2MinSize must not be greater than minimum CU size" ); // HS
     343  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUWidth  >> m_uiMaxCUDepth ), "Minimum CU width must be greater than minimum transform size." );
     344  xConfirmPara( ( 1 << m_uiQuadtreeTULog2MinSize ) > ( m_uiMaxCUHeight >> m_uiMaxCUDepth ), "Minimum CU height must be greater than minimum transform size." );
     345  xConfirmPara( m_uiQuadtreeTUMaxDepthInter < 1,                                                         "QuadtreeTUMaxDepthInter must be greater than or equal to 1" );
     346  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthInter - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
     347  xConfirmPara( m_uiQuadtreeTUMaxDepthIntra < 1,                                                         "QuadtreeTUMaxDepthIntra must be greater than or equal to 1" );
     348  xConfirmPara( m_uiMaxCUWidth < ( 1 << (m_uiQuadtreeTULog2MinSize + m_uiQuadtreeTUMaxDepthIntra - 1) ), "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1" );
     349
     350  // max CU width and height should be power of 2
     351  UInt ui = m_uiMaxCUWidth;
     352  while(ui)
     353  {
     354    ui >>= 1;
     355    if( (ui & 1) == 1)
     356      xConfirmPara( ui != 1 , "Width should be 2^n");
     357  }
     358  ui = m_uiMaxCUHeight;
     359  while(ui)
     360  {
     361    ui >>= 1;
     362    if( (ui & 1) == 1)
     363      xConfirmPara( ui != 1 , "Height should be 2^n");
     364  }
     365#endif
     366
    275367#undef xConfirmPara
    276368  return check_failed;
    277369}
    278370
    279 #endif
     371#endif //SVC_EXTENSION
    280372
    281373
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.h

    r442 r494  
    66#define __TAPPENCLAYERCFG__
    77
     8#if SVC_EXTENSION
    89#include "TLibCommon/CommonDef.h"
    910#include "TLibEncoder/TEncCfg.h"
     
    1112
    1213using namespace std;
    13 #if SVC_EXTENSION
    1414class TAppEncCfg;
    15 #endif
    1615//! \ingroup TAppEncoder
    1716//! \{
     
    4342  Int       m_iIntraPeriod;                                   ///< period of I-slice (random access period)
    4443  Double    m_fQP;                                            ///< QP value of key-picture (floating point)
     44#if AUXILIARY_PICTURES
     45  ChromaFormat m_chromaFormatIDC;
     46  ChromaFormat m_InputChromaFormat;
     47  Int          m_auxId;
     48#endif
    4549#if VPS_EXTN_DIRECT_REF_LAYERS
    4650#if M0457_PREDICTION_INDICATIONS
     
    5559  Int       *m_predLayerIds;
    5660  Int       m_numActiveRefLayers;
     61#endif
     62
     63#if LAYER_CTB
     64  // coding unit (CU) definition
     65  UInt      m_uiMaxCUWidth;                                   ///< max. CU width in pixel
     66  UInt      m_uiMaxCUHeight;                                  ///< max. CU height in pixel
     67  UInt      m_uiMaxCUDepth;                                   ///< max. CU depth
     68 
     69  // transfom unit (TU) definition
     70  UInt      m_uiQuadtreeTULog2MaxSize;
     71  UInt      m_uiQuadtreeTULog2MinSize;
     72 
     73  UInt      m_uiQuadtreeTUMaxDepthInter;
     74  UInt      m_uiQuadtreeTUMaxDepthIntra;
    5775#endif
    5876
     
    7088  Int       m_maxTidIlRefPicsPlus1;
    7189#endif
    72 #if SVC_EXTENSION
    7390  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
    74 #endif
    7591
    7692  Int       m_iQP;                                            ///< QP value of key-picture (integer)
     
    7894  Int*      m_aidQP;                                          ///< array of slice QP values
    7995  TAppEncCfg* m_cAppEncCfg;                                   ///< pointer to app encoder config
    80 #if SCALED_REF_LAYER_OFFSETS
    8196  Int       m_numScaledRefLayerOffsets  ;
    8297  Int       m_scaledRefLayerLeftOffset  [MAX_LAYERS];
     
    8499  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
    85100  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
    86 #endif 
    87 #if FINAL_RPL_CHANGE_N0082
    88   GOPEntry  m_GOPListLayer[MAX_GOP];                            ///< for layer
     101#if O0194_DIFFERENT_BITDEPTH_EL_BL
     102  Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
     103  Int       m_inputBitDepthC;                               ///< bit-depth of input file (chroma component)
     104  Int       m_internalBitDepthY;                            ///< bit-depth codec operates at in luma (input/output files will be converted)
     105  Int       m_internalBitDepthC;                            ///< bit-depth codec operates at in chroma (input/output files will be converted)
     106  Int       m_outputBitDepthY;                              ///< bit-depth of output file (luma component)
     107  Int       m_outputBitDepthC;                              ///< bit-depth of output file (chroma component)
    89108#endif
    90109#if REPN_FORMAT_IN_VPS
     
    122141  Int     getConfTop()                {return m_confTop;          }
    123142  Int     getConfBottom()             {return m_confBottom;       }
     143#if AUXILIARY_PICTURES
     144  ChromaFormat getInputChromaFormat()   {return m_InputChromaFormat;}
     145  ChromaFormat getChromaFormatIDC()     {return m_chromaFormatIDC;  }
     146  Int          getAuxId()               {return m_auxId;            }
     147#endif
    124148
    125149  Int     getIntQP()                  {return m_iQP;              }
     
    152176  Bool    getRCForceIntraQP()         {return m_RCForceIntraQP;        }
    153177#endif
    154 #if FINAL_RPL_CHANGE_N0082
    155   GOPEntry getGOPEntry(Int i )        {return m_GOPListLayer[i];  }
    156 #endif
    157178#if REPN_FORMAT_IN_VPS
    158179  Int     getRepFormatIdx()           { return m_repFormatIdx;  }
     
    164185  Int     getMaxTidIlRefPicsPlus1()   { return m_maxTidIlRefPicsPlus1; }
    165186#endif
     187#if LAYER_CTB
     188  UInt    getMaxCUWidth()             {return m_uiMaxCUWidth;      }
     189  UInt    getMaxCUHeight()            {return m_uiMaxCUHeight;     }
     190  UInt    getMaxCUDepth()             {return m_uiMaxCUDepth;      }
     191#endif
    166192}; // END CLASS DEFINITION TAppEncLayerCfg
     193
     194#endif //SVC_EXTENSION
    167195
    168196//! \}
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r442 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    9898    // Auto generation of the format index
    9999    if( m_acLayerCfg[layer].getRepFormatIdx() == -1 )
    100     {
    101       // Currently only picture width and height are considred. It has to be updated if different chroma format and bit-depth will are used.
     100    {     
    102101      Bool found = false;
    103102      for( UInt idx = 0; idx < layer; idx++ )
    104103      {
    105         if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight() )
     104        if( m_acLayerCfg[layer].getSourceWidth() == m_acLayerCfg[idx].getSourceWidth() && m_acLayerCfg[layer].getSourceHeight() == m_acLayerCfg[idx].getSourceHeight()
     105#if AUXILIARY_PICTURES
     106          && m_acLayerCfg[layer].getChromaFormatIDC() == m_acLayerCfg[idx].getChromaFormatIDC()
     107#endif
     108#if O0194_DIFFERENT_BITDEPTH_EL_BL
     109          && m_acLayerCfg[layer].m_internalBitDepthY == m_acLayerCfg[idx].m_internalBitDepthY && m_acLayerCfg[layer].m_internalBitDepthC == m_acLayerCfg[idx].m_internalBitDepthC
     110#endif
     111          )
    106112        {
    107113          found = true;
     
    117123    }
    118124
    119     assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" );   
     125    assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" );
    120126    vps->setVpsRepFormatIdx( layer, m_acLayerCfg[layer].getRepFormatIdx() );
    121127    maxRepFormatIdx = std::max( m_acLayerCfg[layer].getRepFormatIdx(), maxRepFormatIdx );
     
    141147  for(UInt idx=0; idx < vps->getVpsNumRepFormats(); idx++)
    142148  {
    143     RepFormat *repFormat = vps->getVpsRepFormat( idx );   
     149    RepFormat *repFormat = vps->getVpsRepFormat( idx );
    144150    repFormat->setPicWidthVpsInLumaSamples  ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceWidth()   );
    145151    repFormat->setPicHeightVpsInLumaSamples ( m_acLayerCfg[mapIdxToLayer[idx]].getSourceHeight()  );
     152#if AUXILIARY_PICTURES
     153    repFormat->setChromaFormatVpsIdc        ( m_acLayerCfg[mapIdxToLayer[idx]].getChromaFormatIDC() );
     154#else
    146155    repFormat->setChromaFormatVpsIdc        ( 1                                             );  // Need modification to change for each layer - corresponds to 420
     156#endif
    147157    repFormat->setSeparateColourPlaneVpsFlag( 0                                             );  // Need modification to change for each layer
     158#if O0194_DIFFERENT_BITDEPTH_EL_BL
     159    repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY(mapIdxToLayer[idx])      );  // Need modification to change for each layer
     160    repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC(mapIdxToLayer[idx])      );  // Need modification to change for each layer
     161#else
    148162    repFormat->setBitDepthVpsLuma           ( getInternalBitDepthY()                        );  // Need modification to change for each layer
    149163    repFormat->setBitDepthVpsChroma         ( getInternalBitDepthC()                        );  // Need modification to change for each layer
     164#endif
    150165  }
    151166  delete [] mapIdxToLayer;
     
    153168  for(UInt layer=0; layer<m_numLayers; layer++)
    154169  {
     170#if O0194_DIFFERENT_BITDEPTH_EL_BL
     171    //1
     172    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     173    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     174
     175    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     176    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     177
     178    // Set this to be used in Upsampling filter in function "TComUpsampleFilter::upsampleBasePic"
     179    g_bitDepthYLayer[layer] = g_bitDepthY;
     180    g_bitDepthCLayer[layer] = g_bitDepthC;
     181#endif
    155182    //m_acTEncTop[layer].setVPS(&vps);
    156183    m_acTEncTop[layer].setFrameRate                    ( m_acLayerCfg[layer].getFrameRate() );
     
    187214#endif
    188215#endif
    189     // set layer ID 
    190     m_acTEncTop[layer].setLayerId ( layer ); 
     216    // set layer ID
     217    m_acTEncTop[layer].setLayerId ( layer );
    191218    m_acTEncTop[layer].setNumLayer ( m_numLayers );
    192219    m_acTEncTop[layer].setLayerEnc(m_apcTEncTop);
     
    196223    m_acTEncTop[layer].setDecodingRefreshType          ( m_iDecodingRefreshType );
    197224    m_acTEncTop[layer].setGOPSize                      ( m_iGOPSize );
    198 #if FINAL_RPL_CHANGE_N0082
    199     m_acTEncTop[layer].setGopList                      ( m_acLayerCfg[layer].m_GOPListLayer );
    200 #else
    201225    m_acTEncTop[layer].setGopList                      ( m_GOPList );
    202 #endif
     226
    203227    m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs );
    204228    for(Int i = 0; i < MAX_TLAYER; i++)
     
    220244    if (layer<m_numLayers-1)
    221245    {
    222        m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1()); 
    223     }
    224 #endif 
     246       m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
     247    }
     248#endif
    225249#if VPS_EXTN_DIRECT_REF_LAYERS
    226250    if(layer)
     
    241265      else
    242266      {
    243         m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );     
     267        m_acTEncTop[layer].setNumSamplePredRefLayers   ( m_acLayerCfg[layer].getNumSamplePredRefLayers() );
    244268        for(Int i = 0; i < m_acTEncTop[layer].getNumSamplePredRefLayers(); i++)
    245269        {
    246270          m_acTEncTop[layer].setSamplePredRefLayerId   ( i, m_acLayerCfg[layer].getSamplePredRefLayerId(i));
    247271          m_acTEncTop[layer].setSamplePredEnabledFlag  (m_acLayerCfg[layer].getSamplePredRefLayerId(i), true);
    248         }       
     272        }
    249273      }
    250274      if(m_acLayerCfg[layer].getNumMotionPredRefLayers() == -1)
     
    257281      else
    258282      {
    259         m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );     
     283        m_acTEncTop[layer].setNumMotionPredRefLayers   ( m_acLayerCfg[layer].getNumMotionPredRefLayers() );
    260284        for(Int i = 0; i < m_acTEncTop[layer].getNumMotionPredRefLayers(); i++)
    261285        {
    262286          m_acTEncTop[layer].setMotionPredRefLayerId   ( i, m_acLayerCfg[layer].getMotionPredRefLayerId(i));
    263287          m_acTEncTop[layer].setMotionPredEnabledFlag  (m_acLayerCfg[layer].getMotionPredRefLayerId(i), true);
    264         }       
     288        }
    265289      }
    266290      Int numDirectRefLayers = 0;
     
    283307      else
    284308      {
    285         m_acTEncTop[layer].setNumDirectRefLayers       ( m_acLayerCfg[layer].getNumDirectRefLayers() );     
     309        m_acTEncTop[layer].setNumDirectRefLayers       ( m_acLayerCfg[layer].getNumDirectRefLayers() );
    286310        for(Int i = 0; i < m_acTEncTop[layer].getNumDirectRefLayers(); i++)
    287311        {
     
    304328      else
    305329      {
    306         m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );     
     330        m_acTEncTop[layer].setNumActiveRefLayers       ( m_acLayerCfg[layer].getNumActiveRefLayers() );
    307331        for(Int i = 0; i < m_acTEncTop[layer].getNumActiveRefLayers(); i++)
    308332        {
     
    358382    m_acTEncTop[layer].setUseRDOQTS                    ( m_useRDOQTS   );
    359383    m_acTEncTop[layer].setRDpenalty                    ( m_rdPenalty );
     384#if LAYER_CTB
     385    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MaxSize );
     386    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_acLayerCfg[layer].m_uiQuadtreeTULog2MinSize );
     387    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthInter );
     388    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_acLayerCfg[layer].m_uiQuadtreeTUMaxDepthIntra );
     389#else
    360390    m_acTEncTop[layer].setQuadtreeTULog2MaxSize        ( m_uiQuadtreeTULog2MaxSize );
    361391    m_acTEncTop[layer].setQuadtreeTULog2MinSize        ( m_uiQuadtreeTULog2MinSize );
    362392    m_acTEncTop[layer].setQuadtreeTUMaxDepthInter      ( m_uiQuadtreeTUMaxDepthInter );
    363393    m_acTEncTop[layer].setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
     394#endif
    364395    m_acTEncTop[layer].setUseFastEnc                   ( m_bUseFastEnc  );
    365     m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  ); 
     396    m_acTEncTop[layer].setUseEarlyCU                   ( m_bUseEarlyCU  );
    366397    m_acTEncTop[layer].setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    367398    m_acTEncTop[layer].setUseCbfFastMode               ( m_bUseCbfFastMode  );
     
    383414    m_acTEncTop[layer].setUseWP                   ( m_useWeightedPred      );
    384415    m_acTEncTop[layer].setWPBiPred                ( m_useWeightedBiPred   );
     416#if O0194_WEIGHTED_PREDICTION_CGS
     417    if (layer!=0)
     418    {
     419      // Enable weighted prediction for enhancement layer
     420      m_acTEncTop[layer].setUseWP                 ( true   );
     421      m_acTEncTop[layer].setWPBiPred              ( true   );
     422    }
     423#endif
    385424    //====== Parallel Merge Estimation ========
    386425    m_acTEncTop[layer].setLog2ParallelMergeLevelMinus2 ( m_log2ParallelMergeLevel - 2 );
     
    393432    m_acTEncTop[layer].setSliceSegmentMode        ( m_sliceSegmentMode         );
    394433    m_acTEncTop[layer].setSliceSegmentArgument    ( m_sliceSegmentArgument     );
     434#if LAYER_CTB
     435    Int iNumPartInCU = 1<<(m_acLayerCfg[layer].m_uiMaxCUDepth<<1);
     436#else
    395437    Int iNumPartInCU = 1<<(m_uiMaxCUDepth<<1);
     438#endif
    396439    if(m_sliceSegmentMode==FIXED_NUMBER_OF_LCU)
    397440    {
     
    417460    m_acTEncTop[layer].setSaoLcuBoundary (m_saoLcuBoundary);
    418461    m_acTEncTop[layer].setSaoLcuBasedOptimization (m_saoLcuBasedOptimization);
    419     m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag); 
    420     m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag); 
     462    m_acTEncTop[layer].setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
     463    m_acTEncTop[layer].setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    421464
    422465    m_acTEncTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     
    483526    if(uiTilesCount == 1)
    484527    {
    485       m_bLFCrossTileBoundaryFlag = true; 
     528      m_bLFCrossTileBoundaryFlag = true;
    486529    }
    487530    m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
     
    519562    m_acTEncTop[layer].setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    520563    m_acTEncTop[layer].setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    521     m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 
     564    m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    522565    m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    523566    m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc );
     
    550593    m_acTEncTop[layer].setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    551594    m_acTEncTop[layer].setElRapSliceTypeB(layer == 0? 0 : m_elRapSliceBEnabled);
    552 #if SCALED_REF_LAYER_OFFSETS
    553595    if( layer > 0 )
    554596    {
     
    557599      {
    558600        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    559                                                   2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); 
    560       }
    561     }
    562 #endif
     601                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     602      }
     603    }
    563604#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    564605    m_acTEncTop[layer].setAdaptiveResolutionChange( m_adaptiveResolutionChange );
    565606#endif
     607#if AUXILIARY_PICTURES
     608    m_acTEncTop[layer].setChromaFormatIDC( m_acLayerCfg[layer].m_chromaFormatIDC );
     609#endif
    566610  }
    567611}
    568 #else
     612#else //SVC_EXTENSION
    569613Void TAppEncTop::xInitLibCfg()
    570614{
     
    671715  m_cTEncTop.setQuadtreeTUMaxDepthIntra      ( m_uiQuadtreeTUMaxDepthIntra );
    672716  m_cTEncTop.setUseFastEnc                   ( m_bUseFastEnc  );
    673   m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  ); 
     717  m_cTEncTop.setUseEarlyCU                   ( m_bUseEarlyCU  );
    674718  m_cTEncTop.setUseFastDecisionForMerge      ( m_useFastDecisionForMerge  );
    675719  m_cTEncTop.setUseCbfFastMode            ( m_bUseCbfFastMode  );
     
    725769  m_cTEncTop.setSaoLcuBoundary (m_saoLcuBoundary);
    726770  m_cTEncTop.setSaoLcuBasedOptimization (m_saoLcuBasedOptimization);
    727   m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag); 
    728   m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag); 
     771  m_cTEncTop.setPCMInputBitDepthFlag  ( m_bPCMInputBitDepthFlag);
     772  m_cTEncTop.setPCMFilterDisableFlag  ( m_bPCMFilterDisableFlag);
    729773
    730774  m_cTEncTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     
    783827  if(uiTilesCount == 1)
    784828  {
    785     m_bLFCrossTileBoundaryFlag = true; 
     829    m_bLFCrossTileBoundaryFlag = true;
    786830  }
    787831  m_cTEncTop.setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag );
     
    809853  m_cTEncTop.setUseRecalculateQPAccordingToLambda( m_recalculateQPAccordingToLambda );
    810854  m_cTEncTop.setUseStrongIntraSmoothing( m_useStrongIntraSmoothing );
    811   m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 
     855  m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled );
    812856  m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag );
    813857  m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc );
     
    840884  m_cTEncTop.setLog2MaxMvLengthVertical( m_log2MaxMvLengthVertical );
    841885}
    842 #endif
     886#endif //SVC_EXTENSION
    843887
    844888Void TAppEncTop::xCreateLib()
     
    851895  for(UInt layer=0; layer<m_numLayers; layer++)
    852896  {
     897#if O0194_DIFFERENT_BITDEPTH_EL_BL
     898    //2
     899    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     900    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     901
     902    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     903    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     904#endif
     905#if LAYER_CTB
     906    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     907    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     908    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     909    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     910#endif
     911#if O0194_DIFFERENT_BITDEPTH_EL_BL
     912    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_acLayerCfg[layer].m_inputBitDepthY, m_acLayerCfg[layer].m_inputBitDepthC, m_acLayerCfg[layer].m_internalBitDepthY, m_acLayerCfg[layer].m_internalBitDepthC );  // read  mode
     913#else
    853914    m_acTVideoIOYuvInputFile[layer].open( (Char *)m_acLayerCfg[layer].getInputFile().c_str(),  false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
     915#endif
    854916    m_acTVideoIOYuvInputFile[layer].skipFrames(m_FrameSkip, m_acLayerCfg[layer].getSourceWidth() - m_acLayerCfg[layer].getPad()[0], m_acLayerCfg[layer].getSourceHeight() - m_acLayerCfg[layer].getPad()[1]);
    855917
    856918    if (!m_acLayerCfg[layer].getReconFile().empty())
    857919    {
     920#if O0194_DIFFERENT_BITDEPTH_EL_BL
     921      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_acLayerCfg[layer].m_outputBitDepthY, m_acLayerCfg[layer].m_outputBitDepthC, m_acLayerCfg[layer].m_internalBitDepthY, m_acLayerCfg[layer].m_internalBitDepthC );  // write mode
     922#else
    858923      m_acTVideoIOYuvReconFile[layer].open((Char *)m_acLayerCfg[layer].getReconFile().c_str(), true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // write mode
     924#endif
    859925    }
    860926
    861927    m_acTEncTop[layer].create();
    862928  }
    863 #else
     929#else //SVC_EXTENSION
    864930  m_cTVideoIOYuvInputFile.open( m_pchInputFile,     false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read  mode
    865931  m_cTVideoIOYuvInputFile.skipFrames(m_FrameSkip, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1]);
     
    870936  // Neo Decoder
    871937  m_cTEncTop.create();
    872 #endif
     938#endif //SVC_EXTENSION
    873939}
    874940
     
    882948  for(UInt layer=0; layer<m_numLayers; layer++)
    883949  {
     950#if LAYER_CTB
     951    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     952    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     953    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     954    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     955#endif
     956
    884957    m_acTVideoIOYuvInputFile[layer].close();
    885958    m_acTVideoIOYuvReconFile[layer].close();
     
    887960    m_acTEncTop[layer].destroy();
    888961  }
    889 #else
     962#else //SVC_EXTENSION
    890963  m_cTVideoIOYuvInputFile.close();
    891964  m_cTVideoIOYuvReconFile.close();
     
    893966  // Neo Decoder
    894967  m_cTEncTop.destroy();
    895 #endif
     968#endif //SVC_EXTENSION
    896969}
    897970
     
    901974  for(UInt layer=0; layer<m_numLayers; layer++)
    902975  {
     976#if O0194_DIFFERENT_BITDEPTH_EL_BL
     977    //3
     978    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     979    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     980
     981    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     982    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     983#endif
     984#if LAYER_CTB
     985    g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     986    g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     987    g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     988    g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     989
     990    memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     991    memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     992    memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     993    memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     994#endif
    903995    m_acTEncTop[layer].init(isFieldCoding);
    904996  }
     
    9151007    for(Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++)
    9161008    {
     1009#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1010      //4
     1011      g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
     1012      g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
     1013
     1014      g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
     1015      g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1016#endif
    9171017      vps->setLayerIdIncludedFlag(true, setId, layerId);
    9181018    }
     
    9301030    vps->setScalabilityMask(i, false);
    9311031  }
    932   if(m_numLayers > 1) 
     1032  if(m_numLayers > 1)
    9331033  {
    9341034    Int scalabilityTypes = 0;
     
    9381038      scalabilityTypes += m_scalabilityMask[i];
    9391039    }
     1040#if AUXILIARY_PICTURES
     1041    assert( scalabilityTypes <= 2 );
     1042#else
    9401043    assert( scalabilityTypes == 1 );
     1044#endif
    9411045    vps->setNumScalabilityTypes(scalabilityTypes);
    9421046  }
     
    9591063    vps->setDimensionId(i, 0, i);
    9601064  }
     1065#if AUXILIARY_PICTURES
     1066  if (m_scalabilityMask[3])
     1067  {
     1068    UInt maxAuxId = 0;
     1069    UInt auxDimIdLen = 0;
     1070    for(i = 1; i < vps->getMaxLayers(); i++)
     1071    {
     1072      if (m_acLayerCfg[i].getAuxId() > maxAuxId)
     1073      {
     1074        maxAuxId = m_acLayerCfg[i].getAuxId();
     1075      }
     1076    }
     1077    while((1 << auxDimIdLen) < (maxAuxId + 1))
     1078    {
     1079      auxDimIdLen++;
     1080    }
     1081    vps->setDimensionIdLen(1, auxDimIdLen);
     1082    for(i = 1; i < vps->getMaxLayers(); i++)
     1083    {
     1084      vps->setDimensionId(i, 1, m_acLayerCfg[i].getAuxId());
     1085    }
     1086  }
     1087#endif
    9611088#endif
    9621089#if N0120_MAX_TID_REF_PRESENT_FLAG
    9631090#if N0120_MAX_TID_REF_CFG
    9641091  vps->setMaxTidRefPresentFlag(m_maxTidRefPresentFlag);
    965 #else 
     1092#else
    9661093  vps->setMaxTidRefPresentFlag(true);
     1094#endif
     1095  if (vps->getMaxTidRefPresentFlag())
     1096  {
     1097    for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
     1098    {
     1099#if N0120_MAX_TID_REF_CFG
     1100#if O0225_MAX_TID_FOR_REF_LAYERS
     1101      for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1102      {
     1103        vps->setMaxTidIlRefPicsPlus1(i, j, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
     1104      }
     1105#else
     1106      vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
    9671107#endif
    968   if (vps->getMaxTidRefPresentFlag())
     1108#else
     1109#if O0225_MAX_TID_FOR_REF_LAYERS
     1110      for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1111      {
     1112        vps->setMaxTidIlRefPicsPlus1(i, j, vps->getMaxTLayers()+1);
     1113      }
     1114#else
     1115      vps->setMaxTidIlRefPicsPlus1(i, vps->getMaxTLayers()+1);
     1116#endif
     1117#endif
     1118    }
     1119  }
     1120  else
    9691121  {
    9701122    for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
    9711123    {
    972 #if N0120_MAX_TID_REF_CFG
    973       vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
    974 #else
    975       vps->setMaxTidIlRefPicsPlus1(i, vps->getMaxTLayers()+1);
     1124#if O0225_MAX_TID_FOR_REF_LAYERS
     1125      for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1126      {
     1127        vps->setMaxTidIlRefPicsPlus1(i, j, 7);
     1128      }
     1129#else
     1130      vps->setMaxTidIlRefPicsPlus1(i, 7);
    9761131#endif
    9771132    }
    9781133  }
    979   else
    980   {
    981     for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
    982     {
    983       vps->setMaxTidIlRefPicsPlus1(i, 7);
    984     }
    985   }
    986 #endif
     1134#endif
    9871135#if ILP_SSH_SIG
     1136#if ILP_SSH_SIG_FIX
     1137    vps->setIlpSshSignalingEnabledFlag(false);
     1138#else
    9881139    vps->setIlpSshSignalingEnabledFlag(true);
     1140#endif
    9891141#endif
    9901142#if VPS_EXTN_PROFILE_INFO
     
    9981150#endif
    9991151  // Target output layer
    1000 #if VPS_PROFILE_OUTPUT_LAYERS
    1001   vps->setNumOutputLayerSets(vps->getNumLayerSets());   
    1002   vps->setNumProfileTierLevel(vps->getNumLayerSets());   
     1152  vps->setNumOutputLayerSets(vps->getNumLayerSets());
     1153  vps->setNumProfileTierLevel(vps->getNumLayerSets());
    10031154  vps->setDefaultOneTargetOutputLayerFlag(true);
    10041155  for(i = 1; i < vps->getNumLayerSets(); i++)
    10051156  {
    10061157    vps->setProfileLevelTierIdx(i, i);
    1007     vps->setOutputLayerSetIdx(i, i);
    1008   }
    1009 #else
    1010   vps->setNumOutputLayerSets(1);
    1011   Int lsIdx = 1;
    1012   vps->setOutputLayerSetIdx(0, lsIdx); // Because only one layer set
    1013 #endif
     1158    vps->setOutputLayerSetIdx(i, i);
     1159  }
     1160
    10141161  for(Int lsIdx = 1; lsIdx < vps->getNumLayerSets(); lsIdx++)
    10151162  {
    1016     // Include the highest layer as output layer 
     1163    // Include the highest layer as output layer
    10171164    for(UInt layer=0; layer <= vps->getMaxLayerId() ; layer++)
    10181165    {
     
    10731220#endif
    10741221#endif
    1075 #if JCTVC_M0458_INTERLAYER_RPS_SIG       
    1076     vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true);
    1077 #endif
    1078 #if N0147_IRAP_ALIGN_FLAG   
    1079     vps->setCrossLayerIrapAlignFlag(true);
     1222#if JCTVC_M0458_INTERLAYER_RPS_SIG
     1223    vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true);
     1224#endif
     1225#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1226    for(i = 1; i< vps->getMaxLayers(); i++)
     1227    {
     1228      if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0  )
     1229      {
     1230        vps->setPocLsbNotPresentFlag(i, false);
     1231      }
     1232    }
     1233#endif
     1234#if N0147_IRAP_ALIGN_FLAG
     1235    vps->setCrossLayerIrapAlignFlag(true);
    10801236    for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    10811237    {
     
    10831239      {
    10841240        if (vps->getDirectDependencyFlag( layerCtr, refLayerCtr))
    1085         {         
     1241        {
    10861242          if(m_acTEncTop[layerCtr].getIntraPeriod() !=  m_acTEncTop[refLayerCtr].getIntraPeriod())
    10871243          {
     
    10971253      vps->setCrossLayerIrapAlignFlag(false);
    10981254    }
    1099 #endif 
     1255#endif
    11001256#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    11011257  vps->setSingleLayerForNonIrapFlag(m_adaptiveResolutionChange > 0 ? true : false);
    11021258#endif
     1259#if !VPS_EXTN_OFFSET_CALC
    11031260#if VPS_EXTN_OFFSET
    11041261  // to be updated according to the current semantics
    11051262  vps->setExtensionOffset( 0xffff );
    11061263#endif
     1264#endif
     1265
     1266#if O0215_PHASE_ALIGNMENT
     1267  vps->setPhaseAlignFlag( m_phaseAlignFlag );
     1268#endif
     1269
    11071270#else //SVC_EXTENSION
    11081271  m_cTEncTop.init(isFieldCoding);
     
    11481311  for(UInt layer=0; layer<m_numLayers; layer++)
    11491312  {
     1313#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1314    //5
     1315    g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1316    g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1317
     1318    g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1319    g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1320#endif
    11501321    // allocate original YUV buffer
    11511322    pcPicYuvOrg[layer] = new TComPicYuv;
     
    11531324    {
    11541325#if SVC_UPSAMPLING
     1326#if LAYER_CTB
     1327#if AUXILIARY_PICTURES
     1328      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1329#else
     1330      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1331#endif
     1332#else
     1333#if AUXILIARY_PICTURES
     1334      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1335#else
    11551336      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1337#endif
     1338#endif
    11561339#else
    11571340      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeightOrg(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    11611344    {
    11621345#if SVC_UPSAMPLING
     1346#if LAYER_CTB
     1347#if AUXILIARY_PICTURES
     1348      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1349#else
     1350      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1351#endif
     1352#else
     1353#if AUXILIARY_PICTURES
     1354      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1355#else
    11631356      pcPicYuvOrg[layer]->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1357#endif
     1358#endif
    11641359#else
    11651360      pcPicYuvOrg->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    11901385  while ( !bEos )
    11911386  {
    1192     // Read enough frames 
     1387    // Read enough frames
    11931388    Bool bFramesReadyToCode = false;
    11941389    while(!bFramesReadyToCode)
     
    11961391      for(UInt layer=0; layer<m_numLayers; layer++)
    11971392      {
     1393#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1394        //6
     1395        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1396        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1397
     1398        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1399        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1400#endif
     1401#if LAYER_CTB
     1402        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     1403        g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     1404        g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     1405        g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     1406#endif
     1407
    11981408        // get buffers
    11991409        xGetBuffer(pcPicYuvRec, layer);
     
    12011411        // read input YUV file
    12021412        m_acTVideoIOYuvInputFile[layer].read( pcPicYuvOrg[layer], m_acLayerCfg[layer].getPad() );
     1413
     1414#if AUXILIARY_PICTURES
     1415        if (m_acLayerCfg[layer].getChromaFormatIDC() == CHROMA_400)
     1416        {
     1417          pcPicYuvOrg[layer]->convertToMonochrome();
     1418        }
     1419#endif
    12031420
    12041421        if(layer == m_numLayers-1)
     
    12571474#endif
    12581475
    1259     // loop through frames in one GOP 
     1476    // loop through frames in one GOP
    12601477    for ( UInt iPicIdInGOP=0; iPicIdInGOP < (bFirstFrame? 1:m_iGOPSize); iPicIdInGOP++ )
    12611478    {
     
    12631480      for(UInt layer=0; layer<m_numLayers; layer++)
    12641481      {
     1482#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1483        //7
     1484        g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1485        g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1486
     1487        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1488        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1489#endif
     1490#if LAYER_CTB
     1491        g_uiMaxCUWidth  = g_auiLayerMaxCUWidth[layer];
     1492        g_uiMaxCUHeight = g_auiLayerMaxCUHeight[layer];
     1493        g_uiMaxCUDepth  = g_auiLayerMaxCUDepth[layer];
     1494        g_uiAddCUDepth  = g_auiLayerAddCUDepth[layer];
     1495
     1496        memcpy( g_auiZscanToRaster, g_auiLayerZscanToRaster[layer], sizeof( g_auiZscanToRaster ) );
     1497        memcpy( g_auiRasterToZscan, g_auiLayerRasterToZscan[layer], sizeof( g_auiRasterToZscan ) );
     1498        memcpy( g_auiRasterToPelX,  g_auiLayerRasterToPelX[layer],  sizeof( g_auiRasterToPelX ) );
     1499        memcpy( g_auiRasterToPelY,  g_auiLayerRasterToPelY[layer],  sizeof( g_auiRasterToPelY ) );
     1500#endif
    12651501        // call encoding function for one frame
    12661502        if ( m_isField )
     
    12881524    for(UInt layer=0; layer<m_numLayers; layer++)
    12891525    {
     1526#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1527      //8
     1528      g_bitDepthY = m_acLayerCfg[layer].m_internalBitDepthY;
     1529      g_bitDepthC = m_acLayerCfg[layer].m_internalBitDepthC;
     1530
     1531      g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthY : m_acLayerCfg[layer].m_internalBitDepthY;
     1532      g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layer].m_inputBitDepthC : m_acLayerCfg[layer].m_internalBitDepthC;
     1533#endif
    12901534      // write bistream to file if necessary
    12911535      iNumEncoded = m_acTEncTop[layer].getNumPicRcvd();
     
    15281772
    15291773#if SVC_UPSAMPLING
     1774#if LAYER_CTB
     1775#if AUXILIARY_PICTURES
     1776    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1777#else
     1778    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].m_uiMaxCUWidth, m_acLayerCfg[layer].m_uiMaxCUHeight, m_acLayerCfg[layer].m_uiMaxCUDepth, NULL );
     1779#endif
     1780#else
     1781#if AUXILIARY_PICTURES
     1782    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_acLayerCfg[layer].getChromaFormatIDC(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1783#else
    15301784    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth, NULL );
     1785#endif
     1786#endif
    15311787#else
    15321788    rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     
    15511807      delete pcPicYuvRec; pcPicYuvRec = NULL;
    15521808    }
    1553   } 
     1809  }
    15541810}
    15551811
     
    16021858#endif
    16031859      {
    1604         m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), 
     1860        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(),
    16051861          m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() );
    16061862      }
     
    16221878    for ( i = 0; i < iNumEncoded/2; i++ )
    16231879#endif
    1624     {     
     1880    {
    16251881      const AccessUnit& auTop = *(iterBitstream++);
    16261882      const vector<UInt>& statsTop = writeAnnexB(bitstreamFile, auTop);
  • trunk/source/App/utils/convert_NtoMbit_YCbCr.cpp

    r313 r494  
    8282
    8383  TComPicYuv frame;
     84#if AUXILIARY_PICTURES
     85frame.create( width, height, CHROMA_420, 1, 1, 0 );
     86#else
    8487  frame.create( width, height, 1, 1, 0 );
     88#endif
    8589
    8690  int pad[2] = {0, 0};
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r442 r494  
    130130extern Int g_bitDepthY;
    131131extern Int g_bitDepthC;
    132 
     132#if O0194_DIFFERENT_BITDEPTH_EL_BL
     133extern Int  g_bitDepthYLayer[MAX_LAYERS];
     134extern Int  g_bitDepthCLayer[MAX_LAYERS];
     135
     136extern UInt g_uiPCMBitDepthLumaDec[MAX_LAYERS];    // PCM bit-depth
     137extern UInt g_uiPCMBitDepthChromaDec[MAX_LAYERS];    // PCM bit-depth
     138#endif
     139#if O0194_WEIGHTED_PREDICTION_CGS
     140extern void* g_refWeightACDCParam; //type:wpACDCParam
     141#endif
    133142/** clip x, such that 0 <= x <= #g_maxLumaVal */
    134143template <typename T> inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); }
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r442 r494  
    18721872#endif
    18731873
     1874#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1875Bool TComDataCU::isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1)
     1876{
     1877  Bool checkILR = false;
     1878
     1879  if(uhInterDir&0x1)  //list0
     1880  {
     1881    Int refIdxL0 = cMvFieldL0.getRefIdx();
     1882    checkILR = getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->isILR(m_layerId);
     1883  }
     1884  if(uhInterDir&0x2)  //list1
     1885  {
     1886    Int refIdxL1  = cMvFieldL1.getRefIdx();
     1887    checkILR = checkILR || getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->isILR(m_layerId);
     1888  }
     1889
     1890  return checkILR;
     1891}
     1892#endif
     1893
    18741894UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx )
    18751895{
     
    40044024  uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY);
    40054025
     4026#if !LAYER_CTB
    40064027  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
    4007 
    4008 #if SCALED_REF_LAYER_OFFSETS
     4028#endif
     4029
    40094030  Int leftStartL = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset();
    40104031  Int topStartL  = this->getSlice()->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset();
    40114032  Int iBX = ((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
    40124033  Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    4013 #else
    4014   Int iBX = (uiPelX*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16;
    4015   Int iBY = (uiPelY*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16;
    4016 #endif
    40174034
    40184035#if N0139_POSITION_ROUNDING_OFFSET
     
    40244041#endif
    40254042
    4026 #if SCALED_REF_LAYER_OFFSETS
    40274043  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight() ||
    40284044       iBX < 0                                        || iBY < 0                                           )
     4045  {
     4046    return NULL;
     4047  }
     4048
     4049#if LAYER_CTB
     4050  UInt baseMaxCUHeight = cBaseColPic->getPicSym()->getMaxCUHeight();
     4051  UInt baseMaxCUWidth  = cBaseColPic->getPicSym()->getMaxCUWidth();
     4052  UInt baseMinUnitSize = cBaseColPic->getMinCUWidth();
     4053 
     4054  uiCUAddrBase = ( iBY / cBaseColPic->getPicSym()->getMaxCUHeight() ) * cBaseColPic->getFrameWidthInCU() + ( iBX / cBaseColPic->getPicSym()->getMaxCUWidth() );
    40294055#else
    4030   if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight())
     4056  uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
    40314057#endif
    4032   {
    4033     return NULL;
    4034   }
    4035 
    4036   uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
    40374058
    40384059  assert(uiCUAddrBase < cBaseColPic->getNumCUsInFrame());
    40394060
     4061#if LAYER_CTB
     4062  UInt uiRasterAddrBase = ( iBY - (iBY/baseMaxCUHeight)*baseMaxCUHeight ) / baseMinUnitSize * cBaseColPic->getNumPartInWidth() + ( iBX - (iBX/baseMaxCUWidth)*baseMaxCUWidth ) / baseMinUnitSize;
     4063 
     4064  uiAbsPartIdxBase = g_auiLayerRasterToZscan[cBaseColPic->getLayerId()][uiRasterAddrBase];
     4065#else
    40404066  UInt uiRasterAddrBase = (iBY - (iBY/g_uiMaxCUHeight)*g_uiMaxCUHeight)/uiMinUnitSize*cBaseColPic->getNumPartInWidth()
    40414067    + (iBX - (iBX/g_uiMaxCUWidth)*g_uiMaxCUWidth)/uiMinUnitSize;
    40424068
    40434069  uiAbsPartIdxBase = g_auiRasterToZscan[uiRasterAddrBase];
     4070#endif
    40444071
    40454072  return cBaseColPic->getCU(uiCUAddrBase);
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r442 r494  
    492492  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
    493493  Bool          isBipredRestriction( UInt puIdx );
     494#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     495  Bool          isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1);
     496#endif
    494497
    495498  // -------------------------------------------------------------------------------------------------------------------
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r442 r494  
    7979}
    8080#if SVC_UPSAMPLING
     81#if AUXILIARY_PICTURES
     82Void TComPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     83                      Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual)
     84#else
    8185Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
    8286                      Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual)
    83 
     87#endif
    8488{
    8589  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
    8690  if (!bIsVirtual)
    8791  {
     92#if AUXILIARY_PICTURES
     93    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     94#else
    8895    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    89   }
     96#endif
     97  }
     98#if AUXILIARY_PICTURES
     99  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     100#else
    90101  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     102#endif
    91103
    92104  for( Int i = 0; i < MAX_LAYERS; i++ )
     
    94106    if( m_bSpatialEnhLayer[i] )
    95107    {
     108#if AUXILIARY_PICTURES
     109      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     110#else
    96111      m_pcFullPelBaseRec[i] = new TComPicYuv;  m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     112#endif
    97113    }
    98114  }
     
    407423  {
    408424    m_pNDBFilterYuvTmp = new TComPicYuv();
     425#if AUXILIARY_PICTURES
     426    m_pNDBFilterYuvTmp->create(picWidth, picHeight, getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
     427#else
    409428    m_pNDBFilterYuvTmp->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
     429#endif
     430
    410431  }
    411432
     
    801822#endif
    802823
     824#if MFM_ENCCONSTRAINT
     825Bool TComPic::checkSameRefInfo()
     826{
     827  Bool bSameRefInfo = true;
     828  TComSlice * pSlice0 = getSlice( 0 );
     829  for( UInt uSliceID = getNumAllocatedSlice() - 1 ; bSameRefInfo && uSliceID > 0 ; uSliceID-- )
     830  {
     831    TComSlice * pSliceN = getSlice( uSliceID );
     832    if( pSlice0->getSliceType() != pSliceN->getSliceType() )
     833    {
     834      bSameRefInfo = false;
     835    }
     836    else if( pSlice0->getSliceType() != I_SLICE )
     837    {
     838      Int nListNum = pSlice0->getSliceType() == B_SLICE ? 2 : 1;
     839      for( Int nList = 0 ; nList < nListNum ; nList++ )
     840      {
     841        RefPicList eRefList = ( RefPicList )nList;
     842        if( pSlice0->getNumRefIdx( eRefList ) == pSliceN->getNumRefIdx( eRefList ) )
     843        {
     844          for( Int refIdx = pSlice0->getNumRefIdx( eRefList ) - 1 ; refIdx >= 0 ; refIdx-- )
     845          {
     846            if( pSlice0->getRefPic( eRefList , refIdx ) != pSliceN->getRefPic( eRefList , refIdx ) )
     847            {
     848              bSameRefInfo = false;
     849              break;
     850            }
     851          }
     852        }
     853        else
     854        {
     855          bSameRefInfo = false;
     856          break;
     857        }
     858      }
     859    }
     860  }
     861
     862  return( bSameRefInfo ); 
     863}
     864#endif
    803865
    804866//! \}
  • trunk/source/Lib/TLibCommon/TComPic.h

    r442 r494  
    102102  virtual ~TComPic();
    103103 
     104#if AUXILIARY_PICTURES
     105#if SVC_UPSAMPLING
     106  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     107                        Int *numReorderPics, TComSPS* pcSps = NULL, Bool bIsVirtual = false );
     108#else
     109  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     110                        Int *numReorderPics, Bool bIsVirtual = false );                       
     111#endif
     112#else
    104113#if SVC_UPSAMPLING
    105114  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     
    109118                        Int *numReorderPics, Bool bIsVirtual = false );                       
    110119#endif
     120#endif
    111121  virtual Void  destroy();
    112122 
     
    128138  Void          copyUpsampledMvField  ( UInt refLayerIdc, TComPic* pcPicBase );
    129139  Void          initUpsampledMvField  ();
     140#endif
     141#if MFM_ENCCONSTRAINT
     142  Bool          checkSameRefInfo();
    130143#endif
    131144
     
    163176 
    164177  Int           getStride()           { return m_apcPicYuv[1]->getStride(); }
     178#if AUXILIARY_PICTURES
     179  ChromaFormat  getChromaFormat() const { return m_apcPicYuv[1]->getChromaFormat(); }
     180#endif
    165181  Int           getCStride()          { return m_apcPicYuv[1]->getCStride(); }
    166182 
  • trunk/source/Lib/TLibCommon/TComPicSym.h

    r442 r494  
    126126  TComDataCU*&  getCU( UInt uiCUAddr )  { return m_apcTComDataCU[uiCUAddr];     }
    127127 
     128#if LAYER_CTB
     129  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
     130  UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
     131#endif
     132
    128133#if AVC_SYNTAX
    129134  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
  • trunk/source/Lib/TLibCommon/TComPicYuv.cpp

    r313 r494  
    6767{
    6868}
     69#if AUXILIARY_PICTURES
     70#if SVC_UPSAMPLING
     71Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
     72#else
     73Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
     74#endif
     75#else
    6976#if SVC_UPSAMPLING
    7077Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
    7178#else
    7279Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
     80#endif
    7381#endif
    7482{
     
    8694  m_iCuWidth        = uiMaxCUWidth;
    8795  m_iCuHeight       = uiMaxCUHeight;
     96#if AUXILIARY_PICTURES
     97  m_chromaFormatIDC = chromaFormatIDC;
     98#endif
    8899
    89100  Int numCuInWidth  = m_iPicWidth  / m_iCuWidth  + (m_iPicWidth  % m_iCuWidth  != 0);
    90101  Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
    91102 
     103#if LAYER_CTB
     104  m_iLumaMarginX    = uiMaxCUWidth  + 16; // for 16-byte alignment
     105  m_iLumaMarginY    = uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
     106#else
    92107  m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
    93108  m_iLumaMarginY    = g_uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
     109#endif
    94110 
    95111  m_iChromaMarginX  = m_iLumaMarginX>>1;
     
    234250}
    235251
     252#if AUXILIARY_PICTURES
     253Void TComPicYuv::convertToMonochrome()
     254{
     255  Int numPix = ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1));
     256  Pel grayVal = (1 << (g_bitDepthC - 1));
     257
     258  for (UInt i = 0; i < numPix; i++)
     259  {
     260    m_apiPicBufU[i] = grayVal;
     261    m_apiPicBufV[i] = grayVal;
     262  }
     263}
     264#endif
     265
    236266Void TComPicYuv::extendPicBorder ()
    237267{
  • trunk/source/Lib/TLibCommon/TComPicYuv.h

    r313 r494  
    7575  Int   m_iPicWidth;            ///< Width of picture
    7676  Int   m_iPicHeight;           ///< Height of picture
     77#if AUXILIARY_PICTURES
     78  ChromaFormat m_chromaFormatIDC; ////< Chroma Format
     79#endif
    7780 
    7881  Int   m_iCuWidth;             ///< Width of Coding Unit (CU)
     
    108111  //  Memory management
    109112  // ------------------------------------------------------------------------------------------------
     113#if AUXILIARY_PICTURES
     114#if SVC_UPSAMPLING
     115  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
     116#else
     117  Void  create      ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
     118#endif 
     119#else
    110120#if SVC_UPSAMPLING
    111121  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
     
    113123  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
    114124#endif 
     125#endif
    115126 
    116127  Void  destroy     ();
     
    125136  Int   getWidth    ()     { return  m_iPicWidth;    }
    126137  Int   getHeight   ()     { return  m_iPicHeight;   }
     138#if AUXILIARY_PICTURES
     139  ChromaFormat  getChromaFormat   ()                     const { return m_chromaFormatIDC; }
     140#endif
    127141 
    128142#if SVC_EXTENSION
     
    184198#endif
    185199
     200#if AUXILIARY_PICTURES
     201  Void convertToMonochrome();
     202#endif
     203
    186204  // Set border extension flag
    187205  Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r442 r494  
    765765
    766766#if SVC_UPSAMPLING
    767 #if SCALED_REF_LAYER_OFFSETS
     767#if O0215_PHASE_ALIGNMENT
     768#if O0194_JOINT_US_BITSHIFT
     769Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     770{
     771  m_cUsf.upsampleBasePic( currSlice, refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, phaseAlignFlag );
     772}
     773#else
     774Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     775{
     776  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, phaseAlignFlag );
     777}
     778#endif
     779#else
     780#if O0194_JOINT_US_BITSHIFT
     781Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
     782{
     783  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window);
     784}
     785#else
    768786Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window)
    769787{
    770788  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window);
    771789}
    772 #else
    773 Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic)
    774 {
    775   m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic);
    776 }
     790#endif
    777791#endif
    778792#endif
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r442 r494  
    120120#if SVC_EXTENSION
    121121#if SVC_UPSAMPLING
    122 #if SCALED_REF_LAYER_OFFSETS
     122#if O0215_PHASE_ALIGNMENT
     123#if O0194_JOINT_US_BITSHIFT
     124  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     125#else
     126  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     127#endif
     128#else
     129#if O0194_JOINT_US_BITSHIFT
     130  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     131#else
    123132  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
    124 #else
    125   Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
    126133#endif
    127134#endif
    128135#endif
     136#endif //SVC_EXTENSION
    129137};
    130138
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r313 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    6161  Double dRdCost = 0.0;
    6262  Double dLambda = 0.0;
    63  
     63
    6464  switch ( eDFunc )
    6565  {
     
    8080      break;
    8181  }
    82  
     82
    8383  if (bFlag)
    8484  {
     
    107107    }
    108108  }
    109  
     109
    110110  return dRdCost;
    111111}
     
    115115  Double dRdCost = 0.0;
    116116  Double dLambda = 0.0;
    117  
     117
    118118  switch ( eDFunc )
    119119  {
     
    134134      break;
    135135  }
    136  
     136
    137137  if (bFlag)
    138138  {
     
    161161    }
    162162  }
    163  
     163
    164164  return dRdCost;
    165165}
     
    178178{
    179179  m_afpDistortFunc[0]  = NULL;                  // for DF_DEFAULT
    180  
     180
    181181  m_afpDistortFunc[1]  = TComRdCost::xGetSSE;
    182182  m_afpDistortFunc[2]  = TComRdCost::xGetSSE4;
     
    186186  m_afpDistortFunc[6]  = TComRdCost::xGetSSE64;
    187187  m_afpDistortFunc[7]  = TComRdCost::xGetSSE16N;
    188  
     188
    189189  m_afpDistortFunc[8]  = TComRdCost::xGetSAD;
    190190  m_afpDistortFunc[9]  = TComRdCost::xGetSAD4;
     
    194194  m_afpDistortFunc[13] = TComRdCost::xGetSAD64;
    195195  m_afpDistortFunc[14] = TComRdCost::xGetSAD16N;
    196  
     196
    197197  m_afpDistortFunc[15] = TComRdCost::xGetSAD;
    198198  m_afpDistortFunc[16] = TComRdCost::xGetSAD4;
     
    202202  m_afpDistortFunc[20] = TComRdCost::xGetSAD64;
    203203  m_afpDistortFunc[21] = TComRdCost::xGetSAD16N;
    204  
     204
    205205#if AMP_SAD
    206206  m_afpDistortFunc[43] = TComRdCost::xGetSAD12;
     
    219219  m_afpDistortFunc[27] = TComRdCost::xGetHADs;
    220220  m_afpDistortFunc[28] = TComRdCost::xGetHADs;
    221  
     221
    222222#if !FIX203
    223223  m_puiComponentCostOriginP = NULL;
     
    239239  iSubPelSearchLimit += 4;
    240240  iSubPelSearchLimit *= 8;
    241  
     241
    242242  if( m_iSearchLimit != iSubPelSearchLimit )
    243243  {
    244244    xUninit();
    245    
     245
    246246    m_iSearchLimit = iSubPelSearchLimit;
    247    
     247
    248248    m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ];
    249249    iSubPelSearchLimit *= 2;
    250    
     250
    251251    m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit;
    252    
     252
    253253    for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++)
    254254    {
     
    272272  UInt uiLength = 1;
    273273  UInt uiTemp   = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1);
    274  
     274
    275275  assert ( uiTemp );
    276  
     276
    277277  while ( 1 != uiTemp )
    278278  {
     
    280280    uiLength += 2;
    281281  }
    282  
     282
    283283  return uiLength;
    284284}
     
    290290  rcDistParam.iRows    = uiBlkHeight;
    291291  rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    292  
     292
    293293  // initialize
    294294  rcDistParam.iSubShift  = 0;
     
    301301  rcDistParam.pOrg = pcPatternKey->getROIY();
    302302  rcDistParam.pCur = piRefY;
    303  
     303
    304304  rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride();
    305305  rcDistParam.iStrideCur = iRefStride;
    306  
     306
    307307  // set Block Width / Height
    308308  rcDistParam.iCols    = pcPatternKey->getROIYWidth();
    309309  rcDistParam.iRows    = pcPatternKey->getROIYHeight();
    310310  rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    311  
     311
    312312#if AMP_SAD
    313313  if (rcDistParam.iCols == 12)
     
    336336#endif
    337337{
     338#if O0194_WEIGHTED_PREDICTION_CGS
     339  // Bug fix: The correct bit depth has not been used for weighted cost calculation
     340  rcDistParam.bitDepth = g_bitDepthY;
     341#endif
    338342  // set Original & Curr Pointer / Stride
    339343  rcDistParam.pOrg = pcPatternKey->getROIY();
    340344  rcDistParam.pCur = piRefY;
    341  
     345
    342346  rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride();
    343347  rcDistParam.iStrideCur = iRefStride * iStep;
    344  
     348
    345349  // set Step for interpolated buffer
    346350  rcDistParam.iStep = iStep;
    347  
     351
    348352  // set Block Width / Height
    349353  rcDistParam.iCols    = pcPatternKey->getROIYWidth();
     
    352356  rcDistParam.bUseNSHAD = bUseNSHAD;
    353357#endif
    354  
     358
    355359  // set distortion function
    356360  if ( !bHADME )
     
    376380    rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    377381  }
    378  
     382
    379383  // initialize
    380384  rcDistParam.iSubShift  = 0;
     
    407411  UInt uiSum = 0;
    408412  Int x, y;
    409  
     413
    410414  if ( ( (iWidth % 8) == 0 ) && ( (iHeight % 8) == 0 ) )
    411415  {
     
    444448    }
    445449  }
    446  
     450
    447451  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8);
    448452
     
    523527  Int  iStrideCur = pcDtParam->iStrideCur;
    524528  Int  iStrideOrg = pcDtParam->iStrideOrg;
    525  
    526   UInt uiSum = 0;
    527  
     529
     530  UInt uiSum = 0;
     531
    528532  for( ; iRows != 0; iRows-- )
    529533  {
     
    535539    piCur += iStrideCur;
    536540  }
    537  
     541
    538542  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    539543}
     
    541545UInt TComRdCost::xGetSAD4( DistParam* pcDtParam )
    542546{
    543   if ( pcDtParam->bApplyWeight ) 
     547  if ( pcDtParam->bApplyWeight )
    544548  {
    545549    return xGetSADw( pcDtParam );
     
    552556  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    553557  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    554  
    555   UInt uiSum = 0;
    556  
     558
     559  UInt uiSum = 0;
     560
    557561  for( ; iRows != 0; iRows-=iSubStep )
    558562  {
     
    561565    uiSum += abs( piOrg[2] - piCur[2] );
    562566    uiSum += abs( piOrg[3] - piCur[3] );
    563    
    564     piOrg += iStrideOrg;
    565     piCur += iStrideCur;
    566   }
    567  
     567
     568    piOrg += iStrideOrg;
     569    piCur += iStrideCur;
     570  }
     571
    568572  uiSum <<= iSubShift;
    569573  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    583587  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    584588  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    585  
    586   UInt uiSum = 0;
    587  
     589
     590  UInt uiSum = 0;
     591
    588592  for( ; iRows != 0; iRows-=iSubStep )
    589593  {
     
    596600    uiSum += abs( piOrg[6] - piCur[6] );
    597601    uiSum += abs( piOrg[7] - piCur[7] );
    598    
    599     piOrg += iStrideOrg;
    600     piCur += iStrideCur;
    601   }
    602  
     602
     603    piOrg += iStrideOrg;
     604    piCur += iStrideCur;
     605  }
     606
    603607  uiSum <<= iSubShift;
    604608  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    618622  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    619623  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    620  
    621   UInt uiSum = 0;
    622  
     624
     625  UInt uiSum = 0;
     626
    623627  for( ; iRows != 0; iRows-=iSubStep )
    624628  {
     
    639643    uiSum += abs( piOrg[14] - piCur[14] );
    640644    uiSum += abs( piOrg[15] - piCur[15] );
    641    
    642     piOrg += iStrideOrg;
    643     piCur += iStrideCur;
    644   }
    645  
     645
     646    piOrg += iStrideOrg;
     647    piCur += iStrideCur;
     648  }
     649
    646650  uiSum <<= iSubShift;
    647651  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    662666  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    663667  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    664  
    665   UInt uiSum = 0;
    666  
     668
     669  UInt uiSum = 0;
     670
    667671  for( ; iRows != 0; iRows-=iSubStep )
    668672  {
     
    679683    uiSum += abs( piOrg[10] - piCur[10] );
    680684    uiSum += abs( piOrg[11] - piCur[11] );
    681    
    682     piOrg += iStrideOrg;
    683     piCur += iStrideCur;
    684   }
    685  
     685
     686    piOrg += iStrideOrg;
     687    piCur += iStrideCur;
     688  }
     689
    686690  uiSum <<= iSubShift;
    687691  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    699703  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    700704  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    701  
    702   UInt uiSum = 0;
    703  
     705
     706  UInt uiSum = 0;
     707
    704708  for( ; iRows != 0; iRows-=iSubStep )
    705709  {
     
    726730    piCur += iStrideCur;
    727731  }
    728  
     732
    729733  uiSum <<= iSubShift;
    730734  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    744748  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    745749  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    746  
    747   UInt uiSum = 0;
    748  
     750
     751  UInt uiSum = 0;
     752
    749753  for( ; iRows != 0; iRows-=iSubStep )
    750754  {
     
    781785    uiSum += abs( piOrg[30] - piCur[30] );
    782786    uiSum += abs( piOrg[31] - piCur[31] );
    783    
    784     piOrg += iStrideOrg;
    785     piCur += iStrideCur;
    786   }
    787  
     787
     788    piOrg += iStrideOrg;
     789    piCur += iStrideCur;
     790  }
     791
    788792  uiSum <<= iSubShift;
    789793  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    804808  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    805809  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    806  
    807   UInt uiSum = 0;
    808  
     810
     811  UInt uiSum = 0;
     812
    809813  for( ; iRows != 0; iRows-=iSubStep )
    810814  {
     
    833837    uiSum += abs( piOrg[22] - piCur[22] );
    834838    uiSum += abs( piOrg[23] - piCur[23] );
    835    
    836     piOrg += iStrideOrg;
    837     piCur += iStrideCur;
    838   }
    839  
     839
     840    piOrg += iStrideOrg;
     841    piCur += iStrideCur;
     842  }
     843
    840844  uiSum <<= iSubShift;
    841845  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    857861  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    858862  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    859  
    860   UInt uiSum = 0;
    861  
     863
     864  UInt uiSum = 0;
     865
    862866  for( ; iRows != 0; iRows-=iSubStep )
    863867  {
     
    926930    uiSum += abs( piOrg[62] - piCur[62] );
    927931    uiSum += abs( piOrg[63] - piCur[63] );
    928    
    929     piOrg += iStrideOrg;
    930     piCur += iStrideCur;
    931   }
    932  
     932
     933    piOrg += iStrideOrg;
     934    piCur += iStrideCur;
     935  }
     936
    933937  uiSum <<= iSubShift;
    934938  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    949953  Int  iStrideCur = pcDtParam->iStrideCur*iSubStep;
    950954  Int  iStrideOrg = pcDtParam->iStrideOrg*iSubStep;
    951  
    952   UInt uiSum = 0;
    953  
     955
     956  UInt uiSum = 0;
     957
    954958  for( ; iRows != 0; iRows-=iSubStep )
    955959  {
     
    10021006    uiSum += abs( piOrg[46] - piCur[46] );
    10031007    uiSum += abs( piOrg[47] - piCur[47] );
    1004    
    1005     piOrg += iStrideOrg;
    1006     piCur += iStrideCur;
    1007   }
    1008  
     1008
     1009    piOrg += iStrideOrg;
     1010    piCur += iStrideCur;
     1011  }
     1012
    10091013  uiSum <<= iSubShift;
    10101014  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     
    10281032  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10291033  Int  iStrideCur = pcDtParam->iStrideCur;
    1030  
     1034
    10311035  UInt uiSum = 0;
    10321036  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1033  
     1037
    10341038  Int iTemp;
    1035  
     1039
    10361040  for( ; iRows != 0; iRows-- )
    10371041  {
     
    10441048    piCur += iStrideCur;
    10451049  }
    1046  
     1050
    10471051  return ( uiSum );
    10481052}
     
    10601064  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10611065  Int  iStrideCur = pcDtParam->iStrideCur;
    1062  
     1066
    10631067  UInt uiSum = 0;
    10641068  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1065  
     1069
    10661070  Int  iTemp;
    1067  
     1071
    10681072  for( ; iRows != 0; iRows-- )
    10691073  {
    1070    
     1074
    10711075    iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10721076    iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10731077    iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift;
    10741078    iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1075    
    1076     piOrg += iStrideOrg;
    1077     piCur += iStrideCur;
    1078   }
    1079  
     1079
     1080    piOrg += iStrideOrg;
     1081    piCur += iStrideCur;
     1082  }
     1083
    10801084  return ( uiSum );
    10811085}
     
    10931097  Int  iStrideOrg = pcDtParam->iStrideOrg;
    10941098  Int  iStrideCur = pcDtParam->iStrideCur;
    1095  
     1099
    10961100  UInt uiSum = 0;
    10971101  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1098  
     1102
    10991103  Int  iTemp;
    1100  
     1104
    11011105  for( ; iRows != 0; iRows-- )
    11021106  {
     
    11091113    iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11101114    iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1111    
    1112     piOrg += iStrideOrg;
    1113     piCur += iStrideCur;
    1114   }
    1115  
     1115
     1116    piOrg += iStrideOrg;
     1117    piCur += iStrideCur;
     1118  }
     1119
    11161120  return ( uiSum );
    11171121}
     
    11291133  Int  iStrideOrg = pcDtParam->iStrideOrg;
    11301134  Int  iStrideCur = pcDtParam->iStrideCur;
    1131  
     1135
    11321136  UInt uiSum = 0;
    11331137  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    1134  
     1138
    11351139  Int  iTemp;
    1136  
     1140
    11371141  for( ; iRows != 0; iRows-- )
    11381142  {
    1139    
     1143
    11401144    iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11411145    iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    11541158    iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11551159    iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1156    
    1157     piOrg += iStrideOrg;
    1158     piCur += iStrideCur;
    1159   }
    1160  
     1160
     1161    piOrg += iStrideOrg;
     1162    piCur += iStrideCur;
     1163  }
     1164
    11611165  return ( uiSum );
    11621166}
     
    11741178  Int  iStrideOrg = pcDtParam->iStrideOrg;
    11751179  Int  iStrideCur = pcDtParam->iStrideCur;
    1176  
     1180
    11771181  UInt uiSum = 0;
    11781182  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    11791183  Int  iTemp;
    1180  
     1184
    11811185  for( ; iRows != 0; iRows-- )
    11821186  {
    11831187    for (Int n = 0; n < iCols; n+=16 )
    11841188    {
    1185      
     1189
    11861190      iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    11871191      iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    12001204      iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12011205      iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1202      
    1203     }
    1204     piOrg += iStrideOrg;
    1205     piCur += iStrideCur;
    1206   }
    1207  
     1206
     1207    }
     1208    piOrg += iStrideOrg;
     1209    piCur += iStrideCur;
     1210  }
     1211
    12081212  return ( uiSum );
    12091213}
     
    12211225  Int  iStrideOrg = pcDtParam->iStrideOrg;
    12221226  Int  iStrideCur = pcDtParam->iStrideCur;
    1223  
     1227
    12241228  UInt uiSum = 0;
    12251229  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    12261230  Int  iTemp;
    1227  
     1231
    12281232  for( ; iRows != 0; iRows-- )
    12291233  {
    1230    
     1234
    12311235    iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12321236    iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;
     
    12611265    iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift;
    12621266    iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1263    
    1264     piOrg += iStrideOrg;
    1265     piCur += iStrideCur;
    1266   }
    1267  
     1267
     1268    piOrg += iStrideOrg;
     1269    piCur += iStrideCur;
     1270  }
     1271
    12681272  return ( uiSum );
    12691273}
     
    12811285  Int  iStrideOrg = pcDtParam->iStrideOrg;
    12821286  Int  iStrideCur = pcDtParam->iStrideCur;
    1283  
     1287
    12841288  UInt uiSum = 0;
    12851289  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
    12861290  Int  iTemp;
    1287  
     1291
    12881292  for( ; iRows != 0; iRows-- )
    12891293  {
     
    13521356    iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift;
    13531357    iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift;
    1354    
    1355     piOrg += iStrideOrg;
    1356     piCur += iStrideCur;
    1357   }
    1358  
     1358
     1359    piOrg += iStrideOrg;
     1360    piCur += iStrideCur;
     1361  }
     1362
    13591363  return ( uiSum );
    13601364}
     
    13761380  m[2] = diff[0] - diff[2];
    13771381  m[3] = diff[1] - diff[3];
    1378  
     1382
    13791383  satd += abs(m[0] + m[1]);
    13801384  satd += abs(m[0] - m[1]);
    13811385  satd += abs(m[2] + m[3]);
    13821386  satd += abs(m[2] - m[3]);
    1383  
     1387
    13841388  return satd;
    13851389}
     
    13881392{
    13891393  Int k, satd = 0, diff[16], m[16], d[16];
    1390  
     1394
    13911395  assert( iStep == 1 );
    13921396  for( k = 0; k < 16; k+=4 )
     
    13961400    diff[k+2] = piOrg[2] - piCur[2];
    13971401    diff[k+3] = piOrg[3] - piCur[3];
    1398    
    1399     piCur += iStrideCur;
    1400     piOrg += iStrideOrg;
    1401   }
    1402  
     1402
     1403    piCur += iStrideCur;
     1404    piOrg += iStrideOrg;
     1405  }
     1406
    14031407  /*===== hadamard transform =====*/
    14041408  m[ 0] = diff[ 0] + diff[12];
     
    14181422  m[14] = diff[ 2] - diff[14];
    14191423  m[15] = diff[ 3] - diff[15];
    1420  
     1424
    14211425  d[ 0] = m[ 0] + m[ 4];
    14221426  d[ 1] = m[ 1] + m[ 5];
     
    14351439  d[14] = m[14] - m[10];
    14361440  d[15] = m[15] - m[11];
    1437  
     1441
    14381442  m[ 0] = d[ 0] + d[ 3];
    14391443  m[ 1] = d[ 1] + d[ 2];
     
    14521456  m[14] = d[13] - d[14];
    14531457  m[15] = d[12] - d[15];
    1454  
     1458
    14551459  d[ 0] = m[ 0] + m[ 1];
    14561460  d[ 1] = m[ 0] - m[ 1];
     
    14691473  d[14] = m[14] + m[15];
    14701474  d[15] = m[15] - m[14];
    1471  
     1475
    14721476  for (k=0; k<16; ++k)
    14731477  {
     
    14751479  }
    14761480  satd = ((satd+1)>>1);
    1477  
     1481
    14781482  return satd;
    14791483}
     
    14941498    diff[k+6] = piOrg[6] - piCur[6];
    14951499    diff[k+7] = piOrg[7] - piCur[7];
    1496    
    1497     piCur += iStrideCur;
    1498     piOrg += iStrideOrg;
    1499   }
    1500  
     1500
     1501    piCur += iStrideCur;
     1502    piOrg += iStrideOrg;
     1503  }
     1504
    15011505  //horizontal
    15021506  for (j=0; j < 8; j++)
     
    15111515    m2[j][6] = diff[jj+2] - diff[jj+6];
    15121516    m2[j][7] = diff[jj+3] - diff[jj+7];
    1513    
     1517
    15141518    m1[j][0] = m2[j][0] + m2[j][2];
    15151519    m1[j][1] = m2[j][1] + m2[j][3];
     
    15201524    m1[j][6] = m2[j][4] - m2[j][6];
    15211525    m1[j][7] = m2[j][5] - m2[j][7];
    1522    
     1526
    15231527    m2[j][0] = m1[j][0] + m1[j][1];
    15241528    m2[j][1] = m1[j][0] - m1[j][1];
     
    15301534    m2[j][7] = m1[j][6] - m1[j][7];
    15311535  }
    1532  
     1536
    15331537  //vertical
    15341538  for (i=0; i < 8; i++)
     
    15421546    m3[6][i] = m2[2][i] - m2[6][i];
    15431547    m3[7][i] = m2[3][i] - m2[7][i];
    1544    
     1548
    15451549    m1[0][i] = m3[0][i] + m3[2][i];
    15461550    m1[1][i] = m3[1][i] + m3[3][i];
     
    15511555    m1[6][i] = m3[4][i] - m3[6][i];
    15521556    m1[7][i] = m3[5][i] - m3[7][i];
    1553    
     1557
    15541558    m2[0][i] = m1[0][i] + m1[1][i];
    15551559    m2[1][i] = m1[0][i] - m1[1][i];
     
    15611565    m2[7][i] = m1[6][i] - m1[7][i];
    15621566  }
    1563  
     1567
    15641568  for (i = 0; i < 8; i++)
    15651569  {
     
    15691573    }
    15701574  }
    1571  
     1575
    15721576  sad=((sad+2)>>2);
    1573  
     1577
    15741578  return sad;
    15751579}
     
    16811685  //vertical
    16821686  for (i=0; i < 16; i++)
    1683   {   
     1687  {
    16841688    m2[0][i] = m1[0][i] + m1[2][i];
    16851689    m2[1][i] = m1[1][i] + m1[3][i];
     
    18381842  Int  iOffsetOrg = iStrideOrg<<2;
    18391843  Int  iOffsetCur = iStrideCur<<2;
    1840  
    1841   UInt uiSum = 0;
    1842  
     1844
     1845  UInt uiSum = 0;
     1846
    18431847  for ( y=0; y<iRows; y+= 4 )
    18441848  {
     
    18471851    piCur += iOffsetCur;
    18481852  }
    1849  
     1853
    18501854  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    18511855}
     
    18641868  Int  iStep  = pcDtParam->iStep;
    18651869  Int  y;
    1866  
    1867   UInt uiSum = 0;
    1868  
     1870
     1871  UInt uiSum = 0;
     1872
    18691873  if ( iRows == 4 )
    18701874  {
     
    18831887    }
    18841888  }
    1885  
     1889
    18861890  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    18871891}
     
    19001904  Int  iStrideOrg = pcDtParam->iStrideOrg;
    19011905  Int  iStep  = pcDtParam->iStep;
    1902  
     1906
    19031907  Int  x, y;
    1904  
    1905   UInt uiSum = 0;
    1906  
     1908
     1909  UInt uiSum = 0;
     1910
    19071911#if NS_HAD
    19081912  if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) )
     
    19241928  }
    19251929#if NS_HAD
    1926   else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) 
     1930  else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD )
    19271931  {
    19281932    Int  iOffsetOrg = iStrideOrg<<2;
     
    19381942    }
    19391943  }
    1940   else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) 
     1944  else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD )
    19411945  {
    19421946    Int  iOffsetOrg = iStrideOrg<<4;
     
    19571961    Int  iOffsetOrg = iStrideOrg<<2;
    19581962    Int  iOffsetCur = iStrideCur<<2;
    1959    
     1963
    19601964    for ( y=0; y<iRows; y+= 4 )
    19611965    {
     
    19861990    assert(false);
    19871991  }
    1988  
     1992
    19891993  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    19901994}
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r442 r494  
    8686// Data structure related table & variable
    8787// ====================================================================================================================
    88 
     88#if LAYER_CTB
     89UInt g_auiLayerMaxCUWidth[MAX_LAYERS];
     90UInt g_auiLayerMaxCUHeight[MAX_LAYERS];
     91UInt g_auiLayerMaxCUDepth[MAX_LAYERS];
     92UInt g_auiLayerAddCUDepth[MAX_LAYERS];
     93UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     94UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     95UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     96UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     97#endif
    8998UInt g_uiMaxCUWidth  = MAX_CU_SIZE;
    9099UInt g_uiMaxCUHeight = MAX_CU_SIZE;
     
    312321UInt g_uiPCMBitDepthLuma     = 8;    // PCM bit-depth
    313322UInt g_uiPCMBitDepthChroma   = 8;    // PCM bit-depth
    314 
     323#if O0194_DIFFERENT_BITDEPTH_EL_BL
     324Int  g_bitDepthYLayer[MAX_LAYERS];
     325Int  g_bitDepthCLayer[MAX_LAYERS];
     326
     327UInt g_uiPCMBitDepthLumaDec[MAX_LAYERS];    // PCM bit-depth
     328UInt g_uiPCMBitDepthChromaDec[MAX_LAYERS];    // PCM bit-depth
     329#endif
     330#if O0194_WEIGHTED_PREDICTION_CGS
     331void * g_refWeightACDCParam; // type=wpACDCParam
     332#endif
    315333// ====================================================================================================================
    316334// Misc.
  • trunk/source/Lib/TLibCommon/TComRom.h

    r442 r494  
    8181
    8282// global variable (LCU width/height, max. CU depth)
     83#if LAYER_CTB
     84extern       UInt g_auiLayerMaxCUWidth[MAX_LAYERS];
     85extern       UInt g_auiLayerMaxCUHeight[MAX_LAYERS];
     86extern       UInt g_auiLayerMaxCUDepth[MAX_LAYERS];
     87extern       UInt g_auiLayerAddCUDepth[MAX_LAYERS];
     88extern       UInt g_auiLayerZscanToRaster[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     89extern       UInt g_auiLayerRasterToZscan[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     90extern       UInt g_auiLayerRasterToPelX[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     91extern       UInt g_auiLayerRasterToPelY[MAX_LAYERS][ MAX_NUM_SPU_W*MAX_NUM_SPU_W ];
     92#endif
    8393extern       UInt g_uiMaxCUWidth;
    8494extern       UInt g_uiMaxCUHeight;
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r442 r494  
    7575, m_iDepth                        ( 0 )
    7676, m_bRefenced                     ( false )
    77 #if POC_RESET_FLAG
    78 , m_bPocResetFlag                 ( false )
    79 #endif
    80 #if SH_DISCARDABLE_FLAG
    81 , m_bDiscardableFlag              ( false )
    82 #endif
    8377, m_pcSPS                         ( NULL )
    8478, m_pcPPS                         ( NULL )
     
    9387#endif
    9488, m_uiTLayer                      ( 0 )
    95 #if SVC_EXTENSION
    96 , m_layerId                     ( 0 )
    97 #endif
    9889, m_bTLayerSwitchingFlag          ( false )
    9990, m_sliceMode                   ( 0 )
     
    118109, m_temporalLayerNonReferenceFlag ( false )
    119110, m_enableTMVPFlag                ( true )
     111#if SVC_EXTENSION
     112, m_layerId                     ( 0 )
     113#if REF_IDX_MFM
     114, m_bMFMEnabledFlag               ( false )
     115#endif
     116#if POC_RESET_FLAG
     117, m_bPocResetFlag                 ( false )
     118#endif
     119, m_bDiscardableFlag              ( false )
     120#endif //SVC_EXTENSION
    120121{
    121122  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0;
     
    138139  m_interLayerSamplePredOnlyFlag = false;
    139140#endif
    140 #endif
     141#endif //SVC_EXTENSION
    141142
    142143  initEqualRef();
     
    455456    UInt refLayerIdc = m_interLayerPredLayerIdc[i];
    456457    //inter-layer reference picture
    457 
    458 #if ILR_RESTR
     458#if O0225_MAX_TID_FOR_REF_LAYERS
     459    Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId) : 0;
     460#else
    459461    Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()) : 0;
     462#endif
    460463    if( m_layerId > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=  maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )  )
    461 #else //#if ILR_RESTR
    462     if( m_layerId > 0 && m_activeNumILRRefIdx > 0 )
    463 #endif //#if ILR_RESTR
    464464    {
    465465#if REF_IDX_MFM
     
    485485  TComPic*  rpsCurrList1[MAX_NUM_REF+1];
    486486#if SVC_EXTENSION
    487 #if ILR_RESTR
    488487  Int numInterLayerRPSPics = 0;
    489488#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     
    495494    for( i=0; i < m_pcVPS->getNumDirectRefLayers( m_layerId ); i++ )
    496495    {
     496#if O0225_MAX_TID_FOR_REF_LAYERS
     497      Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[i]->getSlice(0)->getLayerId(),m_layerId);
     498#else
    497499      Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[i]->getSlice(0)->getLayerId());
     500#endif
    498501      if( ((Int)(ilpPic[i]->getSlice(0)->getTLayer())<= maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[i]->getSlice(0)->getRapPicFlag() ) )
    499502      {
     
    574577#endif
    575578  }
    576 #endif
    577579#if JCTVC_M0458_INTERLAYER_RPS_SIG
    578580  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_activeNumILRRefIdx;
     
    580582  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr + m_numILRRefIdx;
    581583#endif
    582 #else
     584#else //SVC_EXTENSION
    583585  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    584 #endif
     586#endif //SVC_EXTENSION
    585587#if FIX1071
    586588  if (checkNumPocTotalCurr)
     
    631633#if RPL_INIT_N0316_N0082
    632634    if( m_layerId > 0 )
    633     {
     635    {     
    634636#if JCTVC_M0458_INTERLAYER_RPS_SIG
    635637      for( i = 0; i < m_activeNumILRRefIdx && cIdx < numPocTotalCurr; cIdx ++, i ++)     
     
    639641      {
    640642        Int refLayerIdc = m_interLayerPredLayerIdc[i];
    641 #if ILR_RESTR
     643#if O0225_MAX_TID_FOR_REF_LAYERS
     644        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId);
     645#else
    642646        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     647#endif
    643648        if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )
    644 #endif
     649        {
    645650          rpsCurrList0[cIdx] = ilpPic[refLayerIdc];
    646       }
    647     }
    648 #endif
    649 #endif
     651        }
     652      }
     653    }
     654#endif
     655#endif //SVC_EXTENSION
    650656    for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    651657    {
     
    667673      {
    668674        Int refLayerIdc = m_interLayerPredLayerIdc[i];
    669 #if ILR_RESTR
    670          Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     675#if O0225_MAX_TID_FOR_REF_LAYERS
     676        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId);
     677#else
     678        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     679#endif
    671680        if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )
    672 #endif
    673         rpsCurrList0[cIdx] = ilpPic[refLayerIdc];
     681        {
     682          rpsCurrList0[cIdx] = ilpPic[refLayerIdc];
     683        }
    674684      }
    675685    }
     
    704714      {
    705715        Int refLayerIdc = m_interLayerPredLayerIdc[i];
    706 #if ILR_RESTR
     716#if O0225_MAX_TID_FOR_REF_LAYERS
     717        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId);
     718#else
    707719        Int maxTidIlRefPicsPlus1 = getVPS()->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId());
     720#endif
    708721        if( ((Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) )
    709 #endif
    710         rpsCurrList1[cIdx] = ilpPic[refLayerIdc];
    711       }
    712     }
    713 #endif
     722        {
     723          rpsCurrList1[cIdx] = ilpPic[refLayerIdc];
     724        }
     725      }
     726    }
     727#endif //SVC_EXTENSION
    714728
    715729    assert(cIdx == numPocTotalCurr);
     
    781795#if N0147_IRAP_ALIGN_FLAG
    782796  hasModification = hasModification && ( m_aiNumRefIdx[REF_PIC_LIST_0] > 1 );
    783 #endif
    784 #if FINAL_RPL_CHANGE_N0082
    785   hasModification = false; //modification is not necessary
    786797#endif
    787798  refPicListModification->setRefPicListModificationFlagL0(hasModification);
     
    11331144#if SVC_EXTENSION
    11341145  m_pcVPS                = pSrc->m_pcVPS;
     1146  m_layerId              = pSrc->m_layerId;
    11351147#if JCTVC_M0458_INTERLAYER_RPS_SIG
    11361148  m_activeNumILRRefIdx         = pSrc->m_activeNumILRRefIdx;
     
    18471859  return retVal;
    18481860}
     1861#if AUXILIARY_PICTURES
     1862ChromaFormat TComSlice::getChromaFormatIdc()
     1863#else
    18491864UInt TComSlice::getChromaFormatIdc()
     1865#endif
     1866{
     1867  TComSPS *sps = getSPS();
     1868  TComVPS *vps = getVPS();
     1869#if AUXILIARY_PICTURES
     1870  ChromaFormat retVal;
     1871  UInt layerId = getLayerId();
     1872#else
     1873  UInt retVal, layerId = getLayerId();
     1874#endif
     1875  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
     1876  {
     1877    retVal = sps->getChromaFormatIdc();
     1878  }
     1879  else
     1880  {
     1881    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc();
     1882  }
     1883  return retVal;
     1884}
     1885UInt TComSlice::getBitDepthY()
    18501886{
    18511887  TComSPS *sps = getSPS();
     
    18541890  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
    18551891  {
    1856     retVal = sps->getChromaFormatIdc();
     1892    retVal = sps->getBitDepthY();
    18571893  }
    18581894  else
    18591895  {
    1860     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getChromaFormatVpsIdc();
     1896    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma();
    18611897  }
    18621898  return retVal;
    18631899}
    1864 UInt TComSlice::getBitDepthY()
     1900UInt TComSlice::getBitDepthC()
    18651901{
    18661902  TComSPS *sps = getSPS();
     
    18691905  if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
    18701906  {
    1871     retVal = sps->getBitDepthY();
     1907    retVal = sps->getBitDepthC();
    18721908  }
    18731909  else
    18741910  {
    1875     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsLuma();
     1911    retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma();
    18761912  }
    18771913  return retVal;
    18781914}
    1879 UInt TComSlice::getBitDepthC()
    1880 {
    1881   TComSPS *sps = getSPS();
    1882   TComVPS *vps = getVPS();
    1883   UInt retVal, layerId = getLayerId();
    1884   if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() )
    1885   {
    1886     retVal = sps->getBitDepthC();
    1887   }
    1888   else
    1889   {
    1890     retVal = vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getBitDepthVpsChroma();
    1891   }
    1892   return retVal;
    1893 }
    18941915Int TComSlice::getQpBDOffsetY()
    18951916{
     
    19021923
    19031924RepFormat::RepFormat()
     1925#if AUXILIARY_PICTURES
     1926: m_chromaFormatVpsIdc          (CHROMA_420)
     1927#else
    19041928: m_chromaFormatVpsIdc          (0)
     1929#endif
    19051930, m_separateColourPlaneVpsFlag  (false)
    19061931, m_picWidthVpsInLumaSamples    (0)
     
    19141939// Video parameter set (VPS)
    19151940// ------------------------------------------------------------------------------------------------
     1941#if SVC_EXTENSION
    19161942TComVPS::TComVPS()
    19171943: m_VPSId                     (  0)
     
    19331959, m_numOutputLayerSets        (0) 
    19341960#endif
    1935 #if VPS_PROFILE_OUTPUT_LAYERS
    19361961, m_numProfileTierLevel       (0)
    19371962, m_moreOutputLayerSetsThanDefaultFlag (false)
    19381963, m_numAddOutputLayerSets     (0)
    19391964, m_defaultOneTargetOutputLayerFlag    (false)
    1940 #endif
    19411965#if VPS_VUI_BITRATE_PICRATE
    19421966, m_bitRatePresentVpsFlag     (false)
     
    19922016  ::memset(m_numLayerInIdList,     0, sizeof(m_numLayerInIdList   ));
    19932017#endif
    1994 #if VPS_PROFILE_OUTPUT_LAYERS
    19952018  ::memset(m_profileLevelTierIdx,  0, sizeof(m_profileLevelTierIdx));
    1996 #endif
    19972019#if JCTVC_M0458_INTERLAYER_RPS_SIG
    19982020  m_maxOneActiveRefLayerFlag = true;
     2021#endif
     2022#if O0062_POC_LSB_NOT_PRESENT_FLAG
     2023  ::memset(m_pocLsbNotPresentFlag, 0, sizeof(m_pocLsbNotPresentFlag));
    19992024#endif
    20002025#if N0147_IRAP_ALIGN_FLAG
     
    20072032  for( Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++)
    20082033  {
     2034#if O0225_MAX_TID_FOR_REF_LAYERS
     2035  for( Int j = 0; j < MAX_VPS_LAYER_ID_PLUS1; j++)
     2036  {
     2037    m_maxTidIlRefPicsPlus1[i][j] = m_uiMaxTLayers + 1;
     2038  }
     2039#else
    20092040    m_maxTidIlRefPicsPlus1[i] = m_uiMaxTLayers + 1;
     2041#endif
    20102042  }
    20112043#endif
     
    20342066#endif
    20352067}
     2068#else
     2069TComVPS::TComVPS()
     2070: m_VPSId                     (  0)
     2071, m_uiMaxTLayers              (  1)
     2072, m_uiMaxLayers               (  1)
     2073, m_bTemporalIdNestingFlag    (false)
     2074, m_numHrdParameters          (  0)
     2075, m_maxNuhReservedZeroLayerId (  0)
     2076, m_hrdParameters             (NULL)
     2077, m_hrdOpSetIdx               (NULL)
     2078, m_cprmsPresentFlag          (NULL)
     2079{
     2080  for( Int i = 0; i < MAX_TLAYER; i++)
     2081  {
     2082    m_numReorderPics[i] = 0;
     2083    m_uiMaxDecPicBuffering[i] = 1;
     2084    m_uiMaxLatencyIncrease[i] = 0;
     2085  }
     2086}
     2087#endif //SVC_EXTENSION
    20362088
    20372089TComVPS::~TComVPS()
     
    21632215, m_vuiParametersPresentFlag  (false)
    21642216, m_vuiParameters             ()
     2217#if SVC_EXTENSION
    21652218#if M0463_VUI_EXT_ILP_REF
    21662219, m_interViewMvVertConstraintFlag (false)
    21672220, m_numIlpRestrictedRefLayers ( 0 )
    21682221#endif
    2169 #if SVC_EXTENSION
    2170 , m_layerId(0)
    2171 #endif
    2172 #if SCALED_REF_LAYER_OFFSETS
    2173 , m_numScaledRefLayerOffsets  (0)
    2174 #endif
     2222, m_layerId                   ( 0 )
     2223, m_numScaledRefLayerOffsets  ( 0 )
    21752224#if REPN_FORMAT_IN_VPS
    21762225, m_updateRepFormatFlag       (false)
    21772226#endif
     2227#endif //SVC_EXTENSION
    21782228{
    21792229  for ( Int i = 0; i < MAX_TLAYER; i++ )
     
    30383088#endif
    30393089}
    3040 #endif
     3090
     3091#if MFM_ENCCONSTRAINT
     3092TComPic* TComSlice::getBaseColPic(  TComList<TComPic*>& rcListPic )
     3093{
     3094#if POC_RESET_FLAG
     3095  return xGetRefPic( rcListPic, m_bPocResetFlag ? 0 : m_iPOC );
     3096#else
     3097  return xGetRefPic( rcListPic, m_iPOC );
     3098#endif
     3099}
     3100#endif
    30413101
    30423102#if REF_IDX_MFM
     
    30853145#endif
    30863146
     3147Void TComSlice::setILRPic(TComPic **pcIlpPic)
     3148{
     3149  for( Int i = 0; i < m_activeNumILRRefIdx; i++ )
     3150  {
     3151    Int refLayerIdc = m_interLayerPredLayerIdc[i];
     3152
     3153    if( pcIlpPic[refLayerIdc] )
     3154    {
     3155      pcIlpPic[refLayerIdc]->copyUpsampledPictureYuv( m_pcPic->getFullPelBaseRec( refLayerIdc ), pcIlpPic[refLayerIdc]->getPicYuvRec() );
     3156      pcIlpPic[refLayerIdc]->getSlice(0)->setPOC( m_iPOC );
     3157      pcIlpPic[refLayerIdc]->setLayerId( m_pcBaseColPic[refLayerIdc]->getLayerId() ); //set reference layerId
     3158      pcIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension( false );
     3159      pcIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder();
     3160      for (Int j=0; j<pcIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++)    // set reference CU layerId
     3161      {
     3162        pcIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId( pcIlpPic[refLayerIdc]->getLayerId() );
     3163      }
     3164    }
     3165  }
     3166}
     3167
     3168#endif //SVC_EXTENSION
     3169
    30873170//! \}
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r442 r494  
    436436class RepFormat
    437437{
     438#if AUXILIARY_PICTURES
     439  ChromaFormat m_chromaFormatVpsIdc;
     440#else
    438441  Int  m_chromaFormatVpsIdc;
     442#endif
    439443  Bool m_separateColourPlaneVpsFlag;
    440444  Int  m_picWidthVpsInLumaSamples;
     
    446450  RepFormat();
    447451
     452#if AUXILIARY_PICTURES
     453  ChromaFormat getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
     454  Void setChromaFormatVpsIdc(ChromaFormat x)  { m_chromaFormatVpsIdc = x;    }
     455#else
    448456  Int  getChromaFormatVpsIdc()        { return m_chromaFormatVpsIdc; }
    449457  Void setChromaFormatVpsIdc(Int x)   { m_chromaFormatVpsIdc = x;    }
     458#endif
    450459
    451460  Bool getSeparateColourPlaneVpsFlag()        { return m_separateColourPlaneVpsFlag; }
     
    484493  UInt*       m_hrdOpSetIdx;
    485494  Bool*       m_cprmsPresentFlag;
     495#if !SVC_EXTENSION
     496  UInt        m_numOpSets;
     497  Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
     498#endif
     499  TComPTL     m_pcPTL;
     500  TimingInfo  m_timingInfo;
     501
     502#if SVC_EXTENSION
     503#if DERIVE_LAYER_ID_LIST_VARIABLES
     504  Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     505  Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
     506#endif
     507#if IL_SL_SIGNALLING_N0371
     508  Bool        m_scalingListLayerDependency[MAX_LAYERS][MAX_LAYERS];  // layer dependency for scaling list
     509#endif
     510#if VPS_EXTN_OFFSET
     511  UInt        m_extensionOffset;
     512#endif
    486513#if VPS_RENAME
    487514  UInt        m_maxLayerId;
    488515  UInt        m_numLayerSets;
    489516  Bool        m_layerIdIncludedFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    490 #else
    491   UInt        m_numOpSets;
    492   Bool        m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
    493 #endif
    494 #if DERIVE_LAYER_ID_LIST_VARIABLES
    495   Int         m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    496   Int         m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
    497 #endif
    498 #if IL_SL_SIGNALLING_N0371
    499   Bool        m_scalingListLayerDependency[MAX_LAYERS][MAX_LAYERS];  // layer dependency for scaling list
    500 #endif
    501 #if VPS_EXTN_OFFSET
    502   UInt        m_extensionOffset;
    503 #endif
    504   TComPTL     m_pcPTL;
    505   TimingInfo  m_timingInfo;
     517#endif
    506518
    507519  // ------------------------------------------
     
    546558#endif
    547559#endif
    548 #if VPS_PROFILE_OUTPUT_LAYERS
    549560  UInt       m_numProfileTierLevel;
    550561  Bool       m_moreOutputLayerSetsThanDefaultFlag;
     
    552563  Bool       m_defaultOneTargetOutputLayerFlag;
    553564  Int        m_profileLevelTierIdx[64];     
    554 #endif
    555565#if JCTVC_M0458_INTERLAYER_RPS_SIG
    556566  Bool       m_maxOneActiveRefLayerFlag;
    557567#endif
     568#if O0062_POC_LSB_NOT_PRESENT_FLAG
     569  Bool       m_pocLsbNotPresentFlag[MAX_VPS_LAYER_ID_PLUS1];
     570#endif
    558571#if N0147_IRAP_ALIGN_FLAG
    559572  Bool       m_crossLayerIrapAlignFlag;
    560573#endif
    561574#if JCTVC_M0203_INTERLAYER_PRED_IDC
     575#if O0225_MAX_TID_FOR_REF_LAYERS
     576  UInt       m_maxTidIlRefPicsPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1][MAX_VPS_LAYER_ID_PLUS1];
     577#else
    562578  UInt       m_maxTidIlRefPicsPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1];
     579#endif
    563580#endif
    564581#if N0120_MAX_TID_REF_PRESENT_FLAG
     
    597614  Int         m_viewIdVal                [MAX_LAYERS];
    598615#endif
     616
     617#if O0215_PHASE_ALIGNMENT
     618  Bool       m_phaseAlignFlag;
     619#endif
     620#endif //SVC_EXTENSION
    599621public:
    600622  TComVPS();
     
    637659  UInt    getNumHrdParameters()                                 { return m_numHrdParameters; }
    638660  Void    setNumHrdParameters(UInt v)                           { m_numHrdParameters = v;    }
    639 
    640 #if VPS_RENAME
    641   UInt    getMaxLayerId()                                       { return m_maxLayerId; }
    642   Void    setMaxLayerId(UInt v)                                 { m_maxLayerId = v;    }
    643 
    644   UInt    getNumLayerSets()                                     { return m_numLayerSets; }
    645   Void    setNumLayerSets(UInt v)                               { m_numLayerSets = v;    }
    646 #else
     661 
     662#if !SVC_EXTENSION
    647663  UInt    getMaxNuhReservedZeroLayerId()                        { return m_maxNuhReservedZeroLayerId; }
    648664  Void    setMaxNuhReservedZeroLayerId(UInt v)                  { m_maxNuhReservedZeroLayerId = v;    }
     
    653669  Bool    getLayerIdIncludedFlag(UInt opsIdx, UInt id)          { return m_layerIdIncludedFlag[opsIdx][id]; }
    654670  Void    setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)  { m_layerIdIncludedFlag[opsIdx][id] = v;    }
     671
     672  TComPTL* getPTL() { return &m_pcPTL; }
     673  TimingInfo* getTimingInfo() { return &m_timingInfo; }
     674
     675#if SVC_EXTENSION
    655676#if DERIVE_LAYER_ID_LIST_VARIABLES
    656677  Int     getLayerSetLayerIdList(Int set, Int layerId)          { return m_layerSetLayerIdList[set][layerId]; }
     
    669690#endif
    670691
    671   TComPTL* getPTL() { return &m_pcPTL; }
    672   TimingInfo* getTimingInfo() { return &m_timingInfo; }
     692#if VPS_RENAME
     693  UInt    getMaxLayerId()                                       { return m_maxLayerId; }
     694  Void    setMaxLayerId(UInt v)                                 { m_maxLayerId = v;    }
     695
     696  UInt    getNumLayerSets()                                     { return m_numLayerSets; }
     697  Void    setNumLayerSets(UInt v)                               { m_numLayerSets = v;    }
     698#endif
    673699#if VPS_EXTN_MASK_AND_DIM_INFO
    674700  Bool   getAvcBaseLayerFlag()                                  { return m_avcBaseLayerFlag;       }
     
    743769#endif
    744770#endif
    745 #if VPS_PROFILE_OUTPUT_LAYERS
    746771  UInt   getNumProfileTierLevel()                                { return m_numProfileTierLevel; }
    747772  Void   setNumProfileTierLevel(Int x)                           { m_numProfileTierLevel = x;    }
     
    758783  Int    getProfileLevelTierIdx(Int i)                        { return m_profileLevelTierIdx[i]; }
    759784  Void   setProfileLevelTierIdx(Int i, Int x)                 { m_profileLevelTierIdx[i] = x   ; }
    760 #endif
    761785#if JCTVC_M0458_INTERLAYER_RPS_SIG
    762786  Bool   getMaxOneActiveRefLayerFlag()                                          { return m_maxOneActiveRefLayerFlag;                      }
    763787  Void   setMaxOneActiveRefLayerFlag(Bool x)                                    { m_maxOneActiveRefLayerFlag = x;                         }
    764 #endif
     788#endif
     789#if O0062_POC_LSB_NOT_PRESENT_FLAG
     790  UInt   getPocLsbNotPresentFlag(Int i)                                         { return m_pocLsbNotPresentFlag[i]; }
     791  Void   setPocLsbNotPresentFlag(Int i, Bool x)                                 { m_pocLsbNotPresentFlag[i] = x;    }
     792#endif
    765793#if N0147_IRAP_ALIGN_FLAG
    766794  Bool   getCrossLayerIrapAlignFlag()                                           { return m_crossLayerIrapAlignFlag;                      }
     
    768796#endif
    769797#if JCTVC_M0203_INTERLAYER_PRED_IDC
     798#if O0225_MAX_TID_FOR_REF_LAYERS
     799  UInt   getMaxTidIlRefPicsPlus1(Int layerId, Int refLayerId)                     { return m_maxTidIlRefPicsPlus1[layerId][refLayerId];           }
     800  Void   setMaxTidIlRefPicsPlus1(Int layerId, Int refLayerId, UInt maxSublayer)   { m_maxTidIlRefPicsPlus1[layerId][refLayerId] = maxSublayer;    }
     801#else
    770802  UInt   getMaxTidIlRefPicsPlus1(Int layerId)                     { return m_maxTidIlRefPicsPlus1[layerId];                   }
    771803  Void   setMaxTidIlRefPicsPlus1(Int layerId, UInt maxSublayer)   { m_maxTidIlRefPicsPlus1[layerId] = maxSublayer;            }
     804#endif
    772805#endif
    773806#if N0120_MAX_TID_REF_PRESENT_FLAG
     
    847880  Void    setExtensionOffset( UInt offset )    { m_extensionOffset = offset; }
    848881#endif
     882#if O0215_PHASE_ALIGNMENT
     883  Bool   getPhaseAlignFlag()                             { return m_phaseAlignFlag; }
     884  Void   setPhaseAlignFlag(Bool x)                       { m_phaseAlignFlag = x;    }
     885#endif
     886#endif //SVC_EXTENSION
    849887};
    850888
     
    924962  TComHRD m_hrdParameters;
    925963  TimingInfo m_timingInfo;
    926 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    927   Bool m_tileBoundariesAlignedFlag;
    928 #endif
    929 
    930964
    931965public:
     
    960994    ,m_log2MaxMvLengthHorizontal(15)
    961995    ,m_log2MaxMvLengthVertical(15)
    962 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    963     ,m_tileBoundariesAlignedFlag(true)
    964 #endif
    965996  {}
    966997
     
    10581089  TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
    10591090  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    1060 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    1061   Bool getTileBoundariesAlignedFlag(  ) { return m_tileBoundariesAlignedFlag; }
    1062   Void setTileBoundariesAlignedFlag( Bool flag ) { m_tileBoundariesAlignedFlag = flag; }
    1063 #endif
    10641091};
    10651092
     
    10701097  Int         m_SPSId;
    10711098  Int         m_VPSId;
     1099#if AUXILIARY_PICTURES
     1100  ChromaFormat m_chromaFormatIdc;
     1101#else
    10721102  Int         m_chromaFormatIdc;
     1103#endif
    10731104
    10741105  UInt        m_uiMaxTLayers;           // maximum number of temporal layers
     
    11431174  TComPTL     m_pcPTL;
    11441175
     1176#if SVC_EXTENSION
    11451177#if M0463_VUI_EXT_ILP_REF
    11461178  Bool        m_interViewMvVertConstraintFlag;
     
    11511183#endif
    11521184
    1153 #if SVC_EXTENSION
    11541185  UInt m_layerId;
    11551186
     
    11611192#endif
    11621193
    1163 #endif
    11641194#if REF_IDX_MFM
    11651195#if !M0457_COL_PICTURE_SIGNALING
     
    11671197#endif
    11681198#endif
    1169 #if SCALED_REF_LAYER_OFFSETS
    11701199  UInt        m_numScaledRefLayerOffsets;
    11711200  Window      m_scaledRefLayerWindow[MAX_LAYERS];
    1172 #endif
    11731201#if REPN_FORMAT_IN_VPS
    11741202  Bool m_updateRepFormatFlag;
    11751203#endif
     1204#endif //SVC_EXTENSION
    11761205public:
    11771206  TComSPS();
     
    11821211  Int  getSPSId       ()         { return m_SPSId;          }
    11831212  Void setSPSId       (Int i)    { m_SPSId = i;             }
     1213
     1214#if AUXILIARY_PICTURES
     1215  ChromaFormat getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
     1216  Void setChromaFormatIdc (ChromaFormat i)   { m_chromaFormatIdc = i;          }
     1217
     1218  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc >= 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
     1219  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc >= 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
     1220#else
    11841221  Int  getChromaFormatIdc ()         { return m_chromaFormatIdc;       }
    11851222  Void setChromaFormatIdc (Int i)    { m_chromaFormatIdc = i;          }
     
    11871224  static Int getWinUnitX (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitX[chromaFormatIdc];      }
    11881225  static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc];      }
     1226#endif
    11891227 
    11901228  // structure
     
    13341372  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
    13351373  UInt     getLayerId() { return m_layerId; }
    1336 #endif
    13371374#if REF_IDX_MFM
    13381375#if !M0457_COL_PICTURE_SIGNALING
     
    13411378#endif
    13421379#endif
    1343 #if SCALED_REF_LAYER_OFFSETS
    13441380  UInt     getNumScaledRefLayerOffsets()  { return m_numScaledRefLayerOffsets; }
    13451381  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x; }
    13461382  Window&  getScaledRefLayerWindow( Int x )   { return m_scaledRefLayerWindow[x]; }
    1347 #endif
    13481383#if REPN_FORMAT_IN_VPS
    13491384  Bool     getUpdateRepFormatFlag()       { return m_updateRepFormatFlag; }
    13501385  Void     setUpdateRepFormatFlag(Bool x) { m_updateRepFormatFlag = x;    }
    13511386#endif
     1387#endif //SVC_EXTENSION
    13521388};
    13531389
     
    16041640  Int64 iAC;
    16051641  Int64 iDC;
     1642#if O0194_WEIGHTED_PREDICTION_CGS
     1643  Int iSamples;
     1644#endif
    16061645} wpACDCParam;
    16071646
     
    16361675  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
    16371676  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
    1638 #if JCTVC_M0458_INTERLAYER_RPS_SIG
    1639   Int         m_activeNumILRRefIdx;        //< Active inter-layer reference pictures
    1640   Int         m_interLayerPredLayerIdc  [MAX_VPS_LAYER_ID_PLUS1];
    1641 #else
    1642 #if SVC_EXTENSION
    1643   Int         m_numILRRefIdx;       //< for inter-layer reference picture ser
    1644 #endif
    1645 #endif
    1646 #if M0457_IL_SAMPLE_PRED_ONLY_FLAG
    1647   Int         m_numSamplePredRefLayers;
    1648   Bool        m_interLayerSamplePredOnlyFlag;
    1649 #endif
    16501677  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
    16511678  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
     
    16641691  // referenced slice?
    16651692  Bool        m_bRefenced;
    1666  
    1667 #if POC_RESET_FLAG
    1668   Bool        m_bPocResetFlag;
    1669   Int         m_pocValueBeforeReset;
    1670 #endif 
    1671 #if SH_DISCARDABLE_FLAG
    1672   Bool        m_bDiscardableFlag;
    1673 #endif
     1693
    16741694  // access channel
    16751695  TComVPS*    m_pcVPS;
     
    16851705  UInt        m_maxNumMergeCand;
    16861706
    1687 
    16881707#if SAO_CHROMA_LAMBDA
    16891708  Double      m_dLambdaLuma;
     
    16951714  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
    16961715  UInt        m_uiTLayer;
    1697 #if SVC_EXTENSION
    1698   UInt        m_layerId;
    1699   TComPic*    m_pcBaseColPic[MAX_LAYERS];
    1700   TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS];
    1701 #if M0457_COL_PICTURE_SIGNALING
    1702   Int         m_numMotionPredRefLayers;
    1703 #if REF_IDX_MFM
    1704   Bool        m_bMFMEnabledFlag;
    1705   Int         m_colRefLayerIdx;
    1706   Bool        m_altColIndicationFlag;
    1707   TComPic*    m_pcIlpPic;
    1708 #endif
    1709 #endif
    1710 #endif
    17111716  Bool        m_bTLayerSwitchingFlag;
    17121717
     
    17421747
    17431748  Bool       m_enableTMVPFlag;
     1749
     1750#if SVC_EXTENSION
     1751  UInt        m_layerId;
     1752  TComPic*    m_pcBaseColPic[MAX_LAYERS];
     1753  TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS];
     1754#if M0457_COL_PICTURE_SIGNALING
     1755  Int         m_numMotionPredRefLayers;
     1756#if REF_IDX_MFM
     1757  Bool        m_bMFMEnabledFlag;
     1758  Int         m_colRefLayerIdx;
     1759  Bool        m_altColIndicationFlag;
     1760  TComPic*    m_pcIlpPic;
     1761#endif
     1762#endif
     1763
    17441764#if JCTVC_M0458_INTERLAYER_RPS_SIG
    1745   Bool       m_interLayerPredEnabledFlag;
     1765  Bool        m_interLayerPredEnabledFlag;
     1766  Int         m_activeNumILRRefIdx;        //< Active inter-layer reference pictures
     1767  Int         m_interLayerPredLayerIdc  [MAX_VPS_LAYER_ID_PLUS1];
     1768#else
     1769#if SVC_EXTENSION
     1770  Int         m_numILRRefIdx;       //< for inter-layer reference picture ser
     1771#endif
    17461772#endif
     1773#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
     1774  Int         m_numSamplePredRefLayers;
     1775  Bool        m_interLayerSamplePredOnlyFlag;
     1776#endif
     1777#if POC_RESET_FLAG
     1778  Bool        m_bPocResetFlag;
     1779  Int         m_pocValueBeforeReset;
     1780#endif 
     1781  Bool        m_bDiscardableFlag;
     1782#endif //SVC_EXTENSION
     1783
    17471784public:
    17481785  TComSlice();
     
    18181855  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
    18191856  Int       getNumRpsCurrTempList();
    1820 #if RPL_INIT_N0316_N0082
    1821   Int       getNumNegativeRpsCurrTempList();
    1822 #endif
    18231857  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
    18241858  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
     
    18311865  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    18321866  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
    1833 #if RESTR_CHK
    1834    Bool     isRADL() {  return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); }
    1835    Bool     isRASL()   {   return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
    1836 #endif
    1837 
    1838 #if POC_RESET_FLAG
    1839   Bool      getPocResetFlag  ()                              { return m_bPocResetFlag; }
    1840   Void      setPocResetFlag  (Bool b)                        { m_bPocResetFlag = b; }
    1841   Int       getPocValueBeforeReset ()                        { return m_pocValueBeforeReset; }
    1842   Void      setPocValueBeforeReset (Int x)                   { m_pocValueBeforeReset = x ; }
    1843 #endif
    1844 #if SH_DISCARDABLE_FLAG
    1845   Bool      getDiscardableFlag  ()                              { return m_bDiscardableFlag; }
    1846   Void      setDiscardableFlag  (Bool b)                        { m_bDiscardableFlag = b; }
    1847 #endif
    1848 
    18491867  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
    18501868  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
     
    20082026  TComPic*  getBaseColPic       (UInt refLayerIdc)                { return m_pcBaseColPic[refLayerIdc]; }
    20092027  TComPic** getBaseColPic       ()                { return &m_pcBaseColPic[0]; }
     2028#if MFM_ENCCONSTRAINT
     2029  TComPic*  getBaseColPic( TComList<TComPic*>& rcListPic );
     2030#endif
    20102031
    20112032  Void      setLayerId (UInt layerId)   { m_layerId = layerId; }
     
    20632084#endif
    20642085
    2065 TComPic* getRefPic(TComList<TComPic*>& rcListPic, Int poc) { return xGetRefPic( rcListPic, poc ); }
    2066 
    2067 #endif //SVC_EXTENSION
     2086  TComPic* getRefPic(TComList<TComPic*>& rcListPic, Int poc) { return xGetRefPic( rcListPic, poc ); }
     2087
     2088#if RESTR_CHK
     2089  Bool     isRADL() {  return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_R); }
     2090  Bool     isRASL()   {   return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); }
     2091#endif
     2092
     2093#if POC_RESET_FLAG
     2094  Bool      getPocResetFlag  ()                              { return m_bPocResetFlag;       }
     2095  Void      setPocResetFlag  (Bool b)                        { m_bPocResetFlag = b;          }
     2096  Int       getPocValueBeforeReset ()                        { return m_pocValueBeforeReset; }
     2097  Void      setPocValueBeforeReset (Int x)                   { m_pocValueBeforeReset = x ;   }
     2098#endif
     2099  Bool      getDiscardableFlag  ()                           { return m_bDiscardableFlag;    }
     2100  Void      setDiscardableFlag  (Bool b)                     { m_bDiscardableFlag = b;       }
     2101
     2102#if RPL_INIT_N0316_N0082
     2103  Int       getNumNegativeRpsCurrTempList();
     2104#endif
    20682105
    20692106#if REPN_FORMAT_IN_VPS
    20702107  UInt getPicWidthInLumaSamples();
    20712108  UInt getPicHeightInLumaSamples();
     2109#if AUXILIARY_PICTURES
     2110  ChromaFormat getChromaFormatIdc();
     2111#else
    20722112  UInt getChromaFormatIdc();
     2113#endif
    20732114  UInt getBitDepthY();
    20742115  UInt getBitDepthC();
    2075   Int getQpBDOffsetY();
    2076   Int getQpBDOffsetC();
    2077 #endif
     2116  Int  getQpBDOffsetY();
     2117  Int  getQpBDOffsetC();
     2118#endif
     2119
     2120  Void setILRPic(TComPic **pcIlpPic);
     2121
     2122#endif //SVC_EXTENSION
    20782123protected:
    20792124  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r442 r494  
    1717  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    1818  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    19   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    20   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    21 #endif
    22   { -1, 4, -11, 52, 26,  -8,  3, -1}, // <-> actual phase shift 1/3, used for spatial scalability x1.5     
     19  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     20  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     21#endif
     22  { -1, 4, -11, 52, 26,  -8,  3, -1}, // <-> actual phase shift 1/3, used for spatial scalability x1.5
    2323#if ARBITRARY_SPATIAL_RATIO
    2424  { -1, 3,  -9, 47, 31, -10,  4, -1},
    2525  { -1, 4, -11, 45, 34, -10,  4, -1},
    2626#else
    27   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //       
    28   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
     27  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     28  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    2929#endif
    3030  { -1, 4, -11, 40, 40, -11,  4, -1}, // <-> actual phase shift 1/2, equal to HEVC MC, used for spatial scalability x2
     
    3333  { -1,  4, -10, 31, 47,  -9,  3, -1},
    3434#else
    35   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    36   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
     35  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     36  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
    3737#endif
    3838  { -1, 3,  -8, 26, 52, -11, 4, -1}, // <-> actual phase shift 2/3, used for spatial scalability x1.5
     
    4343  { 0,  1,  -2,  4, 63,  -3,  1,  0}
    4444#else
    45   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    46   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    47   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, // 
    48   {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}  // 
     45  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     46  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     47  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}, //
     48  {CNU,CNU,CNU,CNU,CNU,CNU,CNU,CNU}  //
    4949#endif
    5050};
     
    6060  {CNU,CNU,CNU,CNU},//
    6161  {CNU,CNU,CNU,CNU},//
    62   {CNU,CNU,CNU,CNU},// 
     62  {CNU,CNU,CNU,CNU},//
    6363#endif
    6464  { -4, 54, 16, -2},// <-> actual phase shift 1/4,equal to HEVC MC, used for spatial scalability x1.5 (only for accurate Chroma alignement)
    65   { -6, 52, 20, -2},// <-> actual phase shift 1/3, used for spatial scalability x1.5   
    66   { -6, 46, 28, -4},// <-> actual phase shift 3/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)     
     65  { -6, 52, 20, -2},// <-> actual phase shift 1/3, used for spatial scalability x1.5
     66  { -6, 46, 28, -4},// <-> actual phase shift 3/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)
    6767#if ARBITRARY_SPATIAL_RATIO
    6868  { -4, 42, 30, -4},
    6969#else
    70   {CNU,CNU,CNU,CNU},// 
     70  {CNU,CNU,CNU,CNU},//
    7171#endif
    7272  { -4, 36, 36, -4},// <-> actual phase shift 1/2,equal to HEVC MC, used for spatial scalability x2
     
    7575  { -4, 28, 46, -6},
    7676#else
    77   {CNU,CNU,CNU,CNU},// 
     77  {CNU,CNU,CNU,CNU},//
    7878#endif
    7979  { -2, 20, 52, -6},// <-> actual phase shift 2/3, used for spatial scalability x1.5
     
    8282  {-2, 14, 56, -4},
    8383#else
    84   {CNU,CNU,CNU,CNU},// 
    85   {CNU,CNU,CNU,CNU},// 
    86 #endif
    87   { -2, 10, 58, -2},// <-> actual phase shift 7/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement) 
     84  {CNU,CNU,CNU,CNU},//
     85  {CNU,CNU,CNU,CNU},//
     86#endif
     87  { -2, 10, 58, -2},// <-> actual phase shift 7/8,equal to HEVC MC, used for spatial scalability x2 (only for accurate Chroma alignement)
    8888  {  0,  4, 62, -2} // <-> actual phase shift 11/12, used for spatial scalability x1.5 (only for accurate Chroma alignement)
    8989};
     
    9797}
    9898
    99 #if SCALED_REF_LAYER_OFFSETS
     99#if O0215_PHASE_ALIGNMENT
     100#if O0194_JOINT_US_BITSHIFT
     101Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     102#else
     103Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     104#endif
     105#else
     106#if O0194_JOINT_US_BITSHIFT
     107Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
     108#else
    100109Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window )
    101 #else
    102 Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic )
     110#endif
    103111#endif
    104112{
     
    109117
    110118  //========== Y component upsampling ===========
    111 #if SCALED_REF_LAYER_OFFSETS
    112119  const Window &scalEL = window;
    113120
     
    119126  Int heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    120127  Int strideEL  = pcUsPic->getStride();
    121 #else
    122   const Window &confBL = pcBasePic->getConformanceWindow();
    123   const Window &confEL = pcUsPic->getConformanceWindow();
    124 
    125   Int widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    126   Int heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    127   Int strideBL  = pcBasePic->getStride();
    128 
    129   Int widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    130   Int heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    131   Int strideEL  = pcUsPic->getStride();
    132 #endif
     128
    133129  Pel* piTempBufY = pcTempPic->getLumaAddr();
    134130  Pel* piSrcBufY  = pcBasePic->getLumaAddr();
     
    153149  Int scaleX = g_posScalingFactor[refLayerIdc][0];
    154150  Int scaleY = g_posScalingFactor[refLayerIdc][1];
     151
     152#if O0194_JOINT_US_BITSHIFT
     153  UInt currLayerId = currSlice->getLayerId();
     154  UInt refLayerId  = currSlice->getVPS()->getRefLayerId( currLayerId, refLayerIdc );
     155#endif
    155156
    156157  if( scaleX == 65536 && scaleY == 65536 ) // ratio 1x
     
    194195    Int refPos16 = 0;
    195196    Int phase    = 0;
    196     Int refPos   = 0; 
     197    Int refPos   = 0;
    197198    Int* coeff = m_chromaFilter[phase];
    198199    for ( i = 0; i < 16; i++)
     
    202203    }
    203204
    204 #if ARBITRARY_SPATIAL_RATIO 
     205#if ARBITRARY_SPATIAL_RATIO
    205206    assert ( widthEL >= widthBL );
    206207    assert ( heightEL >= heightBL );
     
    216217    Int   shiftY = 16;
    217218
     219#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
     220    Int   phaseX = 2*phaseAlignFlag;
     221    Int   phaseY = 2*phaseAlignFlag;
     222#else
    218223    Int   phaseX = 0;
    219224    Int   phaseY = 0;
     225#endif
    220226
    221227#if ROUNDING_OFFSET
     
    228234
    229235    Int   deltaX     = 4 * phaseX;
    230     Int   deltaY     = 4 * phaseY; 
     236    Int   deltaY     = 4 * phaseY;
    231237
    232238    Int shiftXM4 = shiftX - 4;
     
    238244    widthBL   = pcBasePic->getWidth ();
    239245    heightBL  = min<Int>( pcBasePic->getHeight(), heightEL );
    240 #if SCALED_REF_LAYER_OFFSETS
     246
    241247    Int leftStartL = scalEL.getWindowLeftOffset();
    242248    Int rightEndL  = pcUsPic->getWidth() - scalEL.getWindowRightOffset();
    243249    Int topStartL  = scalEL.getWindowTopOffset();
    244250    Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset();
    245 #if BUGFIX_RESAMPLE
    246251    Int leftOffset = leftStartL > 0 ? leftStartL : 0;
    247 #endif
    248 #endif
    249252
    250253#if  N0214_INTERMEDIATE_BUFFER_16BITS
     254#if O0194_JOINT_US_BITSHIFT
     255    // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     256    Int shift1 = g_bitDepthYLayer[refLayerId] - 8;
     257#else
    251258    Int shift1 = g_bitDepthY - 8;
     259#endif
    252260#endif
    253261
     
    255263    for( i = 0; i < widthEL; i++ )
    256264    {
    257 #if SCALED_REF_LAYER_OFFSETS
    258265      Int x = Clip3( leftStartL, rightEndL - 1, i );
    259266      refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX;
    260 #else
    261       refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
    262 #endif
    263267      phase    = refPos16 & 15;
    264268      refPos   = refPos16 >> 4;
     
    287291
    288292#if  N0214_INTERMEDIATE_BUFFER_16BITS
     293#if O0194_JOINT_US_BITSHIFT
     294    Int nShift = 20 - g_bitDepthYLayer[currLayerId];
     295#else
    289296    Int nShift = US_FILTER_PREC*2 - shift1;
     297#endif
    290298#else
    291299    const Int nShift = US_FILTER_PREC*2;
    292300#endif
    293     Int iOffset = 1 << (nShift - 1);
    294 
    295 #if SCALED_REF_LAYER_OFFSETS
     301    Int iOffset = 1 << (nShift - 1);
     302
    296303    for( j = 0; j < pcTempPic->getHeight(); j++ )
    297 #else
    298     for( j = 0; j < heightEL; j++ )
    299 #endif
    300     {
    301 #if SCALED_REF_LAYER_OFFSETS
     304    {
    302305      Int y = Clip3(topStartL, bottomEndL - 1, j);
    303306      refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY;
    304 #else
    305       refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
    306 #endif
    307307      phase    = refPos16 & 15;
    308308      refPos   = refPos16 >> 4;
     
    310310
    311311      piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL;
    312 #if SCALED_REF_LAYER_OFFSETS
    313 #if BUGFIX_RESAMPLE
    314       Pel* piDstY0 = piDstBufY + j * strideEL;           
     312      Pel* piDstY0 = piDstBufY + j * strideEL;
    315313      piDstY = piDstY0 + leftOffset;
    316314      piSrcY += leftOffset;
     
    335333        piDstY++;
    336334      }
    337 #else
    338 #if 1 // it should provide identical result
    339       Pel* piDstY0 = piDstBufY + j * strideEL;           
    340       piDstY = piDstY0 + ( leftStartL > 0 ? leftStartL : 0 );
    341 
    342       for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- )
    343       {
    344         *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
    345         piSrcY++;
    346         piDstY++;
    347       }
    348 
    349       for( i = rightEndL; i < pcTempPic->getWidth(); i++ )
    350       {
    351         *piDstY = piDstY0[rightEndL-1];
    352         piDstY++;
    353       }
    354 
    355       piDstY = piDstY0;
    356       for( i = 0; i < leftStartL; i++ )
    357       {
    358         *piDstY = piDstY0[leftStartL];
    359         piDstY++;
    360       }
    361 #else
    362       piDstY = piDstBufY + j * strideEL;
    363 
    364       for( i = 0; i < pcTempPic->getWidth(); i++ )
    365       {
    366         *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
    367 
    368         // Only increase the x position of reference upsample picture when within the window
    369         // "-2" to ensure that pointer doesn't go beyond the boundary rightEndL-1
    370         if( (i >= leftStartL) && (i <= rightEndL-2) )
    371         {
    372           piSrcY++;
    373         }
    374         piDstY++;
    375       }
    376 #endif
    377 #endif
    378 #else
    379       piDstY = piDstBufY + j * strideEL;
    380 
    381       for( i = 0; i < widthEL; i++ )
    382       {
    383         *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift));
    384         piSrcY++;
    385         piDstY++;
    386       }
    387 #endif
    388     }
    389 
    390 #if SCALED_REF_LAYER_OFFSETS
     335
     336    }
     337
    391338    widthBL   = pcBasePic->getWidth ();
    392339    heightBL  = pcBasePic->getHeight();
     
    394341    widthEL   = pcUsPic->getWidth () - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    395342    heightEL  = pcUsPic->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    396 #else
    397     widthBL   = pcBasePic->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    398     heightBL  = pcBasePic->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    399 
    400     widthEL   = pcUsPic->getWidth () - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    401     heightEL  = pcUsPic->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    402 #endif
    403343
    404344    //========== UV component upsampling ===========
     
    412352    strideBL  = pcBasePic->getCStride();
    413353    strideEL  = pcUsPic->getCStride();
    414 #if SCALED_REF_LAYER_OFFSETS
     354
    415355    Int leftStartC = scalEL.getWindowLeftOffset() >> 1;
    416356    Int rightEndC  = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1);
    417357    Int topStartC  = scalEL.getWindowTopOffset() >> 1;
    418358    Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1);
    419 #if BUGFIX_RESAMPLE
    420359    leftOffset = leftStartC > 0 ? leftStartC : 0;
    421 #endif
    422 #endif
    423360
    424361    shiftX = 16;
    425362    shiftY = 16;
    426363
     364#if O0215_PHASE_ALIGNMENT
     365    Int phaseXC = 0;
     366    Int phaseYC = 1;
     367
     368#if ROUNDING_OFFSET
     369    addX       = ( ( (phaseXC+phaseAlignFlag) * scaleX + 2 ) >> 2 ) + ( 1 << ( shiftX - 5 ) );
     370    addY       = ( ( (phaseYC+phaseAlignFlag) * scaleY + 2 ) >> 2 ) + ( 1 << ( shiftY - 5 ) );
     371#else
     372    addX       = ( ( ( widthBL * (phaseXC+phaseAlignFlag) ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
     373    addY       = ( ( ( heightBL * (phaseYC+phaseAlignFlag) ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
     374#endif
     375
     376    deltaX     = 4 * (phaseXC+phaseAlignFlag);
     377    deltaY     = 4 * (phaseYC+phaseAlignFlag);
     378#else
    427379    phaseX = 0;
    428380    phaseY = 1;
     
    438390    deltaX     = 4 * phaseX;
    439391    deltaY     = 4 * phaseY;
     392#endif
    440393
    441394    shiftXM4 = shiftX - 4;
     
    449402
    450403#if  N0214_INTERMEDIATE_BUFFER_16BITS
     404#if O0194_JOINT_US_BITSHIFT
     405    // g_bitDepthC was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     406    shift1 = g_bitDepthCLayer[refLayerId] - 8;
     407#else
    451408    shift1 = g_bitDepthC - 8;
     409#endif
    452410#endif
    453411
     
    455413    for( i = 0; i < widthEL; i++ )
    456414    {
    457 #if SCALED_REF_LAYER_OFFSETS
    458415      Int x = Clip3(leftStartC, rightEndC - 1, i);
    459416      refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX;
    460 #else
    461       refPos16 = ((i*scaleX + addX) >> shiftXM4) - deltaX;
    462 #endif
    463417      phase    = refPos16 & 15;
    464418      refPos   = refPos16 >> 4;
     
    494448
    495449#if  N0214_INTERMEDIATE_BUFFER_16BITS
     450#if O0194_JOINT_US_BITSHIFT
     451    nShift = 20 - g_bitDepthCLayer[refLayerId];
     452#else
    496453    nShift = US_FILTER_PREC*2 - shift1;
    497     iOffset = 1 << (nShift - 1);
    498 #endif
    499 
    500 #if SCALED_REF_LAYER_OFFSETS
     454#endif
     455    iOffset = 1 << (nShift - 1);
     456#endif
     457
    501458    for( j = 0; j < pcTempPic->getHeight() >> 1; j++ )
    502 #else
    503     for( j = 0; j < heightEL; j++ )
    504 #endif
    505     {
    506 #if SCALED_REF_LAYER_OFFSETS
     459    {
    507460      Int y = Clip3(topStartC, bottomEndC - 1, j);
    508461      refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY;
    509 #else
    510       refPos16 = ((j*scaleY + addY) >> shiftYM4) - deltaY;
    511 #endif
    512462      phase    = refPos16 & 15;
    513       refPos   = refPos16 >> 4; 
     463      refPos   = refPos16 >> 4;
    514464      coeff = m_chromaFilter[phase];
    515      
     465
    516466      piSrcU = piTempBufU  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
    517467      piSrcV = piTempBufV  + (refPos -((NTAPS_US_CHROMA>>1) - 1))*strideEL;
    518 #if SCALED_REF_LAYER_OFFSETS
    519 #if BUGFIX_RESAMPLE
     468
    520469      Pel* piDstU0 = piDstBufU + j*strideEL;
    521470      Pel* piDstV0 = piDstBufV + j*strideEL;
     
    552501        piDstV++;
    553502      }
    554 #else
    555 #if 1 // it should provide identical result
    556       Pel* piDstU0 = piDstBufU + j*strideEL;
    557       Pel* piDstV0 = piDstBufV + j*strideEL;
    558       piDstU = piDstU0 + ( leftStartC > 0 ? leftStartC : 0 );
    559       piDstV = piDstV0 + ( leftStartC > 0 ? leftStartC : 0 );
    560 
    561       for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )
    562       {
    563         *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    564         *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    565         piSrcU++;
    566         piSrcV++;
    567         piDstU++;
    568         piDstV++;
    569       }
    570 
    571       for( i = rightEndC; i < pcTempPic->getWidth() >> 1; i++ )
    572       {
    573         *piDstU = piDstU0[rightEndC-1];
    574         *piDstV = piDstV0[rightEndC-1];
    575         piDstU++;
    576         piDstV++;
    577       }
    578 
    579       piDstU = piDstU0;
    580       piDstV = piDstV0;
    581       for( i = 0; i < leftStartC; i++ )
    582       {
    583         *piDstU = piDstU0[leftStartC];
    584         *piDstV = piDstV0[leftStartC];
    585         piDstU++;
    586         piDstV++;
    587       }
    588 #else
    589       piDstU = piDstBufU + j*strideEL;
    590       piDstV = piDstBufV + j*strideEL;
    591 
    592       for( i = 0; i < pcTempPic->getWidth() >> 1; i++ )
    593       {
    594         *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    595         *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    596 
    597         // Only increase the x position of reference upsample picture when within the window
    598         // "-2" to ensure that pointer doesn't go beyond the boundary rightEndC-1
    599         if( (i >= leftStartC) && (i <= rightEndC-2) )
    600         {
    601           piSrcU++;
    602           piSrcV++;
    603         }
    604 
    605         piDstU++;
    606         piDstV++;
    607       }
    608 #endif
    609 #endif
    610 #else
    611       piDstU = piDstBufU + j*strideEL;
    612       piDstV = piDstBufV + j*strideEL;
    613 
    614       for( i = 0; i < widthEL; i++ )
    615       {
    616         *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift));
    617         *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift));
    618         piSrcU++;
    619         piSrcV++;
    620         piDstU++;
    621         piDstV++;
    622       }
    623 #endif
     503
    624504    }
    625505  }
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.h

    r313 r494  
    4343  ~TComUpsampleFilter(void);
    4444
    45 #if SCALED_REF_LAYER_OFFSETS
     45#if O0215_PHASE_ALIGNMENT
     46#if O0194_JOINT_US_BITSHIFT
     47  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     48#else
     49  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     50#endif
     51#else
     52#if O0194_JOINT_US_BITSHIFT
     53  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
     54#else
    4655  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window );
    47 #else
    48  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
    4956#endif
     57#endif
     58
    5059};
    5160
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r442 r494  
    4545#define RANDOM_ACCESS_SEI_FIX            1
    4646#if SVC_EXTENSION
     47#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     48
     49#define O0194_DIFFERENT_BITDEPTH_EL_BL   1      ///< JCTVC-O0194: Support for different bitdepth values for BL and EL, add required configuration parameters (and Some bugfixes when REPN_FORMAT_IN_VPS (JCTVC-N0092) is enabled)
     50#if O0194_DIFFERENT_BITDEPTH_EL_BL
     51#define O0194_JOINT_US_BITSHIFT          1      ///< JCTVC-O0194: Joint Upsampling and bit-shift
     52#endif
     53#define O0194_WEIGHTED_PREDICTION_CGS    1      ///< JCTVC-O0194: Weighted prediciton for color gamut scalability
     54#define MFM_ENCCONSTRAINT                1      ///< JCTVC-O0216: Encoder constraint for motion field mapping
    4755#define VPS_NUH_LAYER_ID                 1      ///< JCTVC-N0085: Assert that the nuh_layer_id of VPS NAL unit should be 0
    48 #define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
    4956#define POC_RESET_FLAG                   1      ///< JCTVC-N0244: POC reset flag for  layer pictures.
    5057#define ALIGN_TSA_STSA_PICS              1      ///< JCTVC-N0084: Alignment of TSA and STSA pictures across AU.
     
    5259#define TIMING_INFO_NONZERO_LAYERID_SPS  1      ///< JCTVC-N0085: Semantics of vui_timing_info_present_flag to always set that flag to zero for non-zero layer ID SPS
    5360#define RPL_INIT_N0316_N0082             1      ///< JCTVC-N0316, JCTVC-N0082: initial reference picture list construction
    54 #define FINAL_RPL_CHANGE_N0082           1      ///< JCTVC-N0082: final ref picture list change (encoder)
    55 #if FINAL_RPL_CHANGE_N0082
    56 #define EXTERNAL_USEDBYCURR_N0082        1      ///< JCTVC-N0082: final ref picture list change (encoder) //dev ver.
    57 #define TEMP_SCALABILITY_FIX             1      ///< fix for temporal scalability
    58 #endif
     61
    5962#define IL_SL_SIGNALLING_N0371           0      ///< JCTVC-N0371: inter-layer scaling list
    60 #define M0464_TILE_BOUNDARY_ALIGNED_FLAG 0      ///< JCTVC-M0464: VUI flag to indicate tile boundary alignment
    6163#define M0463_VUI_EXT_ILP_REF            0      ///< JCTVC-M0463: VUI extension inter-layer dependency offset signalling
    6264#define SPS_EXTENSION                    1      ///< Define sps_extension() syntax structure
    63 #define SCALED_REF_LAYER_OFFSETS         1      ///< JCTVC-M0309: Signal scaled reference layer offsets in SPS
    6465#define VERT_MV_CONSTRAINT               1      ///< Vertical MV component constraint flag
    6566#define SCALABILITY_MASK_E0104           1      ///< JCT3V-E0104: scalability mask for depth
     67#define LAYER_CTB                        0      ///< enable layer-specific CTB structure
    6668
    6769#define ILP_SSH_SIG                      1      ///< JCTVC-N0195 proposal 2, JCTVC-N0118: add presence flag in VPS ext to condition inter-layer prediction signaling in slice segment header
     70#if ILP_SSH_SIG
     71#define ILP_SSH_SIG_FIX                  1      ///< fix for SHM ticket #5
     72#endif
    6873#define SPL_FLG_CHK                      1      ///< JCTVC-N0195 proposal 5, JCTVC-N0085: constrain sum of lengths to be less than or equal to 6
    6974#define ILP_NUM_REF_CHK                  1      ///< JCTVC-N0195 proposal 1, JCTVC-N0081, JCTVC-N0154, JCTVC-N0217: a condition on signaling inter_layer_pred_layer_idc[ i ], to avoid sending when NumDirectRefLayers equals NumActiveRefLayerPics, and instead infer values
     
    7681#define VPS_EXTN_PROFILE_INFO            1      ///< Include profile information for layer sets in VPS extension
    7782#define VPS_EXTN_DIRECT_REF_LAYERS       1      ///< Include indication of direct dependency of layers in VPS extension
    78 #define VPS_OUTPUT_LAYER_SET_IDX         1      ///< JCTVC-M0268: Signal output_layer_set_idx[i] as output_layer_set_idx_minus1[i]
    79 #define VPS_MOVE_DIR_DEPENDENCY_FLAG     1      ///< JCTVC-M0268: Move the syntax element direct_dependency_flag to follow the syntax element dimension_id
    80 #define VPS_PROFILE_OUTPUT_LAYERS        1      ///< JCTVC-M0268: Signal profile information and output layer information as in Sec. 3 of M0268v2
    81 #define SPS_SUB_LAYER_INFO               1      ///< JCTVC-M0268: Do not signal sps_max_sub_layers_minus1 and sps_temporal_id_nesting_flag for nuh_layer_id greater than 0
    82 #define VPS_SPLIT_FLAG                   1      ///< JCTVC-M0163: Do not signal dimension_id and the last dimension_id_len_minus1, when splitting_flag is equal to 1.
    8383#define M0457_PREDICTION_INDICATIONS     1
    8484#define M0040_ADAPTIVE_RESOLUTION_CHANGE 1
     
    8989#define N0160_VUI_EXT_ILP_REF            1      ///< VUI extension inter-layer dependency offset signalling
    9090#define VPS_VUI_BITRATE_PICRATE          1      ///< JCTVC-N0085: Signal bit rate and picture in VPS VUI
    91 #else
    92 #define M0464_TILE_BOUNDARY_ALIGNED_FLAG 0      ///< VUI flag to indicate tile boundary alignment
    9391#endif //VPS_VUI
    9492
     
    9694
    9795#define VPS_EXTN_OFFSET                  1      ///< implementation of vps_extension_offset syntax element
     96#define VPS_EXTN_OFFSET_CALC             1      ///< Calculation of VPS extension offset
    9897#define SPS_PTL_FIX                      1      ///< remove profile_tier_level from enhancement layer SPS
    99 #define SH_DISCARDABLE_FLAG              1      ///< JCTVC-M0152: Use one reserved flag in the slice header for discardable flag
    10098
    10199#define DERIVE_LAYER_ID_LIST_VARIABLES   1      ///< Derived variables based on the variables in VPS - for use in syntax table parsing
     
    104102#define ROUNDING_OFFSET                  1      ///< JCTVC-N0111: upsampling rounding offset using scalling factors
    105103#define N0214_INTERMEDIATE_BUFFER_16BITS 1      ///< JCTVC-N0214: support base layer input more than 8 bits
    106 #define ARBITRARY_SPATIAL_RATIO          0      ///< JCTVC-N0219, JCTVC-N0273: Support arbitrary spatial ratio
    107 #define BUGFIX_RESAMPLE                  1      ///< JCTVC-N0055: resampling bug fix for positive left scalled offset
     104#define ARBITRARY_SPATIAL_RATIO          1      ///< JCTVC-N0219, JCTVC-N0273: Support arbitrary spatial ratio
    108105
    109106#define JCTVC_M0259_LAMBDAREFINEMENT     1      ///< JCTVC-M0259: lambda refinement (encoder only optimization)
     
    126123#define JCTVC_M0203_INTERLAYER_PRED_IDC  1      ///< JCTVC-M0203: implementation of Inter-layer Prediction Indication
    127124#if JCTVC_M0203_INTERLAYER_PRED_IDC
    128 #define ILR_RESTR                        1      ///< JCTVC-M0209: Inter-layer RPS and RPL
    129 #define ILR_RESTR_FIX                    1      ///< Fix encoder crash when temporal layers are used with scalable coding
    130125#define EARLY_REF_PIC_MARKING            1      ///< Decoded picture marking of sub-layer non-reference pictures
    131126#define N0120_MAX_TID_REF_PRESENT_FLAG   1      ///< JCTVC-N0120: max_tid_ref_pics_plus1_present_flag
    132127#define N0120_MAX_TID_REF_CFG            1      ///< set max_tid_il_ref_pics_plus1 and max_tid_ref_present_flag in the config. file (configuration setting)
     128#define O0225_MAX_TID_FOR_REF_LAYERS     1
    133129#endif
    134130#if REF_IDX_MFM
     
    145141
    146142#define N0147_IRAP_ALIGN_FLAG            1      ///< a flag to indicatate whether IRAPs are aligned across layers
     143#if N0147_IRAP_ALIGN_FLAG
     144#define O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS  1  ///< Remove IRAP align depedency constraints on poc_Reset_flag.
     145#define IRAP_ALIGN_FLAG_IN_VPS_VUI       1       ///< Move IRAP align flag to VPS VUI
     146#endif
    147147#if !N0147_IRAP_ALIGN_FLAG
    148148#define IDR_ALIGNMENT                    1      ///< align IDR picures across layers : As per JCTVC-N0373, IDR are not required to be aligned.
     
    159159#define N0383_IL_CONSTRAINED_TILE_SETS_SEI  1
    160160#define N0065_LAYER_POC_ALIGNMENT        1
     161
     162#define O0215_PHASE_ALIGNMENT            1      ///< JCTVC_O0215: signal a flag to specify phase alignment case, 0: zero-position-aligned, 1: central-position-aligned,
     163#define AUXILIARY_PICTURES               1      ///< JCTVC-O0041: auxiliary picture layers
     164
     165#define O0062_POC_LSB_NOT_PRESENT_FLAG   1      ///< JCTVC-O0062: signal poc_lsb_not_present_flag for each layer in VPS extension
     166#define SHM_FIX7                         1      ///< fix for SHVC WD ticket #7
     167
    161168#else
    162169#define SYNTAX_OUTPUT                    0
     
    469476  CHROMA_422  = 2,
    470477  CHROMA_444  = 3
     478#if AUXILIARY_PICTURES
     479  ,NUM_CHROMA_FORMAT = 4
     480#endif
    471481};
    472482
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r442 r494  
    187187  assert(uiCode <= 63);
    188188  pcPPS->setPPSId (uiCode);
    189  
     189
    190190  READ_UVLC( uiCode, "pps_seq_parameter_set_id");
    191191  assert(uiCode <= 15);
    192192  pcPPS->setSPSId (uiCode);
    193  
     193
    194194  READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag"    );    pcPPS->setDependentSliceSegmentsEnabledFlag   ( uiCode == 1 );
    195195  READ_FLAG( uiCode, "output_flag_present_flag" );                    pcPPS->setOutputFlagPresentFlag( uiCode==1 );
     
    293293
    294294#if IL_SL_SIGNALLING_N0371
    295   pcPPS->setPPS( pcPPS->getLayerId(), pcPPS ); 
     295  pcPPS->setPPS( pcPPS->getLayerId(), pcPPS );
    296296#endif
    297297
     
    301301    pcPPS->getScalingList()->setLayerId( pcPPS->getLayerId() );
    302302
    303     if( pcPPS->getLayerId() > 0 ) 
     303    if( pcPPS->getLayerId() > 0 )
    304304    {
    305305      READ_FLAG( uiCode, "pps_pred_scaling_list_flag" );           pcPPS->setPredScalingListFlag( uiCode ? true : false );
    306306      pcPPS->getScalingList()->setPredScalingListFlag( pcPPS->getPredScalingListFlag() );
    307      
     307
    308308      if( pcPPS->getPredScalingListFlag() )
    309309      {
     
    319319        }
    320320
    321         // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 
     321        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
    322322        // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
    323323        assert( pcPPS->getPPS( pcPPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
    324324
    325         // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 
     325        // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
    326326        // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
    327327        assert( pcPPS->getSPS()->getVPS()->getScalingListLayerDependency( pcPPS->getLayerId(), pcPPS->getScalingListRefLayerId() ) == true );
     
    450450  {
    451451    READ_FLAG(   uiCode, "tiles_fixed_structure_flag");               pcVUI->setTilesFixedStructureFlag(uiCode);
    452 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    453     if ( pcSPS->getLayerId() > 0 )
    454     {
    455       READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVUI->setTileBoundariesAlignedFlag( uiCode == 1 );
    456     }
    457 #endif
    458452    READ_FLAG(   uiCode, "motion_vectors_over_pic_boundaries_flag");  pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode);
    459453    READ_FLAG(   uiCode, "restricted_ref_pic_lists_flag");            pcVUI->setRestrictedRefPicListsFlag(uiCode);
     
    542536}
    543537
    544 #if SPS_SUB_LAYER_INFO
     538#if SVC_EXTENSION
    545539Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager)
    546540#else
     
    554548  UInt  uiCode;
    555549  READ_CODE( 4,  uiCode, "sps_video_parameter_set_id");          pcSPS->setVPSId        ( uiCode );
    556 #if SPS_SUB_LAYER_INFO
     550#if SVC_EXTENSION
    557551  if(pcSPS->getLayerId() == 0)
    558552  {
     
    560554    READ_CODE( 3,  uiCode, "sps_max_sub_layers_minus1" );          pcSPS->setMaxTLayers   ( uiCode+1 );
    561555    assert(uiCode <= 6);
    562  
     556
    563557    READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" );               pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false );
    564 #if SPS_SUB_LAYER_INFO
     558#if SVC_EXTENSION
    565559  }
    566560  else
     
    569563    pcSPS->setTemporalIdNestingFlag( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getTemporalNestingFlag() );
    570564  }
    571 #endif
    572565#if IL_SL_SIGNALLING_N0371
    573566  pcSPS->setVPS( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId()) );
    574567  pcSPS->setSPS( pcSPS->getLayerId(), pcSPS );
    575568#endif
     569#endif
    576570  if ( pcSPS->getMaxTLayers() == 1 )
    577571  {
    578572    // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0
    579 #if SPS_SUB_LAYER_INFO
     573#if SVC_EXTENSION
    580574    assert( pcSPS->getTemporalIdNestingFlag() == true );
    581575#else
     
    598592  if( pcSPS->getLayerId() > 0 )
    599593  {
    600     READ_FLAG( uiCode, "update_rep_format_flag" );                 
     594    READ_FLAG( uiCode, "update_rep_format_flag" );
    601595    pcSPS->setUpdateRepFormatFlag( uiCode ? true : false );
    602596  }
     
    605599    pcSPS->setUpdateRepFormatFlag( true );
    606600  }
    607   if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
    608   {
    609 #endif
     601  if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
     602  {
     603#endif
     604#if AUXILIARY_PICTURES
     605    READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
     606#else
    610607    READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
     608#endif
    611609    assert(uiCode <= 3);
    612610    // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream
     
    639637  }
    640638#if REPN_FORMAT_IN_VPS
    641   if(  pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 
     639  if(  pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
    642640  {
    643641#endif
     
    659657  UInt subLayerOrderingInfoPresentFlag;
    660658  READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
    661  
     659
    662660  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    663661  {
     
    728726          }
    729727
    730           // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and 
     728          // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
    731729          // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
    732730          assert( pcSPS->getSPS( pcSPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
    733731
    734           // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB, 
     732          // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
    735733          // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
    736734          assert( pcSPS->getVPS()->getScalingListLayerDependency( pcSPS->getLayerId(), pcSPS->getScalingListRefLayerId() ) == true );
     
    841839  assert( uiCode == 0 );
    842840#endif
    843 #if SCALED_REF_LAYER_OFFSETS
    844841  if( pcSPS->getLayerId() > 0 )
    845842  {
    846     Int iCode; 
     843    Int iCode;
    847844    READ_UVLC( uiCode,      "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets(uiCode);
    848845    for(Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets(); i++)
     
    855852    }
    856853  }
    857 #endif
    858854#if M0463_VUI_EXT_ILP_REF
    859855  ////   sps_extension_vui_parameters( )
    860856  if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() )
    861   { 
    862     READ_UVLC( uiCode, "num_ilp_restricted_ref_layers" ); pcSPS->setNumIlpRestrictedRefLayers( uiCode ); 
    863     for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ ) 
    864     { 
    865       READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcSPS->setMinSpatialSegmentOffsetPlus1( i, uiCode ); 
    866       if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 ) 
    867       { 
    868         READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[ i ]"); pcSPS->setCtuBasedOffsetEnabledFlag(i, uiCode == 1 ); 
    869         if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) ) 
    870         {
    871           READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[ i ]"); pcSPS->setMinHorizontalCtuOffsetPlus1( i, uiCode ); 
    872         }
    873       } 
    874     } 
    875   } 
     857  {
     858    READ_UVLC( uiCode, "num_ilp_restricted_ref_layers" ); pcSPS->setNumIlpRestrictedRefLayers( uiCode );
     859    for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ )
     860    {
     861      READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcSPS->setMinSpatialSegmentOffsetPlus1( i, uiCode );
     862      if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 )
     863      {
     864        READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[ i ]"); pcSPS->setCtuBasedOffsetEnabledFlag(i, uiCode == 1 );
     865        if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) )
     866        {
     867          READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[ i ]"); pcSPS->setMinHorizontalCtuOffsetPlus1( i, uiCode );
     868        }
     869      }
     870    }
     871  }
    876872  ////   sps_extension_vui_parameters( ) END
    877873#endif
     
    1000996}
    1001997
     998#if SVC_EXTENSION
    1002999#if VPS_EXTNS
    10031000Void TDecCavlc::parseVPSExtension(TComVPS *vps)
     
    10181015  vps->setNumScalabilityTypes(numScalabilityTypes);
    10191016
    1020 #if VPS_SPLIT_FLAG
    10211017  for(j = 0; j < numScalabilityTypes - vps->getSplittingFlag(); j++)
    1022 #else
    1023   for(j = 0; j < numScalabilityTypes; j++)
    1024 #endif
    10251018  {
    10261019    READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); vps->setDimensionIdLen(j, uiCode + 1);
    10271020  }
    1028 #if VPS_SPLIT_FLAG
     1021
    10291022  if(vps->getSplittingFlag())
    10301023  {
     
    10381031    numBits = 6;
    10391032  }
    1040 #else
    1041   if(vps->getSplittingFlag())
    1042   {
    1043     UInt numBits = 0;
    1044     for(j = 0; j < numScalabilityTypes; j++)
    1045     {
    1046       numBits += vps->getDimensionIdLen(j);
    1047     }
    1048     assert( numBits <= 6 );
    1049   }
    1050 #endif
    10511033
    10521034  READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); vps->setNuhLayerIdPresentFlag(uiCode ? true : false);
     
    10661048    vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i);
    10671049
    1068 #if VPS_SPLIT_FLAG
    1069     if(!vps->getSplittingFlag())
    1070 #endif
     1050    if( !vps->getSplittingFlag() )
     1051    {
    10711052    for(j = 0; j < numScalabilityTypes; j++)
    10721053    {
    10731054      READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode);
     1055#if !AUXILIARY_PICTURES
    10741056      assert( uiCode <= vps->getMaxLayerId() );
    1075     }
    1076   }
    1077 #endif
    1078 #if VIEW_ID_RELATED_SIGNALING
    1079   // if ( pcVPS->getNumViews() > 1 ) 
    1080   //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val.
     1057#endif
     1058    }
     1059  }
     1060  }
     1061#endif
     1062#if VIEW_ID_RELATED_SIGNALING
     1063  // if ( pcVPS->getNumViews() > 1 )
     1064  //   However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val.
    10811065  {
    10821066    READ_CODE( 4, uiCode, "view_id_len_minus1" ); vps->setViewIdLenMinus1( uiCode );
     
    10881072  }
    10891073#endif
    1090 #if VPS_MOVE_DIR_DEPENDENCY_FLAG
    10911074#if VPS_EXTN_DIRECT_REF_LAYERS
    10921075  // For layer 0
     
    11081091  }
    11091092#endif
    1110 #endif
    11111093#if JCTVC_M0203_INTERLAYER_PRED_IDC
    11121094#if N0120_MAX_TID_REF_PRESENT_FLAG
     
    11161098    for(i = 0; i < vps->getMaxLayers() - 1; i++)
    11171099    {
     1100#if O0225_MAX_TID_FOR_REF_LAYERS
     1101       for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
     1102       {
     1103         if(vps->getDirectDependencyFlag(j, i))
     1104         {
     1105           READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i][j]" ); vps->setMaxTidIlRefPicsPlus1(i, j, uiCode);
     1106           assert( uiCode <= vps->getMaxTLayers());
     1107         }
     1108       }
     1109#else
    11181110      READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode);
    11191111#if N0120_MAX_TID_REF_CFG
    11201112      assert( uiCode <= vps->getMaxTLayers());
    1121 #else 
     1113#else
    11221114      assert( uiCode <= vps->getMaxTLayers()+ 1 );
     1115#endif
    11231116#endif
    11241117    }
    11251118  }
    1126   else 
     1119  else
    11271120  {
    11281121    for(i = 0; i < vps->getMaxLayers() - 1; i++)
    11291122    {
     1123#if O0225_MAX_TID_FOR_REF_LAYERS
     1124       for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
     1125       {
     1126          vps->setMaxTidIlRefPicsPlus1(i, j, 7);
     1127       }
     1128#else
    11301129      vps->setMaxTidIlRefPicsPlus1(i, 7);
     1130#endif
    11311131    }
    11321132  }
     
    11341134  for(i = 0; i < vps->getMaxLayers() - 1; i++)
    11351135  {
     1136#if O0225_MAX_TID_FOR_REF_LAYERS
     1137       for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
     1138       {
     1139         if(vps->getDirectDependencyFlag(j, i))
     1140         {
     1141           READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i][j]" ); vps->setMaxTidIlRefPicsPlus1(i, j, uiCode);
     1142           assert( uiCode <= vps->getMaxTLayers() );
     1143         }
     1144       }
     1145#else
    11361146    READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode);
    11371147    assert( uiCode <= vps->getMaxTLayers() );
     1148#endif   
    11381149  }
    11391150#endif
     
    11441155#if VPS_EXTN_PROFILE_INFO
    11451156  // Profile-tier-level signalling
    1146 #if VPS_PROFILE_OUTPUT_LAYERS
    11471157  READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" );     assert( uiCode == (vps->getNumLayerSets() - 1) );
    11481158  READ_CODE(  6, uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 );
    11491159  vps->getPTLForExtnPtr()->resize(vps->getNumProfileTierLevel());
    11501160  for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++)
    1151 #else
    1152   vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets());
    1153   for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++)
    1154 #endif
    11551161  {
    11561162    READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); vps->setProfilePresentFlag(idx, uiCode ? true : false);
    11571163    if( !vps->getProfilePresentFlag(idx) )
    11581164    {
    1159 #if VPS_PROFILE_OUTPUT_LAYERS
    11601165      READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1);
    1161 #else
    1162       READ_UVLC( uiCode, "vps_profile_layer_set_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1);
    1163 #endif
    11641166      assert( vps->getProfileLayerSetRef(idx) < idx );
     1167
    11651168      // Copy profile information as indicated
    11661169      vps->getPTLForExtn(idx)->copyProfileInfo( vps->getPTLForExtn( vps->getProfileLayerSetRef(idx) ) );
     
    11701173#endif
    11711174
    1172 #if VPS_PROFILE_OUTPUT_LAYERS
    11731175  READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); vps->setMoreOutputLayerSetsThanDefaultFlag( uiCode ? true : false );
    11741176  Int numOutputLayerSets = 0;
     
    12311233    READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" );     vps->setProfileLevelTierIdx(i, uiCode);
    12321234  }
    1233 #else
    1234 #if VPS_EXTN_OP_LAYER_SETS
    1235   // Target output layer signalling
    1236   READ_UVLC( uiCode,            "vps_num_output_layer_sets"); vps->setNumOutputLayerSets(uiCode);
    1237   for(i = 0; i < vps->getNumOutputLayerSets(); i++)
    1238   {
    1239 #if VPS_OUTPUT_LAYER_SET_IDX
    1240     READ_UVLC( uiCode,           "vps_output_layer_set_idx_minus1[i]"); vps->setOutputLayerSetIdx(i, uiCode + 1);
    1241 #else
    1242     READ_UVLC( uiCode,           "vps_output_layer_set_idx[i]"); vps->setOutputLayerSetIdx(i, uiCode);
    1243 #endif
    1244     Int lsIdx = vps->getOutputLayerSetIdx(i);
    1245     for(j = 0; j <= vps->getMaxLayerId(); j++)
    1246     {
    1247       if(vps->getLayerIdIncludedFlag(lsIdx, j))
    1248       {
    1249         READ_FLAG( uiCode, "vps_output_layer_flag[lsIdx][j]"); vps->setOutputLayerFlag(lsIdx, j, uiCode);
    1250       }
    1251     }
    1252   }
    1253 #endif
    1254 #endif
     1235
    12551236#if REPN_FORMAT_IN_VPS
    1256   READ_FLAG( uiCode, "rep_format_idx_present_flag"); 
     1237  READ_FLAG( uiCode, "rep_format_idx_present_flag");
    12571238  vps->setRepFormatIdxPresentFlag( uiCode ? true : false );
    12581239
     
    12731254    parseRepFormat( vps->getVpsRepFormat(i) );
    12741255  }
    1275  
     1256
    12761257  // Default assignment for layer 0
    12771258  vps->setVpsRepFormatIdx( 0, 0 );
     
    13051286  vps->setMaxOneActiveRefLayerFlag(uiCode);
    13061287#endif
    1307 
    1308 #if N0147_IRAP_ALIGN_FLAG
     1288#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1289  for(i = 1; i< vps->getMaxLayers(); i++)
     1290  {
     1291    if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0  )
     1292    {
     1293      READ_FLAG(uiCode, "poc_lsb_not_present_flag[i]");
     1294      vps->setPocLsbNotPresentFlag(i, uiCode);
     1295    }
     1296  }
     1297#endif
     1298#if O0215_PHASE_ALIGNMENT
     1299  READ_FLAG( uiCode, "cross_layer_phase_alignment_flag"); vps->setPhaseAlignFlag( uiCode == 1 ? true : false );
     1300#endif
     1301
     1302#if N0147_IRAP_ALIGN_FLAG && !IRAP_ALIGN_FLAG_IN_VPS_VUI
    13091303  READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
    13101304  vps->setCrossLayerIrapAlignFlag(uiCode);
    1311 #endif
    1312 
    1313 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG
    1314 #if VPS_EXTN_DIRECT_REF_LAYERS
    1315   // For layer 0
    1316   vps->setNumDirectRefLayers(0, 0);
    1317   // For other layers
    1318   for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    1319   {
    1320     UInt numDirectRefLayers = 0;
    1321     for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
    1322     {
    1323       READ_FLAG(uiCode, "direct_dependency_flag[i][j]" ); vps->setDirectDependencyFlag(layerCtr, refLayerCtr, uiCode? true : false);
    1324       if(uiCode)
    1325       {
    1326         vps->setRefLayerId(layerCtr, numDirectRefLayers, refLayerCtr);
    1327         numDirectRefLayers++;
    1328       }
    1329     }
    1330     vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers);
    1331   }
    1332 #endif
    1333 #endif
     1305#endif
     1306
    13341307#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
    13351308  READ_UVLC( uiCode,           "direct_dep_type_len_minus2"); vps->setDirectDepTypeLen(uiCode+2);
     
    13511324    {
    13521325      for(j = 0; j < i; j++)
    1353         {     
     1326        {
    13541327          vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) );
    13551328        }
     
    13701343    }
    13711344    parseVPSVUI(vps);
    1372 #endif 
     1345#endif
    13731346  }
    13741347}
     
    13781351{
    13791352  UInt uiCode;
     1353#if AUXILIARY_PICTURES
     1354  READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) );
     1355#else
    13801356  READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( uiCode );
     1357#endif
    13811358 
    13821359  if( repFormat->getChromaFormatVpsIdc() == 3 )
     
    13871364  READ_CODE ( 16, uiCode, "pic_width_in_luma_samples" );     repFormat->setPicWidthVpsInLumaSamples ( uiCode );
    13881365  READ_CODE ( 16, uiCode, "pic_height_in_luma_samples" );    repFormat->setPicHeightVpsInLumaSamples( uiCode );
    1389  
     1366
    13901367  READ_CODE( 4, uiCode, "bit_depth_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
    13911368  READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
     
    13981375  UInt i,j;
    13991376  UInt uiCode;
     1377#if IRAP_ALIGN_FLAG_IN_VPS_VUI
     1378  READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
     1379  vps->setCrossLayerIrapAlignFlag(uiCode);
     1380#endif
    14001381#if VPS_VUI_BITRATE_PICRATE
    14011382  READ_FLAG( uiCode,        "bit_rate_present_vps_flag" );  vps->setBitRatePresentVpsFlag( uiCode ? true : false );
     
    14531434    for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
    14541435    {
    1455       READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));     
    1456     }
    1457   } 
    1458 #endif 
     1436      READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));
     1437    }
     1438  }
     1439#endif
    14591440#if N0160_VUI_EXT_ILP_REF
    1460     READ_FLAG( uiCode, "num_ilp_restricted_ref_layers" ); vps->setNumIlpRestrictedRefLayers( uiCode == 1 ); 
     1441    READ_FLAG( uiCode, "num_ilp_restricted_ref_layers" ); vps->setNumIlpRestrictedRefLayers( uiCode == 1 );
    14611442  if( vps->getNumIlpRestrictedRefLayers())
    14621443  {
     
    14651446      for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
    14661447      {
    1467         READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); 
    1468         if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 ) 
    1469         { 
    1470           READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 ); 
    1471           if(vps->getCtuBasedOffsetEnabledFlag(i,j)) 
     1448        READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );
     1449        if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 )
     1450        {
     1451          READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 );
     1452          if(vps->getCtuBasedOffsetEnabledFlag(i,j))
    14721453          {
    1473             READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode ); 
     1454            READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode );
    14741455          }
    1475         } 
    1476       } 
    1477     }
    1478   }
    1479 #endif
    1480 }
    1481 #endif
     1456        }
     1457      }
     1458    }
     1459  }
     1460#endif
     1461}
     1462#endif
     1463#endif //SVC_EXTENSION
     1464
    14821465Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)
    14831466{
     
    15521535  if(!rpcSlice->getDependentSliceSegmentFlag())
    15531536  {
     1537#if SVC_EXTENSION
    15541538#if POC_RESET_FLAG
    1555     Int iBits = 0; 
     1539    Int iBits = 0;
    15561540    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits)
    15571541    {
     
    15691553    }
    15701554#else
    1571 #if SH_DISCARDABLE_FLAG
    15721555    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits()>0)
    15731556    {
     
    15781561      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
    15791562    }
    1580 #else
     1563#endif
     1564#else //SVC_EXTENSION
    15811565    for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
    15821566    {
    15831567      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
    15841568    }
    1585 #endif
    1586 #endif
     1569#endif //SVC_EXTENSION
    15871570
    15881571    READ_UVLC (    uiCode, "slice_type" );            rpcSlice->setSliceType((SliceType)uiCode);
     
    16111594    }
    16121595#if N0065_LAYER_POC_ALIGNMENT
     1596#if SHM_FIX7
     1597    Int iPOClsb = 0;
     1598#endif
     1599#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1600    if( ( rpcSlice->getLayerId() > 0 && !rpcSlice->getVPS()->getPocLsbNotPresentFlag( rpcSlice->getVPS()->getLayerIdInVps(rpcSlice->getLayerId())) ) || !rpcSlice->getIdrPicFlag())
     1601#else
    16131602    if( rpcSlice->getLayerId() > 0 || !rpcSlice->getIdrPicFlag() )
     1603#endif
    16141604#else
    16151605    else
     
    16171607    {
    16181608      READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb");
     1609#if SHM_FIX7
     1610      iPOClsb = uiCode;
     1611#else
    16191612      Int iPOClsb = uiCode;
     1613#endif
    16201614      Int iPrevPOC = rpcSlice->getPrevTid0POC();
    16211615      Int iMaxPOClsb = 1<< sps->getBitsForPOC();
     
    16451639
    16461640#if N0065_LAYER_POC_ALIGNMENT
     1641#if SHM_FIX7
     1642      }
     1643#endif
    16471644      if( !rpcSlice->getIdrPicFlag() )
    16481645      {
     
    17371734            Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB
    17381735                                        - iPOClsb + pocLsbLt;
     1736
    17391737            rps->setPOC     (j, pocLTCurr);
    17401738            rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr);
     
    17461744            rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt);
    17471745            rps->setCheckLTMSBPresent(j,false);
    1748            
     1746
    17491747            // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present
    17501748            if( j == offset+(numOfLtrp-numLtrpInSPS)-1 )
     
    17791777        rpcSlice->setEnableTMVPFlag(false);
    17801778      }
    1781 #if N0065_LAYER_POC_ALIGNMENT
     1779#if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7
    17821780    }
    17831781#endif
     
    17881786    rpcSlice->setActiveNumILRRefIdx(0);
    17891787#if ILP_SSH_SIG
     1788#if ILP_SSH_SIG_FIX
     1789    if((sps->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) )
     1790#else
    17901791    if((sps->getLayerId() > 0) && rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (rpcSlice->getNumILRRefIdx() > 0) )
     1792#endif
    17911793#else
    17921794    if((sps->getLayerId() > 0)  &&  (rpcSlice->getNumILRRefIdx() > 0) )
     
    18411843    }
    18421844#if ILP_SSH_SIG
     1845#if ILP_SSH_SIG_FIX
     1846    else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true )
     1847#else
    18431848    else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == false )
     1849#endif
    18441850    {
    18451851      rpcSlice->setInterLayerPredEnabledFlag(true);
     
    18701876    {
    18711877      READ_FLAG(uiCode, "slice_sao_luma_flag");  rpcSlice->setSaoEnabledFlag((Bool)uiCode);
     1878#if AUXILIARY_PICTURES
     1879      ChromaFormat format;
     1880#if REPN_FORMAT_IN_VPS
     1881      if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() )
     1882      {
     1883        format = sps->getChromaFormatIdc();
     1884      }
     1885      else
     1886      {
     1887        format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc();
     1888      }
     1889#else
     1890      format = sps->getChromaFormatIdc();
     1891#endif
     1892      if (format != CHROMA_400)
     1893      {
     1894#endif
    18721895      READ_FLAG(uiCode, "slice_sao_chroma_flag");  rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode);
     1896#if AUXILIARY_PICTURES
     1897      }
     1898      else
     1899      {
     1900        rpcSlice->setSaoEnabledFlagChroma(false);
     1901      }
     1902#endif
    18731903    }
    18741904
     
    20692099
    20702100#if REPN_FORMAT_IN_VPS
     2101#if O0194_DIFFERENT_BITDEPTH_EL_BL
     2102    g_bitDepthYLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthY();
     2103    g_bitDepthCLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthC();
     2104#endif
    20712105    assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() );
    20722106#else
     
    21792213  {
    21802214    Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation();
    2181    
     2215
    21822216    // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header
    21832217    for ( UInt curByteIdx  = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ )
     
    24652499  SliceType       eSliceType  = pcSlice->getSliceType();
    24662500  Int             iNbRef       = (eSliceType == B_SLICE ) ? (2) : (1);
     2501#if SVC_EXTENSION
     2502  UInt            uiLog2WeightDenomLuma = 0, uiLog2WeightDenomChroma = 0;
     2503#else
    24672504  UInt            uiLog2WeightDenomLuma, uiLog2WeightDenomChroma;
     2505#endif
    24682506  UInt            uiTotalSignalledWeightFlags = 0;
    24692507
    24702508  Int iDeltaDenom;
     2509#if AUXILIARY_PICTURES
     2510  if (pcSlice->getChromaFormatIdc() == CHROMA_400)
     2511  {
     2512    bChroma = false;
     2513  }
     2514#endif
    24712515  // decode delta_luma_log2_weight_denom :
    24722516  READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" );     // ue(v): luma_log2_weight_denom
     
    24882532
    24892533      wp[0].uiLog2WeightDenom = uiLog2WeightDenomLuma;
     2534#if AUXILIARY_PICTURES
     2535      if (!bChroma)
     2536      {
     2537        wp[1].uiLog2WeightDenom = 0;
     2538        wp[2].uiLog2WeightDenom = 0;
     2539      }
     2540      else
     2541      {
     2542#endif
    24902543      wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma;
    24912544      wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma;
     2545#if AUXILIARY_PICTURES
     2546      }
     2547#endif
    24922548
    24932549      UInt  uiCode;
     
    25852641#if IL_SL_SIGNALLING_N0371
    25862642      if ( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
    2587       { 
     2643      {
    25882644        READ_FLAG( code, "scaling_list_pred_mode_flag");
    25892645        scalingListPredModeFlag = (code) ? true : false;
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r442 r494  
    7272  Void  parseQtRootCbf      ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
    7373  Void  parseVPS            ( TComVPS* pcVPS );
     74#if SPS_EXTENSION
    7475#if VPS_EXTNS
    7576  Void  parseVPSExtension   ( TComVPS* pcVPS );
     
    8283  Void  parseRepFormat      ( RepFormat *repFormat );
    8384#endif
    84 #if SPS_SUB_LAYER_INFO
    8585  Void  parseSPS            ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager );
    86 #else
     86  Void  parseSPSExtension    ( TComSPS* pcSPS );
     87#else //SVC_EXTENSION
    8788  Void  parseSPS            ( TComSPS* pcSPS );
    88 #endif
    89 #if SPS_EXTENSION
    90   Void parseSPSExtension    ( TComSPS* pcSPS );
    91 #endif
     89#endif //SVC_EXTENSION
    9290  Void  parsePPS            ( TComPPS* pcPPS);
    9391  Void  parseVUI            ( TComVUI* pcVUI, TComSPS* pcSPS );
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r442 r494  
    616616    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
    617617  }
     618#if O0194_DIFFERENT_BITDEPTH_EL_BL
     619  // Bug-fix
     620#if REPN_FORMAT_IN_VPS
     621  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getQpBDOffsetC(), curChromaQpOffset );
     622#else
    618623  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     624#endif
     625#else
     626  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     627#endif
    619628
    620629  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
     
    768777  // Cb and Cr
    769778  Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
     779#if O0194_DIFFERENT_BITDEPTH_EL_BL
     780  // Bug-fix
     781#if REPN_FORMAT_IN_VPS
     782  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getQpBDOffsetC(), curChromaQpOffset );
     783#else
    770784  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     785#endif
     786#else
     787  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     788#endif
    771789
    772790  uiWidth  >>= 1;
     
    776794
    777795  curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
     796#if O0194_DIFFERENT_BITDEPTH_EL_BL
     797  // Bug-fix
     798#if REPN_FORMAT_IN_VPS
     799  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getQpBDOffsetC(), curChromaQpOffset );
     800#else
    778801  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     802#endif
     803#else
     804  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
     805#endif
    779806
    780807  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
  • trunk/source/Lib/TLibDecoder/TDecEntropy.h

    r345 r494  
    6666
    6767  virtual Void  parseVPS                  ( TComVPS* pcVPS )                       = 0;
    68 #if SPS_SUB_LAYER_INFO
     68#if SVC_EXTENSION
    6969  virtual Void  parseSPS                  ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )           = 0;
    7070#else
     
    134134  Void    resetEntropy                ( TComSlice* p)           { m_pcEntropyDecoderIf->resetEntropy(p);                    }
    135135  Void    decodeVPS                   ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); }
    136 #if SPS_SUB_LAYER_INFO
     136#if SVC_EXTENSION
    137137  Void    decodeSPS                   ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )    { m_pcEntropyDecoderIf->parseSPS(pcSPS, parameterSetManager);                    }
    138138#else
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r442 r494  
    356356    uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    357357    uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
     358#if AUXILIARY_PICTURES
     359    ChromaFormat format = pcCU->getSlice()->getChromaFormatIdc();
     360    UInt uiGrayVal = 1 << (uiSampleBits - 1);
     361#endif
    358362
    359363    for(uiY = 0; uiY < uiHeight; uiY++)
     
    362366      {
    363367        UInt uiSample;
     368#if AUXILIARY_PICTURES
     369        if (format == CHROMA_400)
     370          uiSample = uiGrayVal;
     371        else
     372#endif
    364373        m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample);
    365374        piPCMSample[uiX] = uiSample;
     
    378387      {
    379388        UInt uiSample;
     389#if AUXILIARY_PICTURES
     390        if (format == CHROMA_400)
     391          uiSample = uiGrayVal;
     392        else
     393#endif
    380394        m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample);
    381395        piPCMSample[uiX] = uiSample;
     
    665679  UInt uiSymbol;
    666680
     681#if AUXILIARY_PICTURES
     682  if ( pcCU->getSlice()->getChromaFormatIdc() == CHROMA_400 )
     683  {
     684    uiSymbol = DC_IDX;
     685  }
     686  else
     687  {
     688#endif
    667689  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 0 ) );
    668690
     
    681703    }
    682704  }
     705#if AUXILIARY_PICTURES
     706  }
     707#endif
    683708  pcCU->setChromIntraDirSubParts( uiSymbol, uiAbsPartIdx, uiDepth );
    684709  return;
     
    885910  UInt uiSymbol;
    886911  const UInt uiCtx = pcCU->getCtxQtCbf( eType, uiTrDepth );
     912#if AUXILIARY_PICTURES
     913  if (pcCU->getSlice()->getChromaFormatIdc() == CHROMA_400 && (eType == TEXT_CHROMA_U || eType == TEXT_CHROMA_V))
     914  {
     915    uiSymbol = 0;
     916  }
     917  else
     918  {
     919#endif
    887920  m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA: eType, uiCtx ) );
     921#if AUXILIARY_PICTURES
     922  }
     923#endif
    888924 
    889925  DTRACE_CABAC_VL( g_nSymbolCounter++ )
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r345 r494  
    7676  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
    7777  Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
    78 #if SPS_SUB_LAYER_INFO
     78#if SVC_EXTENSION
    7979  Void  parseSPS                  ( TComSPS* /*pcSPS*/, ParameterSetManagerDecoder * /*parameterSetManager*/ ) {}
    8080#else
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r442 r494  
    179179
    180180        m_cIlpPic[j] = new  TComPic;
     181#if AUXILIARY_PICTURES
     182#if REPN_FORMAT_IN_VPS
     183#if SVC_UPSAMPLING
     184        m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
     185#else
     186        m_cIlpPic[j]->create(picWidth, picHeight, slice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     187#endif
     188#else
     189#if SVC_UPSAMPLING
     190        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, pcSPS, true);
     191#else
     192        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), pcSPS->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     193#endif
     194#endif
     195#else
    181196#if REPN_FORMAT_IN_VPS
    182197#if SVC_UPSAMPLING
     
    190205#else
    191206        m_cIlpPic[j]->create(pcSPS->getPicWidthInLumaSamples(), pcSPS->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     207#endif
    192208#endif
    193209#endif
     
    196212          m_cIlpPic[j]->getPicSym()->getCU(i)->initCU(m_cIlpPic[j], i);
    197213        }
    198       }
    199     }
    200   }
    201 }
    202 
    203 
    204 
    205 Void TDecTop::setILRPic(TComPic *pcPic)
    206 {
    207   for( Int i = 0; i < pcPic->getSlice(0)->getActiveNumILRRefIdx(); i++ )
    208   {
    209     Int refLayerIdc = pcPic->getSlice(0)->getInterLayerPredLayerIdc(i);
    210 
    211     if(m_cIlpPic[refLayerIdc])
    212     {
    213       m_cIlpPic[refLayerIdc]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(refLayerIdc), m_cIlpPic[refLayerIdc]->getPicYuvRec());
    214       m_cIlpPic[refLayerIdc]->getSlice(0)->setPOC(pcPic->getPOC());
    215       m_cIlpPic[refLayerIdc]->setLayerId(pcPic->getSlice(0)->getBaseColPic(refLayerIdc)->getLayerId()); //set reference layerId
    216       m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false);
    217       m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder();
    218       for (Int j=0; j<m_cIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++)  // set reference CU layerId
    219       {
    220         m_cIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId(m_cIlpPic[refLayerIdc]->getLayerId());
    221214      }
    222215    }
     
    310303#endif
    311304        }
    312 #if MAX_ONE_RESAMPLING_DIRECT_LAYERS
    313 #if SCALABILITY_MASK_E0104
    314         if(pcSlice->getVPS()->getScalabilityMask(2))
    315 #else
    316         if(pcSlice->getVPS()->getScalabilityMask(1))
    317 #endif
    318         {
    319           pcSlice->setPic(rpcPic);
    320         }
    321 #endif
    322305      }
    323306    }
    324307#endif
    325308   
     309#if AUXILIARY_PICTURES
     310#if REPN_FORMAT_IN_VPS
     311#if SVC_UPSAMPLING
     312    rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     313                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
     314#else
     315    rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     316                     conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     317#endif
     318#else
     319#if SVC_UPSAMPLING
     320    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     321                     conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
     322#else
     323    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     324                     conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     325#endif
     326#endif
     327#else
    326328#if REPN_FORMAT_IN_VPS
    327329#if SVC_UPSAMPLING
     
    341343#endif
    342344#endif
     345#endif
    343346
    344347    rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
     
    381384  rpcPic->destroy();
    382385
     386#if AUXILIARY_PICTURES
     387#if REPN_FORMAT_IN_VPS
     388#if SVC_UPSAMPLING
     389  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     390                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
     391
     392#else
     393  rpcPic->create ( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     394                   conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     395#endif
     396#else
     397#if SVC_UPSAMPLING
     398  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     399                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSlice->getSPS(), true);
     400
     401#else
     402  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     403                   conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     404#endif
     405#endif
     406#else
    383407#if REPN_FORMAT_IN_VPS
    384408#if SVC_UPSAMPLING
     
    398422  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
    399423                   conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     424#endif
    400425#endif
    401426#endif
     
    473498
    474499  Int remainingInterLayerReferencesFlag = 0;
     500#if O0225_MAX_TID_FOR_REF_LAYERS
     501  for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ )
     502  {
     503    Int jLidx = pcSlice->getVPS()->getLayerIdInVps(targetDecLayerIdList[j]);
     504    if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId,jLidx) - 1 )
     505    {
     506#else
    475507  if ( currTid <= pcSlice->getVPS()->getMaxTidIlRefPicsPlus1(latestDecLayerId) - 1 )
    476508  {
    477509    for ( Int j = latestDecIdx + 1; j < numTargetDecLayers; j++ )
    478510    {
     511#endif
    479512      for ( Int k = 0; k < m_ppcTDecTop[targetDecLayerIdList[j]]->getNumDirectRefLayers(); k++ )
    480513      {
     
    684717
    685718#if SVC_EXTENSION
     719  m_apcSlicePilot->setSliceIdx( m_uiSliceIdx ); // it should be removed if HM will reflect it in above
    686720#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
    687721  setRefLayerParams(m_apcSlicePilot->getVPS());
     
    754788  // actual decoding starts here
    755789  xActivateParameterSets();
    756 #if 0 // N0147_IRAP_ALIGN_FLAG Disabled for now!
     790#if !O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS
     791  //Note setting O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS to 0 may cause decoder to crash.
    757792  //When cross_layer_irap_aligned_flag is equal to 0, num_extra_slice_header_bits >=1
    758793  if(!m_apcSlicePilot->getVPS()->getCrossLayerIrapAlignFlag() )
     
    10981133  pcPic->setLayerId(nalu.m_layerId);
    10991134  pcSlice->setLayerId(nalu.m_layerId);
     1135  pcSlice->setPic(pcPic);
    11001136#endif
    11011137
     
    11131149#endif
    11141150
    1115 #if SVC_EXTENSION   
    1116     if(m_layerId > 0)
     1151#if SVC_EXTENSION
     1152    // Create upsampling reference layer pictures for all possible dependent layers and do it only once for the first slice.
     1153    // Other slices might choose which reference pictures to be used for inter-layer prediction
     1154    if( m_layerId > 0 && m_uiSliceIdx == 0 )
     1155    {     
     1156      for( i = 0; i < pcSlice->getNumILRRefIdx(); i++ )
     1157      {
     1158        UInt refLayerIdc = i;
     1159#if AVC_BASE
     1160        if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() )
     1161        {
     1162          pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() );
     1163#if AVC_SYNTAX
     1164          TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc);
     1165          if( pcSlice->getPOC() == 0 )
     1166          {
     1167            // initialize partition order.
     1168            UInt* piTmp = &g_auiZscanToRaster[0];
     1169            initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp );
     1170            initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 );
     1171          }     
     1172          pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice );
     1173          pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
     1174#endif
     1175        }
     1176        else
     1177        {
     1178#if VPS_EXTN_DIRECT_REF_LAYERS
     1179          TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc );
     1180#else
     1181          TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 );
     1182#endif
     1183          TComList<TComPic*> *cListPic = pcTDecTop->getListPic();
     1184          pcSlice->setBaseColPic ( *cListPic, refLayerIdc );
     1185        }
     1186#else
     1187#if VPS_EXTN_DIRECT_REF_LAYERS
     1188        TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc );
     1189#else
     1190        TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 );
     1191#endif
     1192        TComList<TComPic*> *cListPic = pcTDecTop->getListPic();
     1193        pcSlice->setBaseColPic ( *cListPic, refLayerIdc );
     1194#endif
     1195
     1196        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
     1197
     1198        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
     1199        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
     1200
     1201        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
     1202        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     1203
     1204        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
     1205        g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
     1206
     1207        g_posScalingFactor[refLayerIdc][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
     1208        g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
     1209
     1210#if SVC_UPSAMPLING
     1211        if( pcPic->isSpatialEnhLayer(refLayerIdc) )
     1212        {   
     1213#if O0215_PHASE_ALIGNMENT
     1214#if O0194_JOINT_US_BITSHIFT
     1215          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     1216#else
     1217          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     1218#endif
     1219#else
     1220#if O0194_JOINT_US_BITSHIFT
     1221          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
     1222#else
     1223          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
     1224#endif
     1225#endif
     1226        }
     1227        else
     1228        {
     1229          pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() );
     1230        }
     1231        pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );
     1232#endif
     1233      }
     1234    }
     1235
     1236    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
    11171237    {
    11181238      for( i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
     
    11561276#endif
    11571277
    1158 #if SCALED_REF_LAYER_OFFSETS
    1159         const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
    1160 
    1161         Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
    1162         Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
    1163 
    1164         Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    1165         Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    1166 #else
    1167         const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();
    1168         const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();
    1169 
    1170         Int widthBL   = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    1171         Int heightBL  = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    1172 
    1173         Int widthEL   = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    1174         Int heightEL  = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    1175 #endif
    1176         g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
    1177         g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
    1178 
    1179         g_posScalingFactor[refLayerIdc][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
    1180         g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
    1181 
    1182 #if SVC_UPSAMPLING
    1183         if( pcPic->isSpatialEnhLayer(refLayerIdc) )
    1184         {   
    1185 #if SCALED_REF_LAYER_OFFSETS
    1186           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
    1187 #else
    1188           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() );
    1189 #endif
    1190         }
    1191         else
    1192         {
    1193           pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() );
    1194         }
    11951278        pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );
    1196 #endif
    1197       }
    1198     }
    1199 
    1200     if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
    1201     {
    1202       setILRPic(pcPic);
     1279      }
     1280
     1281      pcSlice->setILRPic( m_cIlpPic );
     1282
    12031283#if REF_IDX_MFM
    12041284#if M0457_COL_PICTURE_SIGNALING
     
    12211301    }
    12221302#endif
    1223 #endif
    1224 
    1225 #endif //SVC_EXTENSION
    1226 
     1303#if MFM_ENCCONSTRAINT
     1304    if( pcSlice->getMFMEnabledFlag() )
     1305    {
     1306      Int refLayerId = pcSlice->getRefPic( pcSlice->getSliceType() == B_SLICE ? ( RefPicList )( 1 - pcSlice->getColFromL0Flag() ) : REF_PIC_LIST_0 , pcSlice->getColRefIdx() )->getLayerId();
     1307      if( refLayerId != pcSlice->getLayerId() )
     1308      {
     1309        TComPic* pColBasePic = pcSlice->getBaseColPic( *m_ppcTDecTop[refLayerId]->getListPic() );
     1310        assert( pColBasePic->checkSameRefInfo() == true );
     1311      }
     1312    }
     1313#endif
     1314#endif
     1315   
    12271316#if N0147_IRAP_ALIGN_FLAG
    12281317    if(  m_layerId > 0 && pcSlice->getVPS()->getCrossLayerIrapAlignFlag())
     
    12391328    }
    12401329#endif
     1330#endif //SVC_EXTENSION
    12411331   
    12421332    // For generalized B
     
    13471437#if SVC_EXTENSION
    13481438  sps->setLayerId(m_layerId);
    1349 #endif
    1350 
    1351 #if SPS_SUB_LAYER_INFO
    13521439  m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder[0] );
    1353 #else
    1354   m_cEntropyDecoder.decodeSPS( sps );
    1355 #endif
    1356 #if SVC_EXTENSION
    13571440  m_parameterSetManagerDecoder[m_layerId].storePrefetchedSPS(sps);
    1358 #else
    1359   m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    1360 #endif
    1361 #if SVC_EXTENSION
    13621441#if !REPN_FORMAT_IN_VPS   // ILRP can only be initialized at activation 
    13631442  if(m_numLayer>0)
     
    13661445  }
    13671446#endif
    1368 #endif
     1447#else //SVC_EXTENSION
     1448  m_cEntropyDecoder.decodeSPS( sps );
     1449  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
     1450#endif //SVC_EXTENSION
    13691451}
    13701452
     
    15191601          Window &conformanceWindow = sps->getConformanceWindow();
    15201602          Window defaultDisplayWindow = sps->getVuiParametersPresentFlag() ? sps->getVuiParameters()->getDefaultDisplayWindow() : Window();
     1603#if AUXILIARY_PICTURES
    15211604#if SVC_UPSAMPLING
    15221605#if AVC_SYNTAX
    1523 
     1606          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true);
     1607#else
     1608          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true);
     1609#endif
     1610#else
     1611          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true);
     1612#endif
     1613#else
     1614#if SVC_UPSAMPLING
     1615#if AVC_SYNTAX
    15241616          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, sps, true);
    15251617#else
     
    15281620#else
    15291621          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth(), onformanceWindow, defaultDisplayWindow, numReorderPics, true);
     1622#endif
     1623#endif
     1624
     1625#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1626          // set AVC BL bit depth, can be an input parameter from the command line
     1627          g_bitDepthYLayer[0] = 8;
     1628          g_bitDepthCLayer[0] = 8;
    15301629#endif
    15311630        }
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r442 r494  
    213213  Void      xInitILRP(TComSPS *pcSPS);
    214214#endif
    215   Void      setILRPic(TComPic *pcPic);
    216215#endif
    217216#if AVC_SYNTAX || SYNTAX_OUTPUT
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r442 r494  
    359359  {
    360360    WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(),             "tiles_fixed_structure_flag");
    361 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG
    362     if ( pcSPS->getLayerId() > 0 )
    363     {
    364       WRITE_FLAG( pcVUI->getTileBoundariesAlignedFlag( ) ? 1 : 0 , "tile_boundaries_aligned_flag" );
    365     }
    366 #endif
    367361    WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
    368362    WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(),           "restricted_ref_pic_lists_flag");
     
    454448#endif
    455449  WRITE_CODE( pcSPS->getVPSId (),          4,       "sps_video_parameter_set_id" );
    456 #if SPS_SUB_LAYER_INFO
     450#if SVC_EXTENSION
    457451  if(pcSPS->getLayerId() == 0)
    458452  {
     
    460454    WRITE_CODE( pcSPS->getMaxTLayers() - 1,  3,       "sps_max_sub_layers_minus1" );
    461455    WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0,                             "sps_temporal_id_nesting_flag" );
    462 #if SPS_SUB_LAYER_INFO
     456#if SVC_EXTENSION
    463457  }
    464458#endif
     
    670664  WRITE_FLAG( 0, "inter_view_mv_vert_constraint_flag" );
    671665#endif
    672 #if SCALED_REF_LAYER_OFFSETS
    673666  if( pcSPS->getLayerId() > 0 )
    674667  {
     
    683676    }
    684677  }
    685 #endif
    686678#if M0463_VUI_EXT_ILP_REF
    687679  ////   sps_extension_vui_parameters( )
     
    708700Void TEncCavlc::codeVPS( TComVPS* pcVPS )
    709701{
     702#if VPS_EXTN_OFFSET_CALC
     703  UInt numBytesInVps = this->m_pcBitIf->getNumberOfWrittenBits();
     704#endif
    710705  WRITE_CODE( pcVPS->getVPSId(),                    4,        "vps_video_parameter_set_id" );
    711706  WRITE_CODE( 3,                                    2,        "vps_reserved_three_2bits" );
     
    811806      WRITE_FLAG(1,                  "vps_extension_alignment_bit_equal_to_one");
    812807    }
     808#if VPS_EXTN_OFFSET_CALC
     809    Int vpsExntOffsetValueInBits = this->m_pcBitIf->getNumberOfWrittenBits() - numBytesInVps + 16; // 2 bytes for NUH
     810    assert( vpsExntOffsetValueInBits % 8 == 0 );
     811    pcVPS->setExtensionOffset( vpsExntOffsetValueInBits >> 3 );
     812#endif
    813813    codeVPSExtension(pcVPS);
    814814    WRITE_FLAG( 0,                     "vps_extension2_flag" );   // Flag value of 1 reserved
     
    820820}
    821821
     822#if SVC_EXTENSION
    822823#if VPS_EXTNS
    823824Void TEncCavlc::codeVPSExtension (TComVPS *vps)
     
    835836  }
    836837
    837 #if VPS_SPLIT_FLAG
    838838  for(j = 0; j < vps->getNumScalabilityTypes() - vps->getSplittingFlag(); j++)
    839 #else
    840   for(j = 0; j < vps->getNumScalabilityTypes(); j++)
    841 #endif
    842839  {
    843840    WRITE_CODE( vps->getDimensionIdLen(j) - 1, 3,      "dimension_id_len_minus1[j]" );
     
    863860      WRITE_CODE( vps->getLayerIdInNuh(i),     6,      "layer_id_in_nuh[i]" );
    864861    }
    865 #if VPS_SPLIT_FLAG
    866     if(!vps->getSplittingFlag())
    867 #endif
     862
     863    if( !vps->getSplittingFlag() )
     864    {
    868865    for(j = 0; j < vps->getNumScalabilityTypes(); j++)
    869866    {
     
    871868      WRITE_CODE( vps->getDimensionId(i, j),   bits,   "dimension_id[i][j]" );
    872869    }
     870  }
    873871  }
    874872#endif
     
    885883  }
    886884#endif
    887 #if VPS_MOVE_DIR_DEPENDENCY_FLAG
    888885#if VPS_EXTN_DIRECT_REF_LAYERS
    889886  for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     
    894891    }
    895892  }
    896 #endif
    897893#endif
    898894#if JCTVC_M0203_INTERLAYER_PRED_IDC
     
    903899     for( i = 0; i < vps->getMaxLayers() - 1; i++)
    904900     {
     901#if O0225_MAX_TID_FOR_REF_LAYERS
     902       for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
     903       {
     904         if(vps->getDirectDependencyFlag(j, i))
     905         {
     906           WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i,j), 3, "max_tid_il_ref_pics_plus1[i][j]" );
     907         }
     908       }
     909#else
    905910       WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i), 3, "max_tid_il_ref_pics_plus1[i]" );
     911#endif
    906912     }
    907913   }
     
    909915  for( i = 0; i < vps->getMaxLayers() - 1; i++)
    910916  {
     917#if O0225_MAX_TID_FOR_REF_LAYERS
     918       for( j = i+1; j <= vps->getMaxLayers() - 1; j++)
     919       {
     920         if(vps->getDirectDependencyFlag(j, i))
     921         {
     922           WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i,j), 3, "max_tid_il_ref_pics_plus1[i][j]" );
     923         }
     924       }
     925#else
    911926    WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i), 3, "max_tid_il_ref_pics_plus1[i]" );
     927#endif
    912928  }
    913929#endif
     
    918934#if VPS_EXTN_PROFILE_INFO
    919935  // Profile-tier-level signalling
    920 #if VPS_PROFILE_OUTPUT_LAYERS
    921936  WRITE_CODE( vps->getNumLayerSets() - 1   , 10, "vps_number_layer_sets_minus1" );     
    922937  WRITE_CODE( vps->getNumProfileTierLevel() - 1,  6, "vps_num_profile_tier_level_minus1");
    923938  for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++)
    924 #else
    925   for(Int idx = 1; idx <= vps->getNumLayerSets() - 1; idx++)
    926 #endif
    927939  {
    928940    WRITE_FLAG( vps->getProfilePresentFlag(idx),       "vps_profile_present_flag[i]" );
    929941    if( !vps->getProfilePresentFlag(idx) )
    930942    {
    931 #if VPS_PROFILE_OUTPUT_LAYERS
    932943      WRITE_CODE( vps->getProfileLayerSetRef(idx) - 1, 6, "profile_ref_minus1[i]" );
    933 #else
    934       WRITE_UVLC( vps->getProfileLayerSetRef(idx) - 1, "vps_profile_layer_set_ref_minus1[i]" );
    935 #endif
    936944    }
    937945    codePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 );
     
    939947#endif
    940948
    941 #if VPS_PROFILE_OUTPUT_LAYERS
    942949  Int numOutputLayerSets = vps->getNumOutputLayerSets() ;
    943950  WRITE_FLAG(  (numOutputLayerSets > vps->getNumLayerSets()), "more_output_layer_sets_than_default_flag" );
     
    974981    WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" );     
    975982  }
    976 #else
    977 #if VPS_EXTN_OP_LAYER_SETS
    978   // Target output layer signalling
    979   WRITE_UVLC( vps->getNumOutputLayerSets(),            "vps_num_output_layer_sets");
    980   for(i = 0; i < vps->getNumOutputLayerSets(); i++)
    981   {
    982 #if VPS_OUTPUT_LAYER_SET_IDX
    983     assert(vps->getOutputLayerSetIdx(i) > 0);
    984     WRITE_UVLC( vps->getOutputLayerSetIdx(i) - 1,           "vps_output_layer_set_idx_minus1[i]");
    985 #else
    986     WRITE_UVLC( vps->getOutputLayerSetIdx(i),           "vps_output_layer_set_idx[i]");
    987 #endif
    988     Int lsIdx = vps->getOutputLayerSetIdx(i);
    989     for(j = 0; j <= vps->getMaxLayerId(); j++)
    990     {
    991       if(vps->getLayerIdIncludedFlag(lsIdx, j))
    992       {
    993         WRITE_FLAG( vps->getOutputLayerFlag(lsIdx, j), "vps_output_layer_flag[lsIdx][j]");
    994       }
    995     }
    996   }
    997 #endif
    998 #endif
    999983
    1000984#if REPN_FORMAT_IN_VPS
     
    10251009#if JCTVC_M0458_INTERLAYER_RPS_SIG
    10261010      WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag");
     1011#endif
     1012#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1013  for(i = 1; i< vps->getMaxLayers(); i++)
     1014  {
     1015    if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0  )
     1016    {
     1017      WRITE_FLAG(vps->getPocLsbNotPresentFlag(i), "poc_lsb_not_present_flag[i]");
     1018    }
     1019  }
     1020#endif
     1021#if O0215_PHASE_ALIGNMENT
     1022  WRITE_FLAG(vps->getPhaseAlignFlag(), "cross_layer_phase_alignment_flag" );
     1023#endif
     1024#if N0147_IRAP_ALIGN_FLAG && !IRAP_ALIGN_FLAG_IN_VPS_VUI
     1025  WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
    10271026#endif
    1028 #if N0147_IRAP_ALIGN_FLAG
    1029       WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
    1030 #endif
    1031 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG
    1032 #if VPS_EXTN_DIRECT_REF_LAYERS
    1033   for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    1034   {
    1035     for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
    1036     {
    1037       WRITE_FLAG(vps->getDirectDependencyFlag(layerCtr, refLayerCtr), "direct_dependency_flag[i][j]" );
    1038     }
    1039   }
    1040 #endif
    1041 #endif
    10421027#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
    10431028  WRITE_UVLC( vps->getDirectDepTypeLen()-2,                           "direct_dep_type_len_minus2");
     
    11071092{
    11081093  Int i,j;
     1094#if IRAP_ALIGN_FLAG_IN_VPS_VUI
     1095      WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
     1096#endif
    11091097#if VPS_VUI_BITRATE_PICRATE
    11101098  WRITE_FLAG( vps->getBitRatePresentVpsFlag(),        "bit_rate_present_vps_flag" );
     
    11731161}
    11741162#endif
     1163#endif //SVC_EXTENSION
    11751164
    11761165Void TEncCavlc::codeSliceHeader         ( TComSlice* pcSlice )
     
    12181207  if ( !pcSlice->getDependentSliceSegmentFlag() )
    12191208  {
    1220 
     1209#if SVC_EXTENSION
    12211210#if POC_RESET_FLAG
    12221211    Int iBits = 0;
     
    12381227    }
    12391228#else
    1240 #if SH_DISCARDABLE_FLAG
    12411229    if (pcSlice->getPPS()->getNumExtraSliceHeaderBits()>0)
    12421230    {
     
    12491237      WRITE_FLAG(0, "slice_reserved_undetermined_flag[]");
    12501238    }
    1251 #else
     1239#endif
     1240#else //SVC_EXTENSION
    12521241    for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
    12531242    {
     
    12551244      WRITE_FLAG(0, "slice_reserved_undetermined_flag[]");
    12561245    }
    1257 #endif
    1258 #endif
     1246#endif //SVC_EXTENSION
    12591247
    12601248    WRITE_UVLC( pcSlice->getSliceType(),       "slice_type" );
     
    12651253    }
    12661254
     1255#if !AUXILIARY_PICTURES
    12671256#if REPN_FORMAT_IN_VPS
    12681257    // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present
     
    12721261    assert (pcSlice->getSPS()->getChromaFormatIdc() == 1 );
    12731262#endif
     1263#endif
    12741264    // if( separate_colour_plane_flag  ==  1 )
    12751265    //   colour_plane_id                                      u(2)
    12761266
    12771267#if N0065_LAYER_POC_ALIGNMENT
     1268#if O0062_POC_LSB_NOT_PRESENT_FLAG
     1269    if( (pcSlice->getLayerId() > 0 && !pcSlice->getVPS()->getPocLsbNotPresentFlag( pcSlice->getVPS()->getLayerIdInVps(pcSlice->getLayerId())) ) || !pcSlice->getIdrPicFlag())
     1270#else
    12781271    if( pcSlice->getLayerId() > 0 || !pcSlice->getIdrPicFlag() )
     1272#endif
    12791273#else
    12801274    if( !pcSlice->getIdrPicFlag() )
     
    12971291
    12981292#if N0065_LAYER_POC_ALIGNMENT
     1293#if SHM_FIX7
     1294    }
     1295#endif
    12991296      if( !pcSlice->getIdrPicFlag() )
    13001297      {
     
    14141411        WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enable_flag" );
    14151412      }
    1416 #if N0065_LAYER_POC_ALIGNMENT
     1413#if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7
    14171414      }
    14181415#endif
     
    14211418#if JCTVC_M0458_INTERLAYER_RPS_SIG
    14221419#if ILP_SSH_SIG
     1420#if ILP_SSH_SIG_FIX
     1421    if((pcSlice->getSPS()->getLayerId() > 0) && !(pcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (pcSlice->getNumILRRefIdx() > 0) )
     1422#else
    14231423    if((pcSlice->getSPS()->getLayerId() > 0) && pcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (pcSlice->getNumILRRefIdx() > 0) )
     1424#endif
    14241425#else
    14251426    if((pcSlice->getSPS()->getLayerId() > 0)  &&  (pcSlice->getNumILRRefIdx() > 0) )
     
    14681469         WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "slice_sao_luma_flag" );
    14691470         {
     1471#if AUXILIARY_PICTURES
     1472           if (pcSlice->getChromaFormatIdc() != CHROMA_400)
     1473           {
     1474#endif
    14701475           SAOParam *saoParam = pcSlice->getPic()->getPicSym()->getSaoParam();
    14711476          WRITE_FLAG( saoParam->bSaoFlag[1], "slice_sao_chroma_flag" );
     1477#if AUXILIARY_PICTURES
     1478           }
     1479#endif
    14721480         }
    14731481      }
     
    19341942  UInt            uiMode = 0;
    19351943  UInt            uiTotalSignalledWeightFlags = 0;
     1944#if AUXILIARY_PICTURES
     1945  if (pcSlice->getChromaFormatIdc() == CHROMA_400)
     1946  {
     1947    bChroma = false;
     1948  }
     1949#endif
    19361950  if ( (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()) )
    19371951  {
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r442 r494  
    6969  Int m_numRefIdc;
    7070  Int m_refIdc[MAX_NUM_REF_PICS+1];
    71 #if EXTERNAL_USEDBYCURR_N0082
    72   Int m_UseExtusedByCurrPic;
    73   Int m_ExtusedByCurrPic[MAX_NUM_REF_PICS];
    74 #endif
    7571  GOPEntry()
    7672  : m_POC(-1)
     
    8783  , m_deltaRPS(0)
    8884  , m_numRefIdc(0)
    89 #if EXTERNAL_USEDBYCURR_N0082
    90   , m_UseExtusedByCurrPic(0)
    91 #endif
    9285  {
    9386    ::memset( m_referencePics, 0, sizeof(m_referencePics) );
    9487    ::memset( m_usedByCurrPic, 0, sizeof(m_usedByCurrPic) );
    9588    ::memset( m_refIdc,        0, sizeof(m_refIdc) );
    96 #if EXTERNAL_USEDBYCURR_N0082
    97     ::memset( m_usedByCurrPic, 0, sizeof(m_ExtusedByCurrPic) );
    98 #endif
    9989  }
    10090};
     
    221211  Int       m_chromaCbQpOffset;                 //  Chroma Cb QP Offset (0:default)
    222212  Int       m_chromaCrQpOffset;                 //  Chroma Cr Qp Offset (0:default)
     213#if AUXILIARY_PICTURES
     214  ChromaFormat m_chromaFormatIDC;
     215#endif
    223216
    224217#if ADAPTIVE_QP_SELECTION
     
    941934  Int       getAdaptiveResolutionChange()      { return m_adaptiveResolutionChange; }
    942935#endif
     936#if AUXILIARY_PICTURES
     937  Void         setChromaFormatIDC(ChromaFormat x) { m_chromaFormatIDC = x;    }
     938  ChromaFormat getChromaFormatIDC()               { return m_chromaFormatIDC; }
     939#endif
    943940#endif
    944941};
  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r442 r494  
    250250#endif
    251251
     252#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     253  m_disableILP = xCheckTileSetConstraint(rpcCU);
     254  m_pcPredSearch->setDisableILP(m_disableILP);
     255#endif
     256
    252257  // analysis of CU
    253258  xCompressCU( m_ppcBestCU[0], m_ppcTempCU[0], 0 );
     
    261266    }
    262267  }
     268#endif
     269
     270#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     271  xVerifyTileSetConstraint(rpcCU);
    263272#endif
    264273}
     
    731740        }
    732741#if (ENCODER_FAST_MODE)
     742#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     743      if(pcPic->getLayerId() > 0 && !m_disableILP)
     744#else
    733745      if(pcPic->getLayerId() > 0)
     746#endif
    734747      {
    735748        for(Int refLayer = 0; refLayer < pcSlice->getActiveNumILRRefIdx(); refLayer++)
     
    13811394      Bool bZeroMVILR = rpcTempCU->xCheckZeroMVILRMerge(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]);
    13821395      if(bZeroMVILR)
     1396      {
     1397#endif
     1398#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1399      if (!(rpcTempCU->isInterLayerReference(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]) && m_disableILP))
    13831400      {
    13841401#endif
     
    14261443          }
    14271444        }
     1445      }
     1446#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1447      }
     1448#endif
    14281449#if REF_IDX_ME_ZEROMV
    1429         }
    1430 #endif
    1431       }
     1450      }
     1451#endif
    14321452  }
    14331453
     
    18081828}
    18091829
     1830#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1831Bool TEncCu::xCheckTileSetConstraint( TComDataCU*& rpcCU )
     1832{
     1833  Bool disableILP = false;
     1834
     1835  if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getAddr()) >= 0)
     1836  {
     1837    if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getAddr()) == 2)
     1838    {
     1839      disableILP = true;
     1840    }
     1841    if (rpcCU->getPic()->getPicSym()->getTileSetType(rpcCU->getAddr()) == 1)
     1842    {
     1843      Int currCUaddr = rpcCU->getAddr();
     1844      Int frameWitdhInCU  = rpcCU->getPic()->getPicSym()->getFrameWidthInCU();
     1845      Int frameHeightInCU = rpcCU->getPic()->getPicSym()->getFrameHeightInCU();
     1846      Bool leftCUExists   = (currCUaddr % frameWitdhInCU) > 0;
     1847      Bool aboveCUExists  = (currCUaddr / frameWitdhInCU) > 0;
     1848      Bool rightCUExists  = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1);
     1849      Bool belowCUExists  = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1);
     1850      Int currTileSetIdx  = rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr);
     1851      // Check if CU is at tile set boundary
     1852      if ( (leftCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-1) != currTileSetIdx) ||
     1853           (leftCUExists && aboveCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) ||
     1854           (aboveCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) ||
     1855           (aboveCUExists && rightCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) ||
     1856           (rightCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+1) != currTileSetIdx) ||
     1857           (rightCUExists && belowCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) ||
     1858           (belowCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) ||
     1859           (belowCUExists && leftCUExists && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) )
     1860      {
     1861        disableILP = true;  // Disable ILP in tile set boundary CU
     1862      }
     1863    }
     1864  }
     1865
     1866  return disableILP;
     1867}
     1868
     1869Void TEncCu::xVerifyTileSetConstraint( TComDataCU*& rpcCU )
     1870{
     1871  if (rpcCU->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && rpcCU->getPic()->getPicSym()->getTileSetIdxMap(rpcCU->getAddr()) >= 0 &&
     1872      m_disableILP)
     1873  {
     1874    UInt numPartitions = rpcCU->getPic()->getNumPartInCU();
     1875    for (UInt i = 0; i < numPartitions; i++)
     1876    {
     1877      if (!rpcCU->isIntra(i))
     1878      {
     1879        for (UInt refList = 0; refList < 2; refList++)
     1880        {
     1881          if (rpcCU->getInterDir(i) & (1<<refList))
     1882          {
     1883            TComCUMvField *mvField = rpcCU->getCUMvField(RefPicList(refList));
     1884            if (mvField->getRefIdx(i) >= 0)
     1885            {
     1886              assert(!(rpcCU->getSlice()->getRefPic(RefPicList(refList), mvField->getRefIdx(i))->isILR(rpcCU->getLayerId())));
     1887            }
     1888          }
     1889        }
     1890      }
     1891    }
     1892  }
     1893}
     1894#endif
     1895
    18101896/** Collect ARL statistics from one LCU
    18111897 * \param pcCU
  • trunk/source/Lib/TLibEncoder/TEncCu.h

    r345 r494  
    108108  Int                     m_temporalSAD;
    109109#endif
     110#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     111  Bool                    m_disableILP;
     112#endif
    110113public:
    111114  /// copy parameters from encoder class
     
    171174#endif
    172175
     176#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     177  Bool xCheckTileSetConstraint( TComDataCU*& rpcCU );
     178  Void xVerifyTileSetConstraint( TComDataCU*& rpcCU );
     179#endif
     180
    173181#if AMP_ENC_SPEEDUP
    174182#if AMP_MRG
  • trunk/source/Lib/TLibEncoder/TEncEntropy.cpp

    r345 r494  
    280280  const UInt uiTrDepthCurr = uiDepth - pcCU->getDepth( uiAbsPartIdx );
    281281  const Bool bFirstCbfOfCU = uiTrDepthCurr == 0;
     282#if AUXILIARY_PICTURES
     283  if (pcCU->getSlice()->getChromaFormatIdc() != CHROMA_400)
     284  {
     285#endif
    282286  if( bFirstCbfOfCU || uiLog2TrafoSize > 2 )
    283287  {
     
    296300    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr - 1 ) );
    297301  }
     302#if AUXILIARY_PICTURES
     303  }
     304  else
     305  {
     306    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepthCurr ) == 0 );
     307    assert( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepthCurr ) == 0 );
     308  }
     309#endif
    298310 
    299311  if( uiSubdiv )
     
    402414Void TEncEntropy::encodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    403415{
     416#if AUXILIARY_PICTURES
     417  if ( pcCU->getSlice()->getChromaFormatIdc() == CHROMA_400 )
     418  {
     419    return;
     420  }
     421#endif
    404422  if( bRD )
    405423  {
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r442 r494  
    753753    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
    754754#if SVC_EXTENSION
    755 #if ILR_RESTR && ILR_RESTR_FIX
     755    if (m_layerId > 0)
     756    {
    756757    Int interLayerPredLayerIdcTmp[MAX_VPS_LAYER_ID_PLUS1];
    757758    Int activeNumILRRefIdxTmp = 0;
    758 #endif
    759     if (m_layerId > 0)
    760     {
     759
    761760      for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
    762761      {
     
    769768        pcSlice->setBaseColPic( *cListPic, refLayerIdc );
    770769
    771 #if ILR_RESTR && ILR_RESTR_FIX
    772770        // Apply temporal layer restriction to inter-layer prediction
     771#if O0225_MAX_TID_FOR_REF_LAYERS
     772        Int maxTidIlRefPicsPlus1 = m_pcEncTop->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getLayerId(),m_layerId);
     773#else
    773774        Int maxTidIlRefPicsPlus1 = m_pcEncTop->getVPS()->getMaxTidIlRefPicsPlus1(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getLayerId());
     775#endif
    774776        if( ((Int)(pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getTLayer())<=maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getRapPicFlag()) )
    775777        {
     
    780782          continue; // ILP is not valid due to temporal layer restriction
    781783        }
    782 #endif
    783 
    784 #if SCALED_REF_LAYER_OFFSETS
     784
    785785        const Window &scalEL = m_pcEncTop->getScaledRefLayerWindow(refLayerIdc);
    786786
     
    790790        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    791791        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    792 #else
    793         const Window &confBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getConformanceWindow();
    794         const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();
    795 
    796         Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
    797         Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
    798 
    799         Int widthEL   = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
    800         Int heightEL  = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
    801 #endif
     792
    802793        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
    803794        g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
     
    809800        if( pcPic->isSpatialEnhLayer(refLayerIdc))
    810801        {
    811 #if SCALED_REF_LAYER_OFFSETS
     802#if O0215_PHASE_ALIGNMENT
     803#if O0194_JOINT_US_BITSHIFT
     804          m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     805#else
     806          m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
     807#endif
     808#else
     809#if O0194_JOINT_US_BITSHIFT
     810          m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
     811#else
    812812          m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
    813 #else
    814           m_pcPredSearch->upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() );
     813#endif
    815814#endif
    816815        }
     
    823822      }
    824823
    825 #if ILR_RESTR && ILR_RESTR_FIX
    826824      // Update the list of active inter-layer pictures
    827825      for ( Int i = 0; i < activeNumILRRefIdxTmp; i++)
     
    835833        pcSlice->setInterLayerPredEnabledFlag(false);
    836834      }
    837 #endif
    838835     
    839836      if( pocCurr % m_pcCfg->getIntraPeriod() == 0 )
     
    11671164    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
    11681165    {
    1169       m_pcEncTop->setILRPic(pcPic);
     1166      pcSlice->setILRPic( m_pcEncTop->getIlpList() );
    11701167#if REF_IDX_MFM
    11711168#if M0457_COL_PICTURE_SIGNALING
     
    12011198        UInt ColFromL0Flag = pcSlice->getColFromL0Flag();
    12021199        UInt ColRefIdx     = pcSlice->getColRefIdx();
     1200
    12031201        for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++)
    12041202        {
    1205           if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) )
     1203          if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId)
     1204#if MFM_ENCCONSTRAINT
     1205            && pcSlice->getBaseColPic( *m_ppcTEncTop[pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getLayerId()]->getListPic() )->checkSameRefInfo() == true
     1206#endif
     1207            )
    12061208          {
    12071209            ColRefIdx = colIdx;
     
    12161218          for(Int colIdx = 0; colIdx < pcSlice->getNumRefIdx( RefPicList(1 - ColFromL0Flag) ); colIdx++)
    12171219          {
    1218             if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId) )
     1220            if( pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->isILR(m_layerId)
     1221#if MFM_ENCCONSTRAINT
     1222              && pcSlice->getBaseColPic( *m_ppcTEncTop[pcSlice->getRefPic( RefPicList(1 - ColFromL0Flag), colIdx)->getLayerId()]->getListPic() )->checkSameRefInfo() == true
     1223#endif
     1224              )
    12191225            {
    12201226              ColRefIdx = colIdx;
     
    15671573    {
    15681574      pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() );
     1575#if O0194_WEIGHTED_PREDICTION_CGS
     1576      // Calculate for the base layer to be used in EL as Inter layer reference
     1577      m_pcSliceEncoder->estimateILWpParam( pcSlice );
     1578#endif
    15691579#if AVC_SYNTAX
    15701580      pcPic->readBLSyntax( m_ppcTEncTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
     
    16071617          pcSlice->setSliceSegmentCurStartCUAddr  ( startCUAddrSlice      );
    16081618          pcSlice->setSliceBits(0);
     1619#if SVC_EXTENSION
     1620          // copy reference list modification info from the first slice, assuming that this information is the same across all slices in the picture
     1621          memcpy( pcSlice->getRefPicListModification(), pcPic->getSlice(0)->getRefPicListModification(), sizeof(TComRefPicListModification) );
     1622#endif
    16091623          uiNumSlices ++;
    16101624        }
     
    16891703#else
    16901704      OutputNALUnit nalu(NAL_UNIT_VPS);
     1705#endif
     1706#if VPS_EXTN_OFFSET_CALC
     1707      OutputNALUnit tempNalu(NAL_UNIT_VPS, 0, 0        ); // The value of nuh_layer_id of VPS NAL unit shall be equal to 0.
     1708      m_pcEntropyCoder->setBitstream(&tempNalu.m_Bitstream);
     1709      m_pcEntropyCoder->encodeVPS(m_pcEncTop->getVPS());  // Use to calculate the VPS extension offset
    16911710#endif
    16921711      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    31623181 
    31633182  TComPicYuv* pcOrgInterlaced = new TComPicYuv;
     3183#if AUXILIARY_PICTURES
     3184  pcOrgInterlaced->create( iWidth, iHeight << 1, pcPicOrgTop->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     3185#else
    31643186  pcOrgInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     3187#endif
    31653188 
    31663189  TComPicYuv* pcRecInterlaced = new TComPicYuv;
     3190#if AUXILIARY_PICTURES
     3191  pcRecInterlaced->create( iWidth, iHeight << 1, pcPicOrgTop->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     3192#else
    31673193  pcRecInterlaced->create( iWidth, iHeight << 1, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     3194#endif
    31683195 
    31693196  Pel* pOrgInterlaced = pcOrgInterlaced->getLumaAddr();
  • trunk/source/Lib/TLibEncoder/TEncPic.cpp

    r313 r494  
    126126 * \return Void
    127127 */
     128#if AUXILIARY_PICTURES
     129#if SVC_UPSAMPLING
     130Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 
     131                      Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual )
     132
     133#else
     134
     135Void TEncPic::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,
     136                      Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual )
     137#endif
     138{
     139#if SVC_UPSAMPLING
     140  TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, 
     141                   conformanceWindow, defaultDisplayWindow, numReorderPics, pcSps, bIsVirtual );
     142#else
     143  TComPic::create( iWidth, iHeight, chromaFormat, uiMaxWidth, uiMaxHeight, uiMaxDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, bIsVirtual );
     144#endif
     145  m_uiMaxAQDepth = uiMaxAQDepth;
     146  if ( uiMaxAQDepth > 0 )
     147  {
     148    m_acAQLayer = new TEncPicQPAdaptationLayer[ m_uiMaxAQDepth ];
     149    for (UInt d = 0; d < m_uiMaxAQDepth; d++)
     150    {
     151      m_acAQLayer[d].create( iWidth, iHeight, uiMaxWidth>>d, uiMaxHeight>>d );
     152    }
     153  }
     154}
     155#else
    128156#if SVC_UPSAMPLING
    129157Void TEncPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 
     
    152180  }
    153181}
     182#endif
    154183
    155184/** Clean up
  • trunk/source/Lib/TLibEncoder/TEncPic.h

    r313 r494  
    105105  virtual ~TEncPic();
    106106
     107#if AUXILIARY_PICTURES
     108#if SVC_UPSAMPLING
     109  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 
     110                      Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual=false );
     111#else
     112  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,
     113                          Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false );
     114
     115#endif
     116#else
    107117#if SVC_UPSAMPLING
    108118  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,   
     
    111121  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,   
    112122                        Window &conformanceWindow, Window &defaultDisplayWindow, Int *numReorderPics, Bool bIsVirtual = false );
     123#endif
    113124#endif
    114125  virtual Void  destroy();
  • trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r313 r494  
    18711871
    18721872  saoParam->bSaoFlag[0] = true;
     1873#if AUXILIARY_PICTURES
     1874  saoParam->bSaoFlag[1] = m_pcPic->getChromaFormat() == CHROMA_400 ? false : true;
     1875#else
    18731876  saoParam->bSaoFlag[1] = true;
     1877#endif
    18741878  saoParam->oneUnitFlag[0] = false;
    18751879  saoParam->oneUnitFlag[1] = false;
  • trunk/source/Lib/TLibEncoder/TEncSbac.cpp

    r442 r494  
    914914    }
    915915
     916#if AUXILIARY_PICTURES
     917    if (pcCU->getSlice()->getChromaFormatIdc() != CHROMA_400)
     918    {
     919#endif
    916920    piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
    917921    uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
     
    945949      piPCMSample += uiWidth;
    946950    }
     951#if AUXILIARY_PICTURES
     952    }
     953#endif
    947954    m_pcBinIf->resetBac();
    948955  }
  • trunk/source/Lib/TLibEncoder/TEncSearch.cpp

    r442 r494  
    30923092    {
    30933093#endif
     3094#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3095    if (!(pcCU->isInterLayerReference(uhInterDirNeighbours[uiMergeCand], cMvFieldNeighbours[0 + 2*uiMergeCand], cMvFieldNeighbours[1 + 2*uiMergeCand]) && m_disableILP))
     3096    {
     3097#endif
    30943098      UInt uiCostCand = MAX_UINT;
    30953099      UInt uiBitsCand = 0;
     
    31153119        uiMergeIndex = uiMergeCand;
    31163120      }
     3121#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     3122    }
     3123#endif
    31173124#if REF_IDX_ME_ZEROMV
    31183125    }
     
    32213228  Int numValidMergeCand = 0 ;
    32223229
    3223 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3224   Bool disableILP = false;
    3225   if (pcCU->getPic()->getLayerId() == (m_pcEncCfg->getNumLayer() - 1)  && m_pcEncCfg->getInterLayerConstrainedTileSetsSEIEnabled() && pcCU->getPic()->getPicSym()->getTileSetIdxMap(pcCU->getAddr()) >= 0)
    3226   {
    3227     if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 2)
    3228     {
    3229       disableILP = true;
    3230     }
    3231     if (pcCU->getPic()->getPicSym()->getTileSetType(pcCU->getAddr()) == 1)
    3232     {
    3233       Int currCUaddr = pcCU->getAddr();
    3234       Int frameWitdhInCU  = pcCU->getPic()->getPicSym()->getFrameWidthInCU();
    3235       Int frameHeightInCU = pcCU->getPic()->getPicSym()->getFrameHeightInCU();
    3236       Bool leftCUExists   = (currCUaddr % frameWitdhInCU) > 0;
    3237       Bool aboveCUExists  = (currCUaddr / frameWitdhInCU) > 0;
    3238       Bool rightCUExists  = (currCUaddr % frameWitdhInCU) < (frameWitdhInCU - 1);
    3239       Bool belowCUExists  = (currCUaddr / frameWitdhInCU) < (frameHeightInCU - 1);
    3240       Int currTileSetIdx  = pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr);
    3241       // Check if CU is at tile set boundary
    3242       if ( (leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-1) != currTileSetIdx) ||
    3243            (leftCUExists && aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU-1) != currTileSetIdx) ||
    3244            (aboveCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU) != currTileSetIdx) ||
    3245            (aboveCUExists && rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr-frameWitdhInCU+1) != currTileSetIdx) ||
    3246            (rightCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+1) != currTileSetIdx) ||
    3247            (rightCUExists && belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU+1) != currTileSetIdx) ||
    3248            (belowCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU) != currTileSetIdx) ||
    3249            (belowCUExists && leftCUExists && pcCU->getPic()->getPicSym()->getTileIdxMap(currCUaddr+frameWitdhInCU-1) != currTileSetIdx) )
    3250       {
    3251         disableILP = true;  // Disable ILP in tile set boundary CU
    3252       }
    3253     }
    3254   }
    3255 #endif
    3256 
    32573230  for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ )
    32583231  {
     
    33053278      {
    33063279#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3307         if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && disableILP)
     3280        if (pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxTemp )->isILR(pcCU->getLayerId()) && m_disableILP)
    33083281        {
    33093282          continue;
     
    35293502        }
    35303503#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3531         if (pcPic->isILR(pcCU->getLayerId()) && disableILP)
     3504        if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP)
    35323505        {
    35333506          testIter = false;
     
    35503523          }
    35513524#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    3552           if (pcPic->isILR(pcCU->getLayerId()) && disableILP)
     3525          if (pcPic->isILR(pcCU->getLayerId()) && m_disableILP)
    35533526          {
    35543527            testRefIdx = false;
     
    41194092
    41204093  // prediction pattern
     4094#if O0194_WEIGHTED_PREDICTION_CGS
     4095  // Bug Fix (It did not check WP for BSlices)
     4096  if ( pcCU->getSlice()->getPPS()->getUseWP())
     4097#else
    41214098  if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     4099#endif
    41224100  {
    41234101    xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true );
     
    41284106  }
    41294107
     4108#if O0194_WEIGHTED_PREDICTION_CGS
     4109  if ( pcCU->getSlice()->getPPS()->getUseWP())
     4110  ///< Bug Fix (It did not check WP for BSlices)
     4111#else
    41304112  if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     4113#endif
    41314114  {
    41324115    xWeightedPredictionUni( pcCU, pcTemplateCand, uiPartAddr, iSizeX, iSizeY, eRefPicList, pcTemplateCand, iRefIdx );
  • trunk/source/Lib/TLibEncoder/TEncSearch.h

    r345 r494  
    129129  // UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS];
    130130  UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds
    131  
     131
     132#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     133  Bool            m_disableILP;
     134#endif
     135
    132136public:
    133137  TEncSearch();
     
    220224  Void xEncPCM    (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType eText);
    221225  Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv );
     226
     227#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     228  Void setDisableILP(Bool a) {m_disableILP = a;}
     229#endif
     230
    222231protected:
    223232 
  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r442 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    5151  m_apcPicYuvPred = NULL;
    5252  m_apcPicYuvResi = NULL;
    53  
     53
    5454  m_pdRdPicLambda = NULL;
    5555  m_pdRdPicQp     = NULL;
     
    6969}
    7070
    71 Void TEncSlice::initCtxMem(  UInt i )               
    72 {   
     71Void TEncSlice::initCtxMem(  UInt i )
     72{
    7373  for (std::vector<TEncSbac*>::iterator j = CTXMem.begin(); j != CTXMem.end(); j++)
    7474  {
    7575    delete (*j);
    7676  }
    77   CTXMem.clear(); 
    78   CTXMem.resize(i); 
     77  CTXMem.clear();
     78  CTXMem.resize(i);
    7979}
    8080
     81#if AUXILIARY_PICTURES
     82Void TEncSlice::create( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth )
     83{
     84  // create prediction picture
     85  if ( m_apcPicYuvPred == NULL )
     86  {
     87    m_apcPicYuvPred  = new TComPicYuv;
     88    m_apcPicYuvPred->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
     89  }
     90
     91  // create residual picture
     92  if( m_apcPicYuvResi == NULL )
     93  {
     94    m_apcPicYuvResi  = new TComPicYuv;
     95    m_apcPicYuvResi->create( iWidth, iHeight, chromaFormat, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
     96  }
     97}
     98#else
    8199Void TEncSlice::create( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth )
    82100{
     
    87105    m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
    88106  }
    89  
     107
    90108  // create residual picture
    91109  if( m_apcPicYuvResi == NULL )
     
    95113  }
    96114}
     115#endif
    97116
    98117Void TEncSlice::destroy()
     
    105124    m_apcPicYuvPred  = NULL;
    106125  }
    107  
     126
    108127  // destroy residual picture
    109128  if ( m_apcPicYuvResi )
     
    113132    m_apcPicYuvResi  = NULL;
    114133  }
    115  
     134
    116135  // free lambda and QP arrays
    117136  if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; }
     
    139158#if SVC_EXTENSION
    140159  m_ppcTEncTop        = pcEncTop->getLayerEnc();
    141 #endif 
     160#endif
    142161  m_pcGOPEncoder      = pcEncTop->getGOPEncoder();
    143162  m_pcCuEncoder       = pcEncTop->getCuEncoder();
    144163  m_pcPredSearch      = pcEncTop->getPredSearch();
    145  
     164
    146165  m_pcEntropyCoder    = pcEncTop->getEntropyCoder();
    147166  m_pcCavlcCoder      = pcEncTop->getCavlcCoder();
     
    149168  m_pcBinCABAC        = pcEncTop->getBinCABAC();
    150169  m_pcTrQuant         = pcEncTop->getTrQuant();
    151  
     170
    152171  m_pcBitCounter      = pcEncTop->getBitCounter();
    153172  m_pcRdCost          = pcEncTop->getRdCost();
    154173  m_pppcRDSbacCoder   = pcEncTop->getRDSbacCoder();
    155174  m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder();
    156  
     175
    157176  // create lambda and QP arrays
    158177  m_pdRdPicLambda     = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
     
    187206  Double dQP;
    188207  Double dLambda;
    189  
     208
    190209  rpcSlice = pcPic->getSlice(0);
    191210  rpcSlice->setSPS( pSPS );
     
    202221  rpcSlice->setPicOutputFlag( true );
    203222  rpcSlice->setPOC( pocCurr );
    204  
     223
    205224  // depth computation based on GOP size
    206225  Int depth;
     
    230249    }
    231250  }
    232  
     251
    233252  // slice type
    234253  SliceType eSliceType;
    235  
     254
    236255  eSliceType=B_SLICE;
    237256  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    238  
     257
    239258  rpcSlice->setSliceType    ( eSliceType );
    240  
     259
    241260  // ------------------------------------------------------------------------------------------------------------------
    242261  // Non-referenced frame marking
    243262  // ------------------------------------------------------------------------------------------------------------------
    244  
     263
    245264  if(pocLast == 0)
    246265  {
     
    252271  }
    253272  rpcSlice->setReferenced(true);
    254  
     273
    255274  // ------------------------------------------------------------------------------------------------------------------
    256275  // QP setting
    257276  // ------------------------------------------------------------------------------------------------------------------
    258  
     277
    259278  dQP = m_pcCfg->getQP();
    260279  if(eSliceType!=I_SLICE)
    261280  {
    262281#if REPN_FORMAT_IN_VPS
    263     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
    264 #else
    265     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless()))) 
     282    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
     283#else
     284    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffsetY() ) && (rpcSlice->getSPS()->getUseLossless())))
    266285#endif
    267286    {
     
    269288    }
    270289  }
    271  
     290
    272291  // modify QP
    273292  Int* pdQPs = m_pcCfg->getdQPs();
     
    285304  // Lambda computation
    286305  // ------------------------------------------------------------------------------------------------------------------
    287  
     306
    288307  Int iQP;
    289308  Double dOrigQP = dQP;
     
    294313    // compute QP value
    295314    dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1);
    296    
     315
    297316    // compute lambda value
    298317    Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
     
    326345#endif
    327346    }
    328    
     347
    329348    // if hadamard is used in ME process
    330349    if ( !m_pcCfg->getUseHADME() && rpcSlice->getSliceType( ) != I_SLICE )
     
    332351      dLambda *= 0.95;
    333352    }
    334    
     353
    335354#if REPN_FORMAT_IN_VPS
    336355    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     
    343362    m_piRdPicQp    [iDQpIdx] = iQP;
    344363  }
    345  
     364
    346365  // obtain dQP = 0 case
    347366  dLambda = m_pdRdPicLambda[0];
    348367  dQP     = m_pdRdPicQp    [0];
    349368  iQP     = m_piRdPicQp    [0];
    350  
     369
    351370  if( rpcSlice->getSliceType( ) != I_SLICE )
    352371  {
     
    359378    Int nCurLayer = rpcSlice->getLayerId();
    360379    Double gamma = xCalEnhLambdaFactor( m_ppcTEncTop[nCurLayer-1]->getQP() - m_ppcTEncTop[nCurLayer]->getQP() ,
    361       1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight() 
     380      1.0 * m_ppcTEncTop[nCurLayer]->getSourceWidth() * m_ppcTEncTop[nCurLayer]->getSourceHeight()
    362381      / m_ppcTEncTop[nCurLayer-1]->getSourceWidth() / m_ppcTEncTop[nCurLayer-1]->getSourceHeight() );
    363382    dLambda *= gamma;
     
    392411#endif
    393412
    394 #if RDOQ_CHROMA_LAMBDA 
     413#if RDOQ_CHROMA_LAMBDA
    395414// for RDOQ
    396   m_pcTrQuant->setLambda( dLambda, dLambda / weight );   
     415  m_pcTrQuant->setLambda( dLambda, dLambda / weight );
    397416#else
    398417  m_pcTrQuant->setLambda( dLambda );
     
    401420#if SAO_CHROMA_LAMBDA
    402421// For SAO
    403   rpcSlice   ->setLambda( dLambda, dLambda / weight ); 
     422  rpcSlice   ->setLambda( dLambda, dLambda / weight );
    404423#else
    405424  rpcSlice   ->setLambda( dLambda );
    406425#endif
    407  
     426
    408427#if HB_LAMBDA_FOR_LDC
    409428  // restore original slice type
    410429  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    411  
     430
    412431#if SVC_EXTENSION
    413432  if(m_pcCfg->getLayerId() > 0)
     
    418437  rpcSlice->setSliceType        ( eSliceType );
    419438#endif
    420  
     439
    421440  if (m_pcCfg->getUseRecalculateQPAccordingToLambda())
    422441  {
    423442    dQP = xGetQPValueAccordingToLambda( dLambda );
    424443#if REPN_FORMAT_IN_VPS
    425     iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
    426 #else
    427     iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );   
     444    iQP = max( -rpcSlice->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
     445#else
     446    iQP = max( -pSPS->getQpBDOffsetY(), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
    428447#endif
    429448  }
     
    438457  rpcSlice->setNumRefIdx(REF_PIC_LIST_0,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    439458  rpcSlice->setNumRefIdx(REF_PIC_LIST_1,m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive);
    440  
     459
    441460  if ( m_pcCfg->getDeblockingFilterMetric() )
    442461  {
     
    479498
    480499  rpcSlice->setDepth            ( depth );
    481  
     500
    482501  pcPic->setTLayer( m_pcCfg->getGOPEntry(iGOPid).m_temporalId );
    483 #if TEMP_SCALABILITY_FIX
    484   if((eSliceType==I_SLICE) || (rpcSlice->getPOC() == 0))
    485 #else
     502
    486503  if(eSliceType==I_SLICE)
    487 #endif
    488504  {
    489505    pcPic->setTLayer(0);
     
    493509  assert( m_apcPicYuvPred );
    494510  assert( m_apcPicYuvResi );
    495  
     511
    496512  pcPic->setPicYuvPred( m_apcPicYuvPred );
    497513  pcPic->setPicYuvResi( m_apcPicYuvResi );
     
    557573#endif
    558574
    559 #if RDOQ_CHROMA_LAMBDA 
     575#if RDOQ_CHROMA_LAMBDA
    560576  // for RDOQ
    561577  m_pcTrQuant->setLambda( lambda, lambda / weight );
     
    665681#endif
    666682
    667 #if RDOQ_CHROMA_LAMBDA 
     683#if RDOQ_CHROMA_LAMBDA
    668684  // for RDOQ
    669   m_pcTrQuant->setLambda( lambda, lambda / weight );   
     685  m_pcTrQuant->setLambda( lambda, lambda / weight );
    670686#else
    671687  m_pcTrQuant->setLambda( lambda );
     
    674690#if SAO_CHROMA_LAMBDA
    675691  // For SAO
    676   pcSlice   ->setLambda( lambda, lambda / weight ); 
     692  pcSlice   ->setLambda( lambda, lambda / weight );
    677693#else
    678694  pcSlice   ->setLambda( lambda );
     
    692708  Int iMaxSR = m_pcCfg->getSearchRange();
    693709  Int iNumPredDir = pcSlice->isInterP() ? 1 : 2;
    694  
     710
    695711  for (Int iDir = 0; iDir <= iNumPredDir; iDir++)
    696712  {
     
    726742  }
    727743#endif
    728  
     744
    729745  TComSlice* pcSlice        = rpcPic->getSlice(getSliceIdx());
    730746  Double     dPicRdCostBest = MAX_DOUBLE;
    731747  UInt       uiQpIdxBest = 0;
    732  
     748
    733749  Double dFrameLambda;
    734750#if FULL_NBIT
     
    737753  Int    SHIFT_QP = 12;
    738754#endif
    739  
     755
    740756  // set frame lambda
    741757  if (m_pcCfg->getGOPSize() > 1)
     
    748764  }
    749765  m_pcRdCost      ->setFrameLambda(dFrameLambda);
    750  
     766
    751767  // for each QP candidate
    752768  for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ )
     
    776792#endif
    777793
    778 #if RDOQ_CHROMA_LAMBDA 
     794#if RDOQ_CHROMA_LAMBDA
    779795    // for RDOQ
    780796    m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
     
    784800#if SAO_CHROMA_LAMBDA
    785801    // For SAO
    786     pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight ); 
     802    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx], m_pdRdPicLambda[uiQpIdx] / weight );
    787803#else
    788804    pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx] );
    789805#endif
    790    
     806
    791807    // try compress
    792808    compressSlice   ( rpcPic );
    793    
     809
    794810    Double dPicRdCost;
    795811    UInt64 uiPicDist        = m_uiPicDist;
    796812    UInt64 uiALFBits        = 0;
    797    
     813
    798814    m_pcGOPEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits );
    799    
     815
    800816    // compute RD cost and choose the best
    801817    dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME);
    802    
     818
    803819    if ( dPicRdCost < dPicRdCostBest )
    804820    {
     
    807823    }
    808824  }
    809  
     825
    810826  // set best values
    811827  pcSlice       ->setSliceQp             ( m_piRdPicQp    [uiQpIdxBest] );
     
    832848#endif
    833849
    834 #if RDOQ_CHROMA_LAMBDA 
    835   // for RDOQ 
    836   m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     850#if RDOQ_CHROMA_LAMBDA
     851  // for RDOQ
     852  m_pcTrQuant   ->setLambda( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    837853#else
    838854  m_pcTrQuant   ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    840856#if SAO_CHROMA_LAMBDA
    841857  // For SAO
    842   pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight ); 
     858  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest], m_pdRdPicLambda[uiQpIdxBest] / weight );
    843859#else
    844860  pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
     
    862878
    863879  UInt uiEncCUOrder;
    864   uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     880  uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    865881  for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU();
    866882       uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU();
     
    898914  TComSlice* pcSlice            = rpcPic->getSlice(getSliceIdx());
    899915  xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false );
    900  
     916
    901917  // initialize cost values
    902918  m_uiPicTotalBits  = 0;
    903919  m_dPicRdCost      = 0;
    904920  m_uiPicDist       = 0;
    905  
     921
    906922  // set entropy coder
    907923  if( m_pcCfg->getUseSBACRD() )
     
    921937    m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
    922938  }
    923  
     939
    924940  //------------------------------------------------------------------------------
    925941  //  Weighted Prediction parameters estimation.
     
    930946    xCalcACDCParamSlice(pcSlice);
    931947  }
     948#if O0194_WEIGHTED_PREDICTION_CGS
     949  else
     950  {
     951    // Calculate for the base layer to be used in EL as Inter layer reference
     952    estimateILWpParam( pcSlice );   
     953  }
     954#endif
    932955
    933956  Bool bWp_explicit = (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred());
     
    10211044        m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] );
    10221045        Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles();
    1023         uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 
     1046        uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
    10241047        uiLin     = uiCUAddr / uiWidthInLCUs;
    10251048        uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(rpcPic->getPicSym()->getCUOrderMap(uiCUAddr))*iNumSubstreamsPerTile
     
    10981121          pcCUTR = rpcPic->getCU( uiCUAddr - uiWidthInCU + 1 );
    10991122        }
    1100         if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1123        if ( ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    11011124             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    11021125             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    11371160      m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice );
    11381161      m_pcEntropyCoder->setBitstream( &pcBitCounters[uiSubStrm] );
    1139      
     1162
    11401163      ((TEncBinCABAC*)m_pcRDGoOnSbacCoder->getEncBinIf())->setBinCountingEnableFlag(true);
    11411164
     
    12421265        m_pcRdCost->setLambda(oldLambda);
    12431266#if RATE_CONTROL_INTRA
    1244         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1267        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    12451268          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    12461269#else
     
    12501273#endif
    12511274#endif
    1252      
     1275
    12531276      // restore entropy coder to an initial stage
    12541277      m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice );
     
    12751298      {
    12761299         ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] );
    1277        
     1300
    12781301         //Store probabilties of second LCU in line into buffer
    12791302         if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro())
     
    13251348
    13261349#if RATE_CONTROL_INTRA
    1327         m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, 
     1350        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
    13281351          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
    13291352#else
     
    13501373      }
    13511374    }
    1352    
     1375
    13531376    m_uiPicTotalBits += pcCU->getTotalBits();
    13541377    m_dPicRdCost     += pcCU->getTotalCost();
     
    14011424    m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice );
    14021425  }
    1403  
     1426
    14041427  m_pcCuEncoder->setBitCounter( NULL );
    14051428  m_pcBitCounter = NULL;
     
    14271450      m_pcBufferSbacCoders[ui].load(m_pcSbacCoder); //init. state
    14281451    }
    1429    
     1452
    14301453    for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++)
    14311454    {
     
    15241547        }
    15251548        if ( (true/*bEnforceSliceRestriction*/ &&
    1526              ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
     1549             ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) ||
    15271550             (pcCUTR->getSCUAddr()+uiMaxParts-1 < pcSlice->getSliceCurStartCUAddr()) ||
    15281551             ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(uiCUAddr)))
     
    15791602    }
    15801603
    1581     TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );   
     1604    TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );
    15821605    if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) )
    15831606    {
     
    16131636        if (allowMergeLeft)
    16141637        {
    1615           m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft); 
     1638          m_pcEntropyCoder->m_pcEntropyCoderIf->codeSaoMerge(mergeLeft);
    16161639        }
    16171640        else
     
    16761699#if ENC_DEC_TRACE
    16771700    g_bJustDoIt = g_bEncDecTraceDisable;
    1678 #endif   
     1701#endif
    16791702    if( m_pcCfg->getUseSBACRD() )
    16801703    {
    16811704       pcSbacCoders[uiSubStrm].load(m_pcSbacCoder);   //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder
    1682        
     1705
    16831706
    16841707       //Store probabilties of second LCU in line into buffer
     
    17331756  UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame();
    17341757  uiBoundingCUAddrSlice     = uiNumberOfCUsInFrame;
    1735   if (bEncodeSlice) 
     1758  if (bEncodeSlice)
    17361759  {
    17371760    UInt uiCUAddrIncrement;
     
    17691792      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    17701793      break;
    1771     } 
     1794    }
    17721795    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    17731796    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18091832      uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18101833      break;
    1811     } 
     1834    }
    18121835    // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row
    18131836    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    18191842
    18201843  Bool tileBoundary = false;
    1821   if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) && 
     1844  if ((m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceMode() == FIXED_NUMBER_OF_BYTES) &&
    18221845      (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    18231846  {
     
    18321855    }
    18331856    tileBoundingCUAddrSlice = lcuEncAddr*rpcPic->getNumPartInCU();
    1834    
     1857
    18351858    if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice)
    18361859    {
     
    18451868  startCUAddrSliceSegment    = pcSlice->getSliceSegmentCurStartCUAddr();
    18461869  boundingCUAddrSliceSegment = uiNumberOfCUsInFrame;
    1847   if (bEncodeSlice) 
     1870  if (bEncodeSlice)
    18481871  {
    18491872    UInt uiCUAddrIncrement;
     
    18801903      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    18811904      break;
    1882     } 
     1905    }
    18831906    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    18841907    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19191942      boundingCUAddrSliceSegment    = uiNumberOfCUsInFrame*rpcPic->getNumPartInCU();
    19201943      break;
    1921     } 
     1944    }
    19221945    // WPP: if a slice segment does not start at the beginning of a CTB row, it must end within the same CTB row
    19231946    if (pcSlice->getPPS()->getNumSubstreams() > 1 && (startCUAddrSliceSegment % (rpcPic->getFrameWidthInCU()*rpcPic->getNumPartInCU()) != 0))
     
    19271950    pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment );
    19281951  }
    1929   if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) && 
     1952  if ((m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_LCU || m_pcCfg->getSliceSegmentMode() == FIXED_NUMBER_OF_BYTES) &&
    19301953    (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0))
    19311954  {
     
    19792002  }
    19802003  UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    1981  
     2004
    19822005  pcSlice->setSliceSegmentCurStartCUAddr(uiRealStartAddress);
    19832006  startCUAddrSliceSegment=uiRealStartAddress;
    1984  
     2007
    19852008  //calculate real slice start address
    19862009  uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(pcSlice->getSliceCurStartCUAddr()) % rpcPic->getNumPartInCU();
     
    20072030  }
    20082031  uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*rpcPic->getNumPartInCU()+uiInternalAddress);
    2009  
     2032
    20102033  pcSlice->setSliceCurStartCUAddr(uiRealStartAddress);
    20112034  uiStartCUAddrSlice=uiRealStartAddress;
    2012  
     2035
    20132036  // Make a joint decision based on reconstruction and dependent slice bounds
    20142037  startCUAddr    = max(uiStartCUAddrSlice   , startCUAddrSliceSegment   );
     
    20222045    if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    20232046      || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2024       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 
     2047      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0)
    20252048      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU)
    2026       || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 
     2049      || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0)
    20272050      || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0)
    20282051      || tileBoundary
     
    20662089}
    20672090#endif
     2091#if O0194_WEIGHTED_PREDICTION_CGS
     2092Void TEncSlice::estimateILWpParam( TComSlice* pcSlice )
     2093{
     2094  xCalcACDCParamSlice(pcSlice);
     2095  wpACDCParam * temp_weightACDCParam;
     2096
     2097  pcSlice->getWpAcDcParam(temp_weightACDCParam);
     2098  g_refWeightACDCParam = (void *) temp_weightACDCParam;
     2099}
     2100#endif
    20682101//! \}
  • trunk/source/Lib/TLibEncoder/TEncSlice.h

    r442 r494  
    111111  virtual ~TEncSlice();
    112112 
     113#if AUXILIARY_PICTURES
     114  Void    create              ( Int iWidth, Int iHeight, ChromaFormat chromaFormat, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth );
     115#else
    113116  Void    create              ( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight, UChar uhTotalDepth );
     117#endif
    114118  Void    destroy             ();
    115119  Void    init                ( TEncTop* pcEncTop );
     
    119123  Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
    120124                                Int iGOPid,   TComSlice*& rpcSlice, TComSPS* pSPS, TComPPS *pPPS, TComVPS *vps, Bool isField );
     125#if O0194_WEIGHTED_PREDICTION_CGS
     126  Void    estimateILWpParam   ( TComSlice* pcSlice );
     127#endif
    121128#else
    122129  Void    initEncSlice        ( TComPic*  pcPic, Int pocLast, Int pocCurr, Int iNumPicRcvd,
  • trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r442 r494  
    8888  m_bMFMEnabledFlag = false;
    8989#endif
    90 #if SCALED_REF_LAYER_OFFSETS
    9190  m_numScaledRefLayerOffsets = 0;
    92 #endif
    93 #endif
    9491#if POC_RESET_FLAG
    9592  m_pocAdjustmentValue     = 0;
    9693#endif
     94#endif //SVC_EXTENSION
    9795}
    9896
     
    117115  m_cGOPEncoder.        create();
    118116#endif
     117#if AUXILIARY_PICTURES
     118  m_cSliceEncoder.      create( getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     119#else
    119120  m_cSliceEncoder.      create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     121#endif
    120122  m_cCuEncoder.         create( g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight );
    121123  if (m_bUseSAO)
     
    175177    }
    176178  }
     179
     180#if LAYER_CTB
     181  memcpy(g_auiLayerZscanToRaster[m_layerId], g_auiZscanToRaster, sizeof( g_auiZscanToRaster ) );
     182  memcpy(g_auiLayerRasterToZscan[m_layerId], g_auiRasterToZscan, sizeof( g_auiRasterToZscan ) );
     183  memcpy(g_auiLayerRasterToPelX[m_layerId],  g_auiRasterToPelX,  sizeof( g_auiRasterToPelX ) );
     184  memcpy(g_auiLayerRasterToPelY[m_layerId],  g_auiRasterToPelY,  sizeof( g_auiRasterToPelY ) );
     185#endif
    177186}
    178187
     
    601610    else
    602611    {
     612#if AUXILIARY_PICTURES
     613      rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     614#else
    603615      rpcPicYuvRec->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     616#endif
    604617    }
    605618    rcListPicYuvRecOut.pushBack( rpcPicYuvRec );
     
    801814#endif
    802815
     816#if AUXILIARY_PICTURES
     817#if SVC_UPSAMPLING
     818      pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
     819                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS);
     820#else
     821      pcEPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
     822                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
     823#endif
     824#else
    803825#if SVC_UPSAMPLING
    804826      pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
     
    807829      pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
    808830                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
     831#endif
    809832#endif
    810833      rpcPic = pcEPic;
     
    842865#endif
    843866
     867#if AUXILIARY_PICTURES
     868#if SVC_UPSAMPLING
     869      rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     870                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics, &m_cSPS);
     871#else
     872      rpcPic->create( m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     873                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
     874#endif
     875#else
    844876#if SVC_UPSAMPLING
    845877      rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     
    849881                      m_conformanceWindow, m_defaultDisplayWindow, m_numReorderPics);
    850882#endif
     883#endif
    851884    }
    852885
     
    871904#if SVC_EXTENSION
    872905  m_cSPS.setLayerId(m_layerId);
    873 #endif
    874906#if REF_IDX_MFM
    875907#if !M0457_COL_PICTURE_SIGNALING
     
    877909#endif
    878910#endif
    879 #if SCALED_REF_LAYER_OFFSETS
    880911  m_cSPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets);
    881912  for(Int i = 0; i < m_cSPS.getNumScaledRefLayerOffsets(); i++)
     
    883914    m_cSPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i];
    884915  }
    885 #endif
     916#endif //SVC_EXTENSION
    886917  ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL();
    887918  profileTierLevel.setLevelIdc(m_level);
     
    914945  m_cSPS.setMaxCUHeight   ( g_uiMaxCUHeight     );
    915946  m_cSPS.setMaxCUDepth    ( g_uiMaxCUDepth      );
     947#if AUXILIARY_PICTURES
     948  m_cSPS.setChromaFormatIdc( m_chromaFormatIDC);
     949#endif
    916950
    917951  Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth );
     
    11881222  for( Int i = 0; i < getGOPSize()+m_extraRPSs; i++)
    11891223  {
    1190 #if FINAL_RPL_CHANGE_N0082
    1191     GOPEntry ge = m_ppcTEncTop[m_cSPS.getLayerId()]->getGOPEntry(i);
    1192 #else
    11931224    GOPEntry ge = getGOPEntry(i);
    1194 #endif
    11951225    rps = rpsList->getReferencePictureSet(i);
    11961226    rps->setNumberOfPictures(ge.m_numRefPics);
     
    15361566#endif
    15371567
    1538 #if SVC_EXTENSION
    15391568#if !REPN_FORMAT_IN_VPS
    15401569Void TEncTop::xInitILRP()
     
    15591588        m_cIlpPic[j] = new  TComPic;
    15601589#if SVC_UPSAMPLING
     1590#if AUXILIARY_PICTURES
     1591        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1592#else
    15611593        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1594#endif
    15621595#else
    15631596        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     
    16111644        m_cIlpPic[j] = new  TComPic;
    16121645#if SVC_UPSAMPLING
     1646#if AUXILIARY_PICTURES
     1647        m_cIlpPic[j]->create(picWidth, picHeight, m_chromaFormatIDC, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1648#else
    16131649        m_cIlpPic[j]->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, &m_cSPS, true);
     1650#endif
    16141651#else
    16151652        m_cIlpPic[j]->create(m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, conformanceWindow, defaultDisplayWindow, numReorderPics, true);
     
    16241661}
    16251662#endif
    1626 Void TEncTop::setILRPic(TComPic *pcPic)
    1627 {
    1628   for( Int i = 0; i < pcPic->getSlice(0)->getActiveNumILRRefIdx(); i++ )
    1629   {
    1630     Int refLayerIdc = pcPic->getSlice(0)->getInterLayerPredLayerIdc(i);
    1631 
    1632     if(m_cIlpPic[refLayerIdc])
    1633     {
    1634       m_cIlpPic[refLayerIdc]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(refLayerIdc), m_cIlpPic[refLayerIdc]->getPicYuvRec());
    1635       m_cIlpPic[refLayerIdc]->getSlice(0)->setPOC(pcPic->getPOC());
    1636       m_cIlpPic[refLayerIdc]->setLayerId(pcPic->getSlice(0)->getBaseColPic(refLayerIdc)->getLayerId()); //set reference layerId
    1637       m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false);
    1638       m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder();
    1639       for (Int j=0; j<m_cIlpPic[refLayerIdc]->getPicSym()->getNumberOfCUsInFrame(); j++)    // set reference CU layerId
    1640       {
    1641         m_cIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId(m_cIlpPic[refLayerIdc]->getLayerId());
    1642       }
    1643     }
    1644   }
    1645 }
    1646 #endif
    1647 #endif
     1663#endif //SVC_EXTENSION
    16481664//! \}
  • trunk/source/Lib/TLibEncoder/TEncTop.h

    r442 r494  
    140140  Int                     m_ilSampleOnlyPred;
    141141#endif
    142 #if SCALED_REF_LAYER_OFFSETS
    143142  UInt                    m_numScaledRefLayerOffsets;
    144143  Window                  m_scaledRefLayerWindow[MAX_LAYERS];
    145 #endif
    146144#if POC_RESET_FLAG
    147145  Int                     m_pocAdjustmentValue;
    148146#endif
    149 #endif
     147#endif //SVC_EXTENSION
    150148protected:
    151149  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
     
    209207  Int                     getNumPicRcvd         () { return m_iNumPicRcvd;            }
    210208  Void                    setNumPicRcvd         ( Int num ) { m_iNumPicRcvd = num;      }
    211 #if SCALED_REF_LAYER_OFFSETS
    212209  Void                    setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; }
    213210  UInt                    getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; }
    214211  Window&  getScaledRefLayerWindow(Int x)            { return m_scaledRefLayerWindow[x]; }
    215 #endif
    216 #endif
     212#endif //SVC_EXTENSION
    217213
    218214  // -------------------------------------------------------------------------------------------------------------------
     
    223219#if SVC_EXTENSION
    224220  TComPic** getIlpList() { return m_cIlpPic; }
    225   Void      setILRPic(TComPic *pcPic);
    226221#if REF_IDX_MFM
    227222  Void      setMFMEnabledFlag       (Bool flag)   {m_bMFMEnabledFlag = flag;}
  • trunk/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r313 r494  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    66 * Copyright (c) 2010-2013, ITU/ISO/IEC
     
    5151  for ( Int iList =0 ; iList<2 ; iList++ )
    5252  {
    53     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
     53    for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
    5454    {
    5555      for ( Int comp=0 ; comp<3 ;comp++ )
     
    7474  TComPicYuv*   pPic = slice->getPic()->getPicYuvOrg();
    7575  Int   iSample  = 0;
     76#if O0194_WEIGHTED_PREDICTION_CGS
     77  // Define here to assign the parameter of "iSample"
     78  wpACDCParam weightACDCParam[3];
     79#endif
    7680
    7781  // calculate DC/AC value for Y
     
    8185  pOrg = pPic->getLumaAddr();
    8286  Int64  iOrgACY  = xCalcACValueSlice(slice, pOrg, iOrgNormDCY);
     87#if O0194_WEIGHTED_PREDICTION_CGS
     88  weightACDCParam[0].iSamples = iSample;
     89#endif
    8390
    8491  // calculate DC/AC value for Cb
     
    8895  pOrg = pPic->getCbAddr();
    8996  Int64  iOrgACCb  = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCb);
     97#if O0194_WEIGHTED_PREDICTION_CGS
     98  weightACDCParam[1].iSamples = iSample;
     99#endif
    90100
    91101  // calculate DC/AC value for Cr
     
    95105  pOrg = pPic->getCrAddr();
    96106  Int64  iOrgACCr  = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCr);
    97 
     107#if O0194_WEIGHTED_PREDICTION_CGS
     108  weightACDCParam[2].iSamples = iSample;
     109#endif
     110
     111#if !O0194_WEIGHTED_PREDICTION_CGS
    98112  wpACDCParam weightACDCParam[3];
     113#endif
    99114  weightACDCParam[0].iAC = iOrgACY;
    100115  weightACDCParam[0].iDC = iOrgNormDCY;
     
    138153  for ( Int iList=0 ; iList<2 ; iList++ )
    139154  {
    140     for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
    141     {
    142       for ( Int iComp=0 ; iComp<3 ;iComp++ ) 
     155    for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
     156    {
     157      for ( Int iComp=0 ; iComp<3 ;iComp++ )
    143158      {
    144159        wpScalingParam  *pwp = &(m_wp[iList][iRefIdx][iComp]);
     
    154169    for ( Int iList=0 ; iList<2 ; iList++ )
    155170    {
    156       for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 
     171      for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
    157172      {
    158         for ( Int iComp=0 ; iComp<3 ;iComp++ ) 
     173        for ( Int iComp=0 ; iComp<3 ;iComp++ )
    159174        {
    160175          wpScalingParam  *pwp = &(m_wp[iList][iRefIdx][iComp]);
     
    195210  // selecting whether WP is used, or not
    196211  xSelectWP(slice, m_wp, iDenom);
    197  
     212
    198213  slice->setWpScaling( m_wp );
    199214
     
    216231      slice->getWpAcDcParam(currWeightACDCParam);
    217232      slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getWpAcDcParam(refWeightACDCParam);
     233#if O0194_WEIGHTED_PREDICTION_CGS
     234      UInt currLayerId = slice->getLayerId();
     235      UInt refLayerId  = slice->getRefPic(eRefPicList, refIdxTemp)->getLayerId();
     236      Bool validILRPic = slice->getRefPic(eRefPicList, refIdxTemp)->isILR( currLayerId ) && refLayerId == 0;
     237
     238      if( validILRPic )
     239      {
     240        refWeightACDCParam = (wpACDCParam *)g_refWeightACDCParam;
     241      }
     242#endif
    218243
    219244      for ( Int comp = 0; comp < 3; comp++ )
     
    229254        Int64 refDC = refWeightACDCParam[comp].iDC;
    230255        Int64 refAC = refWeightACDCParam[comp].iAC;
     256#if O0194_WEIGHTED_PREDICTION_CGS
     257        if( validILRPic )
     258        {
     259          refAC = ( refAC * currWeightACDCParam[comp].iSamples ) /refWeightACDCParam[comp].iSamples;
     260#if O0194_JOINT_US_BITSHIFT
     261          refAC <<= (g_bitDepthYLayer[currLayerId]-g_bitDepthYLayer[refLayerId]);
     262          refDC <<= (g_bitDepthYLayer[currLayerId]-g_bitDepthYLayer[refLayerId]);
     263#endif
     264        }
     265#endif
    231266
    232267        // calculating iWeight and iOffset params
     
    234269        Int weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) );
    235270        Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom );
     271#if O0194_WEIGHTED_PREDICTION_CGS
     272        if( !validILRPic )
     273        {
     274          dWeight = 1;
     275          offset  = 0;
     276        }
     277        weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) );
     278#endif
    236279
    237280        // Chroma offset range limitation
     
    253296        if(deltaWeight > 127 || deltaWeight < -128)
    254297          return (false);
     298#if O0194_WEIGHTED_PREDICTION_CGS
     299        // make sure the reference frames other than ILR are not using weighted prediction
     300        else
     301        if( !validILRPic )
     302        {
     303          continue;
     304        }
     305#endif
    255306
    256307        m_wp[refList][refIdxTemp][comp].bPresentFlag = true;
     
    264315}
    265316
    266 /** select whether weighted pred enables or not. 
     317/** select whether weighted pred enables or not.
    267318 * \param TComSlice *slice
    268319 * \param wpScalingParam
     
    325376}
    326377
    327 /** calculate DC value of original image for luma. 
     378/** calculate DC value of original image for luma.
    328379 * \param TComSlice *slice
    329380 * \param Pel *pPel
     
    345396}
    346397
    347 /** calculate AC value of original image for luma. 
     398/** calculate AC value of original image for luma.
    348399 * \param TComSlice *slice
    349400 * \param Pel *pPel
     
    363414}
    364415
    365 /** calculate DC value of original image for chroma. 
     416/** calculate DC value of original image for chroma.
    366417 * \param TComSlice *slice
    367418 * \param Pel *pPel
     
    383434}
    384435
    385 /** calculate AC value of original image for chroma. 
     436/** calculate AC value of original image for chroma.
    386437 * \param TComSlice *slice
    387438 * \param Pel *pPel
     
    401452}
    402453
    403 /** calculate DC value. 
     454/** calculate DC value.
    404455 * \param Pel *pPel
    405456 * \param Int iWidth
     
    423474}
    424475
    425 /** calculate AC value. 
     476/** calculate AC value.
    426477 * \param Pel *pPel
    427478 * \param Int iWidth
     
    446497}
    447498
    448 /** calculate SAD values for both WP version and non-WP version. 
     499/** calculate SAD values for both WP version and non-WP version.
    449500 * \param Pel *pOrgPel
    450501 * \param Pel *pRefPel
  • trunk/source/Lib/TLibVideoIO/TVideoIOYuv.cpp

    r442 r494  
    473473  {
    474474    dstPicYuv = new TComPicYuv;
     475#if AUXILIARY_PICTURES
     476    dstPicYuv->create( pPicYuv->getWidth(), pPicYuv->getHeight(), pPicYuv->getChromaFormat(), 1, 1, 0 );
     477#else
    475478    dstPicYuv->create( pPicYuv->getWidth(), pPicYuv->getHeight(), 1, 1, 0 );
     479#endif
    476480    pPicYuv->copyToPic(dstPicYuv);
    477481
     
    567571  {
    568572    dstPicTop = new TComPicYuv;
     573#if AUXILIARY_PICTURES
     574    dstPicTop->create( pPicTop->getWidth(), pPicTop->getHeight(), pPicTop->getChromaFormat(), 1, 1, 0 );
     575#else
    569576    dstPicTop->create( pPicTop->getWidth(), pPicTop->getHeight(), 1, 1, 0 );
     577#endif
    570578    pPicTop->copyToPic(dstPicTop);
    571579   
    572580    dstPicBottom = new TComPicYuv;
     581#if AUXILIARY_PICTURES
     582    dstPicBottom->create( pPicBottom->getWidth(), pPicBottom->getHeight(), pPicBottom->getChromaFormat(), 1, 1, 0 );
     583#else
    573584    dstPicBottom->create( pPicBottom->getWidth(), pPicBottom->getHeight(), 1, 1, 0 );
     585#endif
    574586    pPicBottom->copyToPic(dstPicBottom);
    575587   
Note: See TracChangeset for help on using the changeset viewer.