Changeset 906 in SHVCSoftware
- Timestamp:
- 15 Oct 2014, 07:25:10 (10 years ago)
- Location:
- trunk
- Files:
-
- 86 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-dev (added) merged: 817-905
- Property svn:mergeinfo changed
-
trunk/cfg
- Property svn:mergeinfo changed
/branches/SHM-dev/cfg (added) merged: 849,861,874,876
- Property svn:mergeinfo changed
-
trunk/cfg/encoder_intra_he10.cfg
r588 r906 84 84 85 85 #============ WaveFront ================ 86 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).86 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 87 87 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 88 88 -
trunk/cfg/encoder_intra_main.cfg
r595 r906 88 88 89 89 #============ WaveFront ================ 90 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).90 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 91 91 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 92 92 -
trunk/cfg/encoder_intra_main10.cfg
r595 r906 88 88 89 89 #============ WaveFront ================ 90 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).90 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 91 91 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 92 92 -
trunk/cfg/encoder_lowdelay_P_he10.cfg
r588 r906 89 89 90 90 #============ WaveFront ================ 91 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).91 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 92 92 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 93 93 -
trunk/cfg/encoder_lowdelay_P_main.cfg
r595 r906 93 93 94 94 #============ WaveFront ================ 95 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).95 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 96 96 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 97 97 -
trunk/cfg/encoder_lowdelay_P_main10.cfg
r595 r906 93 93 94 94 #============ WaveFront ================ 95 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).95 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 96 96 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 97 97 -
trunk/cfg/encoder_lowdelay_he10.cfg
r595 r906 89 89 90 90 #============ WaveFront ================ 91 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).91 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 92 92 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 93 93 -
trunk/cfg/encoder_lowdelay_main.cfg
r595 r906 93 93 94 94 #============ WaveFront ================ 95 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).95 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 96 96 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 97 97 -
trunk/cfg/encoder_lowdelay_main10.cfg
r595 r906 93 93 94 94 #============ WaveFront ================ 95 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).95 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 96 96 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 97 97 -
trunk/cfg/encoder_randomaccess_he10.cfg
r588 r906 94 94 95 95 #============ WaveFront ================ 96 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).96 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 97 97 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 98 98 -
trunk/cfg/encoder_randomaccess_main.cfg
r595 r906 97 97 98 98 #============ WaveFront ================ 99 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).99 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 100 100 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 101 101 -
trunk/cfg/encoder_randomaccess_main10.cfg
r595 r906 97 97 98 98 #============ WaveFront ================ 99 WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case).99 #WaveFrontSynchro : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 100 100 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 101 101 -
trunk/cfg/layers.cfg
r815 r906 1 1 NumLayers : 2 2 AvcBase: 02 NonHEVCBase : 0 3 3 ScalabilityMask1 : 0 # Multiview 4 4 ScalabilityMask2 : 1 # Scalable … … 23 23 RCForceIntraQP0 : 0 # Rate control: force intra QP to be equal to initial QP for layer 0 24 24 25 #============ WaveFront ================ 26 WaveFrontSynchro0 : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 27 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 25 28 26 29 #============= LAYER 1 ================== … … 42 45 RCForceIntraQP1 : 0 # Rate control: force intra QP to be equal to initial QP for layer 1 43 46 47 #============ WaveFront ================ 48 WaveFrontSynchro1 : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 49 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 44 50 45 NumLayerSets : 146 NumLayerInIdList 0 : 247 LayerSetLayerIdList 0: 0 151 NumLayerSets : 2 # Include default layer set, value of 0 not allowed 52 NumLayerInIdList1 : 2 # 0-th layer set is default, need not specify LayerSetLayerIdList0 or NumLayerInIdList0 53 LayerSetLayerIdList1 : 0 1 48 54 49 55 NumAddLayerSets : 0 56 NumOutputLayerSets : 2 # Include defualt OLS, value of 0 not allowed 57 DefaultTargetOutputLayerIdc : 1 58 NumLayersInOutputLayerSet : 1 # The number of layers in the 0-th OLS should not be specified, 59 # ListOfOutputLayers0 need not be specified 60 ListOfOutputLayers1 : 1 -
trunk/cfg/layers_avcbase.cfg
r713 r906 1 1 NumLayers : 2 2 AvcBase: 12 NonHEVCBase : 1 3 3 ScalabilityMask1 : 0 # Multiview 4 4 ScalabilityMask2 : 1 # Scalable … … 20 20 RCForceIntraQP0 : 0 # Rate control: force intra QP to be equal to initial QP for layer 0 21 21 22 #============ WaveFront ================ 23 WaveFrontSynchro0 : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 24 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 22 25 23 26 #============= LAYER 1 ================== … … 38 41 InitialQP1 : 0 # Rate control: initial QP for layer 1 39 42 RCForceIntraQP1 : 0 # Rate control: force intra QP to be equal to initial QP for layer 1 43 44 WaveFrontSynchro1 : 0 # 0: No WaveFront synchronisation (WaveFrontSubstreams must be 1 in this case). 45 # >0: WaveFront synchronises with the LCU above and to the right by this many LCUs. 46 47 NumLayerSets : 2 # Include default layer set, value of 0 not allowed 48 NumLayerInIdList1 : 2 # 0-th layer set is default, need not specify LayerSetLayerIdList0 or NumLayerInIdList0 49 LayerSetLayerIdList1 : 0 1 50 51 NumAddLayerSets : 0 52 NumOutputLayerSets : 2 # Include defualt OLS, value of 0 not allowed 53 DefaultTargetOutputLayerIdc : 1 54 NumLayersInOutputLayerSet : 1 # The number of layers in the 0-th OLS should not be specified, 55 # ListOfOutputLayers0 need not be specified 56 ListOfOutputLayers1 : 1 -
trunk/cfg/per-sequence-svc-avcbase/BQTerrace-2x.cfg
r752 r906 22 22 IntraPeriod1 : 64 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 31 -
trunk/cfg/per-sequence-svc-avcbase/BQTerrace-SNR.cfg
r595 r906 22 22 IntraPeriod1 : 64 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 4 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 -
trunk/cfg/per-sequence-svc-avcbase/BasketballDrive-2x.cfg
r752 r906 22 22 IntraPeriod1 : 48 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 31 -
trunk/cfg/per-sequence-svc-avcbase/BasketballDrive-SNR.cfg
r595 r906 22 22 IntraPeriod1 : 48 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 4 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 -
trunk/cfg/per-sequence-svc-avcbase/Cactus-2x.cfg
r752 r906 22 22 IntraPeriod1 : 48 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 31 -
trunk/cfg/per-sequence-svc-avcbase/Cactus-SNR.cfg
r595 r906 22 22 IntraPeriod1 : 48 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 4 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 -
trunk/cfg/per-sequence-svc-avcbase/Kimono-2x.cfg
r752 r906 22 22 IntraPeriod1 : 24 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 -
trunk/cfg/per-sequence-svc-avcbase/Kimono-SNR.cfg
r595 r906 22 22 IntraPeriod1 : 24 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 4 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 -
trunk/cfg/per-sequence-svc-avcbase/ParkScene-2x.cfg
r752 r906 22 22 IntraPeriod1 : 24 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 -
trunk/cfg/per-sequence-svc-avcbase/ParkScene-SNR.cfg
r595 r906 22 22 IntraPeriod1 : 24 # Period of I-Frame ( -1 = only first) 23 23 ConformanceMode1 : 1 # conformance mode 24 NumScaledRefLayerOffsets1 : 1 # Number of scaled entry offsets for this layer 25 ScaledRefLayerId1 : 0 # Scaled reference layer ID 26 ScaledRefLayerBottomOffset1 : -4 # offset for spatial alignment of the base and enhancement layers 24 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 25 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 26 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 27 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 28 RefRegionBottomOffset1 : 4 # List of ref region bottom offsets 29 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags 27 30 QP1 : 20 -
trunk/cfg/per-sequence-svc/BQTerrace-2x.cfg
r713 r906 24 24 ConformanceMode1 : 1 # conformance mode 25 25 QP1 : 20 26 27 #============= Reference location offset parameters ================== 28 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 29 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 30 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 31 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 32 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 33 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags -
trunk/cfg/per-sequence-svc/BasketballDrive-2x.cfg
r713 r906 24 24 ConformanceMode1 : 1 # conformance mode 25 25 QP1 : 20 26 27 #============= Reference location offset parameters ================== 28 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 29 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 30 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 31 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 32 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 33 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags -
trunk/cfg/per-sequence-svc/Cactus-2x.cfg
r713 r906 24 24 ConformanceMode1 : 1 # conformance mode 25 25 QP1 : 20 26 27 #============= Reference location offset parameters ================== 28 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 29 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 30 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 31 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 32 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 33 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags -
trunk/cfg/per-sequence-svc/Kimono-2x.cfg
r713 r906 24 24 ConformanceMode1 : 1 # conformance mode 25 25 QP1 : 20 26 27 #============= Reference location offset parameters ================== 28 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 29 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 30 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 31 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 32 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 33 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags -
trunk/cfg/per-sequence-svc/ParkScene-2x.cfg
r713 r906 24 24 ConformanceMode1 : 1 # conformance mode 25 25 QP1 : 20 26 27 #============= Reference location offset parameters ================== 28 NumScaledRefLayerOffsets1 : 1 # Number of reference location offset parameters 29 ScaledRefLayerId1 : 0 # List of ref layer id (i-th entry for i-th ref loc offset parameters) 30 ScaledRefLayerOffsetPresentFlag1 : 0 # List of scaled ref layer offset present flags 31 RefRegionOffsetPresentFlag1 : 1 # List of ref region offset present flags 32 RefRegionBottomOffset1 : 2 # List of ref region bottom offsets 33 ResamplePhaseSetPresentFlag1 : 0 # List of resample phase set present flags -
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-dev/source (added) merged: 818-875,877-905
- Property svn:mergeinfo changed
-
trunk/source/App/TAppDecoder/TAppDecCfg.cpp
r815 r906 78 78 string cfg_ReconFile; 79 79 #endif 80 #if AVC_SYNTAX || SYNTAX_OUTPUT 81 string cfg_BLSyntaxFile; 82 #endif 80 83 81 string cfg_TargetDecLayerIdSetFile; 84 82 … … 96 94 ("BLSourceHeight,-hgt", m_iBLSourceHeight, 0, "BL source picture height") 97 95 #endif 98 #if AVC_SYNTAX99 ("BLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "BL syntax input file name")100 #endif101 96 #endif 102 97 #else 103 98 ("ReconFile,o", cfg_ReconFile, string(""), "reconstructed YUV output file name\n" 104 99 "YUV writing is skipped if omitted") 105 #endif106 #if SYNTAX_OUTPUT107 ("BLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "BL syntax input file name")108 ("BLSourceWidth,-wdt", m_iBLSourceWidth, 0, "BL source picture width")109 ("BLSourceHeight,-hgt", m_iBLSourceHeight, 0, "BL source picture height")110 ("BLFrames,-fr", m_iBLFrames, 0, "BL number of frames")111 100 #endif 112 101 ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access") … … 126 115 ("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.") 127 116 ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n") 117 #if Q0074_COLOUR_REMAPPING_SEI 118 ("SEIColourRemappingInfo", m_colourRemapSEIEnabled, false, "Control handling of Colour Remapping Information SEI messages\n" 119 "\t1: apply colour remapping on decoded pictures if available in the bitstream\n" 120 "\t0: ignore SEI message") 121 #endif 128 122 ; 129 123 po::setDefaults(opts); … … 163 157 #else 164 158 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 165 #endif166 #if AVC_SYNTAX || SYNTAX_OUTPUT167 m_pchBLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());168 159 #endif 169 160 -
trunk/source/App/TAppDecoder/TAppDecCfg.h
r713 r906 69 69 Int m_iMaxTemporalLayer; ///< maximum temporal layer to be decoded 70 70 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 71 #if Q0074_COLOUR_REMAPPING_SEI 72 Bool m_colourRemapSEIEnabled; ///< Enable the Colour Remapping Information SEI message if available (remapping decoded pictures) 73 #endif 71 74 72 75 #if SVC_EXTENSION … … 78 81 Int m_iBLSourceHeight; 79 82 #endif 80 #if AVC_SYNTAX81 Char* m_pchBLSyntaxFile; ///< input BL syntax file name82 83 #endif 83 #endif84 #endif85 86 #if SYNTAX_OUTPUT87 Char* m_pchBLSyntaxFile; ///< input BL syntax file name88 #if !REPN_FORMAT_IN_VPS89 Int m_iBLSourceWidth;90 Int m_iBLSourceHeight;91 #endif92 Int m_iBLFrames;93 84 #endif 94 85 … … 110 101 , m_iMaxTemporalLayer(-1) 111 102 , m_decodedPictureHashSEIEnabled(0) 103 #if Q0074_COLOUR_REMAPPING_SEI 104 , m_colourRemapSEIEnabled(0) 105 #endif 112 106 #if SVC_EXTENSION 113 107 , m_tgtLayerId(0) … … 115 109 , m_iBLSourceWidth(0) 116 110 , m_iBLSourceHeight(0) 117 #endif118 #if SYNTAX_OUTPUT119 , m_iBLSourceWidth(0)120 , m_iBLSourceHeight(0)121 , m_iBLFrames(0)122 111 #endif 123 112 #endif -
trunk/source/App/TAppDecoder/TAppDecTop.cpp
r815 r906 102 102 } 103 103 #endif 104 #if AVC_SYNTAX || SYNTAX_OUTPUT105 if( m_pchBLSyntaxFile )106 {107 free ( m_pchBLSyntaxFile );108 m_pchBLSyntaxFile = NULL;109 }110 #endif111 104 } 112 105 … … 163 156 } 164 157 TComList<TComPic*> *cListPic = m_acTDecTop[0].getListPic(); 165 #if AVC_SYNTAX || !REPN_FORMAT_IN_VPS166 m_acTDecTop[0].setBLsize( m_iBLSourceWidth, m_iBLSourceHeight );167 #endif168 158 m_acTDecTop[0].setBLReconFile( &streamYUV ); 169 159 pcBLPic.setLayerId( 0 ); 170 160 cListPic->pushBack( &pcBLPic ); 171 #if AVC_SYNTAX172 fstream streamSyntaxFile;173 if( m_pchBLSyntaxFile )174 {175 streamSyntaxFile.open( m_pchBLSyntaxFile, fstream::in | fstream::binary );176 }177 m_acTDecTop[0].setBLSyntaxFile( &streamSyntaxFile );178 #endif179 161 #endif 180 162 … … 363 345 streamYUV.close(); 364 346 } 365 #if AVC_SYNTAX366 if( streamSyntaxFile.is_open() )367 {368 streamSyntaxFile.close();369 }370 #endif371 347 pcBLPic.destroy(); 372 348 … … 405 381 Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen) 406 382 Bool loopFiltered = false; 407 408 #if SYNTAX_OUTPUT409 if( !m_pchBLSyntaxFile )410 {411 printf( "Wrong base layer syntax file\n" );412 exit(EXIT_FAILURE);413 }414 fstream streamSyntaxFile( m_pchBLSyntaxFile, fstream::out | fstream::binary );415 if( !streamSyntaxFile.good() )416 {417 printf( "Base layer syntax input reading error\n" );418 exit(EXIT_FAILURE);419 }420 m_cTDecTop.setBLSyntaxFile( &streamSyntaxFile );421 422 for( Int i = m_iBLFrames * m_iBLSourceWidth * m_iBLSourceHeight * SYNTAX_BYTES / 16; i >= 0; i-- )423 {424 streamSyntaxFile.put( 0 );425 }426 streamSyntaxFile.seekp( 0 );427 #endif428 383 429 384 while (!!bitstreamFile) … … 543 498 } 544 499 545 #if SYNTAX_OUTPUT546 if( streamSyntaxFile.is_open() )547 {548 streamSyntaxFile.close();549 }550 #endif551 552 500 xFlushOutput( pcListPic ); 553 501 // delete buffers … … 620 568 m_acTDecTop[layer].init(); 621 569 m_acTDecTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 570 #if Q0074_COLOUR_REMAPPING_SEI 571 m_acTDecTop[layer].setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled); 572 #endif 622 573 m_acTDecTop[layer].setNumLayer( m_tgtLayerId + 1 ); 623 574 #if OUTPUT_LAYER_SET_INDEX … … 625 576 #endif 626 577 } 627 628 578 #else 629 579 m_cTDecTop.init(); 630 580 m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled); 581 #if Q0074_COLOUR_REMAPPING_SEI 582 m_cTDecTop.setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled); 583 #endif 631 584 #endif 632 585 } … … 727 680 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 728 681 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 729 #if Q0074_SEI_COLOR_MAPPING730 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )731 {732 pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );733 pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );734 }735 #endif736 682 #if REPN_FORMAT_IN_VPS 737 683 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); … … 762 708 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 763 709 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 764 #if Q0074_SEI_COLOR_MAPPING765 if ( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )766 {767 pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );768 pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );769 }770 #endif771 710 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 772 711 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), … … 843 782 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 844 783 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 845 #if Q0074_SEI_COLOR_MAPPING846 if ( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )847 {848 pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );849 }850 #endif851 852 784 #if REPN_FORMAT_IN_VPS 853 785 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); … … 873 805 if ( m_pchReconFile ) 874 806 { 875 #if SYNTAX_OUTPUT876 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();877 #if Q0074_SEI_COLOR_MAPPING878 if( m_acTDecTop[layerIdx].m_ColorMapping->getColorMappingFlag() )879 {880 pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );881 }882 #endif883 807 const Window &conf = pcPic->getConformanceWindow(); 884 808 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 885 m_cTVideoIOYuvReconFile.write( pPicCYuvRec, 886 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 887 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 888 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 889 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 890 #endif 809 m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), 810 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), 811 conf.getWindowRightOffset() + defDisp.getWindowRightOffset(), 812 conf.getWindowTopOffset() + defDisp.getWindowTopOffset(), 813 conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() ); 891 814 } 892 815 … … 959 882 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 960 883 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 961 #if Q0074_SEI_COLOR_MAPPING962 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )963 {964 pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );965 pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );966 }967 #endif968 884 #if REPN_FORMAT_IN_VPS 969 885 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); … … 994 910 TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec(); 995 911 TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec(); 996 #if Q0074_SEI_COLOR_MAPPING997 if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )998 {999 pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );1000 pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );1001 }1002 #endif1003 912 m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot, 1004 913 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), … … 1078 987 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1079 988 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 1080 #if Q0074_SEI_COLOR_MAPPING1081 if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )1082 {1083 pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );1084 }1085 #endif1086 989 #if REPN_FORMAT_IN_VPS 1087 990 UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc(); … … 1110 1013 const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window(); 1111 1014 TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec(); 1112 #if Q0074_SEI_COLOR_MAPPING1113 if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )1114 {1115 pPicCYuvRec = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRec );1116 }1117 #endif1118 1015 m_cTVideoIOYuvReconFile.write( pPicCYuvRec, 1119 1016 conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(), … … 1198 1095 #endif 1199 1096 TComPicYuv* pPicCYuvRec = pic->getPicYuvRec(); 1200 #if Q0074_SEI_COLOR_MAPPING1201 pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );1202 #endif1203 1097 m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec, 1204 1098 conf.getWindowLeftOffset() * xScal + defDisp.getWindowLeftOffset(), … … 1221 1115 pic->getPicYuvRec()->setBorderExtension( false ); 1222 1116 1117 #if RESOLUTION_BASED_DPB 1223 1118 dpbStatus.m_numPicsInLayer[layerIdx]--; 1119 #endif 1120 dpbStatus.m_numPicsInSubDpb[layerIdx]--; 1224 1121 } 1225 1122 } … … 1285 1182 for(Int i = 0; i < MAX_LAYERS; i++) 1286 1183 { 1287 m _acTDecTop[i].getListPic()->clear();1184 markAllPicturesAsErased(i); 1288 1185 } 1289 1186 } … … 1291 1188 Void TAppDecTop::markAllPicturesAsErased(Int layerIdx) 1292 1189 { 1190 TComList<TComPic*>::iterator iterPic = m_acTDecTop[layerIdx].getListPic()->begin(); 1191 Int iSize = Int( m_acTDecTop[layerIdx].getListPic()->size() ); 1192 1193 for (Int i = 0; i < iSize; i++ ) 1194 { 1195 TComPic* pcPic = *(iterPic++); 1196 1197 if( pcPic ) 1198 { 1199 pcPic->destroy(); 1200 1201 // pcPic is statically created for the external (AVC) base layer, no need to delete it 1202 #if VPS_AVC_BL_FLAG_REMOVAL 1203 if( !m_acTDecTop[layerIdx].getParameterSetManager()->getActiveVPS()->getNonHEVCBaseLayerFlag() || layerIdx ) 1204 #else 1205 if( !m_acTDecTop[layerIdx].getParameterSetManager()->getActiveVPS()->getAvcBaseLayerFlag() || layerIdx ) 1206 #endif 1207 { 1208 delete pcPic; 1209 pcPic = NULL; 1210 } 1211 } 1212 } 1213 1293 1214 m_acTDecTop[layerIdx].getListPic()->clear(); 1294 1215 } … … 1434 1355 maxDpbLimit.m_maxLatencyPictures = sps->getMaxLatencyIncrease( highestTId ) + sps->getNumReorderPics( highestTId ) - 1; 1435 1356 } 1357 #if RESOLUTION_BASED_DPB 1436 1358 maxDpbLimit.m_numPicsInLayer[0] = sps->getMaxDecPicBuffering( highestTId ); 1359 #endif 1437 1360 maxDpbLimit.m_numPicsInSubDpb[0] = sps->getMaxDecPicBuffering( highestTId ); 1438 1361 } … … 1582 1505 if( pic->getSlice(0)->isReferenced() || pic->getOutputMark() ) 1583 1506 { 1507 #if RESOLUTION_BASED_DPB 1584 1508 dpbStatus.m_numPicsInLayer[i]++; // Count pictures that are "used for reference" or "needed for output" 1509 #else 1510 dpbStatus.m_numPicsInSubDpb[i]++; // Count pictures that are "used for reference" or "needed for output" 1511 #endif 1585 1512 } 1586 1513 #if POC_RESET_IDC_DECODER … … 1607 1534 #if RESOLUTION_BASED_DPB 1608 1535 dpbStatus.m_numPicsInSubDpb[vps->getSubDpbAssigned(targetLsIdx,i)] += dpbStatus.m_numPicsInLayer[i]; 1609 #else1610 1536 dpbStatus.m_numPicsInSubDpb[i] += dpbStatus.m_numPicsInLayer[i]; 1611 1537 #endif -
trunk/source/App/TAppDecoder/TAppDecTop.h
r815 r906 135 135 Int m_numAUsNotDisplayed; 136 136 Int m_numPicsNotDisplayedInLayer[MAX_LAYERS]; 137 #if RESOLUTION_BASED_DPB 137 138 Int m_numPicsInLayer[MAX_LAYERS]; // Pictures marked as used_for_reference or needed for output in the layer 139 #endif 138 140 Int m_numPicsInSubDpb[MAX_LAYERS]; // Pictures marked as used_for_reference or needed for output in the sub-DPB 139 141 Bool m_maxLatencyIncrease; … … 152 154 m_maxLatencyIncrease = false; 153 155 m_maxLatencyPictures = 0; 156 #if RESOLUTION_BASED_DPB 154 157 ::memset( m_numPicsInLayer, 0, sizeof(m_numPicsInLayer) ); 158 #endif 155 159 ::memset( m_numPicsInSubDpb, 0, sizeof(m_numPicsInSubDpb) ); 156 160 ::memset(m_numPicsNotDisplayedInLayer, 0, sizeof(m_numPicsNotDisplayedInLayer) ); -
trunk/source/App/TAppEncoder/TAppEncCfg.cpp
r815 r906 67 67 : m_pBitstreamFile() 68 68 #if AVC_BASE 69 #if VPS_AVC_BL_FLAG_REMOVAL 70 , m_nonHEVCBaseLayerFlag(0) 71 #else 69 72 , m_avcBaseLayerFlag(0) 70 73 #endif 74 #endif 71 75 , m_maxTidRefPresentFlag(1) 72 , m_pColumnWidth() 73 , m_pRowHeight() 76 #if OUTPUT_LAYER_SETS_CONFIG 77 , m_defaultTargetOutputLayerIdc (-1) 78 , m_numOutputLayerSets (-1) 79 #endif 74 80 , m_scalingListFile() 75 81 , m_elRapSliceBEnabled(0) … … 87 93 , m_pchReconFile() 88 94 , m_pchdQPFile() 89 , m_pColumnWidth()90 , m_pRowHeight()91 95 , m_scalingListFile() 92 96 { … … 95 99 m_codedPivotValue = NULL; 96 100 m_targetPivotValue = NULL; 101 #if Q0074_COLOUR_REMAPPING_SEI 102 for( Int c=0 ; c<3 ; c++) 103 { 104 m_colourRemapSEIPreLutCodedValue[c] = NULL; 105 m_colourRemapSEIPreLutTargetValue[c] = NULL; 106 m_colourRemapSEIPostLutCodedValue[c] = NULL; 107 m_colourRemapSEIPostLutTargetValue[c] = NULL; 108 } 109 #endif 97 110 } 98 111 #endif … … 101 114 { 102 115 #if SVC_EXTENSION 103 free(m_pBitstreamFile); 116 if( m_pBitstreamFile ) 117 { 118 free(m_pBitstreamFile); 119 m_pBitstreamFile = NULL; 120 } 104 121 #else 105 122 if ( m_aidQP ) … … 128 145 free(m_pchReconFile); 129 146 free(m_pchdQPFile); 130 #endif 131 free(m_pColumnWidth); 132 free(m_pRowHeight); 147 #if Q0074_COLOUR_REMAPPING_SEI 148 for( Int c=0 ; c<3 ; c++) 149 { 150 if ( m_colourRemapSEIPreLutCodedValue[c] ) 151 { 152 delete[] m_colourRemapSEIPreLutCodedValue[c]; 153 } 154 if ( m_colourRemapSEIPreLutTargetValue[c] ) 155 { 156 delete[] m_colourRemapSEIPreLutTargetValue[c]; 157 } 158 if ( m_colourRemapSEIPostLutCodedValue[c] ) 159 { 160 delete[] m_colourRemapSEIPostLutCodedValue[c]; 161 } 162 if ( m_colourRemapSEIPostLutTargetValue[c] ) 163 { 164 delete[] m_colourRemapSEIPostLutTargetValue[c]; 165 } 166 } 167 #endif 168 #endif 133 169 free(m_scalingListFile); 134 170 } … … 337 373 string* cfg_ReconFile [MAX_LAYERS]; 338 374 Double* cfg_fQP [MAX_LAYERS]; 339 #if Q0074_SEI_COLOR_MAPPING340 string* cfg_seiColorMappingFile[MAX_LAYERS];341 #endif342 343 375 #if REPN_FORMAT_IN_VPS 344 376 Int* cfg_repFormatIdx [MAX_LAYERS]; … … 386 418 string cfg_scaledRefLayerBottomOffset [MAX_LAYERS]; 387 419 Int* cfg_numScaledRefLayerOffsets[MAX_LAYERS]; 420 #if REF_REGION_OFFSET 421 string cfg_scaledRefLayerOffsetPresentFlag [MAX_LAYERS]; 422 string cfg_refRegionOffsetPresentFlag [MAX_LAYERS]; 423 string cfg_refRegionLeftOffset [MAX_LAYERS]; 424 string cfg_refRegionTopOffset [MAX_LAYERS]; 425 string cfg_refRegionRightOffset [MAX_LAYERS]; 426 string cfg_refRegionBottomOffset [MAX_LAYERS]; 427 #endif 428 #if R0209_GENERIC_PHASE 429 string cfg_resamplePhaseSetPresentFlag [MAX_LAYERS]; 430 string cfg_phaseHorLuma [MAX_LAYERS]; 431 string cfg_phaseVerLuma [MAX_LAYERS]; 432 string cfg_phaseHorChroma [MAX_LAYERS]; 433 string cfg_phaseVerChroma [MAX_LAYERS]; 434 #else 388 435 #if P0312_VERT_PHASE_ADJ 389 436 string cfg_vertPhasePositionEnableFlag[MAX_LAYERS]; 437 #endif 390 438 #endif 391 439 … … 397 445 string* cfg_scaledRefLayerRightOffsetPtr [MAX_LAYERS]; 398 446 string* cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS]; 447 #if REF_REGION_OFFSET 448 string* cfg_scaledRefLayerOffsetPresentFlagPtr [MAX_LAYERS]; 449 string* cfg_refRegionOffsetPresentFlagPtr [MAX_LAYERS]; 450 string* cfg_refRegionLeftOffsetPtr [MAX_LAYERS]; 451 string* cfg_refRegionTopOffsetPtr [MAX_LAYERS]; 452 string* cfg_refRegionRightOffsetPtr [MAX_LAYERS]; 453 string* cfg_refRegionBottomOffsetPtr [MAX_LAYERS]; 454 #endif 455 #if R0209_GENERIC_PHASE 456 string* cfg_resamplePhaseSetPresentFlagPtr [MAX_LAYERS]; 457 string* cfg_phaseHorLumaPtr [MAX_LAYERS]; 458 string* cfg_phaseVerLumaPtr [MAX_LAYERS]; 459 string* cfg_phaseHorChromaPtr [MAX_LAYERS]; 460 string* cfg_phaseVerChromaPtr [MAX_LAYERS]; 461 #endif 399 462 #if P0312_VERT_PHASE_ADJ 400 463 string* cfg_vertPhasePositionEnableFlagPtr[MAX_LAYERS]; … … 419 482 #endif 420 483 Int* cfg_maxTidIlRefPicsPlus1[MAX_LAYERS]; 484 #if Q0074_COLOUR_REMAPPING_SEI 485 string* cfg_colourRemapSEIFile[MAX_LAYERS]; 486 #endif 487 Int* cfg_waveFrontSynchro[MAX_LAYERS]; 488 421 489 for(UInt layer = 0; layer < MAX_LAYERS; layer++) 422 490 { … … 424 492 cfg_ReconFile[layer] = &m_acLayerCfg[layer].m_cReconFile; 425 493 cfg_fQP[layer] = &m_acLayerCfg[layer].m_fQP; 494 #if Q0074_COLOUR_REMAPPING_SEI 495 cfg_colourRemapSEIFile[layer] = &m_acLayerCfg[layer].m_colourRemapSEIFile; 496 #endif 426 497 #if REPN_FORMAT_IN_VPS 427 498 cfg_repFormatIdx[layer] = &m_acLayerCfg[layer].m_repFormatIdx; … … 432 503 cfg_IntraPeriod[layer] = &m_acLayerCfg[layer].m_iIntraPeriod; 433 504 cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode; 434 #if Q0074_SEI_COLOR_MAPPING435 cfg_seiColorMappingFile[layer] = &m_acLayerCfg[layer].m_cSeiColorMappingFile;436 #endif437 505 #if LAYER_CTB 438 506 // coding unit (CU) definition … … 457 525 #endif 458 526 cfg_numScaledRefLayerOffsets [layer] = &m_acLayerCfg[layer].m_numScaledRefLayerOffsets; 527 cfg_waveFrontSynchro[layer] = &m_acLayerCfg[layer].m_waveFrontSynchro; 459 528 for(Int i = 0; i < MAX_LAYERS; i++) 460 529 { … … 468 537 #if P0312_VERT_PHASE_ADJ 469 538 cfg_vertPhasePositionEnableFlagPtr[layer] = &cfg_vertPhasePositionEnableFlag[layer]; 539 #endif 540 #if REF_REGION_OFFSET 541 cfg_scaledRefLayerOffsetPresentFlagPtr [layer] = &cfg_scaledRefLayerOffsetPresentFlag [layer]; 542 cfg_refRegionOffsetPresentFlagPtr [layer] = &cfg_refRegionOffsetPresentFlag [layer]; 543 cfg_refRegionLeftOffsetPtr [layer] = &cfg_refRegionLeftOffset [layer]; 544 cfg_refRegionTopOffsetPtr [layer] = &cfg_refRegionTopOffset [layer]; 545 cfg_refRegionRightOffsetPtr [layer] = &cfg_refRegionRightOffset [layer]; 546 cfg_refRegionBottomOffsetPtr[layer] = &cfg_refRegionBottomOffset[layer]; 547 #endif 548 #if R0209_GENERIC_PHASE 549 cfg_resamplePhaseSetPresentFlagPtr [layer] = &cfg_resamplePhaseSetPresentFlag [layer]; 550 cfg_phaseHorLumaPtr [layer] = &cfg_phaseHorLuma [layer]; 551 cfg_phaseVerLumaPtr [layer] = &cfg_phaseVerLuma [layer]; 552 cfg_phaseHorChromaPtr [layer] = &cfg_phaseHorChroma [layer]; 553 cfg_phaseVerChromaPtr [layer] = &cfg_phaseVerChroma [layer]; 470 554 #endif 471 555 } … … 507 591 } 508 592 #endif 593 #if OUTPUT_LAYER_SETS_CONFIG 594 string* cfg_numLayersInOutputLayerSet = new string; 595 string* cfg_listOfOutputLayers = new string[MAX_VPS_OUTPUT_LAYER_SETS_PLUS1]; 596 string* cfg_outputLayerSetIdx = new string; 597 #endif 509 598 #if AVC_BASE 510 599 string cfg_BLInputFile; 511 #endif512 #if AVC_SYNTAX513 string cfg_BLSyntaxFile;514 600 #endif 515 601 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI … … 521 607 string cfg_ReconFile; 522 608 string cfg_dQPFile; 609 #if Q0074_COLOUR_REMAPPING_SEI 610 string cfg_colourRemapSEIFile; 611 #endif 523 612 #endif //SVC_EXTENSION 524 string cfg _ColumnWidth;525 string cfg _RowHeight;613 string cfgColumnWidth; 614 string cfgRowHeight; 526 615 string cfg_ScalingListFile; 527 616 string cfg_startOfCodedInterval; … … 532 621 string cfg_kneeSEIOutputKneePointValue; 533 622 #endif 623 534 624 po::Options opts; 535 625 opts.addOptions() … … 562 652 ("NumLayers", m_numLayers, 1, "Number of layers to code") 563 653 #if Q0078_ADD_LAYER_SETS 654 #if OUTPUT_LAYER_SETS_CONFIG 655 ("NumLayerSets", m_numLayerSets, 1, "Number of layer sets") 656 #else 564 657 ("NumLayerSets", m_numLayerSets, 0, "Number of layer sets") 658 #endif 565 659 ("NumLayerInIdList%d", cfg_numLayerInIdList, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set") 566 660 ("LayerSetLayerIdList%d", cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set") … … 568 662 ("NumHighestLayerIdx%d", cfg_numHighestLayerIdx, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx") 569 663 ("HighestLayerIdx%d", cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set") 664 #endif 665 #if OUTPUT_LAYER_SETS_CONFIG 666 ("DefaultTargetOutputLayerIdc", m_defaultTargetOutputLayerIdc, 1, "Default target output layers. 0: All layers are output layer, 1: Only highest layer is output layer, 2 or 3: No default output layers") 667 ("NumOutputLayerSets", m_numOutputLayerSets, 1, "Number of output layer sets excluding the 0-th output layer set") 668 ("NumLayersInOutputLayerSet", cfg_numLayersInOutputLayerSet, string(""), 1 , "List containing number of output layers in the output layer sets") 669 ("ListOfOutputLayers%d", cfg_listOfOutputLayers, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set, in terms of layer ID in the output layer set Range: [0..NumLayersInOutputLayerSet-1]") 670 ("OutputLayerSetIdx", cfg_outputLayerSetIdx, string(""), 1, "Corresponding layer set index, only for non-default output layer sets") 570 671 #endif 571 672 #if AUXILIARY_PICTURES … … 602 703 ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to" 603 704 " bottom-right luma sample of the EL picture, in units of two luma samples") 705 #if REF_REGION_OFFSET 706 ("ScaledRefLayerOffsetPresentFlag%d", cfg_scaledRefLayerOffsetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of scaled reference layer offsets") 707 ("RefRegionOffsetPresentFlag%d", cfg_refRegionOffsetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of reference region offsets") 708 ("RefRegionLeftOffset%d", cfg_refRegionLeftOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of top-left luma sample of ref region with respect to" 709 " top-left luma sample of the BL picture, in units of two luma samples") 710 ("RefRegionTopOffset%d", cfg_refRegionTopOffsetPtr, string(""), MAX_LAYERS, "Vertical offset of top-left luma sample of ref region with respect to" 711 " top-left luma sample of the BL picture, in units of two luma samples") 712 ("RefRegionRightOffset%d", cfg_refRegionRightOffsetPtr, string(""), MAX_LAYERS, "Horizontal offset of bottom-right luma sample of ref region with respect to" 713 " bottom-right luma sample of the BL picture, in units of two luma samples") 714 ("RefRegionBottomOffset%d", cfg_refRegionBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of ref region with respect to" 715 " bottom-right luma sample of the BL picture, in units of two luma samples") 716 #endif 717 #if R0209_GENERIC_PHASE 718 ("ResamplePhaseSetPresentFlag%d", cfg_resamplePhaseSetPresentFlagPtr, string(""), MAX_LAYERS, "presense flag of resample phase set") 719 ("PhaseHorLuma%d", cfg_phaseHorLumaPtr, string(""), MAX_LAYERS, "luma shift in the horizontal direction used in resampling proces") 720 ("PhaseVerLuma%d", cfg_phaseVerLumaPtr, string(""), MAX_LAYERS, "luma shift in the vertical direction used in resampling proces") 721 ("PhaseHorChroma%d", cfg_phaseHorChromaPtr, string(""), MAX_LAYERS, "chroma shift in the horizontal direction used in resampling proces") 722 ("PhaseVerChroma%d", cfg_phaseVerChromaPtr, string(""), MAX_LAYERS, "chroma shift in the vertical direction used in resampling proces") 723 #endif 604 724 #if P0312_VERT_PHASE_ADJ 605 725 ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d") 726 #endif 727 #if Q0074_COLOUR_REMAPPING_SEI 728 ("SEIColourRemappingInfoFile%d", cfg_colourRemapSEIFile, string(""), MAX_LAYERS, "Colour Remapping Information SEI parameters file name for layer %d") 606 729 #endif 607 730 #if O0194_DIFFERENT_BITDEPTH_EL_BL … … 627 750 #endif 628 751 #if AVC_BASE 752 #if VPS_AVC_BL_FLAG_REMOVAL 753 ("NonHEVCBase,-nonhevc", m_nonHEVCBaseLayerFlag, 0, "BL is available but not internal") 754 #else 629 755 ("AvcBase,-avc", m_avcBaseLayerFlag, 0, "avc_base_layer_flag") 756 #endif 630 757 ("InputBLFile,-ibl", cfg_BLInputFile, string(""), "Base layer rec YUV input file name") 631 #if AVC_SYNTAX632 ("InputBLSyntaxFile,-ibs", cfg_BLSyntaxFile, string(""), "Base layer syntax input file name")633 #endif634 758 #endif 635 759 ("EnableElRapB,-use-rap-b", m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)") 636 #if Q0074_SEI_COLOR_MAPPING637 ("SEIColorMappingFile%d", cfg_seiColorMappingFile, string(""), MAX_LAYERS, "File Containing SEI Color Mapping data")638 #endif639 760 #else //SVC_EXTENSION 640 761 ("InputFile,i", cfg_InputFile, string(""), "Original YUV input file name") … … 654 775 ("ChromaFormatIDC,-cf", tmpChromaFormat, 0, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)") 655 776 #endif 656 ("ConformanceMode", m_conformanceMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance") 657 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2") 658 ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2") 659 ("ConfLeft", m_confLeft, 0, "Left offset for window conformance mode 3") 660 ("ConfRight", m_confRight, 0, "Right offset for window conformance mode 3") 661 ("ConfTop", m_confTop, 0, "Top offset for window conformance mode 3") 662 ("ConfBottom", m_confBottom, 0, "Bottom offset for window conformance mode 3") 777 ("ConformanceMode", m_conformanceWindowMode, 0, "Deprecated alias of ConformanceWindowMode") 778 ("ConformanceWindowMode", m_conformanceWindowMode, 0, "Window conformance mode (0: no window, 1:automatic padding, 2:padding, 3:conformance") 779 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "Horizontal source padding for conformance window mode 2") 780 ("VerticalPadding,-pdy", m_aiPad[1], 0, "Vertical source padding for conformance window mode 2") 781 ("ConfLeft", m_confWinLeft, 0, "Deprecated alias of ConfWinLeft") 782 ("ConfRight", m_confWinRight, 0, "Deprecated alias of ConfWinRight") 783 ("ConfTop", m_confWinTop, 0, "Deprecated alias of ConfWinTop") 784 ("ConfBottom", m_confWinBottom, 0, "Deprecated alias of ConfWinBottom") 785 ("ConfWinLeft", m_confWinLeft, 0, "Left offset for window conformance mode 3") 786 ("ConfWinRight", m_confWinRight, 0, "Right offset for window conformance mode 3") 787 ("ConfWinTop", m_confWinTop, 0, "Top offset for window conformance mode 3") 788 ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") 663 789 ("FrameRate,-fr", m_iFrameRate, 0, "Frame rate") 790 #if Q0074_COLOUR_REMAPPING_SEI 791 ("SEIColourRemappingInfoFile", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name") 792 #endif 664 793 #endif //SVC_EXTENSION 665 794 ("FrameSkip,-fs", m_FrameSkip, 0u, "Number of frames to skip at start of input YUV") … … 821 950 ("WeightedPredB,-wpB", m_useWeightedBiPred, false, "Use weighted (bidirectional) prediction in B slices") 822 951 ("Log2ParallelMergeLevel", m_log2ParallelMergeLevel, 2u, "Parallel merge estimation region") 823 ("UniformSpacingIdc", m_iUniformSpacingIdr, 0, "Indicates if the column and row boundaries are distributed uniformly") 824 ("NumTileColumnsMinus1", m_iNumColumnsMinus1, 0, "Number of columns in a picture minus 1") 825 ("ColumnWidthArray", cfg_ColumnWidth, string(""), "Array containing ColumnWidth values in units of LCU") 826 ("NumTileRowsMinus1", m_iNumRowsMinus1, 0, "Number of rows in a picture minus 1") 827 ("RowHeightArray", cfg_RowHeight, string(""), "Array containing RowHeight values in units of LCU") 952 953 //deprecated copies of renamed tile parameters 954 ("UniformSpacingIdc", m_tileUniformSpacingFlag, false, "deprecated alias of TileUniformSpacing") 955 ("ColumnWidthArray", cfgColumnWidth, string(""), "deprecated alias of TileColumnWidthArray") 956 ("RowHeightArray", cfgRowHeight, string(""), "deprecated alias of TileRowHeightArray") 957 958 ("TileUniformSpacing", m_tileUniformSpacingFlag, false, "Indicates that tile columns and rows are distributed uniformly") 959 ("NumTileColumnsMinus1", m_numTileColumnsMinus1, 0, "Number of tile columns in a picture minus 1") 960 ("NumTileRowsMinus1", m_numTileRowsMinus1, 0, "Number of rows in a picture minus 1") 961 ("TileColumnWidthArray", cfgColumnWidth, string(""), "Array containing tile column width values in units of LCU") 962 ("TileRowHeightArray", cfgRowHeight, string(""), "Array containing tile row height values in units of LCU") 828 963 ("LFCrossTileBoundaryFlag", m_bLFCrossTileBoundaryFlag, true, "1: cross-tile-boundary loop filtering. 0:non-cross-tile-boundary loop filtering") 964 #if SVC_EXTENSION 965 ("WaveFrontSynchro%d", cfg_waveFrontSynchro, 0, MAX_LAYERS, "0: no synchro; 1 synchro with TR; 2 TRR etc") 966 #else 829 967 ("WaveFrontSynchro", m_iWaveFrontSynchro, 0, "0: no synchro; 1 synchro with TR; 2 TRR etc") 968 #endif 830 969 ("ScalingList", m_useScalingListId, 0, "0: no scaling list, 1: default scaling lists, 2: scaling lists specified in ScalingListFile") 831 970 ("ScalingListFile", cfg_ScalingListFile, string(""), "Scaling list file name") … … 884 1023 ("ColourDescriptionPresent", m_colourDescriptionPresentFlag, false, "Signals whether colour_primaries, transfer_characteristics and matrix_coefficients are present") 885 1024 ("ColourPrimaries", m_colourPrimaries, 2, "Indicates chromaticity coordinates of the source primaries") 886 ("TransferChara teristics",m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source")1025 ("TransferCharacteristics", m_transferCharacteristics, 2, "Indicates the opto-electronic transfer characteristics of the source") 887 1026 ("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries") 888 1027 ("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present") … … 1004 1143 ("CGSMaxYPartNumLog", m_nCGSMaxYPartNumLog2 , 2, "max Y part number ") 1005 1144 ("CGSLUTBit", m_nCGSLUTBit , 12, "bit depth of CGS LUT") 1145 #if R0151_CGS_3D_ASYMLUT_IMPROVE 1146 ("CGSAdaptC", m_nCGSAdaptiveChroma , 1, "adaptive chroma partition (only for the case of two chroma partitions)") 1147 #endif 1148 #if R0179_ENC_OPT_3DLUT_SIZE 1149 ("CGSSizeRDO", m_nCGSLutSizeRDO , 0, "RDOpt selection of best table size (effective when large maximum table size such as 8x8x8 is used)") 1150 #endif 1006 1151 #endif 1007 1152 #if Q0108_TSA_STSA … … 1089 1234 #if SVC_EXTENSION 1090 1235 #if AVC_BASE 1236 #if VPS_AVC_BL_FLAG_REMOVAL 1237 if( m_nonHEVCBaseLayerFlag ) 1238 #else 1091 1239 if( m_avcBaseLayerFlag ) 1240 #endif 1092 1241 { 1093 1242 *cfg_InputFile[0] = cfg_BLInputFile; … … 1095 1244 #endif 1096 1245 m_pBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str()); 1097 #if AVC_SYNTAX1098 m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());1099 #endif1100 1246 #else //SVC_EXTENSION 1101 1247 m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str()); … … 1103 1249 m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str()); 1104 1250 m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str()); 1105 #endif //SVC_EXTENSION 1106 1107 Char* pColumnWidth = cfg_ColumnWidth.empty() ? NULL: strdup(cfg_ColumnWidth.c_str()); 1108 Char* pRowHeight = cfg_RowHeight.empty() ? NULL : strdup(cfg_RowHeight.c_str()); 1109 if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 ) 1110 { 1111 char *columnWidth; 1251 #if Q0074_COLOUR_REMAPPING_SEI 1252 m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str()); 1253 #endif 1254 #endif //SVC_EXTENSION 1255 1256 1257 Char* pColumnWidth = cfgColumnWidth.empty() ? NULL: strdup(cfgColumnWidth.c_str()); 1258 Char* pRowHeight = cfgRowHeight.empty() ? NULL : strdup(cfgRowHeight.c_str()); 1259 1260 if( !m_tileUniformSpacingFlag && m_numTileColumnsMinus1 > 0 ) 1261 { 1262 char *str; 1112 1263 int i=0; 1113 m_ pColumnWidth = new UInt[m_iNumColumnsMinus1];1114 columnWidth= strtok(pColumnWidth, " ,-");1115 while( columnWidth!=NULL)1116 { 1117 if( i >=m_iNumColumnsMinus1 )1264 m_tileColumnWidth.resize( m_numTileColumnsMinus1 ); 1265 str = strtok(pColumnWidth, " ,-"); 1266 while(str!=NULL) 1267 { 1268 if( i >= m_numTileColumnsMinus1 ) 1118 1269 { 1119 1270 printf( "The number of columns whose width are defined is larger than the allowed number of columns.\n" ); 1120 1271 exit( EXIT_FAILURE ); 1121 1272 } 1122 *( m_pColumnWidth + i ) = atoi( columnWidth);1123 columnWidth= strtok(NULL, " ,-");1273 m_tileColumnWidth[i] = atoi( str ); 1274 str = strtok(NULL, " ,-"); 1124 1275 i++; 1125 1276 } 1126 if( i <m_iNumColumnsMinus1 )1277 if( i < m_numTileColumnsMinus1 ) 1127 1278 { 1128 1279 printf( "The width of some columns is not defined.\n" ); … … 1132 1283 else 1133 1284 { 1134 m_ pColumnWidth = NULL;1135 } 1136 1137 if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 )1138 { 1139 char * rowHeight;1285 m_tileColumnWidth.clear(); 1286 } 1287 1288 if( !m_tileUniformSpacingFlag && m_numTileRowsMinus1 > 0 ) 1289 { 1290 char *str; 1140 1291 int i=0; 1141 m_ pRowHeight = new UInt[m_iNumRowsMinus1];1142 rowHeight= strtok(pRowHeight, " ,-");1143 while( rowHeight!=NULL)1144 { 1145 if( i>=m_ iNumRowsMinus1 )1292 m_tileRowHeight.resize(m_numTileRowsMinus1); 1293 str = strtok(pRowHeight, " ,-"); 1294 while(str!=NULL) 1295 { 1296 if( i>=m_numTileRowsMinus1 ) 1146 1297 { 1147 1298 printf( "The number of rows whose height are defined is larger than the allowed number of rows.\n" ); 1148 1299 exit( EXIT_FAILURE ); 1149 1300 } 1150 *( m_pRowHeight + i ) = atoi( rowHeight);1151 rowHeight= strtok(NULL, " ,-");1301 m_tileRowHeight[i] = atoi( str ); 1302 str = strtok(NULL, " ,-"); 1152 1303 i++; 1153 1304 } 1154 if( i <m_iNumRowsMinus1 )1305 if( i < m_numTileRowsMinus1 ) 1155 1306 { 1156 1307 printf( "The height of some rows is not defined.\n" ); … … 1160 1311 else 1161 1312 { 1162 m_ pRowHeight = NULL;1313 m_tileRowHeight.clear(); 1163 1314 } 1164 1315 #if SVC_EXTENSION 1316 if( pColumnWidth ) 1317 { 1318 free( pColumnWidth ); 1319 pColumnWidth = NULL; 1320 } 1321 1322 if( pRowHeight ) 1323 { 1324 free( pRowHeight ); 1325 pRowHeight = NULL; 1326 } 1327 1165 1328 for(Int layer = 0; layer < MAX_LAYERS; layer++) 1166 1329 { … … 1171 1334 assert( strcmp(cfg_scaledRefLayerId[layer].c_str(), "")); 1172 1335 #endif 1336 #if REF_REGION_OFFSET 1337 Bool srloFlag = 1338 strcmp(cfg_scaledRefLayerLeftOffset [layer].c_str(), "") || 1339 strcmp(cfg_scaledRefLayerRightOffset [layer].c_str(), "") || 1340 strcmp(cfg_scaledRefLayerTopOffset [layer].c_str(), "") || 1341 strcmp(cfg_scaledRefLayerBottomOffset [layer].c_str(), ""); 1342 Bool rroFlag = 1343 strcmp(cfg_refRegionLeftOffset [layer].c_str(), "") || 1344 strcmp(cfg_refRegionRightOffset [layer].c_str(), "") || 1345 strcmp(cfg_refRegionTopOffset [layer].c_str(), "") || 1346 strcmp(cfg_refRegionBottomOffset [layer].c_str(), ""); 1347 #if R0209_GENERIC_PHASE 1348 Bool phaseSetFlag = 1349 strcmp(cfg_phaseHorLuma [layer].c_str(), "") || 1350 strcmp(cfg_phaseVerLuma [layer].c_str(), "") || 1351 strcmp(cfg_phaseHorChroma [layer].c_str(), "") || 1352 strcmp(cfg_phaseVerChroma [layer].c_str(), ""); 1353 assert( srloFlag || rroFlag || phaseSetFlag); 1354 #else 1355 assert( srloFlag || rroFlag ); 1356 #endif 1357 #else 1173 1358 #if P0312_VERT_PHASE_ADJ 1174 1359 assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "") || … … 1183 1368 strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") ); 1184 1369 #endif 1370 #endif 1185 1371 } 1186 1372 … … 1203 1389 #endif 1204 1390 1391 #if REF_REGION_OFFSET 1392 // Presense Flag // 1393 if(strcmp(cfg_scaledRefLayerOffsetPresentFlag[layer].c_str(), "")) 1394 { 1395 cfgStringToArray( &tempArray, cfg_scaledRefLayerOffsetPresentFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "ScaledRefLayerOffsetPresentFlag"); 1396 if(tempArray) 1397 { 1398 for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) 1399 { 1400 m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] = tempArray[i]; 1401 } 1402 delete [] tempArray; tempArray = NULL; 1403 } 1404 } 1405 #endif 1406 1205 1407 // Left offset // 1206 1408 if(strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(), "")) … … 1273 1475 } 1274 1476 #endif 1275 } 1477 #if REF_REGION_OFFSET 1478 // Presense Flag // 1479 if(strcmp(cfg_refRegionOffsetPresentFlag[layer].c_str(), "")) 1480 { 1481 cfgStringToArray( &tempArray, cfg_refRegionOffsetPresentFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionOffsetPresentFlag"); 1482 if(tempArray) 1483 { 1484 for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) 1485 { 1486 m_acLayerCfg[layer].m_refRegionOffsetPresentFlag[i] = tempArray[i]; 1487 } 1488 delete [] tempArray; tempArray = NULL; 1489 } 1490 } 1491 1492 // Left offset // 1493 if(strcmp(cfg_refRegionLeftOffset[layer].c_str(), "")) 1494 { 1495 cfgStringToArray( &tempArray, cfg_refRegionLeftOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionLeftOffset"); 1496 if(tempArray) 1497 { 1498 for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) 1499 { 1500 m_acLayerCfg[layer].m_refRegionLeftOffset[i] = tempArray[i]; 1501 } 1502 delete [] tempArray; tempArray = NULL; 1503 } 1504 } 1505 1506 // Top offset // 1507 if(strcmp(cfg_refRegionTopOffset[layer].c_str(), "")) 1508 { 1509 cfgStringToArray( &tempArray, cfg_refRegionTopOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionTopOffset"); 1510 if(tempArray) 1511 { 1512 for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) 1513 { 1514 m_acLayerCfg[layer].m_refRegionTopOffset[i] = tempArray[i]; 1515 } 1516 delete [] tempArray; tempArray = NULL; 1517 } 1518 } 1519 1520 // Right offset // 1521 if(strcmp(cfg_refRegionRightOffset[layer].c_str(), "")) 1522 { 1523 cfgStringToArray( &tempArray, cfg_refRegionRightOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionRightOffset"); 1524 if(tempArray) 1525 { 1526 for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) 1527 { 1528 m_acLayerCfg[layer].m_refRegionRightOffset[i] = tempArray[i]; 1529 } 1530 delete [] tempArray; tempArray = NULL; 1531 } 1532 } 1533 1534 // Bottom offset // 1535 if(strcmp(cfg_refRegionBottomOffset[layer].c_str(), "")) 1536 { 1537 cfgStringToArray( &tempArray, cfg_refRegionBottomOffset[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "RefRegionBottomOffset"); 1538 if(tempArray) 1539 { 1540 for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) 1541 { 1542 m_acLayerCfg[layer].m_refRegionBottomOffset[i] = tempArray[i]; 1543 } 1544 delete [] tempArray; tempArray = NULL; 1545 } 1546 } 1547 #endif 1548 #if R0209_GENERIC_PHASE 1549 Int numPhaseSet = m_acLayerCfg[layer].m_numScaledRefLayerOffsets; 1550 1551 // Presense Flag // 1552 if(strcmp(cfg_resamplePhaseSetPresentFlag[layer].c_str(), "")) 1553 { 1554 cfgStringToArray( &tempArray, cfg_resamplePhaseSetPresentFlag[layer], numPhaseSet, "resamplePhaseSetPresentFlag"); 1555 if(tempArray) 1556 { 1557 for(Int i = 0; i < numPhaseSet; i++) 1558 { 1559 m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] = tempArray[i]; 1560 } 1561 delete [] tempArray; tempArray = NULL; 1562 } 1563 } 1564 1565 // Luma horizontal phase // 1566 if(strcmp(cfg_phaseHorLuma[layer].c_str(), "")) 1567 { 1568 cfgStringToArray( &tempArray, cfg_phaseHorLuma[layer], numPhaseSet, "phaseHorLuma"); 1569 if(tempArray) 1570 { 1571 for(Int i = 0; i < numPhaseSet; i++) 1572 { 1573 m_acLayerCfg[layer].m_phaseHorLuma[i] = tempArray[i]; 1574 } 1575 delete [] tempArray; tempArray = NULL; 1576 } 1577 } 1578 1579 // Luma vertical phase // 1580 if(strcmp(cfg_phaseVerLuma[layer].c_str(), "")) 1581 { 1582 cfgStringToArray( &tempArray, cfg_phaseVerLuma[layer], numPhaseSet, "phaseVerLuma"); 1583 if(tempArray) 1584 { 1585 for(Int i = 0; i < numPhaseSet; i++) 1586 { 1587 m_acLayerCfg[layer].m_phaseVerLuma[i] = tempArray[i]; 1588 } 1589 delete [] tempArray; tempArray = NULL; 1590 } 1591 } 1592 1593 // Chroma horizontal phase // 1594 if(strcmp(cfg_phaseHorChroma[layer].c_str(), "")) 1595 { 1596 cfgStringToArray( &tempArray, cfg_phaseHorChroma[layer], numPhaseSet, "phaseHorChroma"); 1597 if(tempArray) 1598 { 1599 for(Int i = 0; i < numPhaseSet; i++) 1600 { 1601 m_acLayerCfg[layer].m_phaseHorChroma[i] = tempArray[i]; 1602 } 1603 delete [] tempArray; tempArray = NULL; 1604 } 1605 } 1606 1607 // Chroma vertical phase // 1608 if(strcmp(cfg_phaseVerChroma[layer].c_str(), "")) 1609 { 1610 cfgStringToArray( &tempArray, cfg_phaseVerChroma[layer], numPhaseSet, "phaseVerChroma"); 1611 if(tempArray) 1612 { 1613 for(Int i = 0; i < numPhaseSet; i++) 1614 { 1615 m_acLayerCfg[layer].m_phaseVerChroma[i] = tempArray[i]; 1616 } 1617 delete [] tempArray; tempArray = NULL; 1618 } 1619 } 1620 #endif 1621 } 1622 1276 1623 #if VPS_EXTN_DIRECT_REF_LAYERS 1277 1624 for(Int layer = 0; layer < MAX_LAYERS; layer++) … … 1305 1652 m_acLayerCfg[layer].m_samplePredRefLayerIds = NULL; 1306 1653 } 1654 1655 if( pSamplePredRefLayerIds ) 1656 { 1657 free( pSamplePredRefLayerIds ); 1658 pSamplePredRefLayerIds = NULL; 1659 } 1307 1660 } 1308 1661 for(Int layer = 0; layer < MAX_LAYERS; layer++) … … 1336 1689 m_acLayerCfg[layer].m_motionPredRefLayerIds = NULL; 1337 1690 } 1691 1692 if( pMotionPredRefLayerIds ) 1693 { 1694 free( pMotionPredRefLayerIds ); 1695 pMotionPredRefLayerIds = NULL; 1696 } 1338 1697 } 1339 1698 … … 1375 1734 m_acLayerCfg[layer].m_predLayerIds = NULL; 1376 1735 } 1736 1737 if( pPredLayerIds ) 1738 { 1739 free( pPredLayerIds ); 1740 pPredLayerIds = NULL; 1741 } 1377 1742 } 1378 1743 #endif 1379 1744 #if Q0078_ADD_LAYER_SETS 1745 #if OUTPUT_LAYER_SETS_CONFIG 1746 for (Int layerSet = 1; layerSet < m_numLayerSets; layerSet++) 1747 { 1748 // Simplifying the code in the #else section, and allowing 0-th layer set t 1749 assert( scanStringToArray( cfg_layerSetLayerIdList[layerSet], m_numLayerInIdList[layerSet], "NumLayerInIdList", m_layerSetLayerIdList[layerSet] ) ); 1750 #else 1380 1751 for (Int layerSet = 0; layerSet < m_numLayerSets; layerSet++) 1381 1752 { … … 1396 1767 i++; 1397 1768 } 1398 } 1769 1770 if( layerSetLayerIdListDup ) 1771 { 1772 free( layerSetLayerIdListDup ); 1773 layerSetLayerIdListDup = NULL; 1774 } 1775 } 1776 #endif 1399 1777 } 1400 1778 for (Int addLayerSet = 0; addLayerSet < m_numAddLayerSets; addLayerSet++) 1401 1779 { 1780 #if OUTPUT_LAYER_SETS_CONFIG 1781 // Simplifying the code in the #else section 1782 assert( scanStringToArray( cfg_layerSetLayerIdList[addLayerSet], m_numLayerInIdList[addLayerSet], "NumLayerInIdList", m_highestLayerIdx[addLayerSet] ) ); 1783 #else 1402 1784 if (m_numHighestLayerIdx[addLayerSet] > 0) 1403 1785 { … … 1416 1798 i++; 1417 1799 } 1418 } 1419 } 1800 1801 if( highestLayrIdxListDup ) 1802 { 1803 free( highestLayrIdxListDup ); 1804 highestLayrIdxListDup = NULL; 1805 } 1806 } 1807 #endif 1808 } 1809 #endif 1810 #if OUTPUT_LAYER_SETS_CONFIG 1811 if( m_defaultTargetOutputLayerIdc != -1 ) 1812 { 1813 assert( m_defaultTargetOutputLayerIdc >= 0 && m_defaultTargetOutputLayerIdc <= 3 ); 1814 } 1815 assert( m_numOutputLayerSets != 0 ); 1816 assert( m_numOutputLayerSets >= m_numLayerSets + m_numAddLayerSets ); // Number of output layer sets must be at least as many as layer sets. 1817 1818 // If output layer Set Idx is specified, only specify it for the non-default output layer sets 1819 Int numNonDefaultOls = m_numOutputLayerSets - (m_numLayerSets + m_numAddLayerSets); 1820 if( numNonDefaultOls ) 1821 { 1822 assert( scanStringToArray( *cfg_outputLayerSetIdx, numNonDefaultOls, "OutputLayerSetIdx", m_outputLayerSetIdx ) ); 1823 for(Int i = 0; i < numNonDefaultOls; i++) 1824 { 1825 assert( m_outputLayerSetIdx[i] >= 0 && m_outputLayerSetIdx[i] < (m_numLayerSets + m_numAddLayerSets) ); 1826 } 1827 } 1828 1829 // Number of output layers in output layer sets 1830 scanStringToArray( *cfg_numLayersInOutputLayerSet, m_numOutputLayerSets - 1, "NumLayersInOutputLayerSets", m_numLayersInOutputLayerSet ); 1831 m_numLayersInOutputLayerSet.insert(m_numLayersInOutputLayerSet.begin(), 1); 1832 // Layers in the output layer set 1833 m_listOfOutputLayers.resize(m_numOutputLayerSets); 1834 Int startOlsCtr = 1; 1835 if( m_defaultTargetOutputLayerIdc == 0 || m_defaultTargetOutputLayerIdc == 1 ) 1836 { 1837 // Default output layer sets defined 1838 startOlsCtr = m_numLayerSets + m_numAddLayerSets; 1839 } 1840 for( Int olsCtr = 1; olsCtr < m_numOutputLayerSets; olsCtr++ ) 1841 { 1842 if( olsCtr < startOlsCtr ) 1843 { 1844 if(scanStringToArray( cfg_listOfOutputLayers[olsCtr], m_numLayersInOutputLayerSet[olsCtr], "ListOfOutputLayers", m_listOfOutputLayers[olsCtr] ) ) 1845 { 1846 std::cout << "Default OLS defined. Ignoring ListOfOutputLayers" << olsCtr << endl; 1847 } 1848 } 1849 else 1850 { 1851 assert( scanStringToArray( cfg_listOfOutputLayers[olsCtr], m_numLayersInOutputLayerSet[olsCtr], "ListOfOutputLayers", m_listOfOutputLayers[olsCtr] ) ); 1852 } 1853 } 1854 delete cfg_numLayersInOutputLayerSet; 1855 delete [] cfg_listOfOutputLayers; 1856 delete cfg_outputLayerSetIdx; 1420 1857 #endif 1421 1858 #endif //SVC_EXTENSION … … 1442 1879 #if !SVC_EXTENSION 1443 1880 // TODO:ChromaFmt assumes 4:2:0 below 1444 switch (m_conformance Mode)1881 switch (m_conformanceWindowMode) 1445 1882 { 1446 1883 case 0: 1447 1884 { 1448 1885 // no conformance or padding 1449 m_conf Left = m_confRight = m_confTop = m_confBottom = 0;1886 m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0; 1450 1887 m_aiPad[1] = m_aiPad[0] = 0; 1451 1888 break; … … 1457 1894 if (m_iSourceWidth % minCuSize) 1458 1895 { 1459 m_aiPad[0] = m_conf Right = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;1460 m_iSourceWidth += m_conf Right;1896 m_aiPad[0] = m_confWinRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; 1897 m_iSourceWidth += m_confWinRight; 1461 1898 } 1462 1899 if (m_iSourceHeight % minCuSize) 1463 1900 { 1464 m_aiPad[1] = m_conf Bottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;1465 m_iSourceHeight += m_conf Bottom;1901 m_aiPad[1] = m_confWinBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 1902 m_iSourceHeight += m_confWinBottom; 1466 1903 if ( m_isField ) 1467 1904 { 1468 m_iSourceHeightOrg += m_conf Bottom << 1;1469 m_aiPad[1] = m_conf Bottom << 1;1905 m_iSourceHeightOrg += m_confWinBottom << 1; 1906 m_aiPad[1] = m_confWinBottom << 1; 1470 1907 } 1471 1908 } … … 1487 1924 m_iSourceWidth += m_aiPad[0]; 1488 1925 m_iSourceHeight += m_aiPad[1]; 1489 m_conf Right = m_aiPad[0];1490 m_conf Bottom = m_aiPad[1];1926 m_confWinRight = m_aiPad[0]; 1927 m_confWinBottom = m_aiPad[1]; 1491 1928 break; 1492 1929 } … … 1494 1931 { 1495 1932 // conformance 1496 if ((m_conf Left == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0))1933 if ((m_confWinLeft == 0) && (m_confWinRight == 0) && (m_confWinTop == 0) && (m_confWinBottom == 0)) 1497 1934 { 1498 1935 fprintf(stderr, "Warning: Conformance window enabled, but all conformance window parameters set to zero\n"); … … 1601 2038 m_targetPivotValue = NULL; 1602 2039 } 2040 2041 if( pcStartOfCodedInterval ) 2042 { 2043 free( pcStartOfCodedInterval ); 2044 pcStartOfCodedInterval = NULL; 2045 } 2046 2047 if( pcCodedPivotValue ) 2048 { 2049 free( pcCodedPivotValue ); 2050 pcCodedPivotValue = NULL; 2051 } 2052 2053 if( pcTargetPivotValue ) 2054 { 2055 free( pcTargetPivotValue ); 2056 pcTargetPivotValue = NULL; 2057 } 1603 2058 } 1604 2059 #if P0050_KNEE_FUNCTION_SEI … … 1626 2081 i++; 1627 2082 } 1628 } 1629 #endif 1630 2083 2084 if( pcInputKneePointValue ) 2085 { 2086 free( pcInputKneePointValue ); 2087 pcInputKneePointValue = NULL; 2088 } 2089 2090 if( pcOutputKneePointValue ) 2091 { 2092 free( pcOutputKneePointValue ); 2093 pcOutputKneePointValue = NULL; 2094 } 2095 } 2096 #endif 2097 #if Q0074_COLOUR_REMAPPING_SEI 2098 #if !SVC_EXTENSION 2099 // reading external Colour Remapping Information SEI message parameters from file 2100 if( m_colourRemapSEIFile.size() > 0 ) 2101 { 2102 FILE* fic; 2103 Int retval; 2104 if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL) 2105 { 2106 fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str()); 2107 exit(EXIT_FAILURE); 2108 } 2109 2110 retval = fscanf( fic, "%d", &m_colourRemapSEIId ); 2111 retval = fscanf( fic, "%d", &m_colourRemapSEICancelFlag ); 2112 if( !m_colourRemapSEICancelFlag ) 2113 { 2114 retval = fscanf( fic, "%d", &m_colourRemapSEIPersistenceFlag ); 2115 retval = fscanf( fic, "%d", &m_colourRemapSEIVideoSignalInfoPresentFlag); 2116 if( m_colourRemapSEIVideoSignalInfoPresentFlag ) 2117 { 2118 retval = fscanf( fic, "%d", &m_colourRemapSEIFullRangeFlag ); 2119 retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries ); 2120 retval = fscanf( fic, "%d", &m_colourRemapSEITransferFunction ); 2121 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoefficients ); 2122 } 2123 2124 retval = fscanf( fic, "%d", &m_colourRemapSEIInputBitDepth ); 2125 retval = fscanf( fic, "%d", &m_colourRemapSEIBitDepth ); 2126 2127 for( Int c=0 ; c<3 ; c++ ) 2128 { 2129 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] ); 2130 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 2131 { 2132 m_colourRemapSEIPreLutCodedValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 2133 m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 2134 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 2135 { 2136 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] ); 2137 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] ); 2138 } 2139 } 2140 } 2141 2142 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixPresentFlag ); 2143 if( m_colourRemapSEIMatrixPresentFlag ) 2144 { 2145 retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom ); 2146 for( Int c=0 ; c<3 ; c++ ) 2147 for( Int i=0 ; i<3 ; i++ ) 2148 retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] ); 2149 } 2150 2151 for( Int c=0 ; c<3 ; c++ ) 2152 { 2153 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] ); 2154 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 2155 { 2156 m_colourRemapSEIPostLutCodedValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 2157 m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 2158 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 2159 { 2160 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] ); 2161 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] ); 2162 } 2163 } 2164 } 2165 } 2166 2167 fclose( fic ); 2168 if( retval != 1 ) 2169 { 2170 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 2171 exit(EXIT_FAILURE); 2172 } 2173 } 2174 #else 2175 // Reading external Colour Remapping Information SEI message parameters from file 2176 // It seems that TAppEncLayerCfg::parseCfg is not used 2177 for(UInt layer = 0; layer < m_numLayers; layer++) 2178 { 2179 if( cfg_colourRemapSEIFile[layer]->length() ) 2180 { 2181 FILE* fic; 2182 Int retval; 2183 if((fic = fopen(cfg_colourRemapSEIFile[layer]->c_str(),"r")) == (FILE*)NULL) 2184 { 2185 fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", cfg_colourRemapSEIFile[layer]->c_str()); 2186 exit(EXIT_FAILURE); 2187 } 2188 Int tempCode; 2189 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIId ); 2190 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEICancelFlag = tempCode ? 1 : 0; 2191 if( !m_acLayerCfg[layer].m_colourRemapSEICancelFlag ) 2192 { 2193 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag = tempCode ? 1 : 0; 2194 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag = tempCode ? 1 : 0; 2195 if( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag ) 2196 { 2197 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag = tempCode ? 1 : 0; 2198 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPrimaries ); 2199 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEITransferFunction ); 2200 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients ); 2201 } 2202 2203 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth ); 2204 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIBitDepth ); 2205 2206 for( Int c=0 ; c<3 ; c++ ) 2207 { 2208 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ); 2209 if( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 2210 { 2211 m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1]; 2212 m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c]+1]; 2213 for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 2214 { 2215 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue[c][i] ); 2216 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue[c][i] ); 2217 } 2218 } 2219 } 2220 2221 retval = fscanf( fic, "%d", &tempCode ); m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag = tempCode ? 1 : 0; 2222 if( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ) 2223 { 2224 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom ); 2225 for( Int c=0 ; c<3 ; c++ ) 2226 for( Int i=0 ; i<3 ; i++ ) 2227 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEICoeffs[c][i] ); 2228 } 2229 2230 for( Int c=0 ; c<3 ; c++ ) 2231 { 2232 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ); 2233 if( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 2234 { 2235 m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1]; 2236 m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c] = new Int[m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c]+1]; 2237 for( Int i=0 ; i<=m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 2238 { 2239 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutCodedValue[c][i] ); 2240 retval = fscanf( fic, "%d", &m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue[c][i] ); 2241 } 2242 } 2243 } 2244 } 2245 2246 fclose( fic ); 2247 if( retval != 1 ) 2248 { 2249 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 2250 exit(EXIT_FAILURE); 2251 } 2252 } 2253 } 2254 #endif 2255 #endif 1631 2256 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI 1632 2257 if (m_interLayerConstrainedTileSetsSEIEnabled) 1633 2258 { 1634 if (m_ iNumColumnsMinus1 == 0 && m_iNumRowsMinus1 == 0)2259 if (m_numTileColumnsMinus1 == 0 && m_numTileRowsMinus1 == 0) 1635 2260 { 1636 2261 printf( "Tiles are not defined (needed for inter-layer comnstrained tile sets SEI).\n" ); … … 1671 2296 } 1672 2297 m_skippedTileSetPresentFlag = false; 2298 2299 if( pTileSets ) 2300 { 2301 free( pTileSets ); 2302 pTileSets = NULL; 2303 } 1673 2304 } 1674 2305 #endif … … 1837 2468 } 1838 2469 1839 Bool tileFlag = (m_iNumColumnsMinus1 > 0 || m_iNumRowsMinus1 > 0 ); 2470 #if !SVC_EXTENSION 2471 Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 ); 1840 2472 xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); 1841 2473 1842 2474 //TODO:ChromaFmt assumes 4:2:0 below 1843 #if !SVC_EXTENSION1844 2475 xConfirmPara( m_iSourceWidth % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling"); 1845 2476 xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling"); … … 1848 2479 xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling"); 1849 2480 1850 xConfirmPara( m_confLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); 1851 xConfirmPara( m_confRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); 1852 xConfirmPara( m_confTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); 1853 xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); 2481 xConfirmPara( m_confWinLeft % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling"); 2482 xConfirmPara( m_confWinRight % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling"); 2483 xConfirmPara( m_confWinTop % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling"); 2484 xConfirmPara( m_confWinBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling"); 2485 2486 xConfirmPara( m_defaultDisplayWindowFlag && !m_vuiParametersPresentFlag, "VUI needs to be enabled for default display window"); 2487 2488 if (m_defaultDisplayWindowFlag) 2489 { 2490 xConfirmPara( m_defDispWinLeftOffset % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left default display window offset must be an integer multiple of the specified chroma subsampling"); 2491 xConfirmPara( m_defDispWinRightOffset % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right default display window offset must be an integer multiple of the specified chroma subsampling"); 2492 xConfirmPara( m_defDispWinTopOffset % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top default display window offset must be an integer multiple of the specified chroma subsampling"); 2493 xConfirmPara( m_defDispWinBottomOffset % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom default display window offset must be an integer multiple of the specified chroma subsampling"); 2494 } 1854 2495 #endif 1855 2496 … … 1955 2596 1956 2597 // it can be updated after AVC BL support will be added to the WD 2598 #if VPS_AVC_BL_FLAG_REMOVAL 2599 if( m_nonHEVCBaseLayerFlag ) 2600 #else 1957 2601 if( m_avcBaseLayerFlag ) 2602 #endif 1958 2603 { 1959 2604 m_crossLayerIrapAlignFlag = false; … … 2593 3238 Int m_uiMaxCUHeight = m_acLayerCfg[layer].m_uiMaxCUHeight; 2594 3239 #endif 2595 #endif 3240 3241 Bool tileFlag = (m_numTileColumnsMinus1 > 0 || m_numTileRowsMinus1 > 0 ); 3242 Int m_iWaveFrontSynchro = m_acLayerCfg[layer].m_waveFrontSynchro; 3243 xConfirmPara( tileFlag && m_iWaveFrontSynchro, "Tile and Wavefront can not be applied together"); 3244 #endif 3245 2596 3246 if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag) 2597 3247 { … … 2603 3253 Int widthInCU = (m_iSourceWidth % m_uiMaxCUWidth) ? m_iSourceWidth/m_uiMaxCUWidth + 1: m_iSourceWidth/m_uiMaxCUWidth; 2604 3254 Int heightInCU = (m_iSourceHeight % m_uiMaxCUHeight) ? m_iSourceHeight/m_uiMaxCUHeight + 1: m_iSourceHeight/m_uiMaxCUHeight; 2605 if(m_ iUniformSpacingIdr)2606 { 2607 maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_ iNumColumnsMinus1)/(m_iNumColumnsMinus1+1));2608 maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_ iNumRowsMinus1)/(m_iNumRowsMinus1+1));3255 if(m_tileUniformSpacingFlag) 3256 { 3257 maxTileWidth = m_uiMaxCUWidth*((widthInCU+m_numTileColumnsMinus1)/(m_numTileColumnsMinus1+1)); 3258 maxTileHeight = m_uiMaxCUHeight*((heightInCU+m_numTileRowsMinus1)/(m_numTileRowsMinus1+1)); 2609 3259 // if only the last tile-row is one treeblock higher than the others 2610 3260 // the maxTileHeight becomes smaller if the last row of treeblocks has lower height than the others 2611 if(!((heightInCU-1)%(m_ iNumRowsMinus1+1)))3261 if(!((heightInCU-1)%(m_numTileRowsMinus1+1))) 2612 3262 { 2613 3263 maxTileHeight = maxTileHeight - m_uiMaxCUHeight + (m_iSourceHeight % m_uiMaxCUHeight); … … 2615 3265 // if only the last tile-column is one treeblock wider than the others 2616 3266 // the maxTileWidth becomes smaller if the last column of treeblocks has lower width than the others 2617 if(!((widthInCU-1)%(m_ iNumColumnsMinus1+1)))3267 if(!((widthInCU-1)%(m_numTileColumnsMinus1+1))) 2618 3268 { 2619 3269 maxTileWidth = maxTileWidth - m_uiMaxCUWidth + (m_iSourceWidth % m_uiMaxCUWidth); … … 2622 3272 else // not uniform spacing 2623 3273 { 2624 if(m_ iNumColumnsMinus1<1)3274 if(m_numTileColumnsMinus1<1) 2625 3275 { 2626 3276 maxTileWidth = m_iSourceWidth; … … 2629 3279 { 2630 3280 Int accColumnWidth = 0; 2631 for(Int col=0; col<(m_ iNumColumnsMinus1); col++)3281 for(Int col=0; col<(m_numTileColumnsMinus1); col++) 2632 3282 { 2633 maxTileWidth = m_ pColumnWidth[col]>maxTileWidth ? m_pColumnWidth[col]:maxTileWidth;2634 accColumnWidth += m_ pColumnWidth[col];3283 maxTileWidth = m_tileColumnWidth[col]>maxTileWidth ? m_tileColumnWidth[col]:maxTileWidth; 3284 accColumnWidth += m_tileColumnWidth[col]; 2635 3285 } 2636 3286 maxTileWidth = (widthInCU-accColumnWidth)>maxTileWidth ? m_uiMaxCUWidth*(widthInCU-accColumnWidth):m_uiMaxCUWidth*maxTileWidth; 2637 3287 } 2638 if(m_ iNumRowsMinus1<1)3288 if(m_numTileRowsMinus1<1) 2639 3289 { 2640 3290 maxTileHeight = m_iSourceHeight; … … 2643 3293 { 2644 3294 Int accRowHeight = 0; 2645 for(Int row=0; row<(m_ iNumRowsMinus1); row++)3295 for(Int row=0; row<(m_numTileRowsMinus1); row++) 2646 3296 { 2647 maxTileHeight = m_ pRowHeight[row]>maxTileHeight ? m_pRowHeight[row]:maxTileHeight;2648 accRowHeight += m_ pRowHeight[row];3297 maxTileHeight = m_tileRowHeight[row]>maxTileHeight ? m_tileRowHeight[row]:maxTileHeight; 3298 accRowHeight += m_tileRowHeight[row]; 2649 3299 } 2650 3300 maxTileHeight = (heightInCU-accRowHeight)>maxTileHeight ? m_uiMaxCUHeight*(heightInCU-accRowHeight):m_uiMaxCUHeight*maxTileHeight; … … 2670 3320 } 2671 3321 #endif 3322 #if !SVC_EXTENSION 2672 3323 xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); 2673 #if !SVC_EXTENSION2674 3324 xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); 2675 3325 xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_iWaveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); … … 2703 3353 } 2704 3354 #endif 3355 #if Q0074_COLOUR_REMAPPING_SEI 3356 #if !SVC_EXTENSION 3357 if ( ( m_colourRemapSEIFile.size() > 0 ) && !m_colourRemapSEICancelFlag ) 3358 { 3359 xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive"); 3360 xConfirmPara( m_colourRemapSEIBitDepth < 8 || m_colourRemapSEIBitDepth > 16, "colour_remap_bit_depth shall be in the range of 8 to 16, inclusive"); 3361 for( Int c=0 ; c<3 ; c++) 3362 { 3363 xConfirmPara( m_colourRemapSEIPreLutNumValMinus1[c] < 0 || m_colourRemapSEIPreLutNumValMinus1[c] > 32, "pre_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive"); 3364 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 3365 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++) 3366 { 3367 xConfirmPara( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEIInputBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_input_bit_depth)-1, inclusive"); 3368 xConfirmPara( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); 3369 } 3370 xConfirmPara( m_colourRemapSEIPostLutNumValMinus1[c] < 0 || m_colourRemapSEIPostLutNumValMinus1[c] > 32, "post_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive"); 3371 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 3372 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++) 3373 { 3374 xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); 3375 xConfirmPara( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); 3376 } 3377 } 3378 if ( m_colourRemapSEIMatrixPresentFlag ) 3379 { 3380 xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive"); 3381 for( Int c=0 ; c<3 ; c++) 3382 for( Int i=0 ; i<3 ; i++) 3383 xConfirmPara( m_colourRemapSEICoeffs[c][i] < -32768 || m_colourRemapSEICoeffs[c][i] > 32767, "colour_remap_coeffs[c][i] shall be in the range of -32768 and 32767, inclusive"); 3384 } 3385 } 3386 #endif 3387 #endif 2705 3388 2706 3389 #if RC_SHVC_HARMONIZATION … … 2909 3592 printf("Scalable : %d\n", m_scalabilityMask[SCALABILITY_ID] ); 2910 3593 #if AVC_BASE 3594 #if VPS_AVC_BL_FLAG_REMOVAL 3595 printf("Base layer : %s\n", m_nonHEVCBaseLayerFlag ? "Non-HEVC" : "HEVC"); 3596 #else 2911 3597 printf("Base layer : %s\n", m_avcBaseLayerFlag ? "AVC" : "HEVC"); 3598 #endif 2912 3599 #endif 2913 3600 #if AUXILIARY_PICTURES … … 2933 3620 { 2934 3621 printf("=== Layer %d settings === \n", layer); 2935 #if AVC_SYNTAX2936 m_acLayerCfg[layer].xPrintParameter( layer );2937 #else2938 3622 m_acLayerCfg[layer].xPrintParameter(); 2939 #endif2940 3623 printf("\n"); 2941 3624 } 2942 3625 printf("=== Common configuration settings === \n"); 2943 3626 printf("Bitstream File : %s\n", m_pBitstreamFile ); 2944 #else 3627 #else //SVC_EXTENSION 2945 3628 printf("Input File : %s\n", m_pchInputFile ); 2946 3629 printf("Bitstream File : %s\n", m_pchBitstreamFile ); 2947 3630 printf("Reconstruction File : %s\n", m_pchReconFile ); 2948 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_conf Left - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );3631 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate ); 2949 3632 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 2950 #endif 3633 #endif //SVC_EXTENSION 2951 3634 if (m_isField) 2952 3635 { … … 3084 3767 printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit ); 3085 3768 #endif 3769 #if R0151_CGS_3D_ASYMLUT_IMPROVE 3770 printf("CGSAdaptC:%d " , m_nCGSAdaptiveChroma ); 3771 #endif 3772 #if R0179_ENC_OPT_3DLUT_SIZE 3773 printf("CGSSizeRDO:%d " , m_nCGSLutSizeRDO ); 3774 #endif 3775 3086 3776 printf("\n\n"); 3087 3777 … … 3099 3789 3100 3790 #if SVC_EXTENSION 3791 #if OUTPUT_LAYER_SETS_CONFIG 3792 Void TAppEncCfg::cfgStringToArray(Int **arr, string const cfgString, Int const numEntries, const char* logString) 3793 #else 3101 3794 Void TAppEncCfg::cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString) 3795 #endif 3102 3796 { 3103 3797 Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str()); … … 3108 3802 *arr = new Int[numEntries]; 3109 3803 3804 #if OUTPUT_LAYER_SETS_CONFIG 3805 if( tempChar == NULL ) 3806 { 3807 arrayEntry = NULL; 3808 } 3809 else 3810 { 3811 arrayEntry = strtok( tempChar, " ,"); 3812 } 3813 #else 3110 3814 arrayEntry = strtok( tempChar, " ,"); 3815 #endif 3111 3816 while(arrayEntry != NULL) 3112 3817 { … … 3130 3835 *arr = NULL; 3131 3836 } 3837 3838 if( tempChar ) 3839 { 3840 free( tempChar ); 3841 tempChar = NULL; 3842 } 3132 3843 } 3133 3844 3845 #if OUTPUT_LAYER_SETS_CONFIG 3846 Bool TAppEncCfg::scanStringToArray(string const cfgString, Int const numEntries, const char* logString, Int * const returnArray) 3847 { 3848 Int *tempArray = NULL; 3849 // For all layer sets 3850 cfgStringToArray( &tempArray, cfgString, numEntries, logString ); 3851 if(tempArray) 3852 { 3853 for(Int i = 0; i < numEntries; i++) 3854 { 3855 returnArray[i] = tempArray[i]; 3856 } 3857 delete [] tempArray; tempArray = NULL; 3858 return true; 3859 } 3860 return false; 3861 } 3862 Bool TAppEncCfg::scanStringToArray(string const cfgString, Int const numEntries, const char* logString, std::vector<Int> & returnVector) 3863 { 3864 Int *tempArray = NULL; 3865 // For all layer sets 3866 cfgStringToArray( &tempArray, cfgString, numEntries, logString ); 3867 if(tempArray) 3868 { 3869 returnVector.empty(); 3870 for(Int i = 0; i < numEntries; i++) 3871 { 3872 returnVector.push_back(tempArray[i]); 3873 } 3874 delete [] tempArray; tempArray = NULL; 3875 return true; 3876 } 3877 return false; 3878 } 3879 #endif 3134 3880 #endif //SVC_EXTENSION 3135 3881 //! \} -
trunk/source/App/TAppEncoder/TAppEncCfg.h
r815 r906 46 46 #endif 47 47 #include <sstream> 48 #include <vector> 48 49 //! \ingroup TAppEncoder 49 50 //! \{ … … 68 69 Int m_framesToBeEncoded; ///< number of encoded frames 69 70 #if AVC_BASE 71 #if VPS_AVC_BL_FLAG_REMOVAL 72 Int m_nonHEVCBaseLayerFlag; ///< non HEVC BL 73 #else 70 74 Int m_avcBaseLayerFlag; ///< avc_baselayer_flag 71 75 #endif 72 #if AVC_SYNTAX73 Char* m_BLSyntaxFile; ///< input syntax file74 76 #endif 75 77 Bool m_maxTidRefPresentFlag; … … 81 83 Int m_numHighestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1]; 82 84 Int m_highestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1]; 85 #endif 86 #if OUTPUT_LAYER_SETS_CONFIG 87 std::vector<Int> m_outputLayerSetIdx; 88 Int m_defaultTargetOutputLayerIdc; 89 Int m_numOutputLayerSets; 90 std::vector<Int> m_numLayersInOutputLayerSet; 91 std::vector< std::vector<Int> > m_listOfOutputLayers; 83 92 #endif 84 93 #else … … 96 105 97 106 98 Int m_conformance Mode;99 Int m_conf Left;100 Int m_conf Right;101 Int m_conf Top;102 Int m_conf Bottom;107 Int m_conformanceWindowMode; 108 Int m_confWinLeft; 109 Int m_confWinRight; 110 Int m_confWinTop; 111 Int m_confWinBottom; 103 112 Int m_framesToBeEncoded; ///< number of encoded frames 104 113 Int m_aiPad[2]; ///< number of padded pixels for width and height … … 222 231 Bool m_useRDOQ; ///< flag for using RD optimized quantization 223 232 Bool m_useRDOQTS; ///< flag for using RD optimized quantization for transform skip 224 Int m_rdPenalty; ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty)233 Int m_rdPenalty; ///< RD-penalty for 32x32 TU for intra in non-intra slices (0: no RD-penalty, 1: RD-penalty, 2: maximum RD-penalty) 225 234 Int m_iFastSearch; ///< ME mode, 0 = full, 1 = diamond, 2 = PMVFAST 226 235 Int m_iSearchRange; ///< ME search range … … 243 252 Bool m_bLFCrossSliceBoundaryFlag; ///< 1: filter across slice boundaries 0: do not filter across slice boundaries 244 253 Bool m_bLFCrossTileBoundaryFlag; ///< 1: filter across tile boundaries 0: do not filter across tile boundaries 245 Int m_iUniformSpacingIdr; 246 Int m_iNumColumnsMinus1; 247 Char* m_pchColumnWidth; 248 Int m_iNumRowsMinus1; 249 Char* m_pchRowHeight; 250 UInt* m_pColumnWidth; 251 UInt* m_pRowHeight; 254 Bool m_tileUniformSpacingFlag; 255 Int m_numTileColumnsMinus1; 256 Int m_numTileRowsMinus1; 257 std::vector<Int> m_tileColumnWidth; 258 std::vector<Int> m_tileRowHeight; 259 #if !SVC_EXTENSION 252 260 Int m_iWaveFrontSynchro; //< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current. 253 #if !SVC_EXTENSION254 261 Int m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). 255 262 #endif 256 257 263 Bool m_bUseConstrainedIntraPred; ///< flag for using constrained intra prediction 258 259 264 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 260 265 Int m_recoveryPointSEIEnabled; … … 288 293 Int* m_codedPivotValue; 289 294 Int* m_targetPivotValue; 290 #if Q0074_SEI_COLOR_MAPPING291 Char* m_pchSEIColorMappingFile; ///< SEI Color Mapping File (initialized from external file)292 #endif293 295 Int m_framePackingSEIEnabled; 294 296 Int m_framePackingSEIType; … … 377 379 Int m_elRapSliceBEnabled; 378 380 #endif 381 #if Q0074_COLOUR_REMAPPING_SEI 382 #if !SVC_EXTENSION 383 string m_colourRemapSEIFile; 384 Int m_colourRemapSEIId; 385 Bool m_colourRemapSEICancelFlag; 386 Bool m_colourRemapSEIPersistenceFlag; 387 Bool m_colourRemapSEIVideoSignalInfoPresentFlag; 388 Bool m_colourRemapSEIFullRangeFlag; 389 Int m_colourRemapSEIPrimaries; 390 Int m_colourRemapSEITransferFunction; 391 Int m_colourRemapSEIMatrixCoefficients; 392 Int m_colourRemapSEIInputBitDepth; 393 Int m_colourRemapSEIBitDepth; 394 Int m_colourRemapSEIPreLutNumValMinus1[3]; 395 Int* m_colourRemapSEIPreLutCodedValue[3]; 396 Int* m_colourRemapSEIPreLutTargetValue[3]; 397 Bool m_colourRemapSEIMatrixPresentFlag; 398 Int m_colourRemapSEILog2MatrixDenom; 399 Int m_colourRemapSEICoeffs[3][3]; 400 Int m_colourRemapSEIPostLutNumValMinus1[3]; 401 Int* m_colourRemapSEIPostLutCodedValue[3]; 402 Int* m_colourRemapSEIPostLutTargetValue[3]; 403 #endif 404 #endif 379 405 // internal member functions 380 406 #if LAYER_CTB … … 439 465 Int m_nCGSMaxYPartNumLog2; 440 466 Int m_nCGSLUTBit; 441 #endif 467 #if R0151_CGS_3D_ASYMLUT_IMPROVE 468 Int m_nCGSAdaptiveChroma; 469 #endif 470 #if R0179_ENC_OPT_3DLUT_SIZE 471 Int m_nCGSLutSizeRDO; 472 #endif 473 #endif 442 474 #endif //SVC_EXTENSION 443 475 public: … … 468 500 #endif 469 501 Int getDecodingRefreshType() {return m_iDecodingRefreshType; } 470 Int getWaveFrontSynchro( ) { return m_iWaveFrontSynchro; }502 Int getWaveFrontSynchro(Int layerId) { return m_acLayerCfg[layerId].m_waveFrontSynchro; } 471 503 Void getDirFilename(string& filename, string& dir, const string path); 472 #if AVC_SYNTAX 473 Char* getBLSyntaxFile() { return m_BLSyntaxFile; } 474 #endif 504 #if OUTPUT_LAYER_SETS_CONFIG 505 Bool scanStringToArray(string const cfgString, Int const numEntries, const char* logString, Int * const returnArray); 506 Bool scanStringToArray(string const cfgString, Int const numEntries, const char* logString, std::vector<Int> & returnVector); 507 Void cfgStringToArray(Int **arr, string const cfgString, Int const numEntries, const char* logString); 508 #else 475 509 Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString); 510 #endif 476 511 #if REPN_FORMAT_IN_VPS 477 512 RepFormatCfg* getRepFormatCfg(Int i) { return &m_repFormatCfg[i]; } -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp
r713 r906 49 49 , m_repFormatIdx (-1) 50 50 #endif 51 { 52 m_confLeft = m_confRight = m_confTop = m_confBottom = 0; 51 #if Q0074_COLOUR_REMAPPING_SEI 52 , m_colourRemapSEIFile(string("")) 53 #endif 54 { 55 #if Q0074_COLOUR_REMAPPING_SEI 56 for( Int c=0 ; c<3 ; c++) 57 { 58 m_colourRemapSEIPreLutCodedValue[c] = NULL; 59 m_colourRemapSEIPreLutTargetValue[c] = NULL; 60 m_colourRemapSEIPostLutCodedValue[c] = NULL; 61 m_colourRemapSEIPostLutTargetValue[c] = NULL; 62 } 63 #endif 64 m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0; 53 65 m_aiPad[1] = m_aiPad[0] = 0; 54 66 m_numScaledRefLayerOffsets = 0; … … 60 72 ::memset(m_scaledRefLayerRightOffset, 0, sizeof(m_scaledRefLayerRightOffset)); 61 73 ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset)); 74 #if REF_REGION_OFFSET 75 ::memset(m_scaledRefLayerOffsetPresentFlag, 0, sizeof(m_scaledRefLayerOffsetPresentFlag)); 76 ::memset(m_refRegionOffsetPresentFlag, 0, sizeof(m_refRegionOffsetPresentFlag)); 77 ::memset(m_refRegionLeftOffset, 0, sizeof(m_refRegionLeftOffset)); 78 ::memset(m_refRegionTopOffset, 0, sizeof(m_refRegionTopOffset)); 79 ::memset(m_refRegionRightOffset, 0, sizeof(m_refRegionRightOffset)); 80 ::memset(m_refRegionBottomOffset, 0, sizeof(m_refRegionBottomOffset)); 81 #endif 82 #if R0209_GENERIC_PHASE 83 ::memset(m_resamplePhaseSetPresentFlag, 0, sizeof(m_resamplePhaseSetPresentFlag)); 84 ::memset(m_phaseHorLuma, 0, sizeof(m_phaseHorLuma)); 85 ::memset(m_phaseVerLuma, 0, sizeof(m_phaseVerLuma)); 86 ::memset(m_phaseHorChroma, 0, sizeof(m_phaseHorChroma)); 87 ::memset(m_phaseVerChroma, 0, sizeof(m_phaseVerChroma)); 88 #else 62 89 #if P0312_VERT_PHASE_ADJ 63 90 ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag)); 64 91 #endif 92 #endif 65 93 } 66 94 … … 71 99 delete[] m_aidQP; 72 100 } 101 #if Q0074_COLOUR_REMAPPING_SEI 102 for( Int c=0 ; c<3 ; c++) 103 { 104 if ( m_colourRemapSEIPreLutCodedValue[c] ) 105 { 106 delete[] m_colourRemapSEIPreLutCodedValue[c]; 107 } 108 if ( m_colourRemapSEIPreLutTargetValue[c] ) 109 { 110 delete[] m_colourRemapSEIPreLutTargetValue[c]; 111 } 112 if ( m_colourRemapSEIPostLutCodedValue[c] ) 113 { 114 delete[] m_colourRemapSEIPostLutCodedValue[c]; 115 } 116 if ( m_colourRemapSEIPostLutTargetValue[c] ) 117 { 118 delete[] m_colourRemapSEIPostLutTargetValue[c]; 119 } 120 } 121 #endif 73 122 } 74 123 … … 98 147 Int tmpInputChromaFormat; 99 148 Int tmpChromaFormat; 149 #endif 150 #if Q0074_COLOUR_REMAPPING_SEI 151 string cfg_colourRemapSEIFile; 100 152 #endif 101 153 … … 114 166 ("ChromaFormatIDC", tmpChromaFormat, 420, "ChromaFormatIDC (400|420|422|444 or set 0 (default) for same as InputChromaFormat)") 115 167 #endif 116 ("CropLeft", m_confLeft, 0, "Left cropping/padding for cropping mode 3") 117 ("CropRight", m_confRight, 0, "Right cropping/padding for cropping mode 3") 118 ("CropTop", m_confTop, 0, "Top cropping/padding for cropping mode 3") 119 ("CropBottom", m_confBottom, 0, "Bottom cropping/padding for cropping mode 3") 168 ("ConfLeft", m_confWinLeft, 0, "Deprecated alias of ConfWinLeft") 169 ("ConfRight", m_confWinRight, 0, "Deprecated alias of ConfWinRight") 170 ("ConfTop", m_confWinTop, 0, "Deprecated alias of ConfWinTop") 171 ("ConfBottom", m_confWinBottom, 0, "Deprecated alias of ConfWinBottom") 172 ("ConfWinLeft", m_confWinLeft, 0, "Left offset for window conformance mode 3") 173 ("ConfWinRight", m_confWinRight, 0, "Right offset for window conformance mode 3") 174 ("ConfWinTop", m_confWinTop, 0, "Top offset for window conformance mode 3") 175 ("ConfWinBottom", m_confWinBottom, 0, "Bottom offset for window conformance mode 3") 120 176 ("HorizontalPadding,-pdx",m_aiPad[0], 0, "horizontal source padding for cropping mode 2") 121 177 ("VerticalPadding,-pdy", m_aiPad[1], 0, "vertical source padding for cropping mode 2") … … 124 180 ("dQPFile,m", cfg_dQPFile, string(""), "dQP file name") 125 181 ("QP,q", m_fQP, 30.0, "Qp value, if value is float, QP is switched once during encoding") 126 ; 182 #if Q0074_COLOUR_REMAPPING_SEI 183 ("SEIColourRemappingInfoFile", cfg_colourRemapSEIFile, string(""), "Colour Remapping Information SEI parameters file name") 184 #endif 185 ; 127 186 128 187 po::setDefaults(opts); … … 136 195 m_chromaFormatIDC = ((tmpChromaFormat == 0) ? (m_InputChromaFormat) : (numberToChromaFormat(tmpChromaFormat))); 137 196 #endif 197 #if Q0074_COLOUR_REMAPPING_SEI 198 m_colourRemapSEIFile = cfg_colourRemapSEIFile.empty() ? NULL : strdup(cfg_colourRemapSEIFile.c_str()); 199 #endif 138 200 139 201 // reading external dQP description from file … … 154 216 } 155 217 } 218 219 #if Q0074_COLOUR_REMAPPING_SEI 220 if( m_colourRemapSEIFile.size() > 0 ) 221 { 222 FILE* fic; 223 Int retval; 224 if((fic = fopen(m_colourRemapSEIFile.c_str(),"r")) == (FILE*)NULL) 225 { 226 fprintf(stderr, "Can't open Colour Remapping Information SEI parameters file %s\n", m_colourRemapSEIFile.c_str()); 227 exit(EXIT_FAILURE); 228 } 229 230 Int tempCode; 231 retval = fscanf( fic, "%d", &m_colourRemapSEIId ); 232 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEICancelFlag = tempCode ? 1 : 0; 233 if( !m_colourRemapSEICancelFlag ) 234 { 235 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIPersistenceFlag = tempCode ? 1 : 0; 236 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIVideoSignalInfoPresentFlag = tempCode ? 1 : 0; 237 if( m_colourRemapSEIVideoSignalInfoPresentFlag ) 238 { 239 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIFullRangeFlag = tempCode ? 1 : 0; 240 retval = fscanf( fic, "%d", &m_colourRemapSEIPrimaries ); 241 retval = fscanf( fic, "%d", &m_colourRemapSEITransferFunction ); 242 retval = fscanf( fic, "%d", &m_colourRemapSEIMatrixCoefficients ); 243 } 244 245 retval = fscanf( fic, "%d", &m_colourRemapSEIInputBitDepth ); 246 retval = fscanf( fic, "%d", &m_colourRemapSEIBitDepth ); 247 248 for( Int c=0 ; c<3 ; c++ ) 249 { 250 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutNumValMinus1[c] ); 251 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 252 { 253 m_colourRemapSEIPreLutCodedValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 254 m_colourRemapSEIPreLutTargetValue[c] = new Int[m_colourRemapSEIPreLutNumValMinus1[c]+1]; 255 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++ ) 256 { 257 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutCodedValue[c][i] ); 258 retval = fscanf( fic, "%d", &m_colourRemapSEIPreLutTargetValue[c][i] ); 259 } 260 } 261 } 262 263 retval = fscanf( fic, "%d", &tempCode );m_colourRemapSEIMatrixPresentFlag = tempCode ? 1 : 0; 264 if( m_colourRemapSEIMatrixPresentFlag ) 265 { 266 retval = fscanf( fic, "%d", &m_colourRemapSEILog2MatrixDenom ); 267 for( Int c=0 ; c<3 ; c++ ) 268 for( Int i=0 ; i<3 ; i++ ) 269 retval = fscanf( fic, "%d", &m_colourRemapSEICoeffs[c][i] ); 270 } 271 272 for( Int c=0 ; c<3 ; c++ ) 273 { 274 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutNumValMinus1[c] ); 275 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 276 { 277 m_colourRemapSEIPostLutCodedValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 278 m_colourRemapSEIPostLutTargetValue[c] = new Int[m_colourRemapSEIPostLutNumValMinus1[c]+1]; 279 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++ ) 280 { 281 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutCodedValue[c][i] ); 282 retval = fscanf( fic, "%d", &m_colourRemapSEIPostLutTargetValue[c][i] ); 283 } 284 } 285 } 286 } 287 288 fclose( fic ); 289 if( retval != 1 ) 290 { 291 fprintf(stderr, "Error while reading Colour Remapping Information SEI parameters file\n"); 292 exit(EXIT_FAILURE); 293 } 294 } 295 #endif 296 156 297 return true; 157 298 } 158 299 159 #if AVC_SYNTAX160 Void TAppEncLayerCfg::xPrintParameter( UInt layerId )161 #else162 300 Void TAppEncLayerCfg::xPrintParameter() 163 #endif164 301 { 165 302 printf("Input File : %s\n", m_cInputFile.c_str() ); 166 303 printf("Reconstruction File : %s\n", m_cReconFile.c_str() ); 167 #if AVC_SYNTAX168 if( layerId == 0 )169 {170 printf("Base layer syntax file : %s\n", m_cAppEncCfg->getBLSyntaxFile() );171 }172 #endif173 304 #if REPN_FORMAT_IN_VPS 174 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - ( m_conf Left + m_confRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confTop + m_confBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate );305 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - ( m_confWinLeft + m_confWinRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confWinTop + m_confWinBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate ); 175 306 #else 176 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_conf Left - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );307 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_confWinLeft - m_confWinRight, m_iSourceHeight - m_confWinTop - m_confWinBottom, m_iFrameRate ); 177 308 #endif 178 309 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); … … 202 333 } 203 334 #endif 204 printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_ cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);335 printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_waveFrontSynchro, m_iWaveFrontSubstreams); 205 336 #if LAYER_CTB 206 337 printf("PCM:%d ", (m_cAppEncCfg->getUsePCM() && (1<<m_cAppEncCfg->getPCMLog2MinSize()) <= m_uiMaxCUWidth)? 1 : 0); … … 217 348 { 218 349 // no cropping or padding 219 m_conf Left = m_confRight = m_confTop = m_confBottom = 0;350 m_confWinLeft = m_confWinRight = m_confWinTop = m_confWinBottom = 0; 220 351 m_aiPad[1] = m_aiPad[0] = 0; 221 352 break; … … 231 362 if (m_iSourceWidth % minCuSize) 232 363 { 233 m_aiPad[0] = m_conf Right = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;234 m_iSourceWidth += m_conf Right;364 m_aiPad[0] = m_confWinRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; 365 m_iSourceWidth += m_confWinRight; 235 366 #if REPN_FORMAT_IN_VPS 236 m_conf Right /= TComSPS::getWinUnitX( m_chromaFormatIDC );367 m_confWinRight /= TComSPS::getWinUnitX( m_chromaFormatIDC ); 237 368 #endif 238 369 } 239 370 if (m_iSourceHeight % minCuSize) 240 371 { 241 m_aiPad[1] = m_conf Bottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;242 m_iSourceHeight += m_conf Bottom;372 m_aiPad[1] = m_confWinBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 373 m_iSourceHeight += m_confWinBottom; 243 374 if ( isField ) 244 375 { 245 m_iSourceHeightOrg += m_conf Bottom << 1;246 m_aiPad[1] = m_conf Bottom << 1;376 m_iSourceHeightOrg += m_confWinBottom << 1; 377 m_aiPad[1] = m_confWinBottom << 1; 247 378 } 248 379 #if REPN_FORMAT_IN_VPS 249 m_conf Bottom /= TComSPS::getWinUnitY( m_chromaFormatIDC );380 m_confWinBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC ); 250 381 #endif 251 382 } … … 257 388 m_iSourceWidth += m_aiPad[0]; 258 389 m_iSourceHeight += m_aiPad[1]; 259 m_conf Right = m_aiPad[0];260 m_conf Bottom = m_aiPad[1];390 m_confWinRight = m_aiPad[0]; 391 m_confWinBottom = m_aiPad[1]; 261 392 #if REPN_FORMAT_IN_VPS 262 m_conf Right /= TComSPS::getWinUnitX( m_chromaFormatIDC );263 m_conf Bottom /= TComSPS::getWinUnitY( m_chromaFormatIDC );393 m_confWinRight /= TComSPS::getWinUnitX( m_chromaFormatIDC ); 394 m_confWinBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC ); 264 395 #endif 265 396 break; … … 268 399 { 269 400 // conformance 270 if ((m_conf Left == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0))401 if ((m_confWinLeft == 0) && (m_confWinRight == 0) && (m_confWinTop == 0) && (m_confWinBottom == 0)) 271 402 { 272 403 fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); … … 333 464 #endif 334 465 335 336 m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1;466 m_iWaveFrontSubstreams = m_waveFrontSynchro ? (m_iSourceHeight + maxCUHeight - 1) / maxCUHeight : 1; 467 xConfirmPara( m_waveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" ); 337 468 xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); 338 xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_ cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" );469 xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_waveFrontSynchro, "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" ); 339 470 340 471 //chekc parameters … … 386 517 } 387 518 #endif 519 #if Q0074_COLOUR_REMAPPING_SEI 520 if ( ( m_colourRemapSEIFile.size() > 0 ) && !m_colourRemapSEICancelFlag ) 521 { 522 xConfirmPara( m_colourRemapSEIInputBitDepth < 8 || m_colourRemapSEIInputBitDepth > 16 , "colour_remap_input_bit_depth shall be in the range of 8 to 16, inclusive"); 523 xConfirmPara( m_colourRemapSEIBitDepth < 8 || m_colourRemapSEIBitDepth > 16, "colour_remap_bit_depth shall be in the range of 8 to 16, inclusive"); 524 for( Int c=0 ; c<3 ; c++) 525 { 526 xConfirmPara( m_colourRemapSEIPreLutNumValMinus1[c] < 0 || m_colourRemapSEIPreLutNumValMinus1[c] > 32, "pre_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive"); 527 if( m_colourRemapSEIPreLutNumValMinus1[c]>0 ) 528 for( Int i=0 ; i<=m_colourRemapSEIPreLutNumValMinus1[c] ; i++) 529 { 530 xConfirmPara( m_colourRemapSEIPreLutCodedValue[c][i] < 0 || m_colourRemapSEIPreLutCodedValue[c][i] > ((1<<m_colourRemapSEIInputBitDepth)-1), "pre_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_input_bit_depth)-1, inclusive"); 531 xConfirmPara( m_colourRemapSEIPreLutTargetValue[c][i] < 0 || m_colourRemapSEIPreLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "pre_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); 532 } 533 xConfirmPara( m_colourRemapSEIPostLutNumValMinus1[c] < 0 || m_colourRemapSEIPostLutNumValMinus1[c] > 32, "post_lut_num_val_minus1[c] shall be in the range of 0 to 32, inclusive"); 534 if( m_colourRemapSEIPostLutNumValMinus1[c]>0 ) 535 for( Int i=0 ; i<=m_colourRemapSEIPostLutNumValMinus1[c] ; i++) 536 { 537 xConfirmPara( m_colourRemapSEIPostLutCodedValue[c][i] < 0 || m_colourRemapSEIPostLutCodedValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_coded_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); 538 xConfirmPara( m_colourRemapSEIPostLutTargetValue[c][i] < 0 || m_colourRemapSEIPostLutTargetValue[c][i] > ((1<<m_colourRemapSEIBitDepth)-1), "post_lut_target_value[c][i] shall be in the range of 0 to (1<<colour_remap_bit_depth)-1, inclusive"); 539 } 540 } 541 if( m_colourRemapSEIMatrixPresentFlag ) 542 { 543 xConfirmPara( m_colourRemapSEILog2MatrixDenom < 0 || m_colourRemapSEILog2MatrixDenom > 15, "log2_matrix_denom shall be in the range of 0 to 15, inclusive"); 544 for( Int c=0 ; c<3 ; c++) 545 for( Int i=0 ; i<3 ; i++) 546 xConfirmPara( m_colourRemapSEICoeffs[c][i] < -32768 || m_colourRemapSEICoeffs[c][i] > 32767, "colour_remap_coeffs[c][i] shall be in the range of -32768 and 32767, inclusive"); 547 } 548 } 549 #endif 388 550 389 551 #undef xConfirmPara -
trunk/source/App/TAppEncoder/TAppEncLayerCfg.h
r815 r906 35 35 Int m_iSourceHeightOrg; ///< original source height in pixel (when interlaced = frame height) 36 36 Int m_conformanceMode; 37 Int m_conf Left;38 Int m_conf Right;39 Int m_conf Top;40 Int m_conf Bottom;37 Int m_confWinLeft; 38 Int m_confWinRight; 39 Int m_confWinTop; 40 Int m_confWinBottom; 41 41 Int m_aiPad[2]; ///< number of padded pixels for width and height 42 42 Int m_iIntraPeriod; ///< period of I-slice (random access period) … … 54 54 Int *m_predLayerIds; 55 55 Int m_numActiveRefLayers; 56 #endif57 #if Q0074_SEI_COLOR_MAPPING58 string m_cSeiColorMappingFile;59 56 #endif 60 57 … … 84 81 85 82 Int m_maxTidIlRefPicsPlus1; 86 Int m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). 83 Int m_waveFrontSynchro; ///< 0: no WPP. >= 1: WPP is enabled, the "Top right" from which inheritance occurs is this LCU offset in the line above the current. 84 Int m_iWaveFrontSubstreams; ///< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles). 87 85 88 86 Int m_iQP; ///< QP value of key-picture (integer) … … 98 96 Int m_scaledRefLayerRightOffset [MAX_LAYERS]; 99 97 Int m_scaledRefLayerBottomOffset[MAX_LAYERS]; 100 #if P0312_VERT_PHASE_ADJ 98 #if REF_REGION_OFFSET 99 Bool m_scaledRefLayerOffsetPresentFlag [MAX_LAYERS]; 100 Bool m_refRegionOffsetPresentFlag [MAX_LAYERS]; 101 Int m_refRegionLeftOffset [MAX_LAYERS]; 102 Int m_refRegionTopOffset [MAX_LAYERS]; 103 Int m_refRegionRightOffset [MAX_LAYERS]; 104 Int m_refRegionBottomOffset[MAX_LAYERS]; 105 #endif 106 #if P0312_VERT_PHASE_ADJ 101 107 Bool m_vertPhasePositionEnableFlag[MAX_LAYERS]; 108 #endif 109 #if R0209_GENERIC_PHASE 110 Int m_phaseHorLuma [MAX_LAYERS]; 111 Int m_phaseVerLuma [MAX_LAYERS]; 112 Int m_phaseHorChroma[MAX_LAYERS]; 113 Int m_phaseVerChroma[MAX_LAYERS]; 114 Bool m_resamplePhaseSetPresentFlag [MAX_LAYERS]; 102 115 #endif 103 116 … … 113 126 Int m_repFormatIdx; 114 127 #endif 128 #if Q0074_COLOUR_REMAPPING_SEI 129 string m_colourRemapSEIFile; ///< Colour Remapping Information SEI message parameters file 130 Int m_colourRemapSEIId; 131 Bool m_colourRemapSEICancelFlag; 132 Bool m_colourRemapSEIPersistenceFlag; 133 Bool m_colourRemapSEIVideoSignalInfoPresentFlag; 134 Bool m_colourRemapSEIFullRangeFlag; 135 Int m_colourRemapSEIPrimaries; 136 Int m_colourRemapSEITransferFunction; 137 Int m_colourRemapSEIMatrixCoefficients; 138 Int m_colourRemapSEIInputBitDepth; 139 Int m_colourRemapSEIBitDepth; 140 Int m_colourRemapSEIPreLutNumValMinus1[3]; 141 Int* m_colourRemapSEIPreLutCodedValue[3]; 142 Int* m_colourRemapSEIPreLutTargetValue[3]; 143 Bool m_colourRemapSEIMatrixPresentFlag; 144 Int m_colourRemapSEILog2MatrixDenom; 145 Int m_colourRemapSEICoeffs[3][3]; 146 Int m_colourRemapSEIPostLutNumValMinus1[3]; 147 Int* m_colourRemapSEIPostLutCodedValue[3]; 148 Int* m_colourRemapSEIPostLutTargetValue[3]; 149 #endif 150 115 151 public: 116 152 TAppEncLayerCfg(); … … 122 158 bool parseCfg ( const string& cfgFileName ); ///< parse layer configuration file to fill member variables 123 159 124 #if AVC_SYNTAX125 Void xPrintParameter( UInt layerId );126 #else127 160 Void xPrintParameter(); 128 #endif129 161 Bool xCheckParameter( Bool isField ); 130 162 … … 140 172 Int* getPad() {return m_aiPad; } 141 173 Double getFloatQP() {return m_fQP; } 142 Int getConf Left() {return m_confLeft; }143 Int getConf Right() {return m_confRight; }144 Int getConf Top() {return m_confTop; }145 Int getConf Bottom() {return m_confBottom; }174 Int getConfWinLeft() {return m_confWinLeft; } 175 Int getConfWinRight() {return m_confWinRight; } 176 Int getConfWinTop() {return m_confWinTop; } 177 Int getConfWinBottom() {return m_confWinBottom; } 146 178 #if AUXILIARY_PICTURES 147 179 ChromaFormat getInputChromaFormat() {return m_InputChromaFormat;} -
trunk/source/App/TAppEncoder/TAppEncTop.cpp
r815 r906 77 77 TComVPS* vps = m_acTEncTop[0].getVPS(); 78 78 79 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 80 vps->setVpsPocLsbAlignedFlag(false); 81 #endif 79 82 vps->setMaxTLayers ( m_maxTempLayer ); 80 83 if (m_maxTempLayer == 1) … … 181 184 repFormat->setBitDepthVpsChroma ( getInternalBitDepthC() ); // Need modification to change for each layer 182 185 #endif 186 187 #if R0156_CONF_WINDOW_IN_REP_FORMAT 188 repFormat->getConformanceWindowVps().setWindow( 189 m_acLayerCfg[mapIdxToLayer[idx]].m_confWinLeft, 190 m_acLayerCfg[mapIdxToLayer[idx]].m_confWinRight, 191 m_acLayerCfg[mapIdxToLayer[idx]].m_confWinTop, 192 m_acLayerCfg[mapIdxToLayer[idx]].m_confWinBottom ); 193 #endif 194 183 195 #if HIGHER_LAYER_IRAP_SKIP_FLAG 184 196 m_acTEncTop[mapIdxToLayer[idx]].setSkipPictureAtArcSwitch( m_skipPictureAtArcSwitch ); … … 213 225 m_acTEncTop[layer].setSourceWidth ( m_acLayerCfg[layer].getSourceWidth() ); 214 226 m_acTEncTop[layer].setSourceHeight ( m_acLayerCfg[layer].getSourceHeight() ); 215 m_acTEncTop[layer].setConformanceMode ( m_acLayerCfg[layer].getConformanceMode() ); 216 m_acTEncTop[layer].setConformanceWindow ( m_acLayerCfg[layer].m_confLeft, m_acLayerCfg[layer].m_confRight, m_acLayerCfg[layer].m_confTop, m_acLayerCfg[layer].m_confBottom ); 227 m_acTEncTop[layer].setConformanceWindow ( m_acLayerCfg[layer].m_confWinLeft, m_acLayerCfg[layer].m_confWinRight, m_acLayerCfg[layer].m_confWinTop, m_acLayerCfg[layer].m_confWinBottom ); 217 228 m_acTEncTop[layer].setFramesToBeEncoded ( m_framesToBeEncoded ); 218 229 … … 226 237 #if REF_IDX_MFM 227 238 #if AVC_BASE 228 m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? AVC_SYNTAX : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers()); 239 #if VPS_AVC_BL_FLAG_REMOVAL 240 m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_nonHEVCBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers()); 241 #else 242 m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_avcBaseLayerFlag ? false : true ) && m_acLayerCfg[layer].getNumMotionPredRefLayers()); 243 #endif 229 244 #else 230 245 m_acTEncTop[layer].setMFMEnabledFlag(layer == 0 ? false : ( m_acLayerCfg[layer].getNumMotionPredRefLayers() > 0 ) ); … … 352 367 } 353 368 } 369 #if REF_REGION_OFFSET 370 for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) 371 { 372 #if AUXILIARY_PICTURES 373 Int cf = m_acLayerCfg[i].m_chromaFormatIDC; 374 Int rlSubWidthC = ( cf == CHROMA_420 || cf == CHROMA_422 ) ? 2 : 1; 375 Int rlSubHeightC = ( cf == CHROMA_420 ) ? 2 : 1; 376 #else 377 Int rlSubWidthC = 2; 378 Int rlSubHeightC = 2; 379 #endif 380 m_acTEncTop[layer].setRefRegionOffsetPresentFlag( i, m_acLayerCfg[layer].m_refRegionOffsetPresentFlag ); 381 m_acTEncTop[layer].getRefLayerWindow(i).setWindow( rlSubWidthC * m_acLayerCfg[layer].m_refRegionLeftOffset[i], rlSubWidthC * m_acLayerCfg[layer].m_refRegionRightOffset[i], 382 rlSubHeightC * m_acLayerCfg[layer].m_refRegionTopOffset[i], rlSubHeightC * m_acLayerCfg[layer].m_refRegionBottomOffset[i]); 383 } 384 #endif 385 } 386 else 387 { 388 assert( layer == 0 ); 389 m_acTEncTop[layer].setNumDirectRefLayers(0); 354 390 } 355 391 #endif //VPS_EXTN_DIRECT_REF_LAYERS … … 514 550 m_acTEncTop[layer].setKneeSEIOutputKneePoint ( m_kneeSEIOutputKneePoint ); 515 551 #endif 516 #if Q0074_SEI_COLOR_MAPPING 517 m_acTEncTop[layer].setColorMappingInfoSEIFile ( m_acLayerCfg[layer].m_cSeiColorMappingFile.empty() ? NULL : const_cast<Char *>(m_acLayerCfg[layer].m_cSeiColorMappingFile.c_str()) ); 552 #if Q0074_COLOUR_REMAPPING_SEI 553 m_acTEncTop[layer].setCRISEIFile ( const_cast<Char*>(m_acLayerCfg[layer].m_colourRemapSEIFile.c_str()) ); 554 m_acTEncTop[layer].setCRISEIId ( m_acLayerCfg[layer].m_colourRemapSEIId ); 555 m_acTEncTop[layer].setCRISEICancelFlag ( m_acLayerCfg[layer].m_colourRemapSEICancelFlag ); 556 m_acTEncTop[layer].setCRISEIPersistenceFlag ( m_acLayerCfg[layer].m_colourRemapSEIPersistenceFlag ); 557 m_acTEncTop[layer].setCRISEIVideoSignalInfoPresentFlag ( m_acLayerCfg[layer].m_colourRemapSEIVideoSignalInfoPresentFlag ); 558 m_acTEncTop[layer].setCRISEIFullRangeFlag ( m_acLayerCfg[layer].m_colourRemapSEIFullRangeFlag ); 559 m_acTEncTop[layer].setCRISEIPrimaries ( m_acLayerCfg[layer].m_colourRemapSEIPrimaries ); 560 m_acTEncTop[layer].setCRISEITransferFunction ( m_acLayerCfg[layer].m_colourRemapSEITransferFunction ); 561 m_acTEncTop[layer].setCRISEIMatrixCoefficients ( m_acLayerCfg[layer].m_colourRemapSEIMatrixCoefficients ); 562 m_acTEncTop[layer].setCRISEIInputBitDepth ( m_acLayerCfg[layer].m_colourRemapSEIInputBitDepth ); 563 m_acTEncTop[layer].setCRISEIBitDepth ( m_acLayerCfg[layer].m_colourRemapSEIBitDepth ); 564 m_acTEncTop[layer].setCRISEIPreLutNumValMinus1 ( m_acLayerCfg[layer].m_colourRemapSEIPreLutNumValMinus1 ); 565 m_acTEncTop[layer].setCRISEIPreLutCodedValue ( m_acLayerCfg[layer].m_colourRemapSEIPreLutCodedValue ); 566 m_acTEncTop[layer].setCRISEIPreLutTargetValue ( m_acLayerCfg[layer].m_colourRemapSEIPreLutTargetValue ); 567 m_acTEncTop[layer].setCRISEIMatrixPresentFlag ( m_acLayerCfg[layer].m_colourRemapSEIMatrixPresentFlag ); 568 m_acTEncTop[layer].setCRISEILog2MatrixDenom ( m_acLayerCfg[layer].m_colourRemapSEILog2MatrixDenom ); 569 m_acTEncTop[layer].setCRISEICoeffs ( m_acLayerCfg[layer].m_colourRemapSEICoeffs ); 570 m_acTEncTop[layer].setCRISEIPostLutNumValMinus1 ( m_acLayerCfg[layer].m_colourRemapSEIPostLutNumValMinus1 ); 571 m_acTEncTop[layer].setCRISEIPostLutCodedValue ( m_acLayerCfg[layer]. m_colourRemapSEIPostLutCodedValue ); 572 m_acTEncTop[layer].setCRISEIPostLutTargetValue ( m_acLayerCfg[layer].m_colourRemapSEIPostLutTargetValue ); 518 573 #endif 519 574 m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); … … 542 597 m_acTEncTop[layer].setIlcIdc( m_ilcIdc ); 543 598 #endif 544 m_acTEncTop[layer].set UniformSpacingIdr ( m_iUniformSpacingIdr);545 m_acTEncTop[layer].setNumColumnsMinus1 ( m_ iNumColumnsMinus1 );546 m_acTEncTop[layer].setNumRowsMinus1 ( m_ iNumRowsMinus1 );547 if( m_iUniformSpacingIdr==0)548 { 549 m_acTEncTop[layer].setColumnWidth ( m_ pColumnWidth );550 m_acTEncTop[layer].setRowHeight ( m_ pRowHeight );599 m_acTEncTop[layer].setTileUniformSpacingFlag ( m_tileUniformSpacingFlag ); 600 m_acTEncTop[layer].setNumColumnsMinus1 ( m_numTileColumnsMinus1 ); 601 m_acTEncTop[layer].setNumRowsMinus1 ( m_numTileRowsMinus1 ); 602 if(!m_tileUniformSpacingFlag) 603 { 604 m_acTEncTop[layer].setColumnWidth ( m_tileColumnWidth ); 605 m_acTEncTop[layer].setRowHeight ( m_tileRowHeight ); 551 606 } 552 607 m_acTEncTop[layer].xCheckGSParameters(); 553 Int uiTilesCount = (m_iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1);608 Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1); 554 609 if(uiTilesCount == 1) 555 610 { … … 557 612 } 558 613 m_acTEncTop[layer].setLFCrossTileBoundaryFlag( m_bLFCrossTileBoundaryFlag ); 559 m_acTEncTop[layer].setWaveFrontSynchro ( m_ iWaveFrontSynchro );614 m_acTEncTop[layer].setWaveFrontSynchro ( m_acLayerCfg[layer].m_waveFrontSynchro ); 560 615 m_acTEncTop[layer].setWaveFrontSubstreams ( m_acLayerCfg[layer].m_iWaveFrontSubstreams ); 561 616 m_acTEncTop[layer].setTMVPModeId ( m_TMVPModeId ); … … 586 641 m_acTEncTop[layer].setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 587 642 m_acTEncTop[layer].setVuiParametersPresentFlag( m_vuiParametersPresentFlag ); 643 m_acTEncTop[layer].setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag); 588 644 m_acTEncTop[layer].setAspectRatioIdc( m_aspectRatioIdc ); 589 645 m_acTEncTop[layer].setSarWidth( m_sarWidth ); … … 617 673 if( layer > 0 ) 618 674 { 675 #if REF_REGION_OFFSET 676 #if AUXILIARY_PICTURES 677 Int cf = m_acLayerCfg[layer].m_chromaFormatIDC; 678 Int subWidthC = ( cf == CHROMA_420 || cf == CHROMA_422 ) ? 2 : 1; 679 Int subHeightC = ( cf == CHROMA_420 ) ? 2 : 1; 680 #else 681 Int subWidthC = 2; 682 Int subHeightC = 2; 683 #endif 684 #endif 619 685 m_acTEncTop[layer].setNumScaledRefLayerOffsets( m_acLayerCfg[layer].m_numScaledRefLayerOffsets ); 620 686 for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++) … … 623 689 m_acTEncTop[layer].setScaledRefLayerId(i, m_acLayerCfg[layer].m_scaledRefLayerId[i]); 624 690 #endif 691 #if REF_REGION_OFFSET 692 m_acTEncTop[layer].setScaledRefLayerOffsetPresentFlag( i, m_acLayerCfg[layer].m_scaledRefLayerOffsetPresentFlag[i] ); 693 m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( subWidthC * m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], subWidthC * m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i], 694 subHeightC * m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], subHeightC * m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); 695 #else 625 696 #if P0312_VERT_PHASE_ADJ 626 697 m_acTEncTop[layer].setVertPhasePositionEnableFlag( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] ); … … 630 701 m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i], 631 702 2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]); 703 #endif 704 #endif 705 #if R0209_GENERIC_PHASE 706 m_acTEncTop[layer].setResamplePhaseSetPresentFlag( i, m_acLayerCfg[layer].m_resamplePhaseSetPresentFlag[i] ); 707 m_acTEncTop[layer].setPhaseHorLuma( i, m_acLayerCfg[layer].m_phaseHorLuma[i] ); 708 m_acTEncTop[layer].setPhaseVerLuma( i, m_acLayerCfg[layer].m_phaseVerLuma[i] ); 709 m_acTEncTop[layer].setPhaseHorChroma( i, m_acLayerCfg[layer].m_phaseHorChroma[i] ); 710 m_acTEncTop[layer].setPhaseVerChroma( i, m_acLayerCfg[layer].m_phaseVerChroma[i] ); 632 711 #endif 633 712 } … … 650 729 m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 ); 651 730 m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit ); 731 #if R0151_CGS_3D_ASYMLUT_IMPROVE 732 m_acTEncTop[layer].setCGSAdaptChroma( m_nCGSAdaptiveChroma ); 733 #endif 734 #if R0179_ENC_OPT_3DLUT_SIZE 735 m_acTEncTop[layer].setCGSLutSizeRDO( m_nCGSLutSizeRDO ); 736 #endif 652 737 #endif 653 738 #if Q0078_ADD_LAYER_SETS … … 685 770 m_cTEncTop.setSourceWidth ( m_iSourceWidth ); 686 771 m_cTEncTop.setSourceHeight ( m_iSourceHeight ); 687 m_cTEncTop.setConformanceWindow ( m_conf Left, m_confRight, m_confTop, m_confBottom );772 m_cTEncTop.setConformanceWindow ( m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 688 773 m_cTEncTop.setFramesToBeEncoded ( m_framesToBeEncoded ); 689 774 … … 853 938 m_cTEncTop.setKneeSEIOutputKneePoint ( m_kneeSEIOutputKneePoint ); 854 939 #endif 855 #if Q0074_SEI_COLOR_MAPPING 856 m_cTEncTop.setColorMappingInfoSEIFile ( m_pchSEIColorMappingFile ); 940 #if Q0074_COLOUR_REMAPPING_SEI 941 m_cTEncTop.setCRISEIFile ( const_cast<Char*>(m_colourRemapSEIFile.c_str()) ); 942 m_cTEncTop.setCRISEIId ( m_colourRemapSEIId ); 943 m_cTEncTop.setCRISEICancelFlag ( m_colourRemapSEICancelFlag ); 944 m_cTEncTop.setCRISEIPersistenceFlag ( m_colourRemapSEIPersistenceFlag ); 945 m_cTEncTop.setCRISEIVideoSignalInfoPresentFlag ( m_colourRemapSEIVideoSignalInfoPresentFlag ); 946 m_cTEncTop.setCRISEIFullRangeFlag ( m_colourRemapSEIFullRangeFlag ); 947 m_cTEncTop.setCRISEIPrimaries ( m_colourRemapSEIPrimaries ); 948 m_cTEncTop.setCRISEITransferFunction ( m_colourRemapSEITransferFunction ); 949 m_cTEncTop.setCRISEIMatrixCoefficients ( m_colourRemapSEIMatrixCoefficients ); 950 m_cTEncTop.setCRISEIInputBitDepth ( m_colourRemapSEIInputBitDepth ); 951 m_cTEncTop.setCRISEIBitDepth ( m_colourRemapSEIBitDepth ); 952 m_cTEncTop.setCRISEIPreLutNumValMinus1 ( m_colourRemapSEIPreLutNumValMinus1 ); 953 m_cTEncTop.setCRISEIPreLutCodedValue ( m_colourRemapSEIPreLutCodedValue ); 954 m_cTEncTop.setCRISEIPreLutTargetValue ( m_colourRemapSEIPreLutTargetValue ); 955 m_cTEncTop.setCRISEIMatrixPresentFlag ( m_colourRemapSEIMatrixPresentFlag ); 956 m_cTEncTop.setCRISEILog2MatrixDenom ( m_colourRemapSEILog2MatrixDenom ); 957 m_cTEncTop.setCRISEICoeffs ( m_colourRemapSEICoeffs ); 958 m_cTEncTop.setCRISEIPostLutNumValMinus1 ( m_colourRemapSEIPostLutNumValMinus1 ); 959 m_cTEncTop.setCRISEIPostLutCodedValue ( m_colourRemapSEIPostLutCodedValue ); 960 m_cTEncTop.setCRISEIPostLutTargetValue ( m_colourRemapSEIPostLutTargetValue ); 857 961 #endif 858 962 m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled ); … … 870 974 m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled ); 871 975 m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled ); 872 m_cTEncTop.set UniformSpacingIdr ( m_iUniformSpacingIdr);873 m_cTEncTop.setNumColumnsMinus1 ( m_ iNumColumnsMinus1 );874 m_cTEncTop.setNumRowsMinus1 ( m_ iNumRowsMinus1 );875 if( m_iUniformSpacingIdr==0)876 { 877 m_cTEncTop.setColumnWidth ( m_ pColumnWidth );878 m_cTEncTop.setRowHeight ( m_ pRowHeight );976 m_cTEncTop.setTileUniformSpacingFlag ( m_tileUniformSpacingFlag ); 977 m_cTEncTop.setNumColumnsMinus1 ( m_numTileColumnsMinus1 ); 978 m_cTEncTop.setNumRowsMinus1 ( m_numTileRowsMinus1 ); 979 if(!m_tileUniformSpacingFlag) 980 { 981 m_cTEncTop.setColumnWidth ( m_tileColumnWidth ); 982 m_cTEncTop.setRowHeight ( m_tileRowHeight ); 879 983 } 880 984 m_cTEncTop.xCheckGSParameters(); 881 Int uiTilesCount = (m_ iNumRowsMinus1+1) * (m_iNumColumnsMinus1+1);985 Int uiTilesCount = (m_numTileRowsMinus1+1) * (m_numTileColumnsMinus1+1); 882 986 if(uiTilesCount == 1) 883 987 { … … 904 1008 m_cTEncTop.setActiveParameterSetsSEIEnabled ( m_activeParameterSetsSEIEnabled ); 905 1009 m_cTEncTop.setVuiParametersPresentFlag( m_vuiParametersPresentFlag ); 1010 m_cTEncTop.setAspectRatioInfoPresentFlag( m_aspectRatioInfoPresentFlag); 906 1011 m_cTEncTop.setAspectRatioIdc( m_aspectRatioIdc ); 907 1012 m_cTEncTop.setSarWidth( m_sarWidth ); … … 1056 1161 1057 1162 #if Q0078_ADD_LAYER_SETS 1163 #if OUTPUT_LAYER_SETS_CONFIG 1164 if (m_numLayerSets > 1) 1165 { 1166 vps->setNumLayerSets(m_numLayerSets); 1167 #else 1058 1168 if (m_numLayerSets > 0) 1059 1169 { 1060 1170 vps->setNumLayerSets(m_numLayerSets+1); 1171 #endif 1061 1172 for (Int setId = 1; setId < vps->getNumLayerSets(); setId++) 1062 1173 { … … 1068 1179 for (Int setId = 1; setId < vps->getNumLayerSets(); setId++) 1069 1180 { 1181 #if OUTPUT_LAYER_SETS_CONFIG 1182 for (Int i = 0; i < m_numLayerInIdList[setId]; i++) 1183 { 1184 Int layerId = m_layerSetLayerIdList[setId][i]; 1185 #else 1070 1186 for (Int i = 0; i < m_numLayerInIdList[setId-1]; i++) 1071 1187 { 1072 1188 Int layerId = m_layerSetLayerIdList[setId-1][i]; 1073 1189 #endif 1074 1190 #if O0194_DIFFERENT_BITDEPTH_EL_BL 1075 1191 //4 … … 1133 1249 UInt i = 0, dimIdLen = 0; 1134 1250 #if AVC_BASE 1251 #if VPS_AVC_BL_FLAG_REMOVAL 1252 vps->setNonHEVCBaseLayerFlag( m_nonHEVCBaseLayerFlag ); 1253 if ( m_nonHEVCBaseLayerFlag ) 1254 { 1255 vps->setBaseLayerInternalFlag (false); 1256 } 1257 #else 1135 1258 vps->setAvcBaseLayerFlag(m_avcBaseLayerFlag); 1259 #endif 1136 1260 #else 1137 1261 vps->setAvcBaseLayerFlag(false); … … 1200 1324 #endif 1201 1325 #if VPS_TSLAYERS 1202 1203 1204 1205 1206 1207 1326 vps->setMaxTSLayersPresentFlag(true); 1327 1328 for( i = 0; i < vps->getMaxLayers(); i++ ) 1329 { 1330 vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1); 1331 } 1208 1332 #endif 1209 1333 vps->setMaxTidRefPresentFlag(m_maxTidRefPresentFlag); … … 1238 1362 vps->setIlpSshSignalingEnabledFlag(false); 1239 1363 #if VPS_EXTN_PROFILE_INFO 1364 1365 #if LIST_OF_PTL 1366 vps->getPTLForExtnPtr()->resize(1); // Dummy object - unused. 1367 for(i = 0; i < vps->getMaxLayers(); i++) 1368 { 1369 // TODO: The profile tier level have to be given support to be included in the configuration files 1370 if(i == 0) 1371 { 1372 if( vps->getBaseLayerInternalFlag() && vps->getMaxLayers() > 1 ) 1373 { 1374 vps->setProfilePresentFlag(1, false); 1375 vps->getPTLForExtnPtr()->push_back( *(m_acTEncTop[0].getSPS()->getPTL()) ); 1376 } 1377 } 1378 else // i > 0 1379 { 1380 vps->setProfilePresentFlag(i, true); 1381 // Note - may need to be changed for other layer structures. 1382 vps->getPTLForExtnPtr()->push_back( *(m_acTEncTop[0].getSPS()->getPTL()) ); 1383 } 1384 } 1385 #else 1240 1386 vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets()); 1241 1387 for(Int setId = 1; setId < vps->getNumLayerSets(); setId++) … … 1245 1391 *(vps->getPTLForExtn(setId)) = *(m_acTEncTop[setId].getSPS()->getPTL()); 1246 1392 } 1393 #endif 1247 1394 #endif 1248 1395 #if VPS_EXTN_DIRECT_REF_LAYERS … … 1317 1464 #endif 1318 1465 #endif 1466 #if OUTPUT_LAYER_SETS_CONFIG 1467 1468 vps->setDefaultTargetOutputLayerIdc( m_defaultTargetOutputLayerIdc ); // As per configuration file 1469 1470 if( m_numOutputLayerSets == -1 ) // # of output layer sets not specified in the configuration file 1471 { 1472 vps->setNumOutputLayerSets(vps->getNumLayerSets()); 1473 1474 for(i = 1; i < vps->getNumLayerSets(); i++) 1475 { 1476 vps->setOutputLayerSetIdx(i, i); 1477 } 1478 } 1479 else 1480 { 1481 vps->setNumOutputLayerSets( m_numOutputLayerSets ); 1482 for( Int olsCtr = 0; olsCtr < vps->getNumLayerSets(); olsCtr ++ ) // Default output layer sets 1483 { 1484 vps->setOutputLayerSetIdx(olsCtr, olsCtr); 1485 } 1486 for( Int olsCtr = vps->getNumLayerSets(); olsCtr < vps->getNumOutputLayerSets(); olsCtr ++ ) // Non-default output layer sets 1487 { 1488 vps->setOutputLayerSetIdx(olsCtr, m_outputLayerSetIdx[olsCtr - vps->getNumLayerSets()]); 1489 } 1490 } 1491 #endif 1319 1492 // Target output layer 1493 #if LIST_OF_PTL 1494 vps->setNumProfileTierLevel( vps->getPTLForExtnPtr()->size() ); // +1 for the base VPS PTL() 1495 #else 1320 1496 vps->setNumOutputLayerSets(vps->getNumLayerSets()); 1321 1497 vps->setNumProfileTierLevel(vps->getNumLayerSets()); 1498 #endif 1499 #if !OUTPUT_LAYER_SETS_CONFIG // Taken care by configuration file parameter 1322 1500 #if P0295_DEFAULT_OUT_LAYER_IDC 1323 1501 vps->setDefaultTargetOutputLayerIdc(1); … … 1329 1507 #endif 1330 1508 #endif 1509 #endif 1510 #if !PER_LAYER_PTL 1331 1511 for(i = 1; i < vps->getNumLayerSets(); i++) 1332 1512 { 1333 1513 vps->setProfileLevelTierIdx(i, i); 1514 #if !OUTPUT_LAYER_SETS_CONFIG 1334 1515 vps->setOutputLayerSetIdx(i, i); 1516 #endif 1335 1517 } 1518 #endif 1336 1519 #endif 1337 1520 #if VPS_DPB_SIZE_TABLE … … 1347 1530 1348 1531 // derive OutputLayerFlag[i][j] 1532 #if !OUTPUT_LAYER_SETS_CONFIG 1349 1533 if( vps->getDefaultTargetOutputLayerIdc() == 1 ) 1534 #endif 1350 1535 { 1351 1536 // default_output_layer_idc equal to 1 specifies that only the layer with the highest value of nuh_layer_id such that nuh_layer_id equal to nuhLayerIdA and … … 1360 1545 if( vps->getLayerIdIncludedFlag(lsIdx, layer) ) 1361 1546 #endif 1362 { 1547 { 1548 #if OUTPUT_LAYER_SETS_CONFIG 1549 switch(vps->getDefaultTargetOutputLayerIdc()) 1550 { 1551 case 0: vps->setOutputLayerFlag( lsIdx, layer, 1 ); 1552 break; 1553 case 1: vps->setOutputLayerFlag( lsIdx, layer, layer == vps->getNumLayersInIdList(lsIdx) - 1 ); 1554 break; 1555 case 2: 1556 case 3: vps->setOutputLayerFlag( lsIdx, layer, std::find( m_listOfOutputLayers[lsIdx].begin(), m_listOfOutputLayers[lsIdx].end(), layer) != m_listOfOutputLayers[lsIdx].end() ); 1557 break; 1558 } 1559 #else 1363 1560 vps->setOutputLayerFlag( lsIdx, layer, layer == vps->getNumLayersInIdList(lsIdx) - 1 ); 1561 #endif 1364 1562 } 1365 1563 } 1366 1564 } 1367 } 1565 #if OUTPUT_LAYER_SETS_CONFIG 1566 for( Int olsIdx = vps->getNumLayerSets(); olsIdx < vps->getNumOutputLayerSets(); olsIdx++ ) 1567 { 1568 for( UInt layer = 0; layer < vps->getNumLayersInIdList(vps->getOutputLayerSetIdx(olsIdx)); layer++ ) 1569 { 1570 vps->setOutputLayerFlag( olsIdx, layer, std::find( m_listOfOutputLayers[olsIdx].begin(), m_listOfOutputLayers[olsIdx].end(), layer) != m_listOfOutputLayers[olsIdx].end()); 1571 } 1572 } 1573 #endif 1574 } 1575 #if !OUTPUT_LAYER_SETS_CONFIG 1368 1576 else 1369 1577 { … … 1371 1579 assert(!"default_output_layer_idc not equal to 1 is not yet supported"); 1372 1580 } 1373 1581 #endif 1582 #if NECESSARY_LAYER_FLAG 1583 vps->deriveNecessaryLayerFlag(); 1584 vps->checkNecessaryLayerFlagCondition(); 1585 #endif 1586 #if PER_LAYER_PTL 1587 vps->getProfileLevelTierIdx()->resize(vps->getNumOutputLayerSets()); 1588 vps->getProfileLevelTierIdx(0)->push_back( vps->getBaseLayerInternalFlag() && vps->getMaxLayers() > 1 ? 1 : 0 ); // Default 0-th output layer set 1589 for(i = 1; i < vps->getNumOutputLayerSets(); i++) 1590 { 1591 Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i ); 1592 Int numLayerInLayerSet = vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); 1593 for(Int j = 0; j < numLayerInLayerSet; j++) 1594 { 1595 Int layerIdxInVps = vps->getLayerIdInVps( vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j) ); 1596 if( vps->getNecessaryLayerFlag(i, j) ) 1597 { 1598 vps->getProfileLevelTierIdx(i)->push_back( vps->getBaseLayerInternalFlag() && vps->getMaxLayers() > 1 ? layerIdxInVps + 1 : layerIdxInVps); 1599 } 1600 else 1601 { 1602 vps->getProfileLevelTierIdx(i)->push_back( -1 ); 1603 } 1604 } 1605 } 1606 #endif 1607 #if SUB_LAYERS_IN_LAYER_SET 1608 vps->calculateMaxSLInLayerSets(); 1609 #endif 1374 1610 // Initialize dpb_size_table() for all ouput layer sets in the VPS extension 1375 1611 for(i = 1; i < vps->getNumOutputLayerSets(); i++) … … 1501 1737 #endif 1502 1738 1739 #if VPS_VUI_BSP_HRD_PARAMS 1740 vps->setVpsVuiBspHrdPresentFlag(false); 1741 TEncTop *pcCfg = &m_acTEncTop[0]; 1742 if( pcCfg->getBufferingPeriodSEIEnabled() ) 1743 { 1744 Int j; 1745 vps->setVpsVuiBspHrdPresentFlag(true); 1746 vps->setVpsNumAddHrdParams( vps->getMaxLayers() ); 1747 vps->createBspHrdParamBuffer(vps->getVpsNumAddHrdParams() + 1); 1748 for( i = vps->getNumHrdParameters(), j = 0; i < vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams(); i++, j++ ) 1749 { 1750 vps->setCprmsAddPresentFlag( j, true ); 1751 vps->setNumSubLayerHrdMinus1( j, vps->getMaxTLayers() - 1 ); 1752 1753 UInt layerId = j; 1754 TEncTop *pcCfgLayer = &m_acTEncTop[layerId]; 1755 1756 Int iPicWidth = pcCfgLayer->getSourceWidth(); 1757 Int iPicHeight = pcCfgLayer->getSourceHeight(); 1758 #if LAYER_CTB 1759 UInt uiWidthInCU = ( iPicWidth % m_acLayerCfg[layerId].m_uiMaxCUWidth ) ? iPicWidth / m_acLayerCfg[layerId].m_uiMaxCUWidth + 1 : iPicWidth / m_acLayerCfg[layerId].m_uiMaxCUWidth; 1760 UInt uiHeightInCU = ( iPicHeight % m_acLayerCfg[layerId].m_uiMaxCUHeight ) ? iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight + 1 : iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight; 1761 UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_acLayerCfg[layerId].m_uiMaxCUDepth << 1); 1762 #else 1763 UInt uiWidthInCU = ( iPicWidth %m_uiMaxCUWidth ) ? iPicWidth /m_uiMaxCUWidth + 1 : iPicWidth /m_uiMaxCUWidth; 1764 UInt uiHeightInCU = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight; 1765 UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1); 1766 #endif 1767 UInt uiNumCUsInFrame = uiWidthInCU * uiHeightInCU; 1768 1769 UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 ); 1770 if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 ) 1771 { 1772 numDU ++; 1773 } 1774 vps->getBspHrd(i)->setNumDU( numDU ); 1775 vps->setBspHrdParameters( i, pcCfgLayer->getFrameRate(), numDU, pcCfgLayer->getTargetBitrate(), ( pcCfgLayer->getIntraPeriod() > 0 ) ); 1776 } 1777 1778 // Signalling of additional partitioning schemes 1779 for(Int h = 1; h < vps->getNumOutputLayerSets(); h++) 1780 { 1781 Int lsIdx = vps->getOutputLayerSetIdx( h ); 1782 vps->setNumSignalledPartitioningSchemes(h, 1); // Only the default per-layer partitioning scheme 1783 for( j = 1; j < vps->getNumSignalledPartitioningSchemes(h); j++ ) 1784 { 1785 // ToDo: Add code for additional partitioning schemes here 1786 // ToDo: Initialize num_partitions_in_scheme_minus1 and layer_included_in_partition_flag 1787 } 1788 1789 for( i = 0; i < vps->getNumSignalledPartitioningSchemes(h); i++ ) 1790 { 1791 if( i == 0 ) 1792 { 1793 for(Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1( lsIdx ); t++) 1794 { 1795 vps->setNumBspSchedulesMinus1( h, i, t, 0 ); 1796 for( j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ ) 1797 { 1798 for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, i); k++ ) 1799 { 1800 // Only for the default partition 1801 Int nuhlayerId = vps->getLayerSetLayerIdList( lsIdx, k); 1802 Int layerIdxInVps = vps->getLayerIdInVps( nuhlayerId ); 1803 vps->setBspHrdIdx(h, i, t, j, k, layerIdxInVps + vps->getNumHrdParameters()); 1804 1805 vps->setBspSchedIdx(h, i, t, j, k, 0); 1806 } 1807 } 1808 } 1809 } 1810 else 1811 { 1812 assert(0); // Need to add support for additional partitioning schemes. 1813 } 1814 } 1815 } 1816 } 1817 #else 1818 1503 1819 #if O0164_MULTI_LAYER_HRD 1504 1820 vps->setVpsVuiBspHrdPresentFlag(false); … … 1572 1888 } 1573 1889 } 1890 #endif 1574 1891 #endif 1575 1892 … … 1669 1986 } 1670 1987 1671 #if AVC_SYNTAX1672 fstream streamSyntaxFile;1673 if( m_acTEncTop[0].getVPS()->getAvcBaseLayerFlag() )1674 {1675 if( !m_BLSyntaxFile )1676 {1677 printf( "Wrong base layer syntax input file\n" );1678 exit(EXIT_FAILURE);1679 }1680 streamSyntaxFile.open( m_BLSyntaxFile, fstream::in | fstream::binary );1681 if( !streamSyntaxFile.good() )1682 {1683 printf( "Base layer syntax input reading error\n" );1684 exit(EXIT_FAILURE);1685 }1686 m_acTEncTop[0].setBLSyntaxFile( &streamSyntaxFile );1687 }1688 #endif1689 1690 1988 Bool bFirstFrame = true; 1691 1989 while ( !bEos ) … … 1816 2114 } 1817 2115 } 2116 #if R0247_SEI_ACTIVE 2117 if(bFirstFrame) 2118 { 2119 list<AccessUnit>::iterator first_au = outputAccessUnits.begin(); 2120 AccessUnit::iterator it_sps; 2121 for (it_sps = first_au->begin(); it_sps != first_au->end(); it_sps++) 2122 { 2123 if( (*it_sps)->m_nalUnitType == NAL_UNIT_SPS ) 2124 { 2125 break; 2126 } 2127 } 2128 2129 for (list<AccessUnit>::iterator it_au = ++outputAccessUnits.begin(); it_au != outputAccessUnits.end(); it_au++) 2130 { 2131 for (AccessUnit::iterator it_nalu = it_au->begin(); it_nalu != it_au->end(); it_nalu++) 2132 { 2133 if( (*it_nalu)->m_nalUnitType == NAL_UNIT_SPS ) 2134 { 2135 first_au->insert(++it_sps, *it_nalu); 2136 it_nalu = it_au->erase(it_nalu); 2137 } 2138 } 2139 } 2140 } 2141 2142 #endif 1818 2143 1819 2144 #if RC_SHVC_HARMONIZATION … … 1858 2183 1859 2184 AccessUnit& accessUnit = outputAccessUnits.back(); 2185 #if T_ID_EOB_BUG_FIX 2186 nalu.m_temporalId = 0; 2187 #else 1860 2188 nalu.m_temporalId = accessUnit.front()->m_temporalId; 2189 #endif 1861 2190 accessUnit.push_back(new NALUnitEBSP(nalu)); 1862 2191 } … … 1884 2213 m_acTEncTop[layer].deletePicBuffer(); 1885 2214 } 1886 1887 #if AVC_SYNTAX1888 if( streamSyntaxFile.is_open() )1889 {1890 streamSyntaxFile.close();1891 }1892 #endif1893 2215 1894 2216 // delete buffers & classes … … 2154 2476 { 2155 2477 #if REPN_FORMAT_IN_VPS 2156 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConf Left() * xScal, m_acLayerCfg[layer].getConfRight() * xScal,2157 m_acLayerCfg[layer].getConf Top() * yScal, m_acLayerCfg[layer].getConfBottom() * yScal, m_isTopFieldFirst );2158 #else 2159 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConf Left(), m_acLayerCfg[layer].getConfRight(), m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom(), m_isTopFieldFirst );2478 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal, 2479 m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal, m_isTopFieldFirst ); 2480 #else 2481 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom(), m_isTopFieldFirst ); 2160 2482 #endif 2161 2483 } … … 2183 2505 { 2184 2506 #if REPN_FORMAT_IN_VPS 2185 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConf Left() * xScal, m_acLayerCfg[layer].getConfRight() * xScal,2186 m_acLayerCfg[layer].getConf Top() * yScal, m_acLayerCfg[layer].getConfBottom() * yScal );2187 #else 2188 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConf Left(), m_acLayerCfg[layer].getConfRight(),2189 m_acLayerCfg[layer].getConf Top(), m_acLayerCfg[layer].getConfBottom() );2507 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft() * xScal, m_acLayerCfg[layer].getConfWinRight() * xScal, 2508 m_acLayerCfg[layer].getConfWinTop() * yScal, m_acLayerCfg[layer].getConfWinBottom() * yScal ); 2509 #else 2510 m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfWinLeft(), m_acLayerCfg[layer].getConfWinRight(), 2511 m_acLayerCfg[layer].getConfWinTop(), m_acLayerCfg[layer].getConfWinBottom() ); 2190 2512 #endif 2191 2513 } … … 2295 2617 if (m_pchReconFile) 2296 2618 { 2297 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_conf Left, m_confRight, m_confTop, m_confBottom, m_isTopFieldFirst );2619 m_cTVideoIOYuvReconFile.write( pcPicYuvRecTop, pcPicYuvRecBottom, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, m_isTopFieldFirst ); 2298 2620 } 2299 2621 … … 2310 2632 { 2311 2633 Int i; 2312 2313 2634 TComList<TComPicYuv*>::iterator iterPicYuvRec = m_cListPicYuvRec.end(); 2314 2635 list<AccessUnit>::const_iterator iterBitstream = accessUnits.begin(); … … 2324 2645 if (m_pchReconFile) 2325 2646 { 2326 #if SYNTAX_OUTPUT 2327 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confLeft, m_confRight, m_confTop, m_confBottom ); 2328 #endif 2647 m_cTVideoIOYuvReconFile.write( pcPicYuvRec, m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom ); 2329 2648 } 2330 2649 -
trunk/source/Lib/TLibCommon/CommonDef.h
r815 r906 58 58 #if SVC_EXTENSION 59 59 #include <vector> 60 #define NV_VERSION " 6.1 (HM-14.0)" ///< Current software version60 #define NV_VERSION "7.0 (HM-15.0)" ///< Current software version 61 61 #else 62 #define NV_VERSION "1 4.0" ///< Current software version62 #define NV_VERSION "15.0" ///< Current software version 63 63 #endif 64 64 -
trunk/source/Lib/TLibCommon/SEI.h
r815 r906 94 94 BSP_NESTING = 140, 95 95 BSP_INITIAL_ARRIVAL_TIME = 141, 96 #if !REMOVE_BSP_HRD_SEI 96 97 BSP_HRD = 142, 97 98 #endif 98 #if Q0074_SEI_COLOR_MAPPING 99 COLOR_MAPPING_INFO = 143, 99 #endif 100 #if Q0074_COLOUR_REMAPPING_SEI 101 COLOUR_REMAPPING_INFO = 143, 100 102 #endif 101 103 #if Q0078_ADD_LAYER_SETS … … 173 175 Int numSpsIdsMinus1; 174 176 std::vector<Int> activeSeqParameterSetId; 177 #if R0247_SEI_ACTIVE 178 std::vector<Int> layerSpsIdx; 179 #endif 175 180 }; 176 181 … … 199 204 UInt m_bpSeqParameterSetId; 200 205 Bool m_rapCpbParamsPresentFlag; 201 Boolm_cpbDelayOffset;202 Boolm_dpbDelayOffset;206 UInt m_cpbDelayOffset; 207 UInt m_dpbDelayOffset; 203 208 UInt m_initialCpbRemovalDelay [MAX_CPB_CNT][2]; 204 209 UInt m_initialCpbRemovalDelayOffset [MAX_CPB_CNT][2]; … … 445 450 }; 446 451 #endif 447 #if Q0074_SEI_COLOR_MAPPING 448 class SEIColorMappingInfo : public SEI 449 { 450 public: 451 PayloadType payloadType() const { return COLOR_MAPPING_INFO; } 452 SEIColorMappingInfo() { 453 } 454 virtual ~SEIColorMappingInfo() {} 455 456 Int m_colorMapId; 457 Bool m_colorMapCancelFlag; 458 Bool m_colorMapPersistenceFlag; 459 Bool m_colorMap_video_signal_type_present_flag; 460 Bool m_colorMap_video_full_range_flag; 461 Int m_colorMap_primaries; 462 Int m_colorMap_transfer_characteristics; 463 Int m_colorMap_matrix_coeffs; 464 Int m_colorMapModelId; 465 466 Int m_colour_map_coded_data_bit_depth; 467 Int m_colour_map_target_bit_depth; 468 469 Int m_num_input_pivots[3]; 470 Int* m_coded_input_pivot_value[3]; 471 Int* m_target_input_pivot_value[3]; 472 473 Bool m_matrix_flag; 474 Int m_log2_matrix_denom; 475 Int m_matrix_coef[3][3]; 476 477 Int m_num_output_pivots[3]; 478 Int* m_coded_output_pivot_value[3]; 479 Int* m_target_output_pivot_value[3]; 452 #if Q0074_COLOUR_REMAPPING_SEI 453 class SEIColourRemappingInfo : public SEI 454 { 455 public: 456 PayloadType payloadType() const { return COLOUR_REMAPPING_INFO; } 457 SEIColourRemappingInfo() {} 458 ~SEIColourRemappingInfo() {} 459 460 Int m_colourRemapId; 461 Bool m_colourRemapCancelFlag; 462 Bool m_colourRemapPersistenceFlag; 463 Bool m_colourRemapVideoSignalInfoPresentFlag; 464 Bool m_colourRemapFullRangeFlag; 465 Int m_colourRemapPrimaries; 466 Int m_colourRemapTransferFunction; 467 Int m_colourRemapMatrixCoefficients; 468 Int m_colourRemapInputBitDepth; 469 Int m_colourRemapBitDepth; 470 Int m_preLutNumValMinus1[3]; 471 std::vector<Int> m_preLutCodedValue[3]; 472 std::vector<Int> m_preLutTargetValue[3]; 473 Bool m_colourRemapMatrixPresentFlag; 474 Int m_log2MatrixDenom; 475 Int m_colourRemapCoeffs[3][3]; 476 Int m_postLutNumValMinus1[3]; 477 std::vector<Int> m_postLutCodedValue[3]; 478 std::vector<Int> m_postLutTargetValue[3]; 480 479 }; 481 480 #endif … … 593 592 Bool m_callerOwnsSEIs; 594 593 SEIMessages m_nestedSEIs; 594 #if VPS_VUI_BSP_HRD_PARAMS 595 Int m_seiPartitioningSchemeIdx; 596 Int m_seiOlsIdx; 597 #endif 595 598 }; 596 599 … … 607 610 }; 608 611 612 #if !REMOVE_BSP_HRD_SEI 609 613 class SEIBspHrd : public SEI 610 614 { … … 627 631 TComHRD *hrd; 628 632 }; 633 #endif 629 634 630 635 #endif -
trunk/source/Lib/TLibCommon/TCom3DAsymLUT.cpp
r815 r906 17 17 m_pCuboid = NULL; 18 18 m_nResQuanBit = 0; 19 #if R0164_CGS_LUT_BUGFIX_CHECK 20 m_pCuboidExplicit = NULL; 21 m_pCuboidFilled = NULL; 22 #endif 19 23 } 20 24 … … 24 28 } 25 29 26 Void TCom3DAsymLUT::create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 ) 30 Void TCom3DAsymLUT::create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 31 #if R0151_CGS_3D_ASYMLUT_IMPROVE 32 , Int nAdaptCThresholdU , Int nAdaptCThresholdV 33 #endif 34 ) 27 35 { 28 36 m_nMaxOctantDepth = nMaxOctantDepth; … … 36 44 m_nMaxPartNumLog2 = 3 * m_nMaxOctantDepth + m_nMaxYPartNumLog2; 37 45 38 xUpdatePartitioning( nMaxOctantDepth , nMaxYPartNumLog2 ); 46 xUpdatePartitioning( nMaxOctantDepth , nMaxYPartNumLog2 47 #if R0151_CGS_3D_ASYMLUT_IMPROVE 48 , nAdaptCThresholdU , nAdaptCThresholdV 49 #endif 50 ); 39 51 40 52 m_nYSize = 1 << ( m_nMaxOctantDepth + m_nMaxYPartNumLog2 ); … … 48 60 } 49 61 xAllocate3DArray( m_pCuboid , m_nYSize , m_nUSize , m_nVSize ); 62 63 #if R0164_CGS_LUT_BUGFIX_CHECK 64 xAllocate3DArray( m_pCuboidExplicit , m_nYSize , m_nUSize , m_nVSize ); 65 xAllocate3DArray( m_pCuboidFilled , m_nYSize , m_nUSize , m_nVSize ); 66 #endif 50 67 } 51 68 … … 53 70 { 54 71 xFree3DArray( m_pCuboid ); 55 } 56 57 Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 ) 72 #if R0164_CGS_LUT_BUGFIX_CHECK 73 xFree3DArray( m_pCuboidExplicit ); 74 xFree3DArray( m_pCuboidFilled ); 75 #endif 76 } 77 78 79 Void TCom3DAsymLUT::xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 80 #if R0151_CGS_3D_ASYMLUT_IMPROVE 81 , Int nAdaptCThresholdU , Int nAdaptCThresholdV 82 #endif 83 ) 58 84 { 59 85 assert( nCurOctantDepth <= m_nMaxOctantDepth ); 86 #if R0179_CGS_SIZE_8x1x1 87 assert( nCurYPartNumLog2 + nCurOctantDepth <= m_nMaxYPartNumLog2 + m_nMaxOctantDepth ); 88 #else 60 89 assert( nCurYPartNumLog2 <= m_nMaxYPartNumLog2 ); 90 #endif 61 91 62 92 m_nCurOctantDepth = nCurOctantDepth; … … 64 94 m_nYShift2Idx = m_nInputBitDepthY - m_nCurOctantDepth - m_nCurYPartNumLog2; 65 95 m_nUShift2Idx = m_nVShift2Idx = m_nInputBitDepthC - m_nCurOctantDepth; 96 #if R0151_CGS_3D_ASYMLUT_IMPROVE 97 m_nMappingShift = 10 + m_nInputBitDepthY - m_nOutputBitDepthY; 98 m_nAdaptCThresholdU = nAdaptCThresholdU; 99 m_nAdaptCThresholdV = nAdaptCThresholdV; 100 #else 66 101 m_nMappingShift = m_nYShift2Idx + m_nUShift2Idx; 102 #endif 67 103 m_nMappingOffset = 1 << ( m_nMappingShift - 1 ); 104 105 #if R0179_ENC_OPT_3DLUT_SIZE 106 m_nYSize = 1 << ( m_nCurOctantDepth + m_nCurYPartNumLog2 ); 107 m_nUSize = 1 << m_nCurOctantDepth; 108 m_nVSize = 1 << m_nCurOctantDepth; 109 #endif 68 110 } 69 111 … … 159 201 160 202 SYUVP sPred; 203 #if R0151_CGS_3D_ASYMLUT_IMPROVE 204 sPred.Y = sPred.U = sPred.V = 0; 205 if( nVertexIdx == 0 ) 206 sPred.Y = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 207 else if( nVertexIdx == 1 ) 208 sPred.U = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 209 else if( nVertexIdx == 2 ) 210 sPred.V = xGetNormCoeffOne() << ( m_nOutputBitDepthY - m_nInputBitDepthY ); 211 #else 161 212 sPred.Y = ( yIdx + m_nVertexIdxOffset[nVertexIdx][0] ) << ( m_nYShift2Idx + m_nDeltaBitDepth ); 162 213 sPred.U = ( uIdx + m_nVertexIdxOffset[nVertexIdx][1] ) << ( m_nUShift2Idx + m_nDeltaBitDepthC ); 163 214 sPred.V = ( vIdx + m_nVertexIdxOffset[nVertexIdx][2] ) << ( m_nVShift2Idx + m_nDeltaBitDepthC ); 215 #endif 164 216 return( sPred ); 165 217 } … … 169 221 SCuboid*** pCuboid = pCurCuboid ? pCurCuboid : m_pCuboid ; 170 222 223 #if R0151_CGS_3D_ASYMLUT_IMPROVE 224 SYUVP sPred; 225 if( yIdx == 0 ) 226 { 227 sPred.Y = nVertexIdx == 0 ? 1024 : 0; 228 sPred.U = nVertexIdx == 1 ? 1024 : 0; 229 sPred.V = nVertexIdx == 2 ? 1024 : 0; 230 } 231 else 232 { 233 sPred = pCuboid[yIdx-1][uIdx][vIdx].P[nVertexIdx]; 234 } 235 #else 171 236 // PredA 172 237 SYUVP sPredA = xGetCuboidVertexPredA( yIdx , uIdx , vIdx , nVertexIdx ); … … 196 261 sPred.U = sPredA.U + sPredB.U; 197 262 sPred.V = sPredA.V + sPredB.V; 198 263 #endif 199 264 return sPred ; 200 265 } … … 220 285 rYUVP.U = sPred.U + ( deltaU << m_nResQuanBit ); 221 286 rYUVP.V = sPred.V + ( deltaV << m_nResQuanBit ); 287 #if R0150_CGS_SIGNAL_CONSTRAINTS 288 // LUT coefficients are less than 12-bit 289 assert( -2048 <= rYUVP.Y && rYUVP.Y <= 2047 ); 290 assert( -2048 <= rYUVP.U && rYUVP.U <= 2047 ); 291 assert( -2048 <= rYUVP.V && rYUVP.V <= 2047 ); 292 #endif 222 293 } 223 294 224 295 Pel TCom3DAsymLUT::xMapY( Pel y , Pel u , Pel v ) 225 296 { 297 #if R0151_CGS_3D_ASYMLUT_IMPROVE 298 const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 299 Pel dstY = ( ( rCuboid.P[0].Y * y + rCuboid.P[1].Y * u + rCuboid.P[2].Y * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].Y; 300 #else 226 301 const SCuboid & rCuboid = m_pCuboid[y>>m_nYShift2Idx][u>>m_nUShift2Idx][v>>m_nVShift2Idx]; 227 302 Pel dstY = rCuboid.P[0].Y; … … 233 308 + ( ( deltaV * ( rCuboid.P[2].Y - rCuboid.P[1].Y ) ) << m_nYShift2Idx ) 234 309 + m_nMappingOffset ) >> m_nMappingShift ); 310 #endif 235 311 return( dstY ); 236 312 } … … 238 314 SYUVP TCom3DAsymLUT::xMapUV( Pel y , Pel u , Pel v ) 239 315 { 316 #if R0151_CGS_3D_ASYMLUT_IMPROVE 317 const SCuboid & rCuboid = m_pCuboid[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 318 SYUVP dst; 319 dst.Y = 0; 320 dst.U = ( ( rCuboid.P[0].U * y + rCuboid.P[1].U * u + rCuboid.P[2].U * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].U; 321 dst.V = ( ( rCuboid.P[0].V * y + rCuboid.P[1].V * u + rCuboid.P[2].V * v + m_nMappingOffset ) >> m_nMappingShift ) + rCuboid.P[3].V; 322 #else 240 323 const SCuboid & rCuboid = m_pCuboid[y>>m_nYShift2Idx][u>>m_nUShift2Idx][v>>m_nVShift2Idx]; 241 324 SYUVP dst = rCuboid.P[0]; … … 251 334 + ( ( deltaV * ( rCuboid.P[2].V - rCuboid.P[1].V ) ) << m_nYShift2Idx ) 252 335 + m_nMappingOffset ) >> m_nMappingShift ); 336 #endif 253 337 return( dst ); 254 338 } … … 256 340 Void TCom3DAsymLUT::xSaveCuboids( SCuboid *** pSrcCuboid ) 257 341 { 342 #if R0179_ENC_OPT_3DLUT_SIZE 343 memcpy( m_pCuboid[0][0] , pSrcCuboid[0][0] , sizeof( SCuboid ) * getMaxYSize() * getMaxCSize() * getMaxCSize() ); 344 #else 258 345 memcpy( m_pCuboid[0][0] , pSrcCuboid[0][0] , sizeof( SCuboid ) * m_nYSize * m_nUSize * m_nVSize ); 346 #endif 259 347 } 260 348 … … 262 350 { 263 351 assert( pSrc->getMaxOctantDepth() == getMaxOctantDepth() && pSrc->getMaxYPartNumLog2() == getMaxYPartNumLog2() ); 264 xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2() ); 352 xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2() 353 #if R0151_CGS_3D_ASYMLUT_IMPROVE 354 , pSrc->getAdaptChromaThresholdU() , pSrc->getAdaptChromaThresholdV() 355 #endif 356 ); 265 357 setResQuantBit( pSrc->getResQuantBit() ); 266 358 xSaveCuboids( pSrc->m_pCuboid ); 267 359 } 268 360 269 #endif 270 361 #if R0164_CGS_LUT_BUGFIX_CHECK 362 Void TCom3DAsymLUT::xInitCuboids( ) 363 { 364 // All vertices are initialized as non-exlicitly-encoded 365 for( Int yIdx = 0 ; yIdx < m_nYSize ; yIdx++ ) 366 { 367 for( Int uIdx = 0 ; uIdx < m_nUSize ; uIdx++ ) 368 { 369 for( Int vIdx = 0 ; vIdx < m_nVSize ; vIdx++ ) 370 { 371 m_pCuboidExplicit[yIdx][uIdx][vIdx] = false; 372 m_pCuboidFilled[yIdx][uIdx][vIdx] = false; 373 } 374 } 375 } 376 } 377 378 Void TCom3DAsymLUT::xCuboidsFilledCheck( Int yIdx , Int uIdx , Int vIdx ) 379 { 380 if ( m_pCuboidFilled[yIdx][uIdx][vIdx] == false ) 381 { 382 if( yIdx > 0) 383 assert ( m_pCuboidFilled[yIdx-1][uIdx][vIdx] ); 384 385 for ( Int nVertexIdx=0 ; nVertexIdx<4 ; nVertexIdx++ ) 386 m_pCuboid[yIdx][uIdx][vIdx].P[nVertexIdx] = yIdx == 0 ? xGetCuboidVertexPredA( yIdx , uIdx , vIdx , nVertexIdx ): xGetCuboidVertexPredAll( yIdx , uIdx , vIdx , nVertexIdx ); 387 388 m_pCuboidFilled[yIdx][uIdx][vIdx] = true ; 389 } 390 } 391 392 393 Void TCom3DAsymLUT::xCuboidsFilledCheck( Bool bDecode ) 394 { 395 Int ySize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 396 Int uSize = 1 << getCurOctantDepth(); 397 Int vSize = 1 << getCurOctantDepth(); 398 for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ ) 399 { 400 for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ ) 401 { 402 for( Int vIdx = 0 ; vIdx < vSize ; vIdx++ ) 403 { 404 if ( bDecode ) 405 xCuboidsFilledCheck( yIdx , uIdx , vIdx ); 406 407 assert( m_pCuboidFilled[yIdx][uIdx][vIdx] ); 408 } 409 } 410 } 411 412 } 413 #endif 414 415 #if R0150_CGS_SIGNAL_CONSTRAINTS 416 Bool TCom3DAsymLUT::isRefLayer( UInt uiRefLayerId ) 417 { 418 Bool bIsRefLayer = false; 419 for( UInt i = 0 ; i < m_vRefLayerId.size() ; i++ ) 420 { 421 if( m_vRefLayerId[i] == uiRefLayerId ) 422 { 423 bIsRefLayer = true; 424 break; 425 } 426 } 427 428 return( bIsRefLayer ); 429 } 430 #endif 431 432 #if R0164_CGS_LUT_BUGFIX_CHECK 433 Void TCom3DAsymLUT::display( Bool bFilled ) 434 { 435 Int ySize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 436 Int uSize = 1 << getCurOctantDepth(); 437 Int vSize = 1 << getCurOctantDepth(); 438 Int vIdx=0; 439 440 printf("\n"); 441 printf("3DLut Explicit flag:\n"); 442 for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ ) 443 { 444 for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ ) 445 { 446 printf("%d\t", m_pCuboidExplicit[yIdx][uIdx][vIdx] ); 447 } 448 printf("\n"); 449 } 450 451 printf("3DLut values (explicit):\n"); 452 for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ ) 453 { 454 for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ ) 455 { 456 if ( m_pCuboidExplicit[yIdx][uIdx][vIdx] ) printf("%d\t", m_pCuboid[yIdx][uIdx][vIdx].P[0].Y ); 457 else printf("?\t", m_pCuboid[yIdx][uIdx][vIdx].P[0].Y ); 458 } 459 printf("\n"); 460 } 461 462 printf("3DLut values (all):\n"); 463 for( Int uIdx = 0 ; uIdx < uSize ; uIdx++ ) 464 { 465 for( Int yIdx = 0 ; yIdx < ySize ; yIdx++ ) 466 { 467 if ( bFilled ) { 468 if ( m_pCuboidFilled[yIdx][uIdx][vIdx] ) printf("%d\t" , m_pCuboid[yIdx][uIdx][vIdx].P[0].Y ); 469 else printf("unk\t" , m_pCuboid[yIdx][uIdx][vIdx].P[0].Y ); 470 } 471 else 472 printf("%d\t" , m_pCuboid[yIdx][uIdx][vIdx].P[0].Y ); 473 } 474 printf("\n"); 475 } 476 477 } 478 #endif 479 480 #endif 481 -
trunk/source/Lib/TLibCommon/TCom3DAsymLUT.h
r815 r906 4 4 5 5 #include "TypeDef.h" 6 #if R0150_CGS_SIGNAL_CONSTRAINTS 7 #include <cassert> 8 #include <vector> 9 #endif 6 10 7 11 #if Q0048_CGS_3D_ASYMLUT … … 25 29 virtual ~TCom3DAsymLUT(); 26 30 27 virtual Void create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 ); 31 virtual Void create( Int nMaxOctantDepth , Int nInputBitDepth , Int nInputBitDepthC , Int nOutputBitDepth , Int nOutputBitDepthC , Int nMaxYPartNumLog2 32 #if R0151_CGS_3D_ASYMLUT_IMPROVE 33 , Int nAdaptCThresholdU , Int nAdaptCThresholdV 34 #endif 35 ); 28 36 virtual Void destroy(); 29 37 … … 36 44 Int getResQuantBit() { return m_nResQuanBit; } 37 45 Void setResQuantBit(Int n){ m_nResQuanBit = n; } 46 #if R0300_CGS_RES_COEFF_CODING 47 Int getMappingShift() { return m_nMappingShift; } 48 Int getDeltaBits() { return m_nDeltaBits; } 49 Void setDeltaBits(Int n) { m_nDeltaBits = n; } 50 #endif 38 51 Int getMaxYPartNumLog2() { return m_nMaxYPartNumLog2; } 39 52 Int getCurYPartNumLog2() { return m_nCurYPartNumLog2; } 53 #if R0150_CGS_SIGNAL_CONSTRAINTS 54 Void addRefLayerId( UInt uiRefLayerId ) 55 { 56 if( !isRefLayer( uiRefLayerId ) ) 57 m_vRefLayerId.push_back( uiRefLayerId ); 58 } 59 size_t getRefLayerNum() { return m_vRefLayerId.size(); } 60 UInt getRefLayerId( UInt n ) { assert( n < m_vRefLayerId.size() ); return m_vRefLayerId[n]; } 61 Bool isRefLayer( UInt uiRefLayerId ); 62 #endif 63 #if R0151_CGS_3D_ASYMLUT_IMPROVE 64 Void setAdaptChromaThresholdU( Int n ) { m_nAdaptCThresholdU = n; } 65 Int getAdaptChromaThresholdU() { return m_nAdaptCThresholdU; } 66 Void setAdaptChromaThresholdV( Int n ) { m_nAdaptCThresholdV = n; } 67 Int getAdaptChromaThresholdV() { return m_nAdaptCThresholdV; } 68 #endif 69 #if R0179_ENC_OPT_3DLUT_SIZE 70 Int getMaxYSize() { return 1<<(m_nMaxOctantDepth+m_nMaxYPartNumLog2); } 71 Int getMaxCSize() { return 1<<m_nMaxOctantDepth; } 72 #endif 40 73 41 74 Void colorMapping( TComPicYuv * pcPicSrc, TComPicYuv * pcPicDst ); … … 45 78 SYUVP getCuboidVertexResTree( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx ); 46 79 Void setCuboidVertexResTree( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx , Int deltaY , Int deltaU , Int deltaV ); 47 80 #if R0164_CGS_LUT_BUGFIX_CHECK 81 Void xInitCuboids( ); 82 Void xCuboidsFilledCheck( Int yIdx , Int uIdx , Int vIdx ); 83 Void xCuboidsFilledCheck( Bool bDecode ); 84 Void display( Bool bFilled=true ); 85 Void xSetExplicit( Int yIdx , Int uIdx , Int vIdx ) { m_pCuboidExplicit[yIdx][uIdx][vIdx] = true ; xSetFilled(yIdx,uIdx,vIdx); } 86 Void xSetFilled( Int yIdx , Int uIdx , Int vIdx ) { m_pCuboidFilled[yIdx][uIdx][vIdx] = true ; } 87 #endif 48 88 49 89 private: … … 68 108 Int m_nMappingOffset; 69 109 Int m_nResQuanBit; 110 #if R0300_CGS_RES_COEFF_CODING 111 Int m_nDeltaBits; 112 #endif 70 113 SCuboid *** m_pCuboid; 71 114 const static Int m_nVertexIdxOffset[4][3]; 115 #if R0150_CGS_SIGNAL_CONSTRAINTS 116 std::vector<UInt> m_vRefLayerId; 117 #endif 118 #if R0151_CGS_3D_ASYMLUT_IMPROVE 119 Int m_nAdaptCThresholdU; 120 Int m_nAdaptCThresholdV; 121 #endif 122 #if R0164_CGS_LUT_BUGFIX_CHECK 123 Bool *** m_pCuboidExplicit; 124 Bool *** m_pCuboidFilled; 125 #endif 72 126 73 127 protected: … … 79 133 Void xFree3DArray( T *** &p ); 80 134 81 Void xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 ); 135 Void xUpdatePartitioning( Int nCurOctantDepth , Int nCurYPartNumLog2 136 #if R0151_CGS_3D_ASYMLUT_IMPROVE 137 , Int nAdaptCThresholdU , Int nAdaptCThreshodV 138 #endif 139 ); 82 140 SYUVP xGetCuboidVertexPredA( Int yIdx , Int uIdx , Int vIdx , Int nVertexIdx ); 83 141 Pel xMapY( Pel y , Pel u , Pel v ); … … 87 145 Int xGetUSize() { return m_nUSize; } 88 146 Int xGetVSize() { return m_nVSize; } 147 #if R0151_CGS_3D_ASYMLUT_IMPROVE 148 Int xGetYIdx(Pel y) { return( y >> m_nYShift2Idx ); } 149 Int xGetUIdx(Pel u) { return( m_nCurOctantDepth == 1 ? u >= m_nAdaptCThresholdU : u >> m_nUShift2Idx ); } 150 Int xGetVIdx(Pel v) { return( m_nCurOctantDepth == 1 ? v >= m_nAdaptCThresholdV : v >> m_nVShift2Idx ); } 151 Int xGetNormCoeffOne() { return( 1 << m_nMappingShift ); } 152 #else 89 153 Int xGetYShift2Idx() { return m_nYShift2Idx; } 90 154 Int xGetUShift2Idx() { return m_nUShift2Idx; } 91 155 Int xGetVShift2Idx() { return m_nVShift2Idx; } 156 #endif 92 157 SCuboid & xGetCuboid( Int yIdx , Int uIdx , Int vIdx ){ return m_pCuboid[yIdx][uIdx][vIdx]; } 93 158 Void xSaveCuboids( SCuboid *** pSrcCuboid ); -
trunk/source/Lib/TLibCommon/TComDataCU.cpp
r815 r906 3481 3481 3482 3482 #if SVC_EXTENSION 3483 TComDataCU* TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int iMotionMapping )3483 TComDataCU* TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping ) 3484 3484 { 3485 3485 UInt uiPelX = getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiCuAbsPartIdx] ]; 3486 3486 UInt uiPelY = getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiCuAbsPartIdx] ]; 3487 3487 3488 return getBaseColCU( refLayerIdc, uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase, iMotionMapping );3489 } 3490 3491 TComDataCU* TComDataCU::getBaseColCU( UInt refLayerIdc, UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int iMotionMapping )3488 return getBaseColCU( refLayerIdc, uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase, motionMapping ); 3489 } 3490 3491 TComDataCU* TComDataCU::getBaseColCU( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping ) 3492 3492 { 3493 3493 TComPic* baseColPic = m_pcSlice->getBaseColPic(refLayerIdc); 3494 3494 3495 uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, uiPelX); 3496 uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY); 3495 UInt uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, pelX); 3496 UInt uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, pelY); 3497 3498 #if REF_IDX_MFM 3499 // centre of the collocated 16x16 block for motion mapping 3500 if( motionMapping ) 3501 { 3502 uiPelX = pelX + 8; 3503 uiPelY = pelY + 8; 3504 } 3505 #endif 3497 3506 3498 3507 #if !LAYER_CTB … … 3500 3509 #endif 3501 3510 3511 #if MOVE_SCALED_OFFSET_TO_PPS 3512 #if O0098_SCALED_REF_LAYER_ID 3513 Int leftStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowLeftOffset(); 3514 Int topStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowTopOffset(); 3515 #else 3516 Int leftStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindow(refLayerIdc).getWindowLeftOffset(); 3517 Int topStartL = baseColPic->getSlice(0)->getPPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset(); 3518 #endif 3519 #else 3502 3520 #if O0098_SCALED_REF_LAYER_ID 3503 3521 Int leftStartL = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindowForLayer(baseColPic->getSlice(0)->getVPS()->getRefLayerId(getSlice()->getLayerId(), refLayerIdc)).getWindowLeftOffset(); … … 3507 3525 Int topStartL = baseColPic->getSlice(0)->getSPS()->getScaledRefLayerWindow(refLayerIdc).getWindowTopOffset(); 3508 3526 #endif 3509 3527 #endif 3528 3529 #if REF_REGION_OFFSET 3530 const Window &windowRL = baseColPic->getSlice(0)->getPPS()->getRefLayerWindow(refLayerIdc); 3531 Int iBX = (((uiPelX - leftStartL)*g_posScalingFactor[refLayerIdc][0] + (1<<15)) >> 16) + windowRL.getWindowLeftOffset(); 3532 Int iBY = (((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16) + windowRL.getWindowTopOffset(); 3533 #else 3510 3534 #if Q0200_CONFORMANCE_BL_SIZE 3511 3535 Int chromaFormatIdc = baseColPic->getSlice(0)->getChromaFormatIdc(); … … 3516 3540 Int iBY = ((uiPelY - topStartL )*g_posScalingFactor[refLayerIdc][1] + (1<<15)) >> 16; 3517 3541 #endif 3542 #endif 3518 3543 3519 3544 #if REF_IDX_MFM 3520 3545 // offset for collocated block in the motion mapping 3521 if( iMotionMapping == 1 ) 3522 { 3523 Bool unequalPictureSizeFlag = g_posScalingFactor[refLayerIdc][0] != 65536 || g_posScalingFactor[refLayerIdc][1] != 65536; //the condition should be updated according to the WD. 3524 3525 // actually, motion field compression is performed in the Void TComPic::compressMotion() function, but with (+4) the rounding may have effect on the picture boundary check. 3526 if( unequalPictureSizeFlag ) 3527 { 3546 if( motionMapping ) 3547 { 3548 if( m_pcPic->equalPictureSizeAndOffsetFlag(refLayerIdc) ) 3549 { 3550 // copy motion field from the same sample position for the case of 1x scaling ratio and same offset value between the current and reference layers 3551 iBX = pelX; 3552 iBY = pelY; 3553 } 3554 else 3555 { 3556 // actually, motion field compression is performed in the Void TComPic::compressMotion() function, but with (+4) the rounding may have effect on the picture boundary check. 3528 3557 iBX = ( ( iBX + 4 ) >> 4 ) << 4; 3529 3558 iBY = ( ( iBY + 4 ) >> 4 ) << 4; 3530 }3531 else3532 {3533 iBX += 4;3534 iBY += 4;3535 3559 } 3536 3560 } … … 3587 3611 { 3588 3612 // check BL mode 3589 UInt 3613 UInt uiCUAddrBase = 0, uiAbsPartAddrBase = 0; 3590 3614 // the right reference layerIdc should be specified, currently it is set to m_layerId-1 3591 TComDataCU* pcTempCU = getBaseColCU(m_layerId - 1, uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase, 0);3615 TComDataCU* pcTempCU = getBaseColCU(m_layerId - 1, uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase, false ); 3592 3616 3593 3617 if( pcTempCU->getPredictionMode( uiAbsPartAddrBase ) != MODE_INTRA ) -
trunk/source/Lib/TLibCommon/TComDataCU.h
r713 r906 469 469 Bool xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx); 470 470 #endif 471 TComDataCU* getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int iMotionMapping = 0);472 TComDataCU* getBaseColCU( UInt refLayerIdc, UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Int iMotionMapping = 0);471 TComDataCU* getBaseColCU( UInt refLayerIdc, UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping = false ); 472 TComDataCU* getBaseColCU( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping = false ); 473 473 Void scaleBaseMV( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase ); 474 474 #endif -
trunk/source/Lib/TLibCommon/TComMotionInfo.h
r713 r906 155 155 Void compress(Char* pePredMode, Int scale); 156 156 157 #if AVC_SYNTAX158 Void setMv (TComMv cMv, Int iIdx ) { m_pcMv [iIdx] = cMv; }159 Void setRefIdx(Int iRefIdx, Int iIdx ) { m_piRefIdx[iIdx] = iRefIdx; }160 #endif161 162 157 #if REF_IDX_MFM 163 158 Void setMvField( TComMvField const& mvField, Int iIdx ) -
trunk/source/Lib/TLibCommon/TComPic.cpp
r815 r906 64 64 memset( m_pcFullPelBaseRec, 0, sizeof( m_pcFullPelBaseRec ) ); 65 65 memset( m_bSpatialEnhLayer, false, sizeof( m_bSpatialEnhLayer ) ); 66 memset( m_equalPictureSizeAndOffsetFlag, false, sizeof( m_equalPictureSizeAndOffsetFlag ) ); 66 67 #endif 67 68 m_apcPicYuv[0] = NULL; … … 84 85 if (!bIsVirtual) 85 86 { 87 #if R0156_CONF_WINDOW_IN_REP_FORMAT 88 #if AUXILIARY_PICTURES 89 m_apcPicYuv[0] = new TComPicYuv; m_apcPicYuv[0]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow ); 90 #else 91 m_apcPicYuv[0] = new TComPicYuv; m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow ); 92 #endif 93 #else 86 94 #if AUXILIARY_PICTURES 87 95 m_apcPicYuv[0] = new TComPicYuv; m_apcPicYuv[0]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); … … 89 97 m_apcPicYuv[0] = new TComPicYuv; m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); 90 98 #endif 91 } 99 #endif 100 } 101 #if R0156_CONF_WINDOW_IN_REP_FORMAT 102 #if AUXILIARY_PICTURES 103 m_apcPicYuv[1] = new TComPicYuv; m_apcPicYuv[1]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow ); 104 #else 105 m_apcPicYuv[1] = new TComPicYuv; m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow ); 106 #endif 107 #else 92 108 #if AUXILIARY_PICTURES 93 109 m_apcPicYuv[1] = new TComPicYuv; m_apcPicYuv[1]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); … … 95 111 m_apcPicYuv[1] = new TComPicYuv; m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); 96 112 #endif 113 #endif 97 114 98 115 for( Int i = 0; i < MAX_LAYERS; i++ ) … … 100 117 if( m_bSpatialEnhLayer[i] ) 101 118 { 119 #if R0156_CONF_WINDOW_IN_REP_FORMAT 120 #if AUXILIARY_PICTURES 121 m_pcFullPelBaseRec[i] = new TComPicYuv; m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow ); 122 #else 123 m_pcFullPelBaseRec[i] = new TComPicYuv; m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, &conformanceWindow ); 124 #endif 125 #else 102 126 #if AUXILIARY_PICTURES 103 127 m_pcFullPelBaseRec[i] = new TComPicYuv; m_pcFullPelBaseRec[i]->create( iWidth, iHeight, chromaFormatIDC, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); 104 128 #else 105 129 m_pcFullPelBaseRec[i] = new TComPicYuv; m_pcFullPelBaseRec[i]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps ); 130 #endif 106 131 #endif 107 132 } … … 187 212 for( Int i = 0; i < MAX_LAYERS; i++ ) 188 213 { 189 if( m_bSpatialEnhLayer[i] )214 if( m_bSpatialEnhLayer[i] && m_pcFullPelBaseRec[i] ) 190 215 { 191 216 m_pcFullPelBaseRec[i]->destroy(); … … 260 285 Void TComPic::copyUpsampledMvField(UInt refLayerIdc, TComPic* pcPicBase) 261 286 { 262 UInt numPartitions 263 UInt widthMinPU 264 UInt heightMinPU 265 Int unitNum 287 UInt numPartitions = 1<<(g_uiMaxCUDepth<<1); 288 UInt widthMinPU = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth); 289 UInt heightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth); 290 Int unitNum = max (1, (Int)((16/widthMinPU)*(16/heightMinPU)) ); 266 291 267 292 for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++) //each LCU … … 277 302 278 303 TComDataCU *pcColCU = 0; 279 pcColCU = pcCUDes->getBaseColCU(refLayerIdc, pelX + 8, pelY + 8, baseCUAddr, baseAbsPartIdx, 1);304 pcColCU = pcCUDes->getBaseColCU(refLayerIdc, pelX, pelY, baseCUAddr, baseAbsPartIdx, true); 280 305 281 306 if( pcColCU && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(baseAbsPartIdx) != MODE_INTRA) ) //base layer unit not skip and invalid mode … … 306 331 } 307 332 } 308 memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(Char)*numPartitions );333 memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(Char)*numPartitions ); 309 334 } 310 335 } … … 332 357 } 333 358 #endif 334 #endif335 336 #if AVC_SYNTAX337 Void TComPic::readBLSyntax( fstream* filestream, UInt numBytes )338 {339 if( !filestream->good() )340 {341 return;342 }343 344 UInt width = this->getPicYuvRec()->getWidth();345 UInt height = this->getPicYuvRec()->getHeight();346 347 UInt64 poc = (UInt64)this->getPOC();348 UInt partWidth = width / 4;349 UInt partHeight = height / 4;350 351 UInt numPartInWidth = this->getNumPartInWidth();352 UInt numPartInHeight = this->getNumPartInHeight();353 UInt numPartLCUInWidth = this->getFrameWidthInCU();354 355 UInt64 uiPos = (UInt64)poc * width * height * numBytes / 16;356 357 filestream->seekg( uiPos, ios_base::beg );358 359 for( Int i = 0; i < partHeight; i++ )360 {361 for( Int j = 0; j < partWidth; j++ )362 {363 UInt x = ( j / numPartInWidth );364 UInt y = ( i / numPartInHeight );365 366 UInt addrLCU = y * numPartLCUInWidth + x;367 UInt partAddr = ( i - y * numPartInHeight ) * numPartInWidth + ( j - x * numPartInWidth );368 partAddr = g_auiRasterToZscan[partAddr];369 370 TComDataCU* pcCU = this->getCU( addrLCU );371 372 TComMv mv;373 Short temp;374 375 // RefIdxL0376 Char refIdxL0 = -1;377 filestream->read( &refIdxL0, 1 );378 assert( refIdxL0 >= -1 );379 pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, partAddr );380 381 // RefIdxL1382 Char refIdxL1 = -1;383 filestream->read( &refIdxL1, 1 );384 assert( refIdxL1 >= -1 );385 pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, partAddr );386 387 // MV L0388 temp = 0;389 filestream->read( reinterpret_cast<char*>(&temp), 2 );390 mv.setHor( (Short)temp );391 temp = 0;392 filestream->read( reinterpret_cast<char*>(&temp), 2 );393 mv.setVer( (Short)temp );394 pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, partAddr );395 396 // MV L1397 temp = 0;398 filestream->read( reinterpret_cast<char*>(&temp), 2 );399 mv.setHor( (Short)temp );400 temp = 0;401 filestream->read( reinterpret_cast<char*>(&temp), 2 );402 mv.setVer( (Short)temp );403 pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, partAddr );404 405 // set dependent information406 pcCU->setPredictionMode( partAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER );407 UInt interDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && this->getSlice(0)->isInterB() ) * 2;408 assert( interDir <= 3 );409 pcCU->setInterDir( partAddr, interDir );410 }411 }412 }413 #endif414 415 #if SYNTAX_OUTPUT416 Void TComPic::wrireBLSyntax( fstream* filestream, UInt numBytes )417 {418 if( !filestream->good() )419 {420 return;421 }422 423 UInt width = this->getPicYuvRec()->getWidth();424 UInt height = this->getPicYuvRec()->getHeight();425 426 UInt64 poc = (UInt64)this->getPOC();427 UInt partWidth = width / 4;428 UInt partHeight = height / 4;429 430 UInt numPartInWidth = this->getNumPartInWidth();431 UInt numPartInHeight = this->getNumPartInHeight();432 UInt numPartLCUInWidth = this->getFrameWidthInCU();433 434 filestream->seekg( poc * width * height * numBytes / 16 );435 436 for( Int i = 0; i < partHeight; i++ )437 {438 for( Int j = 0; j < partWidth; j++ )439 {440 UInt x = ( j / numPartInWidth );441 UInt y = ( i / numPartInHeight );442 443 UInt addrLCU = y * numPartLCUInWidth + x;444 UInt partAddr = ( i - y * numPartInHeight ) * numPartInWidth + ( j - x * numPartInWidth );445 partAddr = g_auiRasterToZscan[partAddr];446 447 TComDataCU* pcCU = this->getCU( addrLCU );448 449 TComMv mv;450 Short temp;451 Char refIdxL0 = NOT_VALID, refIdxL1 = NOT_VALID;452 453 // RefIdx454 if( !pcCU->isIntra( partAddr ) )455 {456 refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( partAddr );457 refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( partAddr );458 }459 assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 );460 filestream->put( refIdxL0 );461 filestream->put( refIdxL1 );462 463 // MV L0464 mv.setZero();465 if( refIdxL0 >= 0 )466 {467 mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( partAddr );468 }469 temp = (Short)mv.getHor();470 filestream->write( reinterpret_cast<char*>(&temp), 2 );471 temp = (Short)mv.getVer();472 filestream->write( reinterpret_cast<char*>(&temp), 2 );473 474 // MV L1475 mv.setZero();476 if( refIdxL1 >= 0 )477 {478 mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( partAddr );479 }480 temp = (Short)mv.getHor();481 filestream->write( reinterpret_cast<char*>(&temp), 2 );482 temp = (Short)mv.getVer();483 filestream->write( reinterpret_cast<char*>(&temp), 2 );484 }485 }486 }487 359 #endif 488 360 … … 529 401 #endif 530 402 403 #if WPP_FIX 404 UInt TComPic::getSubstreamForLCUAddr(const UInt uiLCUAddr, const Bool bAddressInRaster, TComSlice *pcSlice) 405 { 406 const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 407 UInt uiSubStrm; 408 409 if (iNumSubstreams > 1) // wavefronts, and possibly tiles being used. 410 { 411 TComPicSym &picSym=*(getPicSym()); 412 const UInt uiLCUAddrRaster = bAddressInRaster?uiLCUAddr : picSym.getCUOrderMap(uiLCUAddr); 413 const UInt uiWidthInLCUs = picSym.getFrameWidthInCU(); 414 const UInt uiTileIndex=picSym.getTileIdxMap(uiLCUAddrRaster); 415 const UInt widthInTiles=(picSym.getNumColumnsMinus1()+1); 416 TComTile *pTile=picSym.getTComTile(uiTileIndex); 417 const UInt uiTileStartLCU = pTile->getFirstCUAddr(); 418 const UInt uiTileLCUY = uiTileStartLCU / uiWidthInLCUs; 419 // independent tiles => substreams are "per tile". iNumSubstreams has already been multiplied. 420 const UInt uiLin = uiLCUAddrRaster / uiWidthInLCUs; 421 UInt uiStartingSubstreamForTile=(uiTileLCUY*widthInTiles) + (pTile->getTileHeight()*(uiTileIndex%widthInTiles)); 422 uiSubStrm = uiStartingSubstreamForTile + (uiLin-uiTileLCUY); 423 } 424 else 425 { 426 // dependent tiles => substreams are "per frame". 427 uiSubStrm = 0;//uiLin % iNumSubstreams; // x modulo 1 = 0 ! 428 } 429 return uiSubStrm; 430 } 431 #endif 432 433 531 434 //! \} -
trunk/source/Lib/TLibCommon/TComPic.h
r815 r906 45 45 #include "TComBitStream.h" 46 46 #include "SEI.h" 47 #if AVC_BASE || SYNTAX_OUTPUT47 #if AVC_BASE 48 48 #include <fstream> 49 49 #endif … … 88 88 Bool m_bSpatialEnhLayer[MAX_LAYERS]; // whether current layer is a spatial enhancement layer, 89 89 TComPicYuv* m_pcFullPelBaseRec[MAX_LAYERS]; // upsampled base layer recontruction for difference domain inter prediction 90 #if REF_IDX_MFM 91 Bool m_equalPictureSizeAndOffsetFlag[MAX_LAYERS]; 92 #endif 90 93 #endif 91 94 #if Q0048_CGS_3D_ASYMLUT … … 203 206 #endif 204 207 #if REF_IDX_MFM 208 Bool equalPictureSizeAndOffsetFlag(UInt refLayerIdc) { return m_equalPictureSizeAndOffsetFlag[refLayerIdc]; } 209 Void setEqualPictureSizeAndOffsetFlag(UInt refLayerIdc, Bool b) { m_equalPictureSizeAndOffsetFlag[refLayerIdc] = b; } 205 210 Void copyUpsampledMvField ( UInt refLayerIdc, TComPic* pcPicBase ); 206 211 Void initUpsampledMvField (); … … 213 218 #endif 214 219 Void copyUpsampledPictureYuv(TComPicYuv* pcPicYuvIn, TComPicYuv* pcPicYuvOut); 215 #if AVC_SYNTAX216 Void readBLSyntax( fstream* filestream, UInt numBytes );217 #endif218 #endif219 #if SYNTAX_OUTPUT220 Void wrireBLSyntax( fstream* filestream, UInt numBytes );221 220 #endif 222 221 … … 229 228 Void setCurrAuFlag(Bool x) {m_currAuFlag = x; } 230 229 #endif 230 #if WPP_FIX 231 UInt getSubstreamForLCUAddr(const UInt uiLCUAddr, const Bool bAddressInRaster, TComSlice *pcSlice); 232 #endif 231 233 };// END CLASS DEFINITION TComPic 232 234 -
trunk/source/Lib/TLibCommon/TComPicSym.cpp
r595 r906 38 38 #include "TComPicSym.h" 39 39 #include "TComSampleAdaptiveOffset.h" 40 #include "TComSlice.h" 40 41 41 42 //! \ingroup TLibCommon … … 63 64 ,m_iNumColumnsMinus1 (0) 64 65 ,m_iNumRowsMinus1(0) 65 ,m_apcTComTile(NULL)66 66 ,m_puiCUOrderMap(0) 67 67 ,m_puiTileIdxMap(NULL) … … 101 101 delete [] m_apcTComSlice; 102 102 } 103 m_apcTComSlice = new TComSlice*[m_uiNumCUsInFrame *m_uiNumPartitions];103 m_apcTComSlice = new TComSlice*[m_uiNumCUsInFrame]; 104 104 m_apcTComSlice[0] = new TComSlice; 105 105 m_uiNumAllocatedSlice = 1; … … 152 152 delete [] m_apcTComDataCU; 153 153 m_apcTComDataCU = NULL; 154 155 #if SVC_EXTENSION156 if( m_apcTComTile )157 {158 #endif159 for(Int i = 0; i < (m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ )160 {161 delete m_apcTComTile[i];162 }163 delete [] m_apcTComTile;164 #if SVC_EXTENSION165 }166 #endif167 168 m_apcTComTile = NULL;169 154 170 155 delete [] m_puiCUOrderMap; … … 193 178 Void TComPicSym::allocateNewSlice() 194 179 { 180 assert ((m_uiNumAllocatedSlice + 1) <= m_uiNumCUsInFrame); 195 181 m_apcTComSlice[m_uiNumAllocatedSlice ++] = new TComSlice; 196 182 if (m_uiNumAllocatedSlice>=2) … … 225 211 } 226 212 227 Void TComPicSym::xCreateTComTileArray() 228 { 229 m_apcTComTile = new TComTile*[(m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1)]; 230 for( UInt i=0; i<(m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ ) 231 { 232 m_apcTComTile[i] = new TComTile; 233 } 234 } 235 236 Void TComPicSym::xInitTiles() 237 { 238 UInt uiTileIdx; 239 UInt uiColumnIdx = 0; 240 UInt uiRowIdx = 0; 241 UInt uiRightEdgePosInCU; 242 UInt uiBottomEdgePosInCU; 243 Int i, j; 213 Void TComPicSym::initTiles(TComPPS *pps) 214 { 215 //set NumColumnsMinus1 and NumRowsMinus1 216 setNumColumnsMinus1( pps->getNumTileColumnsMinus1() ); 217 setNumRowsMinus1( pps->getTileNumRowsMinus1() ); 218 219 const Int numCols = pps->getNumTileColumnsMinus1() + 1; 220 const Int numRows = pps->getTileNumRowsMinus1() + 1; 221 const Int numTiles = numRows * numCols; 222 223 // allocate memory for tile parameters 224 m_tileParameters.resize(numTiles); 225 226 if( pps->getTileUniformSpacingFlag() ) 227 { 228 //set width and height for each (uniform) tile 229 for(Int row=0; row < numRows; row++) 230 { 231 for(Int col=0; col < numCols; col++) 232 { 233 const Int tileIdx = row * numCols + col; 234 m_tileParameters[tileIdx].setTileWidth( (col+1)*getFrameWidthInCU()/numCols 235 - (col*getFrameWidthInCU())/numCols ); 236 m_tileParameters[tileIdx].setTileHeight( (row+1)*getFrameHeightInCU()/numRows 237 - (row*getFrameHeightInCU())/numRows ); 238 } 239 } 240 } 241 else 242 { 243 //set the width for each tile 244 for(Int row=0; row < numRows; row++) 245 { 246 Int cumulativeTileWidth = 0; 247 for(Int col=0; col < getNumColumnsMinus1(); col++) 248 { 249 m_tileParameters[row * numCols + col].setTileWidth( pps->getTileColumnWidth(col) ); 250 cumulativeTileWidth += pps->getTileColumnWidth(col); 251 } 252 m_tileParameters[row * numCols + getNumColumnsMinus1()].setTileWidth( getFrameWidthInCU()-cumulativeTileWidth ); 253 } 254 255 //set the height for each tile 256 for(Int col=0; col < numCols; col++) 257 { 258 Int cumulativeTileHeight = 0; 259 for(Int row=0; row < getNumRowsMinus1(); row++) 260 { 261 m_tileParameters[row * numCols + col].setTileHeight( pps->getTileRowHeight(row) ); 262 cumulativeTileHeight += pps->getTileRowHeight(row); 263 } 264 m_tileParameters[getNumRowsMinus1() * numCols + col].setTileHeight( getFrameHeightInCU()-cumulativeTileHeight ); 265 } 266 } 267 268 #if TILE_SIZE_CHECK 269 Int minWidth = 1; 270 Int minHeight = 1; 271 const Int profileIdc = pps->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc(); 272 if ( profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10) 273 { 274 if (pps->getTilesEnabledFlag()) 275 { 276 minHeight = 64 / g_uiMaxCUHeight; 277 minWidth = 256 / g_uiMaxCUWidth; 278 } 279 } 280 for(Int row=0; row < numRows; row++) 281 { 282 for(Int col=0; col < numCols; col++) 283 { 284 const Int tileIdx = row * numCols + col; 285 assert (m_tileParameters[tileIdx].getTileWidth() >= minWidth); 286 assert (m_tileParameters[tileIdx].getTileHeight() >= minHeight); 287 } 288 } 289 #endif 244 290 245 291 //initialize each tile of the current picture 246 for( uiRowIdx=0; uiRowIdx < m_iNumRowsMinus1+1; uiRowIdx++ )247 { 248 for( uiColumnIdx=0; uiColumnIdx < m_iNumColumnsMinus1+1; uiColumnIdx++ )249 { 250 uiTileIdx = uiRowIdx * (m_iNumColumnsMinus1+1) + uiColumnIdx;292 for( Int row=0; row < numRows; row++ ) 293 { 294 for( Int col=0; col < numCols; col++ ) 295 { 296 const Int tileIdx = row * numCols + col; 251 297 252 298 //initialize the RightEdgePosInCU for each tile 253 uiRightEdgePosInCU = 0;254 for( i=0; i <= uiColumnIdx; i++ )255 { 256 uiRightEdgePosInCU += this->getTComTile(uiRowIdx * (m_iNumColumnsMinus1+1) + i)->getTileWidth();257 } 258 this->getTComTile(uiTileIdx)->setRightEdgePosInCU(uiRightEdgePosInCU-1);299 Int rightEdgePosInCTU = 0; 300 for( Int i=0; i <= col; i++ ) 301 { 302 rightEdgePosInCTU += m_tileParameters[row * numCols + i].getTileWidth(); 303 } 304 m_tileParameters[tileIdx].setRightEdgePosInCU(rightEdgePosInCTU-1); 259 305 260 306 //initialize the BottomEdgePosInCU for each tile 261 uiBottomEdgePosInCU = 0;262 for( i=0; i <= uiRowIdx; i++ )263 { 264 uiBottomEdgePosInCU += this->getTComTile(i * (m_iNumColumnsMinus1+1) + uiColumnIdx)->getTileHeight();265 } 266 this->getTComTile(uiTileIdx)->setBottomEdgePosInCU(uiBottomEdgePosInCU-1);307 Int bottomEdgePosInCTU = 0; 308 for( Int i=0; i <= row; i++ ) 309 { 310 bottomEdgePosInCTU += m_tileParameters[i * numCols + col].getTileHeight(); 311 } 312 m_tileParameters[tileIdx].setBottomEdgePosInCU(bottomEdgePosInCTU-1); 267 313 268 314 //initialize the FirstCUAddr for each tile 269 this->getTComTile(uiTileIdx)->setFirstCUAddr( (this->getTComTile(uiTileIdx)->getBottomEdgePosInCU() - this->getTComTile(uiTileIdx)->getTileHeight() +1)*m_uiWidthInCU + 270 this->getTComTile(uiTileIdx)->getRightEdgePosInCU() - this->getTComTile(uiTileIdx)->getTileWidth() + 1); 271 } 272 } 315 m_tileParameters[tileIdx].setFirstCUAddr( (m_tileParameters[tileIdx].getBottomEdgePosInCU() - m_tileParameters[tileIdx].getTileHeight() + 1) * getFrameWidthInCU() + 316 m_tileParameters[tileIdx].getRightEdgePosInCU() - m_tileParameters[tileIdx].getTileWidth() + 1); 317 } 318 } 319 320 Int columnIdx = 0; 321 Int rowIdx = 0; 273 322 274 323 //initialize the TileIdxMap 275 for( i=0; i<m_uiNumCUsInFrame; i++) 276 { 277 for(j=0; j < m_iNumColumnsMinus1+1; j++) 278 { 279 if(i % m_uiWidthInCU <= this->getTComTile(j)->getRightEdgePosInCU()) 280 { 281 uiColumnIdx = j; 282 j = m_iNumColumnsMinus1+1; 283 } 284 } 285 for(j=0; j < m_iNumRowsMinus1+1; j++) 286 { 287 if(i/m_uiWidthInCU <= this->getTComTile(j*(m_iNumColumnsMinus1 + 1))->getBottomEdgePosInCU()) 288 { 289 uiRowIdx = j; 290 j = m_iNumRowsMinus1 + 1; 291 } 292 } 293 m_puiTileIdxMap[i] = uiRowIdx * (m_iNumColumnsMinus1 + 1) + uiColumnIdx; 294 } 295 324 for( Int i=0; i<m_uiNumCUsInFrame; i++) 325 { 326 for( Int col=0; col < numCols; col++) 327 { 328 if(i % getFrameWidthInCU() <= m_tileParameters[col].getRightEdgePosInCU()) 329 { 330 columnIdx = col; 331 break; 332 } 333 } 334 for(Int row=0; row < numRows; row++) 335 { 336 if(i / getFrameWidthInCU() <= m_tileParameters[row*numCols].getBottomEdgePosInCU()) 337 { 338 rowIdx = row; 339 break; 340 } 341 } 342 m_puiTileIdxMap[i] = rowIdx * numCols + columnIdx; 343 } 296 344 } 297 345 … … 441 489 442 490 TComTile::TComTile() 491 : m_uiTileWidth (0) 492 , m_uiTileHeight (0) 493 , m_uiRightEdgePosInCU (0) 494 , m_uiBottomEdgePosInCU (0) 495 , m_uiFirstCUAddr (0) 496 443 497 { 444 498 } -
trunk/source/Lib/TLibCommon/TComPicSym.h
r595 r906 45 45 #include "TComDataCU.h" 46 46 class TComSampleAdaptiveOffset; 47 class TComPPS; 47 48 48 49 //! \ingroup TLibCommon … … 102 103 Int m_iNumColumnsMinus1; 103 104 Int m_iNumRowsMinus1; 104 TComTile** m_apcTComTile;105 std::vector<TComTile> m_tileParameters; 105 106 UInt* m_puiCUOrderMap; //the map of LCU raster scan address relative to LCU encoding order 106 107 UInt* m_puiTileIdxMap; //the map of the tile index relative to LCU raster scan address … … 142 143 Int getNumRowsMinus1() { return m_iNumRowsMinus1; } 143 144 Int getNumTiles() { return (m_iNumRowsMinus1+1)*(m_iNumColumnsMinus1+1); } 144 TComTile* getTComTile ( UInt tileIdx ) { return *(m_apcTComTile + tileIdx); }145 TComTile* getTComTile ( UInt tileIdx ) { return &(m_tileParameters[tileIdx]); } 145 146 Void setCUOrderMap( Int encCUOrder, Int cuAddr ) { *(m_puiCUOrderMap + encCUOrder) = cuAddr; } 146 147 UInt getCUOrderMap( Int encCUOrder ) { return *(m_puiCUOrderMap + (encCUOrder>=m_uiNumCUsInFrame ? m_uiNumCUsInFrame : encCUOrder)); } … … 150 151 UInt getPicSCUEncOrder( UInt SCUAddr ); 151 152 UInt getPicSCUAddr( UInt SCUEncOrder ); 152 Void xCreateTComTileArray(); 153 Void xInitTiles(); 153 Void initTiles(TComPPS *pps); 154 154 UInt xCalculateNxtCUAddr( UInt uiCurrCUAddr ); 155 155 SAOBlkParam* getSAOBlkParam() { return m_saoBlkParams;} … … 160 160 UInt getMaxCUWidth() { return m_uiMaxCUWidth; } 161 161 UInt getMaxCUHeight() { return m_uiMaxCUHeight; } 162 #endif163 #if AVC_SYNTAX164 UInt getMaxCUWidth() { return m_uiMaxCUWidth; }165 UInt getMaxCUHeight() { return m_uiMaxCUHeight; }166 UInt getMaxDepth() { return m_uhTotalDepth; }167 162 #endif 168 163 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI -
trunk/source/Lib/TLibCommon/TComPicYuv.cpp
r815 r906 69 69 70 70 #if SVC_EXTENSION 71 #if R0156_CONF_WINDOW_IN_REP_FORMAT 72 #if AUXILIARY_PICTURES 73 Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow ) 74 #else 75 Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow ) 76 #endif 77 #else // R0156_CONF_WINDOW_IN_REP_FORMAT 71 78 #if AUXILIARY_PICTURES 72 79 Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps ) … … 74 81 Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps ) 75 82 #endif 83 #endif 76 84 #else 77 85 Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth ) … … 82 90 83 91 #if SVC_EXTENSION 92 #if R0156_CONF_WINDOW_IN_REP_FORMAT 93 if(conformanceWindow != NULL) 94 { 95 m_conformanceWindow = *conformanceWindow; 96 } 97 #else 84 98 if(pcSps != NULL) 85 99 { 86 100 m_conformanceWindow = pcSps->getConformanceWindow(); 87 101 } 102 #endif 88 103 #endif 89 104 … … 366 381 } 367 382 368 #if SVC_EXTENSION369 383 Void TComPicYuv::dump( Char* pFileName, Bool bAdd, Int bitDepth ) 370 384 { … … 431 445 } 432 446 433 #endif434 435 447 //! \} -
trunk/source/Lib/TLibCommon/TComPicYuv.h
r815 r906 111 111 // ------------------------------------------------------------------------------------------------ 112 112 #if SVC_EXTENSION 113 #if R0156_CONF_WINDOW_IN_REP_FORMAT 114 #if AUXILIARY_PICTURES 115 Void create ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow = NULL); 116 #else 117 Void create ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, Window* conformanceWindow = NULL); 118 #endif 119 #else 113 120 #if AUXILIARY_PICTURES 114 121 Void create ( Int iPicWidth, Int iPicHeight, ChromaFormat chromaFormatIDC, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL); 115 122 #else 116 123 Void create ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL); 124 #endif 117 125 #endif 118 126 #else … … 191 199 Void convertToMonochrome(); 192 200 #endif 201 #endif //SVC_EXTENSION 193 202 Void dump( Char* pFileName, Bool bAdd, Int bitDepth ); 194 #endif //SVC_EXTENSION195 203 196 204 };// END CLASS DEFINITION TComPicYuv -
trunk/source/Lib/TLibCommon/TComPrediction.cpp
r815 r906 796 796 #else 797 797 #if O0194_JOINT_US_BITSHIFT 798 #if REF_REGION_OFFSET 799 Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow ) 800 { 801 m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, altRefWindow ); 802 } 803 #else 798 804 Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window) 799 805 { 800 806 m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window); 801 807 } 808 #endif 802 809 #else 803 810 Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window) -
trunk/source/Lib/TLibCommon/TComPrediction.h
r815 r906 126 126 #else 127 127 #if O0194_JOINT_US_BITSHIFT 128 #if REF_REGION_OFFSET 129 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow ); 130 #else 128 131 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); 132 #endif 129 133 #else 130 134 Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); -
trunk/source/Lib/TLibCommon/TComSlice.cpp
r815 r906 36 36 */ 37 37 38 #include <numeric> 38 39 #include "CommonDef.h" 39 40 #include "TComSlice.h" … … 47 48 #if SVC_EXTENSION 48 49 ParameterSetMap<TComVPS> ParameterSetManager::m_vpsMap(MAX_NUM_VPS); 50 ParameterSetMap<TComSPS> ParameterSetManager::m_spsMap(MAX_NUM_SPS); 51 ParameterSetMap<TComPPS> ParameterSetManager::m_ppsMap(MAX_NUM_PPS); 49 52 Int ParameterSetManager::m_activeVPSId = -1; 50 53 #endif … … 104 107 , m_temporalLayerNonReferenceFlag ( false ) 105 108 , m_enableTMVPFlag ( true ) 109 #if R0226_SLICE_TMVP 110 , m_availableForTMVPRefFlag ( true ) 111 #endif 106 112 #if SVC_EXTENSION 107 113 , m_layerId ( 0 ) … … 124 130 , m_pocMsbValRequiredFlag ( false ) 125 131 , m_pocMsbValPresentFlag ( false ) 132 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 133 , m_pocMsbValNeeded ( false ) 134 #endif 126 135 #endif 127 136 #if POC_RESET_IDC_DECODER || POC_RESET_IDC_ENCODER … … 215 224 m_picOrderCntLsb = 0; 216 225 #endif 226 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 227 m_pocMsbValNeeded = false; 228 m_pocResetDeltaPoc = 0; 229 #endif 217 230 } 218 231 … … 265 278 } 266 279 } 280 267 281 Int TComSlice::getCurrMsb( Int currLsb, Int prevLsb, Int prevMsb, Int maxLsbVal ) 268 282 { … … 281 295 } 282 296 #endif 297 283 298 /** 284 299 - allocate table to contain substream sizes to be written to the slice header. … … 516 531 #endif 517 532 518 #if SVC_EXTENSION519 for( i = 0; i < m_activeNumILRRefIdx; i++ )520 {521 UInt refLayerIdc = m_interLayerPredLayerIdc[i];522 //inter-layer reference picture523 #if O0225_MAX_TID_FOR_REF_LAYERS524 Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId(),m_layerId) : 0;525 #else526 Int maxTidIlRefPicsPlus1 = ( m_layerId > 0 && m_activeNumILRRefIdx > 0)? m_pcVPS->getMaxTidIlRefPicsPlus1(ilpPic[refLayerIdc]->getSlice(0)->getLayerId()) : 0;527 #endif528 if( m_layerId > 0 && m_activeNumILRRefIdx > 0 && ( ( (Int)(ilpPic[refLayerIdc]->getSlice(0)->getTLayer())<= maxTidIlRefPicsPlus1-1) || (maxTidIlRefPicsPlus1==0 && ilpPic[refLayerIdc]->getSlice(0)->getRapPicFlag()) ) )529 {530 #if REF_IDX_MFM531 if(!(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) && getMFMEnabledFlag())532 {533 ilpPic[refLayerIdc]->copyUpsampledMvField( refLayerIdc, m_pcBaseColPic[refLayerIdc] );534 }535 else536 {537 ilpPic[refLayerIdc]->initUpsampledMvField();538 }539 #endif540 ilpPic[refLayerIdc]->setIsLongTerm(1);541 }542 }543 #endif544 533 // ref_pic_list_init 545 534 TComPic* rpsCurrList0[MAX_NUM_REF+1]; … … 595 584 UInt refLayerId = m_pcVPS->getRefLayerId( m_layerId, refLayerIdc ); 596 585 #if RESAMPLING_CONSTRAINT_BUG_FIX 586 #if MOVE_SCALED_OFFSET_TO_PPS 587 #if O0098_SCALED_REF_LAYER_ID 588 const Window &scalEL = getPPS()->getScaledRefLayerWindowForLayer(refLayerId); 589 #else 590 const Window &scalEL = getPPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]); 591 #endif 592 #else 597 593 #if O0098_SCALED_REF_LAYER_ID 598 594 const Window &scalEL = getSPS()->getScaledRefLayerWindowForLayer(refLayerId); 599 595 #else 600 596 const Window &scalEL = getSPS()->getScaledRefLayerWindow(m_interLayerPredLayerIdc[i]); 597 #endif 601 598 #endif 602 599 Int scalingOffset = ((scalEL.getWindowLeftOffset() == 0 ) && … … 1942 1939 Int nrOfPositivePictures = 0; 1943 1940 TComReferencePictureSet* pcRPS = this->getLocalRPS(); 1941 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1942 Bool pocsAdjusted = false; 1943 #endif 1944 1944 1945 1945 // loop through all pictures in the Reference Picture Set … … 1954 1954 rpcPic = *(iterPic++); 1955 1955 1956 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1957 // poc adjustement by poc reset needs to be taken into account here 1958 Int deltaPOC = pReferencePictureSet->getDeltaPOC(i) - rpcPic->getPicSym()->getSlice(0)->getPocResetDeltaPoc(); 1959 if (rpcPic->getPicSym()->getSlice(0)->getPocResetDeltaPoc() != 0) 1960 { 1961 pocsAdjusted = true; 1962 } 1963 1964 if (rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + deltaPOC && rpcPic->getSlice(0)->isReferenced()) 1965 #else 1956 1966 if(rpcPic->getPicSym()->getSlice(0)->getPOC() == this->getPOC() + pReferencePictureSet->getDeltaPOC(i) && rpcPic->getSlice(0)->isReferenced()) 1967 #endif 1957 1968 { 1958 1969 // This picture exists as a reference picture 1959 1970 // and should be added to the explicit Reference Picture Set 1971 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1972 pcRPS->setDeltaPOC(k, deltaPOC); 1973 #else 1960 1974 pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i)); 1975 #endif 1961 1976 pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP)); 1962 1977 #if ALLOW_RECOVERY_POINT_AS_RAP 1978 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1979 pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + deltaPOC < pocRandomAccess) ); 1980 #else 1963 1981 pcRPS->setUsed(k, pcRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) < pocRandomAccess) ); 1982 #endif 1964 1983 #endif 1965 1984 if(pcRPS->getDeltaPOC(k) < 0) … … 2005 2024 || useNewRPS 2006 2025 #endif 2026 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2027 || pocsAdjusted // inter RPS prediction does not work if POCs have been adjusted 2028 #endif 2007 2029 ) 2008 2030 { … … 2139 2161 UInt retVal, layerId = getLayerId(); 2140 2162 #if O0096_REP_FORMAT_INDEX 2163 #if R0279_REP_FORMAT_INBL 2164 if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 ) 2165 { 2166 #if VPS_AVC_BL_FLAG_REMOVAL 2167 if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() ) 2168 #else 2169 if( layerId == 0 && vps->getAvcBaseLayerFlag() ) 2170 #endif 2171 #else 2141 2172 if ( layerId == 0 ) 2142 2173 { 2143 2174 if( vps->getAvcBaseLayerFlag() ) 2175 #endif 2144 2176 { 2145 2177 retVal = vps->getVpsRepFormat(layerId)->getPicWidthVpsInLumaSamples(); … … 2172 2204 UInt retVal, layerId = getLayerId(); 2173 2205 #if O0096_REP_FORMAT_INDEX 2174 if( layerId == 0 ) 2206 #if R0279_REP_FORMAT_INBL 2207 if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 ) 2208 { 2209 #if VPS_AVC_BL_FLAG_REMOVAL 2210 if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() ) 2211 #else 2212 if( layerId == 0 && vps->getAvcBaseLayerFlag() ) 2213 #endif 2214 #else 2215 if ( layerId == 0 ) 2175 2216 { 2176 2217 if( vps->getAvcBaseLayerFlag() ) 2218 #endif 2177 2219 { 2178 2220 retVal = vps->getVpsRepFormat(layerId)->getPicHeightVpsInLumaSamples(); … … 2214 2256 #endif 2215 2257 #if O0096_REP_FORMAT_INDEX 2216 if( layerId == 0 ) 2258 #if R0279_REP_FORMAT_INBL 2259 if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 ) 2260 { 2261 #if VPS_AVC_BL_FLAG_REMOVAL 2262 if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() ) 2263 #else 2264 if( layerId == 0 && vps->getAvcBaseLayerFlag() ) 2265 #endif 2266 #else 2267 if ( layerId == 0 ) 2217 2268 { 2218 2269 if( vps->getAvcBaseLayerFlag() ) 2270 #endif 2219 2271 { 2220 2272 retVal = vps->getVpsRepFormat(layerId)->getChromaFormatVpsIdc(); … … 2247 2299 UInt retVal, layerId = getLayerId(); 2248 2300 #if O0096_REP_FORMAT_INDEX 2249 if( layerId == 0 ) 2301 #if R0279_REP_FORMAT_INBL 2302 if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 ) 2303 #else 2304 if ( layerId == 0 ) 2305 #endif 2250 2306 { 2251 2307 retVal = sps->getBitDepthY(); … … 2273 2329 UInt retVal, layerId = getLayerId(); 2274 2330 #if O0096_REP_FORMAT_INDEX 2275 if( layerId == 0 ) 2331 #if R0279_REP_FORMAT_INBL 2332 if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 ) 2333 #else 2334 if ( layerId == 0 ) 2335 #endif 2276 2336 { 2277 2337 retVal = sps->getBitDepthC(); … … 2301 2361 return (getBitDepthC() - 8) * 6; 2302 2362 } 2363 2364 #if R0156_CONF_WINDOW_IN_REP_FORMAT 2365 Window& TComSlice::getConformanceWindow() 2366 { 2367 TComSPS *sps = getSPS(); 2368 TComVPS *vps = getVPS(); 2369 UInt layerId = getLayerId(); 2370 #if O0096_REP_FORMAT_INDEX 2371 #if R0279_REP_FORMAT_INBL 2372 if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 ) 2373 { 2374 #if VPS_AVC_BL_FLAG_REMOVAL 2375 if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() ) 2376 #else 2377 if( layerId == 0 && vps->getAvcBaseLayerFlag() ) 2378 #endif 2379 #else 2380 if ( layerId == 0 ) 2381 { 2382 if( vps->getAvcBaseLayerFlag() ) 2383 #endif 2384 { 2385 return vps->getVpsRepFormat(layerId)->getConformanceWindowVps(); 2386 } 2387 else 2388 { 2389 return sps->getConformanceWindow(); 2390 } 2391 } 2392 else 2393 { 2394 return vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : layerId) )->getConformanceWindowVps(); 2395 } 2396 #else 2397 if( ( layerId == 0 ) || sps->getUpdateRepFormatFlag() ) 2398 { 2399 return sps->getConformanceWindow(); 2400 } 2401 else 2402 { 2403 return vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerId) )->getConformanceWindowVps(); 2404 } 2405 #endif 2406 } 2407 #endif 2303 2408 2304 2409 RepFormat::RepFormat() … … 2323 2428 m_bitDepthVpsLuma = 0; 2324 2429 m_bitDepthVpsChroma = 0; 2430 #if R0156_CONF_WINDOW_IN_REP_FORMAT 2431 m_conformanceWindowVps.resetWindow(); 2432 #endif 2325 2433 } 2326 2434 #endif … … 2333 2441 TComVPS::TComVPS() 2334 2442 : m_VPSId ( 0) 2443 #if VPS_RESERVED_FLAGS 2444 , m_baseLayerInternalFlag (true) 2445 , m_baseLayerAvailableFlag (true) 2446 #endif 2335 2447 , m_uiMaxTLayers ( 1) 2336 2448 , m_uiMaxLayers ( 1) … … 2384 2496 , m_vpsNonVuiExtLength (0) 2385 2497 #endif 2498 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2499 , m_vpsPocLsbAlignedFlag(false) 2500 #endif 2386 2501 { 2387 2502 for( Int i = 0; i < MAX_TLAYER; i++) … … 2392 2507 } 2393 2508 #if VPS_EXTN_MASK_AND_DIM_INFO 2509 #if VPS_AVC_BL_FLAG_REMOVAL 2510 m_nonHEVCBaseLayerFlag = false; 2511 #else 2394 2512 m_avcBaseLayerFlag = false; 2513 #endif 2395 2514 m_splittingFlag = false; 2396 2515 ::memset(m_scalabilityMask, 0, sizeof(m_scalabilityMask)); … … 2422 2541 ::memset(m_directDependencyType, 0, sizeof(m_directDependencyType)); 2423 2542 #endif 2543 #if !NECESSARY_LAYER_FLAG 2424 2544 #if DERIVE_LAYER_ID_LIST_VARIABLES 2425 2545 ::memset(m_layerSetLayerIdList, 0, sizeof(m_layerSetLayerIdList)); 2426 2546 ::memset(m_numLayerInIdList, 0, sizeof(m_numLayerInIdList )); 2427 2547 #endif 2548 #endif 2549 #if !PER_LAYER_PTL 2428 2550 ::memset(m_profileLevelTierIdx, 0, sizeof(m_profileLevelTierIdx)); 2551 #endif 2429 2552 m_maxOneActiveRefLayerFlag = true; 2430 2553 #if O0062_POC_LSB_NOT_PRESENT_FLAG … … 2542 2665 } 2543 2666 #if DERIVE_LAYER_ID_LIST_VARIABLES 2667 #if NECESSARY_LAYER_FLAG 2668 Void TComVPS::deriveLayerIdListVariables() 2669 { 2670 // For layer 0 2671 m_numLayerInIdList.push_back(1); 2672 m_layerSetLayerIdList.resize(m_numLayerSets); 2673 m_layerSetLayerIdList[0].push_back(0); 2674 2675 // For other layers 2676 for( Int i = 1; i < m_numLayerSets; i++ ) 2677 { 2678 for( Int m = 0; m <= m_maxLayerId; m++) 2679 { 2680 if( m_layerIdIncludedFlag[i][m] ) 2681 { 2682 m_layerSetLayerIdList[i].push_back(m); 2683 } 2684 } 2685 m_numLayerInIdList.push_back(m_layerSetLayerIdList[i].size()); 2686 } 2687 } 2688 #else 2544 2689 Void TComVPS::deriveLayerIdListVariables() 2545 2690 { … … 2564 2709 } 2565 2710 #endif 2711 #endif 2566 2712 #if !RESOLUTION_BASED_DPB 2567 2713 #if VPS_DPB_SIZE_TABLE … … 2660 2806 Void TComVPS::setPredictedLayerIds() 2661 2807 { 2662 for (UInt i = 0; i < getMaxLayers()- 1; i++)2663 { 2664 UInt iNuhLId = getLayerIdInNuh(i);2808 for (UInt i = 0; i < m_uiMaxLayers - 1; i++) 2809 { 2810 UInt iNuhLId = m_layerIdInNuh[i]; 2665 2811 UInt predIdx = 0; 2666 2812 for (UInt j = iNuhLId + 1; j < MAX_NUM_LAYER_IDS; j++) 2667 2813 { 2668 if (getRecursiveRefLayerFlag(j, iNuhLId))2669 { 2670 setPredictedLayerId(i, predIdx, j);2814 if( m_recursiveRefLayerFlag[j][iNuhLId] ) 2815 { 2816 m_predictedLayerId[iNuhLId][predIdx] = j; 2671 2817 predIdx++; 2672 2818 } 2673 2819 } 2674 setNumPredictedLayers(iNuhLId, predIdx); 2675 } 2820 m_numPredictedLayers[iNuhLId] = predIdx; 2821 } 2822 m_numPredictedLayers[m_layerIdInNuh[m_uiMaxLayers-1]] = 0; 2676 2823 } 2677 2824 … … 2679 2826 { 2680 2827 Bool countedLayerIdxFlag[MAX_NUM_LAYER_IDS]; 2681 2682 for (UInt i = 0; i <= getMaxLayers() - 1; i++) 2683 { 2684 countedLayerIdxFlag[i] = false; 2685 } 2828 memset( countedLayerIdxFlag, 0, sizeof(countedLayerIdxFlag) ); 2686 2829 2687 2830 Int numIndependentLayers = 0; 2688 2831 2689 for (UInt i = 0; i < = getMaxLayers() - 1; i++)2690 { 2691 UInt iNuhLId = getLayerIdInNuh(i);2692 if (getNumDirectRefLayers(iNuhLId) == 0)2693 { 2694 setTreePartitionLayerId(numIndependentLayers, 0, iNuhLId);2695 setNumLayersInTreePartition(numIndependentLayers, 1);2696 for (UInt j = 0; j < getNumPredictedLayers(iNuhLId); j++)2697 { 2698 if (!countedLayerIdxFlag[getLayerIdInVps(iNuhLId)])2699 { 2700 setTreePartitionLayerId(numIndependentLayers, getNumLayersInTreePartition(numIndependentLayers), getPredictedLayerId(iNuhLId, j));2701 setNumLayersInTreePartition(numIndependentLayers, getNumLayersInTreePartition(numIndependentLayers) + 1);2702 countedLayerIdxFlag[ getLayerIdInVps(getPredictedLayerId(iNuhLId, j))] = true;2832 for (UInt i = 0; i < m_uiMaxLayers; i++) 2833 { 2834 UInt iNuhLId = m_layerIdInNuh[i]; 2835 if( m_numDirectRefLayers[iNuhLId] == 0 ) 2836 { 2837 m_treePartitionLayerIdList[numIndependentLayers][0] = iNuhLId; 2838 m_numLayersInTreePartition[numIndependentLayers] = 1; 2839 for( UInt j = 0; j < m_numPredictedLayers[iNuhLId]; j++ ) 2840 { 2841 if( !countedLayerIdxFlag[m_layerIdInVps[iNuhLId]] ) 2842 { 2843 m_treePartitionLayerIdList[numIndependentLayers][m_numLayersInTreePartition[numIndependentLayers]] = m_predictedLayerId[iNuhLId][j]; 2844 m_numLayersInTreePartition[numIndependentLayers] = m_numLayersInTreePartition[numIndependentLayers] + 1; 2845 countedLayerIdxFlag[m_layerIdInVps[m_predictedLayerId[iNuhLId][j]]] = true; 2703 2846 } 2704 2847 } … … 2707 2850 } 2708 2851 2709 setNumIndependentLayers(numIndependentLayers);2852 m_numIndependentLayers = numIndependentLayers; 2710 2853 } 2711 2854 2712 2855 void TComVPS::setLayerIdIncludedFlagsForAddLayerSets() 2713 2856 { 2714 for (UInt i = 0; i < getNumAddLayerSets(); i++)2715 { 2716 for (UInt j = 1; j < getNumIndependentLayers(); j++)2857 for (UInt i = 0; i < m_numAddLayerSets; i++) 2858 { 2859 for (UInt j = 1; j < m_numIndependentLayers; j++) 2717 2860 { 2718 2861 Int layerNum = 0; 2719 Int lsIdx = getVpsNumLayerSetsMinus1()+ 1 + i;2862 Int lsIdx = m_vpsNumLayerSetsMinus1 + 1 + i; 2720 2863 for (Int layerId = 0; layerId < MAX_VPS_LAYER_ID_PLUS1; layerId++) 2721 2864 { 2722 setLayerIdIncludedFlag(false, lsIdx, layerId);2723 } 2724 for (Int treeIdx = 1; treeIdx < getNumIndependentLayers(); treeIdx++)2725 { 2726 for (Int layerCnt = 0; layerCnt < getHighestLayerIdxPlus1(i, j); layerCnt++)2727 { 2728 setLayerSetLayerIdList(lsIdx, layerNum, getTreePartitionLayerId(treeIdx, layerCnt));2729 setLayerIdIncludedFlag(true, lsIdx, getTreePartitionLayerId(treeIdx, layerCnt));2865 m_layerIdIncludedFlag[lsIdx][layerId] = false; 2866 } 2867 for (Int treeIdx = 1; treeIdx < m_numIndependentLayers; treeIdx++) 2868 { 2869 for (Int layerCnt = 0; layerCnt < m_highestLayerIdxPlus1[i][j]; layerCnt++) 2870 { 2871 m_layerSetLayerIdList[lsIdx][layerNum] = m_treePartitionLayerIdList[treeIdx][layerCnt]; 2872 m_layerIdIncludedFlag[lsIdx][m_treePartitionLayerIdList[treeIdx][layerCnt]] = true; 2730 2873 layerNum++; 2731 2874 } 2732 2875 } 2733 setNumLayersInIdList(lsIdx, layerNum);2876 m_numLayerInIdList[lsIdx] = layerNum; 2734 2877 } 2735 2878 } … … 2979 3122 } 2980 3123 #endif 3124 #if NECESSARY_LAYER_FLAG 3125 Void TComVPS::deriveNecessaryLayerFlag() 3126 { 3127 m_necessaryLayerFlag.empty(); 3128 m_numNecessaryLayers.empty(); 3129 // Assumed that output layer sets and variables RecursiveRefLayer are already derived 3130 for( Int olsIdx = 0; olsIdx < getNumOutputLayerSets(); olsIdx++) 3131 { 3132 deriveNecessaryLayerFlag(olsIdx); 3133 } 3134 } 3135 Void TComVPS::deriveNecessaryLayerFlag(Int const olsIdx) 3136 { 3137 Int lsIdx = this->getOutputLayerSetIdx( olsIdx ); 3138 Int numLayersInLs = this->getNumLayersInIdList( lsIdx ); 3139 assert( m_necessaryLayerFlag.size() == olsIdx ); // Function should be called in the correct order. 3140 m_necessaryLayerFlag.push_back( std::vector<Bool>( numLayersInLs, false ) ); // Initialize to false 3141 for( Int lsLayerIdx = 0; lsLayerIdx < numLayersInLs; lsLayerIdx++ ) 3142 { 3143 if( this->m_outputLayerFlag[olsIdx][lsLayerIdx] ) 3144 { 3145 m_necessaryLayerFlag[olsIdx][lsLayerIdx] = true; 3146 Int currNuhLayerId = this->m_layerSetLayerIdList[lsIdx][lsLayerIdx]; 3147 for( Int rLsLayerIdx = 0; rLsLayerIdx < lsLayerIdx; rLsLayerIdx++ ) 3148 { 3149 Int refNuhLayerId = this->m_layerSetLayerIdList[lsIdx][rLsLayerIdx]; 3150 if( this->m_recursiveRefLayerFlag[currNuhLayerId][refNuhLayerId] ) 3151 { 3152 m_necessaryLayerFlag[olsIdx][rLsLayerIdx] = true; 3153 } 3154 } 3155 } 3156 } 3157 m_numNecessaryLayers.push_back(std::accumulate(m_necessaryLayerFlag[olsIdx].begin(), m_necessaryLayerFlag[olsIdx].end(), 0)); 3158 } 3159 Void TComVPS::checkNecessaryLayerFlagCondition() 3160 { 3161 /* It is a requirement of bitstream conformance that for each layer index layerIdx in the range of 3162 ( vps_base_layer_internal_flag ? 0 : 1 ) to MaxLayersMinus1, inclusive, there shall be at least one OLS with index olsIdx such that 3163 NecessaryLayerFlag[ olsIdx ][ lsLayerIdx ] is equal to 1 for the value of lsLayerIdx 3164 for which LayerSetLayerIdList[ OlsIdxToLsIdx[ olsIdx ] ][ lsLayerIdx ] is equal to layer_id_in_nuh[ layerIdx ]. */ 3165 for(Int layerIdx = this->getBaseLayerInternalFlag() ? 0 : 1; layerIdx < this->getMaxLayers(); layerIdx++) 3166 { 3167 Bool layerFoundNecessaryLayerFlag = false; 3168 for(Int olsIdx = 0; olsIdx < this->getNumOutputLayerSets(); olsIdx++) 3169 { 3170 Int lsIdx = this->getOutputLayerSetIdx( olsIdx ); 3171 Int currNuhLayerId = this->getLayerIdInNuh( layerIdx ); 3172 std::vector<Int>::iterator iter = std::find( m_layerSetLayerIdList[lsIdx].begin(), m_layerSetLayerIdList[lsIdx].end(), currNuhLayerId ); 3173 if( iter != m_layerSetLayerIdList[lsIdx].end() ) // Layer present in layer set 3174 { 3175 size_t positionLayer = iter - m_layerSetLayerIdList[lsIdx].begin(); 3176 if( *(m_necessaryLayerFlag[olsIdx].begin() + positionLayer) == true ) 3177 { 3178 layerFoundNecessaryLayerFlag = true; 3179 break; 3180 } 3181 } 3182 } 3183 assert( layerFoundNecessaryLayerFlag ); 3184 } 3185 } 3186 #endif 3187 #if PER_LAYER_PTL 3188 Int TComVPS::calculateLenOfSyntaxElement( Int const numVal ) 3189 { 3190 Int numBits = 1; 3191 while((1 << numBits) < numVal) 3192 { 3193 numBits++; 3194 } 3195 return numBits; 3196 } 3197 #endif 3198 #if SUB_LAYERS_IN_LAYER_SET 3199 Void TComVPS::calculateMaxSLInLayerSets() 3200 { 3201 for(Int lsIdx = 0; lsIdx < getNumLayerSets(); lsIdx++) 3202 { 3203 UInt maxSLMinus1 = 0; 3204 for(Int k = 0; k < getNumLayersInIdList(lsIdx); k++ ) { 3205 Int lId = getLayerSetLayerIdList(lsIdx, k); 3206 maxSLMinus1 = std::max(maxSLMinus1, getMaxTSLayersMinus1(getLayerIdInVps(lId))); 3207 } 3208 setMaxSLayersInLayerSetMinus1(lsIdx,maxSLMinus1); 3209 } 3210 } 3211 #endif 3212 2981 3213 #if RESOLUTION_BASED_DPB 2982 3214 // RepFormat Assignment operator … … 2992 3224 m_bitDepthVpsLuma = other.m_bitDepthVpsLuma; 2993 3225 m_bitDepthVpsChroma = other.m_bitDepthVpsChroma; 3226 #if R0156_CONF_WINDOW_IN_REP_FORMAT 3227 m_conformanceWindowVps = other.m_conformanceWindowVps; 3228 #endif 2994 3229 } 2995 3230 return *this; … … 3016 3251 , m_chromaFormatIdc (CHROMA_420) 3017 3252 , m_uiMaxTLayers ( 1) 3253 #if R0279_REP_FORMAT_INBL 3254 , m_bV1CompatibleSPSFlag ( 0) 3255 #endif 3018 3256 // Structure 3019 3257 , m_picWidthInLumaSamples (352) … … 3052 3290 , m_layerId ( 0 ) 3053 3291 , m_extensionFlag ( false ) 3292 #if !MOVE_SCALED_OFFSET_TO_PPS 3054 3293 , m_numScaledRefLayerOffsets ( 0 ) 3294 #endif 3055 3295 #if REPN_FORMAT_IN_VPS 3056 3296 , m_updateRepFormatFlag (false) … … 3075 3315 ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag)); 3076 3316 3317 #if !MOVE_SCALED_OFFSET_TO_PPS 3077 3318 #if P0312_VERT_PHASE_ADJ 3078 3319 ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag)); 3320 #endif 3079 3321 #endif 3080 3322 } … … 3208 3450 const Int TComSPS::m_winUnitY[]={1,2,1,1}; 3209 3451 3452 #if !MOVE_SCALED_OFFSET_TO_PPS 3210 3453 #if O0098_SCALED_REF_LAYER_ID 3211 3454 Window& TComSPS::getScaledRefLayerWindowForLayer(Int layerId) … … 3224 3467 return win; 3225 3468 } 3469 #endif 3470 #if REF_REGION_OFFSET 3471 Window& TComSPS::getRefLayerWindowForLayer(Int layerId) 3472 { 3473 static Window win; 3474 3475 for (Int i = 0; i < m_numRefLayerOffsets; i++) 3476 { 3477 if (layerId == m_refLayerId[i]) 3478 { 3479 return m_refLayerWindow[i]; 3480 } 3481 } 3482 3483 win.resetWindow(); // reference region offsets are inferred to be zero when not present 3484 return win; 3485 } 3486 #endif 3226 3487 #endif 3227 3488 … … 3246 3507 , m_entropyCodingSyncEnabledFlag (false) 3247 3508 , m_loopFilterAcrossTilesEnabledFlag (true) 3248 , m_uniformSpacingFlag (0) 3249 , m_iNumColumnsMinus1 (0) 3250 , m_puiColumnWidth (NULL) 3251 , m_iNumRowsMinus1 (0) 3252 , m_puiRowHeight (NULL) 3253 , m_iNumSubstreams (1) 3509 , m_uniformSpacingFlag (false) 3510 , m_numTileColumnsMinus1 (0) 3511 , m_numTileRowsMinus1 (0) 3512 , m_numSubstreams (1) 3254 3513 , m_signHideFlag(0) 3255 3514 , m_cabacInitPresentFlag (false) … … 3269 3528 , m_pocResetInfoPresentFlag (false) 3270 3529 #endif 3530 #if MOVE_SCALED_OFFSET_TO_PPS 3531 , m_numScaledRefLayerOffsets ( 0 ) 3532 #endif 3271 3533 #if Q0048_CGS_3D_ASYMLUT 3272 3534 , m_nCGSFlag(0) … … 3277 3539 { 3278 3540 m_scalingList = new TComScalingList; 3541 #if REF_REGION_OFFSET 3542 ::memset(m_scaledRefLayerOffsetPresentFlag, 0, sizeof(m_scaledRefLayerOffsetPresentFlag)); 3543 ::memset(m_refRegionOffsetPresentFlag, 0, sizeof(m_refRegionOffsetPresentFlag)); 3544 #endif 3545 #if R0209_GENERIC_PHASE 3546 ::memset(m_resamplePhaseSetPresentFlag, 0, sizeof(m_resamplePhaseSetPresentFlag)); 3547 ::memset(m_phaseHorLuma, 0, sizeof(m_phaseHorLuma)); 3548 ::memset(m_phaseVerLuma, 0, sizeof(m_phaseVerLuma)); 3549 ::memset(m_phaseHorChroma, 0, sizeof(m_phaseHorChroma)); 3550 ::memset(m_phaseVerChroma, 0, sizeof(m_phaseVerChroma)); 3551 #endif 3279 3552 } 3280 3553 3281 3554 TComPPS::~TComPPS() 3282 3555 { 3283 if( m_iNumColumnsMinus1 > 0 && m_uniformSpacingFlag == 0 )3284 {3285 if (m_puiColumnWidth) delete [] m_puiColumnWidth;3286 m_puiColumnWidth = NULL;3287 }3288 if( m_iNumRowsMinus1 > 0 && m_uniformSpacingFlag == 0 )3289 {3290 if (m_puiRowHeight) delete [] m_puiRowHeight;3291 m_puiRowHeight = NULL;3292 }3293 3294 3556 #if SCALINGLIST_INFERRING 3295 3557 if( !m_inferScalingListFlag ) … … 3297 3559 delete m_scalingList; 3298 3560 } 3561 3562 #if MOVE_SCALED_OFFSET_TO_PPS 3563 #if O0098_SCALED_REF_LAYER_ID 3564 Window& TComPPS::getScaledRefLayerWindowForLayer(Int layerId) 3565 { 3566 static Window win; 3567 3568 for (Int i = 0; i < m_numScaledRefLayerOffsets; i++) 3569 { 3570 if (layerId == m_scaledRefLayerId[i]) 3571 { 3572 return m_scaledRefLayerWindow[i]; 3573 } 3574 } 3575 3576 win.resetWindow(); // scaled reference layer offsets are inferred to be zero when not present 3577 return win; 3578 } 3579 #endif 3580 #if REF_REGION_OFFSET 3581 Window& TComPPS::getRefLayerWindowForLayer(Int layerId) 3582 { 3583 static Window win; 3584 3585 for (Int i = 0; i < m_numScaledRefLayerOffsets; i++) 3586 { 3587 if (layerId == m_scaledRefLayerId[i]) 3588 { 3589 return m_refLayerWindow[i]; 3590 } 3591 } 3592 3593 win.resetWindow(); // reference region offsets are inferred to be zero when not present 3594 return win; 3595 } 3596 #endif 3597 3598 #if RESAMPLING_FIX 3599 #if R0209_GENERIC_PHASE 3600 Bool TComPPS::hasZeroResamplingPhase(Int refLayerIdc) 3601 { 3602 Int phaseHorLuma = this->getPhaseHorLuma(refLayerIdc); 3603 Int phaseVerLuma = this->getPhaseVerLuma(refLayerIdc); 3604 Int phaseHorChroma = this->getPhaseHorChroma(refLayerIdc); 3605 Int phaseVerChroma = this->getPhaseVerChroma(refLayerIdc); 3606 return ( phaseHorLuma == 0 && phaseHorChroma == 0 && phaseVerLuma == 0 && phaseVerChroma == 0); 3607 } 3608 #endif 3609 #endif 3610 3611 #endif 3299 3612 3300 3613 TComReferencePictureSet::TComReferencePictureSet() … … 3718 4031 ParameterSetManager::ParameterSetManager() 3719 4032 #if SVC_EXTENSION 3720 : m_spsMap(MAX_NUM_SPS) 3721 , m_ppsMap(MAX_NUM_PPS) 3722 , m_activeSPSId(-1) 4033 : m_activeSPSId(-1) 3723 4034 , m_activePPSId(-1) 3724 4035 #else … … 3854 4165 3855 4166 #if SVC_EXTENSION 3856 #if AVC_SYNTAX3857 Void TComSlice::initBaseLayerRPL( TComSlice *pcSlice )3858 {3859 // Assumed that RPL of the base layer is same to the EL, otherwise this information should be also dumped and read from the metadata file3860 setPOC( pcSlice->getPOC() );3861 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA )3862 {3863 setSliceType( I_SLICE );3864 }3865 else3866 {3867 setSliceType( pcSlice->getSliceType() );3868 }3869 3870 if( this->isIntra() )3871 {3872 return;3873 }3874 3875 //initialize reference POC of BL3876 for( Int iRefPicList = 0; iRefPicList < 2; iRefPicList++ )3877 {3878 RefPicList eRefPicList = RefPicList( iRefPicList );3879 3880 assert( pcSlice->getNumRefIdx( eRefPicList) >= 0 );3881 setNumRefIdx( eRefPicList, pcSlice->getNumRefIdx( eRefPicList ) - 1 );3882 assert( getNumRefIdx( eRefPicList) <= MAX_NUM_REF);3883 3884 for(Int refIdx = 0; refIdx < getNumRefIdx( eRefPicList ); refIdx++)3885 {3886 setRefPOC( pcSlice->getRefPic( eRefPicList, refIdx )->getPOC(), eRefPicList, refIdx );3887 setRefPic( pcSlice->getRefPic( eRefPicList, refIdx ), eRefPicList, refIdx );3888 /*3889 // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused.3890 getRefPic( eRefPicList, refIdx )->setLayerId( 0 );3891 getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() );3892 */3893 3894 }3895 }3896 return;3897 }3898 #endif3899 3900 4167 Bool TComSlice::setBaseColPic( TComList<TComPic*>& rcListPic, UInt refLayerIdc ) 3901 4168 { … … 3939 4206 #endif 3940 4207 3941 #if REF_IDX_MFM3942 Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic** pcRefPicRL )3943 {3944 for( UInt i = 0; i < m_activeNumILRRefIdx; i++ )3945 {3946 UInt refLayerIdc = m_interLayerPredLayerIdc[i];3947 3948 TComPic* pcRefPicBL = pcRefPicRL[refLayerIdc];3949 3950 //set reference picture POC of each ILP reference3951 Int thePoc = ilpPic[refLayerIdc]->getPOC();3952 assert(thePoc == pcRefPicBL->getPOC());3953 3954 ilpPic[refLayerIdc]->getSlice(0)->setBaseColPic( refLayerIdc, pcRefPicBL );3955 3956 //copy layer id from the reference layer3957 ilpPic[refLayerIdc]->setLayerId( pcRefPicBL->getLayerId() );3958 3959 //copy slice type from the reference layer3960 ilpPic[refLayerIdc]->getSlice(0)->setSliceType( pcRefPicBL->getSlice(0)->getSliceType() );3961 3962 //copy "used for reference"3963 ilpPic[refLayerIdc]->getSlice(0)->setReferenced( pcRefPicBL->getSlice(0)->isReferenced() );3964 3965 for( Int refList = 0; refList < 2; refList++ )3966 {3967 RefPicList refPicList = RefPicList( refList );3968 3969 //set reference POC of ILP3970 ilpPic[refLayerIdc]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList));3971 assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) >= 0);3972 assert(ilpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF);3973 3974 //initialize reference POC of ILP3975 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++)3976 {3977 ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx);3978 ilpPic[refLayerIdc]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx);3979 }3980 3981 for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++)3982 {3983 ilpPic[refLayerIdc]->getSlice(0)->setRefPOC(0, refPicList, refIdx);3984 ilpPic[refLayerIdc]->getSlice(0)->setRefPic(NULL, refPicList, refIdx);3985 }3986 3987 //copy reference pictures' marking from the reference layer3988 for(Int j = 0; j < MAX_NUM_REF + 1; j++)3989 {3990 ilpPic[refLayerIdc]->getSlice(0)->setIsUsedAsLongTerm(refList, j, pcRefPicBL->getSlice(0)->getIsUsedAsLongTerm(refList, j));3991 }3992 }3993 }3994 return;3995 }3996 #endif3997 3998 4208 Void TComSlice::setILRPic(TComPic **pcIlpPic) 3999 4209 { … … 4004 4214 if( pcIlpPic[refLayerIdc] ) 4005 4215 { 4006 pcIlpPic[refLayerIdc]->copyUpsampledPictureYuv( m_pcPic->getFullPelBaseRec( refLayerIdc ), pcIlpPic[refLayerIdc]->getPicYuvRec() ); 4216 TComPic* pcRefPicBL = m_pcBaseColPic[refLayerIdc]; 4217 4218 // copy scalability ratio, it is needed to get the correct location for the motion field of the corresponding reference layer block 4219 pcIlpPic[refLayerIdc]->setSpatialEnhLayerFlag( refLayerIdc, m_pcPic->isSpatialEnhLayer(refLayerIdc) ); 4220 4221 pcIlpPic[refLayerIdc]->copyUpsampledPictureYuv( m_pcPic->getFullPelBaseRec( refLayerIdc ), pcIlpPic[refLayerIdc]->getPicYuvRec() ); 4222 pcIlpPic[refLayerIdc]->getSlice(0)->setBaseColPic( refLayerIdc, pcRefPicBL ); 4223 4224 //set reference picture POC of each ILP reference 4007 4225 pcIlpPic[refLayerIdc]->getSlice(0)->setPOC( m_iPOC ); 4008 pcIlpPic[refLayerIdc]->setLayerId( m_pcBaseColPic[refLayerIdc]->getLayerId() ); //set reference layerId 4226 4227 //set temporal Id 4228 pcIlpPic[refLayerIdc]->getSlice(0)->setTLayer( m_uiTLayer ); 4229 4230 //copy layer id from the reference layer 4231 pcIlpPic[refLayerIdc]->setLayerId( pcRefPicBL->getLayerId() ); 4232 4009 4233 pcIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension( false ); 4010 4234 pcIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder(); … … 4013 4237 pcIlpPic[refLayerIdc]->getPicSym()->getCU(j)->setLayerId( pcIlpPic[refLayerIdc]->getLayerId() ); 4014 4238 } 4015 } 4016 } 4017 } 4018 4239 pcIlpPic[refLayerIdc]->setIsLongTerm(1); 4240 4241 #if REF_IDX_MFM 4242 if( m_bMFMEnabledFlag && !(m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP && m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) ) 4243 { 4244 //set reference picture POC of each ILP reference 4245 assert( pcIlpPic[refLayerIdc]->getPOC() == pcRefPicBL->getPOC() ); 4246 4247 //copy slice type from the reference layer 4248 pcIlpPic[refLayerIdc]->getSlice(0)->setSliceType( pcRefPicBL->getSlice(0)->getSliceType() ); 4249 4250 //copy "used for reference" 4251 pcIlpPic[refLayerIdc]->getSlice(0)->setReferenced( pcRefPicBL->getSlice(0)->isReferenced() ); 4252 4253 for( Int refList = 0; refList < 2; refList++ ) 4254 { 4255 RefPicList refPicList = RefPicList( refList ); 4256 4257 //set reference POC of ILP 4258 pcIlpPic[refLayerIdc]->getSlice(0)->setNumRefIdx(refPicList, pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList)); 4259 assert(pcIlpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) >= 0); 4260 assert(pcIlpPic[refLayerIdc]->getSlice(0)->getNumRefIdx(refPicList) <= MAX_NUM_REF); 4261 4262 //initialize reference POC of ILP 4263 for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx++) 4264 { 4265 pcIlpPic[refLayerIdc]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(refPicList, refIdx), refPicList, refIdx); 4266 pcIlpPic[refLayerIdc]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(refPicList, refIdx), refPicList, refIdx); 4267 } 4268 4269 for(Int refIdx = pcRefPicBL->getSlice(0)->getNumRefIdx(refPicList); refIdx < MAX_NUM_REF; refIdx++) 4270 { 4271 pcIlpPic[refLayerIdc]->getSlice(0)->setRefPOC(0, refPicList, refIdx); 4272 pcIlpPic[refLayerIdc]->getSlice(0)->setRefPic(NULL, refPicList, refIdx); 4273 } 4274 4275 //copy reference pictures' marking from the reference layer 4276 for(Int j = 0; j < MAX_NUM_REF + 1; j++) 4277 { 4278 pcIlpPic[refLayerIdc]->getSlice(0)->setIsUsedAsLongTerm(refList, j, pcRefPicBL->getSlice(0)->getIsUsedAsLongTerm(refList, j)); 4279 } 4280 } 4281 4282 pcIlpPic[refLayerIdc]->copyUpsampledMvField( refLayerIdc, m_pcBaseColPic[refLayerIdc] ); 4283 } 4284 else 4285 { 4286 pcIlpPic[refLayerIdc]->initUpsampledMvField(); 4287 } 4288 #endif 4289 4290 #if O0225_MAX_TID_FOR_REF_LAYERS 4291 Int maxTidIlRefPicsPlus1 = m_pcVPS->getMaxTidIlRefPicsPlus1( pcIlpPic[refLayerIdc]->getSlice(0)->getLayerId(), m_layerId ); 4292 #else 4293 Int maxTidIlRefPicsPlus1 = m_pcVPS->getMaxTidIlRefPicsPlus1( pcIlpPic[refLayerIdc]->getSlice(0)->getLayerId() ); 4294 #endif 4295 assert( (Int)pcIlpPic[refLayerIdc]->getSlice(0)->getTLayer() < maxTidIlRefPicsPlus1 || ( !maxTidIlRefPicsPlus1 && pcIlpPic[refLayerIdc]->getSlice(0)->getRapPicFlag() ) ); 4296 4297 } 4298 } 4299 } 4300 4301 Int TComSlice::getReferenceLayerIdc( UInt refLayerId ) 4302 { 4303 for( Int i = 0; i < m_activeNumILRRefIdx; i++ ) 4304 { 4305 if( m_pcVPS->getRefLayerId(m_layerId, m_interLayerPredLayerIdc[i]) == refLayerId ) 4306 { 4307 return m_interLayerPredLayerIdc[i]; 4308 } 4309 } 4310 4311 return -1; 4312 } 4019 4313 #endif //SVC_EXTENSION 4020 4314 -
trunk/source/Lib/TLibCommon/TComSlice.h
r815 r906 370 370 UInt getNumDU ( ) { return m_numDU; } 371 371 Bool getCpbDpbDelaysPresentFlag() { return getNalHrdParametersPresentFlag() || getVclHrdParametersPresentFlag(); } 372 373 #if VPS_VUI_BSP_HRD_PARAMS 374 Void copyCommonInformation( TComHRD *refHrd ) 375 { 376 m_nalHrdParametersPresentFlag = refHrd->getNalHrdParametersPresentFlag(); 377 m_vclHrdParametersPresentFlag = refHrd->getVclHrdParametersPresentFlag(); 378 m_subPicCpbParamsPresentFlag = refHrd->getSubPicCpbParamsPresentFlag(); 379 m_tickDivisorMinus2 = refHrd->getTickDivisorMinus2(); 380 m_duCpbRemovalDelayLengthMinus1 = refHrd->getDuCpbRemovalDelayLengthMinus1(); 381 m_subPicCpbParamsInPicTimingSEIFlag = refHrd->getSubPicCpbParamsInPicTimingSEIFlag(); 382 m_dpbOutputDelayDuLengthMinus1 = refHrd->getDpbOutputDelayDuLengthMinus1(); 383 m_bitRateScale = refHrd->getBitRateScale(); 384 m_cpbSizeScale = refHrd->getCpbSizeScale(); 385 m_ducpbSizeScale = refHrd->getDuCpbSizeScale(); 386 m_initialCpbRemovalDelayLengthMinus1 = refHrd->getInitialCpbRemovalDelayLengthMinus1(); 387 m_cpbRemovalDelayLengthMinus1 = refHrd->getCpbRemovalDelayLengthMinus1(); 388 m_dpbOutputDelayLengthMinus1 = refHrd->getDpbOutputDelayLengthMinus1(); 389 } 390 #endif 372 391 }; 373 392 … … 403 422 }; 404 423 424 class Window 425 { 426 private: 427 Bool m_enabledFlag; 428 Int m_winLeftOffset; 429 Int m_winRightOffset; 430 Int m_winTopOffset; 431 Int m_winBottomOffset; 432 #if P0312_VERT_PHASE_ADJ 433 Bool m_vertPhasePositionEnableFlag; 434 #endif 435 public: 436 Window() 437 : m_enabledFlag (false) 438 , m_winLeftOffset (0) 439 , m_winRightOffset (0) 440 , m_winTopOffset (0) 441 , m_winBottomOffset (0) 442 #if P0312_VERT_PHASE_ADJ 443 , m_vertPhasePositionEnableFlag(false) 444 #endif 445 { } 446 447 Bool getWindowEnabledFlag() const { return m_enabledFlag; } 448 #if P0312_VERT_PHASE_ADJ 449 Void resetWindow() { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; m_vertPhasePositionEnableFlag = false; } 450 #else 451 Void resetWindow() { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0;} 452 #endif 453 Int getWindowLeftOffset() const { return m_enabledFlag ? m_winLeftOffset : 0; } 454 Void setWindowLeftOffset(Int val) { if(val) {m_winLeftOffset = val; m_enabledFlag = true;} } 455 Int getWindowRightOffset() const { return m_enabledFlag ? m_winRightOffset : 0; } 456 Void setWindowRightOffset(Int val) { if(val) {m_winRightOffset = val; m_enabledFlag = true;} } 457 Int getWindowTopOffset() const { return m_enabledFlag ? m_winTopOffset : 0; } 458 Void setWindowTopOffset(Int val) { if(val) {m_winTopOffset = val; m_enabledFlag = true;} } 459 Int getWindowBottomOffset() const { return m_enabledFlag ? m_winBottomOffset: 0; } 460 Void setWindowBottomOffset(Int val) { if(val) {m_winBottomOffset = val; m_enabledFlag = true;} } 461 #if P0312_VERT_PHASE_ADJ 462 Bool getVertPhasePositionEnableFlag() const { return m_vertPhasePositionEnableFlag; } 463 Void setVertPhasePositionEnableFlag(Bool val) { m_vertPhasePositionEnableFlag = val; } 464 #endif 465 #if REF_REGION_OFFSET && RESAMPLING_FIX 466 Bool hasEqualOffset(const Window& ref) const 467 { 468 return ( this->getWindowLeftOffset() == ref.getWindowLeftOffset() 469 && this->getWindowTopOffset() == ref.getWindowTopOffset() 470 && this->getWindowRightOffset() == ref.getWindowRightOffset() 471 && this->getWindowBottomOffset() == ref.getWindowBottomOffset() ); 472 } 473 #endif 474 475 #if P0312_VERT_PHASE_ADJ 476 Void setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom, Bool vertPhasePositionEnableFlag = 0) 477 #else 478 Void setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom) 479 #endif 480 { 481 if(offsetLeft || offsetLRight || offsetLTop || offsetLBottom) 482 { 483 m_enabledFlag = true; 484 m_winLeftOffset = offsetLeft; 485 m_winRightOffset = offsetLRight; 486 m_winTopOffset = offsetLTop; 487 m_winBottomOffset = offsetLBottom; 488 } 489 #if P0312_VERT_PHASE_ADJ 490 m_vertPhasePositionEnableFlag = vertPhasePositionEnableFlag; 491 #endif 492 } 493 }; 494 405 495 #if REPN_FORMAT_IN_VPS 406 496 class RepFormat … … 420 510 Int m_bitDepthVpsChroma; // coded as minus8 421 511 512 #if R0156_CONF_WINDOW_IN_REP_FORMAT 513 Window m_conformanceWindowVps; 514 #endif 515 422 516 public: 423 517 RepFormat(); … … 454 548 Int getBitDepthVpsChroma() { return m_bitDepthVpsChroma; } 455 549 Void setBitDepthVpsChroma(Int x) { m_bitDepthVpsChroma = x; } 550 551 #if R0156_CONF_WINDOW_IN_REP_FORMAT 552 Window& getConformanceWindowVps() { return m_conformanceWindowVps; } 553 Void setConformanceWindowVps(Window& conformanceWindow ) { m_conformanceWindowVps = conformanceWindow; } 554 #endif 456 555 }; 457 556 #endif … … 460 559 private: 461 560 Int m_VPSId; 561 #if VPS_RESERVED_FLAGS 562 Bool m_baseLayerInternalFlag; 563 Bool m_baseLayerAvailableFlag; 564 #endif 462 565 UInt m_uiMaxTLayers; 463 566 UInt m_uiMaxLayers; … … 485 588 #if DERIVE_LAYER_ID_LIST_VARIABLES 486 589 #if Q0078_ADD_LAYER_SETS 590 #if NECESSARY_LAYER_FLAG 591 std::vector< std::vector<Int> > m_layerSetLayerIdList; 592 std::vector<Int> m_numLayerInIdList;; 593 #else 487 594 Int m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1 + MAX_NUM_ADD_LAYER_SETS][MAX_VPS_LAYER_ID_PLUS1]; 488 595 Int m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1 + MAX_NUM_ADD_LAYER_SETS]; 596 #endif 489 597 #else 490 598 Int m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1]; … … 510 618 // ------------------------------------------ 511 619 #if VPS_EXTN_MASK_AND_DIM_INFO 620 #if VPS_AVC_BL_FLAG_REMOVAL 621 Bool m_nonHEVCBaseLayerFlag; 622 #else 512 623 Bool m_avcBaseLayerFlag; // For now, always set to true. 624 #endif 513 625 Bool m_splittingFlag; 514 626 Bool m_scalabilityMask[MAX_VPS_NUM_SCALABILITY_TYPES]; … … 576 688 #endif 577 689 #endif 690 #if PER_LAYER_PTL 691 std::vector< std::vector<Int> > m_profileLevelTierIdx; 692 #else 578 693 Int m_profileLevelTierIdx[64]; 694 #endif 579 695 Bool m_maxOneActiveRefLayerFlag; 580 696 #if O0062_POC_LSB_NOT_PRESENT_FLAG … … 717 833 #if O0164_MULTI_LAYER_HRD 718 834 Bool m_vpsVuiBspHrdPresentFlag; 835 #if VPS_VUI_BSP_HRD_PARAMS 836 Int m_vpsNumAddHrdParams; 837 std::vector<Bool> m_cprmsAddPresentFlag; 838 std::vector<Int> m_numSubLayerHrdMinus1; 839 std::vector<TComHRD> m_bspHrd; 840 Int m_numSignalledPartitioningSchemes[MAX_VPS_OUTPUT_LAYER_SETS_PLUS1]; 841 Int m_numPartitionsInSchemeMinus1 [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16]; 842 Int m_layerIncludedInPartitionFlag [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_LAYERS][MAX_LAYERS]; 843 Int m_numBspSchedulesMinus1 [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER]; 844 Int m_bspHrdIdx [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER][31][MAX_LAYERS]; 845 Int m_bspSchedIdx [MAX_VPS_OUTPUT_LAYER_SETS_PLUS1][16][MAX_TLAYER][31][MAX_LAYERS]; 846 #else 719 847 UInt m_vpsNumBspHrdParametersMinus1; 720 848 Bool m_bspCprmsPresentFlag[MAX_VPS_LAYER_SETS_PLUS1]; … … 726 854 UInt m_bspCombSchedIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16]; 727 855 #endif 856 #endif 728 857 729 858 #if P0182_VPS_VUI_PS_FLAG … … 741 870 Int m_vpsNonVuiExtLength; 742 871 #endif 872 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 873 Bool m_vpsPocLsbAlignedFlag; 874 #endif 743 875 #if RESOLUTION_BASED_DPB 744 876 Int m_subDpbAssigned [MAX_VPS_LAYER_SETS_PLUS1][MAX_LAYERS]; 877 #endif 878 #if NECESSARY_LAYER_FLAG 879 std::vector< std::vector<Bool> > m_necessaryLayerFlag; 880 std::vector<Int> m_numNecessaryLayers; 745 881 #endif 746 882 #endif //SVC_EXTENSION … … 748 884 TComVPS(); 749 885 virtual ~TComVPS(); 886 887 #if VPS_RESERVED_FLAGS 888 Void setBaseLayerInternalFlag(Bool x) { m_baseLayerInternalFlag = x; } 889 Bool getBaseLayerInternalFlag() { return m_baseLayerInternalFlag; } 890 Void setBaseLayerAvailableFlag(Bool x) { m_baseLayerAvailableFlag = x; } 891 Bool getBaseLayerAvailableFlag() { return m_baseLayerAvailableFlag; } 892 #endif 750 893 751 894 Void createHrdParamBuffer() … … 759 902 Void createBspHrdParamBuffer(UInt numHrds) 760 903 { 904 #if VPS_VUI_BSP_HRD_PARAMS 905 m_bspHrd.resize( numHrds ); 906 m_cprmsAddPresentFlag.resize( numHrds ); 907 m_numSubLayerHrdMinus1.resize( numHrds ); 908 #else 761 909 m_bspHrd = new TComHRD[ numHrds ]; 910 #endif 762 911 // m_hrdOpSetIdx = new UInt [ getNumHrdParameters() ]; 763 912 // m_cprmsPresentFlag = new Bool [ getNumHrdParameters() ]; … … 767 916 Int getBspHrdParamBufferCpbCntMinus1(UInt i, UInt sl) 768 917 { 918 #if VPS_VUI_BSP_HRD_PARAMS 919 return m_bspHrd[i].getCpbCntMinus1(sl); 920 #else 769 921 return m_bspHrd->getCpbCntMinus1(sl); 922 #endif 770 923 } 771 924 #endif … … 817 970 #if DERIVE_LAYER_ID_LIST_VARIABLES 818 971 Int getLayerSetLayerIdList(Int set, Int layerId) { return m_layerSetLayerIdList[set][layerId]; } 819 Void setLayerSetLayerIdList(Int set, Int layerId, Int x) { m_layerSetLayerIdList[set][layerId] = x ;}972 Void setLayerSetLayerIdList(Int set, Int layerId, Int x) { m_layerSetLayerIdList[set][layerId] = x; } 820 973 821 974 Int getNumLayersInIdList(Int set) { return m_numLayerInIdList[set]; } 822 Void setNumLayersInIdList(Int set, Int x) { m_numLayerInIdList[set] = x ;}975 Void setNumLayersInIdList(Int set, Int x) { m_numLayerInIdList[set] = x; } 823 976 824 977 Void deriveLayerIdListVariables(); … … 861 1014 Void setNumLayerSets(UInt v) { m_numLayerSets = v; } 862 1015 #if VPS_EXTN_MASK_AND_DIM_INFO 1016 #if VPS_AVC_BL_FLAG_REMOVAL 1017 Bool getNonHEVCBaseLayerFlag() { return m_nonHEVCBaseLayerFlag; } 1018 Void setNonHEVCBaseLayerFlag(Bool x) { m_nonHEVCBaseLayerFlag = x; } 1019 #else 863 1020 Bool getAvcBaseLayerFlag() { return m_avcBaseLayerFlag; } 864 1021 Void setAvcBaseLayerFlag(Bool x) { m_avcBaseLayerFlag = x; } 1022 #endif 865 1023 866 1024 Bool getSplittingFlag() { return m_splittingFlag; } … … 964 1122 #endif 965 1123 #endif 1124 #if PER_LAYER_PTL 1125 Bool getNecessaryLayerFlag(Int const i, Int const j) { return m_necessaryLayerFlag[i][j]; } 1126 std::vector< std::vector<Int> >* getProfileLevelTierIdx() { return &m_profileLevelTierIdx; } 1127 std::vector<Int>* getProfileLevelTierIdx(Int const olsIdx) { return &m_profileLevelTierIdx[olsIdx]; } 1128 Int getProfileLevelTierIdx(Int const olsIdx, Int const layerIdx) { return m_profileLevelTierIdx[olsIdx][layerIdx]; } 1129 Void setProfileLevelTierIdx(Int const olsIdx, Int const layerIdx, Int const ptlIdx) { m_profileLevelTierIdx[olsIdx][layerIdx] = ptlIdx; } 1130 Int calculateLenOfSyntaxElement( Int const numVal ); 1131 #else 966 1132 Int getProfileLevelTierIdx(Int i) { return m_profileLevelTierIdx[i]; } 967 1133 Void setProfileLevelTierIdx(Int i, Int x) { m_profileLevelTierIdx[i] = x ; } 1134 #endif 968 1135 Bool getMaxOneActiveRefLayerFlag() { return m_maxOneActiveRefLayerFlag; } 969 1136 Void setMaxOneActiveRefLayerFlag(Bool x) { m_maxOneActiveRefLayerFlag = x; } … … 971 1138 UInt getPocLsbNotPresentFlag(Int i) { return m_pocLsbNotPresentFlag[i]; } 972 1139 Void setPocLsbNotPresentFlag(Int i, Bool x) { m_pocLsbNotPresentFlag[i] = x; } 1140 #endif 1141 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1142 Bool getVpsPocLsbAlignedFlag() { return m_vpsPocLsbAlignedFlag; } 1143 Void setVpsPocLsbAlignedFlag(Bool x) { m_vpsPocLsbAlignedFlag = x; } 973 1144 #endif 974 1145 #if O0223_PICTURE_TYPES_ALIGN_FLAG … … 1074 1245 Bool getVpsVuiBspHrdPresentFlag() { return m_vpsVuiBspHrdPresentFlag; } 1075 1246 Void setVpsVuiBspHrdPresentFlag(Bool x) { m_vpsVuiBspHrdPresentFlag = x; } 1247 #if VPS_VUI_BSP_HRD_PARAMS 1248 Int getVpsNumAddHrdParams() { return m_vpsNumAddHrdParams; } 1249 Void setVpsNumAddHrdParams(Int i) { m_vpsNumAddHrdParams = i; } 1250 1251 Bool getCprmsAddPresentFlag(Int i) { return m_cprmsAddPresentFlag[i]; } 1252 Void setCprmsAddPresentFlag(Int i, Bool val) { m_cprmsAddPresentFlag[i] = val; } 1253 1254 Int getNumSubLayerHrdMinus1(Int i) { return m_numSubLayerHrdMinus1[i]; } 1255 Void setNumSubLayerHrdMinus1(Int i, Int val) { m_numSubLayerHrdMinus1[i] = val; } 1256 1257 TComHRD* getBspHrd(Int i) {return &m_bspHrd[i];} 1258 1259 Int getNumSignalledPartitioningSchemes(Int i) { return m_numSignalledPartitioningSchemes[i]; } 1260 Void setNumSignalledPartitioningSchemes(Int i, Int val) { m_numSignalledPartitioningSchemes[i] = val; } 1261 1262 Int getNumPartitionsInSchemeMinus1(Int i, Int j) { return m_numPartitionsInSchemeMinus1[i][j];} 1263 Void setNumPartitionsInSchemeMinus1(Int i, Int j, Int val) { m_numPartitionsInSchemeMinus1[i][j] = val; } 1264 1265 Int getLayerIncludedInPartitionFlag(Int i, Int j, Int k, Int l) { return m_layerIncludedInPartitionFlag[i][j][k][l];} 1266 Void setLayerIncludedInPartitionFlag(Int i, Int j, Int k, Int l, Int val) { m_layerIncludedInPartitionFlag[i][j][k][l] = val; } 1267 1268 Int getNumBspSchedulesMinus1(Int i, Int j, Int k) { return m_numBspSchedulesMinus1[i][j][k];} 1269 Void setNumBspSchedulesMinus1(Int i, Int j, Int k, Int val) { m_numBspSchedulesMinus1[i][j][k] = val; } 1270 1271 Int getBspSchedIdx(Int i, Int j, Int k, Int l, Int m) { return m_bspSchedIdx[i][j][k][l][m];} 1272 Void setBspSchedIdx(Int i, Int j, Int k, Int l, Int m, Int val) { m_bspSchedIdx[i][j][k][l][m] = val; } 1273 1274 Int getBspHrdIdx(Int i, Int j, Int k, Int l, Int m) { return m_bspHrdIdx[i][j][k][l][m];} 1275 Void setBspHrdIdx(Int i, Int j, Int k, Int l, Int m, Int val) { m_bspHrdIdx[i][j][k][l][m] = val; } 1276 #else 1076 1277 UInt getVpsNumBspHrdParametersMinus1() { return m_vpsNumBspHrdParametersMinus1; } 1077 1278 Void setVpsNumBspHrdParametersMinus1(UInt i) { m_vpsNumBspHrdParametersMinus1 = i; } … … 1090 1291 Void setBspCombSchedIdx(UInt h, UInt i, UInt j, UInt val) { m_bspCombSchedIdx[h][i][j] = val; } 1091 1292 #endif 1293 #endif 1092 1294 #if P0182_VPS_VUI_PS_FLAG 1093 1295 Int getSPSId (Int layer) { return m_SPSId[layer]; } … … 1205 1407 Void setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess ); 1206 1408 #endif 1409 #if NECESSARY_LAYER_FLAG 1410 Void deriveNecessaryLayerFlag(); 1411 Void deriveNecessaryLayerFlag(Int const olsIdx); 1412 Void checkNecessaryLayerFlagCondition(); 1413 #endif 1414 #if SUB_LAYERS_IN_LAYER_SET 1415 Void calculateMaxSLInLayerSets(); 1416 #endif 1207 1417 #endif //SVC_EXTENSION 1208 1418 }; 1209 1210 class Window1211 {1212 private:1213 Bool m_enabledFlag;1214 Int m_winLeftOffset;1215 Int m_winRightOffset;1216 Int m_winTopOffset;1217 Int m_winBottomOffset;1218 #if P0312_VERT_PHASE_ADJ1219 Bool m_vertPhasePositionEnableFlag;1220 #endif1221 public:1222 Window()1223 : m_enabledFlag (false)1224 , m_winLeftOffset (0)1225 , m_winRightOffset (0)1226 , m_winTopOffset (0)1227 , m_winBottomOffset (0)1228 #if P0312_VERT_PHASE_ADJ1229 , m_vertPhasePositionEnableFlag(false)1230 #endif1231 { }1232 1233 Bool getWindowEnabledFlag() const { return m_enabledFlag; }1234 #if P0312_VERT_PHASE_ADJ1235 Void resetWindow() { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; m_vertPhasePositionEnableFlag = false; }1236 #else1237 Void resetWindow() { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0;}1238 #endif1239 Int getWindowLeftOffset() const { return m_enabledFlag ? m_winLeftOffset : 0; }1240 Void setWindowLeftOffset(Int val) { m_winLeftOffset = val; m_enabledFlag = true; }1241 Int getWindowRightOffset() const { return m_enabledFlag ? m_winRightOffset : 0; }1242 Void setWindowRightOffset(Int val) { m_winRightOffset = val; m_enabledFlag = true; }1243 Int getWindowTopOffset() const { return m_enabledFlag ? m_winTopOffset : 0; }1244 Void setWindowTopOffset(Int val) { m_winTopOffset = val; m_enabledFlag = true; }1245 Int getWindowBottomOffset() const { return m_enabledFlag ? m_winBottomOffset: 0; }1246 Void setWindowBottomOffset(Int val) { m_winBottomOffset = val; m_enabledFlag = true; }1247 1248 #if P0312_VERT_PHASE_ADJ1249 Bool getVertPhasePositionEnableFlag() const { return m_vertPhasePositionEnableFlag; }1250 Void setVertPhasePositionEnableFlag(Bool val) { m_vertPhasePositionEnableFlag = val; }1251 Void setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom, Bool vertPhasePositionEnableFlag = 0)1252 #else1253 Void setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)1254 #endif1255 {1256 m_enabledFlag = true;1257 m_winLeftOffset = offsetLeft;1258 m_winRightOffset = offsetLRight;1259 m_winTopOffset = offsetLTop;1260 m_winBottomOffset = offsetLBottom;1261 #if P0312_VERT_PHASE_ADJ1262 m_vertPhasePositionEnableFlag = vertPhasePositionEnableFlag;1263 #endif1264 }1265 };1266 1267 1419 1268 1420 class TComVUI … … 1445 1597 UInt m_uiMaxTLayers; // maximum number of temporal layers 1446 1598 1599 #if R0279_REP_FORMAT_INBL 1600 Bool m_bV1CompatibleSPSFlag; 1601 #endif 1602 1447 1603 // Structure 1448 1604 UInt m_picWidthInLumaSamples; … … 1514 1670 Bool m_extensionFlag; 1515 1671 UInt m_numScaledRefLayerOffsets; 1672 #if R0042_PROFILE_INDICATION 1673 Int m_NumDirectRefLayers; 1674 #endif 1516 1675 #if P0312_VERT_PHASE_ADJ 1517 1676 Bool m_vertPhasePositionEnableFlag[MAX_LAYERS]; 1518 1677 #endif 1678 #if !MOVE_SCALED_OFFSET_TO_PPS 1519 1679 #if O0098_SCALED_REF_LAYER_ID 1520 1680 UInt m_scaledRefLayerId[MAX_LAYERS]; 1521 1681 #endif 1522 1682 Window m_scaledRefLayerWindow[MAX_LAYERS]; 1683 #endif 1523 1684 #if REPN_FORMAT_IN_VPS 1524 Bool 1685 Bool m_updateRepFormatFlag; 1525 1686 #if O0096_REP_FORMAT_INDEX 1526 1687 UInt m_updateRepFormatIndex; … … 1532 1693 #endif 1533 1694 #endif //SVC_EXTENSION 1695 1534 1696 public: 1535 1697 TComSPS(); … … 1554 1716 static Int getWinUnitY (Int chromaFormatIdc) { assert (chromaFormatIdc > 0 && chromaFormatIdc <= MAX_CHROMA_FORMAT_IDC); return m_winUnitY[chromaFormatIdc]; } 1555 1717 #endif 1556 1718 1719 #if R0279_REP_FORMAT_INBL //These two functions shall be used / called when the syntax element sps_ext_or_max_sub_layers_minus1 and V1CompatibleSPSFlag are implemented 1720 Bool getV1CompatibleSPSFlag() {return m_bV1CompatibleSPSFlag;} 1721 Void setV1CompatibleSPSFlag(Bool x) { m_bV1CompatibleSPSFlag = x;} 1722 #endif 1723 1557 1724 // structure 1558 1725 Void setPicWidthInLumaSamples ( UInt u ) { m_picWidthInLumaSamples = u; } … … 1673 1840 Int getExtensionFlag() { return m_extensionFlag; } 1674 1841 Void setExtensionFlag(Int n) { m_extensionFlag = n; } 1842 #if R0042_PROFILE_INDICATION 1843 Int getNumDirectRefLayers() { return m_NumDirectRefLayers; } 1844 Void setNumDirectRefLayers(Int n) { m_NumDirectRefLayers = n; } 1845 #endif 1846 #if !MOVE_SCALED_OFFSET_TO_PPS 1675 1847 UInt getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; } 1676 1848 Void setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; } … … 1685 1857 #endif 1686 1858 Window& getScaledRefLayerWindow( Int x ) { return m_scaledRefLayerWindow[x]; } 1859 #endif 1687 1860 #if REPN_FORMAT_IN_VPS 1688 1861 Bool getUpdateRepFormatFlag() { return m_updateRepFormatFlag; } … … 1761 1934 1762 1935 Bool m_loopFilterAcrossTilesEnabledFlag; 1763 Intm_uniformSpacingFlag;1764 Int m_iNumColumnsMinus1;1765 UInt* m_puiColumnWidth;1766 Int m_iNumRowsMinus1;1767 UInt* m_puiRowHeight;1768 1769 Int m_ iNumSubstreams;1936 Bool m_uniformSpacingFlag; 1937 Int m_numTileColumnsMinus1; 1938 Int m_numTileRowsMinus1; 1939 std::vector<Int> m_tileColumnWidth; 1940 std::vector<Int> m_tileRowHeight; 1941 1942 Int m_numSubstreams; 1770 1943 1771 1944 Int m_signHideFlag; … … 1797 1970 Bool m_pocResetInfoPresentFlag; 1798 1971 #endif 1972 #if MOVE_SCALED_OFFSET_TO_PPS 1973 UInt m_numScaledRefLayerOffsets; 1974 #if O0098_SCALED_REF_LAYER_ID 1975 UInt m_scaledRefLayerId[MAX_LAYERS]; 1976 #endif 1977 Window m_scaledRefLayerWindow[MAX_LAYERS]; 1978 #if REF_REGION_OFFSET 1979 Window m_refLayerWindow[MAX_LAYERS]; 1980 Bool m_scaledRefLayerOffsetPresentFlag[MAX_LAYERS]; 1981 Bool m_refRegionOffsetPresentFlag[MAX_LAYERS]; 1982 #endif 1983 #if R0209_GENERIC_PHASE 1984 Int m_phaseHorLuma[MAX_LAYERS]; 1985 Int m_phaseVerLuma[MAX_LAYERS]; 1986 Int m_phaseHorChroma[MAX_LAYERS]; 1987 Int m_phaseVerChroma[MAX_LAYERS]; 1988 Bool m_resamplePhaseSetPresentFlag[MAX_LAYERS]; 1989 #endif 1990 #endif 1799 1991 #if Q0048_CGS_3D_ASYMLUT 1800 1992 Int m_nCGSFlag; … … 1855 2047 Bool getDependentSliceSegmentsEnabledFlag() const { return m_dependentSliceSegmentsEnabledFlag; } 1856 2048 Void setDependentSliceSegmentsEnabledFlag(Bool val) { m_dependentSliceSegmentsEnabledFlag = val; } 1857 Bool getTilesEnabledFlag() const { return m_tilesEnabledFlag; }1858 Void setTilesEnabledFlag(Bool val) { m_tilesEnabledFlag = val; }1859 2049 Bool getEntropyCodingSyncEnabledFlag() const { return m_entropyCodingSyncEnabledFlag; } 1860 2050 Void setEntropyCodingSyncEnabledFlag(Bool val) { m_entropyCodingSyncEnabledFlag = val; } 1861 Void setUniformSpacingFlag ( Bool b ) { m_uniformSpacingFlag = b; } 1862 Bool getUniformSpacingFlag () { return m_uniformSpacingFlag; } 1863 Void setNumColumnsMinus1 ( Int i ) { m_iNumColumnsMinus1 = i; } 1864 Int getNumColumnsMinus1 () { return m_iNumColumnsMinus1; } 1865 Void setColumnWidth ( UInt* columnWidth ) 1866 { 1867 if( m_uniformSpacingFlag == 0 && m_iNumColumnsMinus1 > 0 ) 1868 { 1869 m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ]; 1870 1871 for(Int i=0; i<m_iNumColumnsMinus1; i++) 1872 { 1873 m_puiColumnWidth[i] = columnWidth[i]; 1874 } 1875 } 1876 } 1877 UInt getColumnWidth (UInt columnIdx) { return *( m_puiColumnWidth + columnIdx ); } 1878 Void setNumRowsMinus1( Int i ) { m_iNumRowsMinus1 = i; } 1879 Int getNumRowsMinus1() { return m_iNumRowsMinus1; } 1880 Void setRowHeight ( UInt* rowHeight ) 1881 { 1882 if( m_uniformSpacingFlag == 0 && m_iNumRowsMinus1 > 0 ) 1883 { 1884 m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ]; 1885 1886 for(Int i=0; i<m_iNumRowsMinus1; i++) 1887 { 1888 m_puiRowHeight[i] = rowHeight[i]; 1889 } 1890 } 1891 } 1892 UInt getRowHeight (UInt rowIdx) { return *( m_puiRowHeight + rowIdx ); } 1893 Void setNumSubstreams(Int iNumSubstreams) { m_iNumSubstreams = iNumSubstreams; } 1894 Int getNumSubstreams() { return m_iNumSubstreams; } 2051 2052 Void setTilesEnabledFlag (Bool val) { m_tilesEnabledFlag = val; } 2053 Bool getTilesEnabledFlag () const { return m_tilesEnabledFlag; } 2054 Void setTileUniformSpacingFlag (Bool b) { m_uniformSpacingFlag = b; } 2055 Bool getTileUniformSpacingFlag () const { return m_uniformSpacingFlag; } 2056 Void setNumTileColumnsMinus1 (Int i) { m_numTileColumnsMinus1 = i; } 2057 Int getNumTileColumnsMinus1 () const { return m_numTileColumnsMinus1; } 2058 Void setTileColumnWidth (const std::vector<Int>& columnWidth ) { m_tileColumnWidth = columnWidth; } 2059 UInt getTileColumnWidth (UInt columnIdx) const { return m_tileColumnWidth[columnIdx]; } 2060 Void setNumTileRowsMinus1 (Int i) { m_numTileRowsMinus1 = i; } 2061 Int getTileNumRowsMinus1 () const { return m_numTileRowsMinus1; } 2062 Void setTileRowHeight (const std::vector<Int>& rowHeight) { m_tileRowHeight = rowHeight; } 2063 UInt getTileRowHeight (UInt rowIdx) const { return m_tileRowHeight[rowIdx]; } 2064 2065 Void setNumSubstreams (Int numSubstreams) { m_numSubstreams = numSubstreams; } 2066 Int getNumSubstreams () { return m_numSubstreams; } 1895 2067 1896 2068 Void setSignHideFlag( Int signHideFlag ) { m_signHideFlag = signHideFlag; } … … 1945 2117 Void setPocResetInfoPresentFlag (const Bool val) { m_pocResetInfoPresentFlag = val; } 1946 2118 #endif 2119 #if MOVE_SCALED_OFFSET_TO_PPS 2120 UInt getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; } 2121 Void setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; } 2122 #if O0098_SCALED_REF_LAYER_ID 2123 UInt getScaledRefLayerId(Int x) { return m_scaledRefLayerId[x]; } 2124 Void setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id; } 2125 Window& getScaledRefLayerWindowForLayer( Int layerId ); 2126 #endif 2127 Window& getScaledRefLayerWindow( Int x ) { return m_scaledRefLayerWindow[x]; } 2128 #if REF_REGION_OFFSET 2129 Window& getRefLayerWindowForLayer( Int layerId ); 2130 Window& getRefLayerWindow( Int x ) { return m_refLayerWindow[x]; } 2131 Bool getScaledRefLayerOffsetPresentFlag(Int x) { return m_scaledRefLayerOffsetPresentFlag[x]; } 2132 Void setScaledRefLayerOffsetPresentFlag(Int x, Bool b) { m_scaledRefLayerOffsetPresentFlag[x] = b; } 2133 Bool getRefRegionOffsetPresentFlag(Int x) { return m_refRegionOffsetPresentFlag[x]; } 2134 Void setRefRegionOffsetPresentFlag(Int x, Bool b) { m_refRegionOffsetPresentFlag[x] = b; } 2135 #endif 2136 #if R0209_GENERIC_PHASE 2137 Int getPhaseHorLuma(Int x) { return m_phaseHorLuma[x]; } 2138 Int getPhaseVerLuma(Int x) { return m_phaseVerLuma[x]; } 2139 Int getPhaseHorChroma(Int x) { return m_phaseHorChroma[x]; } 2140 Int getPhaseVerChroma(Int x) { return m_phaseVerChroma[x]; } 2141 Void setPhaseHorLuma(Int x, Int val) { m_phaseHorLuma[x] = val; } 2142 Void setPhaseVerLuma(Int x, Int val) { m_phaseVerLuma[x] = val; } 2143 Void setPhaseHorChroma(Int x, Int val) { m_phaseHorChroma[x] = val; } 2144 Void setPhaseVerChroma(Int x, Int val) { m_phaseVerChroma[x] = val; } 2145 Bool getResamplePhaseSetPresentFlag(Int x) { return m_resamplePhaseSetPresentFlag[x]; } 2146 Void setResamplePhaseSetPresentFlag(Int x, Bool b) { m_resamplePhaseSetPresentFlag[x] = b; } 2147 #if RESAMPLING_FIX 2148 Bool hasZeroResamplingPhase(Int layerId); 2149 #endif 2150 #endif 2151 #endif 1947 2152 #if Q0048_CGS_3D_ASYMLUT 1948 2153 Int getCGSFlag() { return m_nCGSFlag; } … … 1994 2199 Int m_associatedIrapPocBeforeReset; 1995 2200 #endif 1996 1997 2201 NalUnitType m_iAssociatedIRAPType; 1998 2202 static Int m_prevTid0POC; … … 2085 2289 2086 2290 Bool m_enableTMVPFlag; 2291 #if R0226_SLICE_TMVP 2292 Bool m_availableForTMVPRefFlag; 2293 #endif 2087 2294 2088 2295 #if SVC_EXTENSION … … 2120 2327 Bool m_pocMsbValRequiredFlag; 2121 2328 Bool m_pocMsbValPresentFlag; 2329 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2330 Bool m_pocMsbValNeeded; 2331 Int m_pocResetDeltaPoc; 2332 #endif 2122 2333 #endif 2123 2334 #if POC_RESET_IDC_ENCODER … … 2392 2603 Bool getEnableTMVPFlag () { return m_enableTMVPFlag;} 2393 2604 2605 #if R0226_SLICE_TMVP 2606 Void setAvailableForTMVPRefFlag ( Bool b ) { m_availableForTMVPRefFlag = b; } 2607 Bool getAvailableForTMVPRefFlag () { return m_availableForTMVPRefFlag;} 2608 #endif 2609 2394 2610 #if SVC_EXTENSION 2395 2611 Bool setBaseColPic ( TComList<TComPic*>& rcListPic , UInt refLayerIdc ); … … 2407 2623 TComPicYuv* getFullPelBaseRec (UInt refLayerIdc) { return m_pcFullPelBaseRec[refLayerIdc]; } 2408 2624 2409 #if AVC_SYNTAX2410 Void initBaseLayerRPL( TComSlice *pcSlice );2411 #endif2412 2413 2625 Void setRefPicListModificationSvc(); 2414 2626 Int getNumILRRefIdx ( ) { return m_pcVPS->getNumDirectRefLayers( m_layerId ); } 2415 2416 #if REF_IDX_MFM2417 Void setRefPOCListILP(TComPic** ilpPic, TComPic** pcRefPicRL);2418 #endif2419 2627 2420 2628 Int getActiveNumILRRefIdx ( ) { return m_activeNumILRRefIdx; } … … 2444 2652 Bool isRASL() { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_R); } 2445 2653 2654 #if POC_RESET_RESTRICTIONS 2655 Bool isIDR() { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL 2656 || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP); } 2657 Bool isCRA() { return m_eNalUnitType == NAL_UNIT_CODED_SLICE_CRA; } 2658 Bool isBLA() { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP 2659 || m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2660 || m_eNalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP ); } 2661 Bool isSLNR() { return (m_eNalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N 2662 || m_eNalUnitType == NAL_UNIT_CODED_SLICE_TSA_N 2663 || m_eNalUnitType == NAL_UNIT_CODED_SLICE_STSA_N 2664 || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL_N 2665 || m_eNalUnitType == NAL_UNIT_CODED_SLICE_RASL_N 2666 || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N10 2667 || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N12 2668 || m_eNalUnitType == NAL_UNIT_RESERVED_VCL_N14 ); } 2669 #endif 2446 2670 #if POC_RESET_FLAG 2447 2671 Bool getPocResetFlag () { return m_bPocResetFlag; } … … 2473 2697 Int getQpBDOffsetY(); 2474 2698 Int getQpBDOffsetC(); 2699 2700 #if R0156_CONF_WINDOW_IN_REP_FORMAT 2701 Window& getConformanceWindow(); 2702 #endif 2475 2703 #endif 2476 2704 … … 2485 2713 Int getPocLsbVal () { return m_pocLsbVal; } 2486 2714 Void setPocLsbVal (Int b) { m_pocLsbVal = b; } 2715 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2716 Void setPocMsbNeeded (Bool x) { m_pocMsbValNeeded = x; } 2717 Bool getPocMsbNeeded () { return m_pocMsbValNeeded; } 2718 Int getPocResetDeltaPoc () { return m_pocResetDeltaPoc; } 2719 Void setPocResetDeltaPoc (Int x) { m_pocResetDeltaPoc = x; } 2720 #endif 2487 2721 Int getPocMsbVal () { return m_pocMsbVal; } 2488 2722 Void setPocMsbVal (Int b) { m_pocMsbVal = b; } … … 2512 2746 Int getCurrMsb( Int currLsb, Int prevLsb, Int prevMsb, Int maxLsbVal ); 2513 2747 #endif 2514 2748 Int getReferenceLayerIdc( UInt refLayerId ); 2515 2749 2516 2750 #endif //SVC_EXTENSION … … 2567 2801 } 2568 2802 2569 #if Q0078_ADD_LAYER_SETS2570 Void removePS(Int psId)2571 {2572 assert(psId < m_maxId);2573 if (m_paramsetMap.find(psId) != m_paramsetMap.end())2574 {2575 m_paramsetMap.erase(psId);2576 }2577 }2578 #endif2579 2580 2581 2803 private: 2582 2804 std::map<Int,T *> m_paramsetMap; … … 2601 2823 TComSPS* getSPS(Int spsId) { return m_spsMap.getPS(spsId); }; 2602 2824 TComSPS* getFirstSPS() { return m_spsMap.getFirstPS(); }; 2603 #if Q0078_ADD_LAYER_SETS2604 Void removeSPS(Int spsId) { m_spsMap.removePS(spsId); };2605 #endif2606 2825 2607 2826 //! store picture parameter set and take ownership of it … … 2610 2829 TComPPS* getPPS(Int ppsId) { return m_ppsMap.getPS(ppsId); }; 2611 2830 TComPPS* getFirstPPS() { return m_ppsMap.getFirstPS(); }; 2612 #if Q0078_ADD_LAYER_SETS2613 Void removePPS(Int ppsId) { m_ppsMap.removePS(ppsId); };2614 #endif2615 2831 2616 2832 //! activate a SPS from a active parameter sets SEI message … … 2630 2846 #if SVC_EXTENSION 2631 2847 static ParameterSetMap<TComVPS> m_vpsMap; 2848 static ParameterSetMap<TComSPS> m_spsMap; 2849 static ParameterSetMap<TComPPS> m_ppsMap; 2632 2850 #else 2633 2851 ParameterSetMap<TComVPS> m_vpsMap; 2634 #endif2635 2852 ParameterSetMap<TComSPS> m_spsMap; 2636 2853 ParameterSetMap<TComPPS> m_ppsMap; 2854 #endif 2637 2855 2638 2856 #if SVC_EXTENSION … … 2648 2866 2649 2867 #endif // __TCOMSLICE__ 2868 -
trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp
r815 r906 59 59 #else 60 60 #if O0194_JOINT_US_BITSHIFT 61 #if REF_REGION_OFFSET 62 Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow ) 63 #else 61 64 Void TComUpsampleFilter::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ) 65 #endif 62 66 #else 63 67 Void TComUpsampleFilter::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ) … … 75 79 #endif 76 80 81 #if MOVE_SCALED_OFFSET_TO_PPS 82 #if O0098_SCALED_REF_LAYER_ID 83 const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId); 84 #else 85 const Window &scalEL = currSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc); 86 #endif 87 #if REF_REGION_OFFSET 88 const Window &windowRL = currSlice->getPPS()->getRefLayerWindow(refLayerIdc); 89 #endif 90 #else 77 91 #if O0098_SCALED_REF_LAYER_ID 78 92 const Window &scalEL = currSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId); 79 93 #else 80 94 const Window &scalEL = currSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc); 95 #endif 81 96 #endif 82 97 … … 91 106 92 107 #if Q0200_CONFORMANCE_BL_SIZE 108 const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow(); 109 #endif 110 #if Q0200_CONFORMANCE_BL_SIZE || REF_REGION_OFFSET 93 111 Int chromaFormatIdc = currSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc(); 94 const Window &confBL = currSlice->getBaseColPic(refLayerIdc)->getConformanceWindow();95 112 Int xScal = TComSPS::getWinUnitX( chromaFormatIdc ); 96 113 Int yScal = TComSPS::getWinUnitY( chromaFormatIdc ); 114 #endif 115 #if R0209_GENERIC_PHASE 116 Int phaseHorLuma = currSlice->getPPS()->getPhaseHorLuma(refLayerIdc); 117 Int phaseVerLuma = currSlice->getPPS()->getPhaseVerLuma(refLayerIdc); 118 Int phaseHorChroma = currSlice->getPPS()->getPhaseHorChroma(refLayerIdc); 119 Int phaseVerChroma; 120 if (currSlice->getPPS()->getResamplePhaseSetPresentFlag(refLayerIdc)) 121 { 122 phaseVerChroma = currSlice->getPPS()->getPhaseVerChroma(refLayerIdc); 123 } 124 else 125 { 126 Int refRegionHeight = heightBL - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset(); 127 phaseVerChroma = (4 * heightEL + (refRegionHeight >> 1)) / refRegionHeight - 4; 128 } 97 129 #endif 98 130 #if P0312_VERT_PHASE_ADJ … … 223 255 Int shiftY = 16; 224 256 257 #if R0209_GENERIC_PHASE 258 Int phaseX = phaseHorLuma; 259 Int phaseY = phaseVerLuma; 260 Int addX = ( ( phaseX * scaleX + 8 ) >> 4 ) - (1 << ( shiftX - 5 )); 261 Int addY = ( ( phaseY * scaleY + 8 ) >> 4 ) - (1 << ( shiftX - 5 )); 262 #if REF_REGION_OFFSET 263 Int refOffsetX = windowRL.getWindowLeftOffset() << 4; 264 Int refOffsetY = windowRL.getWindowTopOffset() << 4; 265 #else 266 #if Q0200_CONFORMANCE_BL_SIZE 267 Int refOffsetX = ( confBL.getWindowLeftOffset() * xScal ) << 4; 268 Int refOffsetY = ( confBL.getWindowTopOffset() * yScal ) << 4; 269 #endif 270 #endif 271 #else 225 272 #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 226 273 Int phaseX = 2*phaseAlignFlag; … … 258 305 #endif 259 306 307 #if REF_REGION_OFFSET 308 Int refOffsetX = windowRL.getWindowLeftOffset() << 4; 309 Int refOffsetY = windowRL.getWindowTopOffset() << 4; 310 #else 260 311 #if Q0200_CONFORMANCE_BL_SIZE 261 312 deltaX -= ( confBL.getWindowLeftOffset() * xScal ) << 4; 262 313 deltaY -= ( confBL.getWindowTopOffset() * yScal ) << 4; 263 314 #endif 315 #endif 316 #endif 264 317 265 318 Int shiftXM4 = shiftX - 4; … … 272 325 heightBL = min<Int>( pcBasePic->getHeight(), heightEL ); 273 326 327 #if R0220_REMOVE_EL_CLIP 328 Int phaseXL = scalEL.getWindowLeftOffset(); 329 Int phaseYL = scalEL.getWindowTopOffset(); 330 Int rlClipL = -(NTAPS_US_LUMA>>1); 331 Int rlClipR = widthBL -1 + (NTAPS_US_LUMA>>1); 332 Int rlClipT = -(NTAPS_US_LUMA>>1); 333 Int rlClipB = heightBL - 1 + (NTAPS_US_LUMA>>1); 334 #else 274 335 Int leftStartL = scalEL.getWindowLeftOffset(); 275 336 Int rightEndL = pcUsPic->getWidth() - scalEL.getWindowRightOffset(); … … 277 338 Int bottomEndL = pcUsPic->getHeight() - scalEL.getWindowBottomOffset(); 278 339 Int leftOffset = leftStartL > 0 ? leftStartL : 0; 340 #endif 279 341 #if O0194_JOINT_US_BITSHIFT 280 342 // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth … … 293 355 for( i = 0; i < widthEL; i++ ) 294 356 { 357 #if R0220_REMOVE_EL_CLIP 358 Int x = i; 359 #if R0209_GENERIC_PHASE 360 refPos16 = (((x - phaseXL)*scaleX - addX) >> shiftXM4) + refOffsetX; 361 #else 362 #if REF_REGION_OFFSET 363 refPos16 = (((x - phaseXL)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetX; 364 #else 365 refPos16 = (((x - phaseXL)*scaleX + addX) >> shiftXM4) - deltaX; 366 #endif 367 #endif 368 #else 295 369 Int x = Clip3( leftStartL, rightEndL - 1, i ); 370 #if REF_REGION_OFFSET 371 refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetX; 372 #else 296 373 refPos16 = (((x - leftStartL)*scaleX + addX) >> shiftXM4) - deltaX; 374 #endif 375 #endif 297 376 phase = refPos16 & 15; 298 377 refPos = refPos16 >> 4; 378 #if R0220_REMOVE_EL_CLIP 379 refPos = Clip3( rlClipL, rlClipR, refPos ); 380 #endif 299 381 coeff = m_lumaFilter[phase]; 300 382 … … 325 407 for( j = 0; j < pcTempPic->getHeight(); j++ ) 326 408 { 409 #if R0220_REMOVE_EL_CLIP 410 Int y = j; 411 #if R0209_GENERIC_PHASE 412 refPos16 = ((( y - phaseYL )*scaleY - addY) >> shiftYM4) + refOffsetY; 413 #else 414 #if REF_REGION_OFFSET 415 refPos16 = ((( y - phaseYL )*scaleY + addY) >> shiftYM4) - deltaY + refOffsetY; 416 #else 417 refPos16 = ((( y - pahseYL )*scaleY + addY) >> shiftYM4) - deltaY; 418 #endif 419 #endif 420 #else 327 421 Int y = Clip3(topStartL, bottomEndL - 1, j); 422 #if REF_REGION_OFFSET 423 refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY + refOffsetY; 424 #else 328 425 refPos16 = ((( y - topStartL )*scaleY + addY) >> shiftYM4) - deltaY; 426 #endif 427 #endif 329 428 phase = refPos16 & 15; 330 429 refPos = refPos16 >> 4; 430 #if R0220_REMOVE_EL_CLIP 431 refPos = Clip3( rlClipT, rlClipB, refPos ); 432 #endif 331 433 coeff = m_lumaFilter[phase]; 332 434 333 435 piSrcY = piTempBufY + (refPos -((NTAPS_US_LUMA>>1) - 1))*strideEL; 334 436 Pel* piDstY0 = piDstBufY + j * strideEL; 335 piDstY = piDstY0 + leftOffset; 336 piSrcY += leftOffset; 337 338 for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- ) 437 438 #if R0220_REMOVE_EL_CLIP 439 piDstY = piDstY0; 440 441 for( i = pcTempPic->getWidth(); i > 0; i-- ) 339 442 { 340 443 *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift)); … … 342 445 piDstY++; 343 446 } 447 #else 448 piDstY = piDstY0 + leftOffset; 449 piSrcY += leftOffset; 450 451 for( i = min<Int>(rightEndL, pcTempPic->getWidth()) - max<Int>(0, leftStartL); i > 0; i-- ) 452 { 453 *piDstY = ClipY( (sumLumaVer(piSrcY, coeff, strideEL) + iOffset) >> (nShift)); 454 piSrcY++; 455 piDstY++; 456 } 344 457 345 458 for( i = rightEndL; i < pcTempPic->getWidth(); i++ ) … … 355 468 piDstY++; 356 469 } 357 470 #endif 358 471 } 359 472 … … 374 487 strideEL = pcUsPic->getCStride(); 375 488 489 #if R0220_REMOVE_EL_CLIP 490 Int srlLOffsetC = scalEL.getWindowLeftOffset() >> 1; 491 Int srlTOffsetC = scalEL.getWindowTopOffset() >> 1; 492 rlClipL = -(NTAPS_US_CHROMA>>1); 493 rlClipR = widthBL -1 + (NTAPS_US_CHROMA>>1); 494 rlClipT = -(NTAPS_US_CHROMA>>1); 495 rlClipB = heightBL - 1 + (NTAPS_US_CHROMA>>1); 496 #else 376 497 Int leftStartC = scalEL.getWindowLeftOffset() >> 1; 377 498 Int rightEndC = (pcUsPic->getWidth() >> 1) - (scalEL.getWindowRightOffset() >> 1); … … 379 500 Int bottomEndC = (pcUsPic->getHeight() >> 1) - (scalEL.getWindowBottomOffset() >> 1); 380 501 leftOffset = leftStartC > 0 ? leftStartC : 0; 502 #endif 381 503 shiftX = 16; 382 504 shiftY = 16; 383 505 506 #if R0209_GENERIC_PHASE 507 addX = ( ( phaseHorChroma * scaleX + 8 ) >> 4 ) - (1 << ( shiftX - 5 )); 508 addY = ( ( phaseVerChroma * scaleY + 8 ) >> 4 ) - (1 << ( shiftX - 5 )); 509 Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4; 510 Int refOffsetYC = (windowRL.getWindowTopOffset() / yScal) << 4; 511 #else 384 512 #if O0215_PHASE_ALIGNMENT 385 513 Int phaseXC = phaseAlignFlag; … … 417 545 #endif 418 546 547 #if REF_REGION_OFFSET 548 Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4; 549 Int refOffsetYC = (windowRL.getWindowTopOffset() / yScal) << 4; 550 #else 419 551 #if Q0200_CONFORMANCE_BL_SIZE 420 552 deltaX -= ( ( confBL.getWindowLeftOffset() * xScal ) >> 1 ) << 4; 421 553 deltaY -= ( ( confBL.getWindowTopOffset() * yScal ) >> 1 ) << 4; 554 #endif 555 #endif 422 556 #endif 423 557 … … 447 581 for( i = 0; i < widthEL; i++ ) 448 582 { 583 #if R0220_REMOVE_EL_CLIP 584 Int x = i; 585 #if R0209_GENERIC_PHASE 586 refPos16 = (((x - srlLOffsetC)*scaleX - addX) >> shiftXM4) + refOffsetXC; 587 #else 588 #if REF_REGION_OFFSET 589 refPos16 = (((x - srlLOffsetC)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetXC; 590 #else 591 refPos16 = (((x - srlLOffsetC)*scaleX + addX) >> shiftXM4) - deltaX; 592 #endif 593 #endif 594 #else 449 595 Int x = Clip3(leftStartC, rightEndC - 1, i); 596 #if REF_REGION_OFFSET 597 refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX + refOffsetXC; 598 #else 450 599 refPos16 = (((x - leftStartC)*scaleX + addX) >> shiftXM4) - deltaX; 600 #endif 601 #endif 451 602 phase = refPos16 & 15; 452 603 refPos = refPos16 >> 4; 604 #if R0220_REMOVE_EL_CLIP 605 refPos = Clip3(rlClipL, rlClipR, refPos); 606 #endif 453 607 coeff = m_chromaFilter[phase]; 454 608 … … 485 639 for( j = 0; j < pcTempPic->getHeight() >> 1; j++ ) 486 640 { 641 #if R0220_REMOVE_EL_CLIP 642 Int y = j; 643 #if R0209_GENERIC_PHASE 644 refPos16 = (((y - srlTOffsetC)*scaleX - addY) >> shiftYM4) + refOffsetYC; 645 #else 646 #if REF_REGION_OFFSET 647 refPos16 = (((y - srlTOffsetC)*scaleY + addY) >> shiftYM4) - deltaY + refOffsetYC; 648 #else 649 refPos16 = (((y - srlTOffsetC)*scaleY + addY) >> shiftYM4) - deltaY; 650 #endif 651 #endif 652 #else 487 653 Int y = Clip3(topStartC, bottomEndC - 1, j); 654 #if REF_REGION_OFFSET 655 refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY + refOffsetYC; 656 #else 488 657 refPos16 = (((y - topStartC)*scaleY + addY) >> shiftYM4) - deltaY; 658 #endif 659 #endif 489 660 phase = refPos16 & 15; 490 661 refPos = refPos16 >> 4; 662 #if R0220_REMOVE_EL_CLIP 663 refPos = Clip3(rlClipT, rlClipB, refPos); 664 #endif 491 665 coeff = m_chromaFilter[phase]; 492 666 … … 496 670 Pel* piDstU0 = piDstBufU + j*strideEL; 497 671 Pel* piDstV0 = piDstBufV + j*strideEL; 498 piDstU = piDstU0 + leftOffset; 499 piDstV = piDstV0 + leftOffset; 500 pi SrcU += leftOffset;501 pi SrcV += leftOffset;502 503 for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- )672 673 #if R0220_REMOVE_EL_CLIP 674 piDstU = piDstU0; 675 piDstV = piDstV0; 676 677 for( i = pcTempPic->getWidth() >> 1; i > 0; i-- ) 504 678 { 505 679 *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift)); … … 510 684 piDstV++; 511 685 } 686 #else 687 piDstU = piDstU0 + leftOffset; 688 piDstV = piDstV0 + leftOffset; 689 piSrcU += leftOffset; 690 piSrcV += leftOffset; 691 692 for( i = min<Int>(rightEndC, pcTempPic->getWidth() >> 1) - max<Int>(0, leftStartC); i > 0; i-- ) 693 { 694 *piDstU = ClipC( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift)); 695 *piDstV = ClipC( (sumChromaVer(piSrcV, coeff, strideEL) + iOffset) >> (nShift)); 696 piSrcU++; 697 piSrcV++; 698 piDstU++; 699 piDstV++; 700 } 512 701 513 702 for( i = rightEndC; i < pcTempPic->getWidth() >> 1; i++ ) … … 528 717 piDstV++; 529 718 } 719 #endif 530 720 531 721 } -
trunk/source/Lib/TLibCommon/TComUpsampleFilter.h
r713 r906 51 51 #else 52 52 #if O0194_JOINT_US_BITSHIFT 53 #if REF_REGION_OFFSET 54 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, const Window altRefWindow ); 55 #else 53 56 Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); 57 #endif 54 58 #else 55 59 Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window ); -
trunk/source/Lib/TLibCommon/TypeDef.h
r815 r906 41 41 #define SVC_EXTENSION 1 42 42 43 #define SYNTAX_BYTES 10 ///< number of bytes taken by syntaxes per 4x4 block [RefIdxL0(1byte), RefIdxL1(1byte), MVxL0(2bytes), MVyL0(2bytes), MVxL1(2bytes), MVyL1(2bytes)]44 43 #if SVC_EXTENSION 45 44 #define MAX_LAYERS 8 ///< max number of layers the codec is supposed to handle 46 45 46 #define SIGNALLING_BITRATE_PICRATE_FIX 1 ///< Fix for signalling of bitrate and picture rate info in VPS VUI to be more aligned to JCTVC-R1008 47 #define INFERENCE_POC_MSB_VAL_PRESENT 1 ///< JCTVC-Q0146 -- poc_msb_val_present_flag shall be equal to 0 when slice_header_extension_length is (inferred to be ) equal to 0 48 #define CROSS_LAYER_BLA_FLAG_FIX 1 ///< Fix for earlier implementation mistake that omit the signalling of cross_layer_bla_flag 49 #define NON_REF_NAL_TYPE_DISCARDABLE 1 ///< JCTVC-P0041 -- If discardable picture is a non-IRAP, it must be a non-referenced sub-layer picture 50 #define VPS_AVC_BL_FLAG_REMOVAL 1 ///< remove avc_base_layer_flag and direct the function its offer to vps_base_layer_internal_flag and vps_base_layer_available_flag 51 #define VPS_RESERVED_FLAGS 1 ///< vps_base_layer_internal_flag and vps_base_layer_available_flag 52 #define VPS_VUI_VST_PARAMS 1 ///< JCTVC-R0227: Related to signalling of VST parameters of the base layer. 47 53 #define VPS_VUI_OFFSET 1 ///< N0085: Signal VPS VUI offset in the VPS extension 54 #define REMOVE_BSP_HRD_SEI 1 ///< R0010: Remove bitstream partition HRD SEI message. 55 #define NESTING_SEI_EXTENSIBILITY 1 ///< R0221: Signalling the number of SEI messages in bitstream partition nesting SEI message 56 #define POC_RESET_RESTRICTIONS 1 ///< Restrictions on semantics of POC reset-related syntax elements, including one item from R0223 57 #define POC_RESET_VALUE_RESTRICTION 1 ///< R0223: Restriction on the value of full_poc_reset_flag 58 #define OUTPUT_LAYER_SETS_CONFIG 1 59 #define MOVE_ADDN_LS_SIGNALLING 1 ///< JCTVC-R0238: (Ed.) Move additional layer set signalling in VPS extn. 60 #define PTL_SIGNALLING 1 ///< Overall macro for all PTL-related signalling 61 #if PTL_SIGNALLING 62 #define LIST_OF_PTL 1 ///< JCTVC-R0272: Signalling the PTL for the 0-th OLS 63 #define NECESSARY_LAYER_FLAG 1 ////< Derivation of NecessaryLayerFlag 64 #define PER_LAYER_PTL 1 ///< Signal profile-tier-level information for each layer. 65 #endif 66 #define BSP_INIT_ARRIVAL_SEI 1 ///< JCTVC-R0231: Make signalling of vcl_initial_arrival_delay independent of NalHrdBpPresentFlag 67 #define SUB_LAYERS_IN_LAYER_SET 1 ///< Move calculation of MaxSubLayerInLayerSets to a separate function 68 #define VPS_VUI_BSP_HRD_PARAMS 1 ///< JCTVC-R0231: Define the VPS VUI BSP hrd_params() as a separate function, and apply changes adopted. 48 69 #define O0137_MAX_LAYERID 1 ///< JCTVC-O0137, JCTVC-O0200, JCTVC-O0223: restrict nuh_layer_id and vps_max_layers_minus1 49 70 50 #define Q0108_TSA_STSA 0 ///< JCTVC-Q0108, Remove cross-layer alignment constraints of TSA and STSA pictures, enable to have different prediction structures in different layers 71 #define R0226_CONSTRAINT_TMVP_SEI 1 ///< JCTVC-R0226, Modification to semantics in temporal motion vector prediction constraints SEI message 72 #define R0226_SLICE_TMVP 1 ///< JCTVC-R0226, Regarding slice_temporal_mvp_enabled_flag 73 #define R0279_REP_FORMAT_INBL 1 ///< JCTVC-R0279, For any independent non-base layer the used representation format is the one that is signalled in the active SPS for the layer 74 #define R0227_VUI_BSP_HRD_FLAG 1 ///< JCTVC-R0227, Conformance checking such that VPS VUI HRD only present if VPS timing info is signalled 75 #define R0227_REP_FORMAT_CONSTRAINT 1 ///< JCTVC-R0227, Conformance checking such that representation format of a particular layer shall not be greater than the one defined in VPS for that layer 76 #define R0227_BR_PR_ADD_LAYER_SET 1 ///< JCTVC-R0227, Signalling of bit-rate and picture rate for additional layer set 77 #define R0042_PROFILE_INDICATION 1 ///< JCTVC-R0042, Profile indication for additional layer sets 78 79 #define Q0108_TSA_STSA 1 ///< JCTVC-Q0108, Remove cross-layer alignment constraints of TSA and STSA pictures, enable to have different prediction structures in different layers 51 80 #define Q0177_SPS_TEMP_NESTING_FIX 1 ///< JCTVC-Q0177; Fix the inference value of sps_temporal_id_nesting_flag when it is not present 52 81 #define Q0177_EOS_CHECKS 1 ///< JCTVC-Q0177; Put checks on handling EOS … … 54 83 #define Q0146_SSH_EXT_DATA_BIT 1 ///< JCTVC-Q0146; Bug-fix -- the SSH_EXT_DATA_BIT can have any value -- not required to be 1 55 84 56 #define Q0200_CONFORMANCE_BL_SIZE 1 ///< JCTVC-Q0200; use conformance picture size in re-sampling processs57 #define P0312_VERT_PHASE_ADJ 1 ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)58 #if P0312_VERT_PHASE_ADJ59 #define Q0120_PHASE_CALCULATION 1 ///< JCTVC-Q0120 phase offset derivation for combination of spatial scalibility and field coding.60 #endif61 85 #define P0130_EOB 1 ///< JCTVC-P0130, set layer Id of EOB NALU to be fixed to 0 86 #define T_ID_EOB_BUG_FIX 1 ///< Bug fix for the value of temporal id of EOB NALU. It must be set to 0 62 87 #define P0307_REMOVE_VPS_VUI_OFFSET 1 ///< JCTVC-P0307, remove implementation related to VPS VUI offset signalling 63 88 #define P0307_VPS_NON_VUI_EXTENSION 1 ///< JCTVC-P0307, implementation related to NON VUI VPS Extension signalling … … 94 119 #if Q0048_CGS_3D_ASYMLUT 95 120 #define CGS_GCC_NO_VECTORIZATION 1 96 #define O0194_WEIGHTED_PREDICTION_CGS 0 97 #else 98 #define O0194_WEIGHTED_PREDICTION_CGS 1 ///< JCTVC-O0194: Weighted prediciton for color gamut scalability 99 #endif 121 #define R0150_CGS_SIGNAL_CONSTRAINTS 1 ///< JCTVC-R0150: CGS signaling improvement and constraints 122 #define R0151_CGS_3D_ASYMLUT_IMPROVE 1 ///< JCTVC-R0151: Non-uniform chroma partitioning and improved LUT coefficient coding 123 #define R0164_CGS_LUT_BUGFIX 1 ///< JCTVC-R0164: Bug fix with LUT syntax 124 #define R0164_CGS_LUT_BUGFIX_CHECK 0 ///< JCTVC-R0164: Add traces explicitly/non-explicitly encoded vertices and check if 3DLUT is correctly filled 125 #define R0179_CGS_SIZE_8x1x1 1 ///< JCTVC-R0179: allow CGS LUT size to be 8x1x1 as well 126 #define R0300_CGS_RES_COEFF_CODING 1 ///< JCTVC-R0300: improved residual coefficient coding for R0151 127 #define R0179_ENC_OPT_3DLUT_SIZE 0 ///< JCTVC-R0179: RD decision based LUT size selection 128 #endif 129 #define O0194_WEIGHTED_PREDICTION_CGS 1 ///< JCTVC-O0194: Weighted prediction for colour gamut scalability 100 130 #define POC_RESET_FLAG 0 ///< JCTVC-N0244: POC reset flag for layer pictures. 101 131 #define POC_RESET_IDC 1 ///< JCTVC-P0041: Include poc_reset_idc and related derivation - eventually will replace POC_RESET_FLAG … … 107 137 #define UNAVAILABLE_PIC_BUGFIX 1 108 138 #endif 139 #if INFERENCE_POC_MSB_VAL_PRESENT 140 #define POC_MSB_VAL_PRESENT_FLAG_SEM 0 ///< JCTVC-Q0146: Inference of poc_msb_val_present_flag 141 #else 109 142 #define POC_MSB_VAL_PRESENT_FLAG_SEM 1 ///< JCTVC-Q0146: Inference of poc_msb_val_present_flag 143 #endif 110 144 #define POC_RESET_INFO_INFERENCE 1 ///< JCTVC-Q0146: Infer the value of poc_reset_info_present_flag when not present 111 145 #define NO_OUTPUT_OF_PRIOR_PICS 1 ///< Use no_output_of_prior_pics_flag … … 123 157 #endif 124 158 159 #define P0297_VPS_POC_LSB_ALIGNED_FLAG 1 ///< JCTVC-P0297: vps_poc_lsb_aligned_flag for cross-layer POC anchor picture derivation 160 125 161 #define VPS_EXTN_MASK_AND_DIM_INFO 1 ///< Include avc_base_layer_flag, splitting_flag, scalability mask and dimension related info 126 162 #if VPS_EXTN_MASK_AND_DIM_INFO … … 152 188 153 189 #define AVC_BASE 1 ///< YUV BL reading for AVC base SVC 154 #if AVC_BASE155 #define AVC_SYNTAX 0 ///< Syntax reading for AVC base156 #endif157 190 158 191 #define REF_IDX_MFM 1 ///< JCTVC-L0336: motion vector mapping of inter-layer reference picture … … 193 226 #define REP_FORMAT_FIX 1 ///< update_rep_format_flag should be inferred to be equal to 0 194 227 228 #define R0156_CONF_WINDOW_IN_REP_FORMAT O0096_REP_FORMAT_INDEX ///< JCTVC-R0156: add conformance window cropping offsets to rep_format() 229 195 230 #define RESAMPLING_CONSTRAINT_BUG_FIX 1 196 231 #define O0098_SCALED_REF_LAYER_ID 1 ///< JCTVC-O0098: signal scaled reference id … … 226 261 #define HRD_BPB 1 ///< JCTVC-Q0101 Bitstream Partition Buffering Proposals 227 262 #define DPB_CONSTRAINTS 1 ///< JCTVC-Q0100 RPS DPB constraints 263 #define DPB_INTERNAL_BL_SIG 1 ///< JCTVC-R0153: external base layer 264 #define ALT_OPT_LAYER_FLAG 1 ///< JCTVC-R0154: proposal1 - alt_output_layer_flag[i] inference 265 #define DEF_OPT_LAYER_IDC 1 ///< JCTVC-R0154: proposal2 - default_output_layer_idc and output_layer_flag[i][j] 266 #define ISLICE_TYPE_NUMDIR 1 ///< JCTVC-R0155: Proposal 1 I slice_type 267 #define OLS_IDX_CHK 1 ///< JCTVC-R0155: Proposal 2 valid range for output_layer_set_idx_to_vps[i] 268 #define R0340_RESAMPLING_MODIFICATION 1 ///< JCTVC-R0340: set of changes regarding resampling (as listed below) 269 #if R0340_RESAMPLING_MODIFICATION 270 #define MOVE_SCALED_OFFSET_TO_PPS 1 ///< JCTVC-R0013: move scaled reference layer offset from SPS to PPS 271 #if MOVE_SCALED_OFFSET_TO_PPS 272 #define REF_REGION_OFFSET 1 ///< JCTVC-Q0159/R0220: reference region offset 273 #define R0209_GENERIC_PHASE 1 ///< JCTVC-R0209: resampling with generic phase 274 #define R0220_REMOVE_EL_CLIP 1 ///< JCTVC-R0220: remove clip to scaled ref window in resampling process 275 #define RESAMPLING_FIX 1 ///< Resampling fix -- equal offset check and conformance check 276 #endif 277 #else 278 #define Q0200_CONFORMANCE_BL_SIZE 1 ///< JCTVC-Q0200; use conformance picture size in re-sampling processs 279 #define P0312_VERT_PHASE_ADJ 1 ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report) 280 #if P0312_VERT_PHASE_ADJ 281 #define Q0120_PHASE_CALCULATION 1 ///< JCTVC-Q0120 phase offset derivation for combination of spatial scalibility and field coding. 282 #endif 283 #endif 228 284 229 285 /// scalability types … … 234 290 AUX_ID = 3, 235 291 }; 292 293 #define WPP_FIX 1 236 294 237 295 /// normative encoder constraints -------- … … 255 313 #define MAX_SUB_STREAMS 1024 256 314 #endif 257 #define Q0074_SEI_COLOR_MAPPING 1 ///< JCTVC-Q0074, SEI Color Mapping258 315 #define LAYERS_NOT_PRESENT_SEI 1 ///< JCTVC-M0043: add layers not present SEI. 259 316 #define N0383_IL_CONSTRAINED_TILE_SETS_SEI 1 260 317 #define Q0189_TMVP_CONSTRAINTS 1 ///< JCTVC-Q0189: indicate constraints on TMVP 261 318 #define Q0247_FRAME_FIELD_INFO 1 ///< JCTVC-Q0247: field_frame_info SEI message 262 263 264 #else 265 #define SYNTAX_OUTPUT 0 319 #define R0247_SEI_ACTIVE 1 ///< JCTVC-R0247: active parameter sets SEI message 320 266 321 #endif // SVC_EXTENSION 322 #define Q0074_COLOUR_REMAPPING_SEI 1 ///< JCTVC-Q0074, JCTVC-R0344: SEI Colour Remapping Information 267 323 268 324 … … 278 334 #define SAO_SGN_FUNC 1 279 335 336 #define TILE_SIZE_CHECK 1 337 280 338 #define FIX1172 1 ///< fix ticket #1172 281 339 … … 292 350 #define MAX_NESTING_NUM_OPS 1024 293 351 #define MAX_NESTING_NUM_LAYER 64 294 352 #if NESTING_SEI_EXTENSIBILITY 353 #define MAX_SEIS_IN_BSP_NESTING 64 354 #endif 295 355 #if SVC_EXTENSION 296 356 #define MAX_VPS_OP_LAYER_SETS_PLUS1 (MAX_LAYERS+1) 297 357 #define MAX_VPS_LAYER_SETS_PLUS1 1024 358 #define MAX_VPS_OUTPUT_LAYER_SETS_PLUS1 1024 298 359 #define MAX_VPS_LAYER_ID_PLUS1 MAX_LAYERS 299 360 #else … … 438 499 typedef double Double; 439 500 typedef float Float; 440 441 501 // ==================================================================================================================== 442 502 // 64-bit integer type -
trunk/source/Lib/TLibDecoder/SEIread.cpp
r815 r906 98 98 break; 99 99 #endif 100 #if Q0074_ SEI_COLOR_MAPPING101 case SEI::COLO R_MAPPING_INFO:102 fprintf( g_hTrace, "===========Colo r Mapping InfoSEI message ===========\n");100 #if Q0074_COLOUR_REMAPPING_SEI 101 case SEI::COLOUR_REMAPPING_INFO: 102 fprintf( g_hTrace, "===========Colour Remapping Information SEI message ===========\n"); 103 103 break; 104 104 #endif … … 132 132 fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n"); 133 133 break; 134 #if !REMOVE_BSP_HRD_SEI 134 135 case SEI::BSP_HRD: 135 136 fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n"); 136 137 break; 138 #endif 137 139 #endif 138 140 #if Q0078_ADD_LAYER_SETS … … 249 251 { 250 252 sei = new SEIDecodingUnitInfo; 253 #if VPS_VUI_BSP_HRD_PARAMS 254 xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps, nestingSei, bspNestingSei, vps); 255 #else 251 256 xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps); 257 #endif 252 258 } 253 259 break; … … 260 266 { 261 267 sei = new SEIBufferingPeriod; 268 #if VPS_VUI_BSP_HRD_PARAMS 269 xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps, nestingSei, bspNestingSei, vps); 270 #else 262 271 xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps); 272 #endif 263 273 } 264 274 break; … … 271 281 { 272 282 sei = new SEIPictureTiming; 283 #if VPS_VUI_BSP_HRD_PARAMS 284 xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, nestingSei, bspNestingSei, vps); 285 #else 273 286 xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps); 287 #endif 274 288 } 275 289 break; … … 304 318 break; 305 319 #endif 306 #if Q0074_ SEI_COLOR_MAPPING307 case SEI::COLO R_MAPPING_INFO:308 sei = new SEIColo rMappingInfo;309 xParseSEIColo rMappingInfo((SEIColorMappingInfo&) *sei, payloadSize);320 #if Q0074_COLOUR_REMAPPING_SEI 321 case SEI::COLOUR_REMAPPING_INFO: 322 sei = new SEIColourRemappingInfo; 323 xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize); 310 324 break; 311 325 #endif … … 345 359 case SEI::SUB_BITSTREAM_PROPERTY: 346 360 sei = new SEISubBitstreamProperty; 361 #if OLS_IDX_CHK 362 xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei, vps); 363 #else 347 364 xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei); 365 #endif 348 366 break; 349 367 #endif … … 361 379 xParseSEIBspInitialArrivalTime((SEIBspInitialArrivalTime&) *sei, vps, sps, *nestingSei, *bspNestingSei); 362 380 break; 381 #if !REMOVE_BSP_HRD_SEI 363 382 case SEI::BSP_HRD: 364 383 sei = new SEIBspHrd; 365 384 xParseSEIBspHrd((SEIBspHrd&) *sei, sps, *nestingSei); 366 385 break; 386 #endif 367 387 #endif 368 388 #if Q0078_ADD_LAYER_SETS … … 580 600 581 601 sei.activeSeqParameterSetId.resize(sei.numSpsIdsMinus1 + 1); 602 #if R0247_SEI_ACTIVE 603 sei.layerSpsIdx.resize(sei.numSpsIdsMinus1 + 1); 604 #endif 582 605 for (Int i=0; i < (sei.numSpsIdsMinus1 + 1); i++) 583 606 { 584 607 READ_UVLC(val, "active_seq_parameter_set_id"); sei.activeSeqParameterSetId[i] = val; 585 608 } 586 609 #if R0247_SEI_ACTIVE 610 for (Int i=1; i < (sei.numSpsIdsMinus1 + 1); i++) 611 { 612 READ_UVLC(val, "layer_sps_idx"); sei.layerSpsIdx[i] = val; 613 } 614 #endif 587 615 xParseByteAlign(); 588 616 } 589 617 618 #if VPS_VUI_BSP_HRD_PARAMS 619 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt /*payloadSize*/, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 620 #else 590 621 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt /*payloadSize*/, TComSPS *sps) 622 #endif 591 623 { 592 624 UInt val; … … 594 626 sei.m_decodingUnitIdx = val; 595 627 628 #if VPS_VUI_BSP_HRD_PARAMS 629 TComHRD *hrd; 630 if( bspNestingSei ) // If DU info SEI contained inside a BSP nesting SEI message 631 { 632 assert( nestingSei ); 633 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 634 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 635 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 636 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 637 std::vector<Int> hrdIdx(maxValues, 0); 638 std::vector<TComHRD *> hrdVec; 639 std::vector<Int> syntaxElemLen(maxValues, 0); 640 for(Int i = 0; i < maxValues; i++) 641 { 642 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 643 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 644 645 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 646 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 647 { 648 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 649 } 650 if( i > 0 ) 651 { 652 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 653 assert( hrdVec[i]->getSubPicCpbParamsInPicTimingSEIFlag() == hrdVec[i-1]->getSubPicCpbParamsInPicTimingSEIFlag() ); 654 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 655 // To be done: Check CpbDpbDelaysPresentFlag 656 } 657 } 658 hrd = hrdVec[0]; 659 } 660 else 661 { 662 TComVUI *vui = sps->getVuiParameters(); 663 hrd = vui->getHrdParameters(); 664 } 665 #else 596 666 TComVUI *vui = sps->getVuiParameters(); 597 if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) 598 { 599 READ_CODE( ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay"); 667 TComHrd *hrd = vui->getHrdParameters(); 668 #endif 669 if(hrd->getSubPicCpbParamsInPicTimingSEIFlag()) 670 { 671 READ_CODE( ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay"); 600 672 sei.m_duSptCpbRemovalDelay = val; 601 673 } … … 607 679 if(sei.m_dpbOutputDuDelayPresentFlag) 608 680 { 609 READ_CODE( vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay");681 READ_CODE(hrd->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay"); 610 682 sei.m_picSptDpbOutputDuDelay = val; 611 683 } … … 613 685 } 614 686 687 #if VPS_VUI_BSP_HRD_PARAMS 688 Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt /*payloadSize*/, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 689 #else 615 690 Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt /*payloadSize*/, TComSPS *sps) 691 #endif 616 692 { 617 693 Int i, nalOrVcl; 618 694 UInt code; 619 695 696 #if VPS_VUI_BSP_HRD_PARAMS 697 TComHRD *pHRD; 698 if( bspNestingSei ) // If BP SEI contained inside a BSP nesting SEI message 699 { 700 assert( nestingSei ); 701 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 702 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 703 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 704 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 705 std::vector<Int> hrdIdx(maxValues, 0); 706 std::vector<TComHRD *> hrdVec; 707 std::vector<Int> syntaxElemLen(maxValues, 0); 708 for(i = 0; i < maxValues; i++) 709 { 710 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 711 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 712 713 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 714 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 715 { 716 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 717 } 718 if( i > 0 ) 719 { 720 assert( hrdVec[i]->getCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getCpbRemovalDelayLengthMinus1() ); 721 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 722 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 723 } 724 } 725 pHRD = hrdVec[i]; 726 } 727 else 728 { 729 TComVUI *vui = sps->getVuiParameters(); 730 pHRD = vui->getHrdParameters(); 731 } 732 // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently. 733 #else 620 734 TComVUI *pVUI = sps->getVuiParameters(); 621 735 TComHRD *pHRD = pVUI->getHrdParameters(); 736 #endif 622 737 623 738 READ_UVLC( code, "bp_seq_parameter_set_id" ); sei.m_bpSeqParameterSetId = code; … … 671 786 xParseByteAlign(); 672 787 } 788 #if VPS_VUI_BSP_HRD_PARAMS 789 Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt /*payloadSize*/, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 790 #else 673 791 Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt /*payloadSize*/, TComSPS *sps) 792 #endif 674 793 { 675 794 Int i; 676 795 UInt code; 677 796 797 #if VPS_VUI_BSP_HRD_PARAMS 798 TComHRD *hrd; 799 TComVUI *vui = sps->getVuiParameters(); 800 if( bspNestingSei ) // If BP SEI contained inside a BSP nesting SEI message 801 { 802 assert( nestingSei ); 803 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 804 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 805 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 806 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 807 std::vector<Int> hrdIdx(maxValues, 0); 808 std::vector<TComHRD *> hrdVec; 809 std::vector<Int> syntaxElemLen(maxValues, 0); 810 for(i = 0; i < maxValues; i++) 811 { 812 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 813 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 814 815 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 816 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 817 { 818 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 819 } 820 if( i > 0 ) 821 { 822 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 823 assert( hrdVec[i]->getSubPicCpbParamsInPicTimingSEIFlag() == hrdVec[i-1]->getSubPicCpbParamsInPicTimingSEIFlag() ); 824 assert( hrdVec[i]->getCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getCpbRemovalDelayLengthMinus1() ); 825 assert( hrdVec[i]->getDpbOutputDelayLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayLengthMinus1() ); 826 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 827 assert( hrdVec[i]->getDuCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getDuCpbRemovalDelayLengthMinus1() ); 828 // To be done: Check CpbDpbDelaysPresentFlag 829 } 830 } 831 hrd = hrdVec[0]; 832 } 833 else 834 { 835 hrd = vui->getHrdParameters(); 836 } 837 // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently. 838 #else 678 839 TComVUI *vui = sps->getVuiParameters(); 679 840 TComHRD *hrd = vui->getHrdParameters(); 841 #endif 680 842 681 843 if( vui->getFrameFieldInfoPresentFlag() ) … … 921 1083 #endif 922 1084 923 #if Q0074_ SEI_COLOR_MAPPING924 Void SEIReader::xParseSEIColo rMappingInfo(SEIColorMappingInfo& sei, UInt /*payloadSize*/)1085 #if Q0074_COLOUR_REMAPPING_SEI 1086 Void SEIReader::xParseSEIColourRemappingInfo(SEIColourRemappingInfo& sei, UInt /*payloadSize*/) 925 1087 { 926 1088 UInt uiVal; 927 1089 Int iVal; 928 1090 929 READ_UVLC( uiVal, "colour_map_id" ); sei.m_colorMapId = uiVal; 930 READ_FLAG( uiVal, "colour_map_cancel_flag" ); sei.m_colorMapCancelFlag = uiVal; 931 if( !sei.m_colorMapCancelFlag ) 932 { 933 READ_FLAG( uiVal, "colour_map_persistence_flag" ); sei.m_colorMapPersistenceFlag = uiVal; 934 READ_FLAG( uiVal, "colour_map_video_signal_type_present_flag" ); sei.m_colorMap_video_signal_type_present_flag = uiVal; 935 if ( sei.m_colorMap_video_signal_type_present_flag ) { 936 READ_FLAG( uiVal, "colour_map_video_full_range_flag" ); sei.m_colorMap_video_full_range_flag = uiVal; 937 READ_CODE( 8, uiVal, "colour_map_primaries" ); sei.m_colorMap_primaries = uiVal; 938 READ_CODE( 8, uiVal, "colour_map_transfer_characteristics" ); sei.m_colorMap_transfer_characteristics = uiVal; 939 READ_CODE( 8, uiVal, "colour_map_matrix_coeffs" ); sei.m_colorMap_matrix_coeffs = uiVal; 940 } 941 } 942 943 READ_CODE( 5, uiVal, "colour_map_coded_data_bit_depth" ); sei.m_colour_map_coded_data_bit_depth = uiVal; 944 READ_CODE( 5, uiVal, "colour_map_target_bit_depth" ); sei.m_colour_map_target_bit_depth = uiVal; 945 READ_UVLC( uiVal, "colour_map_model_id" ); sei.m_colorMapModelId = uiVal; 946 947 assert( sei.m_colorMapModelId == 0 ); 1091 READ_UVLC( uiVal, "colour_remap_id" ); sei.m_colourRemapId = uiVal; 1092 READ_FLAG( uiVal, "colour_remap_cancel_flag" ); sei.m_colourRemapCancelFlag = uiVal; 1093 if( !sei.m_colourRemapCancelFlag ) 1094 { 1095 READ_FLAG( uiVal, "colour_remap_persistence_flag" ); sei.m_colourRemapPersistenceFlag = uiVal; 1096 READ_FLAG( uiVal, "colour_remap_video_signal_info_present_flag" ); sei.m_colourRemapVideoSignalInfoPresentFlag = uiVal; 1097 if ( sei.m_colourRemapVideoSignalInfoPresentFlag ) 1098 { 1099 READ_FLAG( uiVal, "colour_remap_full_range_flag" ); sei.m_colourRemapFullRangeFlag = uiVal; 1100 READ_CODE( 8, uiVal, "colour_remap_primaries" ); sei.m_colourRemapPrimaries = uiVal; 1101 READ_CODE( 8, uiVal, "colour_remap_transfer_function" ); sei.m_colourRemapTransferFunction = uiVal; 1102 READ_CODE( 8, uiVal, "colour_remap_matrix_coefficients" ); sei.m_colourRemapMatrixCoefficients = uiVal; 1103 } 1104 READ_CODE( 8, uiVal, "colour_remap_input_bit_depth" ); sei.m_colourRemapInputBitDepth = uiVal; 1105 READ_CODE( 8, uiVal, "colour_remap_bit_depth" ); sei.m_colourRemapBitDepth = uiVal; 948 1106 949 for( Int i=0 ; i<3 ; i++ ) 950 { 951 READ_CODE( 8, uiVal, "num_input_pivots_minus1[i]" ); sei.m_num_input_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ; 952 sei.m_coded_input_pivot_value[i] = new Int[ sei.m_num_input_pivots[i] ]; 953 sei.m_target_input_pivot_value[i] = new Int[ sei.m_num_input_pivots[i] ]; 954 if( uiVal > 0 ) 955 { 956 for ( Int j=0 ; j<sei.m_num_input_pivots[i] ; j++ ) 957 { 958 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "coded_input_pivot_value[i][j]" ); sei.m_coded_input_pivot_value[i][j] = uiVal; 959 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "target_input_pivot_value[i][j]" ); sei.m_target_input_pivot_value[i][j] = uiVal; 960 } 961 } 962 else 963 { 964 sei.m_coded_input_pivot_value[i][0] = 0; 965 sei.m_target_input_pivot_value[i][0] = 0; 966 sei.m_coded_input_pivot_value[i][1] = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ; 967 sei.m_target_input_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ; 968 } 969 } 970 971 READ_FLAG( uiVal, "matrix_flag" ); sei.m_matrix_flag = uiVal; 972 if( sei.m_matrix_flag ) 973 { 974 READ_CODE( 4, uiVal, "log2_matrix_denom" ); sei.m_log2_matrix_denom = uiVal; 975 for ( Int i=0 ; i<3 ; i++ ) 976 { 977 for ( Int j=0 ; j<3 ; j++ ) 978 { 979 READ_SVLC( iVal, "matrix_coef[i][j]" ); sei.m_matrix_coef[i][j] = iVal; 980 } 981 } 982 } 983 984 for ( Int i=0 ; i<3 ; i++ ) 985 { 986 READ_CODE( 8, uiVal, "num_output_pivots_minus1[i]" ); sei.m_num_output_pivots[i] = (uiVal==0) ? 2 : (uiVal + 1) ; 987 sei.m_coded_output_pivot_value[i] = new Int[ sei.m_num_output_pivots[i] ]; 988 sei.m_target_output_pivot_value[i] = new Int[ sei.m_num_output_pivots[i] ]; 989 if( uiVal > 0 ) 990 { 991 for ( Int j=0 ; j<sei.m_num_output_pivots[i] ; j++ ) 992 { 993 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "coded_output_pivot_value[i][j]" ); sei.m_coded_output_pivot_value[i][j] = uiVal; 994 READ_CODE( (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, uiVal, "target_output_pivot_value[i][j]" ); sei.m_target_output_pivot_value[i][j] = uiVal; 995 } 996 } 997 else 998 { 999 sei.m_coded_output_pivot_value[i][0] = 0; 1000 sei.m_target_output_pivot_value[i][0] = 0; 1001 sei.m_coded_output_pivot_value[i][1] = (1 << sei.m_colour_map_coded_data_bit_depth) - 1 ; 1002 sei.m_target_output_pivot_value[i][1] = (1 << sei.m_colour_map_target_bit_depth) - 1 ; 1107 for( Int c=0 ; c<3 ; c++ ) 1108 { 1109 READ_CODE( 8, uiVal, "pre_lut_num_val_minus1[c]" ); sei.m_preLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 1110 sei.m_preLutCodedValue[c].resize(sei.m_preLutNumValMinus1[c]+1); 1111 sei.m_preLutTargetValue[c].resize(sei.m_preLutNumValMinus1[c]+1); 1112 if( uiVal> 0 ) 1113 for ( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ ) 1114 { 1115 READ_CODE( (( sei.m_colourRemapInputBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_coded_value[c][i]" ); sei.m_preLutCodedValue[c][i] = uiVal; 1116 READ_CODE( (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_target_value[c][i]" ); sei.m_preLutTargetValue[c][i] = uiVal; 1117 } 1118 else // pre_lut_num_val_minus1[c] == 0 1119 { 1120 sei.m_preLutCodedValue[c][0] = 0; 1121 sei.m_preLutTargetValue[c][0] = 0; 1122 sei.m_preLutCodedValue[c][1] = (1 << sei.m_colourRemapInputBitDepth) - 1 ; 1123 sei.m_preLutTargetValue[c][1] = (1 << sei.m_colourRemapBitDepth) - 1 ; 1124 } 1125 } 1126 1127 READ_FLAG( uiVal, "colour_remap_matrix_present_flag" ); sei.m_colourRemapMatrixPresentFlag = uiVal; 1128 if( sei.m_colourRemapMatrixPresentFlag ) 1129 { 1130 READ_CODE( 4, uiVal, "log2_matrix_denom" ); sei.m_log2MatrixDenom = uiVal; 1131 for ( Int c=0 ; c<3 ; c++ ) 1132 for ( Int i=0 ; i<3 ; i++ ) 1133 { 1134 READ_SVLC( iVal, "colour_remap_coeffs[c][i]" ); sei.m_colourRemapCoeffs[c][i] = iVal; 1135 } 1136 } 1137 else // setting default matrix (I3) 1138 { 1139 sei.m_log2MatrixDenom = 0; 1140 for ( Int c=0 ; c<3 ; c++ ) 1141 for ( Int i=0 ; i<3 ; i++ ) 1142 sei.m_colourRemapCoeffs[c][i] = (c==i) ? 1 : 0; 1143 } 1144 for( Int c=0 ; c<3 ; c++ ) 1145 { 1146 READ_CODE( 8, uiVal, "post_lut_num_val_minus1[c]" ); sei.m_postLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 1147 sei.m_postLutCodedValue[c].resize(sei.m_postLutNumValMinus1[c]+1); 1148 sei.m_postLutTargetValue[c].resize(sei.m_postLutNumValMinus1[c]+1); 1149 if( uiVal > 0 ) 1150 for ( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ ) 1151 { 1152 READ_CODE( (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_coded_value[c][i]" ); sei.m_postLutCodedValue[c][i] = uiVal; 1153 READ_CODE( (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_target_value[c][i]" ); sei.m_postLutTargetValue[c][i] = uiVal; 1154 } 1155 else 1156 { 1157 sei.m_postLutCodedValue[c][0] = 0; 1158 sei.m_postLutTargetValue[c][0] = 0; 1159 sei.m_postLutTargetValue[c][1] = (1 << sei.m_colourRemapBitDepth) - 1; 1160 sei.m_postLutCodedValue[c][1] = (1 << sei.m_colourRemapBitDepth) - 1; 1161 } 1003 1162 } 1004 1163 } … … 1194 1353 #endif 1195 1354 #if SUB_BITSTREAM_PROPERTY_SEI 1355 #if OLS_IDX_CHK 1356 Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei, TComVPS *vps) 1357 #else 1196 1358 Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei) 1359 #endif 1197 1360 { 1198 1361 UInt uiCode; … … 1203 1366 { 1204 1367 READ_CODE( 2, uiCode, "sub_bitstream_mode[i]" ); sei.m_subBitstreamMode[i] = uiCode; 1205 READ_UVLC( uiCode, "output_layer_set_idx_to_vps[i]" ); sei.m_outputLayerSetIdxToVps[i] = uiCode; 1368 READ_UVLC( uiCode, "output_layer_set_idx_to_vps[i]" ); 1369 #if OLS_IDX_CHK 1370 // The value of output_layer_set_idx_to_vps[ i ] shall be in the range of 0 to NumOutputLayerSets − 1, inclusive. 1371 assert(uiCode > 0 && uiCode <= vps->getNumOutputLayerSets()-1); 1372 #endif 1373 sei.m_outputLayerSetIdxToVps[i] = uiCode; 1206 1374 READ_CODE( 3, uiCode, "highest_sub_layer_id[i]" ); sei.m_highestSublayerId[i] = uiCode; 1207 1375 READ_CODE( 16, uiCode, "avg_bit_rate[i]" ); sei.m_avgBitRate[i] = uiCode; … … 1232 1400 1233 1401 // read nested SEI messages 1402 #if NESTING_SEI_EXTENSIBILITY 1403 Int numSeiMessages = 0; 1404 READ_UVLC( uiCode, "num_seis_in_bsp_minus1" ); assert( uiCode <= MAX_SEIS_IN_BSP_NESTING ); 1405 numSeiMessages = uiCode; 1406 for(Int i = 0; i < numSeiMessages; i++) 1407 { 1408 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &nestingSei, &sei); 1409 } 1410 #else 1234 1411 do { 1235 1412 #if LAYERS_NOT_PRESENT_SEI … … 1239 1416 #endif 1240 1417 } while (m_pcBitstream->getNumBitsLeft() > 8); 1418 #endif 1241 1419 } 1242 1420 … … 1245 1423 assert(vps->getVpsVuiPresentFlag()); 1246 1424 1425 #if VPS_VUI_BSP_HRD_PARAMS 1426 UInt uiCode; 1427 Int psIdx = bspNestingSei.m_seiPartitioningSchemeIdx; 1428 Int seiOlsIdx = bspNestingSei.m_seiOlsIdx; 1429 Int maxTemporalId = nestingSei.m_nestingMaxTemporalIdPlus1[0]; 1430 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 1431 std::vector<Int> hrdIdx(0, maxValues); 1432 std::vector<TComHRD *> hrdVec; 1433 std::vector<Int> syntaxElemLen; 1434 for(Int i = 0; i < maxValues; i++) 1435 { 1436 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei.m_bspIdx); 1437 hrdVec[i] = vps->getBspHrd(hrdIdx[i]); 1438 1439 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 1440 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 1441 { 1442 assert( syntaxElemLen[i] == 24 ); // Default value of init_cpb_removal_delay_length_minus1 is 23 1443 } 1444 if( i > 0 ) 1445 { 1446 assert( hrdVec[i]->getNalHrdParametersPresentFlag() == hrdVec[i-1]->getNalHrdParametersPresentFlag() ); 1447 assert( hrdVec[i]->getVclHrdParametersPresentFlag() == hrdVec[i-1]->getVclHrdParametersPresentFlag() ); 1448 } 1449 } 1450 if (hrdVec[0]->getNalHrdParametersPresentFlag()) 1451 { 1452 for(UInt i = 0; i < maxValues; i++) 1453 { 1454 READ_CODE( syntaxElemLen[i], uiCode, "nal_initial_arrival_delay[i]" ); sei.m_nalInitialArrivalDelay[i] = uiCode; 1455 } 1456 } 1457 if( hrdVec[0]->getVclHrdParametersPresentFlag() ) 1458 { 1459 for(UInt i = 0; i < maxValues; i++) 1460 { 1461 READ_CODE( syntaxElemLen[i], uiCode, "vcl_initial_arrival_delay[i]" ); sei.m_vclInitialArrivalDelay[i] = uiCode; 1462 } 1463 } 1464 #else 1247 1465 UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]); 1248 1466 UInt len; … … 1277 1495 } 1278 1496 } 1497 #if BSP_INIT_ARRIVAL_SEI 1498 if( hrd->getVclHrdParametersPresentFlag() ) 1499 #else 1279 1500 else 1501 #endif 1280 1502 { 1281 1503 for(UInt i = 0; i < schedCombCnt; i++) … … 1284 1506 } 1285 1507 } 1286 } 1287 1508 #endif 1509 } 1510 1511 #if !REMOVE_BSP_HRD_SEI 1288 1512 Void SEIReader::xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei) 1289 1513 { … … 1371 1595 } 1372 1596 } 1597 #endif 1373 1598 1374 1599 Void SEIReader::xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1) -
trunk/source/Lib/TLibDecoder/SEIread.h
r815 r906 80 80 Void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, UInt payloadSize); 81 81 Void xParseSEIActiveParameterSets (SEIActiveParameterSets &sei, UInt payloadSize); 82 Void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, UInt payloadSize); 83 #if VPS_VUI_BSP_HRD_PARAMS 84 Void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 85 Void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 86 Void xParseSEIPictureTiming (SEIPictureTiming& sei, UInt payloadSize, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 87 #else 82 88 Void xParseSEIDecodingUnitInfo (SEIDecodingUnitInfo& sei, UInt payloadSize, TComSPS *sps); 83 Void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, UInt payloadSize);84 89 Void xParseSEIBufferingPeriod (SEIBufferingPeriod& sei, UInt payloadSize, TComSPS *sps); 85 90 Void xParseSEIPictureTiming (SEIPictureTiming& sei, UInt payloadSize, TComSPS *sps); 91 #endif 86 92 Void xParseSEIRecoveryPoint (SEIRecoveryPoint& sei, UInt payloadSize); 87 93 Void xParseSEIFramePacking (SEIFramePacking& sei, UInt payloadSize); … … 93 99 Void xParseSEIKneeFunctionInfo (SEIKneeFunctionInfo& sei, UInt payloadSize); 94 100 #endif 95 #if Q0074_ SEI_COLOR_MAPPING96 Void xParseSEIColo rMappingInfo (SEIColorMappingInfo& sei, UInt payloadSize);101 #if Q0074_COLOUR_REMAPPING_SEI 102 Void xParseSEIColourRemappingInfo (SEIColourRemappingInfo& sei, UInt payloadSize); 97 103 #endif 98 104 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); … … 101 107 #endif 102 108 #if SUB_BITSTREAM_PROPERTY_SEI 109 #if OLS_IDX_CHK 110 Void xParseSEISubBitstreamProperty (SEISubBitstreamProperty &sei, TComVPS *vps); 111 #else 103 112 Void xParseSEISubBitstreamProperty (SEISubBitstreamProperty &sei); 113 #endif 104 114 #endif 105 115 #if LAYERS_NOT_PRESENT_SEI … … 116 126 #endif 117 127 Void xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei); 128 #if !REMOVE_BSP_HRD_SEI 118 129 Void xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei); 130 #endif 119 131 Void xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1); 120 132 #endif -
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r815 r906 255 255 if( pcPPS->getTilesEnabledFlag() ) 256 256 { 257 READ_UVLC ( uiCode, "num_tile_columns_minus1" ); pcPPS->setNum ColumnsMinus1( uiCode );258 READ_UVLC ( uiCode, "num_tile_rows_minus1" ); pcPPS->setNum RowsMinus1( uiCode );259 READ_FLAG ( uiCode, "uniform_spacing_flag" ); pcPPS->set UniformSpacingFlag( uiCode);260 261 if( !pcPPS->get UniformSpacingFlag())262 { 263 UInt* columnWidth = (UInt*)malloc(pcPPS->getNumColumnsMinus1()*sizeof(UInt));264 for(UInt i=0; i<pcPPS->getNum ColumnsMinus1(); i++)257 READ_UVLC ( uiCode, "num_tile_columns_minus1" ); pcPPS->setNumTileColumnsMinus1( uiCode ); 258 READ_UVLC ( uiCode, "num_tile_rows_minus1" ); pcPPS->setNumTileRowsMinus1( uiCode ); 259 READ_FLAG ( uiCode, "uniform_spacing_flag" ); pcPPS->setTileUniformSpacingFlag( uiCode == 1 ); 260 261 if( !pcPPS->getTileUniformSpacingFlag()) 262 { 263 std::vector<Int> columnWidth(pcPPS->getNumTileColumnsMinus1()); 264 for(UInt i=0; i<pcPPS->getNumTileColumnsMinus1(); i++) 265 265 { 266 266 READ_UVLC( uiCode, "column_width_minus1" ); 267 267 columnWidth[i] = uiCode+1; 268 268 } 269 pcPPS->setColumnWidth(columnWidth); 270 free(columnWidth); 271 272 UInt* rowHeight = (UInt*)malloc(pcPPS->getNumRowsMinus1()*sizeof(UInt)); 273 for(UInt i=0; i<pcPPS->getNumRowsMinus1(); i++) 269 pcPPS->setTileColumnWidth(columnWidth); 270 271 std::vector<Int> rowHeight (pcPPS->getTileNumRowsMinus1()); 272 for(UInt i=0; i<pcPPS->getTileNumRowsMinus1(); i++) 274 273 { 275 274 READ_UVLC( uiCode, "row_height_minus1" ); 276 275 rowHeight[i] = uiCode + 1; 277 276 } 278 pcPPS->setRowHeight(rowHeight); 279 free(rowHeight); 280 } 281 282 if(pcPPS->getNumColumnsMinus1() !=0 || pcPPS->getNumRowsMinus1() !=0) 277 pcPPS->setTileRowHeight(rowHeight); 278 } 279 280 if(pcPPS->getNumTileColumnsMinus1() !=0 || pcPPS->getTileNumRowsMinus1() !=0) 283 281 { 284 282 READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" ); pcPPS->setLoopFilterAcrossTilesEnabledFlag( uiCode ? true : false ); … … 297 295 } 298 296 } 299 297 #if !R0042_PROFILE_INDICATION 300 298 #if SCALINGLIST_INFERRING 301 299 if( pcPPS->getLayerId() > 0 ) … … 317 315 { 318 316 #endif 319 320 READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); 321 322 if(pcPPS->getScalingListPresentFlag ()) 323 { 324 parseScalingList( pcPPS->getScalingList() ); 325 } 326 317 #endif 318 319 READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); 320 321 if(pcPPS->getScalingListPresentFlag ()) 322 { 323 parseScalingList( pcPPS->getScalingList() ); 324 } 325 #if !R0042_PROFILE_INDICATION 327 326 #if SCALINGLIST_INFERRING 328 327 } 328 #endif 329 329 #endif 330 330 … … 338 338 pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); 339 339 340 #if !R0042_PROFILE_INDICATION 340 341 READ_FLAG( uiCode, "pps_extension_flag"); 342 #else 343 READ_FLAG( uiCode, "pps_extension_present_flag"); 344 #endif 345 346 #if !R0042_PROFILE_INDICATION 341 347 #if POC_RESET_INFO_INFERENCE 342 348 pcPPS->setExtensionFlag( uiCode ? true : false ); … … 361 367 READ_FLAG( uiCode, "poc_reset_info_present_flag" ); 362 368 pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false); 369 #if REF_REGION_OFFSET 370 READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode); 371 for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) 372 { 373 READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcPPS->setScaledRefLayerId( i, uiCode ); 374 READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" ); pcPPS->setScaledRefLayerOffsetPresentFlag( i, uiCode ); 375 if (uiCode) 376 { 377 Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i); 378 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); 379 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); 380 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); 381 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); 382 #if P0312_VERT_PHASE_ADJ 383 READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode); 384 #endif 385 } 386 READ_FLAG( uiCode, "ref_region_offset_present_flag" ); pcPPS->setRefRegionOffsetPresentFlag( i, uiCode ); 387 if (uiCode) 388 { 389 Window& refWindow = pcPPS->getRefLayerWindow(i); 390 READ_SVLC( iCode, "ref_region_left_offset" ); refWindow.setWindowLeftOffset (iCode << 1); 391 READ_SVLC( iCode, "ref_region_top_offset" ); refWindow.setWindowTopOffset (iCode << 1); 392 READ_SVLC( iCode, "ref_region_right_offset" ); refWindow.setWindowRightOffset (iCode << 1); 393 READ_SVLC( iCode, "ref_region_bottom_offset" ); refWindow.setWindowBottomOffset(iCode << 1); 394 } 395 #if R0209_GENERIC_PHASE 396 READ_FLAG( uiCode, "resample_phase_set_present_flag" ); pcPPS->setResamplePhaseSetPresentFlag( i, uiCode ); 397 if (uiCode) 398 { 399 READ_UVLC( uiCode, "phase_hor_luma" ); pcPPS->setPhaseHorLuma ( i, uiCode ); 400 READ_UVLC( uiCode, "phase_ver_luma" ); pcPPS->setPhaseVerLuma ( i, uiCode ); 401 READ_UVLC( uiCode, "phase_hor_chroma_plus8" ); pcPPS->setPhaseHorChroma (i, uiCode - 8); 402 READ_UVLC( uiCode, "phase_ver_chroma_plus8" ); pcPPS->setPhaseVerChroma (i, uiCode - 8); 403 } 404 #endif 405 } 406 #else 407 #if MOVE_SCALED_OFFSET_TO_PPS 408 READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode); 409 for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) 410 { 411 Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i); 412 #if O0098_SCALED_REF_LAYER_ID 413 READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcPPS->setScaledRefLayerId( i, uiCode ); 414 #endif 415 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); 416 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); 417 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); 418 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); 419 #if P0312_VERT_PHASE_ADJ 420 READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode); 421 #endif 422 } 423 #endif 424 #endif 363 425 #if Q0048_CGS_3D_ASYMLUT 364 426 READ_FLAG( uiCode , "colour_mapping_enabled_flag" ); … … 383 445 #endif 384 446 385 while ( xMoreRbspData() )386 {387 READ_FLAG( uiCode, "pps_extension_data_flag");388 }447 while ( xMoreRbspData() ) 448 { 449 READ_FLAG( uiCode, "pps_extension_data_flag"); 450 } 389 451 #if P0166_MODIFIED_PPS_EXTENSION 390 452 } … … 397 459 } 398 460 #endif 461 #else 462 pcPPS->setExtensionFlag( uiCode ? true : false ); 463 if( pcPPS->getExtensionFlag() ) 464 { 465 READ_FLAG( uiCode, "pps_range_extension_flag" ); 466 assert(uiCode == 0); 467 READ_FLAG( uiCode, "pps_multilayer_extension_flag" ); 468 assert(uiCode == 1); 469 READ_CODE(6, uiCode, "pps_extension_6bits"); 470 assert(uiCode == 0); 471 472 READ_FLAG( uiCode, "poc_reset_info_present_flag" ); 473 pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false); 474 475 #if SCALINGLIST_INFERRING 476 READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); 477 pcPPS->setInferScalingListFlag( uiCode ); 478 479 if( pcPPS->getInferScalingListFlag() ) 480 { 481 READ_UVLC( uiCode, "pps_scaling_list_ref_layer_id" ); 482 pcPPS->setScalingListRefLayerId( uiCode ); 483 // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive 484 assert( pcPPS->getScalingListRefLayerId() <= 62 ); 485 pcPPS->setScalingListPresentFlag( false ); 486 } 487 #endif 488 489 #if REF_REGION_OFFSET 490 READ_UVLC( uiCode, "num_ref_loc_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode); 491 for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) 492 { 493 READ_CODE( 6, uiCode, "ref_loc_offset_layer_id" ); pcPPS->setScaledRefLayerId( i, uiCode ); 494 READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" ); pcPPS->setScaledRefLayerOffsetPresentFlag( i, uiCode ); 495 if (uiCode) 496 { 497 Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i); 498 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); 499 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); 500 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); 501 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); 502 #if P0312_VERT_PHASE_ADJ 503 READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode); 504 #endif 505 } 506 READ_FLAG( uiCode, "ref_region_offset_present_flag" ); pcPPS->setRefRegionOffsetPresentFlag( i, uiCode ); 507 if (uiCode) 508 { 509 Window& refWindow = pcPPS->getRefLayerWindow(i); 510 READ_SVLC( iCode, "ref_region_left_offset" ); refWindow.setWindowLeftOffset (iCode << 1); 511 READ_SVLC( iCode, "ref_region_top_offset" ); refWindow.setWindowTopOffset (iCode << 1); 512 READ_SVLC( iCode, "ref_region_right_offset" ); refWindow.setWindowRightOffset (iCode << 1); 513 READ_SVLC( iCode, "ref_region_bottom_offset" ); refWindow.setWindowBottomOffset(iCode << 1); 514 } 515 #if R0209_GENERIC_PHASE 516 READ_FLAG( uiCode, "resample_phase_set_present_flag" ); pcPPS->setResamplePhaseSetPresentFlag( i, uiCode ); 517 if (uiCode) 518 { 519 READ_UVLC( uiCode, "phase_hor_luma" ); pcPPS->setPhaseHorLuma ( i, uiCode ); 520 READ_UVLC( uiCode, "phase_ver_luma" ); pcPPS->setPhaseVerLuma ( i, uiCode ); 521 READ_UVLC( uiCode, "phase_hor_chroma_plus8" ); pcPPS->setPhaseHorChroma (i, uiCode - 8); 522 READ_UVLC( uiCode, "phase_ver_chroma_plus8" ); pcPPS->setPhaseVerChroma (i, uiCode - 8); 523 } 524 #endif 525 } 526 #else 527 #if MOVE_SCALED_OFFSET_TO_PPS 528 READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode); 529 for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) 530 { 531 Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i); 532 #if O0098_SCALED_REF_LAYER_ID 533 READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcPPS->setScaledRefLayerId( i, uiCode ); 534 #endif 535 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); 536 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); 537 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); 538 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); 539 #if P0312_VERT_PHASE_ADJ 540 READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode); 541 #endif 542 } 543 #endif 544 #endif 545 #if Q0048_CGS_3D_ASYMLUT 546 READ_FLAG( uiCode , "colour_mapping_enabled_flag" ); 547 pcPPS->setCGSFlag( uiCode ); 548 if( pcPPS->getCGSFlag() ) 549 { 550 xParse3DAsymLUT( pc3DAsymLUT ); 551 pcPPS->setCGSOutputBitDepthY( pc3DAsymLUT->getOutputBitDepthY() ); 552 pcPPS->setCGSOutputBitDepthC( pc3DAsymLUT->getOutputBitDepthC() ); 553 } 554 #endif 555 } 556 #endif 557 399 558 } 400 559 … … 476 635 READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 477 636 } 478 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode);479 if( pcVUI->getHrdParametersPresentFlag() )480 {481 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 );482 }637 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 638 if( pcVUI->getHrdParametersPresentFlag() ) 639 { 640 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 641 } 483 642 } 484 643 READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); … … 524 683 READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); 525 684 } 685 #if VPS_VUI_BSP_HRD_PARAMS 686 else 687 { 688 hrd->setInitialCpbRemovalDelayLengthMinus1( 23 ); 689 // Add inferred values for other syntax elements here. 690 } 691 #endif 526 692 } 527 693 Int i, j, nalOrVcl; … … 554 720 { 555 721 if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || 556 722 ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) 557 723 { 558 724 for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) … … 582 748 #endif 583 749 750 #if R0042_PROFILE_INDICATION 751 UInt uiTmp = 0; 752 Bool bMultiLayerExtSpsFlag; 753 #endif 584 754 UInt uiCode; 585 755 READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); … … 590 760 READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); 591 761 assert(uiCode <= 6); 592 762 #if SVC_EXTENSION 763 } 764 #if R0042_PROFILE_INDICATION 765 else 766 { 767 READ_CODE( 3, uiCode, "sps_ext_or_max_sub_layers_minus1" ); uiTmp = uiCode; 768 } 769 #endif 770 #if !SPS_DPB_PARAMS 771 if(pcSPS->getLayerId() != 0) 772 { 773 pcSPS->setMaxTLayers ( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getMaxTLayers() ); 774 } 775 #endif 776 #endif 777 778 #if SVC_EXTENSION 779 #if R0042_PROFILE_INDICATION 780 bMultiLayerExtSpsFlag = ( pcSPS->getLayerId() != 0 && uiTmp == 7 ); 781 #endif 782 #endif 783 784 #if SVC_EXTENSION 785 #if !R0042_PROFILE_INDICATION 786 if(pcSPS->getLayerId() == 0) 787 #else 788 if(!bMultiLayerExtSpsFlag) 789 #endif 790 { 791 #endif 593 792 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 594 793 #if SVC_EXTENSION … … 597 796 else 598 797 { 599 pcSPS->setMaxTLayers ( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getMaxTLayers() );600 798 pcSPS->setTemporalIdNestingFlag( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getTemporalNestingFlag() ); 601 799 } … … 618 816 619 817 #ifdef SPS_PTL_FIX 818 #if !R0042_PROFILE_INDICATION 620 819 if ( pcSPS->getLayerId() == 0) 820 #else 821 if(!bMultiLayerExtSpsFlag) 822 #endif 621 823 { 622 824 parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); … … 630 832 631 833 #if REPN_FORMAT_IN_VPS 834 #if !R0042_PROFILE_INDICATION 632 835 if( pcSPS->getLayerId() > 0 ) 836 #else 837 if( bMultiLayerExtSpsFlag) 838 #endif 633 839 { 634 840 READ_FLAG( uiCode, "update_rep_format_flag" ); 635 841 pcSPS->setUpdateRepFormatFlag( uiCode ? true : false ); 842 #if R0042_PROFILE_INDICATION 843 if( bMultiLayerExtSpsFlag && uiCode) 844 { 845 READ_CODE(8, uiCode, "sps_rep_format_idx"); 846 pcSPS->setUpdateRepFormatIndex(uiCode); 847 } 848 #endif 636 849 } 637 850 else … … 643 856 #endif 644 857 } 858 859 #if R0042_PROFILE_INDICATION 860 if( !bMultiLayerExtSpsFlag ) 861 { 862 #else 645 863 #if O0096_REP_FORMAT_INDEX 646 864 if( pcSPS->getLayerId() == 0 ) 647 865 #else 648 866 if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 867 #endif 649 868 #endif 650 869 { … … 668 887 } 669 888 #if O0096_REP_FORMAT_INDEX 889 #if !R0042_PROFILE_INDICATION 670 890 else if ( pcSPS->getUpdateRepFormatFlag() ) 671 891 { … … 675 895 #endif 676 896 #endif 677 READ_FLAG( uiCode, "conformance_window_flag"); 678 if (uiCode != 0) 679 { 680 Window &conf = pcSPS->getConformanceWindow(); 897 #endif 898 899 #if R0156_CONF_WINDOW_IN_REP_FORMAT 681 900 #if REPN_FORMAT_IN_VPS 682 READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode ); 683 READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode ); 684 READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode ); 685 READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); 686 #else 687 READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 688 READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 689 READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 690 READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 691 #endif 692 } 693 #if REPN_FORMAT_IN_VPS 901 #if !R0042_PROFILE_INDICATION 694 902 #if O0096_REP_FORMAT_INDEX 695 903 if( pcSPS->getLayerId() == 0 ) 696 904 #else 697 905 if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 906 #endif 907 #endif 908 { 909 #endif 910 #endif 911 READ_FLAG( uiCode, "conformance_window_flag"); 912 if (uiCode != 0) 913 { 914 Window &conf = pcSPS->getConformanceWindow(); 915 #if REPN_FORMAT_IN_VPS 916 READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode ); 917 READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode ); 918 READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode ); 919 READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); 920 #else 921 READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 922 READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); 923 READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 924 READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); 925 #endif 926 } 927 #if R0156_CONF_WINDOW_IN_REP_FORMAT 928 #if REPN_FORMAT_IN_VPS 929 } 930 #endif 931 #endif 932 933 #if REPN_FORMAT_IN_VPS 934 #if !R0042_PROFILE_INDICATION 935 #if O0096_REP_FORMAT_INDEX 936 if( pcSPS->getLayerId() == 0 ) 937 #else 938 if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 939 #endif 698 940 #endif 699 941 { … … 711 953 } 712 954 #endif 955 #if R0042_PROFILE_INDICATION 956 } 957 #endif 958 713 959 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); 714 960 assert(uiCode <= 12); 715 961 716 962 #if SPS_DPB_PARAMS 963 #if !R0042_PROFILE_INDICATION 717 964 if( pcSPS->getLayerId() == 0 ) 718 965 { 966 #else 967 if( !bMultiLayerExtSpsFlag ) 968 { 969 #endif 719 970 #endif 720 971 UInt subLayerOrderingInfoPresentFlag; … … 749 1000 READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); 750 1001 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 751 1002 752 1003 if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5) 753 1004 { 754 1005 assert(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() >= 5); 755 1006 } 756 1007 757 1008 Int maxCUDepthDelta = uiCode; 758 1009 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); … … 773 1024 { 774 1025 #if SCALINGLIST_INFERRING 1026 #if !R0042_PROFILE_INDICATION 775 1027 if( pcSPS->getLayerId() > 0 ) 1028 #else 1029 if( bMultiLayerExtSpsFlag ) 1030 #endif 776 1031 { 777 1032 READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setInferScalingListFlag( uiCode ); … … 790 1045 { 791 1046 #endif 792 READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode );793 if(pcSPS->getScalingListPresentFlag ())794 {795 parseScalingList( pcSPS->getScalingList() );796 }1047 READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); 1048 if(pcSPS->getScalingListPresentFlag ()) 1049 { 1050 parseScalingList( pcSPS->getScalingList() ); 1051 } 797 1052 #if SCALINGLIST_INFERRING 798 1053 } … … 854 1109 if( pcSPS->getExtensionFlag() ) 855 1110 { 1111 #if !R0042_PROFILE_INDICATION 856 1112 #if O0142_CONDITIONAL_SPS_EXTENSION 857 1113 UInt spsExtensionTypeFlag[8]; … … 877 1133 } 878 1134 } 879 } 1135 } 1136 #else 1137 READ_FLAG( uiCode, "sps_range_extension_flag" ); 1138 assert(uiCode == 0); 1139 READ_FLAG( uiCode, "sps_multilayer_extension_flag" ); 1140 assert(uiCode == 1); 1141 READ_CODE(6, uiCode, "sps_extension_6bits"); 1142 assert(uiCode == 0); 1143 parseSPSExtension( pcSPS ); 1144 } 1145 #endif 880 1146 #else 881 1147 if (uiCode) … … 899 1165 assert( uiCode == 0 ); 900 1166 1167 #if !MOVE_SCALED_OFFSET_TO_PPS 901 1168 if( pcSPS->getLayerId() > 0 ) 902 1169 { … … 918 1185 } 919 1186 } 1187 #endif 920 1188 } 921 1189 #endif … … 926 1194 927 1195 READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); 1196 #if VPS_RESERVED_FLAGS 1197 READ_FLAG( uiCode, "vps_base_layer_internal_flag"); pcVPS->setBaseLayerInternalFlag( uiCode ? true : false ); 1198 READ_FLAG( uiCode, "vps_base_layer_available_flag"); pcVPS->setBaseLayerAvailableFlag( uiCode ? true : false ); 1199 #if VPS_AVC_BL_FLAG_REMOVAL 1200 pcVPS->setNonHEVCBaseLayerFlag( (pcVPS->getBaseLayerAvailableFlag() && !pcVPS->getBaseLayerInternalFlag()) ? true : false); 1201 #endif 1202 #else 928 1203 READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); 1204 #endif 929 1205 #if SVC_EXTENSION 930 1206 #if O0137_MAX_LAYERID … … 1025 1301 READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i ); 1026 1302 } 1303 else 1304 { 1305 pcVPS->setCprmsPresentFlag( true, i ); 1306 } 1307 1027 1308 parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 1028 1309 } … … 1082 1363 Int OlsHighestOutputLayerId[MAX_VPS_LAYER_SETS_PLUS1]; 1083 1364 #endif 1365 #if LIST_OF_PTL 1366 if( vps->getMaxLayers() > 1 && vps->getBaseLayerInternalFlag() ) 1367 { 1368 vps->setProfilePresentFlag(1, false); 1369 vps->getPTLForExtnPtr()->empty(); 1370 vps->getPTLForExtnPtr()->resize(2); 1371 vps->getPTLForExtn(1)->copyProfileInfo( vps->getPTL() ); 1372 parsePTL( vps->getPTLForExtn(1), vps->getProfilePresentFlag(1), vps->getMaxTLayers() - 1 ); 1373 } 1374 #endif 1084 1375 #if VPS_EXTN_MASK_AND_DIM_INFO 1085 1376 UInt numScalabilityTypes = 0, i = 0, j = 0; 1086 1377 1378 #if !VPS_AVC_BL_FLAG_REMOVAL 1087 1379 READ_FLAG( uiCode, "avc_base_layer_flag" ); vps->setAvcBaseLayerFlag(uiCode ? true : false); 1380 #endif 1088 1381 1089 1382 #if !P0307_REMOVE_VPS_VUI_OFFSET … … 1094 1387 #endif 1095 1388 #if VPS_VUI_OFFSET 1096 READ_CODE( 16, uiCode, "vps_vui_offset" ); vps->setVpsVuiOffset( uiCode );1389 READ_CODE( 16, uiCode, "vps_vui_offset" ); vps->setVpsVuiOffset( uiCode ); 1097 1390 #endif 1098 1391 #if O0109_MOVE_VPS_VUI_FLAG … … 1145 1438 if( !vps->getSplittingFlag() ) 1146 1439 { 1147 for(j = 0; j < numScalabilityTypes; j++)1148 {1149 READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode);1440 for(j = 0; j < numScalabilityTypes; j++) 1441 { 1442 READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode); 1150 1443 #if !AUXILIARY_PICTURES 1151 assert( uiCode <= vps->getMaxLayerId() );1152 #endif 1153 }1154 }1444 assert( uiCode <= vps->getMaxLayerId() ); 1445 #endif 1446 } 1447 } 1155 1448 } 1156 1449 #endif … … 1215 1508 vps->setTreePartitionLayerIdList(); 1216 1509 #endif 1510 #if MOVE_ADDN_LS_SIGNALLING 1511 #if Q0078_ADD_LAYER_SETS 1512 if (vps->getNumIndependentLayers() > 1) 1513 { 1514 READ_UVLC(uiCode, "num_add_layer_sets"); vps->setNumAddLayerSets(uiCode); 1515 for (i = 0; i < vps->getNumAddLayerSets(); i++) 1516 { 1517 for (j = 1; j < vps->getNumIndependentLayers(); j++) 1518 { 1519 int len = 1; 1520 while ((1 << len) < (vps->getNumLayersInTreePartition(j) + 1)) 1521 { 1522 len++; 1523 } 1524 READ_CODE(len, uiCode, "highest_layer_idx_plus1[i][j]"); vps->setHighestLayerIdxPlus1(i, j, uiCode); 1525 } 1526 } 1527 vps->setNumLayerSets(vps->getNumLayerSets() + vps->getNumAddLayerSets()); 1528 vps->setLayerIdIncludedFlagsForAddLayerSets(); 1529 } 1530 #endif 1531 #endif 1217 1532 #if VPS_TSLAYERS 1218 1533 READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag"); vps->setMaxTSLayersPresentFlag(uiCode ? true : false); … … 1239 1554 { 1240 1555 #if O0225_MAX_TID_FOR_REF_LAYERS 1241 for( j = i+1; j <= vps->getMaxLayers() - 1; j++) 1242 { 1243 if(vps->getDirectDependencyFlag(j, i)) 1244 { 1245 READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i][j]" ); vps->setMaxTidIlRefPicsPlus1(i, j, uiCode); 1246 assert( uiCode <= vps->getMaxTLayers()); 1247 } 1248 } 1556 for( j = i+1; j <= vps->getMaxLayers() - 1; j++) 1557 { 1558 if(vps->getDirectDependencyFlag(j, i)) 1559 { 1560 READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i][j]" ); vps->setMaxTidIlRefPicsPlus1(i, j, uiCode); 1561 } 1562 } 1249 1563 #else 1250 1564 READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode); … … 1258 1572 { 1259 1573 #if O0225_MAX_TID_FOR_REF_LAYERS 1260 1261 1262 1263 1574 for( j = i+1; j <= vps->getMaxLayers() - 1; j++) 1575 { 1576 vps->setMaxTidIlRefPicsPlus1(i, j, 7); 1577 } 1264 1578 #else 1265 1579 vps->setMaxTidIlRefPicsPlus1(i, 7); … … 1276 1590 READ_UVLC( uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 ); 1277 1591 #endif 1592 #if PER_LAYER_PTL 1593 Int const numBitsForPtlIdx = vps->calculateLenOfSyntaxElement( vps->getNumProfileTierLevel() ); 1594 #endif 1278 1595 vps->getPTLForExtnPtr()->resize(vps->getNumProfileTierLevel()); 1596 #if LIST_OF_PTL 1597 for(Int idx = vps->getBaseLayerInternalFlag() ? 2 : 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 1598 #else 1279 1599 for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 1600 #endif 1280 1601 { 1281 1602 READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); vps->setProfilePresentFlag(idx, uiCode ? true : false); … … 1300 1621 #endif 1301 1622 1623 #if !MOVE_ADDN_LS_SIGNALLING 1302 1624 #if Q0078_ADD_LAYER_SETS 1303 1625 if (vps->getNumIndependentLayers() > 1) … … 1319 1641 vps->setLayerIdIncludedFlagsForAddLayerSets(); 1320 1642 } 1643 #endif 1321 1644 #endif 1322 1645 … … 1363 1686 #endif 1364 1687 vps->setNumOutputLayerSets( numOutputLayerSets ); 1365 1688 #if NECESSARY_LAYER_FLAG 1689 // Default output layer set 1690 vps->setOutputLayerSetIdx(0, 0); 1691 vps->setOutputLayerFlag(0, 0, true); 1692 vps->deriveNecessaryLayerFlag(0); 1693 #if PER_LAYER_PTL 1694 vps->getProfileLevelTierIdx()->resize(numOutputLayerSets); 1695 vps->getProfileLevelTierIdx(0)->push_back( vps->getBaseLayerInternalFlag() && vps->getMaxLayers() > 1 ? 1 : 0); 1696 #endif 1697 #endif 1366 1698 for(i = 1; i < numOutputLayerSets; i++) 1367 1699 { … … 1379 1711 vps->setOutputLayerSetIdx( i, i ); 1380 1712 } 1713 Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i); 1381 1714 #if Q0078_ADD_LAYER_SETS 1382 1715 if ( i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() >= 2 ) … … 1385 1718 #endif 1386 1719 { 1387 Int lsIdx = vps->getOutputLayerSetIdx(i);1388 1720 #if NUM_OL_FLAGS 1389 for(j = 0; j < vps->getNumLayersInIdList(l sIdx); j++)1721 for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) 1390 1722 #else 1391 1723 for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) … … 1399 1731 // i <= (vps->getNumLayerSets() - 1) 1400 1732 // Assign OutputLayerFlag depending on default_one_target_output_layer_flag 1401 Int lsIdx = i;1402 1733 if( vps->getDefaultTargetOutputLayerIdc() == 1 ) 1403 1734 { 1404 for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) 1405 { 1406 vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1)) && (vps->getDimensionId(j,1) == 0) ); 1735 for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) 1736 { 1737 #if DEF_OPT_LAYER_IDC 1738 vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet)-1)) ); 1739 1740 #else 1741 vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet)-1)) && (vps->getDimensionId(j,1) == 0) ); 1742 #endif 1407 1743 } 1408 1744 } 1409 1745 else if ( vps->getDefaultTargetOutputLayerIdc() == 0 ) 1410 1746 { 1411 for(j = 0; j < vps->getNumLayersInIdList(l sIdx); j++)1747 for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) 1412 1748 { 1413 1749 vps->setOutputLayerFlag(i, j, 1); … … 1415 1751 } 1416 1752 } 1753 #if NECESSARY_LAYER_FLAG 1754 vps->deriveNecessaryLayerFlag(i); 1755 #endif 1756 #if PER_LAYER_PTL 1757 vps->getProfileLevelTierIdx(i)->assign(vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet), -1); 1758 for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet) ; j++) 1759 { 1760 if( vps->getNecessaryLayerFlag(i, j) ) 1761 { 1762 READ_CODE( numBitsForPtlIdx, uiCode, "profile_level_tier_idx[i]" ); 1763 vps->setProfileLevelTierIdx(i, j, uiCode ); 1764 } 1765 } 1766 #else 1417 1767 Int numBits = 1; 1418 1768 while ((1 << numBits) < (vps->getNumProfileTierLevel())) … … 1421 1771 } 1422 1772 READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" ); vps->setProfileLevelTierIdx(i, uiCode); 1773 #endif 1423 1774 #if P0300_ALT_OUTPUT_LAYER_FLAG 1424 1775 NumOutputLayersInOutputLayerSet[i] = 0; 1425 Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i);1426 1776 for (j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) 1427 1777 { … … 1437 1787 vps->setAltOuputLayerFlag(i, uiCode ? true : false); 1438 1788 } 1789 #if ALT_OPT_LAYER_FLAG 1790 else 1791 { 1792 uiCode=0; 1793 vps->setAltOuputLayerFlag(i, uiCode ? true : false); 1794 } 1795 #endif 1439 1796 #if Q0165_OUTPUT_LAYER_SET 1440 1797 assert( NumOutputLayersInOutputLayerSet[i]>0 ); … … 1443 1800 #endif 1444 1801 } 1802 #if NECESSARY_LAYER_FLAG 1803 vps->checkNecessaryLayerFlagCondition(); 1804 #endif 1445 1805 #else 1446 1806 if( numOutputLayerSets > 1 ) … … 1488 1848 { 1489 1849 #if O0135_DEFAULT_ONE_OUT_SEMANTIC 1850 #if DEF_OPT_LAYER_IDC 1851 vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1)) ); 1852 #else 1490 1853 vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1)) && (vps->getDimensionId(j,1)==0) ); 1854 #endif 1491 1855 #else 1492 1856 vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1))); … … 1669 2033 READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); 1670 2034 vps->setMaxOneActiveRefLayerFlag(uiCode); 2035 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2036 READ_FLAG(uiCode, "vps_poc_lsb_aligned_flag"); 2037 vps->setVpsPocLsbAlignedFlag(uiCode); 2038 #endif 1671 2039 #if O0062_POC_LSB_NOT_PRESENT_FLAG 1672 2040 for(i = 1; i< vps->getMaxLayers(); i++) … … 1824 2192 #endif 1825 2193 } 1826 2194 1827 2195 // When not present, the value of num_add_olss is inferred to be equal to 0. 1828 2196 // NumOutputLayerSets = num_add_olss + NumLayerSets … … 1838 2206 for( j = 0; j < vps->getNumLayersInIdList(lsIdx); j++ ) 1839 2207 { 1840 vps->setOutputLayerFlag(i, j, 1);2208 vps->setOutputLayerFlag(i, j, 1); 1841 2209 } 1842 2210 } … … 1848 2216 vps->setSubLayerDpbInfoPresentFlag( i, 0, true ); 1849 2217 } 1850 2218 1851 2219 // When not present, the value of vps_num_rep_formats_minus1 is inferred to be equal to MaxLayersMinus1. 1852 2220 vps->setVpsNumRepFormats( vps->getMaxLayers() ); … … 1864 2232 } 1865 2233 1866 // vps_poc_lsb_aligned_flag 1867 // When not present, vps_poc_lsb_aligned_flag is inferred to be equal to 0. 1868 2234 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2235 vps->setVpsPocLsbAlignedFlag(false); 2236 #endif 2237 1869 2238 #if O0062_POC_LSB_NOT_PRESENT_FLAG 1870 2239 // When not present, poc_lsb_not_present_flag[ i ] is inferred to be equal to 0. … … 1937 2306 repFormat->setBitDepthVpsChroma ( repFormatPrev->getBitDepthVpsChroma() ); 1938 2307 } 2308 1939 2309 #else 1940 2310 #if AUXILIARY_PICTURES … … 1943 2313 READ_CODE( 2, uiCode, "chroma_format_idc" ); repFormat->setChromaFormatVpsIdc( uiCode ); 1944 2314 #endif 1945 2315 1946 2316 if( repFormat->getChromaFormatVpsIdc() == 3 ) 1947 2317 { … … 1955 2325 READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" ); repFormat->setBitDepthVpsChroma( uiCode + 8 ); 1956 2326 #endif 2327 2328 #if R0156_CONF_WINDOW_IN_REP_FORMAT 2329 READ_FLAG( uiCode, "conformance_window_vps_flag" ); 2330 if( uiCode != 0) 2331 { 2332 Window &conf = repFormat->getConformanceWindowVps(); 2333 READ_UVLC( uiCode, "conf_win_vps_left_offset" ); conf.setWindowLeftOffset ( uiCode ); 2334 READ_UVLC( uiCode, "conf_win_vps_right_offset" ); conf.setWindowRightOffset ( uiCode ); 2335 READ_UVLC( uiCode, "conf_win_vps_top_offset" ); conf.setWindowTopOffset ( uiCode ); 2336 READ_UVLC( uiCode, "conf_win_vps_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); 2337 } 2338 #endif 1957 2339 } 1958 2340 #endif … … 1961 2343 { 1962 2344 UInt uiCode; 2345 #if SUB_LAYERS_IN_LAYER_SET 2346 vps->calculateMaxSLInLayerSets(); 2347 #else 1963 2348 #if DPB_PARAMS_MAXTLAYERS 1964 2349 #if BITRATE_PICRATE_SIGNALLING 1965 1966 1967 #else 1968 1969 1970 #endif 1971 1972 2350 Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumLayerSets()]; 2351 for(Int i = 0; i < vps->getNumLayerSets(); i++) 2352 #else 2353 Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()]; 2354 for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) 2355 #endif 2356 { 2357 UInt maxSLMinus1 = 0; 1973 2358 #if CHANGE_NUMSUBDPB_IDX 1974 1975 #else 1976 2359 Int optLsIdx = vps->getOutputLayerSetIdx( i ); 2360 #else 2361 Int optLsIdx = i; 1977 2362 #endif 1978 2363 #if BITRATE_PICRATE_SIGNALLING 1979 1980 #endif 1981 1982 1983 1984 1985 2364 optLsIdx = i; 2365 #endif 2366 for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) { 2367 Int lId = vps->getLayerSetLayerIdList(optLsIdx, k); 2368 maxSLMinus1 = max(maxSLMinus1, vps->getMaxTSLayersMinus1(vps->getLayerIdInVps(lId))); 2369 } 2370 MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1; 1986 2371 #if BITRATE_PICRATE_SIGNALLING 1987 vps->setMaxSLayersInLayerSetMinus1(i,MaxSubLayersInLayerSetMinus1[ i ]); 1988 #endif 1989 } 1990 #endif 1991 2372 vps->setMaxSLayersInLayerSetMinus1(i,MaxSubLayersInLayerSetMinus1[ i ]); 2373 #endif 2374 } 2375 #endif 2376 #endif 2377 1992 2378 #if !RESOLUTION_BASED_DPB 1993 2379 vps->deriveNumberOfSubDpbs(); … … 1999 2385 #endif 2000 2386 READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]"); vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false ); 2387 #if SUB_LAYERS_IN_LAYER_SET 2388 for(Int j = 0; j <= vps->getMaxSLayersInLayerSetMinus1( layerSetIdxForOutputLayerSet ); j++) 2389 #else 2001 2390 #if DPB_PARAMS_MAXTLAYERS 2002 2391 #if BITRATE_PICRATE_SIGNALLING … … 2008 2397 for(Int j = 0; j <= vps->getMaxTLayers(); j++) 2009 2398 #endif 2399 #endif 2010 2400 { 2011 2401 if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) ) … … 2032 2422 #endif 2033 2423 { 2424 #if DPB_INTERNAL_BL_SIG 2425 uiCode=0; 2426 if(vps->getBaseLayerInternalFlag() || ( vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k) != 0 ) ) 2427 #endif 2034 2428 READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1[i][k][j]" ); vps->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode ); 2035 2429 } … … 2060 2454 } 2061 2455 2456 #if !SUB_LAYERS_IN_LAYER_SET 2457 #if BITRATE_PICRATE_SIGNALLING 2458 if( MaxSubLayersInLayerSetMinus1 ) 2459 { 2460 delete [] MaxSubLayersInLayerSetMinus1; 2461 } 2462 #endif 2463 #endif 2464 2062 2465 // Infer values when not signalled 2063 2466 for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) … … 2122 2525 READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); vps->setPicRatePresentVpsFlag( uiCode ? true : false ); 2123 2526 2527 #if SIGNALLING_BITRATE_PICRATE_FIX 2528 if ( vps->getBitRatePresentVpsFlag() || vps->getPicRatePresentVpsFlag() ) 2529 { 2530 for( i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getNumLayerSets(); i++ ) 2531 { 2532 for( j = 0; j <= vps->getMaxSLayersInLayerSetMinus1( i ); j++ ) 2533 { 2534 if( vps->getBitRatePresentVpsFlag() ) 2535 { 2536 READ_FLAG( uiCode, "bit_rate_present_flag[i][j]" ); vps->setBitRatePresentFlag( i, j, uiCode ? true : false ); 2537 } 2538 if( vps->getPicRatePresentVpsFlag( ) ) 2539 { 2540 READ_FLAG( uiCode, "pic_rate_present_flag[i][j]" ); vps->setPicRatePresentFlag( i, j, uiCode ? true : false ); 2541 } 2542 if( vps->getBitRatePresentFlag( i, j ) ) 2543 { 2544 READ_CODE( 16, uiCode, "avg_bit_rate" ); vps->setAvgBitRate( i, j, uiCode ); 2545 READ_CODE( 16, uiCode, "max_bit_rate" ); vps->setMaxBitRate( i, j, uiCode ); 2546 } 2547 else 2548 { 2549 vps->setAvgBitRate( i, j, 0 ); 2550 vps->setMaxBitRate( i, j, 0 ); 2551 } 2552 if( vps->getPicRatePresentFlag( i, j ) ) 2553 { 2554 READ_CODE( 2, uiCode, "constant_pic_rate_idc" ); vps->setConstPicRateIdc( i, j, uiCode ); 2555 READ_CODE( 16, uiCode, "avg_pic_rate" ); vps->setAvgPicRate( i, j, uiCode ); 2556 } 2557 else 2558 { 2559 vps->setConstPicRateIdc( i, j, 0 ); 2560 vps->setAvgPicRate( i, j, 0 ); 2561 } 2562 } 2563 } 2564 } 2565 #else 2124 2566 Bool parseFlag = vps->getBitRatePresentVpsFlag() || vps->getPicRatePresentVpsFlag(); 2125 2567 2126 2568 #if Q0078_ADD_LAYER_SETS 2569 #if R0227_BR_PR_ADD_LAYER_SET 2570 for( i = 0; i < vps->getNumLayerSets(); i++ ) 2571 #else 2127 2572 for( i = 0; i <= vps->getVpsNumLayerSetsMinus1(); i++ ) 2573 #endif 2128 2574 #else 2129 2575 for( i = 0; i < vps->getNumLayerSets(); i++ ) … … 2174 2620 } 2175 2621 } 2622 #endif 2176 2623 #if VPS_VUI_VIDEO_SIGNAL_MOVE 2177 2624 READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); … … 2182 2629 else 2183 2630 { 2631 #if VPS_VUI_VST_PARAMS 2632 vps->setNumVideoSignalInfo(vps->getMaxLayers() - vps->getBaseLayerInternalFlag() ? 0 : 1); 2633 #else 2184 2634 vps->setNumVideoSignalInfo(vps->getMaxLayers()); 2635 #endif 2185 2636 } 2186 2637 … … 2193 2644 READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); 2194 2645 } 2646 #if VPS_VUI_VST_PARAMS 2647 if( vps->getVideoSigPresentVpsFlag() && vps->getNumVideoSignalInfo() > 1 ) 2648 { 2649 for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) 2650 { 2651 READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); 2652 } 2653 } 2654 else if ( !vps->getVideoSigPresentVpsFlag() ) 2655 { 2656 for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) 2657 { 2658 vps->setVideoSignalInfoIdx( i, i ); 2659 } 2660 } 2661 else // ( vps->getNumVideoSignalInfo() = 0 ) 2662 { 2663 for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) 2664 { 2665 vps->setVideoSignalInfoIdx( i, 0 ); 2666 } 2667 } 2668 #else 2195 2669 if(!vps->getVideoSigPresentVpsFlag()) 2196 2670 { … … 2214 2688 } 2215 2689 } 2690 #endif 2216 2691 #endif 2217 2692 #if VPS_VUI_TILES_NOT_IN_USE__FLAG … … 2303 2778 #if VPS_VUI_VIDEO_SIGNAL_MOVE 2304 2779 #else 2305 READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); 2306 if (vps->getVideoSigPresentVpsFlag()) 2307 { 2308 READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1); 2780 READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); 2781 if (vps->getVideoSigPresentVpsFlag()) 2782 { 2783 READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1); 2784 } 2785 else 2786 { 2787 vps->setNumVideoSignalInfo(vps->getMaxLayers()); 2788 } 2789 2790 2791 for(i = 0; i < vps->getNumVideoSignalInfo(); i++) 2792 { 2793 READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode); 2794 READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode); 2795 READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode); 2796 READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode); 2797 READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); 2798 } 2799 if(!vps->getVideoSigPresentVpsFlag()) 2800 { 2801 for (i=0; i < vps->getMaxLayers(); i++) 2802 { 2803 vps->setVideoSignalInfoIdx(i,i); 2804 } 2805 } 2806 else { 2807 vps->setVideoSignalInfoIdx(0,0); 2808 if (vps->getNumVideoSignalInfo() > 1 ) 2809 { 2810 for (i=1; i < vps->getMaxLayers(); i++) 2811 READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); 2812 } 2813 else { 2814 for (i=1; i < vps->getMaxLayers(); i++) 2815 { 2816 vps->setVideoSignalInfoIdx(i,0); 2817 } 2818 } 2819 } 2820 #endif 2821 #endif 2822 2823 #if O0164_MULTI_LAYER_HRD 2824 READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode); 2825 if (vps->getVpsVuiBspHrdPresentFlag()) 2826 { 2827 #if VPS_VUI_BSP_HRD_PARAMS 2828 parseVpsVuiBspHrdParams(vps); 2829 #else 2830 #if R0227_VUI_BSP_HRD_FLAG 2831 assert (vps->getTimingInfo()->getTimingInfoPresentFlag() == 1); 2832 #endif 2833 READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode); 2834 vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1); 2835 for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) 2836 { 2837 if( i > 0 ) 2838 { 2839 READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode); 2840 } 2841 parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); 2842 } 2843 #if Q0078_ADD_LAYER_SETS 2844 for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++) 2845 #else 2846 for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ ) 2847 #endif 2848 { 2849 READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode); 2850 #if HRD_BPB 2851 Int chkPart=0; 2852 #endif 2853 for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ ) 2854 { 2855 for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) 2856 { 2857 if( vps->getLayerIdIncludedFlag(h, j) ) 2858 { 2859 READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode); 2860 } 2861 } 2862 #if HRD_BPB 2863 chkPart+=vps->getLayerInBspFlag(h, i, j); 2864 #endif 2865 } 2866 #if HRD_BPB 2867 assert(chkPart<=1); 2868 #endif 2869 #if HRD_BPB 2870 if(vps->getNumBitstreamPartitions(h)==1) 2871 { 2872 Int chkPartition1=0; Int chkPartition2=0; 2873 for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) 2874 { 2875 if( vps->getLayerIdIncludedFlag(h, j) ) 2876 { 2877 chkPartition1+=vps->getLayerInBspFlag(h, 0, j); 2878 chkPartition2++; 2879 } 2880 } 2881 assert(chkPartition1!=chkPartition2); 2882 } 2883 #endif 2884 if (vps->getNumBitstreamPartitions(h)) 2885 { 2886 #if Q0182_MULTI_LAYER_HRD_UPDATE 2887 READ_UVLC( uiCode, "num_bsp_sched_combinations_minus1[h]"); vps->setNumBspSchedCombinations(h, uiCode + 1); 2888 #else 2889 READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode); 2890 #endif 2891 for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ ) 2892 { 2893 for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ ) 2894 { 2895 READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode); 2896 #if HRD_BPB 2897 assert(uiCode <= vps->getVpsNumBspHrdParametersMinus1()); 2898 #endif 2899 2900 READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode); 2901 #if HRD_BPB 2902 assert(uiCode <= vps->getBspHrdParamBufferCpbCntMinus1(uiCode,vps->getMaxTLayers()-1)); 2903 #endif 2904 } 2905 } 2906 } 2907 } 2908 #endif 2909 } 2910 #endif 2911 #if P0182_VPS_VUI_PS_FLAG 2912 for(i = 1; i < vps->getMaxLayers(); i++) 2913 { 2914 if (vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0) 2915 { 2916 READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); 2917 vps->setBaseLayerPSCompatibilityFlag( i, uiCode ); 2309 2918 } 2310 2919 else 2311 2920 { 2312 vps->setNumVideoSignalInfo(vps->getMaxLayers()); 2313 } 2314 2315 2316 for(i = 0; i < vps->getNumVideoSignalInfo(); i++) 2317 { 2318 READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode); 2319 READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode); 2320 READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode); 2321 READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode); 2322 READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); 2323 } 2324 if(!vps->getVideoSigPresentVpsFlag()) 2325 { 2326 for (i=0; i < vps->getMaxLayers(); i++) 2327 { 2328 vps->setVideoSignalInfoIdx(i,i); 2329 } 2330 } 2331 else { 2332 vps->setVideoSignalInfoIdx(0,0); 2333 if (vps->getNumVideoSignalInfo() > 1 ) 2334 { 2335 for (i=1; i < vps->getMaxLayers(); i++) 2336 READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); 2337 } 2338 else { 2339 for (i=1; i < vps->getMaxLayers(); i++) 2340 { 2341 vps->setVideoSignalInfoIdx(i,0); 2342 } 2343 } 2344 } 2345 #endif 2346 #endif 2347 2348 #if O0164_MULTI_LAYER_HRD 2349 READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode); 2350 if (vps->getVpsVuiBspHrdPresentFlag()) 2351 { 2352 READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode); 2353 vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1); 2354 for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) 2355 { 2356 if( i > 0 ) 2357 { 2358 READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode); 2359 } 2360 parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); 2361 } 2362 #if Q0078_ADD_LAYER_SETS 2363 for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++) 2364 #else 2365 for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ ) 2366 #endif 2367 { 2368 READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode); 2369 #if HRD_BPB 2370 Int chkPart=0; 2371 #endif 2372 for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ ) 2373 { 2374 for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) 2375 { 2376 if( vps->getLayerIdIncludedFlag(h, j) ) 2377 { 2378 READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode); 2379 } 2380 } 2381 #if HRD_BPB 2382 chkPart+=vps->getLayerInBspFlag(h, i, j); 2383 #endif 2384 } 2385 #if HRD_BPB 2386 assert(chkPart<=1); 2387 #endif 2388 #if HRD_BPB 2389 if(vps->getNumBitstreamPartitions(h)==1) 2390 { 2391 Int chkPartition1=0; Int chkPartition2=0; 2392 for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) 2393 { 2394 if( vps->getLayerIdIncludedFlag(h, j) ) 2395 { 2396 chkPartition1+=vps->getLayerInBspFlag(h, 0, j); 2397 chkPartition2++; 2398 } 2399 } 2400 assert(chkPartition1!=chkPartition2); 2401 } 2402 #endif 2403 if (vps->getNumBitstreamPartitions(h)) 2404 { 2405 #if Q0182_MULTI_LAYER_HRD_UPDATE 2406 READ_UVLC( uiCode, "num_bsp_sched_combinations_minus1[h]"); vps->setNumBspSchedCombinations(h, uiCode + 1); 2407 #else 2408 READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode); 2409 #endif 2410 for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ ) 2411 { 2412 for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ ) 2413 { 2414 READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode); 2415 #if HRD_BPB 2416 assert(uiCode <= vps->getVpsNumBspHrdParametersMinus1()); 2417 #endif 2418 2419 READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode); 2420 #if HRD_BPB 2421 assert(uiCode <= vps->getBspHrdParamBufferCpbCntMinus1(uiCode,vps->getMaxTLayers()-1)); 2422 #endif 2423 } 2424 } 2425 } 2426 } 2427 } 2428 #endif 2429 2430 #if P0182_VPS_VUI_PS_FLAG 2431 for(i = 1; i < vps->getMaxLayers(); i++) 2432 { 2433 if (vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0) 2434 { 2435 READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); 2436 vps->setBaseLayerPSCompatibilityFlag( i, uiCode ); 2437 } 2438 else 2439 { 2440 vps->setBaseLayerPSCompatibilityFlag( i, 0 ); 2441 } 2442 } 2443 #endif 2444 } 2921 vps->setBaseLayerPSCompatibilityFlag( i, 0 ); 2922 } 2923 } 2924 #endif 2925 } 2926 2445 2927 #endif //SVC_EXTENSION 2446 2928 … … 2476 2958 rpcSlice->setSPS(sps); 2477 2959 rpcSlice->setPPS(pps); 2960 2961 #if R0227_REP_FORMAT_CONSTRAINT //Conformance checking for rep format -- rep format of current picture of current layer shall never be greater rep format defined in VPS for the current layer 2962 TComVPS* vps = NULL; 2963 vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); 2964 #if R0279_REP_FORMAT_INBL 2965 if ( vps->getVpsExtensionFlag() == 1 && (rpcSlice->getLayerId() == 0 || sps->getV1CompatibleSPSFlag() == 1) ) 2966 { 2967 assert( sps->getPicWidthInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getPicWidthVpsInLumaSamples() ); 2968 assert( sps->getPicHeightInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getPicHeightVpsInLumaSamples() ); 2969 assert( sps->getChromaFormatIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getChromaFormatVpsIdc() ); 2970 assert( sps->getBitDepthY() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getBitDepthVpsLuma() ); 2971 assert( sps->getBitDepthC() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getBitDepthVpsChroma() ); 2972 #else 2973 if ( rpcSlice->getLayerId() == 0 && vps->getVpsExtensionFlag() == 1 ) 2974 { 2975 assert( sps->getPicWidthInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getPicWidthVpsInLumaSamples() ); 2976 assert( sps->getPicHeightInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getPicHeightVpsInLumaSamples() ); 2977 assert( sps->getChromaFormatIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getChromaFormatVpsIdc() ); 2978 assert( sps->getBitDepthY() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getBitDepthVpsLuma() ); 2979 assert( sps->getBitDepthC() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getBitDepthVpsChroma() ); 2980 #endif 2981 } 2982 else if ( vps->getVpsExtensionFlag() == 1 ) 2983 { 2984 assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getPicWidthVpsInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getPicWidthVpsInLumaSamples()); 2985 assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getPicHeightVpsInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getPicHeightVpsInLumaSamples()); 2986 assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getChromaFormatVpsIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getChromaFormatVpsIdc()); 2987 assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getBitDepthVpsLuma() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getBitDepthVpsLuma()); 2988 assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getBitDepthVpsChroma() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getBitDepthVpsChroma()); 2989 } 2990 #endif 2991 2478 2992 if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic )) 2479 2993 { … … 2522 3036 #if Q0142_POC_LSB_NOT_PRESENT 2523 3037 #if SHM_FIX7 2524 3038 Int iPOClsb = 0; 2525 3039 #endif 2526 3040 #endif … … 2557 3071 } 2558 3072 #else 3073 #if CROSS_LAYER_BLA_FLAG_FIX 3074 Int iBits = 0; 3075 if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) 3076 #else 2559 3077 if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits()>0) 3078 #endif 2560 3079 { 2561 3080 READ_FLAG(uiCode, "discardable_flag"); // ignored 2562 } 3081 #if NON_REF_NAL_TYPE_DISCARDABLE 3082 rpcSlice->setDiscardableFlag( uiCode ? true : false ); 3083 if (uiCode) 3084 { 3085 assert(rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TRAIL_R && 3086 rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TSA_R && 3087 rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_STSA_R && 3088 rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RADL_R && 3089 rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RASL_R); 3090 } 3091 #endif 3092 #if CROSS_LAYER_BLA_FLAG_FIX 3093 iBits++; 3094 #endif 3095 } 3096 #if CROSS_LAYER_BLA_FLAG_FIX 3097 if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) 3098 { 3099 READ_FLAG(uiCode, "cross_layer_bla_flag"); rpcSlice->setCrossLayerBLAFlag( uiCode ? true : false ); 3100 iBits++; 3101 } 3102 for ( ; iBits < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++) 3103 #else 2563 3104 for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 3105 #endif 2564 3106 { 2565 3107 READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored … … 2649 3191 #if N0065_LAYER_POC_ALIGNMENT 2650 3192 #if SHM_FIX7 2651 3193 } 2652 3194 #endif 2653 3195 #if POC_RESET_IDC_DECODER 2654 else 2655 { 2656 rpcSlice->setPicOrderCntLsb( 0 ); 2657 } 2658 #endif 2659 if( !rpcSlice->getIdrPicFlag() ) 2660 { 2661 #endif 2662 TComReferencePictureSet* rps; 2663 rps = rpcSlice->getLocalRPS(); 2664 rpcSlice->setRPS(rps); 2665 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 2666 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 2667 { 2668 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 2669 } 2670 else // use reference to short-term reference picture set in PPS 2671 { 2672 Int numBits = 0; 2673 while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) 2674 { 2675 numBits++; 2676 } 2677 if (numBits > 0) 2678 { 2679 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 3196 else 3197 { 3198 rpcSlice->setPicOrderCntLsb( 0 ); 3199 } 3200 #endif 3201 if( !rpcSlice->getIdrPicFlag() ) 3202 { 3203 #endif 3204 TComReferencePictureSet* rps; 3205 rps = rpcSlice->getLocalRPS(); 3206 rpcSlice->setRPS(rps); 3207 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 3208 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 3209 { 3210 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 3211 } 3212 else // use reference to short-term reference picture set in PPS 3213 { 3214 Int numBits = 0; 3215 while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) 3216 { 3217 numBits++; 3218 } 3219 if (numBits > 0) 3220 { 3221 READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); 3222 } 3223 else 3224 { 3225 uiCode = 0; 3226 } 3227 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 3228 } 3229 if(sps->getLongTermRefsPresent()) 3230 { 3231 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 3232 UInt numOfLtrp = 0; 3233 UInt numLtrpInSPS = 0; 3234 if (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) 3235 { 3236 READ_UVLC( uiCode, "num_long_term_sps"); 3237 numLtrpInSPS = uiCode; 3238 numOfLtrp += numLtrpInSPS; 3239 rps->setNumberOfLongtermPictures(numOfLtrp); 3240 } 3241 Int bitsForLtrpInSPS = 0; 3242 while (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 3243 { 3244 bitsForLtrpInSPS++; 3245 } 3246 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 3247 numOfLtrp += uiCode; 3248 rps->setNumberOfLongtermPictures(numOfLtrp); 3249 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 3250 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 3251 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 3252 { 3253 Int pocLsbLt; 3254 if (k < numLtrpInSPS) 3255 { 3256 uiCode = 0; 3257 if (bitsForLtrpInSPS > 0) 3258 { 3259 READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); 3260 } 3261 Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode); 3262 3263 pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode); 3264 rps->setUsed(j,usedByCurrFromSPS); 2680 3265 } 2681 3266 else 2682 3267 { 2683 uiCode = 0; 2684 } 2685 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 2686 } 2687 if(sps->getLongTermRefsPresent()) 2688 { 2689 Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); 2690 UInt numOfLtrp = 0; 2691 UInt numLtrpInSPS = 0; 2692 if (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) 2693 { 2694 READ_UVLC( uiCode, "num_long_term_sps"); 2695 numLtrpInSPS = uiCode; 2696 numOfLtrp += numLtrpInSPS; 2697 rps->setNumberOfLongtermPictures(numOfLtrp); 2698 } 2699 Int bitsForLtrpInSPS = 0; 2700 while (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) 2701 { 2702 bitsForLtrpInSPS++; 2703 } 2704 READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); 2705 numOfLtrp += uiCode; 2706 rps->setNumberOfLongtermPictures(numOfLtrp); 2707 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 2708 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 2709 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 2710 { 2711 Int pocLsbLt; 2712 if (k < numLtrpInSPS) 3268 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; 3269 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 3270 } 3271 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 3272 Bool mSBPresentFlag = uiCode ? true : false; 3273 if(mSBPresentFlag) 3274 { 3275 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 3276 Bool deltaFlag = false; 3277 // First LTRP || First LTRP from SH 3278 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 2713 3279 { 2714 uiCode = 0; 2715 if (bitsForLtrpInSPS > 0) 2716 { 2717 READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); 2718 } 2719 Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode); 2720 2721 pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode); 2722 rps->setUsed(j,usedByCurrFromSPS); 3280 deltaFlag = true; 3281 } 3282 if(deltaFlag) 3283 { 3284 deltaPocMSBCycleLT = uiCode; 2723 3285 } 2724 3286 else 2725 3287 { 2726 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; 2727 READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); 3288 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2728 3289 } 2729 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 2730 Bool mSBPresentFlag = uiCode ? true : false; 2731 if(mSBPresentFlag) 3290 3291 Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 3292 - iPOClsb + pocLsbLt; 3293 rps->setPOC (j, pocLTCurr); 3294 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); 3295 rps->setCheckLTMSBPresent(j,true); 3296 } 3297 else 3298 { 3299 rps->setPOC (j, pocLsbLt); 3300 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); 3301 rps->setCheckLTMSBPresent(j,false); 3302 3303 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 3304 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 2732 3305 { 2733 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 2734 Bool deltaFlag = false; 2735 // First LTRP || First LTRP from SH 2736 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 2737 { 2738 deltaFlag = true; 2739 } 2740 if(deltaFlag) 2741 { 2742 deltaPocMSBCycleLT = uiCode; 2743 } 2744 else 2745 { 2746 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 2747 } 2748 2749 Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 2750 - iPOClsb + pocLsbLt; 2751 rps->setPOC (j, pocLTCurr); 2752 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); 2753 rps->setCheckLTMSBPresent(j,true); 3306 deltaPocMSBCycleLT = 0; 2754 3307 } 2755 else 3308 } 3309 prevDeltaMSB = deltaPocMSBCycleLT; 3310 } 3311 offset += rps->getNumberOfLongtermPictures(); 3312 rps->setNumberOfPictures(offset); 3313 } 3314 #if DPB_CONSTRAINTS 3315 if(rpcSlice->getVPS()->getVpsExtensionFlag()==1) 3316 { 3317 #if Q0078_ADD_LAYER_SETS 3318 for (Int ii = 1; ii < (rpcSlice->getVPS()->getVpsNumLayerSetsMinus1() + 1); ii++) // prevent assert error when num_add_layer_sets > 0 3319 #else 3320 for (Int ii=1; ii< rpcSlice->getVPS()->getNumOutputLayerSets(); ii++ ) 3321 #endif 3322 { 3323 Int layerSetIdxForOutputLayerSet = rpcSlice->getVPS()->getOutputLayerSetIdx( ii ); 3324 Int chkAssert=0; 3325 for(Int kk = 0; kk < rpcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++) 3326 { 3327 if(rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk)) 2756 3328 { 2757 rps->setPOC (j, pocLsbLt); 2758 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); 2759 rps->setCheckLTMSBPresent(j,false); 2760 2761 // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present 2762 if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) 2763 { 2764 deltaPocMSBCycleLT = 0; 3329 chkAssert=1; 3330 } 3331 } 3332 if(chkAssert) 3333 { 3334 // There may be something wrong here (layer id assumed to be layer idx?) 3335 assert(rps->getNumberOfNegativePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); 3336 assert(rps->getNumberOfPositivePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures()); 3337 assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); 3338 } 3339 } 3340 3341 3342 } 3343 if(rpcSlice->getLayerId() == 0) 3344 { 3345 assert(rps->getNumberOfNegativePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) ); 3346 assert(rps->getNumberOfPositivePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) -rps->getNumberOfNegativePictures()); 3347 assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1)); 3348 } 3349 #endif 3350 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 3351 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 3352 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 3353 { 3354 // In the case of BLA picture types, rps data is read from slice header but ignored 3355 rps = rpcSlice->getLocalRPS(); 3356 rps->setNumberOfNegativePictures(0); 3357 rps->setNumberOfPositivePictures(0); 3358 rps->setNumberOfLongtermPictures(0); 3359 rps->setNumberOfPictures(0); 3360 rpcSlice->setRPS(rps); 3361 } 3362 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 3363 { 3364 #if R0226_SLICE_TMVP 3365 READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); 3366 #else 3367 READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); 3368 #endif 3369 rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 3370 } 3371 else 3372 { 3373 rpcSlice->setEnableTMVPFlag(false); 3374 } 3375 #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7 3376 } 3377 #endif 3378 } 3379 3380 #if SVC_EXTENSION 3381 rpcSlice->setActiveNumILRRefIdx(0); 3382 if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) ) 3383 { 3384 READ_FLAG(uiCode,"inter_layer_pred_enabled_flag"); 3385 rpcSlice->setInterLayerPredEnabledFlag(uiCode); 3386 if( rpcSlice->getInterLayerPredEnabledFlag()) 3387 { 3388 if(rpcSlice->getNumILRRefIdx() > 1) 3389 { 3390 Int numBits = 1; 3391 while ((1 << numBits) < rpcSlice->getNumILRRefIdx()) 3392 { 3393 numBits++; 3394 } 3395 if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 3396 { 3397 READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" ); 3398 rpcSlice->setActiveNumILRRefIdx(uiCode + 1); 3399 } 3400 else 3401 { 3402 #if P0079_DERIVE_NUMACTIVE_REF_PICS 3403 for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ ) 3404 { 3405 #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO 3406 if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && 3407 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) 3408 #else 3409 if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() && 3410 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) 3411 #endif 3412 { 3413 rpcSlice->setActiveNumILRRefIdx(1); 3414 break; 2765 3415 } 2766 3416 } 2767 prevDeltaMSB = deltaPocMSBCycleLT; 2768 } 2769 offset += rps->getNumberOfLongtermPictures(); 2770 rps->setNumberOfPictures(offset); 2771 } 2772 #if DPB_CONSTRAINTS 2773 if(rpcSlice->getVPS()->getVpsExtensionFlag()==1) 3417 #else 3418 rpcSlice->setActiveNumILRRefIdx(1); 3419 #endif 3420 } 3421 3422 if( rpcSlice->getActiveNumILRRefIdx() == rpcSlice->getNumILRRefIdx() ) 3423 { 3424 for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 2774 3425 { 2775 #if Q0078_ADD_LAYER_SETS 2776 for (Int ii = 1; ii < (rpcSlice->getVPS()->getVpsNumLayerSetsMinus1() + 1); ii++) // prevent assert error when num_add_layer_sets > 0 2777 #else 2778 for (Int ii=1; ii< rpcSlice->getVPS()->getNumOutputLayerSets(); ii++ ) 2779 #endif 2780 { 2781 Int layerSetIdxForOutputLayerSet = rpcSlice->getVPS()->getOutputLayerSetIdx( ii ); 2782 Int chkAssert=0; 2783 for(Int kk = 0; kk < rpcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++) 2784 { 2785 if(rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk)) 2786 { 2787 chkAssert=1; 2788 } 2789 } 2790 if(chkAssert) 2791 { 2792 // There may be something wrong here (layer id assumed to be layer idx?) 2793 assert(rps->getNumberOfNegativePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); 2794 assert(rps->getNumberOfPositivePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures()); 2795 assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); 2796 } 2797 } 2798 2799 3426 rpcSlice->setInterLayerPredLayerIdc(i,i); 2800 3427 } 2801 if(rpcSlice->getLayerId() == 0) 3428 } 3429 else 3430 { 3431 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 2802 3432 { 2803 assert(rps->getNumberOfNegativePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) ); 2804 assert(rps->getNumberOfPositivePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) -rps->getNumberOfNegativePictures()); 2805 assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1)); 3433 READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" ); 3434 rpcSlice->setInterLayerPredLayerIdc(uiCode,i); 2806 3435 } 2807 #endif 2808 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 2809 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 2810 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 2811 { 2812 // In the case of BLA picture types, rps data is read from slice header but ignored 2813 rps = rpcSlice->getLocalRPS(); 2814 rps->setNumberOfNegativePictures(0); 2815 rps->setNumberOfPositivePictures(0); 2816 rps->setNumberOfLongtermPictures(0); 2817 rps->setNumberOfPictures(0); 2818 rpcSlice->setRPS(rps); 2819 } 2820 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 2821 { 2822 READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); 2823 rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 3436 } 2824 3437 } 2825 3438 else 2826 3439 { 2827 rpcSlice->setEnableTMVPFlag(false);2828 }2829 #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX72830 }2831 #endif2832 }2833 2834 #if SVC_EXTENSION2835 rpcSlice->setActiveNumILRRefIdx(0);2836 if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) )2837 {2838 READ_FLAG(uiCode,"inter_layer_pred_enabled_flag");2839 rpcSlice->setInterLayerPredEnabledFlag(uiCode);2840 if( rpcSlice->getInterLayerPredEnabledFlag())2841 {2842 if(rpcSlice->getNumILRRefIdx() > 1)2843 {2844 Int numBits = 1;2845 while ((1 << numBits) < rpcSlice->getNumILRRefIdx())2846 {2847 numBits++;2848 }2849 if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag())2850 {2851 READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" );2852 rpcSlice->setActiveNumILRRefIdx(uiCode + 1);2853 }2854 else2855 {2856 #if P0079_DERIVE_NUMACTIVE_REF_PICS2857 for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ )2858 {2859 #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO2860 if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) &&2861 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) )2862 #else2863 if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() &&2864 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) )2865 #endif2866 {2867 rpcSlice->setActiveNumILRRefIdx(1);2868 break;2869 }2870 }2871 #else2872 rpcSlice->setActiveNumILRRefIdx(1);2873 #endif2874 }2875 2876 if( rpcSlice->getActiveNumILRRefIdx() == rpcSlice->getNumILRRefIdx() )2877 {2878 for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )2879 {2880 rpcSlice->setInterLayerPredLayerIdc(i,i);2881 }2882 }2883 else2884 {2885 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )2886 {2887 READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" );2888 rpcSlice->setInterLayerPredLayerIdc(uiCode,i);2889 }2890 }2891 }2892 else2893 {2894 3440 #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS 2895 3441 #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO 2896 2897 2898 #else 2899 2900 3442 if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && 3443 (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >= rpcSlice->getTLayer()) ) 3444 #else 3445 if( (rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) > rpcSlice->getTLayer()) && 3446 (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >= rpcSlice->getTLayer()) ) 2901 3447 #endif 2902 3448 { … … 2907 3453 } 2908 3454 #endif 2909 2910 2911 2912 2913 2914 3455 } 3456 } 3457 } 3458 else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true && (rpcSlice->getLayerId() > 0 )) 3459 { 3460 rpcSlice->setInterLayerPredEnabledFlag(true); 2915 3461 2916 3462 #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS 2917 2918 2919 2920 2921 3463 Int numRefLayerPics = 0; 3464 Int i = 0; 3465 Int refLayerPicIdc [MAX_VPS_LAYER_ID_PLUS1]; 3466 for(i = 0, numRefLayerPics = 0; i < rpcSlice->getNumILRRefIdx(); i++ ) 3467 { 2922 3468 #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO 2923 2924 3469 if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && 3470 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) 2925 3471 #else 2926 2927 3472 if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() && 3473 (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) 2928 3474 #endif 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 #else 2939 2940 2941 2942 2943 3475 { 3476 refLayerPicIdc[ numRefLayerPics++ ] = i; 3477 } 3478 } 3479 rpcSlice->setActiveNumILRRefIdx(numRefLayerPics); 3480 for( i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 3481 { 3482 rpcSlice->setInterLayerPredLayerIdc(refLayerPicIdc[i],i); 3483 } 3484 #else 3485 rpcSlice->setActiveNumILRRefIdx(rpcSlice->getNumILRRefIdx()); 3486 for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 3487 { 3488 rpcSlice->setInterLayerPredLayerIdc(i,i); 3489 } 2944 3490 #endif 2945 3491 } 2946 3492 #if P0312_VERT_PHASE_ADJ 2947 3493 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 2948 3494 { 2949 3495 UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i); 3496 #if !MOVE_SCALED_OFFSET_TO_PPS 2950 3497 if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) ) 3498 #else 3499 if( rpcSlice->getPPS()->getVertPhasePositionEnableFlag(refLayerIdc) ) 3500 #endif 2951 3501 { 2952 3502 READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc ); 2953 3503 } 2954 3504 } 2955 3505 #endif 2956 3506 #endif //SVC_EXTENSION 2957 3507 2958 2959 2960 3508 if(sps->getUseSAO()) 3509 { 3510 READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); 2961 3511 #if AUXILIARY_PICTURES 2962 3512 ChromaFormat format; 2963 3513 #if REPN_FORMAT_IN_VPS 2964 3514 #if O0096_REP_FORMAT_INDEX 2965 2966 2967 2968 2969 2970 2971 3515 if( sps->getLayerId() == 0 ) 3516 { 3517 format = sps->getChromaFormatIdc(); 3518 } 3519 else 3520 { 3521 format = rpcSlice->getVPS()->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); 2972 3522 #if Q0195_REP_FORMAT_CLEANUP 2973 assert( (sps->getUpdateRepFormatFlag()==false && rpcSlice->getVPS()->getVpsNumRepFormats()==1) || rpcSlice->getVPS()->getVpsNumRepFormats() > 1 ); //conformance check 2974 #endif 2975 } 2976 #else 2977 if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() ) 2978 { 2979 format = sps->getChromaFormatIdc(); 2980 } 2981 else 2982 { 2983 format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); 2984 } 2985 #endif 2986 #else 3523 assert( (sps->getUpdateRepFormatFlag()==false && rpcSlice->getVPS()->getVpsNumRepFormats()==1) || rpcSlice->getVPS()->getVpsNumRepFormats() > 1 ); //conformance check 3524 #endif 3525 } 3526 #else 3527 if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() ) 3528 { 2987 3529 format = sps->getChromaFormatIdc(); 2988 #endif 2989 if (format != CHROMA_400) 2990 { 3530 } 3531 else 3532 { 3533 format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); 3534 } 3535 #endif 3536 #else 3537 format = sps->getChromaFormatIdc(); 3538 #endif 3539 if (format != CHROMA_400) 3540 { 2991 3541 #endif 2992 3542 READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); 2993 3543 #if AUXILIARY_PICTURES 3544 } 3545 else 3546 { 3547 rpcSlice->setSaoEnabledFlagChroma(false); 3548 } 3549 #endif 3550 } 3551 3552 if (rpcSlice->getIdrPicFlag()) 3553 { 3554 rpcSlice->setEnableTMVPFlag(false); 3555 } 3556 if (!rpcSlice->isIntra()) 3557 { 3558 3559 READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); 3560 if (uiCode) 3561 { 3562 READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); 3563 if (rpcSlice->isInterB()) 3564 { 3565 READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); 2994 3566 } 2995 3567 else 2996 3568 { 2997 rpcSlice->setSaoEnabledFlagChroma(false); 2998 } 2999 #endif 3000 } 3001 3002 if (rpcSlice->getIdrPicFlag()) 3003 { 3004 rpcSlice->setEnableTMVPFlag(false); 3005 } 3006 if (!rpcSlice->isIntra()) 3007 { 3008 3009 READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); 3010 if (uiCode) 3011 { 3012 READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); 3013 if (rpcSlice->isInterB()) 3014 { 3015 READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); 3016 } 3017 else 3018 { 3019 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 3020 } 3569 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); 3570 } 3571 } 3572 else 3573 { 3574 rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive()); 3575 if (rpcSlice->isInterB()) 3576 { 3577 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive()); 3021 3578 } 3022 3579 else 3023 3580 { 3024 rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive()); 3025 if (rpcSlice->isInterB()) 3026 { 3027 rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive()); 3028 } 3029 else 3030 { 3031 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0); 3032 } 3033 } 3034 } 3035 // } 3036 TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification(); 3037 if(!rpcSlice->isIntra()) 3038 { 3039 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 3040 { 3041 refPicListModification->setRefPicListModificationFlagL0( 0 ); 3581 rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0); 3582 } 3583 } 3584 } 3585 // } 3586 TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification(); 3587 if(!rpcSlice->isIntra()) 3588 { 3589 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 3590 { 3591 refPicListModification->setRefPicListModificationFlagL0( 0 ); 3592 } 3593 else 3594 { 3595 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); 3596 } 3597 3598 if(refPicListModification->getRefPicListModificationFlagL0()) 3599 { 3600 uiCode = 0; 3601 Int i = 0; 3602 Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList(); 3603 if ( numRpsCurrTempList0 > 1 ) 3604 { 3605 Int length = 1; 3606 numRpsCurrTempList0 --; 3607 while ( numRpsCurrTempList0 >>= 1) 3608 { 3609 length ++; 3610 } 3611 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 3612 { 3613 READ_CODE( length, uiCode, "list_entry_l0" ); 3614 refPicListModification->setRefPicSetIdxL0(i, uiCode ); 3615 } 3042 3616 } 3043 3617 else 3044 3618 { 3045 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); 3046 } 3047 3048 if(refPicListModification->getRefPicListModificationFlagL0()) 3049 { 3050 uiCode = 0; 3051 Int i = 0; 3052 Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList(); 3053 if ( numRpsCurrTempList0 > 1 ) 3054 { 3055 Int length = 1; 3056 numRpsCurrTempList0 --; 3057 while ( numRpsCurrTempList0 >>= 1) 3058 { 3059 length ++; 3060 } 3061 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 3062 { 3063 READ_CODE( length, uiCode, "list_entry_l0" ); 3064 refPicListModification->setRefPicSetIdxL0(i, uiCode ); 3065 } 3066 } 3067 else 3068 { 3069 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 3070 { 3071 refPicListModification->setRefPicSetIdxL0(i, 0 ); 3072 } 3073 } 3074 } 3619 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) 3620 { 3621 refPicListModification->setRefPicSetIdxL0(i, 0 ); 3622 } 3623 } 3624 } 3625 } 3626 else 3627 { 3628 refPicListModification->setRefPicListModificationFlagL0(0); 3629 } 3630 if(rpcSlice->isInterB()) 3631 { 3632 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 3633 { 3634 refPicListModification->setRefPicListModificationFlagL1( 0 ); 3075 3635 } 3076 3636 else 3077 3637 { 3078 refPicListModification->setRefPicListModificationFlagL0(0); 3079 } 3080 if(rpcSlice->isInterB()) 3081 { 3082 if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) 3083 { 3084 refPicListModification->setRefPicListModificationFlagL1( 0 ); 3638 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); 3639 } 3640 if(refPicListModification->getRefPicListModificationFlagL1()) 3641 { 3642 uiCode = 0; 3643 Int i = 0; 3644 Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList(); 3645 if ( numRpsCurrTempList1 > 1 ) 3646 { 3647 Int length = 1; 3648 numRpsCurrTempList1 --; 3649 while ( numRpsCurrTempList1 >>= 1) 3650 { 3651 length ++; 3652 } 3653 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 3654 { 3655 READ_CODE( length, uiCode, "list_entry_l1" ); 3656 refPicListModification->setRefPicSetIdxL1(i, uiCode ); 3657 } 3085 3658 } 3086 3659 else 3087 3660 { 3088 READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); 3089 } 3090 if(refPicListModification->getRefPicListModificationFlagL1()) 3091 { 3092 uiCode = 0; 3093 Int i = 0; 3094 Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList(); 3095 if ( numRpsCurrTempList1 > 1 ) 3096 { 3097 Int length = 1; 3098 numRpsCurrTempList1 --; 3099 while ( numRpsCurrTempList1 >>= 1) 3100 { 3101 length ++; 3102 } 3103 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 3104 { 3105 READ_CODE( length, uiCode, "list_entry_l1" ); 3106 refPicListModification->setRefPicSetIdxL1(i, uiCode ); 3107 } 3108 } 3109 else 3110 { 3111 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 3112 { 3113 refPicListModification->setRefPicSetIdxL1(i, 0 ); 3114 } 3115 } 3116 } 3661 for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) 3662 { 3663 refPicListModification->setRefPicSetIdxL1(i, 0 ); 3664 } 3665 } 3666 } 3667 } 3668 else 3669 { 3670 refPicListModification->setRefPicListModificationFlagL1(0); 3671 } 3672 if (rpcSlice->isInterB()) 3673 { 3674 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); 3675 } 3676 3677 rpcSlice->setCabacInitFlag( false ); // default 3678 if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) 3679 { 3680 READ_FLAG(uiCode, "cabac_init_flag"); 3681 rpcSlice->setCabacInitFlag( uiCode ? true : false ); 3682 } 3683 3684 if ( rpcSlice->getEnableTMVPFlag() ) 3685 { 3686 #if SVC_EXTENSION && REF_IDX_MFM 3687 // set motion mapping flag 3688 rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() && !rpcSlice->isIntra() ) ? true : false ); 3689 #endif 3690 if ( rpcSlice->getSliceType() == B_SLICE ) 3691 { 3692 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 3693 rpcSlice->setColFromL0Flag(uiCode); 3117 3694 } 3118 3695 else 3119 3696 { 3120 refPicListModification->setRefPicListModificationFlagL1(0); 3121 } 3122 if (rpcSlice->isInterB()) 3123 { 3124 READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); 3125 } 3126 3127 rpcSlice->setCabacInitFlag( false ); // default 3128 if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) 3129 { 3130 READ_FLAG(uiCode, "cabac_init_flag"); 3131 rpcSlice->setCabacInitFlag( uiCode ? true : false ); 3132 } 3133 3134 if ( rpcSlice->getEnableTMVPFlag() ) 3135 { 3136 #if SVC_EXTENSION && REF_IDX_MFM 3137 // set motion mapping flag 3138 rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() && !rpcSlice->isIntra() ) ? true : false ); 3139 #endif 3140 if ( rpcSlice->getSliceType() == B_SLICE ) 3141 { 3142 READ_FLAG( uiCode, "collocated_from_l0_flag" ); 3143 rpcSlice->setColFromL0Flag(uiCode); 3144 } 3145 else 3146 { 3147 rpcSlice->setColFromL0Flag( 1 ); 3148 } 3149 3150 if ( rpcSlice->getSliceType() != I_SLICE && 3151 ((rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| 3152 (rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) 3153 { 3154 READ_UVLC( uiCode, "collocated_ref_idx" ); 3155 rpcSlice->setColRefIdx(uiCode); 3156 } 3157 else 3158 { 3159 rpcSlice->setColRefIdx(0); 3160 } 3161 } 3162 if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) 3163 { 3164 xParsePredWeightTable(rpcSlice); 3165 rpcSlice->initWpScaling(); 3166 } 3167 if (!rpcSlice->isIntra()) 3168 { 3169 READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); 3170 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 3171 } 3172 3173 READ_SVLC( iCode, "slice_qp_delta" ); 3174 rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); 3697 rpcSlice->setColFromL0Flag( 1 ); 3698 } 3699 3700 if ( rpcSlice->getSliceType() != I_SLICE && 3701 ((rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| 3702 (rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) 3703 { 3704 READ_UVLC( uiCode, "collocated_ref_idx" ); 3705 rpcSlice->setColRefIdx(uiCode); 3706 } 3707 else 3708 { 3709 rpcSlice->setColRefIdx(0); 3710 } 3711 } 3712 if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) 3713 { 3714 xParsePredWeightTable(rpcSlice); 3715 rpcSlice->initWpScaling(); 3716 } 3717 if (!rpcSlice->isIntra()) 3718 { 3719 READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); 3720 rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); 3721 } 3722 3723 READ_SVLC( iCode, "slice_qp_delta" ); 3724 rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); 3175 3725 3176 3726 #if REPN_FORMAT_IN_VPS 3177 3727 #if O0194_DIFFERENT_BITDEPTH_EL_BL 3178 g_bitDepthYLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthY(); 3179 g_bitDepthCLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthC(); 3180 #endif 3181 assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() ); 3182 #else 3183 assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); 3184 #endif 3185 assert( rpcSlice->getSliceQp() <= 51 ); 3186 3187 if (rpcSlice->getPPS()->getSliceChromaQpFlag()) 3188 { 3189 READ_SVLC( iCode, "slice_qp_delta_cb" ); 3190 rpcSlice->setSliceQpDeltaCb( iCode ); 3191 assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); 3192 assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); 3193 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); 3194 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); 3195 3196 READ_SVLC( iCode, "slice_qp_delta_cr" ); 3197 rpcSlice->setSliceQpDeltaCr( iCode ); 3198 assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); 3199 assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); 3200 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); 3201 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); 3202 } 3203 3204 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 3205 { 3206 if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) 3207 { 3208 READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); 3728 g_bitDepthYLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthY(); 3729 g_bitDepthCLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthC(); 3730 #endif 3731 assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() ); 3732 #else 3733 assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); 3734 #endif 3735 assert( rpcSlice->getSliceQp() <= 51 ); 3736 3737 if (rpcSlice->getPPS()->getSliceChromaQpFlag()) 3738 { 3739 READ_SVLC( iCode, "slice_qp_delta_cb" ); 3740 rpcSlice->setSliceQpDeltaCb( iCode ); 3741 assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); 3742 assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); 3743 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); 3744 assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); 3745 3746 READ_SVLC( iCode, "slice_qp_delta_cr" ); 3747 rpcSlice->setSliceQpDeltaCr( iCode ); 3748 assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); 3749 assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); 3750 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); 3751 assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); 3752 } 3753 3754 if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) 3755 { 3756 if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) 3757 { 3758 READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); 3759 } 3760 else 3761 { 3762 rpcSlice->setDeblockingFilterOverrideFlag(0); 3763 } 3764 if(rpcSlice->getDeblockingFilterOverrideFlag()) 3765 { 3766 READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); 3767 if(!rpcSlice->getDeblockingFilterDisable()) 3768 { 3769 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 3770 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 3771 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 3772 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 3773 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 3774 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 3775 } 3776 } 3777 else 3778 { 3779 rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() ); 3780 rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); 3781 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() ); 3782 } 3783 } 3784 else 3785 { 3786 rpcSlice->setDeblockingFilterDisable ( false ); 3787 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 3788 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); 3789 } 3790 3791 Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma()); 3792 Bool isDBFEnabled = (!rpcSlice->getDeblockingFilterDisable()); 3793 3794 if(rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) 3795 { 3796 READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); 3797 } 3798 else 3799 { 3800 uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0; 3801 } 3802 rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); 3803 3804 } 3805 3806 UInt *entryPointOffset = NULL; 3807 UInt numEntryPointOffsets, offsetLenMinus1; 3808 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 3809 { 3810 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 3811 if (numEntryPointOffsets>0) 3812 { 3813 READ_UVLC(offsetLenMinus1, "offset_len_minus1"); 3814 } 3815 entryPointOffset = new UInt[numEntryPointOffsets]; 3816 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 3817 { 3818 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 3819 entryPointOffset[ idx ] = uiCode + 1; 3820 } 3821 } 3822 else 3823 { 3824 rpcSlice->setNumEntryPointOffsets ( 0 ); 3825 } 3826 3827 #if POC_RESET_IDC_SIGNALLING 3828 Int sliceHeaderExtensionLength = 0; 3829 if(pps->getSliceHeaderExtensionPresentFlag()) 3830 { 3831 READ_UVLC( uiCode, "slice_header_extension_length"); sliceHeaderExtensionLength = uiCode; 3832 } 3833 else 3834 { 3835 sliceHeaderExtensionLength = 0; 3836 #if INFERENCE_POC_MSB_VAL_PRESENT 3837 rpcSlice->setPocMsbValPresentFlag( false ); 3838 #endif 3839 } 3840 UInt startBits = m_pcBitstream->getNumBitsRead(); // Start counter of # SH Extn bits 3841 if( sliceHeaderExtensionLength > 0 ) 3842 { 3843 if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() ) 3844 { 3845 READ_CODE( 2, uiCode, "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode); 3846 #if POC_RESET_RESTRICTIONS 3847 /* The value of poc_reset_idc shall not be equal to 1 or 2 for a RASL picture, a RADL picture, 3848 a sub-layer non-reference picture, or a picture that has TemporalId greater than 0, 3849 or a picture that has discardable_flag equal to 1. */ 3850 if( rpcSlice->getPocResetIdc() == 1 || rpcSlice->getPocResetIdc() == 2 ) 3851 { 3852 assert( !rpcSlice->isRASL() ); 3853 assert( !rpcSlice->isRADL() ); 3854 assert( !rpcSlice->isSLNR() ); 3855 assert( rpcSlice->getTLayer() == 0 ); 3856 assert( rpcSlice->getDiscardableFlag() == 0 ); 3857 } 3858 3859 // The value of poc_reset_idc of a CRA or BLA picture shall be less than 3. 3860 if( rpcSlice->getPocResetIdc() == 3) 3861 { 3862 assert( ! ( rpcSlice->isCRA() || rpcSlice->isBLA() ) ); 3863 } 3864 #endif 3865 } 3866 else 3867 { 3868 rpcSlice->setPocResetIdc( 0 ); 3869 } 3870 #if Q0142_POC_LSB_NOT_PRESENT 3871 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && iPOClsb > 0 ) 3872 { 3873 assert( rpcSlice->getPocResetIdc() != 2 ); 3874 } 3875 #endif 3876 if( rpcSlice->getPocResetIdc() > 0 ) 3877 { 3878 READ_CODE(6, uiCode, "poc_reset_period_id"); rpcSlice->setPocResetPeriodId(uiCode); 3879 } 3880 else 3881 { 3882 3883 rpcSlice->setPocResetPeriodId( 0 ); 3884 } 3885 3886 if (rpcSlice->getPocResetIdc() == 3) 3887 { 3888 READ_FLAG( uiCode, "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false); 3889 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode); 3890 #if Q0142_POC_LSB_NOT_PRESENT 3891 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && rpcSlice->getFullPocResetFlag() ) 3892 { 3893 assert( rpcSlice->getPocLsbVal() == 0 ); 3894 } 3895 #endif 3896 } 3897 3898 // Derive the value of PocMsbValRequiredFlag 3899 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3900 rpcSlice->setPocMsbValRequiredFlag( (rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag()) 3901 && (!rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() || 3902 (rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() && rpcSlice->getVPS()->getNumDirectRefLayers(rpcSlice->getLayerId()) == 0)) 3903 ); 3904 #else 3905 rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag() ); 3906 #endif 3907 3908 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3909 if (!rpcSlice->getPocMsbValRequiredFlag() && rpcSlice->getVPS()->getVpsPocLsbAlignedFlag()) 3910 #else 3911 if (!rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */) 3912 #endif 3913 { 3914 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3915 READ_FLAG(uiCode, "poc_msb_cycle_val_present_flag"); rpcSlice->setPocMsbValPresentFlag(uiCode ? true : false); 3916 #else 3917 READ_FLAG(uiCode, "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag(uiCode ? true : false); 3918 #endif 3919 } 3920 else 3921 { 3922 #if POC_MSB_VAL_PRESENT_FLAG_SEM 3923 if( sliceHeaderExtensionLength == 0 ) 3924 { 3925 rpcSlice->setPocMsbValPresentFlag( false ); 3926 } 3927 else if( rpcSlice->getPocMsbValRequiredFlag() ) 3928 #else 3929 if( rpcSlice->getPocMsbValRequiredFlag() ) 3930 #endif 3931 { 3932 rpcSlice->setPocMsbValPresentFlag( true ); 3933 } 3934 else 3935 { 3936 rpcSlice->setPocMsbValPresentFlag( false ); 3937 } 3938 } 3939 3940 #if !POC_RESET_IDC_DECODER 3941 Int maxPocLsb = 1 << rpcSlice->getSPS()->getBitsForPOC(); 3942 #endif 3943 if( rpcSlice->getPocMsbValPresentFlag() ) 3944 { 3945 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3946 READ_UVLC( uiCode, "poc_msb_cycle_val"); rpcSlice->setPocMsbVal( uiCode ); 3947 #else 3948 READ_UVLC( uiCode, "poc_msb_val"); rpcSlice->setPocMsbVal( uiCode ); 3949 #endif 3950 3951 #if !POC_RESET_IDC_DECODER 3952 // Update POC of the slice based on this MSB val 3953 Int pocLsb = rpcSlice->getPOC() % maxPocLsb; 3954 rpcSlice->setPOC((rpcSlice->getPocMsbVal() * maxPocLsb) + pocLsb); 3955 } 3956 else 3957 { 3958 rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb ); 3959 #endif 3960 } 3961 3962 // Read remaining bits in the slice header extension. 3963 UInt endBits = m_pcBitstream->getNumBitsRead(); 3964 Int counter = (endBits - startBits) % 8; 3965 if( counter ) 3966 { 3967 counter = 8 - counter; 3968 } 3969 3970 while( counter ) 3971 { 3972 #if Q0146_SSH_EXT_DATA_BIT 3973 READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" ); 3974 #else 3975 READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 ); 3976 #endif 3977 counter--; 3978 } 3979 } 3980 #else 3981 if(pps->getSliceHeaderExtensionPresentFlag()) 3982 { 3983 READ_UVLC(uiCode,"slice_header_extension_length"); 3984 for(Int i=0; i<uiCode; i++) 3985 { 3986 UInt ignore; 3987 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 3988 } 3989 } 3990 #endif 3991 m_pcBitstream->readByteAlignment(); 3992 3993 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 3994 { 3995 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 3996 3997 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 3998 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 3999 { 4000 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 4001 { 4002 endOfSliceHeaderLocation++; 4003 } 4004 } 4005 4006 Int curEntryPointOffset = 0; 4007 Int prevEntryPointOffset = 0; 4008 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 4009 { 4010 curEntryPointOffset += entryPointOffset[ idx ]; 4011 4012 Int emulationPreventionByteCount = 0; 4013 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 4014 { 4015 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 4016 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 4017 { 4018 emulationPreventionByteCount++; 4019 } 4020 } 4021 4022 entryPointOffset[ idx ] -= emulationPreventionByteCount; 4023 prevEntryPointOffset = curEntryPointOffset; 4024 } 4025 4026 if ( pps->getTilesEnabledFlag() ) 4027 { 4028 rpcSlice->setTileLocationCount( numEntryPointOffsets ); 4029 4030 UInt prevPos = 0; 4031 for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) 4032 { 4033 rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); 4034 prevPos += entryPointOffset[ idx ]; 4035 } 4036 } 4037 else if ( pps->getEntropyCodingSyncEnabledFlag() ) 4038 { 4039 Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; 4040 rpcSlice->allocSubstreamSizes(numSubstreams); 4041 UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); 4042 for (Int idx=0; idx<numSubstreams-1; idx++) 4043 { 4044 if ( idx < numEntryPointOffsets ) 4045 { 4046 pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; 3209 4047 } 3210 4048 else 3211 4049 { 3212 rpcSlice->setDeblockingFilterOverrideFlag(0); 3213 } 3214 if(rpcSlice->getDeblockingFilterOverrideFlag()) 3215 { 3216 READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); 3217 if(!rpcSlice->getDeblockingFilterDisable()) 3218 { 3219 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 3220 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 3221 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 3222 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 3223 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 3224 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 3225 } 3226 } 3227 else 3228 { 3229 rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() ); 3230 rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); 3231 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() ); 3232 } 3233 } 3234 else 3235 { 3236 rpcSlice->setDeblockingFilterDisable ( false ); 3237 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); 3238 rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); 3239 } 3240 3241 Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma()); 3242 Bool isDBFEnabled = (!rpcSlice->getDeblockingFilterDisable()); 3243 3244 if(rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) 3245 { 3246 READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); 3247 } 3248 else 3249 { 3250 uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0; 3251 } 3252 rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); 3253 3254 } 3255 3256 UInt *entryPointOffset = NULL; 3257 UInt numEntryPointOffsets, offsetLenMinus1; 3258 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 3259 { 3260 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 3261 if (numEntryPointOffsets>0) 3262 { 3263 READ_UVLC(offsetLenMinus1, "offset_len_minus1"); 3264 } 3265 entryPointOffset = new UInt[numEntryPointOffsets]; 3266 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 3267 { 3268 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 3269 entryPointOffset[ idx ] = uiCode + 1; 3270 } 3271 } 3272 else 3273 { 3274 rpcSlice->setNumEntryPointOffsets ( 0 ); 3275 } 3276 3277 #if POC_RESET_IDC_SIGNALLING 3278 Int sliceHeaderExtensionLength = 0; 3279 if(pps->getSliceHeaderExtensionPresentFlag()) 3280 { 3281 READ_UVLC( uiCode, "slice_header_extension_length"); sliceHeaderExtensionLength = uiCode; 3282 } 3283 else 3284 { 3285 sliceHeaderExtensionLength = 0; 3286 } 3287 UInt startBits = m_pcBitstream->getNumBitsRead(); // Start counter of # SH Extn bits 3288 if( sliceHeaderExtensionLength > 0 ) 3289 { 3290 if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() ) 3291 { 3292 READ_CODE( 2, uiCode, "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode); 3293 } 3294 else 3295 { 3296 rpcSlice->setPocResetIdc( 0 ); 3297 } 3298 #if Q0142_POC_LSB_NOT_PRESENT 3299 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && iPOClsb > 0 ) 3300 { 3301 assert( rpcSlice->getPocResetIdc() != 2 ); 3302 } 3303 #endif 3304 if( rpcSlice->getPocResetIdc() > 0 ) 3305 { 3306 READ_CODE(6, uiCode, "poc_reset_period_id"); rpcSlice->setPocResetPeriodId(uiCode); 3307 } 3308 else 3309 { 3310 3311 rpcSlice->setPocResetPeriodId( 0 ); 3312 } 3313 3314 if (rpcSlice->getPocResetIdc() == 3) 3315 { 3316 READ_FLAG( uiCode, "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false); 3317 READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode); 3318 #if Q0142_POC_LSB_NOT_PRESENT 3319 if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && rpcSlice->getFullPocResetFlag() ) 3320 { 3321 assert( rpcSlice->getPocLsbVal() == 0 ); 3322 } 3323 #endif 3324 } 3325 3326 // Derive the value of PocMsbValRequiredFlag 3327 rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag() 3328 /* || related to vps_poc_lsb_aligned_flag */ 3329 ); 3330 3331 if( !rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */ ) 3332 { 3333 READ_FLAG( uiCode, "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag( uiCode ? true : false ); 3334 } 3335 else 3336 { 3337 #if POC_MSB_VAL_PRESENT_FLAG_SEM 3338 if( sliceHeaderExtensionLength == 0 ) 3339 { 3340 rpcSlice->setPocMsbValPresentFlag( false ); 3341 } 3342 else if( rpcSlice->getPocMsbValRequiredFlag() ) 3343 #else 3344 if( rpcSlice->getPocMsbValRequiredFlag() ) 3345 #endif 3346 { 3347 rpcSlice->setPocMsbValPresentFlag( true ); 3348 } 3349 else 3350 { 3351 rpcSlice->setPocMsbValPresentFlag( false ); 3352 } 3353 } 3354 3355 #if !POC_RESET_IDC_DECODER 3356 Int maxPocLsb = 1 << rpcSlice->getSPS()->getBitsForPOC(); 3357 #endif 3358 if( rpcSlice->getPocMsbValPresentFlag() ) 3359 { 3360 READ_UVLC( uiCode, "poc_msb_val"); rpcSlice->setPocMsbVal( uiCode ); 3361 3362 #if !POC_RESET_IDC_DECODER 3363 // Update POC of the slice based on this MSB val 3364 Int pocLsb = rpcSlice->getPOC() % maxPocLsb; 3365 rpcSlice->setPOC((rpcSlice->getPocMsbVal() * maxPocLsb) + pocLsb); 3366 } 3367 else 3368 { 3369 rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb ); 3370 #endif 3371 } 3372 3373 // Read remaining bits in the slice header extension. 3374 UInt endBits = m_pcBitstream->getNumBitsRead(); 3375 Int counter = (endBits - startBits) % 8; 3376 if( counter ) 3377 { 3378 counter = 8 - counter; 3379 } 3380 3381 while( counter ) 3382 { 3383 #if Q0146_SSH_EXT_DATA_BIT 3384 READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" ); 3385 #else 3386 READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 ); 3387 #endif 3388 counter--; 3389 } 3390 } 3391 #else 3392 if(pps->getSliceHeaderExtensionPresentFlag()) 3393 { 3394 READ_UVLC(uiCode,"slice_header_extension_length"); 3395 for(Int i=0; i<uiCode; i++) 3396 { 3397 UInt ignore; 3398 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 3399 } 3400 } 3401 #endif 3402 m_pcBitstream->readByteAlignment(); 3403 3404 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 3405 { 3406 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 3407 3408 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 3409 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 3410 { 3411 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 3412 { 3413 endOfSliceHeaderLocation++; 3414 } 3415 } 3416 3417 Int curEntryPointOffset = 0; 3418 Int prevEntryPointOffset = 0; 3419 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 3420 { 3421 curEntryPointOffset += entryPointOffset[ idx ]; 3422 3423 Int emulationPreventionByteCount = 0; 3424 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 3425 { 3426 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 3427 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 3428 { 3429 emulationPreventionByteCount++; 3430 } 3431 } 3432 3433 entryPointOffset[ idx ] -= emulationPreventionByteCount; 3434 prevEntryPointOffset = curEntryPointOffset; 3435 } 3436 3437 if ( pps->getTilesEnabledFlag() ) 3438 { 3439 rpcSlice->setTileLocationCount( numEntryPointOffsets ); 3440 3441 UInt prevPos = 0; 3442 for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) 3443 { 3444 rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); 3445 prevPos += entryPointOffset[ idx ]; 3446 } 3447 } 3448 else if ( pps->getEntropyCodingSyncEnabledFlag() ) 3449 { 3450 Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; 3451 rpcSlice->allocSubstreamSizes(numSubstreams); 3452 UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); 3453 for (Int idx=0; idx<numSubstreams-1; idx++) 3454 { 3455 if ( idx < numEntryPointOffsets ) 3456 { 3457 pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; 3458 } 3459 else 3460 { 3461 pSubstreamSizes[ idx ] = 0; 3462 } 3463 } 3464 } 3465 3466 if (entryPointOffset) 3467 { 3468 delete [] entryPointOffset; 3469 } 3470 } 3471 3472 return; 4050 pSubstreamSizes[ idx ] = 0; 4051 } 4052 } 4053 } 4054 4055 if (entryPointOffset) 4056 { 4057 delete [] entryPointOffset; 4058 } 4059 } 4060 4061 return; 3473 4062 } 3474 4063 … … 3733 4322 { 3734 4323 #endif 3735 wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma;3736 wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma;4324 wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma; 4325 wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma; 3737 4326 #if AUXILIARY_PICTURES 3738 4327 } … … 3913 4502 Void TDecCavlc::xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) 3914 4503 { 4504 #if R0150_CGS_SIGNAL_CONSTRAINTS 4505 UInt uiNumRefLayersM1; 4506 READ_UVLC( uiNumRefLayersM1 , "num_cm_ref_layers_minus1" ); 4507 assert( uiNumRefLayersM1 <= 61 ); 4508 for( UInt i = 0 ; i <= uiNumRefLayersM1 ; i++ ) 4509 { 4510 UInt uiRefLayerId; 4511 READ_CODE( 6 , uiRefLayerId , "cm_ref_layer_id" ); 4512 pc3DAsymLUT->addRefLayerId( uiRefLayerId ); 4513 } 4514 #endif 3915 4515 UInt uiCurOctantDepth , uiCurPartNumLog2 , uiInputBitDepthM8 , uiOutputBitDepthM8 , uiResQaunBit; 4516 #if R0300_CGS_RES_COEFF_CODING 4517 UInt uiDeltaBits; 4518 #endif 3916 4519 READ_CODE( 2 , uiCurOctantDepth , "cm_octant_depth" ); 3917 4520 READ_CODE( 2 , uiCurPartNumLog2 , "cm_y_part_num_log2" ); 4521 #if R0150_CGS_SIGNAL_CONSTRAINTS 4522 UInt uiChromaInputBitDepthM8 , uiChromaOutputBitDepthM8; 4523 READ_UVLC( uiInputBitDepthM8 , "cm_input_luma_bit_depth_minus8" ); 4524 READ_UVLC( uiChromaInputBitDepthM8 , "cm_input_chroma_bit_depth_minus8" ); 4525 READ_UVLC( uiOutputBitDepthM8 , "cm_output_luma_bit_depth_minus8" ); 4526 READ_UVLC( uiChromaOutputBitDepthM8 , "cm_output_chroma_bit_depth_minus8" ); 4527 #else 3918 4528 READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_bit_depth_minus8" ); 3919 4529 Int iInputBitDepthCDelta; … … 3922 4532 Int iOutputBitDepthCDelta; 3923 4533 READ_SVLC(iOutputBitDepthCDelta, "cm_output_bit_depth_chroma_delta"); 4534 #endif 3924 4535 READ_CODE( 2 , uiResQaunBit , "cm_res_quant_bit" ); 4536 #if R0300_CGS_RES_COEFF_CODING 4537 READ_CODE( 2 , uiDeltaBits , "cm_flc_bits" ); 4538 pc3DAsymLUT->setDeltaBits(uiDeltaBits + 1); 4539 #endif 4540 4541 #if R0151_CGS_3D_ASYMLUT_IMPROVE 4542 #if R0150_CGS_SIGNAL_CONSTRAINTS 4543 Int nAdaptCThresholdU = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); 4544 Int nAdaptCThresholdV = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); 4545 #else 4546 Int nAdaptCThresholdU = 1 << ( uiInputBitDepthM8 + 8 + iInputBitDepthCDelta - 1 ); 4547 Int nAdaptCThresholdV = 1 << ( uiInputBitDepthM8 + 8 + iInputBitDepthCDelta - 1 ); 4548 #endif 4549 if( uiCurOctantDepth == 1 ) 4550 { 4551 Int delta = 0; 4552 READ_SVLC( delta , "cm_adapt_threshold_u_delta" ); 4553 nAdaptCThresholdU += delta; 4554 READ_SVLC( delta , "cm_adapt_threshold_v_delta" ); 4555 nAdaptCThresholdV += delta; 4556 } 4557 #endif 3925 4558 pc3DAsymLUT->destroy(); 3926 pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 , uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, uiOutputBitDepthM8 + 8 , uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta ,uiCurPartNumLog2 ); 4559 pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 , 4560 #if R0150_CGS_SIGNAL_CONSTRAINTS 4561 uiChromaInputBitDepthM8 + 8 , 4562 #else 4563 uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, 4564 #endif 4565 uiOutputBitDepthM8 + 8 , 4566 #if R0150_CGS_SIGNAL_CONSTRAINTS 4567 uiChromaOutputBitDepthM8 + 8 , 4568 #else 4569 uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta , 4570 #endif 4571 uiCurPartNumLog2 4572 #if R0151_CGS_3D_ASYMLUT_IMPROVE 4573 , nAdaptCThresholdU , nAdaptCThresholdV 4574 #endif 4575 ); 3927 4576 pc3DAsymLUT->setResQuantBit( uiResQaunBit ); 3928 4577 4578 #if R0164_CGS_LUT_BUGFIX_CHECK 4579 pc3DAsymLUT->xInitCuboids(); 4580 #endif 3929 4581 xParse3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); 4582 #if R0164_CGS_LUT_BUGFIX 4583 #if R0164_CGS_LUT_BUGFIX_CHECK 4584 printf("============= Before 'xCuboidsFilledCheck()': ================\n"); 4585 pc3DAsymLUT->display(); 4586 pc3DAsymLUT->xCuboidsFilledCheck( false ); 4587 printf("============= After 'xCuboidsFilledCheck()': =================\n"); 4588 pc3DAsymLUT->display(); 4589 #endif 4590 #endif 3930 4591 } 3931 4592 … … 3952 4613 else 3953 4614 { 4615 #if R0300_CGS_RES_COEFF_CODING 4616 Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-pc3DAsymLUT->getDeltaBits() ; 4617 nFLCbits = nFLCbits >= 0 ? nFLCbits:0; 4618 #endif 3954 4619 for( Int l = 0 ; l < nYPartNum ; l++ ) 3955 4620 { 4621 #if R0164_CGS_LUT_BUGFIX 4622 Int shift = pc3DAsymLUT->getCurOctantDepth() - nDepth ; 4623 #endif 3956 4624 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 3957 4625 { … … 3961 4629 if( uiCodeVertex ) 3962 4630 { 4631 #if R0151_CGS_3D_ASYMLUT_IMPROVE 4632 #if R0300_CGS_RES_COEFF_CODING 4633 xReadParam( deltaY, nFLCbits ); 4634 xReadParam( deltaU, nFLCbits ); 4635 xReadParam( deltaV, nFLCbits ); 4636 #else 4637 xReadParam( deltaY ); 4638 xReadParam( deltaU ); 4639 xReadParam( deltaV ); 4640 #endif 4641 #else 3963 4642 READ_SVLC( deltaY , "resY" ); 3964 4643 READ_SVLC( deltaU , "resU" ); 3965 4644 READ_SVLC( deltaV , "resV" ); 3966 } 4645 #endif 4646 } 4647 #if R0164_CGS_LUT_BUGFIX 4648 pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); 4649 for (Int m = 1; m < (1<<shift); m++) { 4650 pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) + m , uIdx , vIdx , nVertexIdx , 0 , 0 , 0 ); 4651 #if R0164_CGS_LUT_BUGFIX_CHECK 4652 pc3DAsymLUT->xSetFilled( yIdx + (l<<shift) + m , uIdx , vIdx ); 4653 #endif 4654 } 4655 #else 3967 4656 pc3DAsymLUT->setCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); 3968 } 3969 } 3970 } 3971 } 4657 #endif 4658 } 4659 #if R0164_CGS_LUT_BUGFIX_CHECK 4660 pc3DAsymLUT->xSetExplicit( yIdx + (l<<shift) , uIdx , vIdx ); 4661 #endif 4662 } 4663 #if R0164_CGS_LUT_BUGFIX 4664 for ( Int u=0 ; u<nLength ; u++ ) { 4665 for ( Int v=0 ; v<nLength ; v++ ) { 4666 if ( u!=0 || v!=0 ) { 4667 for ( Int y=0 ; y<nLength*nYPartNum ; y++ ) { 4668 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 4669 { 4670 pc3DAsymLUT->setCuboidVertexResTree( yIdx + y , uIdx + u , vIdx + v , nVertexIdx , 0 , 0 , 0 ); 4671 #if R0164_CGS_LUT_BUGFIX_CHECK 4672 pc3DAsymLUT->xSetFilled( yIdx + y , uIdx + u , vIdx + v ); 4673 #endif 4674 } 4675 } 4676 } 4677 } 4678 } 4679 #endif 4680 } 4681 } 4682 4683 #if R0151_CGS_3D_ASYMLUT_IMPROVE 4684 #if R0300_CGS_RES_COEFF_CODING 4685 Void TDecCavlc::xReadParam( Int& param, Int rParam ) 4686 #else 4687 Void TDecCavlc::xReadParam( Int& param ) 4688 #endif 4689 { 4690 #if !R0300_CGS_RES_COEFF_CODING 4691 const UInt rParam = 7; 4692 #endif 4693 UInt prefix; 4694 UInt codeWord ; 4695 UInt rSymbol; 4696 UInt sign; 4697 4698 READ_UVLC( prefix, "quotient") ; 4699 READ_CODE (rParam, codeWord, "remainder"); 4700 rSymbol = (prefix<<rParam) + codeWord; 4701 4702 if(rSymbol) 4703 { 4704 READ_FLAG(sign, "sign"); 4705 param = sign ? -(Int)(rSymbol) : (Int)(rSymbol); 4706 } 4707 else param = 0; 4708 } 4709 #endif 4710 #if VPS_VUI_BSP_HRD_PARAMS 4711 Void TDecCavlc::parseVpsVuiBspHrdParams( TComVPS *vps ) 4712 { 4713 UInt uiCode; 4714 assert (vps->getTimingInfo()->getTimingInfoPresentFlag() == 1); 4715 READ_UVLC( uiCode, "vps_num_add_hrd_params" ); vps->setVpsNumAddHrdParams(uiCode); 4716 vps->createBspHrdParamBuffer(vps->getVpsNumAddHrdParams()); // Also allocates m_cprmsAddPresentFlag and m_numSubLayerHrdMinus 4717 4718 for( Int i = vps->getNumHrdParameters(), j = 0; i < vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams(); i++, j++ ) // j = i - vps->getNumHrdParameters() 4719 { 4720 if( i > 0 ) 4721 { 4722 READ_FLAG( uiCode, "cprms_add_present_flag[i]" ); vps->setCprmsAddPresentFlag(j, uiCode ? true : false); 4723 } 4724 else 4725 { 4726 // i == 0 4727 if( vps->getNumHrdParameters() == 0 ) 4728 { 4729 vps->setCprmsAddPresentFlag(0, true); 4730 } 4731 } 4732 READ_UVLC( uiCode, "num_sub_layer_hrd_minus1[i]" ); vps->setNumSubLayerHrdMinus1(j, uiCode ); 4733 assert( uiCode <= vps->getMaxTLayers() - 1 ); 4734 4735 parseHrdParameters( vps->getBspHrd(j), vps->getCprmsAddPresentFlag(j), vps->getNumSubLayerHrdMinus1(j) ); 4736 if( i > 0 && !vps->getCprmsAddPresentFlag(i) ) 4737 { 4738 // Copy common information parameters 4739 if( i == vps->getNumHrdParameters() ) 4740 { 4741 vps->getBspHrd(j)->copyCommonInformation( vps->getHrdParameters( vps->getNumHrdParameters() - 1 ) ); 4742 } 4743 else 4744 { 4745 vps->getBspHrd(j)->copyCommonInformation( vps->getBspHrd( j - 1 ) ); 4746 } 4747 } 4748 } 4749 for (Int h = 1; h < vps->getNumOutputLayerSets(); h++) 4750 { 4751 Int lsIdx = vps->getOutputLayerSetIdx( h ); 4752 READ_UVLC( uiCode, "num_signalled_partitioning_schemes[h]"); vps->setNumSignalledPartitioningSchemes(h, uiCode); 4753 for( Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++ ) 4754 { 4755 READ_UVLC( uiCode, "num_partitions_in_scheme_minus1[h][j]" ); vps->setNumPartitionsInSchemeMinus1(h, j, uiCode); 4756 for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++ ) 4757 { 4758 for( Int r = 0; r < vps->getNumLayersInIdList( lsIdx ); r++ ) 4759 { 4760 READ_FLAG( uiCode, "layer_included_in_partition_flag[h][j][k][r]" ); vps->setLayerIncludedInPartitionFlag(h, j, k, r, uiCode ? true : false); 4761 } 4762 } 4763 } 4764 for( Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++ ) 4765 { 4766 for( Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++ ) 4767 { 4768 READ_UVLC( uiCode, "num_bsp_schedules_minus1[h][i][t]"); vps->setNumBspSchedulesMinus1(h, i, t, uiCode); 4769 for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ ) 4770 { 4771 for( Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++ ) 4772 { 4773 READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]"); vps->setBspHrdIdx(h, i, t, j, k, uiCode); 4774 READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][t][j][k]"); vps->setBspSchedIdx(h, i, t, j, k, uiCode); 4775 } 4776 } 4777 } 4778 } 4779 4780 // To be done: Check each layer included in not more than one BSP in every partitioning scheme, 4781 // and other related checks associated with layers in bitstream partitions. 4782 4783 } 4784 } 4785 #endif 3972 4786 #endif 3973 4787 //! \} -
trunk/source/Lib/TLibDecoder/TDecCAVLC.h
r815 r906 86 86 Void parseVpsDpbSizeTable( TComVPS *vps ); 87 87 #endif 88 #if VPS_VUI_BSP_HRD_PARAMS 89 Void parseVpsVuiBspHrdParams( TComVPS *vps ); 90 #endif 88 91 #if SPS_DPB_PARAMS 89 92 Void parseSPS ( TComSPS* pcSPS ); // it should be removed after macro clean up … … 143 146 Void xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 144 147 Void xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 148 #if R0151_CGS_3D_ASYMLUT_IMPROVE 149 #if R0300_CGS_RES_COEFF_CODING 150 Void xReadParam( Int& param, Int flc_bits ); 151 #else 152 Void xReadParam( Int& param ); 153 #endif 154 #endif 145 155 #endif 146 156 }; -
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r713 r906 54 54 //! \{ 55 55 static void calcAndPrintHashStatus(TComPicYuv& pic, const SEIDecodedPictureHash* pictureHashSEI); 56 #if Q0074_COLOUR_REMAPPING_SEI 57 static Void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* colourRemappingInfoSEI, UInt layerId=0 ); 58 static std::vector<SEIColourRemappingInfo> storeCriSEI; //Persistent Colour Remapping Information SEI 59 #endif 56 60 // ==================================================================================================================== 57 61 // Constructor / destructor / initialization / destroy … … 218 222 if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR( m_layerId ) ) 219 223 { 220 printf( "%d(%d)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() ); 224 UInt refLayerId = pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId(); 225 UInt refLayerIdc = pcSlice->getReferenceLayerIdc(refLayerId); 226 assert( g_posScalingFactor[refLayerIdc][0] ); 227 assert( g_posScalingFactor[refLayerIdc][1] ); 228 229 printf( "%d(%d, {%1.2f, %1.2f}x)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), refLayerId, 65536.0/g_posScalingFactor[refLayerIdc][0], 65536.0/g_posScalingFactor[refLayerIdc][1] ); 221 230 } 222 231 else … … 247 256 calcAndPrintHashStatus(*rpcPic->getPicYuvRec(), hash); 248 257 } 258 #if Q0074_COLOUR_REMAPPING_SEI 259 if (m_colourRemapSEIEnabled) 260 { 261 SEIMessages colourRemappingInfo = getSeisByType(rpcPic->getSEIs(), SEI::COLOUR_REMAPPING_INFO ); 262 const SEIColourRemappingInfo *seiColourRemappingInfo = ( colourRemappingInfo.size() > 0 ) ? (SEIColourRemappingInfo*) *(colourRemappingInfo.begin()) : NULL; 263 if (colourRemappingInfo.size() > 1) 264 { 265 printf ("Warning: Got multiple Colour Remapping Information SEI messages. Using first."); 266 } 267 applyColourRemapping(*rpcPic->getPicYuvRec(), seiColourRemappingInfo 268 #if SVC_EXTENSION 269 , rpcPic->getLayerId() 270 #endif 271 ); 272 } 273 #endif 249 274 250 275 #if SETTING_PIC_OUTPUT_MARK … … 334 359 } 335 360 } 361 362 #if Q0074_COLOUR_REMAPPING_SEI 363 Void xInitColourRemappingLut( const Int bitDepthY, const Int bitDepthC, std::vector<Int>(&preLut)[3], std::vector<Int>(&postLut)[3], const SEIColourRemappingInfo* const pCriSEI ) 364 { 365 for ( Int c=0 ; c<3 ; c++ ) 366 { 367 Int bitDepth = c ? bitDepthC : bitDepthY ; 368 preLut[c].resize(1 << bitDepth); 369 postLut[c].resize(1 << pCriSEI->m_colourRemapBitDepth); 370 371 Int bitDepthDiff = pCriSEI->m_colourRemapBitDepth - bitDepth; 372 Int iShift1 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from bitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= bitdepth) 373 if( bitDepthDiff<0 ) 374 printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <bitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, bitDepth); 375 bitDepthDiff = pCriSEI->m_colourRemapBitDepth - pCriSEI->m_colourRemapInputBitDepth; 376 Int iShift2 = (bitDepthDiff>0) ? bitDepthDiff : 0; //bit scale from ColourRemapInputBitdepth to ColourRemapBitdepth (manage only case colourRemapBitDepth>= colourRemapInputBitDepth) 377 if( bitDepthDiff<0 ) 378 printf ("Warning: CRI SEI - colourRemapBitDepth (%d) <colourRemapInputBitDepth (%d) - case not handled\n", pCriSEI->m_colourRemapBitDepth, pCriSEI->m_colourRemapInputBitDepth); 379 380 //Fill preLut 381 for ( Int k=0 ; k<(1<<bitDepth) ; k++ ) 382 { 383 Int iSample = k << iShift1 ; 384 for ( Int iPivot=0 ; iPivot<=pCriSEI->m_preLutNumValMinus1[c] ; iPivot++ ) 385 { 386 Int iCodedPrev = pCriSEI->m_preLutCodedValue[c][iPivot] << iShift2; //Coded in CRInputBitdepth 387 Int iCodedNext = pCriSEI->m_preLutCodedValue[c][iPivot+1] << iShift2; //Coded in CRInputBitdepth 388 Int iTargetPrev = pCriSEI->m_preLutTargetValue[c][iPivot]; //Coded in CRBitdepth 389 Int iTargetNext = pCriSEI->m_preLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth 390 if ( iCodedPrev <= iSample && iSample <= iCodedNext ) 391 { 392 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev); 393 preLut[c][k] = (Int)( 0.5f + fInterpol ); 394 iPivot = pCriSEI->m_preLutNumValMinus1[c] + 1; 395 } 396 } 397 } 398 399 //Fill postLut 400 for ( Int k=0 ; k<(1<<pCriSEI->m_colourRemapBitDepth) ; k++ ) 401 { 402 Int iSample = k; 403 for ( Int iPivot=0 ; iPivot<=pCriSEI->m_postLutNumValMinus1[c] ; iPivot++ ) 404 { 405 Int iCodedPrev = pCriSEI->m_postLutCodedValue[c][iPivot]; //Coded in CRBitdepth 406 Int iCodedNext = pCriSEI->m_postLutCodedValue[c][iPivot+1]; //Coded in CRBitdepth 407 Int iTargetPrev = pCriSEI->m_postLutTargetValue[c][iPivot]; //Coded in CRBitdepth 408 Int iTargetNext = pCriSEI->m_postLutTargetValue[c][iPivot+1]; //Coded in CRBitdepth 409 if ( iCodedPrev <= iSample && iSample <= iCodedNext ) 410 { 411 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) * 1.f / (Float)(iCodedNext - iCodedPrev) ; 412 postLut[c][k] = (Int)( 0.5f + fInterpol ); 413 iPivot = pCriSEI->m_postLutNumValMinus1[c] + 1; 414 } 415 } 416 } 417 } 418 } 419 420 static void applyColourRemapping(TComPicYuv& pic, const SEIColourRemappingInfo* pCriSEI, UInt layerId ) 421 { 422 if( !storeCriSEI.size() ) 423 #if SVC_EXTENSION 424 storeCriSEI.resize(MAX_LAYERS); 425 #else 426 storeCriSEI.resize(1); 427 #endif 428 429 if ( pCriSEI ) //if a CRI SEI has just been retrieved, keep it in memory (persistence management) 430 storeCriSEI[layerId] = *pCriSEI; 431 432 if( !storeCriSEI[layerId].m_colourRemapCancelFlag ) 433 { 434 Int iHeight = pic.getHeight(); 435 Int iWidth = pic.getWidth(); 436 Int iStride = pic.getStride(); 437 Int iCStride = pic.getCStride(); 438 439 Pel *YUVIn[3], *YUVOut[3]; 440 YUVIn[0] = pic.getLumaAddr(); 441 YUVIn[1] = pic.getCbAddr(); 442 YUVIn[2] = pic.getCrAddr(); 443 444 TComPicYuv picColourRemapped; 445 #if SVC_EXTENSION 446 #if AUXILIARY_PICTURES 447 picColourRemapped.create( pic.getWidth(), pic.getHeight(), pic.getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 448 #else 449 picColourRemapped.create( pic.getWidth(), pic.getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL ); 450 #endif 451 #else 452 picColourRemapped.create( pic.getWidth(), pic.getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); 453 #endif 454 YUVOut[0] = picColourRemapped.getLumaAddr(); 455 YUVOut[1] = picColourRemapped.getCbAddr(); 456 YUVOut[2] = picColourRemapped.getCrAddr(); 457 458 #if SVC_EXTENSION 459 Int bitDepthY = g_bitDepthYLayer[layerId]; 460 Int bitDepthC = g_bitDepthCLayer[layerId]; 461 462 assert( g_bitDepthY == bitDepthY ); 463 assert( g_bitDepthC == bitDepthC ); 464 #else 465 Int bitDepthY = g_bitDepthY; 466 Int bitDepthC = g_bitDepthC; 467 #endif 468 469 std::vector<Int> preLut[3]; 470 std::vector<Int> postLut[3]; 471 xInitColourRemappingLut( bitDepthY, bitDepthC, preLut, postLut, &storeCriSEI[layerId] ); 472 473 Int roundingOffset = (storeCriSEI[layerId].m_log2MatrixDenom==0) ? 0 : (1 << (storeCriSEI[layerId].m_log2MatrixDenom - 1)); 474 475 for( Int y = 0; y < iHeight ; y++ ) 476 { 477 for( Int x = 0; x < iWidth ; x++ ) 478 { 479 Int YUVPre[3], YUVMat[3]; 480 YUVPre[0] = preLut[0][ YUVIn[0][x] ]; 481 YUVPre[1] = preLut[1][ YUVIn[1][x>>1] ]; 482 YUVPre[2] = preLut[2][ YUVIn[2][x>>1] ]; 483 484 YUVMat[0] = ( storeCriSEI[layerId].m_colourRemapCoeffs[0][0]*YUVPre[0] 485 + storeCriSEI[layerId].m_colourRemapCoeffs[0][1]*YUVPre[1] 486 + storeCriSEI[layerId].m_colourRemapCoeffs[0][2]*YUVPre[2] 487 + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom ); 488 YUVMat[0] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[0] ); 489 YUVOut[0][x] = postLut[0][ YUVMat[0] ]; 490 491 if( (y&1) && (x&1) ) 492 { 493 for(Int c=1 ; c<3 ; c++) 494 { 495 YUVMat[c] = ( storeCriSEI[layerId].m_colourRemapCoeffs[c][0]*YUVPre[0] 496 + storeCriSEI[layerId].m_colourRemapCoeffs[c][1]*YUVPre[1] 497 + storeCriSEI[layerId].m_colourRemapCoeffs[c][2]*YUVPre[2] 498 + roundingOffset ) >> ( storeCriSEI[layerId].m_log2MatrixDenom ); 499 YUVMat[c] = Clip3( 0, (1<<storeCriSEI[layerId].m_colourRemapBitDepth)-1, YUVMat[c] ); 500 YUVOut[c][x>>1] = postLut[c][ YUVMat[c] ]; 501 } 502 } 503 } 504 YUVIn[0] += iStride; 505 YUVOut[0] += iStride; 506 if( y&1 ) 507 { 508 YUVIn[1] += iCStride; 509 YUVIn[2] += iCStride; 510 YUVOut[1] += iCStride; 511 YUVOut[2] += iCStride; 512 } 513 } 514 515 //Write remapped picture in decoding order 516 Char cTemp[255]; 517 sprintf(cTemp, "seiColourRemappedPic_L%d_%dx%d_%dbits.yuv", layerId, iWidth, iHeight, storeCriSEI[layerId].m_colourRemapBitDepth ); 518 picColourRemapped.dump( cTemp, true, storeCriSEI[layerId].m_colourRemapBitDepth ); 519 520 picColourRemapped.destroy(); 521 522 storeCriSEI[layerId].m_colourRemapCancelFlag = !storeCriSEI[layerId].m_colourRemapPersistenceFlag; //Handling persistence 523 } 524 } 525 #endif 336 526 //! \} -
trunk/source/Lib/TLibDecoder/TDecGop.h
r595 r906 82 82 Double m_dDecTime; 83 83 Int m_decodedPictureHashSEIEnabled; ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message 84 84 #if Q0074_COLOUR_REMAPPING_SEI 85 Bool m_colourRemapSEIEnabled; ///< Enable/disable Colour Remapping Information SEI message acting on decoded pictures 86 #endif 85 87 #if SVC_EXTENSION 86 88 UInt m_layerId; … … 114 116 115 117 void setDecodedPictureHashSEIEnabled(Int enabled) { m_decodedPictureHashSEIEnabled = enabled; } 118 #if Q0074_COLOUR_REMAPPING_SEI 119 void setColourRemappingInfoSEIEnabled(Int enabled) { m_colourRemapSEIEnabled = enabled; } 120 #endif 116 121 #if SVC_EXTENSION 117 122 TDecTop* getLayerDec(UInt LayerId) { return m_ppcTDecTop[LayerId]; } -
trunk/source/Lib/TLibDecoder/TDecSlice.cpp
r644 r906 42 42 43 43 #if SVC_EXTENSION 44 ParameterSetMap<TComVPS> ParameterSetManagerDecoder::m_vpsBuffer(MAX_NUM_VPS); 44 ParameterSetMap<TComVPS> ParameterSetManagerDecoder::m_vpsBuffer(MAX_NUM_VPS); 45 ParameterSetMap<TComSPS> ParameterSetManagerDecoder::m_spsBuffer(MAX_NUM_SPS); 46 ParameterSetMap<TComPPS> ParameterSetManagerDecoder::m_ppsBuffer(MAX_NUM_PPS); 45 47 #endif 46 48 … … 144 146 UInt uiTilesAcross = rpcPic->getPicSym()->getNumColumnsMinus1()+1; 145 147 TComSlice* pcSlice = rpcPic->getSlice(rpcPic->getCurrSliceIdx()); 148 #if !WPP_FIX 146 149 Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 150 #endif 147 151 148 152 // delete decoders if already allocated in previous slice … … 191 195 UInt uiWidthInLCUs = rpcPic->getPicSym()->getFrameWidthInCU(); 192 196 //UInt uiHeightInLCUs = rpcPic->getPicSym()->getFrameHeightInCU(); 197 198 #if WPP_FIX 199 UInt uiTileCol; 200 UInt uiTileLCUX; 201 const Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag(); 202 const UInt startTileIdx=rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr); 203 TComTile *pCurrentTile=rpcPic->getPicSym()->getTComTile(startTileIdx); 204 UInt uiTileStartLCU = pCurrentTile->getFirstCUAddr(); // Code tidy 205 206 // The first LCU of the slice is the first coded substream, but the global substream number, as calculated by getSubstreamForLCUAddr may be higher. 207 // This calculates the common offset for all substreams in this slice. 208 const UInt subStreamOffset=rpcPic->getSubstreamForLCUAddr(iStartCUAddr, true, pcSlice); 209 #else 193 210 UInt uiCol=0, uiLin=0, uiSubStrm=0; 194 211 … … 199 216 Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag(); 200 217 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr(); 218 #endif 201 219 if( depSliceSegmentsEnabled ) 202 220 { 221 #if WPP_FIX 222 if( (!rpcPic->getSlice(rpcPic->getCurrSliceIdx())->isNextSlice()) && iStartCUAddr != uiTileStartLCU) // Code tidy // Is this a dependent slice segment and not the start of a tile? 223 #else 203 224 if( (!rpcPic->getSlice(rpcPic->getCurrSliceIdx())->isNextSlice()) && 204 225 iStartCUAddr != rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr()) 226 #endif 205 227 { 206 228 if(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) 207 229 { 230 #if WPP_FIX 231 uiTileCol = startTileIdx % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // Code tidy 232 #else 208 233 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 234 #endif 209 235 m_pcBufferSbacDecoders[uiTileCol].loadContexts( CTXMem[1] );//2.LCU 236 #if WPP_FIX 237 if ( pCurrentTile->getTileWidth() < 2) 238 { 239 CTXMem[0]->loadContexts(pcSbacDecoder); // If tile width is less than 2, need to ensure CTX states get initialised to un-adapted CABAC. Set here, to load a few lines later (!) 240 } 241 #else 210 242 if ( (iStartCUAddr%uiWidthInLCUs+1) >= uiWidthInLCUs ) 211 243 { … … 217 249 } 218 250 } 251 #endif 219 252 } 220 253 pcSbacDecoder->loadContexts(CTXMem[0] ); //end of depSlice-1 254 #if WPP_FIX 255 pcSbacDecoders[0].loadContexts(pcSbacDecoder); // The first substream used for the slice will always be 0. (The original code was equivalent) 256 #else 221 257 pcSbacDecoders[uiSubStrm].loadContexts(pcSbacDecoder); 258 #endif 222 259 } 223 260 else … … 237 274 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr(); 238 275 uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; 276 #if WPP_FIX 277 UInt uiCol = iCUAddr % uiWidthInLCUs; 278 UInt uiSubStrm=rpcPic->getSubstreamForLCUAddr(iCUAddr, true, pcSlice)-subStreamOffset; 279 #else 239 280 uiCol = iCUAddr % uiWidthInLCUs; 240 281 // The 'line' is now relative to the 1st line in the slice, not the 1st line in the picture. 241 282 uiLin = (iCUAddr/uiWidthInLCUs)-(iStartCUAddr/uiWidthInLCUs); 283 #endif 242 284 // inherit from TR if necessary, select substream to use. 243 285 if( (pcSlice->getPPS()->getNumSubstreams() > 1) || ( depSliceSegmentsEnabled && (uiCol == uiTileLCUX)&&(pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) )) 244 286 { 287 #if !WPP_FIX 245 288 // independent tiles => substreams are "per tile". iNumSubstreams has already been multiplied. 246 289 iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 247 290 uiSubStrm = rpcPic->getPicSym()->getTileIdxMap(iCUAddr)*iNumSubstreamsPerTile 248 291 + uiLin%iNumSubstreamsPerTile; 292 #endif 249 293 m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiSubStrm] ); 250 294 // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line. … … 278 322 pcSbacDecoder->load(&pcSbacDecoders[uiSubStrm]); //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders) 279 323 } 324 #if !WPP_FIX 280 325 else if ( pcSlice->getPPS()->getNumSubstreams() <= 1 ) 281 326 { … … 283 328 iNumSubstreamsPerTile = 1; 284 329 } 330 #endif 285 331 286 332 if ( (iCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr()) && // 1st in tile. … … 397 443 398 444 ParameterSetManagerDecoder::ParameterSetManagerDecoder() 399 #if SVC_EXTENSION 400 : m_spsBuffer(MAX_NUM_SPS) 401 , m_ppsBuffer(MAX_NUM_PPS) 402 #else 445 #if !SVC_EXTENSION 403 446 : m_vpsBuffer(MAX_NUM_VPS) 404 447 , m_spsBuffer(MAX_NUM_SPS) -
trunk/source/Lib/TLibDecoder/TDecSlice.h
r644 r906 110 110 #if SVC_EXTENSION 111 111 static ParameterSetMap<TComVPS> m_vpsBuffer; 112 static ParameterSetMap<TComSPS> m_spsBuffer; 113 static ParameterSetMap<TComPPS> m_ppsBuffer; 112 114 #else 113 115 ParameterSetMap<TComVPS> m_vpsBuffer; 114 #endif115 116 ParameterSetMap<TComSPS> m_spsBuffer; 116 117 ParameterSetMap<TComPPS> m_ppsBuffer; 118 #endif 117 119 }; 118 120 -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r815 r906 43 43 UInt TDecTop::m_uiPrevLayerId = MAX_UINT; 44 44 Bool TDecTop::m_bFirstSliceInSequence = true; 45 #if POC_RESET_RESTRICTIONS 46 Bool TDecTop::m_checkPocRestrictionsForCurrAu = false; 47 Int TDecTop::m_pocResetIdcOrCurrAu = -1; 48 Bool TDecTop::m_baseLayerIdrFlag = false; 49 Bool TDecTop::m_baseLayerPicPresentFlag = false; 50 Bool TDecTop::m_baseLayerIrapFlag = false; 51 Bool TDecTop::m_nonBaseIdrPresentFlag = false; 52 Int TDecTop::m_nonBaseIdrType = -1; 53 Bool TDecTop::m_picNonIdrWithRadlPresentFlag = false; 54 Bool TDecTop::m_picNonIdrNoLpPresentFlag = false; 55 #endif 56 #if POC_RESET_VALUE_RESTRICTION 57 Int TDecTop::m_crossLayerPocResetPeriodId = -1; 58 Int TDecTop::m_crossLayerPocResetIdc = -1; 59 #endif 45 60 #endif 46 61 … … 74 89 memset(m_cIlpPic, 0, sizeof(m_cIlpPic)); 75 90 #endif 76 #if AVC_SYNTAX || SYNTAX_OUTPUT77 m_pBLSyntaxFile = NULL;78 #endif79 91 m_prevSliceSkipped = false; 80 92 m_skippedPOC = 0; … … 105 117 #endif 106 118 107 #if Q0074_SEI_COLOR_MAPPING 108 m_ColorMapping = new TDecColorMapping(); 119 #if POC_RESET_RESTRICTIONS 120 resetPocRestrictionCheckParameters(); 121 #endif 122 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 123 m_pocResettingFlag = false; 124 m_pocDecrementedInDPBFlag = false; 109 125 #endif 110 126 } … … 112 128 TDecTop::~TDecTop() 113 129 { 114 #if Q0078_ADD_LAYER_SETS115 for (Int psId = 0; psId < MAX_NUM_SPS; psId++)116 {117 TComSPS* sps = m_parameterSetManagerDecoder.getSPS(psId);118 if (sps != NULL)119 {120 // Remove parameter set from other layers to prevent multiple deletes of the same object121 for (Int lId = 0; lId < m_numLayer; lId++)122 {123 if (m_ppcTDecTop[lId] != this)124 {125 m_parameterSetManagerDecoder.removeSPS(psId);126 }127 }128 }129 }130 for (Int psId = 0; psId < MAX_NUM_PPS; psId++)131 {132 TComPPS* pps = m_parameterSetManagerDecoder.getPPS(psId);133 if (pps != NULL)134 {135 // Remove parameter set from other layers to prevent multiple deletes of the same object136 for (Int lId = 0; lId < m_numLayer; lId++)137 {138 if (m_ppcTDecTop[lId] != this)139 {140 m_parameterSetManagerDecoder.removePPS(psId);141 }142 }143 }144 }145 #endif146 130 #if ENC_DEC_TRACE 147 131 fclose( g_hTrace ); … … 154 138 m_pColorMappedPic = NULL; 155 139 } 156 #endif157 #if Q0074_SEI_COLOR_MAPPING158 if ( m_ColorMapping ) delete m_ColorMapping;159 140 #endif 160 141 } … … 188 169 m_cIlpPic[i] = NULL; 189 170 } 190 } 171 } 191 172 #endif 192 173 } … … 237 218 238 219 Int numReorderPics[MAX_TLAYER]; 220 #if R0156_CONF_WINDOW_IN_REP_FORMAT 221 Window &conformanceWindow = slice->getConformanceWindow(); 222 #else 239 223 Window &conformanceWindow = pcSPS->getConformanceWindow(); 224 #endif 240 225 Window defaultDisplayWindow = pcSPS->getVuiParametersPresentFlag() ? pcSPS->getVuiParameters()->getDefaultDisplayWindow() : Window(); 241 226 … … 326 311 { 327 312 Int numReorderPics[MAX_TLAYER]; 313 #if R0156_CONF_WINDOW_IN_REP_FORMAT 314 Window &conformanceWindow = pcSlice->getConformanceWindow(); 315 #else 328 316 Window &conformanceWindow = pcSlice->getSPS()->getConformanceWindow(); 317 #endif 329 318 Window defaultDisplayWindow = pcSlice->getSPS()->getVuiParametersPresentFlag() ? pcSlice->getSPS()->getVuiParameters()->getDefaultDisplayWindow() : Window(); 330 319 … … 362 351 #else 363 352 m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), pcSlice->getLayerId(), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 353 //TODO: HENDRY -- Do the checking here. 364 354 #endif 365 355 } … … 381 371 for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ ) 382 372 { 373 #if MOVE_SCALED_OFFSET_TO_PPS 374 #if O0098_SCALED_REF_LAYER_ID 375 const Window scalEL = pcSlice->getPPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i)); 376 #else 377 const Window scalEL = pcSlice->getPPS()->getScaledRefLayerWindow(i); 378 #endif 379 #else 383 380 #if O0098_SCALED_REF_LAYER_ID 384 381 const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i)); … … 386 383 const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(i); 387 384 #endif 385 #endif 386 #if REF_REGION_OFFSET 387 const Window refEL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i)); 388 #if RESAMPLING_FIX 389 Bool equalOffsets = scalEL.hasEqualOffset(refEL); 390 #if R0209_GENERIC_PHASE 391 Bool zeroPhase = pcSlice->getPPS()->hasZeroResamplingPhase(pcSlice->getVPS()->getRefLayerId(m_layerId, i)); 392 #endif 393 #else 394 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 395 && refEL.getWindowLeftOffset() == 0 && refEL.getWindowRightOffset() == 0 && refEL.getWindowTopOffset() == 0 && refEL.getWindowBottomOffset() == 0 ); 396 #endif 397 #else 388 398 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 399 #endif 389 400 390 401 #if VPS_EXTN_DIRECT_REF_LAYERS … … 400 411 Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] ); 401 412 402 if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths 413 #if REF_IDX_MFM 414 if( pcPicYuvRecBase->getWidth() == pcSlice->getPicWidthInLumaSamples() && pcPicYuvRecBase->getHeight() == pcSlice->getPicHeightInLumaSamples() && equalOffsets && zeroPhase ) 415 { 416 rpcPic->setEqualPictureSizeAndOffsetFlag( i, true ); 417 } 418 419 if( !rpcPic->equalPictureSizeAndOffsetFlag(i) || !sameBitDepths 420 #else 421 if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !sameBitDepths 422 #if REF_REGION_OFFSET && RESAMPLING_FIX 423 || !equalOffsets 424 #if R0209_GENERIC_PHASE 425 || !zeroPhase 426 #endif 427 #else 428 || !zeroOffsets 429 #endif 430 #endif 403 431 #if Q0048_CGS_3D_ASYMLUT 404 432 || pcSlice->getPPS()->getCGSFlag() > 0 … … 409 437 ) 410 438 #else 411 if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets ) 412 #endif 413 #else 414 if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() || !zeroOffsets ) 439 if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() 440 #if REF_REGION_OFFSET && RESAMPLING_FIX 441 || !equalOffsets 442 #if R0209_GENERIC_PHASE 443 || !zeroPhase 444 #endif 445 #else 446 || !zeroOffsets 447 #endif 448 ) 449 #endif 450 #else 451 if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() 452 #if REF_REGION_OFFSET && RESAMPLING_FIX 453 || !equalOffsets 454 #if R0209_GENERIC_PHASE 455 || !zeroPhase 456 #endif 457 #else 458 || !zeroOffsets 459 #endif 460 ) 415 461 #endif 416 462 { … … 522 568 m_cGopDecoder.filterPicture(pcPic); 523 569 524 #if SYNTAX_OUTPUT525 pcPic->wrireBLSyntax( getBLSyntaxFile(), SYNTAX_BYTES );526 #endif527 570 TComSlice::sortPicList( m_cListPic ); // sorting for application output 528 571 poc = pcPic->getSlice(m_uiSliceIdx-1)->getPOC(); … … 713 756 714 757 // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0 758 #if VPS_AVC_BL_FLAG_REMOVAL 759 if( activeVPS->getNonHEVCBaseLayerFlag() ) 760 #else 715 761 if( activeVPS->getAvcBaseLayerFlag() ) 762 #endif 716 763 { 717 764 assert( refLayerId > 0 ); … … 742 789 743 790 // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0 791 #if VPS_AVC_BL_FLAG_REMOVAL 792 if( activeVPS->getNonHEVCBaseLayerFlag() ) 793 #else 744 794 if( activeVPS->getAvcBaseLayerFlag() ) 795 #endif 745 796 { 746 797 assert( refLayerId > 0 ); … … 768 819 769 820 #if AVC_BASE 821 #if VPS_AVC_BL_FLAG_REMOVAL 822 if( activeVPS->getNonHEVCBaseLayerFlag() ) 823 #else 770 824 if( activeVPS->getAvcBaseLayerFlag() ) 825 #endif 771 826 { 772 827 TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); … … 777 832 778 833 Int numReorderPics[MAX_TLAYER]; 834 #if !R0156_CONF_WINDOW_IN_REP_FORMAT 779 835 Window conformanceWindow; 836 #endif 780 837 Window defaultDisplayWindow; 781 838 839 #if R0156_CONF_WINDOW_IN_REP_FORMAT 782 840 #if AUXILIARY_PICTURES 783 #if AVC_SYNTAX 784 pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, activeSPS, true); 785 #else 841 pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), repFormat->getConformanceWindowVps(), defaultDisplayWindow, numReorderPics, NULL, true); 842 #else 843 pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), repFormat->getConformanceWindowVps(), defaultDisplayWindow, numReorderPics, NULL, true); 844 #endif 845 #else 846 #if AUXILIARY_PICTURES 786 847 pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), repFormat->getChromaFormatVpsIdc(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true); 787 #endif788 #else789 #if AVC_SYNTAX790 pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, activeSPS, true);791 848 #else 792 849 pBLPic->create( repFormat->getPicWidthVpsInLumaSamples(), repFormat->getPicHeightVpsInLumaSamples(), activeSPS->getMaxCUWidth(), activeSPS->getMaxCUHeight(), activeSPS->getMaxCUDepth(), conformanceWindow, defaultDisplayWindow, numReorderPics, NULL, true); … … 805 862 806 863 #if P0312_VERT_PHASE_ADJ 864 #if MOVE_SCALED_OFFSET_TO_PPS 865 if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 ) 866 { 867 for(Int i = 0; i < activePPS->getNumScaledRefLayerOffsets(); i++) 868 { 869 UInt scaledRefLayerId = activePPS->getScaledRefLayerId(i); 870 if( activePPS->getVertPhasePositionEnableFlag( scaledRefLayerId ) ) 871 { 872 printf("\nWarning: LayerId = %d: vert_phase_position_enable_flag[%d] = 1, however indication vert_phase_position_in_use_flag = 0\n", m_layerId, scaledRefLayerId ); 873 break; 874 } 875 } 876 } 877 #else 807 878 if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 ) 808 879 { … … 817 888 } 818 889 } 890 #endif 819 891 #endif 820 892 … … 868 940 pps->setSPS(sps); 869 941 #if REPN_FORMAT_IN_VPS 870 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNum ColumnsMinus1() + 1) : 1);871 #else 872 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNum ColumnsMinus1() + 1) : 1);942 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumTileColumnsMinus1() + 1) : 1); 943 #else 944 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumTileColumnsMinus1() + 1) : 1); 873 945 #endif 874 946 pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) ); … … 885 957 g_uiMaxCUDepth = sps->getMaxCUDepth(); 886 958 g_uiAddCUDepth = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() ); 887 888 #if Q0074_SEI_COLOR_MAPPING889 for(Int compID=0; compID<3; compID++)890 {891 m_ColorMapping->setColorMapping( compID ? g_bitDepthC : g_bitDepthY, compID );892 }893 #endif894 959 895 960 for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++) … … 953 1018 954 1019 m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType); 1020 #if POC_RESET_RESTRICTIONS 1021 m_apcSlicePilot->setTLayer( nalu.m_temporalId ); 1022 #endif 955 1023 Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N || 956 1024 m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N || … … 1018 1086 } 1019 1087 1088 //TODO: HENDRY -- Probably do the checking for max number of positive and negative pics here 1089 1090 1020 1091 //For inference of PicOutputFlag 1021 1092 if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R) … … 1109 1180 } 1110 1181 #endif 1182 1111 1183 #if POC_RESET_IDC_DECODER 1112 1184 if( m_parseIdc != -1 ) // Second pass for a POC resetting picture … … 1129 1201 if(( m_layerId < m_uiPrevLayerId) ||( ( m_layerId == m_uiPrevLayerId) && bNewPOC)) // Decoding a lower layer than or same layer as previous - mark all earlier pictures as not in current AU 1130 1202 { 1203 #if POC_RESET_RESTRICTIONS 1204 // New access unit; reset all variables related to POC reset restrictions 1205 resetPocRestrictionCheckParameters(); 1206 #endif 1131 1207 markAllPicsAsNoCurrAu(); 1132 } 1208 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1209 for (UInt i = 0; i < MAX_LAYERS; i++) 1210 { 1211 m_ppcTDecTop[i]->m_pocDecrementedInDPBFlag = false; 1212 } 1213 #endif 1214 } 1215 1216 1217 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1218 m_pocResettingFlag = false; 1219 1220 if (m_apcSlicePilot->getPocResetIdc() != 0) 1221 { 1222 if (m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag()) 1223 { 1224 m_pocResettingFlag = true; 1225 } 1226 else if (m_pocDecrementedInDPBFlag) 1227 { 1228 m_pocResettingFlag = false; 1229 } 1230 else 1231 { 1232 m_pocResettingFlag = true; 1233 } 1234 } 1235 #endif 1133 1236 1134 1237 if( m_apcSlicePilot->getPocResetIdc() && m_apcSlicePilot->getSliceIdx() == 0 ) … … 1141 1244 m_parseIdc = 0; 1142 1245 } 1246 #if POC_RESET_VALUE_RESTRICTION 1247 // Check if the POC Reset period ID matches with the Reset Period ID 1248 if( pocResetPeriodId == m_crossLayerPocResetPeriodId ) 1249 { 1250 // If matching, and current poc_reset_idc = 3, then the values should match 1251 if( m_apcSlicePilot->getPocResetIdc() == 3 ) 1252 { 1253 assert( ( m_apcSlicePilot->getFullPocResetFlag() == false && m_crossLayerPocResetIdc == 1 ) || 1254 ( m_apcSlicePilot->getFullPocResetFlag() == true && m_crossLayerPocResetIdc == 2 ) ); 1255 } 1256 } 1257 else 1258 { 1259 // This is the first picture of a POC resetting access unit 1260 m_crossLayerPocResetPeriodId = pocResetPeriodId; 1261 if( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 ) 1262 { 1263 m_crossLayerPocResetIdc = m_apcSlicePilot->getPocResetIdc(); 1264 } 1265 else 1266 { // poc_reset_idc = 3 1267 // In this case, the entire POC resetting access unit has been lost. 1268 // Need more checking to ensure poc_reset_idc = 3 works. 1269 assert ( 0 ); 1270 } 1271 } 1272 #endif 1143 1273 } 1144 1274 else 1145 1275 { 1146 1276 m_parseIdc = 3; // Proceed to decoding POC and RPS 1147 } 1277 } 1148 1278 } 1149 1279 #endif … … 1151 1281 #if ALIGNED_BUMPING 1152 1282 #if POC_RESET_IDC_DECODER 1283 1284 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1285 UInt affectedLayerList[MAX_NUM_LAYER_IDS]; 1286 Int numAffectedLayers; 1287 1288 affectedLayerList[0] = m_apcSlicePilot->getLayerId(); 1289 numAffectedLayers = 1; 1290 1291 if (m_apcSlicePilot->getVPS()->getVpsPocLsbAlignedFlag()) 1292 { 1293 for (UInt j = 0; j < m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()); j++) 1294 { 1295 affectedLayerList[j + 1] = m_apcSlicePilot->getVPS()->getPredictedLayerId(m_apcSlicePilot->getLayerId(), j); 1296 } 1297 numAffectedLayers = m_apcSlicePilot->getVPS()->getNumPredictedLayers(m_apcSlicePilot->getLayerId()) + 1; 1298 } 1299 #endif 1300 1153 1301 //if( (bNewPOC || m_layerId != m_uiPrevLayerId) && ( m_parseIdc != 1) ) 1154 if( m_parseIdc == 1 ) 1302 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1303 if (m_parseIdc == 1 && m_pocResettingFlag) 1304 #else 1305 if (m_parseIdc == 1) 1306 #endif 1155 1307 { 1156 1308 // Invoke output of pictures if the current picture is a POC reset picture … … 1203 1355 Int deltaPocVal = pocMsbDelta + pocLsbDelta; 1204 1356 1357 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1358 for (UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++) 1359 { 1360 if (!m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocDecrementedInDPBFlag) 1361 { 1362 m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocDecrementedInDPBFlag = true; 1363 TComList<TComPic*>::iterator iterPic = m_ppcTDecTop[affectedLayerList[layerIdx]]->getListPic()->begin(); 1364 while (iterPic != m_ppcTDecTop[affectedLayerList[layerIdx]]->getListPic()->end()) 1365 #else 1205 1366 //Reset all POC for DPB -> basically do it for each slice in the picutre 1206 1367 TComList<TComPic*>::iterator iterPic = m_cListPic.begin(); … … 1208 1369 // Iterate through all picture in DPB 1209 1370 while( iterPic != m_cListPic.end() ) 1371 #endif 1210 1372 { 1211 1373 TComPic *dpbPic = *iterPic; 1212 1374 // Check if the picture pointed to by iterPic is either used for reference or 1213 1375 // needed for output, are in the same layer, and not the current picture. 1214 if( /* ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) ) 1376 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1377 assert(dpbPic->getLayerId() == affectedLayerList[layerIdx]); 1378 if ( (dpbPic->getReconMark()) && (dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag()) ) 1379 #else 1380 if ( /* ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) ) 1215 1381 &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() ) 1216 1382 && ( dpbPic->getReconMark() ) && ( dpbPic->getPicSym()->getSlice(0)->getPicOutputFlag() )) 1383 #endif 1217 1384 { 1218 1385 for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--) … … 1241 1408 iterPic++; 1242 1409 } 1410 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1411 // Update the value of pocCRA 1412 m_ppcTDecTop[affectedLayerList[layerIdx]]->m_pocCRA -= deltaPocVal; 1413 } 1414 } 1415 #else 1243 1416 // Update the value of pocCRA 1244 1417 m_pocCRA -= deltaPocVal; 1418 #endif 1245 1419 1246 1420 // Update value of POCLastDisplay … … 1250 1424 Int slicePicOrderCntLsb = m_apcSlicePilot->getPicOrderCntLsb(); 1251 1425 1252 if( m_parseIdc == 1 || m_parseIdc == 2 ) // TODO This should be replaced by pocResettingFlag. 1426 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1427 if (m_pocResettingFlag && (m_parseIdc == 1 || m_parseIdc == 2)) 1428 #else 1429 if (m_parseIdc == 1 || m_parseIdc == 2) // TODO This should be replaced by pocResettingFlag. 1430 #endif 1253 1431 { 1254 1432 // Set poc for current slice … … 1296 1474 && !m_apcSlicePilot->getDiscardableFlag() ) 1297 1475 { 1476 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1477 for (UInt i = 0; i < numAffectedLayers; i++) 1478 { 1479 m_ppcTDecTop[affectedLayerList[i]]->setPrevPicOrderCnt(m_apcSlicePilot->getPOC()); 1480 } 1481 #else 1298 1482 this->setPrevPicOrderCnt( m_apcSlicePilot->getPOC() ); 1483 #endif 1299 1484 } 1300 1485 else if ( m_apcSlicePilot->getPocResetIdc() == 3 ) 1301 1486 { 1487 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1488 if (!m_firstPicInLayerDecodedFlag || (m_firstPicInLayerDecodedFlag && m_pocResettingFlag)) 1489 { 1490 for (UInt i = 0; i < numAffectedLayers; i++) 1491 { 1492 m_ppcTDecTop[affectedLayerList[i]]->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag() 1493 ? 0 : m_apcSlicePilot->getPocLsbVal() ); 1494 } 1495 } 1496 #else 1302 1497 this->setPrevPicOrderCnt( m_apcSlicePilot->getFullPocResetFlag() 1303 1498 ? 0 : m_apcSlicePilot->getPocLsbVal() ); 1499 #endif 1304 1500 } 1305 1501 #else … … 1324 1520 #if POC_RESET_IDC_DECODER 1325 1521 m_parseIdc = -1; 1522 #endif 1523 1524 1525 #if R0226_SLICE_TMVP 1526 if ( m_apcSlicePilot->getTLayer() == 0 && m_apcSlicePilot->getEnableTMVPFlag() == 0 ) 1527 { 1528 //update all pics in the DPB such that they cannot be used for TMPV ref 1529 TComList<TComPic*>::iterator iterRefPic = m_cListPic.begin(); 1530 while( iterRefPic != m_cListPic.end() ) 1531 { 1532 TComPic *refPic = *iterRefPic; 1533 if( ( refPic->getLayerId() == m_apcSlicePilot->getLayerId() ) && refPic->getReconMark() ) 1534 { 1535 for(Int i = refPic->getNumAllocatedSlice()-1; i >= 0; i--) 1536 { 1537 1538 TComSlice *refSlice = refPic->getSlice(i); 1539 refSlice->setAvailableForTMVPRefFlag( false ); 1540 } 1541 } 1542 iterRefPic++; 1543 } 1544 } 1545 m_apcSlicePilot->setAvailableForTMVPRefFlag( true ); 1326 1546 #endif 1327 1547 … … 1483 1703 { 1484 1704 #if AVC_BASE 1705 #if VPS_AVC_BL_FLAG_REMOVAL 1706 if( m_layerId == 1 && m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getNonHEVCBaseLayerFlag() ) 1707 #else 1485 1708 if( m_layerId == 1 && m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) 1709 #endif 1486 1710 { 1487 1711 TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin()); … … 1611 1835 1612 1836 #if POC_RESET_IDC_DECODER 1613 pcPic->setCurrAuFlag( true ); 1837 pcPic->setCurrAuFlag( true ); 1838 #if POC_RESET_RESTRICTIONS 1839 if( pcPic->getLayerId() > 0 && m_apcSlicePilot->isIDR() && !m_nonBaseIdrPresentFlag ) 1840 { 1841 // IDR picture with nuh_layer_id > 0 present 1842 m_nonBaseIdrPresentFlag = true; 1843 m_nonBaseIdrType = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL); 1844 } 1845 else 1846 { 1847 if( m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL ) 1848 { 1849 // Picture with nal_unit_type not equal IDR_W_RADL present 1850 m_picNonIdrWithRadlPresentFlag = true; 1851 } 1852 if( m_apcSlicePilot->getNalUnitType() != NAL_UNIT_CODED_SLICE_IDR_N_LP ) 1853 { 1854 // Picture with nal_unit_type not equal IDR_N_LP present 1855 m_picNonIdrNoLpPresentFlag = true; 1856 } 1857 } 1858 if( !m_checkPocRestrictionsForCurrAu ) // Will be true for the first slice/picture of the AU 1859 { 1860 m_checkPocRestrictionsForCurrAu = true; 1861 m_pocResetIdcOrCurrAu = m_apcSlicePilot->getPocResetIdc(); 1862 if( pcPic->getLayerId() == 0 ) 1863 { 1864 // Base layer picture is present 1865 m_baseLayerPicPresentFlag = true; 1866 if( m_apcSlicePilot->isIRAP() ) 1867 { 1868 // Base layer picture is IRAP 1869 m_baseLayerIrapFlag = true; 1870 } 1871 if( m_apcSlicePilot->isIDR() ) 1872 { 1873 // Base layer picture is IDR 1874 m_baseLayerIdrFlag = true; 1875 } 1876 else 1877 { 1878 if( m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag()) 1879 { 1880 /* When the picture with nuh_layer_id equal to 0 in an access unit is not an IDR picture 1881 and vps_base_layer_internal_flag is equal to 1, the value of poc_reset_idc shall not be equal to 2 1882 for any picture in the access unit. */ 1883 assert( m_apcSlicePilot->getPocResetIdc() != 2 ); 1884 } 1885 } 1886 } 1887 } 1888 else 1889 { 1890 // The value of poc_reset_idc of all coded pictures that are present in the bitstream in an access unit shall be the same. 1891 assert( m_pocResetIdcOrCurrAu == m_apcSlicePilot->getPocResetIdc() ); 1892 1893 /* When the picture in an access unit with nuh_layer_id equal to 0 is an IRAP picture and vps_base_layer_internal_flag is equal to 1 1894 and there is at least one other picture in the same access unit that is not an IRAP picture, 1895 the value of poc_reset_idc shall be equal to 1 or 2 for all pictures in the access unit. */ 1896 if( m_baseLayerPicPresentFlag && m_baseLayerIrapFlag && !m_apcSlicePilot->isIRAP() && m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag() ) 1897 { 1898 assert( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 ); 1899 } 1900 1901 /* When the picture with nuh_layer_id equal to 0 in an access unit is an IDR picture and 1902 vps_base_layer_internal_flag is equal to 1 and there is at least one non-IDR picture in the same access unit, 1903 the value of poc_reset_idc shall be equal to 2 for all pictures in the access unit. */ 1904 if( m_baseLayerPicPresentFlag && m_baseLayerIdrFlag && !m_apcSlicePilot->isIDR() && m_apcSlicePilot->getVPS()->getBaseLayerInternalFlag() ) 1905 { 1906 assert( m_apcSlicePilot->getPocResetIdc() == 2 ); 1907 } 1908 1909 /* When there is at least one picture that has nuh_layer_id greater than 0 and that is an IDR picture 1910 with a particular value of nal_unit_type in an access unit and there is at least one other coded picture 1911 that is present in the bitstream in the same access unit with a different value of nal_unit_type, 1912 the value of poc_reset_idc shall be equal to 1 or 2 for all pictures in the access unit. */ 1913 if( m_nonBaseIdrPresentFlag && ( 1914 ( m_nonBaseIdrType == 1 && m_picNonIdrWithRadlPresentFlag ) || 1915 ( m_nonBaseIdrType == 0 && m_picNonIdrNoLpPresentFlag ) 1916 )) 1917 { 1918 assert( m_apcSlicePilot->getPocResetIdc() == 1 || m_apcSlicePilot->getPocResetIdc() == 2 ); 1919 } 1920 } 1921 #endif 1614 1922 #endif 1615 1923 … … 1627 1935 isTff = (pictureTiming->m_picStruct == 1); 1628 1936 } 1937 1938 #if R0226_CONSTRAINT_TMVP_SEI 1939 // Check if any new temporal motion vector prediction constraints SEI has arrived 1940 SEIMessages seiTMVPConstrainsList = extractSeisByType (m_SEIs, SEI::TMVP_CONSTRAINTS); 1941 if (seiTMVPConstrainsList.size() > 0) 1942 { 1943 assert ( pcPic->getTLayer() == 0 ); //this SEI can present only for AU with Tid equal to 0 1944 SEITMVPConstrains* tmvpConstraintSEI = (SEITMVPConstrains*) *(seiTMVPConstrainsList.begin()); 1945 if ( tmvpConstraintSEI->prev_pics_not_used_flag == 1 ) 1946 { 1947 //update all pics in the DPB such that they cannot be used for TMPV ref 1948 TComList<TComPic*>::iterator iterRefPic = m_cListPic.begin(); 1949 while( iterRefPic != m_cListPic.end() ) 1950 { 1951 TComPic *refPic = *iterRefPic; 1952 if( ( refPic->getLayerId() == pcPic->getLayerId() ) && refPic->getReconMark() ) 1953 { 1954 for(Int i = refPic->getNumAllocatedSlice()-1; i >= 0; i--) 1955 { 1956 TComSlice *refSlice = refPic->getSlice(i); 1957 refSlice->setAvailableForTMVPRefFlag( false ); 1958 } 1959 } 1960 iterRefPic++; 1961 } 1962 } 1963 } 1964 #endif 1629 1965 } 1630 1966 … … 1665 2001 Bool bNextSlice = pcSlice->isNextSlice(); 1666 2002 1667 UInt uiCummulativeTileWidth; 1668 UInt uiCummulativeTileHeight; 1669 UInt i, j, p; 1670 1671 //set NumColumnsMins1 and NumRowsMinus1 1672 pcPic->getPicSym()->setNumColumnsMinus1( pcSlice->getPPS()->getNumColumnsMinus1() ); 1673 pcPic->getPicSym()->setNumRowsMinus1( pcSlice->getPPS()->getNumRowsMinus1() ); 1674 1675 //create the TComTileArray 1676 pcPic->getPicSym()->xCreateTComTileArray(); 1677 1678 if( pcSlice->getPPS()->getUniformSpacingFlag() ) 1679 { 1680 //set the width for each tile 1681 for(j=0; j < pcPic->getPicSym()->getNumRowsMinus1()+1; j++) 1682 { 1683 for(p=0; p < pcPic->getPicSym()->getNumColumnsMinus1()+1; p++) 1684 { 1685 pcPic->getPicSym()->getTComTile( j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p )-> 1686 setTileWidth( (p+1)*pcPic->getPicSym()->getFrameWidthInCU()/(pcPic->getPicSym()->getNumColumnsMinus1()+1) 1687 - (p*pcPic->getPicSym()->getFrameWidthInCU())/(pcPic->getPicSym()->getNumColumnsMinus1()+1) ); 1688 } 1689 } 1690 1691 //set the height for each tile 1692 for(j=0; j < pcPic->getPicSym()->getNumColumnsMinus1()+1; j++) 1693 { 1694 for(p=0; p < pcPic->getPicSym()->getNumRowsMinus1()+1; p++) 1695 { 1696 pcPic->getPicSym()->getTComTile( p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j )-> 1697 setTileHeight( (p+1)*pcPic->getPicSym()->getFrameHeightInCU()/(pcPic->getPicSym()->getNumRowsMinus1()+1) 1698 - (p*pcPic->getPicSym()->getFrameHeightInCU())/(pcPic->getPicSym()->getNumRowsMinus1()+1) ); 1699 } 1700 } 1701 } 1702 else 1703 { 1704 //set the width for each tile 1705 for(j=0; j < pcSlice->getPPS()->getNumRowsMinus1()+1; j++) 1706 { 1707 uiCummulativeTileWidth = 0; 1708 for(i=0; i < pcSlice->getPPS()->getNumColumnsMinus1(); i++) 1709 { 1710 pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcSlice->getPPS()->getColumnWidth(i) ); 1711 uiCummulativeTileWidth += pcSlice->getPPS()->getColumnWidth(i); 1712 } 1713 pcPic->getPicSym()->getTComTile(j * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + i)->setTileWidth( pcPic->getPicSym()->getFrameWidthInCU()-uiCummulativeTileWidth ); 1714 } 1715 1716 //set the height for each tile 1717 for(j=0; j < pcSlice->getPPS()->getNumColumnsMinus1()+1; j++) 1718 { 1719 uiCummulativeTileHeight = 0; 1720 for(i=0; i < pcSlice->getPPS()->getNumRowsMinus1(); i++) 1721 { 1722 pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcSlice->getPPS()->getRowHeight(i) ); 1723 uiCummulativeTileHeight += pcSlice->getPPS()->getRowHeight(i); 1724 } 1725 pcPic->getPicSym()->getTComTile(i * (pcSlice->getPPS()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcPic->getPicSym()->getFrameHeightInCU()-uiCummulativeTileHeight ); 1726 } 1727 } 1728 1729 pcPic->getPicSym()->xInitTiles(); 2003 UInt i; 2004 pcPic->getPicSym()->initTiles(pcSlice->getPPS()); 1730 2005 1731 2006 //generate the Coding Order Map and Inverse Coding Order Map … … 1793 2068 UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc); 1794 2069 #if AVC_BASE 2070 #if VPS_AVC_BL_FLAG_REMOVAL 2071 if( refLayerId == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getNonHEVCBaseLayerFlag() ) 2072 #else 1795 2073 if( refLayerId == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() ) 2074 #endif 1796 2075 { 1797 2076 TComPic* pic = *m_ppcTDecTop[0]->getListPic()->begin(); … … 1805 2084 continue; 1806 2085 } 1807 #if AVC_SYNTAX1808 TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc);1809 if( pcSlice->getPOC() == 0 )1810 {1811 // initialize partition order.1812 UInt* piTmp = &g_auiZscanToRaster[0];1813 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp );1814 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 );1815 }1816 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice );1817 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );1818 #endif1819 2086 } 1820 2087 else … … 1841 2108 #endif 1842 2109 2110 #if MOVE_SCALED_OFFSET_TO_PPS 2111 #if O0098_SCALED_REF_LAYER_ID 2112 const Window &scalEL = pcSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId); 2113 #else 2114 const Window &scalEL = pcSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc); 2115 #endif 2116 #else 1843 2117 #if O0098_SCALED_REF_LAYER_ID 1844 2118 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId); … … 1846 2120 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc); 1847 2121 #endif 1848 2122 #endif 2123 2124 #if REF_REGION_OFFSET 2125 const Window &windowRL = pcSlice->getPPS()->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc)); 2126 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth() - windowRL.getWindowLeftOffset() - windowRL.getWindowRightOffset(); 2127 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset(); 2128 #else 1849 2129 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(); 1850 2130 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(); … … 1855 2135 heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc ); 1856 2136 #endif 2137 #endif 1857 2138 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 1858 2139 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 1859 2140 2141 #if RESAMPLING_FIX 2142 #if REF_REGION_OFFSET 2143 // conformance check: the values of RefLayerRegionWidthInSamplesY, RefLayerRegionHeightInSamplesY, ScaledRefRegionWidthInSamplesY and ScaledRefRegionHeightInSamplesY shall be greater than 0 2144 assert(widthEL > 0 && heightEL > 0 && widthBL > 0 && widthEL > 0); 2145 2146 // conformance check: ScaledRefRegionWidthInSamplesY shall be greater or equal to RefLayerRegionWidthInSamplesY and ScaledRefRegionHeightInSamplesY shall be greater or equal to RefLayerRegionHeightInSamplesY 2147 assert(widthEL >= widthBL && heightEL >= heightBL); 2148 2149 #if R0209_GENERIC_PHASE 2150 // conformance check: when ScaledRefRegionWidthInSamplesY is equal to RefLayerRegionWidthInSamplesY, PhaseHorY shall be equal to 0, when ScaledRefRegionWidthInSamplesC is equal to RefLayerRegionWidthInSamplesC, PhaseHorC shall be equal to 0, when ScaledRefRegionHeightInSamplesY is equal to RefLayerRegionHeightInSamplesY, PhaseVerY shall be equal to 0, and when ScaledRefRegionHeightInSamplesC is equal to RefLayerRegionHeightInSamplesC, PhaseVerC shall be equal to 0. 2151 Int phaseHorLuma = pcSlice->getPPS()->getPhaseHorLuma(refLayerIdc); 2152 Int phaseVerLuma = pcSlice->getPPS()->getPhaseVerLuma(refLayerIdc); 2153 Int phaseHorChroma = pcSlice->getPPS()->getPhaseHorChroma(refLayerIdc); 2154 Int phaseVerChroma = pcSlice->getPPS()->getPhaseVerChroma(refLayerIdc); 2155 assert( ( (widthEL != widthBL) || (phaseHorLuma == 0 && phaseHorChroma == 0) ) 2156 && ( (heightEL != heightBL) || (phaseVerLuma == 0 && phaseVerChroma == 0) ) ); 2157 #endif 2158 #endif 2159 #endif 2160 1860 2161 g_mvScalingFactor[refLayerIdc][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 1861 2162 g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); … … 1866 2167 #if Q0048_CGS_3D_ASYMLUT 1867 2168 TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(); 1868 if( pcSlice->getPPS()->getCGSFlag() ) 1869 { 2169 if( pcSlice->getPPS()->getCGSFlag() 2170 #if R0150_CGS_SIGNAL_CONSTRAINTS 2171 && m_c3DAsymLUTPPS.isRefLayer( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ) 2172 #endif 2173 ) 2174 { 2175 #if R0150_CGS_SIGNAL_CONSTRAINTS 2176 assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepthY() == m_c3DAsymLUTPPS.getInputBitDepthY() ); 2177 assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepthC() == m_c3DAsymLUTPPS.getInputBitDepthC() ); 2178 assert( pcSlice->getBitDepthY() >= m_c3DAsymLUTPPS.getOutputBitDepthY() ); 2179 assert( pcSlice->getBitDepthY() >= m_c3DAsymLUTPPS.getOutputBitDepthC() ); 2180 #endif 1870 2181 if(!m_pColorMappedPic) 1871 2182 { … … 1891 2202 #else 1892 2203 #if Q0048_CGS_3D_ASYMLUT 1893 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() ); 1894 #else 1895 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 2204 #if MOVE_SCALED_OFFSET_TO_PPS 2205 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getPPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() ); 2206 #else 2207 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() ); 2208 #endif 2209 #else 2210 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() ); 1896 2211 #endif 1897 2212 #endif … … 1899 2214 #if O0194_JOINT_US_BITSHIFT 1900 2215 #if Q0048_CGS_3D_ASYMLUT 1901 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 1902 #else 1903 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 2216 #if REF_REGION_OFFSET 2217 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, altRL ); 2218 #else 2219 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 2220 #endif 2221 #else 2222 m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 1904 2223 #endif 1905 2224 #else … … 1928 2247 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 1929 2248 #if AVC_BASE 2249 #if VPS_AVC_BL_FLAG_REMOVAL 2250 if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getNonHEVCBaseLayerFlag() ) 2251 #else 1930 2252 if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() ) 2253 #endif 1931 2254 { 1932 2255 pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() ); 1933 #if AVC_SYNTAX1934 TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc);1935 if( pcSlice->getPOC() == 0 )1936 {1937 // initialize partition order.1938 UInt* piTmp = &g_auiZscanToRaster[0];1939 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp );1940 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 );1941 }1942 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice );1943 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );1944 #endif1945 2256 } 1946 2257 else … … 1970 2281 1971 2282 #if REF_IDX_MFM 1972 if( pcSlice->getMFMEnabledFlag() )1973 {1974 pcSlice->setRefPOCListILP(m_ppcTDecTop[m_layerId]->m_cIlpPic, pcSlice->getBaseColPic());1975 }1976 2283 pcSlice->setRefPicList( m_cListPic, false, m_cIlpPic); 1977 2284 } … … 2015 2322 } 2016 2323 } 2017 2324 2018 2325 if( m_layerId > 0 && !pcSlice->isIntra() && pcSlice->getEnableTMVPFlag() ) 2019 2326 { … … 2021 2328 2022 2329 assert( refPic ); 2330 #if R0226_SLICE_TMVP 2331 assert ( refPic->getPicSym()->getSlice(0)->getAvailableForTMVPRefFlag() == true ); 2332 #endif 2023 2333 2024 2334 // It is a requirement of bitstream conformance when the collocated picture, used for temporal motion vector prediction, is an inter-layer reference picture, … … 2100 2410 // Decode a picture 2101 2411 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); 2412 2413 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2414 setFirstPicInLayerDecodedFlag(true); 2415 #endif 2102 2416 2103 2417 m_bFirstSliceInPicture = false; … … 2115 2429 } 2116 2430 2431 #if SVC_EXTENSION 2117 2432 Void TDecTop::xDecodeSPS() 2118 2433 { 2119 2434 TComSPS* sps = new TComSPS(); 2120 #if SVC_EXTENSION2121 2435 sps->setLayerId(m_layerId); 2122 2436 #if SPS_DPB_PARAMS … … 2126 2440 #endif 2127 2441 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 2128 #if Q0078_ADD_LAYER_SETS2129 // Store SPS for all layers2130 for (Int lId = 0; lId < m_numLayer; lId++)2131 {2132 if (m_ppcTDecTop[lId] != this)2133 {2134 m_ppcTDecTop[lId]->getParameterSetManager()->storePrefetchedSPS(sps);2135 }2136 }2137 #endif2138 2442 #if !REPN_FORMAT_IN_VPS // ILRP can only be initialized at activation 2139 2443 if(m_numLayer>0) … … 2142 2446 } 2143 2447 #endif 2144 #else //SVC_EXTENSION2145 m_cEntropyDecoder.decodeSPS( sps );2146 m_parameterSetManagerDecoder.storePrefetchedSPS(sps);2147 #endif //SVC_EXTENSION2148 2448 } 2149 2449 … … 2166 2466 ); 2167 2467 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 2168 #if Q0078_ADD_LAYER_SETS2169 // Store PPS for all layers2170 for (Int lId = 0; lId < m_numLayer; lId++)2171 {2172 if (m_ppcTDecTop[lId] != this)2173 {2174 m_ppcTDecTop[lId]->getParameterSetManager()->storePrefetchedPPS(pps);2175 }2176 }2177 #endif2178 2179 if( pps->getDependentSliceSegmentsEnabledFlag() )2180 {2181 Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;2182 m_cSliceDecoder.initCtxMem(NumCtx);2183 for ( UInt st = 0; st < NumCtx; st++ )2184 {2185 TDecSbac* ctx = NULL;2186 ctx = new TDecSbac;2187 ctx->init( &m_cBinCABAC );2188 m_cSliceDecoder.setCtxMem( ctx, st );2189 }2190 }2191 2468 } 2469 #else 2470 Void TDecTop::xDecodeSPS() 2471 { 2472 TComSPS* sps = new TComSPS(); 2473 m_cEntropyDecoder.decodeSPS( sps ); 2474 m_parameterSetManagerDecoder.storePrefetchedSPS(sps); 2475 } 2476 2477 Void TDecTop::xDecodePPS() 2478 { 2479 TComPPS* pps = new TComPPS(); 2480 m_cEntropyDecoder.decodePPS( pps ); 2481 m_parameterSetManagerDecoder.storePrefetchedPPS( pps ); 2482 } 2483 #endif //SVC_EXTENSION 2192 2484 2193 2485 Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) … … 2217 2509 { 2218 2510 SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin()); 2511 #if !R0247_SEI_ACTIVE 2219 2512 m_parameterSetManagerDecoder.applyPrefetchedPS(); 2220 2513 assert(seiAps->activeSeqParameterSetId.size()>0); … … 2223 2516 printf ("Warning SPS activation with Active parameter set SEI failed"); 2224 2517 } 2225 } 2226 #if Q0074_SEI_COLOR_MAPPING 2227 m_ColorMapping->setColorMapping( m_SEIs ); 2228 #endif 2518 #else 2519 getLayerDec(0)->m_parameterSetManagerDecoder.applyPrefetchedPS(); 2520 assert(seiAps->activeSeqParameterSetId.size()>0); 2521 if( !getLayerDec(0)->m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParameterSetId[0] ) ) 2522 { 2523 printf ("Warning SPS activation with Active parameter set SEI failed"); 2524 } 2525 for (Int c=1 ; c <= seiAps->numSpsIdsMinus1; c++) 2526 { 2527 Int layerIdx = seiAps->layerSpsIdx[c]; 2528 getLayerDec(layerIdx)->m_parameterSetManagerDecoder.applyPrefetchedPS(); 2529 if( !getLayerDec(layerIdx)->m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParameterSetId[layerIdx] ) ) 2530 { 2531 printf ("Warning SPS activation with Active parameter set SEI failed"); 2532 } 2533 } 2534 #endif 2535 } 2229 2536 } 2230 2537 #else … … 2287 2594 #endif 2288 2595 #if AVC_BASE 2596 #if VPS_AVC_BL_FLAG_REMOVAL 2597 if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getNonHEVCBaseLayerFlag() ) 2598 #else 2289 2599 if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() ) 2600 #endif 2290 2601 { 2291 2602 if( !m_ppcTDecTop[0]->getBLReconFile()->good() ) … … 2294 2605 exit(EXIT_FAILURE); 2295 2606 } 2296 #if AVC_SYNTAX2297 if( !m_ppcTDecTop[0]->getBLSyntaxFile()->good() )2298 {2299 printf( "Base layer syntax input reading error\n" );2300 exit(EXIT_FAILURE);2301 }2302 #endif2303 2607 } 2304 2608 else … … 2748 3052 } 2749 3053 #endif 2750 3054 #if POC_RESET_RESTRICTIONS 3055 Void TDecTop::resetPocRestrictionCheckParameters() 3056 { 3057 TDecTop::m_checkPocRestrictionsForCurrAu = false; 3058 TDecTop::m_pocResetIdcOrCurrAu = -1; 3059 TDecTop::m_baseLayerIdrFlag = false; 3060 TDecTop::m_baseLayerPicPresentFlag = false; 3061 TDecTop::m_baseLayerIrapFlag = false; 3062 TDecTop::m_nonBaseIdrPresentFlag = false; 3063 TDecTop::m_nonBaseIdrType = -1; 3064 TDecTop::m_picNonIdrWithRadlPresentFlag = false; 3065 TDecTop::m_picNonIdrNoLpPresentFlag = false; 3066 } 3067 #endif 2751 3068 #endif //SVC_EXTENSION 2752 3069 2753 #if Q0074_SEI_COLOR_MAPPING2754 TDecColorMapping::TDecColorMapping()2755 {2756 m_pcColorMappingPic[0] = NULL;2757 m_pcColorMappingPic[1] = NULL;2758 2759 m_colorMapCancelFlag = true;2760 2761 for( Int i=0 ; i<3 ; i++ )2762 {2763 m_lut1d_computed[i] = false;2764 m_lut1d_input[i] = NULL;2765 m_coded_input_pivot_value[i] = NULL;2766 m_target_input_pivot_value[i] = NULL;2767 }2768 for( Int i=0 ; i<3 ; i++ )2769 {2770 m_lut1d_output[i] = NULL;2771 m_coded_output_pivot_value[i] = NULL;2772 m_target_output_pivot_value[i] = NULL;2773 }2774 }2775 2776 TDecColorMapping::~TDecColorMapping()2777 {2778 if ( m_pcColorMappingPic[0] ) delete m_pcColorMappingPic[0];2779 if ( m_pcColorMappingPic[1] ) delete m_pcColorMappingPic[1];2780 2781 for( Int i=0 ; i<3 ; i++ )2782 {2783 if ( m_lut1d_input[i] ) delete m_lut1d_input[i];2784 if ( m_coded_input_pivot_value[i] ) delete m_coded_input_pivot_value[i];2785 if ( m_target_input_pivot_value[i] ) delete m_target_input_pivot_value[i];2786 }2787 for( Int i=0 ; i<3 ; i++ )2788 {2789 if ( m_lut1d_output[i] ) delete m_lut1d_output[i];2790 if ( m_coded_output_pivot_value[i] ) delete m_coded_output_pivot_value[i];2791 if ( m_target_output_pivot_value[i] ) delete m_target_output_pivot_value[i];2792 }2793 }2794 2795 Void TDecColorMapping::setColorMapping( SEIMessages m_SEIs )2796 {2797 SEIMessages colorMappingInfo = getSeisByType(m_SEIs, SEI::COLOR_MAPPING_INFO) ;2798 SEIColorMappingInfo *seiColorMappingInfo = NULL;2799 if (colorMappingInfo.size() !=0)2800 {2801 seiColorMappingInfo = (SEIColorMappingInfo*)(*colorMappingInfo.begin());2802 2803 m_colorMapId = seiColorMappingInfo->m_colorMapId;2804 m_colorMapCancelFlag = seiColorMappingInfo->m_colorMapCancelFlag;2805 if( !m_colorMapCancelFlag )2806 {2807 m_colorMapPersistenceFlag = seiColorMappingInfo->m_colorMapPersistenceFlag;2808 m_colorMap_video_signal_type_present_flag = seiColorMappingInfo->m_colorMap_video_signal_type_present_flag;2809 m_colorMap_video_full_range_flag = seiColorMappingInfo->m_colorMap_video_full_range_flag;2810 m_colorMap_primaries = seiColorMappingInfo->m_colorMap_primaries;2811 m_colorMap_transfer_characteristics = seiColorMappingInfo->m_colorMap_transfer_characteristics;2812 m_colorMap_matrix_coeffs = seiColorMappingInfo->m_colorMap_matrix_coeffs;2813 m_colorMapModelId = seiColorMappingInfo->m_colorMapModelId;2814 2815 m_colour_map_coded_data_bit_depth = seiColorMappingInfo->m_colour_map_coded_data_bit_depth;2816 m_colour_map_target_bit_depth = seiColorMappingInfo->m_colour_map_target_bit_depth;2817 2818 for( Int i=0 ; i<3 ; i++ )2819 {2820 m_num_input_pivots[i] = seiColorMappingInfo->m_num_input_pivots[i];2821 if ( m_coded_input_pivot_value[i] ) delete m_coded_input_pivot_value[i];2822 if ( m_target_input_pivot_value[i] ) delete m_target_input_pivot_value[i];2823 m_coded_input_pivot_value[i] = new Int[ m_num_input_pivots[i] ];2824 m_target_input_pivot_value[i] = new Int[ m_num_input_pivots[i] ];2825 for( Int j=0 ; j<m_num_input_pivots[i] ; j++ )2826 {2827 m_coded_input_pivot_value[i][j] = seiColorMappingInfo->m_coded_input_pivot_value[i][j];2828 m_target_input_pivot_value[i][j] = seiColorMappingInfo->m_target_input_pivot_value[i][j];2829 }2830 }2831 2832 m_matrix_flag = seiColorMappingInfo->m_matrix_flag;2833 m_log2_matrix_denom = m_matrix_flag ? (seiColorMappingInfo->m_log2_matrix_denom) : (0) ;2834 for( Int i=0 ; i<3 ; i++ )2835 {2836 for( Int j=0 ; j<3 ; j++ )2837 {2838 m_matrix_coef[i][j] = seiColorMappingInfo->m_matrix_coef[i][j];2839 }2840 }2841 2842 for( Int i=0 ; i<3 ; i++ )2843 {2844 m_num_output_pivots[i] = seiColorMappingInfo->m_num_output_pivots[i];2845 if ( m_coded_output_pivot_value[i] ) delete m_coded_output_pivot_value[i];2846 if ( m_target_output_pivot_value[i] ) delete m_target_output_pivot_value[i];2847 m_coded_output_pivot_value[i] = new Int[ m_num_output_pivots[i] ];2848 m_target_output_pivot_value[i] = new Int[ m_num_output_pivots[i] ];2849 for( Int j=0 ; j<m_num_output_pivots[i] ; j++ )2850 {2851 m_coded_output_pivot_value[i][j] = seiColorMappingInfo->m_coded_output_pivot_value[i][j];2852 m_target_output_pivot_value[i][j] = seiColorMappingInfo->m_target_output_pivot_value[i][j];2853 }2854 }2855 2856 memset( m_lut1d_computed, 0, sizeof( m_lut1d_computed ) );2857 }2858 }2859 2860 }2861 2862 Void TDecColorMapping::setColorMapping( Int bitDepth, Int iComp )2863 {2864 if( !m_colorMapCancelFlag && !m_lut1d_computed[iComp] )2865 {2866 2867 if ( m_lut1d_input[iComp] ) delete m_lut1d_input[iComp];2868 if ( m_lut1d_output[iComp] ) delete m_lut1d_output[iComp];2869 2870 m_lut1d_input[iComp] = new Int[ 1 << bitDepth ];2871 m_lut1d_output[iComp] = new Int[ 1 << bitDepth ];2872 2873 Int iShift = (m_colour_map_coded_data_bit_depth >= bitDepth) ? (m_colour_map_coded_data_bit_depth - bitDepth) : (0);2874 Int iShiftPivot = (m_colour_map_coded_data_bit_depth >= bitDepth) ? (0) : (bitDepth - m_colour_map_coded_data_bit_depth);2875 2876 for( Int k=0 ; k<(1<<bitDepth) ; k++ )2877 {2878 Int iSample = k << iShift ;2879 if( m_num_input_pivots[iComp] > 1 )2880 {2881 for( Int iPivot=0 ; iPivot<m_num_input_pivots[iComp] ; iPivot++ )2882 {2883 Int iCodedPrev = m_coded_input_pivot_value[iComp][iPivot] << iShiftPivot;2884 Int iCodedNext = m_coded_input_pivot_value[iComp][iPivot+1] << iShiftPivot;2885 Int iTargetPrev = m_target_input_pivot_value[iComp][iPivot] << iShiftPivot;2886 Int iTargetNext = m_target_input_pivot_value[iComp][iPivot+1] << iShiftPivot;2887 if ( iCodedPrev <= iSample && iSample < iCodedNext )2888 {2889 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) / (Float)(iCodedNext - iCodedPrev) ;2890 m_lut1d_input[iComp][k] = (Int)( 0.5 + fInterpol );2891 iPivot = m_num_input_pivots[iComp]; // stop2892 }2893 }2894 }2895 else2896 {2897 m_lut1d_input[iComp][k] = k;2898 }2899 }2900 2901 iShift = ( (m_colour_map_coded_data_bit_depth >= bitDepth) ? (m_colour_map_coded_data_bit_depth - bitDepth) : (0) );2902 Int iOffset = iShift ? (1 << (iShift - 1)) : (0) ;2903 iShiftPivot = (m_colour_map_target_bit_depth >= bitDepth) ? (0) : (bitDepth - m_colour_map_target_bit_depth) ;2904 for( Int k=0 ; k<(1<<bitDepth) ; k++ )2905 {2906 Int iSample = k << iShift;2907 if ( m_num_output_pivots[iComp]>1 )2908 {2909 for( Int iPivot=0 ; iPivot<m_num_output_pivots[iComp] ; iPivot++ )2910 {2911 Int iCodedPrev = m_coded_output_pivot_value[iComp][iPivot] << iShiftPivot;2912 Int iCodedNext = m_coded_output_pivot_value[iComp][iPivot+1] << iShiftPivot;2913 Int iTargetPrev = m_target_output_pivot_value[iComp][iPivot] << iShiftPivot;2914 Int iTargetNext = m_target_output_pivot_value[iComp][iPivot+1] << iShiftPivot;2915 if ( iCodedPrev <= iSample && iSample < iCodedNext )2916 {2917 Float fInterpol = (Float)( (iCodedNext - iSample)*iTargetPrev + (iSample - iCodedPrev)*iTargetNext ) / (Float)(iCodedNext - iCodedPrev) ;2918 m_lut1d_output[iComp][k] = ( (Int)(0.5 + fInterpol) + iOffset ) >> iShift ;2919 iPivot = m_num_output_pivots[iComp]; // stop2920 }2921 }2922 }2923 else2924 {2925 m_lut1d_output[iComp][k] = k;2926 }2927 }2928 2929 m_lut1d_computed[iComp] = true;2930 }2931 2932 }2933 2934 TComPicYuv* TDecColorMapping::getColorMapping( TComPicYuv* pPicYuvRec, Int iTop, Int curlayerId )2935 {2936 if( !m_colorMapCancelFlag )2937 {2938 if( !m_pcColorMappingPic[iTop] )2939 {2940 m_pcColorMappingPic[iTop] = new TComPicYuv;2941 #if SVC_EXTENSION2942 m_pcColorMappingPic[iTop]->create( pPicYuvRec->getWidth(), pPicYuvRec->getHeight(), pPicYuvRec->getChromaFormat(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );2943 #else2944 m_pcColorMappingPic[iTop]->create( pPicYuvRec->getWidth(), pPicYuvRec->getHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );2945 #endif2946 }2947 2948 Int iHeight = pPicYuvRec->getHeight();2949 Int iWidth = pPicYuvRec->getWidth();2950 Int iStride = pPicYuvRec->getStride();2951 Int iCStride = pPicYuvRec->getCStride();2952 2953 Pel* Lum0 = pPicYuvRec->getLumaAddr();2954 Pel* Cb0 = pPicYuvRec->getCbAddr();2955 Pel* Cr0 = pPicYuvRec->getCrAddr();2956 Pel* Lum1 = m_pcColorMappingPic[iTop]->getLumaAddr();2957 Pel* Cb1 = m_pcColorMappingPic[iTop]->getCbAddr();2958 Pel* Cr1 = m_pcColorMappingPic[iTop]->getCrAddr();2959 2960 #if SVC_EXTENSION2961 Int bitDepthY = g_bitDepthYLayer[curlayerId];2962 Int bitDepthC = g_bitDepthCLayer[curlayerId];2963 2964 assert( g_bitDepthY == bitDepthY );2965 assert( g_bitDepthC == bitDepthC );2966 #else2967 Int bitDepthY = g_bitDepthY;2968 Int bitDepthC = g_bitDepthC;2969 #endif2970 2971 Int iYShift = (m_colour_map_target_bit_depth >= bitDepthY) ? (m_colour_map_target_bit_depth - bitDepthY) : (0) ;2972 Int iCShift = (m_colour_map_target_bit_depth >= bitDepthC) ? (m_colour_map_target_bit_depth - bitDepthC) : (0) ;2973 Int offsetY = (1 << (m_log2_matrix_denom+iYShift - 1));2974 Int offsetC = (1 << (m_log2_matrix_denom+iCShift - 1));2975 2976 Int cShift = 1 ;2977 2978 //Pel* LumPrev0 = Lum0;2979 for( Int y = 0; y < iHeight ; y++ )2980 {2981 Bool bDoChroma = (y % 2);2982 for( Int x = 0; x < iWidth ; x++ )2983 {2984 Int s1Y = m_lut1d_input[0][ Lum0[x] ];2985 Int s1U = m_lut1d_input[1][ Cb0[x>>1] ];2986 Int s1V = m_lut1d_input[2][ Cr0[x>>1] ];2987 2988 Int s2Y, s2U, s2V;2989 if( m_matrix_flag )2990 {2991 s2Y = ( m_matrix_coef[0][0]*s1Y + m_matrix_coef[0][1]*s1U + m_matrix_coef[0][2]*s1V + offsetY ) >> ( m_log2_matrix_denom + iYShift );2992 //s2Y = ClipBD( s2Y , bitDepthY );2993 s2Y = ClipY( s2Y );2994 Lum1[x] = m_lut1d_output[0][ s2Y ];2995 }2996 else2997 {2998 s1Y = ( s1Y + offsetY ) >> iYShift ;2999 //s1Y = ClipBD( s1Y , bitDepthY );3000 s1Y = ClipY( s1Y );3001 Lum1[x] = m_lut1d_output[0][ s1Y ];3002 }3003 3004 if( bDoChroma && (x%2) )3005 {3006 if( m_matrix_flag )3007 {3008 //s1Y = ( m_lut1d_input[0][ Lum0[x] ] + m_lut1d_input[0][ Lum0[x+1] ] + m_lut1d_input[0][ LumPrev0[x] ] + m_lut1d_input[0][ LumPrev0[x+1] ] + 2 ) >> 2 ;3009 //s1Y = m_lut1d_input[0][ (Lum0[x] + Lum0[x+1] + LumPrev0[x] + LumPrev0[x+1] + 2)>>2 ] ;3010 s1Y = m_lut1d_input[0][ Lum0[x] ];3011 3012 s2U = ( m_matrix_coef[1][0]*s1Y + m_matrix_coef[1][1]*s1U + m_matrix_coef[1][2]*s1V + offsetC ) >> ( m_log2_matrix_denom + iCShift ) ;3013 s2V = ( m_matrix_coef[2][0]*s1Y + m_matrix_coef[2][1]*s1U + m_matrix_coef[2][2]*s1V + offsetC ) >> ( m_log2_matrix_denom + iCShift ) ;3014 //s2U = ClipBD( s2U , bitDepthC );3015 //s2V = ClipBD( s2V , bitDepthC );3016 s2U = ClipC( s2U );3017 s2V = ClipC( s2V );3018 Cb1[x>>cShift] = m_lut1d_output[1][ s2U ];3019 Cr1[x>>cShift] = m_lut1d_output[2][ s2V ];3020 }3021 else3022 {3023 s1U = ( s1U + offsetC ) >> iCShift ;3024 s1V = ( s1V + offsetC ) >> iCShift ;3025 //s1U = ClipBD( s1U , bitDepthC );3026 //s1V = ClipBD( s1V , bitDepthC );3027 s1U = ClipC( s1U );3028 s1V = ClipC( s1V );3029 Cb1[x>>cShift] = m_lut1d_output[1][ s1U ];3030 Cr1[x>>cShift] = m_lut1d_output[2][ s1V ];3031 }3032 }3033 3034 }3035 3036 //LumPrev0 = Lum0;3037 Lum0 += iStride;3038 Lum1 += iStride;3039 if( bDoChroma )3040 {3041 Cb0 += iCStride;3042 Cr0 += iCStride;3043 Cb1 += iCStride;3044 Cr1 += iCStride;3045 }3046 }3047 3048 return m_pcColorMappingPic[iTop];3049 }3050 3051 return pPicYuvRec;3052 }3053 #endif3054 3070 3055 3071 //! \} -
trunk/source/Lib/TLibDecoder/TDecTop.h
r815 r906 64 64 // ==================================================================================================================== 65 65 66 #if Q0074_SEI_COLOR_MAPPING67 class TDecColorMapping68 {69 Int m_colorMapId;70 Bool m_colorMapCancelFlag;71 Bool m_colorMapPersistenceFlag;72 Bool m_colorMap_video_signal_type_present_flag;73 Bool m_colorMap_video_full_range_flag;74 Int m_colorMap_primaries;75 Int m_colorMap_transfer_characteristics;76 Int m_colorMap_matrix_coeffs;77 Int m_colorMapModelId;78 79 Int m_colour_map_coded_data_bit_depth;80 Int m_colour_map_target_bit_depth;81 82 Int m_num_input_pivots[3];83 Int* m_coded_input_pivot_value[3];84 Int* m_target_input_pivot_value[3];85 86 Bool m_matrix_flag;87 Int m_log2_matrix_denom;88 Int m_matrix_coef[3][3];89 90 Int m_num_output_pivots[3];91 Int* m_coded_output_pivot_value[3];92 Int* m_target_output_pivot_value[3];93 94 Bool m_lut1d_computed[3];95 Int* m_lut1d_input[3];96 Int* m_lut1d_output[3];97 TComPicYuv* m_pcColorMappingPic[2];98 99 public:100 TDecColorMapping();101 ~TDecColorMapping();102 103 Bool getColorMappingFlag() { return(!m_colorMapCancelFlag);};104 105 Void setColorMapping( SEIMessages m_SEIs );106 Void setColorMapping( Int bitDepthY, Int bitDepthC );107 TComPicYuv* getColorMapping( TComPicYuv* pPicYuvRec, Int iTop=0, Int curlayerId=0 );108 };// END CLASS DEFINITION TDecColorMapping109 #endif110 111 66 /// decoder class 112 67 class TDecTop … … 165 120 Bool m_isLastNALWasEos; 166 121 #endif 167 168 122 #if SVC_EXTENSION 169 123 static UInt m_prevPOC; // POC of the previous slice … … 173 127 UInt m_numLayer; 174 128 TDecTop** m_ppcTDecTop; 129 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 130 Bool m_pocResettingFlag; 131 Bool m_pocDecrementedInDPBFlag; 132 #endif 175 133 #if AVC_BASE 176 134 fstream* m_pBLReconFile; … … 195 153 CommonDecoderParams* m_commonDecoderParams; 196 154 #endif 197 #if AVC_SYNTAX || SYNTAX_OUTPUT198 fstream* m_pBLSyntaxFile;199 #endif200 201 155 #if NO_CLRAS_OUTPUT_FLAG 202 156 Bool m_noClrasOutputFlag; … … 214 168 #endif 215 169 public: 216 #if Q0074_SEI_COLOR_MAPPING 217 TDecColorMapping* m_ColorMapping; 170 #if POC_RESET_RESTRICTIONS 171 static Bool m_checkPocRestrictionsForCurrAu; 172 static Int m_pocResetIdcOrCurrAu; 173 static Bool m_baseLayerIdrFlag; 174 static Bool m_baseLayerPicPresentFlag; 175 static Bool m_baseLayerIrapFlag; 176 static Bool m_nonBaseIdrPresentFlag; 177 static Int m_nonBaseIdrType; 178 static Bool m_picNonIdrWithRadlPresentFlag; 179 static Bool m_picNonIdrNoLpPresentFlag; 180 #endif 181 #if POC_RESET_VALUE_RESTRICTION 182 static Int m_crossLayerPocResetPeriodId; 183 static Int m_crossLayerPocResetIdc; 218 184 #endif 219 185 … … 225 191 226 192 void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); } 193 #if Q0074_COLOUR_REMAPPING_SEI 194 void setColourRemappingInfoSEIEnabled(Bool enabled) { m_cGopDecoder.setColourRemappingInfoSEIEnabled(enabled); } 195 #endif 227 196 228 197 Void init(); … … 327 296 #endif 328 297 #endif //SVC_EXTENSION 329 #if AVC_SYNTAX || SYNTAX_OUTPUT 330 Void setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; } 331 fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; } 332 #endif 298 333 299 protected: 334 300 Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); … … 365 331 Void initAsymLut(TComSlice *pcSlice); 366 332 #endif 333 #if POC_RESET_RESTRICTIONS 334 Void resetPocRestrictionCheckParameters(); 335 #endif 367 336 };// END CLASS DEFINITION TDecTop 368 337 369 338 339 370 340 //! \} 371 341 -
trunk/source/Lib/TLibEncoder/SEIwrite.cpp
r815 r906 92 92 break; 93 93 #endif 94 #if Q0074_ SEI_COLOR_MAPPING95 case SEI::COLO R_MAPPING_INFO:96 fprintf( g_hTrace, "=========== Colo r Mapping InfoSEI message ===========\n");94 #if Q0074_COLOUR_REMAPPING_SEI 95 case SEI::COLOUR_REMAPPING_INFO: 96 fprintf( g_hTrace, "=========== Colour Remapping Information SEI message ===========\n"); 97 97 break; 98 98 #endif … … 126 126 fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n"); 127 127 break; 128 #if !REMOVE_BSP_HRD_SEI 128 129 case SEI::BSP_HRD: 129 130 fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n"); 130 131 break; 132 #endif 131 133 #endif 132 134 #if Q0078_ADD_LAYER_SETS … … 147 149 148 150 #if O0164_MULTI_LAYER_HRD 151 #if VPS_VUI_BSP_HRD_PARAMS 152 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSeiPtr, const SEIBspNesting* bspNestingSeiPtr) 153 #else 149 154 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei) 155 #endif 150 156 #else 151 157 void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps) 152 158 #endif 153 159 { 160 #if VPS_VUI_BSP_HRD_PARAMS 161 SEIScalableNesting nestingSei; 162 SEIBspNesting bspNestingSei; 163 if( nestingSeiPtr ) 164 { 165 nestingSei = *nestingSeiPtr; 166 } 167 if( bspNestingSeiPtr ) 168 { 169 bspNestingSei = *bspNestingSeiPtr; 170 } 171 #endif 154 172 switch (sei.payloadType()) 155 173 { … … 160 178 xWriteSEIActiveParameterSets(*static_cast<const SEIActiveParameterSets*>(& sei)); 161 179 break; 180 case SEI::DECODED_PICTURE_HASH: 181 xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei)); 182 break; 183 #if VPS_VUI_BSP_HRD_PARAMS 184 case SEI::DECODING_UNIT_INFO: 185 xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps, nestingSeiPtr, bspNestingSeiPtr, vps); 186 break; 187 case SEI::BUFFERING_PERIOD: 188 xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps, nestingSeiPtr, bspNestingSeiPtr, vps); 189 break; 190 case SEI::PICTURE_TIMING: 191 xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps, nestingSeiPtr, bspNestingSeiPtr, vps); 192 break; 193 #else 162 194 case SEI::DECODING_UNIT_INFO: 163 195 xWriteSEIDecodingUnitInfo(*static_cast<const SEIDecodingUnitInfo*>(& sei), sps); 164 196 break; 165 case SEI::DECODED_PICTURE_HASH:166 xWriteSEIDecodedPictureHash(*static_cast<const SEIDecodedPictureHash*>(&sei));167 break;168 197 case SEI::BUFFERING_PERIOD: 169 198 xWriteSEIBufferingPeriod(*static_cast<const SEIBufferingPeriod*>(&sei), sps); … … 172 201 xWriteSEIPictureTiming(*static_cast<const SEIPictureTiming*>(&sei), sps); 173 202 break; 203 #endif 174 204 case SEI::RECOVERY_POINT: 175 205 xWriteSEIRecoveryPoint(*static_cast<const SEIRecoveryPoint*>(&sei)); … … 195 225 break; 196 226 #endif 197 #if Q0074_ SEI_COLOR_MAPPING198 case SEI::COLO R_MAPPING_INFO:199 xWriteSEIColo rMappingInfo(*static_cast<const SEIColorMappingInfo*>(&sei));227 #if Q0074_COLOUR_REMAPPING_SEI 228 case SEI::COLOUR_REMAPPING_INFO: 229 xWriteSEIColourRemappingInfo(*static_cast<const SEIColourRemappingInfo*>(&sei)); 200 230 break; 201 231 #endif … … 233 263 xWriteSEIBspInitialArrivalTime(*static_cast<const SEIBspInitialArrivalTime*>(&sei), vps, sps, nestingSei, bspNestingSei); 234 264 break; 265 #if !REMOVE_BSP_HRD_SEI 235 266 case SEI::BSP_HRD: 236 267 xWriteSEIBspHrd(*static_cast<const SEIBspHrd*>(&sei), sps, nestingSei); 237 268 break; 269 #endif 238 270 #endif 239 271 #if Q0078_ADD_LAYER_SETS … … 283 315 #endif 284 316 #if O0164_MULTI_LAYER_HRD 317 #if VPS_VUI_BSP_HRD_PARAMS 318 xWriteSEIpayloadData(bs_count, sei, vps, sps, nestingSei, bspNestingSei); 319 #else 285 320 xWriteSEIpayloadData(bs_count, sei, vps, sps, *nestingSei, *bspNestingSei); 321 #endif 286 322 #else 287 323 xWriteSEIpayloadData(bs_count, sei, sps); … … 322 358 323 359 #if O0164_MULTI_LAYER_HRD 360 #if VPS_VUI_BSP_HRD_PARAMS 361 xWriteSEIpayloadData(bs, sei, vps, sps, nestingSei, bspNestingSei); 362 #else 324 363 xWriteSEIpayloadData(bs, sei, vps, sps, *nestingSei, *bspNestingSei); 364 #endif 325 365 #else 326 366 xWriteSEIpayloadData(bs, sei, sps); … … 390 430 WRITE_UVLC(sei.activeSeqParameterSetId[i], "active_seq_parameter_set_id"); 391 431 } 392 xWriteByteAlign(); 393 } 394 432 #if R0247_SEI_ACTIVE 433 for (Int i = 1; i < sei.activeSeqParameterSetId.size(); i++) 434 { 435 WRITE_UVLC(sei.layerSpsIdx[i], "layer_sps_idx"); 436 } 437 #endif 438 xWriteByteAlign(); 439 } 440 441 #if VPS_VUI_BSP_HRD_PARAMS 442 Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 443 #else 395 444 Void SEIWriter::xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps) 396 { 445 #endif 446 { 447 #if VPS_VUI_BSP_HRD_PARAMS 448 TComHRD *hrd; 449 if( bspNestingSei ) // If DU info SEI contained inside a BSP nesting SEI message 450 { 451 assert( nestingSei ); 452 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 453 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 454 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 455 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 456 std::vector<Int> hrdIdx(maxValues, 0); 457 std::vector<TComHRD *> hrdVec; 458 std::vector<Int> syntaxElemLen(maxValues, 0); 459 for(Int i = 0; i < maxValues; i++) 460 { 461 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 462 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 463 464 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 465 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 466 { 467 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 468 } 469 if( i > 0 ) 470 { 471 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 472 assert( hrdVec[i]->getSubPicCpbParamsInPicTimingSEIFlag() == hrdVec[i-1]->getSubPicCpbParamsInPicTimingSEIFlag() ); 473 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 474 // To be done: Check CpbDpbDelaysPresentFlag 475 } 476 } 477 hrd = hrdVec[0]; 478 } 479 else 480 { 481 TComVUI *vui = sps->getVuiParameters(); 482 hrd = vui->getHrdParameters(); 483 } 484 #else 397 485 TComVUI *vui = sps->getVuiParameters(); 486 TComHrd *hrd = vui->getHrdParameters(); 487 #endif 398 488 WRITE_UVLC(sei.m_decodingUnitIdx, "decoding_unit_idx"); 399 if( vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag())400 { 401 WRITE_CODE( sei.m_duSptCpbRemovalDelay, ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay");489 if(hrd->getSubPicCpbParamsInPicTimingSEIFlag()) 490 { 491 WRITE_CODE( sei.m_duSptCpbRemovalDelay, (hrd->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay"); 402 492 } 403 493 WRITE_FLAG( sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag"); 404 494 if(sei.m_dpbOutputDuDelayPresentFlag) 405 495 { 406 WRITE_CODE(sei.m_picSptDpbOutputDuDelay, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay"); 407 } 408 xWriteByteAlign(); 409 } 410 496 WRITE_CODE(sei.m_picSptDpbOutputDuDelay,hrd->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay"); 497 } 498 xWriteByteAlign(); 499 } 500 501 #if VPS_VUI_BSP_HRD_PARAMS 502 Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 503 #else 411 504 Void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps) 505 #endif 412 506 { 413 507 Int i, nalOrVcl; 508 #if VPS_VUI_BSP_HRD_PARAMS 509 TComHRD *hrd; 510 if( bspNestingSei ) // If BP SEI contained inside a BSP nesting SEI message 511 { 512 assert( nestingSei ); 513 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 514 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 515 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 516 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 517 std::vector<Int> hrdIdx(maxValues, 0); 518 std::vector<TComHRD *> hrdVec; 519 std::vector<Int> syntaxElemLen(maxValues, 0); 520 for(i = 0; i < maxValues; i++) 521 { 522 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 523 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 524 525 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 526 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 527 { 528 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 529 } 530 if( i > 0 ) 531 { 532 assert( hrdVec[i]->getCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getCpbRemovalDelayLengthMinus1() ); 533 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 534 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 535 } 536 } 537 hrd = hrdVec[i]; 538 } 539 else 540 { 541 TComVUI *vui = sps->getVuiParameters(); 542 hrd = vui->getHrdParameters(); 543 } 544 // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently. 545 #else 414 546 TComVUI *vui = sps->getVuiParameters(); 415 547 TComHRD *hrd = vui->getHrdParameters(); 548 #endif 416 549 417 550 WRITE_UVLC( sei.m_bpSeqParameterSetId, "bp_seq_parameter_set_id" ); … … 452 585 xWriteByteAlign(); 453 586 } 587 #if VPS_VUI_BSP_HRD_PARAMS 588 Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps) 589 #else 454 590 Void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps) 591 #endif 455 592 { 456 593 Int i; 594 #if VPS_VUI_BSP_HRD_PARAMS 595 TComHRD *hrd; 596 TComVUI *vui = sps->getVuiParameters(); 597 if( bspNestingSei ) // If BP SEI contained inside a BSP nesting SEI message 598 { 599 assert( nestingSei ); 600 Int psIdx = bspNestingSei->m_seiPartitioningSchemeIdx; 601 Int seiOlsIdx = bspNestingSei->m_seiOlsIdx; 602 Int maxTemporalId = nestingSei->m_nestingMaxTemporalIdPlus1[0] - 1; 603 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 604 std::vector<Int> hrdIdx(maxValues, 0); 605 std::vector<TComHRD *> hrdVec; 606 std::vector<Int> syntaxElemLen(maxValues, 0); 607 for(i = 0; i < maxValues; i++) 608 { 609 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei->m_bspIdx); 610 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 611 612 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 613 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 614 { 615 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 616 } 617 if( i > 0 ) 618 { 619 assert( hrdVec[i]->getSubPicCpbParamsPresentFlag() == hrdVec[i-1]->getSubPicCpbParamsPresentFlag() ); 620 assert( hrdVec[i]->getSubPicCpbParamsInPicTimingSEIFlag() == hrdVec[i-1]->getSubPicCpbParamsInPicTimingSEIFlag() ); 621 assert( hrdVec[i]->getCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getCpbRemovalDelayLengthMinus1() ); 622 assert( hrdVec[i]->getDpbOutputDelayLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayLengthMinus1() ); 623 assert( hrdVec[i]->getDpbOutputDelayDuLengthMinus1() == hrdVec[i-1]->getDpbOutputDelayDuLengthMinus1() ); 624 assert( hrdVec[i]->getDuCpbRemovalDelayLengthMinus1() == hrdVec[i-1]->getDuCpbRemovalDelayLengthMinus1() ); 625 // To be done: Check CpbDpbDelaysPresentFlag 626 } 627 } 628 hrd = hrdVec[0]; 629 } 630 else 631 { 632 hrd = vui->getHrdParameters(); 633 } 634 // To be done: When contained in an BSP HRD SEI message, the hrd structure is to be chosen differently. 635 #else 457 636 TComVUI *vui = sps->getVuiParameters(); 458 637 TComHRD *hrd = vui->getHrdParameters(); 459 460 if( vui->getFrameFieldInfoPresentFlag() ) 638 #endif 639 640 if( vui->getFrameFieldInfoPresentFlag() ) // To be done: Check whether this is the correct invocation of vui when PT SEI contained in BSP nesting SEI 461 641 { 462 642 WRITE_CODE( sei.m_picStruct, 4, "pic_struct" ); … … 634 814 } 635 815 #endif 636 #if Q0074_SEI_COLOR_MAPPING 637 Void SEIWriter::xWriteSEIColorMappingInfo(const SEIColorMappingInfo& sei) 638 { 639 WRITE_UVLC( sei.m_colorMapId, "colour_map_id" ); 640 WRITE_FLAG( sei.m_colorMapCancelFlag, "colour_map_cancel_flag" ); 641 if( !sei.m_colorMapCancelFlag ) 642 { 643 WRITE_FLAG( sei.m_colorMapPersistenceFlag, "colour_map_persistence_flag" ); 644 WRITE_FLAG( sei.m_colorMap_video_signal_type_present_flag, "colour_map_video_signal_type_present_flag" ); 645 if ( sei.m_colorMap_video_signal_type_present_flag ) 646 { 647 WRITE_FLAG( sei.m_colorMap_video_full_range_flag, "colour_map_video_full_range_flag" ); 648 WRITE_CODE( sei.m_colorMap_primaries, 8, "colour_map_primaries" ); 649 WRITE_CODE( sei.m_colorMap_transfer_characteristics, 8, "colour_map_transfer_characteristics" ); 650 WRITE_CODE( sei.m_colorMap_matrix_coeffs, 8, "colour_map_matrix_coeffs" ); 651 } 652 } 653 654 WRITE_CODE( sei.m_colour_map_coded_data_bit_depth, 5, "colour_map_coded_data_bit_depth" ); 655 WRITE_CODE( sei.m_colour_map_target_bit_depth, 5, "colour_map_target_bit_depth" ); 656 WRITE_UVLC( sei.m_colorMapModelId, "colour_map_model_id" ); 657 658 assert( sei.m_colorMapModelId == 0 ); 659 660 for( Int i=0 ; i<3 ; i++ ) 661 { 662 WRITE_CODE( sei.m_num_input_pivots[i] - 1, 8, "num_input_pivots_minus1[i]" ); 663 for( Int j=0 ; j<sei.m_num_input_pivots[i] ; j++ ) 664 { 665 WRITE_CODE( sei.m_coded_input_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "coded_input_pivot_value[i][j]" ); 666 WRITE_CODE( sei.m_target_input_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "target_input_pivot_value[i][j]" ); 667 } 668 } 669 670 WRITE_FLAG( sei.m_matrix_flag, "matrix_flag" ); 671 if( sei.m_matrix_flag ) 672 { 673 WRITE_CODE( sei.m_log2_matrix_denom, 4, "log2_matrix_denom" ); 674 for( Int i=0 ; i<3 ; i++ ) 675 { 676 for( Int j=0 ; j<3 ; j++ ) 677 { 678 WRITE_SVLC( sei.m_matrix_coef[i][j], "matrix_coef[i][j]" ); 679 } 680 } 681 } 682 683 for( Int i=0 ; i<3 ; i++ ) 684 { 685 WRITE_CODE( sei.m_num_output_pivots[i] - 1, 8, "num_output_pivots_minus1[i]" ); 686 for( Int j=0 ; j<sei.m_num_output_pivots[i] ; j++ ) 687 { 688 WRITE_CODE( sei.m_coded_output_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "coded_output_pivot_value[i][j]" ); 689 WRITE_CODE( sei.m_target_output_pivot_value[i][j], (( sei.m_colour_map_coded_data_bit_depth + 7 ) >> 3 ) << 3, "target_output_pivot_value[i][j]" ); 690 } 691 } 692 816 #if Q0074_COLOUR_REMAPPING_SEI 817 Void SEIWriter::xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei) 818 { 819 WRITE_UVLC( sei.m_colourRemapId, "colour_remap_id" ); 820 WRITE_FLAG( sei.m_colourRemapCancelFlag, "colour_remap_cancel_flag" ); 821 if( !sei.m_colourRemapCancelFlag ) 822 { 823 WRITE_FLAG( sei.m_colourRemapPersistenceFlag, "colour_remap_persistence_flag" ); 824 WRITE_FLAG( sei.m_colourRemapVideoSignalInfoPresentFlag, "colour_remap_video_signal_info_present_flag" ); 825 if ( sei.m_colourRemapVideoSignalInfoPresentFlag ) 826 { 827 WRITE_FLAG( sei.m_colourRemapFullRangeFlag, "colour_remap_full_range_flag" ); 828 WRITE_CODE( sei.m_colourRemapPrimaries, 8, "colour_remap_primaries" ); 829 WRITE_CODE( sei.m_colourRemapTransferFunction, 8, "colour_remap_transfer_function" ); 830 WRITE_CODE( sei.m_colourRemapMatrixCoefficients, 8, "colour_remap_matrix_coefficients" ); 831 } 832 WRITE_CODE( sei.m_colourRemapInputBitDepth, 8, "colour_remap_input_bit_depth" ); 833 WRITE_CODE( sei.m_colourRemapBitDepth, 8, "colour_remap_bit_depth" ); 834 for( Int c=0 ; c<3 ; c++ ) 835 { 836 WRITE_CODE( sei.m_preLutNumValMinus1[c], 8, "pre_lut_num_val_minus1[c]" ); 837 if( sei.m_preLutNumValMinus1[c]>0 ) 838 for( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ ) 839 { 840 WRITE_CODE( sei.m_preLutCodedValue[c][i], (( sei.m_colourRemapInputBitDepth + 7 ) >> 3 ) << 3, "pre_lut_coded_value[c][i]" ); 841 WRITE_CODE( sei.m_preLutTargetValue[c][i], (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "pre_lut_target_value[c][i]" ); 842 } 843 } 844 WRITE_FLAG( sei.m_colourRemapMatrixPresentFlag, "colour_remap_matrix_present_flag" ); 845 if( sei.m_colourRemapMatrixPresentFlag ) 846 { 847 WRITE_CODE( sei.m_log2MatrixDenom, 4, "log2_matrix_denom" ); 848 for( Int c=0 ; c<3 ; c++ ) 849 for( Int i=0 ; i<3 ; i++ ) 850 WRITE_SVLC( sei.m_colourRemapCoeffs[c][i], "colour_remap_coeffs[c][i]" ); 851 } 852 853 for( Int c=0 ; c<3 ; c++ ) 854 { 855 WRITE_CODE( sei.m_postLutNumValMinus1[c], 8, "m_postLutNumValMinus1[c]" ); 856 if( sei.m_postLutNumValMinus1[c]>0 ) 857 for( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ ) 858 { 859 WRITE_CODE( sei.m_postLutCodedValue[c][i], (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "post_lut_coded_value[c][i]" ); 860 WRITE_CODE( sei.m_postLutTargetValue[c][i], (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, "post_lut_target_value[c][i]" ); 861 } 862 } 863 } 693 864 xWriteByteAlign(); 694 865 } … … 753 924 { 754 925 WRITE_FLAG( sei.m_defaultOpFlag, "default_op_flag" ); 755 WRITE_UVLC( sei.m_nestingNumOpsMinus1, "nesting_num_ops ");926 WRITE_UVLC( sei.m_nestingNumOpsMinus1, "nesting_num_ops_minus1" ); 756 927 for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++) 757 928 { 758 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" ); 759 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id" ); 929 WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3, "nesting_max_temporal_id_plus1" ); 760 930 WRITE_UVLC( sei.m_nestingOpIdx[i], "nesting_op_idx" ); 761 931 } … … 766 936 if (!sei.m_allLayersFlag) 767 937 { 768 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id " );769 WRITE_UVLC( sei.m_nestingNumLayersMinus1, "nesting_num_layers" );938 WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id_plus1" ); 939 WRITE_UVLC( sei.m_nestingNumLayersMinus1, "nesting_num_layers" ); 770 940 for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) 771 941 { … … 901 1071 WRITE_FLAG( 0, "bsp_nesting_zero_bit" ); 902 1072 } 903 1073 #if NESTING_SEI_EXTENSIBILITY 1074 assert( sei.m_nestedSEIs.size() <= MAX_SEIS_IN_BSP_NESTING ); 1075 WRITE_UVLC( sei.m_nestedSEIs.size(), "num_seis_in_bsp_minus1" ); 1076 #endif 904 1077 // write nested SEI messages 905 1078 for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++) … … 913 1086 assert(vps->getVpsVuiPresentFlag()); 914 1087 1088 #if VPS_VUI_BSP_HRD_PARAMS 1089 Int psIdx = bspNestingSei.m_seiPartitioningSchemeIdx; 1090 Int seiOlsIdx = bspNestingSei.m_seiOlsIdx; 1091 Int maxTemporalId = nestingSei.m_nestingMaxTemporalIdPlus1[0] - 1; 1092 Int maxValues = vps->getNumBspSchedulesMinus1(seiOlsIdx, psIdx, maxTemporalId) + 1; 1093 std::vector<Int> hrdIdx(maxValues, 0); 1094 std::vector<TComHRD *> hrdVec; 1095 std::vector<Int> syntaxElemLen(maxValues, 0); 1096 for(Int i = 0; i < maxValues; i++) 1097 { 1098 hrdIdx[i] = vps->getBspHrdIdx( seiOlsIdx, psIdx, maxTemporalId, i, bspNestingSei.m_bspIdx); 1099 hrdVec.push_back(vps->getBspHrd(hrdIdx[i])); 1100 1101 syntaxElemLen[i] = hrdVec[i]->getInitialCpbRemovalDelayLengthMinus1() + 1; 1102 if ( !(hrdVec[i]->getNalHrdParametersPresentFlag() || hrdVec[i]->getVclHrdParametersPresentFlag()) ) 1103 { 1104 assert( syntaxElemLen[i] == 24 ); // Default of value init_cpb_removal_delay_length_minus1 is 23 1105 } 1106 if( i > 0 ) 1107 { 1108 assert( hrdVec[i]->getNalHrdParametersPresentFlag() == hrdVec[i-1]->getNalHrdParametersPresentFlag() ); 1109 assert( hrdVec[i]->getVclHrdParametersPresentFlag() == hrdVec[i-1]->getVclHrdParametersPresentFlag() ); 1110 } 1111 } 1112 if (hrdVec[0]->getNalHrdParametersPresentFlag()) 1113 { 1114 for(UInt i = 0; i < maxValues; i++) 1115 { 1116 WRITE_CODE( sei.m_nalInitialArrivalDelay[i], syntaxElemLen[i], "nal_initial_arrival_delay[i]" ); 1117 } 1118 } 1119 if( hrdVec[0]->getVclHrdParametersPresentFlag() ) 1120 { 1121 for(UInt i = 0; i < maxValues; i++) 1122 { 1123 WRITE_CODE( sei.m_vclInitialArrivalDelay[i], syntaxElemLen[i], "vcl_initial_arrival_delay[i]" ); 1124 } 1125 } 1126 #else 915 1127 UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]); 916 1128 UInt len; … … 944 1156 } 945 1157 } 1158 #if BSP_INIT_ARRIVAL_SEI 1159 if( hrd->getVclHrdParametersPresentFlag() ) 1160 #else 946 1161 else 1162 #endif 947 1163 { 948 1164 for(UInt i = 0; i < schedCombCnt; i++) … … 951 1167 } 952 1168 } 953 } 954 1169 #endif 1170 } 1171 1172 #if !REMOVE_BSP_HRD_SEI 955 1173 Void SEIWriter::xWriteSEIBspHrd(const SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei) 956 1174 { … … 1004 1222 } 1005 1223 } 1224 #endif 1006 1225 1007 1226 Void SEIWriter::xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 ) -
trunk/source/Lib/TLibEncoder/SEIwrite.h
r815 r906 55 55 protected: 56 56 #if O0164_MULTI_LAYER_HRD 57 #if VPS_VUI_BSP_HRD_PARAMS 58 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei); 59 #else 57 60 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei); 61 #endif 58 62 #else 59 63 Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps); … … 61 65 Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); 62 66 Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei); 67 Void xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei); 68 #if VPS_VUI_BSP_HRD_PARAMS 69 Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 70 Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 71 Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei, TComVPS *vps); 72 #else 63 73 Void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& sei, TComSPS *sps); 64 Void xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei);65 74 Void xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei, TComSPS *sps); 66 75 Void xWriteSEIPictureTiming(const SEIPictureTiming& sei, TComSPS *sps); 76 #endif 67 77 TComSPS *m_pSPS; 68 78 Void xWriteSEIRecoveryPoint(const SEIRecoveryPoint& sei); … … 75 85 Void xWriteSEIKneeFunctionInfo(const SEIKneeFunctionInfo &sei); 76 86 #endif 77 #if Q0074_ SEI_COLOR_MAPPING78 Void xWriteSEIColo rMappingInfo(const SEIColorMappingInfo& sei);87 #if Q0074_COLOUR_REMAPPING_SEI 88 Void xWriteSEIColourRemappingInfo(const SEIColourRemappingInfo& sei); 79 89 #endif 80 90 Void xWriteSEISOPDescription(const SEISOPDescription& sei); … … 104 114 Void xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei); 105 115 Void xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei); 116 #if !REMOVE_BSP_HRD_SEI 106 117 Void xWriteSEIBspHrd(const SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei); 118 #endif 107 119 Void xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 ); 108 120 #endif -
trunk/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp
r815 r906 14 14 m_pColorInfoC = NULL; 15 15 m_pEncCuboid = NULL; 16 16 17 m_pBestEncCuboid = NULL; 18 #if R0151_CGS_3D_ASYMLUT_IMPROVE 19 m_nAccuFrameBit = 0; 20 m_nAccuFrameCGSBit = 0; 21 m_nPrevFrameCGSPartNumLog2 = 0; 22 #else 17 23 memset( m_nPrevFrameBit , 0 , sizeof( m_nPrevFrameBit ) ); 18 24 memset( m_nPrevFrameCGSBit , 0 , sizeof( m_nPrevFrameCGSBit ) ); 19 25 memset( m_nPrevFrameCGSPartNumLog2 , 0 , sizeof( m_nPrevFrameCGSPartNumLog2 ) ); 20 26 memset( m_nPrevFrameOverWritePPS , 0 , sizeof( m_nPrevFrameOverWritePPS ) ); 27 #endif 21 28 m_dTotalFrameBit = 0; 22 29 m_nTotalCGSBit = 0; 23 30 m_nPPSBit = 0; 24 31 m_pDsOrigPic = NULL; 32 #if R0179_ENC_OPT_3DLUT_SIZE 33 m_pMaxColorInfo = NULL; 34 m_pMaxColorInfoC = NULL; 35 36 37 // fixed m_dDistFactor 38 Double dTmpFactor[3]; 39 dTmpFactor[I_SLICE] = 1.0; 40 dTmpFactor[P_SLICE] = 4./3.; 41 dTmpFactor[B_SLICE] = 1.5; 42 for( Int iSliceType = 0; iSliceType < 3; iSliceType++) 43 { 44 for(Int iLayer = 0; iLayer < MAX_TLAYER; iLayer++) 45 { 46 m_dDistFactor[iSliceType][iLayer] = dTmpFactor[iSliceType]*(Double)(1<<iLayer); 47 } 48 } 49 // initialization with approximate number of bits to code the LUT 50 m_nNumLUTBits[0][0] = 200; // 1x1x1 51 m_nNumLUTBits[1][0] = 400; // 2x1x1 52 m_nNumLUTBits[1][1] = 1500; // 2x2x2 53 m_nNumLUTBits[2][0] = 800; // 4x1x1 54 m_nNumLUTBits[2][1] = 3200; // 4x2x2 55 m_nNumLUTBits[2][2] = 8500; // 4x4x4 56 m_nNumLUTBits[3][0] = 1200; // 8x1x1 57 m_nNumLUTBits[3][1] = 4500; // 8x2x2 58 m_nNumLUTBits[3][2] = 10000; // 8x4x4 59 m_nNumLUTBits[3][3] = 12000; // 8x8x8 60 #endif 25 61 } 26 62 … … 32 68 } 33 69 34 TCom3DAsymLUT::create( nMaxOctantDepth , nInputBitDepth , nInputBitDepthC, nOutputBitDepth , nOutputBitDepthC, nMaxYPartNumLog2 ); 70 TCom3DAsymLUT::create( nMaxOctantDepth , nInputBitDepth , nInputBitDepthC, nOutputBitDepth , nOutputBitDepthC, nMaxYPartNumLog2 71 #if R0151_CGS_3D_ASYMLUT_IMPROVE 72 , 1 << ( nInputBitDepthC - 1 ) , 1 << ( nInputBitDepthC - 1 ) 73 #endif 74 ); 35 75 xAllocate3DArray( m_pColorInfo , xGetYSize() , xGetUSize() , xGetVSize() ); 36 76 xAllocate3DArray( m_pColorInfoC , xGetYSize() , xGetUSize() , xGetVSize() ); 37 77 xAllocate3DArray( m_pEncCuboid , xGetYSize() , xGetUSize() , xGetVSize() ); 38 78 xAllocate3DArray( m_pBestEncCuboid , xGetYSize() , xGetUSize() , xGetVSize() ); 79 #if R0179_ENC_OPT_3DLUT_SIZE 80 xAllocate3DArray( m_pMaxColorInfo , xGetYSize() , xGetUSize() , xGetVSize() ); 81 xAllocate3DArray( m_pMaxColorInfoC , xGetYSize() , xGetUSize() , xGetVSize() ); 82 83 m_pEncCavlc = new TEncCavlc; 84 m_pBitstreamRedirect = new TComOutputBitstream; 85 m_pEncCavlc->setBitstream(m_pBitstreamRedirect); 86 #endif 39 87 } 40 88 … … 45 93 xFree3DArray( m_pEncCuboid ); 46 94 xFree3DArray( m_pBestEncCuboid ); 95 #if R0179_ENC_OPT_3DLUT_SIZE 96 xFree3DArray( m_pMaxColorInfo ); 97 xFree3DArray( m_pMaxColorInfoC ); 98 delete m_pBitstreamRedirect; 99 delete m_pEncCavlc; 100 #endif 47 101 TCom3DAsymLUT::destroy(); 48 102 } … … 58 112 } 59 113 114 #if R0151_CGS_3D_ASYMLUT_IMPROVE 115 Double TEnc3DAsymLUT::xxDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 116 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ) 117 { 118 Int nInitP0 = rP0; 119 Int nInitP1 = rP1; 120 Int nInitP3 = rP3; 121 Int nInitP7 = rP7; 122 123 const Int nOne = xGetNormCoeffOne(); 124 Double dNorm = (N * yy * vv * uu - N * yy * uv * uv - N * yv * yv * uu - N * vv * yu * yu + 2 * N * yv * uv * yu - yy * vs * vs * uu + 2 * yy * vs * uv * us - yy * vv * us * us - 2 * vs * uv * yu * ys + uv * uv * ys * ys + vs * vs * yu * yu - 2 * yv * vs * us * yu + 2 * yv * vs * ys * uu - 2 * yv * uv * us * ys + 2 * vv * yu * ys * us - vv * uu * ys * ys + yv * yv * us * us); 125 if( N > 16 && dNorm != 0 ) 126 { 127 Double dInitA = (-N * uu * yv * Yv + N * uu * Yy * vv - N * Yy * uv * uv + N * yv * uv * Yu - N * yu * Yu * vv + N * yu * uv * Yv + yu * us * Ys * vv - vs * ys * uv * Yu - yu * vs * us * Yv - yv * uv * us * Ys - yv * vs * us * Yu - yu * uv * vs * Ys - ys * us * uv * Yv + ys * us * Yu * vv + 2 * Yy * vs * uv * us + uu * yv * vs * Ys - uu * ys * Ys * vv + uu * vs * ys * Yv + ys * Ys * uv * uv - Yy * vv * us * us + yu * Yu * vs * vs + yv * Yv * us * us - uu * Yy * vs * vs) / dNorm; 128 Double dInitB = (N * yy * Yu * vv - N * yy * uv * Yv - N * Yu * yv * yv - N * yu * Yy * vv + N * uv * yv * Yy + N * yv * yu * Yv - yy * us * Ys * vv + yy * uv * vs * Ys - yy * Yu * vs * vs + yy * vs * us * Yv - uv * vs * ys * Yy - yv * yu * vs * Ys + yu * Yy * vs * vs + yu * ys * Ys * vv - uv * yv * ys * Ys + 2 * Yu * yv * vs * ys + us * ys * Yy * vv - vs * ys * yu * Yv + uv * ys * ys * Yv + us * Ys * yv * yv - Yu * ys * ys * vv - yv * ys * us * Yv - vs * us * yv * Yy) / dNorm; 129 Double dInitC = -(-N * yy * Yv * uu + N * yy * uv * Yu - N * yv * yu * Yu - N * uv * yu * Yy + N * Yv * yu * yu + N * yv * Yy * uu - yy * uv * us * Ys + yy * Yv * us * us + yy * vs * Ys * uu - yy * vs * us * Yu + yv * ys * us * Yu - vs * Ys * yu * yu - yv * ys * Ys * uu + vs * us * yu * Yy + vs * ys * yu * Yu - uv * Yu * ys * ys + Yv * uu * ys * ys - yv * Yy * us * us - 2 * Yv * yu * ys * us - vs * ys * Yy * uu + uv * us * ys * Yy + uv * yu * ys * Ys + yv * yu * us * Ys) / dNorm; 130 nInitP0 = ( Int )( dInitA * nOne + 0.5 ) >> nResQuantBit << nResQuantBit; 131 nInitP1 = ( Int )( dInitB * nOne + 0.5 ) >> nResQuantBit << nResQuantBit; 132 nInitP3 = ( Int )( dInitC * nOne + 0.5 ) >> nResQuantBit << nResQuantBit; 133 } 134 135 Int nMin = - ( 1 << ( m_nLUTBitDepth - 1 ) ); 136 Int nMax = - nMin - ( 1 << nResQuantBit ); 137 Int nMask = ( 1 << nResQuantBit ) - 1; 138 139 Double dMinError = MAX_DOUBLE; 140 Int nTestRange = 2; 141 Int nStepSize = 1 << nResQuantBit; 142 for( Int i = - nTestRange ; i <= nTestRange ; i++ ) 143 { 144 for( Int j = - nTestRange ; j <= nTestRange ; j++ ) 145 { 146 for( Int k = - nTestRange ; k <= nTestRange ; k++ ) 147 { 148 Int nTestP0 = Clip3( nMin , nMax , nInitP0 + i * nStepSize ); 149 Int nTestP1 = Clip3( nMin , nMax , nInitP1 + j * nStepSize ); 150 Int nTestP3 = Clip3( nMin , nMax , nInitP3 + k * nStepSize ); 151 Double a = 1.0 * nTestP0 / nOne; 152 Double b = 1.0 * nTestP1 / nOne; 153 Double c = 1.0 * nTestP3 / nOne; 154 Double d = ( Ys - a * ys - b * us - c * vs ) / N; 155 nInitP7 = ( ( Int )d ) >> nResQuantBit << nResQuantBit; 156 for( Int m = 0 ; m < 2 ; m++ ) 157 { 158 Int nTestP7 = Clip3( nMin , nMax , nInitP7 + m * nStepSize ); 159 Double dError = xxCalEstDist( N , Ys , Yy , Yu , Yv , ys , us , vs , yy , yu , yv , uu , uv , vv , YY , a , b , c , nTestP7 ); 160 if( dError < dMinError ) 161 { 162 dMinError = dError; 163 rP0 = ( Pel )nTestP0; 164 rP1 = ( Pel )nTestP1; 165 rP3 = ( Pel )nTestP3; 166 rP7 = ( Pel )nTestP7; 167 } 168 } 169 } 170 } 171 } 172 assert( !( rP0 & nMask ) && !( rP1 & nMask ) && !( rP3 & nMask ) && !( rP7 & nMask ) ); 173 174 return( dMinError ); 175 } 176 #else 60 177 Double TEnc3DAsymLUT::xxDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 61 178 Int y0 , Int u0 , Int v0 , Int nLengthY , Int nLengthUV , … … 134 251 return( dMinError ); 135 252 } 136 253 #endif 254 255 #if R0151_CGS_3D_ASYMLUT_IMPROVE 256 Double TEnc3DAsymLUT::estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc ) 257 { 258 xxCollectData( pCurPic , refLayerIdc ); 259 260 Double dErrorLuma = 0 , dErrorChroma = 0; 261 Int nYSize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 262 Int nUVSize = 1 << getCurOctantDepth(); 263 for( Int yIdx = 0 ; yIdx < nYSize ; yIdx++ ) 264 { 265 for( Int uIdx = 0 ; uIdx < nUVSize ; uIdx++ ) 266 { 267 for( Int vIdx = 0 ; vIdx < nUVSize ; vIdx++ ) 268 { 269 SColorInfo & rCuboidColorInfo = m_pColorInfo[yIdx][uIdx][vIdx]; 270 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[yIdx][uIdx][vIdx]; 271 SCuboid & rCuboid = xGetCuboid( yIdx , uIdx , vIdx ); 272 if( rCuboidColorInfo.N > 0 ) 273 { 274 dErrorLuma += xxCalEstDist( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY , 275 rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y ); 276 } 277 if( rCuboidColorInfoC.N > 0 ) 278 { 279 dErrorChroma += xxCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU , 280 rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U ); 281 dErrorChroma += xxCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV , 282 rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V ); 283 } 284 } 285 } 286 } 287 288 return( dErrorLuma + dErrorChroma); 289 } 290 #else 137 291 Double TEnc3DAsymLUT::estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc ) 138 292 { … … 174 328 return( dErrorLuma + dErrorChroma); 175 329 } 176 330 #endif 331 332 #if R0151_CGS_3D_ASYMLUT_IMPROVE 333 #if R0179_ENC_OPT_3DLUT_SIZE 334 Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB, Double dFrameLambda ) 335 { 336 m_nLUTBitDepth = pCfg->getCGSLUTBit(); 337 338 Int nBestAdaptCThresholdU = 1 << ( getInputBitDepthC() - 1 ); 339 Int nBestAdaptCThresholdV = 1 << ( getInputBitDepthC() - 1 ); 340 Int nAdaptCThresholdU, nAdaptCThresholdV; 341 342 Int nTmpLutBits[MAX_Y_SIZE][MAX_C_SIZE] ; 343 memset(nTmpLutBits, 0, sizeof(nTmpLutBits)); 344 345 SLUTSize sMaxLutSize; 346 347 // collect stats for the most partitions 348 Int nCurYPartNumLog2 = 0 , nCurOctantDepth = 0; 349 Int nMaxPartNumLog2 = xGetMaxPartNumLog2(); 350 351 xxMapPartNum2DepthYPart( nMaxPartNumLog2 , nCurOctantDepth , nCurYPartNumLog2 ); 352 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2, nBestAdaptCThresholdU, nBestAdaptCThresholdV ); 353 xxCollectData( pCurPic , refLayerIdc ); 354 xxCopyColorInfo(m_pMaxColorInfo, m_pColorInfo, m_pMaxColorInfoC, m_pColorInfoC); 355 356 sMaxLutSize.iCPartNumLog2 = nCurOctantDepth; 357 sMaxLutSize.iYPartNumLog2 = nCurOctantDepth + nCurYPartNumLog2; 358 359 m_pBitstreamRedirect->clear(); 360 361 // find the best partition based on RD cost 362 Int i; 363 Double dMinCost, dCurCost; 364 365 Int iBestLUTSizeIdx = 0; 366 Int nBestResQuanBit = 0; 367 Double dCurError, dMinError; 368 Int iNumBitsCurSize; 369 Int iNumBitsCurSizeSave = m_pEncCavlc->getNumberOfWrittenBits(); 370 Double dDistFactor = getDistFactor(pSlice->getSliceType(), pSlice->getDepth()); 371 372 // check all LUT sizes 373 xxGetAllLutSizes(pSlice); 374 if (m_nTotalLutSizes == 0) // return if no valid size is found, LUT will not be updated 375 { 376 nCurOctantDepth = sMaxLutSize.iCPartNumLog2; 377 nCurYPartNumLog2 = sMaxLutSize.iYPartNumLog2-nCurOctantDepth; 378 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2, nBestAdaptCThresholdU, nBestAdaptCThresholdV ); 379 return MAX_DOUBLE; 380 } 381 382 dMinCost = MAX_DOUBLE; dMinError = MAX_DOUBLE; 383 for (i = 0; i < m_nTotalLutSizes; i++) 384 { 385 // add up the stats 386 nCurOctantDepth = m_sLutSizes[i].iCPartNumLog2; 387 nCurYPartNumLog2 = m_sLutSizes[i].iYPartNumLog2-nCurOctantDepth; 388 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2, nBestAdaptCThresholdU, nBestAdaptCThresholdV ); 389 xxConsolidateData( &m_sLutSizes[i], &sMaxLutSize ); 390 391 dCurError = xxDeriveVertexes(nBestResQuanBit, m_pEncCuboid); 392 393 setResQuantBit( nBestResQuanBit ); 394 xSaveCuboids( m_pEncCuboid ); 395 m_pEncCavlc->xCode3DAsymLUT( this ); 396 iNumBitsCurSize = m_pEncCavlc->getNumberOfWrittenBits(); 397 dCurCost = dCurError/dDistFactor + dFrameLambda*(Double)(iNumBitsCurSize-iNumBitsCurSizeSave); 398 nTmpLutBits[m_sLutSizes[i].iYPartNumLog2][m_sLutSizes[i].iCPartNumLog2] = iNumBitsCurSize-iNumBitsCurSizeSave; // store LUT size 399 iNumBitsCurSizeSave = iNumBitsCurSize; 400 if(dCurCost < dMinCost ) 401 { 402 SCuboid *** tmp = m_pBestEncCuboid; 403 m_pBestEncCuboid = m_pEncCuboid; 404 m_pEncCuboid = tmp; 405 dMinCost = dCurCost; 406 dMinError = dCurError; 407 iBestLUTSizeIdx = i; 408 } 409 } 410 411 nCurOctantDepth = m_sLutSizes[iBestLUTSizeIdx].iCPartNumLog2; 412 nCurYPartNumLog2 = m_sLutSizes[iBestLUTSizeIdx].iYPartNumLog2-nCurOctantDepth; 413 414 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2, nBestAdaptCThresholdU, nBestAdaptCThresholdV ); 415 416 Bool bUseNewColorInfo = false; 417 if( pCfg->getCGSAdaptChroma() && nCurOctantDepth <= 1 ) // if the best size found so far has depth = 0 or 1, then check AdaptC U/V thresholds 418 { 419 nAdaptCThresholdU = ( Int )( m_dSumU / m_nNChroma + 0.5 ); 420 nAdaptCThresholdV = ( Int )( m_dSumV / m_nNChroma + 0.5 ); 421 if( !(nAdaptCThresholdU == nBestAdaptCThresholdU && nAdaptCThresholdV == nBestAdaptCThresholdV ) ) 422 { 423 nCurOctantDepth = 1; 424 if( nCurOctantDepth + nCurYPartNumLog2 > getMaxYPartNumLog2()+getMaxOctantDepth() ) 425 nCurYPartNumLog2 = getMaxYPartNumLog2()+getMaxOctantDepth()-nCurOctantDepth; 426 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2 , nAdaptCThresholdU , nAdaptCThresholdV ); 427 xxCollectData( pCurPic , refLayerIdc ); 428 429 dCurError = xxDeriveVertexes( nBestResQuanBit , m_pEncCuboid ) ; 430 setResQuantBit( nBestResQuanBit ); 431 xSaveCuboids( m_pEncCuboid ); 432 m_pEncCavlc->xCode3DAsymLUT( this ); 433 iNumBitsCurSize = m_pEncCavlc->getNumberOfWrittenBits(); 434 dCurCost = dCurError/dDistFactor + dFrameLambda*(Double)(iNumBitsCurSize-iNumBitsCurSizeSave); 435 iNumBitsCurSizeSave = iNumBitsCurSize; 436 if(dCurCost < dMinCost ) 437 { 438 SCuboid *** tmp = m_pBestEncCuboid; 439 m_pBestEncCuboid = m_pEncCuboid; 440 m_pEncCuboid = tmp; 441 dMinCost = dCurCost; 442 dMinError = dCurError; 443 nBestAdaptCThresholdU = nAdaptCThresholdU; 444 nBestAdaptCThresholdV = nAdaptCThresholdV; 445 bUseNewColorInfo = true; 446 } 447 } 448 } 449 450 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2, nBestAdaptCThresholdU, nBestAdaptCThresholdV ); 451 452 // check res_quant_bits only for the best table size and best U/V threshold 453 if( !bUseNewColorInfo ) 454 xxConsolidateData( &m_sLutSizes[iBestLUTSizeIdx], &sMaxLutSize ); 455 456 // xxCollectData( pCurPic , refLayerIdc ); 457 for( Int nResQuanBit = 1 ; nResQuanBit < 4 ; nResQuanBit++ ) 458 { 459 dCurError = xxDeriveVertexes( nResQuanBit , m_pEncCuboid ); 460 461 setResQuantBit( nResQuanBit ); 462 xSaveCuboids( m_pEncCuboid ); 463 m_pEncCavlc->xCode3DAsymLUT( this ); 464 iNumBitsCurSize = m_pEncCavlc->getNumberOfWrittenBits(); 465 dCurCost = dCurError/dDistFactor + dFrameLambda*(Double)(iNumBitsCurSize-iNumBitsCurSizeSave); 466 467 iNumBitsCurSizeSave = iNumBitsCurSize; 468 if(dCurCost < dMinCost) 469 { 470 nBestResQuanBit = nResQuanBit; 471 SCuboid *** tmp = m_pBestEncCuboid; 472 m_pBestEncCuboid = m_pEncCuboid; 473 m_pEncCuboid = tmp; 474 dMinCost = dCurCost; 475 dMinError = dCurError; 476 } 477 else 478 { 479 break; 480 } 481 } 482 483 setResQuantBit( nBestResQuanBit ); 484 xSaveCuboids( m_pBestEncCuboid ); 485 486 // update LUT size stats 487 for(Int iLutSizeY = 0; iLutSizeY < MAX_Y_SIZE; iLutSizeY++) 488 { 489 for(Int iLutSizeC = 0; iLutSizeC < MAX_C_SIZE; iLutSizeC++) 490 { 491 if(nTmpLutBits[iLutSizeY][iLutSizeC] != 0) 492 m_nNumLUTBits[iLutSizeY][iLutSizeC] = (m_nNumLUTBits[iLutSizeY][iLutSizeC] + nTmpLutBits[iLutSizeY][iLutSizeC]*3+2)>>2; // update with new stats 493 } 494 } 495 496 // return cost rather than error 497 return( dMinCost ); 498 } 499 #endif 500 501 502 Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB ) 503 { 504 m_nLUTBitDepth = pCfg->getCGSLUTBit(); 505 Int nCurYPartNumLog2 = 0 , nCurOctantDepth = 0; 506 xxDerivePartNumLog2( pSlice , pCfg , nCurOctantDepth , nCurYPartNumLog2 , bSignalPPS , bElRapSliceTypeB ); 507 508 Int nBestResQuanBit = 0; 509 Int nBestAdaptCThresholdU = 1 << ( getInputBitDepthC() - 1 ); 510 Int nBestAdaptCThresholdV = 1 << ( getInputBitDepthC() - 1 ); 511 Int nBestOctantDepth = nCurOctantDepth; 512 Int nBestYPartNumLog2 = nCurYPartNumLog2; 513 Int nTargetLoop = 1 + ( pCfg->getCGSAdaptChroma() && ( nCurOctantDepth == 1 || ( nCurOctantDepth * 3 + nCurYPartNumLog2 ) >= 5 ) ); 514 Double dMinError = MAX_DOUBLE; 515 for( Int nLoop = 0 ; nLoop < nTargetLoop ; nLoop++ ) 516 { 517 Int nAdaptCThresholdU = 1 << ( getInputBitDepthC() - 1 ); 518 Int nAdaptCThresholdV = 1 << ( getInputBitDepthC() - 1 ); 519 if( nLoop > 0 ) 520 { 521 nAdaptCThresholdU = ( Int )( m_dSumU / m_nNChroma + 0.5 ); 522 nAdaptCThresholdV = ( Int )( m_dSumV / m_nNChroma + 0.5 ); 523 if( nCurOctantDepth > 1 ) 524 { 525 nCurOctantDepth = 1; 526 nCurYPartNumLog2 = 2; 527 } 528 if( nAdaptCThresholdU == nBestAdaptCThresholdU && nAdaptCThresholdV == nBestAdaptCThresholdV 529 && nCurOctantDepth == nBestOctantDepth && nCurYPartNumLog2 == nBestYPartNumLog2 ) 530 break; 531 } 532 533 xUpdatePartitioning( nCurOctantDepth , nCurYPartNumLog2 , nAdaptCThresholdU , nAdaptCThresholdV ); 534 xxCollectData( pCurPic , refLayerIdc ); 535 for( Int nResQuanBit = 0 ; nResQuanBit < 4 ; nResQuanBit++ ) 536 { 537 Double dError = xxDeriveVertexes( nResQuanBit , m_pEncCuboid ) / ( 1 + ( nResQuanBit > 0 ) * 0.001 * ( pSlice->getDepth() + 1 ) ); 538 if( dError <= dMinError ) 539 { 540 nBestResQuanBit = nResQuanBit; 541 nBestAdaptCThresholdU = nAdaptCThresholdU; 542 nBestAdaptCThresholdV = nAdaptCThresholdV; 543 nBestOctantDepth = nCurOctantDepth; 544 nBestYPartNumLog2 = nCurYPartNumLog2; 545 SCuboid *** tmp = m_pBestEncCuboid; 546 m_pBestEncCuboid = m_pEncCuboid; 547 m_pEncCuboid = tmp; 548 dMinError = dError; 549 } 550 else 551 { 552 break; 553 } 554 } 555 } 556 557 setResQuantBit( nBestResQuanBit ); 558 xUpdatePartitioning( nBestOctantDepth , nBestYPartNumLog2 , nBestAdaptCThresholdU , nBestAdaptCThresholdV ); 559 560 xSaveCuboids( m_pBestEncCuboid ); 561 return( dMinError ); 562 } 563 #else 177 564 Double TEnc3DAsymLUT::derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB ) 178 565 { … … 204 591 setResQuantBit( nBestResQuanBit ); 205 592 xSaveCuboids( m_pBestEncCuboid ); 206 207 593 return( dCurError ); 208 594 } 595 #endif 209 596 210 597 Double TEnc3DAsymLUT::xxDeriveVertexes( Int nResQuanBit , SCuboid *** pCurCuboid ) … … 213 600 Int nYSize = 1 << ( getCurOctantDepth() + getCurYPartNumLog2() ); 214 601 Int nUVSize = 1 << getCurOctantDepth(); 602 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 215 603 Int nLengthY = 1 << ( getInputBitDepthY() - getCurOctantDepth() - getCurYPartNumLog2() ); 216 604 Int nLengthUV = 1 << ( getInputBitDepthC() - getCurOctantDepth() ); 605 #endif 217 606 for( Int yIdx = 0 ; yIdx < nYSize ; yIdx++ ) 218 607 { … … 224 613 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[yIdx][uIdx][vIdx]; 225 614 SCuboid & rCuboid = pCurCuboid[yIdx][uIdx][vIdx]; 615 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 226 616 Int y0 = yIdx << xGetYShift2Idx(); 227 617 Int u0 = uIdx << xGetUShift2Idx(); 228 618 Int v0 = vIdx << xGetVShift2Idx(); 619 #endif 229 620 for( Int idxVertex = 0 ; idxVertex < 4 ; idxVertex++ ) 230 621 { … … 235 626 { 236 627 dErrorLuma += xxDeriveVertexPerColor( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY , 237 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y , nResQuanBit ); 628 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 629 y0 , u0 , v0 , nLengthY , nLengthUV , 630 #endif 631 rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y , nResQuanBit ); 238 632 } 239 633 if( rCuboidColorInfoC.N > 0 ) 240 634 { 241 635 dErrorChroma += xxDeriveVertexPerColor( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU , 242 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U , nResQuanBit ); 636 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 637 y0 , u0 , v0 , nLengthY , nLengthUV , 638 #endif 639 rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U , nResQuanBit ); 243 640 dErrorChroma += xxDeriveVertexPerColor( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV , 244 y0 , u0 , v0 , nLengthY , nLengthUV , rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V , nResQuanBit ); 641 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 642 y0 , u0 , v0 , nLengthY , nLengthUV , 643 #endif 644 rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V , nResQuanBit ); 245 645 } 246 646 … … 276 676 Int nStrideILRY = pRecPic->getStride(); 277 677 Int nStrideILRC = pRecPic->getCStride(); 678 #if R0179_ENC_OPT_3DLUT_SIZE 679 xReset3DArray( m_pColorInfo , getMaxYSize() , getMaxCSize() , getMaxCSize() ); 680 xReset3DArray( m_pColorInfoC , getMaxYSize() , getMaxCSize() , getMaxCSize() ); 681 #else 278 682 xReset3DArray( m_pColorInfo , xGetYSize() , xGetUSize() , xGetVSize() ); 279 683 xReset3DArray( m_pColorInfoC , xGetYSize() , xGetUSize() , xGetVSize() ); 684 #endif 280 685 281 686 //alignment padding … … 285 690 TComSlice * pSlice = pCurPic->getSlice(pCurPic->getCurrSliceIdx()); 286 691 UInt refLayerId = pSlice->getVPS()->getRefLayerId(pSlice->getLayerId(), refLayerIdc); 692 #if MOVE_SCALED_OFFSET_TO_PPS 693 const Window &scalEL = pSlice->getPPS()->getScaledRefLayerWindowForLayer(refLayerId); 694 #else 287 695 const Window &scalEL = pSlice->getSPS()->getScaledRefLayerWindowForLayer(refLayerId); 696 #endif 288 697 TComPicYuv *pcRecPicBL = pSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(); 289 698 // borders of down-sampled picture … … 299 708 // since we do data collection only for overlapped region, the border extension is good enough 300 709 710 #if R0151_CGS_3D_ASYMLUT_IMPROVE 711 m_dSumU = m_dSumV = 0; 712 m_nNChroma = 0; 713 #endif 301 714 for( Int i = top ; i <= bottom ; i++ ) 302 715 { … … 330 743 } 331 744 745 #if R0151_CGS_3D_ASYMLUT_IMPROVE 746 m_dSumU += u; 747 m_dSumV += v; 748 m_nNChroma++; 749 #endif 332 750 SColorInfo sColorInfo; 751 #if R0151_CGS_3D_ASYMLUT_IMPROVE 752 SColorInfo & rCuboidColorInfo = m_pColorInfo[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 753 #else 333 754 SColorInfo & rCuboidColorInfo = m_pColorInfo[y>>xGetYShift2Idx()][u>>xGetUShift2Idx()][v>>xGetVShift2Idx()]; 755 #endif 334 756 memset(&sColorInfo, 0, sizeof(SColorInfo)); 335 757 sColorInfo.Ys = Y; … … 358 780 u = pIRLU[posIRLUV]; 359 781 v = pIRLV[posIRLUV]; 782 #if R0151_CGS_3D_ASYMLUT_IMPROVE 783 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[xGetYIdx(y)][xGetUIdx(u)][xGetVIdx(v)]; 784 #else 360 785 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[y>>xGetYShift2Idx()][u>>xGetUShift2Idx()][v>>xGetVShift2Idx()]; 786 #endif 361 787 sColorInfo.Us = U; 362 788 sColorInfo.Vs = V; … … 389 815 Void TEnc3DAsymLUT::xxDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB ) 390 816 { 817 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 391 818 Int nSliceType = pSlice->getSliceType(); 392 819 // update slice type as what will be done later … … 406 833 407 834 const Int nSliceTempLevel = pSlice->getDepth(); 835 #endif 408 836 Int nPartNumLog2 = 4; 409 837 if( pSlice->getBaseColPic( pSlice->getInterLayerPredLayerIdc( 0 ) )->getSlice( 0 )->isIntra() ) … … 411 839 nPartNumLog2 = xGetMaxPartNumLog2(); 412 840 } 841 #if R0151_CGS_3D_ASYMLUT_IMPROVE 842 if( m_nAccuFrameBit && pSlice->getPPS()->getCGSFlag() ) 843 { 844 Double dBitCost = 1.0 * m_nAccuFrameCGSBit / m_nAccuFrameBit; 845 nPartNumLog2 = m_nPrevFrameCGSPartNumLog2; 846 #else 413 847 if( m_nPrevFrameBit[nSliceType][nSliceTempLevel] && pSlice->getPPS()->getCGSFlag() ) 414 848 { 415 849 Double dBitCost = 1.0 * m_nPrevFrameCGSBit[nSliceType][nSliceTempLevel] / m_nPrevFrameBit[nSliceType][nSliceTempLevel]; 416 850 nPartNumLog2 = m_nPrevFrameCGSPartNumLog2[nSliceType][nSliceTempLevel]; 851 #endif 417 852 Double dBitCostT = 0.03; 418 853 if( dBitCost < dBitCostT / 6.0 ) … … 425 860 } 426 861 } 862 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 427 863 else 428 864 { 429 865 nPartNumLog2 -= nSliceTempLevel; 430 866 } 431 nPartNumLog2 = Clip3( 0 , xGetMaxPartNumLog2() , nPartNumLog2 ); 867 #endif 868 nPartNumLog2 = Clip3( 0 , xGetMaxPartNumLog2() , nPartNumLog2 ); 432 869 xxMapPartNum2DepthYPart( nPartNumLog2 , rOctantDepth , rYPartNumLog2 ); 433 870 } … … 453 890 Void TEnc3DAsymLUT::updatePicCGSBits( TComSlice * pcSlice , Int nPPSBit ) 454 891 { 892 #if !R0151_CGS_3D_ASYMLUT_IMPROVE 455 893 const Int nSliceType = pcSlice->getSliceType(); 456 894 const Int nSliceTempLevel = pcSlice->getDepth(); 457 895 #endif 458 896 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 459 897 { 460 898 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 899 #if R0151_CGS_3D_ASYMLUT_IMPROVE 900 m_nAccuFrameBit += pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit(); 901 #else 461 902 m_nPrevFrameBit[nSliceType][nSliceTempLevel] = pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit(); 903 #endif 462 904 m_dTotalFrameBit += pcSlice->getPic()->getFrameBit() + pcSlice->getBaseColPic(refLayerIdc)->getFrameBit(); 463 905 } 906 #if R0151_CGS_3D_ASYMLUT_IMPROVE 907 m_nAccuFrameCGSBit += nPPSBit; 908 m_nTotalCGSBit += nPPSBit; 909 m_nPrevFrameCGSPartNumLog2 = getCurOctantDepth() * 3 + getCurYPartNumLog2(); 910 #else 464 911 m_nPrevFrameOverWritePPS[nSliceType][nSliceTempLevel] = pcSlice->getCGSOverWritePPS(); 465 912 m_nPrevFrameCGSBit[nSliceType][nSliceTempLevel] = nPPSBit; 466 913 m_nTotalCGSBit += nPPSBit; 467 914 m_nPrevFrameCGSPartNumLog2[nSliceType][nSliceTempLevel] = getCurOctantDepth() * 3 + getCurYPartNumLog2(); 468 } 469 470 #endif 915 #endif 916 #if R0179_ENC_OPT_3DLUT_SIZE 917 Int nCurELFrameBit = pcSlice->getPic()->getFrameBit(); 918 const Int nSliceType = pcSlice->getSliceType(); 919 const Int nSliceTempLevel = pcSlice->getDepth(); 920 m_nPrevELFrameBit[nSliceType][nSliceTempLevel] = m_nPrevELFrameBit[nSliceType][nSliceTempLevel] == 0 ? nCurELFrameBit:((m_nPrevELFrameBit[nSliceType][nSliceTempLevel]+nCurELFrameBit)>>1); 921 #endif 922 } 923 924 #if R0179_ENC_OPT_3DLUT_SIZE 925 926 Void TEnc3DAsymLUT::xxGetAllLutSizes(TComSlice *pSlice) 927 { 928 Int iMaxYPartNumLog2, iMaxCPartNumLog2; 929 Int iCurYPartNumLog2, iCurCPartNumLog2; 930 Int iMaxAddYPartNumLog2; 931 Int iNumELFrameBits = m_nPrevELFrameBit[pSlice->getSliceType()][pSlice->getDepth()]; 932 933 xxMapPartNum2DepthYPart( xGetMaxPartNumLog2() , iMaxCPartNumLog2 , iMaxYPartNumLog2 ); 934 iMaxAddYPartNumLog2 = iMaxYPartNumLog2; 935 iMaxYPartNumLog2 += iMaxCPartNumLog2; 936 937 //m_sLutSizes[0].iYPartNumLog2 = iMaxYPartNumLog2; 938 //m_sLutSizes[0].iCPartNumLog2 = iMaxCPartNumLog2; 939 m_nTotalLutSizes = 0; 940 941 942 for(iCurYPartNumLog2 = iMaxYPartNumLog2; iCurYPartNumLog2 >= 0; iCurYPartNumLog2--) 943 { 944 for(iCurCPartNumLog2 = iMaxCPartNumLog2; iCurCPartNumLog2 >= 0; iCurCPartNumLog2--) 945 { 946 // try more sizes 947 if(iCurCPartNumLog2 <= iCurYPartNumLog2 && 948 (m_nNumLUTBits[iCurYPartNumLog2][iCurCPartNumLog2] < (iNumELFrameBits>>1)) && 949 m_nTotalLutSizes < MAX_NUM_LUT_SIZES) 950 { 951 m_sLutSizes[m_nTotalLutSizes].iYPartNumLog2 = iCurYPartNumLog2; 952 m_sLutSizes[m_nTotalLutSizes].iCPartNumLog2 = iCurCPartNumLog2; 953 m_nTotalLutSizes ++; 954 } 955 } 956 } 957 958 } 959 960 Void TEnc3DAsymLUT::xxCopyColorInfo( SColorInfo *** dst, SColorInfo *** src , SColorInfo *** dstC, SColorInfo *** srcC ) 961 { 962 Int yIdx, uIdx, vIdx; 963 964 // copy from pColorInfo to pMaxColorInfo 965 for(yIdx = 0; yIdx < xGetYSize(); yIdx++) 966 { 967 for(uIdx = 0; uIdx < xGetUSize(); uIdx++) 968 { 969 for(vIdx = 0; vIdx < xGetVSize(); vIdx++) 970 { 971 dst [yIdx][uIdx][vIdx] = src [yIdx][uIdx][vIdx]; 972 dstC[yIdx][uIdx][vIdx] = srcC[yIdx][uIdx][vIdx]; 973 } 974 } 975 } 976 } 977 978 Void TEnc3DAsymLUT::xxAddColorInfo( Int yIdx, Int uIdx, Int vIdx, Int iYDiffLog2, Int iCDiffLog2 ) 979 { 980 SColorInfo & rCuboidColorInfo = m_pColorInfo [yIdx][uIdx][vIdx]; 981 SColorInfo & rCuboidColorInfoC = m_pColorInfoC[yIdx][uIdx][vIdx]; 982 983 for( Int i = 0; i < (1<<iYDiffLog2); i++) 984 { 985 for (Int j = 0; j < (1<<iCDiffLog2); j++) 986 { 987 for(Int k = 0; k < (1<<iCDiffLog2); k++) 988 { 989 rCuboidColorInfo += m_pMaxColorInfo [(yIdx<<iYDiffLog2)+i][(uIdx<<iCDiffLog2)+j][(vIdx<<iCDiffLog2)+k]; 990 rCuboidColorInfoC += m_pMaxColorInfoC[(yIdx<<iYDiffLog2)+i][(uIdx<<iCDiffLog2)+j][(vIdx<<iCDiffLog2)+k]; 991 } 992 } 993 } 994 } 995 996 Void TEnc3DAsymLUT::xxConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize ) 997 { 998 Int yIdx, uIdx, vIdx; 999 Int iYDiffLog2, iCDiffLog2; 1000 Int nYSize = 1<< pMaxLUTSize->iYPartNumLog2; 1001 Int nCSize = 1<< pMaxLUTSize->iCPartNumLog2; 1002 1003 iYDiffLog2 = pMaxLUTSize->iYPartNumLog2-pCurLUTSize->iYPartNumLog2; 1004 iCDiffLog2 = pMaxLUTSize->iCPartNumLog2-pCurLUTSize->iCPartNumLog2; 1005 1006 //assert(pMaxLUTSize->iCPartNumLog2 >= pCurLUTSize->iCPartNumLog2 && pMaxLUTSize->iYPartNumLog2 >= pCurLUTSize->iYPartNumLog2); 1007 if (iYDiffLog2 == 0 && iCDiffLog2 == 0) // shouldn't have to do anything 1008 { 1009 xxCopyColorInfo(m_pColorInfo, m_pMaxColorInfo, m_pColorInfoC, m_pMaxColorInfoC); 1010 return; 1011 } 1012 1013 xReset3DArray( m_pColorInfo , 1<<pMaxLUTSize->iYPartNumLog2, 1<<pMaxLUTSize->iCPartNumLog2, 1<<pMaxLUTSize->iCPartNumLog2 ); 1014 xReset3DArray( m_pColorInfoC , 1<<pMaxLUTSize->iYPartNumLog2, 1<<pMaxLUTSize->iCPartNumLog2, 1<<pMaxLUTSize->iCPartNumLog2 ); 1015 1016 for(yIdx = 0; yIdx < nYSize; yIdx++) 1017 { 1018 for(uIdx = 0; uIdx < nCSize; uIdx++) 1019 { 1020 for(vIdx = 0; vIdx < nCSize; vIdx++) 1021 { 1022 const SColorInfo & rCuboidSrc = m_pMaxColorInfo [yIdx][uIdx][vIdx]; 1023 const SColorInfo & rCuboidSrcC = m_pMaxColorInfoC[yIdx][uIdx][vIdx]; 1024 1025 Int yIdx2, uIdx2, vIdx2; 1026 yIdx2 = yIdx>>iYDiffLog2; 1027 uIdx2 = uIdx>>iCDiffLog2; 1028 vIdx2 = vIdx>>iCDiffLog2; 1029 1030 m_pColorInfo [yIdx2][uIdx2][vIdx2] += rCuboidSrc; 1031 m_pColorInfoC[yIdx2][uIdx2][vIdx2] += rCuboidSrcC; 1032 } 1033 } 1034 } 1035 } 1036 1037 Void TEnc3DAsymLUT::update3DAsymLUTParam( TEnc3DAsymLUT * pSrc ) 1038 { 1039 assert( pSrc->getMaxOctantDepth() == getMaxOctantDepth() && pSrc->getMaxYPartNumLog2() == getMaxYPartNumLog2() ); 1040 xUpdatePartitioning( pSrc->getCurOctantDepth() , pSrc->getCurYPartNumLog2() 1041 #if R0151_CGS_3D_ASYMLUT_IMPROVE 1042 , pSrc->getAdaptChromaThresholdU() , pSrc->getAdaptChromaThresholdV() 1043 #endif 1044 ); 1045 setResQuantBit( pSrc->getResQuantBit() ); 1046 } 1047 1048 #endif 1049 #endif -
trunk/source/Lib/TLibEncoder/TEnc3DAsymLUT.h
r713 r906 8 8 #include "../TLibCommon/TComPic.h" 9 9 #include "TEncCfg.h" 10 #if R0179_ENC_OPT_3DLUT_SIZE 11 #include "TEncCavlc.h" 12 #define MAX_NUM_LUT_SIZES 10 // 4+3+2+1 13 #define MAX_Y_SIZE 4 14 #define MAX_C_SIZE 4 15 #endif 10 16 11 17 #if Q0048_CGS_3D_ASYMLUT … … 55 61 }SColorInfo; 56 62 63 #if R0179_ENC_OPT_3DLUT_SIZE 64 typedef struct _LUTSize 65 { 66 Int iYPartNumLog2; 67 Int iCPartNumLog2; 68 } SLUTSize; 69 #endif 57 70 58 71 class TEnc3DAsymLUT : public TCom3DAsymLUT … … 66 79 Double derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB ); 67 80 Double estimateDistWithCur3DAsymLUT( TComPic * pCurPic , UInt refLayerIdc ); 81 #if R0179_ENC_OPT_3DLUT_SIZE 82 Double getDistFactor( Int iSliceType, Int iLayer) { return m_dDistFactor[iSliceType][iLayer];} 83 Double derive3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS , Bool bElRapSliceTypeB, Double dFrameLambda ); 84 Void update3DAsymLUTParam( TEnc3DAsymLUT * pSrc ); 85 #endif 68 86 69 87 Void updatePicCGSBits( TComSlice * pcSlice , Int nPPSBit ); … … 75 93 SColorInfo *** m_pColorInfo; 76 94 SColorInfo *** m_pColorInfoC; 95 #if R0179_ENC_OPT_3DLUT_SIZE 96 SColorInfo *** m_pMaxColorInfo; 97 SColorInfo *** m_pMaxColorInfoC; 98 #endif 77 99 TComPicYuv* m_pDsOrigPic; 78 100 SCuboid *** m_pEncCuboid; 79 101 SCuboid *** m_pBestEncCuboid; 102 #if R0151_CGS_3D_ASYMLUT_IMPROVE 103 Int m_nAccuFrameBit; // base + enhancement layer 104 Int m_nAccuFrameCGSBit; 105 Int m_nPrevFrameCGSPartNumLog2; 106 #else 80 107 Int m_nPrevFrameBit[3][MAX_TLAYER]; // base + enhancement layer 81 108 Int m_nPrevFrameCGSBit[3][MAX_TLAYER]; 82 109 Int m_nPrevFrameCGSPartNumLog2[3][MAX_TLAYER]; 83 110 Int m_nPrevFrameOverWritePPS[3][MAX_TLAYER]; 111 #endif 84 112 Double m_dTotalFrameBit; 85 113 Int m_nTotalCGSBit; 86 114 Int m_nPPSBit; 87 115 Int m_nLUTBitDepth; 116 #if R0179_ENC_OPT_3DLUT_SIZE 117 118 Double m_dDistFactor[3][MAX_TLAYER]; 119 Int m_nNumLUTBits[MAX_Y_SIZE][MAX_C_SIZE]; 120 Int m_nPrevELFrameBit[3][MAX_TLAYER]; 121 122 123 Int m_nTotalLutSizes; 124 SLUTSize m_sLutSizes[MAX_NUM_LUT_SIZES]; 125 #endif 126 #if R0151_CGS_3D_ASYMLUT_IMPROVE 127 Double m_dSumU; 128 Double m_dSumV; 129 Int m_nNChroma; 130 #endif 131 #if R0179_ENC_OPT_3DLUT_SIZE 132 TComOutputBitstream *m_pBitstreamRedirect; 133 TEncCavlc *m_pEncCavlc; 134 #endif 88 135 89 136 private: 137 #if R0151_CGS_3D_ASYMLUT_IMPROVE 138 Double xxDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 139 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ); 140 #else 90 141 Double xxDeriveVertexPerColor( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 91 142 Int y0 , Int u0 , Int v0 , Int nLengthY , Int nLengthUV , 92 143 Pel & rP0 , Pel & rP1 , Pel & rP3 , Pel & rP7 , Int nResQuantBit ); 144 #endif 93 145 Void xxDerivePartNumLog2( TComSlice * pSlice , TEncCfg * pcCfg , Int & rOctantDepth , Int & rYPartNumLog2 , Bool bSignalPPS , Bool bElRapSliceTypeB ); 94 146 Void xxMapPartNum2DepthYPart( Int nPartNumLog2 , Int & rOctantDepth , Int & rYPartNumLog2 ); 95 147 Int xxCoeff2Vertex( Double a , Double b , Double c , Double d , Int y , Int u , Int v ) { return ( ( Int )( a * y + b * u + c * v + d + 0.5 ) ); } 96 148 Void xxCollectData( TComPic * pCurPic , UInt refLayerIdc ); 149 97 150 Double xxDeriveVertexes( Int nResQuantBit , SCuboid *** pCurCuboid ); 98 151 inline Double xxCalEstDist( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , … … 100 153 inline Double xxCalEstDist( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 101 154 Double a , Double b , Double c , Double d ); 155 #if R0151_CGS_3D_ASYMLUT_IMPROVE 156 inline Double xxCalEstDist( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 157 Pel nP0 , Pel nP1 , Pel nP3 , Pel nP7 ); 158 #endif 159 #if R0179_ENC_OPT_3DLUT_SIZE 160 Void xxConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize ); 161 Void xxGetAllLutSizes(TComSlice *pSlice); 162 Void xxCopyColorInfo( SColorInfo *** dst, SColorInfo *** src , SColorInfo *** dstC, SColorInfo *** srcC ); 163 Void xxAddColorInfo( Int yIdx, Int uIdx, Int vIdx, Int iYDiffLog2, Int iCDiffLog2 ); 164 #endif 102 165 }; 103 166 … … 118 181 return( dError ); 119 182 }; 120 #endif 121 122 #endif 183 184 #if R0151_CGS_3D_ASYMLUT_IMPROVE 185 Double TEnc3DAsymLUT::xxCalEstDist( Double N , Double Ys , Double Yy , Double Yu , Double Yv , Double ys , Double us , Double vs , Double yy , Double yu , Double yv , Double uu , Double uv , Double vv , Double YY , 186 Pel nP0 , Pel nP1 , Pel nP3 , Pel nP7 ) 187 { 188 const Int nOne = xGetNormCoeffOne(); 189 Double a = 1.0 * nP0 / nOne; 190 Double b = 1.0 * nP1 / nOne; 191 Double c = 1.0 * nP3 / nOne; 192 Double d = nP7; 193 Double dError = N * d * d + 2 * b * c * uv + 2 * a * c * yv + 2 * a * b * yu - 2 * c * Yv - 2 * b * Yu - 2 * a * Yy + 2 * c * d * vs + 2 * b * d * us + 2 * a * d * ys + a * a * yy + c * c * vv + b * b * uu - 2 * d * Ys + YY; 194 return( dError ); 195 }; 196 #endif 197 198 #endif 199 200 #endif -
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r815 r906 193 193 if( pcPPS->getTilesEnabledFlag() ) 194 194 { 195 WRITE_UVLC( pcPPS->getNum ColumnsMinus1(), "num_tile_columns_minus1" );196 WRITE_UVLC( pcPPS->get NumRowsMinus1(), "num_tile_rows_minus1" );197 WRITE_FLAG( pcPPS->get UniformSpacingFlag(), "uniform_spacing_flag" );198 if( pcPPS->getUniformSpacingFlag() == 0)199 { 200 for(UInt i=0; i<pcPPS->getNum ColumnsMinus1(); i++)201 { 202 WRITE_UVLC( pcPPS->get ColumnWidth(i)-1, "column_width_minus1" );203 } 204 for(UInt i=0; i<pcPPS->get NumRowsMinus1(); i++)205 { 206 WRITE_UVLC( pcPPS->get RowHeight(i)-1, "row_height_minus1" );207 } 208 } 209 if(pcPPS->getNum ColumnsMinus1() !=0 || pcPPS->getNumRowsMinus1() !=0)195 WRITE_UVLC( pcPPS->getNumTileColumnsMinus1(), "num_tile_columns_minus1" ); 196 WRITE_UVLC( pcPPS->getTileNumRowsMinus1(), "num_tile_rows_minus1" ); 197 WRITE_FLAG( pcPPS->getTileUniformSpacingFlag(), "uniform_spacing_flag" ); 198 if( !pcPPS->getTileUniformSpacingFlag() ) 199 { 200 for(UInt i=0; i<pcPPS->getNumTileColumnsMinus1(); i++) 201 { 202 WRITE_UVLC( pcPPS->getTileColumnWidth(i)-1, "column_width_minus1" ); 203 } 204 for(UInt i=0; i<pcPPS->getTileNumRowsMinus1(); i++) 205 { 206 WRITE_UVLC( pcPPS->getTileRowHeight(i)-1, "row_height_minus1" ); 207 } 208 } 209 if(pcPPS->getNumTileColumnsMinus1() !=0 || pcPPS->getTileNumRowsMinus1() !=0) 210 210 { 211 211 WRITE_FLAG( pcPPS->getLoopFilterAcrossTilesEnabledFlag()?1 : 0, "loop_filter_across_tiles_enabled_flag"); … … 225 225 } 226 226 227 #if !R0042_PROFILE_INDICATION 227 228 #if SCALINGLIST_INFERRING 228 229 if( pcPPS->getLayerId() > 0 ) … … 241 242 { 242 243 #endif 244 #endif 243 245 244 246 WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0, "pps_scaling_list_data_present_flag" ); … … 247 249 codeScalingList( m_pcSlice->getScalingList() ); 248 250 } 249 251 #if !R0042_PROFILE_INDICATION 250 252 #if SCALINGLIST_INFERRING 251 253 } 254 #endif 252 255 #endif 253 256 … … 256 259 WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); 257 260 #if P0166_MODIFIED_PPS_EXTENSION 261 #if !R0042_PROFILE_INDICATION 258 262 WRITE_FLAG( pcPPS->getExtensionFlag() ? 1 : 0, "pps_extension_flag" ); 263 #else 264 WRITE_FLAG( pcPPS->getExtensionFlag() ? 1 : 0, "pps_extension_present_flag" ); 265 #endif 259 266 260 267 if( pcPPS->getExtensionFlag() ) 261 268 { 269 #if !R0042_PROFILE_INDICATION 262 270 #if !POC_RESET_IDC 263 271 UInt ppsExtensionTypeFlag[8] = { 0, 1, 0, 0, 0, 0, 0, 0 }; … … 273 281 { 274 282 WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag() ? 1 : 0, "poc_reset_info_present_flag" ); 283 #if REF_REGION_OFFSET 284 WRITE_UVLC( pcPPS->getNumScaledRefLayerOffsets(), "num_scaled_ref_layer_offsets" ); 285 for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) 286 { 287 WRITE_CODE( pcPPS->getScaledRefLayerId(i), 6, "scaled_ref_layer_id" ); 288 WRITE_FLAG( pcPPS->getScaledRefLayerOffsetPresentFlag(i) ? 1 : 0, "scaled_ref_layer_offset_prsent_flag" ); 289 if (pcPPS->getScaledRefLayerOffsetPresentFlag(i)) 290 { 291 Window scaledWindow = pcPPS->getScaledRefLayerWindow(i); 292 WRITE_SVLC( scaledWindow.getWindowLeftOffset() >> 1, "scaled_ref_layer_left_offset" ); 293 WRITE_SVLC( scaledWindow.getWindowTopOffset() >> 1, "scaled_ref_layer_top_offset" ); 294 WRITE_SVLC( scaledWindow.getWindowRightOffset() >> 1, "scaled_ref_layer_right_offset" ); 295 WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" ); 296 } 297 WRITE_FLAG( pcPPS->getRefRegionOffsetPresentFlag(i) ? 1 : 0, "ref_region_offset_prsent_flag" ); 298 if (pcPPS->getRefRegionOffsetPresentFlag(i)) 299 { 300 Window refWindow = pcPPS->getRefLayerWindow(i); 301 WRITE_SVLC( refWindow.getWindowLeftOffset() >> 1, "ref_layer_left_offset" ); 302 WRITE_SVLC( refWindow.getWindowTopOffset() >> 1, "ref_layer_top_offset" ); 303 WRITE_SVLC( refWindow.getWindowRightOffset() >> 1, "ref_layer_right_offset" ); 304 WRITE_SVLC( refWindow.getWindowBottomOffset() >> 1, "ref_layer_bottom_offset" ); 305 } 306 #if R0209_GENERIC_PHASE 307 WRITE_FLAG( pcPPS->getResamplePhaseSetPresentFlag(i) ? 1 : 0, "resample_phase_set_present_flag" ); 308 if (pcPPS->getResamplePhaseSetPresentFlag(i)) 309 { 310 WRITE_UVLC( pcPPS->getPhaseHorLuma(i), "phase_hor_luma" ); 311 WRITE_UVLC( pcPPS->getPhaseVerLuma(i), "phase_ver_luma" ); 312 WRITE_UVLC( pcPPS->getPhaseHorChroma(i) + 8, "phase_hor_chroma_plus8" ); 313 WRITE_UVLC( pcPPS->getPhaseVerChroma(i) + 8, "phase_ver_chroma_plus8" ); 314 } 315 #endif 316 } 317 #else 318 #if MOVE_SCALED_OFFSET_TO_PPS 319 WRITE_UVLC( pcPPS->getNumScaledRefLayerOffsets(), "num_scaled_ref_layer_offsets" ); 320 for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) 321 { 322 Window scaledWindow = pcPPS->getScaledRefLayerWindow(i); 323 #if O0098_SCALED_REF_LAYER_ID 324 WRITE_CODE( pcPPS->getScaledRefLayerId(i), 6, "scaled_ref_layer_id" ); 325 #endif 326 WRITE_SVLC( scaledWindow.getWindowLeftOffset() >> 1, "scaled_ref_layer_left_offset" ); 327 WRITE_SVLC( scaledWindow.getWindowTopOffset() >> 1, "scaled_ref_layer_top_offset" ); 328 WRITE_SVLC( scaledWindow.getWindowRightOffset() >> 1, "scaled_ref_layer_right_offset" ); 329 WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" ); 330 } 331 #endif 332 #endif 275 333 #if Q0048_CGS_3D_ASYMLUT 276 334 UInt uiPos = getNumberOfWrittenBits(); … … 285 343 #endif 286 344 } 345 #else 346 WRITE_FLAG( 0, "pps_range_extension_flag" ); 347 WRITE_FLAG( 1, "pps_multilayer_extension_flag" ); 348 WRITE_CODE( 0, 6, "pps_extension_6bits" ); 349 350 WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag() ? 1 : 0, "poc_reset_info_present_flag" ); 351 #if SCALINGLIST_INFERRING 352 WRITE_FLAG( pcPPS->getInferScalingListFlag() ? 1 : 0, "pps_infer_scaling_list_flag" ); 353 if( pcPPS->getInferScalingListFlag() ) 354 { 355 // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive 356 assert( pcPPS->getScalingListRefLayerId() <= 62 ); 357 WRITE_UVLC( pcPPS->getScalingListRefLayerId(), "pps_scaling_list_ref_layer_id" ); 358 } 359 #endif 360 361 #if REF_REGION_OFFSET 362 WRITE_UVLC( pcPPS->getNumScaledRefLayerOffsets(), "num_ref_loc_offsets" ); 363 for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) 364 { 365 WRITE_CODE( pcPPS->getScaledRefLayerId(i), 6, "ref_loc_offset_layer_id" ); 366 WRITE_FLAG( pcPPS->getScaledRefLayerOffsetPresentFlag(i) ? 1 : 0, "scaled_ref_layer_offset_prsent_flag" ); 367 if (pcPPS->getScaledRefLayerOffsetPresentFlag(i)) 368 { 369 Window scaledWindow = pcPPS->getScaledRefLayerWindow(i); 370 WRITE_SVLC( scaledWindow.getWindowLeftOffset() >> 1, "scaled_ref_layer_left_offset" ); 371 WRITE_SVLC( scaledWindow.getWindowTopOffset() >> 1, "scaled_ref_layer_top_offset" ); 372 WRITE_SVLC( scaledWindow.getWindowRightOffset() >> 1, "scaled_ref_layer_right_offset" ); 373 WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" ); 374 } 375 WRITE_FLAG( pcPPS->getRefRegionOffsetPresentFlag(i) ? 1 : 0, "ref_region_offset_prsent_flag" ); 376 if (pcPPS->getRefRegionOffsetPresentFlag(i)) 377 { 378 Window refWindow = pcPPS->getRefLayerWindow(i); 379 WRITE_SVLC( refWindow.getWindowLeftOffset() >> 1, "ref_region_left_offset" ); 380 WRITE_SVLC( refWindow.getWindowTopOffset() >> 1, "ref_region_top_offset" ); 381 WRITE_SVLC( refWindow.getWindowRightOffset() >> 1, "ref_region_right_offset" ); 382 WRITE_SVLC( refWindow.getWindowBottomOffset() >> 1, "ref_region_bottom_offset" ); 383 } 384 #if R0209_GENERIC_PHASE 385 WRITE_FLAG( pcPPS->getResamplePhaseSetPresentFlag(i) ? 1 : 0, "resample_phase_set_present_flag" ); 386 if (pcPPS->getResamplePhaseSetPresentFlag(i)) 387 { 388 WRITE_UVLC( pcPPS->getPhaseHorLuma(i), "phase_hor_luma" ); 389 WRITE_UVLC( pcPPS->getPhaseVerLuma(i), "phase_ver_luma" ); 390 WRITE_UVLC( pcPPS->getPhaseHorChroma(i) + 8, "phase_hor_chroma_plus8" ); 391 WRITE_UVLC( pcPPS->getPhaseVerChroma(i) + 8, "phase_ver_chroma_plus8" ); 392 } 393 #endif 394 } 395 #else 396 #if MOVE_SCALED_OFFSET_TO_PPS 397 WRITE_UVLC( pcPPS->getNumScaledRefLayerOffsets(), "num_scaled_ref_layer_offsets" ); 398 for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) 399 { 400 Window scaledWindow = pcPPS->getScaledRefLayerWindow(i); 401 #if O0098_SCALED_REF_LAYER_ID 402 WRITE_CODE( pcPPS->getScaledRefLayerId(i), 6, "scaled_ref_layer_id" ); 403 #endif 404 WRITE_SVLC( scaledWindow.getWindowLeftOffset() >> 1, "scaled_ref_layer_left_offset" ); 405 WRITE_SVLC( scaledWindow.getWindowTopOffset() >> 1, "scaled_ref_layer_top_offset" ); 406 WRITE_SVLC( scaledWindow.getWindowRightOffset() >> 1, "scaled_ref_layer_right_offset" ); 407 WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" ); 408 } 409 #endif 410 #endif 411 #if Q0048_CGS_3D_ASYMLUT 412 UInt uiPos = getNumberOfWrittenBits(); 413 WRITE_FLAG( pcPPS->getCGSFlag() , "colour_mapping_enabled_flag" ); 414 if( pcPPS->getCGSFlag() ) 415 { 416 assert( pc3DAsymLUT != NULL ); 417 xCode3DAsymLUT( pc3DAsymLUT ); 418 } 419 pc3DAsymLUT->setPPSBit( getNumberOfWrittenBits() - uiPos ); 420 #endif 421 #endif 287 422 } 288 423 #else … … 340 475 if( defaultDisplayWindow.getWindowEnabledFlag() ) 341 476 { 342 WRITE_UVLC(defaultDisplayWindow.getWindowLeftOffset() ,"def_disp_win_left_offset");343 WRITE_UVLC(defaultDisplayWindow.getWindowRightOffset() ,"def_disp_win_right_offset");344 WRITE_UVLC(defaultDisplayWindow.getWindowTopOffset() ,"def_disp_win_top_offset");345 WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset() ,"def_disp_win_bottom_offset");477 WRITE_UVLC(defaultDisplayWindow.getWindowLeftOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc()), "def_disp_win_left_offset"); 478 WRITE_UVLC(defaultDisplayWindow.getWindowRightOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc()), "def_disp_win_right_offset"); 479 WRITE_UVLC(defaultDisplayWindow.getWindowTopOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc()), "def_disp_win_top_offset"); 480 WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset()/ TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc()), "def_disp_win_bottom_offset"); 346 481 } 347 482 TimingInfo *timingInfo = pcVUI->getTimingInfo(); … … 452 587 Void TEncCavlc::codeSPS( TComSPS* pcSPS ) 453 588 { 589 #if R0042_PROFILE_INDICATION 590 Bool bMultiLayerExtSpsFlag = (pcSPS->getNumDirectRefLayers() != 0 ) ; 591 #endif 454 592 #if ENC_DEC_TRACE 455 593 xTraceSPSHeader (pcSPS); … … 461 599 #endif 462 600 WRITE_CODE( pcSPS->getMaxTLayers() - 1, 3, "sps_max_sub_layers_minus1" ); 601 #if SVC_EXTENSION 602 } 603 #if R0042_PROFILE_INDICATION 604 else 605 { 606 WRITE_CODE(bMultiLayerExtSpsFlag? 7:(pcSPS->getMaxTLayers() - 1) , 3, "sps_ext_or_max_sub_layers_minus1" ); 607 } 608 #endif 609 #endif 610 611 #if SVC_EXTENSION 612 #if !R0042_PROFILE_INDICATION 613 if(pcSPS->getLayerId() == 0) 614 #else 615 if(!bMultiLayerExtSpsFlag) 616 #endif 617 { 618 #endif 463 619 WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0, "sps_temporal_id_nesting_flag" ); 464 620 #if SVC_EXTENSION … … 466 622 #endif 467 623 #ifdef SPS_PTL_FIX 624 #if !R0042_PROFILE_INDICATION 468 625 if (pcSPS->getLayerId() == 0) 626 #else 627 if(!bMultiLayerExtSpsFlag) 628 #endif 469 629 { 470 630 codePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); … … 475 635 WRITE_UVLC( pcSPS->getSPSId (), "sps_seq_parameter_set_id" ); 476 636 #if REPN_FORMAT_IN_VPS 637 #if !R0042_PROFILE_INDICATION 477 638 if( pcSPS->getLayerId() > 0 ) 639 #else 640 if(bMultiLayerExtSpsFlag) 641 #endif 478 642 { 479 643 WRITE_FLAG( pcSPS->getUpdateRepFormatFlag(), "update_rep_format_flag" ); 480 644 } 645 #if R0042_PROFILE_INDICATION 646 if( bMultiLayerExtSpsFlag && pcSPS->getUpdateRepFormatFlag()) 647 { 648 WRITE_CODE( pcSPS->getUpdateRepFormatIndex(), 8, "sps_rep_format_idx"); 649 } 650 #endif 651 652 #if R0042_PROFILE_INDICATION 653 if(!bMultiLayerExtSpsFlag) 654 { 655 #endif 656 #if !R0042_PROFILE_INDICATION 481 657 #if O0096_REP_FORMAT_INDEX 482 658 if( pcSPS->getLayerId() == 0 ) 483 659 #else 484 660 if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 661 #endif 485 662 #endif 486 663 { … … 498 675 #if REPN_FORMAT_IN_VPS 499 676 } 677 #if !R0042_PROFILE_INDICATION 500 678 #if O0096_REP_FORMAT_INDEX 501 679 else if (pcSPS->getUpdateRepFormatFlag()) … … 505 683 #endif 506 684 #endif 507 Window conf = pcSPS->getConformanceWindow(); 508 509 WRITE_FLAG( conf.getWindowEnabledFlag(), "conformance_window_flag" ); 510 if (conf.getWindowEnabledFlag()) 511 { 685 #endif 686 687 #if R0156_CONF_WINDOW_IN_REP_FORMAT 512 688 #if REPN_FORMAT_IN_VPS 513 WRITE_UVLC( conf.getWindowLeftOffset(), "conf_win_left_offset" ); 514 WRITE_UVLC( conf.getWindowRightOffset(), "conf_win_right_offset" ); 515 WRITE_UVLC( conf.getWindowTopOffset(), "conf_win_top_offset" ); 516 WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_bottom_offset" ); 517 #else 518 WRITE_UVLC( conf.getWindowLeftOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_left_offset" ); 519 WRITE_UVLC( conf.getWindowRightOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_right_offset" ); 520 WRITE_UVLC( conf.getWindowTopOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_top_offset" ); 521 WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" ); 522 #endif 523 } 524 525 #if REPN_FORMAT_IN_VPS 689 #if !R0042_PROFILE_INDICATION 526 690 #if O0096_REP_FORMAT_INDEX 527 691 if( pcSPS->getLayerId() == 0 ) … … 529 693 if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 530 694 #endif 695 #endif 696 { 697 #endif 698 #endif 699 Window conf = pcSPS->getConformanceWindow(); 700 701 WRITE_FLAG( conf.getWindowEnabledFlag(), "conformance_window_flag" ); 702 if (conf.getWindowEnabledFlag()) 703 { 704 #if REPN_FORMAT_IN_VPS 705 WRITE_UVLC( conf.getWindowLeftOffset(), "conf_win_left_offset" ); 706 WRITE_UVLC( conf.getWindowRightOffset(), "conf_win_right_offset" ); 707 WRITE_UVLC( conf.getWindowTopOffset(), "conf_win_top_offset" ); 708 WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_bottom_offset" ); 709 #else 710 WRITE_UVLC( conf.getWindowLeftOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_left_offset" ); 711 WRITE_UVLC( conf.getWindowRightOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_right_offset" ); 712 WRITE_UVLC( conf.getWindowTopOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_top_offset" ); 713 WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" ); 714 #endif 715 } 716 #if R0156_CONF_WINDOW_IN_REP_FORMAT 717 #if REPN_FORMAT_IN_VPS 718 } 719 #endif 720 #endif 721 722 #if REPN_FORMAT_IN_VPS 723 #if !R0042_PROFILE_INDICATION 724 #if O0096_REP_FORMAT_INDEX 725 if( pcSPS->getLayerId() == 0 ) 726 #else 727 if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) 728 #endif 729 #endif 531 730 { 532 731 assert( pcSPS->getBitDepthY() >= 8 ); … … 538 737 } 539 738 #endif 739 #if R0042_PROFILE_INDICATION 740 } 741 #endif 742 540 743 WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); 541 744 542 745 #if SPS_DPB_PARAMS 746 #if !R0042_PROFILE_INDICATION 543 747 if( pcSPS->getLayerId() == 0 ) 748 #else 749 if(!bMultiLayerExtSpsFlag) 750 #endif 544 751 { 545 752 #endif … … 571 778 { 572 779 #if SCALINGLIST_INFERRING 780 #if !R0042_PROFILE_INDICATION 573 781 if( pcSPS->getLayerId() > 0 ) 782 #else 783 if( bMultiLayerExtSpsFlag) 784 #endif 574 785 { 575 786 WRITE_FLAG( pcSPS->getInferScalingListFlag() ? 1 : 0, "sps_infer_scaling_list_flag" ); … … 640 851 641 852 #if SVC_EXTENSION 853 #if !R0042_PROFILE_INDICATION 642 854 WRITE_FLAG( pcSPS->getExtensionFlag() ? 1 : 0, "sps_extension_flag" ); 855 #else 856 WRITE_FLAG( pcSPS->getExtensionFlag() ? 1 : 0, "sps_extension_present_flag" ); 857 #endif 643 858 644 859 if( pcSPS->getExtensionFlag() ) 645 860 { 861 #if !R0042_PROFILE_INDICATION 646 862 #if O0142_CONDITIONAL_SPS_EXTENSION 647 863 UInt spsExtensionTypeFlag[8] = { 0, 1, 0, 0, 0, 0, 0, 0 }; … … 658 874 WRITE_FLAG( 0, "sps_extension2_flag" ); 659 875 #endif 876 #else 877 WRITE_FLAG( 0, "sps_range_extension_flag" ); 878 WRITE_FLAG( 1, "sps_multilayer_extension_flag" ); 879 WRITE_CODE( 0, 6, "sps_extension_6bits" ); 880 codeSPSExtension( pcSPS ); //it is sps_multilayer_extension 881 #endif 660 882 } 661 883 #else … … 672 894 WRITE_FLAG( 0, "inter_view_mv_vert_constraint_flag" ); 673 895 896 #if !MOVE_SCALED_OFFSET_TO_PPS 674 897 if( pcSPS->getLayerId() > 0 ) 675 898 { … … 690 913 } 691 914 } 915 #endif 692 916 } 693 917 #endif //SVC_EXTENSION … … 706 930 #endif 707 931 WRITE_CODE( pcVPS->getVPSId(), 4, "vps_video_parameter_set_id" ); 932 #if VPS_RESERVED_FLAGS 933 WRITE_FLAG( pcVPS->getBaseLayerInternalFlag(), "vps_base_layer_internal_flag"); 934 WRITE_FLAG( pcVPS->getBaseLayerAvailableFlag(), "vps_base_layer_available_flag"); 935 #else 708 936 WRITE_CODE( 3, 2, "vps_reserved_three_2bits" ); 937 #endif 709 938 #if SVC_EXTENSION 710 939 WRITE_CODE( pcVPS->getMaxLayers() - 1, 6, "vps_max_layers_minus1" ); … … 774 1003 } 775 1004 } 1005 #if !NECESSARY_FLAG // Already called once in TAppEncTop.cpp 776 1006 #if DERIVE_LAYER_ID_LIST_VARIABLES 777 1007 pcVPS->deriveLayerIdListVariables(); 1008 #endif 778 1009 #endif 779 1010 TimingInfo *timingInfo = pcVPS->getTimingInfo(); … … 848 1079 Int OlsHighestOutputLayerId[MAX_VPS_LAYER_SETS_PLUS1]; 849 1080 #endif 1081 #if LIST_OF_PTL 1082 if( vps->getMaxLayers() > 1 && vps->getBaseLayerInternalFlag() ) 1083 { 1084 codePTL( vps->getPTLForExtn(1), false, vps->getMaxTLayers() - 1 ); 1085 } 1086 #endif 850 1087 #if VPS_EXTN_MASK_AND_DIM_INFO 851 1088 UInt i = 0, j = 0; 852 1089 #if !VPS_AVC_BL_FLAG_REMOVAL 853 1090 WRITE_FLAG( vps->getAvcBaseLayerFlag(), "avc_base_layer_flag" ); 1091 #endif 854 1092 #if !P0307_REMOVE_VPS_VUI_OFFSET 855 1093 #if O0109_MOVE_VPS_VUI_FLAG … … 948 1186 } 949 1187 } 1188 #endif 1189 #if MOVE_ADDN_LS_SIGNALLING 1190 #if Q0078_ADD_LAYER_SETS 1191 if (vps->getNumIndependentLayers() > 1) 1192 { 1193 WRITE_UVLC( vps->getNumAddLayerSets(), "num_add_layer_sets" ); 1194 for (i = 0; i < vps->getNumAddLayerSets(); i++) 1195 { 1196 for (j = 1; j < vps->getNumIndependentLayers(); j++) 1197 { 1198 int len = 1; 1199 while ((1 << len) < (vps->getNumLayersInTreePartition(j) + 1)) 1200 { 1201 len++; 1202 } 1203 WRITE_CODE(vps->getHighestLayerIdxPlus1(i, j), len, "highest_layer_idx_plus1[i][j]"); 1204 } 1205 } 1206 } 1207 #endif 950 1208 #endif 951 1209 #if VPS_TSLAYERS … … 985 1243 #else 986 1244 WRITE_UVLC( vps->getNumProfileTierLevel() - 1, "vps_num_profile_tier_level_minus1"); 987 #endif 1245 #if PER_LAYER_PTL 1246 Int const numBitsForPtlIdx = vps->calculateLenOfSyntaxElement( vps->getNumProfileTierLevel() ); 1247 #endif 1248 #endif 1249 #if LIST_OF_PTL 1250 assert( vps->getNumProfileTierLevel() == vps->getPTLForExtnPtr()->size()); 1251 for(Int idx = vps->getBaseLayerInternalFlag() ? 2 : 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 1252 #else 988 1253 for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) 1254 #endif 989 1255 { 990 1256 WRITE_FLAG( vps->getProfilePresentFlag(idx), "vps_profile_present_flag[i]" ); … … 999 1265 #endif 1000 1266 1267 1268 #if !MOVE_ADDN_LS_SIGNALLING 1001 1269 #if Q0078_ADD_LAYER_SETS 1002 1270 if (vps->getNumIndependentLayers() > 1) … … 1016 1284 } 1017 1285 } 1286 #endif 1018 1287 #endif 1019 1288 … … 1060 1329 for(i = 1; i < numOutputLayerSets; i++) 1061 1330 { 1331 Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i); 1062 1332 if( i > (vps->getNumLayerSets() - 1) ) 1063 1333 { … … 1077 1347 { 1078 1348 #endif 1079 Int lsIdx = vps->getOutputLayerSetIdx(i);1080 1349 #if NUM_OL_FLAGS 1081 for(j = 0; j < vps->getNumLayersInIdList(l sIdx) ; j++)1350 for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet) ; j++) 1082 1351 #else 1083 1352 for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) … … 1087 1356 } 1088 1357 } 1358 #if PER_LAYER_PTL 1359 for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet) ; j++) 1360 { 1361 if( vps->getNecessaryLayerFlag(i, j) ) 1362 { 1363 WRITE_CODE( vps->getProfileLevelTierIdx(i, j), numBitsForPtlIdx, "profile_level_tier_idx[i]" ); 1364 } 1365 } 1366 #else 1089 1367 Int numBits = 1; 1090 1368 while ((1 << numBits) < (vps->getNumProfileTierLevel())) … … 1093 1371 } 1094 1372 WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" ); 1373 #endif 1095 1374 #if P0300_ALT_OUTPUT_LAYER_FLAG 1096 1375 NumOutputLayersInOutputLayerSet[i] = 0; 1097 Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i);1098 1376 for (j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) 1099 1377 { … … 1211 1489 1212 1490 WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag"); 1491 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 1492 WRITE_FLAG(vps->getVpsPocLsbAlignedFlag(), "vps_poc_lsb_aligned_flag"); 1493 #endif 1213 1494 #if O0062_POC_LSB_NOT_PRESENT_FLAG 1214 1495 for(i = 1; i< vps->getMaxLayers(); i++) … … 1367 1648 WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_chroma_minus8" ); 1368 1649 #endif 1650 1651 #if R0156_CONF_WINDOW_IN_REP_FORMAT 1652 Window conf = repFormat->getConformanceWindowVps(); 1653 1654 WRITE_FLAG( conf.getWindowEnabledFlag(), "conformance_window_vps_flag" ); 1655 if (conf.getWindowEnabledFlag()) 1656 { 1657 WRITE_UVLC( conf.getWindowLeftOffset(), "conf_win_vps_left_offset" ); 1658 WRITE_UVLC( conf.getWindowRightOffset(), "conf_win_vps_right_offset" ); 1659 WRITE_UVLC( conf.getWindowTopOffset(), "conf_win_vps_top_offset" ); 1660 WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_vps_bottom_offset" ); 1661 } 1662 #endif 1369 1663 } 1370 1664 #endif … … 1372 1666 Void TEncCavlc::codeVpsDpbSizeTable(TComVPS *vps) 1373 1667 { 1668 #if !SUB_LAYERS_IN_LAYER_SET // MaxSLInLayerSets calculated earlier in the encoder 1374 1669 #if DPB_PARAMS_MAXTLAYERS 1375 1670 #if BITRATE_PICRATE_SIGNALLING … … 1400 1695 } 1401 1696 #endif 1697 #endif 1402 1698 1403 1699 … … 1408 1704 #endif 1409 1705 WRITE_FLAG( vps->getSubLayerFlagInfoPresentFlag( i ), "sub_layer_flag_info_present_flag[i]"); 1706 #if SUB_LAYERS_IN_LAYER_SET 1707 for(Int j = 0; j <= vps->getMaxSLayersInLayerSetMinus1( layerSetIdxForOutputLayerSet ); j++) 1708 #else 1410 1709 #if DPB_PARAMS_MAXTLAYERS 1411 1710 #if BITRATE_PICRATE_SIGNALLING … … 1417 1716 for(Int j = 0; j < vps->getMaxTLayers(); j++) 1418 1717 #endif 1718 #endif 1419 1719 { 1420 1720 if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) ) … … 1434 1734 #endif 1435 1735 { 1436 WRITE_UVLC( vps->getMaxVpsDecPicBufferingMinus1( i, k, j), "max_vps_dec_pic_buffering_minus1[i][k][j]" ); 1736 #if DPB_INTERNAL_BL_SIG 1737 if(vps->getBaseLayerInternalFlag() || ( vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k) != 0 ) ) 1738 #endif 1739 WRITE_UVLC( vps->getMaxVpsDecPicBufferingMinus1( i, k, j), "max_vps_dec_pic_buffering_minus1[i][k][j]" ); 1437 1740 } 1438 1741 WRITE_UVLC( vps->getMaxVpsNumReorderPics( i, j), "max_vps_num_reorder_pics[i][j]" ); … … 1450 1753 } 1451 1754 } 1755 1756 #if !SUB_LAYERS_IN_LAYER_SET 1757 #if BITRATE_PICRATE_SIGNALLING 1758 if( MaxSubLayersInLayerSetMinus1 ) 1759 { 1760 delete [] MaxSubLayersInLayerSetMinus1; 1761 } 1762 #endif 1763 #endif 1452 1764 } 1453 1765 #endif … … 1479 1791 { 1480 1792 #if Q0078_ADD_LAYER_SETS 1793 #if R0227_BR_PR_ADD_LAYER_SET 1794 #if SIGNALLING_BITRATE_PICRATE_FIX 1795 for( i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getNumLayerSets(); i++ ) 1796 #else 1797 for( i = 0; i < vps->getNumLayerSets(); i++ ) 1798 #endif 1799 #else 1481 1800 for( i = 0; i <= vps->getVpsNumLayerSetsMinus1(); i++ ) 1801 #endif 1482 1802 #else 1483 1803 for( i = 0; i < vps->getNumLayerSets(); i++ ) … … 1529 1849 if (vps->getVideoSigPresentVpsFlag() && vps->getNumVideoSignalInfo() > 1 ) 1530 1850 { 1851 #if VPS_VUI_VST_PARAMS 1852 for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) 1853 { 1854 WRITE_CODE( vps->getVideoSignalInfoIdx(i), 4, "vps_video_signal_info_idx" ); 1855 } 1856 #else 1531 1857 for (i=1; i < vps->getMaxLayers(); i++) 1532 1858 WRITE_CODE(vps->getVideoSignalInfoIdx(i), 4, "vps_video_signal_info_idx" ); 1859 #endif 1533 1860 } 1534 1861 #endif … … 1645 1972 if (vps->getVpsVuiBspHrdPresentFlag()) 1646 1973 { 1974 #if VPS_VUI_BSP_HRD_PARAMS 1975 codeVpsVuiBspHrdParams(vps); 1976 #else 1647 1977 WRITE_UVLC( vps->getVpsNumBspHrdParametersMinus1(), "vps_num_bsp_hrd_parameters_minus1" ); 1648 1978 for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) … … 1688 2018 } 1689 2019 } 2020 #endif 1690 2021 } 1691 2022 #endif … … 1786 2117 } 1787 2118 #else 2119 #if CROSS_LAYER_BLA_FLAG_FIX 2120 Int iBits = 0; 2121 if(pcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) 2122 #else 1788 2123 if (pcSlice->getPPS()->getNumExtraSliceHeaderBits()>0) 2124 #endif 1789 2125 { 1790 2126 assert(!!"discardable_flag"); 2127 #if NON_REF_NAL_TYPE_DISCARDABLE 2128 if (pcSlice->getDiscardableFlag()) 2129 { 2130 assert(pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TRAIL_R && 2131 pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TSA_R && 2132 pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_STSA_R && 2133 pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RADL_R && 2134 pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RASL_R); 2135 } 2136 #endif 1791 2137 WRITE_FLAG(pcSlice->getDiscardableFlag(), "discardable_flag"); 1792 } 2138 #if CROSS_LAYER_BLA_FLAG_FIX 2139 iBits++; 2140 #endif 2141 } 2142 #if CROSS_LAYER_BLA_FLAG_FIX 2143 if( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits ) 2144 { 2145 assert(!!"cross_layer_bla_flag"); 2146 WRITE_FLAG(pcSlice->getCrossLayerBLAFlag(), "cross_layer_bla_flag"); 2147 iBits++; 2148 } 2149 for (; iBits < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++) 2150 #else 1793 2151 for (Int i = 1; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 2152 #endif 1794 2153 { 1795 2154 assert(!!"slice_reserved_undetermined_flag[]"); … … 1978 2337 if (pcSlice->getSPS()->getTMVPFlagsPresent()) 1979 2338 { 2339 #if R0226_SLICE_TMVP 2340 WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enabled_flag" ); 2341 #else 1980 2342 WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enable_flag" ); 2343 #endif 1981 2344 } 1982 2345 #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7 … … 2262 2625 } 2263 2626 UInt numEntryPointOffsets = 0, offsetLenMinus1 = 0, maxOffset = 0; 2627 #if !WPP_FIX 2264 2628 Int numZeroSubstreamsAtStartOfSlice = 0; 2629 #endif 2265 2630 UInt *entryPointOffset = NULL; 2266 2631 if ( pSlice->getPPS()->getTilesEnabledFlag() ) … … 2289 2654 UInt* pSubstreamSizes = pSlice->getSubstreamSizes(); 2290 2655 Int maxNumParts = pSlice->getPic()->getNumPartInCU(); 2656 #if WPP_FIX 2657 Int numZeroSubstreamsAtStartOfSlice = pSlice->getPic()->getSubstreamForLCUAddr(pSlice->getSliceSegmentCurStartCUAddr()/maxNumParts, false, pSlice); 2658 Int subStreamOfLastSegmentOfSlice = pSlice->getPic()->getSubstreamForLCUAddr((pSlice->getSliceSegmentCurEndCUAddr()/maxNumParts)-1, false, pSlice); 2659 numEntryPointOffsets = subStreamOfLastSegmentOfSlice-numZeroSubstreamsAtStartOfSlice; 2660 #else 2291 2661 numZeroSubstreamsAtStartOfSlice = pSlice->getSliceSegmentCurStartCUAddr()/maxNumParts/pSlice->getPic()->getFrameWidthInCU(); 2292 2662 Int numZeroSubstreamsAtEndOfSlice = pSlice->getPic()->getFrameHeightInCU()-1 - ((pSlice->getSliceSegmentCurEndCUAddr()-1)/maxNumParts/pSlice->getPic()->getFrameWidthInCU()); 2293 2663 numEntryPointOffsets = pSlice->getPPS()->getNumSubstreams() - numZeroSubstreamsAtStartOfSlice - numZeroSubstreamsAtEndOfSlice - 1; 2664 #endif 2294 2665 pSlice->setNumEntryPointOffsets(numEntryPointOffsets); 2295 2666 entryPointOffset = new UInt[numEntryPointOffsets]; … … 2333 2704 { 2334 2705 // Derive the value of PocMsbValRequiredFlag 2335 slice->setPocMsbValRequiredFlag( slice->getCraPicFlag() || slice->getBlaPicFlag() 2336 /* || related to vps_poc_lsb_aligned_flag */ 2337 ); 2706 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2707 slice->setPocMsbValRequiredFlag( (slice->getCraPicFlag() || slice->getBlaPicFlag()) 2708 && (!slice->getVPS()->getVpsPocLsbAlignedFlag() || 2709 (slice->getVPS()->getVpsPocLsbAlignedFlag() && slice->getVPS()->getNumDirectRefLayers(slice->getLayerId()) == 0)) 2710 ); 2711 #else 2712 slice->setPocMsbValRequiredFlag( slice->getCraPicFlag() || slice->getBlaPicFlag() ); 2713 #endif 2338 2714 2339 2715 // Determine value of SH extension length. … … 2353 2729 2354 2730 2355 if( !slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */ ) 2731 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2732 if (!slice->getPocMsbValRequiredFlag() && slice->getVPS()->getVpsPocLsbAlignedFlag()) 2733 #else 2734 if (!slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */) 2735 #endif 2356 2736 { 2357 2737 shExtnLengthInBit++; … … 2369 2749 } 2370 2750 2371 if( slice->getPocMsbValPresentFlag() ) 2751 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2752 if (slice->getPocMsbNeeded()) 2753 { 2754 slice->setPocMsbValPresentFlag(true); 2755 } 2756 #endif 2757 2758 if (slice->getPocMsbValPresentFlag()) 2372 2759 { 2373 2760 UInt lengthVal = 1; … … 2403 2790 } 2404 2791 2405 if( !slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */ ) 2406 { 2792 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2793 if (!slice->getPocMsbValRequiredFlag() && slice->getVPS()->getVpsPocLsbAlignedFlag()) 2794 #else 2795 if (!slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */) 2796 #endif 2797 { 2798 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2799 WRITE_FLAG( slice->getPocMsbValPresentFlag(), "poc_msb_cycle_val_present_flag" ); 2800 #else 2407 2801 WRITE_FLAG( slice->getPocMsbValPresentFlag(), "poc_msb_val_present_flag" ); 2408 } 2409 if( slice->getPocMsbValPresentFlag() ) 2410 { 2411 assert( slice->getPocMsbVal() % maxPocLsb == 0 ); 2412 WRITE_UVLC( slice->getPocMsbVal() / maxPocLsb, "poc_msb_val" ); 2802 #endif 2803 } 2804 if (slice->getPocMsbValPresentFlag()) 2805 { 2806 assert(slice->getPocMsbVal() % maxPocLsb == 0); 2807 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 2808 WRITE_UVLC(slice->getPocMsbVal() / maxPocLsb, "poc_msb_cycle_val"); 2809 #else 2810 WRITE_UVLC(slice->getPocMsbVal() / maxPocLsb, "poc_msb_val"); 2811 #endif 2413 2812 } 2414 2813 for (Int i = 0; i < shExtnAdditionalBits; i++) … … 2755 3154 Void TEncCavlc::xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) 2756 3155 { 3156 #if R0150_CGS_SIGNAL_CONSTRAINTS 3157 UInt uiNumRefLayers = ( UInt )pc3DAsymLUT->getRefLayerNum(); 3158 WRITE_UVLC( uiNumRefLayers - 1 , "num_cm_ref_layers_minus1" ); 3159 for( UInt i = 0 ; i < uiNumRefLayers ; i++ ) 3160 { 3161 WRITE_CODE( pc3DAsymLUT->getRefLayerId( i ) , 6 , "cm_ref_layer_id" ); 3162 } 3163 #endif 2757 3164 assert( pc3DAsymLUT->getCurOctantDepth() < 4 ); 2758 3165 WRITE_CODE( pc3DAsymLUT->getCurOctantDepth() , 2 , "cm_octant_depth" ); … … 2760 3167 WRITE_CODE( pc3DAsymLUT->getCurYPartNumLog2() , 2 , "cm_y_part_num_log2" ); 2761 3168 assert( pc3DAsymLUT->getInputBitDepthY() < 16 ); 3169 #if R0150_CGS_SIGNAL_CONSTRAINTS 3170 WRITE_UVLC( pc3DAsymLUT->getInputBitDepthY() - 8 , "cm_input_luma_bit_depth_minus8" ); 3171 WRITE_UVLC( pc3DAsymLUT->getInputBitDepthC() - 8 , "cm_input_chroma_bit_depth_minus8" ); 3172 WRITE_UVLC( pc3DAsymLUT->getOutputBitDepthY() - 8 , "cm_output_luma_bit_depth_minus8" ); 3173 WRITE_UVLC( pc3DAsymLUT->getOutputBitDepthC() - 8 , "cm_output_chroma_bit_depth_minus8" ); 3174 #else 2762 3175 WRITE_CODE( pc3DAsymLUT->getInputBitDepthY() - 8 , 3 , "cm_input_bit_depth_minus8" ); 2763 3176 WRITE_SVLC(pc3DAsymLUT->getInputBitDepthC()-pc3DAsymLUT->getInputBitDepthY(), "cm_input_bit_depth_chroma delta"); … … 2765 3178 WRITE_CODE( pc3DAsymLUT->getOutputBitDepthY() - 8 , 3 , "cm_output_bit_depth_minus8" ); 2766 3179 WRITE_SVLC(pc3DAsymLUT->getOutputBitDepthC()-pc3DAsymLUT->getOutputBitDepthY(), "cm_output_bit_depth_chroma_delta"); 3180 #endif 2767 3181 assert( pc3DAsymLUT->getResQuantBit() < 4 ); 2768 3182 WRITE_CODE( pc3DAsymLUT->getResQuantBit() , 2 , "cm_res_quant_bit" ); 2769 3183 #if R0300_CGS_RES_COEFF_CODING 3184 xFindDeltaBits( pc3DAsymLUT ); 3185 assert(pc3DAsymLUT->getDeltaBits() >=1 && pc3DAsymLUT->getDeltaBits() <= 4); 3186 WRITE_CODE( pc3DAsymLUT->getDeltaBits()-1 , 2 , "cm_delta_bit" ); 3187 #endif 3188 #if R0151_CGS_3D_ASYMLUT_IMPROVE 3189 if( pc3DAsymLUT->getCurOctantDepth() == 1 ) 3190 { 3191 WRITE_SVLC( pc3DAsymLUT->getAdaptChromaThresholdU() - ( 1 << ( pc3DAsymLUT->getInputBitDepthC() - 1 ) ) , "cm_adapt_threshold_u_delta" ); 3192 WRITE_SVLC( pc3DAsymLUT->getAdaptChromaThresholdV() - ( 1 << ( pc3DAsymLUT->getInputBitDepthC() - 1 ) ) , "cm_adapt_threshold_v_delta" ); 3193 } 3194 #endif 3195 3196 #if R0164_CGS_LUT_BUGFIX_CHECK 3197 pc3DAsymLUT->xInitCuboids(); 3198 #endif 2770 3199 xCode3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); 3200 #if R0164_CGS_LUT_BUGFIX_CHECK 3201 xCuboidsFilledCheck( false ); 3202 pc3DAsymLUT->display( false ); 3203 #endif 2771 3204 } 2772 3205 … … 2793 3226 else 2794 3227 { 3228 #if R0300_CGS_RES_COEFF_CODING 3229 Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-pc3DAsymLUT->getDeltaBits() ; 3230 nFLCbits = nFLCbits >= 0 ? nFLCbits : 0; 3231 #endif 2795 3232 for( Int l = 0 ; l < nYPartNum ; l++ ) 2796 3233 { 3234 #if R0164_CGS_LUT_BUGFIX 3235 Int shift = pc3DAsymLUT->getCurOctantDepth() - nDepth ; 3236 #endif 2797 3237 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 2798 3238 { 3239 #if R0164_CGS_LUT_BUGFIX 3240 SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + (l<<shift) , uIdx , vIdx , nVertexIdx ); 3241 #else 2799 3242 SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx ); 3243 #endif 2800 3244 UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0; 2801 3245 WRITE_FLAG( uiCodeVertex , "coded_vertex_flag" ); 2802 3246 if( uiCodeVertex ) 2803 3247 { 3248 #if R0151_CGS_3D_ASYMLUT_IMPROVE 3249 #if R0300_CGS_RES_COEFF_CODING 3250 xWriteParam( sRes.Y, nFLCbits ); 3251 xWriteParam( sRes.U, nFLCbits ); 3252 xWriteParam( sRes.V, nFLCbits ); 3253 #else 3254 xWriteParam( sRes.Y ); 3255 xWriteParam( sRes.U ); 3256 xWriteParam( sRes.V ); 3257 #endif 3258 #else 2804 3259 WRITE_SVLC( sRes.Y , "resY" ); 2805 3260 WRITE_SVLC( sRes.U , "resU" ); 2806 3261 WRITE_SVLC( sRes.V , "resV" ); 2807 } 2808 } 2809 } 2810 } 2811 } 3262 #endif 3263 } 3264 } 3265 #if R0164_CGS_LUT_BUGFIX_CHECK 3266 pc3DAsymLUT->xSetExplicit( yIdx + (l<<shift) , uIdx , vIdx ); 3267 #endif 3268 } 3269 } 3270 } 3271 3272 #if R0151_CGS_3D_ASYMLUT_IMPROVE 3273 #if R0300_CGS_RES_COEFF_CODING 3274 Void TEncCavlc::xWriteParam( Int param, UInt rParam) 3275 #else 3276 Void TEncCavlc::xWriteParam( Int param) 3277 #endif 3278 { 3279 #if !R0300_CGS_RES_COEFF_CODING 3280 const UInt rParam = 7; 3281 #endif 3282 Int codeNumber = abs(param); 3283 WRITE_UVLC(codeNumber / (1 << rParam), "quotient"); 3284 WRITE_CODE((codeNumber % (1 << rParam)), rParam, "remainder"); 3285 if (abs(param)) 3286 WRITE_FLAG( param <0, "sign"); 3287 } 3288 #endif 3289 3290 #if R0300_CGS_RES_COEFF_CODING 3291 Void TEncCavlc::xFindDeltaBits( TCom3DAsymLUT * pc3DAsymLUT ) 3292 { 3293 Int nDeltaBits; 3294 Int nBestDeltaBits = -1; 3295 Int nBestBits = MAX_INT; 3296 for( nDeltaBits = 1; nDeltaBits < 5; nDeltaBits++) 3297 { 3298 Int nCurBits = 0; 3299 xTally3DAsymLUTOctantBits( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth(), nDeltaBits, nCurBits ); 3300 //printf("%d, %d, %d\n", nDeltaBits, nCurBits, nBestBits); 3301 if(nCurBits < nBestBits) 3302 { 3303 nBestDeltaBits = nDeltaBits; 3304 nBestBits = nCurBits; 3305 } 3306 } 3307 3308 assert(nBestDeltaBits >=1 && nBestDeltaBits < 5); 3309 pc3DAsymLUT->setDeltaBits(nBestDeltaBits); 3310 } 3311 3312 Void TEncCavlc::xTally3DAsymLUTOctantBits( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength, Int nDeltaBits, Int& nCurBits ) 3313 { 3314 UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); 3315 if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) 3316 nCurBits ++; 3317 Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); 3318 if( uiOctantSplit ) 3319 { 3320 Int nHalfLength = nLength >> 1; 3321 for( Int l = 0 ; l < 2 ; l++ ) 3322 { 3323 for( Int m = 0 ; m < 2 ; m++ ) 3324 { 3325 for( Int n = 0 ; n < 2 ; n++ ) 3326 { 3327 xTally3DAsymLUTOctantBits( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength, nDeltaBits, nCurBits ); 3328 } 3329 } 3330 } 3331 } 3332 else 3333 { 3334 Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-nDeltaBits ; 3335 nFLCbits = nFLCbits >= 0 ? nFLCbits:0; 3336 //printf("nFLCbits = %d\n", nFLCbits); 3337 3338 for( Int l = 0 ; l < nYPartNum ; l++ ) 3339 { 3340 for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) 3341 { 3342 SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx ); 3343 3344 UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0; 3345 nCurBits++; 3346 if( uiCodeVertex ) 3347 { 3348 xCheckParamBits( sRes.Y, nFLCbits, nCurBits ); 3349 xCheckParamBits( sRes.U, nFLCbits, nCurBits ); 3350 xCheckParamBits( sRes.V, nFLCbits, nCurBits ); 3351 } 3352 } 3353 } 3354 } 3355 } 3356 3357 Void TEncCavlc::xCheckParamBits( Int param, Int rParam, Int &nBits) 3358 { 3359 Int codeNumber = abs(param); 3360 Int codeQuotient = codeNumber >> rParam; 3361 Int qLen; 3362 3363 UInt uiLength = 1; 3364 UInt uiTemp = ++codeQuotient; 3365 3366 while( 1 != uiTemp ) 3367 { 3368 uiTemp >>= 1; 3369 uiLength += 2; 3370 } 3371 3372 qLen = (uiLength >> 1); 3373 qLen += ((uiLength+1) >> 1); 3374 3375 nBits += qLen; 3376 nBits += rParam; 3377 if (abs(param)) 3378 nBits++; 3379 } 3380 #endif 3381 #if VPS_VUI_BSP_HRD_PARAMS 3382 Void TEncCavlc::codeVpsVuiBspHrdParams(TComVPS * const vps) 3383 { 3384 WRITE_UVLC( vps->getVpsNumAddHrdParams(), "vps_num_add_hrd_params" ); 3385 for( Int i = vps->getNumHrdParameters(), j = 0; i < vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams(); i++, j++ ) // j = i - vps->getNumHrdParameters() 3386 { 3387 if( i > 0 ) 3388 { 3389 WRITE_FLAG( vps->getCprmsAddPresentFlag(j), "cprms_add_present_flag[i]" ); 3390 } 3391 WRITE_UVLC( vps->getNumSubLayerHrdMinus1(j), "num_sub_layer_hrd_minus1[i]" ); 3392 codeHrdParameters(vps->getBspHrd(j), i == 0 ? true : vps->getCprmsAddPresentFlag(j), vps->getNumSubLayerHrdMinus1(j)); 3393 } 3394 for( Int h = 1; h < vps->getNumOutputLayerSets(); h++ ) 3395 { 3396 Int lsIdx = vps->getOutputLayerSetIdx( h ); 3397 WRITE_UVLC( vps->getNumSignalledPartitioningSchemes(h), "num_signalled_partitioning_schemes[h]"); 3398 for( Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++ ) 3399 { 3400 WRITE_UVLC( vps->getNumPartitionsInSchemeMinus1(h, j), "num_partitions_in_scheme_minus1[h][j]" ); 3401 for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++ ) 3402 { 3403 for( Int r = 0; r < vps->getNumLayersInIdList( lsIdx ); r++ ) 3404 { 3405 WRITE_FLAG( vps->getLayerIncludedInPartitionFlag(h, j, k, r), "layer_included_in_partition_flag[h][j][k][r]" ); 3406 } 3407 } 3408 } 3409 for( Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++ ) 3410 { 3411 for( Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++ ) 3412 { 3413 WRITE_UVLC(vps->getNumBspSchedulesMinus1(h, i, t), "num_bsp_schedules_minus1[h][i][t]"); 3414 for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ ) 3415 { 3416 for( Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++ ) 3417 { 3418 WRITE_UVLC( vps->getBspHrdIdx(h, i, t, j, k), "bsp_comb_hrd_idx[h][i][t][j][k]"); 3419 WRITE_UVLC( vps->getBspSchedIdx(h, i, t, j, k), "bsp_comb_sched_idx[h][i][t][j][k]"); 3420 } 3421 } 3422 } 3423 } 3424 } 3425 } 3426 #endif 2812 3427 #endif 2813 3428 //! \} -
trunk/source/Lib/TLibEncoder/TEncCavlc.h
r815 r906 169 169 Void codeVpsDpbSizeTable (TComVPS *vps); 170 170 #endif 171 #if Q0048_CGS_3D_ASYMLUT 171 #if VPS_VUI_BSP_HRD_PARAMS 172 Void codeVpsVuiBspHrdParams (TComVPS * const); 173 #endif 174 #if Q0048_CGS_3D_ASYMLUT 175 #if R0179_ENC_OPT_3DLUT_SIZE 176 public: 177 Void xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 178 protected: 179 Void xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 180 #else 172 181 protected: 173 182 Void xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ); 174 183 Void xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ); 175 184 #endif 185 #if R0151_CGS_3D_ASYMLUT_IMPROVE 186 #if R0300_CGS_RES_COEFF_CODING 187 Void xWriteParam( Int param, UInt nFLCBits); 188 Void xCheckParamBits( Int param, Int nFLCBits, Int & nCurBits); 189 Void xTally3DAsymLUTOctantBits( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength, Int nDeltaBits, Int &nCurBits); 190 Void xFindDeltaBits( TCom3DAsymLUT * pc3DAsymLUT ); 191 #else 192 Void xWriteParam( Int param); 193 #endif 194 #endif 195 #endif 176 196 #endif //SVC_EXTENSION 177 197 -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r815 r906 107 107 Int m_iSourceWidth; 108 108 Int m_iSourceHeight; 109 Int m_conformanceMode;110 109 Window m_conformanceWindow; 111 110 Int m_framesToBeEncoded; … … 208 207 Bool m_bPCMFilterDisableFlag; 209 208 Bool m_loopFilterAcrossTilesEnabledFlag; 210 Int m_iUniformSpacingIdr;209 Bool m_tileUniformSpacingFlag; 211 210 Int m_iNumColumnsMinus1; 212 UInt* m_puiColumnWidth;213 211 Int m_iNumRowsMinus1; 214 UInt* m_puiRowHeight; 212 std::vector<Int> m_tileColumnWidth; 213 std::vector<Int> m_tileRowHeight; 215 214 216 215 Int m_iWaveFrontSynchro; … … 248 247 Int* m_codedPivotValue; 249 248 Int* m_targetPivotValue; 250 #if P0050_KNEE_FUNCTION_SEI251 Bool m_kneeSEIEnabled;252 Int m_kneeSEIId;253 Bool m_kneeSEICancelFlag;254 Bool m_kneeSEIPersistenceFlag;255 Bool m_kneeSEIMappingFlag;256 Int m_kneeSEIInputDrange;257 Int m_kneeSEIInputDispLuminance;258 Int m_kneeSEIOutputDrange;259 Int m_kneeSEIOutputDispLuminance;260 Int m_kneeSEINumKneePointsMinus1;261 Int* m_kneeSEIInputKneePoint;262 Int* m_kneeSEIOutputKneePoint;263 #endif264 #if Q0074_SEI_COLOR_MAPPING265 Char* m_seiColorMappingFile;266 #endif267 249 Int m_framePackingSEIEnabled; 268 250 Int m_framePackingSEIType; … … 276 258 Int m_SOPDescriptionSEIEnabled; 277 259 Int m_scalableNestingSEIEnabled; 278 #if Q0189_TMVP_CONSTRAINTS279 Int m_TMVPConstraintsSEIEnabled;280 #endif281 260 //====== Weighted Prediction ======== 282 261 Bool m_useWeightedPred; //< Use of Weighting Prediction (P_SLICE) … … 388 367 Int m_nCGSMaxYPartNumLog2; 389 368 Int m_nCGSLUTBit; 369 #if R0151_CGS_3D_ASYMLUT_IMPROVE 370 Int m_nCGSAdaptiveChroma; 371 #endif 372 #if R0179_ENC_OPT_3DLUT_SIZE 373 Int m_nCGSLutSizeRDO; 374 #endif 375 #endif 376 #if P0050_KNEE_FUNCTION_SEI 377 Bool m_kneeSEIEnabled; 378 Int m_kneeSEIId; 379 Bool m_kneeSEICancelFlag; 380 Bool m_kneeSEIPersistenceFlag; 381 Bool m_kneeSEIMappingFlag; 382 Int m_kneeSEIInputDrange; 383 Int m_kneeSEIInputDispLuminance; 384 Int m_kneeSEIOutputDrange; 385 Int m_kneeSEIOutputDispLuminance; 386 Int m_kneeSEINumKneePointsMinus1; 387 Int* m_kneeSEIInputKneePoint; 388 Int* m_kneeSEIOutputKneePoint; 389 #endif 390 #if Q0189_TMVP_CONSTRAINTS 391 Int m_TMVPConstraintsSEIEnabled; 390 392 #endif 391 393 #endif //SVC_EXTENSION 394 #if Q0074_COLOUR_REMAPPING_SEI 395 Char* m_colourRemapSEIFile; ///< SEI Colour Remapping File (initialized from external file) 396 Int m_colourRemapSEIId; 397 Bool m_colourRemapSEICancelFlag; 398 Bool m_colourRemapSEIPersistenceFlag; 399 Bool m_colourRemapSEIVideoSignalInfoPresentFlag; 400 Bool m_colourRemapSEIFullRangeFlag; 401 Int m_colourRemapSEIPrimaries; 402 Int m_colourRemapSEITransferFunction; 403 Int m_colourRemapSEIMatrixCoefficients; 404 Int m_colourRemapSEIInputBitDepth; 405 Int m_colourRemapSEIBitDepth; 406 Int m_colourRemapSEIPreLutNumValMinus1[3]; 407 Int* m_colourRemapSEIPreLutCodedValue[3]; 408 Int* m_colourRemapSEIPreLutTargetValue[3]; 409 Bool m_colourRemapSEIMatrixPresentFlag; 410 Int m_colourRemapSEILog2MatrixDenom; 411 Int m_colourRemapSEICoeffs[3][3]; 412 Int m_colourRemapSEIPostLutNumValMinus1[3]; 413 Int* m_colourRemapSEIPostLutCodedValue[3]; 414 Int* m_colourRemapSEIPostLutTargetValue[3]; 415 #endif 392 416 393 417 public: 394 418 TEncCfg() 395 : m_ puiColumnWidth()396 , m_ puiRowHeight()419 : m_tileColumnWidth() 420 , m_tileRowHeight() 397 421 {} 398 422 399 423 virtual ~TEncCfg() 400 { 401 delete[] m_puiColumnWidth; 402 delete[] m_puiRowHeight; 403 } 424 {} 404 425 405 426 Void setProfile(Profile::Name profile) { m_profile = profile; } … … 412 433 413 434 Window &getConformanceWindow() { return m_conformanceWindow; } 414 #if P0312_VERT_PHASE_ADJ 435 #if P0312_VERT_PHASE_ADJ && !R0209_GENERIC_PHASE 415 436 Void setConformanceWindow (Int confLeft, Int confRight, Int confTop, Int confBottom ) { m_conformanceWindow.setWindow (confLeft, confRight, confTop, confBottom, false); } 416 437 #else … … 437 458 Void setMaxRefPicNum ( Int iMaxRefPicNum ) { m_iMaxRefPicNum = iMaxRefPicNum; } 438 459 439 BoolgetMaxTempLayer () { return m_maxTempLayer; }460 Int getMaxTempLayer () { return m_maxTempLayer; } 440 461 Void setMaxTempLayer ( Int maxTempLayer ) { m_maxTempLayer = maxTempLayer; } 441 462 //======== Transform ============= … … 582 603 Void setLFCrossTileBoundaryFlag ( Bool val ) { m_loopFilterAcrossTilesEnabledFlag = val; } 583 604 Bool getLFCrossTileBoundaryFlag () { return m_loopFilterAcrossTilesEnabledFlag; } 584 Void set UniformSpacingIdr ( Int i ) { m_iUniformSpacingIdr = i; }585 Int getUniformSpacingIdr () { return m_iUniformSpacingIdr; }605 Void setTileUniformSpacingFlag ( Bool b ) { m_tileUniformSpacingFlag = b; } 606 Bool getTileUniformSpacingFlag () { return m_tileUniformSpacingFlag; } 586 607 Void setNumColumnsMinus1 ( Int i ) { m_iNumColumnsMinus1 = i; } 587 608 Int getNumColumnsMinus1 () { return m_iNumColumnsMinus1; } 588 Void setColumnWidth ( UInt* columnWidth ) 589 { 590 if( m_iUniformSpacingIdr == 0 && m_iNumColumnsMinus1 > 0 ) 591 { 592 Int m_iWidthInCU = ( m_iSourceWidth%g_uiMaxCUWidth ) ? m_iSourceWidth/g_uiMaxCUWidth + 1 : m_iSourceWidth/g_uiMaxCUWidth; 593 m_puiColumnWidth = new UInt[ m_iNumColumnsMinus1 ]; 594 595 for(Int i=0; i<m_iNumColumnsMinus1; i++) 596 { 597 m_puiColumnWidth[i] = columnWidth[i]; 598 printf("col: m_iWidthInCU= %4d i=%4d width= %4d\n",m_iWidthInCU,i,m_puiColumnWidth[i]); //AFU 599 } 600 } 601 } 602 UInt getColumnWidth ( UInt columnidx ) { return *( m_puiColumnWidth + columnidx ); } 609 Void setColumnWidth ( const std::vector<Int>& columnWidth ) { m_tileColumnWidth = columnWidth; } 610 UInt getColumnWidth ( UInt columnIdx ) { return m_tileColumnWidth[columnIdx]; } 603 611 Void setNumRowsMinus1 ( Int i ) { m_iNumRowsMinus1 = i; } 604 612 Int getNumRowsMinus1 () { return m_iNumRowsMinus1; } 605 Void setRowHeight (UInt* rowHeight) 606 { 607 if( m_iUniformSpacingIdr == 0 && m_iNumRowsMinus1 > 0 ) 608 { 609 Int m_iHeightInCU = ( m_iSourceHeight%g_uiMaxCUHeight ) ? m_iSourceHeight/g_uiMaxCUHeight + 1 : m_iSourceHeight/g_uiMaxCUHeight; 610 m_puiRowHeight = new UInt[ m_iNumRowsMinus1 ]; 611 612 for(Int i=0; i<m_iNumRowsMinus1; i++) 613 { 614 m_puiRowHeight[i] = rowHeight[i]; 615 printf("row: m_iHeightInCU=%4d i=%4d height=%4d\n",m_iHeightInCU,i,m_puiRowHeight[i]); //AFU 616 } 617 } 618 } 619 UInt getRowHeight ( UInt rowIdx ) { return *( m_puiRowHeight + rowIdx ); } 613 Void setRowHeight ( const std::vector<Int>& rowHeight) { m_tileRowHeight = rowHeight; } 614 UInt getRowHeight ( UInt rowIdx ) { return m_tileRowHeight[rowIdx]; } 620 615 Void xCheckGSParameters(); 621 616 Void setWaveFrontSynchro(Int iWaveFrontSynchro) { m_iWaveFrontSynchro = iWaveFrontSynchro; } … … 711 706 Int* getKneeSEIOutputKneePoint() { return m_kneeSEIOutputKneePoint; } 712 707 #endif 713 #if Q0074_SEI_COLOR_MAPPING 714 Void setColorMappingInfoSEIFile( Char* nameFile ) { m_seiColorMappingFile = nameFile; } 715 Char* getColorMappingInfoSEIFile() { return m_seiColorMappingFile; } 708 #if Q0074_COLOUR_REMAPPING_SEI 709 Void setCRISEIFile( Char* pch ) { m_colourRemapSEIFile = pch; } 710 Char* getCRISEIFile() { return m_colourRemapSEIFile; } 711 Void setCRISEIId(Int i) { m_colourRemapSEIId = i; } 712 Int getCRISEIId() { return m_colourRemapSEIId; } 713 Void setCRISEICancelFlag(Bool b) { m_colourRemapSEICancelFlag = b; } 714 Bool getCRISEICancelFlag() { return m_colourRemapSEICancelFlag; } 715 Void setCRISEIPersistenceFlag(Bool b) { m_colourRemapSEIPersistenceFlag = b; } 716 Bool getCRISEIPersistenceFlag() { return m_colourRemapSEIPersistenceFlag; } 717 Void setCRISEIVideoSignalInfoPresentFlag(Bool b) { m_colourRemapSEIVideoSignalInfoPresentFlag = b; } 718 Bool getCRISEIVideoSignalInfoPresentFlag() { return m_colourRemapSEIVideoSignalInfoPresentFlag; } 719 Void setCRISEIFullRangeFlag(Bool b) { m_colourRemapSEIFullRangeFlag = b; } 720 Bool getCRISEIFullRangeFlag() { return m_colourRemapSEIFullRangeFlag; } 721 Void setCRISEIPrimaries(Int i) { m_colourRemapSEIPrimaries = i; } 722 Int getCRISEIPrimaries() { return m_colourRemapSEIPrimaries; } 723 Void setCRISEITransferFunction(Int i) { m_colourRemapSEITransferFunction = i; } 724 Int getCRISEITransferFunction() { return m_colourRemapSEITransferFunction; } 725 Void setCRISEIMatrixCoefficients(Int i) { m_colourRemapSEIMatrixCoefficients = i; } 726 Int getCRISEIMatrixCoefficients() { return m_colourRemapSEIMatrixCoefficients; } 727 Void setCRISEIInputBitDepth(Int i) { m_colourRemapSEIInputBitDepth = i; } 728 Int getCRISEIInputBitDepth() { return m_colourRemapSEIInputBitDepth; } 729 Void setCRISEIBitDepth(Int i) { m_colourRemapSEIBitDepth = i; } 730 Int getCRISEIBitDepth() { return m_colourRemapSEIBitDepth; } 731 Void setCRISEIPreLutNumValMinus1(Int *i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutNumValMinus1[c] = i[c]; } 732 Int getCRISEIPreLutNumValMinus1(Int i) { return m_colourRemapSEIPreLutNumValMinus1[i]; } 733 Void setCRISEIPreLutCodedValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutCodedValue[c] = i[c]; } 734 Int* getCRISEIPreLutCodedValue(Int i) { return m_colourRemapSEIPreLutCodedValue[i]; } 735 Void setCRISEIPreLutTargetValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPreLutTargetValue[c] = i[c]; } 736 Int* getCRISEIPreLutTargetValue(Int i) { return m_colourRemapSEIPreLutTargetValue[i]; } 737 Void setCRISEIMatrixPresentFlag(Bool b) { m_colourRemapSEIMatrixPresentFlag = b; } 738 Bool getCRISEIMatrixPresentFlag() { return m_colourRemapSEIMatrixPresentFlag; } 739 Void setCRISEILog2MatrixDenom(Int i) { m_colourRemapSEILog2MatrixDenom = i; } 740 Int getCRISEILog2MatrixDenom() { return m_colourRemapSEILog2MatrixDenom; } 741 Void setCRISEICoeffs(Int i[3][3]) { for(Int c=0 ; c<3 ; c++) for(Int j=0 ; j<3 ; j++) m_colourRemapSEICoeffs[c][j] = i[c][j]; } 742 Int* getCRISEICoeffs(Int i) { return m_colourRemapSEICoeffs[i]; } 743 Void setCRISEIPostLutNumValMinus1(Int *i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutNumValMinus1[c] = i[c]; } 744 Int getCRISEIPostLutNumValMinus1(Int i) { return m_colourRemapSEIPostLutNumValMinus1[i]; } 745 Void setCRISEIPostLutCodedValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutCodedValue[c] = i[c]; } 746 Int* getCRISEIPostLutCodedValue(Int i) { return m_colourRemapSEIPostLutCodedValue[i]; } 747 Void setCRISEIPostLutTargetValue(Int **i) { for(Int c=0 ; c<3 ; c++) m_colourRemapSEIPostLutTargetValue[c] = i[c]; } 748 Int* getCRISEIPostLutTargetValue(Int i) { return m_colourRemapSEIPostLutTargetValue[i]; } 716 749 #endif 717 750 Void setFramePackingArrangementSEIEnabled(Int b) { m_framePackingSEIEnabled = b; } … … 865 898 UInt getNumLayer () { return m_numLayer; } 866 899 Void setNumLayer (UInt uiNum) { m_numLayer = uiNum; } 867 Void setConformanceMode (Int mode) { m_conformanceMode = mode; }868 900 Void setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; } 869 901 Void setElRapSliceTypeB(Int bEnabled) {m_elRapSliceBEnabled = bEnabled;} … … 971 1003 Void setCGSLUTBit(Int n) { m_nCGSLUTBit = n; } 972 1004 Int getCGSLUTBit() { return m_nCGSLUTBit; } 1005 #if R0151_CGS_3D_ASYMLUT_IMPROVE 1006 Void setCGSAdaptChroma(Int n) { m_nCGSAdaptiveChroma = n; } 1007 Int getCGSAdaptChroma() { return m_nCGSAdaptiveChroma; } 1008 #endif 1009 #if R0179_ENC_OPT_3DLUT_SIZE 1010 Void setCGSLutSizeRDO(Int n) { m_nCGSLutSizeRDO = n; } 1011 Int getCGSLutSizeRDO() { return m_nCGSLutSizeRDO; } 1012 #endif 973 1013 #endif 974 1014 #endif -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r815 r906 49 49 #include <time.h> 50 50 #include <math.h> 51 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 52 #include <limits.h> 53 #endif 51 54 52 55 using namespace std; … … 202 205 seiActiveParameterSets->m_selfContainedCvsFlag = false; 203 206 seiActiveParameterSets->m_noParameterSetUpdateFlag = false; 207 #if !R0247_SEI_ACTIVE 204 208 seiActiveParameterSets->numSpsIdsMinus1 = 0; 205 209 seiActiveParameterSets->activeSeqParameterSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1); 206 210 seiActiveParameterSets->activeSeqParameterSetId[0] = sps->getSPSId(); 211 #else 212 seiActiveParameterSets->numSpsIdsMinus1 = m_pcCfg->getNumLayer()-1; 213 seiActiveParameterSets->activeSeqParameterSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1); 214 seiActiveParameterSets->layerSpsIdx.resize(seiActiveParameterSets->numSpsIdsMinus1+ 1); 215 for (Int c=0; c <= seiActiveParameterSets->numSpsIdsMinus1; c++) 216 { 217 seiActiveParameterSets->activeSeqParameterSetId[c] = c; 218 } 219 for (Int c=1; c <= seiActiveParameterSets->numSpsIdsMinus1; c++) 220 { 221 seiActiveParameterSets->layerSpsIdx[c] = c; 222 } 223 #endif 207 224 return seiActiveParameterSets; 208 225 } … … 365 382 #endif 366 383 367 #if Q0074_ SEI_COLOR_MAPPING368 SEIColo rMappingInfo* TEncGOP::xCreateSEIColorMappingInfo( Char* file)384 #if Q0074_COLOUR_REMAPPING_SEI 385 SEIColourRemappingInfo* TEncGOP::xCreateSEIColourRemappingInfo() 369 386 { 370 SEIColorMappingInfo *seiColorMappingInfo = new SEIColorMappingInfo(); 371 372 FILE* fic = fopen( file, "r" ); 373 374 Int iVal, retval; 375 376 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMapId ); 377 retval = fscanf( fic, "%d", &iVal ); 378 seiColorMappingInfo->m_colorMapCancelFlag = iVal; 379 if( !seiColorMappingInfo->m_colorMapCancelFlag ) 380 { 381 retval = fscanf( fic, "%d", &iVal ); 382 seiColorMappingInfo->m_colorMapPersistenceFlag = iVal; 383 retval = fscanf( fic, "%d", &iVal ); 384 seiColorMappingInfo->m_colorMap_video_signal_type_present_flag = iVal; 385 if( seiColorMappingInfo->m_colorMap_video_signal_type_present_flag ) 386 { 387 retval = fscanf( fic, "%d", &iVal ); 388 seiColorMappingInfo->m_colorMap_video_full_range_flag = iVal; 389 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_primaries ); 390 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_transfer_characteristics ); 391 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colorMap_matrix_coeffs ); 392 } 393 } 394 395 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colour_map_coded_data_bit_depth ); 396 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_colour_map_target_bit_depth ); 397 retval = fscanf( fic, "%d", &iVal ); 398 seiColorMappingInfo->m_colorMapModelId = iVal; 399 400 assert( seiColorMappingInfo->m_colorMapModelId == 0 ); 401 402 for( Int i=0 ; i<3 ; i++ ) 403 { 404 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_num_input_pivots[i] ); 405 seiColorMappingInfo->m_coded_input_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_input_pivots[i] ]; 406 seiColorMappingInfo->m_target_input_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_input_pivots[i] ]; 407 for( Int j=0 ; j<seiColorMappingInfo->m_num_input_pivots[i] ; j++ ) 408 { 409 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_coded_input_pivot_value[i][j] ); 410 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_target_input_pivot_value[i][j] ); 411 } 412 } 413 414 retval = fscanf( fic, "%d", &iVal ); 415 seiColorMappingInfo->m_matrix_flag = iVal; 416 if( seiColorMappingInfo->m_matrix_flag ) 417 { 418 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_log2_matrix_denom ); 419 for( Int i=0 ; i<3 ; i++ ) 420 { 421 for( Int j=0 ; j<3 ; j++ ) 422 { 423 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_matrix_coef[i][j] ); 424 } 425 } 426 } 427 428 for( Int i=0 ; i<3 ; i++ ) 429 { 430 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_num_output_pivots[i] ); 431 seiColorMappingInfo->m_coded_output_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_output_pivots[i] ]; 432 seiColorMappingInfo->m_target_output_pivot_value[i] = new Int[ seiColorMappingInfo->m_num_output_pivots[i] ]; 433 for( Int j=0 ; j<seiColorMappingInfo->m_num_output_pivots[i] ; j++ ) 434 { 435 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_coded_output_pivot_value[i][j] ); 436 retval = fscanf( fic, "%d", &seiColorMappingInfo->m_target_output_pivot_value[i][j] ); 437 } 438 } 439 440 fclose( fic ); 441 442 if( retval != 1 ) 443 { 444 printf("Error: can't read color mapping information\n"); 445 } 446 447 return seiColorMappingInfo; 387 SEIColourRemappingInfo *seiColourRemappingInfo = new SEIColourRemappingInfo(); 388 seiColourRemappingInfo->m_colourRemapId = m_pcCfg->getCRISEIId(); 389 seiColourRemappingInfo->m_colourRemapCancelFlag = m_pcCfg->getCRISEICancelFlag(); 390 if( !seiColourRemappingInfo->m_colourRemapCancelFlag ) 391 { 392 seiColourRemappingInfo->m_colourRemapPersistenceFlag = m_pcCfg->getCRISEIPersistenceFlag(); 393 seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag = m_pcCfg->getCRISEIVideoSignalInfoPresentFlag(); 394 if( seiColourRemappingInfo->m_colourRemapVideoSignalInfoPresentFlag ) 395 { 396 seiColourRemappingInfo->m_colourRemapFullRangeFlag = m_pcCfg->getCRISEIFullRangeFlag(); 397 seiColourRemappingInfo->m_colourRemapPrimaries = m_pcCfg->getCRISEIPrimaries(); 398 seiColourRemappingInfo->m_colourRemapTransferFunction = m_pcCfg->getCRISEITransferFunction(); 399 seiColourRemappingInfo->m_colourRemapMatrixCoefficients = m_pcCfg->getCRISEIMatrixCoefficients(); 400 } 401 seiColourRemappingInfo->m_colourRemapInputBitDepth = m_pcCfg->getCRISEIInputBitDepth(); 402 seiColourRemappingInfo->m_colourRemapBitDepth = m_pcCfg->getCRISEIBitDepth(); 403 for( Int c=0 ; c<3 ; c++ ) 404 { 405 seiColourRemappingInfo->m_preLutNumValMinus1[c] = m_pcCfg->getCRISEIPreLutNumValMinus1(c); 406 if( seiColourRemappingInfo->m_preLutNumValMinus1[c]>0 ) 407 { 408 seiColourRemappingInfo->m_preLutCodedValue[c].resize(seiColourRemappingInfo->m_preLutNumValMinus1[c]+1); 409 seiColourRemappingInfo->m_preLutTargetValue[c].resize(seiColourRemappingInfo->m_preLutNumValMinus1[c]+1); 410 for( Int i=0 ; i<=seiColourRemappingInfo->m_preLutNumValMinus1[c] ; i++) 411 { 412 seiColourRemappingInfo->m_preLutCodedValue[c][i] = (m_pcCfg->getCRISEIPreLutCodedValue(c))[i]; 413 seiColourRemappingInfo->m_preLutTargetValue[c][i] = (m_pcCfg->getCRISEIPreLutTargetValue(c))[i]; 414 } 415 } 416 } 417 seiColourRemappingInfo->m_colourRemapMatrixPresentFlag = m_pcCfg->getCRISEIMatrixPresentFlag(); 418 if( seiColourRemappingInfo->m_colourRemapMatrixPresentFlag ) 419 { 420 seiColourRemappingInfo->m_log2MatrixDenom = m_pcCfg->getCRISEILog2MatrixDenom(); 421 for( Int c=0 ; c<3 ; c++ ) 422 for( Int i=0 ; i<3 ; i++ ) 423 seiColourRemappingInfo->m_colourRemapCoeffs[c][i] = (m_pcCfg->getCRISEICoeffs(c))[i]; 424 } 425 for( Int c=0 ; c<3 ; c++ ) 426 { 427 seiColourRemappingInfo->m_postLutNumValMinus1[c] = m_pcCfg->getCRISEIPostLutNumValMinus1(c); 428 if( seiColourRemappingInfo->m_postLutNumValMinus1[c]>0 ) 429 { 430 seiColourRemappingInfo->m_postLutCodedValue[c].resize(seiColourRemappingInfo->m_postLutNumValMinus1[c]+1); 431 seiColourRemappingInfo->m_postLutTargetValue[c].resize(seiColourRemappingInfo->m_postLutNumValMinus1[c]+1); 432 for( Int i=0 ; i<=seiColourRemappingInfo->m_postLutNumValMinus1[c] ; i++) 433 { 434 seiColourRemappingInfo->m_postLutCodedValue[c][i] = (m_pcCfg->getCRISEIPostLutCodedValue(c))[i]; 435 seiColourRemappingInfo->m_postLutTargetValue[c][i] = (m_pcCfg->getCRISEIPostLutTargetValue(c))[i]; 436 } 437 } 438 } 439 } 440 return seiColourRemappingInfo; 448 441 } 449 442 #endif … … 453 446 OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI); 454 447 455 if(m_pcCfg->getActiveParameterSetsSEIEnabled()) 448 if(m_pcCfg->getActiveParameterSetsSEIEnabled() 449 #if R0247_SEI_ACTIVE 450 && m_layerId == 0 451 #endif 452 ) 456 453 { 457 454 SEIActiveParameterSets *sei = xCreateSEIActiveParameterSets (sps); … … 532 529 } 533 530 #endif 534 #if Q0074_ SEI_COLOR_MAPPING535 if( m_pcCfg->getColorMappingInfoSEIFile())536 { 537 SEIColo rMappingInfo *sei = xCreateSEIColorMappingInfo( m_pcCfg->getColorMappingInfoSEIFile());531 #if Q0074_COLOUR_REMAPPING_SEI 532 if(strlen(m_pcCfg->getCRISEIFile())) 533 { 534 SEIColourRemappingInfo *sei = xCreateSEIColourRemappingInfo (); 538 535 539 536 #if SVC_EXTENSION 540 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, m_layerId); // temporalId = 0 ?537 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, sps->getLayerId()); // SEI-CRI is applied per layer 541 538 #else 542 539 nalu = NALUnit(NAL_UNIT_PREFIX_SEI); … … 609 606 TEncSbac* pcSbacCoders = NULL; 610 607 TComOutputBitstream* pcSubstreamsOut = NULL; 611 #if Q0108_TSA_STSA612 Int flagTSTA = 0;613 #endif614 608 615 609 xInitGOP( iPOCLast, iNumPicRcvd, rcListPic, rcListPicYuvRecOut, isField ); … … 918 912 determinePocResetIdc(pocCurr, pcSlice); 919 913 914 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 915 Bool pocResettingFlag = false; 916 917 if (pcSlice->getPocResetIdc() != 0) 918 { 919 if (pcSlice->getVPS()->getVpsPocLsbAlignedFlag()) 920 { 921 pocResettingFlag = true; 922 } 923 else if (m_pcEncTop->getPocDecrementedInDPBFlag()) 924 { 925 pocResettingFlag = false; 926 } 927 else 928 { 929 pocResettingFlag = true; 930 } 931 } 932 #endif 933 920 934 // If reset, do the following steps: 935 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 936 if( pocResettingFlag ) 937 #else 921 938 if( pcSlice->getPocResetIdc() ) 939 #endif 922 940 { 923 941 updatePocValuesOfPics(pocCurr, pcSlice); … … 1020 1038 // inferring of the scaling list can be moved to the config file 1021 1039 UInt refLayerId = 0; 1040 #if VPS_AVC_BL_FLAG_REMOVAL 1041 if( m_layerId > 0 && !m_pcEncTop->getVPS()->getNonHEVCBaseLayerFlag() && m_pcEncTop->getVPS()->getRecursiveRefLayerFlag( m_layerId, refLayerId ) ) 1042 #else 1022 1043 if( m_layerId > 0 && !m_pcEncTop->getVPS()->getAvcBaseLayerFlag() && m_pcEncTop->getVPS()->getRecursiveRefLayerFlag( m_layerId, refLayerId ) ) 1044 #endif 1023 1045 { 1024 1046 m_pcEncTop->getSPS()->setInferScalingListFlag( true ); … … 1050 1072 // inferring of the scaling list can be moved to the config file 1051 1073 UInt refLayerId = 0; 1074 #if VPS_AVC_BL_FLAG_REMOVAL 1075 if( m_layerId > 0 && !m_pcEncTop->getVPS()->getNonHEVCBaseLayerFlag() && m_pcEncTop->getVPS()->getRecursiveRefLayerFlag( m_layerId, refLayerId ) ) 1076 #else 1052 1077 if( m_layerId > 0 && !m_pcEncTop->getVPS()->getAvcBaseLayerFlag() && m_pcEncTop->getVPS()->getRecursiveRefLayerFlag( m_layerId, refLayerId ) ) 1078 #endif 1053 1079 { 1054 1080 m_pcEncTop->getSPS()->setInferScalingListFlag( true ); … … 1135 1161 #endif 1136 1162 1163 #if REF_REGION_OFFSET 1164 const Window &windowRL = m_pcEncTop->getRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc)); 1165 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth() - windowRL.getWindowLeftOffset() - windowRL.getWindowRightOffset(); 1166 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight() - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset(); 1167 #else 1137 1168 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(); 1138 1169 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(); … … 1143 1174 heightBL -= ( confBL.getWindowTopOffset() + confBL.getWindowBottomOffset() ) * TComSPS::getWinUnitY( chromaFormatIdc ); 1144 1175 #endif 1176 #endif 1145 1177 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 1146 1178 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 1179 1180 #if RESAMPLING_FIX 1181 #if REF_REGION_OFFSET 1182 // conformance check: the values of RefLayerRegionWidthInSamplesY, RefLayerRegionHeightInSamplesY, ScaledRefRegionWidthInSamplesY and ScaledRefRegionHeightInSamplesY shall be greater than 0 1183 assert(widthEL > 0 && heightEL > 0 && widthBL > 0 && widthEL > 0); 1184 1185 // conformance check: ScaledRefRegionWidthInSamplesY shall be greater or equal to RefLayerRegionWidthInSamplesY and ScaledRefRegionHeightInSamplesY shall be greater or equal to RefLayerRegionHeightInSamplesY 1186 assert(widthEL >= widthBL && heightEL >= heightBL); 1187 1188 #if R0209_GENERIC_PHASE 1189 // conformance check: when ScaledRefRegionWidthInSamplesY is equal to RefLayerRegionWidthInSamplesY, PhaseHorY shall be equal to 0, when ScaledRefRegionWidthInSamplesC is equal to RefLayerRegionWidthInSamplesC, PhaseHorC shall be equal to 0, when ScaledRefRegionHeightInSamplesY is equal to RefLayerRegionHeightInSamplesY, PhaseVerY shall be equal to 0, and when ScaledRefRegionHeightInSamplesC is equal to RefLayerRegionHeightInSamplesC, PhaseVerC shall be equal to 0. 1190 Int phaseHorLuma = pcSlice->getPPS()->getPhaseHorLuma(refLayerIdc); 1191 Int phaseVerLuma = pcSlice->getPPS()->getPhaseVerLuma(refLayerIdc); 1192 Int phaseHorChroma = pcSlice->getPPS()->getPhaseHorChroma(refLayerIdc); 1193 Int phaseVerChroma = pcSlice->getPPS()->getPhaseVerChroma(refLayerIdc); 1194 assert( ( (widthEL != widthBL) || (phaseHorLuma == 0 && phaseHorChroma == 0) ) 1195 && ( (heightEL != heightBL) || (phaseVerLuma == 0 && phaseVerChroma == 0) ) ); 1196 #endif 1197 #endif 1198 #endif 1147 1199 1148 1200 g_mvScalingFactor[refLayerIdc][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); … … 1156 1208 if( pcSlice->getPPS()->getCGSFlag() ) 1157 1209 { 1210 #if R0150_CGS_SIGNAL_CONSTRAINTS 1211 // all reference layers are currently taken as CGS reference layers 1212 m_Enc3DAsymLUTPPS.addRefLayerId( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ); 1213 m_Enc3DAsymLUTPicUpdate.addRefLayerId( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ); 1214 #endif 1158 1215 if(g_posScalingFactor[refLayerIdc][0] < (1<<16) || g_posScalingFactor[refLayerIdc][1] < (1<<16)) //if(pcPic->isSpatialEnhLayer(refLayerIdc)) 1159 1216 { … … 1207 1264 #if O0194_JOINT_US_BITSHIFT 1208 1265 #if Q0048_CGS_3D_ASYMLUT 1209 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 1210 #else 1211 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 1266 #if REF_REGION_OFFSET 1267 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL, altRL ); 1268 #else 1269 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), scalEL ); 1270 #endif 1271 #else 1272 m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL ); 1212 1273 #endif 1213 1274 #else … … 1270 1331 } 1271 1332 } 1272 1333 #if ISLICE_TYPE_NUMDIR 1334 if( pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA && (m_pcEncTop->getNumDirectRefLayers() == 0) ) 1335 #else 1273 1336 if( pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 1337 #endif 1274 1338 { 1275 1339 pcSlice->setSliceType(I_SLICE); … … 1395 1459 if(pcSlice->isTemporalLayerSwitchingPoint(rcListPic) || pcSlice->getSPS()->getTemporalIdNestingFlag()) 1396 1460 { 1397 #if !Q0108_TSA_STSA1461 #if SVC_EXTENSION && !Q0108_TSA_STSA 1398 1462 if( pcSlice->getLayerId() > 0 ) 1399 1463 { … … 1494 1558 if(isSTSA==true) 1495 1559 { 1496 #if !Q0108_TSA_STSA1560 #if SVC_EXTENSION && !Q0108_TSA_STSA 1497 1561 if( pcSlice->getLayerId() > 0 ) 1498 1562 { … … 1563 1627 } 1564 1628 } 1629 1630 arrangeLongtermPicturesInRPS(pcSlice, rcListPic); 1631 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 1632 refPicListModification->setRefPicListModificationFlagL0(0); 1633 refPicListModification->setRefPicListModificationFlagL1(0); 1634 pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 1635 pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 1636 1637 #if SVC_EXTENSION 1638 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 1639 { 1640 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 1641 if ( pocCurr > 0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1642 #else 1643 if (pcSlice->getPOC()>0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1644 #endif 1645 { 1646 pcSlice->setActiveNumILRRefIdx(0); 1647 pcSlice->setInterLayerPredEnabledFlag(0); 1648 } 1649 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 1650 { 1651 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getActiveNumILRRefIdx()); 1652 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getActiveNumILRRefIdx()); 1653 } 1654 else 1655 { 1656 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+pcSlice->getActiveNumILRRefIdx()); 1657 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getActiveNumILRRefIdx()); 1658 } 1659 1660 // check for the reference pictures whether there is at least one either temporal picture or ILRP with sample prediction type 1661 if( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) - pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) - pcSlice->getActiveNumILRRefIdx() == 0 ) 1662 { 1663 Bool foundSamplePredPicture = false; 1664 1665 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 1666 { 1667 if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( pcSlice->getVPS()->getRefLayerId( m_layerId, pcSlice->getInterLayerPredLayerIdc(i) ) ) ) 1668 { 1669 foundSamplePredPicture = true; 1670 break; 1671 } 1672 } 1673 1674 if( !foundSamplePredPicture ) 1675 { 1676 pcSlice->setSliceType(I_SLICE); 1677 pcSlice->setInterLayerPredEnabledFlag(0); 1678 pcSlice->setActiveNumILRRefIdx(0); 1679 } 1680 } 1681 } 1682 #endif //SVC_EXTENSION 1683 1565 1684 #if Q0108_TSA_STSA 1566 else if( ( pcSlice->getTLayer() == 0 && pcSlice->getLayerId() > 0) // only for enhancement layer and with temporal layer 01567 1685 if( ( pcSlice->getTLayer() == 0 && pcSlice->getLayerId() > 0 ) // only for enhancement layer and with temporal layer 0 1686 && !( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N 1568 1687 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R 1569 1688 || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N … … 1576 1695 { 1577 1696 Bool isSTSA=true; 1697 Bool isIntra=false; 1698 1699 for( Int i = 0; i < pcSlice->getLayerId(); i++) 1700 { 1701 TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic(); 1702 TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC()); 1703 if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerId(), i) ) 1704 { 1705 if( lowerLayerPic->getSlice(0)->getSliceType() == I_SLICE) 1706 { 1707 isIntra = true; 1708 } 1709 } 1710 } 1711 1578 1712 for(Int ii=iGOPid+1; ii < m_pcCfg->getGOPSize() && isSTSA; ii++) 1579 1713 { … … 1605 1739 } 1606 1740 } 1607 if(isSTSA==true )1741 if(isSTSA==true && isIntra == false) 1608 1742 { 1609 #if !Q0108_TSA_STSA1610 if( pcSlice->getLayerId() > 0 )1611 {1612 Bool oneRefLayerSTSA = false, oneRefLayerNotSTSA = false;1613 for( Int i = 0; i < pcSlice->getLayerId(); i++)1614 {1615 TComList<TComPic *> *cListPic = m_ppcTEncTop[i]->getListPic();1616 TComPic *lowerLayerPic = pcSlice->getRefPic(*cListPic, pcSlice->getPOC());1617 if( lowerLayerPic && pcSlice->getVPS()->getDirectDependencyFlag(pcSlice->getLayerId(), i) )1618 {1619 if( ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N ) ||1620 ( lowerLayerPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_R )1621 )1622 {1623 if(pcSlice->getTemporalLayerNonReferenceFlag() )1624 {1625 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N);1626 }1627 else1628 {1629 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R );1630 }1631 oneRefLayerSTSA = true;1632 }1633 else1634 {1635 oneRefLayerNotSTSA = true;1636 }1637 }1638 }1639 assert( !( oneRefLayerNotSTSA && oneRefLayerSTSA ) ); // Only one variable should be true - failure of this assert means1640 // that two independent reference layers that are not dependent on1641 // each other, but are reference for current layer have inconsistency1642 if( oneRefLayerNotSTSA /*&& !oneRefLayerSTSA*/ ) // No reference layer is STSA - set current as TRAIL1643 {1644 if(pcSlice->getTemporalLayerNonReferenceFlag() )1645 {1646 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_N );1647 }1648 else1649 {1650 pcSlice->setNalUnitType( NAL_UNIT_CODED_SLICE_TRAIL_R );1651 }1652 }1653 else // This means there is no reference layer picture for current picture in this AU1654 {1655 if(pcSlice->getTemporalLayerNonReferenceFlag() )1656 {1657 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N);1658 }1659 else1660 {1661 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R );1662 }1663 }1664 }1665 #else1666 1743 if(pcSlice->getTemporalLayerNonReferenceFlag()) 1667 1744 { 1668 1745 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_N); 1669 flagTSTA = 1;1670 1746 } 1671 1747 else 1672 1748 { 1673 1749 pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_STSA_R); 1674 flagTSTA = 1; 1675 } 1676 #endif 1677 } 1678 } 1679 #endif 1680 1681 arrangeLongtermPicturesInRPS(pcSlice, rcListPic); 1682 TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); 1683 refPicListModification->setRefPicListModificationFlagL0(0); 1684 refPicListModification->setRefPicListModificationFlagL1(0); 1685 pcSlice->setNumRefIdx(REF_PIC_LIST_0,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 1686 pcSlice->setNumRefIdx(REF_PIC_LIST_1,min(m_pcCfg->getGOPEntry(iGOPid).m_numRefPicsActive,pcSlice->getRPS()->getNumberOfPictures())); 1687 1688 #if SVC_EXTENSION 1689 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 1690 { 1691 #if POC_RESET_FLAG || POC_RESET_IDC_ENCODER 1692 if ( pocCurr > 0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1693 #else 1694 if (pcSlice->getPOC()>0 && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL()) 1695 #endif 1696 { 1697 pcSlice->setActiveNumILRRefIdx(0); 1698 pcSlice->setInterLayerPredEnabledFlag(0); 1699 } 1700 #if Q0108_TSA_STSA 1701 if( ( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) || flagTSTA == 1 ) 1702 #else 1703 if( pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP && pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA ) 1704 #endif 1705 { 1706 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getActiveNumILRRefIdx()); 1707 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getActiveNumILRRefIdx()); 1708 } 1709 else 1710 { 1711 pcSlice->setNumRefIdx(REF_PIC_LIST_0, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+pcSlice->getActiveNumILRRefIdx()); 1712 pcSlice->setNumRefIdx(REF_PIC_LIST_1, pcSlice->getNumRefIdx(REF_PIC_LIST_1)+pcSlice->getActiveNumILRRefIdx()); 1713 } 1714 1715 // check for the reference pictures whether there is at least one either temporal picture or ILRP with sample prediction type 1716 if( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) - pcSlice->getActiveNumILRRefIdx() == 0 && pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) - pcSlice->getActiveNumILRRefIdx() == 0 ) 1717 { 1718 Bool foundSamplePredPicture = false; 1719 1720 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 1721 { 1722 if( m_ppcTEncTop[m_layerId]->getSamplePredEnabledFlag( pcSlice->getVPS()->getRefLayerId( m_layerId, pcSlice->getInterLayerPredLayerIdc(i) ) ) ) 1723 { 1724 foundSamplePredPicture = true; 1725 break; 1726 } 1727 } 1728 1729 if( !foundSamplePredPicture ) 1730 { 1731 pcSlice->setSliceType(I_SLICE); 1732 pcSlice->setInterLayerPredEnabledFlag(0); 1733 pcSlice->setActiveNumILRRefIdx(0); 1734 } 1735 } 1736 } 1737 #endif //SVC_EXTENSION 1750 } 1751 } 1752 } 1753 #endif 1738 1754 1739 1755 #if ADAPTIVE_QP_SELECTION … … 1750 1766 if(m_layerId == 0 || ( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() == 0 ) ) 1751 1767 { 1752 pcSlice->setRefPicList( rcListPic );1768 pcSlice->setRefPicList( rcListPic ); 1753 1769 } 1754 1770 … … 1756 1772 { 1757 1773 pcSlice->setILRPic( m_pcEncTop->getIlpList() ); 1758 #if REF_IDX_MFM 1759 if( pcSlice->getMFMEnabledFlag() ) 1760 { 1761 pcSlice->setRefPOCListILP(m_pcEncTop->getIlpList(), pcSlice->getBaseColPic()); 1762 } 1763 #else 1774 #if !REF_IDX_MFM 1764 1775 // Set reference list 1765 1776 pcSlice->setRefPicList ( rcListPic ); … … 2110 2121 UInt uiRealEndAddress = uiExternalAddress*pcPic->getNumPartInCU()+uiInternalAddress; 2111 2122 2112 UInt uiCummulativeTileWidth;2113 UInt uiCummulativeTileHeight;2114 2123 Int p, j; 2115 2124 UInt uiEncCUAddr; 2116 2125 2117 //set NumColumnsMinus1 and NumRowsMinus1 2118 pcPic->getPicSym()->setNumColumnsMinus1( pcSlice->getPPS()->getNumColumnsMinus1() ); 2119 pcPic->getPicSym()->setNumRowsMinus1( pcSlice->getPPS()->getNumRowsMinus1() ); 2120 2121 //create the TComTileArray 2122 pcPic->getPicSym()->xCreateTComTileArray(); 2123 2124 if( pcSlice->getPPS()->getUniformSpacingFlag() == 1 ) 2125 { 2126 //set the width for each tile 2127 for(j=0; j < pcPic->getPicSym()->getNumRowsMinus1()+1; j++) 2128 { 2129 for(p=0; p < pcPic->getPicSym()->getNumColumnsMinus1()+1; p++) 2130 { 2131 pcPic->getPicSym()->getTComTile( j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p )-> 2132 setTileWidth( (p+1)*pcPic->getPicSym()->getFrameWidthInCU()/(pcPic->getPicSym()->getNumColumnsMinus1()+1) 2133 - (p*pcPic->getPicSym()->getFrameWidthInCU())/(pcPic->getPicSym()->getNumColumnsMinus1()+1) ); 2134 } 2135 } 2136 2137 //set the height for each tile 2138 for(j=0; j < pcPic->getPicSym()->getNumColumnsMinus1()+1; j++) 2139 { 2140 for(p=0; p < pcPic->getPicSym()->getNumRowsMinus1()+1; p++) 2141 { 2142 pcPic->getPicSym()->getTComTile( p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j )-> 2143 setTileHeight( (p+1)*pcPic->getPicSym()->getFrameHeightInCU()/(pcPic->getPicSym()->getNumRowsMinus1()+1) 2144 - (p*pcPic->getPicSym()->getFrameHeightInCU())/(pcPic->getPicSym()->getNumRowsMinus1()+1) ); 2145 } 2146 } 2147 } 2148 else 2149 { 2150 //set the width for each tile 2151 for(j=0; j < pcPic->getPicSym()->getNumRowsMinus1()+1; j++) 2152 { 2153 uiCummulativeTileWidth = 0; 2154 for(p=0; p < pcPic->getPicSym()->getNumColumnsMinus1(); p++) 2155 { 2156 pcPic->getPicSym()->getTComTile( j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p )->setTileWidth( pcSlice->getPPS()->getColumnWidth(p) ); 2157 uiCummulativeTileWidth += pcSlice->getPPS()->getColumnWidth(p); 2158 } 2159 pcPic->getPicSym()->getTComTile(j * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + p)->setTileWidth( pcPic->getPicSym()->getFrameWidthInCU()-uiCummulativeTileWidth ); 2160 } 2161 2162 //set the height for each tile 2163 for(j=0; j < pcPic->getPicSym()->getNumColumnsMinus1()+1; j++) 2164 { 2165 uiCummulativeTileHeight = 0; 2166 for(p=0; p < pcPic->getPicSym()->getNumRowsMinus1(); p++) 2167 { 2168 pcPic->getPicSym()->getTComTile( p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j )->setTileHeight( pcSlice->getPPS()->getRowHeight(p) ); 2169 uiCummulativeTileHeight += pcSlice->getPPS()->getRowHeight(p); 2170 } 2171 pcPic->getPicSym()->getTComTile(p * (pcPic->getPicSym()->getNumColumnsMinus1()+1) + j)->setTileHeight( pcPic->getPicSym()->getFrameHeightInCU()-uiCummulativeTileHeight ); 2172 } 2173 } 2174 //intialize each tile of the current picture 2175 pcPic->getPicSym()->xInitTiles(); 2126 pcPic->getPicSym()->initTiles(pcSlice->getPPS()); 2176 2127 2177 2128 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI … … 2183 2134 2184 2135 // Allocate some coders, now we know how many tiles there are. 2136 #if WPP_FIX 2137 const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 2138 #else 2185 2139 Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 2140 #endif 2186 2141 2187 2142 //generate the Coding Order Map and Inverse Coding Order Map … … 2215 2170 startCUAddrSliceSegmentIdx++; 2216 2171 #if AVC_BASE 2172 #if VPS_AVC_BL_FLAG_REMOVAL 2173 if( m_layerId == 0 && m_pcEncTop->getVPS()->getNonHEVCBaseLayerFlag() ) 2174 #else 2217 2175 if( m_layerId == 0 && m_pcEncTop->getVPS()->getAvcBaseLayerFlag() ) 2176 #endif 2218 2177 { 2219 2178 pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() ); … … 2225 2184 } 2226 2185 #endif 2227 #if AVC_SYNTAX 2228 pcPic->readBLSyntax( m_ppcTEncTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 2229 #endif 2186 2187 if( pcSubstreamsOut ) 2188 { 2189 delete[] pcSubstreamsOut; 2190 pcSubstreamsOut = NULL; 2191 } 2192 2193 if( pcBitstreamRedirect ) 2194 { 2195 delete pcBitstreamRedirect; 2196 pcBitstreamRedirect = NULL; 2197 } 2198 2230 2199 return; 2231 2200 } … … 2318 2287 OutputNALUnit nalu( NAL_UNIT_VPS, 0, 0 ); // The value of nuh_layer_id of VPS NAL unit shall be equal to 0. 2319 2288 #if AVC_BASE 2289 #if VPS_AVC_BL_FLAG_REMOVAL 2290 if( ( m_layerId == 1 && m_pcEncTop->getVPS()->getNonHEVCBaseLayerFlag() ) || ( m_layerId == 0 && !m_pcEncTop->getVPS()->getNonHEVCBaseLayerFlag() ) ) 2291 #else 2320 2292 if( ( m_layerId == 1 && m_pcEncTop->getVPS()->getAvcBaseLayerFlag() ) || ( m_layerId == 0 && !m_pcEncTop->getVPS()->getAvcBaseLayerFlag() ) ) 2293 #endif 2321 2294 #else 2322 2295 if( m_layerId == 0 ) … … 2418 2391 if (pcSlice->getLayerId() == 0 && m_pcEncTop->getVPS()->getVpsVuiBspHrdPresentFlag()) 2419 2392 { 2420 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, 1); 2421 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2422 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2423 SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice); 2424 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *scalableBspNestingSei, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2425 writeRBSPTrailingBits(nalu.m_Bitstream); 2426 2427 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2428 UInt offsetPosition = m_activeParameterSetSEIPresentInAU 2429 + m_bufferingPeriodSEIPresentInAU 2430 + m_pictureTimingSEIPresentInAU 2431 + m_nestedPictureTimingSEIPresentInAU; // Insert SEI after APS, BP and PT SEI 2432 AccessUnit::iterator it; 2433 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 2434 { 2435 it++; 2436 } 2437 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2393 #if VPS_VUI_BSP_HRD_PARAMS 2394 TComVPS *vps = m_pcEncTop->getVPS(); 2395 for(Int i = 0; i < vps->getNumOutputLayerSets(); i++) 2396 { 2397 for(Int k = 0; k < vps->getNumSignalledPartitioningSchemes(i); k++) 2398 { 2399 for(Int l = 0; l < vps->getNumPartitionsInSchemeMinus1(i, k)+1; l++) 2400 { 2401 #endif 2402 nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, 1); 2403 m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice); 2404 m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream); 2405 #if VPS_VUI_BSP_HRD_PARAMS 2406 SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice, i, k, l); 2407 #else 2408 SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice); 2409 #endif 2410 m_seiWriter.writeSEImessage(nalu.m_Bitstream, *scalableBspNestingSei, m_pcEncTop->getVPS(), pcSlice->getSPS()); 2411 writeRBSPTrailingBits(nalu.m_Bitstream); 2412 2413 UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit); 2414 UInt offsetPosition = m_activeParameterSetSEIPresentInAU 2415 + m_bufferingPeriodSEIPresentInAU 2416 + m_pictureTimingSEIPresentInAU 2417 + m_nestedPictureTimingSEIPresentInAU; // Insert SEI after APS, BP and PT SEI 2418 AccessUnit::iterator it; 2419 for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++) 2420 { 2421 it++; 2422 } 2423 accessUnit.insert(it, new NALUnitEBSP(nalu)); 2424 #if VPS_VUI_BSP_HRD_PARAMS 2425 } 2426 } 2427 } 2428 #endif 2438 2429 } 2439 2430 #endif … … 2842 2833 2843 2834 #if SETTING_NO_OUT_PIC_PRIOR 2835 pcSlice->setNoRaslOutputFlag(false); 2844 2836 if (pcSlice->isIRAP()) 2845 2837 { … … 2849 2841 } 2850 2842 //the inference for NoOutputPriorPicsFlag 2843 // KJS: This cannot happen at the encoder 2851 2844 if (!m_bFirst && pcSlice->isIRAP() && pcSlice->getNoRaslOutputFlag()) 2852 2845 { … … 2876 2869 m_pcEntropyCoder->setEntropyCoder ( m_pcSbacCoder, pcSlice ); 2877 2870 m_pcEntropyCoder->resetEntropy (); 2871 #if WPP_FIX 2872 for ( UInt ui = 0 ; ui < iNumSubstreams ; ui++ ) 2873 #else 2878 2874 for ( UInt ui = 0 ; ui < pcSlice->getPPS()->getNumSubstreams() ; ui++ ) 2875 #endif 2879 2876 { 2880 2877 m_pcEntropyCoder->setEntropyCoder ( &pcSbacCoders[ui], pcSlice ); … … 2888 2885 m_pcSbacCoder->init( (TEncBinIf*)m_pcBinCABAC ); 2889 2886 { 2887 #if WPP_FIX 2888 for ( UInt ui = 0 ; ui < iNumSubstreams ; ui++ ) 2889 #else 2890 2890 for ( UInt ui = 0 ; ui < pcSlice->getPPS()->getNumSubstreams() ; ui++ ) 2891 #endif 2891 2892 { 2892 2893 m_pcEntropyCoder->setEntropyCoder ( &pcSbacCoders[ui], pcSlice ); … … 2915 2916 2916 2917 pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength ); 2917 2918 pcSlice->setTileLocationCount ( 0 ); 2918 2919 m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut); 2919 2920 … … 2942 2943 2943 2944 Bool bNextSubstreamInNewTile = ((ui+1) < iNumSubstreams)&& ((ui+1)%uiNumSubstreamsPerTile == 0); 2945 #if WPP_FIX 2946 if (bNextSubstreamInNewTile && !pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() ) 2947 #else 2944 2948 if (bNextSubstreamInNewTile) 2949 #endif 2945 2950 { 2946 2951 pcSlice->setTileLocation(ui/uiNumSubstreamsPerTile, pcSlice->getTileOffstForMultES()+(uiTotalCodedSize>>3)); 2947 2952 } 2953 #if WPP_FIX 2954 if (ui+1 < iNumSubstreams) 2955 { 2956 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3); 2957 } 2958 #else 2948 2959 if (ui+1 < pcSlice->getPPS()->getNumSubstreams()) 2949 2960 { 2950 2961 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3); 2951 2962 } 2963 #endif 2952 2964 } 2953 2965 … … 2966 2978 // Substreams... 2967 2979 TComOutputBitstream *pcOut = pcBitstreamRedirect; 2968 Int offs = 0; 2980 #if WPP_FIX 2981 Int numZeroSubstreamsAtStartOfSlice = 0; 2982 Int numSubstreamsToCode = pcSlice->getPPS()->getNumSubstreams(); 2983 if (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) 2984 { 2985 Int maxNumParts = pcPic->getNumPartInCU(); 2986 numZeroSubstreamsAtStartOfSlice = pcPic->getSubstreamForLCUAddr(pcSlice->getSliceSegmentCurStartCUAddr()/maxNumParts, false, pcSlice); 2987 // 1st line present for WPP. 2988 numSubstreamsToCode = pcSlice->getNumEntryPointOffsets()+1; 2989 } 2990 for ( UInt ui = 0 ; ui < numSubstreamsToCode; ui++ ) 2991 { 2992 pcOut->addSubstream(&pcSubstreamsOut[ui+numZeroSubstreamsAtStartOfSlice]); 2993 } 2994 #else 2995 Int offs = 0; 2969 2996 Int nss = pcSlice->getPPS()->getNumSubstreams(); 2970 2997 if (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) … … 2978 3005 pcOut->addSubstream(&pcSubstreamsOut[ui+offs]); 2979 3006 } 3007 #endif 2980 3008 } 2981 3009 … … 3396 3424 pcPicYuvRecOut->setReconstructed(true); 3397 3425 #endif 3398 3426 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3427 m_pcEncTop->setFirstPicInLayerDecodedFlag(true); 3428 #endif 3399 3429 pcPic->setReconMark ( true ); 3400 3430 m_bFirst = false; … … 3455 3485 // If BL picture in the AU is IDR, and another picture is not IDR, set the poc_reset_idc to 2 3456 3486 // If BL picture is IRAP, and another picture is non-IRAP, then the poc_reset_idc is equal to 1 or 2. 3487 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3488 slice->setPocMsbNeeded(false); 3489 #endif 3457 3490 if( slice->getSliceIdx() == 0 ) // First slice - compute, copy for other slices 3458 3491 { … … 3514 3547 { 3515 3548 slice->setPocResetIdc( 2 ); // Full reset needed 3549 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3550 if (slice->getVPS()->getVpsPocLsbAlignedFlag() && slice->getVPS()->getNumDirectRefLayers(slice->getLayerId()) == 0) 3551 { 3552 slice->setPocMsbNeeded(true); // Force msb writing 3553 } 3554 #endif 3516 3555 } 3517 3556 else … … 3530 3569 Int periodId = rand() % 64; 3531 3570 m_lastPocPeriodId = (periodId == m_lastPocPeriodId) ? (periodId + 1) % 64 : periodId ; 3571 3572 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3573 for (UInt i = 0; i < MAX_LAYERS; i++) 3574 { 3575 m_ppcTEncTop[i]->setPocDecrementedInDPBFlag(false); 3576 } 3577 #endif 3532 3578 } 3533 3579 else … … 3546 3592 Void TEncGOP::updatePocValuesOfPics(Int const pocCurr, TComSlice *const slice) 3547 3593 { 3594 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3595 UInt affectedLayerList[MAX_NUM_LAYER_IDS]; 3596 Int numAffectedLayers; 3597 3598 affectedLayerList[0] = m_layerId; 3599 numAffectedLayers = 1; 3600 3601 if (m_pcEncTop->getVPS()->getVpsPocLsbAlignedFlag()) 3602 { 3603 for (UInt j = 0; j < m_pcEncTop->getVPS()->getNumPredictedLayers(m_layerId); j++) 3604 { 3605 affectedLayerList[j + 1] = m_pcEncTop->getVPS()->getPredictedLayerId(m_layerId, j); 3606 } 3607 numAffectedLayers = m_pcEncTop->getVPS()->getNumPredictedLayers(m_layerId) + 1; 3608 } 3609 #endif 3548 3610 3549 3611 Int pocAdjustValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); … … 3553 3615 3554 3616 maxPocLsb = 1 << slice->getSPS()->getBitsForPOC(); 3617 3618 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3619 Int adjustedPocValue = pocCurr; 3620 3621 if (m_pcEncTop->getFirstPicInLayerDecodedFlag()) 3622 { 3623 #endif 3624 3555 3625 pocLsbVal = (slice->getPocResetIdc() == 3) 3556 3626 ? slice->getPocLsbVal() … … 3561 3631 : 0; 3562 3632 deltaPocVal = pocMsbDelta + pocLsbDelta; 3563 3633 3634 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3635 Int origDeltaPocVal = deltaPocVal; // original value needed when updating POC adjustment value 3636 3637 if (slice->getPocMsbNeeded()) // IDR picture in base layer, non-IDR picture in other layers, poc_lsb_aligned_flag = 1 3638 { 3639 if (slice->getLayerId() == 0) 3640 { 3641 Int highestPoc = INT_MIN; 3642 // Find greatest POC in DPB for layer 0 3643 for (TComList<TComPic*>::iterator iterPic = m_pcEncTop->getListPic()->begin(); iterPic != m_pcEncTop->getListPic()->end(); ++iterPic) 3644 { 3645 TComPic *dpbPic = *iterPic; 3646 if (dpbPic->getReconMark() && dpbPic->getLayerId() == 0 && dpbPic->getPOC() > highestPoc) 3647 { 3648 highestPoc = dpbPic->getPOC(); 3649 } 3650 } 3651 deltaPocVal = (highestPoc - (highestPoc & (maxPocLsb - 1))) + 1*maxPocLsb; 3652 m_pcEncTop->setCurrPocMsb(deltaPocVal); 3653 } 3654 else 3655 { 3656 deltaPocVal = m_ppcTEncTop[0]->getCurrPocMsb(); // copy from base layer 3657 } 3658 slice->setPocMsbVal(deltaPocVal); 3659 } 3660 #endif 3661 3662 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3663 for (UInt layerIdx = 0; layerIdx < numAffectedLayers; layerIdx++) 3664 { 3665 if (!m_ppcTEncTop[affectedLayerList[layerIdx]]->getPocDecrementedInDPBFlag()) 3666 { 3667 m_ppcTEncTop[affectedLayerList[layerIdx]]->setPocDecrementedInDPBFlag(true); 3668 3669 // Decrement value of associatedIrapPoc of the TEncGop object 3670 m_ppcTEncTop[affectedLayerList[layerIdx]]->getGOPEncoder()->m_associatedIRAPPOC -= deltaPocVal; 3671 3672 // Decrememnt the value of m_pocCRA 3673 m_ppcTEncTop[affectedLayerList[layerIdx]]->getGOPEncoder()->m_pocCRA -= deltaPocVal; 3674 3675 TComList<TComPic*>::iterator iterPic = m_ppcTEncTop[affectedLayerList[layerIdx]]->getListPic()->begin(); 3676 while (iterPic != m_ppcTEncTop[affectedLayerList[layerIdx]]->getListPic()->end()) 3677 #else 3564 3678 // Decrement value of associatedIrapPoc of the TEncGop object 3565 3679 this->m_associatedIRAPPOC -= deltaPocVal; … … 3571 3685 TComList<TComPic*>::iterator iterPic = getListPic()->begin(); 3572 3686 while( iterPic != getListPic()->end() ) 3687 #endif 3573 3688 { 3574 3689 TComPic *dpbPic = *iterPic; … … 3595 3710 // Update value of associatedIrapPoc of each slice 3596 3711 dpbPicSlice->setAssociatedIRAPPOC( dpbPicSlice->getAssociatedIRAPPOC() - deltaPocVal ); 3712 3713 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3714 if (slice->getPocMsbNeeded()) 3715 { 3716 // this delta value is needed when computing delta POCs in reference picture set initialization 3717 dpbPicSlice->setPocResetDeltaPoc(dpbPicSlice->getPocResetDeltaPoc() + (deltaPocVal - pocLsbVal)); 3718 } 3719 #endif 3597 3720 } 3598 3721 } 3599 3722 iterPic++; 3600 3723 } 3601 3724 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3725 } 3726 } 3727 #endif 3728 3602 3729 // Actual POC value before reset 3730 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3731 adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 3732 #else 3603 3733 Int adjustedPocValue = pocCurr - m_pcEncTop->getPocAdjustmentValue(); 3734 #endif 3604 3735 3605 3736 // Set MSB value before reset 3606 3737 Int tempLsbVal = adjustedPocValue & (maxPocLsb - 1); 3607 slice->setPocMsbVal( adjustedPocValue - tempLsbVal); 3738 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3739 if (!slice->getPocMsbNeeded()) // set poc msb normally if special msb handling is not needed 3740 { 3741 #endif 3742 slice->setPocMsbVal(adjustedPocValue - tempLsbVal); 3743 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3744 } 3745 #endif 3608 3746 3609 3747 // Set LSB value before reset - this is needed in the case of resetIdc = 2 … … 3611 3749 3612 3750 // Cumulative delta 3751 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3752 deltaPocVal = origDeltaPocVal; // restore deltaPoc for correct adjustment value update 3753 #endif 3613 3754 m_pcEncTop->setPocAdjustmentValue( m_pcEncTop->getPocAdjustmentValue() + deltaPocVal ); 3755 3756 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 3757 } 3758 #endif 3614 3759 3615 3760 // New LSB value, after reset … … 3738 3883 assert (m_iGopSize > 0); 3739 3884 3740 return;3741 }3742 3743 Void TEncGOP::xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut )3744 {3745 assert( iNumPicRcvd > 0 );3746 // Exception for the first frame3747 if ( iPOCLast == 0 )3748 {3749 m_iGopSize = 1;3750 }3751 else3752 m_iGopSize = m_pcCfg->getGOPSize();3753 3754 assert (m_iGopSize > 0);3755 3756 3885 return; 3757 3886 } … … 4090 4219 { 4091 4220 #if POC_RESET_IDC_ENCODER 4092 printf( "%d(%d)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() ); 4221 UInt refLayerId = pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId(); 4222 UInt refLayerIdc = pcSlice->getReferenceLayerIdc(refLayerId); 4223 assert( g_posScalingFactor[refLayerIdc][0] ); 4224 assert( g_posScalingFactor[refLayerIdc][1] ); 4225 4226 printf( "%d(%d, {%1.2f, %1.2f}x)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), refLayerId, 65536.0/g_posScalingFactor[refLayerIdc][0], 65536.0/g_posScalingFactor[refLayerIdc][1] ); 4093 4227 #else 4094 4228 printf( "%d(%d)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex)-pcSlice->getLastIDR(), pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId() ); … … 4120 4254 if( m_layerId && pcSlice->getPPS()->getCGSFlag() ) 4121 4255 { 4256 #if R0179_ENC_OPT_3DLUT_SIZE 4257 m_Enc3DAsymLUTPicUpdate.update3DAsymLUTParam( &m_Enc3DAsymLUTPPS ); 4258 #else 4259 if( m_Enc3DAsymLUTPPS.getPPSBit() > 0 ) 4260 m_Enc3DAsymLUTPicUpdate.copy3DAsymLUT( &m_Enc3DAsymLUTPPS ); 4261 #endif 4122 4262 m_Enc3DAsymLUTPicUpdate.updatePicCGSBits( pcSlice , m_Enc3DAsymLUTPPS.getPPSBit() ); 4123 4263 } … … 4771 4911 4772 4912 #if O0164_MULTI_LAYER_HRD 4913 #if VPS_VUI_BSP_HRD_PARAMS 4914 SEIScalableNesting* TEncGOP::xCreateBspNestingSEI(TComSlice *pcSlice, Int olsIdx, Int partitioningSchemeIdx, Int bspIdx) 4915 #else 4773 4916 SEIScalableNesting* TEncGOP::xCreateBspNestingSEI(TComSlice *pcSlice) 4917 #endif 4774 4918 { 4775 4919 SEIScalableNesting *seiScalableNesting = new SEIScalableNesting(); … … 4784 4928 seiScalableNesting->m_defaultOpFlag = 0; 4785 4929 seiScalableNesting->m_nestingNumOpsMinus1 = 0; //nesting_num_ops_minus1 4930 #if VPS_VUI_BSP_HRD_PARAMS 4931 seiScalableNesting->m_nestingOpIdx[0] = pcSlice->getVPS()->getOutputLayerSetIdx(olsIdx); 4932 seiScalableNesting->m_nestingMaxTemporalIdPlus1[0] = 6 + 1; 4933 #else 4786 4934 seiScalableNesting->m_nestingOpIdx[0] = 1; 4935 #endif 4787 4936 seiScalableNesting->m_allLayersFlag = 0; 4788 4937 seiScalableNesting->m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1; //nesting_no_op_max_temporal_id_plus1 … … 4830 4979 seiBspNesting->m_nestedSEIs.push_back(seiBufferingPeriod); 4831 4980 seiBspNesting->m_nestedSEIs.push_back(seiBspInitialArrivalTime); 4981 #if VPS_VUI_BSP_HRD_PARAMS 4982 seiBspNesting->m_bspIdx = bspIdx; 4983 seiBspNesting->m_seiOlsIdx = olsIdx; 4984 seiBspNesting->m_seiPartitioningSchemeIdx = partitioningSchemeIdx; 4985 #endif 4832 4986 seiScalableNesting->m_nestedSEIs.push_back(seiBspNesting); // BSP nesting SEI is contained in scalable nesting SEI 4833 4987 … … 4842 4996 m_Enc3DAsymLUTPPS.setPPSBit( 0 ); 4843 4997 Double dErrorUpdatedPPS = 0 , dErrorPPS = 0; 4844 dErrorUpdatedPPS = m_Enc3DAsymLUTPicUpdate.derive3DAsymLUT( pSlice , pCurPic , refLayerIdc , pCfg , bSignalPPS , m_pcEncTop->getElRapSliceTypeB() ); 4998 4999 #if R0179_ENC_OPT_3DLUT_SIZE 5000 Int nTLthres = m_pcCfg->getCGSLutSizeRDO() ? 2:7; 5001 Double dFrameLambda; 5002 #if FULL_NBIT 5003 Int SHIFT_QP = 12 + 6 * (pSlice->getBitDepthY() - 8); 5004 #else 5005 Int SHIFT_QP = 12; 5006 #endif 5007 Int QP = pSlice->getSliceQp(); 5008 5009 // set frame lambda 5010 dFrameLambda = 0.68 * pow (2, (QP - SHIFT_QP) / 3.0) * (m_pcCfg->getGOPSize() > 1 && pSlice->isInterB()? 2 : 1); 5011 5012 if(m_pcCfg->getCGSLutSizeRDO() == 1 && (!bSignalPPS && (pSlice->getDepth() < nTLthres))) 5013 dErrorUpdatedPPS = m_Enc3DAsymLUTPicUpdate.derive3DAsymLUT( pSlice , pCurPic , refLayerIdc , pCfg , bSignalPPS , m_pcEncTop->getElRapSliceTypeB(), dFrameLambda ); 5014 else if (pSlice->getDepth() >= nTLthres) 5015 dErrorUpdatedPPS = MAX_DOUBLE; 5016 else // if (m_pcCfg->getCGSLutSizeRDO() = 0 || bSignalPPS) 5017 #endif 5018 dErrorUpdatedPPS = m_Enc3DAsymLUTPicUpdate.derive3DAsymLUT( pSlice , pCurPic , refLayerIdc , pCfg , bSignalPPS , m_pcEncTop->getElRapSliceTypeB() ); 5019 5020 4845 5021 if( bSignalPPS ) 4846 5022 { … … 4850 5026 else if( nCGSFlag ) 4851 5027 { 4852 dErrorPPS = m_Enc3DAsymLUTPPS.estimateDistWithCur3DAsymLUT( pCurPic , refLayerIdc ); 4853 Double dFactor = pCfg->getIntraPeriod() == 1 ? 0.99 : 0.9; 4854 pSlice->setCGSOverWritePPS( dErrorUpdatedPPS < dFactor * dErrorPPS ); 5028 #if R0179_ENC_OPT_3DLUT_SIZE 5029 if(pSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || pSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N) 5030 { 5031 pSlice->setCGSOverWritePPS( 0 ); 5032 } 5033 else if (pSlice->getDepth() >= nTLthres) 5034 { 5035 pSlice->setCGSOverWritePPS( 0 ); 5036 } 5037 else 5038 { 5039 #endif 5040 dErrorPPS = m_Enc3DAsymLUTPPS.estimateDistWithCur3DAsymLUT( pCurPic , refLayerIdc ); 5041 Double dFactor = pCfg->getIntraPeriod() == 1 ? 0.99 : 0.9; 5042 5043 #if R0179_ENC_OPT_3DLUT_SIZE 5044 if( m_pcCfg->getCGSLutSizeRDO() ) 5045 { 5046 dErrorPPS = dErrorPPS/m_Enc3DAsymLUTPicUpdate.getDistFactor(pSlice->getSliceType(), pSlice->getDepth()); 5047 } 5048 #endif 5049 pSlice->setCGSOverWritePPS( dErrorUpdatedPPS < dFactor * dErrorPPS ); 5050 #if R0179_ENC_OPT_3DLUT_SIZE 5051 } 5052 #endif 4855 5053 if( pSlice->getCGSOverWritePPS() ) 4856 5054 { -
trunk/source/Lib/TLibEncoder/TEncGOP.h
r815 r906 207 207 protected: 208 208 209 Void xInitGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Bool isField ); 210 Void xInitGOP ( Int iPOC, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut ); 211 Void xGetBuffer ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr, Bool isField ); 209 Void xInitGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, bool isField ); 210 Void xGetBuffer ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr, bool isField ); 212 211 213 212 Void xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime ); … … 226 225 SEIKneeFunctionInfo* xCreateSEIKneeFunctionInfo(); 227 226 #endif 228 #if Q0074_ SEI_COLOR_MAPPING229 SEIColo rMappingInfo* xCreateSEIColorMappingInfo( Char* file);227 #if Q0074_COLOUR_REMAPPING_SEI 228 SEIColourRemappingInfo* xCreateSEIColourRemappingInfo(); 230 229 #endif 231 230 … … 254 253 #endif 255 254 #if O0164_MULTI_LAYER_HRD 255 #if VPS_VUI_BSP_HRD_PARAMS 256 SEIScalableNesting* xCreateBspNestingSEI(TComSlice *pcSlice, Int olsIdx, Int partitioningSchemeIdx, Int bspIdx); 257 #else 256 258 SEIScalableNesting* xCreateBspNestingSEI(TComSlice *pcSlice); 259 #endif 257 260 #endif 258 261 #if Q0048_CGS_3D_ASYMLUT -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r815 r906 4896 4896 if( bCodeChroma ) 4897 4897 { 4898 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 4899 m_pcEntropyCoder->resetBits(); 4898 4900 m_pcEntropyCoder->encodeQtCbf ( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrMode ); 4899 4901 m_pcEntropyCoder->encodeCoeffNxN( pcCU, pcCoeffCurrU, uiAbsPartIdx, trWidthC, trHeightC, uiDepth, TEXT_CHROMA_U ); 4900 uiSingleBitsU = m_pcEntropyCoder->getNumberOfWrittenBits() - uiSingleBitsY;4902 uiSingleBitsU = m_pcEntropyCoder->getNumberOfWrittenBits(); 4901 4903 4904 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 4905 m_pcEntropyCoder->resetBits(); 4902 4906 m_pcEntropyCoder->encodeQtCbf ( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrMode ); 4903 4907 m_pcEntropyCoder->encodeCoeffNxN( pcCU, pcCoeffCurrV, uiAbsPartIdx, trWidthC, trHeightC, uiDepth, TEXT_CHROMA_V ); 4904 uiSingleBitsV = m_pcEntropyCoder->getNumberOfWrittenBits() - ( uiSingleBitsY + uiSingleBitsU );4908 uiSingleBitsV = m_pcEntropyCoder->getNumberOfWrittenBits(); 4905 4909 } 4906 4910 … … 4939 4943 { 4940 4944 const Double singleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY ); 4945 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 4941 4946 m_pcEntropyCoder->resetBits(); 4942 4947 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_LUMA, uiTrMode ); … … 4964 4969 else if( checkTransformSkipY ) 4965 4970 { 4971 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 4966 4972 m_pcEntropyCoder->resetBits(); 4967 4973 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_LUMA, uiTrMode ); … … 5015 5021 { 5016 5022 const Double dSingleCostU = m_pcRdCost->calcRdCost( uiSingleBitsU, uiNonzeroDistU ); 5023 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 5017 5024 m_pcEntropyCoder->resetBits(); 5018 5025 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_CHROMA_U, uiTrMode ); … … 5040 5047 else if( checkTransformSkipUV ) 5041 5048 { 5049 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 5042 5050 m_pcEntropyCoder->resetBits(); 5043 5051 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_CHROMA_U, uiTrMode ); … … 5084 5092 { 5085 5093 const Double dSingleCostV = m_pcRdCost->calcRdCost( uiSingleBitsV, uiNonzeroDistV ); 5094 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 5086 5095 m_pcEntropyCoder->resetBits(); 5087 5096 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_CHROMA_V, uiTrMode ); … … 5109 5118 else if( checkTransformSkipUV ) 5110 5119 { 5120 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 5111 5121 m_pcEntropyCoder->resetBits(); 5112 5122 m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_CHROMA_V, uiTrMode ); … … 5287 5297 pcCU->setCbfSubParts( uiAbsSumTransformSkipV ? uiSetCbf : 0, TEXT_CHROMA_V, uiAbsPartIdx, pcCU->getDepth(0)+uiTrModeC ); 5288 5298 5289 m_pcEntropyCoder->resetBits();5290 5299 uiSingleBitsU = 0; 5291 5300 uiSingleBitsV = 0; … … 5293 5302 if( uiAbsSumTransformSkipU ) 5294 5303 { 5304 m_pcEntropyCoder->resetBits(); 5295 5305 m_pcEntropyCoder->encodeQtCbf ( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrMode ); 5296 5306 m_pcEntropyCoder->encodeCoeffNxN( pcCU, pcCoeffCurrU, uiAbsPartIdx, trWidthC, trHeightC, uiDepth, TEXT_CHROMA_U ); … … 5335 5345 if( uiAbsSumTransformSkipV ) 5336 5346 { 5347 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] ); 5348 m_pcEntropyCoder->resetBits(); 5337 5349 m_pcEntropyCoder->encodeQtCbf ( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrMode ); 5338 5350 m_pcEntropyCoder->encodeCoeffNxN( pcCU, pcCoeffCurrV, uiAbsPartIdx, trWidthC, trHeightC, uiDepth, TEXT_CHROMA_V ); 5339 uiSingleBitsV = m_pcEntropyCoder->getNumberOfWrittenBits() - uiSingleBitsU;5351 uiSingleBitsV = m_pcEntropyCoder->getNumberOfWrittenBits(); 5340 5352 5341 5353 curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr(); -
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r713 r906 836 836 Void TEncSlice::compressSlice( TComPic*& rpcPic ) 837 837 { 838 #if !WPP_FIX 838 839 UInt uiCUAddr; 840 #endif 839 841 UInt uiStartCUAddr; 840 842 UInt uiBoundingCUAddr; … … 907 909 TEncSbac**** ppppcRDSbacCoders = pcEncTop->getRDSbacCoders(); 908 910 TComBitCounter* pcBitCounters = pcEncTop->getBitCounters(); 911 #if WPP_FIX 912 const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 913 const UInt uiTilesAcross = rpcPic->getPicSym()->getNumColumnsMinus1()+1; 914 #else 909 915 Int iNumSubstreams = 1; 910 916 UInt uiTilesAcross = 0; … … 912 918 iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 913 919 uiTilesAcross = rpcPic->getPicSym()->getNumColumnsMinus1()+1; 920 #endif 914 921 delete[] m_pcBufferSbacCoders; 915 922 delete[] m_pcBufferBinCoderCABACs; … … 943 950 UInt uiWidthInLCUs = rpcPic->getPicSym()->getFrameWidthInCU(); 944 951 //UInt uiHeightInLCUs = rpcPic->getPicSym()->getFrameHeightInCU(); 952 #if WPP_FIX 953 UInt uiTileCol = 0; 954 Bool depSliceSegmentsEnabled = pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag(); 955 UInt uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 956 UInt currentTileIdx = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr); 957 TComTile *pCurrentTile = rpcPic->getPicSym()->getTComTile(currentTileIdx); 958 UInt uiTileStartLCU = pCurrentTile->getFirstCUAddr(); 959 #else 945 960 UInt uiCol=0, uiLin=0, uiSubStrm=0; 946 961 UInt uiTileCol = 0; … … 950 965 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 951 966 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr(); 967 #endif 952 968 if( depSliceSegmentsEnabled ) 953 969 { 954 970 if((pcSlice->getSliceSegmentCurStartCUAddr()!= pcSlice->getSliceCurStartCUAddr())&&(uiCUAddr != uiTileStartLCU)) 955 971 { 972 #if WPP_FIX 973 UInt uiSubStrm=0; 974 #endif 956 975 if( m_pcCfg->getWaveFrontsynchro() ) 957 976 { 977 #if WPP_FIX 978 uiTileCol = currentTileIdx % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 979 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); 980 //uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 981 uiSubStrm=rpcPic->getSubstreamForLCUAddr(uiCUAddr, true, pcSlice); 982 if ( pCurrentTile->getTileWidth() < 2) 983 { 984 CTXMem[0]->loadContexts(m_pcSbacCoder); 985 } 986 #else 958 987 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 959 988 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); … … 972 1001 } 973 1002 } 1003 #endif 974 1004 } 975 1005 m_pppcRDSbacCoder[0][CI_CURR_BEST]->loadContexts( CTXMem[0] ); … … 998 1028 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // what column of tiles are we in? 999 1029 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr(); 1030 #if WPP_FIX 1031 UInt uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; 1032 //UInt uiSliceStartLCU = pcSlice->getSliceCurStartCUAddr(); 1033 UInt uiCol = uiCUAddr % uiWidthInLCUs; 1034 UInt uiSubStrm=rpcPic->getSubstreamForLCUAddr(uiCUAddr, true, pcSlice); 1035 1036 if ( ((iNumSubstreams > 1) || depSliceSegmentsEnabled ) && (uiCol == uiTileLCUX) && m_pcCfg->getWaveFrontsynchro()) 1037 #else 1000 1038 uiTileLCUX = uiTileStartLCU % uiWidthInLCUs; 1001 1039 //UInt uiSliceStartLCU = pcSlice->getSliceCurStartCUAddr(); … … 1015 1053 } 1016 1054 if ( ((pcSlice->getPPS()->getNumSubstreams() > 1) || depSliceSegmentsEnabled ) && (uiCol == uiTileLCUX) && m_pcCfg->getWaveFrontsynchro()) 1055 #endif 1017 1056 { 1018 1057 // We'll sync if the TR is available. … … 1138 1177 ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]->load( m_pppcRDSbacCoder[0][CI_CURR_BEST] ); 1139 1178 //Store probabilties of second LCU in line into buffer 1179 #if WPP_FIX 1180 if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (iNumSubstreams > 1)) && m_pcCfg->getWaveFrontsynchro()) 1181 #else 1140 1182 if ( ( uiCol == uiTileLCUX+1) && (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && m_pcCfg->getWaveFrontsynchro()) 1183 #endif 1141 1184 { 1142 1185 m_pcBufferSbacCoders[uiTileCol].loadContexts(ppppcRDSbacCoders[uiSubStrm][0][CI_CURR_BEST]); … … 1177 1220 m_uiPicDist += pcCU->getTotalDistortion(); 1178 1221 } 1222 #if WPP_FIX 1223 if ((iNumSubstreams > 1) && !depSliceSegmentsEnabled) 1224 #else 1179 1225 if ((pcSlice->getPPS()->getNumSubstreams() > 1) && !depSliceSegmentsEnabled) 1226 #endif 1180 1227 { 1181 1228 pcSlice->setNextSlice( true ); … … 1239 1286 TEncTop* pcEncTop = (TEncTop*) m_pcCfg; 1240 1287 TEncSbac* pcSbacCoders = pcEncTop->getSbacCoders(); //coder for each substream 1288 #if WPP_FIX 1289 const Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 1290 #else 1241 1291 Int iNumSubstreams = pcSlice->getPPS()->getNumSubstreams(); 1292 #endif 1242 1293 UInt uiBitsOriginallyInSubstreams = 0; 1243 1294 { … … 1260 1311 1261 1312 UInt uiWidthInLCUs = rpcPic->getPicSym()->getFrameWidthInCU(); 1313 #if WPP_FIX 1314 UInt uiCol=0, uiSubStrm=0; 1315 #else 1262 1316 UInt uiCol=0, uiLin=0, uiSubStrm=0; 1317 #endif 1263 1318 UInt uiTileCol = 0; 1264 1319 UInt uiTileStartLCU = 0; … … 1268 1323 an encoding order index, so we need to convert the index (uiStartCUAddr) 1269 1324 into the real raster scan address (uiCUAddr) via the CUOrderMap */ 1325 #if WPP_FIX 1326 UInt currentTileIdx=rpcPic->getPicSym()->getTileIdxMap(uiCUAddr); 1327 TComTile *pCurrentTile=rpcPic->getPicSym()->getTComTile(currentTileIdx); 1328 uiTileStartLCU = pCurrentTile->getFirstCUAddr(); 1329 #else 1270 1330 uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr(); 1331 #endif 1271 1332 if( depSliceSegmentsEnabled ) 1272 1333 { 1334 #if WPP_FIX 1335 if( pcSlice->isNextSlice()|| uiCUAddr == uiTileStartLCU) 1336 #else 1273 1337 if( pcSlice->isNextSlice()|| 1274 1338 uiCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(uiCUAddr))->getFirstCUAddr()) 1339 #endif 1275 1340 { 1276 1341 if(m_pcCfg->getWaveFrontsynchro()) … … 1284 1349 if(m_pcCfg->getWaveFrontsynchro()) 1285 1350 { 1351 #if WPP_FIX 1352 uiTileCol = currentTileIdx % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 1353 #else 1286 1354 uiTileCol = rpcPic->getPicSym()->getTileIdxMap(uiCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); 1355 #endif 1287 1356 m_pcBufferSbacCoders[uiTileCol].loadContexts( CTXMem[1] ); 1357 #if WPP_FIX 1358 uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU()); 1359 uiSubStrm=rpcPic->getSubstreamForLCUAddr(uiCUAddr, true, pcSlice); 1360 if ( pCurrentTile->getTileWidth() < 2) 1361 { 1362 CTXMem[0]->loadContexts(m_pcSbacCoder); 1363 } 1364 #else 1288 1365 Int iNumSubstreamsPerTile = iNumSubstreams/rpcPic->getPicSym()->getNumTiles(); 1289 1366 uiLin = uiCUAddr / uiWidthInLCUs; … … 1299 1376 } 1300 1377 } 1378 #endif 1301 1379 } 1302 1380 pcSbacCoders[uiSubStrm].loadContexts( CTXMem[0] ); … … 1314 1392 //UInt uiSliceStartLCU = pcSlice->getSliceCurStartCUAddr(); 1315 1393 uiCol = uiCUAddr % uiWidthInLCUs; 1394 #if WPP_FIX 1395 uiSubStrm=rpcPic->getSubstreamForLCUAddr(uiCUAddr, true, pcSlice); 1396 #else 1316 1397 uiLin = uiCUAddr / uiWidthInLCUs; 1317 1398 if (pcSlice->getPPS()->getNumSubstreams() > 1) … … 1327 1408 uiSubStrm = uiLin % iNumSubstreams; 1328 1409 } 1410 #endif 1329 1411 1330 1412 m_pcEntropyCoder->setBitstream( &pcSubstreams[uiSubStrm] ); 1331 1413 // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line. 1414 #if WPP_FIX 1415 if (((iNumSubstreams > 1) || depSliceSegmentsEnabled) && (uiCol == uiTileLCUX) && m_pcCfg->getWaveFrontsynchro()) 1416 #else 1332 1417 if (((pcSlice->getPPS()->getNumSubstreams() > 1) || depSliceSegmentsEnabled) && (uiCol == uiTileLCUX) && m_pcCfg->getWaveFrontsynchro()) 1418 #endif 1333 1419 { 1334 1420 // We'll sync if the TR is available. … … 1368 1454 // When tiles are independent, we have "substreams per tile". Each substream has already been terminated, and we no longer 1369 1455 // have to perform it here. 1456 #if WPP_FIX 1457 if (iNumSubstreams <= 1) 1458 #else 1370 1459 if (pcSlice->getPPS()->getNumSubstreams() > 1) 1371 1460 { … … 1373 1462 } 1374 1463 else 1464 #endif 1375 1465 { 1376 1466 SliceType sliceType = pcSlice->getSliceType(); … … 1448 1538 pcSbacCoders[uiSubStrm].load(m_pcSbacCoder); //load back status of the entropy coder after encoding the LCU into relevant bitstream entropy coder 1449 1539 //Store probabilties of second LCU in line into buffer 1540 #if WPP_FIX 1541 if ( (depSliceSegmentsEnabled || (iNumSubstreams > 1)) && (uiCol == uiTileLCUX+1) && m_pcCfg->getWaveFrontsynchro()) 1542 #else 1450 1543 if ( (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && (uiCol == uiTileLCUX+1) && m_pcCfg->getWaveFrontsynchro()) 1544 #endif 1451 1545 { 1452 1546 m_pcBufferSbacCoders[uiTileCol].loadContexts( &pcSbacCoders[uiSubStrm] ); … … 1480 1574 } 1481 1575 1576 #if WPP_FIX 1577 Void TEncSlice::calculateBoundingCUAddrForSlice(UInt &uiStartCUAddrSlice, UInt &uiBoundingCUAddrSlice, Bool &bReachedTileBoundary, TComPic*& rpcPic, Bool bEncodeSlice, Int sliceMode, Int sliceArgument, UInt uiSliceCurEndCUAddr) 1578 { 1579 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 1580 UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame(); 1581 const UInt scaleCUAddr = rpcPic->getNumPartInCU(); // due to fine granularity slices all addresses are scaled. 1582 uiBoundingCUAddrSlice=0; 1583 bReachedTileBoundary=false; 1584 1585 switch (sliceMode) 1586 { 1587 case FIXED_NUMBER_OF_LCU: 1588 { 1589 UInt uiCUAddrIncrement = sliceArgument; 1590 uiBoundingCUAddrSlice = ((uiStartCUAddrSlice + uiCUAddrIncrement) < uiNumberOfCUsInFrame*scaleCUAddr) ? (uiStartCUAddrSlice + uiCUAddrIncrement) : uiNumberOfCUsInFrame*scaleCUAddr; 1591 } 1592 break; 1593 case FIXED_NUMBER_OF_BYTES: 1594 if (bEncodeSlice) 1595 uiBoundingCUAddrSlice = uiSliceCurEndCUAddr; 1596 else 1597 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*scaleCUAddr; 1598 break; 1599 case FIXED_NUMBER_OF_TILES: 1600 { 1601 UInt tileIdx = rpcPic->getPicSym()->getTileIdxMap( rpcPic->getPicSym()->getCUOrderMap(uiStartCUAddrSlice/scaleCUAddr) ); 1602 UInt uiCUAddrIncrement = 0; 1603 UInt tileTotalCount = (rpcPic->getPicSym()->getNumColumnsMinus1()+1) * (rpcPic->getPicSym()->getNumRowsMinus1()+1); 1604 1605 for(UInt tileIdxIncrement = 0; tileIdxIncrement < sliceArgument; tileIdxIncrement++) 1606 { 1607 if((tileIdx + tileIdxIncrement) < tileTotalCount) 1608 { 1609 UInt tileWidthInLcu = rpcPic->getPicSym()->getTComTile(tileIdx + tileIdxIncrement)->getTileWidth(); 1610 UInt tileHeightInLcu = rpcPic->getPicSym()->getTComTile(tileIdx + tileIdxIncrement)->getTileHeight(); 1611 uiCUAddrIncrement += (tileWidthInLcu * tileHeightInLcu * scaleCUAddr); 1612 } 1613 } 1614 1615 uiBoundingCUAddrSlice = ((uiStartCUAddrSlice + uiCUAddrIncrement) < uiNumberOfCUsInFrame*scaleCUAddr) ? (uiStartCUAddrSlice + uiCUAddrIncrement) : uiNumberOfCUsInFrame*scaleCUAddr; 1616 } 1617 break; 1618 default: 1619 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame*scaleCUAddr; 1620 break; 1621 } 1622 1623 // Adjust for tiles and wavefronts. 1624 if ((sliceMode == FIXED_NUMBER_OF_LCU || sliceMode == FIXED_NUMBER_OF_BYTES) && 1625 (m_pcCfg->getNumRowsMinus1() > 0 || m_pcCfg->getNumColumnsMinus1() > 0)) 1626 { 1627 const UInt lcuEncAddrStart = (uiStartCUAddrSlice+scaleCUAddr-1)/scaleCUAddr; 1628 const UInt lcuAddr = rpcPic->getPicSym()->getCUOrderMap(lcuEncAddrStart); 1629 const UInt startTileIdx = rpcPic->getPicSym()->getTileIdxMap(lcuAddr); 1630 const Bool bWavefrontsEnabled = m_pcCfg->getWaveFrontsynchro(); 1631 1632 TComTile *pStartingTile = rpcPic->getPicSym()->getTComTile(startTileIdx); 1633 const UInt uiTileStartLCUEncAddr = rpcPic->getPicSym()->getInverseCUOrderMap(pStartingTile->getFirstCUAddr()); 1634 const UInt uiTileStartWidth = pStartingTile->getTileWidth(); 1635 const UInt uiTileStartHeight = pStartingTile->getTileHeight(); 1636 const UInt uiTileLastLCUEncAddr_excl = uiTileStartLCUEncAddr + uiTileStartWidth*uiTileStartHeight; 1637 const UInt tileBoundingCUAddrSlice = uiTileLastLCUEncAddr_excl * scaleCUAddr; 1638 1639 const UInt lcuColumnOfStartingTile=((lcuEncAddrStart-uiTileStartLCUEncAddr)%uiTileStartWidth); 1640 if (bWavefrontsEnabled && lcuColumnOfStartingTile!=0) 1641 { 1642 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1643 const UInt numberOfLCUsToEndOfRow=uiTileStartWidth-lcuColumnOfStartingTile; 1644 const UInt wavefrontTileBoundingCUAddrSlice = (lcuEncAddrStart+numberOfLCUsToEndOfRow)*scaleCUAddr; 1645 if (wavefrontTileBoundingCUAddrSlice < uiBoundingCUAddrSlice) 1646 { 1647 uiBoundingCUAddrSlice = wavefrontTileBoundingCUAddrSlice; 1648 } 1649 } 1650 1651 if (tileBoundingCUAddrSlice < uiBoundingCUAddrSlice) 1652 { 1653 uiBoundingCUAddrSlice = tileBoundingCUAddrSlice; 1654 bReachedTileBoundary = true; 1655 } 1656 } 1657 else if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*scaleCUAddr) != 0)) 1658 { 1659 // WPP: if a slice does not start at the beginning of a CTB row, it must end within the same CTB row 1660 uiBoundingCUAddrSlice = min(uiBoundingCUAddrSlice, uiStartCUAddrSlice - (uiStartCUAddrSlice % (rpcPic->getFrameWidthInCU()*scaleCUAddr)) + (rpcPic->getFrameWidthInCU()*scaleCUAddr)); 1661 } 1662 1663 //calculate real slice start address (fine granularity slices) 1664 { 1665 UInt uiInternalAddress = rpcPic->getPicSym()->getPicSCUAddr(uiStartCUAddrSlice) % scaleCUAddr; 1666 UInt uiExternalAddress = rpcPic->getPicSym()->getPicSCUAddr(uiStartCUAddrSlice) / scaleCUAddr; 1667 UInt uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1668 UInt uiPosY = ( uiExternalAddress / rpcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ]; 1669 #if REPN_FORMAT_IN_VPS 1670 UInt uiWidth = pcSlice->getPicWidthInLumaSamples(); 1671 UInt uiHeight = pcSlice->getPicHeightInLumaSamples(); 1672 #else 1673 UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples(); 1674 UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples(); 1675 #endif 1676 while((uiPosX>=uiWidth||uiPosY>=uiHeight)&&!(uiPosX>=uiWidth&&uiPosY>=uiHeight)) 1677 { 1678 uiInternalAddress++; 1679 if(uiInternalAddress>=scaleCUAddr) 1680 { 1681 uiInternalAddress=0; 1682 uiExternalAddress = rpcPic->getPicSym()->getCUOrderMap(rpcPic->getPicSym()->getInverseCUOrderMap(uiExternalAddress)+1); 1683 } 1684 uiPosX = ( uiExternalAddress % rpcPic->getFrameWidthInCU() ) * g_uiMaxCUWidth+ g_auiRasterToPelX[ g_auiZscanToRaster[uiInternalAddress] ]; 1685 uiPosY = ( uiExternalAddress / rpcPic->getFrameWidthInCU() ) * g_uiMaxCUHeight+ g_auiRasterToPelY[ g_auiZscanToRaster[uiInternalAddress] ]; 1686 } 1687 UInt uiRealStartAddress = rpcPic->getPicSym()->getPicSCUEncOrder(uiExternalAddress*scaleCUAddr+uiInternalAddress); 1688 1689 uiStartCUAddrSlice=uiRealStartAddress; 1690 } 1691 } 1692 1693 /** Determines the starting and bounding LCU address of current slice / dependent slice 1694 * \param bEncodeSlice Identifies if the calling function is compressSlice() [false] or encodeSlice() [true] 1695 * \returns Updates uiStartCUAddr, uiBoundingCUAddr with appropriate LCU address 1696 */ 1697 Void TEncSlice::xDetermineStartAndBoundingCUAddr ( UInt& startCUAddr, UInt& boundingCUAddr, TComPic*& rpcPic, Bool bEncodeSlice ) 1698 { 1699 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 1700 1701 // Non-dependent slice 1702 UInt uiStartCUAddrSlice = pcSlice->getSliceCurStartCUAddr(); 1703 Bool bTileBoundarySlice = false; 1704 UInt uiBoundingCUAddrSlice; 1705 calculateBoundingCUAddrForSlice(uiStartCUAddrSlice, uiBoundingCUAddrSlice, bTileBoundarySlice, rpcPic, bEncodeSlice, m_pcCfg->getSliceMode(), m_pcCfg->getSliceArgument(), pcSlice->getSliceCurEndCUAddr()); 1706 pcSlice->setSliceCurEndCUAddr( uiBoundingCUAddrSlice ); 1707 pcSlice->setSliceCurStartCUAddr(uiStartCUAddrSlice); 1708 1709 // Dependent slice 1710 UInt startCUAddrSliceSegment = pcSlice->getSliceSegmentCurStartCUAddr(); 1711 Bool bTileBoundarySliceSegment = false; 1712 UInt boundingCUAddrSliceSegment; 1713 calculateBoundingCUAddrForSlice(startCUAddrSliceSegment, boundingCUAddrSliceSegment, bTileBoundarySliceSegment, rpcPic, bEncodeSlice, m_pcCfg->getSliceSegmentMode(), m_pcCfg->getSliceSegmentArgument(), pcSlice->getSliceSegmentCurEndCUAddr()); 1714 pcSlice->setSliceSegmentCurEndCUAddr( boundingCUAddrSliceSegment ); 1715 pcSlice->setSliceSegmentCurStartCUAddr(startCUAddrSliceSegment); 1716 1717 // Make a joint decision based on reconstruction and dependent slice bounds 1718 startCUAddr = max(uiStartCUAddrSlice , startCUAddrSliceSegment ); 1719 boundingCUAddr = min(uiBoundingCUAddrSlice, boundingCUAddrSliceSegment); 1720 1721 1722 if (!bEncodeSlice) 1723 { 1724 // For fixed number of LCU within an entropy and reconstruction slice we already know whether we will encounter end of entropy and/or reconstruction slice 1725 // first. Set the flags accordingly. 1726 if ( (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 1727 || (m_pcCfg->getSliceMode()==0 && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 1728 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_LCU && m_pcCfg->getSliceSegmentMode()==0) 1729 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_LCU) 1730 || (m_pcCfg->getSliceMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceSegmentMode()==0) 1731 || (m_pcCfg->getSliceSegmentMode()==FIXED_NUMBER_OF_TILES && m_pcCfg->getSliceMode()==0) 1732 || bTileBoundarySlice || bTileBoundarySliceSegment ) 1733 { 1734 if (uiBoundingCUAddrSlice < boundingCUAddrSliceSegment) 1735 { 1736 pcSlice->setNextSlice ( true ); 1737 pcSlice->setNextSliceSegment( false ); 1738 } 1739 else if (uiBoundingCUAddrSlice > boundingCUAddrSliceSegment) 1740 { 1741 pcSlice->setNextSlice ( false ); 1742 pcSlice->setNextSliceSegment( true ); 1743 } 1744 else 1745 { 1746 pcSlice->setNextSlice ( true ); 1747 pcSlice->setNextSliceSegment( true ); 1748 } 1749 } 1750 else 1751 { 1752 pcSlice->setNextSlice ( false ); 1753 pcSlice->setNextSliceSegment( false ); 1754 } 1755 } 1756 } 1757 #else 1482 1758 /** Determines the starting and bounding LCU address of current slice / dependent slice 1483 1759 * \param bEncodeSlice Identifies if the calling function is compressSlice() [false] or encodeSlice() [true] … … 1816 2092 } 1817 2093 } 2094 #endif 1818 2095 1819 2096 Double TEncSlice::xGetQPValueAccordingToLambda ( Double lambda ) -
trunk/source/Lib/TLibEncoder/TEncSlice.h
r595 r906 150 150 Void setCtxMem( TEncSbac* sb, Int b ) { CTXMem[b] = sb; } 151 151 152 #if WPP_FIX 153 Void calculateBoundingCUAddrForSlice(UInt &uiStartCUAddrSlice, UInt &uiBoundingCUAddrSlice, Bool &bReachedTileBoundary, TComPic*& rpcPic, Bool bEncodeSlice, Int sliceMode, Int sliceArgument, UInt uiSliceCurEndCUAddr); 154 #endif 155 152 156 private: 153 157 Double xGetQPValueAccordingToLambda ( Double lambda ); -
trunk/source/Lib/TLibEncoder/TEncTop.cpp
r815 r906 98 98 m_noOutputOfPriorPicsFlags = false; 99 99 #endif 100 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 101 m_pocDecrementedInDPBFlag = false; 102 #endif 100 103 #endif //SVC_EXTENSION 101 104 } … … 323 326 /* set the VPS profile information */ 324 327 *m_cVPS.getPTL() = *m_cSPS.getPTL(); 328 #if VPS_VUI_BSP_HRD_PARAMS 329 m_cVPS.getTimingInfo()->setTimingInfoPresentFlag ( true ); 330 #else 325 331 m_cVPS.getTimingInfo()->setTimingInfoPresentFlag ( false ); 332 #endif 326 333 // initialize PPS 327 334 m_cPPS.setSPS(&m_cSPS); … … 779 786 for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ ) 780 787 { 788 #if MOVE_SCALED_OFFSET_TO_PPS 789 #if O0098_SCALED_REF_LAYER_ID 790 const Window scalEL = getPPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); 791 #else 792 const Window scalEL = getPPS()->getScaledRefLayerWindow(i); 793 #endif 794 #else 781 795 #if O0098_SCALED_REF_LAYER_ID 782 796 const Window scalEL = getSPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); … … 784 798 const Window scalEL = getSPS()->getScaledRefLayerWindow(i); 785 799 #endif 800 #endif 801 #if REF_REGION_OFFSET 802 const Window altRL = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); 803 #if RESAMPLING_FIX 804 Bool equalOffsets = scalEL.hasEqualOffset(altRL); 805 #if R0209_GENERIC_PHASE 806 Bool zeroPhase = getPPS()->hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i)); 807 #endif 808 #else 809 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 810 && altRL.getWindowLeftOffset() == 0 && altRL.getWindowRightOffset() == 0 && altRL.getWindowTopOffset() == 0 && altRL.getWindowBottomOffset() == 0); 811 #endif 812 #else 786 813 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 814 #endif 787 815 788 816 #if VPS_EXTN_DIRECT_REF_LAYERS … … 795 823 Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] ); 796 824 797 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths 825 #if REF_IDX_MFM 826 if( m_iSourceWidth == pcEncTopBase->getSourceWidth() && m_iSourceHeight == pcEncTopBase->getSourceHeight() && equalOffsets && zeroPhase ) 827 { 828 pcEPic->setEqualPictureSizeAndOffsetFlag( i, true ); 829 } 830 831 if( !pcEPic->equalPictureSizeAndOffsetFlag(i) || !sameBitDepths 832 #else 833 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !sameBitDepths 834 #if REF_REGION_OFFSET && RESAMPLING_FIX 835 || !equalOffsets 836 #if R0209_GENERIC_PHASE 837 || !zeroPhase 838 #endif 839 #else 840 || !zeroOffsets 841 #endif 842 #endif 798 843 #if Q0048_CGS_3D_ASYMLUT 799 844 || m_cPPS.getCGSFlag() > 0 … … 804 849 ) 805 850 #else 806 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) 851 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() 852 #if REF_REGION_OFFSET && RESAMPLING_FIX 853 || !equalOffsets 854 #if R0209_GENERIC_PHASE 855 || !zeroPhase 856 #endif 857 #else 858 || !zeroOffsets 859 #endif 860 ) 807 861 #endif 808 862 { … … 839 893 for(UInt i = 0; i < m_cVPS.getNumDirectRefLayers( m_layerId ); i++ ) 840 894 { 895 #if MOVE_SCALED_OFFSET_TO_PPS 896 #if O0098_SCALED_REF_LAYER_ID 897 const Window scalEL = getPPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); 898 #else 899 const Window scalEL = getPPS()->getScaledRefLayerWindow(i); 900 #endif 901 #else 841 902 #if O0098_SCALED_REF_LAYER_ID 842 903 const Window scalEL = getSPS()->getScaledRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); … … 844 905 const Window scalEL = getSPS()->getScaledRefLayerWindow(i); 845 906 #endif 907 #endif 908 #if REF_REGION_OFFSET 909 const Window altRL = getPPS()->getRefLayerWindowForLayer(m_cVPS.getRefLayerId(m_layerId, i)); 910 #if RESAMPLING_FIX 911 Bool equalOffsets = scalEL.hasEqualOffset(altRL); 912 #if R0209_GENERIC_PHASE 913 Bool zeroPhase = getPPS()->hasZeroResamplingPhase(m_cVPS.getRefLayerId(m_layerId, i)); 914 #endif 915 #else 916 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 917 && altRL.getWindowLeftOffset() == 0 && altRL.getWindowRightOffset() == 0 && altRL.getWindowTopOffset() == 0 && altRL.getWindowBottomOffset() == 0); 918 #endif 919 #else 846 920 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 921 #endif 847 922 848 923 #if VPS_EXTN_DIRECT_REF_LAYERS … … 855 930 Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] ); 856 931 857 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths 932 if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !sameBitDepths 933 #if REF_REGION_OFFSET && RESAMPLING_FIX 934 || !equalOffsets 935 #if R0209_GENERIC_PHASE 936 || !zeroPhase 937 #endif 938 #else 939 || !zeroOffsets 940 #endif 858 941 #if Q0048_CGS_3D_ASYMLUT 859 942 || m_cPPS.getCGSFlag() > 0 … … 864 947 ) 865 948 #else 866 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets ) 949 if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() 950 #if REF_REGION_OFFSET && RESAMPLING_FIX 951 || !equalOffsets 952 #if R0209_GENERIC_PHASE 953 || !zeroPhase 954 #endif 955 #else 956 || !zeroOffsets 957 #endif 958 ) 867 959 #endif 868 960 { … … 905 997 #if SVC_EXTENSION 906 998 m_cSPS.setExtensionFlag( m_layerId > 0 ? true : false ); 907 999 #if R0042_PROFILE_INDICATION 1000 m_cSPS.setNumDirectRefLayers(m_numAddLayerSets); 1001 #endif 908 1002 #if Q0078_ADD_LAYER_SETS 909 if (getNumDirectRefLayers() == 0 && getNumAddLayerSets() > 0)1003 if( !m_numDirectRefLayers && m_numAddLayerSets ) 910 1004 { 911 1005 m_cSPS.setLayerId(0); // layer ID 0 for independent layers … … 918 1012 m_cSPS.setLayerId(m_layerId); 919 1013 #endif 1014 #if !MOVE_SCALED_OFFSET_TO_PPS 920 1015 m_cSPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets); 921 1016 for(Int i = 0; i < m_cSPS.getNumScaledRefLayerOffsets(); i++) … … 929 1024 #endif 930 1025 } 1026 #endif 931 1027 #endif //SVC_EXTENSION 932 1028 ProfileTierLevel& profileTierLevel = *m_cSPS.getPTL()->getGeneralPTL(); … … 1041 1137 { 1042 1138 TComVUI* pcVUI = m_cSPS.getVuiParameters(); 1043 pcVUI->setAspectRatioInfoPresentFlag(getAspectRatioI dc() != -1);1139 pcVUI->setAspectRatioInfoPresentFlag(getAspectRatioInfoPresentFlag()); 1044 1140 pcVUI->setAspectRatioIdc(getAspectRatioIdc()); 1045 1141 pcVUI->setSarWidth(getSarWidth()); … … 1177 1273 1178 1274 #if Q0078_ADD_LAYER_SETS 1179 if (getNumDirectRefLayers() == 0 && getNumAddLayerSets() > 0)1275 if( !m_numDirectRefLayers && m_numAddLayerSets ) 1180 1276 { 1181 1277 m_cPPS.setLayerId(0); // layer ID 0 for independent layers … … 1203 1299 { 1204 1300 m_cPPS.setNumExtraSliceHeaderBits( 3 ); 1301 } 1302 #endif 1303 #if MOVE_SCALED_OFFSET_TO_PPS 1304 m_cPPS.setNumScaledRefLayerOffsets(m_numScaledRefLayerOffsets); 1305 for(Int i = 0; i < m_cPPS.getNumScaledRefLayerOffsets(); i++) 1306 { 1307 #if O0098_SCALED_REF_LAYER_ID 1308 m_cPPS.setScaledRefLayerId(i, m_scaledRefLayerId[i]); 1309 #endif 1310 m_cPPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i]; 1311 #if REF_REGION_OFFSET 1312 m_cPPS.getRefLayerWindow(i) = m_refLayerWindow[i]; 1313 m_cPPS.setScaledRefLayerOffsetPresentFlag( m_scaledRefLayerId[i], m_scaledRefLayerOffsetPresentFlag[i] ); 1314 m_cPPS.setRefRegionOffsetPresentFlag( m_scaledRefLayerId[i], m_refRegionOffsetPresentFlag[i] ); 1315 #endif 1316 #if R0209_GENERIC_PHASE 1317 m_cPPS.setResamplePhaseSetPresentFlag( m_scaledRefLayerId[i], m_resamplePhaseSetPresentFlag[i] ); 1318 m_cPPS.setPhaseHorLuma( m_scaledRefLayerId[i], m_phaseHorLuma[i] ); 1319 m_cPPS.setPhaseVerLuma( m_scaledRefLayerId[i], m_phaseVerLuma[i] ); 1320 m_cPPS.setPhaseHorChroma( m_scaledRefLayerId[i], m_phaseHorChroma[i] ); 1321 m_cPPS.setPhaseVerChroma( m_scaledRefLayerId[i], m_phaseVerChroma[i] ); 1322 #endif 1323 #if P0312_VERT_PHASE_ADJ 1324 m_cPPS.setVertPhasePositionEnableFlag( m_scaledRefLayerId[i], m_scaledRefLayerWindow[i].getVertPhasePositionEnableFlag() ); 1325 #endif 1205 1326 } 1206 1327 #endif … … 1477 1598 Void TEncTop::xInitPPSforTiles() 1478 1599 { 1479 m_cPPS.set UniformSpacingFlag( m_iUniformSpacingIdr);1480 m_cPPS.setNum ColumnsMinus1( m_iNumColumnsMinus1 );1481 m_cPPS.setNum RowsMinus1( m_iNumRowsMinus1 );1482 if( m_iUniformSpacingIdr == 0)1483 { 1484 m_cPPS.set ColumnWidth( m_puiColumnWidth );1485 m_cPPS.set RowHeight( m_puiRowHeight );1600 m_cPPS.setTileUniformSpacingFlag( m_tileUniformSpacingFlag ); 1601 m_cPPS.setNumTileColumnsMinus1( m_iNumColumnsMinus1 ); 1602 m_cPPS.setNumTileRowsMinus1( m_iNumRowsMinus1 ); 1603 if( !m_tileUniformSpacingFlag ) 1604 { 1605 m_cPPS.setTileColumnWidth( m_tileColumnWidth ); 1606 m_cPPS.setTileRowHeight( m_tileRowHeight ); 1486 1607 } 1487 1608 m_cPPS.setLoopFilterAcrossTilesEnabledFlag( m_loopFilterAcrossTilesEnabledFlag ); 1488 1609 1489 1610 // # substreams is "per tile" when tiles are independent. 1490 if (m_iWaveFrontSynchro 1491 ) 1611 if (m_iWaveFrontSynchro ) 1492 1612 { 1493 1613 m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams * (m_iNumColumnsMinus1+1)); … … 1515 1635 } 1516 1636 1517 if( m_iNumColumnsMinus1 && m_iUniformSpacingIdr==0)1637 if( m_iNumColumnsMinus1 && !m_tileUniformSpacingFlag ) 1518 1638 { 1519 1639 for(Int i=0; i<m_iNumColumnsMinus1; i++) 1520 1640 { 1521 uiCummulativeColumnWidth += m_ puiColumnWidth[i];1641 uiCummulativeColumnWidth += m_tileColumnWidth[i]; 1522 1642 } 1523 1643 … … 1542 1662 } 1543 1663 1544 if( m_iNumRowsMinus1 && m_iUniformSpacingIdr==0)1664 if( m_iNumRowsMinus1 && !m_tileUniformSpacingFlag ) 1545 1665 { 1546 1666 for(Int i=0; i<m_iNumRowsMinus1; i++) 1547 { 1548 uiCummulativeRowHeight += m_puiRowHeight[i]; 1549 } 1667 uiCummulativeRowHeight += m_tileRowHeight[i]; 1550 1668 1551 1669 if( uiCummulativeRowHeight >= iHeightInCU ) … … 1646 1764 1647 1765 Int numReorderPics[MAX_TLAYER]; 1766 #if R0156_CONF_WINDOW_IN_REP_FORMAT 1767 Window &conformanceWindow = repFormat->getConformanceWindowVps(); 1768 #else 1648 1769 Window &conformanceWindow = m_cSPS.getConformanceWindow(); 1770 #endif 1649 1771 Window defaultDisplayWindow = m_cSPS.getVuiParametersPresentFlag() ? m_cSPS.getVuiParameters()->getDefaultDisplayWindow() : Window(); 1650 1772 … … 1685 1807 return win; 1686 1808 } 1809 #if REF_REGION_OFFSET 1810 Window& TEncTop::getRefLayerWindowForLayer(Int layerId) 1811 { 1812 static Window win; 1813 1814 for (Int i = 0; i < m_numScaledRefLayerOffsets; i++) 1815 { 1816 if (layerId == m_refLayerId[i]) 1817 { 1818 return m_refLayerWindow[i]; 1819 } 1820 } 1821 1822 win.resetWindow(); // reference offsets are inferred to be zero when not present 1823 return win; 1824 } 1825 #endif 1687 1826 #endif 1688 1827 -
trunk/source/Lib/TLibEncoder/TEncTop.h
r815 r906 125 125 static Int m_iSPSIdCnt; ///< next Id number for SPS 126 126 static Int m_iPPSIdCnt; ///< next Id number for PPS 127 #if AVC_SYNTAX128 fstream* m_pBLSyntaxFile;129 #endif130 127 TEncTop** m_ppcTEncTop; 131 128 TEncTop* getLayerEnc(UInt layer) { return m_ppcTEncTop[layer]; } … … 139 136 #endif 140 137 Window m_scaledRefLayerWindow[MAX_LAYERS]; 138 #if REF_REGION_OFFSET 139 UInt m_numRefLayerOffsets; 140 UInt m_refLayerId[MAX_LAYERS]; 141 Window m_refLayerWindow[MAX_LAYERS]; 142 Bool m_scaledRefLayerOffsetPresentFlag[MAX_LAYERS]; 143 Bool m_refRegionOffsetPresentFlag[MAX_LAYERS]; 144 #endif 145 #if R0209_GENERIC_PHASE 146 Int m_phaseHorLuma [MAX_LAYERS]; 147 Int m_phaseVerLuma [MAX_LAYERS]; 148 Int m_phaseHorChroma[MAX_LAYERS]; 149 Int m_phaseVerChroma[MAX_LAYERS]; 150 Int m_resamplePhaseSetPresentFlag[MAX_LAYERS]; 151 #endif 141 152 #if P0312_VERT_PHASE_ADJ 142 153 Bool m_vertPhasePositionEnableFlag[MAX_LAYERS]; … … 156 167 #if Q0078_ADD_LAYER_SETS 157 168 int m_numAddLayerSets; 169 #endif 170 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 171 Bool m_pocDecrementedInDPBFlag; 172 Int m_currPocMsb; 158 173 #endif 159 174 #endif //SVC_EXTENSION … … 232 247 #endif 233 248 Window& getScaledRefLayerWindow(Int x) { return m_scaledRefLayerWindow[x]; } 249 #if REF_REGION_OFFSET 250 Void setNumRefLayerOffsets(Int x) { m_numRefLayerOffsets = x; } 251 UInt getNumRefLayerOffsets() { return m_numRefLayerOffsets; } 252 Void setRefLayerId(Int x, UInt id) { m_refLayerId[x] = id; } 253 UInt getRefLayerId(Int x) { return m_refLayerId[x]; } 254 Window& getRefLayerWindowForLayer(Int layerId); 255 Window& getRefLayerWindow(Int x) { return m_refLayerWindow[x]; } 256 Bool getScaledRefLayerOffsetPresentFlag(Int x) { return m_scaledRefLayerOffsetPresentFlag[x]; } 257 Void setScaledRefLayerOffsetPresentFlag(Int x, Bool b) { m_scaledRefLayerOffsetPresentFlag[x] = b; } 258 Bool getRefRegionOffsetPresentFlag(Int x) { return m_refRegionOffsetPresentFlag[x]; } 259 Void setRefRegionOffsetPresentFlag(Int x, Bool b) { m_refRegionOffsetPresentFlag[x] = b; } 260 #endif 234 261 #if P0312_VERT_PHASE_ADJ 235 262 Void setVertPhasePositionEnableFlag(Int x, Bool b) { m_vertPhasePositionEnableFlag[x] = b; } 236 263 UInt getVertPhasePositionEnableFlag(Int x) { return m_vertPhasePositionEnableFlag[x]; } 264 #endif 265 #if R0209_GENERIC_PHASE 266 Int getPhaseHorLuma(Int x) { return m_phaseHorLuma[x]; } 267 Int getPhaseVerLuma(Int x) { return m_phaseVerLuma[x]; } 268 Int getPhaseHorChroma(Int x) { return m_phaseHorChroma[x]; } 269 Int getPhaseVerChroma(Int x) { return m_phaseVerChroma[x]; } 270 Void setPhaseHorLuma(Int x, Int val) { m_phaseHorLuma[x] = val; } 271 Void setPhaseVerLuma(Int x, Int val) { m_phaseVerLuma[x] = val; } 272 Void setPhaseHorChroma(Int x, Int val) { m_phaseHorChroma[x] = val; } 273 Void setPhaseVerChroma(Int x, Int val) { m_phaseVerChroma[x] = val; } 274 Bool getResamplePhaseSetPresentFlag(Int x) { return m_resamplePhaseSetPresentFlag[x]; } 275 Void setResamplePhaseSetPresentFlag(Int x, Bool b) { m_resamplePhaseSetPresentFlag[x] = b; } 237 276 #endif 238 277 … … 245 284 Void setInterLayerWeightedPredFlag(Bool flag) { m_interLayerWeightedPredFlag = flag; } 246 285 Bool getInterLayerWeightedPredFlag() { return m_interLayerWeightedPredFlag; } 247 #endif248 #if AVC_SYNTAX249 Void setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }250 fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }251 286 #endif 252 287 Void encode( TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int iPicIdInGOP ); … … 275 310 Int getNumAddLayerSets() { return m_numAddLayerSets; } 276 311 #endif 312 #if P0297_VPS_POC_LSB_ALIGNED_FLAG 313 Void setPocDecrementedInDPBFlag(Bool x) { m_pocDecrementedInDPBFlag = x; } 314 Bool getPocDecrementedInDPBFlag() { return m_pocDecrementedInDPBFlag; } 315 Void setCurrPocMsb(Int poc) { m_currPocMsb = poc; } 316 Int getCurrPocMsb() { return m_currPocMsb; } 317 #endif 277 318 #else //SVC_EXTENSION 278 319 Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, -
trunk/source/Lib/TLibVideoIO/TVideoIOYuv.cpp
r595 r906 470 470 Bool retval = true; 471 471 472 if ((width==0)||(height==0)) 473 { 474 printf ("\nWarning: writing %d x %d luma sample output picture!", width, height); 475 } 476 472 477 if (m_bitDepthShiftY != 0 || m_bitDepthShiftC != 0) 473 478 { … … 567 572 568 573 Bool retval = true; 574 575 if ((width==0)||(height==0)) 576 { 577 printf ("\nWarning: writing %d x %d luma sample output picture!", width, height); 578 } 569 579 570 580 if (m_bitDepthShiftY != 0 || m_bitDepthShiftC != 0)
Note: See TracChangeset for help on using the changeset viewer.