Changeset 446 in 3DVCSoftware for branches/HTM-DEV-0.2-dev


Ignore:
Timestamp:
26 May 2013, 16:22:23 (12 years ago)
Author:
tech
Message:

Added missing parts.

Location:
branches/HTM-DEV-0.2-dev
Files:
16 added
126 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.2-dev/build/linux/app/TAppRenderer/makefile

    r438 r446  
    44# set directories to your wanted values
    55SRC_DIR                         = ../../../../source/App/TAppRenderer
    6 INC_DIR                         = ../../../../source/App
     6INC_DIR                         = ../../../../source/Lib
    77LIB_DIR                         = ../../../../lib
    88BIN_DIR                         = ../../../../bin
  • branches/HTM-DEV-0.2-dev/build/linux/common/makefile.base

    r324 r446  
    4747# default cpp flags for all configurations
    4848#CPPFLAGS          = -Wall -fPIC $(DEFS) -I$(CURDIR)/$(INC_DIR) $(USER_INC_DIRS)
    49 CPPFLAGS          = -fPIC $(DEFS) -I$(CURDIR)/$(INC_DIR) $(USER_INC_DIRS) -Wall -Wshadow -Wno-sign-compare -Werror
     49CPPFLAGS          = -fPIC $(DEFS) $(ADDDEFS) -I$(CURDIR)/$(INC_DIR) $(USER_INC_DIRS) -Wall -Wshadow -Wno-sign-compare -Werror
    5050
    5151##########
  • branches/HTM-DEV-0.2-dev/build/linux/makefile

    r438 r446  
    11### enforce 32-bit build : 1=yes, 0=no
    22M32?= 0
     3HEVC_EXT?= ''
    34 
    45export M32
    56
     7ifneq ($(HEVC_EXT), '')
     8ADDDEFS = -DHEVC_EXT=$(HEVC_EXT)
     9endif
     10
    611all:
    7         $(MAKE) -C lib/TLibVideoIO      MM32=$(M32)
    8         $(MAKE) -C lib/TLibCommon       MM32=$(M32)
    9         $(MAKE) -C lib/TLibDecoder      MM32=$(M32)
    10         $(MAKE) -C lib/TLibEncoder      MM32=$(M32)
    11         $(MAKE) -C lib/TLibRenderer  MM32=$(M32)
    12         $(MAKE) -C lib/TLibExtractor  MM32=$(M32)
    13         $(MAKE) -C lib/TAppCommon       MM32=$(M32)
    14         $(MAKE) -C app/TAppDecoder      MM32=$(M32)
    15         $(MAKE) -C app/TAppEncoder      MM32=$(M32)
    16         $(MAKE) -C app/TAppRenderer     MM32=$(M32)
    17         $(MAKE) -C app/TAppExtractor    MM32=$(M32)
    18         $(MAKE) -C utils/annexBbytecount       MM32=$(M32)
    19         $(MAKE) -C utils/convert_NtoMbit_YCbCr MM32=$(M32)
     12        $(MAKE) -C lib/TLibVideoIO      MM32=$(M32) ADDDEFS=$(ADDDEFS)
     13        $(MAKE) -C lib/TLibCommon       MM32=$(M32) ADDDEFS=$(ADDDEFS)
     14        $(MAKE) -C lib/TLibDecoder      MM32=$(M32) ADDDEFS=$(ADDDEFS)
     15        $(MAKE) -C lib/TLibEncoder      MM32=$(M32) ADDDEFS=$(ADDDEFS)
     16        $(MAKE) -C lib/TLibRenderer  MM32=$(M32) ADDDEFS=$(ADDDEFS)
     17        $(MAKE) -C lib/TLibExtractor  MM32=$(M32) ADDDEFS=$(ADDDEFS)
     18        $(MAKE) -C lib/TAppCommon       MM32=$(M32) ADDDEFS=$(ADDDEFS)
     19        $(MAKE) -C app/TAppDecoder      MM32=$(M32) ADDDEFS=$(ADDDEFS)
     20        $(MAKE) -C app/TAppEncoder      MM32=$(M32) ADDDEFS=$(ADDDEFS)
     21        $(MAKE) -C app/TAppRenderer     MM32=$(M32) ADDDEFS=$(ADDDEFS)
     22        $(MAKE) -C app/TAppExtractor    MM32=$(M32) ADDDEFS=$(ADDDEFS)
     23        $(MAKE) -C utils/annexBbytecount       MM32=$(M32) ADDDEFS=$(ADDDEFS)
     24        $(MAKE) -C utils/convert_NtoMbit_YCbCr MM32=$(M32) ADDDEFS=$(ADDDEFS)
    2025
    2126debug:
    22         $(MAKE) -C lib/TLibVideoIO      debug MM32=$(M32)
    23         $(MAKE) -C lib/TLibCommon       debug MM32=$(M32)
    24         $(MAKE) -C lib/TLibDecoder      debug MM32=$(M32)
    25         $(MAKE) -C lib/TLibEncoder      debug MM32=$(M32)
    26         $(MAKE) -C lib/TLibRenderer  debug      MM32=$(M32)
    27         $(MAKE) -C lib/TLibExtractor  debug     MM32=$(M32)
    28         $(MAKE) -C lib/TAppCommon       debug MM32=$(M32)
    29         $(MAKE) -C app/TAppDecoder      debug MM32=$(M32)
    30         $(MAKE) -C app/TAppEncoder      debug MM32=$(M32)
    31         $(MAKE) -C app/TAppRenderer     debug MM32=$(M32)
    32         $(MAKE) -C app/TAppExtractor    debug MM32=$(M32)
    33         $(MAKE) -C utils/annexBbytecount       debug MM32=$(M32)
    34         $(MAKE) -C utils/convert_NtoMbit_YCbCr debug MM32=$(M32)
     27        $(MAKE) -C lib/TLibVideoIO      debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     28        $(MAKE) -C lib/TLibCommon       debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     29        $(MAKE) -C lib/TLibDecoder      debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     30        $(MAKE) -C lib/TLibEncoder      debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     31        $(MAKE) -C lib/TLibRenderer  debug      MM32=$(M32) ADDDEFS=$(ADDDEFS)
     32        $(MAKE) -C lib/TLibExtractor  debug     MM32=$(M32) ADDDEFS=$(ADDDEFS)
     33        $(MAKE) -C lib/TAppCommon       debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     34        $(MAKE) -C app/TAppDecoder      debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     35        $(MAKE) -C app/TAppEncoder      debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     36        $(MAKE) -C app/TAppRenderer     debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     37        $(MAKE) -C app/TAppExtractor    debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     38        $(MAKE) -C utils/annexBbytecount       debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
     39        $(MAKE) -C utils/convert_NtoMbit_YCbCr debug MM32=$(M32) ADDDEFS=$(ADDDEFS)
    3540
    3641release:
    37         $(MAKE) -C lib/TLibVideoIO      release MM32=$(M32)
    38         $(MAKE) -C lib/TLibCommon       release MM32=$(M32)
    39         $(MAKE) -C lib/TLibDecoder      release MM32=$(M32)
    40         $(MAKE) -C lib/TLibEncoder      release MM32=$(M32)
    41         $(MAKE) -C lib/TLibRenderer  release MM32=$(M32)
    42         $(MAKE) -C lib/TLibExtractor  release MM32=$(M32)
    43         $(MAKE) -C lib/TAppCommon       release MM32=$(M32)
    44         $(MAKE) -C app/TAppDecoder      release MM32=$(M32)
    45         $(MAKE) -C app/TAppEncoder      release MM32=$(M32)
    46         $(MAKE) -C app/TAppRenderer    release MM32=$(M32)     
    47         $(MAKE) -C app/TAppExtractor    release MM32=$(M32)     
    48         $(MAKE) -C utils/annexBbytecount       release MM32=$(M32)
    49         $(MAKE) -C utils/convert_NtoMbit_YCbCr release MM32=$(M32)
     42        $(MAKE) -C lib/TLibVideoIO      release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     43        $(MAKE) -C lib/TLibCommon       release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     44        $(MAKE) -C lib/TLibDecoder      release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     45        $(MAKE) -C lib/TLibEncoder      release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     46        $(MAKE) -C lib/TLibRenderer  release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     47        $(MAKE) -C lib/TLibExtractor  release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     48        $(MAKE) -C lib/TAppCommon       release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     49        $(MAKE) -C app/TAppDecoder      release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     50        $(MAKE) -C app/TAppEncoder      release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     51        $(MAKE) -C app/TAppRenderer    release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     52        $(MAKE) -C app/TAppExtractor    release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     53        $(MAKE) -C utils/annexBbytecount       release MM32=$(M32) ADDDEFS=$(ADDDEFS)
     54        $(MAKE) -C utils/convert_NtoMbit_YCbCr release MM32=$(M32) ADDDEFS=$(ADDDEFS)
    5055
    5156clean:
  • branches/HTM-DEV-0.2-dev/build/vc9/TAppExtractor_vc9.vcproj

    r438 r446  
    4545                                Name="VCCLCompilerTool"
    4646                                Optimization="0"
    47                                 AdditionalIncludeDirectories=""..\..\compat\msvc""
     47                                AdditionalIncludeDirectories="$(SolutionDir)\..\source\Lib\;$(SolutionDir)\..\compat\msvc"
    4848                                PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
    4949                                MinimalRebuild="true"
     
    6868                                SubSystem="1"
    6969                                TargetMachine="1"
     70                        />
     71                        <Tool
     72                                Name="VCALinkTool"
     73                        />
     74                        <Tool
     75                                Name="VCManifestTool"
     76                        />
     77                        <Tool
     78                                Name="VCXDCMakeTool"
     79                        />
     80                        <Tool
     81                                Name="VCBscMakeTool"
     82                        />
     83                        <Tool
     84                                Name="VCFxCopTool"
     85                        />
     86                        <Tool
     87                                Name="VCAppVerifierTool"
     88                        />
     89                        <Tool
     90                                Name="VCPostBuildEventTool"
     91                        />
     92                </Configuration>
     93                <Configuration
     94                        Name="Debug|x64"
     95                        OutputDirectory="$(SolutionDir)\..\bin\vc9\$(PlatformName)\$(ConfigurationName)\"
     96                        IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
     97                        ConfigurationType="1"
     98                        CharacterSet="2"
     99                        >
     100                        <Tool
     101                                Name="VCPreBuildEventTool"
     102                        />
     103                        <Tool
     104                                Name="VCCustomBuildTool"
     105                        />
     106                        <Tool
     107                                Name="VCXMLDataGeneratorTool"
     108                        />
     109                        <Tool
     110                                Name="VCWebServiceProxyGeneratorTool"
     111                        />
     112                        <Tool
     113                                Name="VCMIDLTool"
     114                                TargetEnvironment="3"
     115                        />
     116                        <Tool
     117                                Name="VCCLCompilerTool"
     118                                Optimization="0"
     119                                AdditionalIncludeDirectories="&quot;$(SolutionDir)\source\Lib&quot;;&quot;$(SolutionDir)\..\source\Lib\&quot;;&quot;$(SolutionDir)\..\compat\msvc&quot;"
     120                                PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
     121                                MinimalRebuild="true"
     122                                BasicRuntimeChecks="3"
     123                                RuntimeLibrary="1"
     124                                WarningLevel="3"
     125                                DebugInformationFormat="3"
     126                        />
     127                        <Tool
     128                                Name="VCManagedResourceCompilerTool"
     129                        />
     130                        <Tool
     131                                Name="VCResourceCompilerTool"
     132                        />
     133                        <Tool
     134                                Name="VCPreLinkEventTool"
     135                        />
     136                        <Tool
     137                                Name="VCLinkerTool"
     138                                LinkIncremental="2"
     139                                GenerateDebugInformation="true"
     140                                SubSystem="1"
     141                                TargetMachine="17"
    70142                        />
    71143                        <Tool
     
    120192                                EnableIntrinsicFunctions="false"
    121193                                FavorSizeOrSpeed="1"
    122                                 AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
     194                                AdditionalIncludeDirectories="$(SolutionDir)\..\source\Lib\;$(SolutionDir)\..\compat\msvc"
    123195                                PreprocessorDefinitions="WIN32;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
    124196                                StringPooling="true"
     
    143215                                SubSystem="1"
    144216                                TargetMachine="1"
    145                         />
    146                         <Tool
    147                                 Name="VCALinkTool"
    148                         />
    149                         <Tool
    150                                 Name="VCManifestTool"
    151                         />
    152                         <Tool
    153                                 Name="VCXDCMakeTool"
    154                         />
    155                         <Tool
    156                                 Name="VCBscMakeTool"
    157                         />
    158                         <Tool
    159                                 Name="VCFxCopTool"
    160                         />
    161                         <Tool
    162                                 Name="VCAppVerifierTool"
    163                         />
    164                         <Tool
    165                                 Name="VCPostBuildEventTool"
    166                         />
    167                 </Configuration>
    168                 <Configuration
    169                         Name="Debug|x64"
    170                         OutputDirectory="$(SolutionDir)\..\bin\vc9\$(PlatformName)\$(ConfigurationName)\"
    171                         IntermediateDirectory="$(SolutionDir)\vc9\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
    172                         ConfigurationType="1"
    173                         CharacterSet="2"
    174                         >
    175                         <Tool
    176                                 Name="VCPreBuildEventTool"
    177                         />
    178                         <Tool
    179                                 Name="VCCustomBuildTool"
    180                         />
    181                         <Tool
    182                                 Name="VCXMLDataGeneratorTool"
    183                         />
    184                         <Tool
    185                                 Name="VCWebServiceProxyGeneratorTool"
    186                         />
    187                         <Tool
    188                                 Name="VCMIDLTool"
    189                                 TargetEnvironment="3"
    190                         />
    191                         <Tool
    192                                 Name="VCCLCompilerTool"
    193                                 Optimization="0"
    194                                 PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
    195                                 AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
    196                                 MinimalRebuild="true"
    197                                 BasicRuntimeChecks="3"
    198                                 RuntimeLibrary="1"
    199                                 WarningLevel="3"
    200                                 DebugInformationFormat="3"
    201                         />
    202                         <Tool
    203                                 Name="VCManagedResourceCompilerTool"
    204                         />
    205                         <Tool
    206                                 Name="VCResourceCompilerTool"
    207                         />
    208                         <Tool
    209                                 Name="VCPreLinkEventTool"
    210                         />
    211                         <Tool
    212                                 Name="VCLinkerTool"
    213                                 LinkIncremental="2"
    214                                 GenerateDebugInformation="true"
    215                                 SubSystem="1"
    216                                 TargetMachine="17"
    217217                        />
    218218                        <Tool
     
    268268                                EnableIntrinsicFunctions="false"
    269269                                FavorSizeOrSpeed="1"
     270                                AdditionalIncludeDirectories="$(SolutionDir)\..\source\Lib\;$(SolutionDir)\..\compat\msvc"
    270271                                PreprocessorDefinitions="WIN32;_CONSOLE;_CRT_SECURE_NO_WARNINGS"
    271                                 AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
    272272                                StringPooling="true"
    273273                                RuntimeLibrary="0"
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/baseCfg_2view+depth.cfg

    r438 r446  
    2626ScalabilityMask               : 3           # Scalability Mask             ( 1: View Scalability, 3: View + Depth Scalability )
    2727DimensionIdLen                : 2 1         # Number of bits to store Ids,  per scalability dimension, (m)
    28 ViewId                        : 0 0 1 1     # ViewId     (m)
     28ViewId                        : 1 1 0 0     # ViewId     (m)
    2929DepthFlag                     : 0 1 0 1     # DepthFlag  (m)
    3030LayerIdInNuh                  : 0           # Layer Id in NAL unit header, (0: no explicit signalling ) (m)
    3131SplittingFlag                 : 0           # Splitting Flag
     32
     33#========== Camera parameters ==========
     34CameraParameterFile           : cam_pars.txt  # camera parameter file
     35CodedCamParsPrecision         : 5           # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
    3236
    3337#======== Unit definition ================
     
    105109Frame8_l5:  B    7     7        0.68     0            0              0           3                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       1             -4                 2                  -1 
    106110
    107 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    108 
    109111#=========== Motion Search =============
    110112FastSearch                    : 1           # 0:Full search  1:TZ search
     
    125127DeblockingFilterControlPresent: 1           # Dbl control params present (0=not present, 1=present) (mc)
    126128LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    127 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
    128 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    129 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     129LoopFilterDisable             : 0 1         # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
     130LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     131LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     132DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    130133
    131134
     
    134137
    135138#=========== Coding Tools =================
    136 SAO                           : 1           # Sample adaptive offset  (0: OFF, 1: ON) (mc)
     139SAO                           : 1 0         # Sample adaptive offset  (0: OFF, 1: ON) (mc)
    137140AMP                           : 1           # Asymmetric motion partitions (0: OFF, 1: ON)
    138141TransformSkip                 : 1           # Transform skipping (0: OFF, 1: ON)
     
    191194RCForceIntraQP                      : 0                # Rate control: force intra QP to be equal to initial QP
    192195
     196#========== multiview coding tools ==========
     197
     198
     199#========== depth coding tools ==========
     200VSO                       : 1                                      # use of view synthesis optimization for depth coding
     201
     202#========== view synthesis optimization (VSO) ==========
     203
     204VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) I(s0.25 s0.5 s0.75)]  # VSO configuration string
     205#VSOConfig                 : [ox0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) I(s0.25 s0.5 s0.75)]  # VSO configuration string // FCO
     206WVSO                      : 1                                    # use of WVSO (Depth distortion metric with a weighted depth fidelity term)
     207VSOWeight                 : 10                                   # weight of VSO ( in SAD case, cf. squared in SSE case )
     208VSDWeight                 : 1                                    # weight of VSD ( in SAD case, cf. squared in SSE case )
     209DWeight                   : 1                                    # weight of depth distortion itself ( in SAD case, cf. squared in SSE case )
     210UseEstimatedVSD           : 1                                    # Model based VSD estimation instead of rendering based for some encoder decisions     
     211
     212
     213
    193214### DO NOT ADD ANYTHING BELOW THIS LINE ###
    194215### DO NOT DELETE THE EMPTY LINE BELOW ###
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/baseCfg_2view.cfg

    r438 r446  
    2121LayerIdInNuh                  : 0           # Layer Id in NAL unit header, (0: no explicit signalling ) (m)
    2222SplittingFlag                 : 0           # Splitting Flag
     23
     24
     25#========== Camera parameters ==========
     26CameraParameterFile           : cam_pars.txt  # camera parameter file
     27CodedCamParsPrecision         : 5           # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
    2328
    2429#======== Unit definition ================
     
    5762Frame8_l1:  B    7     7        0.68     0            0              0           3                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       1             -1                 2                  -1
    5863
    59 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    60 
    6164#=========== Motion Search =============
    6265FastSearch                    : 1           # 0:Full search  1:TZ search
     
    7982LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    8083LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
    81 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    82 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     84LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     85LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     86DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    8387
    8488
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/baseCfg_3view+depth.cfg

    r438 r446  
    2626ScalabilityMask               : 3           # Scalability Mask             ( 1: View Scalability, 3: View + Depth Scalability )
    2727DimensionIdLen                : 2 1         # Number of bits to store Ids,  per scalability dimension, (m)
    28 ViewId                        : 0 0 1 1 2 2 # ViewId     (m)
     28ViewId                        : 1 1 0 0 2 2 # ViewId     (m)
    2929DepthFlag                     : 0 1 0 1 0 1 # DepthFlag  (m)
    3030LayerIdInNuh                  : 0           # Layer Id in NAL unit header, (0: no explicit signalling ) (m)
    3131SplittingFlag                 : 0           # Splitting Flag
     32
     33#========== Camera parameters ==========
     34CameraParameterFile           : cam_pars.txt  # camera parameter file
     35CodedCamParsPrecision         : 5           # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
    3236
    3337#======== Unit definition ================
     
    105109Frame8_l5:  B    7     7        0.68     0            0              0           3                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       1             -4                 2                  -1 
    106110
    107 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    108 
    109111#=========== Motion Search =============
    110112FastSearch                    : 1           # 0:Full search  1:TZ search
     
    125127DeblockingFilterControlPresent: 1           # Dbl control params present (0=not present, 1=present) (mc)
    126128LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    127 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
    128 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    129 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
    130 
     129LoopFilterDisable             : 0 1         # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
     130LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     131LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     132DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    131133
    132134#=========== Misc. ============
     
    134136
    135137#=========== Coding Tools =================
    136 SAO                           : 1           # Sample adaptive offset  (0: OFF, 1: ON) (mc)
     138SAO                           : 1 0         # Sample adaptive offset  (0: OFF, 1: ON) (mc)
    137139AMP                           : 1           # Asymmetric motion partitions (0: OFF, 1: ON)
    138140TransformSkip                 : 1           # Transform skipping (0: OFF, 1: ON)
     
    191193RCForceIntraQP                      : 0                # Rate control: force intra QP to be equal to initial QP
    192194
     195#========== multiview coding tools ==========
     196
     197
     198#========== depth coding tools ==========
     199VSO                       : 1                                      # use of view synthesis optimization for depth coding
     200
     201#========== view synthesis optimization (VSO) ==========
     202VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][cx2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string
     203#VSOConfig                 : [ox0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][ox2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string for FCO = 1
     204WVSO                      : 1                                    # use of WVSO (Depth distortion metric with a weighted depth fidelity term)
     205VSOWeight                 : 10                                   # weight of VSO ( in SAD case, cf. squared in SSE case )
     206VSDWeight                 : 1                                    # weight of VSD ( in SAD case, cf. squared in SSE case )
     207DWeight                   : 1                                    # weight of depth distortion itself ( in SAD case, cf. squared in SSE case )
     208UseEstimatedVSD           : 1                                    # Model based VSD estimation instead of rendering based for some encoder decisions     
     209
     210
     211
    193212### DO NOT ADD ANYTHING BELOW THIS LINE ###
    194213### DO NOT DELETE THE EMPTY LINE BELOW ###
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/baseCfg_3view.cfg

    r438 r446  
    2323LayerIdInNuh                  : 0           # Layer Id in NAL unit header, (0: no explicit signalling ) (m)
    2424SplittingFlag                 : 0           # Splitting Flag
     25
     26#========== Camera parameters ==========
     27CameraParameterFile           : cam_pars.txt  # camera parameter file
     28CodedCamParsPrecision         : 5           # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
    2529
    2630#======== Unit definition ================
     
    6973Frame8_l2:  B    7     7        0.68     0            0              0           3                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       1             -2                 2                  -1
    7074
    71 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    72 
    7375#=========== Motion Search =============
    7476FastSearch                    : 1           # 0:Full search  1:TZ search
     
    9193LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    9294LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
    93 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    94 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
    95 
     95LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     96LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     97DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    9698
    9799#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/fullCfg.cfg

    r438 r446  
    3030ScalabilityMask               : 3           # Scalability Mask             ( 1: View Scalability, 3: View + Depth Scalability )
    3131DimensionIdLen                : 2 1         # Number of bits to store Ids,  per scalability dimension, (m)
    32 ViewId                        : 0 0 1 1 2 2 # ViewId     (m)
     32ViewId                        : 1 1 0 0 2 2 # ViewId     (m)
    3333DepthFlag                     : 0 1 0 1 0 1 # DepthFlag  (m)
    3434LayerIdInNuh                  : 0           # Layer Id in NAL unit header, (0: no explicit signalling ) (m)
    3535SplittingFlag                 : 0           # Splitting Flag
     36
     37#========== Camera parameters ==========
     38BaseViewCameraNumbers         : 3 1 5       # camera numbers of coded views ( in coding order per view )
     39CameraParameterFile           : cam_pars.txt  # camera parameter file
     40CodedCamParsPrecision         : 5           # precision used for coding of camera parameters (in units of 2^(-x) luma samples)
    3641
    3742#======== Unit definition ================
     
    109114Frame8_l5:  B    7     7        0.68     0            0              0           3                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       1             -4                 2                  -1 
    110115
    111 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    112 
    113116#=========== Motion Search =============
    114117FastSearch                    : 1           # 0:Full search  1:TZ search
     
    120123
    121124#======== Quantization =============
    122 QP                            : 25 30       # QP ( mc )
     125QP                            : 25 30 25 30 25 30      # QP ( mc )
    123126MaxDeltaQP                    : 0           # CU-based multi-QP optimization
    124127MaxCuDQPDepth                 : 0           # Max depth of a minimum CuDQP for sub-LCU-level delta QP
     
    130133DeblockingFilterControlPresent: 1           # Dbl control params present (0=not present, 1=present) (mc)
    131134LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    132 LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
    133 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    134 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
    135 
     135LoopFilterDisable             : 0 1         # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
     136LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     137LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     138DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    136139
    137140#=========== Misc. ============
     
    139142
    140143#=========== Coding Tools =================
    141 SAO                           : 1           # Sample adaptive offset  (0: OFF, 1: ON) (mc)
     144SAO                           : 1 0         # Sample adaptive offset  (0: OFF, 1: ON) (mc)
    142145AMP                           : 1           # Asymmetric motion partitions (0: OFF, 1: ON)
    143146TransformSkip                 : 1           # Transform skipping (0: OFF, 1: ON)
     
    196199RCForceIntraQP                      : 0                # Rate control: force intra QP to be equal to initial QP
    197200
     201#========== multiview coding tools ==========
     202
     203
     204#========== depth coding tools ==========
     205VSO                       : 1                                      # use of view synthesis optimization for depth coding
     206
     207#========== view synthesis optimization (VSO) ==========
     208VSOConfig                 : [cx0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][cx2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string
     209#VSOConfig                 : [ox0 B(cc1) I(s0.25 s0.5 s0.75)][cx1 B(oo0) B(oo2) I(s0.25 s0.5 s0.75 s1.25 s1.5 s1.75)][ox2 B(cc1) I(s1.25 s1.5 s1.75)] # VSO configuration string for FCO = 1
     210WVSO                      : 1                                    # use of WVSO (Depth distortion metric with a weighted depth fidelity term)
     211VSOWeight                 : 10                                   # weight of VSO ( in SAD case, cf. squared in SSE case )
     212VSDWeight                 : 1                                    # weight of VSD ( in SAD case, cf. squared in SSE case )
     213DWeight                   : 1                                    # weight of depth distortion itself ( in SAD case, cf. squared in SSE case )
     214UseEstimatedVSD           : 1                                    # Model based VSD estimation instead of rendering based for some encoder decisions     
     215
     216
     217
    198218### DO NOT ADD ANYTHING BELOW THIS LINE ###
    199219### DO NOT DELETE THE EMPTY LINE BELOW ###
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/seqCfg_Balloons.cfg

    r324 r446  
    55FrameRate                 : 30                                     # frame rate in frames per second
    66FramesToBeEncoded         : 300                                    # number of frames to be coded
    7 #BaseViewCameraNumbers     : 3 1 5                                  # camera numbers of coded views (in coding order)
     7BaseViewCameraNumbers     : 3 1 5                                  # camera numbers of coded views (in coding order)
    88
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/seqCfg_GhostTownFly.cfg

    r324 r446  
    55FrameRate                 : 25                                     # frame rate in frames per second
    66FramesToBeEncoded         : 250                                    # number of frames to be coded
    7 #BaseViewCameraNumbers     : 5 9 1                                  # camera numbers of coded views (in coding order)
     7BaseViewCameraNumbers     : 5 9 1                                  # camera numbers of coded views (in coding order)
    88
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/seqCfg_Kendo.cfg

    r324 r446  
    55FrameRate                 : 30                                     # frame rate in frames per second
    66FramesToBeEncoded         : 300                                    # number of frames to be coded
    7 #BaseViewCameraNumbers     : 3 1 5                                  # camera numbers of coded views (in coding order)
     7BaseViewCameraNumbers     : 3 1 5                                  # camera numbers of coded views (in coding order)
    88
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/seqCfg_Newspaper.cfg

    r324 r446  
    55FrameRate                 : 30                                     # frame rate in frames per second
    66FramesToBeEncoded         : 300                                    # number of frames to be coded
    7 #BaseViewCameraNumbers     : 4 2 6                                  # camera numbers of coded views (in coding order)
     7BaseViewCameraNumbers     : 4 2 6                                  # camera numbers of coded views (in coding order)
    88
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/seqCfg_PoznanHall2.cfg

    r324 r446  
    55FrameRate                 : 25                                     # frame rate in frames per second
    66FramesToBeEncoded         : 200                                    # number of frames to be coded
    7 #BaseViewCameraNumbers     : 6 7 5                                  # camera numbers of coded views (in coding order)
     7BaseViewCameraNumbers     : 6 7 5                                  # camera numbers of coded views (in coding order)
    88
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/seqCfg_PoznanStreet.cfg

    r324 r446  
    55FrameRate                 : 25                                     # frame rate in frames per second
    66FramesToBeEncoded         : 250                                    # number of frames to be coded
    7 #BaseViewCameraNumbers     : 4 5 3                                  # camera numbers of coded views (in coding order)
     7BaseViewCameraNumbers     : 4 5 3                                  # camera numbers of coded views (in coding order)
    88
  • branches/HTM-DEV-0.2-dev/cfg/3D-HEVC/seqCfg_UndoDancer.cfg

    r324 r446  
    55FrameRate                 : 25                                     # frame rate in frames per second
    66FramesToBeEncoded         : 250                                    # number of frames to be coded
    7 #BaseViewCameraNumbers     : 5 1 9                                  # camera numbers of coded views (in coding order)
     7BaseViewCameraNumbers     : 5 1 9                                  # camera numbers of coded views (in coding order)
    88
  • branches/HTM-DEV-0.2-dev/cfg/HEVC/HM/encoder_intra_main.cfg

    r438 r446  
    3939LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    4040LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
    41 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    42 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     41LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     42LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     43DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    4344
    4445#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/HEVC/HM/encoder_intra_main10.cfg

    r438 r446  
    3939LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    4040LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
    41 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    42 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     41LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     42LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     43DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    4344
    4445#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/HEVC/HM/encoder_lowdelay_P_main.cfg

    r438 r446  
    2323Frame3:  P    3   3        0.4624   0            0               0           4                4         -1 -3 -7 -11       1      -1       5         0 1 1 1 1           
    2424Frame4:  P    4   1        0.578    0            0               0           4                4         -1 -4 -8 -12       1      -1       5         0 1 1 1 1
    25 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    2625
    2726#=========== Motion Search =============
     
    4544LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    4645LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
    47 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    48 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     46LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     47LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     48DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    4949
    5050#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/HEVC/HM/encoder_lowdelay_P_main10.cfg

    r438 r446  
    2323Frame3:  P    3   3        0.4624   0            0               0           4                4         -1 -3 -7 -11       1      -1       5         0 1 1 1 1           
    2424Frame4:  P    4   1        0.578    0            0               0           4                4         -1 -4 -8 -12       1      -1       5         0 1 1 1 1
    25 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    2625
    2726#=========== Motion Search =============
     
    4746LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    4847LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
    49 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    50 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     48LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     49LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     50DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    5151
    5252#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/HEVC/HM/encoder_lowdelay_main.cfg

    r438 r446  
    2323Frame3:  B    3   3        0.4624   0            0               0           4                4         -1 -3 -7 -11       1      -1       5         0 1 1 1 1           
    2424Frame4:  B    4   1        0.578    0            0               0           4                4         -1 -4 -8 -12       1      -1       5         0 1 1 1 1
    25 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    2625
    2726#=========== Motion Search =============
     
    4544LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    4645LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
    47 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    48 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     46LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     47LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     48DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    4949
    5050#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/HEVC/HM/encoder_lowdelay_main10.cfg

    r438 r446  
    2323Frame3:  B    3   3        0.4624   0            0               0           4                4         -1 -3 -7 -11       1      -1       5         0 1 1 1 1           
    2424Frame4:  B    4   1        0.578    0            0               0           4                4         -1 -4 -8 -12       1      -1       5         0 1 1 1 1
    25 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    2625
    2726#=========== Motion Search =============
     
    4544LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    4645LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
    47 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    48 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     46LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     47LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     48DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    4949
    5050#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/HEVC/HM/encoder_randomaccess_main.cfg

    r438 r446  
    2727Frame7:  B    5   4        0.68     0            0              0           2                4         -1 -5  1 3             1       1        5         1 0 1 1 1 
    2828Frame8:  B    7   4        0.68     0            0              0           2                4         -1 -3 -7 1             1      -2        5         1 1 1 1 0
    29 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    3029
    3130#=========== Motion Search =============
     
    4948LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    5049LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
    51 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    52 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
    53 
     50LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     51LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     52DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    5453
    5554#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/HEVC/HM/encoder_randomaccess_main10.cfg

    r438 r446  
    2727Frame7:  B    5   4        0.68     0            0              0           2                4         -1 -5  1 3             1       1        5         1 0 1 1 1 
    2828Frame8:  B    7   4        0.68     0            0              0           2                4         -1 -3 -7 1             1      -2        5         1 1 1 1 0
    29 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    3029
    3130#=========== Motion Search =============
     
    4948LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    5049LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter)
    51 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    52 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     50LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     51LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     52DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    5353
    5454#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/MV-HEVC/baseCfg_2view.cfg

    r438 r446  
    5757Frame8_l1:  B    7     7        0.68     0            0              0           3                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       1             -1                 2                  -1
    5858
    59 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    60 
    6159#=========== Motion Search =============
    6260FastSearch                    : 1           # 0:Full search  1:TZ search
     
    7977LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    8078LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
    81 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    82 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
     79LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     80LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     81DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    8382
    8483
  • branches/HTM-DEV-0.2-dev/cfg/MV-HEVC/baseCfg_3view.cfg

    r438 r446  
    6969Frame8_l2:  B    7     7        0.68     0            0              0           3                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       1             -2                 2                  -1
    7070
    71 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    72 
    7371#=========== Motion Search =============
    7472FastSearch                    : 1           # 0:Full search  1:TZ search
     
    9189LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    9290LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
    93 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    94 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
    95 
     91LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     92LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     93DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    9694
    9795#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/cfg/MV-HEVC/fullCfg.cfg

    r438 r446  
    7373Frame8_l2:  B    7     7        0.68     0            0              0           3                4         -1 -3 -7 1         1      -2        5         1 1 1 1 0       1             -2                 2                  -1
    7474
    75 ListCombination               : 1           # Use combined list for uni-prediction in B-slices
    76 
    7775#=========== Motion Search =============
    7876FastSearch                    : 1           # 0:Full search  1:TZ search
     
    9593LoopFilterOffsetInPPS         : 0           # Dbl params: 0=varying params in SliceHeader, param = base_param + GOP_offset_param; 1=constant params in PPS, param = base_param)
    9694LoopFilterDisable             : 0           # Disable deblocking filter (0=Filter, 1=No Filter) (mc)
    97 LoopFilterBetaOffset_div2     : 0           # base_param: -13 ~ 13
    98 LoopFilterTcOffset_div2       : 0           # base_param: -13 ~ 13
    99 
     95LoopFilterBetaOffset_div2     : 0           # base_param: -6 ~ 6
     96LoopFilterTcOffset_div2       : 0           # base_param: -6 ~ 6
     97DeblockingFilterMetric        : 0           # blockiness metric (automatically configures deblocking parameters in bitstream)
    10098
    10199#=========== Misc. ============
  • branches/HTM-DEV-0.2-dev/doc/Doxyfile

    r438 r446  
    3333# if some version control system is used.
    3434
    35 PROJECT_NUMBER         = HM-10.0
     35PROJECT_NUMBER         = HM-10.1
    3636
    3737# Using the PROJECT_BRIEF tag one can provide an optional one line description
  • branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecCfg.cpp

    r438 r446  
    4545#include <cassert>
    4646#endif
    47 
    4847#ifdef WIN32
    4948#define strdup _strdup
     
    6968  string cfg_ReconFile;
    7069  string cfg_TargetDecLayerIdSetFile;
     70#if H_3D
     71  string cfg_ScaleOffsetFile;
     72#endif
    7173
    7274  po::Options opts;
     
    7678  ("ReconFile,o",     cfg_ReconFile,     string(""), "reconstructed YUV output file name\n"
    7779                                                     "YUV writing is skipped if omitted")
     80#if H_3D
     81  ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")
     82#endif
    7883  ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access")
    7984  ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)")
    8085  ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)")
    81 
    8286#if H_MV
    8387  ("MaxLayerId,-ls", m_maxLayerId, MAX_NUM_LAYER_IDS-1, "Maximum LayerId to be decoded.")
    8488#endif
    85 
    8689  ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
    8790  ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n"
     
    108111  /* convert std::string to c string for compatability */
    109112  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    110 
    111113  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    112114
     115#if H_3D
     116  m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());
     117#endif
    113118  if (!m_pchBitstreamFile)
    114119  {
     
    191196}
    192197#endif
    193 
    194198//! \}
  • branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecCfg.h

    r368 r446  
    6363#endif
    6464  Char*         m_pchReconFile;                       ///< output reconstruction file name
     65#if H_3D
     66  Char*         m_pchScaleOffsetFile;                 ///< output coded scale and offset parameters
     67#endif
    6568  Int           m_iSkipFrame;                         ///< counter for frames prior to the random access point to skip
    6669  Int           m_outputBitDepthY;                    ///< bit depth used for writing output (luma)
  • branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r438 r446  
    5454
    5555TAppDecTop::TAppDecTop()
    56 
    5756#if !H_MV
    5857: m_iPOCLastDisplay(-MAX_INT)
     
    6059: m_numDecoders( 0 )
    6160#endif
    62 
    6361{
    6462  ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));
    6563#if H_MV
    6664  for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) m_layerIdToDecIdx[i] = -1;
     65#endif
     66#if H_3D
     67    m_pScaleOffsetFile  = 0;
    6768#endif
    6869}
     
    7980    m_pchBitstreamFile = NULL;
    8081  }
    81 
    8282#if H_MV
    8383  for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++)
     
    115115  poc = -1;
    116116#endif
    117 
    118117  TComList<TComPic*>* pcListPic = NULL;
    119118
     
    125124  }
    126125
     126#if H_3D
     127  if( m_pchScaleOffsetFile )
     128  {
     129    m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );
     130    AOF( m_pScaleOffsetFile );
     131  }
     132  m_cCamParsCollector.init( m_pScaleOffsetFile );
     133#endif
    127134  InputByteStream bytestream(bitstreamFile);
    128135
     
    147154  Bool firstSlice        = true;
    148155#endif
    149 
    150156 
    151157  while (!!bitstreamFile)
     
    156162     * nal unit. */
    157163    streampos location = bitstreamFile.tellg();
     164#if H_MV
     165#if ENC_DEC_TRACE
     166    Int64 symCount = g_nSymbolCounter;
     167#endif
     168#endif
    158169    AnnexBStats stats = AnnexBStats();
    159170#if !H_MV
    160171    Bool bPreviousPictureDecoded = false;
    161172#endif
     173
    162174    vector<uint8_t> nalUnit;
    163175    InputNALUnit nalu;
     
    250262          bitstreamFile.seekg(location-streamoff(3));
    251263          bytestream.reset();
     264#if H_MV
     265#if ENC_DEC_TRACE
     266          g_nSymbolCounter = symCount;
     267#endif
     268#endif
    252269        }
    253270#if !H_MV
     
    276293    }
    277294#endif
     295
    278296    if( pcListPic )
    279297    {
     
    286304        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    287305        if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
     306
    288307#if H_MV
    289308        m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
     
    297316      if ( bNewPicture &&
    298317#endif
    299            (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR
     318           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    300319            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
    301320            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
    302             || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLANT
    303             || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA ) )
     321            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     322            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) )
    304323      {
    305324#if H_MV
     
    318337  }
    319338
     339#if H_3D
     340  if( m_cCamParsCollector.isInitialized() )
     341  {
     342    m_cCamParsCollector.setSlice( 0 );
     343  }
     344#endif
    320345  for(UInt decIdx = 0; decIdx < m_numDecoders; decIdx++)
    321346  {
     
    383408  // destroy decoder class
    384409  m_cTDecTop.destroy();
     410#endif
     411#if H_3D
     412  m_cCamParsCollector.uninit();
     413  if( m_pScaleOffsetFile )
     414  {
     415    ::fclose( m_pScaleOffsetFile );
     416  }
    385417#endif
    386418}
     
    593625}
    594626
     627#if H_MV
     628Int TAppDecTop::xGetDecoderIdx( Int layerId, Bool createFlag /*= false */ )
     629{
     630  Int decIdx = -1;
     631  if ( m_layerIdToDecIdx[ layerId ] != -1 )
     632  {     
     633    decIdx = m_layerIdToDecIdx[ layerId ];
     634  }
     635  else
     636  {     
     637    assert ( createFlag );
     638    assert( m_numDecoders < MAX_NUM_LAYERS );
     639
     640    decIdx = m_numDecoders;
     641
     642    // Init decoder
     643    m_tDecTop[ decIdx ] =  new TDecTop;
     644    m_tDecTop[ decIdx ]->create();
     645    m_tDecTop[ decIdx ]->init( );
     646    m_tDecTop[ decIdx ]->setLayerId( layerId );
     647    m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     648    m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists );
     649#if H_3D
     650   m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );
     651#endif
     652
     653    // append pic list of new decoder to PicLists
     654    assert( m_ivPicLists.size() == m_numDecoders );
     655    m_ivPicLists.push_back( m_tDecTop[ decIdx ]->getListPic() );
     656
     657    // create recon file related stuff     
     658    Char* pchTempFilename = NULL;
     659    if ( m_pchReconFile )
     660    {     
     661      Char buffer[4];     
     662      sprintf(buffer,"_%i", layerId );
     663      assert ( m_pchReconFile );
     664      xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename );
     665      assert( m_pchReconFiles.size() == m_numDecoders );
     666    }
     667
     668    m_pchReconFiles.push_back( pchTempFilename );   
     669
     670    m_tVideoIOYuvReconFile[ decIdx ] = new TVideoIOYuv;
     671    m_reconOpen           [ decIdx ] = false;
     672
     673    // set others
     674    m_pocLastDisplay      [ decIdx ] = -MAX_INT;
     675    m_layerIdToDecIdx     [ layerId ] = decIdx;
     676
     677    m_numDecoders++;
     678  };
     679  return decIdx;
     680}
     681#endif
    595682//! \}
  • branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecTop.h

    r438 r446  
    7171  TVideoIOYuv                     m_cTVideoIOYuvReconFile;        ///< reconstruction YUV class
    7272#endif
    73  
    74   // for output control
     73    // for output control
    7574  Bool                            m_abDecFlag[ MAX_GOP ];         ///< decoded flag in one GOP
    76 
    7775#if H_MV
    7876  Int                             m_pocLastDisplay      [ MAX_NUM_LAYERS ]; ///< last POC in display order
     
    8179  Int                             m_iPOCLastDisplay;              ///< last POC in display order
    8280#endif
    83  
     81#if H_3D
     82  FILE*                           m_pScaleOffsetFile;
     83  CamParsCollector                m_cCamParsCollector;
     84#endif
    8485public:
    8586  TAppDecTop();
     
    9091  Void  decode            (); ///< main decoding function
    9192 
    92 
    9393protected:
    9494  Void  xCreateDecLib     (); ///< create internal classes
     
    9999  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, Int layerId, Int tId ); ///< write YUV to file
    100100  Void  xFlushOutput      ( TComList<TComPic*>* pcListPic, Int layerId ); ///< flush all remaining decoded pictures to file
    101   Int   xGetDecoderIdx    ( Int layerId, Bool createFlag = false )
    102   {
    103     Int decIdx = -1;
    104     if ( m_layerIdToDecIdx[ layerId ] != -1 )
    105     {     
    106       decIdx = m_layerIdToDecIdx[ layerId ];
    107     }
    108     else
    109     {     
    110       assert ( createFlag );
    111       assert( m_numDecoders < MAX_NUM_LAYERS );
    112 
    113       decIdx = m_numDecoders;
    114      
    115       // Init decoder
    116       m_tDecTop[ decIdx ] =  new TDecTop;
    117       m_tDecTop[ decIdx ]->create();
    118       m_tDecTop[ decIdx ]->init( );
    119       m_tDecTop[ decIdx ]->setLayerId( layerId );
    120       m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    121       m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists );
    122      
    123       // append pic list of new decoder to PicLists
    124       assert( m_ivPicLists.size() == m_numDecoders );
    125       m_ivPicLists.push_back( m_tDecTop[ decIdx ]->getListPic() );
    126 
    127       // create recon file related stuff     
    128       Char* pchTempFilename = NULL;
    129       if ( m_pchReconFile )
    130       {     
    131         Char buffer[4];     
    132         sprintf(buffer,"_%i", layerId );
    133         assert ( m_pchReconFile );
    134         xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename );
    135         assert( m_pchReconFiles.size() == m_numDecoders );
    136       }
    137 
    138       m_pchReconFiles.push_back( pchTempFilename );   
    139 
    140       m_tVideoIOYuvReconFile[ decIdx ] = new TVideoIOYuv;
    141       m_reconOpen           [ decIdx ] = false;
    142 
    143       // set others
    144       m_pocLastDisplay      [ decIdx ] = -MAX_INT;
    145       m_layerIdToDecIdx     [ layerId ] = decIdx;
    146 
    147       m_numDecoders++;
    148     };
    149     return decIdx;
    150   }
     101  Int   xGetDecoderIdx    ( Int layerId, Bool createFlag = false );
    151102#else
    152103  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic , UInt tId); ///< write YUV to file
    153104  Void  xFlushOutput      ( TComList<TComPic*>* pcListPic ); ///< flush all remaining decoded pictures to file
    154105#endif
    155 
    156106  Bool  isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet
    157107};
  • branches/HTM-DEV-0.2-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r438 r446  
    7979  m_aidQP = NULL;
    8080#endif
     81#if J0149_TONE_MAPPING_SEI
     82  m_startOfCodedInterval = NULL;
     83  m_codedPivotValue = NULL;
     84  m_targetPivotValue = NULL;
     85#endif
    8186}
    8287
     
    102107    delete[] m_aidQP;
    103108  }
     109#endif
     110#if J0149_TONE_MAPPING_SEI
     111  if ( m_startOfCodedInterval )
     112  {
     113    delete[] m_startOfCodedInterval;
     114    m_startOfCodedInterval = NULL;
     115  }
     116   if ( m_codedPivotValue )
     117  {
     118    delete[] m_codedPivotValue;
     119    m_codedPivotValue = NULL;
     120  }
     121  if ( m_targetPivotValue )
     122  {
     123    delete[] m_targetPivotValue;
     124    m_targetPivotValue = NULL;
     125  }
     126#endif
     127#if !H_MV
    104128  free(m_pchInputFile);
    105129#endif
    106 
    107130  free(m_pchBitstreamFile);
    108 
    109131#if H_MV
    110132  for(Int i = 0; i< m_pchReconFileList.size(); i++ )
     
    116138  free(m_pchReconFile);
    117139#endif
    118 
    119140  free(m_pchdQPFile);
    120141  free(m_pColumnWidth);
    121142  free(m_pRowHeight);
    122143  free(m_scalingListFile);
    123 
    124144#if H_MV
    125145  for( Int i = 0; i < m_GOPListMvc.size(); i++ )
     
    131151    }
    132152  }
     153#endif
     154#if H_3D
     155#if H_3D_VSO
     156  if (  m_pchVSOConfig != NULL)
     157    free (  m_pchVSOConfig );
     158#endif
     159  if ( m_pchCameraParameterFile != NULL )
     160    free ( m_pchCameraParameterFile );
     161
     162  if ( m_pchBaseViewCameraNumbers != NULL )
     163    free ( m_pchBaseViewCameraNumbers );
    133164#endif
    134165}
     
    300331  string cfg_InputFile;
    301332#endif
    302 
    303333  string cfg_BitstreamFile;
    304 
    305334#if !H_MV
    306335  string cfg_ReconFile;
    307336#endif
    308 
    309337#if H_MV
    310338  vector<Int>   cfg_dimensionLength;
     
    316344#endif
    317345#endif
    318 
    319346  string cfg_dQPFile;
    320347  string cfg_ColumnWidth;
    321348  string cfg_RowHeight;
    322349  string cfg_ScalingListFile;
     350#if J0149_TONE_MAPPING_SEI
     351  string cfg_startOfCodedInterval;
     352  string cfg_codedPivotValue;
     353  string cfg_targetPivotValue;
     354#endif
    323355#if SIGNAL_BITRATE_PICRATE_IN_VPS
    324356  string cfg_bitRateInfoPresentFlag;
     
    335367 
    336368  // File, I/O and source parameters
    337 
    338369#if H_MV
    339370  ("InputFile_%d,i_%d",       m_pchInputFileList,       (char *) 0 , MAX_NUM_LAYER_IDS , "original Yuv input file name %d")
     
    341372  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    342373#endif
    343 
    344374  ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
    345 
    346375#if H_MV
    347376  ("ReconFile_%d,o_%d",       m_pchReconFileList,       (char *) 0 , MAX_NUM_LAYER_IDS , "reconstructed Yuv output file name %d")
     
    349378  ("ReconFile,o",           cfg_ReconFile,     string(""), "Reconstructed YUV output file name")
    350379#endif
    351 
    352380#if H_MV
    353381  ("NumberOfLayers",        m_numberOfLayers     , 1,                     "Number of layers")
     
    365393  ("SplittingFlag",         m_splittingFlag      , false                , "Splitting Flag")   
    366394#endif
    367 
    368395  ("SourceWidth,-wdt",      m_iSourceWidth,        0, "Source picture width")
    369396  ("SourceHeight,-hgt",     m_iSourceHeight,       0, "Source picture height")
     
    387414
    388415  // Profile and level
    389 
    390416  ("Profile", m_profile,   Profile::NONE, "Profile to be used when encoding (Incomplete)")
    391417  ("Level",   m_level,     Level::NONE,   "Level limit to be used, eg 5.1 (Incomplete)")
     
    417443  ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
    418444  ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
     445#if !L0034_COMBINED_LIST_CLEANUP
    419446  ("ListCombination,-lc",     m_bUseLComb,               true, "Combined reference list for uni-prediction estimation in B-slices")
     447#endif
    420448  // motion options
    421449  ("FastSearch",              m_iFastSearch,                1, "0:Full search  1:Diamond  2:PMVFAST")
     
    473501  ("LoopFilterTcOffset_div2",        m_loopFilterTcOffsetDiv2,             0 )
    474502  ("DeblockingFilterControlPresent", m_DeblockingFilterControlPresent, false )
     503#if L0386_DB_METRIC
     504  ("DeblockingFilterMetric",         m_DeblockingFilterMetric,         false )
     505#endif
    475506
    476507  // Coding tools
     
    591622  ("SEIBufferingPeriod",             m_bufferingPeriodSEIEnabled,              0, "Control generation of buffering period SEI messages")
    592623  ("SEIPictureTiming",               m_pictureTimingSEIEnabled,                0, "Control generation of picture timing SEI messages")
     624#if J0149_TONE_MAPPING_SEI
     625  ("SEIToneMappingInfo",                       m_toneMappingInfoSEIEnabled,    false, "Control generation of Tone Mapping SEI messages")
     626  ("SEIToneMapId",                             m_toneMapId,                        0, "Specifies Id of Tone Mapping SEI message for a given session")
     627  ("SEIToneMapCancelFlag",                     m_toneMapCancelFlag,            false, "Indicates that Tone Mapping SEI message cancels the persistance or follows")
     628  ("SEIToneMapPersistenceFlag",                m_toneMapPersistenceFlag,        true, "Specifies the persistence of the Tone Mapping SEI message")
     629  ("SEIToneMapCodedDataBitDepth",              m_toneMapCodedDataBitDepth,         8, "Specifies Coded Data BitDepth of Tone Mapping SEI messages")
     630  ("SEIToneMapTargetBitDepth",                 m_toneMapTargetBitDepth,            8, "Specifies Output BitDepth of Tome mapping function")
     631  ("SEIToneMapModelId",                        m_toneMapModelId,                   0, "Specifies Model utilized for mapping coded data into target_bit_depth range\n"
     632                                                                                      "\t0:  linear mapping with clipping\n"
     633                                                                                      "\t1:  sigmoidal mapping\n"
     634                                                                                      "\t2:  user-defined table mapping\n"
     635                                                                                      "\t3:  piece-wise linear mapping\n"
     636                                                                                      "\t4:  luminance dynamic range information ")
     637  ("SEIToneMapMinValue",                              m_toneMapMinValue,                          0, "Specifies the minimum value in mode 0")
     638  ("SEIToneMapMaxValue",                              m_toneMapMaxValue,                       1023, "Specifies the maxmum value in mode 0")
     639  ("SEIToneMapSigmoidMidpoint",                       m_sigmoidMidpoint,                        512, "Specifies the centre point in mode 1")
     640  ("SEIToneMapSigmoidWidth",                          m_sigmoidWidth,                           960, "Specifies the distance between 5% and 95% values of the target_bit_depth in mode 1")
     641  ("SEIToneMapStartOfCodedInterval",                  cfg_startOfCodedInterval,          string(""), "Array of user-defined mapping table")
     642  ("SEIToneMapNumPivots",                             m_numPivots,                                0, "Specifies the number of pivot points in mode 3")
     643  ("SEIToneMapCodedPivotValue",                       cfg_codedPivotValue,               string(""), "Array of pivot point")
     644  ("SEIToneMapTargetPivotValue",                      cfg_targetPivotValue,              string(""), "Array of pivot point")
     645  ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                        0, "Indicates the camera ISO speed for daylight illumination")
     646  ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                    400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
     647  ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,        0, "Specifies the sign of ExposureCompensationValue")
     648  ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,       0, "Specifies the numerator of ExposureCompensationValue")
     649  ("SEIToneMapExposureCompensationValueDenomIdc",     m_exposureCompensationValueDenomIdc,        2, "Specifies the denominator of ExposureCompensationValue")
     650  ("SEIToneMapRefScreenLuminanceWhite",               m_refScreenLuminanceWhite,                350, "Specifies reference screen brightness setting in units of candela per square metre")
     651  ("SEIToneMapExtendedRangeWhiteLevel",               m_extendedRangeWhiteLevel,                800, "Indicates the luminance dynamic range")
     652  ("SEIToneMapNominalBlackLevelLumaCodeValue",        m_nominalBlackLevelLumaCodeValue,          16, "Specifies luma sample value of the nominal black level assigned decoded pictures")
     653  ("SEIToneMapNominalWhiteLevelLumaCodeValue",        m_nominalWhiteLevelLumaCodeValue,         235, "Specifies luma sample value of the nominal white level assigned decoded pictures")
     654  ("SEIToneMapExtendedWhiteLevelLumaCodeValue",       m_extendedWhiteLevelLumaCodeValue,        300, "Specifies luma sample value of the extended dynamic range assigned decoded pictures")
     655#endif
    593656  ("SEIFramePacking",                m_framePackingSEIEnabled,                 0, "Control generation of frame packing SEI messages")
    594657  ("SEIFramePackingType",            m_framePackingSEIType,                    0, "Define frame packing arrangement\n"
     
    611674  ("SEIGradualDecodingRefreshInfo",  m_gradualDecodingRefreshInfoEnabled,      0, "Control generation of gradual decoding refresh information SEI message")
    612675  ("SEIDecodingUnitInfo",             m_decodingUnitInfoSEIEnabled,                       0, "Control generation of decoding unit information SEI message.")
     676#if L0208_SOP_DESCRIPTION_SEI
     677  ("SEISOPDescription",              m_SOPDescriptionSEIEnabled,              0, "Control generation of SOP description SEI messages")
     678#endif
     679#if K0180_SCALABLE_NESTING_SEI
     680  ("SEIScalableNesting",             m_scalableNestingSEIEnabled,              0, "Control generation of scalable nesting SEI messages")
     681#endif
    613682#if SIGNAL_BITRATE_PICRATE_IN_VPS
    614683  ("BitRatePicRateMaxTLayers",   m_bitRatePicRateMaxTLayers,           0, "Maximum number of sub-layers signalled; can be inferred otherwise; here for easy parsing of config. file")
     
    624693  ("ConstantPicRateIdc",           cfg_constantPicRateIdc,            string(""), "List of constant picture rate IDCs; include non-negative number even if corresponding flag is 0")
    625694#endif
     695#if H_3D
     696  ("CameraParameterFile,cpf", m_pchCameraParameterFile,    (Char *) 0, "Camera Parameter File Name")
     697  ("BaseViewCameraNumbers" ,  m_pchBaseViewCameraNumbers,  (Char *) 0, "Numbers of base views")
     698  ("CodedCamParsPrecision",   m_iCodedCamParPrecision,  STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
     699/* View Synthesis Optimization */
     700
     701#if H_3D_VSO
     702  ("VSOConfig",                       m_pchVSOConfig            , (Char *) 0    , "VSO configuration")
     703  ("VSO",                             m_bUseVSO                 , false         , "Use VSO" )   
     704  ("VSOMode",                         m_uiVSOMode               , (UInt)   4    , "VSO Mode")
     705  ("LambdaScaleVSO",                  m_dLambdaScaleVSO         , (Double) 1    , "Lambda Scaling for VSO")
     706  ("VSOLSTable",                      m_bVSOLSTable             , true          , "Depth QP dependent video/depth rate allocation by Lagrange multiplier" )     
     707  ("ForceLambdaScaleVSO",             m_bForceLambdaScaleVSO    , false         , "Force using Lambda Scale VSO also in non-VSO-Mode")
     708  ("AllowNegDist",                    m_bAllowNegDist           , true          , "Allow negative Distortion in VSO")
     709 
     710  ("UseEstimatedVSD",                 m_bUseEstimatedVSD        , true          , "Model based VSD estimation instead of rendering based for some encoder decisions" )     
     711  ("VSOEarlySkip",                    m_bVSOEarlySkip           , true          , "Early skip of VSO computation if synthesis error assumed to be zero" )     
     712 
     713  ("WVSO",                            m_bUseWVSO                , true          , "Use depth fidelity term for VSO" )
     714  ("VSOWeight",                       m_iVSOWeight              , 10            , "Synthesized View Distortion Change weight" )
     715  ("VSDWeight",                       m_iVSDWeight              , 1             , "View Synthesis Distortion estimate weight" )
     716  ("DWeight",                         m_iDWeight                , 1             , "Depth Distortion weight" )
     717
     718#endif //HHI_VSO
     719#endif //H_3D
    626720  ;
    627721 
     
    661755  }
    662756#endif
    663 
    664757  po::setDefaults(opts);
    665758  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
     
    681774   */
    682775  /* convert std::string to c string for compatability */
    683 
    684776#if !H_MV
    685777  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
    686778#endif
    687 
    688779  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    689 
    690780#if !H_MV
    691781  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    692782#endif
    693 
    694783  m_pchdQPFile = cfg_dQPFile.empty() ? NULL : strdup(cfg_dQPFile.c_str());
    695784 
     
    755844  free ( pRowHeight   );
    756845#endif
    757 
    758846#if SIGNAL_BITRATE_PICRATE_IN_VPS
    759847  readBoolString(cfg_bitRateInfoPresentFlag, m_bitRatePicRateMaxTLayers, m_bitRateInfoPresentFlag, "bit rate info. present flag" );
     
    839927#if H_3D
    840928  xResizeVector( m_depthFlag );
     929
     930  std::vector<Int> uniqueViewIds;
     931  for( Int layer = 0; layer < m_numberOfLayers; layer++ )
     932  {   
     933    Bool isIn = false;
     934    for ( Int i = 0 ; i < uniqueViewIds.size(); i++ )
     935    {
     936      isIn = isIn || ( m_viewId[ layer ] == uniqueViewIds[ i ] );
     937    }
     938    if ( !isIn )
     939    {
     940      uniqueViewIds.push_back( m_viewId[ layer ] );
     941    }
     942  }
     943  m_iNumberOfViews = (Int) uniqueViewIds.size();
    841944#endif
    842945
     
    9141017  m_iWaveFrontSubstreams = m_iWaveFrontSynchro ? (m_iSourceHeight + m_uiMaxCUHeight - 1) / m_uiMaxCUHeight : 1;
    9151018
     1019#if J0149_TONE_MAPPING_SEI
     1020  if( m_toneMappingInfoSEIEnabled && !m_toneMapCancelFlag )
     1021  {
     1022    Char* pcStartOfCodedInterval = cfg_startOfCodedInterval.empty() ? NULL: strdup(cfg_startOfCodedInterval.c_str());
     1023    Char* pcCodedPivotValue = cfg_codedPivotValue.empty() ? NULL: strdup(cfg_codedPivotValue.c_str());
     1024    Char* pcTargetPivotValue = cfg_targetPivotValue.empty() ? NULL: strdup(cfg_targetPivotValue.c_str());
     1025    if( m_toneMapModelId == 2 && pcStartOfCodedInterval )
     1026    {
     1027      char *startOfCodedInterval;
     1028      UInt num = 1u<< m_toneMapTargetBitDepth;
     1029      m_startOfCodedInterval = new Int[num];
     1030      ::memset( m_startOfCodedInterval, 0, sizeof(Int)*num );
     1031      startOfCodedInterval = strtok(pcStartOfCodedInterval, " .");
     1032      int i = 0;
     1033      while( startOfCodedInterval && ( i < num ) )
     1034      {
     1035        m_startOfCodedInterval[i] = atoi( startOfCodedInterval );
     1036        startOfCodedInterval = strtok(NULL, " .");
     1037        i++;
     1038      }
     1039    }
     1040    else
     1041    {
     1042      m_startOfCodedInterval = NULL;
     1043    }
     1044    if( ( m_toneMapModelId == 3 ) && ( m_numPivots > 0 ) )
     1045    {
     1046      if( pcCodedPivotValue && pcTargetPivotValue )
     1047      {
     1048        char *codedPivotValue;
     1049        char *targetPivotValue;
     1050        m_codedPivotValue = new Int[m_numPivots];
     1051        m_targetPivotValue = new Int[m_numPivots];
     1052        ::memset( m_codedPivotValue, 0, sizeof(Int)*( m_numPivots ) );
     1053        ::memset( m_targetPivotValue, 0, sizeof(Int)*( m_numPivots ) );
     1054        codedPivotValue = strtok(pcCodedPivotValue, " .");
     1055        int i=0;
     1056        while(codedPivotValue&&i<m_numPivots)
     1057        {
     1058          m_codedPivotValue[i] = atoi( codedPivotValue );
     1059          codedPivotValue = strtok(NULL, " .");
     1060          i++;
     1061        }
     1062        i=0;
     1063        targetPivotValue = strtok(pcTargetPivotValue, " .");
     1064        while(targetPivotValue&&i<m_numPivots)
     1065        {
     1066          m_targetPivotValue[i]= atoi( targetPivotValue );
     1067          targetPivotValue = strtok(NULL, " .");
     1068          i++;
     1069        }
     1070      }
     1071    }
     1072    else
     1073    {
     1074      m_codedPivotValue = NULL;
     1075      m_targetPivotValue = NULL;
     1076    }
     1077  }
     1078#endif
     1079#if H_3D
     1080  // set global varibles
     1081  xSetGlobal();
     1082#if H_3D_VSO
     1083// Table base optimization
     1084  // Q&D
     1085  Double adLambdaScaleTable[] =
     1086  {  0.031250, 0.031639, 0.032029, 0.032418, 0.032808, 0.033197, 0.033586, 0.033976, 0.034365, 0.034755,
     1087     0.035144, 0.035533, 0.035923, 0.036312, 0.036702, 0.037091, 0.037480, 0.037870, 0.038259, 0.038648,
     1088     0.039038, 0.039427, 0.039817, 0.040206, 0.040595, 0.040985, 0.041374, 0.041764, 0.042153, 0.042542,
     1089     0.042932, 0.043321, 0.043711, 0.044100, 0.044194, 0.053033, 0.061872, 0.070711, 0.079550, 0.088388,
     1090     0.117851, 0.147314, 0.176777, 0.235702, 0.294628, 0.353553, 0.471405, 0.589256, 0.707107, 0.707100,
     1091     0.753550, 0.800000 
     1092  };
     1093  if ( m_bVSOLSTable )
     1094  {
     1095    Int firstDepthLayer = -1;
     1096    for (Int layer = 0; layer < m_numberOfLayers; layer++ )
     1097    {
     1098      if ( m_depthFlag[ layer ])
     1099      {
     1100        firstDepthLayer = layer;
     1101        break;
     1102      }
     1103    }
     1104    AOT( firstDepthLayer == -1 );
     1105    AOT( (m_iQP[firstDepthLayer] < 0) || (m_iQP[firstDepthLayer] > 51));
     1106    m_dLambdaScaleVSO *= adLambdaScaleTable[m_iQP[firstDepthLayer]];
     1107  }
     1108#endif
     1109#if H_3D_VSO
     1110if ( m_bUseVSO && m_uiVSOMode == 4)
     1111{
     1112  m_cRenModStrParser.setString( m_iNumberOfViews, m_pchVSOConfig );
     1113  m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     1114                                      g_bitDepthY,
     1115                                (UInt)m_iCodedCamParPrecision,
     1116                                      m_FrameSkip,
     1117                                (UInt)m_framesToBeEncoded,
     1118                                      m_pchCameraParameterFile,
     1119                                      m_pchBaseViewCameraNumbers,
     1120                                      NULL,
     1121                                      m_cRenModStrParser.getSynthViews(),
     1122                                      LOG2_DISP_PREC_LUT );
     1123}
     1124else if ( m_bUseVSO && m_uiVSOMode != 4 )
     1125{
     1126  m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     1127                                      g_bitDepthY,
     1128                                (UInt)m_iCodedCamParPrecision,
     1129                                      m_FrameSkip,
     1130                                (UInt)m_framesToBeEncoded,
     1131                                      m_pchCameraParameterFile,
     1132                                      m_pchBaseViewCameraNumbers,
     1133                                      m_pchVSOConfig,
     1134                                      NULL,
     1135                                      LOG2_DISP_PREC_LUT );
     1136}
     1137else
     1138{
     1139  m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     1140    g_bitDepthY,
     1141    (UInt) m_iCodedCamParPrecision,
     1142    m_FrameSkip,
     1143    (UInt) m_framesToBeEncoded,
     1144    m_pchCameraParameterFile,
     1145    m_pchBaseViewCameraNumbers,
     1146    NULL,
     1147    NULL,
     1148    LOG2_DISP_PREC_LUT );
     1149}
     1150#else
     1151  m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     1152    g_bitDepthY,
     1153    (UInt) m_iCodedCamParPrecision,
     1154    m_FrameSkip,
     1155    (UInt) m_framesToBeEncoded,
     1156    m_pchCameraParameterFile,
     1157    m_pchBaseViewCameraNumbers,
     1158    NULL,
     1159    NULL,
     1160    LOG2_DISP_PREC_LUT );
     1161#endif
     1162  m_cCameraData.check( false, true );
     1163#endif
    9161164  // check validity of input parameters
    9171165  xCheckParameter();
    918  
     1166
     1167#if !H_3D
    9191168  // set global varibles
    9201169  xSetGlobal();
     1170#endif
    9211171 
    9221172  // print-out parameters
     
    10131263  xConfirmPara( m_iFrameRate <= 0,                                                          "Frame rate must be more than 1" );
    10141264  xConfirmPara( m_framesToBeEncoded <= 0,                                                   "Total Number Of Frames encoded must be more than 0" );
    1015 
    10161265#if H_MV
    10171266  xConfirmPara( m_numberOfLayers > MAX_NUM_LAYER_IDS ,                                      "NumberOfLayers must be less than or equal to MAX_NUM_LAYER_IDS");
     
    10261275  xConfirmPara( m_scalabilityMask != 1 , "Scalability Mask must be equal to 1. ");
    10271276#endif
    1028   
     1277 
    10291278  m_dimIds.push_back( m_viewId );
     1279  const Int viewDimPosition = 0;
    10301280#if H_3D
    10311281  if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
     
    10371287 for( Int dim = 0; dim < m_dimIds.size(); dim++ )
    10381288 {
    1039    xConfirmPara( m_dimIds[dim].size() < m_numberOfLayers,  "DimensionId must be given for all layers and all dimensions. ");
    1040    xConfirmPara( m_dimIds[dim][0] != 0,                    "DimensionId of layer 0 must be 0 in all dimensions. " );
     1289   xConfirmPara( m_dimIds[dim].size() < m_numberOfLayers,  "DimensionId must be given for all layers and all dimensions. ");   
     1290   xConfirmPara( ( dim != viewDimPosition ) &&  (m_dimIds[dim][0] != 0), "DimensionId of layer 0 must be 0. " );
    10411291   xConfirmPara( m_dimensionIdLen[dim] < 1 || m_dimensionIdLen[dim] > 8, "DimensionIdLen must be greater than 0 and less than 9 in all dimensions. " );
    10421292   for( Int i = 1; i < m_numberOfLayers; i++ )
     
    10731323     {
    10741324       Bool inc = m_dimIds[ lastDiff ][ i ] > m_dimIds[ lastDiff ][ j ];
    1075        if ( !inc )
     1325       Bool shallBeButIsNotIncreasing = ( !inc && ( lastDiff != viewDimPosition ) ) ;
     1326       if ( shallBeButIsNotIncreasing )
    10761327       {       
    10771328         printf( "\nError: Positions of Layers %d and %d is not increasing in dimension %d \n", i, j, lastDiff);       
    10781329       }
    1079        xConfirmPara( !inc,  "DimensionIds shall be increasing within one dimension. " );
     1330       xConfirmPara( shallBeButIsNotIncreasing && ( lastDiff != viewDimPosition ),  "DimensionIds shall be increasing within one dimension. " );
    10801331     }
    10811332   }
     
    10831334
    10841335#endif
    1085 
    1086 
    10871336  xConfirmPara( m_iGOPSize < 1 ,                                                            "GOP Size must be greater or equal to 1" );
    10881337  xConfirmPara( m_iGOPSize > 1 &&  m_iGOPSize % 2,                                          "GOP Size must be a multiple of 2, if GOP Size is greater than 1" );
     
    11851434  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
    11861435
     1436#if H_3D
     1437  xConfirmPara( m_pchCameraParameterFile    == 0                ,   "CameraParameterFile must be given");
     1438  xConfirmPara( m_pchBaseViewCameraNumbers  == 0                ,   "BaseViewCameraNumbers must be given" );
     1439  xConfirmPara( ((UInt) m_numberOfLayers >> 1 ) != m_cCameraData.getBaseViewNumbers().size(),   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
     1440  xConfirmPara    ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5,       "CodedCamParsPrecision must be in range of 0..5" );
     1441#if H_3D_VSO
     1442    if( m_bUseVSO )
     1443    {
     1444      xConfirmPara(   m_pchVSOConfig            == 0                             ,   "VSO Setup string must be given");
     1445      xConfirmPara( m_uiVSOMode > 4 ,                                                "VSO Mode must be less than 5");
     1446    }
     1447#endif
     1448#endif
    11871449  // max CU width and height should be power of 2
    11881450  UInt ui = m_uiMaxCUWidth;
     
    13481610      Int*      m_numReorderPics     = m_numReorderPicsMvc    [layer]; // It is not a member, but this name helps avoiding code duplication !!!
    13491611#endif
    1350 
    13511612  /* if this is an intra-only sequence, ie IntraPeriod=1, don't verify the GOP structure
    13521613   * This permits the ability to omit a GOP structure specification */
     
    16091870  {
    16101871    m_numReorderPics[i] = 0;
     1872#if L0323_DPB
     1873    m_maxDecPicBuffering[i] = 1;
     1874#else
    16111875    m_maxDecPicBuffering[i] = 0;
     1876#endif
    16121877  }
    16131878  for(Int i=0; i<m_iGOPSize; i++)
    16141879  {
     1880#if L0323_DPB
     1881    if(m_GOPList[i].m_numRefPics+1 > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
     1882#else
    16151883    if(m_GOPList[i].m_numRefPics > m_maxDecPicBuffering[m_GOPList[i].m_temporalId])
    1616     {
     1884#endif
     1885    {
     1886#if L0323_DPB
     1887      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics + 1;
     1888#else
    16171889      m_maxDecPicBuffering[m_GOPList[i].m_temporalId] = m_GOPList[i].m_numRefPics;
     1890#endif
    16181891    }
    16191892    Int highestDecodingNumberWithLowerPOC = 0;
     
    16461919      m_numReorderPics[i+1] = m_numReorderPics[i];
    16471920    }
     1921#if L0323_DPB
     1922    // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] - 1, inclusive
     1923    if(m_numReorderPics[i] > m_maxDecPicBuffering[i] - 1)
     1924    {
     1925      m_maxDecPicBuffering[i] = m_numReorderPics[i] + 1;
     1926    }
     1927#else
    16481928    // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive
    16491929    if(m_numReorderPics[i] > m_maxDecPicBuffering[i])
     
    16511931      m_maxDecPicBuffering[i] = m_numReorderPics[i];
    16521932    }
     1933#endif
    16531934    // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer
    16541935    if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i])
     
    16571938    }
    16581939  }
     1940
     1941
     1942#if L0323_DPB
     1943  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ] -  1, inclusive
     1944  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1] - 1)
     1945  {
     1946    m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1] + 1;
     1947  }
     1948#else
    16591949  // the value of num_reorder_pics[ i ] shall be in the range of 0 to max_dec_pic_buffering[ i ], inclusive
    16601950  if(m_numReorderPics[MAX_TLAYER-1] > m_maxDecPicBuffering[MAX_TLAYER-1])
     
    16621952    m_maxDecPicBuffering[MAX_TLAYER-1] = m_numReorderPics[MAX_TLAYER-1];
    16631953  }
     1954#endif
    16641955
    16651956  if(m_vuiParametersPresentFlag && m_bitstreamRestrictionFlag)
     
    17362027    }
    17372028  }
     2029#if !L0034_COMBINED_LIST_CLEANUP
    17382030  xConfirmPara( m_bUseLComb==false && m_numReorderPics[MAX_TLAYER-1]!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" );  // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1.
     2031#endif
    17392032  xConfirmPara( m_iWaveFrontSynchro < 0, "WaveFrontSynchro cannot be negative" );
    17402033  xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
     
    17432036  xConfirmPara( m_decodedPictureHashSEIEnabled<0 || m_decodedPictureHashSEIEnabled>3, "this hash type is not correct!\n");
    17442037
     2038#if J0149_TONE_MAPPING_SEI
     2039  if (m_toneMappingInfoSEIEnabled)
     2040  {
     2041    xConfirmPara( m_toneMapCodedDataBitDepth < 8 || m_toneMapCodedDataBitDepth > 14 , "SEIToneMapCodedDataBitDepth must be in rage 8 to 14");
     2042    xConfirmPara( m_toneMapTargetBitDepth < 1 || (m_toneMapTargetBitDepth > 16 && m_toneMapTargetBitDepth < 255) , "SEIToneMapTargetBitDepth must be in rage 1 to 16 or equal to 255");
     2043    xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4");
     2044    xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0");
     2045    xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100");
     2046    xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue");
     2047    xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue");
     2048  }
     2049#endif
     2050
    17452051#if RATE_CONTROL_LAMBDA_DOMAIN
    17462052  if ( m_RCEnableRateControl )
     
    17792085  }
    17802086#endif
    1781 
    17822087#if H_MV
    17832088  }
     
    18272132  printf("Input          File          : %s\n", m_pchInputFile          );
    18282133#endif
    1829 
    18302134  printf("Bitstream      File          : %s\n", m_pchBitstreamFile      );
    1831 
    18322135#if H_MV
    18332136  for( Int layer = 0; layer < m_numberOfLayers; layer++)
     
    18382141  printf("Reconstruction File          : %s\n", m_pchReconFile          );
    18392142#endif
    1840 
    1841 #if H_MV
    1842  xPrintParaVector( "ViewId", m_viewId );
    1843 #endif
    1844 
     2143#if H_MV
     2144  xPrintParaVector( "ViewId", m_viewId );
     2145#endif
    18452146#if H_3D
    1846  xPrintParaVector( "DepthFlag", m_depthFlag );
    1847 #endif
    1848 
     2147  xPrintParaVector( "DepthFlag", m_depthFlag );
     2148  printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision);
     2149#endif
    18492150#if H_MV 
    18502151  xPrintParaVector( "QP"               , m_fQP                );
     
    18952196#endif
    18962197  printf("Max Num Merge Candidates     : %d\n", m_maxNumMergeCand);
     2198#if H_3D
     2199  printf("BaseViewCameraNumbers        : %s\n", m_pchBaseViewCameraNumbers );
     2200  printf("Coded Camera Param. Precision: %d\n", m_iCodedCamParPrecision);
     2201#if H_3D_VSO
     2202  printf("Force use of Lambda Scale    : %d\n", m_bForceLambdaScaleVSO );
     2203
     2204  if ( m_bUseVSO )
     2205  {   
     2206    printf("VSO Lambda Scale             : %5.2f\n", m_dLambdaScaleVSO );
     2207    printf("VSO Mode                     : %d\n",    m_uiVSOMode       );
     2208    printf("VSO Config                   : %s\n",    m_pchVSOConfig    );
     2209    printf("VSO Negative Distortion      : %d\n",    m_bAllowNegDist ? 1 : 0);
     2210    printf("VSO LS Table                 : %d\n",    m_bVSOLSTable ? 1 : 0);
     2211    printf("VSO Estimated VSD            : %d\n",    m_bUseEstimatedVSD ? 1 : 0);
     2212    printf("VSO Early Skip               : %d\n",    m_bVSOEarlySkip ? 1 : 0);   
     2213    if ( m_bUseWVSO )
     2214    printf("Dist. Weights (VSO/VSD/SAD)  : %d/%d/%d\n ", m_iVSOWeight, m_iVSDWeight, m_iDWeight );
     2215  }
     2216#endif //HHI_VSO
     2217#endif //H_3D
    18972218  printf("\n");
    1898  
     2219#if H_MV
     2220  printf("TOOL CFG General: ");
     2221#else
    18992222  printf("TOOL CFG: ");
     2223#endif
    19002224  printf("IBD:%d ", g_bitDepthY > m_inputBitDepthY || g_bitDepthC > m_inputBitDepthC);
    19012225  printf("HAD:%d ", m_bUseHADME           );
     
    19082232  printf("SQP:%d ", m_uiDeltaQpRD         );
    19092233  printf("ASR:%d ", m_bUseASR             );
     2234#if !L0034_COMBINED_LIST_CLEANUP
    19102235  printf("LComb:%d ", m_bUseLComb         );
     2236#endif
    19112237  printf("FEN:%d ", m_bUseFastEnc         );
    19122238  printf("ECU:%d ", m_bUseEarlyCU         );
     
    19432269  printf("TMVPMode:%d ", m_TMVPModeId     );
    19442270#if ADAPTIVE_QP_SELECTION
    1945   printf("AQpS:%d", m_bUseAdaptQpSelect   );
     2271  printf("AQpS:%d ", m_bUseAdaptQpSelect   );
    19462272#endif
    19472273
    19482274  printf(" SignBitHidingFlag:%d ", m_signHideFlag);
    1949   printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    1950   printf("\n\n");
    1951  
     2275  printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 );
     2276#if H_3D_VSO
     2277  printf("VSO:%d ", m_bUseVSO   );
     2278  printf("WVSO:%d ", m_bUseWVSO ); 
     2279#endif
     2280  printf("\n\n"); 
     2281
    19522282  fflush(stdout);
    19532283}
  • branches/HTM-DEV-0.2-dev/source/App/TAppEncoder/TAppEncCfg.h

    r438 r446  
    4343#include "TLibEncoder/TEncCfg.h"
    4444#include <sstream>
     45#if H_3D
     46#include "TAppCommon/TAppComCamPara.h"
     47#include "TLibRenderer/TRenModel.h"
     48#include "TLibRenderer/TRenModSetupStrParser.h"
     49#endif
    4550//! \ingroup TAppEncoder
    4651//! \{
     
    6065  Char*     m_pchInputFile;                                   ///< source file name
    6166#endif
    62 
    6367  Char*     m_pchBitstreamFile;                               ///< output bitstream file
    64 
    6568#if H_MV
    6669  std::vector<char*>     m_pchReconFileList;                  ///< output reconstruction file names
    6770  Int                    m_numberOfLayers;                    ///< number of Layers to Encode
     71#if H_3D
     72  Int                    m_iNumberOfViews;                    ///< number of Layers that are views
     73#endif
    6874#else
    6975  Char*     m_pchReconFile;                                   ///< output reconstruction file
    7076#endif
    71 
    72 
    73   // VPS specification
    74 #if H_MV
     77  #if H_MV
     78// VPS specification
    7579  std::vector< std::vector<Int> > m_dimIds;                   ///< dimension ids ( pointers to m_viewId and m_depthFlag
    7680  std::vector<Int>       m_viewId;                            ///< view id
     
    8387  std::vector<Int>       m_dimensionIdLen;                   ///< Length of scalability dimension s
    8488#endif
    85 
    86 
    8789  Double    m_adLambdaModifier[ MAX_TLAYER ];                 ///< Lambda modifier array for each temporal layer
    8890  // source specification
     
    103105  Level::Tier   m_levelTier;
    104106  Level::Name   m_level;
    105 
    106107#if L0046_CONSTRAINT_FLAGS
    107108  Bool m_progressiveSourceFlag;
     
    124125  GOPEntry  m_GOPList[MAX_GOP];                               ///< the coding structure entries from the config file
    125126  Int       m_numReorderPics[MAX_TLAYER];                     ///< total number of reorder pictures
     127#if L0323_DPB
     128  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of pictures in the decoded picture buffer
     129#else
    126130  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of reference pictures needed for decoding
    127131#endif
     132#endif
     133#if !L0034_COMBINED_LIST_CLEANUP
    128134  Bool      m_bUseLComb;                                      ///< flag for using combined reference list for uni-prediction in B-slices (JCTVC-D421)
     135#endif
    129136  Bool      m_useTransformSkip;                               ///< flag for enabling intra transform skipping
    130137  Bool      m_useTransformSkipFast;                           ///< flag for enabling fast intra transform skipping
     
    207214  Int       m_loopFilterTcOffsetDiv2;                       ///< tc offset for deblocking filter
    208215  Bool      m_DeblockingFilterControlPresent;                 ///< deblocking filter control present flag in PPS
     216#if L0386_DB_METRIC
     217  Bool      m_DeblockingFilterMetric;                         ///< blockiness metric in encoder
     218#endif
    209219 
    210220  // coding tools (PCM)
     
    256266  Int       m_bufferingPeriodSEIEnabled;
    257267  Int       m_pictureTimingSEIEnabled;
     268#if J0149_TONE_MAPPING_SEI
     269  Bool      m_toneMappingInfoSEIEnabled;
     270  Int       m_toneMapId;
     271  Bool      m_toneMapCancelFlag;
     272  Bool      m_toneMapPersistenceFlag;
     273  Int       m_toneMapCodedDataBitDepth;
     274  Int       m_toneMapTargetBitDepth;
     275  Int       m_toneMapModelId;
     276  Int       m_toneMapMinValue;
     277  Int       m_toneMapMaxValue;
     278  Int       m_sigmoidMidpoint;
     279  Int       m_sigmoidWidth;
     280  Int       m_numPivots;
     281  Int       m_cameraIsoSpeedIdc;
     282  Int       m_cameraIsoSpeedValue;
     283  Int       m_exposureCompensationValueSignFlag;
     284  Int       m_exposureCompensationValueNumerator;
     285  Int       m_exposureCompensationValueDenomIdc;
     286  Int       m_refScreenLuminanceWhite;
     287  Int       m_extendedRangeWhiteLevel;
     288  Int       m_nominalBlackLevelLumaCodeValue;
     289  Int       m_nominalWhiteLevelLumaCodeValue;
     290  Int       m_extendedWhiteLevelLumaCodeValue;
     291  Int*      m_startOfCodedInterval;
     292  Int*      m_codedPivotValue;
     293  Int*      m_targetPivotValue;
     294#endif
    258295  Int       m_framePackingSEIEnabled;
    259296  Int       m_framePackingSEIType;
     
    265302  Int       m_gradualDecodingRefreshInfoEnabled;
    266303  Int       m_decodingUnitInfoSEIEnabled;
     304#if L0208_SOP_DESCRIPTION_SEI
     305  Int       m_SOPDescriptionSEIEnabled;
     306#endif
     307#if K0180_SCALABLE_NESTING_SEI
     308  Int       m_scalableNestingSEIEnabled;
     309#endif
    267310  // weighted prediction
    268311  Bool      m_useWeightedPred;                    ///< Use of weighted prediction in P slices
     
    332375  Int       m_log2MaxMvLengthVertical;                        ///< Indicate the maximum absolute value of a decoded vertical MV component in quarter-pel luma units
    333376
     377#if H_3D
     378  // Camera parameters
     379  Char*     m_pchCameraParameterFile;                         ///< camera parameter file
     380  Char*     m_pchBaseViewCameraNumbers;
     381  TAppComCamPara m_cCameraData;
     382  Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
     383#if H_3D_VSO
     384  Char*     m_pchVSOConfig;
     385  Bool      m_bUseVSO;                                    ///< flag for using View Synthesis Optimization
     386  Bool      m_bVSOLSTable;                                ///< Depth QP dependent Lagrange parameter optimization (m23714)
     387  Bool      m_bVSOEarlySkip;                              ///< Early skip of VSO computation (JCT3V-A0093 modification 4)
     388
     389  //// Used for development by GT, might be removed later
     390  Double    m_dLambdaScaleVSO;                            ///< Scaling factor for Lambda in VSO mode
     391  Bool      m_bForceLambdaScaleVSO;                       ///< Use Lambda Scale for depth even if VSO is turned off
     392  Bool      m_bAllowNegDist;                              ///< Allow negative distortion in VSO
     393  UInt      m_uiVSOMode;                                  ///< Number of VSO Mode, 1 = , 2 = simple, org vs. ren, 3 = simple, ren vs. ren, 4 = full 
     394
     395  // SAIT_VSO_EST_A0033
     396  Bool      m_bUseEstimatedVSD;                           ///< Flag for using model based VSD estimation instead of VSO for some encoder decisions (JCT3V-A0033 modification 3) 
     397
     398  // LGE_WVSO_A0119
     399  Bool      m_bUseWVSO;                                    ///< flag for using View Synthesis Optimization 
     400  Int       m_iVSOWeight;
     401  Int       m_iVSDWeight;
     402  Int       m_iDWeight;
     403
     404  // Ren Model String
     405  TRenModSetupStrParser       m_cRenModStrParser;
     406#endif
     407#endif
    334408  // internal member functions
    335409  Void  xSetGlobal      ();                                   ///< set global variables
     
    337411  Void  xPrintParameter ();                                   ///< print configuration values
    338412  Void  xPrintUsage     ();                                   ///< print usage
    339 
    340413#if H_MV
    341414  template <typename T>
     
    388461  Int*      m_constantPicRateIdc;                                ///< Indicates constant picture rate idc for various sub-layers
    389462#endif
    390  
    391463#if H_MV
    392464  Int   getGOPSize() { return m_iGOPSize; }
  • branches/HTM-DEV-0.2-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r438 r446  
    7070Void TAppEncTop::xInitLibCfg()
    7171{
     72#if H_MV
     73  TComVPS& vps = m_vps;   
     74#else
    7275  TComVPS vps;
     76#endif
    7377 
    7478#if H_MV
     
    111115  }
    112116#endif
    113 
    114117#if H_MV
    115118  xSetLayerIds             ( vps );   
    116119  xSetDimensionIdAndLength ( vps );
    117120  xSetDirectDependencyFlags( vps );
     121#if H_3D
     122  vps.initViewIndex();
     123  m_ivPicLists.setVPS      ( &vps );
     124#endif
    118125
    119126  for(Int layer = 0; layer < m_numberOfLayers; layer++)
     
    128135    TEncTop& m_cTEncTop = *m_acTEncTopList[ layer ];  // It is not a member, but this name helps avoiding code duplication !!!
    129136   
    130     m_cTEncTop.setLayerIdInVps( layer );
    131     m_cTEncTop.setLayerId     ( vps.getLayerIdInNuh( layer ) );   
    132     m_cTEncTop.setViewId      ( vps.getViewId      ( layer ) );
     137    m_cTEncTop.setLayerIdInVps                 ( layer );
     138    m_cTEncTop.setLayerId                      ( vps.getLayerIdInNuh( layer ) );   
     139    m_cTEncTop.setViewId                       ( vps.getViewId      ( layer ) );
    133140#if H_3D
    134     m_cTEncTop.setIsDepth     ( vps.getDepthId     ( layer ) != 0 );
    135 #endif
    136     m_cTEncTop.setIvPicLists  ( &m_ivPicLists );
    137 #endif
    138 
     141    Bool isDepth = ( vps.getDepthId     ( layer ) != 0 ) ;
     142    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   ( layer ) );
     143    m_cTEncTop.setIsDepth                      ( isDepth );
     144    //====== Camera Parameters =========
     145    m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
     146    m_cTEncTop.setCamParPrecision              ( isDepth ? false : m_cCameraData.getCamParsCodedPrecision  () );
     147    m_cTEncTop.setCamParInSliceHeader          ( isDepth ? 0     : m_cCameraData.getVaryingCameraParameters() );
     148    m_cTEncTop.setCodedScale                   ( isDepth ? 0     : m_cCameraData.getCodedScale             () );
     149    m_cTEncTop.setCodedOffset                  ( isDepth ? 0     : m_cCameraData.getCodedOffset            () );
     150#if H_3D_VSO
     151    //====== VSO =========
     152    m_cTEncTop.setRenderModelParameters        ( &m_cRenModStrParser );
     153    m_cTEncTop.setForceLambdaScaleVSO          ( isDepth ? m_bForceLambdaScaleVSO : false );
     154    m_cTEncTop.setLambdaScaleVSO               ( isDepth ? m_dLambdaScaleVSO      : 1     );
     155    m_cTEncTop.setVSOMode                      ( isDepth ? m_uiVSOMode            : 0     );
     156
     157    m_cTEncTop.setAllowNegDist                 ( isDepth ? m_bAllowNegDist        : false );
     158
     159    // SAIT_VSO_EST_A0033
     160    m_cTEncTop.setUseEstimatedVSD              ( isDepth ? m_bUseEstimatedVSD     : false );
     161
     162    // LGE_WVSO_A0119
     163    m_cTEncTop.setUseWVSO                      ( isDepth ? m_bUseWVSO             : false );   
     164    m_cTEncTop.setVSOWeight                    ( isDepth ? m_iVSOWeight           : 0     );
     165    m_cTEncTop.setVSDWeight                    ( isDepth ? m_iVSDWeight           : 0     );
     166    m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
     167#endif // H_3D_VSO
     168#endif // H_3D
     169
     170    m_cTEncTop.setIvPicLists                   ( &m_ivPicLists );
     171#endif // H_MV
    139172  m_cTEncTop.setVPS(&vps);
    140173
    141174  m_cTEncTop.setProfile(m_profile);
    142175  m_cTEncTop.setLevel(m_levelTier, m_level);
    143 
    144176#if L0046_CONSTRAINT_FLAGS
    145177  m_cTEncTop.setProgressiveSourceFlag(m_progressiveSourceFlag);
     
    186218  m_cTEncTop.setQP                           ( m_iQP );
    187219#endif
     220
    188221  m_cTEncTop.setPad                          ( m_aiPad );
    189    
     222
    190223#if H_MV
    191224  m_cTEncTop.setMaxTempLayer                 ( m_maxTempLayerMvc[layer] );
     
    207240  m_cTEncTop.setLoopFilterTcOffset           ( m_loopFilterTcOffsetDiv2    );
    208241  m_cTEncTop.setDeblockingFilterControlPresent( m_DeblockingFilterControlPresent);
     242#if L0386_DB_METRIC
     243  m_cTEncTop.setDeblockingFilterMetric       ( m_DeblockingFilterMetric );
     244#endif
    209245
    210246  //====== Motion search ========
     
    226262  Int lowestQP;
    227263  lowestQP =  - 6*(g_bitDepthY - 8); // XXX: check
     264
    228265#if H_MV
    229266  if ((m_iMaxDeltaQP == 0 ) && (m_iQP[layer] == lowestQP) && (m_useLossless == true))
     
    243280  m_cTEncTop.setUseHADME                     ( m_bUseHADME    );
    244281  m_cTEncTop.setUseLossless                  ( m_useLossless );
     282#if !L0034_COMBINED_LIST_CLEANUP
    245283  m_cTEncTop.setUseLComb                     ( m_bUseLComb    );
     284#endif
    246285#if H_MV
    247286  m_cTEncTop.setdQPs                         ( m_aidQP[layer]   );
     
    321360  m_cTEncTop.setBufferingPeriodSEIEnabled( m_bufferingPeriodSEIEnabled );
    322361  m_cTEncTop.setPictureTimingSEIEnabled( m_pictureTimingSEIEnabled );
     362#if J0149_TONE_MAPPING_SEI
     363  m_cTEncTop.setToneMappingInfoSEIEnabled                 ( m_toneMappingInfoSEIEnabled );
     364  m_cTEncTop.setTMISEIToneMapId                           ( m_toneMapId );
     365  m_cTEncTop.setTMISEIToneMapCancelFlag                   ( m_toneMapCancelFlag );
     366  m_cTEncTop.setTMISEIToneMapPersistenceFlag              ( m_toneMapPersistenceFlag );
     367  m_cTEncTop.setTMISEICodedDataBitDepth                   ( m_toneMapCodedDataBitDepth );
     368  m_cTEncTop.setTMISEITargetBitDepth                      ( m_toneMapTargetBitDepth );
     369  m_cTEncTop.setTMISEIModelID                             ( m_toneMapModelId );
     370  m_cTEncTop.setTMISEIMinValue                            ( m_toneMapMinValue );
     371  m_cTEncTop.setTMISEIMaxValue                            ( m_toneMapMaxValue );
     372  m_cTEncTop.setTMISEISigmoidMidpoint                     ( m_sigmoidMidpoint );
     373  m_cTEncTop.setTMISEISigmoidWidth                        ( m_sigmoidWidth );
     374  m_cTEncTop.setTMISEIStartOfCodedInterva                 ( m_startOfCodedInterval );
     375  m_cTEncTop.setTMISEINumPivots                           ( m_numPivots );
     376  m_cTEncTop.setTMISEICodedPivotValue                     ( m_codedPivotValue );
     377  m_cTEncTop.setTMISEITargetPivotValue                    ( m_targetPivotValue );
     378  m_cTEncTop.setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
     379  m_cTEncTop.setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
     380  m_cTEncTop.setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
     381  m_cTEncTop.setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
     382  m_cTEncTop.setTMISEIExposureCompensationValueDenomIdc   ( m_exposureCompensationValueDenomIdc );
     383  m_cTEncTop.setTMISEIRefScreenLuminanceWhite             ( m_refScreenLuminanceWhite );
     384  m_cTEncTop.setTMISEIExtendedRangeWhiteLevel             ( m_extendedRangeWhiteLevel );
     385  m_cTEncTop.setTMISEINominalBlackLevelLumaCodeValue      ( m_nominalBlackLevelLumaCodeValue );
     386  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
     387  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
     388#endif
    323389  m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    324390  m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
     
    330396  m_cTEncTop.setGradualDecodingRefreshInfoEnabled( m_gradualDecodingRefreshInfoEnabled );
    331397  m_cTEncTop.setDecodingUnitInfoSEIEnabled( m_decodingUnitInfoSEIEnabled );
     398#if L0208_SOP_DESCRIPTION_SEI
     399  m_cTEncTop.setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
     400#endif
     401#if K0180_SCALABLE_NESTING_SEI
     402  m_cTEncTop.setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
     403#endif
    332404  m_cTEncTop.setUniformSpacingIdr          ( m_iUniformSpacingIdr );
    333405  m_cTEncTop.setNumColumnsMinus1           ( m_iNumColumnsMinus1 );
     
    424496  }
    425497#endif
    426 
    427 #if H_MV
    428   }
    429 #endif
    430 
     498#if H_MV
     499  }
     500#endif
     501#if H_3D_VSO
     502  if ( m_bUseVSO )
     503  {
     504    if ( m_uiVSOMode == 4 )
     505    {
     506#if H_3D_VSO_EARLY_SKIP
     507      m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );
     508#else
     509      m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, g_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );
     510#endif
     511      for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )
     512      {
     513        TEncTop* pcEncTop =  m_acTEncTopList[ layer ];
     514        Int iViewNum      = pcEncTop->getViewIndex();
     515        Int iContent      = pcEncTop->getIsDepth() ? 1 : 0;
     516        Int iNumOfModels  = m_cRenModStrParser.getNumOfModelsForView(iViewNum, iContent);
     517
     518        Bool bUseVSO      = (iNumOfModels != 0);
     519
     520        pcEncTop->setUseVSO( bUseVSO );
     521        pcEncTop->getRdCost()->setRenModel( bUseVSO ? &m_cRendererModel : NULL );
     522
     523        for (Int iCurModel = 0; iCurModel < iNumOfModels; iCurModel++ )
     524        {
     525          Int iModelNum; Int iLeftViewNum; Int iRightViewNum; Int iDump; Int iOrgRefNum; Int iBlendMode;
     526
     527          m_cRenModStrParser.getSingleModelData  ( iViewNum, iContent, iCurModel, iModelNum, iBlendMode, iLeftViewNum, iRightViewNum, iOrgRefNum, iDump ) ;
     528          m_cRendererModel  .createSingleModel   ( iViewNum, iContent, iModelNum, iLeftViewNum, iRightViewNum, (iOrgRefNum != -1), iBlendMode );
     529        }           
     530      }
     531    }
     532    else
     533    {
     534      AOT(true);
     535    }
     536  }
     537#endif
    431538}
    432539
     
    579686
    580687        eos[layer] = (m_frameRcvd[layer] == m_framesToBeEncoded);
    581         allEos = allEos|eos[layer];
     688        allEos = allEos||eos[layer];
    582689
    583690        // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures
     
    585692        {
    586693          flush          [layer] = true;
    587           eos            [layer]   = true;
     694          eos            [layer] = true;
    588695          m_frameRcvd    [layer]--;
    589696          m_acTEncTopList[layer]->setFramesToBeEncoded(m_frameRcvd[layer]);
     
    593700    for ( Int gopId=0; gopId < gopSize; gopId++ )
    594701    {
     702#if H_3D
     703      UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
     704      if ( iNextPoc < m_framesToBeEncoded )
     705      {
     706        m_cCameraData.update( iNextPoc );
     707      }
     708#endif
    595709      for(Int layer=0; layer < m_numberOfLayers; layer++ )
    596710      {
     711#if H_3D_VSO       
     712          if( m_bUseVSO && m_bUseEstimatedVSD && iNextPoc < m_framesToBeEncoded )
     713          {
     714            m_cCameraData.setDispCoeff( iNextPoc, m_acTEncTopList[layer]->getViewIndex() );
     715            m_acTEncTopList[layer]  ->setDispCoeff( m_cCameraData.getDispCoeff() );
     716          }
     717#endif
    597718        Int   iNumEncoded = 0;
    598719
     
    602723        outputAccessUnits.clear();
    603724      }
    604 
    605725    }
    606726    gopSize = maxGopSize;
     
    666786  return;
    667787}
    668 
    669 #if H_3D
    670 TEncTop* TAppEncTop::getTEncTopView( Int viewId, Bool isDepth )
    671 {
    672   TEncTop* encoder = NULL;
    673   for( Int layer = 0; layer < m_acTEncTopList.size(); layer++ )
    674   {
    675     if( m_acTEncTopList[layer]->getViewId()  == viewId &&
    676         m_acTEncTopList[layer]->getIsDepth() == isDepth )
    677     {
    678       encoder = m_acTEncTopList[layer];
    679       break;
    680     }
    681   }
    682   return encoder;
    683 }
    684 #endif
    685788
    686789// ====================================================================================================================
     
    694797 .
    695798 */
    696 
    697799#if H_MV
    698800Void TAppEncTop::xGetBuffer( TComPicYuv*& rpcPicYuvRec, UInt layer)
     
    722824
    723825  }
    724 
    725826#if H_MV
    726827  m_picYuvRec[layer]->pushBack( rpcPicYuvRec );
     
    732833Void TAppEncTop::xDeleteBuffer( )
    733834{
    734 
    735835#if H_MV
    736836  for(Int layer=0; layer<m_picYuvRec.size(); layer++)
     
    757857  }
    758858#endif 
    759 
    760859}
    761860
     
    787886  {
    788887    TComPicYuv*  pcPicYuvRec  = *(iterPicYuvRec++);
    789 
    790888#if H_MV
    791889      if (m_pchReconFileList[layerId])
     
    815913  }
    816914#endif
    817 
    818915}
    819916
     
    832929    case NAL_UNIT_CODED_SLICE_TRAIL_R:
    833930    case NAL_UNIT_CODED_SLICE_TRAIL_N:
    834     case NAL_UNIT_CODED_SLICE_TLA:
     931    case NAL_UNIT_CODED_SLICE_TLA_R:
    835932    case NAL_UNIT_CODED_SLICE_TSA_N:
    836933    case NAL_UNIT_CODED_SLICE_STSA_R:
    837934    case NAL_UNIT_CODED_SLICE_STSA_N:
    838     case NAL_UNIT_CODED_SLICE_BLA:
    839     case NAL_UNIT_CODED_SLICE_BLANT:
     935    case NAL_UNIT_CODED_SLICE_BLA_W_LP:
     936    case NAL_UNIT_CODED_SLICE_BLA_W_RADL:
    840937    case NAL_UNIT_CODED_SLICE_BLA_N_LP:
    841     case NAL_UNIT_CODED_SLICE_IDR:
     938    case NAL_UNIT_CODED_SLICE_IDR_W_RADL:
    842939    case NAL_UNIT_CODED_SLICE_IDR_N_LP:
    843940    case NAL_UNIT_CODED_SLICE_CRA:
    844941    case NAL_UNIT_CODED_SLICE_RADL_N:
    845     case NAL_UNIT_CODED_SLICE_DLP:
     942    case NAL_UNIT_CODED_SLICE_RADL_R:
    846943    case NAL_UNIT_CODED_SLICE_RASL_N:
    847     case NAL_UNIT_CODED_SLICE_TFD:
     944    case NAL_UNIT_CODED_SLICE_RASL_R:
    848945    case NAL_UNIT_VPS:
    849946    case NAL_UNIT_SPS:
     
    861958void TAppEncTop::printRateSummary()
    862959{
    863 
    864960#if H_MV
    865961  Double time = (Double) m_frameRcvd[0] / m_iFrameRate;
     
    868964  Double time = (Double) m_iFrameRcvd / m_iFrameRate;
    869965#endif
    870 
    871966  printf("Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time);
    872967#if VERBOSE_RATE
     
    881976  for( Int dim = 0; dim < m_dimIds.size(); dim++ )
    882977  {
    883       vps.setDimensionIdLen( dim, m_dimensionIdLen[ dim ] );
    884       for( Int layer = 1; layer < vps.getMaxLayers(); layer++ )
    885       {       
    886         vps.setDimensionId( layer, dim, m_dimIds[ dim ][ layer ] );       
    887      
     978    vps.setDimensionIdLen( dim, m_dimensionIdLen[ dim ] );
     979    for( Int layer = 0; layer < vps.getMaxLayers(); layer++ )
     980    {       
     981      vps.setDimensionId( layer, dim, m_dimIds[ dim ][ layer ] );       
     982   
    888983  }
    889984}
     
    9371032}
    9381033#endif
    939 
    9401034//! \}
  • branches/HTM-DEV-0.2-dev/source/App/TAppEncoder/TAppEncTop.h

    r438 r446  
    4646#include "TLibCommon/AccessUnit.h"
    4747#include "TAppEncCfg.h"
     48#if H_3D
     49#include "../../Lib/TLibRenderer/TRenTop.h"
     50#endif
    4851
    4952//! \ingroup TAppEncoder
     
    5962private:
    6063  // class interface
    61 
    6264#if H_MV
    6365  std::vector<TEncTop*>      m_acTEncTopList ;              ///< encoder class per layer
     
    7072
    7173  TComPicLists               m_ivPicLists;                  ///< picture buffers of encoder instances
     74  TComVPS                    m_vps;                         ///< vps
    7275#else
    7376  TEncTop                    m_cTEncTop;                    ///< encoder class
     
    8285  UInt m_essentialBytes;
    8386  UInt m_totalBytes;
     87#if H_3D_VSO
     88  TRenTop                     m_cRendererTop;
     89  TRenModel                   m_cRendererModel;   
     90#endif
    8491protected:
    8592  // initialization
     
    9198  /// obtain required buffers
    9299#if H_MV
    93   Void xGetBuffer(TComPicYuv*& rpcPicYuvRec, UInt layer);
     100  Void  xGetBuffer(TComPicYuv*& rpcPicYuvRec, UInt layer);
    94101#else
    95102  Void xGetBuffer(TComPicYuv*& rpcPicYuvRec);
     
    100107 
    101108  // file I/O
    102 
    103109#if H_MV
    104110  Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, UInt layerId); ///< write bitstream to file
     
    106112  Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, const std::list<AccessUnit>& accessUnits); ///< write bitstream to file
    107113#endif
    108 
    109114  void rateStatsAccum(const AccessUnit& au, const std::vector<UInt>& stats);
    110115  void printRateSummary();
     
    116121  Int  xGetMax( std::vector<Int>& vec);
    117122#endif
    118 
    119123public:
    120124  TAppEncTop();
     
    122126 
    123127  Void        encode      ();                               ///< main encoding function
    124 
    125128#if H_MV
    126   TEncTop*    getTEncTopLayer(UInt layer) { return  m_acTEncTopList[layer]; }  ///< return pointer to encoder class for specific layer
    127 #if H_3D
    128   TEncTop*    getTEncTopView( Int viewId, Bool isDepth );                      ///< return pointer to encoder class for specific view Id and texture or depth
    129 #endif
     129  TEncTop*    getTEncTop( UInt layer ) { return  m_acTEncTopList[layer]; }  ///< return pointer to encoder class for specific layer
    130130#else
    131131  TEncTop&    getTEncTop  ()   { return  m_cTEncTop; }      ///< return encoder class pointer reference
    132132#endif
    133 
    134133};// END CLASS DEFINITION TAppEncTop
    135134
  • branches/HTM-DEV-0.2-dev/source/App/TAppEncoder/encmain.cpp

    r438 r446  
    6262  fprintf( stdout, "HM software: Encoder Version [%s]", NV_VERSION );
    6363#endif
    64 
    6564  fprintf( stdout, NVM_ONOS );
    6665  fprintf( stdout, NVM_COMPILEDBY );
  • branches/HTM-DEV-0.2-dev/source/App/TAppExtractor/TAppExtrTop.cpp

    r438 r446  
    1 /* The copyright in this software is being made available under the BSD
    2  * License, included below. This software may be subject to other third party
    3  * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
    5  *
    6  * Copyright (c) 2010-2011, ISO/IEC
    7  * All rights reserved.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
    10  * modification, are permitted provided that the following conditions are met:
    11  *
    12  *  * Redistributions of source code must retain the above copyright notice,
    13  *    this list of conditions and the following disclaimer.
    14  *  * Redistributions in binary form must reproduce the above copyright notice,
    15  *    this list of conditions and the following disclaimer in the documentation
    16  *    and/or other materials provided with the distribution.
    17  *  * Neither the name of the ISO/IEC nor the names of its contributors may
    18  *    be used to endorse or promote products derived from this software without
    19  *    specific prior written permission.
    20  *
    21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
    25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
    31  * THE POSSIBILITY OF SUCH DAMAGE.
    32  */
    33 
    34 /** \file     TAppExtrTop.cpp
    35     \brief    Extractor application class
    36 */
    37 
     1///* The copyright in this software is being made available under the BSD
     2// * License, included below. This software may be subject to other third party
     3// * and contributor rights, including patent rights, and no such rights are
     4// * granted under this license. 
     5// *
     6// * Copyright (c) 2010-2011, ISO/IEC
     7// * All rights reserved.
     8// *
     9// * Redistribution and use in source and binary forms, with or without
     10// * modification, are permitted provided that the following conditions are met:
     11// *
     12// *  * Redistributions of source code must retain the above copyright notice,
     13// *    this list of conditions and the following disclaimer.
     14// *  * Redistributions in binary form must reproduce the above copyright notice,
     15// *    this list of conditions and the following disclaimer in the documentation
     16// *    and/or other materials provided with the distribution.
     17// *  * Neither the name of the ISO/IEC nor the names of its contributors may
     18// *    be used to endorse or promote products derived from this software without
     19// *    specific prior written permission.
     20// *
     21// * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     22// * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23// * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24// * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
     25// * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     26// * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     27// * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     28// * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     29// * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30// * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     31// * THE POSSIBILITY OF SUCH DAMAGE.
     32// */
     33//
     34///** \file     TAppExtrTop.cpp
     35//    \brief    Extractor application class
    3836#include "TAppExtrTop.h"
    3937#include "../../Lib/TLibDecoder/AnnexBread.h"
     
    4442#include <assert.h>
    4543
     44#if H_MV
    4645// ====================================================================================================================
    4746// Constructor / destructor / initialization / destroy
     
    5049TAppExtrTop::TAppExtrTop()
    5150{
     51  // To suppress compiler warnings on potential division by 0.
     52  g_uiMaxCUWidth  = 1;
     53  g_uiMaxCUHeight = 1;
    5254}
    5355
     
    6062// ====================================================================================================================
    6163
    62 /**
    63  - until the end of the bitstream, call extraction function in TExtrTop class
    64  */
     64//
     65//until the end of the bitstream, call extraction function in TExtrTop class
     66//
     67
    6568Void TAppExtrTop::extract()
    6669{
     
    128131  outputBitstreamFile.close();
    129132
     133
    130134  // write SPS info file
    131135  if ( m_pchSpsInfoFile )
     
    143147    cSpsInfoFileHandle.close();
    144148  }
     149
     150  m_cTExtrTop.dumpVpsInfo( std::cout );
    145151  m_cTExtrTop.dumpSpsInfo( std::cout );
     152
    146153}
     154#endif
  • branches/HTM-DEV-0.2-dev/source/App/TAppExtractor/TAppExtrTop.h

    r438 r446  
    4646#include "TAppExtrCfg.h"
    4747
     48#if H_MV
    4849// ====================================================================================================================
    4950// Class definition
     
    6667#endif
    6768
     69#endif
  • branches/HTM-DEV-0.2-dev/source/App/TAppExtractor/extrmain.cpp

    r438 r446  
    4141#include "TAppExtrTop.h"
    4242
     43#if H_MV
    4344// ====================================================================================================================
    4445// Main function
     
    6869
    6970  // call extraction function
    70   cTAppExtrTop.extract();
     71//  cTAppExtrTop.extract();
    7172
    7273  // ending time
     
    7677  return EXIT_SUCCESS;
    7778}
     79#else
    7880
     81#include <iostream>
     82int main(int argc, char* argv[])
     83{
     84  std::cout << "Set H_MV equal to 1 in TypeDef.h to build bitstream extractor. " << std::endl;
     85  return 1;
     86}
    7987
     88#endif
     89
  • branches/HTM-DEV-0.2-dev/source/App/TAppRenderer/RendererMain.cpp

    r438 r446  
    3333
    3434
    35 
    3635#include <time.h>
     36#include "../../Lib/TLibCommon/TypeDef.h"
     37#if H_3D
    3738#include "TAppRendererTop.h"
    38 
    3939// ====================================================================================================================
    4040// Main function
     
    4343int main(int argc, char* argv[])
    4444  {
    45 #if !QC_MVHEVC_B0046
     45
    4646  TAppRendererTop  cTAppRendererTop;
    4747
     
    7979
    8080  return 0;
    81 #endif
     81}
     82#else
     83
     84#include <iostream>
     85int main(int argc, char* argv[])
     86{
     87  std::cout << "Set H_3D equal to 1 in TypeDef.h to build renderer. " << std::endl;
     88  return 1;
    8289}
    8390
     91#endif // H_3D
    8492
  • branches/HTM-DEV-0.2-dev/source/App/TAppRenderer/TAppRendererCfg.cpp

    r438 r446  
    3434
    3535
     36
    3637#include <stdlib.h>
    3738#include <math.h>
     
    4041#include <string>
    4142
    42 
    43 
    4443#include "TAppRendererCfg.h"
    4544#include "../../Lib/TAppCommon/program_options_lite.h"
    4645
     46#if H_3D
    4747
    4848using namespace std;
     
    5959// Constructor / destructor / initialization / destroy
    6060// ====================================================================================================================
    61 #if !QC_MVHEVC_B0046
     61
     62
    6263TAppRendererCfg::TAppRendererCfg()
    6364{
    64 
     65 
    6566}
    6667
     
    129130    ("DepthInputFile_%d,d_%d",  m_pchDepthInputFileList ,    (Char *) 0, MAX_INPUT_VIEW_NUM , "Original Yuv depth input file name %d")
    130131    ("SynthOutputFile_%d,s_%d", m_pchSynthOutputFileList,    (Char *) 0, MAX_OUTPUT_VIEW_NUM, "Synthesized Yuv output file name %d")
     132
     133    ("InputBitDepth",           m_inputBitDepthY,                     8, "Bit-depth of input file")
     134    ("OutputBitDepth",          m_outputBitDepthY,                    0, "Bit-depth of output file (default:InternalBitDepth)")
     135    ("InternalBitDepth",        m_internalBitDepthY,                  0, "Bit-depth the renderer operates at. (default:InputBitDepth)"                                                                          "If different to InputBitDepth, source data will be converted")
     136
     137    ("InputBitDepthC",        m_inputBitDepthC,    0, "As per InputBitDepth but for chroma component. (default:InputBitDepth)")
     138    ("OutputBitDepthC",       m_outputBitDepthC,   0, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
     139    ("InternalBitDepthC",     m_internalBitDepthC, 0, "As per InternalBitDepth but for chroma component. (default:IntrenalBitDepth)")
    131140
    132141    /* Source Specification */
     
    176185  */
    177186
     187  /* rules for input, output and internal bitdepths as per help text */
     188  if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
     189  if (!m_internalBitDepthC) { m_internalBitDepthC = m_internalBitDepthY; }
     190  if (!m_inputBitDepthC)    { m_inputBitDepthC    = m_inputBitDepthY; }
     191  if (!m_outputBitDepthY)   { m_outputBitDepthY   = m_internalBitDepthY; }
     192  if (!m_outputBitDepthC)   { m_outputBitDepthC   = m_internalBitDepthC; }
     193
    178194  xSetGlobal();
    179195
     
    258274  xConfirmPara( m_iFramesToBeRendered <  0,                   "Total Number Of Frames rendered must be more than 1" );
    259275
     276  // bit depth
     277  xConfirmPara( m_internalBitDepthC != m_internalBitDepthY,  "InternalBitDepth for luma and chroma must be equal. ");
     278  xConfirmPara( m_inputBitDepthY < 8,                        "InputBitDepth must be at least 8" );
     279  xConfirmPara( m_inputBitDepthC < 8,                        "InputBitDepthC must be at least 8" );
    260280
    261281  // camera specification
     
    500520    iCurPrec = 0;
    501521    for ( Int iCur = 1;  aiIn[uiK] % iCur == 0; iCur *= 10, iCurPrec++);
    502     iCurPrec = LOG10_VIEW_NUM_PREC - Min(LOG10_VIEW_NUM_PREC, iCurPrec-1 );
     522    iCurPrec = LOG10_VIEW_NUM_PREC - std::min((Int) LOG10_VIEW_NUM_PREC, iCurPrec-1 );
    503523    iPrecAfter = max(iPrecAfter, iCurPrec );
    504524  }
     
    507527Void TAppRendererCfg::xSetGlobal()
    508528{
    509   // set max CU width & height
    510   Int iInternalBitDepth = 8;
     529  // set max CU width & height 
    511530  g_uiMaxCUWidth   = 0;
    512   g_uiMaxCUHeight  = 0;
    513   g_uiBitDepth     = 8;
    514   g_uiBitIncrement = iInternalBitDepth - g_uiBitDepth;
    515   g_uiBASE_MAX     = ((1<<(g_uiBitDepth))-1);
    516   g_uiIBDI_MAX     = ((1<<(g_uiBitDepth+g_uiBitIncrement))-1);
    517 }
     531  g_uiMaxCUHeight  = 0; 
     532}
     533
    518534#endif
  • branches/HTM-DEV-0.2-dev/source/App/TAppRenderer/TAppRendererCfg.h

    r438 r446  
    3232 */
    3333
    34 
     34#ifndef __TAppRENDERERCFG__
     35#define __TAppRENDERERCFG__
    3536
    3637#include <list>
     
    3839#include <fcntl.h>
    3940#include <assert.h>
    40 
    41 
    42 
    43 #ifndef __TAppRENDERERCFG__
    44 #define __TAppRENDERERCFG__
    4541
    4642#include "../../Lib/TAppCommon/TAppComCamPara.h"
     
    5046#include <string>
    5147#include <vector>
    52 #if !QC_MVHEVC_B0046
     48
     49#if H_3D
     50
    5351// ====================================================================================================================
    5452// Class definition
     
    6664  Bool               m_bContOutputFileNumbering;       ///< use continous numbering instead of view numbering
    6765  Bool               m_bSweep;                         ///< 1: Store view range in file
     66
     67
     68  // bit-depth      ( Currently interal luma and chroma bit-depth are required to be equal. )
     69  Int                m_inputBitDepthY;                 ///< bit-depth of input file (luma component)
     70  Int                m_inputBitDepthC;                 ///< bit-depth of input file (chroma component)
     71  Int                m_outputBitDepthY;                ///< bit-depth of output file (luma component)
     72  Int                m_outputBitDepthC;                ///< bit-depth of output file (chroma component)
     73  Int                m_internalBitDepthY;              ///< bit-depth renderer operates at in luma (input/output files will be converted)
     74  Int                m_internalBitDepthC;              ///< bit-depth renderer operates at in chroma (input/output files will be converted)
     75
    6876
    6977  // derived
     
    133141};// END CLASS DEFINITION TAppRendererCfg
    134142
    135 
    136 #endif
    137143#endif // __TAppRENDERERCFG__
    138 
     144#endif // H_3D
  • branches/HTM-DEV-0.2-dev/source/App/TAppRenderer/TAppRendererTop.cpp

    r438 r446  
    3333
    3434
    35 
    3635#include <list>
    3736#include <stdio.h>
     
    4241#include "TAppRendererTop.h"
    4342
     43#if H_3D
     44
    4445// ====================================================================================================================
    4546// Constructor / destructor / initialization / destroy
    4647// ====================================================================================================================
    47 #if !QC_MVHEVC_B0046
     48
    4849TAppRendererTop::TAppRendererTop()
    4950{
     
    5960Void TAppRendererTop::xCreateLib()
    6061{
    61   Int iInteralBitDepth = g_uiBitDepth + g_uiBitIncrement;
    62   Int iFileBitDepth    = 8;
    6362  m_pcRenTop = new TRenTop();
    6463
     
    6867    TVideoIOYuv* pcDepthInput = new TVideoIOYuv;
    6968
    70     pcVideoInput->open( m_pchVideoInputFileList[iViewIdx], false, iFileBitDepth, iInteralBitDepth );  // read mode
    71     pcDepthInput->open( m_pchDepthInputFileList[iViewIdx], false, iFileBitDepth, iInteralBitDepth );  // read mode
     69    pcVideoInput->open( m_pchVideoInputFileList[iViewIdx], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC);  // read mode
     70    pcDepthInput->open( m_pchDepthInputFileList[iViewIdx], false, m_inputBitDepthY, m_inputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // read mode
    7271    pcVideoInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight  );
    7372    pcDepthInput->skipFrames(m_iFrameSkip, m_iSourceWidth, m_iSourceHeight  );
     
    8079  {
    8180    TVideoIOYuv* pcSynthOutput = new TVideoIOYuv;
    82     pcSynthOutput->open( m_pchSynthOutputFileList[iViewIdx], true, iFileBitDepth, iInteralBitDepth );  // write mode
     81    pcSynthOutput->open( m_pchSynthOutputFileList[iViewIdx], true, m_outputBitDepthY, m_outputBitDepthC, m_internalBitDepthY, m_internalBitDepthC );  // write mode
    8382    m_apcTVideoIOYuvSynthOutput.push_back( pcSynthOutput );
    8483  }
     
    469468    render();
    470469    break;
     470#if H_3D_VSO
    471471  case 1:
    472472    renderModel();
    473473    break;
     474#endif
    474475  case 10:
    475476    renderUsedPelsMap( );
     
    481482}
    482483
     484#if H_3D_VSO
    483485Void TAppRendererTop::renderModel()
    484486{
     
    493495}
    494496
     497
     498
    495499Void TAppRendererTop::xRenderModelFromString()
    496500{
    497 
    498501    xCreateLib();
    499502    xInitLib();
     
    522525
    523526    AOT( m_iLog2SamplingFactor != 0 );
    524 #if LGE_VSO_EARLY_SKIP_A0093
     527#if H_3D_VSO_EARLY_SKIP
    525528    cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );
    526529#else
     
    683686}
    684687
     688
    685689Void TAppRendererTop::xRenderModelFromNums()
    686690{
     
    700704  AOT( m_iLog2SamplingFactor != 0 );
    701705  cCurModel.setupPart( 0, m_iSourceHeight  );
    702 #if LGE_VSO_EARLY_SKIP_A0093
     706#if H_3D_VSO_EARLY_SKIP
    703707  cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );
    704708#else
     
    880884
    881885}
     886#endif
    882887
    883888Void TAppRendererTop::renderUsedPelsMap( )
  • branches/HTM-DEV-0.2-dev/source/App/TAppRenderer/TAppRendererTop.h

    r438 r446  
    3232 */
    3333
    34 
    35 
    3634#include <list>
    3735#include <stdio.h>
     
    3937#include <assert.h>
    4038
    41 
    4239#ifndef __TAppRendererTOP__
    4340#define __TAppRendererTOP__
    44 
    45 
     41#include "../../Lib/TLibCommon/TypeDef.h"
     42#if H_3D
    4643#include "../../Lib/TLibRenderer/TRenTop.h"
    4744#include "../../Lib/TLibVideoIO/TVideoIOYuv.h"
     
    5047#include "../../Lib/TLibRenderer/TRenModel.h"
    5148
    52 #if !QC_MVHEVC_B0046
    5349// ====================================================================================================================
    5450// Class definition
     
    7268  Void  xInitLib          ();                               ///< initialize renderer class
    7369  Void  xDestroyLib       ();                               ///< destroy renderer class and video io
     70#if H_3D_VSO
    7471  Void  xRenderModelFromString();                           ///< render using model using setup string
    7572  Void  xRenderModelFromNums();                             ///< render using model using synth view numbers
    76 
     73#endif
    7774
    7875public:
     
    8178
    8279  Void  render      ();                               ///< main encoding function
     80#if H_3D_VSO
    8381  Void  renderModel ();
     82#endif
    8483  Void  go          ();
    8584  Void  renderUsedPelsMap();
     
    8786};// END CLASS DEFINITION TAppRendererTop
    8887
    89 #endif
    9088
    91 #endif
     89#endif // H_3D
     90#endif // __TAppRendererTOP__
  • branches/HTM-DEV-0.2-dev/source/Lib/TAppCommon/TAppComCamPara.cpp

    r438 r446  
    4949#include <functional>
    5050#include <string>
    51 
     51#if H_3D
    5252
    5353
     
    5858  AOF( radShiftParams == NULL && raiShiftParams == NULL && radLUT == NULL && raiLUT == NULL );
    5959
    60   uiNumberSourceViews = max( 1, uiNumberSourceViews );
    61   uiNumberTargetViews = Max( 1, uiNumberTargetViews );
     60  uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews );
     61  uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews );
    6262
    6363  radShiftParams = new Double** [ uiNumberSourceViews ];
     
    892892
    893893        // maximum deviation
    894         dMaxDispDev     = Max( dMaxDispDev,    fabs( Double( (Int) iTestScale   ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );
    895         dMaxRndDispDvL  = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) );
    896         dMaxRndDispDvC  = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );
     894        dMaxDispDev     = std::max( dMaxDispDev,    fabs( Double( (Int) iTestScale   ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );
     895        dMaxRndDispDvL  = std::max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) );
     896        dMaxRndDispDvC  = std::max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );
    897897      }
    898898
     
    980980  AOF( iMinAbsVOIId != 0 && iMinAbsVOI != 0 );
    981981  xGetCameraShifts( 0, iMinAbsVOIId, m_uiFirstFrameId, dCamPosShift, dPicPosShift );
     982#if H_3D_PDM_CAM_PARAS
    982983  Double  dCamPosShiftVOI01     = dCamPosShift / Double( iMinVOI );
     984#endif
    983985
    984986  //--- determine maximum absolute camera position shift, precision, and base scale ---
     
    993995    }
    994996  }
     997
     998#if H_3D_PDM_CAM_PARAS
    995999  Int     iPrecision  = 0;
    9961000#if 0 // enabling this lines might be reasonable, but produces different results for the 2 view and 3 view test cases
     
    10271031    }
    10281032  }
     1033#endif
    10291034}
    10301035
     
    10501055  m_aaiScaleAndOffsetSet      = 0;
    10511056
     1057#if H_3D_PDM_CAM_PARAS
    10521058  m_iPdmPrecision             = 0;
    10531059  m_aaiPdmScaleNomDelta       = 0;
    10541060  m_aaiPdmOffset              = 0;
     1061#endif
    10551062
    10561063  m_adBaseViewShiftParameter  = 0;
     
    10781085  xDeleteArray( m_aiBaseViewShiftLUT,        m_iNumberOfBaseViews, m_iNumberOfBaseViews,  2 );
    10791086
    1080   xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, Max(1,m_iNumberOfSynthViews));
    1081   xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, Max(1,m_iNumberOfSynthViews));
    1082   xDeleteArray( m_adSynthViewShiftLUT,       m_iNumberOfBaseViews, Max(1,m_iNumberOfSynthViews), 2 );
    1083   xDeleteArray( m_aiSynthViewShiftLUT,       m_iNumberOfBaseViews, Max(1,m_iNumberOfSynthViews), 2 );
     1087  xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews));
     1088  xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews));
     1089  xDeleteArray( m_adSynthViewShiftLUT,       m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews), 2 );
     1090  xDeleteArray( m_aiSynthViewShiftLUT,       m_iNumberOfBaseViews, std::max( (Int)1 ,m_iNumberOfSynthViews), 2 );
    10841091
    10851092  xDeleteArray( m_aaiCodedScale,             m_iNumberOfBaseViews );
     
    10871094  xDeleteArray( m_aaiScaleAndOffsetSet,      m_iNumberOfBaseViews );
    10881095
     1096#if H_3D_PDM_CAM_PARAS
    10891097  xDeleteArray( m_aaiPdmScaleNomDelta,       m_iNumberOfBaseViews );
    10901098  xDeleteArray( m_aaiPdmOffset,              m_iNumberOfBaseViews );
     1099#endif
    10911100}
    10921101
     
    11061115
    11071116    Int iViewOrderIdx  = (Int)( m_aadCameraParameters[ uiRow ][ 1 ] );
    1108     iMinViewOrderIdx   = Min( iViewOrderIdx, iMinViewOrderIdx );
     1117    iMinViewOrderIdx   = std::min( iViewOrderIdx, iMinViewOrderIdx );
    11091118
    11101119    aiViewOrderIdx     .push_back( iViewOrderIdx );
     
    11211130    m_aiBaseId2SortedId.push_back( iCurBaseView );
    11221131    m_aiBaseSortedId2Id.push_back( iCurBaseView );
    1123 
    11241132  }
    11251133
     
    13321340  xInit2dArray  ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiScaleAndOffsetSet, 0 );
    13331341
     1342#if H_3D_PDM_CAM_PARAS
    13341343  xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiPdmScaleNomDelta     );
    13351344  xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews,  m_aaiPdmOffset            );
     
    13371346  //===== init disparity to virtual depth conversion parameters =====
    13381347  xSetPdmConversionParams();
     1348#endif
    13391349
    13401350  //===== init arrays for first frame =====
     
    13851395    }
    13861396
     1397    Bool bInterpolateFirst = true;
     1398    Bool bAnyInterpolated  = false;
    13871399    for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ )
    13881400    {
     
    13941406        bInterpolated |= bInterpolatedCur;
    13951407      }
     1408     
    13961409      if( bInterpolated )
    13971410      {
    1398         std::cout << "Interpolating Camera Parameters for View " << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << std::endl;
    1399       }
    1400     }
     1411        bAnyInterpolated = true;
     1412        if ( bInterpolateFirst )
     1413        {
     1414          std::cout << "Interpolating Camera Parameters for View(s) " ;
     1415            bInterpolateFirst = false;
     1416        }         
     1417        std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ;
     1418      }
     1419    }
     1420    if ( bAnyInterpolated )
     1421      std::cout << std::endl;
    14011422  }
    14021423
     
    14331454}
    14341455
    1435 #if SAIT_VSO_EST_A0033
    1436 Void
    1437 TAppComCamPara::xSetDispCoeff( UInt uiFrameId, Int iViewIdx )
     1456#if H_3D_VSO
     1457Void
     1458TAppComCamPara::setDispCoeff( UInt uiFrameId, Int iViewIdx )
    14381459{
    14391460  UInt uiFrame = m_uiFirstFrameId + uiFrameId;
     
    14531474    xGetZNearZFar   ( iSourceViewNum, uiFrame, dZN1, dZF1 );
    14541475
    1455     dBaseLine = ( Max( dPos[0], Max( dPos[1], dPos[2] ) ) - Min( dPos[0], Min( dPos[1], dPos[2] ) ) ) / 2.0;
     1476    dBaseLine = ( std::max( dPos[0], std::max( dPos[1], dPos[2] ) ) - std::min( dPos[0], std::min( dPos[1], dPos[2] ) ) ) / 2.0;
    14561477  }
    14571478  else if( m_iNumberOfBaseViews == 2 )
     
    14651486    dBaseLine = dPos[0] - dPos[1];
    14661487  }
    1467 
    14681488
    14691489  m_dDispCoeff = fabs( dFL1 * ( dBaseLine / 2.0 ) / 255.0 * ( 1.0/dZN1 - 1.0/dZF1 ) );
     
    15101530  return xGetViewId(m_aiRelSynthViewsNum, iRelNum );
    15111531}
     1532#endif
  • branches/HTM-DEV-0.2-dev/source/Lib/TAppCommon/TAppComCamPara.h

    r438 r446  
    6666  Bool                m_bSetupFromCoded;                      ///< setup from coded parameter file
    6767  Bool                m_bCamParsCodedPrecSet;                 ///< Coded Cam Para precision set for current frame;
    68 
    69 #if SAIT_VSO_EST_A0033
     68 
     69  //SAIT_VSO_EST_A0033
    7070  Double              m_dDispCoeff;
    71 #endif
    7271
    7372  // view lists
     
    9089  Int**               m_aaiScaleAndOffsetSet;                 ///< array indicating whether scale and offset have been set
    9190
     91#if H_3D_PDM_CAM_PARAS
    9292  // parameters for virtual depth map generation
    9393  Int                 m_iPdmPrecision;                        ///< additional precision for disparity - virtual depth conversion
    9494  Int**               m_aaiPdmScaleNomDelta;                  ///< [TargetView][RefView] delta for nominator of scale factor
    9595  Int**               m_aaiPdmOffset;                         ///< [TargetView][RefView] offset parameter
     96#endif
    9697
    9798  // scale and offset parameters
     
    182183
    183184  Int                 synthRelNum2Idx           ( Int iRelNum );
    184   Bool getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView );
     185  Bool                getLeftRightBaseView      ( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView );
    185186  Int                 getRelDistLeft            ( Int iSynthViewIdx, Int   iLeftViewIdx, Int iRightViewIdx );
    186187  UInt                getCurFrameId             ()  { return m_iCurrentFrameId;   }
    187188  static Void         convertNumberString       ( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec );
    188189
    189 #if SAIT_VSO_EST_A0033
    190   Void xSetDispCoeff( UInt uiStartFrameId, Int iViewIdx );
    191   Double getDispCoeff() { return m_dDispCoeff; }
     190#if H_3D_VSO
     191  // SAIT_VSO_EST_A033
     192  Void                setDispCoeff              ( UInt uiStartFrameId, Int iViewIdx );
     193  Double              getDispCoeff              () { return m_dDispCoeff; }
    192194#endif
    193195
     
    216218  Int**               getCodedOffset            ()  { return m_aaiCodedOffset;          }
    217219
     220#if H_3D_PDM_CAM_PARAS
    218221  // parameters for virtual depth map generation
    219222  Int                 getPdmPrecision           ()  { return m_iPdmPrecision;           }
    220223  Int**               getPdmScaleNomDelta       ()  { return m_aaiPdmScaleNomDelta;     }
    221224  Int**               getPdmOffset              ()  { return m_aaiPdmOffset;            }
     225#endif
    222226};
    223227
  • branches/HTM-DEV-0.2-dev/source/Lib/TAppCommon/program_options_lite.h

    r438 r446  
    4646#endif
    4747#endif
    48 
    4948//! \ingroup TAppCommon
    5049//! \{
     
    283282    }
    284283#endif
    285 
    286284    /** Option class for argument handling using a user provided function */
    287285    struct OptionFunc : public OptionBase
     
    382380      }
    383381#endif
    384 
    385382      /**
    386383       * Add option described by name to the parent Options list,
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/CommonDef.h

    r439 r446  
    5757
    5858#if H_MV
    59 #define NV_VERSION        "0.3"                 ///< Current software version
     59#define NV_VERSION        "0.1"                 ///< Current software version
    6060#define HM_VERSION        "10.1"                ///<
    6161#else
    62 #define NV_VERSION        "10.0"                 ///< Current software version
     62#define NV_VERSION        "10.1"                 ///< Current software version
    6363#endif
    6464
     
    115115#define MAX_NUM_REF_PICS            16          ///< max. number of pictures used for reference
    116116#define MAX_NUM_REF                 16          ///< max. number of entries in picture reference list
     117#if !L0034_COMBINED_LIST_CLEANUP
    117118#define MAX_NUM_REF_LC              MAX_NUM_REF_PICS  // TODO: remove this macro definition (leftover from combined list concept)
     119#endif
    118120
    119121#define MAX_UINT                    0xFFFFFFFFU ///< max. value of unsigned 32-bit integer
    120122#define MAX_INT                     2147483647  ///< max. value of signed 32-bit integer
     123#if H_3D
     124#define MIN_INT                     (-2147483647-1) // < min. value of signed 32-bit integer
     125#endif
    121126#define MAX_INT64                   0x7FFFFFFFFFFFFFFFLL  ///< max. value of signed 64-bit integer
    122127#define MAX_DOUBLE                  1.7e+308    ///< max. value of double-type value
     
    136141template <typename T> inline T ClipY(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); }
    137142template <typename T> inline T ClipC(T x) { return std::min<T>(T((1 << g_bitDepthC)-1), std::max<T>( T(0), x)); }
    138 
    139 template <typename T> inline T Clip(T x) { return std::min<T>(T((1 << g_bitDepthY)-1), std::max<T>( T(0), x)); }
    140143
    141144/** clip a, such that minVal <= a <= maxVal */
     
    167170}
    168171
    169 #endif
    170 
     172#define AOT( exp )            \
     173{                             \
     174  if( ( exp ) )               \
     175{                           \
     176  assert( 0 );              \
     177}                           \
     178}
     179
     180template <typename T>
     181__inline T gSign(const T& t)
     182{
     183  if( t == 0 )
     184    return T(0);
     185  else
     186    return (t < 0) ? T(-1) : T(1);
     187}
     188
     189#define RemoveBitIncrement( exp ) ( exp >> ( g_bitDepthY - 8 ) )
     190
     191#endif
    171192
    172193// ====================================================================================================================
     
    216237 
    217238  NAL_UNIT_CODED_SLICE_TSA_N,     // 2
    218   NAL_UNIT_CODED_SLICE_TLA,       // 3   // Current name in the spec: TSA_R
     239  NAL_UNIT_CODED_SLICE_TLA_R,       // 3
    219240 
    220241  NAL_UNIT_CODED_SLICE_STSA_N,    // 4
     
    222243
    223244  NAL_UNIT_CODED_SLICE_RADL_N,    // 6
    224   NAL_UNIT_CODED_SLICE_DLP,       // 7 // Current name in the spec: RADL_R
     245  NAL_UNIT_CODED_SLICE_RADL_R,      // 7
    225246 
    226247  NAL_UNIT_CODED_SLICE_RASL_N,    // 8
    227   NAL_UNIT_CODED_SLICE_TFD,       // 9 // Current name in the spec: RASL_R
    228 
    229   NAL_UNIT_RESERVED_10,
    230   NAL_UNIT_RESERVED_11,
    231   NAL_UNIT_RESERVED_12,
    232   NAL_UNIT_RESERVED_13,
    233   NAL_UNIT_RESERVED_14,
    234   NAL_UNIT_RESERVED_15,
    235 
    236   NAL_UNIT_CODED_SLICE_BLA,       // 16   // Current name in the spec: BLA_W_LP
    237   NAL_UNIT_CODED_SLICE_BLANT,     // 17   // Current name in the spec: BLA_W_DLP
     248  NAL_UNIT_CODED_SLICE_RASL_R,      // 9
     249
     250  NAL_UNIT_RESERVED_VCL_N10,
     251  NAL_UNIT_RESERVED_VCL_R11,
     252  NAL_UNIT_RESERVED_VCL_N12,
     253  NAL_UNIT_RESERVED_VCL_R13,
     254  NAL_UNIT_RESERVED_VCL_N14,
     255  NAL_UNIT_RESERVED_VCL_R15,
     256
     257  NAL_UNIT_CODED_SLICE_BLA_W_LP,    // 16
     258  NAL_UNIT_CODED_SLICE_BLA_W_RADL,  // 17
    238259  NAL_UNIT_CODED_SLICE_BLA_N_LP,  // 18
    239   NAL_UNIT_CODED_SLICE_IDR,       // 19  // Current name in the spec: IDR_W_DLP
     260  NAL_UNIT_CODED_SLICE_IDR_W_RADL,  // 19
    240261  NAL_UNIT_CODED_SLICE_IDR_N_LP,  // 20
    241262  NAL_UNIT_CODED_SLICE_CRA,       // 21
    242   NAL_UNIT_RESERVED_22,
    243   NAL_UNIT_RESERVED_23,
    244 
    245   NAL_UNIT_RESERVED_24,
    246   NAL_UNIT_RESERVED_25,
    247   NAL_UNIT_RESERVED_26,
    248   NAL_UNIT_RESERVED_27,
    249   NAL_UNIT_RESERVED_28,
    250   NAL_UNIT_RESERVED_29,
    251   NAL_UNIT_RESERVED_30,
    252   NAL_UNIT_RESERVED_31,
     263  NAL_UNIT_RESERVED_IRAP_VCL22,
     264  NAL_UNIT_RESERVED_IRAP_VCL23,
     265
     266  NAL_UNIT_RESERVED_VCL24,
     267  NAL_UNIT_RESERVED_VCL25,
     268  NAL_UNIT_RESERVED_VCL26,
     269  NAL_UNIT_RESERVED_VCL27,
     270  NAL_UNIT_RESERVED_VCL28,
     271  NAL_UNIT_RESERVED_VCL29,
     272  NAL_UNIT_RESERVED_VCL30,
     273  NAL_UNIT_RESERVED_VCL31,
    253274
    254275  NAL_UNIT_VPS,                   // 32
     
    259280  NAL_UNIT_EOB,                   // 37
    260281  NAL_UNIT_FILLER_DATA,           // 38
    261   NAL_UNIT_SEI,                   // 39 Prefix SEI
    262   NAL_UNIT_SEI_SUFFIX,            // 40 Suffix SEI
    263   NAL_UNIT_RESERVED_41,
    264   NAL_UNIT_RESERVED_42,
    265   NAL_UNIT_RESERVED_43,
    266   NAL_UNIT_RESERVED_44,
    267   NAL_UNIT_RESERVED_45,
    268   NAL_UNIT_RESERVED_46,
    269   NAL_UNIT_RESERVED_47,
     282  NAL_UNIT_PREFIX_SEI,              // 39
     283  NAL_UNIT_SUFFIX_SEI,              // 40
     284  NAL_UNIT_RESERVED_NVCL41,
     285  NAL_UNIT_RESERVED_NVCL42,
     286  NAL_UNIT_RESERVED_NVCL43,
     287  NAL_UNIT_RESERVED_NVCL44,
     288  NAL_UNIT_RESERVED_NVCL45,
     289  NAL_UNIT_RESERVED_NVCL46,
     290  NAL_UNIT_RESERVED_NVCL47,
    270291  NAL_UNIT_UNSPECIFIED_48,
    271292  NAL_UNIT_UNSPECIFIED_49,
     
    287308};
    288309
     310#if H_3D
     311//PICYUV
     312#define PICYUV_PAD         16
     313
     314//RENDERER
     315#define REN_LUMA_MARGIN   ( g_uiMaxCUWidth + PICYUV_PAD )
     316#define REN_VDWEIGHT_PREC  8
     317#define REN_IS_FILLED     ( 1 << REN_VDWEIGHT_PREC )
     318#define REN_USED_PEL       ( (1 << g_bitDepthY) - 1 )
     319#define REN_UNUSED_PEL     0
     320#define REN_IS_HOLE        0
     321
     322
     323// CAMERA PARAMETERS
     324#define LOG2_DISP_PREC_LUT           2           ///< log2 of disparity precision used in integer disparity LUTs
     325#define STD_CAM_PARAMETERS_PRECISION 5        ///< quarter luma sample accuarcy for derived disparities (as default)
     326
     327#endif // end of H_3D
    289328//! \}
    290329
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/NAL.h

    r438 r446  
    4747  NalUnitType m_nalUnitType; ///< nal_unit_type
    4848  UInt        m_temporalId;  ///< temporal_id
    49 
    5049#if H_MV
    5150  Int         m_layerId;     ///< layer id
     
    8079    return m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_R
    8180        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TRAIL_N
    82         || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA
     81        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA_R
    8382        || m_nalUnitType == NAL_UNIT_CODED_SLICE_TSA_N
    8483        || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_R
    8584        || m_nalUnitType == NAL_UNIT_CODED_SLICE_STSA_N
    86         || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA
    87         || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLANT
     85        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP
     86        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    8887        || m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
    89         || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR
     88        || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    9089        || m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
    9190        || m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA
    9291        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N
    93         || m_nalUnitType == NAL_UNIT_CODED_SLICE_DLP
     92        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R
    9493        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N
    95         || m_nalUnitType == NAL_UNIT_CODED_SLICE_TFD;
     94        || m_nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R;
    9695  }
    9796#if L0045_NON_NESTED_SEI_RESTRICTIONS
    9897  Bool isSei()
    9998  {
    100     return m_nalUnitType == NAL_UNIT_SEI
    101         || m_nalUnitType == NAL_UNIT_SEI_SUFFIX;
     99    return m_nalUnitType == NAL_UNIT_PREFIX_SEI
     100        || m_nalUnitType == NAL_UNIT_SUFFIX_SEI;
    102101  }
    103102
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/SEI.cpp

    r438 r446  
    3838#include "CommonDef.h"
    3939#include "SEI.h"
     40
     41#if J0149_TONE_MAPPING_SEI
     42//Table D-7 Meaning of camera iso sensitivity indicator and exposure index rating indicator
     43Int  Table_exp_indicator[32] = {0, 10, 12, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 160, 200, 250, 320, 400, 500, 640, 800, 1000, 1250, 1600, 2000, 2500, 3200, 4000, 5000, 6400, 8000, -1};
     44#endif
    4045
    4146SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType)
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/SEI.h

    r438 r446  
    355355};
    356356
     357#if L0208_SOP_DESCRIPTION_SEI
     358class SEISOPDescription : public SEI
     359{
     360public:
     361  PayloadType payloadType() const { return SOP_DESCRIPTION; }
     362
     363  SEISOPDescription() {}
     364  virtual ~SEISOPDescription() {}
     365
     366  UInt m_sopSeqParameterSetId;
     367  UInt m_numPicsInSopMinus1;
     368
     369  UInt m_sopDescVclNaluType[MAX_NUM_PICS_IN_SOP];
     370  UInt m_sopDescTemporalId[MAX_NUM_PICS_IN_SOP];
     371  UInt m_sopDescStRpsIdx[MAX_NUM_PICS_IN_SOP];
     372  Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP];
     373};
     374#endif
     375
     376#if J0149_TONE_MAPPING_SEI
     377class SEIToneMappingInfo : public SEI
     378{
     379public:
     380  PayloadType payloadType() const { return TONE_MAPPING_INFO; }
     381  SEIToneMappingInfo() {}
     382  virtual ~SEIToneMappingInfo() {}
     383
     384  Int    m_toneMapId;
     385  Bool   m_toneMapCancelFlag;
     386  Bool   m_toneMapPersistenceFlag;
     387  Int    m_codedDataBitDepth;
     388  Int    m_targetBitDepth;
     389  Int    m_modelId;
     390  Int    m_minValue;
     391  Int    m_maxValue;
     392  Int    m_sigmoidMidpoint;
     393  Int    m_sigmoidWidth;
     394  std::vector<Int> m_startOfCodedInterval;
     395  Int    m_numPivots;
     396  std::vector<Int> m_codedPivotValue;
     397  std::vector<Int> m_targetPivotValue;
     398  Int    m_cameraIsoSpeedIdc;
     399  Int    m_cameraIsoSpeedValue;
     400  Int    m_exposureCompensationValueSignFlag;
     401  Int    m_exposureCompensationValueNumerator;
     402  Int    m_exposureCompensationValueDenomIdc;
     403  Int    m_refScreenLuminanceWhite;
     404  Int    m_extendedRangeWhiteLevel;
     405  Int    m_nominalBlackLevelLumaCodeValue;
     406  Int    m_nominalWhiteLevelLumaCodeValue;
     407  Int    m_extendedWhiteLevelLumaCodeValue;
     408};
     409#endif
     410
    357411typedef std::list<SEI*> SEIMessages;
    358412
     
    366420Void deleteSEIs (SEIMessages &seiList);
    367421
     422#if K0180_SCALABLE_NESTING_SEI
     423class SEIScalableNesting : public SEI
     424{
     425public:
     426  PayloadType payloadType() const { return SCALABLE_NESTING; }
     427
     428  SEIScalableNesting() {}
     429  virtual ~SEIScalableNesting()
     430  {
     431    if (!m_callerOwnsSEIs)
     432    {
     433      deleteSEIs(m_nestedSEIs);
     434    }
     435  }
     436
     437  Bool  m_bitStreamSubsetFlag;
     438  Bool  m_nestingOpFlag;
     439  Bool  m_defaultOpFlag;                             //value valid if m_nestingOpFlag != 0
     440  UInt  m_nestingNumOpsMinus1;                       // -"-
     441  UInt  m_nestingMaxTemporalIdPlus1[MAX_TLAYER];     // -"-
     442  UInt  m_nestingOpIdx[MAX_NESTING_NUM_OPS];         // -"-
     443
     444  Bool  m_allLayersFlag;                             //value valid if m_nestingOpFlag == 0
     445  UInt  m_nestingNoOpMaxTemporalIdPlus1;             //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
     446  UInt  m_nestingNumLayersMinus1;                    //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
     447  UChar m_nestingLayerId[MAX_NESTING_NUM_LAYER];     //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0. This can e.g. be a static array of 64 unsigned char values
     448
     449  Bool  m_callerOwnsSEIs;
     450  SEIMessages m_nestedSEIs;
     451};
     452#endif
     453
    368454//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComBitStream.cpp

    r438 r446  
    177177  }
    178178}
     179
    179180Void TComOutputBitstream::writeByteAlignment()
    180181{
     
    182183  writeAlignZero();
    183184}
     185
     186Int TComOutputBitstream::countStartCodeEmulations()
     187{
     188  UInt cnt = 0;
     189  vector<uint8_t>& rbsp   = getFIFO();
     190  for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();)
     191  {
     192    vector<uint8_t>::iterator found = it;
     193    do
     194    {
     195      // find the next emulated 00 00 {00,01,02,03}
     196      // NB, end()-1, prevents finding a trailing two byte sequence
     197      found = search_n(found, rbsp.end()-1, 2, 0);
     198      found++;
     199      // if not found, found == end, otherwise found = second zero byte
     200      if (found == rbsp.end())
     201      {
     202        break;
     203      }
     204      if (*(++found) <= 3)
     205      {
     206        break;
     207      }
     208    } while (true);
     209    it = found;
     210    if (found != rbsp.end())
     211    {
     212      cnt++;
     213    }
     214  }
     215  return cnt;
     216}
     217
    184218/**
    185219 * read #uiNumberOfBits# from bitstream without updating the bitstream
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComBitStream.h

    r438 r446  
    154154  Void          addSubstream    ( TComOutputBitstream* pcSubstream );
    155155  Void writeByteAlignment();
     156
     157  //! returns the number of start code emulations contained in the current buffer
     158  Int countStartCodeEmulations();
    156159};
    157160
     
    163166{
    164167  std::vector<uint8_t> *m_fifo; /// FIFO for storage of complete bytes
     168  std::vector<UInt> m_emulationPreventionByteLocation;
    165169
    166170protected:
     
    206210  UInt  getNumBitsRead() { return m_numBitsRead; }
    207211  Void readByteAlignment();
     212
     213  Void      pushEmulationPreventionByteLocation ( UInt pos )                  { m_emulationPreventionByteLocation.push_back( pos ); }
     214  UInt      numEmulationPreventionBytesRead     ()                            { return (UInt) m_emulationPreventionByteLocation.size();    }
     215  std::vector<UInt>  getEmulationPreventionByteLocation  ()                   { return m_emulationPreventionByteLocation;           }
     216  UInt      getEmulationPreventionByteLocation  ( UInt idx )                  { return m_emulationPreventionByteLocation[ idx ];    }
     217  Void      clearEmulationPreventionByteLocation()                            { m_emulationPreventionByteLocation.clear();          }
     218  Void      setEmulationPreventionByteLocation  ( std::vector<UInt> vec )     { m_emulationPreventionByteLocation = vec;            }
    208219};
    209220
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r438 r446  
    32003200  Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic( eRefPicList, iRefIdx)->getIsLongTerm();
    32013201  Bool bIsNeibRefLongTerm = false;
    3202 
    32033202  //---------------  V1 (END) ------------------//
    32043203  if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0)
     
    38403839}
    38413840
     3841#if H_3D
     3842Void TComDataCU::getPosInPic( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY )
     3843{
     3844  riPosX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelX();
     3845  riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 
     3846}
     3847#endif
    38423848
    38433849//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComDataCU.h

    r324 r446  
    194194  Bool          m_bDecSubCu;          ///< indicates decoder-mode
    195195  Double        m_dTotalCost;         ///< sum of partition RD costs
     196#if H_3D_VSO
     197  Dist          m_uiTotalDistortion;  ///< sum of partition distortion
     198#else
    196199  UInt          m_uiTotalDistortion;  ///< sum of partition distortion
     200#endif
    197201  UInt          m_uiTotalBits;        ///< sum of partition bits
    198202  UInt          m_uiTotalBins;       ///< sum of partition bins
     
    263267 
    264268  Void          setDepthSubParts      ( UInt uiDepth, UInt uiAbsPartIdx );
     269#if H_3D
     270  Void          getPosInPic           ( UInt uiAbsPartIndex, Int& riPosX, Int& riPosY );
     271#endif
    265272 
    266273  // -------------------------------------------------------------------------------------------------------------------
     
    512519 
    513520  Double&       getTotalCost()                  { return m_dTotalCost;        }
     521#if H_3D_VSO
     522  Dist&         getTotalDistortion()            { return m_uiTotalDistortion; }
     523#else
    514524  UInt&         getTotalDistortion()            { return m_uiTotalDistortion; }
     525#endif
    515526  UInt&         getTotalBits()                  { return m_uiTotalBits;       }
    516527  UInt&         getTotalNumPart()               { return m_uiNumPartition;    }
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComLoopFilter.cpp

    r438 r446  
    5757// ====================================================================================================================
    5858
    59 const UChar tctable_8x8[54] =
     59const UChar TComLoopFilter::sm_tcTable[54] =
    6060{
    6161  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,8,9,10,11,13,14,16,18,20,22,24
    6262};
    6363
    64 const UChar betatable_8x8[52] =
     64const UChar TComLoopFilter::sm_betaTable[52] =
    6565{
    6666  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64
     
    585585      Int iIndexB = Clip3(0, MAX_QP, iQP + (betaOffsetDiv2 << 1));
    586586     
    587       Int iTc =  tctable_8x8[iIndexTC]*iBitdepthScale;
    588       Int iBeta = betatable_8x8[iIndexB]*iBitdepthScale;
     587      Int iTc =  sm_tcTable[iIndexTC]*iBitdepthScale;
     588      Int iBeta = sm_betaTable[iIndexB]*iBitdepthScale;
    589589      Int iSideThreshold = (iBeta+(iBeta>>1))>>3;
    590590      Int iThrCut = iTc*10;
     
    735735
    736736        Int iIndexTC = Clip3(0, MAX_QP+DEFAULT_INTRA_TC_OFFSET, iQP + DEFAULT_INTRA_TC_OFFSET*(ucBs - 1) + (tcOffsetDiv2 << 1));
    737         Int iTc =  tctable_8x8[iIndexTC]*iBitdepthScale;
     737        Int iTc =  sm_tcTable[iIndexTC]*iBitdepthScale;
    738738
    739739        for ( UInt uiStep = 0; uiStep < uiPelsInPartChroma; uiStep++ )
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComLoopFilter.h

    r438 r446  
    9999  __inline Int xCalcDQ( Pel* piSrc, Int iOffset);
    100100 
     101  static const UChar sm_tcTable[54];
     102  static const UChar sm_betaTable[52];
     103
    101104public:
    102105  TComLoopFilter();
     
    111114  /// picture-level deblocking filter
    112115  Void loopFilterPic( TComPic* pcPic );
     116
     117  static Int getBeta( Int qp )
     118  {
     119    Int indexB = Clip3( 0, MAX_QP, qp );
     120    return sm_betaTable[ indexB ];
     121  }
    113122};
    114123
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPic.cpp

    r438 r446  
    6868, m_viewId                                (0)
    6969#if H_3D
     70, m_viewIndex                             (0)
    7071, m_isDepth                               (false)
     72, m_aaiCodedScale                         (0)
     73, m_aaiCodedOffset                        (0)
    7174#endif
    7275#endif
     
    479482    std::cout  << getLayerId() << "\t" << getPOC()<< "\t" << getReconMark() << "\t" << getSlice(0)->isReferenced() << "\t" << getIsLongTerm() << std::endl;
    480483}
    481 #endif
    482 
     484
     485TComPic* TComPicLists::getPic( Int layerIdInNuh, Int poc )
     486{
     487  TComPic* pcPic = NULL;
     488  for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() && pcPic == NULL ); itL++)
     489  {   
     490    for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() && pcPic == NULL ); itP++)
     491    {
     492      TComPic* currPic = (*itP);
     493      if ( ( currPic->getPOC() == poc ) && ( currPic->getLayerId() == layerIdInNuh ) )
     494      {
     495        pcPic = currPic ;     
     496      }
     497    }
     498  }
     499  return pcPic;
     500}
     501
     502#if H_3D
     503TComPic* TComPicLists::getPic( Int viewIndex, Bool depthFlag, Int poc )
     504{
     505  return getPic   ( m_vps->getLayerIdInNuh( viewIndex, depthFlag ), poc );
     506}
     507
     508Void TComPicLists::print()
     509{
     510  Bool first = true;     
     511  for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() ); itL++)
     512  {   
     513    for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() ); itP++)
     514    {
     515      if ( first )
     516      {
     517        (*itP)->print( true );       
     518        first = false;
     519      }
     520      (*itP)->print( false );       
     521    }
     522  }
     523}
     524
     525TComPicYuv* TComPicLists::getPicYuv( Int layerIdInNuh, Int poc, Bool reconFlag )
     526{
     527  TComPic*    pcPic = getPic( layerIdInNuh, poc );
     528  TComPicYuv* pcPicYuv = NULL;
     529
     530  if (pcPic != NULL)
     531  {
     532    if( reconFlag )
     533    {
     534      if ( pcPic->getReconMark() )
     535      {
     536        pcPicYuv = pcPic->getPicYuvRec();
     537      }
     538    }
     539    else
     540    {
     541      pcPicYuv = pcPic->getPicYuvOrg();
     542    }
     543  };
     544
     545  return pcPicYuv;
     546}
     547
     548TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon )
     549
     550  Int layerIdInNuh = m_vps->getLayerIdInNuh( viewIndex, depthFlag );
     551  return getPicYuv( layerIdInNuh, poc, recon );
     552}
     553#endif // H_3D
     554#endif // H_MV
    483555//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPic.h

    r438 r446  
    9090  Int                   m_viewId;
    9191#if H_3D
     92  Int                   m_viewIndex;
    9293  Bool                  m_isDepth;
    93 #endif
    94 #endif
    95 
     94  Int**                 m_aaiCodedScale;
     95  Int**                 m_aaiCodedOffset;
     96#endif
     97#endif
    9698public:
    9799  TComPic();
     
    112114  Int           getViewId             ()                 { return m_viewId;     }
    113115#if H_3D
     116  Void          setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
     117  Int           getViewIndex          ()                 { return m_viewIndex;     }
     118
    114119  Void          setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
    115120  Bool          getIsDepth            ()                 { return m_isDepth; }
    116 #endif
    117 #endif
    118 
     121
     122  Void          setScaleOffset( Int** pS, Int** pO )  { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; }
     123  Int**         getCodedScale ()                      { return m_aaiCodedScale;  }
     124  Int**         getCodedOffset()                      { return m_aaiCodedOffset; }
     125#endif
     126#endif
    119127  Bool          getUsedByCurr()             { return m_bUsedByCurr; }
    120128  Void          setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; }
     
    186194  Void          print( Bool legend );
    187195#endif
    188 
    189 
    190 
    191196  /** transfer ownership of seis to this picture */
    192197  void setSEIs(SEIMessages& seis) { m_SEIs = seis; }
     
    209214private:
    210215  TComList<TComList<TComPic*>*> m_lists;
     216#if H_3D
     217  TComVPS*                     m_vps;
     218#endif
    211219public:
    212  
    213   Void push_back( TComList<TComPic*>* list ) { m_lists.push_back( list ); }
    214   Int  size     ()                           { return (Int) m_lists.size    (); }
    215 
    216   TComPic* getPic( Int layerIdInNuh, Int poc )
    217   {
    218     TComPic* pcPic = NULL;
    219     for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() && pcPic == NULL ); itL++)
    220     {   
    221       for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() && pcPic == NULL ); itP++)
    222       {
    223         if ( ( (*itP)->getPOC() == poc ) && ( (*itP)->getLayerId() == layerIdInNuh ) )
    224         {
    225           pcPic = *itP ;     
    226         }
    227       }
    228     }
    229     return pcPic;
    230   }
    231 
    232   Void print( )
    233   {
    234     Bool first = true;     
    235     for(TComList<TComList<TComPic*>*>::iterator itL = m_lists.begin(); ( itL != m_lists.end() ); itL++)
    236     {   
    237       for(TComList<TComPic*>::iterator itP=(*itL)->begin(); ( itP!=(*itL)->end() ); itP++)
    238       {
    239         if ( first )
    240         {
    241           (*itP)->print( true );       
    242           first = false;
    243         }
    244         (*itP)->print( false );       
    245       }
    246     }
    247   }
    248 
     220  Void        push_back( TComList<TComPic*>* list ) { m_lists.push_back( list );   }
     221  Int         size     ()                           { return (Int) m_lists.size(); }
     222  TComPic*    getPic   ( Int layerIdInNuh,              Int poc );   
     223  TComPicYuv* getPicYuv( Int layerIdInNuh,              Int poc, Bool recon );
     224#if H_3D
     225  Void        setVPS   ( TComVPS* vps ) { m_vps = vps;  };
     226  TComPic*    getPic   ( Int viewIndex, Bool depthFlag, Int poc );
     227  TComPicYuv* getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon );
     228#endif 
     229
     230  Void print( ); 
    249231
    250232}; // END CLASS DEFINITION TComPicLists
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPicYuv.cpp

    r324 r446  
    324324}
    325325
     326#if H_3D
     327Void TComPicYuv::setLumaTo( Pel pVal )
     328{
     329  xSetPels( getLumaAddr(), getStride(), getWidth(), getHeight(), pVal );
     330}
     331
     332Void TComPicYuv::setChromaTo( Pel pVal )
     333{
     334  xSetPels( getCbAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, pVal );
     335  xSetPels( getCrAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, pVal );
     336}
     337
     338Void TComPicYuv::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal )
     339{
     340  for (Int iYPos = 0; iYPos < iHeight; iYPos++)
     341  {
     342    for (Int iXPos = 0; iXPos < iWidth; iXPos++)
     343    {
     344      piPelSource[iXPos] = iVal;
     345    }
     346    piPelSource += iSourceStride;
     347  }
     348}
     349#endif
    326350
    327351//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPicYuv.h

    r324 r446  
    9090protected:
    9191  Void  xExtendPicCompBorder (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY);
     92#if H_3D
     93  Void  xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal );
     94#endif
    9295 
    9396public:
     
    158161  // Set border extension flag
    159162  Void  setBorderExtension(Bool b) { m_bIsBorderExtended = b; }
     163#if H_3D
     164  // Set Function
     165  Void  setLumaTo    ( Pel pVal ); 
     166  Void  setChromaTo  ( Pel pVal ); 
     167#endif
    160168};// END CLASS DEFINITION TComPicYuv
    161169
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComPrediction.cpp

    r438 r446  
    8383  if( m_piYuvExt == NULL )
    8484  {
    85     Int extWidth  = g_uiMaxCUWidth + 16;
    86     Int extHeight = g_uiMaxCUHeight + 1;
     85    Int extWidth  = MAX_CU_SIZE + 16;
     86    Int extHeight = MAX_CU_SIZE + 1;
    8787    Int i, j;
    8888    for (i = 0; i < 4; i++)
     
    9494      }
    9595    }
    96     m_iYuvExtHeight  = ((g_uiMaxCUHeight + 2) << 4);
    97     m_iYuvExtStride = ((g_uiMaxCUWidth  + 8) << 4);
     96    m_iYuvExtHeight  = ((MAX_CU_SIZE + 2) << 4);
     97    m_iYuvExtStride = ((MAX_CU_SIZE  + 8) << 4);
    9898    m_piYuvExt = new Int[ m_iYuvExtStride * m_iYuvExtHeight ];
    9999
    100100    // new structure
    101     m_acYuvPred[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    102     m_acYuvPred[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    103 
    104     m_cYuvPredTemp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    105   }
    106 
    107   if (m_iLumaRecStride != (g_uiMaxCUWidth>>1) + 1)
    108   {
    109     m_iLumaRecStride =  (g_uiMaxCUWidth>>1) + 1;
     101    m_acYuvPred[0] .create( MAX_CU_SIZE, MAX_CU_SIZE );
     102    m_acYuvPred[1] .create( MAX_CU_SIZE, MAX_CU_SIZE );
     103
     104    m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE );
     105  }
     106
     107  if (m_iLumaRecStride != (MAX_CU_SIZE>>1) + 1)
     108  {
     109    m_iLumaRecStride =  (MAX_CU_SIZE>>1) + 1;
    110110    if (!m_pLumaRecBuffer)
    111111    {
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComRdCost.cpp

    r324 r446  
    4040#include "TComRom.h"
    4141#include "TComRdCost.h"
     42#if H_3D
     43#include "TComDataCU.h"
     44#endif
    4245
    4346//! \ingroup TLibCommon
    4447//! \{
    4548
     49#if H_3D_VSO
     50// SAIT_VSO_EST_A0033
     51Double TComRdCost::m_dDisparityCoeff = 1.0;
     52#endif
     53
    4654TComRdCost::TComRdCost()
    4755{
     
    5765
    5866// Calculate RD functions
     67#if H_3D_VSO
     68Double TComRdCost::calcRdCost( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc )
     69#else
    5970Double TComRdCost::calcRdCost( UInt uiBits, UInt uiDistortion, Bool bFlag, DFunc eDFunc )
     71#endif
    6072{
    6173  Double dRdCost = 0.0;
     
    111123}
    112124
     125#if H_3D_VSO
     126Double TComRdCost::calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag, DFunc eDFunc )
     127#else
    113128Double TComRdCost::calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag, DFunc eDFunc )
     129#endif
    114130{
    115131  Double dRdCost = 0.0;
     
    219235  m_afpDistortFunc[27] = TComRdCost::xGetHADs;
    220236  m_afpDistortFunc[28] = TComRdCost::xGetHADs;
    221  
     237
     238#if H_3D_VSO
     239  // SAIT_VSO_EST_A0033
     240  m_afpDistortFunc[29]  = TComRdCost::xGetVSD;
     241  m_afpDistortFunc[30]  = TComRdCost::xGetVSD4;
     242  m_afpDistortFunc[31]  = TComRdCost::xGetVSD8;
     243  m_afpDistortFunc[32]  = TComRdCost::xGetVSD16;
     244  m_afpDistortFunc[33]  = TComRdCost::xGetVSD32;
     245  m_afpDistortFunc[34]  = TComRdCost::xGetVSD64;
     246  m_afpDistortFunc[35]  = TComRdCost::xGetVSD16N;
     247#endif
    222248#if !FIX203
    223249  m_puiComponentCostOriginP = NULL;
     
    230256#if !FIX203
    231257  m_iSearchLimit            = 0xdeaddead;
     258#endif
     259#if H_3D_VSO
     260  m_bUseVSO                 = false;
     261  m_uiVSOMode               = 0;
     262  m_fpDistortFuncVSO        = NULL;
     263  m_pcRenModel              = NULL;
     264
     265  // SAIT_VSO_EST_A0033
     266  m_bUseEstimatedVSD        = false;
    232267#endif
    233268}
     
    484519#endif
    485520}
     521#if H_3D_VSO
     522// SAIT_VSO_EST_A0033
     523UInt TComRdCost::getDistPartVSD( TComDataCU* pcCU, UInt uiPartOffset, Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight,  Bool bHAD, DFunc eDFunc )
     524{
     525  AOT( ( m_dDisparityCoeff <= 0 ) || ( m_dDisparityCoeff > 10 ) );
     526
     527  Pel* piVirRec  = m_pcVideoRecPicYuv->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiPartOffset);
     528  Pel* piVirOrg  = m_pcDepthPicYuv   ->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()+uiPartOffset);
     529  Int iVirStride = m_pcVideoRecPicYuv->getStride();   
     530
     531  DistParam cDtParam;
     532  setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam );
     533  cDtParam.pOrg       = piOrg;
     534  cDtParam.pCur       = piCur;
     535  cDtParam.pVirRec    = piVirRec;
     536  cDtParam.pVirOrg    = piVirOrg;
     537  cDtParam.iStrideVir = iVirStride;
     538  cDtParam.iStrideOrg = iOrgStride;
     539  cDtParam.iStrideCur = iCurStride;
     540  cDtParam.iStep      = 1;
     541
     542  cDtParam.bApplyWeight = false;
     543  cDtParam.uiComp       = 255;    // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed.
     544
     545  Dist dist = cDtParam.DistFunc( &cDtParam );
     546
     547  if ( m_bUseWVSO )   
     548  {
     549    Int iDWeight   = m_iDWeight   * m_iDWeight;
     550    Int iVSOWeight = m_iVSDWeight * m_iVSDWeight;
     551    Dist distDepth;
     552
     553    if ( !bHAD )
     554    {
     555      distDepth = (Dist) getDistPart( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight);
     556    }
     557    else
     558    {
     559      distDepth = (Dist) calcHAD( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight);
     560    }
     561
     562    dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight);
     563  }
     564  return dist;
     565
     566}
     567#endif
    486568
    487569#if RATE_CONTROL_LAMBDA_DOMAIN
     
    13591441  return ( uiSum );
    13601442}
     1443#if H_3D_VSO
     1444//SAIT_VSO_EST_A0033
     1445UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride,  Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y )
     1446{
     1447  Double dD;
     1448  Int iTemp;
     1449
     1450  dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff;
     1451
     1452  Double dTemp = ( 0.5 * fabs(dD) * ( abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x-1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x+1+y*iVirStride ] ) ) );
     1453  iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));
     1454
     1455  return (UInt) ( (iTemp*iTemp)>>1 );
     1456}
     1457
     1458UInt TComRdCost::xGetVSD( DistParam* pcDtParam )
     1459{
     1460  Pel* piOrg    = pcDtParam->pOrg;
     1461  Pel* piCur    = pcDtParam->pCur;
     1462  Pel* piVirRec = pcDtParam->pVirRec;
     1463  Pel* piVirOrg = pcDtParam->pVirOrg;
     1464  Int  iRows    = pcDtParam->iRows;
     1465  Int  iCols    = pcDtParam->iCols;
     1466  Int  iStrideOrg = pcDtParam->iStrideOrg;
     1467  Int  iStrideCur = pcDtParam->iStrideCur;
     1468  Int  iStrideVir = pcDtParam->iStrideVir;
     1469
     1470  UInt uiSum = 0;
     1471  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     1472
     1473  Int dDM;
     1474
     1475  for ( Int y = 0 ; y < iRows ; y++ )
     1476  {
     1477    for (Int x = 0; x < iCols; x++ )
     1478    {
     1479      dDM = (Int) ( piOrg[x  ] - piCur[x  ] );
     1480      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     1481    }
     1482    piOrg += iStrideOrg;
     1483    piCur += iStrideCur;
     1484  }
     1485
     1486  return ( uiSum );
     1487}
     1488
     1489UInt TComRdCost::xGetVSD4( DistParam* pcDtParam )
     1490{
     1491  Pel* piOrg   = pcDtParam->pOrg;
     1492  Pel* piCur   = pcDtParam->pCur;
     1493  Pel* piVirRec = pcDtParam->pVirRec;
     1494  Pel* piVirOrg = pcDtParam->pVirOrg;
     1495  Int  iRows   = pcDtParam->iRows;
     1496  Int  iStrideOrg = pcDtParam->iStrideOrg;
     1497  Int  iStrideCur = pcDtParam->iStrideCur;
     1498  Int  iStrideVir = pcDtParam->iStrideVir;
     1499
     1500  UInt uiSum = 0;
     1501  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     1502
     1503  Int dDM;
     1504
     1505  for ( Int y = 0 ; y < iRows ; y++ )
     1506  {
     1507    dDM = (Int) ( piOrg[0] - piCur[0] );  uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 0, y ) ) >> uiShift;
     1508    dDM = (Int) ( piOrg[1] - piCur[1] );  uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 1, y ) ) >> uiShift;
     1509    dDM = (Int) ( piOrg[2] - piCur[2] );  uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 2, y ) ) >> uiShift;
     1510    dDM = (Int) ( piOrg[3] - piCur[3] );  uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 3, y ) ) >> uiShift;
     1511
     1512    piOrg += iStrideOrg;
     1513    piCur += iStrideCur;
     1514  }
     1515
     1516  return ( uiSum );
     1517}
     1518
     1519UInt TComRdCost::xGetVSD8( DistParam* pcDtParam )
     1520{
     1521  Pel* piOrg   = pcDtParam->pOrg;
     1522  Pel* piCur   = pcDtParam->pCur;
     1523  Pel* piVirRec = pcDtParam->pVirRec;
     1524  Pel* piVirOrg = pcDtParam->pVirOrg;
     1525  Int  iRows   = pcDtParam->iRows;
     1526  Int  iStrideOrg = pcDtParam->iStrideOrg;
     1527  Int  iStrideCur = pcDtParam->iStrideCur;
     1528  Int  iStrideVir = pcDtParam->iStrideVir;
     1529
     1530  UInt uiSum = 0;
     1531  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     1532
     1533  Int dDM;
     1534
     1535  for ( Int y = 0 ; y < iRows ; y++ )
     1536  {
     1537    for (Int x = 0; x < 8; x++ )
     1538    {
     1539      dDM = (Int) ( piOrg[x] - piCur[x] );
     1540      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     1541    }
     1542    piOrg += iStrideOrg;
     1543    piCur += iStrideCur;
     1544  }
     1545
     1546  return ( uiSum );
     1547}
     1548
     1549UInt TComRdCost::xGetVSD16( DistParam* pcDtParam )
     1550{
     1551  Pel* piOrg   = pcDtParam->pOrg;
     1552  Pel* piCur   = pcDtParam->pCur;
     1553  Pel* piVirRec = pcDtParam->pVirRec;
     1554  Pel* piVirOrg = pcDtParam->pVirOrg;
     1555  Int  iRows   = pcDtParam->iRows;
     1556  Int  iStrideOrg = pcDtParam->iStrideOrg;
     1557  Int  iStrideCur = pcDtParam->iStrideCur;
     1558  Int  iStrideVir = pcDtParam->iStrideVir;
     1559
     1560  UInt uiSum = 0;
     1561  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     1562
     1563  Int dDM;
     1564
     1565  for ( Int y = 0 ; y < iRows ; y++ )
     1566  {
     1567    for (Int x = 0; x < 16; x++ )
     1568    {
     1569      dDM = (Int) ( piOrg[x] - piCur[x] );
     1570      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     1571    }
     1572    piOrg += iStrideOrg;
     1573    piCur += iStrideCur;
     1574  }
     1575
     1576  return ( uiSum );
     1577}
     1578
     1579UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam )
     1580{
     1581  Pel* piOrg   = pcDtParam->pOrg;
     1582  Pel* piCur   = pcDtParam->pCur;
     1583  Pel* piVirRec = pcDtParam->pVirRec;
     1584  Pel* piVirOrg = pcDtParam->pVirOrg;
     1585  Int  iRows   = pcDtParam->iRows;
     1586  Int  iCols   = pcDtParam->iCols;
     1587  Int  iStrideOrg = pcDtParam->iStrideOrg;
     1588  Int  iStrideCur = pcDtParam->iStrideCur;
     1589  Int  iStrideVir = pcDtParam->iStrideVir;
     1590
     1591  UInt uiSum = 0;
     1592  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     1593
     1594  Int dDM;
     1595
     1596  for ( Int y = 0 ; y < iRows ; y++ )
     1597  {
     1598    for (Int x = 0; x < iCols; x+=16 )
     1599    {
     1600      for ( Int k = 0 ; k < 16 ; k++ )
     1601      {
     1602        dDM = (Int) ( piOrg[x+k] - piCur[x+k] );
     1603        uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x+k, y ) >> uiShift;
     1604      }
     1605    }
     1606    piOrg += iStrideOrg;
     1607    piCur += iStrideCur;
     1608  }
     1609
     1610  return ( uiSum );
     1611}
     1612
     1613UInt TComRdCost::xGetVSD32( DistParam* pcDtParam )
     1614{
     1615  Pel* piOrg   = pcDtParam->pOrg;
     1616  Pel* piCur   = pcDtParam->pCur;
     1617  Pel* piVirRec = pcDtParam->pVirRec;
     1618  Pel* piVirOrg = pcDtParam->pVirOrg;
     1619  Int  iRows   = pcDtParam->iRows;
     1620  Int  iStrideOrg = pcDtParam->iStrideOrg;
     1621  Int  iStrideCur = pcDtParam->iStrideCur;
     1622  Int  iStrideVir = pcDtParam->iStrideVir;
     1623
     1624  UInt uiSum = 0;
     1625  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     1626
     1627  Int dDM;
     1628
     1629  for ( Int y = 0 ; y < iRows ; y++ )
     1630  {
     1631    for (Int x = 0; x < 32 ; x++ )
     1632    {
     1633      dDM = (Int) ( piOrg[x] - piCur[x] );
     1634      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     1635    }
     1636    piOrg += iStrideOrg;
     1637    piCur += iStrideCur;
     1638  }
     1639
     1640  return ( uiSum );
     1641}
     1642
     1643UInt TComRdCost::xGetVSD64( DistParam* pcDtParam )
     1644{
     1645  Pel* piOrg      = pcDtParam->pOrg;
     1646  Pel* piCur      = pcDtParam->pCur;
     1647  Pel* piVirRec   = pcDtParam->pVirRec;
     1648  Pel* piVirOrg   = pcDtParam->pVirOrg;
     1649  Int  iRows      = pcDtParam->iRows;
     1650  Int  iStrideOrg = pcDtParam->iStrideOrg;
     1651  Int  iStrideCur = pcDtParam->iStrideCur;
     1652  Int  iStrideVir = pcDtParam->iStrideVir;
     1653
     1654  UInt uiSum = 0;
     1655  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     1656
     1657  Int dDM;
     1658
     1659  for ( Int y = 0 ; y < iRows ; y++ )
     1660  {
     1661    for (Int x = 0; x < 64; x++ )
     1662    {
     1663      dDM = (Int) ( piOrg[x] - piCur[x] );
     1664      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     1665    }
     1666    piOrg += iStrideOrg;
     1667    piCur += iStrideCur;
     1668  }
     1669
     1670  return ( uiSum );
     1671}
     1672
     1673#endif
    13611674
    13621675// --------------------------------------------------------------------------------------------------------------------
     
    19892302  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
    19902303}
     2304#if H_3D_VSO
     2305Void TComRdCost::setLambdaVSO( Double dLambdaVSO )
     2306{
     2307  m_dLambdaVSO           = dLambdaVSO;
     2308  m_dSqrtLambdaVSO       = sqrt(m_dLambdaVSO);
     2309  m_uiLambdaMotionSADVSO = (UInt)floor(65536.0 *       m_dSqrtLambdaVSO);
     2310  m_uiLambdaMotionSSEVSO = (UInt)floor(65536.0 *       m_dLambdaVSO    );
     2311}
     2312
     2313Dist TComRdCost::xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD )
     2314{
     2315  AOT(bSAD);
     2316#if H_3D_VSO_EARLY_SKIP
     2317  RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur, piOrg, iOrgStride); 
     2318#else
     2319  RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur ); 
     2320#endif
     2321
     2322  RMDist iDistMin = (RMDist) RDO_DIST_MIN;
     2323  iDistMin = m_bAllowNegDist ? RDO_DIST_MIN : 0;
     2324 
     2325  iDist = std::min( iDist, (RMDist) RDO_DIST_MAX);
     2326  iDist = std::max( iDist, iDistMin);
     2327  return (Dist) iDist;
     2328}
     2329
     2330
     2331Dist TComRdCost::getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHAD )
     2332{
     2333  assert( m_bUseVSO ); 
     2334  assert( this->m_fpDistortFuncVSO != 0 );
     2335
     2336  Int iPosX;
     2337  Int iPosY;
     2338 
     2339  pcCU->getPosInPic( uiAbsPartIndex, iPosX, iPosY );
     2340   
     2341  Dist dist = (this->*m_fpDistortFuncVSO) ( iPosX, iPosY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, bHAD ); 
     2342 
     2343  if ( m_bUseWVSO )   
     2344  {
     2345    Int iDWeight   = m_iDWeight   * m_iDWeight;
     2346    Int iVSOWeight = m_iVSOWeight * m_iVSOWeight;
     2347    Dist distDepth;
     2348   
     2349    if ( !bHAD )
     2350    {
     2351       distDepth = (Dist) getDistPart( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight);
     2352    }
     2353    else
     2354    {
     2355       distDepth = (Dist) calcHAD( g_bitDepthY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight);
     2356    }
     2357   
     2358    dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight);
     2359  }
     2360  return dist;
     2361};
     2362
     2363
     2364Void TComRdCost::setVSOMode( UInt uiIn )
     2365{
     2366  m_uiVSOMode = uiIn;
     2367  switch (m_uiVSOMode )
     2368  {
     2369  case   4:
     2370    m_fpDistortFuncVSO = &TComRdCost::xGetDistVSOMode4;
     2371    break;
     2372  default:
     2373    assert(0);
     2374    break;
     2375  }
     2376}
     2377
     2378
     2379Double TComRdCost::calcRdCostVSO( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc )
     2380{
     2381  assert( m_bUseLambdaScaleVSO );   
     2382
     2383  Double dRdCost = 0.0;
     2384  Double dLambda = 0.0;   
     2385
     2386  switch ( eDFunc )
     2387  {
     2388  case DF_SSE:
     2389    assert(0);
     2390    break;
     2391  case DF_SAD:
     2392    dLambda = (Double)m_uiLambdaMotionSADVSO;
     2393    break;
     2394  case DF_DEFAULT:
     2395    dLambda =         m_dLambdaVSO;
     2396    break;
     2397  case DF_SSE_FRAME:
     2398    dLambda =         m_dFrameLambdaVSO;
     2399    break;
     2400  default:
     2401    assert (0);
     2402    break;
     2403  }
     2404
     2405  if (bFlag)
     2406  {
     2407    // Intra8x8, Intra4x4 Block only...
     2408#if SEQUENCE_LEVEL_LOSSLESS
     2409    dRdCost = (Double)(uiBits);
     2410#else
     2411    dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda));
     2412#endif
     2413  }
     2414  else
     2415  {
     2416    if (eDFunc == DF_SAD)
     2417    {
     2418      dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16));
     2419      dRdCost = (Double)(Dist)floor(dRdCost);
     2420    }
     2421    else
     2422    {
     2423#if SEQUENCE_LEVEL_LOSSLESS
     2424      dRdCost = (Double)(uiBits);
     2425#else
     2426      dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)));
     2427      dRdCost = (Double)(Dist)floor(dRdCost);
     2428#endif
     2429    }
     2430  }
     2431
     2432  return dRdCost;
     2433}
     2434
     2435Void TComRdCost::setRenModelData( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight )
     2436{
     2437  UInt iBlkX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]];
     2438  UInt iBlkY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]];
     2439
     2440  Int iStartPosX = iBlkX + pcCU->getCUPelX();
     2441  Int iStartPosY = iBlkY + pcCU->getCUPelY();
     2442
     2443  m_pcRenModel->setData( iStartPosX, iStartPosY, iBlkWidth, iBlkHeight, iStride, piData );
     2444}
     2445
     2446Void TComRdCost::setAllowNegDist( Bool bAllowNegDist )
     2447{
     2448  m_bAllowNegDist = bAllowNegDist;
     2449}
     2450#endif
    19912451
    19922452//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComRdCost.h

    r324 r446  
    4646#include "TComSlice.h"
    4747#include "TComRdCostWeightPrediction.h"
     48#if H_3D
     49#include "../TLibRenderer/TRenModel.h"
     50#endif
    4851
    4952//! \ingroup TLibCommon
     
    5457class DistParam;
    5558class TComPattern;
     59#if H_3D
     60class TComRdCost;
     61#endif
    5662
    5763// ====================================================================================================================
     
    6268typedef UInt (*FpDistFunc) (DistParam*);
    6369
     70#if H_3D
     71#if H_3D_VSO
     72typedef Dist (TComRdCost::*FpDistFuncVSO) ( Int, Int, Pel*, Int, Pel*, Int, UInt, UInt, Bool );
     73#endif
     74#endif
    6475// ====================================================================================================================
    6576// Class definition
     
    7485  Int   iStrideOrg;
    7586  Int   iStrideCur;
     87#if H_3D_VSO
     88  // SAIT_VSO_EST_A0033
     89  Pel*  pVirRec;
     90  Pel*  pVirOrg;
     91  Int   iStrideVir;
     92#endif
    7693  Int   iRows;
    7794  Int   iCols;
     
    107124    bUseNSHAD = false;
    108125#endif
     126#if H_3D_VSO
     127    // SAIT_VSO_EST_A0033
     128    pVirRec = NULL;
     129    pVirOrg = NULL;
     130    iStrideVir = 0;
     131#endif
    109132  }
    110133};
     
    134157  UInt                    m_uiLambdaMotionSSE;
    135158  Double                  m_dFrameLambda;
     159#if H_3D_VSO
     160  // SAIT_VSO_EST_A0033
     161  static Double           m_dDisparityCoeff;
     162#endif
    136163 
    137164  // for motion cost
     
    153180  TComRdCost();
    154181  virtual ~TComRdCost();
    155  
     182
     183#if H_3D_VSO
     184  Double  calcRdCost  ( UInt   uiBits, Dist   uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
     185  Double  calcRdCost64( UInt64 uiBits, Dist64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
     186#else
    156187  Double  calcRdCost  ( UInt   uiBits, UInt   uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
    157188  Double  calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
     189#endif
     190
    158191 
    159192#if WEIGHTED_CHROMA_DISTORTION
     
    165198 
    166199  Double  getSqrtLambda ()   { return m_sqrtLambda; }
     200#if H_3D_VSO
     201  // SAIT_VSO_EST_A0033
     202  Void    setDisparityCoeff( Double dDisparityCoeff ) { m_dDisparityCoeff = dDisparityCoeff; }
     203  Double  getDisparityCoeff()                         { return m_dDisparityCoeff; }
     204#endif
    167205
    168206#if RATE_CONTROL_LAMBDA_DOMAIN
     
    239277  static UInt xGetSAD16N        ( DistParam* pcDtParam );
    240278 
     279#if H_3D_VSO
     280  static UInt xGetVSD           ( DistParam* pcDtParam );
     281  static UInt xGetVSD4          ( DistParam* pcDtParam );
     282  static UInt xGetVSD8          ( DistParam* pcDtParam );
     283  static UInt xGetVSD16         ( DistParam* pcDtParam );
     284  static UInt xGetVSD32         ( DistParam* pcDtParam );
     285  static UInt xGetVSD64         ( DistParam* pcDtParam );
     286  static UInt xGetVSD16N        ( DistParam* pcDtParam );
     287#endif
     288
    241289#if AMP_SAD
    242290  static UInt xGetSAD12         ( DistParam* pcDtParam );
     
    267315  UInt   getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height );
    268316#endif
     317
     318#if H_3D_VSO
     319  // SAIT_VSO_EST_A0033
     320  UInt        getDistPartVSD( TComDataCU* pcCu, UInt uiPartOffset, Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bHad, DFunc eDFunc = DF_VSD);
     321  static UInt getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride,  Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y );
     322
     323private:
     324  Double                  m_dLambdaVSO;
     325  Double                  m_dSqrtLambdaVSO;
     326  UInt                    m_uiLambdaMotionSADVSO;
     327  UInt                    m_uiLambdaMotionSSEVSO;
     328  Double                  m_dFrameLambdaVSO;
     329  Bool                    m_bAllowNegDist;
     330  Bool                    m_bUseVSO;
     331  Bool                    m_bUseLambdaScaleVSO;
     332  UInt                    m_uiVSOMode;
     333
     334  FpDistFuncVSO           m_fpDistortFuncVSO;
     335  TRenModel*              m_pcRenModel;
     336
     337
     338  // SAIT_VSO_EST_A0033
     339  TComPicYuv *            m_pcVideoRecPicYuv;
     340  TComPicYuv *            m_pcDepthPicYuv;
     341  Bool                    m_bUseEstimatedVSD;
     342
     343  // LGE_WVSO_A0119
     344  Int                     m_iDWeight;
     345  Int                     m_iVSOWeight;
     346  Int                     m_iVSDWeight;
     347  Bool                    m_bUseWVSO;
     348
     349public:
     350
     351  Void    setRenModel       ( TRenModel* pcRenModel ) { m_pcRenModel = pcRenModel; }
     352  TRenModel* getRenModel    ( )                       { return m_pcRenModel; }
     353  Void    setRenModelData   ( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight );
     354  Void    setLambdaVSO      ( Double dLambda );
     355  Void    setFrameLambdaVSO ( Double dLambda ) { m_dFrameLambdaVSO = dLambda; };
     356
     357
     358  Void    setUseVSO ( Bool bIn )         { m_bUseVSO = bIn; };
     359  Bool    getUseVSO ( )                  { return m_bUseVSO;};
     360
     361  Bool    getUseRenModel ( )             { return (m_bUseVSO && m_uiVSOMode == 4); };
     362  Void    setUseLambdaScaleVSO(Bool bIn) { m_bUseLambdaScaleVSO = bIn; };
     363  Bool    getUseLambdaScaleVSO( )        { return m_bUseLambdaScaleVSO; };
     364
     365  Void    setVSOMode( UInt uiIn);
     366  UInt    getVSOMode( )                  { return m_uiVSOMode; }
     367  Void    setAllowNegDist ( Bool bAllowNegDist );
     368
     369  Double  getSqrtLambdaVSO ()   { return m_dSqrtLambdaVSO; }
     370  Double  getLambdaVSO ()       { return m_dLambdaVSO; }
     371
     372  Dist   getDistPartVSO( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD );
     373  Double calcRdCostVSO ( UInt   uiBits, Dist   uiDistortion, Bool bFlag = false, DFunc eDFunc = DF_DEFAULT );
     374
     375  // SAIT_VSO_EST_A0033
     376  Bool    getUseEstimatedVSD( )           { return m_bUseEstimatedVSD; };
     377  Void    setUseEstimatedVSD( Bool bIn )  { m_bUseEstimatedVSD = bIn; };
     378
     379  TComPicYuv* getVideoRecPicYuv ()                               { return m_pcVideoRecPicYuv; };
     380  Void        setVideoRecPicYuv ( TComPicYuv* pcVideoRecPicYuv ) { m_pcVideoRecPicYuv = pcVideoRecPicYuv; };
     381  TComPicYuv* getDepthPicYuv    ()                               { return m_pcDepthPicYuv; };
     382  Void        setDepthPicYuv    ( TComPicYuv* pcDepthPicYuv )    { m_pcDepthPicYuv = pcDepthPicYuv; };
     383
     384  // LGE_WVSO_A0119
     385  Void    setUseWVSO ( Bool bIn )         { m_bUseWVSO = bIn; };
     386  Bool    getUseWVSO ( )                  { return m_bUseWVSO;};
     387  Void    setDWeight   ( Int iDWeight   ) { m_iDWeight = iDWeight; };
     388  Int     getDWeight   ()                 { return m_iDWeight; };
     389  Void    setVSOWeight ( Int iVSOWeight ) { m_iVSOWeight = iVSOWeight; };
     390  Int     getVSOWeight ()                 { return m_iVSOWeight; };
     391  Void    setVSDWeight ( Int iVSDWeight ) { m_iVSDWeight = iVSDWeight; };
     392  Int     getVSDWeight ()                 { return m_iVSDWeight; };
     393
     394private:
     395  Dist xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD );
     396
     397#endif // H_3D_VSO
     398
    269399};// END CLASS DEFINITION TComRdCost
    270400
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComRom.cpp

    r438 r446  
    6262  g_aucConvertToBit[ i ] = c;
    6363 
    64   // g_auiFrameScanXY[ g_aucConvertToBit[ transformSize ] ]: zigzag scan array for transformSize
    6564  c=2;
    6665  for ( i=0; i<MAX_CU_DEPTH; i++ )
     
    7776Void destroyROM()
    7877{
    79   Int i;
    80  
    81   for ( i=0; i<MAX_CU_DEPTH; i++ )
     78  for (Int i=0; i<MAX_CU_DEPTH; i++ )
    8279  {
    8380    delete[] g_auiSigLastScan[0][i];
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComSlice.cpp

    r438 r446  
    4949, m_iPOC                          ( 0 )
    5050, m_iLastIDR                      ( 0 )
    51 , m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR )
     51, m_eNalUnitType                  ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
    5252, m_eSliceType                    ( I_SLICE )
    5353, m_iSliceQp                      ( 0 )
     
    6060, m_deblockingFilterBetaOffsetDiv2 ( 0 )
    6161, m_deblockingFilterTcOffsetDiv2   ( 0 )
     62#if !L0034_COMBINED_LIST_CLEANUP
    6263, m_bRefPicListModificationFlagLC ( false )
    6364, m_bRefPicListCombinationFlag    ( false )
     65#endif
    6466, m_bCheckLDC                     ( false )
    6567, m_iSliceQpDelta                 ( 0 )
     
    7981, m_dLambda                       ( 0.0 )
    8082#endif
     83#if !L0034_COMBINED_LIST_CLEANUP
    8184, m_bNoBackPredFlag               ( false )
     85#endif
    8286, m_uiTLayer                      ( 0 )
    8387, m_bTLayerSwitchingFlag          ( false )
     
    107111, m_viewId                        (0)
    108112#if H_3D
     113, m_viewIndex                     (0)
    109114, m_isDepth                       (false)
    110115#endif
    111116#endif
    112117{
     118#if L0034_COMBINED_LIST_CLEANUP
     119  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = 0;
     120#else
    113121  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
     122#endif
    114123 
    115124  initEqualRef();
    116125 
     126#if L0034_COMBINED_LIST_CLEANUP
     127  for ( Int idx = 0; idx < MAX_NUM_REF; idx++ )
     128  {
     129    m_list1IdxToList0Idx[idx] = -1;
     130  }
     131#else
    117132  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF_LC; iNumCount++)
    118133  {
     
    124139    m_iRefIdxOfL1FromRefIdxOfL0[iNumCount] = -1;
    125140  }   
     141#endif
    126142  for(Int iNumCount = 0; iNumCount < MAX_NUM_REF; iNumCount++)
    127143  {
     
    135151#endif
    136152  }
    137   resetWpScaling(m_weightPredTable);
     153  resetWpScaling();
    138154  initWpAcDcParam();
    139155  m_saoEnabledFlag = false;
     
    156172  m_colRefIdx = 0;
    157173  initEqualRef();
     174#if !L0034_COMBINED_LIST_CLEANUP
    158175  m_bNoBackPredFlag = false;
    159176  m_bRefPicListCombinationFlag = false;
    160177  m_bRefPicListModificationFlagLC = false;
     178#endif
    161179  m_bCheckLDC = false;
    162180  m_iSliceQpDeltaCb = 0;
    163181  m_iSliceQpDeltaCr = 0;
    164182
     183#if !L0034_COMBINED_LIST_CLEANUP
    165184  m_aiNumRefIdx[REF_PIC_LIST_C]      = 0;
     185#endif
    166186
    167187  m_maxNumMergeCand = MRG_MAX_NUM_CANDS;
     
    177197Bool TComSlice::getRapPicFlag()
    178198{
    179   return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR
     199  return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    180200      || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
    181201      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    182       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
    183       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
     202      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     203      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    184204      || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA;
    185205}
     
    251271
    252272
    253 TComPic* TComSlice::xGetLongTermRefPic (TComList<TComPic*>& rcListPic,
    254                                         Int                 poc)
     273TComPic* TComSlice::xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb)
    255274{
    256275  TComList<TComPic*>::iterator  iterPic = rcListPic.begin(); 
    257276  TComPic*                      pcPic = *(iterPic);
    258277  TComPic*                      pcStPic = pcPic;
     278 
     279  Int pocCycle = 1 << getSPS()->getBitsForPOC();
     280  if (!pocHasMsb)
     281  {
     282    poc = poc % pocCycle;
     283  }
     284 
    259285  while ( iterPic != rcListPic.end() )
    260286  {
    261287    pcPic = *(iterPic);
    262     if(pcPic && (pcPic->getPOC()%(1<<getSPS()->getBitsForPOC())) == (poc%(1<<getSPS()->getBitsForPOC())))
     288    if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->getSlice( 0 )->isReferenced())
     289    {
     290      Int picPoc = pcPic->getPOC();
     291      if (!pocHasMsb)
     292      {
     293        picPoc = picPoc % pocCycle;
     294      }
     295     
     296      if (poc == picPoc)
    263297    {
    264298      if(pcPic->getIsLongTerm())
     
    272306      break;
    273307    }
     308    }
    274309
    275310    iterPic++;
    276311  }
     312 
    277313  return  pcStPic;
    278314}
     
    293329}
    294330
     331#if L0034_COMBINED_LIST_CLEANUP
     332Void TComSlice::setList1IdxToList0Idx()
     333{
     334  Int idxL0, idxL1;
     335  for ( idxL1 = 0; idxL1 < getNumRefIdx( REF_PIC_LIST_1 ); idxL1++ )
     336  {
     337    m_list1IdxToList0Idx[idxL1] = -1;
     338    for ( idxL0 = 0; idxL0 < getNumRefIdx( REF_PIC_LIST_0 ); idxL0++ )
     339    {
     340      if ( m_apcRefPicList[REF_PIC_LIST_0][idxL0]->getPOC() == m_apcRefPicList[REF_PIC_LIST_1][idxL1]->getPOC() )
     341      {
     342        m_list1IdxToList0Idx[idxL1] = idxL0;
     343        break;
     344      }
     345    }
     346  }
     347}
     348#else
    295349Void TComSlice::generateCombinedList()
    296350{
     
    365419  }
    366420}
     421#endif
    367422
    368423#if H_MV
    369 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer )
     424Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer , Bool checkNumPocTotalCurr)
     425#else
     426#if FIX1071
     427Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
    370428#else
    371429Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
    372430#endif
    373 {
    374   if (m_eSliceType == I_SLICE)
    375   {
    376     ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    377     ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     431#endif
     432{
     433#if FIX1071
     434  if (!checkNumPocTotalCurr)
     435#endif
     436  {
     437    if (m_eSliceType == I_SLICE)
     438    {
     439      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     440      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     441     
     442      return;
     443    }
    378444   
    379     return;
    380   }
    381  
    382445#if !H_MV
    383   m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    384   m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
    385 #endif
     446    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
     447    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     448#endif
     449  }
    386450
    387451  TComPic*  pcRefPic= NULL;
     
    397461#endif
    398462  Int i;
    399 
    400463  for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
    401464  {
     
    410473    }
    411474  }
     475 
    412476  for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)
    413477  {
     
    422486    }
    423487  }
     488 
    424489  for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)
    425490  {
    426491    if(m_pcRPS->getUsed(i))
    427492    {
    428       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     493      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    429494      pcRefPic->setIsLongTerm(1);
    430495      pcRefPic->getPicYuvRec()->extendPicBorder();
     
    434499    if(pcRefPic==NULL)
    435500    {
    436       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i));
     501      pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    437502    }
    438503    pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
     
    448513  Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    449514#endif
    450 
    451   {
    452     Int cIdx = 0;
    453     for ( i=0; i<NumPocStCurr0; i++, cIdx++)
    454     {
    455       rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
    456     }
    457     for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    458     {
    459       rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
    460     }
    461     for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
    462     {
    463       rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
    464     }
     515#if FIX1071
     516  if (checkNumPocTotalCurr)
     517  {
     518    // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
    465519#if H_MV
    466     for ( i=0; i<numDirectRefLayers;  i++, cIdx++)
    467     {
    468       if( cIdx <= MAX_NUM_REF )
    469       {
    470         rpsCurrList0[cIdx] = refPicSetInterLayer[i];
    471       }
    472     }
    473 #endif
    474   }
     520    // – If nuh_layer_id is equal to 0 and the current picture is a BLA picture or a CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     521    // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     522    if ( getRapPicFlag() && m_layerId == 0 )
     523#else
     524    // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     525    // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     526    if (getRapPicFlag())
     527#endif
     528    {
     529      assert(numPocTotalCurr == 0);
     530    }
     531
     532    if (m_eSliceType == I_SLICE)
     533    {
     534      ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     535      ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
     536     
     537      return;
     538    }
     539   
     540    assert(numPocTotalCurr != 0);
     541   
     542    m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
     543    m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
     544  }
     545#endif
     546
     547  Int cIdx = 0;
     548  for ( i=0; i<NumPocStCurr0; i++, cIdx++)
     549  {
     550    rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
     551  }
     552  for ( i=0; i<NumPocStCurr1; i++, cIdx++)
     553  {
     554    rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
     555  }
     556  for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
     557  {
     558    rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
     559  }
     560#if H_MV
     561  for ( i=0; i<numDirectRefLayers;  i++, cIdx++)
     562  {
     563    if( cIdx <= MAX_NUM_REF )
     564    {
     565      rpsCurrList0[cIdx] = refPicSetInterLayer[i];
     566    }
     567  }
     568#endif
    475569
    476570  if (m_eSliceType==B_SLICE)
    477571  {
    478     Int cIdx = 0;
     572    cIdx = 0;
    479573    for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    480574    {
     
    524618}
    525619
     620#if H_MV
     621// Temporary fix for FIX1071 should be removed later
     622Int TComSlice::getNumRpsCurrTempList( TComReferencePictureSet* rps /* = 0 */)
     623#else
    526624Int TComSlice::getNumRpsCurrTempList()
    527 {
     625#endif
     626{
     627
    528628  Int numRpsCurrTempList = 0;
    529629
     
    532632    return 0;
    533633  }
     634#if H_MV
     635// Temporary fix for FIX1071 should be removed later
     636  if (rps == NULL)
     637  {
     638    rps = m_pcRPS;
     639  }
     640
     641  for(UInt i=0; i < rps->getNumberOfNegativePictures()+ rps->getNumberOfPositivePictures() + rps->getNumberOfLongtermPictures(); i++)
     642  {
     643    if(rps->getUsed(i))
     644#else
    534645  for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
    535646  {
    536647    if(m_pcRPS->getUsed(i))
     648#endif
    537649    {
    538650      numRpsCurrTempList++;
     
    558670  }
    559671}
     672#if H_3D
     673Void TComSlice::setCamparaSlice( Int** aaiScale, Int** aaiOffset )
     674
     675  if( m_pcSPS->hasCamParInSliceHeader() )
     676  {   
     677    for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < m_viewIndex; uiBaseViewIndex++ )
     678    {
     679      m_aaiCodedScale [ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][     m_viewIndex ];
     680      m_aaiCodedScale [ 1 ][ uiBaseViewIndex ] = aaiScale [     m_viewIndex ][ uiBaseViewIndex ];
     681      m_aaiCodedOffset[ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][     m_viewIndex ];
     682      m_aaiCodedOffset[ 1 ][ uiBaseViewIndex ] = aaiOffset[     m_viewIndex ][ uiBaseViewIndex ];
     683    }
     684  }
     685}
     686#endif
    560687
    561688Void TComSlice::checkColRefIdx(UInt curSliceIdx, TComPic* pic)
     
    585712}
    586713
    587 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA)
     714Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic)
    588715{
    589716  for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++)
     
    598725    if(pocCRA < MAX_UINT && getPOC() > pocCRA)
    599726    {
     727      if (!pReferencePictureSet->getCheckLTMSBPresent(i))
     728      {
     729        assert(xGetLongTermRefPic(rcListPic, pReferencePictureSet->getPOC(i), false)->getPOC() >= pocCRA);
     730      }
     731      else
     732      {
    600733      assert(pReferencePictureSet->getPOC(i) >= pocCRA);
    601734    }
    602735  }
    603   if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found
     736  }
     737  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP ) // IDR picture found
    604738  {
    605739    pocCRA = getPOC();
     
    611745    prevRAPisBLA = false;
    612746  }
    613   else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    614          || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     747  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     748         || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    615749         || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) // BLA picture found
    616750  {
     
    643777  Int pocCurr = getPOC();
    644778
    645   if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    646     || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     779  if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     780    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    647781    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    648     || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR
     782    || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    649783    || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )  // IDR or BLA picture
    650784  {
     
    658792      iterPic++;
    659793    }
    660     if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    661       || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     794    if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     795      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    662796      || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )
    663797    {
     
    673807      {
    674808        rpcPic = *(iterPic);
    675         if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA) rpcPic->getSlice(0)->setReferenced(false);
     809        if (rpcPic->getPOC() != pocCurr && rpcPic->getPOC() != pocCRA)
     810        {
     811          rpcPic->getSlice(0)->setReferenced(false);
     812        }
    676813        iterPic++;
    677814      }
     
    707844  m_deblockingFilterTcOffsetDiv2 = pSrc->m_deblockingFilterTcOffsetDiv2;
    708845 
     846#if L0034_COMBINED_LIST_CLEANUP
     847  for (i = 0; i < 2; i++)
     848#else
    709849  for (i = 0; i < 3; i++)
     850#endif
    710851  {
    711852    m_aiNumRefIdx[i]     = pSrc->m_aiNumRefIdx[i];
    712853  }
    713854
     855#if L0034_COMBINED_LIST_CLEANUP
     856  for (i = 0; i < MAX_NUM_REF; i++)
     857  {
     858    m_list1IdxToList0Idx[i] = pSrc->m_list1IdxToList0Idx[i];
     859  }
     860#else
    714861  for (i = 0; i < 2; i++)
    715862  {
     
    728875  m_bRefPicListModificationFlagLC = pSrc->m_bRefPicListModificationFlagLC;
    729876  m_bRefPicListCombinationFlag    = pSrc->m_bRefPicListCombinationFlag;
     877#endif
    730878  m_bCheckLDC             = pSrc->m_bCheckLDC;
    731879  m_iSliceQpDelta        = pSrc->m_iSliceQpDelta;
     
    785933  }
    786934
     935#if !L0034_COMBINED_LIST_CLEANUP
    787936  m_bNoBackPredFlag      = pSrc->m_bNoBackPredFlag;
     937#endif
    788938  m_uiTLayer                      = pSrc->m_uiTLayer;
    789939  m_bTLayerSwitchingFlag          = pSrc->m_bTLayerSwitchingFlag;
     
    819969
    820970Int TComSlice::m_prevPOC = 0;
     971
    821972/** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag.
    822973 * \param uiTLayer Temporal layer ID of the current slice
     
    8791030  Int i, isReference;
    8801031
    881   Int j = 0;
    8821032  // loop through all pictures in the reference picture buffer
    8831033  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
    8841034  while ( iterPic != rcListPic.end())
    8851035  {
    886     j++;
    8871036    rpcPic = *(iterPic++);
     1037
     1038    if(!rpcPic->getSlice( 0 )->isReferenced())
     1039    {
     1040      continue;
     1041    }
    8881042
    8891043    isReference = 0;
     
    9241078    {           
    9251079      rpcPic->getSlice( 0 )->setReferenced( false );   
     1080      rpcPic->setUsedByCurr(0);
    9261081      rpcPic->setIsLongTerm(0);
    9271082    }
     
    9291084    assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getUsedByCurr()==0||rpcPic->getTLayer()<=this->getTLayer());
    9301085    //check that pictures of higher or equal temporal layer are not in the RPS if the current picture is a TSA picture
    931     if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)
     1086    if(this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R || this->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N)
    9321087    {
    9331088      assert(rpcPic->getSlice( 0 )->isReferenced()==0||rpcPic->getTLayer()<this->getTLayer());
    9341089    }
    935 
    9361090    //check that pictures marked as temporal layer non-reference pictures are not used for reference
    9371091    if(rpcPic->getPicSym()->getSlice(0)->getPOC() != this->getPOC() && rpcPic->getTLayer()==this->getTLayer())
     
    9471101{
    9481102  TComPic* rpcPic;
    949   Int i, isAvailable, j;
     1103  Int i, isAvailable;
    9501104  Int atLeastOneLost = 0;
    9511105  Int atLeastOneRemoved = 0;
     
    9561110  for(i=pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i<pReferencePictureSet->getNumberOfPictures();i++)
    9571111  {
    958     j = 0;
    9591112    isAvailable = 0;
    9601113    // loop through all pictures in the reference picture buffer
     
    9621115    while ( iterPic != rcListPic.end())
    9631116    {
    964       j++;
    9651117      rpcPic = *(iterPic++);
    9661118      if(pReferencePictureSet->getCheckLTMSBPresent(i)==true)
     
    9851137      while ( iterPic != rcListPic.end())
    9861138      {
    987         j++;
    9881139        rpcPic = *(iterPic++);
    9891140
    990         if((rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == (this->getPOC() + pReferencePictureSet->getDeltaPOC(i))%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())
     1141        Int pocCycle = 1 << rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     1142        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC();
     1143        Int refPoc = pReferencePictureSet->getPOC(i);
     1144        if (!pReferencePictureSet->getCheckLTMSBPresent(i))
     1145        {
     1146          curPoc = curPoc % pocCycle;
     1147          refPoc = refPoc % pocCycle;
     1148        }
     1149       
     1150        if (rpcPic->getSlice(0)->isReferenced() && curPoc == refPoc)
    9911151        {
    9921152          isAvailable = 1;
     
    10261186  for(i=0;i<pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures();i++)
    10271187  {
    1028     j = 0;
    10291188    isAvailable = 0;
    10301189    // loop through all pictures in the reference picture buffer
     
    10321191    while ( iterPic != rcListPic.end())
    10331192    {
    1034       j++;
    10351193      rpcPic = *(iterPic++);
    10361194
     
    10491207        {
    10501208          if(printErrors)
     1209          {
    10511210            printf("\nShort-term reference picture with POC = %3d seems to have been removed or not correctly decoded.", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
     1211          }
    10521212          atLeastOneRemoved = 1;
    10531213        }
     
    10551215        {
    10561216          if(printErrors)
     1217          {
    10571218            printf("\nShort-term reference picture with POC = %3d is lost or not correctly decoded!", this->getPOC() + pReferencePictureSet->getDeltaPOC(i));
     1219          }
    10581220          atLeastOneLost = 1;
    10591221          iPocLost=this->getPOC() + pReferencePictureSet->getDeltaPOC(i);
     
    12011363 * \returns Void
    12021364 */
    1203 Void  TComSlice::resetWpScaling(wpScalingParam  wp[2][MAX_NUM_REF][3])
     1365Void  TComSlice::resetWpScaling()
    12041366{
    12051367  for ( Int e=0 ; e<2 ; e++ )
     
    12091371      for ( Int yuv=0 ; yuv<3 ; yuv++ )
    12101372      {
    1211         wpScalingParam  *pwp = &(wp[e][i][yuv]);
     1373        wpScalingParam  *pwp = &(m_weightPredTable[e][i][yuv]);
    12121374        pwp->bPresentFlag      = false;
    12131375        pwp->uiLog2WeightDenom = 0;
     
    12251387Void  TComSlice::initWpScaling()
    12261388{
    1227   initWpScaling(m_weightPredTable);
    1228 }
    1229 
    1230 /** set WP tables
    1231  * \param wpScalingParam
    1232  * \returns Void
    1233  */
    1234 Void  TComSlice::initWpScaling(wpScalingParam  wp[2][MAX_NUM_REF][3])
    1235 {
    12361389  for ( Int e=0 ; e<2 ; e++ )
    12371390  {
     
    12401393      for ( Int yuv=0 ; yuv<3 ; yuv++ )
    12411394      {
    1242         wpScalingParam  *pwp = &(wp[e][i][yuv]);
    1243         if ( !pwp->bPresentFlag ) {
     1395        wpScalingParam  *pwp = &(m_weightPredTable[e][i][yuv]);
     1396        if ( !pwp->bPresentFlag )
     1397        {
    12441398          // Inferring values not present :
    12451399          pwp->iWeight = (1 << pwp->uiLog2WeightDenom);
     
    12751429, m_cprmsPresentFlag          (NULL)
    12761430{
    1277 
    12781431  for( Int i = 0; i < MAX_TLAYER; i++)
    12791432  {
    12801433    m_numReorderPics[i] = 0;
     1434#if L0323_DPB
     1435    m_uiMaxDecPicBuffering[i] = 1;
     1436#else
    12811437    m_uiMaxDecPicBuffering[i] = 0;
     1438#endif
    12821439    m_uiMaxLatencyIncrease[i] = 0;
    12831440  }
     
    13151472    m_layerIdInNuh      [i] = ( i == 0 ) ? 0 : -1;
    13161473    m_numDirectRefLayers[i] = 0;
     1474#if H_3D
     1475    m_viewIndex         [i] = -1;
     1476#endif
    13171477
    13181478    for( Int j = 0; j < MAX_NUM_LAYERS; j++ )
     
    13261486      m_dimensionId[i][j] = 0;
    13271487    }
    1328 
    13291488  }
    13301489#endif
     
    13331492TComVPS::~TComVPS()
    13341493{
    1335   if( m_hrdParameters    != NULL )     delete m_hrdParameters;
    1336   if( m_hrdOpSetIdx      != NULL )     delete m_hrdOpSetIdx;
    1337   if( m_cprmsPresentFlag != NULL )     delete m_cprmsPresentFlag;
     1494if( m_hrdParameters    != NULL )     delete[] m_hrdParameters;
     1495  if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
     1496  if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
    13381497}
    13391498
     
    13981557{
    13991558  for ( Int scalType = 0; scalType < MAX_NUM_SCALABILITY_TYPES; scalType++ )
    1400     setScalabilityMask( scalType, ( val & (1 << scalType ) ) == 1 );
     1559    setScalabilityMask( scalType, ( val & (1 << scalType ) ) != 0 );
    14011560}
    14021561
     
    14221581Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType )
    14231582{
    1424   return ( ( layerIdInVps != 0 )&& getScalabilityMask( scalType ) ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0;
    1425 }
    1426 #endif
     1583  return getScalabilityMask( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0;
     1584}
     1585
     1586#if H_3D
     1587Void TComVPS::initViewIndex()
     1588{
     1589  Int viewIdList   [ MAX_NUM_LAYERS ]; // ed. should be changed to MAX_VIEW_ID
     1590  Int viewIndexList[ MAX_NUM_LAYERS ];
     1591  Int numViewIds = 0;
     1592
     1593  for ( Int i = 0 ; i  <  m_uiMaxLayers; i++ )
     1594  {     
     1595    Int currViewId = getViewId( i );
     1596
     1597    Bool viewIdInListFlag = false;
     1598    for ( Int j = 0; j < numViewIds; j ++ )
     1599    {
     1600      viewIdInListFlag  = viewIdInListFlag || ( currViewId  == viewIdList[ j ]  );
     1601    }
     1602
     1603    if ( !viewIdInListFlag )
     1604    {
     1605      viewIdList   [ numViewIds ] = currViewId;
     1606      viewIndexList[ currViewId ] = numViewIds;
     1607
     1608      numViewIds++;
     1609    } 
     1610
     1611    m_viewIndex[ i ] = viewIndexList[ currViewId ];
     1612  }
     1613}
     1614
     1615Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag )
     1616{
     1617  Int foundlayerId = -1;
     1618
     1619  for (Int layer = 0 ; layer < m_uiMaxLayers; layer++ )
     1620  {
     1621    if( ( getViewIndex( layer ) == viewIndex ) && ( getDepthId( layer ) == ( depthFlag ? 1 : 0 ) )  )
     1622    {
     1623      foundlayerId = layer;
     1624      break;
     1625    }
     1626  }
     1627  assert( foundlayerId != -1 );
     1628
     1629  return getLayerIdInNuh( foundlayerId );
     1630}
     1631#endif // H_3D
     1632#endif // H_MV
    14271633
    14281634// ------------------------------------------------------------------------------------------------
     
    14381644, m_picWidthInLumaSamples     (352)
    14391645, m_picHeightInLumaSamples    (288)
     1646, m_log2MinCodingBlockSize    (  0)
     1647, m_log2DiffMaxMinCodingBlockSize (0)
    14401648, m_uiMaxCUWidth              ( 32)
    14411649, m_uiMaxCUHeight             ( 32)
    14421650, m_uiMaxCUDepth              (  3)
    1443 , m_uiMinTrDepth              (  0)
    1444 , m_uiMaxTrDepth              (  1)
    14451651, m_bLongTermRefsPresent      (false)
    14461652, m_uiQuadtreeTULog2MaxSize   (  0)
     
    14521658, m_pcmLog2MaxSize            (  5)
    14531659, m_uiPCMLog2MinSize          (  7)
     1660#if !L0034_COMBINED_LIST_CLEANUP
    14541661, m_bUseLComb                 (false)
     1662#endif
    14551663, m_bitDepthY                 (  8)
    14561664, m_bitDepthC                 (  8)
     
    14701678, m_vuiParametersPresentFlag  (false)
    14711679, m_vuiParameters             ()
     1680#if H_MV
     1681, m_interViewMvVertConstraintFlag (false)
     1682#endif
     1683#if H_3D
     1684, m_bCamParInSliceHeader      (false)
     1685#endif
    14721686{
    14731687  for ( Int i = 0; i < MAX_TLAYER; i++ )
    14741688  {
    14751689    m_uiMaxLatencyIncrease[i] = 0;
     1690#if L0323_DPB
     1691    m_uiMaxDecPicBuffering[i] = 1;
     1692#else
    14761693    m_uiMaxDecPicBuffering[i] = 0;
     1694#endif
    14771695    m_numReorderPics[i]       = 0;
    14781696  }
     
    14931711  m_RPSList.create(numRPS);
    14941712}
     1713
    14951714Void TComSPS::setHrdParameters( UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess )
    14961715{
     
    16831902}
    16841903
     1904#if H_3D
     1905Void
     1906TComSPS::initCamParaSPS( UInt uiViewIndex, UInt uiCamParPrecision, Bool bCamParSlice, Int** aaiScale, Int** aaiOffset )
     1907{
     1908  AOT( uiViewIndex != 0 && !bCamParSlice && ( aaiScale == 0 || aaiOffset == 0 ) ); 
     1909 
     1910  m_uiCamParPrecision     = ( uiViewIndex ? uiCamParPrecision : 0 );
     1911  m_bCamParInSliceHeader  = ( uiViewIndex ? bCamParSlice  : false );
     1912  ::memset( m_aaiCodedScale,  0x00, sizeof( m_aaiCodedScale  ) );
     1913  ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) );
     1914
     1915  if( !m_bCamParInSliceHeader )
     1916  {
     1917    for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ )
     1918    {
     1919      m_aaiCodedScale [ 0 ][ uiBaseViewIndex ] = aaiScale [ uiBaseViewIndex ][     uiViewIndex ];
     1920      m_aaiCodedScale [ 1 ][ uiBaseViewIndex ] = aaiScale [     uiViewIndex ][ uiBaseViewIndex ];
     1921      m_aaiCodedOffset[ 0 ][ uiBaseViewIndex ] = aaiOffset[ uiBaseViewIndex ][     uiViewIndex ];
     1922      m_aaiCodedOffset[ 1 ][ uiBaseViewIndex ] = aaiOffset[     uiViewIndex ][ uiBaseViewIndex ];
     1923    }
     1924  }
     1925}
     1926#endif
     1927
    16851928TComReferencePictureSet::TComReferencePictureSet()
    16861929: m_numberOfPictures (0)
     
    17371980  return m_POC[bufferNum];
    17381981}
     1982
    17391983Void TComReferencePictureSet::setPOC(Int bufferNum, Int POC)
    17401984{
    17411985  m_POC[bufferNum] = POC;
    17421986}
     1987
    17431988Bool TComReferencePictureSet::getCheckLTMSBPresent(Int bufferNum)
    17441989{
    17451990  return m_bCheckLTMSB[bufferNum];
    17461991}
     1992
    17471993Void TComReferencePictureSet::setCheckLTMSBPresent(Int bufferNum, Bool b)
    17481994{
     
    20122258}
    20132259#endif
    2014 
    20152260/** get scaling matrix from RefMatrixID
    20162261 * \param sizeId size index
     
    20222267  ::memcpy(getScalingListAddress(sizeId, listId),((listId == refListId)? getScalingListDefaultAddress(sizeId, refListId): getScalingListAddress(sizeId, refListId)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]));
    20232268}
     2269
    20242270/** parse syntax infomation
    20252271 *  \param pchFile syntax infomation
     
    21142360  m_scalingListCoef[SCALING_LIST_32x32][3] = m_scalingListCoef[SCALING_LIST_32x32][1]; // copy address for 32x32
    21152361}
     2362
    21162363/** destroy quantization matrix array
    21172364 */
     
    21262373  }
    21272374}
     2375
    21282376/** get default address of quantization matrix
    21292377 * \param sizeId size index
     
    21552403  return src;
    21562404}
     2405
    21572406/** process of default matrix
    21582407 * \param sizeId size index
     
    21642413  setScalingListDC(sizeId,listId,SCALING_LIST_DC);
    21652414}
     2415
    21662416/** check DC value of matrix for default matrix signaling
    21672417 */
     
    22242474//! activate a PPS and depending on isIDR parameter also SPS and VPS
    22252475//! \returns true, if activation is successful
    2226 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIDR)
     2476Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP)
    22272477{
    22282478  TComPPS *pps = m_ppsMap.getPS(ppsId);
     
    22332483    // active parameter sets per layer should be used here
    22342484#else
    2235     if (!isIDR && (spsId != m_activeSPSId))
    2236     {
    2237       printf("Warning: tried to activate PPS referring to a inactive SPS at non-IDR.");
     2485    if (!isIRAP && (spsId != m_activeSPSId))
     2486    {
     2487      printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP.");
    22382488      return false;
    22392489    }
     
    22432493    {
    22442494      Int vpsId = sps->getVPSId();
    2245       if (!isIDR && (vpsId != m_activeVPSId))
    2246       {
    2247         printf("Warning: tried to activate PPS referring to a inactive VPS at non-IDR.");
     2495      if (!isIRAP && (vpsId != m_activeVPSId))
     2496      {
     2497        printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP.");
    22482498        return false;
    22492499      }
     
    23042554}
    23052555#endif
    2306 
    23072556#if SIGNAL_BITRATE_PICRATE_IN_VPS
    23082557TComBitRatePicRateInfo::TComBitRatePicRateInfo()
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComSlice.h

    r438 r446  
    248248  ProfileTierLevel* getGeneralPTL()  { return &m_generalPTL; }
    249249  ProfileTierLevel* getSubLayerPTL(Int i)  { return &m_subLayerPTL[i]; }
    250 
    251250#if H_MV
    252251  Void copyLevelFrom( TComPTL* source );
     
    523522  Int         m_layerIdInVps             [MAX_NUM_LAYERS   ];
    524523  Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES]; 
     524#if H_3D
     525  Int         m_viewIndex                [MAX_NUM_LAYERS   ];
     526#endif
    525527
    526528 
     
    536538
    537539#endif
    538 
    539540public:
    540541  TComVPS();
     
    596597  TComPTL* getPTL() { return &m_pcPTL; }
    597598#endif
    598 
    599599#if SIGNAL_BITRATE_PICRATE_IN_VPS
    600600  TComBitRatePicRateInfo *getBitratePicrateInfo() { return &m_bitRatePicRateInfo; }
     
    603603  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    604604#endif
    605 
    606605#if H_MV
    607606  Void    setAvcBaseLayerFlag( Bool val )                                  { m_avcBaseLayerFlag = val;  }
     
    639638  Int     getViewId  ( Int layerIdInVps )                                  { return getScalabilityId( layerIdInVps, VIEW_ID  ); }
    640639#if H_3D 
    641   Int     getDepthId ( Int layerIdInVps )                                  { return getScalabilityId( layerIdInVps, DEPTH_ID ); }
     640  Void    initViewIndex();
     641  Int     getViewIndex    ( Int layerIdInVps )                             { return m_viewIndex[ layerIdInVps ]; }   
     642  Int     getDepthId      ( Int layerIdInVps )                             { return getScalabilityId( layerIdInVps, DEPTH_ID ); }
     643  Int     getLayerIdInNuh( Int viewIndex, Bool depthFlag ); 
    642644#endif
    643645
     
    905907  UInt        m_picHeightInLumaSamples;
    906908 
    907   Window      m_conformanceWindow;
    908 
     909  Int         m_log2MinCodingBlockSize;
     910  Int         m_log2DiffMaxMinCodingBlockSize;
    909911  UInt        m_uiMaxCUWidth;
    910912  UInt        m_uiMaxCUHeight;
    911913  UInt        m_uiMaxCUDepth;
    912   UInt        m_uiMinTrDepth;
    913   UInt        m_uiMaxTrDepth;
     914
     915  Window      m_conformanceWindow;
     916
    914917  TComRPSList m_RPSList;
    915918  Bool        m_bLongTermRefsPresent;
     
    927930  Bool        m_useAMP;
    928931
     932#if !L0034_COMBINED_LIST_CLEANUP
    929933  Bool        m_bUseLComb;
     934#endif
    930935 
    931936  // Parameter
     
    968973  static const Int   m_winUnitY[MAX_CHROMA_FORMAT_IDC+1];
    969974  TComPTL     m_pcPTL;
     975#if H_MV
     976  Bool        m_interViewMvVertConstraintFlag;
     977#endif
     978#if H_3D
     979  UInt        m_uiCamParPrecision;
     980  Bool        m_bCamParInSliceHeader;
     981  Int         m_aaiCodedScale [2][MAX_NUM_LAYERS];
     982  Int         m_aaiCodedOffset[2][MAX_NUM_LAYERS];
     983#endif
    970984public:
    971985  TComSPS();
     
    9991013  Bool getUsedByCurrPicLtSPSFlag(Int i)        {return m_usedByCurrPicLtSPSFlag[i];}
    10001014  Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)      { m_usedByCurrPicLtSPSFlag[i] = x;}
     1015
     1016  Int  getLog2MinCodingBlockSize() const           { return m_log2MinCodingBlockSize; }
     1017  Void setLog2MinCodingBlockSize(Int val)          { m_log2MinCodingBlockSize = val; }
     1018  Int  getLog2DiffMaxMinCodingBlockSize() const    { return m_log2DiffMaxMinCodingBlockSize; }
     1019  Void setLog2DiffMaxMinCodingBlockSize(Int val)   { m_log2DiffMaxMinCodingBlockSize = val; }
     1020
    10011021  Void setMaxCUWidth  ( UInt u ) { m_uiMaxCUWidth = u;      }
    10021022  UInt getMaxCUWidth  ()         { return  m_uiMaxCUWidth;  }
     
    10151035  Bool getUseAMP() { return m_useAMP; }
    10161036  Void setUseAMP( Bool b ) { m_useAMP = b; }
    1017   Void setMinTrDepth  ( UInt u ) { m_uiMinTrDepth = u;      }
    1018   UInt getMinTrDepth  ()         { return  m_uiMinTrDepth;  }
    1019   Void setMaxTrDepth  ( UInt u ) { m_uiMaxTrDepth = u;      }
    1020   UInt getMaxTrDepth  ()         { return  m_uiMaxTrDepth;  }
    10211037  Void setQuadtreeTULog2MaxSize( UInt u ) { m_uiQuadtreeTULog2MaxSize = u;    }
    10221038  UInt getQuadtreeTULog2MaxSize()         { return m_uiQuadtreeTULog2MaxSize; }
     
    10401056 
    10411057  // Tool list
     1058#if !L0034_COMBINED_LIST_CLEANUP
    10421059  Void setUseLComb    (Bool b)   { m_bUseLComb = b;         }
    10431060  Bool getUseLComb    ()         { return m_bUseLComb;      }
     1061#endif
    10441062
    10451063  Bool getUseLossless ()         { return m_useLossless; }
     
    10941112
    10951113  TComPTL* getPTL()     { return &m_pcPTL; }
     1114#if H_MV
     1115  Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
     1116  Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
     1117#endif
     1118#if H_3D
     1119  Void initCamParaSPS      (  UInt uiViewIndex, UInt uiCamParPrecision = 0, Bool bCamParSlice = false, Int** aaiScale = 0, Int** aaiOffset = 0 );
     1120  UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
     1121  Bool hasCamParInSliceHeader()  { return m_bCamParInSliceHeader; }
     1122  Int* getCodedScale         ()  { return m_aaiCodedScale [0]; }
     1123  Int* getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
     1124  Int* getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
     1125  Int* getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
     1126#endif
    10961127};
    10971128
     
    11201151  Void       setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx) { m_RefPicSetIdxL1[idx] = refPicSetIdx; }
    11211152  UInt       getRefPicSetIdxL1(UInt idx) { return m_RefPicSetIdxL1[idx]; }
    1122 
    11231153#if H_MV
    11241154  // Why not an listIdx for all members, would avoid code duplication??
     
    13571387  Int         m_deblockingFilterBetaOffsetDiv2;    //< beta offset for deblocking filter
    13581388  Int         m_deblockingFilterTcOffsetDiv2;      //< tc offset for deblocking filter
    1359  
     1389#if L0034_COMBINED_LIST_CLEANUP
     1390  Int         m_list1IdxToList0Idx[MAX_NUM_REF];
     1391  Int         m_aiNumRefIdx   [2];    //  for multiple reference of current slice
     1392#else
    13601393  Int         m_aiNumRefIdx   [3];    //  for multiple reference of current slice
    13611394
     
    13671400  Bool        m_bRefPicListModificationFlagLC;
    13681401  Bool        m_bRefPicListCombinationFlag;
     1402#endif
    13691403
    13701404  Bool        m_bCheckLDC;
     
    14071441
    14081442  Bool        m_abEqualRef  [2][MAX_NUM_REF][MAX_NUM_REF];
    1409  
     1443#if !L0034_COMBINED_LIST_CLEANUP
    14101444  Bool        m_bNoBackPredFlag;
     1445#endif
    14111446  UInt        m_uiTLayer;
    14121447  Bool        m_bTLayerSwitchingFlag;
     
    14431478
    14441479  Bool       m_enableTMVPFlag;
    1445 
    14461480#if H_MV
    14471481  Int        m_layerId;
    14481482  Int        m_viewId;
    14491483#if H_3D
     1484  Int        m_viewIndex;
    14501485  Bool       m_isDepth;
    1451 #endif
    1452 #endif
    1453 
     1486  Int        m_aaiCodedScale [2][MAX_NUM_LAYERS];
     1487  Int        m_aaiCodedOffset[2][MAX_NUM_LAYERS];
     1488#endif
     1489#endif
    14541490public:
    14551491  TComSlice();
     
    15151551  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
    15161552  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
     1553#if H_MV  // This is a temporary fix of the temporary fix L0177
     1554  Int       getNumRpsCurrTempList( TComReferencePictureSet* rps = NULL );
     1555#else
    15171556  Int       getNumRpsCurrTempList();
     1557#endif
     1558#if L0034_COMBINED_LIST_CLEANUP
     1559  Int       getList1IdxToList0Idx ( Int list1Idx )               { return m_list1IdxToList0Idx[list1Idx]; }
     1560#else
    15181561  Int       getRefIdxOfLC       (RefPicList e, Int iRefIdx)     { return m_iRefIdxOfLC[e][iRefIdx];           }
    15191562  Int       getListIdFromIdxOfLC(Int iRefIdx)                   { return m_eListIdFromIdxOfLC[iRefIdx];       }
     
    15251568  Bool      getRefPicListCombinationFlag()                      {return m_bRefPicListCombinationFlag;}
    15261569  Void      setRefPicListCombinationFlag(Bool bflag)            {m_bRefPicListCombinationFlag=bflag;}   
     1570#endif
    15271571  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
    15281572  Bool      isReferenced()                                      { return m_bRefenced; }
    15291573  Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
    15301574  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
    1531   NalUnitType getNalUnitType    ()                              { return m_eNalUnitType;        }
     1575  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
    15321576  Bool      getRapPicFlag       (); 
    1533   Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    1534   Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA);
     1577  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
     1578  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
     1579  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);
    15351580  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
    15361581  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
     
    15581603#endif
    15591604#if H_MV
    1560   Void      setRefPicList       ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet );
     1605  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet , Bool checkNumPocTotalCurr = false );
     1606#else
     1607#if FIX1071
     1608  Void      setRefPicList       ( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr = false );
    15611609#else
    15621610  Void      setRefPicList       ( TComList<TComPic*>& rcListPic );
     1611#endif
    15631612#endif
    15641613  Void      setRefPOCList       ();
     
    15941643 
    15951644  static Void      sortPicList         ( TComList<TComPic*>& rcListPic );
    1596  
     1645#if L0034_COMBINED_LIST_CLEANUP
     1646  Void setList1IdxToList0Idx();
     1647#else
    15971648  Bool getNoBackPredFlag() { return m_bNoBackPredFlag; }
    15981649  Void setNoBackPredFlag( Bool b ) { m_bNoBackPredFlag = b; }
    15991650  Void generateCombinedList       ();
     1651#endif
    16001652
    16011653  UInt getTLayer             ()                            { return m_uiTLayer;                      }
     
    16051657  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum );
    16061658  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
    1607 
    16081659#if H_MV
    16091660  Void createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer );
     
    16141665  Void xPrintRefPicList();
    16151666#endif
    1616 
    16171667  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
    16181668  Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
     
    16551705  Void  getWpScaling    ( RefPicList e, Int iRefIdx, wpScalingParam *&wp);
    16561706
    1657   Void  resetWpScaling  (wpScalingParam  wp[2][MAX_NUM_REF][3]);
    1658   Void  initWpScaling    (wpScalingParam  wp[2][MAX_NUM_REF][3]);
     1707  Void  resetWpScaling  ();
    16591708  Void  initWpScaling   ();
    16601709  inline Bool applyWP   () { return( (m_eSliceType==P_SLICE && m_pcPPS->getUseWP()) || (m_eSliceType==B_SLICE && m_pcPPS->getWPBiPred()) ); }
     
    16981747  Int       getViewId             ()                 { return m_viewId;     }
    16991748#if H_3D
     1749  Void      setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
     1750  Int       getViewIndex          ()                 { return m_viewIndex;     }
    17001751  Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
    17011752  Bool      getIsDepth            ()                 { return m_isDepth; }
    1702 #endif
    1703 #endif
    1704 
     1753  Void      setCamparaSlice       ( Int** aaiScale = 0, Int** aaiOffset = 0 );
     1754  Int*      getCodedScale         ()  { return m_aaiCodedScale [0]; }
     1755  Int*      getCodedOffset        ()  { return m_aaiCodedOffset[0]; }
     1756  Int*      getInvCodedScale      ()  { return m_aaiCodedScale [1]; }
     1757  Int*      getInvCodedOffset     ()  { return m_aaiCodedOffset[1]; }
     1758#endif
     1759#endif
    17051760protected:
    17061761  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
    17071762                         Int                 poc);
    1708   TComPic*  xGetLongTermRefPic  (TComList<TComPic*>& rcListPic,
    1709                          Int                 poc);
     1763TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
    17101764#if H_MV
    17111765  TComPic*  xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId );
     
    17941848  //! activate a PPS and depending on isIDR parameter also SPS and VPS
    17951849  //! \returns true, if activation is successful
    1796   Bool activatePPS(Int ppsId, Bool isIDR);
     1850  Bool activatePPS(Int ppsId, Bool isIRAP);
    17971851
    17981852  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComTrQuant.cpp

    r438 r446  
    19861986          }
    19871987         
    1988           if(piQCoef[minPos] == 32767 || piQCoef[minPos] == -32768)
     1988          if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768)
    19891989          {
    19901990            finalChange = -1;
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComYuv.cpp

    r324 r446  
    637637  }
    638638}
     639
     640#if H_3D
     641Void TComYuv::addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
     642{
     643  Int x, y;
     644
     645  Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiTrUnitIdx);
     646  Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiTrUnitIdx);
     647  Pel* pDst  = getLumaAddr( uiTrUnitIdx);
     648
     649  UInt iSrc0Stride = pcYuvSrc0->getStride();
     650  UInt iSrc1Stride = pcYuvSrc1->getStride();
     651  UInt iDstStride  = getStride();
     652  for ( y = uiPartSize-1; y >= 0; y-- )
     653  {
     654    for ( x = uiPartSize-1; x >= 0; x-- )
     655    {
     656      pDst[x] = ClipY( pSrc0[x] + pSrc1[x] );     
     657    }
     658    pSrc0 += iSrc0Stride;
     659    pSrc1 += iSrc1Stride;
     660    pDst  += iDstStride;
     661  }
     662}
     663#endif
    639664//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TComYuv.h

    r324 r446  
    180180  UInt    getCHeight  ()    { return  m_iCHeight; }
    181181  UInt    getCWidth   ()    { return  m_iCWidth;  } 
     182#if H_3D
     183  Void addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
     184#endif
     185
    182186};// END CLASS DEFINITION TComYuv
    183187
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibCommon/TypeDef.h

    r438 r446  
    4242//! \{
    4343
    44 #define H_MV                        1
    45 
    46 
    47 #if H_MV
    48 #define H_3D                        0
    49 #endif
    50 
    51 ///// ***** HM 10.0 *********
    52 
     44
     45/////////////////////////////////////////////////////////////////////////////////////////
     46///////////////////////////////// EXTENSION SELECTION /////////////////////////////////// 
     47/////////////////////////////////////////////////////////////////////////////////////////
     48
     49/* HEVC_EXT might be defined by compiler/makefile options.
     50   
     51   Linux makefiles support the following settings:   
     52   make             -> HEVC_EXT not defined   
     53   make HEVC_EXT=0  -> H_MV=0 H_3D=0   --> plain HM
     54   make HEVC_EXT=1  -> H_MV=1 H_3D=0   --> MV only
     55   make HEVC_EXT=2  -> H_MV=1 H_3D=1   --> full 3D
     56*/
     57
     58#ifndef HEVC_EXT
     59#define HEVC_EXT                    2
     60#endif
     61
     62#if ( HEVC_EXT < 0 )||( HEVC_EXT > 2 )
     63#error HEVC_EXT must be in the range of 0 to 2, inclusive.
     64#endif
     65
     66#define H_MV          ( HEVC_EXT != 0)
     67#define H_3D          ( HEVC_EXT == 2)
     68
     69/////////////////////////////////////////////////////////////////////////////////////////
     70///////////////////////////////////   MAJOR DEFINES   /////////////////////////////////// 
     71/////////////////////////////////////////////////////////////////////////////////////////
     72
     73#if H_3D
     74#define H_3D_PDM_CAM_PARAS                0 ///< PDM related parts of camera parameters, should be removed if not used anymore.
     75#define H_3D_VSO                          1   // VSO, View synthesis optimization, includes:
     76                                              // HHI_VSO
     77                                              // HHI_VSO_LS_TABLE_M23714 enable table base Lagrange multiplier optimization
     78                                              // SAIT_VSO_EST_A0033, JCT3V-A0033 modification 3
     79                                              // LGE_WVSO_A0119
     80#endif
     81
     82/////////////////////////////////////////////////////////////////////////////////////////
     83///////////////////////////////////   DERIVED DEFINES /////////////////////////////////// 
     84/////////////////////////////////////////////////////////////////////////////////////////
     85
     86///// ***** VIEW SYNTHESIS OPTIMIZAION *********
     87#if H_3D_VSO                                 
     88#define H_3D_VSO_DIST_INT                 1   // Allow negative synthesized view distortion change
     89#define H_3D_VSO_COLOR_PLANES             1   // Compute VSO distortion on color planes
     90#define H_3D_VSO_EARLY_SKIP               1   // LGE_VSO_EARLY_SKIP_A0093, A0093 modification 4
     91#define H_3D_VSO_RM_ASSERTIONS            0   // Output VSO assertions
     92#define H_3D_VSO_SYNTH_DIST_OUT           0   // Output of synthesized view distortion instead of depth distortion in encoder output
     93#endif
     94
     95/////////////////////////////////////////////////////////////////////////////////////////
     96///////////////////////////////////   HM RELATED DEFINES ////////////////////////////////
     97/////////////////////////////////////////////////////////////////////////////////////////
     98
     99#define FIX1071 1 ///< Temporary fix for issue #1071
     100
     101#define L0208_SOP_DESCRIPTION_SEI     1 ///< L0208: add SOP descrioption SEI
     102#define MAX_NUM_PICS_IN_SOP           1024
     103
     104#define K0180_SCALABLE_NESTING_SEI  1   ///JCTVC-K0180 scalable nesting sei message
     105#define MAX_NESTING_NUM_OPS         1024
     106#define MAX_NESTING_NUM_LAYER       64
     107
     108#define J0149_TONE_MAPPING_SEI        1 ///< J0149: Tone mapping information SEI
    53109#define L0363_DU_BIT_RATE             1 ///< L0363: add bit_rate_du_value_minus1 to HRD parameters
    54110#define L0328_SPLICING                1 ///< L0328: splicing support in HRD
     
    75131#define SIGNAL_BITRATE_PICRATE_IN_VPS               0  ///< K0125: Signal bit_rate and pic_rate in VPS
    76132#define L0232_RD_PENALTY           1  ///< L0232: RD-penalty for 32x32 TU for intra in non-intra slices
     133#define L0386_DB_METRIC            1  ///< L0386: non-normative blockiness metric (automatically configures deblocking parameters in bitstream)
     134#define L0323_DPB                     1 ///< L0323: Specification of active reference indices and decoded picture buffer
     135
     136#define L0034_COMBINED_LIST_CLEANUP 1
    77137
    78138#define MAX_VPS_NUM_HRD_PARAMETERS                1
    79139#define MAX_VPS_OP_SETS_PLUS1                     1024
    80 
    81140#if H_MV
    82141#define MAX_VPS_NUH_LAYER_ID_PLUS1  64
     
    92151#define MAX_CPB_CNT                     32  ///< Upper bound of (cpb_cnt_minus1 + 1)
    93152#define MAX_NUM_LAYER_IDS               64
     153#if H_MV
    94154#define MAX_NUM_LAYERS                  64
     155#endif
    95156
    96157#define COEF_REMAIN_BIN_REDUCTION        3 ///< indicates the level at which the VLC
     
    261322typedef       Int             TCoeff;     ///< transform coefficient
    262323
     324#if H_3D_VSO
     325// ====================================================================================================================
     326// Define Distortion Types
     327// ====================================================================================================================
     328typedef       Int64           RMDist;     ///< renderer model distortion
     329
     330#if H_3D_VSO_DIST_INT
     331typedef       Int              Dist;       ///< RDO distortion
     332typedef       Int64            Dist64;
     333#define       RDO_DIST_MIN     MIN_INT
     334#define       RDO_DIST_MAX     MAX_INT
     335#else
     336typedef       UInt             Dist;       ///< RDO distortion
     337typedef       UInt64           Dist;
     338#define       RDO_DIST_MIN     0
     339#define       RDO_DIST_MAX     MAX_UINT
     340#endif
     341#endif
    263342/// parameters for adaptive loop filter
    264343class TComPicSym;
     
    412491  REF_PIC_LIST_0 = 0,   ///< reference list 0
    413492  REF_PIC_LIST_1 = 1,   ///< reference list 1
     493#if !L0034_COMBINED_LIST_CLEANUP
    414494  REF_PIC_LIST_C = 2,   ///< combined reference list for uni-prediction in B-Slices
     495#endif
    415496  REF_PIC_LIST_X = 100  ///< special mark
    416497};
     
    451532  DF_HADS64   = 27,     ///<  64xM HAD with step
    452533  DF_HADS16N  = 28,     ///< 16NxM HAD with step
    453  
     534#if H_3D_VSO
     535  DF_VSD      = 29,      ///< general size VSD
     536  DF_VSD4     = 30,      ///<   4xM VSD
     537  DF_VSD8     = 31,      ///<   8xM VSD
     538  DF_VSD16    = 32,      ///<  16xM VSD
     539  DF_VSD32    = 33,      ///<  32xM VSD
     540  DF_VSD64    = 34,      ///<  64xM VSD
     541  DF_VSD16N   = 35,      ///< 16NxM VSD
     542#endif
     543
    454544#if AMP_SAD
    455545  DF_SAD12    = 43,
     
    549639    VIEW_ID  = 0,
    550640#if H_3D
    551     DEPTH_ID = 1,
     641    DEPTH_ID = 1,   
    552642#endif   
    553643  };
    554644#endif
    555 #endif
    556 
     645#if H_3D
     646  // Renderer
     647  enum BlenMod
     648  {
     649    BLEND_NONE  = -1,
     650    BLEND_AVRG  = 0,
     651    BLEND_LEFT  = 1,
     652    BLEND_RIGHT = 2,
     653    BLEND_GEN   =  3
     654  };
     655
     656 
     657  enum
     658  {
     659    VIEWPOS_INVALID = -1,
     660    VIEWPOS_LEFT    = 0,
     661    VIEWPOS_RIGHT   = 1,
     662    VIEWPOS_MERGED  = 2
     663  };
     664
     665
     666#endif
     667#endif
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/AnnexBread.h

    r324 r446  
    4343#include <vector>
    4444
    45 #include "TLibCommon/TypeDef.h"
     45#include "../TLibCommon/TypeDef.h"
    4646
    4747//! \ingroup TLibDecoder
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/NALread.cpp

    r438 r446  
    5050//! \ingroup TLibDecoder
    5151//! \{
    52 static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, Bool isVclNalUnit)
     52static void convertPayloadToRBSP(vector<uint8_t>& nalUnitBuf, TComInputBitstream *bitstream, Bool isVclNalUnit)
    5353{
    5454  UInt zeroCount = 0;
    5555  vector<uint8_t>::iterator it_read, it_write;
    5656
    57   for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++)
     57  UInt pos = 0;
     58  bitstream->clearEmulationPreventionByteLocation();
     59  for (it_read = it_write = nalUnitBuf.begin(); it_read != nalUnitBuf.end(); it_read++, it_write++, pos++)
    5860  {
    5961    assert(zeroCount < 2 || *it_read >= 0x03);
    6062    if (zeroCount == 2 && *it_read == 0x03)
    6163    {
     64      bitstream->pushEmulationPreventionByteLocation( pos );
     65      pos++;
    6266      it_read++;
    6367      zeroCount = 0;
     
    109113  if ( nalu.m_temporalId )
    110114  {
    111     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA
    112          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLANT
     115    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_LP
     116         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_W_RADL
    113117         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_BLA_N_LP
    114          && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR
     118         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_W_RADL
    115119         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_IDR_N_LP
    116120         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_CRA
     
    122126  else
    123127  {
    124     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA
     128    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R
    125129         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
    126130         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
     
    136140  /* perform anti-emulation prevention */
    137141  TComInputBitstream *pcBitstream = new TComInputBitstream(NULL);
    138   convertPayloadToRBSP(nalUnitBuf, (nalUnitBuf[0] & 64) == 0);
     142  convertPayloadToRBSP(nalUnitBuf, pcBitstream, (nalUnitBuf[0] & 64) == 0);
    139143 
    140144  nalu.m_Bitstream = new TComInputBitstream(&nalUnitBuf);
     145  nalu.m_Bitstream->setEmulationPreventionByteLocation(pcBitstream->getEmulationPreventionByteLocation());
    141146  delete pcBitstream;
    142147  readNalUnitHeader(nalu);
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/NALread.h

    r324 r446  
    3939#pragma once
    4040
    41 #include "TLibCommon/TypeDef.h"
    42 #include "TLibCommon/TComBitStream.h"
    43 #include "TLibCommon/NAL.h"
     41#include "../TLibCommon/TypeDef.h"
     42#include "../TLibCommon/TComBitStream.h"
     43#include "../TLibCommon/NAL.h"
    4444
    4545//! \ingroup TLibDecoder
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SEIread.cpp

    r438 r446  
    9090    fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n");
    9191    break;
     92#if J0149_TONE_MAPPING_SEI
     93  case SEI::TONE_MAPPING_INFO:
     94    fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n");
     95    break;
     96#endif
     97#if L0208_SOP_DESCRIPTION_SEI
     98  case SEI::SOP_DESCRIPTION:
     99    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
     100    break;
     101#endif
     102#if K0180_SCALABLE_NESTING_SEI
     103  case SEI::SCALABLE_NESTING:
     104    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
     105    break;
     106#endif
    92107  default:
    93108    fprintf( g_hTrace, "=========== Unknown SEI message ===========\n");
     
    154169  SEI *sei = NULL;
    155170
    156   if(nalUnitType == NAL_UNIT_SEI)
     171  if(nalUnitType == NAL_UNIT_PREFIX_SEI)
    157172  {
    158173    switch (payloadType)
     
    219234      xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize);
    220235      break;
     236#if J0149_TONE_MAPPING_SEI
     237    case SEI::TONE_MAPPING_INFO:
     238      sei = new SEIToneMappingInfo;
     239      xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize);
     240      break;
     241#endif
     242#if L0208_SOP_DESCRIPTION_SEI
     243    case SEI::SOP_DESCRIPTION:
     244      sei = new SEISOPDescription;
     245      xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize);
     246      break;
     247#endif
     248#if K0180_SCALABLE_NESTING_SEI
     249    case SEI::SCALABLE_NESTING:
     250      sei = new SEIScalableNesting;
     251      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps);
     252      break;
     253#endif
    221254    default:
    222255      for (UInt i = 0; i < payloadSize; i++)
     
    284317    {
    285318      UInt reservedPayloadExtensionData;
    286       READ_CODE (1, reservedPayloadExtensionData, "reserved_payload_extension_data");
     319      READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data");
    287320    }
    288321
    289322    UInt dummy;
    290     READ_CODE (1, dummy, "payload_bit_equal_to_one");
    291     READ_CODE (payloadBitsRemaining-1, dummy, "payload_bit_equal_to_zero");
     323    READ_FLAG (dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--;
     324    while (payloadBitsRemaining)
     325    {
     326      READ_FLAG (dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--;
     327    }
    292328  }
    293329
     
    632668}
    633669
     670#if J0149_TONE_MAPPING_SEI
     671Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/)
     672{
     673  Int i;
     674  UInt val;
     675  READ_UVLC( val, "tone_map_id" );                         sei.m_toneMapId = val;
     676  READ_FLAG( val, "tone_map_cancel_flag" );                sei.m_toneMapCancelFlag = val;
     677
     678  if ( !sei.m_toneMapCancelFlag )
     679  {
     680    READ_FLAG( val, "tone_map_persistence_flag" );         sei.m_toneMapPersistenceFlag = val;
     681    READ_CODE( 8, val, "coded_data_bit_depth" );           sei.m_codedDataBitDepth = val;
     682    READ_CODE( 8, val, "target_bit_depth" );               sei.m_targetBitDepth = val;
     683    READ_UVLC( val, "model_id" );                          sei.m_modelId = val;
     684    switch(sei.m_modelId)
     685    {
     686    case 0:
     687      {
     688        READ_CODE( 32, val, "min_value" );                 sei.m_minValue = val;
     689        READ_CODE( 32, val, "max_value" );                 sei.m_maxValue = val;
     690        break;
     691      }
     692    case 1:
     693      {
     694        READ_CODE( 32, val, "sigmoid_midpoint" );          sei.m_sigmoidMidpoint = val;
     695        READ_CODE( 32, val, "sigmoid_width" );             sei.m_sigmoidWidth = val;
     696        break;
     697      }
     698    case 2:
     699      {
     700        UInt num = 1u << sei.m_targetBitDepth;
     701        sei.m_startOfCodedInterval.resize(num+1);
     702        for(i = 0; i < num; i++)
     703        {
     704          READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval" );
     705          sei.m_startOfCodedInterval[i] = val;
     706        }
     707        sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth;
     708        break;
     709      }
     710    case 3:
     711      {
     712        READ_CODE( 16, val,  "num_pivots" );                       sei.m_numPivots = val;
     713        sei.m_codedPivotValue.resize(sei.m_numPivots);
     714        sei.m_targetPivotValue.resize(sei.m_numPivots);
     715        for(i = 0; i < sei.m_numPivots; i++ )
     716        {
     717          READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value" );
     718          sei.m_codedPivotValue[i] = val;
     719          READ_CODE( ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3),    val, "target_pivot_value" );
     720          sei.m_targetPivotValue[i] = val;
     721        }
     722        break;
     723      }
     724    case 4:
     725      {
     726        READ_CODE( 8, val, "camera_iso_speed_idc" );                     sei.m_cameraIsoSpeedValue = val;
     727        if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO
     728        {
     729          READ_CODE( 32,   val,   "camera_iso_speed_value" );            sei.m_cameraIsoSpeedValue = val;
     730        }
     731        READ_FLAG( val, "exposure_compensation_value_sign_flag" );       sei.m_exposureCompensationValueSignFlag = val;
     732        READ_CODE( 16, val, "exposure_compensation_value_numerator" );   sei.m_exposureCompensationValueNumerator = val;
     733        READ_CODE( 16, val, "exposure_compensation_value_denom_idc" );   sei.m_exposureCompensationValueDenomIdc = val;
     734        READ_CODE( 32, val, "ref_screen_luminance_white" );              sei.m_refScreenLuminanceWhite = val;
     735        READ_CODE( 32, val, "extended_range_white_level" );              sei.m_extendedRangeWhiteLevel = val;
     736        READ_CODE( 16, val, "nominal_black_level_luma_code_value" );     sei.m_nominalBlackLevelLumaCodeValue = val;
     737        READ_CODE( 16, val, "nominal_white_level_luma_code_value" );     sei.m_nominalWhiteLevelLumaCodeValue= val;
     738        READ_CODE( 16, val, "extended_white_level_luma_code_value" );    sei.m_extendedWhiteLevelLumaCodeValue = val;
     739        break;
     740      }
     741    default:
     742      {
     743        assert(!"Undefined SEIToneMapModelId");
     744        break;
     745      }
     746    }//switch model id
     747  }// if(!sei.m_toneMapCancelFlag)
     748
     749  xParseByteAlign();
     750}
     751#endif
     752
     753#if L0208_SOP_DESCRIPTION_SEI
     754Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize)
     755{
     756  Int iCode;
     757  UInt uiCode;
     758
     759  READ_UVLC( uiCode,           "sop_seq_parameter_set_id"            ); sei.m_sopSeqParameterSetId = uiCode;
     760  READ_UVLC( uiCode,           "num_pics_in_sop_minus1"              ); sei.m_numPicsInSopMinus1 = uiCode;
     761  for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++)
     762  {
     763    READ_CODE( 6, uiCode,                     "sop_desc_vcl_nalu_type" );  sei.m_sopDescVclNaluType[i] = uiCode;
     764    READ_CODE( 3, sei.m_sopDescTemporalId[i], "sop_desc_temporal_id"   );  sei.m_sopDescTemporalId[i] = uiCode;
     765    if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP)
     766    {
     767      READ_UVLC( sei.m_sopDescStRpsIdx[i],    "sop_desc_st_rps_idx"    ); sei.m_sopDescStRpsIdx[i] = uiCode;
     768    }
     769    if (i > 0)
     770    {
     771      READ_SVLC( iCode,                       "sop_desc_poc_delta"     ); sei.m_sopDescPocDelta[i] = iCode;
     772    }
     773  }
     774
     775  xParseByteAlign();
     776}
     777#endif
     778
     779#if K0180_SCALABLE_NESTING_SEI
     780Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps)
     781{
     782  UInt uiCode;
     783  SEIMessages seis;
     784
     785  READ_FLAG( uiCode,            "bitstream_subset_flag"         ); sei.m_bitStreamSubsetFlag = uiCode;
     786  READ_FLAG( uiCode,            "nesting_op_flag"               ); sei.m_nestingOpFlag = uiCode;
     787  if (sei.m_nestingOpFlag)
     788  {
     789    READ_FLAG( uiCode,            "default_op_flag"               ); sei.m_defaultOpFlag = uiCode;
     790    READ_UVLC( uiCode,            "nesting_num_ops_minus1"        ); sei.m_nestingNumOpsMinus1 = uiCode;
     791    for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++)
     792    {
     793      READ_CODE( 3,        uiCode,  "nesting_max_temporal_id_plus1"   ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode;
     794      READ_UVLC( uiCode,            "nesting_op_idx"                  ); sei.m_nestingOpIdx[i] = uiCode;
     795    }
     796  }
     797  else
     798  {
     799    READ_FLAG( uiCode,            "all_layers_flag"               ); sei.m_allLayersFlag       = uiCode;
     800    if (!sei.m_allLayersFlag)
     801    {
     802      READ_CODE( 3,        uiCode,  "nesting_no_op_max_temporal_id_plus1"  ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode;
     803      READ_UVLC( uiCode,            "nesting_num_layers_minus1"            ); sei.m_nestingNumLayersMinus1        = uiCode;
     804      for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++)
     805      {
     806        READ_CODE( 6,           uiCode,     "nesting_layer_id"      ); sei.m_nestingLayerId[i]   = uiCode;
     807      }
     808    }
     809  }
     810
     811  // byte alignment
     812  while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     813  {
     814    UInt code;
     815    READ_FLAG( code, "nesting_zero_bit" );
     816  }
     817
     818  sei.m_callerOwnsSEIs = false;
     819
     820  // read nested SEI messages
     821  do {
     822    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     823  } while (m_pcBitstream->getNumBitsLeft() > 8);
     824
     825}
     826#endif
     827
    634828Void SEIReader::xParseByteAlign()
    635829{
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SEIread.h

    r438 r446  
    7070  Void xParseSEITemporalLevel0Index   (SEITemporalLevel0Index &sei, UInt payloadSize);
    7171  Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize);
     72#if J0149_TONE_MAPPING_SEI
     73  Void xParseSEIToneMappingInfo       (SEIToneMappingInfo& sei, UInt payloadSize);
     74#endif
     75#if L0208_SOP_DESCRIPTION_SEI
     76  Void xParseSEISOPDescription        (SEISOPDescription &sei, UInt payloadSize);
     77#endif
     78#if K0180_SCALABLE_NESTING_SEI
     79  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps);
     80#endif
    7281  Void xParseByteAlign();
    7382};
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/SyntaxElementParser.h

    r324 r446  
    4343#endif // _MSC_VER > 1000
    4444
    45 #include "TLibCommon/TComRom.h"
     45#include "../TLibCommon/TComRom.h"
    4646
    4747#if ENC_DEC_TRACE
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r438 r446  
    6868TDecCavlc::TDecCavlc()
    6969{
     70#if H_3D
     71  m_aaiTempScale            = new Int* [ MAX_NUM_LAYERS ];
     72  m_aaiTempOffset           = new Int* [ MAX_NUM_LAYERS ];
     73  for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ )
     74  {
     75    m_aaiTempScale            [ uiVId ] = new Int [ MAX_NUM_LAYERS ];
     76    m_aaiTempOffset           [ uiVId ] = new Int [ MAX_NUM_LAYERS ];
     77  }
     78#endif
    7079}
    7180
    7281TDecCavlc::~TDecCavlc()
    7382{
    74 
     83#if H_3D
     84  for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ )
     85  {
     86    delete [] m_aaiTempScale            [ uiVId ];
     87    delete [] m_aaiTempOffset           [ uiVId ];
     88  }
     89  delete [] m_aaiTempScale;
     90  delete [] m_aaiTempOffset;
     91#endif
    7592}
    7693
     
    173190  rps->printDeltaPOC();
    174191#endif
    175 }
    176 
    177 /** copy SAO parameter
    178 * \param dst 
    179 * \param src
    180 */
    181 inline Void copySaoOneLcuParam(SaoLcuParam* dst,  SaoLcuParam* src)
    182 {
    183   Int i;
    184   dst->partIdx = src->partIdx;
    185   dst->typeIdx = src->typeIdx;
    186   if (dst->typeIdx != -1)
    187   {
    188     dst->subTypeIdx = src->subTypeIdx ;
    189     dst->length  = src->length;
    190     for (i=0;i<dst->length;i++)
    191     {
    192       dst->offset[i] = src->offset[i];
    193     }
    194   }
    195   else
    196   {
    197     dst->length  = 0;
    198     for (i=0;i<SAO_BO_LEN;i++)
    199     {
    200       dst->offset[i] = 0;
    201     }
    202   }
    203192}
    204193
     
    400389
    401390  READ_FLAG(     uiCode, "field_seq_flag");                           pcVUI->setFieldSeqFlag(uiCode);
    402   assert(pcVUI->getFieldSeqFlag() == false);        // not supported yet
    403391
    404392  READ_FLAG(uiCode, "frame_field_info_present_flag");                 pcVUI->setFrameFieldInfoPresentFlag(uiCode);
     
    554542}
    555543
     544#if H_3D
     545Void TDecCavlc::parseSPS(TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
     546#else
    556547Void TDecCavlc::parseSPS(TComSPS* pcSPS)
     548#endif
    557549{
    558550#if ENC_DEC_TRACE 
     
    593585
    594586  READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
    595   g_bitDepthY = 8 + uiCode;
    596   pcSPS->setBitDepthY(g_bitDepthY);
     587  pcSPS->setBitDepthY( uiCode + 8 );
    597588  pcSPS->setQpBDOffsetY( (Int) (6*uiCode) );
    598589
    599590  READ_UVLC( uiCode,    "bit_depth_chroma_minus8" );
    600   g_bitDepthC = 8 + uiCode;
    601   pcSPS->setBitDepthC(g_bitDepthC);
     591  pcSPS->setBitDepthC( uiCode + 8 );
    602592  pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
    603593
     
    608598  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    609599  {
     600#if L0323_DPB
     601#if H_MV
     602    READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]");
     603#else
     604    READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1");
     605#endif
     606    pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
     607#else
    610608    READ_UVLC ( uiCode, "sps_max_dec_pic_buffering");
    611609    pcSPS->setMaxDecPicBuffering( uiCode, i);
     610#endif
     611#if H_MV
     612    READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" );
     613#else
    612614    READ_UVLC ( uiCode, "sps_num_reorder_pics" );
     615#endif
    613616    pcSPS->setNumReorderPics(uiCode, i);
     617#if H_MV
     618    READ_UVLC ( uiCode, "sps_max_latency_increase[i]");
     619#else
    614620    READ_UVLC ( uiCode, "sps_max_latency_increase");
     621#endif
    615622    pcSPS->setMaxLatencyIncrease( uiCode, i );
    616623
     
    628635
    629636  READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" );
    630   UInt log2MinCUSize = uiCode + 3;
     637  Int log2MinCUSize = uiCode + 3;
     638  pcSPS->setLog2MinCodingBlockSize(log2MinCUSize);
    631639  READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" );
    632   UInt uiMaxCUDepthCorrect = uiCode;
    633   pcSPS->setMaxCUWidth  ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUWidth  = 1<<(log2MinCUSize + uiMaxCUDepthCorrect);
    634   pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUHeight = 1<<(log2MinCUSize + uiMaxCUDepthCorrect);
     640  pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
     641  Int maxCUDepthDelta = uiCode;
     642  pcSPS->setMaxCUWidth  ( 1<<(log2MinCUSize + maxCUDepthDelta) );
     643  pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) );
    635644  READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" );   pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 );
    636645
     
    640649  READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" );    pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 );
    641650  READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" );    pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 );
    642   g_uiAddCUDepth = 0;
    643   while( ( pcSPS->getMaxCUWidth() >> uiMaxCUDepthCorrect ) > ( 1 << ( pcSPS->getQuadtreeTULog2MinSize() + g_uiAddCUDepth )  ) )
    644   {
    645     g_uiAddCUDepth++;
    646   }
    647   pcSPS->setMaxCUDepth( uiMaxCUDepthCorrect+g_uiAddCUDepth  );
    648   g_uiMaxCUDepth  = uiMaxCUDepthCorrect+g_uiAddCUDepth;
    649   // BB: these parameters may be removed completly and replaced by the fixed values
    650   pcSPS->setMinTrDepth( 0 );
    651   pcSPS->setMaxTrDepth( 1 );
     651
     652  Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() );
     653  pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth );
     654
    652655  READ_FLAG( uiCode, "scaling_list_enabled_flag" );                 pcSPS->setScalingListFlag ( uiCode );
    653656  if(pcSPS->getScalingListFlag())
     
    710713  if (uiCode)
    711714  {
     715#if !H_MV
    712716    while ( xMoreRbspData() )
    713717    {
    714718      READ_FLAG( uiCode, "sps_extension_data_flag");
    715719    }
     720#else
     721    READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );    pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false);
     722    READ_FLAG( uiCode, "sps_extension2_flag");
     723    if ( uiCode )
     724    {
     725#if !H_3D
     726      while ( xMoreRbspData() )
     727      {
     728        READ_FLAG( uiCode, "sps_extension_data_flag");
     729      }
     730#else
     731      UInt uiCamParPrecision = 0;
     732      Bool bCamParSlice      = false;
     733      if ( !depthFlag )
     734      {     
     735        READ_UVLC( uiCamParPrecision, "cp_precision" );
     736        READ_FLAG( uiCode, "cp_in_slice_header_flag" );    bCamParSlice = ( uiCode == 1 );
     737        if( !bCamParSlice )
     738        {       
     739          for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ )
     740          {
     741            Int iCode;
     742            READ_SVLC( iCode, "cp_scale" );                m_aaiTempScale  [ uiBaseIndex ][ viewIndex ]   = iCode;
     743            READ_SVLC( iCode, "cp_off" );                  m_aaiTempOffset [ uiBaseIndex ][ viewIndex ]   = iCode;
     744            READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale  [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ];
     745            READ_SVLC( iCode, "cp_inv_off_plus_off" );     m_aaiTempOffset [ viewIndex   ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ];
     746          }
     747        }
     748      }
     749      pcSPS->initCamParaSPS( viewIndex, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset );
     750      READ_FLAG( uiCode, "sps_extension3_flag");
     751      if ( uiCode )
     752      {
     753        while ( xMoreRbspData() )
     754        {
     755          READ_FLAG( uiCode, "sps_extension_data_flag");
     756        }
     757      }
     758#endif // !H_3D
     759    }
     760#endif // !H_MV
    716761  }
    717762}
     
    744789  for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++)
    745790  {
     791#if L0323_DPB
     792    READ_UVLC( uiCode,  "vps_max_dec_pic_buffering_minus1[i]" );     pcVPS->setMaxDecPicBuffering( uiCode + 1, i );
     793#else
    746794    READ_UVLC( uiCode,  "vps_max_dec_pic_buffering[i]" );     pcVPS->setMaxDecPicBuffering( uiCode, i );
     795#endif
    747796    READ_UVLC( uiCode,  "vps_num_reorder_pics[i]" );          pcVPS->setNumReorderPics( uiCode, i );
    748797    READ_UVLC( uiCode,  "vps_max_latency_increase[i]" );      pcVPS->setMaxLatencyIncrease( uiCode, i );
     
    839888
    840889    // parse layer_id_in_nuh[i] and derive LayerIdInVps
    841     pcVPS->setLayerIdInNuh( 0, 0 ); pcVPS->setLayerIdInVps( 0, 0 );
    842    
    843     for( Int layer = 1; layer <= pcVPS->getMaxLayers() - 1; layer++ )
     890    // already updated to JCT3V-D0220
     891    for( Int layer = 0; layer <= pcVPS->getMaxLayers() - 1; layer++ )
    844892    {
    845893      UInt layerIdInNuh;
    846       if ( pcVPS->getVpsNuhLayerIdPresentFlag() )
     894      if ( pcVPS->getVpsNuhLayerIdPresentFlag() && ( layer != 0 ) )
    847895      {
    848896        READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" );                layerIdInNuh = uiCode;
     
    922970#endif   
    923971  }
    924  
     972
     973#if H_3D
     974  pcVPS->initViewIndex();
     975#endif
     976
    925977  return;
    926978}
     
    9561008  vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId());
    9571009  assert(vps!=0);
    958   rpcSlice->setVPS(vps);
     1010  rpcSlice->setVPS(vps);     
     1011  rpcSlice->setViewId   ( vps->getViewId   ( rpcSlice->getLayerIdInVps() )      );
     1012#if H_3D 
     1013  rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerIdInVps() )      ); 
     1014  rpcSlice->setIsDepth  ( vps->getDepthId  ( rpcSlice->getLayerIdInVps() ) == 1 );
     1015#endif
    9591016#endif
    9601017  rpcSlice->setSPS(sps);
     
    10521109        iPOCmsb = iPrevPOCmsb;
    10531110      }
    1054       if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    1055         || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     1111      if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     1112        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    10561113        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )
    10571114      {
     
    10621119
    10631120      TComReferencePictureSet* rps;
     1121      rps = rpcSlice->getLocalRPS();
     1122      rpcSlice->setRPS(rps);
    10641123      READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" );
    10651124      if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header
    10661125      {
    1067         rps = rpcSlice->getLocalRPS();
    10681126        parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets());
    1069         rpcSlice->setRPS(rps);
    10701127      }
    10711128      else // use reference to short-term reference picture set in PPS
     
    10841141          uiCode = 0;
    10851142        }
    1086         rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode));
    1087 
    1088         rps = rpcSlice->getRPS();
     1143        memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet));
    10891144      }
    10901145      if(sps->getLongTermRefsPresent())
     
    11091164        rps->setNumberOfLongtermPictures(numOfLtrp);
    11101165        Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC();
    1111         Int prevLSB = 0, prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;
     1166        Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;
    11121167        for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++)
    11131168        {
     
    11361191            READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" );
    11371192            Bool deltaFlag = false;
    1138             //            First LTRP                               || First LTRP from SH           || curr LSB    != prev LSB
    1139             if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) || (pocLsbLt != prevLSB) )
     1193            //            First LTRP                               || First LTRP from SH
     1194            if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) )
    11401195            {
    11411196              deltaFlag = true;
     
    11621217            rps->setCheckLTMSBPresent(j,false); 
    11631218          }
    1164           prevLSB = pocLsbLt;
    11651219          prevDeltaMSB = deltaPocMSBCycleLT;
    11661220        }
     
    11681222        rps->setNumberOfPictures(offset);       
    11691223      } 
    1170       if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    1171         || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT
     1224      if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     1225        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
    11721226        || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP )
    11731227      {
     
    12431297
    12441298      if(refPicListModification->getRefPicListModificationFlagL0())
    1245       {
     1299      { 
    12461300        uiCode = 0;
    12471301        Int i = 0;
     
    14011455        if(!rpcSlice->getDeblockingFilterDisable())
    14021456        {
    1403           READ_SVLC( iCode, "beta_offset_div2" );                       rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode);
    1404           READ_SVLC( iCode, "tc_offset_div2" );                         rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode);
     1457          READ_SVLC( iCode, "slice_beta_offset_div2" );                       rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode);
     1458          assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 &&
     1459                 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <=  6);
     1460          READ_SVLC( iCode, "slice_tc_offset_div2" );                         rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode);
     1461          assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 &&
     1462                 rpcSlice->getDeblockingFilterTcOffsetDiv2() <=  6);
    14051463        }
    14061464      }
     
    14341492  }
    14351493 
    1436   if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )
    1437   {
    14381494    UInt *entryPointOffset          = NULL;
    14391495    UInt numEntryPointOffsets, offsetLenMinus1;
    1440 
     1496  if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )
     1497  {
    14411498    READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets );
    14421499    if (numEntryPointOffsets>0)
     
    14551512#endif
    14561513    }
     1514  }
     1515  else
     1516  {
     1517    rpcSlice->setNumEntryPointOffsets ( 0 );
     1518  }
     1519
     1520  if(pps->getSliceHeaderExtensionPresentFlag())
     1521  {
     1522    READ_UVLC(uiCode,"slice_header_extension_length");
     1523#if H_3D
     1524    if( rpcSlice->getSPS()->hasCamParInSliceHeader() )
     1525    {
     1526      UInt uiViewIndex = rpcSlice->getViewIndex();
     1527      for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ )
     1528      {
     1529        READ_SVLC( iCode, "cp_scale" );                m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ] = iCode;
     1530        READ_SVLC( iCode, "cp_off" );                  m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ] = iCode;
     1531        READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ];
     1532        READ_SVLC( iCode, "cp_inv_off_plus_off" );     m_aaiTempOffset[ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ];
     1533      }
     1534      rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset );
     1535    }
     1536
     1537    READ_FLAG(uiCode,"slice_segment_header_extension2_flag");
     1538    if ( uiCode )
     1539    {   
     1540      READ_UVLC(uiCode,"slice_header_extension2_length");
     1541      for(Int i=0; i<uiCode; i++)
     1542      {
     1543        UInt ignore;
     1544        READ_CODE(8,ignore,"slice_header_extension2_data_byte");
     1545      }
     1546    }
     1547  }
     1548#else
     1549    for(Int i=0; i<uiCode; i++)
     1550    {
     1551      UInt ignore;
     1552      READ_CODE(8,ignore,"slice_header_extension_data_byte");
     1553    }
     1554  }
     1555#endif
     1556  m_pcBitstream->readByteAlignment();
     1557
     1558  if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )
     1559  {
     1560    Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation();
     1561    Int  curEntryPointOffset     = 0;
     1562    Int  prevEntryPointOffset    = 0;
     1563    for (UInt idx=0; idx<numEntryPointOffsets; idx++)
     1564    {
     1565      curEntryPointOffset += entryPointOffset[ idx ];
     1566
     1567      Int emulationPreventionByteCount = 0;
     1568      for ( UInt curByteIdx  = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ )
     1569      {
     1570        if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) &&
     1571             m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) <  ( curEntryPointOffset  + endOfSliceHeaderLocation ) )
     1572        {
     1573          emulationPreventionByteCount++;
     1574        }
     1575      }
     1576
     1577      entryPointOffset[ idx ] -= emulationPreventionByteCount;
     1578      prevEntryPointOffset = curEntryPointOffset;
     1579    }
    14571580
    14581581    if ( pps->getTilesEnabledFlag() )
     
    14901613    }
    14911614  }
    1492   else
    1493   {
    1494     rpcSlice->setNumEntryPointOffsets ( 0 );
    1495   }
    1496 
    1497   if(pps->getSliceHeaderExtensionPresentFlag())
    1498   {
    1499     READ_UVLC(uiCode,"slice_header_extension_length");
    1500     for(Int i=0; i<uiCode; i++)
    1501     {
    1502       UInt ignore;
    1503       READ_CODE(8,ignore,"slice_header_extension_data_byte");
    1504     }
    1505   }
    1506   m_pcBitstream->readByteAlignment();
     1615
    15071616  return;
    15081617}
     
    17551864// ====================================================================================================================
    17561865
    1757 
    1758 /** Parse PCM alignment zero bits.
    1759 * \returns Void
    1760 */
    1761 Void TDecCavlc::xReadPCMAlignZero( )
    1762 {
    1763   UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();
    1764 
    1765   if(uiNumberOfBits)
    1766   {
    1767     UInt uiBits;
    1768     UInt uiSymbol;
    1769 
    1770     for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)
    1771     {
    1772       xReadFlag( uiSymbol );
    1773       assert( uiSymbol == 0 );
    1774     }
    1775   }
    1776 }
    1777 
    1778 Void TDecCavlc::xReadUnaryMaxSymbol( UInt& ruiSymbol, UInt uiMaxSymbol )
    1779 {
    1780   if (uiMaxSymbol == 0)
    1781   {
    1782     ruiSymbol = 0;
    1783     return;
    1784   }
    1785 
    1786   xReadFlag( ruiSymbol );
    1787 
    1788   if (ruiSymbol == 0 || uiMaxSymbol == 1)
    1789   {
    1790     return;
    1791   }
    1792 
    1793   UInt uiSymbol = 0;
    1794   UInt uiCont;
    1795 
    1796   do
    1797   {
    1798     xReadFlag( uiCont );
    1799     uiSymbol++;
    1800   }
    1801   while( uiCont && (uiSymbol < uiMaxSymbol-1) );
    1802 
    1803   if( uiCont && (uiSymbol == uiMaxSymbol-1) )
    1804   {
    1805     uiSymbol++;
    1806   }
    1807 
    1808   ruiSymbol = uiSymbol;
    1809 }
    1810 
    1811 Void TDecCavlc::xReadExGolombLevel( UInt& ruiSymbol )
    1812 {
    1813   UInt uiSymbol ;
    1814   UInt uiCount = 0;
    1815   do
    1816   {
    1817     xReadFlag( uiSymbol );
    1818     uiCount++;
    1819   }
    1820   while( uiSymbol && (uiCount != 13));
    1821 
    1822   ruiSymbol = uiCount-1;
    1823 
    1824   if( uiSymbol )
    1825   {
    1826     xReadEpExGolomb( uiSymbol, 0 );
    1827     ruiSymbol += uiSymbol+1;
    1828   }
    1829 
    1830   return;
    1831 }
    1832 
    1833 Void TDecCavlc::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount )
    1834 {
    1835   UInt uiSymbol = 0;
    1836   UInt uiBit = 1;
    1837 
    1838 
    1839   while( uiBit )
    1840   {
    1841     xReadFlag( uiBit );
    1842     uiSymbol += uiBit << uiCount++;
    1843   }
    1844 
    1845   uiCount--;
    1846   while( uiCount-- )
    1847   {
    1848     xReadFlag( uiBit );
    1849     uiSymbol += uiBit << uiCount;
    1850   }
    1851 
    1852   ruiSymbol = uiSymbol;
    1853 
    1854   return;
    1855 }
    1856 
    1857 UInt TDecCavlc::xGetBit()
    1858 {
    1859   UInt ruiCode;
    1860   m_pcBitstream->read( 1, ruiCode );
    1861   return ruiCode;
    1862 }
    1863 
    1864 
    18651866/** parse explicit wp tables
    18661867* \param TComSlice* pcSlice
     
    18791880  // decode delta_luma_log2_weight_denom :
    18801881  READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" );     // ue(v): luma_log2_weight_denom
     1882  assert( uiLog2WeightDenomLuma <= 7 );
    18811883  if( bChroma )
    18821884  {
    18831885    READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" );     // se(v): delta_chroma_log2_weight_denom
    18841886    assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0);
     1887    assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7);
    18851888    uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma);
    18861889  }
     
    19211924        Int iDeltaWeight;
    19221925        READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" );  // se(v): delta_luma_weight_l0[i]
     1926        assert( iDeltaWeight >= -128 );
     1927        assert( iDeltaWeight <=  127 );
    19231928        wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom));
    19241929        READ_SVLC( wp[0].iOffset, "luma_offset_lX" );       // se(v): luma_offset_l0[i]
     1930        assert( wp[0].iOffset >= -128 );
     1931        assert( wp[0].iOffset <=  127 );
    19251932      }
    19261933      else
     
    19371944            Int iDeltaWeight;
    19381945            READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" );  // se(v): chroma_weight_l0[i][j]
     1946            assert( iDeltaWeight >= -128 );
     1947            assert( iDeltaWeight <=  127 );
    19391948            wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom));
    19401949
    19411950            Int iDeltaChroma;
    19421951            READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" );  // se(v): delta_chroma_offset_l0[i][j]
     1952            assert( iDeltaChroma >= -512 );
     1953            assert( iDeltaChroma <=  511 );
    19431954            Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) );
    19441955            wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) );
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecCAVLC.h

    r438 r446  
    6161 
    6262protected:
    63   Void  xReadEpExGolomb       ( UInt& ruiSymbol, UInt uiCount );
    64   Void  xReadExGolombLevel    ( UInt& ruiSymbol );
    65   Void  xReadUnaryMaxSymbol   ( UInt& ruiSymbol, UInt uiMaxSymbol );
     63  void  parseShortTermRefPicSet            (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx);
    6664 
    67   Void  xReadPCMAlignZero     ();
    68 
    69   UInt  xGetBit             ();
    70  
    71   void  parseShortTermRefPicSet            (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx);
    72 private:
    73  
     65#if H_3D
     66  Int**    m_aaiTempScale;
     67  Int**    m_aaiTempOffset;
     68#endif
    7469public:
    7570
     
    8176  Void  parseQtRootCbf      ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
    8277  Void  parseVPS            ( TComVPS* pcVPS );
     78#if H_3D
     79  Void  parseSPS            ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
     80#else
    8381  Void  parseSPS            ( TComSPS* pcSPS );
     82#endif
    8483  Void  parsePPS            ( TComPPS* pcPPS);
    8584  Void  parseVUI            ( TComVUI* pcVUI, TComSPS* pcSPS );
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecEntropy.h

    r324 r446  
    3939#define __TDECENTROPY__
    4040
    41 #include "TLibCommon/CommonDef.h"
    42 #include "TLibCommon/TComBitStream.h"
    43 #include "TLibCommon/TComSlice.h"
    44 #include "TLibCommon/TComPic.h"
    45 #include "TLibCommon/TComPrediction.h"
    46 #include "TLibCommon/TComSampleAdaptiveOffset.h"
     41#include "../TLibCommon/CommonDef.h"
     42#include "../TLibCommon/TComBitStream.h"
     43#include "../TLibCommon/TComSlice.h"
     44#include "../TLibCommon/TComPic.h"
     45#include "../TLibCommon/TComPrediction.h"
     46#include "../TLibCommon/TComSampleAdaptiveOffset.h"
    4747
    4848class TDecSbac;
     
    6666
    6767  virtual Void  parseVPS                  ( TComVPS* pcVPS )                       = 0;
     68#if H_3D
     69  virtual Void  parseSPS                  ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag  )         = 0;
     70#else
    6871  virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
     72#endif
    6973  virtual Void  parsePPS                  ( TComPPS* pcPPS )                                      = 0;
    7074
     
    129133  Void    resetEntropy                ( TComSlice* p)           { m_pcEntropyDecoderIf->resetEntropy(p);                    }
    130134  Void    decodeVPS                   ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); }
     135#if H_3D
     136  Void    decodeSPS                   ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )    { m_pcEntropyDecoderIf->parseSPS(pcSPS, viewIndex, depthFlag );                    }
     137#else
    131138  Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
     139#endif
    132140  Void    decodePPS                   ( TComPPS* pcPPS )    { m_pcEntropyDecoderIf->parsePPS(pcPPS);                    }
    133141  Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager);         }
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecGop.cpp

    r438 r446  
    208208  rpcPic->compressMotion();
    209209#endif
    210 
    211210  Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
    212211  if (!pcSlice->isReferenced()) c += 32;
    213212
    214213  //-- For time output for each slice
    215 
    216214#if H_MV
    217215  printf("\nLayer %2d   POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getLayerId(),
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecSbac.h

    r324 r446  
    7676  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
    7777  Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
     78#if H_3D
     79  Void  parseSPS                  ( TComSPS* /*pcSPS*/ , Int /*viewIndex*/, Bool /*depthFlag*/ ) {}
     80#else
    7881  Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
     82#endif
    7983  Void  parsePPS                  ( TComPPS* /*pcPPS*/ ) {}
    8084
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecSlice.h

    r438 r446  
    8484  Void      initCtxMem(  UInt i );
    8585  Void      setCtxMem( TDecSbac* sb, Int b )   { CTXMem[b] = sb; }
     86  Int       getCtxMemSize( )                   { return (Int)CTXMem.size(); }
    8687};
    8788
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r438 r446  
    4242ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder;
    4343#endif
    44 
    4544//! \ingroup TLibDecoder
    4645//! \{
    4746
     47#if H_3D
     48CamParsCollector::CamParsCollector()
     49: m_bInitialized( false )
     50{
     51  m_aaiCodedOffset         = new Int* [ MAX_NUM_LAYERS ];
     52  m_aaiCodedScale          = new Int* [ MAX_NUM_LAYERS ];
     53  m_aiViewId               = new Int  [ MAX_NUM_LAYERS ];
     54  m_aiLayerIdx             = new Int  [ MAX_NUM_LAYERS ];
     55
     56  m_bViewReceived          = new Bool [ MAX_NUM_LAYERS ];
     57  for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ )
     58  {
     59    m_aaiCodedOffset      [ uiId ] = new Int [ MAX_NUM_LAYERS ];
     60    m_aaiCodedScale       [ uiId ] = new Int [ MAX_NUM_LAYERS ];
     61  }
     62
     63  xCreateLUTs( (UInt)MAX_NUM_LAYERS, (UInt)MAX_NUM_LAYERS, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     64  m_iLog2Precision   = LOG2_DISP_PREC_LUT;
     65  m_uiBitDepthForLUT = 8; // fixed
     66}
     67
     68CamParsCollector::~CamParsCollector()
     69{
     70  for( UInt uiId = 0; uiId < MAX_NUM_LAYERS; uiId++ )
     71  {
     72    delete [] m_aaiCodedOffset      [ uiId ];
     73    delete [] m_aaiCodedScale       [ uiId ];
     74  }
     75  delete [] m_aaiCodedOffset;
     76  delete [] m_aaiCodedScale;
     77  delete [] m_aiViewId; 
     78  delete [] m_bViewReceived;
     79
     80  xDeleteArray( m_adBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );
     81  xDeleteArray( m_aiBaseViewShiftLUT, MAX_NUM_LAYERS, MAX_NUM_LAYERS, 2 );
     82}
     83
     84Void
     85CamParsCollector::init( FILE* pCodedScaleOffsetFile )
     86{
     87  m_bInitialized            = true;
     88  m_pCodedScaleOffsetFile   = pCodedScaleOffsetFile;
     89  m_uiCamParsCodedPrecision = 0;
     90  m_bCamParsVaryOverTime    = false;
     91  m_iLastViewIndex             = -1;
     92  m_iLastPOC                = -1;
     93  m_uiMaxViewIndex             = 0;
     94}
     95
     96Void
     97CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT)
     98{
     99
     100  uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews );
     101  uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews );
     102
     103  radLUT         = new Double***[ uiNumberSourceViews ];
     104  raiLUT         = new Int   ***[ uiNumberSourceViews ];
     105
     106  for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )
     107  {
     108    radLUT        [ uiSourceView ] = new Double**[ uiNumberTargetViews ];
     109    raiLUT        [ uiSourceView ] = new Int   **[ uiNumberTargetViews ];
     110
     111    for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )
     112    {
     113      radLUT        [ uiSourceView ][ uiTargetView ]      = new Double*[ 2 ];
     114      radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];
     115      radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];
     116
     117      raiLUT        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
     118      raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
     119      raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
     120    }
     121  }
     122}
     123
     124Void
     125  CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)
     126{
     127  Int     iLog2DivLuma   = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision;   AOF( iLog2DivLuma > 0 );
     128  Int     iLog2DivChroma = iLog2DivLuma + 1;
     129
     130  iOffset <<= m_uiBitDepthForLUT;
     131
     132  Double dScale  = (Double) iScale  / (( Double ) ( 1 << iLog2DivLuma ));
     133  Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));
     134
     135  // offsets including rounding offsets
     136  Int64 iOffsetLuma   = iOffset + ( ( 1 << iLog2DivLuma   ) >> 1 );
     137  Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );
     138
     139
     140  for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
     141  {
     142
     143    // real-valued look-up tables
     144    Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     145    Double  dShiftChroma    = dShiftLuma / 2;
     146    radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
     147    radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;
     148
     149    // integer-valued look-up tables
     150    Int64   iTempScale      = (Int64)uiDepthValue * iScale;
     151    Int64   iShiftLuma      = ( iTempScale + iOffsetLuma   ) >> iLog2DivLuma;
     152    Int64   iShiftChroma    = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;
     153    raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;
     154    raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;
     155  }
     156
     157  radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     158  radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     159  raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     160  raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     161}
     162
     163Void
     164CamParsCollector::uninit()
     165{
     166  m_bInitialized = false;
     167}
     168
     169Void
     170CamParsCollector::setSlice( TComSlice* pcSlice )
     171{
     172
     173  if( pcSlice == 0 )
     174  {
     175    AOF( xIsComplete() );
     176    if( m_bCamParsVaryOverTime || m_iLastPOC == 0 )
     177    {
     178      xOutput( m_iLastPOC );
     179    }
     180    return;
     181  }
     182 
     183  if ( pcSlice->getIsDepth())
     184  {
     185    return;
     186  }
     187
     188  Bool  bFirstAU          = ( pcSlice->getPOC()     == 0 );
     189  Bool  bFirstSliceInAU   = ( pcSlice->getPOC()     != Int ( m_iLastPOC ) );
     190  Bool  bFirstSliceInView = ( pcSlice->getViewIndex()  != UInt( m_iLastViewIndex ) || bFirstSliceInAU );
     191
     192  AOT(  bFirstSliceInAU  &&   pcSlice->getViewIndex()  != 0 );
     193  AOT( !bFirstSliceInAU  &&   pcSlice->getViewIndex()   < UInt( m_iLastViewIndex ) );
     194 
     195  AOT( !bFirstSliceInAU  &&   pcSlice->getViewIndex()   > UInt( m_iLastViewIndex + 1 ) );
     196 
     197  AOT( !bFirstAU         &&   pcSlice->getViewIndex()   > m_uiMaxViewIndex );
     198
     199  if ( !bFirstSliceInView )
     200  {
     201    if( m_bCamParsVaryOverTime ) // check consistency of slice parameters here
     202    {
     203      UInt uiViewIndex = pcSlice->getViewIndex();
     204      for( UInt uiBaseViewIndex = 0; uiBaseViewIndex < uiViewIndex; uiBaseViewIndex++ )
     205      {
     206        AOF( m_aaiCodedScale [ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedScale    () [ uiBaseViewIndex ] );
     207        AOF( m_aaiCodedOffset[ uiBaseViewIndex ][ uiViewIndex ] == pcSlice->getCodedOffset   () [ uiBaseViewIndex ] );
     208        AOF( m_aaiCodedScale [ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedScale () [ uiBaseViewIndex ] );
     209        AOF( m_aaiCodedOffset[ uiViewIndex ][ uiBaseViewIndex ] == pcSlice->getInvCodedOffset() [ uiBaseViewIndex ] );
     210      }
     211    }
     212    return;
     213  }
     214
     215  if( bFirstSliceInAU )
     216  {
     217    if( !bFirstAU )
     218    {
     219      AOF( xIsComplete() );
     220      xOutput( m_iLastPOC );
     221    }
     222    ::memset( m_bViewReceived, false, MAX_NUM_LAYERS * sizeof( Bool ) );
     223  }
     224
     225  UInt uiViewIndex                       = pcSlice->getViewIndex();
     226  m_bViewReceived[ uiViewIndex ]         = true;
     227  if( bFirstAU )
     228  {
     229    m_uiMaxViewIndex                     = std::max( m_uiMaxViewIndex, uiViewIndex );
     230    m_aiViewId[ uiViewIndex ]            = pcSlice->getViewId();
     231    if( uiViewIndex == 1 )
     232    {
     233      m_uiCamParsCodedPrecision       = pcSlice->getSPS()->getCamParPrecision     ();
     234      m_bCamParsVaryOverTime          = pcSlice->getSPS()->hasCamParInSliceHeader ();
     235    }
     236    else if( uiViewIndex > 1 )
     237    {
     238      AOF( m_uiCamParsCodedPrecision == pcSlice->getSPS()->getCamParPrecision     () );
     239      AOF( m_bCamParsVaryOverTime    == pcSlice->getSPS()->hasCamParInSliceHeader () );
     240    }
     241    for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ )
     242    {
     243      if( m_bCamParsVaryOverTime )
     244      {
     245        m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getCodedScale    () [ uiBaseIndex ];
     246        m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getCodedOffset   () [ uiBaseIndex ];
     247        m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getInvCodedScale () [ uiBaseIndex ];
     248        m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getInvCodedOffset() [ uiBaseIndex ];
     249        xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
     250        xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
     251      }
     252      else
     253      {
     254        m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getSPS()->getCodedScale    () [ uiBaseIndex ];
     255        m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getSPS()->getCodedOffset   () [ uiBaseIndex ];
     256        m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getSPS()->getInvCodedScale () [ uiBaseIndex ];
     257        m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseIndex ];
     258        xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     259        xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     260      }
     261    }
     262  }
     263  else
     264  {
     265    AOF( m_aiViewId[ uiViewIndex ] == pcSlice->getViewId() );
     266    if( m_bCamParsVaryOverTime )
     267    {
     268      for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ )
     269      {
     270        m_aaiCodedScale [ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getCodedScale    () [ uiBaseIndex ];
     271        m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ]  = pcSlice->getCodedOffset   () [ uiBaseIndex ];
     272        m_aaiCodedScale [ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getInvCodedScale () [ uiBaseIndex ];
     273        m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ]  = pcSlice->getInvCodedOffset() [ uiBaseIndex ];
     274
     275        xInitLUTs( uiBaseIndex, uiViewIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     276        xInitLUTs( uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiViewIndex ][ uiBaseIndex ], m_aaiCodedOffset[ uiViewIndex ][ uiBaseIndex ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     277      }
     278    }
     279  }
     280 
     281  m_iLastViewIndex = (Int)pcSlice->getViewIndex(); 
     282  m_iLastPOC       = (Int)pcSlice->getPOC();
     283}
     284
     285Bool
     286CamParsCollector::xIsComplete()
     287{
     288  for( UInt uiView = 0; uiView <= m_uiMaxViewIndex; uiView++ )
     289  {
     290    if( m_bViewReceived[ uiView ] == 0 )
     291    {
     292      return false;
     293    }
     294  }
     295  return true;
     296}
     297
     298Void
     299CamParsCollector::xOutput( Int iPOC )
     300{
     301  if( m_pCodedScaleOffsetFile )
     302  {
     303    if( iPOC == 0 )
     304    {
     305      fprintf( m_pCodedScaleOffsetFile, "#  ViewIndex       ViewId\n" );
     306      fprintf( m_pCodedScaleOffsetFile, "#----------- ------------\n" );
     307      for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ )
     308      {
     309        fprintf( m_pCodedScaleOffsetFile, "%12d %12d\n", uiViewIndex, m_aiViewId[ uiViewIndex ] );
     310      }
     311      fprintf( m_pCodedScaleOffsetFile, "\n\n");
     312      fprintf( m_pCodedScaleOffsetFile, "# StartFrame     EndFrame   TargetView     BaseView   CodedScale  CodedOffset    Precision\n" );
     313      fprintf( m_pCodedScaleOffsetFile, "#----------- ------------ ------------ ------------ ------------ ------------ ------------\n" );
     314    }
     315    if( iPOC == 0 || m_bCamParsVaryOverTime )
     316    {
     317      Int iS = iPOC;
     318      Int iE = ( m_bCamParsVaryOverTime ? iPOC : ~( 1 << 31 ) );
     319      for( UInt uiViewIndex = 0; uiViewIndex <= m_uiMaxViewIndex; uiViewIndex++ )
     320      {
     321        for( UInt uiBaseIndex = 0; uiBaseIndex <= m_uiMaxViewIndex; uiBaseIndex++ )
     322        {
     323          if( uiViewIndex != uiBaseIndex )
     324          {
     325            fprintf( m_pCodedScaleOffsetFile, "%12d %12d %12d %12d %12d %12d %12d\n",
     326              iS, iE, uiViewIndex, uiBaseIndex, m_aaiCodedScale[ uiBaseIndex ][ uiViewIndex ], m_aaiCodedOffset[ uiBaseIndex ][ uiViewIndex ], m_uiCamParsCodedPrecision );
     327          }
     328        }
     329      }
     330    }
     331  }
     332}
     333#endif
    48334TDecTop::TDecTop()
    49335{
     
    51337  m_iMaxRefPicNum = 0;
    52338#if ENC_DEC_TRACE
     339#if H_MV
     340  if ( g_hTrace == NULL )
     341  {
     342#endif
    53343  g_hTrace = fopen( "TraceDec.txt", "wb" );
    54344  g_bJustDoIt = g_bEncDecTraceDisable;
    55345  g_nSymbolCounter = 0;
     346#if H_MV
     347  }
     348#endif
    56349#endif
    57350  m_pocCRA = 0;
     
    65358  m_viewId = 0;
    66359#if H_3D
     360  m_viewIndex = 0;
    67361  m_isDepth = false;
     362  m_pcCamParsCollector = 0;
    68363#endif
    69364#endif
     
    94389}
    95390
    96 
    97391Void TDecTop::init()
    98392{
     
    101395  initROM();
    102396#endif
    103 
    104397  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
    105398  m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder );
     
    149442  }
    150443
     444#if L0323_DPB
     445  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     446#else
    151447  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded
     448#endif
    152449  if (m_cListPic.size() < (UInt)m_iMaxRefPicNum)
    153450  {
     
    219516  rpcListPic          = &m_cListPic; 
    220517  m_cCuDecoder.destroy();       
    221 
    222518#if H_MV
    223519  TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 
    224520  TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc );
    225521#endif
    226 
    227522  m_bFirstSliceInPicture  = true;
    228523
     
    290585  assert (sps != 0);
    291586
    292   if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->getIdrPicFlag()))
     587  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
    293588  {
    294589    printf ("Parameter set activation failed!");
     
    296591  }
    297592
     593  if( pps->getDependentSliceSegmentsEnabledFlag() )
     594  {
     595    Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;
     596
     597    if (m_cSliceDecoder.getCtxMemSize() != NumCtx)
     598    {
     599      m_cSliceDecoder.initCtxMem(NumCtx);
     600      for ( UInt st = 0; st < NumCtx; st++ )
     601      {
     602        TDecSbac* ctx = NULL;
     603        ctx = new TDecSbac;
     604        ctx->init( &m_cBinCABAC );
     605        m_cSliceDecoder.setCtxMem( ctx, st );
     606      }
     607    }
     608  }
     609
    298610  m_apcSlicePilot->setPPS(pps);
    299611  m_apcSlicePilot->setSPS(sps);
    300 
    301612#if H_MV
    302613  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() );
    303614#endif
    304 
    305615  pps->setSPS(sps);
    306616  pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1);
    307617  pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) );
    308618
    309   for (Int i = 0; i < sps->getMaxCUDepth() - g_uiAddCUDepth; i++)
     619  g_bitDepthY     = sps->getBitDepthY();
     620  g_bitDepthC     = sps->getBitDepthC();
     621  g_uiMaxCUWidth  = sps->getMaxCUWidth();
     622  g_uiMaxCUHeight = sps->getMaxCUHeight();
     623  g_uiMaxCUDepth  = sps->getMaxCUDepth();
     624  g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() );
     625
     626  for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++)
    310627  {
    311628    sps->setAMPAcc( i, sps->getUseAMP() );
    312629  }
    313630
    314   for (Int i = sps->getMaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++)
     631  for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++)
    315632  {
    316633    sps->setAMPAcc( i, 0 );
     
    318635
    319636  m_cSAO.destroy();
    320   m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight );
    321   m_cLoopFilter.        create( g_uiMaxCUDepth );
     637  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
     638  m_cLoopFilter.create( sps->getMaxCUDepth() );
    322639}
    323640
     
    345662
    346663  m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType);
    347   if((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N) ||
    348      (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) ||
    349      (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N))
    350   {
    351     m_apcSlicePilot->setTemporalLayerNonReferenceFlag(true);
    352   }
     664  Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N ||
     665                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N   ||
     666                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N  ||
     667                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N  ||
     668                           m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N);
     669  m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag);
     670 
    353671  m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS
    354672  m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);
     
    357675  m_apcSlicePilot->setLayerId( nalu.m_layerId );
    358676#endif
    359 
    360677  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder);
    361678
    362679#if H_MV 
    363680  TComVPS* vps     = m_apcSlicePilot->getVPS();
    364   Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId );
    365  
    366   setViewId(  vps->getViewId( layerIdInVps  ) );
    367   m_apcSlicePilot->setViewId( getViewId() );
     681  Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId ); 
     682  setViewId   ( vps->getViewId   ( layerIdInVps )      ); 
    368683#if H_3D
    369   setIsDepth( vps->getDepthId( layerIdInVps ) == 1 );
    370   m_apcSlicePilot->setIsDepth( getIsDepth() );
    371 #endif
    372 #endif
    373 
    374   if (m_apcSlicePilot->isNextSlice())
    375   {
     684  setViewIndex( vps->getViewIndex( layerIdInVps )      ); 
     685  setIsDepth  ( vps->getDepthId  ( layerIdInVps ) == 1 ); 
     686  m_ivPicLists->setVPS( vps );
     687#endif
     688#endif
    376689    // Skip pictures due to random access
    377690    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    384697      return false;
    385698    }
    386   }
    387 
     699
     700  //we should only get a different poc for a new picture (with CTU address==0)
     701  if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0))
     702  {
     703    printf ("Warning, the first slice of a picture might have been lost!\n");
     704  }
    388705  // exit when a new picture is found
    389   if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence)
     706  if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence )
    390707  {
    391708    if (m_prevPOC >= m_pocRandomAccess)
     
    396713    m_prevPOC = m_apcSlicePilot->getPOC();
    397714  }
    398 
    399715#if H_MV
    400716  if ( newLayerFlag )
     
    403719  }
    404720#endif
    405 
    406 
    407721  // actual decoding starts here
    408722  xActivateParameterSets();
     
    419733    xCreateLostPicture(lostPoc-1);
    420734  }
    421 
    422735  if (m_bFirstSliceInPicture)
    423736  {
     
    425738    m_cPrediction.initTempBuff();
    426739    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
    427    
    428740#if H_MV
    429741    m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer );
    430742#endif
    431 
    432 
    433743    //  Get a new picture buffer
    434744    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     
    566876  pcPic->setViewId ( getViewId() );
    567877#if H_3D
    568   pcPic->setIsDepth( getIsDepth() );
    569 #endif
    570 #endif
    571 
     878  pcPic->setViewIndex( getViewIndex() );
     879  pcPic->setIsDepth  ( getIsDepth  () );
     880#endif
     881#endif
    572882  if (bNextSlice)
    573883  {
    574     pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA );
     884    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic );
    575885    // Set reference list
    576 
    577886#if H_MV   
    578     pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer );   
     887    pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true );   
     888#else
     889#if FIX1071
     890    pcSlice->setRefPicList( m_cListPic, true );
    579891#else
    580892    pcSlice->setRefPicList( m_cListPic );
    581893#endif
    582894
     895#endif
    583896    // For generalized B
    584897    // note: maybe not existed case (always L0 is copied to L1 if L1 is empty)
     
    622935    //---------------
    623936    pcSlice->setRefPOCList();
     937#if !L0034_COMBINED_LIST_CLEANUP
    624938    pcSlice->setNoBackPredFlag( false );
    625939    if ( pcSlice->getSliceType() == B_SLICE )
     
    638952      }
    639953    }
     954#endif
    640955  }
    641956
     
    664979  //  Decode a picture
    665980  m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic);
    666 
     981#if H_3D
     982  if( m_pcCamParsCollector )
     983  {
     984    m_pcCamParsCollector->setSlice( pcSlice );
     985  }
     986#endif
    667987  m_bFirstSliceInPicture = false;
    668988  m_uiSliceIdx++;
     
    6821002{
    6831003  TComSPS* sps = new TComSPS();
     1004#if H_3D
     1005  // Preliminary fix. assuming that all sps refer to the same SPS.
     1006  // Parsing dependency should be resolved!
     1007  TComVPS* vps = m_parameterSetManagerDecoder.getPrefetchedVPS( 0 );
     1008  assert( vps != 0 );
     1009  Int layerIdInVPS = vps->getLayerIdInVps( m_layerId );
     1010  m_cEntropyDecoder.decodeSPS( sps, vps->getViewIndex( layerIdInVPS ), ( vps->getDepthId( layerIdInVPS ) == 1 ) );
     1011#else
    6841012  m_cEntropyDecoder.decodeSPS( sps );
     1013#endif
    6851014  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    6861015}
     
    6911020  m_cEntropyDecoder.decodePPS( pps );
    6921021  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
    693 
    694   if( pps->getDependentSliceSegmentsEnabledFlag() )
    695   {
    696     Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;
    697     m_cSliceDecoder.initCtxMem(NumCtx);
    698     for ( UInt st = 0; st < NumCtx; st++ )
    699     {
    700       TDecSbac* ctx = NULL;
    701       ctx = new TDecSbac;
    702       ctx->init( &m_cBinCABAC );
    703       m_cSliceDecoder.setCtxMem( ctx, st );
    704     }
    705   }
    7061022}
    7071023
    7081024Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType )
    7091025{
    710   if(nalUnitType == NAL_UNIT_SEI_SUFFIX)
     1026  if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
    7111027  {
    7121028    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     
    7531069      return false;
    7541070     
    755     case NAL_UNIT_SEI:
    756     case NAL_UNIT_SEI_SUFFIX:
     1071    case NAL_UNIT_PREFIX_SEI:
     1072    case NAL_UNIT_SUFFIX_SEI:
    7571073      xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType );
    7581074      return false;
     
    7601076    case NAL_UNIT_CODED_SLICE_TRAIL_R:
    7611077    case NAL_UNIT_CODED_SLICE_TRAIL_N:
    762     case NAL_UNIT_CODED_SLICE_TLA:
     1078    case NAL_UNIT_CODED_SLICE_TLA_R:
    7631079    case NAL_UNIT_CODED_SLICE_TSA_N:
    7641080    case NAL_UNIT_CODED_SLICE_STSA_R:
    7651081    case NAL_UNIT_CODED_SLICE_STSA_N:
    766     case NAL_UNIT_CODED_SLICE_BLA:
    767     case NAL_UNIT_CODED_SLICE_BLANT:
     1082    case NAL_UNIT_CODED_SLICE_BLA_W_LP:
     1083    case NAL_UNIT_CODED_SLICE_BLA_W_RADL:
    7681084    case NAL_UNIT_CODED_SLICE_BLA_N_LP:
    769     case NAL_UNIT_CODED_SLICE_IDR:
     1085    case NAL_UNIT_CODED_SLICE_IDR_W_RADL:
    7701086    case NAL_UNIT_CODED_SLICE_IDR_N_LP:
    7711087    case NAL_UNIT_CODED_SLICE_CRA:
    7721088    case NAL_UNIT_CODED_SLICE_RADL_N:
    773     case NAL_UNIT_CODED_SLICE_DLP:
     1089    case NAL_UNIT_CODED_SLICE_RADL_R:
    7741090    case NAL_UNIT_CODED_SLICE_RASL_N:
    775     case NAL_UNIT_CODED_SLICE_TFD:
     1091    case NAL_UNIT_CODED_SLICE_RASL_R:
    7761092#if H_MV
    7771093      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag);
     
    7951111Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay)
    7961112{
    797   if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TFD || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     1113  if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    7981114  {
    7991115    iPOCLastDisplay++;
     
    8261142  {
    8271143    if (   m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA
    828         || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
     1144        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
    8291145        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    830         || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT )
     1146        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL )
    8311147    {
    8321148      // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
    8331149      m_pocRandomAccess = m_apcSlicePilot->getPOC();
    8341150    }
    835     else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     1151    else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    8361152    {
    8371153      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
     
    8491165  }
    8501166  // skip the reordered pictures, if necessary
    851   else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TFD || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     1167  else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    8521168  {
    8531169    iPOCLastDisplay++;
     
    8811197
    8821198#endif
    883 
    8841199//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.h

    r438 r446  
    6464class TAppDecTop;
    6565#endif
    66 
     66#if H_3D
     67class CamParsCollector
     68{
     69public:
     70  CamParsCollector  ();
     71  ~CamParsCollector ();
     72
     73  Void  init        ( FILE* pCodedScaleOffsetFile );
     74  Void  uninit      ();
     75  Void  setSlice    ( TComSlice* pcSlice );
     76
     77  Bool  isInitialized() const     { return m_bInitialized; }
     78  Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
     79
     80private:
     81  Bool  xIsComplete ();
     82  Void  xOutput     ( Int iPOC );
     83
     84private:
     85  Bool    m_bInitialized;
     86  FILE*   m_pCodedScaleOffsetFile;
     87
     88  Int**   m_aaiCodedOffset;
     89  Int**   m_aaiCodedScale;
     90  Int*    m_aiViewId; 
     91  Int*    m_aiLayerIdx;
     92
     93  Bool*   m_bViewReceived;
     94  UInt    m_uiCamParsCodedPrecision;
     95  Bool    m_bCamParsVaryOverTime;
     96  Int     m_iLastViewIndex;
     97  Int     m_iLastPOC;
     98  UInt    m_uiMaxViewIndex;
     99
     100
     101  UInt    m_uiBitDepthForLUT;
     102  UInt    m_iLog2Precision;
     103  UInt    m_uiInputBitDepth;
     104
     105  // look-up tables
     106  Double****   m_adBaseViewShiftLUT;       ///< Disparity LUT
     107  Int****      m_aiBaseViewShiftLUT;       ///< Disparity LUT
     108  Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);
     109  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);
     110  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );
     111  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2 );
     112  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize );
     113
     114};
     115
     116template <class T>
     117Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )
     118{
     119  if( rpt )
     120  {
     121    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     122    {
     123      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     124      {
     125        for( UInt uiM = 0; uiM < uiSize3; uiM++ )
     126        {
     127          delete[] rpt[ uiK ][ uiL ][ uiM ];
     128        }
     129        delete[] rpt[ uiK ][ uiL ];
     130      }
     131      delete[] rpt[ uiK ];
     132    }
     133    delete[] rpt;
     134  }
     135  rpt = NULL;
     136};
     137
     138
     139template <class T>
     140Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )
     141{
     142  if( rpt )
     143  {
     144    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     145    {
     146      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     147      {
     148        delete[] rpt[ uiK ][ uiL ];
     149      }
     150      delete[] rpt[ uiK ];
     151    }
     152    delete[] rpt;
     153  }
     154  rpt = NULL;
     155};
     156
     157
     158template <class T>
     159Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )
     160{
     161  if( rpt )
     162  {
     163    for( UInt uiK = 0; uiK < uiSize; uiK++ )
     164    {
     165      delete[] rpt[ uiK ];
     166    }
     167    delete[] rpt;
     168  }
     169  rpt = NULL;
     170};
     171
     172#endif //H_3D
    67173/// decoder class
    68174class TDecTop
     
    81187  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
    82188#endif
    83 
    84189  TComSlice*              m_apcSlicePilot;
    85190 
     
    114219  std::vector<TComPic*>   m_refPicSetInterLayer;
    115220#if H_3D
     221  Int                     m_viewIndex;
    116222  Bool                    m_isDepth;
     223  CamParsCollector*       m_pcCamParsCollector;
    117224#endif
    118225#endif
     
    142249#endif
    143250 
    144 
    145251#if H_MV   
    146252  TComPic*                getPic                ( Int poc );
     
    154260  Int                     getViewId             ()               { return m_viewId;     } 
    155261#if H_3D   
     262  Void                    setViewIndex          ( Int viewIndex  )  { m_viewIndex  = viewIndex;  }
     263  Int                     getViewIndex          ()               { return m_viewIndex;     } 
    156264  Void                    setIsDepth            ( Bool isDepth ) { m_isDepth = isDepth; }
    157265  Bool                    getIsDepth            ()               { return m_isDepth;    }
    158 #endif
    159 #endif
    160  
     266  Void                    setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }
     267#endif
     268#endif
    161269protected:
    162270  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.cpp

    r438 r446  
    8484    fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n");
    8585    break;
     86#if J0149_TONE_MAPPING_SEI
     87  case SEI::TONE_MAPPING_INFO:
     88    fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n");
     89    break;
     90#endif
     91#if L0208_SOP_DESCRIPTION_SEI
     92  case SEI::SOP_DESCRIPTION:
     93    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
     94    break;
     95#endif
     96#if K0180_SCALABLE_NESTING_SEI
     97  case SEI::SCALABLE_NESTING:
     98    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
     99    break;
     100#endif
    86101  default:
    87102    fprintf( g_hTrace, "=========== Unknown SEI message ===========\n");
     
    91106#endif
    92107
     108#if K0180_SCALABLE_NESTING_SEI
     109void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps)
     110#else
    93111void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps)
     112#endif
    94113{
    95114  switch (sei.payloadType())
     
    128147    xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei));
    129148    break;
     149#if J0149_TONE_MAPPING_SEI
     150  case SEI::TONE_MAPPING_INFO:
     151    xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei));
     152    break;
     153#endif
     154#if L0208_SOP_DESCRIPTION_SEI
     155  case SEI::SOP_DESCRIPTION:
     156    xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei));
     157    break;
     158#endif
     159#if K0180_SCALABLE_NESTING_SEI
     160  case SEI::SCALABLE_NESTING:
     161    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
     162    break;
     163#endif
    130164  default:
    131165    assert(!"Unhandled SEI message");
     
    145179  setBitstream(&bs_count);
    146180
     181
     182#if K0180_SCALABLE_NESTING_SEI
     183
     184#if ENC_DEC_TRACE
     185  Bool traceEnable = g_HLSTraceEnable;
     186  g_HLSTraceEnable = false;
     187#endif
     188  xWriteSEIpayloadData(bs_count, sei, sps);
     189#if ENC_DEC_TRACE
     190  g_HLSTraceEnable = traceEnable;
     191#endif
     192
     193#else
     194
    147195#if ENC_DEC_TRACE
    148196  g_HLSTraceEnable = false;
     
    152200  g_HLSTraceEnable = true;
    153201#endif
     202
     203#endif
     204
    154205  UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits();
    155206  assert(0 == payload_data_num_bits % 8);
     
    158209
    159210#if ENC_DEC_TRACE
     211#if K0180_SCALABLE_NESTING_SEI
     212  if (g_HLSTraceEnable)
     213#endif
    160214  xTraceSEIHeader();
    161215#endif
     
    177231  /* payloadData */
    178232#if ENC_DEC_TRACE
     233#if K0180_SCALABLE_NESTING_SEI
     234  if (g_HLSTraceEnable)
     235#endif
    179236  xTraceSEIMessageType(sei.payloadType());
    180237#endif
    181238
     239#if K0180_SCALABLE_NESTING_SEI
     240  xWriteSEIpayloadData(bs, sei, sps);
     241#else
    182242  xWriteSEIpayloadData(sei, sps);
     243#endif
    183244}
    184245
     
    421482  xWriteByteAlign();
    422483}
     484
     485#if J0149_TONE_MAPPING_SEI
     486Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei)
     487{
     488  Int i;
     489  WRITE_UVLC( sei.m_toneMapId,                    "tone_map_id" );
     490  WRITE_FLAG( sei.m_toneMapCancelFlag,            "tone_map_cancel_flag" );
     491  if( !sei.m_toneMapCancelFlag )
     492  {
     493    WRITE_FLAG( sei.m_toneMapPersistenceFlag,     "tone_map_persistence_flag" );
     494    WRITE_CODE( sei.m_codedDataBitDepth,    8,    "coded_data_bit_depth" );
     495    WRITE_CODE( sei.m_targetBitDepth,       8,    "target_bit_depth" );
     496    WRITE_UVLC( sei.m_modelId,                    "model_id" );
     497    switch(sei.m_modelId)
     498    {
     499    case 0:
     500      {
     501        WRITE_CODE( sei.m_minValue,  32,        "min_value" );
     502        WRITE_CODE( sei.m_maxValue, 32,         "max_value" );
     503        break;
     504      }
     505    case 1:
     506      {
     507        WRITE_CODE( sei.m_sigmoidMidpoint, 32,  "sigmoid_midpoint" );
     508        WRITE_CODE( sei.m_sigmoidWidth,    32,  "sigmoid_width"    );
     509        break;
     510      }
     511    case 2:
     512      {
     513        UInt num = 1u << sei.m_targetBitDepth;
     514        for(i = 0; i < num; i++)
     515        {
     516          WRITE_CODE( sei.m_startOfCodedInterval[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3,  "start_of_coded_interval" );
     517        }
     518        break;
     519      }
     520    case 3:
     521      {
     522        WRITE_CODE( sei.m_numPivots, 16,          "num_pivots" );
     523        for(i = 0; i < sei.m_numPivots; i++ )
     524        {
     525          WRITE_CODE( sei.m_codedPivotValue[i], (( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3,       "coded_pivot_value" );
     526          WRITE_CODE( sei.m_targetPivotValue[i], (( sei.m_targetBitDepth + 7 ) >> 3 ) << 3,         "target_pivot_value");
     527        }
     528        break;
     529      }
     530    case 4:
     531      {
     532        WRITE_CODE( sei.m_cameraIsoSpeedIdc,    8,    "camera_iso_speed_idc" );
     533        if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO
     534        {
     535          WRITE_CODE( sei.m_cameraIsoSpeedValue,    32,    "camera_iso_speed_value" );
     536        }
     537        WRITE_FLAG( sei.m_exposureCompensationValueSignFlag,           "exposure_compensation_value_sign_flag" );
     538        WRITE_CODE( sei.m_exposureCompensationValueNumerator,     16,  "exposure_compensation_value_numerator" );
     539        WRITE_CODE( sei.m_exposureCompensationValueDenomIdc,      16,  "exposure_compensation_value_denom_idc" );
     540        WRITE_CODE( sei.m_refScreenLuminanceWhite,                32,  "ref_screen_luminance_white" );
     541        WRITE_CODE( sei.m_extendedRangeWhiteLevel,                32,  "extended_range_white_level" );
     542        WRITE_CODE( sei.m_nominalBlackLevelLumaCodeValue,         16,  "nominal_black_level_luma_code_value" );
     543        WRITE_CODE( sei.m_nominalWhiteLevelLumaCodeValue,         16,  "nominal_white_level_luma_code_value" );
     544        WRITE_CODE( sei.m_extendedWhiteLevelLumaCodeValue,        16,  "extended_white_level_luma_code_value" );
     545        break;
     546      }
     547    default:
     548      {
     549        assert(!"Undefined SEIToneMapModelId");
     550        break;
     551      }
     552    }//switch m_modelId
     553  }//if(!sei.m_toneMapCancelFlag)
     554
     555  xWriteByteAlign();
     556}
     557#endif
     558
    423559Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei)
    424560{
     
    455591}
    456592
     593#if L0208_SOP_DESCRIPTION_SEI
     594Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei)
     595{
     596  WRITE_UVLC( sei.m_sopSeqParameterSetId,           "sop_seq_parameter_set_id"               );
     597  WRITE_UVLC( sei.m_numPicsInSopMinus1,             "num_pics_in_sop_minus1"               );
     598  for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++)
     599  {
     600    WRITE_CODE( sei.m_sopDescVclNaluType[i], 6, "sop_desc_vcl_nalu_type" );
     601    WRITE_CODE( sei.m_sopDescTemporalId[i],  3, "sop_desc_temporal_id" );
     602    if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP)
     603    {
     604      WRITE_UVLC( sei.m_sopDescStRpsIdx[i],           "sop_desc_st_rps_idx"               );
     605    }
     606    if (i > 0)
     607    {
     608      WRITE_SVLC( sei.m_sopDescPocDelta[i],           "sop_desc_poc_delta"               );
     609    }
     610  }
     611
     612  xWriteByteAlign();
     613}
     614#endif
     615
     616#if K0180_SCALABLE_NESTING_SEI
     617Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps)
     618{
     619  WRITE_FLAG( sei.m_bitStreamSubsetFlag,             "bitstream_subset_flag"         );
     620  WRITE_FLAG( sei.m_nestingOpFlag,                   "nesting_op_flag      "         );
     621  if (sei.m_nestingOpFlag)
     622  {
     623    WRITE_FLAG( sei.m_defaultOpFlag,                 "default_op_flag"               );
     624    WRITE_UVLC( sei.m_nestingNumOpsMinus1,           "nesting_num_ops"               );
     625    for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++)
     626    {
     627      WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
     628      WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3,  "nesting_max_temporal_id"       );
     629      WRITE_UVLC( sei.m_nestingOpIdx[i],                  "nesting_op_idx"                );
     630    }
     631  }
     632  else
     633  {
     634    WRITE_FLAG( sei.m_allLayersFlag,                      "all_layers_flag"               );
     635    if (!sei.m_allLayersFlag)
     636    {
     637      WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
     638      WRITE_UVLC( sei.m_nestingNumLayersMinus1,           "nesting_num_layers"            );
     639      for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++)
     640      {
     641        WRITE_CODE( sei.m_nestingLayerId[i], 6,           "nesting_layer_id"              );
     642      }
     643    }
     644  }
     645 
     646  // byte alignment
     647  while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
     648  {
     649    WRITE_FLAG( 0, "nesting_zero_bit" );
     650  }
     651
     652  // write nested SEI messages
     653  for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++)
     654  {
     655    writeSEImessage(bs, *(*it), sps);
     656  }
     657}
     658#endif
     659
    457660Void SEIWriter::xWriteByteAlign()
    458661{
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/SEIwrite.h

    r438 r446  
    5050
    5151protected:
     52#if K0180_SCALABLE_NESTING_SEI
     53  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps);
     54#else
    5255  Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps);
     56#endif
    5357  Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei);
    5458  Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei);
     
    6367  Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei);
    6468  Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei);
     69#if J0149_TONE_MAPPING_SEI
     70  Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei);
     71#endif
     72#if L0208_SOP_DESCRIPTION_SEI
     73  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
     74#endif
     75#if K0180_SCALABLE_NESTING_SEI
     76  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);
     77#endif
    6578  Void xWriteByteAlign();
    6679};
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp

    r438 r446  
    185185{
    186186  {
     187#if !H_MV
    187188    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    188189    DTRACE_CABAC_T( "\tstate=" )
     
    191192    DTRACE_CABAC_V( binValue )
    192193    DTRACE_CABAC_T( "\n" )
     194#endif
    193195  }
    194196  m_uiBinsCoded += m_binCountIncrement;
     
    231233{
    232234  {
     235#if !H_MV
    233236    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    234237    DTRACE_CABAC_T( "\tEPsymbol=" )
    235238    DTRACE_CABAC_V( binValue )
    236239    DTRACE_CABAC_T( "\n" )
     240#endif
    237241  }
    238242  m_uiBinsCoded += m_binCountIncrement;
     
    259263  for ( Int i = 0; i < numBins; i++ )
    260264  {
     265#if !H_MV
    261266    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    262267    DTRACE_CABAC_T( "\tEPsymbol=" )
    263268    DTRACE_CABAC_V( ( binValues >> ( numBins - 1 - i ) ) & 1 )
    264269    DTRACE_CABAC_T( "\n" )
     270#endif
    265271  }
    266272 
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r438 r446  
    285285  WRITE_FLAG(pcVUI->getNeutralChromaIndicationFlag(),           "neutral_chroma_indication_flag");
    286286  WRITE_FLAG(pcVUI->getFieldSeqFlag(),                          "field_seq_flag");
    287   assert(pcVUI->getFieldSeqFlag() == 0);                        // not currently supported
    288287  WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(),             "frame_field_info_present_flag");
    289288
     
    434433}
    435434
     435#if H_3D
     436Void TEncCavlc::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
     437#else
    436438Void TEncCavlc::codeSPS( TComSPS* pcSPS )
     439#endif
    437440{
    438441#if ENC_DEC_TRACE 
     
    474477  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    475478  {
     479#if L0323_DPB
     480    WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1,       "sps_max_dec_pic_buffering_minus1[i]" );
     481#else
    476482    WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i),           "sps_max_dec_pic_buffering[i]" );
     483#endif
    477484    WRITE_UVLC( pcSPS->getNumReorderPics(i),               "sps_num_reorder_pics[i]" );
    478485    WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase[i]" );
     
    484491  assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() );
    485492 
    486   UInt MinCUSize = pcSPS->getMaxCUWidth() >> ( pcSPS->getMaxCUDepth()-g_uiAddCUDepth );
    487   UInt log2MinCUSize = 0;
    488   while(MinCUSize > 1)
    489   {
    490     MinCUSize >>= 1;
    491     log2MinCUSize++;
    492   }
    493 
    494   WRITE_UVLC( log2MinCUSize - 3,                                                     "log2_min_coding_block_size_minus3" );
    495   WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth,                                 "log2_diff_max_min_coding_block_size" );
     493  WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3,                                "log2_min_coding_block_size_minus3" );
     494  WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(),                             "log2_diff_max_min_coding_block_size" );
    496495  WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2,                                 "log2_min_transform_block_size_minus2" );
    497496  WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" );
     
    554553  }
    555554
     555#if H_MV
     556  WRITE_FLAG( 1, "sps_extension_flag" );
     557  WRITE_FLAG( pcSPS->getInterViewMvVertConstraintFlag() ? 1 : 0, "inter_view_mv_vert_constraint_flag" );
     558#if !H_3D
     559  WRITE_FLAG( 0, "sps_extension2_flag" );
     560#else
     561  WRITE_FLAG( 1, "sps_extension2_flag"  );
     562  if (!depthFlag )
     563  {
     564    WRITE_UVLC( pcSPS->getCamParPrecision(), "cp_precision" );
     565    WRITE_FLAG( pcSPS->hasCamParInSliceHeader() ? 1 : 0, "cp_in_slice_header_flag" );
     566    if( !pcSPS->hasCamParInSliceHeader() )
     567    {
     568      for( UInt uiIndex = 0; uiIndex < viewIndex; uiIndex++ )
     569      {
     570        WRITE_SVLC( pcSPS->getCodedScale    ()[ uiIndex ],                                      "cp_scale" );
     571        WRITE_SVLC( pcSPS->getCodedOffset   ()[ uiIndex ],                                      "cp_off" );
     572        WRITE_SVLC( pcSPS->getInvCodedScale ()[ uiIndex ] + pcSPS->getCodedScale ()[ uiIndex ], "cp_inv_scale_plus_scale" );
     573        WRITE_SVLC( pcSPS->getInvCodedOffset()[ uiIndex ] + pcSPS->getCodedOffset()[ uiIndex ], "cp_inv_off_plus_off" );
     574      }
     575    }
     576  }
     577
     578  WRITE_FLAG( 0, "sps_extension3_flag" );
     579#endif
     580#else
    556581  WRITE_FLAG( 0, "sps_extension_flag" );
     582#endif
    557583}
    558584
     
    569595  WRITE_FLAG( pcVPS->getTemporalNestingFlag(),                "vps_temporal_id_nesting_flag" );
    570596  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
     597#if H_MV
    571598  WRITE_CODE( 0xffff,                              16,        "vps_extension_offset" );
     599#else
     600  WRITE_CODE( 0xffff,                              16,        "vps_reserved_ffff_16bits" );
     601#endif
    572602  codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 );
    573603#if SIGNAL_BITRATE_PICRATE_IN_VPS
     
    578608  for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++)
    579609  {
     610#if L0323_DPB
     611    WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1,       "vps_max_dec_pic_buffering_minus1[i]" );
     612#else
    580613    WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i),           "vps_max_dec_pic_buffering[i]" );
     614#endif
    581615    WRITE_UVLC( pcVPS->getNumReorderPics(i),               "vps_num_reorder_pics[i]" );
    582616    WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i),           "vps_max_latency_increase[i]" );
     
    645679  }
    646680#endif
    647 
    648681#if H_MV
    649682  WRITE_FLAG( 1,                                             "vps_extension_flag" );
     
    666699  WRITE_FLAG( pcVPS->getVpsNuhLayerIdPresentFlag() ? 1 : 0,  "vps_nuh_layer_id_present_flag");
    667700
    668   for( Int layer = 1; layer <= pcVPS->getMaxLayers() - 1; layer++ )
    669   {
    670     if (pcVPS->getVpsNuhLayerIdPresentFlag() )
     701  // already updated to JCT3V-D0220
     702  for( Int layer = 0; layer <= pcVPS->getMaxLayers() - 1; layer++ )
     703  {
     704    if ( ( layer != 0 ) && pcVPS->getVpsNuhLayerIdPresentFlag() )
    671705      WRITE_CODE( pcVPS->getLayerIdInNuh( layer ), 6,          "layer_id_in_nuh[i]");
    672706    for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes() ; sIdx++ )
     
    779813    //   colour_plane_id                                      u(2)
    780814
     815#if H_MV
     816    // Temporary fix for FIX1071 should be removed later
     817    TComReferencePictureSet* rps = pcSlice->getRPS();
     818#endif     
    781819    if( !pcSlice->getIdrPicFlag() )
    782820    {
    783821      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC());
    784822      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
     823#if !H_MV
     824      // Temporary fix for FIX1071 should be removed later
    785825      TComReferencePictureSet* rps = pcSlice->getRPS();
     826#endif     
     827#if FIX1071
     828      // Deal with bitstream restriction stating that:
     829      // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     830      // Ideally this process should not be repeated for each slice in a picture
     831      TComReferencePictureSet altRps;
     832      Bool useAltRps = false;
     833      if (pcSlice->getRapPicFlag())
     834      {
     835        for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++)
     836        {
     837          useAltRps = rps->getUsed(picIdx);
     838        }
     839        if (useAltRps)
     840        {
     841          memcpy(&altRps, rps, sizeof(TComReferencePictureSet));
     842          rps = &altRps;
     843          for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++)
     844          {
     845            rps->setUsed(picIdx, false);
     846          }
     847        }
     848      }
     849
     850      if(pcSlice->getRPSidx() < 0 || useAltRps)
     851#else
    786852      if(pcSlice->getRPSidx() < 0)
     853#endif
    787854      {
    788855        WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
     
    917984      pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);
    918985    }
    919 
     986#if H_MV
     987    // Temporary fix for FIX1071 should be removed later
     988    if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList( rps ) > 1)
     989#else
    920990    if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1)
     991#endif
    921992    {
    922993      TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
     
    10411112  if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag())
    10421113  {
     1114#if !H_3D
    10431115    WRITE_UVLC(0,"slice_header_extension_length");
     1116#else
     1117    WRITE_UVLC(0,"slice_header_extension_length"); //<- this element needs to be set to the correct value!!
     1118
     1119    if( pcSlice->getSPS()->hasCamParInSliceHeader() )
     1120    {
     1121      for( UInt uiId = 0; uiId < pcSlice->getViewIndex(); uiId++ )
     1122      {
     1123        WRITE_SVLC( pcSlice->getCodedScale    ()[ uiId ],                                     "cp_scale" );
     1124        WRITE_SVLC( pcSlice->getCodedOffset   ()[ uiId ],                                     "cp_off" );
     1125        WRITE_SVLC( pcSlice->getInvCodedScale ()[ uiId ] + pcSlice->getCodedScale ()[ uiId ], "cp_inv_scale_plus_scale" );
     1126        WRITE_SVLC( pcSlice->getInvCodedOffset()[ uiId ] + pcSlice->getCodedOffset()[ uiId ], "cp_inv_off_plus_off" );
     1127      }
     1128    }
     1129
     1130    Bool sliceSegmentHeaderExtension2Flag = false;
     1131    WRITE_FLAG( sliceSegmentHeaderExtension2Flag ? 1 : 0 , "slice_segment_header_extension2_flag" );
     1132    if ( sliceSegmentHeaderExtension2Flag )
     1133    {
     1134      WRITE_UVLC(0,"slice_header_extension2_length");
     1135    }
     1136#endif
    10441137  }
    10451138}
     
    13671460// ====================================================================================================================
    13681461
    1369 
    1370 /** Write PCM alignment bits.
    1371  * \returns Void
    1372  */
    1373 Void  TEncCavlc::xWritePCMAlignZero    ()
    1374 {
    1375   m_pcBitIf->writeAlignZero();
    1376 }
    1377 
    1378 Void TEncCavlc::xWriteUnaryMaxSymbol( UInt uiSymbol, UInt uiMaxSymbol )
    1379 {
    1380   if (uiMaxSymbol == 0)
    1381   {
    1382     return;
    1383   }
    1384   xWriteFlag( uiSymbol ? 1 : 0 );
    1385   if ( uiSymbol == 0 )
    1386   {
    1387     return;
    1388   }
    1389  
    1390   Bool bCodeLast = ( uiMaxSymbol > uiSymbol );
    1391  
    1392   while( --uiSymbol )
    1393   {
    1394     xWriteFlag( 1 );
    1395   }
    1396   if( bCodeLast )
    1397   {
    1398     xWriteFlag( 0 );
    1399   }
    1400   return;
    1401 }
    1402 
    1403 Void TEncCavlc::xWriteExGolombLevel( UInt uiSymbol )
    1404 {
    1405   if( uiSymbol )
    1406   {
    1407     xWriteFlag( 1 );
    1408     UInt uiCount = 0;
    1409     Bool bNoExGo = (uiSymbol < 13);
    1410    
    1411     while( --uiSymbol && ++uiCount < 13 )
    1412     {
    1413       xWriteFlag( 1 );
    1414     }
    1415     if( bNoExGo )
    1416     {
    1417       xWriteFlag( 0 );
    1418     }
    1419     else
    1420     {
    1421       xWriteEpExGolomb( uiSymbol, 0 );
    1422     }
    1423   }
    1424   else
    1425   {
    1426     xWriteFlag( 0 );
    1427   }
    1428   return;
    1429 }
    1430 
    1431 Void TEncCavlc::xWriteEpExGolomb( UInt uiSymbol, UInt uiCount )
    1432 {
    1433   while( uiSymbol >= (UInt)(1<<uiCount) )
    1434   {
    1435     xWriteFlag( 1 );
    1436     uiSymbol -= 1<<uiCount;
    1437     uiCount  ++;
    1438   }
    1439   xWriteFlag( 0 );
    1440   while( uiCount-- )
    1441   {
    1442     xWriteFlag( (uiSymbol>>uiCount) & 1 );
    1443   }
    1444   return;
    1445 }
    1446 
    14471462/** code explicit wp tables
    14481463 * \param TComSlice* pcSlice
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCavlc.h

    r438 r446  
    6969  UInt          m_uiCoeffCost;
    7070
    71   Void  xWritePCMAlignZero    ();
    72   Void  xWriteEpExGolomb      ( UInt uiSymbol, UInt uiCount );
    73   Void  xWriteExGolombLevel    ( UInt uiSymbol );
    74   Void  xWriteUnaryMaxSymbol  ( UInt uiSymbol, UInt uiMaxSymbol );
    75 
    7671  Void codeShortTermRefPicSet              ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Bool calledFromSliceHeader, Int idx );
    7772  Bool findMatchingLTRP ( TComSlice* pcSlice, UInt *ltrpsIndex, Int ltrpPOC, Bool usedFlag );
     
    9085  Void  codeVPS                 ( TComVPS* pcVPS );
    9186  Void  codeVUI                 ( TComVUI *pcVUI, TComSPS* pcSPS );
     87#if H_3D
     88  Void  codeSPS                 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
     89#else
    9290  Void  codeSPS                 ( TComSPS* pcSPS );
     91#endif
    9392  Void  codePPS                 ( TComPPS* pcPPS );
    9493  Void  codeSliceHeader         ( TComSlice* pcSlice );
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCfg.h

    r438 r446  
    4646#include "TLibCommon/TComSlice.h"
    4747#include <assert.h>
     48#if H_3D
     49#include "TAppCommon/TAppComCamPara.h"
     50#include "TLibRenderer/TRenModSetupStrParser.h"
     51#endif
    4852
    4953struct GOPEntry
     
    7478  Int m_interViewRefPosL[2][MAX_NUM_REF_PICS]; 
    7579#endif
    76 
    7780  GOPEntry()
    7881  : m_POC(-1)
     
    172175  Int       m_loopFilterTcOffsetDiv2;
    173176  Bool      m_DeblockingFilterControlPresent;
     177#if L0386_DB_METRIC
     178  Bool      m_DeblockingFilterMetric;
     179#endif
    174180  Bool      m_bUseSAO;
    175181  Int       m_maxNumOffsetsPerPic;
     
    202208  Bool      m_bUseASR;
    203209  Bool      m_bUseHADME;
     210#if !L0034_COMBINED_LIST_CLEANUP
    204211  Bool      m_bUseLComb;
     212#endif
    205213  Bool      m_useRDOQ;
    206214  Bool      m_useRDOQTS;
     
    248256  Int       m_pictureTimingSEIEnabled;
    249257  Int       m_recoveryPointSEIEnabled;
     258#if J0149_TONE_MAPPING_SEI
     259  Bool      m_toneMappingInfoSEIEnabled;
     260  Int       m_toneMapId;
     261  Bool      m_toneMapCancelFlag;
     262  Bool      m_toneMapPersistenceFlag;
     263  Int       m_codedDataBitDepth;
     264  Int       m_targetBitDepth;
     265  Int       m_modelId;
     266  Int       m_minValue;
     267  Int       m_maxValue;
     268  Int       m_sigmoidMidpoint;
     269  Int       m_sigmoidWidth;
     270  Int       m_numPivots;
     271  Int       m_cameraIsoSpeedIdc;
     272  Int       m_cameraIsoSpeedValue;
     273  Int       m_exposureCompensationValueSignFlag;
     274  Int       m_exposureCompensationValueNumerator;
     275  Int       m_exposureCompensationValueDenomIdc;
     276  Int       m_refScreenLuminanceWhite;
     277  Int       m_extendedRangeWhiteLevel;
     278  Int       m_nominalBlackLevelLumaCodeValue;
     279  Int       m_nominalWhiteLevelLumaCodeValue;
     280  Int       m_extendedWhiteLevelLumaCodeValue;
     281  Int*      m_startOfCodedInterval;
     282  Int*      m_codedPivotValue;
     283  Int*      m_targetPivotValue;
     284#endif
    250285  Int       m_framePackingSEIEnabled;
    251286  Int       m_framePackingSEIType;
     
    257292  Int       m_gradualDecodingRefreshInfoEnabled;
    258293  Int       m_decodingUnitInfoSEIEnabled;
     294#if L0208_SOP_DESCRIPTION_SEI
     295  Int       m_SOPDescriptionSEIEnabled;
     296#endif
     297#if K0180_SCALABLE_NESTING_SEI
     298  Int       m_scalableNestingSEIEnabled;
     299#endif
    259300  //====== Weighted Prediction ========
    260301  Bool      m_useWeightedPred;       //< Use of Weighting Prediction (P_SLICE)
     
    321362  Int       m_layerIdInVps;
    322363  Int       m_viewId;
     364#endif
     365
    323366#if H_3D
     367  Int       m_viewIndex;
    324368  Bool      m_isDepth;
    325 #endif
     369
     370  //====== Camera Parameters ======
     371  UInt      m_uiCamParPrecision;
     372  Bool      m_bCamParInSliceHeader;
     373  Int**     m_aaiCodedScale;
     374  Int**     m_aaiCodedOffset;
     375  TAppComCamPara* m_cameraParameters;
     376 
     377#if H_3D_VSO
     378  //====== View Synthesis Optimization ======
     379  TRenModSetupStrParser* m_renderModelParameters;
     380  Bool      m_bUseVSO;
     381  Bool      m_bForceLambdaScale;
     382  Bool      m_bAllowNegDist;
     383  Double    m_dLambdaScaleVSO;
     384  UInt      m_uiVSOMode;
     385 
     386  // LGE_WVSO_A0119
     387  Bool      m_bUseWVSO;
     388  Int       m_iVSOWeight;
     389  Int       m_iVSDWeight;
     390  Int       m_iDWeight;
     391#endif
     392
     393  // SAIT_VSO_EST_A0033
     394  Bool      m_bUseEstimatedVSD;
     395  Double    m_dDispCoeff;
    326396#endif
    327397
     
    335405  , m_viewId(-1)
    336406#if H_3D
     407  , m_viewIndex(-1)
    337408  , m_isDepth(false)
    338409#endif
     
    367438  Int       getViewId                        ()                   { return m_viewId;    }
    368439#if H_3D
     440  Void      setViewIndex                     ( Int viewIndex  )   { m_viewIndex  = viewIndex;  }
     441  Int       getViewIndex                     ()                   { return m_viewIndex;    }
    369442  Void      setIsDepth                       ( Bool isDepth )   { m_isDepth = isDepth; }
    370443  Bool      getIsDepth                       ()                 { return m_isDepth; }
    371444#endif
    372445#endif
    373 
    374446  //====== Coding Structure ========
    375447  Void      setIntraPeriod                  ( Int   i )      { m_uiIntraPeriod = (UInt)i; }
     
    409481  Void      setLoopFilterTcOffset           ( Int   i )      { m_loopFilterTcOffsetDiv2    = i; }
    410482  Void      setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; }
     483#if L0386_DB_METRIC
     484  Void      setDeblockingFilterMetric       ( Bool  b )      { m_DeblockingFilterMetric = b; }
     485#endif
    411486
    412487  //====== Motion search ========
     
    463538  Int       getLoopFilterTcOffset           ()      { return m_loopFilterTcOffsetDiv2; }
    464539  Bool      getDeblockingFilterControlPresent()  { return  m_DeblockingFilterControlPresent; }
     540#if L0386_DB_METRIC
     541  Bool      getDeblockingFilterMetric       ()      { return m_DeblockingFilterMetric; }
     542#endif
    465543
    466544  //==== Motion search ========
     
    480558  Void      setUseASR                       ( Bool  b )     { m_bUseASR     = b; }
    481559  Void      setUseHADME                     ( Bool  b )     { m_bUseHADME   = b; }
     560#if !L0034_COMBINED_LIST_CLEANUP
    482561  Void      setUseLComb                     ( Bool  b )     { m_bUseLComb   = b; }
     562#endif
    483563  Void      setUseRDOQ                      ( Bool  b )     { m_useRDOQ    = b; }
    484564  Void      setUseRDOQTS                    ( Bool  b )     { m_useRDOQTS  = b; }
     
    502582  Bool      getUseASR                       ()      { return m_bUseASR;     }
    503583  Bool      getUseHADME                     ()      { return m_bUseHADME;   }
     584#if !L0034_COMBINED_LIST_CLEANUP
    504585  Bool      getUseLComb                     ()      { return m_bUseLComb;   }
     586#endif
    505587  Bool      getUseRDOQ                      ()      { return m_useRDOQ;    }
    506588  Bool      getUseRDOQTS                    ()      { return m_useRDOQTS;  }
     
    599681  Void  setRecoveryPointSEIEnabled(Int b)                { m_recoveryPointSEIEnabled = b; }
    600682  Int   getRecoveryPointSEIEnabled()                     { return m_recoveryPointSEIEnabled; }
     683#if J0149_TONE_MAPPING_SEI
     684  Void  setToneMappingInfoSEIEnabled(Bool b)                 {  m_toneMappingInfoSEIEnabled = b;  }
     685  Bool  getToneMappingInfoSEIEnabled()                       {  return m_toneMappingInfoSEIEnabled;  }
     686  Void  setTMISEIToneMapId(Int b)                            {  m_toneMapId = b;  }
     687  Int   getTMISEIToneMapId()                                 {  return m_toneMapId;  }
     688  Void  setTMISEIToneMapCancelFlag(Bool b)                   {  m_toneMapCancelFlag=b;  }
     689  Bool  getTMISEIToneMapCancelFlag()                         {  return m_toneMapCancelFlag;  }
     690  Void  setTMISEIToneMapPersistenceFlag(Bool b)              {  m_toneMapPersistenceFlag = b;  }
     691  Bool   getTMISEIToneMapPersistenceFlag()                   {  return m_toneMapPersistenceFlag;  }
     692  Void  setTMISEICodedDataBitDepth(Int b)                    {  m_codedDataBitDepth = b;  }
     693  Int   getTMISEICodedDataBitDepth()                         {  return m_codedDataBitDepth;  }
     694  Void  setTMISEITargetBitDepth(Int b)                       {  m_targetBitDepth = b;  }
     695  Int   getTMISEITargetBitDepth()                            {  return m_targetBitDepth;  }
     696  Void  setTMISEIModelID(Int b)                              {  m_modelId = b;  }
     697  Int   getTMISEIModelID()                                   {  return m_modelId;  }
     698  Void  setTMISEIMinValue(Int b)                             {  m_minValue = b;  }
     699  Int   getTMISEIMinValue()                                  {  return m_minValue;  }
     700  Void  setTMISEIMaxValue(Int b)                             {  m_maxValue = b;  }
     701  Int   getTMISEIMaxValue()                                  {  return m_maxValue;  }
     702  Void  setTMISEISigmoidMidpoint(Int b)                      {  m_sigmoidMidpoint = b;  }
     703  Int   getTMISEISigmoidMidpoint()                           {  return m_sigmoidMidpoint;  }
     704  Void  setTMISEISigmoidWidth(Int b)                         {  m_sigmoidWidth = b;  }
     705  Int   getTMISEISigmoidWidth()                              {  return m_sigmoidWidth;  }
     706  Void  setTMISEIStartOfCodedInterva( Int*  p )              {  m_startOfCodedInterval = p;  }
     707  Int*  getTMISEIStartOfCodedInterva()                       {  return m_startOfCodedInterval;  }
     708  Void  setTMISEINumPivots(Int b)                            {  m_numPivots = b;  }
     709  Int   getTMISEINumPivots()                                 {  return m_numPivots;  }
     710  Void  setTMISEICodedPivotValue( Int*  p )                  {  m_codedPivotValue = p;  }
     711  Int*  getTMISEICodedPivotValue()                           {  return m_codedPivotValue;  }
     712  Void  setTMISEITargetPivotValue( Int*  p )                 {  m_targetPivotValue = p;  }
     713  Int*  getTMISEITargetPivotValue()                          {  return m_targetPivotValue;  }
     714  Void  setTMISEICameraIsoSpeedIdc(Int b)                    {  m_cameraIsoSpeedIdc = b;  }
     715  Int   getTMISEICameraIsoSpeedIdc()                         {  return m_cameraIsoSpeedIdc;  }
     716  Void  setTMISEICameraIsoSpeedValue(Int b)                  {  m_cameraIsoSpeedValue = b;  }
     717  Int   getTMISEICameraIsoSpeedValue()                       {  return m_cameraIsoSpeedValue;  }
     718  Void  setTMISEIExposureCompensationValueSignFlag(Int b)    {  m_exposureCompensationValueSignFlag = b;  }
     719  Int   getTMISEIExposureCompensationValueSignFlag()         {  return m_exposureCompensationValueSignFlag;  }
     720  Void  setTMISEIExposureCompensationValueNumerator(Int b)   {  m_exposureCompensationValueNumerator = b;  }
     721  Int   getTMISEIExposureCompensationValueNumerator()        {  return m_exposureCompensationValueNumerator;  }
     722  Void  setTMISEIExposureCompensationValueDenomIdc(Int b)    {  m_exposureCompensationValueDenomIdc =b;  }
     723  Int   getTMISEIExposureCompensationValueDenomIdc()         {  return m_exposureCompensationValueDenomIdc;  }
     724  Void  setTMISEIRefScreenLuminanceWhite(Int b)              {  m_refScreenLuminanceWhite = b;  }
     725  Int   getTMISEIRefScreenLuminanceWhite()                   {  return m_refScreenLuminanceWhite;  }
     726  Void  setTMISEIExtendedRangeWhiteLevel(Int b)              {  m_extendedRangeWhiteLevel = b;  }
     727  Int   getTMISEIExtendedRangeWhiteLevel()                   {  return m_extendedRangeWhiteLevel;  }
     728  Void  setTMISEINominalBlackLevelLumaCodeValue(Int b)       {  m_nominalBlackLevelLumaCodeValue = b;  }
     729  Int   getTMISEINominalBlackLevelLumaCodeValue()            {  return m_nominalBlackLevelLumaCodeValue;  }
     730  Void  setTMISEINominalWhiteLevelLumaCodeValue(Int b)       {  m_nominalWhiteLevelLumaCodeValue = b;  }
     731  Int   getTMISEINominalWhiteLevelLumaCodeValue()            {  return m_nominalWhiteLevelLumaCodeValue;  }
     732  Void  setTMISEIExtendedWhiteLevelLumaCodeValue(Int b)      {  m_extendedWhiteLevelLumaCodeValue =b;  }
     733  Int   getTMISEIExtendedWhiteLevelLumaCodeValue()           {  return m_extendedWhiteLevelLumaCodeValue;  }
     734#endif
    601735  Void  setFramePackingArrangementSEIEnabled(Int b)      { m_framePackingSEIEnabled = b; }
    602736  Int   getFramePackingArrangementSEIEnabled()           { return m_framePackingSEIEnabled; }
     
    617751  Void  setDecodingUnitInfoSEIEnabled(Int b)                { m_decodingUnitInfoSEIEnabled = b;    }
    618752  Int   getDecodingUnitInfoSEIEnabled()                     { return m_decodingUnitInfoSEIEnabled; }
     753#if L0208_SOP_DESCRIPTION_SEI
     754  Void  setSOPDescriptionSEIEnabled(Int b)                { m_SOPDescriptionSEIEnabled = b; }
     755  Int   getSOPDescriptionSEIEnabled()                     { return m_SOPDescriptionSEIEnabled; }
     756#endif
     757#if K0180_SCALABLE_NESTING_SEI
     758  Void  setScalableNestingSEIEnabled(Int b)                { m_scalableNestingSEIEnabled = b; }
     759  Int   getScalableNestingSEIEnabled()                     { return m_scalableNestingSEIEnabled; }
     760#endif
    619761  Void      setUseWP               ( Bool b )    { m_useWeightedPred   = b;    }
    620762  Void      setWPBiPred            ( Bool b )    { m_useWeightedBiPred = b;    }
     
    744886  Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
    745887#endif
     888#if H_3D
     889  /// 3D Tools
     890
     891 //==== CAMERA PARAMETERS  ==========
     892  Void      setCamParPrecision              ( UInt  u )      { m_uiCamParPrecision      = u; }
     893  Void      setCamParInSliceHeader          ( Bool  b )      { m_bCamParInSliceHeader   = b; }
     894  Void      setCodedScale                   ( Int** p )      { m_aaiCodedScale          = p; }
     895  Void      setCodedOffset                  ( Int** p )      { m_aaiCodedOffset         = p; }
     896  Void      setCameraParameters             ( TAppComCamPara* c) { m_cameraParameters   = c; }
     897
     898#if H_3D_VSO
     899 //==== VSO  ==========
     900  Void      setRenderModelParameters ( TRenModSetupStrParser* c ) { m_renderModelParameters = c; }
     901  Bool      getUseVSO                       ()              { return m_bUseVSO;     }
     902  Void      setUseVSO                       ( Bool  b  )    { m_bUseVSO     = b; }
     903  UInt      getVSOMode                      ()              { return m_uiVSOMode; }
     904  Void      setVSOMode                      ( UInt  ui )    { m_uiVSOMode   = ui; }
     905  Bool      getForceLambdaScaleVSO          ()              { return m_bForceLambdaScale; }
     906  Void      setForceLambdaScaleVSO          ( Bool   b )    { m_bForceLambdaScale = b; };
     907  Double    getLambdaScaleVSO               ()              { return m_dLambdaScaleVSO;   }
     908  Void      setLambdaScaleVSO               ( Double d )    { m_dLambdaScaleVSO   = d; };
     909  Bool      getAllowNegDist                 ()              { return m_bAllowNegDist;     }
     910  Void      setAllowNegDist                 ( Bool   b )    { m_bAllowNegDist     = b; };
     911
     912  // LGE_WVSO_A0119
     913  Bool      getUseWVSO                      ()              { return m_bUseWVSO;     }
     914  Void      setUseWVSO                      ( Bool  b )     { m_bUseWVSO   = b; }
     915  Int       getVSOWeight                    ()              { return m_iVSOWeight;    }
     916  Void      setVSOWeight                    ( Int   i )     { m_iVSOWeight = i; }
     917  Int       getVSDWeight                    ()              { return m_iVSDWeight;    }
     918  Void      setVSDWeight                    ( Int   i )     { m_iVSDWeight = i; }
     919  Int       getDWeight                      ()              { return m_iDWeight;    }
     920  Void      setDWeight                      ( Int   i )     { m_iDWeight   = i; }
     921
     922  // SAIT_VSO_EST_A0033
     923  Bool      getUseEstimatedVSD              ()              { return m_bUseEstimatedVSD; }
     924  Void      setUseEstimatedVSD              ( Bool  b )     { m_bUseEstimatedVSD = b; }
     925  Double    getDispCoeff                    ()              { return m_dDispCoeff;    }
     926  Void      setDispCoeff                    ( Double  d )   { m_dDispCoeff  = d; }
     927#endif // H_3D_VSO
     928#endif // H_3D
    746929};
    747930
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncCu.cpp

    r324 r446  
    710710          UInt uiRawBits = (2 * g_bitDepthY + g_bitDepthC) * rpcBestCU->getWidth(0) * rpcBestCU->getHeight(0) / 2;
    711711          UInt uiBestBits = rpcBestCU->getTotalBits();
     712#if H_3D_VSO // M7
     713          Double dRDCostTemp = m_pcRdCost->getUseVSO() ? m_pcRdCost->calcRdCostVSO(uiRawBits, 0) : m_pcRdCost->calcRdCost(uiRawBits, 0);
     714          if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > dRDCostTemp ))
     715#else
    712716          if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0)))
     717#endif
    713718          {
    714719            xCheckIntraPCM (rpcBestCU, rpcTempCU);
     
    730735      rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    731736    }
     737
     738#if H_3D_VSO // M8
     739    if ( m_pcRdCost->getUseVSO() )   
     740      rpcBestCU->getTotalCost()  = m_pcRdCost->calcRdCostVSO( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );   
     741    else
     742#endif
    732743    rpcBestCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );
    733744
     
    822833    if( bSubBranch && bTrySplitDQP && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )
    823834    {
     835#if H_3D_VSO // M9
     836      // reset Model
     837      if( m_pcRdCost->getUseRenModel() )
     838      {
     839        UInt  uiWidth     = m_ppcOrigYuv[uiDepth]->getWidth ( );
     840        UInt  uiHeight    = m_ppcOrigYuv[uiDepth]->getHeight( );
     841        Pel*  piSrc       = m_ppcOrigYuv[uiDepth]->getLumaAddr( 0 );
     842        UInt  uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride();
     843        m_pcRdCost->setRenModelData( m_ppcBestCU[uiDepth], 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     844      }
     845#endif
     846
    824847      UChar       uhNextDepth         = uiDepth+1;
    825848      TComDataCU* pcSubBestPartCU     = m_ppcBestCU[uhNextDepth];
     
    880903        }
    881904      }
     905
     906#if H_3D_VSO // M10
     907      if ( m_pcRdCost->getUseVSO() )
     908        rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     909      else
     910#endif
    882911      rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    883912
     
    914943            rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    915944          }
     945#if H_3D_VSO // M11
     946          if ( m_pcRdCost->getUseLambdaScaleVSO())         
     947            rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );         
     948          else
     949#endif
    916950          rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    917951#endif
     
    946980    }
    947981  }
     982
     983
     984#if H_3D_VSO // M12
     985  if( m_pcRdCost->getUseRenModel() )
     986  {
     987    UInt  uiWidth     = m_ppcRecoYuvBest[uiDepth]->getWidth   ( );
     988    UInt  uiHeight    = m_ppcRecoYuvBest[uiDepth]->getHeight  ( );
     989    Pel*  piSrc       = m_ppcRecoYuvBest[uiDepth]->getLumaAddr( 0 );
     990    UInt  uiSrcStride = m_ppcRecoYuvBest[uiDepth]->getStride  ( );
     991    m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     992  }
     993#endif
    948994
    949995  rpcBestCU->copyToPic(uiDepth);                                                     // Copy Best data to Picture for next partition prediction.
     
    11951241  }
    11961242  UChar uhDepth = rpcTempCU->getDepth( 0 );
     1243
     1244#if H_3D_VSO // M1  //nececcary here?
     1245  if( m_pcRdCost->getUseRenModel() )
     1246  {
     1247    UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     1248    UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     1249    Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     1250    UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     1251    m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     1252  }
     1253#endif
     1254
    11971255  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    11981256  rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );
     
    12401298       m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
    12411299       // estimate residual and encode everything
     1300
     1301#if H_3D_VSO //M2
     1302       if( m_pcRdCost->getUseRenModel() )
     1303       { //Reset
     1304         UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
     1305         UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
     1306         Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
     1307         UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
     1308         m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     1309       }
     1310#endif
     1311
    12421312       m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,
    12431313         m_ppcOrigYuv    [uhDepth],
     
    13141384{
    13151385  UChar uhDepth = rpcTempCU->getDepth( 0 );
    1316  
     1386#if H_3D_VSO // M3
     1387  if( m_pcRdCost->getUseRenModel() )
     1388  {
     1389    UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     1390    UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     1391    Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     1392    UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     1393    m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     1394  }
     1395#endif
     1396
    13171397  rpcTempCU->setDepthSubParts( uhDepth, 0 );
    13181398 
     
    13481428
    13491429  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
     1430
     1431
     1432#if H_3D_VSO // M4
     1433  if( m_pcRdCost->getUseLambdaScaleVSO() )
     1434    rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     1435  else
     1436#endif
    13501437  rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    13511438
     
    13581445  UInt uiDepth = rpcTempCU->getDepth( 0 );
    13591446 
     1447#if H_3D_VSO // M5
     1448  if( m_pcRdCost->getUseRenModel() )
     1449  {
     1450    UInt  uiWidth     = m_ppcOrigYuv[uiDepth]->getWidth   ();
     1451    UInt  uiHeight    = m_ppcOrigYuv[uiDepth]->getHeight  ();
     1452    Pel*  piSrc       = m_ppcOrigYuv[uiDepth]->getLumaAddr();
     1453    UInt  uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride  ();
     1454    m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     1455  }
     1456#endif
     1457
    13601458  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
    13611459
     
    13991497    rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    14001498  }
     1499
     1500#if H_3D_VSO // M6
     1501  if( m_pcRdCost->getUseLambdaScaleVSO()) 
     1502    rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 
     1503  else
     1504#endif
    14011505  rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    14021506 
     
    14461550    rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    14471551  }
     1552#if H_3D_VSO // M44
     1553  if ( m_pcRdCost->getUseVSO() )
     1554    rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     1555  else
     1556#endif
    14481557  rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    14491558
     
    15011610        pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    15021611      }
     1612#if H_3D_VSO // M45
     1613      if ( m_pcRdCost->getUseVSO() )     
     1614        pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( pcCU->getTotalBits(), pcCU->getTotalDistortion() );     
     1615      else
     1616#endif
    15031617      pcCU->getTotalCost() = m_pcRdCost->calcRdCost( pcCU->getTotalBits(), pcCU->getTotalDistortion() );
    15041618#endif
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncEntropy.cpp

    r438 r446  
    8787}
    8888
     89#if H_3D
     90Void TEncEntropy::encodeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
     91{
     92  m_pcEntropyCoderIf->codeSPS( pcSPS, viewIndex, depthFlag );
     93  return;
     94}
     95#else
    8996Void TEncEntropy::encodeSPS( TComSPS* pcSPS )
    9097{
     
    9299  return;
    93100}
     101#endif
    94102
    95103Void TEncEntropy::encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     
    587595  if( pcCU->isIntra(uiAbsPartIdx) )
    588596  {
     597#if !H_MV
    589598    DTRACE_CABAC_VL( g_nSymbolCounter++ )
    590599    DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" )
    591600    DTRACE_CABAC_V( uiDepth )
    592601    DTRACE_CABAC_T( "\n" )
     602#endif
    593603  }
    594604  else
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncEntropy.h

    r324 r446  
    6969
    7070  virtual Void  codeVPS                 ( TComVPS* pcVPS )                                      = 0;
     71#if !H_3D
    7172  virtual Void  codeSPS                 ( TComSPS* pcSPS )                                      = 0;
     73#else
     74  virtual Void  codeSPS                 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )       = 0;
     75#endif
    7276  virtual Void  codePPS                 ( TComPPS* pcPPS )                                      = 0;
    7377  virtual Void  codeSliceHeader         ( TComSlice* pcSlice )                                  = 0;
     
    149153  Void encodeVPS               ( TComVPS* pcVPS);
    150154  // SPS
     155#if H_3D
     156  Void encodeSPS               ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
     157#else
    151158  Void encodeSPS               ( TComSPS* pcSPS );
     159#endif
    152160  Void encodePPS               ( TComPPS* pcPPS );
    153161  Void encodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r438 r446  
    9696#if L0045_NON_NESTED_SEI_RESTRICTIONS
    9797  xResetNonNestedSEIPresentFlags();
    98 #endif
    99 
     98#if K0180_SCALABLE_NESTING_SEI
     99  xResetNestedSEIPresentFlags();
     100#endif
     101#endif
    100102#if H_MV
    101103  m_layerId      = 0;
     
    103105  m_pocLastCoded = -1;
    104106#if H_3D
     107  m_viewIndex  =   0;
    105108  m_isDepth = false;
    106109#endif
    107110#endif
    108 
    109111  return;
    110112}
     
    151153  m_viewId               = pcTEncTop->getViewId();
    152154#if H_3D
     155  m_viewIndex            = pcTEncTop->getViewIndex();
    153156  m_isDepth              = pcTEncTop->getIsDepth();
    154157#endif
     
    211214}
    212215
     216#if J0149_TONE_MAPPING_SEI
     217SEIToneMappingInfo*  TEncGOP::xCreateSEIToneMappingInfo()
     218{
     219  SEIToneMappingInfo *seiToneMappingInfo = new SEIToneMappingInfo();
     220  seiToneMappingInfo->m_toneMapId = m_pcCfg->getTMISEIToneMapId();
     221  seiToneMappingInfo->m_toneMapCancelFlag = m_pcCfg->getTMISEIToneMapCancelFlag();
     222  seiToneMappingInfo->m_toneMapPersistenceFlag = m_pcCfg->getTMISEIToneMapPersistenceFlag();
     223
     224  seiToneMappingInfo->m_codedDataBitDepth = m_pcCfg->getTMISEICodedDataBitDepth();
     225  assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14);
     226  seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth();
     227  assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth  == 255) );
     228  seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID();
     229  assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4);
     230
     231  switch( seiToneMappingInfo->m_modelId)
     232  {
     233  case 0:
     234    {
     235      seiToneMappingInfo->m_minValue = m_pcCfg->getTMISEIMinValue();
     236      seiToneMappingInfo->m_maxValue = m_pcCfg->getTMISEIMaxValue();
     237      break;
     238    }
     239  case 1:
     240    {
     241      seiToneMappingInfo->m_sigmoidMidpoint = m_pcCfg->getTMISEISigmoidMidpoint();
     242      seiToneMappingInfo->m_sigmoidWidth = m_pcCfg->getTMISEISigmoidWidth();
     243      break;
     244    }
     245  case 2:
     246    {
     247      UInt num = 1u<<(seiToneMappingInfo->m_targetBitDepth);
     248      seiToneMappingInfo->m_startOfCodedInterval.resize(num);
     249      Int* ptmp = m_pcCfg->getTMISEIStartOfCodedInterva();
     250      if(ptmp)
     251      {
     252        for(int i=0; i<num;i++)
     253        {
     254          seiToneMappingInfo->m_startOfCodedInterval[i] = ptmp[i];
     255        }
     256      }
     257      break;
     258    }
     259  case 3:
     260    {
     261      seiToneMappingInfo->m_numPivots = m_pcCfg->getTMISEINumPivots();
     262      seiToneMappingInfo->m_codedPivotValue.resize(seiToneMappingInfo->m_numPivots);
     263      seiToneMappingInfo->m_targetPivotValue.resize(seiToneMappingInfo->m_numPivots);
     264      Int* ptmpcoded = m_pcCfg->getTMISEICodedPivotValue();
     265      Int* ptmptarget = m_pcCfg->getTMISEITargetPivotValue();
     266      if(ptmpcoded&&ptmptarget)
     267      {
     268        for(int i=0; i<(seiToneMappingInfo->m_numPivots);i++)
     269        {
     270          seiToneMappingInfo->m_codedPivotValue[i]=ptmpcoded[i];
     271          seiToneMappingInfo->m_targetPivotValue[i]=ptmptarget[i];
     272         }
     273       }
     274       break;
     275     }
     276  case 4:
     277     {
     278       seiToneMappingInfo->m_cameraIsoSpeedIdc = m_pcCfg->getTMISEICameraIsoSpeedIdc();
     279       seiToneMappingInfo->m_cameraIsoSpeedValue = m_pcCfg->getTMISEICameraIsoSpeedValue();
     280       assert( seiToneMappingInfo->m_cameraIsoSpeedValue !=0 );
     281       seiToneMappingInfo->m_exposureCompensationValueSignFlag = m_pcCfg->getTMISEIExposureCompensationValueSignFlag();
     282       seiToneMappingInfo->m_exposureCompensationValueNumerator = m_pcCfg->getTMISEIExposureCompensationValueNumerator();
     283       seiToneMappingInfo->m_exposureCompensationValueDenomIdc = m_pcCfg->getTMISEIExposureCompensationValueDenomIdc();
     284       seiToneMappingInfo->m_refScreenLuminanceWhite = m_pcCfg->getTMISEIRefScreenLuminanceWhite();
     285       seiToneMappingInfo->m_extendedRangeWhiteLevel = m_pcCfg->getTMISEIExtendedRangeWhiteLevel();
     286       assert( seiToneMappingInfo->m_extendedRangeWhiteLevel >= 100 );
     287       seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue = m_pcCfg->getTMISEINominalBlackLevelLumaCodeValue();
     288       seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue = m_pcCfg->getTMISEINominalWhiteLevelLumaCodeValue();
     289       assert( seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue > seiToneMappingInfo->m_nominalBlackLevelLumaCodeValue );
     290       seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue = m_pcCfg->getTMISEIExtendedWhiteLevelLumaCodeValue();
     291       assert( seiToneMappingInfo->m_extendedWhiteLevelLumaCodeValue >= seiToneMappingInfo->m_nominalWhiteLevelLumaCodeValue );
     292       break;
     293    }
     294  default:
     295    {
     296      assert(!"Undefined SEIToneMapModelId");
     297      break;
     298    }
     299  }
     300  return seiToneMappingInfo;
     301}
     302#endif
    213303Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps)
    214304{
    215   OutputNALUnit nalu(NAL_UNIT_SEI);
     305  OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    216306
    217307  if(m_pcCfg->getActiveParameterSetsSEIEnabled())
     
    234324    SEIFramePacking *sei = xCreateSEIFramePacking ();
    235325
    236     nalu = NALUnit(NAL_UNIT_SEI);
     326    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    237327    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    238328    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     
    245335    SEIDisplayOrientation *sei = xCreateSEIDisplayOrientation();
    246336
    247     nalu = NALUnit(NAL_UNIT_SEI);
     337    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    248338    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
    249339    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     
    252342    delete sei;
    253343  }
     344#if J0149_TONE_MAPPING_SEI
     345  if(m_pcCfg->getToneMappingInfoSEIEnabled())
     346  {
     347    SEIToneMappingInfo *sei = xCreateSEIToneMappingInfo ();
     348     
     349    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
     350    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     351    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     352    writeRBSPTrailingBits(nalu.m_Bitstream);
     353    accessUnit.push_back(new NALUnitEBSP(nalu));
     354    delete sei;
     355  }
     356#endif
    254357}
    255358
     
    257360// Public member functions
    258361// ====================================================================================================================
    259 
    260362#if H_MV
    261363Void TEncGOP::initGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP)
     
    265367}
    266368#endif
    267 
    268369#if H_MV
    269370Void TEncGOP::compressPicInGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid)
     
    275376  TComPicYuv*     pcPicYuvRecOut;
    276377  TComSlice*      pcSlice;
    277   TComOutputBitstream* pcBitstreamRedirect = new TComOutputBitstream;
     378  TComOutputBitstream  *pcBitstreamRedirect;
     379  pcBitstreamRedirect = new TComOutputBitstream;
    278380  AccessUnit::iterator  itLocationToPushSliceHeaderNALU; // used to store location where NALU containing slice header is to be inserted
    279381  UInt                  uiOneBitstreamPerSliceLength = 0;
     
    286388  m_iNumPicCoded = 0;
    287389#endif
    288 
    289390  SEIPictureTiming pictureTimingSEI;
     391#if L0208_SOP_DESCRIPTION_SEI
     392  Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled();
     393#endif
     394#if K0180_SCALABLE_NESTING_SEI
     395  // Initialize Scalable Nesting SEI with single layer values
     396  SEIScalableNesting scalableNestingSEI;
     397  scalableNestingSEI.m_bitStreamSubsetFlag           = 1;      // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1
     398  scalableNestingSEI.m_nestingOpFlag                 = 0;
     399  scalableNestingSEI.m_nestingNumOpsMinus1           = 0;      //nesting_num_ops_minus1
     400  scalableNestingSEI.m_allLayersFlag                 = 0;
     401  scalableNestingSEI.m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1;  //nesting_no_op_max_temporal_id_plus1
     402  scalableNestingSEI.m_nestingNumLayersMinus1        = 1 - 1;  //nesting_num_layers_minus1
     403  scalableNestingSEI.m_nestingLayerId[0]             = 0;
     404  scalableNestingSEI.m_callerOwnsSEIs                = true;
     405#endif
    290406#if L0044_DU_DPB_OUTPUT_DELAY_HRD
    291407  Int picSptDpbOutputDuDelay = 0;
     
    294410  UInt *accumNalsDU = NULL;
    295411  SEIDecodingUnitInfo decodingUnitInfoSEI;
    296 
    297412#if !H_MV
    298413  for ( Int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ )
    299414#endif
    300 
    301415  {
    302416    UInt uiColDir = 1;
     
    357471    if(pocCurr>=m_pcCfg->getFramesToBeEncoded())
    358472    {
    359 
    360473#if H_MV
    361474      delete pcBitstreamRedirect;
     
    364477      continue;
    365478#endif
    366 
    367     }
    368 
    369     if( getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR || getNalUnitType(pocCurr) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     479    }
     480
     481    if( getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType(pocCurr, m_iLastIDR) == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    370482    {
    371483      m_iLastIDR = pocCurr;
     
    385497    pcSlice->setLastIDR(m_iLastIDR);
    386498    pcSlice->setSliceIdx(0);
    387 
    388499#if H_MV
    389     pcPic  ->setLayerId     ( getLayerId() );
    390     pcPic  ->setViewId      ( getViewId()  );
     500    pcPic  ->setLayerId     ( getLayerId()   );
     501    pcPic  ->setViewId      ( getViewId()    );   
    391502    pcSlice->setLayerId     ( getLayerId() );
    392     pcSlice->setViewId      ( getViewId()  );
     503    pcSlice->setViewId      ( getViewId()  );   
    393504    pcSlice->setVPS         ( m_pcEncTop->getVPS() );
    394505#if H_3D
     506    pcPic  ->setViewIndex   ( getViewIndex() );
    395507    pcPic  ->setIsDepth( getIsDepth() );
    396     pcSlice->setIsDepth( getIsDepth() );
    397 #endif
    398 #endif
    399 
     508    pcSlice->setViewIndex   ( getViewIndex()  );
     509    pcSlice->setIsDepth( getIsDepth() );   
     510    pcSlice->setCamparaSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() );
     511#endif
     512#endif
    400513    //set default slice level flag to the same as SPS level flag
    401514    pcSlice->setLFCrossSliceBoundaryFlag(  pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()  );
     
    437550#if H_MV
    438551    // Set the nal unit type
    439     pcSlice->setNalUnitType(getNalUnitType(pocCurr));
     552    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
    440553    if( pcSlice->getSliceType() == B_SLICE )
    441554    {
     
    451564    }
    452565    // Set the nal unit type
    453     pcSlice->setNalUnitType(getNalUnitType(pocCurr));
    454 #endif
    455     if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)
    456     {
    457       if(pcSlice->getTemporalLayerNonReferenceFlag())
     566    pcSlice->setNalUnitType(getNalUnitType(pocCurr, m_iLastIDR));
     567#endif
     568    if(pcSlice->getTemporalLayerNonReferenceFlag())
     569    {
     570      if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_TRAIL_R)
    458571      {
    459572        pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TRAIL_N);
     573      }
     574      if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RADL_R)
     575      {
     576        pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RADL_N);
     577      }
     578      if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_RASL_R)
     579      {
     580        pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_RASL_N);
    460581      }
    461582    }
     
    482603        else
    483604        {
    484           pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA);
     605          pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_TLA_R);
    485606        }
    486607      }
     
    568689    }
    569690#endif
    570 
     691#if !L0034_COMBINED_LIST_CLEANUP
    571692    if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb())
    572693    {
     
    580701      pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0));
    581702    }
     703#endif
    582704
    583705    if (pcSlice->getSliceType() == B_SLICE)
     
    605727      pcSlice->setCheckLDC(bLowDelay); 
    606728    }
     729    else
     730    {
     731      pcSlice->setCheckLDC(true); 
     732    }
    607733
    608734    uiColDir = 1-uiColDir;
     
    611737    pcSlice->setRefPOCList();
    612738
     739#if L0034_COMBINED_LIST_CLEANUP
     740    pcSlice->setList1IdxToList0Idx();
     741#else
    613742    pcSlice->setNoBackPredFlag( false );
    614743    if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag())
     
    634763    }
    635764    pcSlice->generateCombinedList();
     765#endif
    636766
    637767    if (m_pcEncTop->getTMVPModeId() == 2)
     
    658788      pcSlice->setEnableTMVPFlag(0);
    659789    }
     790
     791#if H_3D_VSO
     792  // Should be moved to TEncTop !!!
     793  Bool bUseVSO = m_pcEncTop->getUseVSO();
     794 
     795  TComRdCost* pcRdCost = m_pcEncTop->getRdCost();   
     796
     797  pcRdCost->setUseVSO( bUseVSO );
     798
     799  // SAIT_VSO_EST_A0033
     800  pcRdCost->setUseEstimatedVSD( m_pcEncTop->getUseEstimatedVSD() );
     801
     802  if ( bUseVSO )
     803  {
     804    Int iVSOMode = m_pcEncTop->getVSOMode();
     805    pcRdCost->setVSOMode( iVSOMode  );
     806    pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() );
     807
     808    // SAIT_VSO_EST_A0033
     809    pcRdCost->setVideoRecPicYuv( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), false , pcSlice->getPOC(), true ) );
     810    pcRdCost->setDepthPicYuv   ( m_pcEncTop->getIvPicLists()->getPicYuv( pcSlice->getViewIndex(), true  , pcSlice->getPOC(), false ) );
     811
     812    // LGE_WVSO_A0119
     813    Bool bUseWVSO  = m_pcEncTop->getUseWVSO();
     814    pcRdCost->setUseWVSO( bUseWVSO );
     815
     816  }
     817#endif
    660818    /////////////////////////////////////////////////////////////////////////////////////////////////// Compress a slice
    661819    //  Slice compression
     
    9391097    Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag();
    9401098    m_pcLoopFilter->setCfg(bLFCrossTileBoundary);
     1099#if L0386_DB_METRIC
     1100    if ( m_pcCfg->getDeblockingFilterMetric() )
     1101    {
     1102      dblMetric(pcPic, uiNumSlices);
     1103    }
     1104#endif
    9411105    m_pcLoopFilter->loopFilterPic( pcPic );
    9421106
     
    10121176        pcSlice->getSPS()->getVuiParameters()->setHrdParametersPresentFlag( true );
    10131177      }
     1178#if !H_3D
    10141179      m_pcEntropyCoder->encodeSPS(pcSlice->getSPS());
     1180#else
     1181      m_pcEntropyCoder->encodeSPS(pcSlice->getSPS(), pcSlice->getViewIndex(), pcSlice->getIsDepth() );
     1182#endif
    10151183      writeRBSPTrailingBits(nalu.m_Bitstream);
    10161184      accessUnit.push_back(new NALUnitEBSP(nalu));
     
    10371205    }
    10381206
     1207#if L0208_SOP_DESCRIPTION_SEI
     1208    if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP
     1209    {
     1210      Int SOPcurrPOC = pocCurr;
     1211
     1212      OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
     1213      m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     1214      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     1215
     1216      SEISOPDescription SOPDescriptionSEI;
     1217      SOPDescriptionSEI.m_sopSeqParameterSetId = pcSlice->getSPS()->getSPSId();
     1218
     1219      UInt i = 0;
     1220      UInt prevEntryId = iGOPid;
     1221      for (j = iGOPid; j < m_iGopSize; j++)
     1222      {
     1223        Int deltaPOC = m_pcCfg->getGOPEntry(j).m_POC - m_pcCfg->getGOPEntry(prevEntryId).m_POC;
     1224        if ((SOPcurrPOC + deltaPOC) < m_pcCfg->getFramesToBeEncoded())
     1225        {
     1226          SOPcurrPOC += deltaPOC;
     1227          SOPDescriptionSEI.m_sopDescVclNaluType[i] = getNalUnitType(SOPcurrPOC, m_iLastIDR);
     1228          SOPDescriptionSEI.m_sopDescTemporalId[i] = m_pcCfg->getGOPEntry(j).m_temporalId;
     1229          SOPDescriptionSEI.m_sopDescStRpsIdx[i] = m_pcEncTop->getReferencePictureSetIdxForSOP(pcSlice, SOPcurrPOC, j);
     1230          SOPDescriptionSEI.m_sopDescPocDelta[i] = deltaPOC;
     1231
     1232          prevEntryId = j;
     1233          i++;
     1234        }
     1235      }
     1236
     1237      SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1;
     1238
     1239      m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS());
     1240      writeRBSPTrailingBits(nalu.m_Bitstream);
     1241      accessUnit.push_back(new NALUnitEBSP(nalu));
     1242
     1243      writeSOP = false;
     1244    }
     1245#endif
     1246
    10391247    if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) &&
    10401248        ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) &&
     
    10821290       || ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getVclHrdParametersPresentFlag() ) ) )
    10831291    {
    1084       OutputNALUnit nalu(NAL_UNIT_SEI);
     1292      OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    10851293      m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    10861294      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    11231331      writeRBSPTrailingBits(nalu.m_Bitstream);
    11241332#if L0045_NON_NESTED_SEI_RESTRICTIONS
     1333      {
    11251334      UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    11261335      UInt offsetPosition = m_activeParameterSetSEIPresentInAU;   // Insert BP SEI after APS SEI
     
    11321341      accessUnit.insert(it, new NALUnitEBSP(nalu));
    11331342      m_bufferingPeriodSEIPresentInAU = true;
     1343      }
    11341344#else
    11351345      accessUnit.push_back(new NALUnitEBSP(nalu));
     1346#endif
     1347
     1348#if K0180_SCALABLE_NESTING_SEI
     1349      if (m_pcCfg->getScalableNestingSEIEnabled())
     1350      {
     1351        OutputNALUnit naluTmp(NAL_UNIT_PREFIX_SEI);
     1352        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     1353        m_pcEntropyCoder->setBitstream(&naluTmp.m_Bitstream);
     1354        scalableNestingSEI.m_nestedSEIs.clear();
     1355        scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period);
     1356        m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
     1357        writeRBSPTrailingBits(naluTmp.m_Bitstream);
     1358#if L0045_NON_NESTED_SEI_RESTRICTIONS
     1359        UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     1360        UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU;   // Insert BP SEI after non-nested APS, BP and PT SEIs
     1361        AccessUnit::iterator it;
     1362        for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)
     1363        {
     1364          it++;
     1365        }
     1366        accessUnit.insert(it, new NALUnitEBSP(naluTmp));
     1367        m_nestedBufferingPeriodSEIPresentInAU = true;
     1368#else
     1369        accessUnit.push_back(new NALUnitEBSP(naluTmp));
     1370#endif
     1371      }
    11361372#endif
    11371373
     
    11451381      {
    11461382        // Gradual decoding refresh SEI
    1147         OutputNALUnit nalu(NAL_UNIT_SEI);
     1383        OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    11481384        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    11491385        m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    11571393      }
    11581394    // Recovery point SEI
    1159       OutputNALUnit nalu(NAL_UNIT_SEI);
     1395      OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    11601396      m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    11611397      m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     
    13481584
    13491585          pcSlice->setTileOffstForMultES( uiOneBitstreamPerSliceLength );
    1350           if (!sliceSegment)
    1351           {
    13521586            pcSlice->setTileLocationCount ( 0 );
    1353             m_pcSliceEncoder->encodeSlice(pcPic, pcBitstreamRedirect, pcSubstreamsOut); // redirect is only used for CAVLC tile position info.
    1354           }
    1355           else
    1356           {
    1357             m_pcSliceEncoder->encodeSlice(pcPic, &nalu.m_Bitstream, pcSubstreamsOut); // nalu.m_Bitstream is only used for CAVLC tile position info.
    1358           }
     1587          m_pcSliceEncoder->encodeSlice(pcPic, pcSubstreamsOut);
    13591588
    13601589          {
     
    13881617              if (ui+1 < pcSlice->getPPS()->getNumSubstreams())
    13891618              {
    1390                 puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits();
     1619                puiSubstreamSizes[ui] = pcSubstreamsOut[ui].getNumberOfWrittenBits() + (pcSubstreamsOut[ui].countStartCodeEmulations()<<3);
    13911620              }
    13921621            }
     
    14201649          // If current NALU is the last NALU of slice and a NALU was buffered, then (a) Write current NALU (b) Update an write buffered NALU at approproate location in NALU list.
    14211650          Bool bNALUAlignedWrittenToList    = false; // used to ensure current NALU is not written more than once to the NALU list.
    1422           xWriteTileLocationToSliceHeader(nalu, pcBitstreamRedirect, pcSlice);
     1651          xAttachSliceDataToNalUnit(nalu, pcBitstreamRedirect);
    14231652          accessUnit.push_back(new NALUnitEBSP(nalu));
    14241653#if RATE_CONTROL_LAMBDA_DOMAIN
     
    14481677            {
    14491678              UInt numRBSPBytes_nal = UInt((*it)->m_nalUnitData.str().size());
    1450               if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
     1679              if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
    14511680              {
    14521681                numRBSPBytes += numRBSPBytes_nal;
     
    15181747      pcPic->compressMotion();
    15191748#endif
    1520 
    15211749#if H_MV
    15221750      m_pocLastCoded = pcPic->getPOC();
     
    15491777          digestStr = digestToString(sei_recon_picture_digest.digest, 4);
    15501778        }
    1551         OutputNALUnit nalu(NAL_UNIT_SEI_SUFFIX, pcSlice->getTLayer());
     1779        OutputNALUnit nalu(NAL_UNIT_SUFFIX_SEI, pcSlice->getTLayer());
    15521780
    15531781        /* write the SEI messages */
     
    15731801        sei_temporal_level0_index.rapIdx = m_rapIdx;
    15741802
    1575         OutputNALUnit nalu(NAL_UNIT_SEI);
     1803        OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI);
    15761804
    15771805        /* write the SEI messages */
     
    17131941        if( m_pcCfg->getPictureTimingSEIEnabled() )
    17141942        {
    1715           OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer());
     1943          {
     1944            OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
    17161945          m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    17171946          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS());
     
    17331962#endif
    17341963        }
     1964#if K0180_SCALABLE_NESTING_SEI
     1965          if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI
     1966          {
     1967            OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
     1968            m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     1969            scalableNestingSEI.m_nestedSEIs.clear();
     1970            scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI);
     1971            m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
     1972            writeRBSPTrailingBits(nalu.m_Bitstream);
     1973#if L0045_NON_NESTED_SEI_RESTRICTIONS
     1974            UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     1975            UInt offsetPosition = m_activeParameterSetSEIPresentInAU
     1976              + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU + m_nestedBufferingPeriodSEIPresentInAU;    // Insert PT SEI after APS and BP SEI
     1977            AccessUnit::iterator it;
     1978            for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)
     1979            {
     1980              it++;
     1981            }
     1982            accessUnit.insert(it, new NALUnitEBSP(nalu));
     1983            m_nestedPictureTimingSEIPresentInAU = true;
     1984#else
     1985            AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));
     1986            accessUnit.insert(it, new NALUnitEBSP(nalu));
     1987#endif
     1988          }
     1989#endif
     1990
     1991        }
    17351992        if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() )
    17361993        {             
     
    17381995          for( Int i = 0; i < ( pictureTimingSEI.m_numDecodingUnitsMinus1 + 1 ); i ++ )
    17391996          {
    1740             OutputNALUnit nalu(NAL_UNIT_SEI, pcSlice->getTLayer());
     1997            OutputNALUnit nalu(NAL_UNIT_PREFIX_SEI, pcSlice->getTLayer());
    17411998
    17421999            SEIDecodingUnitInfo tempSEI;
     
    17862043                  break;
    17872044                }
    1788                 if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
     2045                if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
    17892046                {
    17902047                  ctr++;
     
    17972054#if L0045_NON_NESTED_SEI_RESTRICTIONS
    17982055      xResetNonNestedSEIPresentFlags();
     2056#if K0180_SCALABLE_NESTING_SEI
     2057      xResetNestedSEIPresentFlags();
     2058#endif
    17992059#endif
    18002060      pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut);
     
    18292089  assert ( m_iNumPicCoded == iNumPicRcvd );
    18302090#endif
    1831 
    18322091}
    18332092
     
    18692128}
    18702129#endif
    1871 
     2130#if H_3D_VSO
     2131Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits )
     2132#else
    18722133Void TEncGOP::preLoopFilterPicAll( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits )
     2134#endif
    18732135{
    18742136  TComSlice* pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
     
    19582220}
    19592221
     2222#if H_3D_VSO
     2223Dist64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1)
     2224#else
    19602225UInt64 TEncGOP::xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1)
     2226#endif
    19612227{
    19622228  Int     x, y;
     
    19702236  Int   iHeight = pcPic0->getHeight();
    19712237 
     2238#if H_3D_VSO
     2239  Dist64  uiTotalDiff = 0;
     2240#else
    19722241  UInt64  uiTotalDiff = 0;
     2242#endif
    19732243 
    19742244  for( y = 0; y < iHeight; y++ )
     
    20232293    case NAL_UNIT_CODED_SLICE_TRAIL_R: return "TRAIL_R";
    20242294    case NAL_UNIT_CODED_SLICE_TRAIL_N: return "TRAIL_N";
    2025     case NAL_UNIT_CODED_SLICE_TLA: return "TLA";
     2295    case NAL_UNIT_CODED_SLICE_TLA_R:      return "TLA_R";
    20262296    case NAL_UNIT_CODED_SLICE_TSA_N: return "TSA_N";
    20272297    case NAL_UNIT_CODED_SLICE_STSA_R: return "STSA_R";
    20282298    case NAL_UNIT_CODED_SLICE_STSA_N: return "STSA_N";
    2029     case NAL_UNIT_CODED_SLICE_BLA: return "BLA";
    2030     case NAL_UNIT_CODED_SLICE_BLANT: return "BLANT";
     2299    case NAL_UNIT_CODED_SLICE_BLA_W_LP:   return "BLA_W_LP";
     2300    case NAL_UNIT_CODED_SLICE_BLA_W_RADL: return "BLA_W_RADL";
    20312301    case NAL_UNIT_CODED_SLICE_BLA_N_LP: return "BLA_N_LP";
    2032     case NAL_UNIT_CODED_SLICE_IDR: return "IDR";
     2302    case NAL_UNIT_CODED_SLICE_IDR_W_RADL: return "IDR_W_RADL";
    20332303    case NAL_UNIT_CODED_SLICE_IDR_N_LP: return "IDR_N_LP";
    20342304    case NAL_UNIT_CODED_SLICE_CRA: return "CRA";
    2035     case NAL_UNIT_CODED_SLICE_DLP: return "DLP";
    2036     case NAL_UNIT_CODED_SLICE_TFD: return "TFD";
     2305    case NAL_UNIT_CODED_SLICE_RADL_R:     return "RADL_R";
     2306    case NAL_UNIT_CODED_SLICE_RASL_R:     return "RASL_R";
    20372307    case NAL_UNIT_VPS: return "VPS";
    20382308    case NAL_UNIT_SPS: return "SPS";
     
    20422312    case NAL_UNIT_EOB: return "EOB";
    20432313    case NAL_UNIT_FILLER_DATA: return "FILLER";
    2044     case NAL_UNIT_SEI: return "SEI";
     2314    case NAL_UNIT_PREFIX_SEI:             return "SEI";
     2315    case NAL_UNIT_SUFFIX_SEI:             return "SEI";
    20452316    default: return "UNK";
    20462317  }
     
    20832354  }
    20842355 
    2085   iHeight >>= 1;
     2356#if H_3D_VSO
     2357#if H_3D_VSO_SYNTH_DIST_OUT
     2358  if ( m_pcRdCost->getUseRenModel() )
     2359  {
     2360    unsigned int maxval = 255 * (1<<(g_uiBitDepth + g_uiBitIncrement -8));
     2361    Double fRefValueY = (double) maxval * maxval * iSize;
     2362    Double fRefValueC = fRefValueY / 4.0;
     2363    TRenModel*  pcRenModel = m_pcEncTop->getEncTop()->getRenModel();
     2364    Int64 iDistVSOY, iDistVSOU, iDistVSOV;
     2365    pcRenModel->getTotalSSE( iDistVSOY, iDistVSOU, iDistVSOV );
     2366    dYPSNR = ( iDistVSOY ? 10.0 * log10( fRefValueY / (Double) iDistVSOY ) : 99.99 );
     2367    dUPSNR = ( iDistVSOU ? 10.0 * log10( fRefValueC / (Double) iDistVSOU ) : 99.99 );
     2368    dVPSNR = ( iDistVSOV ? 10.0 * log10( fRefValueC / (Double) iDistVSOV ) : 99.99 );
     2369  }
     2370  else
     2371  {
     2372#endif
     2373#endif
     2374    iHeight >>= 1;
    20862375  iWidth  >>= 1;
    20872376  iStride >>= 1;
     
    21212410  dUPSNR            = ( uiSSDU ? 10.0 * log10( fRefValueC / (Double)uiSSDU ) : 99.99 );
    21222411  dVPSNR            = ( uiSSDV ? 10.0 * log10( fRefValueC / (Double)uiSSDV ) : 99.99 );
    2123 
     2412#if H_3D_VSO
     2413#if H_3D_VSO_SYNTH_DIST_OUT
     2414}
     2415#endif
     2416#endif
    21242417  /* calculate the size of the access unit, excluding:
    21252418   *  - any AnnexB contributions (start_code_prefix, zero_byte, etc.,)
     
    21332426    printf("*** %6s numBytesInNALunit: %u\n", nalUnitTypeToString((*it)->m_nalUnitType), numRBSPBytes_nal);
    21342427#endif
    2135     if ((*it)->m_nalUnitType != NAL_UNIT_SEI && (*it)->m_nalUnitType != NAL_UNIT_SEI_SUFFIX)
     2428    if ((*it)->m_nalUnitType != NAL_UNIT_PREFIX_SEI && (*it)->m_nalUnitType != NAL_UNIT_SUFFIX_SEI)
    21362429    {
    21372430      numRBSPBytes += numRBSPBytes_nal;
     
    21432436
    21442437  //===== add PSNR =====
    2145 
    21462438#if H_MV
    21472439  m_pcEncTop->getAnalyzeAll()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    21492441  m_gcAnalyzeAll.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    21502442#endif
    2151 
    21522443  TComSlice*  pcSlice = pcPic->getSlice(0);
    21532444  if (pcSlice->isIntra())
    21542445  {
    2155 
    21562446#if H_MV
    21572447    m_pcEncTop->getAnalyzeI()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    21592449    m_gcAnalyzeI.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    21602450#endif
    2161 
    21622451  }
    21632452  if (pcSlice->isInterP())
    21642453  {
    2165 
    21662454#if H_MV
    21672455    m_pcEncTop->getAnalyzeP()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    21692457    m_gcAnalyzeP.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    21702458#endif
    2171 
    21722459  }
    21732460  if (pcSlice->isInterB())
    21742461  {
    2175 
    21762462#if H_MV
    21772463    m_pcEncTop->getAnalyzeB()->addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
     
    21792465    m_gcAnalyzeB.addResult (dYPSNR, dUPSNR, dVPSNR, (Double)uibits);
    21802466#endif
    2181 
    21822467  }
    21832468
     
    21862471
    21872472#if ADAPTIVE_QP_SELECTION
    2188 
    21892473#if H_MV
    21902474  printf("Layer %3d   POC %4d TId: %1d ( %c-SLICE, nQP %d QP %d ) %10d bits",
     
    22052489         uibits );
    22062490#endif
    2207 
    2208 #else
    2209 
     2491#else
    22102492#if H_MV
    22112493  printf("Layer %3d   POC %4d TId: %1d ( %c-SLICE, QP %d ) %10d bits",
     
    22242506         uibits );
    22252507#endif
    2226 
    22272508#endif
    22282509
     
    22572538 * This function checks the configuration and returns the appropriate nal_unit_type for the picture.
    22582539 */
    2259 NalUnitType TEncGOP::getNalUnitType(Int pocCurr)
     2540NalUnitType TEncGOP::getNalUnitType(Int pocCurr, Int lastIDR)
    22602541{
    22612542  if (pocCurr == 0)
    22622543  {
    2263     return NAL_UNIT_CODED_SLICE_IDR;
     2544    return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
    22642545  }
    22652546  if (pocCurr % m_pcCfg->getIntraPeriod() == 0)
     
    22712552    else if (m_pcCfg->getDecodingRefreshType() == 2)
    22722553    {
    2273       return NAL_UNIT_CODED_SLICE_IDR;
     2554      return NAL_UNIT_CODED_SLICE_IDR_W_RADL;
    22742555    }
    22752556  }
     
    22832564      // controlling the reference pictures used for encoding that leading picture. Such a leading
    22842565      // picture need not be marked as a TFD picture.
    2285       return NAL_UNIT_CODED_SLICE_TFD;
     2566      return NAL_UNIT_CODED_SLICE_RASL_R;
     2567    }
     2568  }
     2569  if (lastIDR>0)
     2570  {
     2571    if (pocCurr < lastIDR)
     2572    {
     2573      return NAL_UNIT_CODED_SLICE_RADL_R;
    22862574    }
    22872575  }
     
    23342622}
    23352623
    2336 /** Determine the difference between consecutive tile sizes (in bytes) and writes it to  bistream rNalu [slice header]
    2337  * \param rpcBitstreamRedirect contains the bitstream to be concatenated to rNalu. rpcBitstreamRedirect contains slice payload. rpcSlice contains tile location information.
    2338  * \returns Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call.
     2624/** Attaches the input bitstream to the stream in the output NAL unit
     2625    Updates rNalu to contain concatenated bitstream. rpcBitstreamRedirect is cleared at the end of this function call.
     2626 *  \param codedSliceData contains the coded slice data (bitstream) to be concatenated to rNalu
     2627 *  \param rNalu          target NAL unit
    23392628 */
    2340 Void TEncGOP::xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice)
     2629Void TEncGOP::xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& codedSliceData)
    23412630{
    23422631  // Byte-align
     
    23442633
    23452634  // Perform bitstream concatenation
    2346   if (rpcBitstreamRedirect->getNumberOfWrittenBits() > 0)
    2347   {
    2348     UInt uiBitCount  = rpcBitstreamRedirect->getNumberOfWrittenBits();
    2349     if (rpcBitstreamRedirect->getByteStreamLength()>0)
    2350     {
    2351       UChar *pucStart  =  reinterpret_cast<UChar*>(rpcBitstreamRedirect->getByteStream());
    2352       UInt uiWriteByteCount = 0;
    2353       while (uiWriteByteCount < (uiBitCount >> 3) )
    2354       {
    2355         UInt uiBits = (*pucStart);
    2356         rNalu.m_Bitstream.write(uiBits, 8);
    2357         pucStart++;
    2358         uiWriteByteCount++;
    2359       }
    2360     }
    2361     UInt uiBitsHeld = (uiBitCount & 0x07);
    2362     for (UInt uiIdx=0; uiIdx < uiBitsHeld; uiIdx++)
    2363     {
    2364       rNalu.m_Bitstream.write((rpcBitstreamRedirect->getHeldBits() & (1 << (7-uiIdx))) >> (7-uiIdx), 1);
    2365     }         
     2635  if (codedSliceData->getNumberOfWrittenBits() > 0)
     2636    {
     2637    rNalu.m_Bitstream.addSubstream(codedSliceData);
    23662638  }
    23672639
    23682640  m_pcEntropyCoder->setBitstream(&rNalu.m_Bitstream);
    23692641
    2370   delete rpcBitstreamRedirect;
    2371   rpcBitstreamRedirect = new TComOutputBitstream;
     2642  codedSliceData->clear();
    23722643}
    23732644
     
    24942765     }               
    24952766  }
    2496   assert(it != accessUnit.end());
     2767//  assert(it != accessUnit.end());  // Triggers with some legit configurations
    24972768  return seiStartPos;
    24982769}
    24992770#endif
    25002771
     2772#if L0386_DB_METRIC
     2773Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices )
     2774{
     2775  TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec();
     2776  Pel* Rec    = pcPicYuvRec->getLumaAddr( 0 );
     2777  Pel* tempRec = Rec;
     2778  Int  stride = pcPicYuvRec->getStride();
     2779  UInt log2maxTB = pcPic->getSlice(0)->getSPS()->getQuadtreeTULog2MaxSize();
     2780  UInt maxTBsize = (1<<log2maxTB);
     2781  const UInt minBlockArtSize = 8;
     2782  const UInt picWidth = pcPicYuvRec->getWidth();
     2783  const UInt picHeight = pcPicYuvRec->getHeight();
     2784  const UInt noCol = (picWidth>>log2maxTB);
     2785  const UInt noRows = (picHeight>>log2maxTB);
     2786  UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64));
     2787  UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64));
     2788  UInt colIdx = 0;
     2789  UInt rowIdx = 0;
     2790  Pel p0, p1, p2, q0, q1, q2;
     2791 
     2792  Int qp = pcPic->getSlice(0)->getSliceQp();
     2793  Int bitdepthScale = 1 << (g_bitDepthY-8);
     2794  Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale;
     2795  const Int thr2 = (beta>>2);
     2796  const Int thr1 = 2*bitdepthScale;
     2797  UInt a = 0;
     2798 
     2799  memset(colSAD, 0, noCol*sizeof(UInt64));
     2800  memset(rowSAD, 0, noRows*sizeof(UInt64));
     2801 
     2802  if (maxTBsize > minBlockArtSize)
     2803  {
     2804    // Analyze vertical artifact edges
     2805    for(Int c = maxTBsize; c < picWidth; c += maxTBsize)
     2806    {
     2807      for(Int r = 0; r < picHeight; r++)
     2808      {
     2809        p2 = Rec[c-3];
     2810        p1 = Rec[c-2];
     2811        p0 = Rec[c-1];
     2812        q0 = Rec[c];
     2813        q1 = Rec[c+1];
     2814        q2 = Rec[c+2];
     2815        a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1);
     2816        if ( thr1 < a && a < thr2)
     2817        {
     2818          colSAD[colIdx] += abs(p0 - q0);
     2819        }
     2820        Rec += stride;
     2821      }
     2822      colIdx++;
     2823      Rec = tempRec;
     2824    }
     2825   
     2826    // Analyze horizontal artifact edges
     2827    for(Int r = maxTBsize; r < picHeight; r += maxTBsize)
     2828    {
     2829      for(Int c = 0; c < picWidth; c++)
     2830      {
     2831        p2 = Rec[c + (r-3)*stride];
     2832        p1 = Rec[c + (r-2)*stride];
     2833        p0 = Rec[c + (r-1)*stride];
     2834        q0 = Rec[c + r*stride];
     2835        q1 = Rec[c + (r+1)*stride];
     2836        q2 = Rec[c + (r+2)*stride];
     2837        a = ((abs(p2-(p1<<1)+p0)+abs(q0-(q1<<1)+q2))<<1);
     2838        if (thr1 < a && a < thr2)
     2839        {
     2840          rowSAD[rowIdx] += abs(p0 - q0);
     2841        }
     2842      }
     2843      rowIdx++;
     2844    }
     2845  }
     2846 
     2847  UInt64 colSADsum = 0;
     2848  UInt64 rowSADsum = 0;
     2849  for(Int c = 0; c < noCol-1; c++)
     2850  {
     2851    colSADsum += colSAD[c];
     2852  }
     2853  for(Int r = 0; r < noRows-1; r++)
     2854  {
     2855    rowSADsum += rowSAD[r];
     2856  }
     2857 
     2858  colSADsum <<= 10;
     2859  rowSADsum <<= 10;
     2860  colSADsum /= (noCol-1);
     2861  colSADsum /= picHeight;
     2862  rowSADsum /= (noRows-1);
     2863  rowSADsum /= picWidth;
     2864 
     2865  UInt64 avgSAD = ((colSADsum + rowSADsum)>>1);
     2866  avgSAD >>= (g_bitDepthY-8);
     2867 
     2868  if ( avgSAD > 2048 )
     2869  {
     2870    avgSAD >>= 9;
     2871    Int offset = Clip3(2,6,(Int)avgSAD);
     2872    for (Int i=0; i<uiNumSlices; i++)
     2873    {
     2874      pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(true);
     2875      pcPic->getSlice(i)->setDeblockingFilterDisable(false);
     2876      pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( offset );
     2877      pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2( offset );
     2878    }
     2879  }
     2880  else
     2881  {
     2882    for (Int i=0; i<uiNumSlices; i++)
     2883    {
     2884      pcPic->getSlice(i)->setDeblockingFilterOverrideFlag(false);
     2885      pcPic->getSlice(i)->setDeblockingFilterDisable(        pcPic->getSlice(i)->getPPS()->getPicDisableDeblockingFilterFlag() );
     2886      pcPic->getSlice(i)->setDeblockingFilterBetaOffsetDiv2( pcPic->getSlice(i)->getPPS()->getDeblockingFilterBetaOffsetDiv2() );
     2887      pcPic->getSlice(i)->setDeblockingFilterTcOffsetDiv2(   pcPic->getSlice(i)->getPPS()->getDeblockingFilterTcOffsetDiv2()   );
     2888    }
     2889  }
     2890 
     2891  free(colSAD);
     2892  free(rowSAD);
     2893}
     2894#endif
    25012895#if H_MV
    25022896Void TEncGOP::xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid )
     
    25292923
    25302924    // set inter-view modifications
    2531     if( (maxRefListSize > 1) && (numModifications > 0) )
    2532     {
    2533       refPicListModification->setRefPicListModificationFlagL( li, true );
     2925    Bool isModified = false;
    25342926      Int tempList[16];
    25352927      for( Int k = 0; k < 16; k++ ) { tempList[k] = -1; }
    25362928
    2537       Bool isModified = false;
     2929    if( (maxRefListSize > 1) && (numModifications > 0) )
     2930    {
    25382931      for( Int k = 0; k < ge.m_numInterViewRefPics; k++ )
    25392932      {
     
    25542947        }
    25552948      }
     2949    }
     2950
     2951    refPicListModification->setRefPicListModificationFlagL( li, isModified ); 
     2952
    25562953      if( isModified )
    25572954      {
     
    25702967        }
    25712968      }
    2572       else
    2573       {
    2574         refPicListModification->setRefPicListModificationFlagL( li, false );
    2575       }
    2576     }
    25772969  }
    25782970}
    25792971#endif
    2580 
    25812972//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncGOP.h

    r438 r446  
    105105  Int                     m_viewId;
    106106#if H_3D
     107  Int                     m_viewIndex;
    107108  Bool                    m_isDepth;
    108109#endif
    109110#endif
    110 
    111111  //--Adaptive Loop filter
    112112  TEncSampleAdaptiveOffset*  m_pcSAO;
     
    132132  Bool                    m_bufferingPeriodSEIPresentInAU;
    133133  Bool                    m_pictureTimingSEIPresentInAU;
     134#if K0180_SCALABLE_NESTING_SEI
     135  Bool                    m_nestedBufferingPeriodSEIPresentInAU;
     136  Bool                    m_nestedPictureTimingSEIPresentInAU;
     137#endif
    134138#endif
    135139public:
     
    141145 
    142146  Void  init        ( TEncTop* pcTEncTop );
    143 
    144147#if H_MV
    145148  Void  initGOP     ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP);
     
    148151  Void  compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );
    149152#endif
    150 
    151   Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice);
     153  Void  xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect);
    152154
    153155#if H_MV
     
    156158  Int       getViewId        ()                 { return m_viewId;    }
    157159#if H_3D
     160  Int       getViewIndex     ()                 { return m_viewIndex;    }
    158161  Bool      getIsDepth       ()                 { return m_isDepth; }
    159162#endif
     
    167170  Void  printOutSummary      ( UInt uiNumAllPicCoded );
    168171#endif
    169 
     172#if H_3D_VSO
     173  Void  preLoopFilterPicAll  ( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits );
     174#else
    170175  Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
     176#endif
    171177 
    172178  TEncSlice*  getSliceEncoder()   { return m_pcSliceEncoder; }
    173   NalUnitType getNalUnitType( Int pocCurr );
     179  NalUnitType getNalUnitType( Int pocCurr, Int lastIdr );
    174180  Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& );
    175181protected:
     
    181187 
    182188  Void  xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime );
    183  
     189#if H_3D_VSO
     190  Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
     191#else 
    184192  UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
     193#endif
    185194
    186195  Double xCalculateRVM();
     
    189198  SEIFramePacking*        xCreateSEIFramePacking();
    190199  SEIDisplayOrientation*  xCreateSEIDisplayOrientation();
     200
     201#if J0149_TONE_MAPPING_SEI
     202  SEIToneMappingInfo*     xCreateSEIToneMappingInfo();
     203#endif
    191204
    192205  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
     
    199212    m_pictureTimingSEIPresentInAU      = false;
    200213  }
    201 #endif
    202 
     214#if K0180_SCALABLE_NESTING_SEI
     215  Void xResetNestedSEIPresentFlags()
     216  {
     217    m_nestedBufferingPeriodSEIPresentInAU    = false;
     218    m_nestedPictureTimingSEIPresentInAU      = false;
     219  }
     220#endif
     221#endif
    203222#if H_MV
    204223   Void  xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid );
    205224#endif
    206 
     225#if L0386_DB_METRIC
     226  Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
     227#endif
    207228};// END CLASS DEFINITION TEncGOP
    208229
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r438 r446  
    16771677#endif
    16781678{
    1679 #if SAO_CHROMA_LAMBDA
    1680   m_dLambdaLuma    = dLambdaLuma;
    1681   m_dLambdaChroma  = dLambdaChroma;
    1682 #else
    1683   m_dLambdaLuma    = dLambda;
    1684   m_dLambdaChroma  = dLambda;
    1685 #endif
    1686 
    16871679  if(m_bUseNIF)
    16881680  {
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h

    r438 r446  
    5757{
    5858private:
    59   Double            m_dLambdaLuma;
    60   Double            m_dLambdaChroma;
    61 
    6259  TEncEntropy*      m_pcEntropyCoder;
    6360  TEncSbac***       m_pppcRDSbacCoder;              ///< for CABAC
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSbac.cpp

    r324 r446  
    246246}
    247247
     248#if H_3D
     249Void TEncSbac::codeSPS( TComSPS* pcSPS, Int viewIndex, Bool depthFlag )
     250#else
    248251Void TEncSbac::codeSPS( TComSPS* pcSPS )
     252#endif
    249253{
    250254  assert (0);
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSbac.h

    r438 r446  
    9191
    9292  Void  codeVPS                 ( TComVPS* pcVPS );
     93#if !H_3D
    9394  Void  codeSPS                 ( TComSPS* pcSPS     );
     95#else
     96  Void  codeSPS                 ( TComSPS* pcSPS, Int viewIndex, Bool depthFlag );
     97#endif
    9498  Void  codePPS                 ( TComPPS* pcPPS     );
    9599  Void  codeSliceHeader         ( TComSlice* pcSlice );
     
    109113  Void  xWriteEpExGolomb     ( UInt uiSymbol, UInt uiCount );
    110114  Void  xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam );
    111   Void  xWriteTerminatingBit ( UInt uiBit );
    112115 
    113116  Void  xCopyFrom            ( TEncSbac* pSrc );
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSearch.cpp

    r438 r446  
    10081008                                TComYuv*    pcPredYuv,
    10091009                                TComYuv*    pcResiYuv,
     1010#if H_3D_VSO
     1011                                Dist&       ruiDist,
     1012#else
    10101013                                UInt&       ruiDist,
     1014#endif
    10111015                                Int        default0Save1Load2 )
    10121016{
     
    11591163 
    11601164  //===== update distortion =====
     1165#if H_3D_VSO // M39
     1166  if ( m_pcRdCost->getUseVSO() ) 
     1167      ruiDist += m_pcRdCost->getDistPartVSO  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false ); 
     1168  else
     1169#endif
    11611170  ruiDist += m_pcRdCost->getDistPart(g_bitDepthY, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
    11621171}
     
    13711380                                TComYuv*     pcPredYuv,
    13721381                                TComYuv*     pcResiYuv,
     1382#if H_3D_VSO
     1383                                Dist&        ruiDistY,
     1384#else
    13731385                                UInt&        ruiDistY,
     1386#endif
    13741387                                UInt&        ruiDistC,
    13751388#if HHI_RQT_INTRA_SPEEDUP
     
    14191432#endif
    14201433  Double  dSingleCost   = MAX_DOUBLE;
     1434#if H_3D_VSO
     1435  Dist    uiSingleDistY = 0;
     1436#else
    14211437  UInt    uiSingleDistY = 0;
     1438#endif
    14221439  UInt    uiSingleDistC = 0;
    14231440  UInt    uiSingleCbfY  = 0;
     
    14451462        m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] );
    14461463      }
     1464#if H_3D_VSO
     1465      Dist   singleDistYTmp     = 0;
     1466#else
    14471467      UInt   singleDistYTmp     = 0;
     1468#endif
    14481469      UInt   singleDistCTmp     = 0;
    14491470      UInt   singleCbfYTmp      = 0;
     
    14951516        {
    14961517          UInt uiSingleBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false );
     1518#if H_3D_VSO // M NEW
     1519          if ( m_pcRdCost->getUseRenModel() )
     1520            singleCostTmp     = m_pcRdCost->calcRdCostVSO( uiSingleBits, singleDistYTmp + singleDistCTmp );
     1521          else
     1522#endif
    14971523          singleCostTmp     = m_pcRdCost->calcRdCost( uiSingleBits, singleDistYTmp + singleDistCTmp );
    14981524        }
     
    15971623      }
    15981624#endif
     1625#if H_3D_VSO // M40
     1626      if ( m_pcRdCost->getUseLambdaScaleVSO())     
     1627        dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDistY + uiSingleDistC );     
     1628      else
     1629#endif
    15991630      dSingleCost       = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistY + uiSingleDistC );
    16001631    }
     
    16181649    //----- code splitted block -----
    16191650    Double  dSplitCost      = 0.0;
     1651#if H_3D_VSO
     1652    Dist    uiSplitDistY    = 0;
     1653#else
    16201654    UInt    uiSplitDistY    = 0;
     1655#endif
    16211656    UInt    uiSplitDistC    = 0;
    16221657    UInt    uiQPartsDiv     = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
     
    16621697    //----- determine rate and r-d cost -----
    16631698    UInt uiSplitBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false );
     1699#if H_3D_VSO // M41
     1700    if( m_pcRdCost->getUseLambdaScaleVSO() )   
     1701      dSplitCost = m_pcRdCost->calcRdCostVSO( uiSplitBits, uiSplitDistY + uiSplitDistC );   
     1702    else
     1703#endif
    16641704    dSplitCost       = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistY + uiSplitDistC );
    16651705   
     
    17331773    }
    17341774  }
     1775
     1776#if H_3D_VSO // M42
     1777  if ( m_pcRdCost->getUseRenModel() && bCheckFull )
     1778  {
     1779    UInt  uiWidth     = pcCU->getWidth ( 0 ) >> uiTrDepth;
     1780    UInt  uiHeight    = pcCU->getHeight( 0 ) >> uiTrDepth;
     1781    UInt  uiQTLayer   = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
     1782    Pel*  piSrc       = m_pcQTTempTComYuv[ uiQTLayer ].getLumaAddr( uiAbsPartIdx );
     1783    UInt  uiSrcStride = m_pcQTTempTComYuv[ uiQTLayer ].getStride  ();
     1784
     1785    m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight );
     1786  }
     1787#endif
     1788
    17351789  ruiDistY += uiSingleDistY;
    17361790  ruiDistC += uiSingleDistC;
     
    24432497  UInt    uiQNumParts    = pcCU->getTotalNumPart() >> 2;
    24442498  UInt    uiWidthBit     = pcCU->getIntraSizeIdx(0);
     2499#if H_3D_VSO
     2500  Dist    uiOverallDistY = 0;
     2501#else
    24452502  UInt    uiOverallDistY = 0;
     2503#endif
    24462504  UInt    uiOverallDistC = 0;
    24472505  UInt    CandNum;
     
    24922550
    24932551        predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
    2494        
     2552#if H_3D_VSO // M34
     2553        Dist uiSad;
     2554        if ( m_pcRdCost->getUseVSO() )
     2555        {
     2556          if ( m_pcRdCost->getUseEstimatedVSD() )
     2557          {         
     2558            uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) );
     2559          }
     2560          else
     2561          {   
     2562            uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true );
     2563          }
     2564        }
     2565        else
     2566        {
     2567          uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
     2568        }
     2569#else       
    24952570        // use hadamard transform here
    24962571        UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
     2572#endif
    24972573       
    24982574        UInt   iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );
     2575
     2576     
     2577#if H_3D_VSO // M35
     2578        Double dLambda;
     2579        if ( m_pcRdCost->getUseLambdaScaleVSO() )
     2580          dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();
     2581        else       
     2582          dLambda = m_pcRdCost->getSqrtLambda();       
     2583
    24992584        Double cost      = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();
     2585#else
     2586        Double cost      = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();
     2587#endif
    25002588       
    25012589        CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
     
    25432631   
    25442632    UInt    uiBestPUMode  = 0;
     2633#if H_3D_VSO
     2634    Dist    uiBestPUDistY = 0;
     2635#else
    25452636    UInt    uiBestPUDistY = 0;
     2637#endif
    25462638    UInt    uiBestPUDistC = 0;
    25472639    Double  dBestPUCost   = MAX_DOUBLE;
     
    25602652     
    25612653      // determine residual for partition
     2654#if H_3D_VSO
     2655      Dist   uiPUDistY = 0;
     2656#else
    25622657      UInt   uiPUDistY = 0;
     2658#endif
    25632659      UInt   uiPUDistC = 0;
    25642660      Double dPUCost   = 0.0;
     2661#if H_3D_VSO // M36
     2662      if( m_pcRdCost->getUseRenModel() )
     2663      {
     2664        m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
     2665      }
     2666#endif
    25652667#if HHI_RQT_INTRA_SPEEDUP
    25662668      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost );
     
    26252727     
    26262728      // determine residual for partition
     2729#if H_3D_VSO
     2730      Dist   uiPUDistY = 0;
     2731#else
    26272732      UInt   uiPUDistY = 0;
     2733#endif
    26282734      UInt   uiPUDistC = 0;
    26292735      Double dPUCost   = 0.0;
     2736
     2737#if H_3D_VSO // M37
     2738      // reset Model
     2739      if( m_pcRdCost->getUseRenModel() )
     2740      {
     2741        m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
     2742      }
     2743#endif
    26302744      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );
    26312745     
     
    26922806        }
    26932807      }
     2808#if H_3D_VSO // M38
     2809      // set model
     2810      if( m_pcRdCost->getUseRenModel() )
     2811      {
     2812        piSrc = pcRecoYuv->getLumaAddr( uiPartOffset );
     2813        m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piSrc, uiSrcStride, uiCompWidth, uiCompHeight);
     2814      }
     2815#endif
    26942816      if( !bLumaOnly && !bSkipChroma )
    26952817      {
     
    29823104  uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
    29833105
     3106#if H_3D_VSO // M43
     3107  if( m_pcRdCost->getUseLambdaScaleVSO() ) 
     3108    dCost =  m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion ); 
     3109  else
     3110#endif
    29843111  dCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion );
    29853112
     
    32093336    UInt          uiBitsTempL0[MAX_NUM_REF];
    32103337
     3338#if L0034_COMBINED_LIST_CLEANUP
     3339    TComMv        mvValidList1;
     3340    Int           refIdxValidList1 = 0;
     3341    UInt          bitsValidList1 = MAX_UINT;
     3342    UInt          costValidList1 = MAX_UINT;
     3343#endif
     3344
    32113345    xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits);
    32123346   
     
    32553389        uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
    32563390#if ZERO_MVD_EST
     3391#if L0034_COMBINED_LIST_CLEANUP
     3392        if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 )
     3393#else
    32573394        if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) &&
    32583395            (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0))
     3396#endif
    32593397        {
    32603398          uiZeroMvdBitsTemp = uiBitsTemp;
     
    32763414       
    32773415#if GPB_SIMPLE_UNI
     3416#if L0034_COMBINED_LIST_CLEANUP
     3417        if ( iRefList == 1 )    // list 1
     3418        {
     3419          if ( pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 )
     3420          {
     3421            cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )];
     3422            uiCostTemp = uiCostTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )];
     3423            /*first subtract the bit-rate part of the cost of the other list*/
     3424            uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp )] );
     3425            /*correct the bit-rate part of the current ref*/
     3426            m_pcRdCost->setPredictor  ( cMvPred[iRefList][iRefIdxTemp] );
     3427            uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );
     3428            /*calculate the correct cost*/
     3429            uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );
     3430          }
     3431          else
     3432          {
     3433            xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     3434          }
     3435        }
     3436        else
     3437        {
     3438          xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     3439        }
     3440#else
    32783441        if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0)
    32793442        {
     
    33173480          }       
    33183481        }
     3482#endif
    33193483#else
    33203484        xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
     
    33233487        xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    33243488
     3489#if L0034_COMBINED_LIST_CLEANUP
     3490        if ( iRefList == 0 )
     3491        {
     3492          uiCostTempL0[iRefIdxTemp] = uiCostTemp;
     3493          uiBitsTempL0[iRefIdxTemp] = uiBitsTemp;
     3494        }
     3495        if ( uiCostTemp < uiCost[iRefList] )
     3496        {
     3497          uiCost[iRefList] = uiCostTemp;
     3498          uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction
     3499
     3500          // set motion
     3501          cMv[iRefList]     = cMvTemp[iRefList][iRefIdxTemp];
     3502          iRefIdx[iRefList] = iRefIdxTemp;
     3503        }
     3504
     3505        if ( iRefList == 1 && uiCostTemp < costValidList1 && pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 )
     3506        {
     3507          costValidList1 = uiCostTemp;
     3508          bitsValidList1 = uiBitsTemp;
     3509
     3510          // set motion
     3511          mvValidList1     = cMvTemp[iRefList][iRefIdxTemp];
     3512          refIdxValidList1 = iRefIdxTemp;
     3513        }
     3514#else
    33253515        if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())
    33263516        {
     
    33723562            }
    33733563          }
     3564#endif
    33743565      }
    33753566    }
     
    34353626       
    34363627        Int         iRefList    = iIter % 2;
     3628#if L0034_COMBINED_LIST_CLEANUP
     3629        if ( m_pcEncCfg->getUseFastEnc() )
     3630        {
     3631          if( uiCost[0] <= uiCost[1] )
     3632          {
     3633            iRefList = 1;
     3634          }
     3635          else
     3636          {
     3637            iRefList = 0;
     3638          }
     3639        }
     3640        else if ( iIter == 0 )
     3641        {
     3642          iRefList = 0;
     3643        }
     3644        if ( iIter == 0 && !pcCU->getSlice()->getMvdL1ZeroFlag())
     3645        {
     3646          pcCU->getCUMvField(RefPicList(1-iRefList))->setAllMv( cMv[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
     3647          pcCU->getCUMvField(RefPicList(1-iRefList))->setAllRefIdx( iRefIdx[1-iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
     3648          TComYuv*  pcYuvPred = &m_acYuvPred[1-iRefList];
     3649          motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx );
     3650        }
     3651#else
    34373652        if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) )
    34383653        {
    34393654          iRefList = 1;
    34403655        }
     3656#endif
    34413657        RefPicList  eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    34423658
     
    35733789    UInt uiMEBits = 0;
    35743790    // Set Motion Field_
     3791#if L0034_COMBINED_LIST_CLEANUP
     3792    cMv[1] = mvValidList1;
     3793    iRefIdx[1] = refIdxValidList1;
     3794    uiBits[1] = bitsValidList1;
     3795    uiCost[1] = costValidList1;
     3796#else
    35753797    if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) )
    35763798    {
    35773799      uiCost[1] = MAX_UINT;
    35783800    }
     3801#endif
    35793802#if AMP_MRG
    35803803    if (bTestNormalMC)
     
    44644687  Bool      bHighPass    = pcCU->getSlice()->getDepth() ? true : false;
    44654688  UInt      uiBits       = 0, uiBitsBest = 0;
     4689#if H_3D_VSO
     4690  Dist      uiDistortion = 0, uiDistortionBest = 0;
     4691#else
    44664692  UInt      uiDistortion = 0, uiDistortionBest = 0;
     4693#endif
    44674694 
    44684695  UInt      uiWidth      = pcCU->getWidth ( 0 );
     
    44774704   
    44784705    pcYuvPred->copyToPartYuv( rpcYuvRec, 0 );
    4479    
     4706
     4707#if H_3D_VSO // M13
     4708    if ( m_pcRdCost->getUseVSO() )
     4709    {
     4710      uiDistortion = m_pcRdCost->getDistPartVSO( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight     , false );
     4711    }
     4712    else   
     4713    {
     4714#endif
    44804715#if WEIGHTED_CHROMA_DISTORTION
    44814716    uiDistortion = m_pcRdCost->getDistPart(g_bitDepthY, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight      )
     
    44884723#endif
    44894724
     4725#if H_3D_VSO // MIgnore
     4726    }
     4727#endif
     4728
    44904729    if( m_bUseSBACRD )
    44914730      m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST]);
     
    45024741    pcCU->getTotalBits()       = uiBits;
    45034742    pcCU->getTotalDistortion() = uiDistortion;
    4504     pcCU->getTotalCost()       = m_pcRdCost->calcRdCost( uiBits, uiDistortion );
    4505    
     4743#if H_3D_VSO //M 14
     4744    if ( m_pcRdCost->getUseLambdaScaleVSO() )   
     4745      pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion );   
     4746    else
     4747#endif   
     4748    pcCU->getTotalCost() = m_pcRdCost->calcRdCost( uiBits, uiDistortion );
     4749
    45064750    if( m_bUseSBACRD )
    45074751      m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_TEMP_BEST]);
     
    45094753    pcCU->setCbfSubParts( 0, 0, 0, 0, pcCU->getDepth( 0 ) );
    45104754    pcCU->setTrIdxSubParts( 0, 0, pcCU->getDepth(0) );
    4511    
     4755
     4756#if H_3D_VSO // necessary? // M15
     4757    // set Model
     4758    if( !m_pcRdCost->getUseEstimatedVSD()&& m_pcRdCost->getUseRenModel() )
     4759    {
     4760      Pel*  piSrc       = rpcYuvRec->getLumaAddr();
     4761      UInt  uiSrcStride = rpcYuvRec->getStride();
     4762      m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     4763    }
     4764#endif
     4765
    45124766    return;
    45134767  }
     
    45224776    while( pcCU->getWidth(0) > (pcCU->getSlice()->getSPS()->getMaxTrSize()<<uiTrLevel) ) uiTrLevel++;
    45234777  }
    4524   UInt uiMaxTrMode = pcCU->getSlice()->getSPS()->getMaxTrDepth() + uiTrLevel;
     4778  UInt uiMaxTrMode = 1 + uiTrLevel;
    45254779 
    45264780  while((uiWidth>>uiMaxTrMode) < (g_uiMaxCUWidth>>g_uiMaxCUDepth)) uiMaxTrMode--;
     
    45394793    {
    45404794      m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_CURR_BEST ] );
    4541     }
    4542    
     4795    }   
     4796
     4797#if H_3D_VSO // M16 // M18
     4798    Dist uiZeroDistortion = 0;
     4799    if ( m_pcRdCost->getUseVSO() )  // This creating and destroying need to be fixed.
     4800    {
     4801      m_cYuvRecTemp.create( pcYuvPred->getWidth(), pcYuvPred->getHeight()  );
     4802    }
     4803
     4804    xEstimateResidualQT( pcCU, 0, 0, 0, pcYuvOrg, pcYuvPred, rpcYuvResi,  pcCU->getDepth(0), dCost, uiBits, uiDistortion, &uiZeroDistortion );
     4805   
     4806    if ( m_pcRdCost->getUseVSO() )
     4807    {
     4808      m_cYuvRecTemp.destroy();
     4809    }
     4810#else
    45434811    UInt uiZeroDistortion = 0;
    45444812    xEstimateResidualQT( pcCU, 0, 0, 0, rpcYuvResi,  pcCU->getDepth(0), dCost, uiBits, uiDistortion, &uiZeroDistortion );
     4813#endif
    45454814   
    45464815    m_pcEntropyCoder->resetBits();
    45474816    m_pcEntropyCoder->encodeQtRootCbfZero( pcCU );
    45484817    UInt zeroResiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
     4818
     4819#if H_3D_VSO  // M19
     4820    Double dZeroCost;
     4821    if( m_pcRdCost->getUseLambdaScaleVSO() )   
     4822      dZeroCost = m_pcRdCost->calcRdCostVSO( 0, uiZeroDistortion );
     4823    else
     4824      dZeroCost = m_pcRdCost->calcRdCost( zeroResiBits, uiZeroDistortion );
     4825#else
    45494826    Double dZeroCost = m_pcRdCost->calcRdCost( zeroResiBits, uiZeroDistortion );
     4827#endif
    45504828    if(pcCU->isLosslessCoded( 0 ))
    45514829    { 
     
    45964874    }
    45974875   
    4598    
     4876#if H_3D_VSO // M20
     4877    Double dExactCost;
     4878    if( m_pcRdCost->getUseLambdaScaleVSO() )   
     4879      dExactCost = m_pcRdCost->calcRdCostVSO( uiBits, uiDistortion );   
     4880    else
     4881      dExactCost = m_pcRdCost->calcRdCost   ( uiBits, uiDistortion );
     4882#else   
    45994883    Double dExactCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion );
     4884#endif
    46004885    dCost = dExactCost;
    46014886   
     
    46394924      }
    46404925    }
     4926#if H_3D_VSO // M21
     4927    if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() )
     4928    {
     4929      Pel*  piSrc       = pcYuvOrg->getLumaAddr();
     4930      UInt  uiSrcStride = pcYuvOrg->getStride();
     4931      m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     4932    }
     4933#endif
    46414934  }
    46424935 
     
    46694962  }
    46704963  rpcYuvRec->addClip ( pcYuvPred, rpcYuvResiBest, 0, uiWidth );
    4671  
     4964
     4965#if H_3D_VSO  // M22 // GT: might be removed since VSO already provided clipped distortion
     4966  if ( m_pcRdCost->getUseVSO() )
     4967  {
     4968    uiDistortionBest = m_pcRdCost->getDistPartVSO  ( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight, false );
     4969  }
     4970  else
     4971  {
     4972#endif
    46724973  // update with clipped distortion and cost (qp estimation loop uses unclipped values)
    46734974#if WEIGHTED_CHROMA_DISTORTION
     
    46804981  + m_pcRdCost->getDistPart(g_bitDepthC, rpcYuvRec->getCrAddr(),   rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(),   pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 );
    46814982#endif
     4983#if H_3D_VSO // M23
     4984  }
     4985  if ( m_pcRdCost->getUseLambdaScaleVSO() )
     4986    dCostBest = m_pcRdCost->calcRdCostVSO( uiBitsBest, uiDistortionBest );
     4987  else
     4988#endif
    46824989  dCostBest = m_pcRdCost->calcRdCost( uiBitsBest, uiDistortionBest );
    46834990 
     
    46924999 
    46935000  pcCU->setQPSubParts( qpBest, 0, pcCU->getDepth(0) );
     5001
     5002#if H_3D_VSO // M24 // necessary??
     5003  if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() )
     5004  {
     5005    Pel*  piSrc       = rpcYuvRec->getLumaAddr();
     5006    UInt  uiSrcStride = rpcYuvRec->getStride();
     5007    m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     5008  }
     5009#endif
    46945010}
    46955011
     5012#if H_3D_VSO // M25
     5013Void TEncSearch::xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist )
     5014#else
    46965015Void TEncSearch::xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist )
     5016#endif
    46975017{
    46985018  const UInt uiTrMode = uiDepth - pcCU->getDepth( 0 );
     
    47275047  Double dSingleCost = MAX_DOUBLE;
    47285048  UInt uiSingleBits = 0;
     5049#if H_3D_VSO
     5050  Dist uiSingleDist = 0;
     5051#else
    47295052  UInt uiSingleDist = 0;
     5053#endif
    47305054  UInt uiAbsSumY = 0, uiAbsSumU = 0, uiAbsSumV = 0;
    47315055  UInt uiBestTransformMode[3] = {0};
     
    48525176    ::memset( m_pTempPel, 0, sizeof( Pel ) * uiNumSamplesLuma ); // not necessary needed for inside of recursion (only at the beginning)
    48535177   
     5178#if H_3D_VSO // M27
     5179    Dist uiDistY;
     5180    if ( m_pcRdCost->getUseVSO() )
     5181    {
     5182      if( m_pcRdCost->getUseEstimatedVSD() )
     5183      {
     5184        uiDistY = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, m_pTempPel, 1<< uiLog2TrSize, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false );
     5185      }
     5186      else
     5187      {     
     5188        uiDistY = m_pcRdCost->getDistPartVSO  ( pcCU, uiAbsPartIdx, pcPred->getLumaAddr( uiAbsPartIdx ), pcPred->getStride(), pcOrg->getLumaAddr( uiAbsPartIdx), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false ); // initialized with zero residual distortion
     5189      }
     5190    }
     5191    else
     5192    {
     5193      uiDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pTempPel, trWidth, pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight ); // initialized with zero residual destortion
     5194    }
     5195#else
    48545196    UInt uiDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pTempPel, trWidth, pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight ); // initialized with zero residual destortion
     5197#endif
    48555198
    48565199    if ( puiZeroDist )
     
    48675210      assert(scalingListType < 6);     
    48685211      m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),  pcCoeffCurrY, trWidth, trHeight, scalingListType );//this is for inter mode only
    4869      
    4870       const UInt uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),
    4871       pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight );
     5212
     5213#if H_3D_VSO // M28     
     5214      Dist uiNonzeroDistY;
     5215      if ( m_pcRdCost->getUseVSO() )
     5216      {
     5217        if ( m_pcRdCost->getUseEstimatedVSD() )
     5218        {         
     5219          uiNonzeroDistY = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPartIdx, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(),  1<< uiLog2TrSize,    1<< uiLog2TrSize, false );
     5220        }
     5221        else
     5222        {       
     5223          m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTTempAccessLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize  );
     5224          uiNonzeroDistY = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(),
     5225            pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize,   1<< uiLog2TrSize, false );
     5226        }
     5227      }
     5228      else
     5229      {
     5230        uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),      pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight );
     5231      }
     5232#else     
     5233      const UInt uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),      pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth,trHeight );
     5234#endif
    48725235      if (pcCU->isLosslessCoded(0))
    48735236      {
     
    48765239      else
    48775240      {
     5241#if H_3D_VSO // M29
     5242        Double singleCostY;
     5243        if ( m_pcRdCost->getUseLambdaScaleVSO())
     5244          singleCostY = m_pcRdCost->calcRdCostVSO( uiSingleBitsY, uiNonzeroDistY );
     5245        else
     5246          singleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY );
     5247#else
    48785248        const Double singleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY );
     5249#endif
    48795250        m_pcEntropyCoder->resetBits();
    48805251        m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_LUMA,     uiTrMode );
    48815252        const UInt uiNullBitsY   = m_pcEntropyCoder->getNumberOfWrittenBits();
     5253#if H_3D_VSO // M29
     5254        Double nullCostY;
     5255        if ( m_pcRdCost->getUseLambdaScaleVSO())
     5256          nullCostY   = m_pcRdCost->calcRdCostVSO( uiNullBitsY, uiDistY );
     5257        else
     5258          nullCostY   = m_pcRdCost->calcRdCost   ( uiNullBitsY, uiDistY );
     5259#else
    48825260        const Double nullCostY   = m_pcRdCost->calcRdCost( uiNullBitsY, uiDistY );
     5261#endif
    48835262        if( nullCostY < singleCostY ) 
    48845263        {   
     
    49055284      m_pcEntropyCoder->encodeQtCbfZero( pcCU, TEXT_LUMA, uiTrMode );
    49065285      const UInt uiNullBitsY = m_pcEntropyCoder->getNumberOfWrittenBits();
     5286#if H_3D_VSO // M NEW01
     5287      if ( m_pcRdCost->getUseRenModel() )
     5288        minCostY = m_pcRdCost->calcRdCostVSO( uiNullBitsY, uiDistY );
     5289      else
     5290#endif
    49075291      minCostY = m_pcRdCost->calcRdCost( uiNullBitsY, uiDistY );
    49085292    }
     
    50805464    if( checkTransformSkipY )
    50815465    {
     5466#if H_3D_VSO
     5467      Dist uiNonzeroDistY;
     5468      UInt uiAbsSumTransformSkipY;
     5469#else
    50825470      UInt uiNonzeroDistY, uiAbsSumTransformSkipY;
     5471#endif
    50835472      Double dSingleCostY;
    50845473
     
    51385527        m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA,REG_DCT, pcResiCurrY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),  pcCoeffCurrY, trWidth, trHeight, scalingListType, true );
    51395528
    5140         uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),
     5529#if H_3D_VSO // M NEW       
     5530        if ( m_pcRdCost->getUseVSO() )
     5531        {
     5532          if ( m_pcRdCost->getUseEstimatedVSD() )
     5533          {         
     5534            uiNonzeroDistY = m_pcRdCost->getDistPartVSD( pcCU,  uiAbsPartIdx, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(),  1<< uiLog2TrSize,    1<< uiLog2TrSize, false );
     5535          }
     5536          else
     5537          {       
     5538            m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTTempAccessLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize  );
     5539            uiNonzeroDistY = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(),
     5540              pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize,   1<< uiLog2TrSize, false );
     5541          }
     5542        }
     5543        else
     5544#endif
     5545          uiNonzeroDistY = m_pcRdCost->getDistPart(g_bitDepthY, m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( absTUPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),
    51415546          pcResi->getLumaAddr( absTUPartIdx ), pcResi->getStride(), trWidth, trHeight );
    51425547
     5548#if H_3D_VSO
     5549        if ( m_pcRdCost->getUseRenModel() )
     5550          dSingleCostY = m_pcRdCost->calcRdCostVSO( uiTsSingleBitsY, uiNonzeroDistY );
     5551        else
     5552#endif
    51435553        dSingleCostY = m_pcRdCost->calcRdCost( uiTsSingleBitsY, uiNonzeroDistY );
    51445554      }
     
    53595769
    53605770    uiSingleDist = uiDistY + uiDistU + uiDistV;
     5771#if H_3D_VSO // M30
     5772    if ( m_pcRdCost->getUseLambdaScaleVSO())   
     5773      dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDist );   
     5774    else
     5775#endif
    53615776    dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist );
    53625777  } 
     
    53705785      m_pcRDGoOnSbacCoder->load ( m_pppcRDSbacCoder[ uiDepth ][ CI_QT_TRAFO_ROOT ] );
    53715786    }
     5787#if H_3D_VSO
     5788    Dist uiSubdivDist = 0;
     5789#else
    53725790    UInt uiSubdivDist = 0;
     5791#endif
    53735792    UInt uiSubdivBits = 0;
    53745793    Double dSubdivCost = 0.0;
     
    53785797    {
    53795798      UInt nsAddr = uiAbsPartIdx + ui * uiQPartNumSubdiv;
     5799#if H_3D_VSO // M31
     5800      xEstimateResidualQT( pcCU, ui, uiAbsPartIdx + ui * uiQPartNumSubdiv, nsAddr, pcOrg, pcPred, pcResi, uiDepth + 1, dSubdivCost, uiSubdivBits, uiSubdivDist, bCheckFull ? NULL : puiZeroDist );
     5801#else
    53805802      xEstimateResidualQT( pcCU, ui, uiAbsPartIdx + ui * uiQPartNumSubdiv, nsAddr, pcResi, uiDepth + 1, dSubdivCost, uiSubdivBits, uiSubdivDist, bCheckFull ? NULL : puiZeroDist );
     5803#endif
    53815804    }
    53825805   
     
    54115834   
    54125835    uiSubdivBits = m_pcEntropyCoder->getNumberOfWrittenBits();
     5836#if H_3D_VSO // M32
     5837    if ( m_pcRdCost->getUseLambdaScaleVSO())
     5838      dSubdivCost  = m_pcRdCost->calcRdCostVSO( uiSubdivBits, uiSubdivDist );
     5839    else
     5840#endif
    54135841    dSubdivCost  = m_pcRdCost->calcRdCost( uiSubdivBits, uiSubdivDist );
    54145842   
     
    54355863    }
    54365864  }
     5865
     5866#if H_3D_VSO // M33
     5867  if( m_pcRdCost->getUseRenModel() && !m_pcRdCost->getUseEstimatedVSD() )
     5868  {
     5869    UInt  uiWidth     = 1<< uiLog2TrSize;
     5870    UInt  uiHeight    = 1<< uiLog2TrSize;
     5871
     5872    Pel*  piSrc;
     5873    UInt  uiSrcStride;
     5874
     5875    if ( uiAbsSumY )
     5876    {
     5877      UInt  uiQTLayer   = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
     5878      m_cYuvRecTemp.addClipPartLuma( &m_pcQTTempTComYuv[uiQTLayer], pcPred, uiAbsPartIdx, 1<< uiLog2TrSize  );
     5879      piSrc       = m_cYuvRecTemp.getLumaAddr( uiAbsPartIdx );
     5880      uiSrcStride = m_cYuvRecTemp.getStride  ();
     5881    }
     5882    else
     5883    {
     5884      piSrc       = pcPred->getLumaAddr( uiAbsPartIdx );
     5885      uiSrcStride = pcPred->getStride  ();
     5886    }
     5887
     5888    m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight );
     5889  }
     5890#endif
     5891
    54375892  rdCost += dSingleCost;
    54385893  ruiBits += uiSingleBits;
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSearch.h

    r324 r446  
    121121  const UInt*     m_puiDFilter;
    122122  Int             m_iMaxDeltaQP;
    123  
     123
     124#if H_3D_VSO // M17
     125  TComYuv         m_cYuvRecTemp;
     126#endif
    124127  // AMVP cost computation
    125128  // UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS];
     
    253256                                    TComYuv*     pcPredYuv,
    254257                                    TComYuv*     pcResiYuv,
     258#if H_3D_VSO
     259                                    Dist&        ruiDist,
     260#else
    255261                                    UInt&        ruiDist,
     262#endif
    256263                                    Int         default0Save1Load2 = 0);
    257264  Void  xIntraCodingChromaBlk     ( TComDataCU*  pcCU,
     
    272279                                    TComYuv*     pcPredYuv,
    273280                                    TComYuv*     pcResiYuv,
     281#if H_3D_VSO
     282                                    Dist&        ruiDistY,
     283#else
    274284                                    UInt&        ruiDistY,
     285#endif
    275286                                    UInt&        ruiDistC,
    276287#if HHI_RQT_INTRA_SPEEDUP
     
    445456 
    446457  Void xEncodeResidualQT( TComDataCU* pcCU, UInt uiAbsPartIdx, const UInt uiDepth, Bool bSubdivAndCbf, TextType eType );
     458#if H_3D_VSO // M26
     459  Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist );
     460#else
    447461  Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist );
     462#endif
    448463  Void xSetResidualQTData( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx,UInt absTUPartIdx, TComYuv* pcResi, UInt uiDepth, Bool bSpatial );
    449464 
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSlice.cpp

    r438 r446  
    371371  // store lambda
    372372  m_pcRdCost ->setLambda( dLambda );
     373
     374#if H_3D_VSO
     375  m_pcRdCost->setUseLambdaScaleVSO  ( (m_pcCfg->getUseVSO() ||  m_pcCfg->getForceLambdaScaleVSO()) && m_pcCfg->getIsDepth() );
     376  m_pcRdCost->setLambdaVSO          ( dLambda * m_pcCfg->getLambdaScaleVSO() );
     377
     378  // Should be moved to TEncTop
     379 
     380  // SAIT_VSO_EST_A0033
     381  m_pcRdCost->setDisparityCoeff( m_pcCfg->getDispCoeff() );
     382
     383  // LGE_WVSO_A0119
     384  if( m_pcCfg->getUseWVSO() && m_pcCfg->getIsDepth() )
     385  {
     386    m_pcRdCost->setDWeight  ( m_pcCfg->getDWeight()   );
     387    m_pcRdCost->setVSOWeight( m_pcCfg->getVSOWeight() );
     388    m_pcRdCost->setVSDWeight( m_pcCfg->getVSDWeight() );
     389  }
     390
     391#endif
     392
    373393#if WEIGHTED_CHROMA_DISTORTION
    374394// for RDO
     
    414434  eSliceType = (pocLast == 0 || pocCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
    415435#endif
     436
    416437  rpcSlice->setSliceType        ( eSliceType );
    417438#endif
     
    438459#endif
    439460
     461#if L0386_DB_METRIC
     462  if ( m_pcCfg->getDeblockingFilterMetric() )
     463  {
     464    rpcSlice->setDeblockingFilterOverrideFlag(true);
     465    rpcSlice->setDeblockingFilterDisable(false);
     466    rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 );
     467    rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 );
     468  } else
     469#endif
    440470  if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag())
    441471  {
     
    764794   
    765795    Double dPicRdCost;
     796#if H_3D_VSO
     797    Dist64 uiPicDist        = m_uiPicDist;
     798#else
    766799    UInt64 uiPicDist        = m_uiPicDist;
     800#endif
    767801    UInt64 uiALFBits        = 0;
    768802   
     
    771805    // compute RD cost and choose the best
    772806    dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME);
     807#if H_3D
     808    // Above calculation need to be fixed for VSO, including frameLambda value.
     809#endif
    773810   
    774811    if ( dPicRdCost < dPicRdCostBest )
     
    9771014  }
    9781015  // for every CU in slice
     1016#if H_3D
     1017  Int iLastPosY = -1;
     1018#endif
    9791019  UInt uiEncCUOrder;
    9801020  for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU();
     
    9851025    TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );
    9861026    pcCU->initCU( rpcPic, uiCUAddr );
    987 
     1027#if H_3D_VSO
     1028    if ( m_pcRdCost->getUseRenModel() )
     1029    {
     1030      // updated renderer model if necessary
     1031      Int iCurPosX;
     1032      Int iCurPosY;
     1033      pcCU->getPosInPic(0, iCurPosX, iCurPosY );
     1034      if ( iCurPosY != iLastPosY )
     1035      {
     1036        iLastPosY = iCurPosY;         
     1037        pcEncTop->setupRenModel( pcSlice->getPOC() , pcSlice->getViewIndex(), pcSlice->getIsDepth() ? 1 : 0, iCurPosY );
     1038      }
     1039    }
     1040#endif
    9881041#if !RATE_CONTROL_LAMBDA_DOMAIN
    9891042    if(m_pcCfg->getUseRateCtrl())
     
    12231276 \retval rpcBitstream  bitstream class
    12241277 */
    1225 Void TEncSlice::encodeSlice   ( TComPic*& rpcPic, TComOutputBitstream* pcBitstream, TComOutputBitstream* pcSubstreams )
     1278Void TEncSlice::encodeSlice   ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams )
    12261279{
    12271280  UInt       uiCUAddr;
     
    14031456      }
    14041457      {
    1405           UInt uiCounter = 0;
    1406           vector<uint8_t>& rbsp   = pcSubstreams[uiSubStrm].getFIFO();
    1407           for (vector<uint8_t>::iterator it = rbsp.begin(); it != rbsp.end();)
    1408           {
    1409             /* 1) find the next emulated 00 00 {00,01,02,03}
    1410              * 2a) if not found, write all remaining bytes out, stop.
    1411              * 2b) otherwise, write all non-emulated bytes out
    1412              * 3) insert emulation_prevention_three_byte
    1413              */
    1414             vector<uint8_t>::iterator found = it;
    1415             do
    1416             {
    1417               /* NB, end()-1, prevents finding a trailing two byte sequence */
    1418               found = search_n(found, rbsp.end()-1, 2, 0);
    1419               found++;
    1420               /* if not found, found == end, otherwise found = second zero byte */
    1421               if (found == rbsp.end())
    1422               {
    1423                 break;
    1424               }
    1425               if (*(++found) <= 3)
    1426               {
    1427                 break;
    1428               }
    1429             } while (true);
    1430             it = found;
    1431             if (found != rbsp.end())
    1432             {
    1433               it++;
    1434               uiCounter++;
    1435             }
    1436           }
    1437        
     1458        UInt numStartCodeEmulations = pcSubstreams[uiSubStrm].countStartCodeEmulations();
    14381459        UInt uiAccumulatedSubstreamLength = 0;
    14391460        for (Int iSubstrmIdx=0; iSubstrmIdx < iNumSubstreams; iSubstrmIdx++)
     
    14431464        // add bits coded in previous dependent slices + bits coded so far
    14441465        // add number of emulation prevention byte count in the tile
    1445         pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + uiCounter );
     1466        pcSlice->addTileLocation( ((pcSlice->getTileOffstForMultES() + uiAccumulatedSubstreamLength - uiBitsOriginallyInSubstreams) >> 3) + numStartCodeEmulations );
    14461467      }
    14471468    }
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncSlice.h

    r438 r446  
    9191  TEncSbac*               m_pcRDGoOnSbacCoder;                  ///< go-on SBAC encoder
    9292  UInt64                  m_uiPicTotalBits;                     ///< total bits for the picture
     93#if H_3D_VSO
     94  Dist64                  m_uiPicDist;                          ///< total distortion for the picture
     95#else
    9396  UInt64                  m_uiPicDist;                          ///< total distortion for the picture
     97#endif
    9498  Double                  m_dPicRdCost;                         ///< picture-level RD cost
    9599  Double*                 m_pdRdPicLambda;                      ///< array of lambda candidates
     
    122126  Void    precompressSlice    ( TComPic*& rpcPic                                );      ///< precompress slice for multi-loop opt.
    123127  Void    compressSlice       ( TComPic*& rpcPic                                );      ///< analysis stage of slice
    124   Void    encodeSlice         ( TComPic*& rpcPic, TComOutputBitstream* rpcBitstream, TComOutputBitstream* pcSubstreams  );
     128  Void    encodeSlice         ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams  );
    125129 
    126130  // misc. functions
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r438 r446  
    8181  m_pcBitCounters          = NULL;
    8282  m_pcRdCosts              = NULL;
    83 
    8483#if H_MV
    8584  m_ivPicLists = NULL;
     
    9695Void TEncTop::create ()
    9796{
    98 
    9997#if !H_MV
    10098  // initialize global variables
     
    288286Void TEncTop::init()
    289287{
    290 
    291288  // initialize SPS
    292289  xInitSPS();
     
    346343    m_cPreanalyzer.xPreanalyze( dynamic_cast<TEncPic*>( pcPicCurr ) );
    347344  }
    348 }
    349 #endif
    350 
     345#if H_MV
     346  pcPicCurr->setLayerId( getLayerId());
     347#endif
     348#if H_3D
     349  pcPicCurr->setScaleOffset( m_aaiCodedScale, m_aaiCodedOffset );
     350#endif
     351}
     352#endif
    351353Void TEncTop::deletePicBuffer()
    352354{
     
    375377 \retval  iNumEncoded         number of encoded pictures
    376378 */
    377 Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded
    378379#if H_MV
    379                      , Int gopId
    380 #endif               
    381                      )
    382 {
    383 
     380Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded , Int gopId )
     381{
     382#else
     383Void TEncTop::encode(Bool flush, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded )
     384{
     385#endif
    384386#if H_3D
    385387  TComPic* picLastCoded = getPic( getGOPEncoder()->getPocLastCoded() );
     
    389391  }
    390392#endif
    391 
    392393#if H_MV
    393394  if( gopId == 0)
     
    443444  m_iNumPicRcvd       = 0;
    444445  m_uiNumAllPicCoded += iNumEncoded;
    445 
    446446#if H_MV
    447447}
    448448#endif
    449 
    450449}
    451450
     
    547546  m_cSPS.setMaxCUHeight   ( g_uiMaxCUHeight     );
    548547  m_cSPS.setMaxCUDepth    ( g_uiMaxCUDepth      );
    549   m_cSPS.setMinTrDepth    ( 0                   );
    550   m_cSPS.setMaxTrDepth    ( 1                   );
     548
     549  Int minCUSize = m_cSPS.getMaxCUWidth() >> ( m_cSPS.getMaxCUDepth()-g_uiAddCUDepth );
     550  Int log2MinCUSize = 0;
     551  while(minCUSize > 1)
     552  {
     553    minCUSize >>= 1;
     554    log2MinCUSize++;
     555  }
     556
     557  m_cSPS.setLog2MinCodingBlockSize(log2MinCUSize);
     558  m_cSPS.setLog2DiffMaxMinCodingBlockSize(m_cSPS.getMaxCUDepth()-g_uiAddCUDepth);
    551559 
    552560  m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize);
     
    563571
    564572  m_cSPS.setMaxTrSize   ( 1 << m_uiQuadtreeTULog2MaxSize );
    565  
     573#if !L0034_COMBINED_LIST_CLEANUP
    566574  m_cSPS.setUseLComb    ( m_bUseLComb           );
     575#endif
    567576 
    568577  Int i;
     
    645654    pcVUI->setLog2MaxMvLengthVertical(getLog2MaxMvLengthVertical());
    646655  }
     656#if H_3D
     657  if ( !m_isDepth )
     658  {
     659    m_cSPS.initCamParaSPS           ( m_viewIndex, m_uiCamParPrecision, m_bCamParInSliceHeader, m_aaiCodedScale, m_aaiCodedOffset );
     660  }
     661#endif
    647662}
    648663
     
    716731  m_cPPS.setOutputFlagPresentFlag( false );
    717732  m_cPPS.setSignHideFlag(getSignHideFlag());
     733#if L0386_DB_METRIC
     734  if ( getDeblockingFilterMetric() )
     735  {
     736    m_cPPS.setDeblockingFilterControlPresentFlag (true);
     737    m_cPPS.setDeblockingFilterOverrideEnabledFlag(true);
     738    m_cPPS.setPicDisableDeblockingFilterFlag(false);
     739    m_cPPS.setDeblockingFilterBetaOffsetDiv2(0);
     740    m_cPPS.setDeblockingFilterTcOffsetDiv2(0);
     741  }
     742  else
     743  {
    718744  m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
     745  }
     746#else
     747  m_cPPS.setDeblockingFilterControlPresentFlag (m_DeblockingFilterControlPresent );
     748#endif
    719749  m_cPPS.setLog2ParallelMergeLevelMinus2   (m_log2ParallelMergeLevelMinus2 );
    720750  m_cPPS.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG);
     
    763793    }
    764794  }
     795#if H_3D
     796  if( m_cSPS.hasCamParInSliceHeader() )
     797  {
     798    m_cPPS.setSliceHeaderExtensionPresentFlag( true );
     799  }
     800#endif
    765801}
    766802
     
    9881024  }
    9891025#endif
    990 }
     1026
     1027}
     1028
     1029#if L0208_SOP_DESCRIPTION_SEI
     1030Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid )
     1031{
     1032  int rpsIdx = GOPid;
     1033
     1034  for(Int extraNum=m_iGOPSize; extraNum<m_extraRPSs+m_iGOPSize; extraNum++)
     1035  {   
     1036    if(m_uiIntraPeriod > 0 && getDecodingRefreshType() > 0)
     1037    {
     1038      Int POCIndex = POCCurr%m_uiIntraPeriod;
     1039      if(POCIndex == 0)
     1040      {
     1041        POCIndex = m_uiIntraPeriod;
     1042      }
     1043      if(POCIndex == m_GOPList[extraNum].m_POC)
     1044      {
     1045        rpsIdx = extraNum;
     1046      }
     1047    }
     1048    else
     1049    {
     1050      if(POCCurr==m_GOPList[extraNum].m_POC)
     1051      {
     1052        rpsIdx = extraNum;
     1053      }
     1054    }
     1055  }
     1056
     1057  return rpsIdx;
     1058}
     1059#endif
    9911060
    9921061Void  TEncTop::xInitPPSforTiles()
     
    10691138  }
    10701139}
    1071 
    10721140#if H_MV
    10731141Void TEncTop::printSummary( Int numAllPicCoded )
     
    11331201#endif
    11341202
     1203#if H_3D_VSO
     1204Void TEncTop::setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset )
     1205{
     1206  TRenModel* rendererModel = m_cRdCost.getRenModel();
     1207  rendererModel->setupPart( iHorOffset, std::min( (Int) g_uiMaxCUHeight, (Int) ( m_iSourceHeight - iHorOffset ) )) ;
     1208 
     1209  Int iEncViewSIdx = m_cameraParameters->getBaseId2SortedId()[ iEncViewIdx ];
     1210
     1211  // setup base views
     1212  Int iNumOfBV = m_renderModelParameters->getNumOfBaseViewsForView( iEncViewSIdx, iEncContent );
     1213
     1214  for (Int iCurView = 0; iCurView < iNumOfBV; iCurView++ )
     1215  {
     1216    Int iBaseViewSIdx;
     1217    Int iVideoDistMode;
     1218    Int iDepthDistMode;
     1219
     1220    m_renderModelParameters->getBaseViewData( iEncViewSIdx, iEncContent, iCurView, iBaseViewSIdx, iVideoDistMode, iDepthDistMode );
     1221
     1222    AOT( iVideoDistMode < 0 || iVideoDistMode > 2 );
     1223
     1224    Int iBaseViewIdx = m_cameraParameters->getBaseSortedId2Id()[ iBaseViewSIdx ];
     1225
     1226    TComPicYuv* pcPicYuvVideoRec  = m_ivPicLists->getPicYuv( iBaseViewIdx, false, iPoc, true  );
     1227    TComPicYuv* pcPicYuvDepthRec  = m_ivPicLists->getPicYuv( iBaseViewIdx, true , iPoc, true  );
     1228    TComPicYuv* pcPicYuvVideoOrg  = m_ivPicLists->getPicYuv( iBaseViewIdx, false, iPoc, false );
     1229    TComPicYuv* pcPicYuvDepthOrg  = m_ivPicLists->getPicYuv( iBaseViewIdx, true , iPoc, false );   
     1230
     1231    TComPicYuv* pcPicYuvVideoRef  = ( iVideoDistMode == 2 ) ? pcPicYuvVideoOrg  : NULL;
     1232    TComPicYuv* pcPicYuvDepthRef  = ( iDepthDistMode == 2 ) ? pcPicYuvDepthOrg  : NULL;
     1233
     1234    TComPicYuv* pcPicYuvVideoTest = ( iVideoDistMode == 0 ) ? pcPicYuvVideoOrg  : pcPicYuvVideoRec;
     1235    TComPicYuv* pcPicYuvDepthTest = ( iDepthDistMode == 0 ) ? pcPicYuvDepthOrg  : pcPicYuvDepthRec;
     1236
     1237    AOT( (iVideoDistMode == 2) != (pcPicYuvVideoRef != NULL) );
     1238    AOT( (iDepthDistMode == 2) != (pcPicYuvDepthRef != NULL) );
     1239    AOT( pcPicYuvDepthTest == NULL );
     1240    AOT( pcPicYuvVideoTest == NULL );
     1241
     1242    rendererModel->setBaseView( iBaseViewSIdx, pcPicYuvVideoTest, pcPicYuvDepthTest, pcPicYuvVideoRef, pcPicYuvDepthRef );
     1243  }
     1244
     1245  rendererModel->setErrorMode( iEncViewSIdx, iEncContent, 0 );
     1246  // setup virtual views
     1247  Int iNumOfSV  = m_renderModelParameters->getNumOfModelsForView( iEncViewSIdx, iEncContent );
     1248  for (Int iCurView = 0; iCurView < iNumOfSV; iCurView++ )
     1249  {
     1250    Int iOrgRefBaseViewSIdx;
     1251    Int iLeftBaseViewSIdx;
     1252    Int iRightBaseViewSIdx;
     1253    Int iSynthViewRelNum;
     1254    Int iModelNum;
     1255    Int iBlendMode;
     1256    m_renderModelParameters->getSingleModelData(iEncViewSIdx, iEncContent, iCurView, iModelNum, iBlendMode,iLeftBaseViewSIdx, iRightBaseViewSIdx, iOrgRefBaseViewSIdx, iSynthViewRelNum );
     1257
     1258    Int iLeftBaseViewIdx    = -1;
     1259    Int iRightBaseViewIdx   = -1;
     1260
     1261    TComPicYuv* pcPicYuvOrgRef  = NULL;
     1262    Int**      ppiShiftLUTLeft  = NULL;
     1263    Int**      ppiShiftLUTRight = NULL;
     1264    Int**      ppiBaseShiftLUTLeft  = NULL;
     1265    Int**      ppiBaseShiftLUTRight = NULL;
     1266
     1267
     1268    Int        iDistToLeft      = -1;
     1269
     1270    Int iSynthViewIdx = m_cameraParameters->synthRelNum2Idx( iSynthViewRelNum );
     1271
     1272    if ( iLeftBaseViewSIdx != -1 )
     1273    {
     1274      iLeftBaseViewIdx   = m_cameraParameters->getBaseSortedId2Id()   [ iLeftBaseViewSIdx ];
     1275      ppiShiftLUTLeft    = m_cameraParameters->getSynthViewShiftLUTI()[ iLeftBaseViewIdx  ][ iSynthViewIdx  ];
     1276    }
     1277
     1278    if ( iRightBaseViewSIdx != -1 )
     1279    {
     1280      iRightBaseViewIdx  = m_cameraParameters->getBaseSortedId2Id()   [iRightBaseViewSIdx ];
     1281      ppiShiftLUTRight   = m_cameraParameters->getSynthViewShiftLUTI()[ iRightBaseViewIdx ][ iSynthViewIdx ];
     1282    }
     1283
     1284    if ( iRightBaseViewSIdx != -1 && iLeftBaseViewSIdx != -1 )
     1285    {
     1286      iDistToLeft          = m_cameraParameters->getRelDistLeft(  iSynthViewIdx , iLeftBaseViewIdx, iRightBaseViewIdx);
     1287      ppiBaseShiftLUTLeft  = m_cameraParameters->getBaseViewShiftLUTI() [ iLeftBaseViewIdx  ][ iRightBaseViewIdx ];
     1288      ppiBaseShiftLUTRight = m_cameraParameters->getBaseViewShiftLUTI() [ iRightBaseViewIdx ][ iLeftBaseViewIdx  ];
     1289
     1290    }
     1291
     1292    if ( iOrgRefBaseViewSIdx != -1 )
     1293    {
     1294      pcPicYuvOrgRef = m_ivPicLists->getPicYuv(  m_cameraParameters->getBaseSortedId2Id()[ iOrgRefBaseViewSIdx ] , false, iPoc, false );
     1295      AOF ( pcPicYuvOrgRef );
     1296    }
     1297
     1298    rendererModel->setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );
     1299  }
     1300}
     1301#endif
    11351302//! \}
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/TEncTop.h

    r438 r446  
    6363// Class definition
    6464// ====================================================================================================================
    65 
    66 
    6765
    6866/// encoder class
     
    133131  TEncAnalyze             m_cAnalyzeB; 
    134132#endif
    135 
    136133protected:
    137134  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
     
    148145  Void      create          ();
    149146  Void      destroy         ();
    150 
    151147  Void      init            ();
    152 
    153148#if H_MV 
    154149  TComPicLists* getIvPicLists() { return m_ivPicLists; }
    155150#endif
    156 
    157151  Void      deletePicBuffer ();
    158152
     
    162156  Void      initNewPic(TComPicYuv* pcPicYuvOrg);
    163157#endif
    164 
    165158  // -------------------------------------------------------------------------------------------------------------------
    166159  // member access functions
     
    195188  TComPPS*                getPPS                () { return  &m_cPPS;                 }
    196189  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid );
     190#if L0208_SOP_DESCRIPTION_SEI
     191  Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid );
     192#endif
    197193  TComScalingList*        getScalingList        () { return  &m_scalingList;         }
    198 
    199194#if H_MV
    200195  TEncAnalyze*            getAnalyzeAll         () { return &m_cAnalyzeAll; }
     
    210205  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
    211206#endif
    212 
    213 
    214207  // -------------------------------------------------------------------------------------------------------------------
    215208  // encoder function
     
    217210
    218211  /// encode several number of pictures until end-of-sequence
     212#if H_MV
     213  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded  , Int gopId  ); 
     214#else
    219215  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
    220               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded
    221 #if H_MV
    222               , Int gopId
    223 #endif       
    224               ); 
    225 
    226 #if H_MV
    227   void printSummary      ( Int numAllPicCoded );
     216              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 
     217#endif
     218
     219#if H_MV
     220  Void printSummary      ( Int numAllPicCoded );
    228221#else
    229   void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); }
    230 #endif
    231 
     222  void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); }
     223#endif
     224
     225#if H_3D
     226   Void setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset );
     227#endif
    232228};
    233229
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp

    r438 r446  
    235235        Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom );
    236236
    237         // Chroma offset range limination
     237        // Chroma offset range limitation
    238238        if(comp)
    239239        {
    240           Int shift = 1 << (g_bitDepthC - 1);
    241           Int pred = ( shift - ( ( shift*weight)>>(log2Denom) ) );
     240          Int pred = ( 128 - ( ( 128*weight)>>(log2Denom) ) );
    242241          Int deltaOffset = Clip3( -512, 511, (offset - pred) );    // signed 10bit
    243242          offset = Clip3( -128, 127, (deltaOffset + pred) );        // signed 8bit
     243        }
     244        // Luma offset range limitation
     245        else
     246        {
     247          offset = Clip3( -128, 127, offset);
    244248        }
    245249
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibExtractor/TExtrTop.cpp

    r438 r446  
    3737
    3838#include "TExtrTop.h"
    39 
     39#if H_MV
    4040TExtrTop::TExtrTop()
    4141{
     
    5555Bool TExtrTop::extract( InputNALUnit& nalu, std::set<UInt>& rsuiExtractLayerIds )
    5656{
    57 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    5857  //extraction now has to be done using layer_id
    59   UInt uiLayerId = nalu.m_layerId;
    60 #else
    61   UInt uiLayerId = xGetLayerId( nalu.m_viewId, nalu.m_isDepth );
    62 #endif
     58  UInt uiLayerId      = nalu.m_layerId;
     59
     60 
    6361  // Initialize entropy decoder
    6462  m_cEntropyDecoder.setEntropyDecoder( &m_cCavlcDecoder );
    6563  m_cEntropyDecoder.setBitstream     ( nalu.m_Bitstream );
    6664 
    67 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
    6865  if ( nalu.m_nalUnitType == NAL_UNIT_VPS )
    6966  {
    7067    // a hack for now assuming there's only one VPS in the bitstream
    71     m_cEntropyDecoder.decodeVPS( &m_cVPS );
    72      
     68    m_cEntropyDecoder.decodeVPS( &m_cVPS );     
    7369  }
    74 #endif
    7570
    7671  if ( nalu.m_nalUnitType == NAL_UNIT_SPS )
    7772  {
    78      TComSPS cSPS;
    79      TComRPSList cRPS;
    80      cSPS.setRPSList( &cRPS );
    81 #if HHI_MPI || H3D_QTL
    82 #if VIDYO_VPS_INTEGRATION
    83      m_cEntropyDecoder.decodeSPS( &cSPS, m_cVPS.getDepthFlag(uiLayerId) );
     73     TComSPS     cSPS;
     74#if H_3D
     75     Int layerIdInVPS = m_cVPS.getLayerIdInVps( uiLayerId );
     76     m_cEntropyDecoder   .decodeSPS( &cSPS, m_cVPS.getViewIndex( layerIdInVPS ), ( m_cVPS.getDepthId( layerIdInVPS ) == 1 ) );
    8477#else
    85      m_cEntropyDecoder.decodeSPS( &cSPS, nalu.m_isDepth );
     78     m_cEntropyDecoder   .decodeSPS( &cSPS );
    8679#endif
    87 #else
    88      m_cEntropyDecoder.decodeSPS( &cSPS );
    89 #endif
    90 
    91      m_acSPSBuffer.push_back( cSPS );
     80     m_acSPSBuffer       .push_back( cSPS );
    9281  }
    9382
     
    9786
    9887Void TExtrTop::dumpSpsInfo( std::ostream& rcSpsInfoHandle )
    99 {
     88{ 
    10089  rcSpsInfoHandle << "NumSPS = " << m_acSPSBuffer.size() << std::endl;
     90 
     91  std::list<Int>::iterator iterSPSLayerId = m_aiSPSLayerIdBuffer.begin();
    10192
    102   for( std::list<TComSPS>::iterator iterSPS = m_acSPSBuffer.begin(); iterSPS != m_acSPSBuffer.end(); iterSPS++ )
    103   {
    104      rcSpsInfoHandle << std::endl;
    105      rcSpsInfoHandle << "layer_id = "              << xGetLayerId( iterSPS->getViewId(), iterSPS->isDepth() ) << std::endl;
     93  for( std::list<TComSPS>::iterator iterSPS = m_acSPSBuffer.begin(); iterSPS != m_acSPSBuffer.end(); iterSPS++, iterSPSLayerId++ )
     94  {     
     95     rcSpsInfoHandle << "layer_id = "              << *iterSPSLayerId << std::endl;
    10696     rcSpsInfoHandle << "seq_parameter_set_id = "  << iterSPS->getSPSId() << std::endl;
    107      rcSpsInfoHandle << "view_id = "               << iterSPS->getViewId() << std::endl;
    108      rcSpsInfoHandle << "view_order_idx = "        << iterSPS->getViewOrderIdx() << std::endl;
    109      rcSpsInfoHandle << "is_depth = "              << iterSPS->isDepth() << std::endl;
    11097  }
    11198}
     99
     100Void TExtrTop::dumpVpsInfo( std::ostream& rcVpsInfoHandle )
     101{
     102  rcVpsInfoHandle << "MaxLayers = "     << m_cVPS.getMaxLayers()     << std::endl;
     103  rcVpsInfoHandle << "MaxNuhLayerId = " << m_cVPS.getMaxNuhLayerId() << std::endl;
     104 
     105  for ( Int layerIdxInVps = 0; layerIdxInVps < m_cVPS.getMaxLayers(); layerIdxInVps++ )
     106  { 
     107    rcVpsInfoHandle << "LayerIdxInVps =  " << layerIdxInVps                           << std::endl;
     108    rcVpsInfoHandle << "LayerIdInNuh = "   << m_cVPS.getLayerIdInNuh( layerIdxInVps ) << std::endl;
     109    rcVpsInfoHandle << "ViewId = "         << m_cVPS.getViewId      ( layerIdxInVps ) << std::endl;
     110#if H_3D
     111    rcVpsInfoHandle << "DepthFlag = "      << m_cVPS.getViewIndex   ( layerIdxInVps ) << std::endl;     
     112    rcVpsInfoHandle << "DepthFlag = "      << m_cVPS.getDepthId     ( layerIdxInVps ) << std::endl;     
     113#endif
     114  }
     115}
     116#endif
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibExtractor/TExtrTop.h

    r438 r446  
    4646#include <set>
    4747
     48#if H_MV
    4849// ====================================================================================================================
    4950// Class definition
     
    5455{
    5556private:
    56 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
     57
    5758  TComVPS                 m_cVPS;
    58 #endif
    59    std::list<TComSPS>      m_acSPSBuffer;
     59  std::list<TComSPS>      m_acSPSBuffer;
     60  std::list<Int    >      m_aiSPSLayerIdBuffer;
    6061
    6162  // functional classes
     
    7273  Bool     extract( InputNALUnit& nalu, std::set<UInt>& rsuiExtractLayerIds );
    7374  Void     dumpSpsInfo( std::ostream& rcSpsInfoHandle );
     75  Void     dumpVpsInfo( std::ostream& rcVpsInfoHandle );
    7476 
    7577  TComSPS *getFirstSPS() { return m_acSPSBuffer.empty() ? 0 : &(m_acSPSBuffer.front()); }
    7678
    7779protected:
    78    UInt     xGetLayerId( UInt uiViewId, Bool bIsDepth ) { return ( ( uiViewId << 1 ) + ( bIsDepth ? 1 : 0 ) ); }
     80
    7981};// END CLASS DEFINITION TExtrTop
    8082
    8183
    8284#endif // __TEXTRTOP__
    83 
     85#endif
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenFilter.cpp

    r438 r446  
    3636#include "TRenFilter.h"
    3737#include "TRenInterpFilter.h"
    38 
     38#if H_3D
    3939
    4040///// COMMON /////
     
    7272  }
    7373  // Set Threshold
    74   riBlendZThres  = ( Max( abs(piInvZLUTLeft[0]- piInvZLUTLeft[255]), abs(piInvZLUTRight[0]- piInvZLUTRight[255]) ) * iBlendZThresPerc + 50)  / 100;
     74  riBlendZThres  = ( std::max( abs(piInvZLUTLeft[0]- piInvZLUTLeft[255]), abs(piInvZLUTRight[0]- piInvZLUTRight[255]) ) * iBlendZThresPerc + 50)  / 100;
    7575}
    7676
     
    194194
    195195/////////// Comparison ///////////
    196 Int64 TRenFilter::SSE   (PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2  )
     196Int64 TRenFilter::SSE   (PelImagePlane* pcInputPlane1, PelImagePlane* pcInputPlane2, Bool bLuma )
    197197{
    198198  UInt uiWidth     = pcInputPlane1->getWidth();
     
    205205  Pel* pucImData2  = pcInputPlane2->getPlaneData();
    206206
    207   return SSE( pucImData1, (Int) uiStride1, (Int) uiWidth, (Int) uiHeight, pucImData2, (Int) uiStride2 );
    208 }
    209 
    210 Int64 TRenFilter::SSE( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight,  Pel* piSrc2, Int iSrcStride2 )
     207  return SSE( pucImData1, (Int) uiStride1, (Int) uiWidth, (Int) uiHeight, pucImData2, (Int) uiStride2, bLuma );
     208}
     209
     210Int64 TRenFilter::SSE( Pel* piSrc1, Int iSrcStride1, Int iWidth, Int iHeight,  Pel* piSrc2, Int iSrcStride2, Bool bLuma )
    211211{
    212212  Int64 iSSE = 0;
    213213
    214   Int iShift = g_uiBitIncrement << 1;
     214
     215  Int iShift = DISTORTION_PRECISION_ADJUSTMENT( ( bLuma ? g_bitDepthY : g_bitDepthC ) - 8 ) << 1 ;
    215216  for(Int iPosY = 0; iPosY < iHeight; iPosY++)
    216217  {
     
    266267
    267268inline Void TRenFilter::sampleUp2Tap13(PelImage* pcInputImage, PelImage* pcOutputImage)
    268 {// UpSampling from JSVM Software (DownConvertStatic) ???
     269{ // UpSampling from JSVM Software (DownConvertStatic) ???
     270
     271  AOF( g_bitDepthC == g_bitDepthY );
    269272  UInt uiNumPlanes = pcInputImage->getNumberOfPlanes();
    270273
     
    397400      {
    398401        // Scale and copy to image buffer.
    399         pcOutputPlaneData[iOffset+i] = max(min((Pel) ((piDst[i] + iAddH) / iDivH), g_uiBASE_MAX ),0);
     402        pcOutputPlaneData[iOffset+i] = ClipY((Pel) ((piDst[i] + iAddH) / iDivH));
    400403      }
    401404    }
     
    421424Void TRenFilter::sampleDown2Tap13( Pel* pcInputPlaneData, Int iInputStride, Int iWidth, Int iHeight, Pel* pcOutputPlaneData, Int iOutputStride  )
    422425{ // DownSampling from JSVM Software (DownConvertStatic) ??
     426 
     427  AOF( g_bitDepthC == g_bitDepthY );
     428
    423429  Int iOffset, iPosX, iPosY, k;
    424430  Int* piDataHorDown = new Int[(Int)(iWidth * iHeight / 2)];
     
    543549    {
    544550      // Scale and copy back to image buffer.
    545       pcOutputPlaneData[iOutputStride*iPosY+iPosX] = max(min( ( Pel) ( (piDst[iPosY] + iAddV) / iDivV), g_uiBASE_MAX ),0);
     551      pcOutputPlaneData[iOutputStride*iPosY+iPosX] = ClipY( ( Pel) ( (piDst[iPosY] + iAddV) / iDivV));
    546552    }
    547553  }
     
    569575
    570576Void TRenFilter::sampleVerDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad)
    571 { // DownSampling from JSVM Software (DownConvertStatic) ??
     577{
     578  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     579  // DownSampling from JSVM Software (DownConvertStatic) ??
    572580  Int iWidth       = pcInputPlane->getWidth();
    573581  Int iHeight      = pcInputPlane->getHeight();
     
    614622
    615623      Int iSum = iTmp4 + iTmp3 - iTmp2 + ((iTmp0 + iTmp4 + iTmp5 - iTmp2) << 1) + ( ( iTmp3 - iTmp1)  << 2) + (  iTmp5 << 3 ) + (( iTmp4 + iTmp5 ) << 4);
    616       pcOutputPlaneData[ iXPos ] = (Pel) Clip((iSum + 32) >> 6);
     624      pcOutputPlaneData[ iXPos ] = (Pel) ClipY((iSum + 32) >> 6);
    617625      pcTmpIn++;
    618626    }
     
    623631
    624632Void TRenFilter::sampleHorDown2Tap13( PelImagePlane* pcInputPlane, PelImagePlane* pcOutputPlane, Int uiPad )
    625 { // DownSampling from JSVM Software (DownConvertStatic) ??
     633{
     634  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     635  // DownSampling from JSVM Software (DownConvertStatic) ??
    626636  Int iWidth       = pcInputPlane->getWidth();
    627637  Int iHeight      = pcInputPlane->getHeight();
     
    653663
    654664      Int iSum = iTmp4 + iTmp3 - iTmp2 + ((iTmp0 + iTmp4 + iTmp5 - iTmp2) << 1) + ( ( iTmp3 - iTmp1)  << 2) + (  iTmp5 << 3 ) + (( iTmp4 + iTmp5 ) << 4);
    655       pcOutputPlaneData[ iXPos ] = (Pel) Clip((iSum + 32) >> 6);
     665      pcOutputPlaneData[ iXPos ] = (Pel) ClipY((iSum + 32) >> 6);
    656666      pcTmpIn += 2;
    657667    }
     
    726736
    727737  UInt uiPlane;
    728   for (uiPlane = 0; uiPlane < pcInputImage->getNumberOfFullPlanes(); uiPlane ++)
     738  for (uiPlane = 0; uiPlane < pcInputImage->getNumberOfPlanes(); uiPlane ++)
    729739  {
    730740    binominal( pcInputImage->getPlane(uiPlane), pcOutputImage->getPlane(uiPlane), uiSize );
     
    810820Pel TRenFilter::xFiltBinom3( Pel* pcInputData, Int iStride )
    811821{
     822  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     823
    812824  Int iSum = pcInputData[-1 * iStride ] + pcInputData[ 0 ] +  (pcInputData[iStride ] << 1 );
    813   return Clip( (iSum +  2) >>  2 );
     825  return ClipY( (iSum +  2) >>  2 );
    814826}
    815827
    816828Pel TRenFilter::xFiltBinom5( Pel* pcInputData, Int iStride )
    817829{
     830  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    818831  // { 1,4,6,4,1 }
    819832  Int iStride0  = 0;
     
    828841
    829842  Int iSum = iTmp0 +  (iTmp2 << 1) + ((iTmp1 + iTmp2) << 2);
    830   return Clip( (iSum +  8) >>  4 );
     843  return ClipY( (iSum +  8) >>  4 );
    831844}
    832845
    833846Pel TRenFilter::xFiltBinom7( Pel* pcInputData, Int iStride )
    834847{
     848  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    835849  // { 1,6,15,20,15,6,1 }
    836850  Int iStride0  = 0;
     
    849863  Int iSum = iTmp0 - iTmp2 + ( iTmp1  << 1) + ( (iTmp1 + iTmp3) << 2) + ((iTmp2 + iTmp3) << 4);
    850864
    851   return Clip( (iSum +  32) >>  6 );
     865  return ClipY( (iSum +  32) >>  6 );
    852866}
    853867
    854868Pel TRenFilter::xFiltBinom9( Pel* pcInputData, Int iStride )
    855869{
     870  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    856871  // {  1     8    28    56    70    56    28     8     1 }
    857872  Int iStride0  = 0;
     
    873888  Int iSum = iTmp0 + ((iTmp4 ) << 1) + ( ( iTmp4 - iTmp2 ) << 2) +  ( (iTmp1 - iTmp3) << 3 ) +  ((iTmp2 ) << 5) + ((iTmp3+ iTmp4 ) << 6);
    874889
    875   return Clip( (iSum +  128) >>  8 );
     890  return ClipY( (iSum +  128) >>  8 );
    876891}
    877892
     
    911926Void TRenFilter::diffHorSym(PelImagePlane* pcInputPlane, IntImagePlane* pcOutputPlane)
    912927{
    913   UInt uiInputStride  = pcInputPlane ->getStride();
     928  UInt uiInputStride = pcInputPlane ->getStride();
    914929  UInt uiOutputStride = pcOutputPlane->getStride();
    915930  UInt uiWidth        = pcInputPlane ->getWidth();
    916931  UInt uiHeight       = pcInputPlane ->getHeight();
    917932
    918   Pel*   pcInputData  = pcInputPlane ->getPlaneData();
    919   Int*   piOutputData = pcOutputPlane->getPlaneData();
     933  Pel*   pcInputData   = pcInputPlane ->getPlaneData();
     934  Int*   piOutputData  = pcOutputPlane->getPlaneData();
    920935
    921936  for (UInt uiPosY = 0; uiPosY < uiHeight; uiPosY++)
     
    927942    };
    928943
    929     piOutputData[0]         = piOutputData[1];
     944    piOutputData[0] = piOutputData[1];
    930945    piOutputData[uiWidth-1] = piOutputData[uiWidth-2];
    931     pcInputData            += uiInputStride;
    932     piOutputData           += uiOutputStride;
     946    pcInputData += uiInputStride;
     947    piOutputData  += uiOutputStride;
     948
    933949  };
    934950}
     
    12251241Void TRenFilter::xInterpHorChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter )
    12261242{
     1243  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    12271244  Int   iSum;
    12281245  Pel*  piSrcTmp;
     
    12351252    {
    12361253      iSum      = (cFilter.*fpFilter)( piSrcTmp,  iSrcStepX );
    1237       piDst[x * iDstStepX ] =  Clip ((iSum +  32) >>  6 );
     1254      piDst[x * iDstStepX ] =  ClipC ((iSum +  32) >>  6 );
    12381255      piSrcTmp+= iSrcStepX;
    12391256    }
     
    12451262Void TRenFilter::xInterpVerChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter )
    12461263{
     1264  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
    12471265  Int   iSum;
    12481266  Pel*  piSrcTmp;
     
    12551273    {
    12561274      iSum      = (cFilter.*fpFilter)( piSrcTmp,  iSrcStepY * iSrcStride );
    1257       piDst[x * iDstStepX ]  =  Clip ((iSum +  32) >>  6 );
     1275      piDst[x * iDstStepX ]  =  ClipC ((iSum +  32) >>  6 );
    12581276      piSrcTmp += iSrcStepX;
    12591277    }
     
    12661284Void TRenFilter::xSampleDownHor2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
    12671285{
     1286 
     1287  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     1288
    12681289  Int   iSum;
    12691290  Pel*  piSrcTmp;
     
    12771298      // { 1,2,1 }
    12781299      iSum = piSrcTmp[0] + piSrcTmp[2] +  (piSrcTmp[1] << 1);
    1279       piDst[x] = Clip( (iSum +  2) >>  2 );
     1300      piDst[x] = ClipY( (iSum +  2) >>  2 );
    12801301      piSrcTmp += 2;
    12811302    }
     
    12871308Void TRenFilter::xSampleDownVer2( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iSrcHeight, Pel* piDst, Int iDstStride  )
    12881309{
     1310  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     1311
    12891312  Int   iSum;
    12901313  Pel*  piSrcTmp;
     
    12971320      // { 1,2,1 }
    12981321      iSum = piSrcTmp[0] + piSrcTmp[ iSrcStride << 1] +  (piSrcTmp[ iSrcStride ] << 1);
    1299       piDst[x] = Clip( (iSum +  2) >>  2 );
     1322      piDst[x] = ClipY( (iSum +  2) >>  2 );
    13001323      piSrcTmp += 1;
    13011324    }
     
    13071330Void TRenFilter::xSampleDownHor4( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
    13081331{
     1332  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     1333
    13091334  Int   iSum;
    13101335  Pel*  piSrcTmp;
     
    13231348
    13241349      iSum = iTmp0 +  (iTmp2 << 1) + ((iTmp1 + iTmp2) << 2);
    1325       piDst[x] = Clip( (iSum +  8) >>  4 );
     1350      piDst[x] = ClipY( (iSum +  8) >>  4 );
    13261351      piSrcTmp += 4;
    13271352    }
     
    13331358Void TRenFilter::xSampleDownHor8( Pel* piSrc, Int iSrcStride, Int iSrcWidth, Int iHeight, Pel* piDst, Int iDstStride  )
    13341359{
     1360  assert( g_bitDepthY == g_bitDepthC); // ToDo: Update renderer to work with different luma/chroma bit depth
     1361
    13351362  Int   iSum;
    13361363  Pel*  piSrcTmp;
     
    13501377
    13511378      iSum = iTmp0 - iTmp2 + ( iTmp1  << 1) + ( (iTmp1 + iTmp3) << 2) + ((iTmp2 + iTmp3) << 4);
    1352       piDst[x] = Clip( (iSum +  32) >>  6 );
     1379      piDst[x] = ClipY( (iSum +  32) >>  6 );
    13531380      piSrcTmp += 8;
    13541381    }
     
    14321459template Void TRenFilter::mirrorHor(        TRenImage<Int>           *pcImage );
    14331460template Void TRenFilter::mirrorHor(        TRenImagePlane<Pel>      *pcImagePlane );
     1461
     1462#endif
     1463
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenFilter.h

    r438 r446  
    3333
    3434
    35 
    3635#ifndef __TRENFILTER__
    3736#define __TRENFILTER__
     
    4039#include "TRenImage.h"
    4140#include "TRenInterpFilter.h"
     41#if H_3D
    4242
    4343typedef Int (TRenInterpFilter::*FpChromaIntFilt) ( Pel*, Int );
     
    6262  /////////// Comparison ///////////
    6363
    64   static Int64                          SSE  ( PelImagePlane*     pcInputPlane1, PelImagePlane*      pcInputPlane2 );
    65   static Int64                          SSE  ( Pel* piSrc1,       Int iSrcStride1, Int iWidth, Int iHeight,  Pel* piSrc2, Int iSrcStride2 );
     64  static Int64                          SSE  ( PelImagePlane*     pcInputPlane1, PelImagePlane*      pcInputPlane2, Bool bLuma );
     65  static Int64                          SSE  ( Pel* piSrc1,       Int iSrcStride1, Int iWidth, Int iHeight,  Pel* piSrc2, Int iSrcStride2, Bool bLuma );
    6666
    6767  template <typename T> static Bool compare  (TRenImage<T> *pcInputImage1     , TRenImage<T> *pcInputImage2);
     
    138138};
    139139
    140 
     140#endif
    141141#endif //__TRENFILTER__
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenImage.cpp

    r438 r446  
    3737#include "TRenFilter.h"
    3838#include "assert.h"
     39#if H_3D
     40
    3941
    4042template<typename T>
     
    6668    m_uiNumberOfQuaterPlanes = 0;
    6769    m_apcPlanes    = new TRenImagePlane<Pel>*[ m_uiNumberOfPlanes ];
    68     m_apcPlanes[0] = new TRenImagePlane<Pel>( pcPicYuv->getBufY(), pcPicYuv->getWidth() + (REN_LUMA_MARGIN << 1),   pcPicYuv->getHeight()+ (REN_LUMA_MARGIN << 1), pcPicYuv->getStride (), REN_LUMA_MARGIN, g_uiPCMBitDepthLuma );
     70    m_apcPlanes[0] = new TRenImagePlane<Pel>( pcPicYuv->getBufY(), pcPicYuv->getWidth() + (REN_LUMA_MARGIN << 1),   pcPicYuv->getHeight()+ (REN_LUMA_MARGIN << 1), pcPicYuv->getStride (), REN_LUMA_MARGIN );
    6971  }
    7072  else //420
     
    7577
    7678    m_apcPlanes    = new TRenImagePlane<Pel>*[ m_uiNumberOfPlanes ];
    77     m_apcPlanes[0] = new TRenImagePlane<Pel>( pcPicYuv->getBufY(),   pcPicYuv->getWidth()     + (REN_LUMA_MARGIN << 1),  pcPicYuv->getHeight()      + (REN_LUMA_MARGIN << 1), pcPicYuv->getStride (), REN_LUMA_MARGIN     , g_uiPCMBitDepthLuma   );
    78     m_apcPlanes[1] = new TRenImagePlane<Pel>( pcPicYuv->getBufU(),   (pcPicYuv->getWidth()>>1)+  REN_LUMA_MARGIN      ,  (pcPicYuv->getHeight()>>1) +  REN_LUMA_MARGIN      , pcPicYuv->getCStride(), REN_LUMA_MARGIN >> 1, g_uiPCMBitDepthChroma );
    79     m_apcPlanes[2] = new TRenImagePlane<Pel>( pcPicYuv->getBufV(),   (pcPicYuv->getWidth()>>1)+  REN_LUMA_MARGIN      ,  (pcPicYuv->getHeight()>>1) +  REN_LUMA_MARGIN      , pcPicYuv->getCStride(), REN_LUMA_MARGIN >> 1, g_uiPCMBitDepthChroma );
     79    m_apcPlanes[0] = new TRenImagePlane<Pel>( pcPicYuv->getBufY(),   pcPicYuv->getWidth()     + (REN_LUMA_MARGIN << 1),  pcPicYuv->getHeight()      + (REN_LUMA_MARGIN << 1), pcPicYuv->getStride (), REN_LUMA_MARGIN );
     80    m_apcPlanes[1] = new TRenImagePlane<Pel>( pcPicYuv->getBufU(),   (pcPicYuv->getWidth()>>1)+  REN_LUMA_MARGIN      ,  (pcPicYuv->getHeight()>>1) +  REN_LUMA_MARGIN      , pcPicYuv->getCStride(), REN_LUMA_MARGIN >> 1 );
     81    m_apcPlanes[2] = new TRenImagePlane<Pel>( pcPicYuv->getBufV(),   (pcPicYuv->getWidth()>>1)+  REN_LUMA_MARGIN      ,  (pcPicYuv->getHeight()>>1) +  REN_LUMA_MARGIN      , pcPicYuv->getCStride(), REN_LUMA_MARGIN >> 1 );
    8082  }
    8183}
     
    132134  assert( uiNumberOfFullPlanes + uiNumberOfQuaterPlanes);
    133135
    134   UInt uiHalfWidth  = uiWidth  >> 1;
    135   UInt uiHalfHeight = uiHeight >> 1;
     136  UInt uiHalfWidth  = uiWidth  / 2;
     137  UInt uiHalfHeight = uiHeight / 2;
    136138
    137139  uiHalfWidth  = (uiHalfWidth  == 0) ? 1 : uiHalfWidth ;
     
    146148  for (UInt uiCurPlane = 0; uiCurPlane < uiNumberOfFullPlanes; uiCurPlane++)
    147149  {
    148     this->m_apcPlanes[uiCurPlane] = new TRenImagePlane<T>(uiWidth, uiHeight, REN_LUMA_MARGIN, g_uiPCMBitDepthLuma );
     150    this->m_apcPlanes[uiCurPlane] = new TRenImagePlane<T>(uiWidth, uiHeight, REN_LUMA_MARGIN);
    149151  };
    150152
    151153  for (UInt uiCurPlane = 0; uiCurPlane < uiNumberOfQuaterPlanes; uiCurPlane++)
    152154  {
    153     this->m_apcPlanes[uiCurPlane+uiNumberOfFullPlanes] = new TRenImagePlane<T>(uiHalfWidth, uiHalfHeight, REN_LUMA_MARGIN >> 1, g_uiPCMBitDepthChroma);
     155    this->m_apcPlanes[uiCurPlane+uiNumberOfFullPlanes] = new TRenImagePlane<T>(uiHalfWidth, uiHalfHeight, REN_LUMA_MARGIN >> 1);
    154156  };
    155157}
     
    231233  for (UInt uiCurPlane = 1; uiCurPlane < m_uiNumberOfPlanes; uiCurPlane++)
    232234  {
    233     m_apcPlanes[uiCurPlane]->assign( (Pel) ((g_uiIBDI_MAX+1) >> 1) );
     235    m_apcPlanes[uiCurPlane]->assign( (Pel) ( 1 << ( g_bitDepthC - 1 ) ) );
    234236  }
    235237}
     
    270272template Void TRenImage<Pel>::assign<Pel>    (TRenImage<Pel>*   );
    271273
     274#endif // H_3D
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenImage.h

    r438 r446  
    3939#include "../TLibCommon/TComPicYuv.h"
    4040#include "TRenImagePlane.h"
     41#if H_3D
    4142
    4243
     
    99100};
    100101
     102#endif // H_3D
    101103#endif // __TRENIMAGE__
    102104
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenImagePlane.cpp

    r438 r446  
    3636#include "TRenFilter.h"
    3737#include <string.h>
     38#if H_3D
     39
    3840/////// TRenImagePlane ///////
    3941
     
    4244
    4345template<class T>
    44 TRenImagePlane<T>::TRenImagePlane(UInt uiWidth, UInt uiHeight, UInt uiPad, UInt uiBitDepth )
    45 : m_uiWidth    (uiWidth),
    46   m_uiHeight   (uiHeight),
    47   m_uiStride   (uiWidth+2*uiPad),
    48   m_uiWidthOrg (uiWidth+2*uiPad),
    49   m_uiHeightOrg(uiHeight+2*uiPad),
    50   m_uiPad      (uiPad),
    51   m_uiBitDepth (uiBitDepth)
     46TRenImagePlane<T>::TRenImagePlane(UInt uiWidth, UInt uiHeight, UInt uiPad)
     47: m_uiWidth(uiWidth), m_uiHeight(uiHeight), m_uiStride(uiWidth+2*uiPad), m_uiWidthOrg(uiWidth+2*uiPad), m_uiHeightOrg(uiHeight+2*uiPad), m_uiPad(uiPad)
    5248{
    5349  m_pcDataOrg = new T[ m_uiWidthOrg * m_uiHeightOrg ];
     
    5854template<class T>
    5955TRenImagePlane<T>::TRenImagePlane(TRenImagePlane* pcPlane)
    60 : m_uiWidth    (pcPlane->getWidth   ())
    61 , m_uiHeight   (pcPlane->getHeight  ())
    62 , m_uiStride   (pcPlane->getStride  ())
    63 , m_uiWidthOrg (pcPlane->getWidthOrg())
     56: m_uiWidth   (pcPlane->getWidth   ())
     57, m_uiHeight  (pcPlane->getHeight  ())
     58, m_uiStride  (pcPlane->getStride  ())
     59, m_uiWidthOrg(pcPlane->getWidthOrg())
    6460, m_uiHeightOrg(pcPlane->getHeightOrg())
    65 , m_uiPad      (pcPlane->getPad     ())
    66 , m_uiBitDepth (pcPlane->getBitDepth())
     61, m_uiPad     (pcPlane->getPad     ())
    6762{
    6863  m_pcData = new T[m_uiWidthOrg*m_uiHeightOrg];
     
    7267
    7368template<typename T>
    74 TRenImagePlane<T>::TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad, UInt uiBitDepth )
     69TRenImagePlane<T>::TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad )
    7570: m_pcData     (pcDataOrg + uiStride * uiPad + uiPad )
    7671, m_uiWidth    (uiWidthOrg  - 2* uiPad )
     
    8277, m_uiPad      (uiPad      )
    8378, m_bClean     (false      )
    84 , m_uiBitDepth (uiBitDepth )
    8579{
    8680
     
    519513template<typename T>
    520514TRenImagePlanePart<T>::TRenImagePlanePart( TRenImagePlane<T>* pPlane, UInt uHorOff, UInt uVerOff, UInt uWidth, UInt uHeight )
    521 : TRenImagePlane<T>( pPlane->getPlaneData() + uHorOff + uVerOff * pPlane->getStride(), uWidth, uHeight, pPlane->getStride(),0, pPlane->getBitDepth())
     515: TRenImagePlane<T>( pPlane->getPlaneData() + uHorOff + uVerOff * pPlane->getStride(), uWidth, uHeight, pPlane->getStride(),0)
    522516{
    523517
     
    534528template class TRenImagePlanePart<Bool>;
    535529template class TRenImagePlanePart<Int>;
     530#endif // H_3D
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenImagePlane.h

    r438 r446  
    3939#include "../TLibCommon/TComPicYuv.h"
    4040
     41#if H_3D
    4142#define PelImagePlane     TRenImagePlane<Pel>
    4243#define DoubleImagePlane  TRenImagePlane<Double>
     
    4950  // Construction
    5051  TRenImagePlane();
    51   TRenImagePlane( UInt uiWidth, UInt uiHeight, UInt uiPad, UInt uiBitDepth );
     52  TRenImagePlane( UInt uiWidth, UInt uiHeight, UInt uiPad);
    5253  TRenImagePlane( TRenImagePlane* pcInputPlane );
    53   TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad, UInt uiBitDepth );
     54  TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad );
    5455
    5556  ~TRenImagePlane();
     
    6465  UInt getHeightOrg() { return m_uiHeightOrg; };
    6566  UInt getPad      () { return m_uiPad;       };
    66   UInt getBitDepth () { return m_uiBitDepth; };
    6767  UInt getStride   () { return m_uiStride; };
    6868
     
    106106  UInt   m_uiHeightOrg;
    107107  UInt   m_uiPad;
    108   UInt   m_uiBitDepth;
    109108
     109  Double m_dRatio;
    110110  Bool   m_bClean;
    111111
     
    122122};
    123123
     124#endif // H_3D
    124125#endif // __TRENIMAGEPLANE__
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenInterpFilter.cpp

    r438 r446  
    3939
    4040#include "TRenInterpFilter.h"
     41#if H_3D
    4142
    4243// ====================================================================================================================
     
    4950}
    5051
     52#endif // H_3D
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenInterpFilter.h

    r438 r446  
    4444#include "TLibCommon/CommonDef.h"
    4545#include "assert.h"
     46#if H_3D
     47
    4648// ====================================================================================================================
    4749// Constants
     
    103105   __inline Int xCTI_Filter_VI04_C_OCT3( Int* pSrc, Int iStride );
    104106
    105 #if HIGH_ACCURACY_BI
    106   __inline Void xCTI_FilterHalfHor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //
    107   __inline Void xCTI_FilterHalfHor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);//
    108  
    109    
    110   __inline Void xCTI_FilterQuarter0Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //
    111   __inline Void xCTI_FilterQuarter0Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //
    112  
    113   __inline Void xCTI_FilterQuarter1Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //
    114   __inline Void xCTI_FilterQuarter1Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst); //
    115  
    116   __inline Void xCTI_FilterHalfVer_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst ); //
    117  
    118   __inline Void xCTI_FilterQuarter0Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst );
    119   __inline Void xCTI_FilterQuarter1Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst );
    120  
    121   __inline Void xCTI_Filter1DHorC_ha (Pel* piSrc, Int iSrcStride,  Int iWidth, Int iHeight, Int iDstStride,  Pel*& rpiDst, Int iMV);
    122   __inline Void xCTI_Filter1DVerC_ha (Pel* piSrc, Int iSrcStride,  Int iWidth, Int iHeight, Int iDstStride,  Pel*& rpiDst, Int iMV);
    123   __inline Void xCTI_Filter2DHorC_ha (Int* piSrc, Int iSrcStride,  Int iWidth, Int iHeight, Int iDstStride,  Pel*& rpiDst, Int iMV);
    124 
    125 #endif
    126107};
    127108
    128 #if HIGH_ACCURACY_BI
    129 __inline Void TRenInterpFilter::xCTI_FilterHalfHor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    130 {
     109
     110// ------------------------------------------------------------------------------------------------
     111// DCTIF filters
     112// ------------------------------------------------------------------------------------------------
     113
     114__inline Void TRenInterpFilter::xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
     115{
     116  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
     117
    131118  Pel*  piDst    = rpiDst;
    132119  Int   iSum;
    133120  Pel*  piSrcTmp;
    134 
    135121  Int iSrcStep2 = iSrcStep*2;
    136122  Int iSrcStep3 = iSrcStep*3;
     
    141127
    142128  Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    143   Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;
    144   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
     129
    145130  for ( Int y = iHeight; y != 0; y-- )
    146131  {
     
    160145            + (   iTmpA          << 1 )
    161146            -    iTmp0 -  iTmp2;
    162 #if REMOVE_INTERMEDIATE_CLIPPING
    163       piDst   [x * iDstStep] = (iSum +  shiftOffset) >>  shiftNum;
    164 #else
    165       piDst   [x * iDstStep] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    166 #endif
    167      
     147
     148      piDst   [x * iDstStep] = ClipY( (iSum +  32) >>  6 );
    168149      piSrcTmp += iSrcStep;
    169150    }
     
    172153  }
    173154  return;
    174 
    175 }
    176 
    177 __inline Void TRenInterpFilter::xCTI_FilterHalfHor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    178 {
     155}
     156
     157__inline Void TRenInterpFilter::xCTI_FilterHalfHor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
     158{
     159  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
     160
    179161  Pel*  piDst    = rpiDst;
    180162  Int   iSum;
    181163  Int*  piSrcTmp;
    182  
    183164  Int iSrcStep2 = iSrcStep*2;
    184165  Int iSrcStep3 = iSrcStep*3;
     
    189170
    190171  Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    191   Int shiftNum = 6 + g_uiBitIncrement + g_uiBitDepth - 8;
    192   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
     172
    193173  for ( Int y = iHeight; y != 0; y-- )
    194174  {
     
    209189            -    iTmp0 -  iTmp2;
    210190     
    211 #if REMOVE_INTERMEDIATE_CLIPPING
    212       piDst   [x * iDstStep] = (iSum +  shiftOffset) >>  shiftNum;
    213 #else
    214       piDst   [x * iDstStep] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    215 #endif
    216 
     191      piDst   [x * iDstStep] = ClipY( (iSum +  2048) >>  12 );
    217192      piSrcTmp += iSrcStep;
    218193    }
     
    221196  }
    222197  return;
    223 
    224 }
    225 
    226 
    227 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    228 {
     198}
     199
     200__inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
     201{
     202  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
    229203  Pel*  piDst    = rpiDst;
    230204  Int   iSum;
    231205  Pel*  piSrcTmp;
    232 
    233206  Int iSrcStep2 = iSrcStep*2;
    234207  Int iSrcStep3 = iSrcStep*3;
     
    239212
    240213  Int  iTmp1, iTmp2;
    241   Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;
    242   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
     214
    243215  for ( Int y = iHeight; y != 0; y-- )
    244216  {
     
    252224     
    253225      iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
    254             - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 )
    255             + (  piSrcTmp[iSrcStep]             << 2 )
    256             - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 )
    257             + (   piSrcTmp[iSrcStep4]           << 4 )
    258             + ( piSrcTmp[iSrcStep3]             << 6);
    259      
    260 #if REMOVE_INTERMEDIATE_CLIPPING
    261       piDst   [x * iDstStep] = (iSum + shiftOffset) >> shiftNum;
    262 #else
    263       piDst   [x * iDstStep] = Clip3(0,16383, (iSum + shiftOffset) >> shiftNum );
    264 #endif
     226             - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 )
     227             + (  piSrcTmp[iSrcStep]             << 2 )
     228             - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 )
     229             + (   piSrcTmp[iSrcStep4]           << 4 );
     230     
     231      piDst   [x * iDstStep] = ClipY(( (iSum +  32) >>  6 )+ piSrcTmp[iSrcStep3]);
    265232      piSrcTmp += iSrcStep;
    266233    }
     
    271238}
    272239
    273 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    274 {
     240__inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
     241{
     242  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
     243
    275244  Pel*  piDst    = rpiDst;
    276245  Int   iSum;
    277246  Int*  piSrcTmp;
    278  
    279247  Int iSrcStep2 = iSrcStep*2;
    280248  Int iSrcStep3 = iSrcStep*3;
     
    283251  Int iSrcStep6 = iSrcStep*6;
    284252  Int iSrcStep7 = iSrcStep*7;
    285   Int shiftNum = 6 + g_uiBitIncrement + g_uiBitDepth - 8;
    286   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
     253
    287254  Int  iTmp1, iTmp2;
    288255
     
    304271            + (   piSrcTmp[iSrcStep3]           << 6 );
    305272     
    306 #if REMOVE_INTERMEDIATE_CLIPPING
    307       piDst   [x * iDstStep] = (iSum +  shiftOffset) >>  shiftNum;
    308 #else
    309       piDst   [x * iDstStep] = Clip3(0, 16383, (iSum +  shiftOffset) >>  shiftNum );
    310 #endif
     273      piDst   [x * iDstStep] = ClipY( (iSum +  2048) >>  12 );
    311274      piSrcTmp += iSrcStep;
    312275    }
     
    315278  }
    316279  return;
    317 
    318 }
    319 
    320 
    321 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor_ha(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    322 {
     280}
     281
     282__inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
     283{
     284  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
    323285  Pel*  piDst    = rpiDst;
    324286  Int   iSum;
    325287  Pel*  piSrcTmp;
    326 
    327288  Int iSrcStep2 = iSrcStep*2;
    328289  Int iSrcStep3 = iSrcStep*3;
     
    331292  Int iSrcStep6 = iSrcStep*6;
    332293  Int iSrcStep7 = iSrcStep*7;
    333   Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;
    334   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
     294
     295  Int  iTmp1, iTmp2;
     296  for ( Int y = iHeight; y != 0; y-- )
     297  {
     298    piSrcTmp = &piSrc[ -3*iSrcStep ];
     299    for ( Int x = 0; x < iWidth; x++ )
     300    {
     301      // {-1,   3,  -7,  19,   57,  -10,   4,   -1  },
     302     
     303      iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2];
     304      iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3];
     305     
     306      iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
     307            - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 )
     308            + (   piSrcTmp[iSrcStep6]           << 2 )
     309            - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 )
     310            + (   piSrcTmp[iSrcStep3]           << 4 );
     311     
     312      piDst   [x * iDstStep] = ClipY( ((iSum +  32) >>  6) + piSrcTmp[iSrcStep4] );
     313      piSrcTmp += iSrcStep;
     314    }
     315    piSrc += iSrcStride;
     316    piDst += iDstStride;
     317  }
     318  return;
     319}
     320
     321__inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
     322{
     323  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
     324
     325  Pel*  piDst    = rpiDst;
     326  Int   iSum;
     327  Int*  piSrcTmp;
     328  Int iSrcStep2 = iSrcStep*2;
     329  Int iSrcStep3 = iSrcStep*3;
     330  Int iSrcStep4 = iSrcStep*4;
     331  Int iSrcStep5 = iSrcStep*5;
     332  Int iSrcStep6 = iSrcStep*6;
     333  Int iSrcStep7 = iSrcStep*7;
    335334
    336335  Int  iTmp1, iTmp2;
     
    351350            + (   piSrcTmp[iSrcStep3]           << 4 )
    352351            + (   piSrcTmp[iSrcStep4]           << 6 );
    353 
    354 #if REMOVE_INTERMEDIATE_CLIPPING
    355       piDst   [x * iDstStep] = (iSum +  shiftOffset) >>  shiftNum;
    356 #else
    357       piDst   [x * iDstStep] = Clip3(0, 16383, (iSum +  shiftOffset) >>  shiftNum );
    358 #endif
     352     
     353      piDst   [x * iDstStep] = ClipY( (iSum +  2048) >>  12 );
    359354      piSrcTmp += iSrcStep;
    360355    }
     
    363358  }
    364359  return;
    365 
    366 
    367 }
    368 
    369 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor_ha(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    370 {
    371   Pel*  piDst    = rpiDst;
    372   Int   iSum;
    373   Int*  piSrcTmp;
    374 
    375   Int iSrcStep2 = iSrcStep*2;
    376   Int iSrcStep3 = iSrcStep*3;
    377   Int iSrcStep4 = iSrcStep*4;
    378   Int iSrcStep5 = iSrcStep*5;
    379   Int iSrcStep6 = iSrcStep*6;
    380   Int iSrcStep7 = iSrcStep*7;
    381   Int shiftNum = 6+g_uiBitIncrement + g_uiBitDepth - 8;
    382   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
    383   Int  iTmp1, iTmp2;
     360}
     361
     362__inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel )
     363{
     364  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
     365  Int*  piDst = rpiDst;
     366  Pel*  piDstPel = rpiDstPel;
     367  Int   iSum;
     368  Pel*  piSrcTmp;
     369  Int iSrcStride2 = iSrcStride*2;
     370  Int iSrcStride3 = iSrcStride*3;
     371  Int iSrcStride4 = iSrcStride*4;
     372  Int iSrcStride5 = iSrcStride*5;
     373  Int iSrcStride6 = iSrcStride*6;
     374  Int iSrcStride7 = iSrcStride*7;
     375
     376  Int  iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    384377  for ( Int y = iHeight; y != 0; y-- )
    385378  {
    386     piSrcTmp = &piSrc[ -3*iSrcStep ];
     379    piSrcTmp = &piSrc[ -3*iSrcStride ];
    387380    for ( Int x = 0; x < iWidth; x++ )
    388381    {
    389       // {-1,   3,  -7,  19,   57,  -10,   4,   -1  },
    390      
    391       iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2];
    392       iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3];
    393      
    394       iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
    395             - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 )
    396             + (   piSrcTmp[iSrcStep6]           << 2 )
    397             - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 )
    398             + (   piSrcTmp[iSrcStep3]           << 4 )
    399             + (   piSrcTmp[iSrcStep4]           << 6 );
    400      
    401 #if REMOVE_INTERMEDIATE_CLIPPING
    402       piDst   [x * iDstStep] = (iSum +  shiftOffset) >>  shiftNum;
    403 #else
    404       piDst   [x * iDstStep] = Clip3(0, 16383, (iSum +  shiftOffset) >>  shiftNum );
    405 #endif
     382      // { -1,4,-11,40,40,-11,4,-1   }
     383      iTmp0 = piSrcTmp[          0]+piSrcTmp[iSrcStride7];
     384      iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];
     385      iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];
     386      iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];
     387     
     388      iTmpA = (iTmp3 << 2) - iTmp2;
     389     
     390      iSum  = (   iTmp1          << 2 )
     391            + (   iTmpA          << 3 )
     392            + (   iTmpA          << 1 )
     393            -    iTmp0 -  iTmp2;
     394     
     395      piDst[x * iDstStep]    = iSum;
     396      piDstPel[x * iDstStep] = ClipY( (iSum +  32) >>  6 );
    406397      piSrcTmp += iSrcStep;
    407398    }
    408399    piSrc += iSrcStride;
    409400    piDst += iDstStride;
    410   }
    411   return;
    412 
    413 }
    414 
    415 
    416 
    417 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    418 {
     401    piDstPel += iDstStridePel;
     402  }
     403 return;
     404}
     405
     406__inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst)
     407{
     408  Int*  piDst = rpiDst;
     409  Int   iSum;
     410  Pel*  piSrcTmp;
     411  Int iSrcStride2 = iSrcStride*2;
     412  Int iSrcStride3 = iSrcStride*3;
     413  Int iSrcStride4 = iSrcStride*4;
     414  Int iSrcStride5 = iSrcStride*5;
     415  Int iSrcStride6 = iSrcStride*6;
     416  Int iSrcStride7 = iSrcStride*7;
     417
     418  Int  iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
     419  for ( Int y = iHeight; y != 0; y-- )
     420  {
     421    piSrcTmp = &piSrc[ -3*iSrcStride ];
     422    for ( Int x = 0; x < iWidth; x++ )
     423    {
     424      // { -1,4,-11,40,40,-11,4,-1   }
     425      iTmp0 = piSrcTmp[          0]+piSrcTmp[iSrcStride7];
     426      iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];
     427      iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];
     428      iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];
     429     
     430      iTmpA = (iTmp3 << 2) - iTmp2;
     431     
     432      iSum  = (   iTmp1          << 2 )
     433            + (   iTmpA          << 3 )
     434            + (   iTmpA          << 1 )
     435            -    iTmp0 -  iTmp2;       
     436     
     437      piDst[x * iDstStep] = iSum;
     438      piSrcTmp += iSrcStep;
     439    }
     440    piSrc += iSrcStride;
     441    piDst += iDstStride;
     442  }
     443  return;
     444}
     445
     446__inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
     447{
     448  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
    419449  Pel*  piDst = rpiDst;
    420450  Int   iSum;
     
    427457  Int iSrcStride6 = iSrcStride*6;
    428458  Int iSrcStride7 = iSrcStride*7;
    429   Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;
    430   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
    431   Int  iTmp1, iTmp2;
     459
     460  Int  iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    432461  for ( Int y = iHeight; y != 0; y-- )
    433462  {
     
    435464    for ( Int x = 0; x < iWidth; x++ )
    436465    {
    437       // {-1,   4,  -10,  57,   19,  -7,   3,   -1  },
    438      
    439       iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5];
    440       iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4];
    441      
    442       iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7]
    443             - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 )
    444             + (  piSrcTmp[iSrcStride]             << 2 )
    445             - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 )
    446             + (   piSrcTmp[iSrcStride4]           << 4 )
    447             + (   piSrcTmp[iSrcStride3]           << 6);
    448      
    449 #if REMOVE_INTERMEDIATE_CLIPPING
    450       piDst   [x * iDstStep] = (iSum +  shiftOffset) >>  shiftNum;
    451 #else
    452       piDst   [x * iDstStep] = Clip3(0, 16383, (iSum +  shiftOffset) >>  shiftNum );
    453 #endif
     466      // { -1,4,-11,40,40,-11,4,-1   }
     467      iTmp0 = piSrcTmp[          0]+piSrcTmp[iSrcStride7];
     468      iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];
     469      iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];
     470      iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];
     471     
     472      iTmpA = (iTmp3 << 2) - iTmp2;
     473     
     474      iSum  = (   iTmp1          << 2 )
     475            + (   iTmpA          << 3 )
     476            + (   iTmpA          << 1 )
     477            -    iTmp0 -  iTmp2;       
     478     
     479      piDst[x * iDstStep] = ClipY( (iSum +  32) >>  6 );
    454480      piSrcTmp += iSrcStep;
    455481    }
     
    458484  }
    459485  return;
    460 
    461 }
    462 
    463 
    464 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Ver_ha (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    465 {
    466   Pel*  piDst = rpiDst;
     486}
     487
     488__inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst)
     489{
     490  Int*  piDst = rpiDst;
    467491  Int   iSum;
    468492  Pel*  piSrcTmp;
    469 
    470493  Int iSrcStride2 = iSrcStride*2;
    471494  Int iSrcStride3 = iSrcStride*3;
     
    474497  Int iSrcStride6 = iSrcStride*6;
    475498  Int iSrcStride7 = iSrcStride*7;
    476   Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;
    477   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
     499
    478500  Int  iTmp1, iTmp2;
    479 
    480501  for ( Int y = iHeight; y != 0; y-- )
    481502  {
     
    483504    for ( Int x = 0; x < iWidth; x++ )
    484505    {
    485       /// {-1,   3,  -7,  19,   57,  -10,   4,   -1  },
    486       iTmp1 = piSrcTmp[iSrcStride4] + piSrcTmp[iSrcStride2];
    487       iTmp2 = piSrcTmp[iSrcStride ] + piSrcTmp[iSrcStride3];
     506      // {-1,   4,  -10,  57,   19,  -7,   3,   -1  },
     507     
     508      iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5];
     509      iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4];
    488510     
    489511      iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7]
    490             - ( ( piSrcTmp[iSrcStride5] - iTmp2 ) << 1 )
    491             + (   piSrcTmp[iSrcStride6]           << 2 )
    492             - ( ( piSrcTmp[iSrcStride5] + iTmp1 ) << 3 )
    493             + (   piSrcTmp[iSrcStride3]           << 4 )
    494             + (   piSrcTmp[iSrcStride4]           << 6 );
    495            
    496 #if REMOVE_INTERMEDIATE_CLIPPING
    497       piDst   [x * iDstStep] = (iSum +  shiftOffset) >>  shiftNum;
    498 #else
    499       piDst   [x * iDstStep] = Clip3(0, 16383, (iSum +  shiftOffset) >>  shiftNum );
    500 #endif
     512            - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 )
     513            + (  piSrcTmp[iSrcStride]             << 2 )
     514            - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 )
     515            + (   piSrcTmp[iSrcStride4]           << 4 )
     516            + (   piSrcTmp[iSrcStride3]           << 6 );
     517     
     518      piDst[x * iDstStep] = iSum;
    501519      piSrcTmp += iSrcStep;
    502520    }
     
    505523  }
    506524  return;
    507 
    508 }
    509 
    510 __inline Void TRenInterpFilter::xCTI_FilterHalfVer_ha  (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    511 {
     525}
     526
     527__inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
     528{
     529  assert( g_bitDepthC == g_bitDepthY );  // ToDo: Update renderer to work with different luma/chroma bit depth
    512530  Pel*  piDst = rpiDst;
    513531  Int   iSum;
     
    520538  Int iSrcStride6 = iSrcStride*6;
    521539  Int iSrcStride7 = iSrcStride*7;
    522   Int shiftNum = g_uiBitIncrement + g_uiBitDepth - 8;
    523   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
    524   Int  iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    525   for ( Int y = iHeight; y != 0; y-- )
    526   {
    527     piSrcTmp = &piSrc[ -3*iSrcStride ];
    528     for ( Int x = 0; x < iWidth; x++ )
    529     {
    530       // { -1,4,-11,40,40,-11,4,-1   }
    531       iTmp0 = piSrcTmp[          0]+piSrcTmp[iSrcStride7];
    532       iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];
    533       iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];
    534       iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];
    535      
    536       iTmpA = (iTmp3 << 2) - iTmp2;
    537      
    538       iSum  = (   iTmp1          << 2 )
    539             + (   iTmpA          << 3 )
    540             + (   iTmpA          << 1 )
    541             -    iTmp0 -  iTmp2;       
    542      
    543 #if REMOVE_INTERMEDIATE_CLIPPING
    544       piDst   [x * iDstStep] = (iSum +  shiftOffset) >>  shiftNum;
    545 #else
    546       piDst   [x * iDstStep] = Clip3(0, 16383, (iSum +  shiftOffset) >>  shiftNum );
    547 #endif
    548       piSrcTmp += iSrcStep;
    549     }
    550     piSrc += iSrcStride;
    551     piDst += iDstStride;
    552   }
    553   return;
    554 
    555 }
    556 
    557 
    558 #endif
    559 
    560 // ------------------------------------------------------------------------------------------------
    561 // DCTIF filters
    562 // ------------------------------------------------------------------------------------------------
    563 
    564 __inline Void TRenInterpFilter::xCTI_FilterHalfHor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    565 {
    566   Pel*  piDst    = rpiDst;
    567   Int   iSum;
    568   Pel*  piSrcTmp;
    569   Int iSrcStep2 = iSrcStep*2;
    570   Int iSrcStep3 = iSrcStep*3;
    571   Int iSrcStep4 = iSrcStep*4;
    572   Int iSrcStep5 = iSrcStep*5;
    573   Int iSrcStep6 = iSrcStep*6;
    574   Int iSrcStep7 = iSrcStep*7;
    575 
    576   Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    577 
    578   for ( Int y = iHeight; y != 0; y-- )
    579   {
    580     piSrcTmp = &piSrc[ -3*iSrcStep ];
    581     for ( Int x = 0; x < iWidth; x++ )
    582     {
    583       // { -1,4,-11,40,40,-11,4,-1   }
    584       iTmp0 = piSrcTmp[        0]+piSrcTmp[iSrcStep7];
    585       iTmp1 = piSrcTmp[iSrcStep]+piSrcTmp[iSrcStep6];
    586       iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5];
    587       iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4];
    588 
    589       iTmpA = (iTmp3 << 2) - iTmp2;
    590 
    591       iSum  = (   iTmp1          << 2 )
    592             + (   iTmpA          << 3 )
    593             + (   iTmpA          << 1 )
    594             -    iTmp0 -  iTmp2;
    595 
    596       piDst   [x * iDstStep] = ClipY( (iSum +  32) >>  6 );
    597       piSrcTmp += iSrcStep;
    598     }
    599     piSrc += iSrcStride;
    600     piDst += iDstStride;
    601   }
    602   return;
    603 }
    604 
    605 __inline Void TRenInterpFilter::xCTI_FilterHalfHor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    606 {
    607   Pel*  piDst    = rpiDst;
    608   Int   iSum;
    609   Int*  piSrcTmp;
    610   Int iSrcStep2 = iSrcStep*2;
    611   Int iSrcStep3 = iSrcStep*3;
    612   Int iSrcStep4 = iSrcStep*4;
    613   Int iSrcStep5 = iSrcStep*5;
    614   Int iSrcStep6 = iSrcStep*6;
    615   Int iSrcStep7 = iSrcStep*7;
    616 
    617   Int iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    618 
    619   for ( Int y = iHeight; y != 0; y-- )
    620   {
    621     piSrcTmp = &piSrc[ -3*iSrcStep ];
    622     for ( Int x = 0; x < iWidth; x++ )
    623     {
    624       // { -1,4,-11,40,40,-11,4,-1   }
    625       iTmp0 = piSrcTmp[        0]+piSrcTmp[iSrcStep7];
    626       iTmp1 = piSrcTmp[iSrcStep ]+piSrcTmp[iSrcStep6];
    627       iTmp2 = piSrcTmp[iSrcStep2]+piSrcTmp[iSrcStep5];
    628       iTmp3 = piSrcTmp[iSrcStep3]+piSrcTmp[iSrcStep4];
    629      
    630       iTmpA = (iTmp3 << 2) - iTmp2;
    631      
    632       iSum  = (   iTmp1          << 2 )
    633             + (   iTmpA          << 3 )
    634             + (   iTmpA          << 1 )
    635             -    iTmp0 -  iTmp2;
    636      
    637       piDst   [x * iDstStep] = ClipY( (iSum +  2048) >>  12 );
    638       piSrcTmp += iSrcStep;
    639     }
    640     piSrc += iSrcStride;
    641     piDst += iDstStride;
    642   }
    643   return;
    644 }
    645 
    646 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    647 {
    648   Pel*  piDst    = rpiDst;
    649   Int   iSum;
    650   Pel*  piSrcTmp;
    651   Int iSrcStep2 = iSrcStep*2;
    652   Int iSrcStep3 = iSrcStep*3;
    653   Int iSrcStep4 = iSrcStep*4;
    654   Int iSrcStep5 = iSrcStep*5;
    655   Int iSrcStep6 = iSrcStep*6;
    656   Int iSrcStep7 = iSrcStep*7;
    657 
    658   Int  iTmp1, iTmp2;
    659 
    660   for ( Int y = iHeight; y != 0; y-- )
    661   {
    662     piSrcTmp = &piSrc[ -3*iSrcStep ];
    663     for ( Int x = 0; x < iWidth; x++ )
    664     {
    665       // {-1,   4,  -10,  57,   19,  -7,   3,   -1  },
    666      
    667       iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5];
    668       iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4];
    669      
    670       iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
    671              - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 )
    672              + (  piSrcTmp[iSrcStep]             << 2 )
    673              - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 )
    674              + (   piSrcTmp[iSrcStep4]           << 4 );
    675      
    676       piDst   [x * iDstStep] = ClipY(( (iSum +  32) >>  6 )+ piSrcTmp[iSrcStep3]);
    677       piSrcTmp += iSrcStep;
    678     }
    679     piSrc += iSrcStride;
    680     piDst += iDstStride;
    681   }
    682   return;
    683 }
    684 
    685 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    686 {
    687   Pel*  piDst    = rpiDst;
    688   Int   iSum;
    689   Int*  piSrcTmp;
    690   Int iSrcStep2 = iSrcStep*2;
    691   Int iSrcStep3 = iSrcStep*3;
    692   Int iSrcStep4 = iSrcStep*4;
    693   Int iSrcStep5 = iSrcStep*5;
    694   Int iSrcStep6 = iSrcStep*6;
    695   Int iSrcStep7 = iSrcStep*7;
    696 
    697   Int  iTmp1, iTmp2;
    698 
    699   for ( Int y = iHeight; y != 0; y-- )
    700   {
    701     piSrcTmp = &piSrc[ -3*iSrcStep ];
    702     for ( Int x = 0; x < iWidth; x++ )
    703     {
    704       // {-1,   4,  -10,  57,   19,  -7,   3,   -1  },
    705    
    706       iTmp1 = piSrcTmp[iSrcStep3] + piSrcTmp[iSrcStep5];
    707       iTmp2 = piSrcTmp[iSrcStep6] + piSrcTmp[iSrcStep4];
    708      
    709       iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
    710             - ( ( piSrcTmp[iSrcStep2] - iTmp2 ) << 1 )
    711             + (  piSrcTmp[iSrcStep]             << 2 )
    712             - ( ( piSrcTmp[iSrcStep2] + iTmp1 ) << 3 )
    713             + (   piSrcTmp[iSrcStep4]           << 4 )
    714             + (   piSrcTmp[iSrcStep3]           << 6 );
    715      
    716       piDst   [x * iDstStep] = ClipY( (iSum +  2048) >>  12 );
    717       piSrcTmp += iSrcStep;
    718     }
    719     piSrc += iSrcStride;
    720     piDst += iDstStride;
    721   }
    722   return;
    723 }
    724 
    725 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    726 {
    727   Pel*  piDst    = rpiDst;
    728   Int   iSum;
    729   Pel*  piSrcTmp;
    730   Int iSrcStep2 = iSrcStep*2;
    731   Int iSrcStep3 = iSrcStep*3;
    732   Int iSrcStep4 = iSrcStep*4;
    733   Int iSrcStep5 = iSrcStep*5;
    734   Int iSrcStep6 = iSrcStep*6;
    735   Int iSrcStep7 = iSrcStep*7;
    736 
    737   Int  iTmp1, iTmp2;
    738   for ( Int y = iHeight; y != 0; y-- )
    739   {
    740     piSrcTmp = &piSrc[ -3*iSrcStep ];
    741     for ( Int x = 0; x < iWidth; x++ )
    742     {
    743       // {-1,   3,  -7,  19,   57,  -10,   4,   -1  },
    744      
    745       iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2];
    746       iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3];
    747      
    748       iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
    749             - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 )
    750             + (   piSrcTmp[iSrcStep6]           << 2 )
    751             - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 )
    752             + (   piSrcTmp[iSrcStep3]           << 4 );
    753      
    754       piDst   [x * iDstStep] = Clip( ((iSum +  32) >>  6) + piSrcTmp[iSrcStep4] );
    755       piSrcTmp += iSrcStep;
    756     }
    757     piSrc += iSrcStride;
    758     piDst += iDstStride;
    759   }
    760   return;
    761 }
    762 
    763 __inline Void TRenInterpFilter::xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    764 {
    765   Pel*  piDst    = rpiDst;
    766   Int   iSum;
    767   Int*  piSrcTmp;
    768   Int iSrcStep2 = iSrcStep*2;
    769   Int iSrcStep3 = iSrcStep*3;
    770   Int iSrcStep4 = iSrcStep*4;
    771   Int iSrcStep5 = iSrcStep*5;
    772   Int iSrcStep6 = iSrcStep*6;
    773   Int iSrcStep7 = iSrcStep*7;
    774 
    775   Int  iTmp1, iTmp2;
    776   for ( Int y = iHeight; y != 0; y-- )
    777   {
    778     piSrcTmp = &piSrc[ -3*iSrcStep ];
    779     for ( Int x = 0; x < iWidth; x++ )
    780     {
    781       // {-1,   3,  -7,  19,   57,  -10,   4,   -1  },
    782      
    783       iTmp1 = piSrcTmp[iSrcStep4] + piSrcTmp[iSrcStep2];
    784       iTmp2 = piSrcTmp[iSrcStep ] + piSrcTmp[iSrcStep3];
    785      
    786       iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStep7]
    787             - ( ( piSrcTmp[iSrcStep5] - iTmp2 ) << 1 )
    788             + (   piSrcTmp[iSrcStep6]           << 2 )
    789             - ( ( piSrcTmp[iSrcStep5] + iTmp1 ) << 3 )
    790             + (   piSrcTmp[iSrcStep3]           << 4 )
    791             + (   piSrcTmp[iSrcStep4]           << 6 );
    792      
    793       piDst   [x * iDstStep] = Clip( (iSum +  2048) >>  12 );
    794       piSrcTmp += iSrcStep;
    795     }
    796     piSrc += iSrcStride;
    797     piDst += iDstStride;
    798   }
    799   return;
    800 }
    801 
    802 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel )
    803 {
    804   Int*  piDst = rpiDst;
    805   Pel*  piDstPel = rpiDstPel;
    806   Int   iSum;
    807   Pel*  piSrcTmp;
    808   Int iSrcStride2 = iSrcStride*2;
    809   Int iSrcStride3 = iSrcStride*3;
    810   Int iSrcStride4 = iSrcStride*4;
    811   Int iSrcStride5 = iSrcStride*5;
    812   Int iSrcStride6 = iSrcStride*6;
    813   Int iSrcStride7 = iSrcStride*7;
    814 
    815   Int  iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    816   for ( Int y = iHeight; y != 0; y-- )
    817   {
    818     piSrcTmp = &piSrc[ -3*iSrcStride ];
    819     for ( Int x = 0; x < iWidth; x++ )
    820     {
    821       // { -1,4,-11,40,40,-11,4,-1   }
    822       iTmp0 = piSrcTmp[          0]+piSrcTmp[iSrcStride7];
    823       iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];
    824       iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];
    825       iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];
    826      
    827       iTmpA = (iTmp3 << 2) - iTmp2;
    828      
    829       iSum  = (   iTmp1          << 2 )
    830             + (   iTmpA          << 3 )
    831             + (   iTmpA          << 1 )
    832             -    iTmp0 -  iTmp2;
    833      
    834       piDst[x * iDstStep]    = iSum;
    835       piDstPel[x * iDstStep] = Clip( (iSum +  32) >>  6 );
    836       piSrcTmp += iSrcStep;
    837     }
    838     piSrc += iSrcStride;
    839     piDst += iDstStride;
    840     piDstPel += iDstStridePel;
    841   }
    842  return;
    843 }
    844 
    845 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst)
    846 {
    847   Int*  piDst = rpiDst;
    848   Int   iSum;
    849   Pel*  piSrcTmp;
    850   Int iSrcStride2 = iSrcStride*2;
    851   Int iSrcStride3 = iSrcStride*3;
    852   Int iSrcStride4 = iSrcStride*4;
    853   Int iSrcStride5 = iSrcStride*5;
    854   Int iSrcStride6 = iSrcStride*6;
    855   Int iSrcStride7 = iSrcStride*7;
    856 
    857   Int  iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    858   for ( Int y = iHeight; y != 0; y-- )
    859   {
    860     piSrcTmp = &piSrc[ -3*iSrcStride ];
    861     for ( Int x = 0; x < iWidth; x++ )
    862     {
    863       // { -1,4,-11,40,40,-11,4,-1   }
    864       iTmp0 = piSrcTmp[          0]+piSrcTmp[iSrcStride7];
    865       iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];
    866       iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];
    867       iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];
    868      
    869       iTmpA = (iTmp3 << 2) - iTmp2;
    870      
    871       iSum  = (   iTmp1          << 2 )
    872             + (   iTmpA          << 3 )
    873             + (   iTmpA          << 1 )
    874             -    iTmp0 -  iTmp2;       
    875      
    876       piDst[x * iDstStep] = iSum;
    877       piSrcTmp += iSrcStep;
    878     }
    879     piSrc += iSrcStride;
    880     piDst += iDstStride;
    881   }
    882   return;
    883 }
    884 
    885 __inline Void TRenInterpFilter::xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    886 {
    887   Pel*  piDst = rpiDst;
    888   Int   iSum;
    889   Pel*  piSrcTmp;
    890  
    891   Int iSrcStride2 = iSrcStride*2;
    892   Int iSrcStride3 = iSrcStride*3;
    893   Int iSrcStride4 = iSrcStride*4;
    894   Int iSrcStride5 = iSrcStride*5;
    895   Int iSrcStride6 = iSrcStride*6;
    896   Int iSrcStride7 = iSrcStride*7;
    897 
    898   Int  iTmp0, iTmp1, iTmp2, iTmp3, iTmpA;
    899   for ( Int y = iHeight; y != 0; y-- )
    900   {
    901     piSrcTmp = &piSrc[ -3*iSrcStride ];
    902     for ( Int x = 0; x < iWidth; x++ )
    903     {
    904       // { -1,4,-11,40,40,-11,4,-1   }
    905       iTmp0 = piSrcTmp[          0]+piSrcTmp[iSrcStride7];
    906       iTmp1 = piSrcTmp[iSrcStride ]+piSrcTmp[iSrcStride6];
    907       iTmp2 = piSrcTmp[iSrcStride2]+piSrcTmp[iSrcStride5];
    908       iTmp3 = piSrcTmp[iSrcStride3]+piSrcTmp[iSrcStride4];
    909      
    910       iTmpA = (iTmp3 << 2) - iTmp2;
    911      
    912       iSum  = (   iTmp1          << 2 )
    913             + (   iTmpA          << 3 )
    914             + (   iTmpA          << 1 )
    915             -    iTmp0 -  iTmp2;       
    916      
    917       piDst[x * iDstStep] = Clip( (iSum +  32) >>  6 );
    918       piSrcTmp += iSrcStep;
    919     }
    920     piSrc += iSrcStride;
    921     piDst += iDstStride;
    922   }
    923   return;
    924 }
    925 
    926 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst)
    927 {
    928   Int*  piDst = rpiDst;
    929   Int   iSum;
    930   Pel*  piSrcTmp;
    931   Int iSrcStride2 = iSrcStride*2;
    932   Int iSrcStride3 = iSrcStride*3;
    933   Int iSrcStride4 = iSrcStride*4;
    934   Int iSrcStride5 = iSrcStride*5;
    935   Int iSrcStride6 = iSrcStride*6;
    936   Int iSrcStride7 = iSrcStride*7;
    937 
    938   Int  iTmp1, iTmp2;
    939   for ( Int y = iHeight; y != 0; y-- )
    940   {
    941     piSrcTmp = &piSrc[ -3*iSrcStride ];
    942     for ( Int x = 0; x < iWidth; x++ )
    943     {
    944       // {-1,   4,  -10,  57,   19,  -7,   3,   -1  },
    945      
    946       iTmp1 = piSrcTmp[iSrcStride3] + piSrcTmp[iSrcStride5];
    947       iTmp2 = piSrcTmp[iSrcStride6] + piSrcTmp[iSrcStride4];
    948      
    949       iSum  =  iTmp1 + iTmp2 - piSrcTmp[0] - piSrcTmp[iSrcStride7]
    950             - ( ( piSrcTmp[iSrcStride2] - iTmp2 ) << 1 )
    951             + (  piSrcTmp[iSrcStride]             << 2 )
    952             - ( ( piSrcTmp[iSrcStride2] + iTmp1 ) << 3 )
    953             + (   piSrcTmp[iSrcStride4]           << 4 )
    954             + (   piSrcTmp[iSrcStride3]           << 6 );
    955      
    956       piDst[x * iDstStep] = iSum;
    957       piSrcTmp += iSrcStep;
    958     }
    959     piSrc += iSrcStride;
    960     piDst += iDstStride;
    961   }
    962   return;
    963 }
    964 
    965 __inline Void TRenInterpFilter::xCTI_FilterQuarter0Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    966 {
    967   Pel*  piDst = rpiDst;
    968   Int   iSum;
    969   Pel*  piSrcTmp;
    970  
    971   Int iSrcStride2 = iSrcStride*2;
    972   Int iSrcStride3 = iSrcStride*3;
    973   Int iSrcStride4 = iSrcStride*4;
    974   Int iSrcStride5 = iSrcStride*5;
    975   Int iSrcStride6 = iSrcStride*6;
    976   Int iSrcStride7 = iSrcStride*7;
    977540
    978541  Int  iTmp1, iTmp2;
     
    993556            + (   piSrcTmp[iSrcStride4]           << 4 );
    994557     
    995       piDst[x * iDstStep] = Clip( ((iSum +  32) >>  6) + piSrcTmp[iSrcStride3] );
     558      piDst[x * iDstStep] = ClipY( ((iSum +  32) >>  6) + piSrcTmp[iSrcStride3] );
    996559      piSrcTmp += iSrcStep;
    997560    }
     
    1043606__inline Void TRenInterpFilter::xCTI_FilterQuarter1Ver (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst)
    1044607{
     608  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
     609
    1045610  Pel*  piDst = rpiDst;
    1046611  Int   iSum;
     
    1070635            + (   piSrcTmp[iSrcStride3]           << 4 );
    1071636           
    1072       piDst[x * iDstStep] = Clip( ((iSum +  32) >>  6) +  piSrcTmp[iSrcStride4] );
     637      piDst[x * iDstStep] = ClipY( ((iSum +  32) >>  6) +  piSrcTmp[iSrcStride4] );
    1073638      piSrcTmp += iSrcStep;
    1074639    }
     
    1211776__inline Void TRenInterpFilter::xCTI_Filter2DHorC(Int* piSrc, Int iSrcStride,  Int iWidth, Int iHeight, Int iDstStride,  Pel*& rpiDst, Int iMV)
    1212777{
     778  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
    1213779  Pel*  piDst    = rpiDst;
    1214780  Int   iSum;
     
    1225791        {
    1226792          iSum         = xCTI_Filter_VI04_C_OCT0( piSrcTmp, 1 );
    1227           piDst   [x ] = Clip ((iSum +  2048) >>  12 );
     793          piDst   [x ] = ClipC ((iSum +  2048) >>  12 );
    1228794          piSrcTmp++;
    1229795        }
     
    1241807        {
    1242808          iSum         = xCTI_Filter_VI04_C_QUA0( piSrcTmp, 1 );
    1243           piDst   [x ] = Clip ((iSum +  2048) >>  12 );
     809          piDst   [x ] = ClipC ((iSum +  2048) >>  12 );
    1244810          piSrcTmp++;
    1245811        }
     
    1257823        {
    1258824          iSum         = xCTI_Filter_VI04_C_QUA1( piSrcTmp, 1 );
    1259           piDst   [x ] = Clip ((iSum +  2048) >>  12 );
     825          piDst   [x ] = ClipC ((iSum +  2048) >>  12 );
    1260826          piSrcTmp++;
    1261827        }
     
    1273839        {
    1274840          iSum         = xCTI_Filter_VI04_C_OCT1( piSrcTmp, 1 );
    1275           piDst   [x ] = Clip ((iSum +  2048) >>  12 );
     841          piDst   [x ] = ClipC ((iSum +  2048) >>  12 );
    1276842          piSrcTmp++;
    1277843        }
     
    1289855        {
    1290856          iSum         = xCTI_Filter_VI04_C_OCT2( piSrcTmp, 1 );
    1291           piDst   [x ] = Clip ((iSum +  2048) >>  12 );
     857          piDst   [x ] = ClipC ((iSum +  2048) >>  12 );
    1292858          piSrcTmp++;
    1293859        }
     
    1305871        {
    1306872          iSum         = xCTI_Filter_VI04_C_OCT3( piSrcTmp, 1 );
    1307           piDst   [x ] = Clip ((iSum +  2048) >>  12 );
     873          piDst   [x ] = ClipC ((iSum +  2048) >>  12 );
    1308874          piSrcTmp++;
    1309875        }
     
    1321887        {
    1322888          iSum      = xCTI_Filter_VIS04_C_HAL( piSrcTmp, 1 );
    1323           piDst   [x ] = Clip ((iSum +  2048) >>  12 );
     889          piDst   [x ] = ClipC ((iSum +  2048) >>  12 );
    1324890          piSrcTmp++;
    1325891        }
     
    1338904__inline Void TRenInterpFilter::xCTI_Filter1DVerC (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride,  Pel*& rpiDst, Int iMV)
    1339905{
     906  assert( g_bitDepthC == g_bitDepthY);  // ToDo: Update renderer to work with different luma/chroma bit depth
     907
    1340908  Pel*  piDst = rpiDst;
    1341909  Int   iSum;
     
    1352920        {
    1353921          iSum      = xCTI_Filter_VP04_C_OCT0( piSrcTmp,  iSrcStride );
    1354           piDst[x ] = Clip ((iSum +  32) >>  6 );
     922          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    1355923          piSrcTmp++;
    1356924        }
     
    1368936        {
    1369937          iSum      = xCTI_Filter_VP04_C_QUA0( piSrcTmp,  iSrcStride );
    1370           piDst[x ] = Clip ((iSum +  32) >>  6 );
     938          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    1371939          piSrcTmp++;
    1372940        }
     
    1384952        {
    1385953          iSum      = xCTI_Filter_VP04_C_QUA1( piSrcTmp,  iSrcStride );
    1386           piDst[x ] = Clip ((iSum +  32) >>  6 );
     954          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    1387955          piSrcTmp++;
    1388956        }
     
    1400968        {
    1401969          iSum      = xCTI_Filter_VP04_C_OCT1( piSrcTmp,  iSrcStride );
    1402           piDst[x ] = Clip ((iSum +  32) >>  6 );
     970          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    1403971          piSrcTmp++;
    1404972        }
     
    1416984        {
    1417985          iSum      = xCTI_Filter_VP04_C_OCT2( piSrcTmp,  iSrcStride );
    1418           piDst[x ] = Clip ((iSum +  32) >>  6 );
     986          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    1419987          piSrcTmp++;
    1420988        }
     
    14321000        {
    14331001          iSum      = xCTI_Filter_VP04_C_OCT3( piSrcTmp,  iSrcStride );
    1434           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1002          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    14351003          piSrcTmp++;
    14361004        }
     
    14481016        {
    14491017          iSum      = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride );
    1450           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1018          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    14511019          piSrcTmp++;
    14521020        }
     
    14781046        {
    14791047          iSum         = xCTI_Filter_VP04_C_OCT0( piSrcTmp,  1 );
    1480           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1048          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    14811049          piSrcTmp++;
    14821050        }
     
    14941062        {
    14951063          iSum         = xCTI_Filter_VP04_C_QUA0( piSrcTmp,  1 );
    1496           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1064          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    14971065          piSrcTmp++;
    14981066        }
     
    15101078        {
    15111079          iSum         = xCTI_Filter_VP04_C_QUA1( piSrcTmp,  1 );
    1512           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1080          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    15131081          piSrcTmp++;
    15141082        }
     
    15261094        {
    15271095          iSum         = xCTI_Filter_VP04_C_OCT1( piSrcTmp,  1 );
    1528           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1096          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    15291097          piSrcTmp++;
    15301098        }
     
    15421110        {
    15431111          iSum         = xCTI_Filter_VP04_C_OCT2( piSrcTmp,  1 );
    1544           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1112          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    15451113          piSrcTmp++;
    15461114        }
     
    15581126        {
    15591127          iSum         = xCTI_Filter_VP04_C_OCT3( piSrcTmp,  1 );
    1560           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1128          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    15611129          piSrcTmp++;
    15621130        }
     
    15741142        {
    15751143          iSum         = xCTI_Filter_VPS04_C_HAL( piSrcTmp,  1 );
    1576           piDst[x ] = Clip ((iSum +  32) >>  6 );
     1144          piDst[x ] = ClipC ((iSum +  32) >>  6 );
    15771145          piSrcTmp++;
    15781146        }
     
    15871155  return;
    15881156}
    1589 
    1590 #if HIGH_ACCURACY_BI
    1591 __inline Void TRenInterpFilter::xCTI_Filter2DHorC_ha(Int* piSrc, Int iSrcStride,  Int iWidth, Int iHeight, Int iDstStride,  Pel*& rpiDst, Int iMV)
    1592 {
    1593   Pel*  piDst    = rpiDst;
    1594   Int   iSum;
    1595   Int*  piSrcTmp;
    1596   Int shiftNum  = 6 + g_uiBitIncrement + g_uiBitDepth - 8;
    1597   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
    1598 
    1599   switch (iMV)
    1600   {
    1601   case 1:
    1602   { 
    1603       for ( Int y = iHeight; y != 0; y-- )
    1604       {
    1605         piSrcTmp = &piSrc[ -1 ];
    1606         for ( Int x = 0; x < iWidth; x++ )
    1607         {
    1608           iSum         = xCTI_Filter_VI04_C_OCT0( piSrcTmp, 1 );
    1609 #if REMOVE_INTERMEDIATE_CLIPPING
    1610           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1611 #else
    1612           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1613 #endif
    1614           piSrcTmp++;
    1615         }
    1616         piSrc += iSrcStride;
    1617         piDst += iDstStride;
    1618       }
    1619   }
    1620   break;
    1621   case 2:
    1622   { 
    1623       for ( Int y = iHeight; y != 0; y-- )
    1624       {
    1625         piSrcTmp = &piSrc[ -1 ];
    1626         for ( Int x = 0; x < iWidth; x++ )
    1627         {
    1628           iSum         = xCTI_Filter_VI04_C_QUA0( piSrcTmp, 1 );
    1629 #if REMOVE_INTERMEDIATE_CLIPPING
    1630           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1631 #else
    1632           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1633 #endif
    1634           piSrcTmp++;
    1635         }
    1636         piSrc += iSrcStride;
    1637         piDst += iDstStride;
    1638       }
    1639   }
    1640   break;
    1641   case 6:
    1642   { 
    1643       for ( Int y = iHeight; y != 0; y-- )
    1644       {
    1645         piSrcTmp = &piSrc[ -1 ];
    1646         for ( Int x = 0; x < iWidth; x++ )
    1647         {
    1648           iSum         = xCTI_Filter_VI04_C_QUA1( piSrcTmp, 1 );
    1649 #if REMOVE_INTERMEDIATE_CLIPPING
    1650           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1651 #else
    1652           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1653 #endif
    1654           piSrcTmp++;
    1655         }
    1656         piSrc += iSrcStride;
    1657         piDst += iDstStride;
    1658       }
    1659   }
    1660   break;
    1661   case 3:
    1662   { 
    1663       for ( Int y = iHeight; y != 0; y-- )
    1664       {
    1665         piSrcTmp = &piSrc[ -1 ];
    1666         for ( Int x = 0; x < iWidth; x++ )
    1667         {
    1668           iSum         = xCTI_Filter_VI04_C_OCT1( piSrcTmp, 1 );
    1669 #if REMOVE_INTERMEDIATE_CLIPPING
    1670           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1671 #else
    1672           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1673 #endif
    1674           piSrcTmp++;
    1675         }
    1676         piSrc += iSrcStride;
    1677         piDst += iDstStride;
    1678       }
    1679   }
    1680   break;
    1681   case 5:
    1682   { 
    1683       for ( Int y = iHeight; y != 0; y-- )
    1684       {
    1685         piSrcTmp = &piSrc[ -1 ];
    1686         for ( Int x = 0; x < iWidth; x++ )
    1687         {
    1688           iSum         = xCTI_Filter_VI04_C_OCT2( piSrcTmp, 1 );
    1689 #if REMOVE_INTERMEDIATE_CLIPPING
    1690           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1691 #else
    1692           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1693 #endif
    1694           piSrcTmp++;
    1695         }
    1696         piSrc += iSrcStride;
    1697         piDst += iDstStride;
    1698       }
    1699   }
    1700   break;
    1701   case 7:
    1702   { 
    1703       for ( Int y = iHeight; y != 0; y-- )
    1704       {
    1705         piSrcTmp = &piSrc[ -1 ];
    1706         for ( Int x = 0; x < iWidth; x++ )
    1707         {
    1708           iSum         = xCTI_Filter_VI04_C_OCT3( piSrcTmp, 1 );
    1709 #if REMOVE_INTERMEDIATE_CLIPPING
    1710           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1711 #else
    1712           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1713 #endif
    1714           piSrcTmp++;
    1715         }
    1716         piSrc += iSrcStride;
    1717         piDst += iDstStride;
    1718       }
    1719   }
    1720   break;
    1721   case 4:
    1722   {
    1723       for ( Int y = iHeight; y != 0; y-- )
    1724       {
    1725         piSrcTmp = &piSrc[ -1 ];
    1726         for ( Int x = 0; x < iWidth; x++ )
    1727         {
    1728           iSum      = xCTI_Filter_VIS04_C_HAL( piSrcTmp, 1 );
    1729 #if REMOVE_INTERMEDIATE_CLIPPING
    1730           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1731 #else
    1732           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1733 #endif
    1734           piSrcTmp++;
    1735         }
    1736         piSrc += iSrcStride;
    1737         piDst += iDstStride;
    1738       }
    1739   }
    1740   break;
    1741   default:
    1742     assert( 0 );
    1743   }
    1744 
    1745   return;
    1746 }
    1747 
    1748 __inline Void TRenInterpFilter::xCTI_Filter1DVerC_ha (Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride,  Pel*& rpiDst, Int iMV)
    1749 {
    1750   Pel*  piDst = rpiDst;
    1751   Int   iSum;
    1752   Pel*  piSrcTmp;
    1753   Int shiftNum  = g_uiBitIncrement + g_uiBitDepth - 8;
    1754   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
    1755    
    1756   switch (iMV)
    1757   {
    1758   case 1:
    1759   { 
    1760       for ( Int y = iHeight; y != 0; y-- )
    1761       {
    1762         piSrcTmp = &piSrc[ -iSrcStride ];
    1763         for ( Int x = 0; x < iWidth; x++ )
    1764         {
    1765           iSum      = xCTI_Filter_VP04_C_OCT0( piSrcTmp,  iSrcStride );
    1766 #if REMOVE_INTERMEDIATE_CLIPPING
    1767           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1768 #else
    1769           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1770 #endif
    1771           piSrcTmp++;
    1772         }
    1773         piSrc += iSrcStride;
    1774         piDst += iDstStride;
    1775       }
    1776   }
    1777   break;
    1778   case 2:
    1779   { 
    1780       for ( Int y = iHeight; y != 0; y-- )
    1781       {
    1782         piSrcTmp = &piSrc[ -iSrcStride ];
    1783         for ( Int x = 0; x < iWidth; x++ )
    1784         {
    1785           iSum      = xCTI_Filter_VP04_C_QUA0( piSrcTmp,  iSrcStride );
    1786 #if REMOVE_INTERMEDIATE_CLIPPING
    1787           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1788 #else
    1789           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1790 #endif
    1791           piSrcTmp++;
    1792         }
    1793         piSrc += iSrcStride;
    1794         piDst += iDstStride;
    1795       }
    1796   }
    1797   break;
    1798   case 6:
    1799   { 
    1800       for ( Int y = iHeight; y != 0; y-- )
    1801       {
    1802         piSrcTmp = &piSrc[ -iSrcStride ];
    1803         for ( Int x = 0; x < iWidth; x++ )
    1804         {
    1805           iSum      = xCTI_Filter_VP04_C_QUA1( piSrcTmp,  iSrcStride );
    1806 #if REMOVE_INTERMEDIATE_CLIPPING
    1807           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1808 #else
    1809           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1810 #endif
    1811           piSrcTmp++;
    1812         }
    1813         piSrc += iSrcStride;
    1814         piDst += iDstStride;
    1815       }
    1816   }
    1817   break;
    1818   case 3:
    1819   { 
    1820       for ( Int y = iHeight; y != 0; y-- )
    1821       {
    1822         piSrcTmp = &piSrc[ -iSrcStride ];
    1823         for ( Int x = 0; x < iWidth; x++ )
    1824         {
    1825           iSum      = xCTI_Filter_VP04_C_OCT1( piSrcTmp,  iSrcStride );
    1826 #if REMOVE_INTERMEDIATE_CLIPPING
    1827           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1828 #else
    1829           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1830 #endif
    1831           piSrcTmp++;
    1832         }
    1833         piSrc += iSrcStride;
    1834         piDst += iDstStride;
    1835       }
    1836   }
    1837   break;
    1838   case 5:
    1839   { 
    1840       for ( Int y = iHeight; y != 0; y-- )
    1841       {
    1842         piSrcTmp = &piSrc[ -iSrcStride ];
    1843         for ( Int x = 0; x < iWidth; x++ )
    1844         {
    1845           iSum      = xCTI_Filter_VP04_C_OCT2( piSrcTmp,  iSrcStride );
    1846 #if REMOVE_INTERMEDIATE_CLIPPING
    1847           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1848 #else
    1849           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1850 #endif
    1851           piSrcTmp++;
    1852         }
    1853         piSrc += iSrcStride;
    1854         piDst += iDstStride;
    1855       }
    1856   }
    1857   break;
    1858   case 7:
    1859   { 
    1860       for ( Int y = iHeight; y != 0; y-- )
    1861       {
    1862         piSrcTmp = &piSrc[ -iSrcStride ];
    1863         for ( Int x = 0; x < iWidth; x++ )
    1864         {
    1865           iSum      = xCTI_Filter_VP04_C_OCT3( piSrcTmp,  iSrcStride );
    1866 #if REMOVE_INTERMEDIATE_CLIPPING
    1867           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1868 #else
    1869           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1870 #endif
    1871           piSrcTmp++;
    1872         }
    1873         piSrc += iSrcStride;
    1874         piDst += iDstStride;
    1875       }
    1876   }
    1877   break;
    1878   case 4:
    1879   {
    1880       for ( Int y = iHeight; y != 0; y-- )
    1881       {
    1882         piSrcTmp = &piSrc[-iSrcStride ];
    1883         for ( Int x = 0; x < iWidth; x++ )
    1884         {
    1885           iSum      = xCTI_Filter_VPS04_C_HAL( piSrcTmp, iSrcStride );
    1886 #if REMOVE_INTERMEDIATE_CLIPPING
    1887           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1888 #else
    1889           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1890 #endif
    1891           piSrcTmp++;
    1892         }
    1893         piSrc += iSrcStride;
    1894         piDst += iDstStride;
    1895       }
    1896   }
    1897   break;
    1898   default:
    1899     assert( 0 );
    1900   }   
    1901   return;
    1902 }
    1903 
    1904 __inline Void TRenInterpFilter::xCTI_Filter1DHorC_ha(Pel* piSrc, Int iSrcStride, Int iWidth, Int iHeight, Int iDstStride, Pel*& rpiDst, Int iMV)
    1905 {
    1906   Pel*  piDst    = rpiDst;
    1907   Int   iSum;
    1908   Pel*  piSrcTmp;
    1909   Int shiftNum  = g_uiBitIncrement + g_uiBitDepth - 8;
    1910   Int shiftOffset = (shiftNum > 0) ? ( 1 << (shiftNum - 1)) : 0 ;
    1911 
    1912   switch (iMV)
    1913   {
    1914   case 1:
    1915   { 
    1916       for ( Int y = iHeight; y != 0; y-- )
    1917       {
    1918         piSrcTmp = &piSrc[ -1 ];
    1919         for ( Int x = 0; x < iWidth; x++ )
    1920         {
    1921           iSum      = xCTI_Filter_VP04_C_OCT0( piSrcTmp,  1 );
    1922 #if REMOVE_INTERMEDIATE_CLIPPING
    1923           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1924 #else
    1925           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1926 #endif
    1927           piSrcTmp++;
    1928         }
    1929         piSrc += iSrcStride;
    1930         piDst += iDstStride;
    1931       }
    1932   }
    1933   break;
    1934   case 2:
    1935   { 
    1936       for ( Int y = iHeight; y != 0; y-- )
    1937       {
    1938         piSrcTmp = &piSrc[ -1 ];
    1939         for ( Int x = 0; x < iWidth; x++ )
    1940         {
    1941           iSum      = xCTI_Filter_VP04_C_QUA0( piSrcTmp,  1 );
    1942 #if REMOVE_INTERMEDIATE_CLIPPING
    1943           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1944 #else
    1945           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1946 #endif
    1947           piSrcTmp++;
    1948         }
    1949         piSrc += iSrcStride;
    1950         piDst += iDstStride;
    1951       }
    1952   }
    1953   break;
    1954   case 6:
    1955   { 
    1956       for ( Int y = iHeight; y != 0; y-- )
    1957       {
    1958         piSrcTmp = &piSrc[ -1 ];
    1959         for ( Int x = 0; x < iWidth; x++ )
    1960         {
    1961           iSum         = xCTI_Filter_VP04_C_QUA1( piSrcTmp,  1 );
    1962 #if REMOVE_INTERMEDIATE_CLIPPING
    1963           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1964 #else
    1965           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1966 #endif
    1967           piSrcTmp++;
    1968         }
    1969         piSrc += iSrcStride;
    1970         piDst += iDstStride;
    1971       }
    1972   }
    1973   break;
    1974   case 3:
    1975   { 
    1976       for ( Int y = iHeight; y != 0; y-- )
    1977       {
    1978         piSrcTmp = &piSrc[ -1 ];
    1979         for ( Int x = 0; x < iWidth; x++ )
    1980         {
    1981           iSum      = xCTI_Filter_VP04_C_OCT1( piSrcTmp,  1 );
    1982 #if REMOVE_INTERMEDIATE_CLIPPING
    1983           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    1984 #else
    1985           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    1986 #endif
    1987           piSrcTmp++;
    1988         }
    1989         piSrc += iSrcStride;
    1990         piDst += iDstStride;
    1991       }
    1992   }
    1993   break;
    1994   case 5:
    1995   { 
    1996       for ( Int y = iHeight; y != 0; y-- )
    1997       {
    1998         piSrcTmp = &piSrc[ -1 ];
    1999         for ( Int x = 0; x < iWidth; x++ )
    2000         {
    2001           iSum         = xCTI_Filter_VP04_C_OCT2( piSrcTmp,  1 );
    2002 #if REMOVE_INTERMEDIATE_CLIPPING
    2003           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    2004 #else
    2005           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    2006 #endif
    2007           piSrcTmp++;
    2008         }
    2009         piSrc += iSrcStride;
    2010         piDst += iDstStride;
    2011       }
    2012   }
    2013   break;
    2014   case 7:
    2015   { 
    2016       for ( Int y = iHeight; y != 0; y-- )
    2017       {
    2018         piSrcTmp = &piSrc[ -1 ];
    2019         for ( Int x = 0; x < iWidth; x++ )
    2020         {
    2021           iSum         = xCTI_Filter_VP04_C_OCT3( piSrcTmp,  1 );
    2022 #if REMOVE_INTERMEDIATE_CLIPPING
    2023           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    2024 #else
    2025           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    2026 #endif
    2027           piSrcTmp++;
    2028         }
    2029         piSrc += iSrcStride;
    2030         piDst += iDstStride;
    2031       }
    2032   }
    2033   break;
    2034   case 4:
    2035   {
    2036       for ( Int y = iHeight; y != 0; y-- )
    2037       {
    2038         piSrcTmp = &piSrc[ -1 ];
    2039         for ( Int x = 0; x < iWidth; x++ )
    2040         {
    2041           iSum    = xCTI_Filter_VPS04_C_HAL( piSrcTmp,  1 );
    2042 #if REMOVE_INTERMEDIATE_CLIPPING
    2043           piDst[x ] = (iSum +  shiftOffset) >>  shiftNum;
    2044 #else
    2045           piDst[x ] = Clip3(0,16383, (iSum +  shiftOffset) >>  shiftNum );
    2046 #endif
    2047           piSrcTmp++;
    2048         }
    2049         piSrc += iSrcStride;
    2050         piDst += iDstStride;
    2051       }
    2052   }
    2053   break;
    2054   default:
    2055     assert( 0 );
    2056 
    2057  }
    2058   return;
    2059 }
    2060 #endif
    2061 
    20621157
    20631158__inline Int TRenInterpFilter::xCTI_Filter_VP04_C_OCT0( Pel* pSrc,  Int iStride )
     
    22311326  return iSum;
    22321327}
    2233 
     1328#endif // H_3D
    22341329#endif // __TRENINTERP__
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenModSetupStrParser.cpp

    r438 r446  
    3636#include "TRenFilter.h"
    3737#include "TRenModSetupStrParser.h"
    38 #if !QC_MVHEVC_B0046
     38
     39#if H_3D
    3940Int
    4041TRenModSetupStrParser::getNumOfModels()
     
    450451  rcNextChar = m_pchSetStr[iPos];
    451452}
    452 #endif
    453 
     453#endif // H_3D
     454
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenModSetupStrParser.h

    r438 r446  
    3131 * THE POSSIBILITY OF SUCH DAMAGE.
    3232 */
    33 #if !QC_MVHEVC_B0046
     33
    3434#ifndef __TRENMODSETUPSTRPARSER__
    3535#define __TRENMODSETUPSTRPARSER__
     
    3939#include "../TLibCommon/TypeDef.h"
    4040#include "../TAppCommon/TAppComCamPara.h"
     41#if H_3D
     42
    4143
    4244
     
    126128};
    127129
     130#endif // H_3D
    128131#endif //__TRENMODEL__
    129 #endif
    130132
     133
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenModel.cpp

    r438 r446  
    3535#include "TRenFilter.h"
    3636#include "TRenModel.h"
    37 #if !QC_MVHEVC_B0046
     37
     38#if H_3D_VSO
    3839///////////  TRENMODEL //////////////////////
    3940TRenModel::TRenModel()
     
    4849  m_iHoleMargin        =  1;
    4950  m_uiHorOff           = -1;
    50 #if LGE_VSO_EARLY_SKIP_A0093
     51#if H_3D_VSO_EARLY_SKIP
    5152  m_bEarlySkip         = false;
    5253#endif
     
    214215
    215216Void
    216 #if LGE_VSO_EARLY_SKIP_A0093
     217#if H_3D_VSO_EARLY_SKIP
    217218TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip )
    218219#else
     
    226227  m_iShiftPrec          = iShiftPrec;
    227228  m_iHoleMargin         = iHoleMargin;
    228 #if LGE_VSO_EARLY_SKIP_A0093
     229#if H_3D_VSO_EARLY_SKIP
    229230  m_bEarlySkip          = bEarlySkip;
    230231#endif
     
    357358  AOT( iContent      < -1 || iContent > 1 );
    358359  AOT( iBlendMode < -1 || iBlendMode > 2 );
    359 
    360   Bool bBitInc = (g_uiBitIncrement != 0);
     360  AOT( g_bitDepthY  != g_bitDepthC );
     361
     362  Bool bBitInc = ( DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) != 0);
    361363
    362364  AOT( m_apcRenModels[iModelNum] );
     
    414416
    415417
    416 #if LGE_VSO_EARLY_SKIP_A0093
     418#if H_3D_VSO_EARLY_SKIP
    417419  m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode, m_bEarlySkip );
    418420#else
     
    550552}
    551553
    552 #if LGE_VSO_EARLY_SKIP_A0093
     554#if H_3D_VSO_EARLY_SKIP
    553555RMDist
    554556TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride)
     
    574576    if (m_iCurrentContent == 1)
    575577    {
    576 #if LGE_VSO_EARLY_SKIP_A0093
     578#if H_3D_VSO_EARLY_SKIP
    577579      iDist +=  m_apcCurRenModels[iModelNum]->getDistDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY,  iWidth,  iHeight,  iStride,  piNewData , piOrgData, iOrgStride);
    578580#else
     
    606608    if (m_iCurrentContent == 1)
    607609    {
    608 #ifdef LGE_VSO_EARLY_SKIP_A0093
     610#if H_3D_VSO_EARLY_SKIP
    609611      Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ];
    610612      m_apcCurRenModels[iModelNum]->setDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX ,iTargetStride );
     
    619621  }
    620622
    621 #ifdef LGE_VSO_EARLY_SKIP_A0093
     623#if H_3D_VSO_EARLY_SKIP
    622624  if (m_iCurrentContent == 1)
    623625  {
     
    658660    m_apcCurRenModels[iCurModel]->getRefVideo  ( m_aiCurPosInModels[iCurModel], &cPicYuvTempRef   );
    659661
    660     iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(),  m_iWidth,      m_iUsedHeight     , cPicYuvTempRef.getLumaAddr(), cPicYuvTempRef.getStride() );
    661     iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr()  , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCbAddr()  , cPicYuvTempRef.getCStride());
    662     iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr()  , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCrAddr()  , cPicYuvTempRef.getCStride());
     662    iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(),  m_iWidth,      m_iUsedHeight     , cPicYuvTempRef.getLumaAddr(), cPicYuvTempRef.getStride() , true  );
     663    iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr()  , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCbAddr()  , cPicYuvTempRef.getCStride(), false );
     664    iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr()  , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCrAddr()  , cPicYuvTempRef.getCStride(), false );
    663665  }
    664666
     
    697699  }
    698700}
    699 #endif
    700 
     701#endif // H_3D
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenModel.h

    r438 r446  
    3232 */
    3333
    34 #if !QC_MVHEVC_B0046
     34
    3535#ifndef __TRENMODEL__
    3636#define __TRENMODEL__
     
    4242#include "../TLibCommon/TypeDef.h"
    4343
     44#if H_3D_VSO
     45
    4446class TRenModel
    4547{
     
    5052
    5153  // Creation
    52 #if LGE_VSO_EARLY_SKIP_A0093
     54#if H_3D_VSO_EARLY_SKIP
    5355  Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip );
    5456#else
     
    6870
    6971  // Get Distortion, set Data
    70 #ifdef LGE_VSO_EARLY_SKIP_A0093
     72#if H_3D_VSO_EARLY_SKIP
    7173  Int64 getDist          ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride);
    7274#else
     
    9193  Int**  m_aaaiSubPelShiftLut[2];
    9294  Int    m_iHoleMargin;
    93 #if LGE_VSO_EARLY_SKIP_A0093
     95#if H_3D_VSO_EARLY_SKIP
    9496  Bool   m_bEarlySkip;
    9597#endif
     
    155157};
    156158
     159#endif // H_3D
    157160#endif //__TRENMODEL__
    158 #endif
    159161
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenSingleModel.cpp

    r438 r446  
    3636#include "TRenSingleModel.h"
    3737
    38 #if !QC_MVHEVC_B0046
     38#if H_3D_VSO
     39
    3940////////////// TRENSINGLE MODEL ///////////////
    4041template <BlenMod iBM, Bool bBitInc>
    4142TRenSingleModelC<iBM,bBitInc>::TRenSingleModelC()
    42 :  m_iDistShift ( g_uiBitIncrement << 1 )
     43:  m_iDistShift ( ( g_bitDepthY - 8) << 1 )
    4344{
    4445  m_iWidth  = -1;
     
    8485  }
    8586
    86 #ifdef LGE_VSO_EARLY_SKIP_A0093
     87#if H_3D_VSO_EARLY_SKIP
    8788  m_pbHorSkip = NULL;
    8889#endif
     
    9293TRenSingleModelC<iBM,bBitInc>::~TRenSingleModelC()
    9394{
    94 #ifdef LGE_VSO_EARLY_SKIP_A0093
     95#if H_3D_VSO_EARLY_SKIP
    9596  if ( m_pbHorSkip )
    9697  {
     
    114115
    115116template <BlenMod iBM, Bool bBitInc> Void
    116 #if LGE_VSO_EARLY_SKIP_A0093
     117#if H_3D_VSO_EARLY_SKIP
    117118TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip )
    118119#else
     
    121122
    122123{
    123 #if LGE_VSO_EARLY_SKIP_A0093
     124#if H_3D_VSO_EARLY_SKIP
    124125  m_pbHorSkip     = new Bool [MAX_CU_SIZE];
    125126  m_bEarlySkip    = bEarlySkip;
     
    182183  Pel* piDRow = piCurDepthPel;
    183184  Pel* piYRow = apiCurVideoPel[0];
    184 #if HHI_VSO_COLOR_PLANES
     185#if H_3D_VSO_COLOR_PLANES
    185186  Pel* piURow = apiCurVideoPel[1];
    186187  Pel* piVRow = apiCurVideoPel[2];
     
    196197      Int iSubPosX = (1 << m_iShiftPrec);
    197198      pcCurInputSampleRow[0].aiY[iSubPosX] = piYRow[0];
    198 #if HHI_VSO_COLOR_PLANES
     199#if H_3D_VSO_COLOR_PLANES
    199200      pcCurInputSampleRow[0].aiU[iSubPosX] = piURow[0];
    200201      pcCurInputSampleRow[0].aiV[iSubPosX] = piVRow[0];
     
    210211        Int iShift = (iPosX << m_iShiftPrec) + iSubPosX;
    211212        pcCurInputSampleRow[iPosX+iOffsetX].aiY[iSubPosX] = piYRow[iShift];
    212 #if HHI_VSO_COLOR_PLANES
     213#if H_3D_VSO_COLOR_PLANES
    213214        pcCurInputSampleRow[iPosX+iOffsetX].aiU[iSubPosX] = piURow[iShift];
    214215        pcCurInputSampleRow[iPosX+iOffsetX].aiV[iSubPosX] = piVRow[iShift];
     
    221222    piDRow += iCurDepthStride;
    222223    piYRow += aiCurVideoStride[0];
    223 #if HHI_VSO_COLOR_PLANES
     224#if H_3D_VSO_COLOR_PLANES
    224225    piURow += aiCurVideoStride[1];
    225226    piVRow += aiCurVideoStride[2];
     
    270271  { 
    271272  case 0:   
    272 #if LGE_VSO_EARLY_SKIP_A0093
     273#if H_3D_VSO_EARLY_SKIP
    273274    xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false );
    274275#else
     
    277278    break;
    278279  case 1:   
    279 #ifdef LGE_VSO_EARLY_SKIP_A0093
     280#if H_3D_VSO_EARLY_SKIP
    280281    xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
    281282#else
     
    285286  case 2:
    286287    TRenFilter::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight );
    287 #ifdef LGE_VSO_EARLY_SKIP_A0093
     288#if H_3D_VSO_EARLY_SKIP
    288289    xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false);
    289290    xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
     
    306307
    307308template <BlenMod iBM, Bool bBitInc> Void
    308 #if HHI_VSO_COLOR_PLANES
     309#if H_3D_VSO_COLOR_PLANES
    309310TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV )
    310311#else
     
    316317  case 0:
    317318    rpiSrcY = &RenModelOutPels::iYLeft;
    318 #if HHI_VSO_COLOR_PLANES 
     319#if H_3D_VSO_COLOR_PLANES 
    319320    rpiSrcU = &RenModelOutPels::iULeft;
    320321    rpiSrcV = &RenModelOutPels::iVLeft;
     
    323324  case 1:
    324325    rpiSrcY = &RenModelOutPels::iYRight;
    325 #if HHI_VSO_COLOR_PLANES 
     326#if H_3D_VSO_COLOR_PLANES 
    326327    rpiSrcU = &RenModelOutPels::iURight;
    327328    rpiSrcV = &RenModelOutPels::iVRight;
     
    330331  case 2:
    331332    rpiSrcY = &RenModelOutPels::iYBlended;
    332 #if HHI_VSO_COLOR_PLANES 
     333#if H_3D_VSO_COLOR_PLANES 
    333334    rpiSrcU = &RenModelOutPels::iUBlended;
    334335    rpiSrcV = &RenModelOutPels::iVBlended;
     
    353354 
    354355  Pel* piYRow = m_aapiRefVideoPel[0];
    355 #if HHI_VSO_COLOR_PLANES
     356#if H_3D_VSO_COLOR_PLANES
    356357  Pel* piURow = m_aapiRefVideoPel[1];
    357358  Pel* piVRow = m_aapiRefVideoPel[2];
     
    363364    {     
    364365      pcCurOutSampleRow[iPosX].iYRef = piYRow[iPosX];
    365 #if HHI_VSO_COLOR_PLANES
     366#if H_3D_VSO_COLOR_PLANES
    366367      pcCurOutSampleRow[iPosX].iURef = piURow[iPosX];
    367368      pcCurOutSampleRow[iPosX].iVRef = piVRow[iPosX];
     
    372373   
    373374    piYRow += m_aiRefVideoStrides[0];
    374 #if HHI_VSO_COLOR_PLANES
     375#if H_3D_VSO_COLOR_PLANES
    375376    piURow += m_aiRefVideoStrides[1];
    376377    piVRow += m_aiRefVideoStrides[2];
     
    403404  Pel RenModelOutPels::* piSrcY = NULL;
    404405
    405 #if HHI_VSO_COLOR_PLANES 
     406#if H_3D_VSO_COLOR_PLANES 
    406407  Pel RenModelOutPels::* piSrcU = NULL;
    407408  Pel RenModelOutPels::* piSrcV = NULL;
     
    416417    {     
    417418      pcCurOutSampleRow[iPosX].iYRef = pcCurOutSampleRow[iPosX].*piSrcY;
    418 #if HHI_VSO_COLOR_PLANES
     419#if H_3D_VSO_COLOR_PLANES
    419420      pcCurOutSampleRow[iPosX].iURef = pcCurOutSampleRow[iPosX].*piSrcU;
    420421      pcCurOutSampleRow[iPosX].iVRef = pcCurOutSampleRow[iPosX].*piSrcV;
     
    449450      pcOutSampleRow[iPosX].iYRight       = 0;
    450451      pcOutSampleRow[iPosX].iYBlended     = 0;
    451 #if HHI_VSO_COLOR_PLANES             
     452#if H_3D_VSO_COLOR_PLANES             
    452453      // U Planes                   
    453       pcOutSampleRow[iPosX].iULeft        = 128 << g_uiBitIncrement;
    454       pcOutSampleRow[iPosX].iURight       = 128 << g_uiBitIncrement;
    455       pcOutSampleRow[iPosX].iUBlended     = 128 << g_uiBitIncrement;
     454      pcOutSampleRow[iPosX].iULeft        = 1 << (g_bitDepthC - 1);
     455      pcOutSampleRow[iPosX].iURight       = 1 << (g_bitDepthC - 1);
     456      pcOutSampleRow[iPosX].iUBlended     = 1 << (g_bitDepthC - 1);
    456457                                     
    457458      // V Planes                   
    458       pcOutSampleRow[iPosX].iVLeft        = 128 << g_uiBitIncrement;
    459       pcOutSampleRow[iPosX].iVRight       = 128 << g_uiBitIncrement;
    460       pcOutSampleRow[iPosX].iVBlended     = 128 << g_uiBitIncrement;
     459      pcOutSampleRow[iPosX].iVLeft        = 1 << (g_bitDepthC - 1);
     460      pcOutSampleRow[iPosX].iVRight       = 1 << (g_bitDepthC - 1);
     461      pcOutSampleRow[iPosX].iVBlended     = 1 << (g_bitDepthC - 1);
    461462#endif
    462463      //// Input Samples
     
    472473
    473474
    474 #ifdef LGE_VSO_EARLY_SKIP_A0093
     475#if H_3D_VSO_EARLY_SKIP
    475476template <BlenMod iBM, Bool bBitInc> RMDist
    476477TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Pel * piOrgData, Int iOrgStride )
     
    481482{
    482483  RMDist iSSE = 0;
    483 #ifdef LGE_VSO_EARLY_SKIP_A0093
     484#if H_3D_VSO_EARLY_SKIP
    484485  Bool   bEarlySkip;
    485486#endif
     
    487488  {
    488489  case 0:
    489 #ifdef LGE_VSO_EARLY_SKIP_A0093
     490#if H_3D_VSO_EARLY_SKIP
    490491    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
    491492    if( !bEarlySkip )
     
    498499    break;
    499500  case 1:
    500 #ifdef LGE_VSO_EARLY_SKIP_A0093
     501#if H_3D_VSO_EARLY_SKIP
    501502    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
    502503    if( !bEarlySkip )
     
    514515  return iSSE;
    515516}
    516 #ifdef LGE_VSO_EARLY_SKIP_A0093
     517#if H_3D_VSO_EARLY_SKIP
    517518template <BlenMod iBM, Bool bBitInc> Void
    518519TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride )
     
    522523#endif
    523524{
    524 #ifdef  LGE_VSO_EARLY_SKIP_A0093
     525#ifdef  H_3D_VSO_EARLY_SKIP
    525526  Bool bEarlySkip;
    526527#endif
     
    528529  {
    529530  case 0:
    530 #ifdef LGE_VSO_EARLY_SKIP_A0093
     531#if H_3D_VSO_EARLY_SKIP
    531532    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
    532533    if( !bEarlySkip )
     
    539540    break;
    540541  case 1:
    541 #ifdef LGE_VSO_EARLY_SKIP_A0093
     542#if H_3D_VSO_EARLY_SKIP
    542543    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
    543544    if( !bEarlySkip )
     
    560561  AOT( pcPicYuv->getHeight() < m_iUsedHeight + m_iHorOffset );
    561562
    562 #if HHI_VSO_COLOR_PLANES
     563#if H_3D_VSO_COLOR_PLANES
    563564  Pel RenModelOutPels::* piText[3] = { NULL, NULL, NULL };
    564565  xGetSampleStrTextPtrs(iViewPos, piText[0], piText[1], piText[2]);
     
    581582  xGetSampleStrTextPtrs(iViewPos, piY);
    582583  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getLumaAddr() + m_iHorOffset * pcPicYuv->getStride(), pcPicYuv->getStride(), m_iWidth, m_iUsedHeight );
    583   pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
     584  pcPicYuv->setChromaTo( 1 << (g_bitDepthC - 1) );   
    584585#endif 
    585586}
     
    595596  xGetSampleStrDepthPtrs(iViewPos, piD);
    596597  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piD, pcPicYuv->getLumaAddr() + pcPicYuv->getStride() * m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight );
    597   pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
     598  pcPicYuv->setChromaTo( 1 << (g_bitDepthC - 1) );   
    598599}
    599600
     
    605606  AOT( pcPicYuv->getHeight() <  m_iUsedHeight + m_iHorOffset);
    606607
    607 #if HHI_VSO_COLOR_PLANES
     608#if H_3D_VSO_COLOR_PLANES
    608609  Pel RenModelOutPels::* piText[3];
    609610  piText[0] = &RenModelOutPels::iYRef;
     
    627628#else
    628629  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getLumaAddr() *  pcPicYuv->getStride() + m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight );
    629   pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
     630  pcPicYuv->setChromaTo( 1 << ( g_bitDepthC - 1 ) );   
    630631#endif 
    631632}
     
    662663  m_pcOutputSamplesRow   += m_iOutputSamplesStride; 
    663664}
    664 #if LGE_VSO_EARLY_SKIP_A0093
     665#if H_3D_VSO_EARLY_SKIP
    665666template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
    666667TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast)
     
    695696  for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
    696697  {
    697 #ifdef LGE_VSO_EARLY_SKIP_A0093
     698#if H_3D_VSO_EARLY_SKIP
    698699    if( m_bEarlySkip && bFast )
    699700    {
     
    721722      xExtrapolateMarginL<bSet>  ( iCurSPos, iEndChangePos, iError );
    722723
    723       iMinChangedSPos       = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
     724      iMinChangedSPos       = std::min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    724725      iLastSPos             = iCurSPos;
    725726      m_iLastDepth          = m_iCurDepth;
     
    746747      // Get minimal changed sample position
    747748
    748       iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
     749      iMinChangedSPos = std::min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    749750      Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
    750751      m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
     
    786787}
    787788
    788 #ifdef  LGE_VSO_EARLY_SKIP_A0093
     789#ifdef  H_3D_VSO_EARLY_SKIP
    789790template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
    790791TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Bool bFast)
     
    820821  for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
    821822  {
    822 #ifdef LGE_VSO_EARLY_SKIP_A0093
     823#if H_3D_VSO_EARLY_SKIP
    823824    if( m_bEarlySkip && bFast )
    824825    {
     
    846847      xExtrapolateMarginR<bSet>     ( iCurSPos, iStartChangePos, iError );
    847848
    848       iMaxChangedSPos       = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
     849      iMaxChangedSPos       = std::max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    849850      iLastSPos             = iCurSPos;
    850851      m_iLastDepth          = m_iCurDepth;
     
    872873      // Get minimal changed sample position
    873874
    874       iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
     875      iMaxChangedSPos = std::max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    875876      Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
    876877      m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
     
    10021003
    10031004    m_iThisDepth = m_iCurDepth;
    1004     for (Int iFillSPos = Max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ )
     1005    for (Int iFillSPos = std::max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ )
    10051006    {
    10061007      Int iDeltaCurSPos  = (iFillSPos << m_iShiftPrec) - iCurSPos;
     
    11891190
    11901191  m_iThisDepth = m_iLastDepth;
    1191   for (Int iFillSPos = Max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ )
     1192  for (Int iFillSPos = std::max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ )
    11921193  {
    11931194    xSetShiftedPelL<bSet>( iLastPos, 0,  iFillSPos, REN_IS_HOLE, riError );
     
    12331234//    return;
    12341235
    1235   Int iSPosFullPel = Max(0,xRangeLeftL(iCurSPos));
     1236  Int iSPosFullPel = std::max(0,xRangeLeftL(iCurSPos));
    12361237
    12371238  m_iThisDepth = m_iCurDepth;
     
    12531254  //    return;
    12541255
    1255   Int iSPosFullPel = Min(m_iWidth-1,xRangeRightR(iCurSPos));
     1256  Int iSPosFullPel = std::min(m_iWidth-1,xRangeRightR(iCurSPos));
    12561257
    12571258  m_iThisDepth = m_iCurDepth;
     
    14131414    // Yuv
    14141415    pcOutSample->iYLeft  = pcInSample->aiY[iSubSourcePos];
    1415 #if HHI_VSO_COLOR_PLANES
     1416#if H_3D_VSO_COLOR_PLANES
    14161417    pcOutSample->iULeft  = pcInSample->aiU[iSubSourcePos];
    14171418    pcOutSample->iVLeft  = pcInSample->aiV[iSubSourcePos];
     
    14281429  else
    14291430  {
    1430 #if HHI_VSO_COLOR_PLANES
     1431#if H_3D_VSO_COLOR_PLANES
    14311432    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef,
    14321433                         pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef,
     
    14451446{
    14461447  Pel piBlendedValueY;
    1447 #if HHI_VSO_COLOR_PLANES
     1448#if H_3D_VSO_COLOR_PLANES
    14481449  Pel piBlendedValueU;
    14491450  Pel piBlendedValueV;
     
    14531454    pcInSample ->aiY[iSubSourcePos],
    14541455    pcOutSample->iYRight,   
    1455 #if HHI_VSO_COLOR_PLANES
     1456#if H_3D_VSO_COLOR_PLANES
    14561457    pcInSample ->aiU[iSubSourcePos],
    14571458    pcOutSample->iURight,   
     
    14641465    pcOutSample->iFilledRight  ,
    14651466    piBlendedValueY
    1466 #if HHI_VSO_COLOR_PLANES
     1467#if H_3D_VSO_COLOR_PLANES
    14671468    , piBlendedValueU,
    14681469    piBlendedValueV
     
    14761477    pcOutSample->iYLeft      = pcInSample ->aiY[iSubSourcePos];
    14771478    pcOutSample->iYBlended   = piBlendedValueY;   
    1478 #if HHI_VSO_COLOR_PLANES 
     1479#if H_3D_VSO_COLOR_PLANES 
    14791480    pcOutSample->iULeft      = pcInSample ->aiU[iSubSourcePos];
    14801481    pcOutSample->iUBlended   = piBlendedValueU;   
     
    14861487    // Get Error
    14871488    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
    1488 #if HHI_VSO_COLOR_PLANES
     1489#if H_3D_VSO_COLOR_PLANES
    14891490    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
    14901491    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
     
    14971498  {
    14981499    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
    1499 #if HHI_VSO_COLOR_PLANES
     1500#if H_3D_VSO_COLOR_PLANES
    15001501    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
    15011502    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
     
    15431544    // Yuv
    15441545    pcOutSample->iYRight  = pcInSample->aiY[iSubSourcePos];
    1545 #if HHI_VSO_COLOR_PLANES
     1546#if H_3D_VSO_COLOR_PLANES
    15461547    pcOutSample->iURight  = pcInSample->aiU[iSubSourcePos];
    15471548    pcOutSample->iVRight  = pcInSample->aiV[iSubSourcePos];
     
    15591560  else
    15601561  {
    1561 #if HHI_VSO_COLOR_PLANES
     1562#if H_3D_VSO_COLOR_PLANES
    15621563    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef,
    15631564      pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef,
     
    15761577{
    15771578  Pel piBlendedValueY;
    1578 #if HHI_VSO_COLOR_PLANES
     1579#if H_3D_VSO_COLOR_PLANES
    15791580  Pel piBlendedValueU;
    15801581  Pel piBlendedValueV;
     
    15841585    pcOutSample->iYLeft,
    15851586    pcInSample ->aiY[iSubSourcePos],       
    1586 #if HHI_VSO_COLOR_PLANES
     1587#if H_3D_VSO_COLOR_PLANES
    15871588    pcOutSample->iULeft,   
    15881589    pcInSample ->aiU[iSubSourcePos],
     
    15951596    iFilled,
    15961597    piBlendedValueY
    1597 #if HHI_VSO_COLOR_PLANES
     1598#if H_3D_VSO_COLOR_PLANES
    15981599    , piBlendedValueU,
    15991600    piBlendedValueV
     
    16071608    pcOutSample->iYRight     = pcInSample ->aiY[iSubSourcePos];
    16081609    pcOutSample->iYBlended   = piBlendedValueY;   
    1609 #if HHI_VSO_COLOR_PLANES 
     1610#if H_3D_VSO_COLOR_PLANES 
    16101611    pcOutSample->iURight     = pcInSample ->aiU[iSubSourcePos];
    16111612    pcOutSample->iUBlended   = piBlendedValueU;   
     
    16171618    // Get Error
    16181619    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
    1619 #if HHI_VSO_COLOR_PLANES
     1620#if H_3D_VSO_COLOR_PLANES
    16201621    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
    16211622    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
     
    16281629  {
    16291630    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
    1630 #if HHI_VSO_COLOR_PLANES
     1631#if H_3D_VSO_COLOR_PLANES
    16311632    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
    16321633    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
     
    16801681
    16811682
    1682 #if HHI_VSO_COLOR_PLANES
     1683#if H_3D_VSO_COLOR_PLANES
    16831684template <BlenMod iBM, Bool bBitInc>  __inline Void
    16841685TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
     
    16951696    if (iBM == BLEND_LEFT )
    16961697    {
    1697 #if HHI_VSO_COLOR_PLANES
     1698#if H_3D_VSO_COLOR_PLANES
    16981699      xGetBlendedValueBM1(  iYL,  iYR,  iUL,  iUR,  iVL,  iVR,  iDepthL,  iDepthR,  iFilledL,  iFilledR,  riY,  riU, riV );
    16991700#else
     
    17031704    else
    17041705    {
    1705 #if HHI_VSO_COLOR_PLANES
     1706#if H_3D_VSO_COLOR_PLANES
    17061707      xGetBlendedValueBM2(  iYL,  iYR,  iUL,  iUR,  iVL,  iVR,  iDepthL,  iDepthR,  iFilledL,  iFilledR,  riY,  riU, riV );
    17071708#else
     
    17211722      {
    17221723        riY = xBlend( iYL, iYR, iFilledR >> 1 );
    1723 #if HHI_VSO_COLOR_PLANES
     1724#if H_3D_VSO_COLOR_PLANES
    17241725        riU = xBlend( iUL, iUR, iFilledR >> 1 );
    17251726        riV = xBlend( iVL, iVR, iFilledR >> 1 );
     
    17301731      {
    17311732        riY = xBlend( iYR, iYL, (iFilledL >> 1) );
    1732 #if HHI_VSO_COLOR_PLANES
     1733#if H_3D_VSO_COLOR_PLANES
    17331734        riU = xBlend( iUR, iUL, (iFilledL >> 1) );
    17341735        riV = xBlend( iVR, iVL, (iFilledL >> 1) );
     
    17381739      {
    17391740        riY = xBlend( iYL, iYR, m_iBlendDistWeight );
    1740 #if HHI_VSO_COLOR_PLANES   
     1741#if H_3D_VSO_COLOR_PLANES   
    17411742        riU = xBlend( iUL, iUR, m_iBlendDistWeight );
    17421743        riV = xBlend( iVL, iVR, m_iBlendDistWeight );
     
    17471748    {
    17481749      riY = iYL;
    1749 #if HHI_VSO_COLOR_PLANES
     1750#if H_3D_VSO_COLOR_PLANES
    17501751      riU = iUL;
    17511752      riV = iVL;
     
    17551756    {
    17561757      riY = iYR;
    1757 #if HHI_VSO_COLOR_PLANES
     1758#if H_3D_VSO_COLOR_PLANES
    17581759      riU = iUR;
    17591760      riV = iVR;
     
    17661767    {
    17671768        riY =  iYR;
    1768 #if HHI_VSO_COLOR_PLANES
     1769#if H_3D_VSO_COLOR_PLANES
    17691770        riU =  iUR;
    17701771        riV =  iVR;
     
    17741775    {
    17751776        riY =  iYL;
    1776 #if HHI_VSO_COLOR_PLANES
     1777#if H_3D_VSO_COLOR_PLANES
    17771778        riU =  iUL;
    17781779        riV =  iVL;
     
    17851786    {
    17861787        riY = iYL;
    1787 #if HHI_VSO_COLOR_PLANES
     1788#if H_3D_VSO_COLOR_PLANES
    17881789        riU = iUL;
    17891790        riV = iVL;
     
    17931794    {
    17941795      riY = iYR;
    1795 #if HHI_VSO_COLOR_PLANES
     1796#if H_3D_VSO_COLOR_PLANES
    17961797      riU = iUR;
    17971798      riV = iVR;
     
    18021803
    18031804template <BlenMod iBM, Bool bBitInc> __inline Void
    1804 #if HHI_VSO_COLOR_PLANES
     1805#if H_3D_VSO_COLOR_PLANES
    18051806TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
    18061807#else
     
    18111812  {
    18121813    riY = iYL;
    1813 #if HHI_VSO_COLOR_PLANES
     1814#if H_3D_VSO_COLOR_PLANES
    18141815    riU = iUL;
    18151816    riV = iVL;
     
    18191820  {
    18201821    riY = iYR;
    1821 #if HHI_VSO_COLOR_PLANES
     1822#if H_3D_VSO_COLOR_PLANES
    18221823    riU = iUR;
    18231824    riV = iVR;
     
    18271828  {
    18281829    riY = xBlend( iYR, iYL, iFilledL );
    1829 #if HHI_VSO_COLOR_PLANES
     1830#if H_3D_VSO_COLOR_PLANES
    18301831    riU = xBlend( iUR, iUL, iFilledL );
    18311832    riV = xBlend( iVR, iUL, iFilledL );
     
    18351836
    18361837template <BlenMod iBM, Bool bBitInc> __inline Void
    1837 #if HHI_VSO_COLOR_PLANES
     1838#if H_3D_VSO_COLOR_PLANES
    18381839TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
    18391840#else
     
    18441845  {
    18451846    riY = iYR;
    1846 #if HHI_VSO_COLOR_PLANES
     1847#if H_3D_VSO_COLOR_PLANES
    18471848    riU = iUR;
    18481849    riV = iVR;
     
    18521853  {
    18531854    riY = iYL;
    1854 #if HHI_VSO_COLOR_PLANES
     1855#if H_3D_VSO_COLOR_PLANES
    18551856    riU = iUL;
    18561857    riV = iVL;
     
    18601861  {
    18611862    riY = xBlend( iYL, iYR, iFilledR );
    1862 #if HHI_VSO_COLOR_PLANES
     1863#if H_3D_VSO_COLOR_PLANES
    18631864    riU = xBlend( iUL, iUR, iFilledR );
    18641865    riV = xBlend( iVL, iUR, iFilledR );
     
    18911892template class TRenSingleModelC<BLEND_RIGHT,false>;
    18921893
    1893 #ifdef LGE_VSO_EARLY_SKIP_A0093
     1894#if H_3D_VSO_EARLY_SKIP
    18941895template <BlenMod iBM, Bool bBitInc>
    18951896__inline Bool
     
    19571958}
    19581959#endif
    1959 #endif
    1960 
     1960#endif // H_3D
     1961
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenSingleModel.h

    r438 r446  
    3232 */
    3333
    34 #if !QC_MVHEVC_B0046
     34
    3535#ifndef __TRENSINGLEMODEL__
    3636#define __TRENSINGLEMODEL__
     
    5151#include <cstring>
    5252
    53 
     53#if H_3D_VSO
    5454using namespace std;
    5555
    56 
    57 #if HHI_VSO_RM_ASSERTIONS
     56#if H_3D_VSO_RM_ASSERTIONS
    5857#define RM_AOT( exp ) AOT ( exp )
    5958#define RM_AOF( exp ) AOF ( exp )
     
    7069
    7170  virtual ~TRenSingleModel() { } 
    72 #if LGE_VSO_EARLY_SKIP_A0093
     71#if H_3D_VSO_EARLY_SKIP
    7372  virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) = 0;
    7473#else
     
    8281
    8382  // Set Data
    84 #ifdef LGE_VSO_EARLY_SKIP_A0093
     83#if H_3D_VSO_EARLY_SKIP
    8584  virtual Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride )  = 0;
    8685#else
     
    9089
    9190  // Get Distortion
    92 #ifdef LGE_VSO_EARLY_SKIP_A0093
     91#if H_3D_VSO_EARLY_SKIP
    9392  virtual RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride)=0;
    9493#else
     
    109108    // video
    110109    Pel aiY[5]    ; // y-value
    111 #if HHI_VSO_COLOR_PLANES
     110#if H_3D_VSO_COLOR_PLANES
    112111    Pel aiU[5]    ; // u-value
    113112    Pel aiV[5]    ; // v-value
     
    126125    Pel iYRight   ;
    127126    Pel iYBlended ;
    128 #if HHI_VSO_COLOR_PLANES
     127#if H_3D_VSO_COLOR_PLANES
    129128    Pel iULeft    ;
    130129    Pel iURight   ;
     
    148147    // reference
    149148    Pel iYRef    ;
    150 #if HHI_VSO_COLOR_PLANES
     149#if H_3D_VSO_COLOR_PLANES
    151150    Pel iURef    ;
    152151    Pel iVRef    ;
     
    161160
    162161  // Create Model
    163 #if LGE_VSO_EARLY_SKIP_A0093
     162#if H_3D_VSO_EARLY_SKIP
    164163  Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip  );
    165164#else
     
    172171  Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference );
    173172
    174 #if LGE_VSO_EARLY_SKIP_A0093
     173#if H_3D_VSO_EARLY_SKIP
    175174  Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride );
    176175#else
     
    180179
    181180  // Get Distortion
    182 #ifdef LGE_VSO_EARLY_SKIP_A0093
     181#if H_3D_VSO_EARLY_SKIP
    183182  RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride);
    184183#else
     
    198197  /////  Rendering /////
    199198  // Left to Right
    200 #if LGE_VSO_EARLY_SKIP_A0093
     199#if H_3D_VSO_EARLY_SKIP
    201200                      __inline Bool   xDetectEarlySkipL   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride );
    202201                      __inline Bool   xDetectEarlySkipR   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride );
     
    229228  template<Bool bSet> __inline Void   xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
    230229
    231 #if HHI_VSO_COLOR_PLANES
     230#if H_3D_VSO_COLOR_PLANES
    232231  __inline Void   xGetBlendedValue    ( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV );
    233232  __inline Void   xGetBlendedValueBM1 ( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV );
     
    260259  __inline Void   xSetInts   ( Int*  piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal );
    261260
    262 #if HHI_VSO_COLOR_PLANES
     261#if H_3D_VSO_COLOR_PLANES
    263262  Void            xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV );
    264263#else 
     
    367366  Int   m_iShiftPrec;
    368367  Int   m_iHoleMargin;
    369 #ifdef LGE_VSO_EARLY_SKIP_A0093
     368#if H_3D_VSO_EARLY_SKIP
    370369  Bool  m_bEarlySkip;
    371370#endif
     
    385384
    386385  //// Early Skip
    387 #ifdef LGE_VSO_EARLY_SKIP_A0093
     386#if H_3D_VSO_EARLY_SKIP
    388387  Bool* m_pbHorSkip;
    389388#endif
    390389};
    391390
     391#endif // H_3D
    392392#endif //__TRENSINGLEMODEL__
    393 #endif
    394 
     393
     394
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenTop.cpp

    r438 r446  
    3232 */
    3333
     34
    3435#include "TRenImage.h"
    3536#include "TRenTop.h"
     
    3940#include <math.h>
    4041#include "../TLibCommon/CommonDef.h"
     42#if H_3D
     43
    4144
    4245Void TRenTop::xGetDataPointers( PelImage*& rpcInputImage, PelImage*& rpcOutputImage, PelImage*& rpcInputDepth, PelImage*& rpcOutputDepth, PelImage*& rpcFilled, Bool bRenderDepth )
     
    15881591Void TRenTop::xEnhSimilarityPlane       ( PelImagePlane** apcLeftPlane, PelImagePlane** apcRightPlane, PelImagePlane* pcFilledLeftPlane, PelImagePlane* pcFilledRightPlane, UInt uiNumberOfPlanes )
    15891592{
     1593  AOF( g_bitDepthC == g_bitDepthY );
    15901594  AOT( m_iSimEnhBaseView != 1 && m_iSimEnhBaseView != 2 );
    15911595  Int iWidth  = (*apcRightPlane)->getWidth ();
    15921596  Int iHeight = (*apcRightPlane)->getHeight();
    15931597
    1594   Int* aiHistLeft  = new Int[ g_uiIBDI_MAX + 1 ];
    1595   Int* aiHistRight = new Int[ g_uiIBDI_MAX + 1 ];
    1596   Pel* aiConvLUT   = new Pel[ g_uiIBDI_MAX + 1 ];
     1598  Int* aiHistLeft  = new Int[ ((Int64)1 ) << g_bitDepthY ];
     1599  Int* aiHistRight = new Int[ ((Int64)1 ) << g_bitDepthY ];
     1600  Pel* aiConvLUT   = new Pel[ ((Int64)1 ) << g_bitDepthY ];
    15971601
    15981602  for (UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++ )
    15991603  {
    1600     for (Int iCurVal = 0 ; iCurVal <= g_uiIBDI_MAX; iCurVal++)
     1604    for (Int iCurVal = 0 ; iCurVal < ( 1 << g_bitDepthY ); iCurVal++)
    16011605    {
    16021606      aiHistLeft [iCurVal] = 0;
     
    16451649    Int iCheckSumRight = 0;
    16461650
    1647     for (Int iCurVal = 0 ; iCurVal <= g_uiIBDI_MAX; iCurVal++)
     1651    for (Int iCurVal = 0 ; iCurVal < ( 1 << g_bitDepthY ); iCurVal++)
    16481652    {
    16491653      iCheckSumLeft  += aiHistLeft [iCurVal];
     
    16521656
    16531657
    1654     while( iCurChangeVal <= g_uiIBDI_MAX )
     1658    while( iCurChangeVal < ( 1 << g_bitDepthY ) )
    16551659    {
    16561660      if ( iCumSumBase == iCumSumChange )
    16571661      {
    1658         aiConvLUT[iCurChangeVal] = Min(iCurBaseVal, g_uiIBDI_MAX);
     1662        aiConvLUT[iCurChangeVal] = std::min( iCurBaseVal,  ( 1 << g_bitDepthY ) - 1 );
    16591663        iCurBaseVal  ++;
    16601664        iCurChangeVal++;
    16611665        iCumSumChange += aiHistChange[iCurChangeVal];
    1662         if (iCurBaseVal <= g_uiIBDI_MAX )
     1666        if (iCurBaseVal <  ( 1 << g_bitDepthY ) )
    16631667        {
    16641668          iCumSumBase   += aiHistBase  [iCurBaseVal]  ;
     
    16681672      {
    16691673        iCurBaseVal++;
    1670         if (iCurBaseVal <= g_uiIBDI_MAX )
     1674        if (iCurBaseVal < ( 1 << g_bitDepthY ) )
    16711675        {
    16721676          iCumSumBase   += aiHistBase  [iCurBaseVal]  ;
     
    16751679      else if ( iCumSumBase > iCumSumChange)
    16761680      {
    1677         aiConvLUT[iCurChangeVal] = Min(iCurBaseVal, g_uiIBDI_MAX);
     1681        aiConvLUT[iCurChangeVal] = std::min(iCurBaseVal, ( 1 << g_bitDepthY )-1);
    16781682        iCurChangeVal++;
    16791683        iCumSumChange += aiHistChange  [iCurChangeVal]  ;
     
    18841888Void TRenTop::temporalFilterVSRS( TComPicYuv* pcPicYuvVideoCur, TComPicYuv* pcPicYuvDepthCur, TComPicYuv* pcPicYuvVideoLast, TComPicYuv* pcPicYuvDepthLast, Bool bFirstFrame )
    18851889{
     1890  AOF( g_bitDepthY == g_bitDepthC );
    18861891  Int iSADThres  = 100 ;  //threshold of sad in 4*4 block motion detection
    18871892
     
    19501955            { //Weight: 0.75
    19511956              Int iFilt = (( (pcDepthLastDataBlk[iCurPosX] << 1 ) + pcDepthLastDataBlk[iCurPosX] + pcDepthCurDataBlk[iCurPosX] + 2 ) >> 2 );
    1952               assert( (iFilt >= 0) && (iFilt <=  g_uiIBDI_MAX) );
     1957              assert( (iFilt >= 0) && (iFilt <  ( 1 << g_bitDepthY ) ) );
    19531958              pcDepthCurDataBlk[iCurPosX] = pcDepthLastDataBlk[iCurPosX];
    19541959              pcDepthCurDataBlk[iCurPosX] = iFilt;
     
    22212226  if(m_aiBlkMoving         != NULL ) delete[] m_aiBlkMoving;
    22222227}
     2228#endif // H_3D
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibRenderer/TRenTop.h

    r438 r446  
    3838#include "../TLibCommon/CommonDef.h"
    3939#include "../TLibCommon/TComPicYuv.h"
     40
     41#if H_3D
    4042#include <list>
    4143#include <vector>
     
    268270};
    269271
     272#endif // H_3D
    270273#endif //__TRENTOP__
Note: See TracChangeset for help on using the changeset viewer.