Changeset 28 in 3DVCSoftware


Ignore:
Timestamp:
24 Feb 2012, 20:22:58 (12 years ago)
Author:
poznan-univ
Message:

Poznan Tools

  • Encoding only disoccluded CUs in depended views
  • Depth based motion prediction
  • Texture QP adjustment based on depth data
  • Nonlinear depth representation
Location:
branches/0.3-poznan-univ
Files:
2 added
69 edited

Legend:

Unmodified
Added
Removed
  • branches/0.3-poznan-univ/CommonTestConditionsCfgs/baseCfg_2view+depth.cfg

    r18 r28  
    9797ALF                       : 1                                      # use adaptive loop filter
    9898ALFEncodePassReduction    : 0                                      # ALF encoding (0:original 16-pass, 1:one-pass, 2:two-pass)
    99 
     99DBMP                      : 1                                      # use depth base motion prediction
     100CUSkip                    : 1                                      # encode only disoccluded CUs in dependend views
     101TDdQP                     : 1                                      # texture TU blocks QP param modification according to depth map's values
    100102
    101103#========== multiview coding tools ==========
     
    113115VSO                       : 1                                      # use of view synthesis optimization for depth coding
    114116MVI                       : 1                                      # motion parameter inheritance
    115 
     117DepthPower                : -1                                     # nonlinear depth representation
    116118
    117119#========== view synthesis optimization (VSO) ==========
  • branches/0.3-poznan-univ/CommonTestConditionsCfgs/baseCfg_3view+depth.cfg

    r18 r28  
    101101ALF                       : 1                                      # use adaptive loop filter
    102102ALFEncodePassReduction    : 0                                      # ALF encoding (0:original 16-pass, 1:one-pass, 2:two-pass)
    103 
     103DBMP                      : 1                                      # use depth base motion prediction
     104CUSkip                    : 1                                      # encode only disoccluded CUs in dependend views
     105TDdQP                     : 1                                      # texture TU blocks QP param modification according to depth map's values
    104106
    105107#========== multiview coding tools ==========
     
    117119VSO                       : 1                                      # use of view synthesis optimization for depth coding
    118120MVI                       : 1                                      # motion parameter inheritance
    119 
     121DepthPower                : -1                                     # nonlinear depth representation
    120122
    121123#========== view synthesis optimization (VSO) ==========
     
    123125                                                                   # VSO configuration string
    124126
     127
     128
  • branches/0.3-poznan-univ/build/HM_vc10.sln

    r2 r28  
    33# Visual Studio 2010
    44Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppDecoder", "vc10\TAppDecoder_vc10.vcxproj", "{A7A515D9-E917-4706-BD5B-57DC6C78D612}"
     5        ProjectSection(ProjectDependencies) = postProject
     6                {2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4} = {2B298BE6-DFF0-4BD2-8F26-395FFE7F9EB4}
     7        EndProjectSection
    58EndProject
    69Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppEncoder", "vc10\TAppEncoder_vc10.vcxproj", "{D759E4E1-D33A-4483-B57B-0FD248E022FE}"
  • branches/0.3-poznan-univ/build/HM_vc8.sln

    r2 r28  
    55        ProjectSection(ProjectDependencies) = postProject
    66                {8783AD3A-A5CA-42B7-AAC4-A07EB845A684} = {8783AD3A-A5CA-42B7-AAC4-A07EB845A684}
     7                {5E87AD84-AC4F-4336-B4EE-549CA210EE4A} = {5E87AD84-AC4F-4336-B4EE-549CA210EE4A}
     8                {78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
     9                {F8B77A48-AF6C-4746-A89F-B706ABA6AD94} = {F8B77A48-AF6C-4746-A89F-B706ABA6AD94}
    710                {5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
    8                 {F8B77A48-AF6C-4746-A89F-B706ABA6AD94} = {F8B77A48-AF6C-4746-A89F-B706ABA6AD94}
    9                 {78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
    1011        EndProjectSection
    1112EndProject
    1213Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppEncoder", "vc8\TAppEncoder_vc8.vcproj", "{D759E4E1-D33A-4483-B57B-0FD248E022FE}"
    1314        ProjectSection(ProjectDependencies) = postProject
     15                {8783AD3A-A5CA-42B7-AAC4-A07EB845A684} = {8783AD3A-A5CA-42B7-AAC4-A07EB845A684}
     16                {78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
     17                {47E90995-1FC5-4EE4-A94D-AD474169F0E1} = {47E90995-1FC5-4EE4-A94D-AD474169F0E1}
     18                {5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
    1419                {5E87AD84-AC4F-4336-B4EE-549CA210EE4A} = {5E87AD84-AC4F-4336-B4EE-549CA210EE4A}
    15                 {5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
    16                 {47E90995-1FC5-4EE4-A94D-AD474169F0E1} = {47E90995-1FC5-4EE4-A94D-AD474169F0E1}
    17                 {78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
    18                 {8783AD3A-A5CA-42B7-AAC4-A07EB845A684} = {8783AD3A-A5CA-42B7-AAC4-A07EB845A684}
    1920        EndProjectSection
    2021EndProject
     
    3132Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TAppRenderer", "vc8\TAppRenderer_vc8.vcproj", "{CE149235-A923-4BA7-B552-3A02287CD3E4}"
    3233        ProjectSection(ProjectDependencies) = postProject
     34                {8783AD3A-A5CA-42B7-AAC4-A07EB845A684} = {8783AD3A-A5CA-42B7-AAC4-A07EB845A684}
     35                {5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
     36                {78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
    3337                {5E87AD84-AC4F-4336-B4EE-549CA210EE4A} = {5E87AD84-AC4F-4336-B4EE-549CA210EE4A}
    34                 {78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
    35                 {5280C25A-D316-4BE7-AE50-29D72108624F} = {5280C25A-D316-4BE7-AE50-29D72108624F}
    36                 {8783AD3A-A5CA-42B7-AAC4-A07EB845A684} = {8783AD3A-A5CA-42B7-AAC4-A07EB845A684}
    3738        EndProjectSection
    3839EndProject
  • branches/0.3-poznan-univ/build/HM_vc9.sln

    r2 r28  
    88                {78018D78-F890-47E3-A0B7-09D273F0B11D} = {78018D78-F890-47E3-A0B7-09D273F0B11D}
    99                {D1E8A1C2-15DB-4C94-80E8-4F70CF0A2DC5} = {D1E8A1C2-15DB-4C94-80E8-4F70CF0A2DC5}
     10                {457993C6-AE2C-4B9B-B5F9-71033279A0B9} = {457993C6-AE2C-4B9B-B5F9-71033279A0B9}
    1011        EndProjectSection
    1112EndProject
  • branches/0.3-poznan-univ/build/linux/common/makefile.base

    r2 r28  
    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) -I$(CURDIR)/$(INC_DIR) $(USER_INC_DIRS) -Wall -Wshadow -Wno-sign-compare
    5050
    5151##########
  • branches/0.3-poznan-univ/build/linux/lib/TLibCommon/makefile

    r2 r28  
    4242                        $(OBJ_DIR)/TComLoopFilter.o \
    4343                        $(OBJ_DIR)/TComMotionInfo.o \
     44            $(OBJ_DIR)/TComMP.o \
    4445                        $(OBJ_DIR)/TComPattern.o \
    4546                        $(OBJ_DIR)/TComPic.o \
  • branches/0.3-poznan-univ/build/linux/test/TAppDecoder/makefile

    r2 r28  
    4141
    4242
    43 DYN_DEBUG_LIBS          = -lTLibDecoderd -lTLibCommond -lTLibVideoIOd -lTAppCommond
    44 DYN_DEBUG_PREREQS               = $(LIB_DIR)/libTLibDecoderd.a $(LIB_DIR)/libTLibCommond.a $(LIB_DIR)/libTLibVideoIOd.a $(LIB_DIR)/libTAppCommond.a
    45 STAT_DEBUG_LIBS         = -lTLibDecoderStaticd -lTLibCommonStaticd -lTLibVideoIOStaticd -lTAppCommonStaticd
    46 STAT_DEBUG_PREREQS              = $(LIB_DIR)/libTLibDecoderStaticd.a $(LIB_DIR)/libTLibCommonStaticd.a $(LIB_DIR)/libTLibVideoIOStaticd.a $(LIB_DIR)/libTAppCommonStaticd.a
     43DYN_DEBUG_LIBS          = -lTLibDecoderd -lTLibCommond -lTLibVideoIOd -lTAppCommond -lTLibRendererd
     44DYN_DEBUG_PREREQS       = $(LIB_DIR)/libTLibDecoderd.a $(LIB_DIR)/libTLibCommond.a $(LIB_DIR)/libTLibVideoIOd.a $(LIB_DIR)/libTAppCommond.a $(LIB_DIR)/libTLibRendererd.a
     45STAT_DEBUG_LIBS         = -lTLibDecoderStaticd -lTLibCommonStaticd -lTLibVideoIOStaticd -lTAppCommonStaticd -lTLibRendererStaticd
     46STAT_DEBUG_PREREQS      = $(LIB_DIR)/libTLibDecoderStaticd.a $(LIB_DIR)/libTLibCommonStaticd.a $(LIB_DIR)/libTLibVideoIOStaticd.a $(LIB_DIR)/libTAppCommonStaticd.a $(LIB_DIR)/libTLibRendererStaticd.a
    4747
    48 DYN_RELEASE_LIBS        = -lTLibDecoder -lTLibCommon -lTLibVideoIO -lTAppCommon
    49 DYN_RELEASE_PREREQS     = $(LIB_DIR)/libTLibDecoder.a $(LIB_DIR)/libTLibCommon.a $(LIB_DIR)/libTLibVideoIO.a $(LIB_DIR)/libTAppCommon.a
    50 STAT_RELEASE_LIBS       = -lTLibDecoderStatic -lTLibCommonStatic -lTLibVideoIOStatic -lTAppCommonStatic
    51 STAT_RELEASE_PREREQS    = $(LIB_DIR)/libTLibDecoderStatic.a $(LIB_DIR)/libTLibCommonStatic.a $(LIB_DIR)/libTLibVideoIOStatic.a $(LIB_DIR)/libTAppCommonStatic.a
     48DYN_RELEASE_LIBS        = -lTLibDecoder -lTLibCommon -lTLibVideoIO -lTAppCommon -lTLibRenderer
     49DYN_RELEASE_PREREQS     = $(LIB_DIR)/libTLibDecoder.a $(LIB_DIR)/libTLibCommon.a $(LIB_DIR)/libTLibVideoIO.a $(LIB_DIR)/libTAppCommon.a $(LIB_DIR)/libTLibRenderer.a
     50STAT_RELEASE_LIBS       = -lTLibDecoderStatic -lTLibCommonStatic -lTLibVideoIOStatic -lTAppCommonStatic -lTLibRendererStatic
     51STAT_RELEASE_PREREQS    = $(LIB_DIR)/libTLibDecoderStatic.a $(LIB_DIR)/libTLibCommonStatic.a $(LIB_DIR)/libTLibVideoIOStatic.a $(LIB_DIR)/libTAppCommonStatic.a $(LIB_DIR)/libTLibRendererStatic.a
    5252
    5353
  • branches/0.3-poznan-univ/build/vc10/TAppDecoder_vc10.vcxproj

    r2 r28  
    190190      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    191191    </ProjectReference>
     192    <ProjectReference Include="TLibRenderer_vc10.vcxproj">
     193      <Project>{2b298be6-dff0-4bd2-8f26-395ffe7f9eb4}</Project>
     194      <Private>true</Private>
     195      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     196      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
     197      <LinkLibraryDependencies>true</LinkLibraryDependencies>
     198      <UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
     199    </ProjectReference>
    192200  </ItemGroup>
    193201  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  • branches/0.3-poznan-univ/build/vc10/TLibCommon_vc10.vcxproj

    r2 r28  
    152152    <ClCompile Include="..\..\source\Lib\TLibCommon\TComLoopFilter.cpp" />
    153153    <ClCompile Include="..\..\source\Lib\TLibCommon\TComMotionInfo.cpp" />
     154    <ClCompile Include="..\..\source\Lib\TLibCommon\TComMP.cpp" />
    154155    <ClCompile Include="..\..\source\Lib\TLibCommon\TComMVDRefData.cpp" />
    155156    <ClCompile Include="..\..\source\Lib\TLibCommon\TComPattern.cpp" />
     
    187188    <ClInclude Include="..\..\source\Lib\TLibCommon\TComLoopFilter.h" />
    188189    <ClInclude Include="..\..\source\Lib\TLibCommon\TComMotionInfo.h" />
     190    <ClInclude Include="..\..\source\Lib\TLibCommon\TComMP.h" />
    189191    <ClInclude Include="..\..\source\Lib\TLibCommon\TComMv.h" />
    190192    <ClInclude Include="..\..\source\Lib\TLibCommon\TComMVDRefData.h" />
  • branches/0.3-poznan-univ/build/vc10/TLibCommon_vc10.vcxproj.filters

    r2 r28  
    9090      <Filter>Source Files</Filter>
    9191    </ClCompile>
    92     <ClCompile Include="..\..\source\Lib\TLibCommon\TComWeightPrediction.cpp.cpp">
     92    <ClCompile Include="..\..\source\Lib\TLibCommon\TComWeightPrediction.cpp">
     93      <Filter>Source Files</Filter>
     94    </ClCompile>
     95    <ClCompile Include="..\..\source\Lib\TLibCommon\TComMP.cpp">
    9396      <Filter>Source Files</Filter>
    9497    </ClCompile>
     
    197200      <Filter>Header Files</Filter>
    198201    </ClInclude>
     202    <ClInclude Include="..\..\source\Lib\TLibCommon\TComMP.h">
     203      <Filter>Header Files</Filter>
     204    </ClInclude>
    199205  </ItemGroup>
    200206</Project>
  • branches/0.3-poznan-univ/build/vc8/TLibCommon_vc8.vcproj

    r2 r28  
    8181                </Configuration>
    8282                <Configuration
     83                        Name="Debug|x64"
     84                        OutputDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
     85                        IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
     86                        ConfigurationType="4"
     87                        CharacterSet="2"
     88                        >
     89                        <Tool
     90                                Name="VCPreBuildEventTool"
     91                        />
     92                        <Tool
     93                                Name="VCCustomBuildTool"
     94                        />
     95                        <Tool
     96                                Name="VCXMLDataGeneratorTool"
     97                        />
     98                        <Tool
     99                                Name="VCWebServiceProxyGeneratorTool"
     100                        />
     101                        <Tool
     102                                Name="VCMIDLTool"
     103                                TargetEnvironment="3"
     104                        />
     105                        <Tool
     106                                Name="VCCLCompilerTool"
     107                                Optimization="0"
     108                                AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
     109                                PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
     110                                MinimalRebuild="true"
     111                                BasicRuntimeChecks="3"
     112                                RuntimeLibrary="1"
     113                                WarningLevel="3"
     114                                DebugInformationFormat="3"
     115                        />
     116                        <Tool
     117                                Name="VCManagedResourceCompilerTool"
     118                        />
     119                        <Tool
     120                                Name="VCResourceCompilerTool"
     121                        />
     122                        <Tool
     123                                Name="VCPreLinkEventTool"
     124                        />
     125                        <Tool
     126                                Name="VCLibrarianTool"
     127                        />
     128                        <Tool
     129                                Name="VCALinkTool"
     130                        />
     131                        <Tool
     132                                Name="VCXDCMakeTool"
     133                        />
     134                        <Tool
     135                                Name="VCBscMakeTool"
     136                        />
     137                        <Tool
     138                                Name="VCFxCopTool"
     139                        />
     140                        <Tool
     141                                Name="VCPostBuildEventTool"
     142                        />
     143                </Configuration>
     144                <Configuration
    83145                        Name="Release|Win32"
    84146                        OutputDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
     
    145207                </Configuration>
    146208                <Configuration
    147                         Name="Debug|x64"
    148                         OutputDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
    149                         IntermediateDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
    150                         ConfigurationType="4"
    151                         CharacterSet="2"
    152                         >
    153                         <Tool
    154                                 Name="VCPreBuildEventTool"
    155                         />
    156                         <Tool
    157                                 Name="VCCustomBuildTool"
    158                         />
    159                         <Tool
    160                                 Name="VCXMLDataGeneratorTool"
    161                         />
    162                         <Tool
    163                                 Name="VCWebServiceProxyGeneratorTool"
    164                         />
    165                         <Tool
    166                                 Name="VCMIDLTool"
    167                                 TargetEnvironment="3"
    168                         />
    169                         <Tool
    170                                 Name="VCCLCompilerTool"
    171                                 Optimization="0"
    172                                 PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
    173                                 AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
    174                                 MinimalRebuild="true"
    175                                 BasicRuntimeChecks="3"
    176                                 RuntimeLibrary="1"
    177                                 WarningLevel="3"
    178                                 DebugInformationFormat="3"
    179                         />
    180                         <Tool
    181                                 Name="VCManagedResourceCompilerTool"
    182                         />
    183                         <Tool
    184                                 Name="VCResourceCompilerTool"
    185                         />
    186                         <Tool
    187                                 Name="VCPreLinkEventTool"
    188                         />
    189                         <Tool
    190                                 Name="VCLibrarianTool"
    191                         />
    192                         <Tool
    193                                 Name="VCALinkTool"
    194                         />
    195                         <Tool
    196                                 Name="VCXDCMakeTool"
    197                         />
    198                         <Tool
    199                                 Name="VCBscMakeTool"
    200                         />
    201                         <Tool
    202                                 Name="VCFxCopTool"
    203                         />
    204                         <Tool
    205                                 Name="VCPostBuildEventTool"
    206                         />
    207                 </Configuration>
    208                 <Configuration
    209209                        Name="Release|x64"
    210210                        OutputDirectory="$(SolutionDir)\vc8\$(PlatformName)\$(ConfigurationName)\$(RootNamespace)"
     
    236236                                EnableIntrinsicFunctions="false"
    237237                                FavorSizeOrSpeed="1"
     238                                AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
    238239                                PreprocessorDefinitions="WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
    239                                 AdditionalIncludeDirectories="&quot;..\..\compat\msvc&quot;"
    240240                                StringPooling="true"
    241241                                RuntimeLibrary="0"
     
    321321                        </File>
    322322                        <File
     323                                RelativePath="..\..\source\Lib\TLibCommon\TComMP.cpp"
     324                                >
     325                        </File>
     326                        <File
    323327                                RelativePath="..\..\source\Lib\TLibCommon\TComMVDRefData.cpp"
    324328                                >
     
    459463                        </File>
    460464                        <File
     465                                RelativePath="..\..\source\Lib\TLibCommon\TComMP.h"
     466                                >
     467                        </File>
     468                        <File
    461469                                RelativePath="..\..\source\Lib\TLibCommon\TComMv.h"
    462470                                >
  • branches/0.3-poznan-univ/build/vc9/TLibCommon_vc9.vcproj

    r2 r28  
    324324                        </File>
    325325                        <File
     326                                RelativePath="..\..\source\Lib\TLibCommon\TComMP.cpp"
     327                                >
     328                        </File>
     329                        <File
    326330                                RelativePath="..\..\source\Lib\TLibCommon\TComMVDRefData.cpp"
    327331                                >
     
    462466                        </File>
    463467                        <File
     468                                RelativePath="..\..\source\Lib\TLibCommon\TComMP.h"
     469                                >
     470                        </File>
     471                        <File
    464472                                RelativePath="..\..\source\Lib\TLibCommon\TComMv.h"
    465473                                >
  • branches/0.3-poznan-univ/source/App/TAppCommon/TAppComCamPara.cpp

    r21 r28  
    7676
    7777      radLUT        [ uiSourceView ][ uiTargetView ]      = new Double*[ 2 ];
    78       radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];
    79       radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];
     78      radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ SizeOfLUT+1 ];
     79      radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ SizeOfLUT+1 ];
    8080
    8181      raiLUT        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
    82       raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
    83       raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
     82      raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ SizeOfLUT+1 ];
     83      raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ SizeOfLUT+1 ];
    8484    }
    8585  }
     
    877877      radShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = dOffset;
    878878
    879       for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
    880       {
     879#if POZNAN_NONLINEAR_DEPTH
     880      TComNonlinearDepthBackward cNonlinearDepthBwd(m_fDepthPower, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0);
     881#endif
     882
     883      for( UInt uiDepthValue = 0; uiDepthValue < SizeOfLUT; uiDepthValue++ )
     884      {
     885        Double  dDepthValue = (Double)uiDepthValue;
     886        Int64   iDepthValue = (Int64)uiDepthValue;
     887#if POZNAN_NONLINEAR_DEPTH
     888        dDepthValue = cNonlinearDepthBwd(dDepthValue);
     889        iDepthValue = (Int64)(dDepthValue+0.5);
     890#endif
     891#if POZNAN_LUT_INCREASED_PRECISION
     892        dDepthValue /= (1<<g_uiBitIncrement);
     893#endif
    881894        // real-valued look-up tables
    882         Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     895
     896        Double  dShiftLuma      = ( dDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
    883897        Double  dShiftChroma    = dShiftLuma / 2;
    884898        radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
     
    886900
    887901        // integer-valued look-up tables
    888         Int64   iTempScale      = (Int64)uiDepthValue * iScale;
     902        Int64   iTempScale      = iDepthValue * iScale;
     903#if POZNAN_LUT_INCREASED_PRECISION
     904        iTempScale >>= g_uiBitIncrement;
     905#endif
    889906        Int64   iTestScale      = ( iTempScale + iOffset       );   // for checking accuracy of camera parameters
    890907        Int64   iShiftLuma      = ( iTempScale + iOffsetLuma   ) >> iLog2DivLuma;
     
    899916      }
    900917
    901       radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
    902       radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
    903       raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
    904       raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     918      radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ SizeOfLUT ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ SizeOfLUT-1 ];
     919      radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ SizeOfLUT ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ SizeOfLUT-1 ];
     920      raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ SizeOfLUT ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ SizeOfLUT-1 ];
     921      raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ SizeOfLUT ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ SizeOfLUT-1 ];
    905922    }
    906923  }
     
    12351252                      Char*  pchSynthViewNumbers,
    12361253                      std::vector<Int>* paiSynthViewNumbers,
    1237                       Int    iLog2Precision )
     1254                      Int    iLog2Precision
     1255#if POZNAN_NONLINEAR_DEPTH
     1256                      ,Float fDepthPower
     1257#endif
     1258                      )
    12381259{
    12391260  //===== set miscellaneous variables =====
     
    12431264  m_uiCamParsCodedPrecision = uiCodedCamParsPrecision;
    12441265  m_iLog2Precision          = iLog2Precision;
     1266
     1267#if POZNAN_NONLINEAR_DEPTH
     1268  m_fDepthPower             = fDepthPower;
     1269#endif
    12451270
    12461271  xReadCameraParameterFile( pchCfgFileName );
     
    14601485}
    14611486
     1487#if POZNAN_SYNTH
     1488Bool
     1489TAppComCamPara::getNearestBaseView( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft)
     1490{
     1491  riNearestViewIdx = 0;
     1492
     1493  Bool bDecencdingVN = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] );
     1494  Int  iFactor       = ( bDecencdingVN ? -1 : 1 );
     1495
     1496  if( ( m_aiBaseId2SortedId[iSynthViewIdx] - m_aiBaseId2SortedId[riNearestViewIdx] ) * iFactor  <= 0 )
     1497  {
     1498    rbRenderFromLeft = true;
     1499  }
     1500  else
     1501  {
     1502    rbRenderFromLeft = false;
     1503  }
     1504
     1505  riRelDistToLeft = 128; //Not used for now;
     1506
     1507  return true;
     1508}
     1509#endif
     1510
     1511
     1512
    14621513Int TAppComCamPara::getRelDistLeft( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx )
    14631514{
     
    14741525  return xGetViewId(m_aiRelSynthViewsNum, iRelNum );
    14751526}
     1527
     1528
     1529#if POZNAN_MP
     1530Bool
     1531TAppComCamPara::isLeftView( Int iSynthViewIdx, Int iNearestViewIdx)
     1532{
     1533  Bool bDecencdingVN = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] );
     1534  Int  iFactor       = ( bDecencdingVN ? -1 : 1 );
     1535
     1536  if( ( m_aiBaseId2SortedId[iSynthViewIdx] - m_aiBaseId2SortedId[iNearestViewIdx] ) * iFactor  <= 0 ) return true;
     1537  else return false;
     1538}
     1539#endif
  • branches/0.3-poznan-univ/source/App/TAppCommon/TAppComCamPara.h

    r5 r28  
    104104  Int****             m_aiSynthViewShiftLUT;                                                                    ///< Disparity LUT
    105105
     106#if POZNAN_NONLINEAR_DEPTH
     107  Float               m_fDepthPower;
     108#endif
    106109
    107110protected:
     
    161164                Char*   pchSynthViewNumbers,
    162165                std::vector<Int>* paiSynthViewNumbers,
    163                 Int     iLog2Precision );
     166                Int     iLog2Precision
     167#if POZNAN_NONLINEAR_DEPTH
     168                ,Float  fDepthPower
     169#endif
     170                );
    164171
    165172  Void init   ( UInt    uiInputBitDepth,
     
    170177                std::vector<Int>* paiSynthViewNumbers,
    171178                Int     iLog2Precision
     179#if POZNAN_NONLINEAR_DEPTH
     180                ,Float  fDepthPower
     181#endif
    172182              );
    173183
     
    182192  Int                 synthRelNum2Idx           ( Int iRelNum );
    183193  Bool getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView );
     194#if POZNAN_SYNTH
     195  Bool getNearestBaseView( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft);
     196#endif
     197
    184198  Int                 getRelDistLeft            ( Int iSynthViewIdx, Int   iLeftViewIdx, Int iRightViewIdx );
    185199  UInt                getCurFrameId             ()  { return m_iCurrentFrameId;   }
    186200  static Void         convertNumberString       ( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec );
     201
     202#if POZNAN_MP
     203  Bool isLeftView( Int iSynthViewIdx, Int iNearestViewIdx);
     204#endif
    187205
    188206  // function for getting parameters and parameter arrays
  • branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.cpp

    r21 r28  
    6464//  m_iPOCLastDisplay  = -1;
    6565  m_pScaleOffsetFile  = 0;
     66
     67#if POZNAN_MP
     68  m_pcMP = NULL;
     69#endif
    6670}
    6771
     
    7175 
    7276  m_apcBitstream->create( BITS_BUF_SIZE );
     77
     78#if POZNAN_MP
     79  m_pcMP = new TComMP();
     80#endif
    7381}
    7482
     
    8997    free(m_pchReconFile);
    9098  }
     99
     100#if POZNAN_MP
     101  if(m_pcMP) { delete m_pcMP; m_pcMP = NULL; };
     102#endif
    91103}
    92104
     
    163175    if( eNalUnitType == NAL_UNIT_SPS )
    164176    {
     177#if POZNAN_SYNTH
     178      if(cComSPS.getViewId()==0 && !cComSPS.isDepth()) // it should be called at first view at the begining of the stream
     179        initRenderer(cComSPS);
     180#endif
    165181      if( cComSPS.isDepth() && (m_bUsingDepth==false) )  // expected not using depth, but bitstream are using depth
    166182      {                                                     // know from sps
     
    415431        if ( m_pchReconFile )
    416432        {
     433
     434#if POZNAN_NONLINEAR_DEPTH
     435          TComSPS* pcSPS = pcPic->getSlice(0)->getSPS();
     436          TComPicYuv cPicPower;
     437
     438          //pcPic->getPicYuvRec()
     439          cPicPower.create(pcSPS->getWidth(), pcSPS->getHeight(), pcSPS->getMaxCUWidth(), pcSPS->getMaxCUHeight(), pcSPS->getMaxCUDepth() );
     440
     441          pcPic->getPicYuvRec()->nonlinearDepthBackward(&cPicPower, pcSPS->getDepthPower());
     442
     443          m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write(&cPicPower, pcSPS->getPad());
     444          cPicPower.destroy();           
     445#else
    417446          m_acTVideoIOYuvDepthReconFileList[iViewIdx]->write( pcPic->getPicYuvRec(), pcPic->getSlice(0)->getSPS()->getPad() );
     447#endif
    418448        }
    419449
     
    542572  return pcRefPic;
    543573}
     574
     575#if POZNAN_SYNTH
     576Void TAppDecTop::initRenderer(TComSPS &cComSPS)
     577{
     578  m_cAvailabilityRenderer.init(cComSPS.getWidth(), cComSPS.getHeight(),true,0,LOG2_DISP_PREC_LUT,true, 0,0,0,0,0,6,4,1,0,6 );  //GT: simplest configuration
     579}
     580//*
     581Void TAppDecTop::storeSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx, Int iCurPoc, Bool bDepth)
     582{
     583  Int  iLeftViewIdx  = -1;
     584  Int  iRightViewIdx = -1;
     585  Int  iNearestViewIdx = -1;
     586  Bool bRenderFromLeft;
     587
     588  Int iRelDistToLeft = 128;
     589  if(iCoddedViewIdx==0) //First on View Coded List
     590  {
     591    //TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false );
     592    return;
     593  }
     594  iNearestViewIdx = 0;
     595  //bRenderFromLeft = iCoddedViewOrderIdx>0?true:false;
     596  //bRenderFromLeft = iCoddedViewOrderIdx<0?true:false;
     597  //m_cCamParsCollector.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft);
     598  bRenderFromLeft = iCoddedViewIdx>1?true:false;
     599
     600  m_cAvailabilityRenderer.setShiftLUTs(
     601    m_cCamParsCollector.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],
     602    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     603    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     604    m_cCamParsCollector.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right
     605    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     606    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     607    iRelDistToLeft
     608  );
     609
     610  TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, bDepth );
     611
     612  TComPicYuv* pcPicYuvSynthView = pcPic->getPicYuvSynth();
     613  TComPicYuv* pcPicYuvAvailView = pcPic->getPicYuvAvail();
     614  if(!pcPicYuvSynthView)
     615  {
     616    pcPic->addSynthesisBuffer();
     617    pcPicYuvSynthView = pcPic->getPicYuvSynth();
     618  }
     619  if(!pcPicYuvAvailView)
     620  {
     621    pcPic->addAvailabilityBuffer();
     622    pcPicYuvAvailView = pcPic->getPicYuvAvail();
     623  }
     624// usun i uzyj syntezy Krzysztofa tylko przesun ja przed dekodowanie tekstury to do
     625  /*
     626#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     627  if(!bDepth)
     628  {
     629  TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
     630  if(!pcPicYuvSynthDepthView)
     631  {
     632    pcPic->addSynthesisDepthBuffer();
     633    pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
     634  }
     635  m_cAvailabilityRenderer.extrapolateAvailabilityView( getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPicYuvAvailView, bRenderFromLeft );
     636 
     637#if POZNAN_OUTPUT_SYNTH
     638      Char acFilenameBaseD[1024];
     639      //printf("\niNearestViewIdx: %d, iCurPoc: %d, bRenderFromLeft: %s\n", iNearestViewIdx, iCurPoc, (bRenderFromLeft)?"true":"false");
     640      ::sprintf( acFilenameBaseD,  "SynthInputDepth_%s_V%d.yuv", ( true ? "Dec" : "Enc" ),iCoddedViewIdx );
     641      getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec()->dump(acFilenameBaseD, iCurPoc!=0);
     642      ::sprintf( acFilenameBaseD,  "SynthDepth_%s_V%d.yuv", ( true ? "Dec" : "Enc" ),iCoddedViewIdx );
     643      pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0);
     644#endif
     645   }
     646#endif//*/
     647
     648  //m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, false )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvERView, pcPicYuvAvailView, bRenderFromLeft );
     649  m_cAvailabilityRenderer.extrapolateAvailabilityView( getPicFromView( iNearestViewIdx, iCurPoc, bDepth )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthView, pcPicYuvAvailView, bRenderFromLeft );
     650
     651  pcPicYuvAvailView->setBorderExtension( false );//Needed??
     652  pcPicYuvAvailView->extendPicBorder();//Needed??
     653
     654#if POZNAN_OUTPUT_AVAILABLE_MAP
     655  {
     656  Char acFilenameBase[1024];
     657  ::sprintf( acFilenameBase,  "Available_%s_%s_V%d.yuv", (bDepth ? "Depth":"Tex"),( true ? "Dec" : "Enc" ), iCoddedViewIdx);
     658  pcPicYuvAvailView->dump(acFilenameBase, iCurPoc!=0);
     659  }
     660#endif
     661#if POZNAN_OUTPUT_SYNTH
     662  {
     663  Char acFilenameBase[1024];
     664  ::sprintf( acFilenameBase,  "Synth_%s_%s_V%d.yuv", (bDepth ? "Depth":"Tex"),( true ? "Dec" : "Enc" ), iCoddedViewIdx );
     665  pcPicYuvSynthView->dump(acFilenameBase, iCurPoc!=0);
     666  }
     667#endif
     668}
     669#endif
     670
     671//*
     672#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     673Void TAppDecTop::storeDepthSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx, Int iCurPoc)
     674{
     675  Int  iLeftViewIdx  = -1;
     676  Int  iRightViewIdx = -1;
     677  Int  iNearestViewIdx = -1;
     678  Bool bRenderFromLeft;
     679
     680  Int iRelDistToLeft = 128;
     681  if(iCoddedViewIdx==0) //First on View Coded List
     682  {
     683    //TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false );
     684    return;
     685  }
     686  iNearestViewIdx = 0;
     687  //bRenderFromLeft = iCoddedViewOrderIdx>0?true:false;
     688  //bRenderFromLeft = iCoddedViewOrderIdx<0?true:false;
     689  //m_cCamParsCollector.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft);
     690  bRenderFromLeft = iCoddedViewIdx>1?true:false;
     691
     692  m_cAvailabilityRenderer.setShiftLUTs(
     693    m_cCamParsCollector.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],
     694    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     695    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     696    m_cCamParsCollector.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right
     697    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     698    m_cCamParsCollector.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     699    iRelDistToLeft
     700  );
     701
     702  TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false );
     703
     704  TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
     705  if(!pcPicYuvSynthDepthView)
     706  {
     707    pcPic->addSynthesisDepthBuffer();
     708    pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
     709  }
     710 
     711  Int   iWidth        = pcPicYuvSynthDepthView->getWidth      ();
     712  Int   iHeight       = pcPicYuvSynthDepthView->getHeight     ();
     713  UInt  uiMaxCuWidth  = pcPicYuvSynthDepthView->getMaxCuWidth ();
     714  UInt  uiMaxCuHeight = pcPicYuvSynthDepthView->getMaxCuHeight();
     715  UInt  uiMaxCuDepth  = pcPicYuvSynthDepthView->getMaxCuDepth ();
     716
     717  TComPicYuv* pcPicYuvAvailView = new TComPicYuv;
     718  pcPicYuvAvailView->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     719
     720  m_cAvailabilityRenderer.extrapolateAvailabilityView( getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPicYuvAvailView, bRenderFromLeft );
     721 
     722  pcPicYuvAvailView->destroy();
     723  delete pcPicYuvAvailView;
     724
     725#if POZNAN_OUTPUT_SYNTH
     726      Char acFilenameBaseD[1024];
     727      //printf("\niNearestViewIdx: %d, iCurPoc: %d, bRenderFromLeft: %s\n", iNearestViewIdx, iCurPoc, (bRenderFromLeft)?"true":"false");
     728      ::sprintf( acFilenameBaseD,  "SynthInputDepth_%s_V%d.yuv", ( true ? "Dec" : "Enc" ),iCoddedViewIdx );
     729      getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec()->dump(acFilenameBaseD, iCurPoc!=0);
     730      ::sprintf( acFilenameBaseD,  "SynthDepth_%s_V%d.yuv", ( true ? "Dec" : "Enc" ),iCoddedViewIdx );
     731      pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0);
     732#endif
     733 
     734}
     735#endif//*/
  • branches/0.3-poznan-univ/source/App/TAppDecoder/TAppDecTop.h

    r21 r28  
    5252#include "../../Lib/TLibCommon/TComDepthMapGenerator.h"
    5353#include "../../Lib/TLibDecoder/TDecTop.h"
     54#if POZNAN_SYNTH
     55#include "../../Lib/TLibRenderer/TRenTop.h"
     56#endif
    5457#include "TAppDecCfg.h"
     58
     59#if POZNAN_MP
     60#include "../../Lib/TLibCommon/TComMP.h"
     61#endif
    5562
    5663// ====================================================================================================================
     
    8794#endif
    8895
     96#if POZNAN_SYNTH
     97  TRenTop                         m_cAvailabilityRenderer;
     98#endif
     99
     100#if POZNAN_MP
     101  TComMP*                                                 m_pcMP;
     102#endif
     103
    89104public:
    90105  TAppDecTop();
     
    97112  Void  startUsingDepth() ;
    98113
    99 // GT FIX
     114#if POZNAN_SYNTH
     115  Void  initRenderer(TComSPS &cComSPS);
     116  Void  storeSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx,Int iCurPoc,Bool bDepth);
     117#endif
     118
     119#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     120  Void storeDepthSynthPicsInBuffer(Int iCoddedViewIdx,Int iCoddedViewOrderIdx, Int iCurPoc);
     121#endif
     122
     123 // GT FIX
    100124  std::vector<TComPic*> getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepth );
    101125  TComPic* getPicFromView( Int iViewIdx, Int iPoc, bool bDepth );
     
    106130  TComAUPicAccess*  getAUPicAccess() { return &m_cAUPicAccess; }
    107131  TDecTop*          getDecTop0    () { return m_acTDecTopList[0]; }
     132#endif
     133
     134#if POZNAN_MP
     135  TComMP* getMP() { return m_pcMP; }
    108136#endif
    109137
  • branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncCfg.cpp

    r21 r28  
    341341#endif
    342342
     343#if POZNAN_DBMP
     344  ("DBMP",  m_uiDBMP,    (UInt)0, "usage of Depth-Based Motion Prediction" )
     345#endif
     346
     347#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     348  ("CUSkip",  m_uiUseCUSkip,    (UInt)1, "encode only disoccluded CUs in dependend view" )
     349#endif
     350
    343351  ("QpChangeFrame", m_iQpChangeFrame, PicOrderCnt(0), "start frame for QP change")
    344352  ("QpChangeOffsetVideo", m_iQpChangeOffsetVideo, 0, "QP change offset for video")
     
    350358#endif
    351359#endif
     360#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     361  ("TDdQP", m_bUseTexDqpAccordingToDepth, false, "texture TU blocks QP param modification according to depth map's values")
     362#endif
     363#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     364  ("TDdQPOffset",              m_dTexDqpAccordingToDepthOffset,       (Double)(-2.6), "texture block QP changing tool based on coresponding depth block values - offset parameter" )
     365  ("TDdQPMul",                 m_dTexDqpAccordingToDepthMul,          (Double)(1),    "texture block QP changing tool based on coresponding depth block values - multiplicative parameter" )
     366  ("TDdQPTopBottomRow",        m_iTexDqpAccordingToDepthTopBottomRow, (Int)2,         "texture block QP changing tool - top and bottom CU rows delta QP parameter" )
     367#endif
     368#if POZNAN_NONLINEAR_DEPTH
     369  ("DepthPower,-dpow",    m_fDepthPower,      (Double)1.0, "Depth power value (for non-linear processing)")
     370#endif
     371
    352372
    353373  /* Compatability with old style -1 FOO or -0 FOO options. */
     
    437457#endif
    438458
     459#if POZNAN_NONLINEAR_DEPTH
     460if (m_fDepthPower<=0)
     461  {
     462    Float fDepthQP = m_adQP[ m_adQP.size()  < 2 ? 0 : 1];
     463    m_fDepthPower = (fDepthQP-30) *0.25/20.0 + 1.25;
     464    if (m_fDepthPower<=1.0) m_fDepthPower = 1.0;
     465    // QP = 30 = 1.25
     466    // QP = 50 = 1.5
     467    if (m_fDepthPower>=1.66) m_fDepthPower = 1.66;
     468  };
     469
     470#if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
     471  m_fDepthPower = dequantizeDepthPower(quantizeDepthPower((Float)m_fDepthPower));
     472#endif
     473
     474#endif
     475
    439476  xCleanUpVectors();
    440477
     
    516553                                      NULL,
    517554                                      m_cRenModStrParser.getSynthViews(),
    518                                       LOG2_DISP_PREC_LUT );
     555                                      LOG2_DISP_PREC_LUT
     556#if POZNAN_NONLINEAR_DEPTH                                     
     557                                      ,m_fDepthPower
     558#endif
     559                                      );
    519560}
    520561else if ( m_bUseVSO && m_uiVSOMode != 4 )
     
    529570                                      m_pchVSOConfig,
    530571                                      NULL,
    531                                       LOG2_DISP_PREC_LUT );
     572                                      LOG2_DISP_PREC_LUT
     573#if POZNAN_NONLINEAR_DEPTH                                     
     574                                      ,m_fDepthPower
     575#endif                                     
     576                                      );
    532577}
    533578else
     
    542587    NULL,
    543588    NULL,
    544     LOG2_DISP_PREC_LUT );
     589    LOG2_DISP_PREC_LUT
     590#if POZNAN_NONLINEAR_DEPTH                                     
     591    ,m_fDepthPower
     592#endif   
     593    );
    545594}
    546595#else
     
    554603    NULL,
    555604    NULL,
    556     LOG2_DISP_PREC_LUT );
     605    LOG2_DISP_PREC_LUT
     606#if POZNAN_NONLINEAR_DEPTH                                     
     607    ,m_fDepthPower
     608#endif   
     609    );
    557610#endif
    558611
     
    665718#endif
    666719
     720#if POZNAN_DBMP
     721  xConfirmPara    ( m_uiDBMP > 1,                                                                                                       "DBMP must be less than or equal to 1" );
     722#endif
     723
     724#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     725  xConfirmPara    ( m_uiUseCUSkip > 1,                                                                                          "CU-Skip must be less than or equal to 1" );
     726#endif
     727
    667728#if HHI_INTERVIEW_SKIP
    668729  xConfirmPara    ( m_uiInterViewSkip > 1,                                        "RenderingSkipMode > 1 not supported" );
     
    933994#if MTK_SAO
    934995#endif
     996
     997#if POZNAN_MP
     998  printf("POZNAN_MP(1){ ");
     999
     1000#if POZNAN_MP_USE_DEPTH_MAP_GENERATION
     1001  printf("dmg=1 ");
     1002#else
     1003  printf("dmg=0 ");
     1004#endif
     1005
     1006#if POZNAN_MP_FILL
     1007  printf("fill=%d ",POZNAN_MP_FILL_TYPE);
     1008#else
     1009  printf("fill=- ");
     1010#endif
     1011
     1012#if POZNAN_DBMP
     1013  printf("DBMP:%d ", m_uiDBMP);
     1014  if(m_uiDBMP)
     1015  {   
     1016        printf("cand=%d ",POZNAN_DBMP_MERGE_POS);
     1017#if POZNAN_DBMP_CALC_PRED_DATA
     1018        printf("pr=1 ");
     1019#else
     1020        printf("pr=0 ");
     1021#endif
     1022#if POZNAN_DBMP_COMPRESS_ME_DATA
     1023        printf("comp=1 ");
     1024#else
     1025        printf("comp=0 ");
     1026#endif
     1027#if POZNAN_DBMP_USE_IN_NONANCHOR_PIC_ONLY
     1028        printf("na=1 ");
     1029#else
     1030        printf("na=0 ");
     1031#endif
     1032  }
     1033#endif
     1034  printf("} ");
     1035#endif
     1036
     1037#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     1038  printf("CU-Skip:%d ", m_uiUseCUSkip);
     1039#endif
     1040
    9351041  printf("\n");
    9361042  printf("TOOL CFG VIDEO  : ");
     
    9381044  printf("SAO:%d ", (m_abUseSAO [0] ? 1 : 0));
    9391045  printf("RDQ:%d ", (m_abUseRDOQ[0] ? 1 : 0) );
     1046#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     1047  printf("TDdQP:%d ", m_bUseTexDqpAccordingToDepth);
     1048#endif
     1049
    9401050  printf("\n");
    9411051
     
    9521062#if HHI_MPI
    9531063  printf("MVI:%d ", m_bUseMVI ? 1 : 0 );
     1064#endif
     1065#if POZNAN_NONLINEAR_DEPTH
     1066  printf("DepthPower:%f ", m_fDepthPower);
    9541067#endif
    9551068  printf("\n");
  • branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncCfg.h

    r5 r28  
    178178#endif
    179179
     180#if POZNAN_DBMP
     181  UInt      m_uiDBMP;                                                                               ///< using Depth-Based Motion Prediction
     182#endif
     183
     184#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     185  UInt      m_uiUseCUSkip;                                       ///< using CU-Skip - Encode only disoccluded CUs in dependend view
     186#endif
     187
    180188#if HHI_INTERVIEW_SKIP
    181189  UInt      m_uiInterViewSkip;                            ///< usage of interview skip mode ( do not transmit residual)
     
    246254#endif
    247255
     256#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     257  Bool      m_bUseTexDqpAccordingToDepth;                       ///< flag for using texture QP param modyfication according to depth map's values
     258#endif
    248259  // internal member functions
    249260  Void  xSetGlobal      ();                                   ///< set global variables
     
    271282  TRenModSetupStrParser       m_cRenModStrParser;
    272283#endif
     284
     285#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     286  Double                      m_dTexDqpAccordingToDepthOffset;
     287  Double                      m_dTexDqpAccordingToDepthMul;
     288  Int                         m_iTexDqpAccordingToDepthTopBottomRow;
     289#endif
     290
     291#if POZNAN_NONLINEAR_DEPTH
     292  Double    m_fDepthPower;                                                                        ///< Depth power value
     293#endif
     294
    273295public:
    274296
  • branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncTop.cpp

    r21 r28  
    141141    m_acTEncTopList[iViewIdx]->setUseFastEnc                   ( m_bUseFastEnc  );
    142142
     143#if POZNAN_NONLINEAR_DEPTH
     144    m_acTEncTopList[iViewIdx]->setDepthPower                   ( (Float)m_fDepthPower );
     145#endif
     146
    143147#if HHI_VSO
    144148    m_acTEncTopList[iViewIdx]->setUseVSO                       ( false ); //GT: might be enabled later for VSO Mode 4
     
    167171#endif
    168172
     173#if POZNAN_DBMP
     174        m_acTEncTopList[iViewIdx]->setDBMP                           ( m_uiDBMP );
     175#endif
     176
     177#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     178        m_acTEncTopList[iViewIdx]->setUseCUSkip                         ( m_uiUseCUSkip );
     179#endif
    169180
    170181#if HHI_INTERVIEW_SKIP
     
    222233    m_acTEncTopList[iViewIdx]->setQpChangeOffsetVideo( m_iQpChangeOffsetVideo );
    223234    m_acTEncTopList[iViewIdx]->setQpChangeOffsetDepth( m_iQpChangeOffsetDepth );
     235
     236   
     237#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     238    m_acTEncTopList[iViewIdx]->setUseTexDqpAccordingToDepth      ( m_bUseTexDqpAccordingToDepth );
     239#endif
     240 #if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     241    m_acTEncTopList[iViewIdx]->setTexDqpAccordingToDepthOffset( m_dTexDqpAccordingToDepthOffset );
     242    m_acTEncTopList[iViewIdx]->setTexDqpAccordingToDepthMul( m_dTexDqpAccordingToDepthMul );
     243    m_acTEncTopList[iViewIdx]->setTexDqpAccordingToDepthTopBottomRow( m_iTexDqpAccordingToDepthTopBottomRow ); 
     244#endif
    224245  }
    225246  if( m_bUsingDepthMaps )
     
    382403      m_acTEncDepthTopList[iViewIdx]->setUseMVI( m_bUseMVI );
    383404#endif
     405#if POZNAN_DBMP
     406      m_acTEncDepthTopList[iViewIdx]->setDBMP                        ( m_uiDBMP );
     407#endif
     408#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     409            m_acTEncDepthTopList[iViewIdx]->setUseCUSkip                      ( m_uiUseCUSkip );
     410#endif
     411#if POZNAN_NONLINEAR_DEPTH
     412      m_acTEncDepthTopList[iViewIdx]->setDepthPower                   ( (Float)m_fDepthPower );
     413#endif
    384414
    385415      m_acTEncDepthTopList[iViewIdx]->setPictureDigestEnabled(m_pictureDigestEnabled);
     
    435465#endif
    436466
     467#if POZNAN_SYNTH
     468  //m_cAvailabilityRenderer.init(m_iSourceWidth, m_iSourceHeight,true,0,0,true, 0,0,0,0,0,0,0,1,0,0 );  //GT: simplest configuration
     469  m_cAvailabilityRenderer.init(m_iSourceWidth, m_iSourceHeight,true,0,LOG2_DISP_PREC_LUT,true, 0,0,0,0,0,6,4,1,0,6 );  //GT: simplest configuration
     470#endif
     471
    437472#if HHI_INTERVIEW_SKIP
    438473  m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 );
    439474#endif
     475
     476#if POZNAN_MP
     477#if POZNAN_MP_USE_DEPTH_MAP_GENERATION
     478  m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth);
     479#else
     480  //m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth, &m_cCameraData);
     481  m_pcMP = new TComMP(m_iSourceHeight, m_iSourceWidth, m_cCameraData.getBaseViewShiftLUTI());
     482#endif
     483#endif
     484
    440485}
    441486
     
    485530
    486531  m_cTVideoIOBitsFile.closeBits();
     532
     533#if POZNAN_MP
     534  if (m_pcMP) { delete m_pcMP; m_pcMP=NULL; };
     535#endif
    487536
    488537#if HHI_VSO
     
    640689        {
    641690          m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcPdmDepthOrg, m_aiPad, m_bUsingDepthMaps );
     691#if POZNAN_NONLINEAR_DEPTH
     692                      pcPdmDepthOrg->nonlinearDepthForward(pcPdmDepthOrg, m_fDepthPower);                 
     693#endif
    642694        }
    643695#endif
     
    661713          // read input YUV file
    662714          m_acTVideoIOYuvDepthInputFileList[iViewIdx]->read( pcDepthPicYuvOrg, m_aiPad  ) ;
     715#if POZNAN_NONLINEAR_DEPTH
     716                      pcDepthPicYuvOrg->nonlinearDepthForward(pcDepthPicYuvOrg, m_fDepthPower);           
     717#endif
    663718          bDepthEos[iViewIdx] = ( m_acTVideoIOYuvDepthInputFileList[iViewIdx]->isEof() == 1 ?   true : false  );
    664719          bDepthEos[iViewIdx] = ( m_iDepthFrameRcvdVector[iViewIdx] == (m_iFrameToBeEncoded - 1) ?    true : bDepthEos[iViewIdx]   );
     
    692747    for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )     // Start encoding
    693748    {
     749#if POZNAN_SYNTH
     750      if( m_uiUseCUSkip )
     751      {
     752        xStoreSynthPicsInBuffer(iViewIdx,false);
     753      }
     754#endif
     755            //*
     756#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     757      if(m_bUseTexDqpAccordingToDepth)
     758      {
     759        xStoreDepthSynthPicsInBuffer(iViewIdx);
     760      }
     761#endif
     762      //*/
    694763      bool bThisViewContinueReadingPics = bContinueReadingPics[iViewIdx];
    695764      m_acTEncTopList[iViewIdx]->encode( bEos[iViewIdx], m_cListPicYuvRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingPics );
     
    708777      if( m_bUsingDepthMaps )
    709778      {
     779#if POZNAN_SYNTH
     780        if( m_uiUseCUSkip )
     781        {
     782          xStoreSynthPicsInBuffer(iViewIdx,true);
     783        }
     784#endif
    710785        bool bThisViewContinueReadingDepthPics = bContinueReadingDepthPics[iViewIdx];
    711786        m_acTEncDepthTopList[iViewIdx]->encode( bDepthEos[iViewIdx], m_cListPicYuvDepthRecMap[iViewIdx], pcBitstream, bThisViewContinueReadingDepthPics );
     
    9281003  {
    9291004    riNextPocToDump++;
     1005#if POZNAN_NONLINEAR_DEPTH
     1006    if(isDepth)
     1007    {
     1008      TComPicYuv *pcPicOrg = i->second;
     1009      TComPicYuv *pcPicPow = new TComPicYuv;
     1010      //pcPicYuvRec->createCompatibleAs(*iterPicYuvRec);
     1011      pcPicPow->create( pcPicOrg->getWidth(), pcPicOrg->getHeight(), pcPicOrg->getMaxCuWidth(), pcPicOrg->getMaxCuHeight(), pcPicOrg->getMaxCuDepth() );
     1012      //cPicPower.create(pcSPS->getWidth(), pcSPS->getHeight(), pcSPS->getMaxCUWidth(), pcSPS->getMaxCUHeight(), pcSPS->getMaxCUDepth() );
     1013      pcPicOrg->nonlinearDepthBackward(pcPicPow, m_fDepthPower);               
     1014      rpcTVideoIOYuvReconFile->write( pcPicPow, m_aiPad );
     1015// to do destroy pcPicow
     1016    } else
     1017#endif
    9301018    rpcTVideoIOYuvReconFile->write( i->second, m_aiPad );
    9311019    rcMap.erase( i );
     
    11771265#endif
    11781266
     1267#if POZNAN_SYNTH
     1268Void TAppEncTop::xStoreSynthPicsInBuffer(Int iCoddedViewIdx,Bool bDepth)
     1269{
     1270  Int iCurPoc;
     1271  if(bDepth)
     1272  {
     1273    iCurPoc = m_acTEncDepthTopList[ iCoddedViewIdx ]->getNextFrameId();
     1274    if (!(m_acTEncDepthTopList[ iCoddedViewIdx ]->currentPocWillBeCoded())) return;
     1275  }
     1276  else
     1277  {
     1278    iCurPoc = m_acTEncTopList[ iCoddedViewIdx ]->getNextFrameId();
     1279    if (!(m_acTEncTopList[ iCoddedViewIdx ]->currentPocWillBeCoded())) return;
     1280  }
     1281 
     1282  Int iNumberOfReferenceViews = 0;
     1283  Int  iNearestViewIdx = -1;
     1284  Bool bRenderFromLeft;
     1285
     1286  Int iRelDistToLeft;
     1287  if(iCoddedViewIdx==0) //First on View Coded List
     1288  {
     1289    //TComPic* pcPic = xGetPicFromView( iCoddedViewIdx, iCurPoc, false );
     1290    return;
     1291  }
     1292  m_cCameraData.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft);
     1293
     1294  m_cAvailabilityRenderer.setShiftLUTs(
     1295    m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],
     1296    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     1297    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     1298    m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right
     1299    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     1300    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     1301    iRelDistToLeft
     1302  );
     1303   
     1304
     1305  TComPicYuv* pcPicYuvERView = new TComPicYuv;
     1306  pcPicYuvERView->create( m_iSourceWidth, m_iSourceHeight, m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
     1307
     1308  TComPic* pcPic = xGetPicFromView( iCoddedViewIdx, iCurPoc, bDepth );
     1309  pcPic->addSynthesisBuffer();
     1310  pcPic->addAvailabilityBuffer();
     1311// usun to i wykorzystaj synteze która robi krzysztof dla glebi - tylko najpierw ja przeson przed kodowanie tekstury //to do
     1312  /*
     1313#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     1314      if(!bDepth)
     1315      {
     1316      pcPic->addSynthesisDepthBuffer();
     1317      TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
     1318      m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPic->getPicYuvAvail(), bRenderFromLeft );
     1319#if POZNAN_OUTPUT_SYNTH
     1320      Char acFilenameBaseD[1024];
     1321      //printf("\niNearestViewIdx: %d, iCurPoc: %d, bRenderFromLeft: %s\n", iNearestViewIdx, iCurPoc, (bRenderFromLeft)?"true":"false");
     1322      ::sprintf( acFilenameBaseD,  "SynthInputDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx );
     1323      xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec()->dump(acFilenameBaseD, iCurPoc!=0);
     1324      ::sprintf( acFilenameBaseD,  "SynthDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx );
     1325      pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0);
     1326#endif
     1327      }
     1328#endif//*/
     1329  TComPicYuv* pcPicYuvSynthView = pcPic->getPicYuvSynth();
     1330  TComPicYuv* pcPicYuvAvailView = pcPic->getPicYuvAvail();
     1331 
     1332  //m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, false )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvERView, pcPicYuvAvailView, bRenderFromLeft );
     1333  m_cAvailabilityRenderer.extrapolateAvailabilityView( xGetPicFromView( iNearestViewIdx, iCurPoc, bDepth )->getPicYuvRec(), xGetPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthView, pcPicYuvAvailView, bRenderFromLeft );
     1334     
     1335  pcPicYuvAvailView->setBorderExtension( false );//Needed??
     1336  pcPicYuvAvailView->extendPicBorder();//Needed??
     1337
     1338  pcPicYuvSynthView->setBorderExtension( false );//Needed??
     1339  pcPicYuvSynthView->extendPicBorder();//Needed??
     1340
     1341  //TComPic* pcPicDepth = xGetPicFromView( iCoddedViewIdx, iCurPoc, true );
     1342  //pcPicDepth->addAvailabilityBuffer();
     1343  //pcPicDepth->addSynthesisBuffer();
     1344  //pcPicYuvAvailView->copyToPic(pcPicDepth->getPicYuvAvail());
     1345     
     1346#if POZNAN_OUTPUT_AVAILABLE_MAP
     1347  {
     1348  Char acFilenameBase[1024];
     1349  ::sprintf( acFilenameBase,  "Available_%s_%s_V%d.yuv", (bDepth?"Depth":"Tex"),( false ? "Dec" : "Enc" ),iCoddedViewIdx );
     1350  pcPicYuvAvailView->dump(acFilenameBase, iCurPoc!=0);
     1351  }
     1352#endif
     1353#if POZNAN_OUTPUT_SYNTH
     1354  {
     1355  Char acFilenameBase[1024];
     1356  ::sprintf( acFilenameBase,  "Synth_%s_%s_V%d.yuv", (bDepth?"Depth":"Tex"),( false ? "Dec" : "Enc" ),iCoddedViewIdx );
     1357  pcPicYuvERView->dump(acFilenameBase, iCurPoc!=0);
     1358  }
     1359#endif
     1360
     1361      //Usun pcPicYuvERView i inne bufforki
     1362}
     1363#endif
     1364
     1365//*
     1366#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     1367Void TAppEncTop::xStoreDepthSynthPicsInBuffer(Int iCoddedViewIdx)
     1368{
     1369  Int  iLeftViewIdx  = -1;
     1370  Int  iRightViewIdx = -1;
     1371  Int  iNearestViewIdx = -1;
     1372  Bool bRenderFromLeft;
     1373
     1374  Int iCurPoc = m_acTEncTopList[ iCoddedViewIdx ]->getNextFrameId();
     1375  if (!(m_acTEncTopList[ iCoddedViewIdx ]->currentPocWillBeCoded())) return;
     1376
     1377  Int iRelDistToLeft = 128;
     1378  if(iCoddedViewIdx==0) //First on View Coded List
     1379  {
     1380    //TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false );
     1381    return;
     1382  }
     1383  iNearestViewIdx = 0;
     1384  //bRenderFromLeft = iCoddedViewOrderIdx>0?true:false;
     1385  //bRenderFromLeft = iCoddedViewOrderIdx<0?true:false;
     1386  //m_cCamParsCollector.getNearestBaseView(iCoddedViewIdx, iNearestViewIdx, iRelDistToLeft, bRenderFromLeft);
     1387  bRenderFromLeft = iCoddedViewIdx>1?true:false;
     1388
     1389  m_cAvailabilityRenderer.setShiftLUTs(
     1390    m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],
     1391    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     1392    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     1393    m_cCameraData.getBaseViewShiftLUTD()[iNearestViewIdx][iCoddedViewIdx],//right
     1394    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     1395    m_cCameraData.getBaseViewShiftLUTI()[iNearestViewIdx][iCoddedViewIdx],
     1396    iRelDistToLeft
     1397  );
     1398
     1399  TComPic* pcPic = getPicFromView( iCoddedViewIdx, iCurPoc, false );
     1400
     1401  TComPicYuv* pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
     1402  if(!pcPicYuvSynthDepthView)
     1403  {
     1404    pcPic->addSynthesisDepthBuffer();
     1405    pcPicYuvSynthDepthView = pcPic->getPicYuvSynthDepth();
     1406  }
     1407 
     1408  Int   iWidth        = pcPicYuvSynthDepthView->getWidth      ();
     1409  Int   iHeight       = pcPicYuvSynthDepthView->getHeight     ();
     1410  UInt  uiMaxCuWidth  = pcPicYuvSynthDepthView->getMaxCuWidth ();
     1411  UInt  uiMaxCuHeight = pcPicYuvSynthDepthView->getMaxCuHeight();
     1412  UInt  uiMaxCuDepth  = pcPicYuvSynthDepthView->getMaxCuDepth ();
     1413
     1414  TComPicYuv* pcPicYuvAvailView = new TComPicYuv;
     1415  pcPicYuvAvailView->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     1416
     1417  m_cAvailabilityRenderer.extrapolateAvailabilityView( getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec(), pcPicYuvSynthDepthView, pcPicYuvAvailView, bRenderFromLeft );
     1418 
     1419  pcPicYuvAvailView->destroy();
     1420  delete pcPicYuvAvailView;
     1421
     1422#if POZNAN_OUTPUT_SYNTH
     1423      Char acFilenameBaseD[1024];
     1424      //printf("\niNearestViewIdx: %d, iCurPoc: %d, bRenderFromLeft: %s\n", iNearestViewIdx, iCurPoc, (bRenderFromLeft)?"true":"false");
     1425      ::sprintf( acFilenameBaseD,  "SynthInputDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx );
     1426      getPicFromView( iNearestViewIdx, iCurPoc, true )->getPicYuvRec()->dump(acFilenameBaseD, iCurPoc!=0);
     1427      ::sprintf( acFilenameBaseD,  "SynthDepth_%s_V%d.yuv", ( false ? "Dec" : "Enc" ),iCoddedViewIdx );
     1428      pcPicYuvSynthDepthView->dump(acFilenameBaseD, iCurPoc!=0);
     1429#endif
     1430 
     1431}
     1432#endif//*/
     1433
     1434
    11791435#if HHI_INTERVIEW_SKIP
    11801436Void TAppEncTop::getUsedPelsMap( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedSplsMap )
  • branches/0.3-poznan-univ/source/App/TAppEncoder/TAppEncTop.h

    r5 r28  
    5151//GT VSO end
    5252
     53#if POZNAN_MP
     54#include "../../Lib/TLibCommon/TComMP.h"
     55#endif 
     56
    5357// ====================================================================================================================
    5458// Class definition
     
    9296#endif
    9397
     98#if POZNAN_SYNTH
     99  TRenTop                     m_cAvailabilityRenderer;
     100#endif
     101
     102#if POZNAN_MP
     103  TComMP*                                 m_pcMP;
     104#endif
    94105protected:
    95106  // initialization
     
    145156#endif
    146157
     158#if POZNAN_MP
     159  TComMP* getMP() {return m_pcMP;}
     160#endif
     161
    147162#if HHI_VSO
    148163private:
     
    155170#endif
    156171 
     172
     173#if POZNAN_SYNTH
     174private:
     175  Void  xStoreSynthPicsInBuffer(Int iCoddedViewIdx, Bool bDepth);
     176#endif
     177
     178#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     179private:
     180  Void xStoreDepthSynthPicsInBuffer(Int iCoddedViewIdx);
     181#endif
     182
    157183};// END CLASS DEFINITION TAppEncTop
    158184
  • branches/0.3-poznan-univ/source/App/TAppRenderer/TAppRendererCfg.cpp

    r5 r28  
    186186  {
    187187    m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    188       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
     188      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, NULL, m_iLog2SamplingFactor+m_iShiftPrecision
     189#if POZNAN_NONLINEAR_DEPTH     
     190      ,1.0f
     191#endif
     192      );
    189193    m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
    190194    m_iNumberOfOutputViews = m_iNumberOfInputViews - 1;
     
    205209
    206210  m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    207       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );
     211      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision
     212#if POZNAN_NONLINEAR_DEPTH
     213      , 1.0f
     214#endif
     215      );
    208216  }
    209217  else
    210218  {
    211219  m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    212       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
     220      m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision
     221#if POZNAN_NONLINEAR_DEPTH
     222      ,1.0f
     223#endif
     224      );
    213225  m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();
    214226  m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/CommonDef.h

    r21 r28  
    138138
    139139
    140 #if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED )
     140#if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED || POZNAN_MP_USE_DEPTH_MAP_GENERATION)
    141141#define DEPTH_MAP_GENERATION        1
    142142#else
    143143#define DEPTH_MAP_GENERATION        0
     144#endif
     145
     146#if POZNAN_NONLINEAR_DEPTH
     147#define POZNAN_LUT_INCREASED_PRECISION 0 // 1 //to do
     148#else
     149#define POZNAN_LUT_INCREASED_PRECISION 0
    144150#endif
    145151
     
    174180#define OUTPUT_RESIDUAL_PICTURES          0         // output residual pictures (for debugging)
    175181
    176 #define HHI_MPI_MERGE_POS                     0         // position of mvi in merge list (0..5)
    177 
     182#define HHI_MPI_MERGE_POS                 0         // position of mvi in merge list (0..5)
     183
     184// ====================================================================================================================
     185// POZNAN DEFINE SECTION
     186// ====================================================================================================================
     187#define POZNAN_OUTPUT_AVAILABLE_MAP       0           // output available map (for debugging)
     188#define POZNAN_OUTPUT_SYNTH               0           // output synthesised view (for debugging)
     189
     190#if POZNAN_DBMP
     191#define POZNAN_DBMP_MERGE_POS             0         // position of DBMP candidate in merge list for coding (0..6) - overwrites PDM_MERGE_POS settings, is overwritten by HHI_MPI_MERGE_POS settings!!!
     192#endif
     193
     194#if POZNAN_NONLINEAR_DEPTH
     195inline UChar quantizeDepthPower(Float fDepthPower)
     196{
     197  Int r = (Int) ( (fDepthPower-1.0f)*128.0f + 0.5f);
     198  if (r<=0) return 0;
     199  if (r>255) r=255; 
     200  return r;
     201};
     202
     203inline Float dequantizeDepthPower(Int iDepthQuant)
     204{
     205  return iDepthQuant/128.0f + 1.0f; 
     206};
     207#endif
    178208
    179209// ====================================================================================================================
     
    186216#define Clip(x)                     ( Min(g_uiIBDI_MAX, Max( 0, (x)) ) )                              ///< clip with bit-depth range
    187217#define Clip3( MinVal, MaxVal, a)   ( ((a)<(MinVal)) ? (MinVal) : (((a)>(MaxVal)) ? (MaxVal) :(a)) )  ///< general min/max clip
    188 #define RemoveBitIncrement(x)       ( (x + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
     218#define RemoveBitIncrement(x)       ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
     219
     220#if POZNAN_LUT_INCREASED_PRECISION
     221#define RemoveBitIncrementLUT(x)       (x)     ///< Remove Bit increment
     222#define SizeOfLUT                      (256 << g_uiBitIncrement) 
     223#else
     224#define SizeOfLUT                      256
     225#define RemoveBitIncrementLUT(x)       ( ((x) + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
     226#endif
    189227
    190228#define DATA_ALIGN                  1                                                                 ///< use 32-bit aligned malloc/free
     
    216254#define AMVP_MAX_NUM_CANDS          6           ///< max number of final candidates
    217255// MERGE
     256#if POZNAN_DBMP
     257#define MRG_MAX_NUM_CANDS           7
     258#define POZNAN_DBMP_MRG_CAND    MRG_MAX_NUM_CANDS-1                     // position of DBMP candidate in merge list (0..6)
     259#else
    218260#define MRG_MAX_NUM_CANDS           6
     261#endif
    219262
    220263// Reference memory management
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/ContextTables.h

    r5 r28  
    5353#define NUM_MERGE_FLAG_EXT_CTX        3       ///< number of context models for merge flag of merge extended
    5454#define NUM_MERGE_IDX_EXT_CTX         4       ///< number of context models for merge index of merge extended
     55#if POZNAN_DBMP
     56#define NUM_MV_MERGE_IDX_EXT_CTX      6       ///< number of context models for merge index of merge extended
     57#else
    5558#define NUM_MV_MERGE_IDX_EXT_CTX      5       ///< number of context models for merge index of merge extended
     59#endif
    5660#define NUM_RES_PRED_FLAG_CTX         3       ///< number of context for residual prediction flag     
    5761
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComDataCU.cpp

    r21 r28  
    187187    m_acCUMvField[1].create( uiNumPartition );
    188188   
     189#if POZNAN_DBMP_CALC_PRED_DATA
     190    m_acCUMvField2nd[0].create( uiNumPartition );
     191    m_acCUMvField2nd[1].create( uiNumPartition );
     192#endif
     193   
    189194#if HHI_DMM_WEDGE_INTRA
    190195    m_puiWedgeFullTabIdx       = (UInt*)xMalloc(UInt, uiNumPartition);
     
    210215    m_acCUMvField[0].setNumPartition(uiNumPartition );
    211216    m_acCUMvField[1].setNumPartition(uiNumPartition );
     217
     218#if POZNAN_DBMP_CALC_PRED_DATA
     219    m_acCUMvField2nd[0].setNumPartition(uiNumPartition );
     220    m_acCUMvField2nd[1].setNumPartition(uiNumPartition );
     221#endif
    212222  }
    213223 
     
    296306    if ( m_piContourPredTexDeltaDC2  ) { xFree(m_piContourPredTexDeltaDC2);  m_piContourPredTexDeltaDC2  = NULL; }
    297307#endif   
     308   
     309#if POZNAN_DBMP_CALC_PRED_DATA
     310    m_acCUMvField2nd[0].destroy();
     311    m_acCUMvField2nd[1].destroy();
     312#endif
     313
    298314  }
    299315 
     
    388404  m_acCUMvField[0].clearMvField();
    389405  m_acCUMvField[1].clearMvField();
     406 
     407#if POZNAN_DBMP_CALC_PRED_DATA
     408  m_acCUMvField2nd[0].clearMvField();
     409  m_acCUMvField2nd[1].clearMvField();
     410#endif
    390411 
    391412  UInt uiTmp = m_puhWidth[0]*m_puhHeight[0];
     
    508529  m_acCUMvField[1].clearMvField();
    509530
     531#if POZNAN_DBMP_CALC_PRED_DATA
     532  m_acCUMvField2nd[0].clearMvField();
     533  m_acCUMvField2nd[1].clearMvField();
     534#endif
     535
    510536#if HHI_DMM_WEDGE_INTRA
    511537  memset( m_puiWedgeFullTabIdx,  0, iSizeInUInt   );
     
    617643  m_uiEntropySliceStartCU   = pcCU->getEntropySliceStartCU();
    618644
     645#if POZNAN_DBMP_CALC_PRED_DATA
     646  m_acCUMvField2nd[0].clearMvField();
     647  m_acCUMvField2nd[1].clearMvField();
     648#endif
     649
    619650#if HHI_DMM_WEDGE_INTRA
    620651  memset( m_puiWedgeFullTabIdx,  0, iSizeInUInt   );
     
    719750  m_acCUMvField[1].setMvdPtr(pcCU->getCUMvField(REF_PIC_LIST_1)->getMvd()    + uiPart);
    720751  m_acCUMvField[1].setRefIdxPtr(pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx() + uiPart);
     752
     753#if POZNAN_DBMP_CALC_PRED_DATA
     754  m_acCUMvField2nd[0].setMvPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getMv()     + uiPart);
     755  m_acCUMvField2nd[0].setMvdPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getMvd()    + uiPart);
     756  m_acCUMvField2nd[0].setRefIdxPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getRefIdx() + uiPart);
     757  m_acCUMvField2nd[1].setMvPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getMv()     + uiPart);
     758  m_acCUMvField2nd[1].setMvdPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getMvd()    + uiPart);
     759  m_acCUMvField2nd[1].setRefIdxPtr(pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getRefIdx() + uiPart);
     760#endif
     761
    721762  m_uiSliceStartCU        = pcCU->getSliceStartCU();
    722763  m_uiEntropySliceStartCU = pcCU->getEntropySliceStartCU();
     
    787828  m_acCUMvField[eRefPicList].setMvdPtr(pcCU->getCUMvField(eRefPicList)->getMvd()    + uiAbsPartIdx);
    788829  m_acCUMvField[eRefPicList].setRefIdxPtr(pcCU->getCUMvField(eRefPicList)->getRefIdx() + uiAbsPartIdx);
     830
     831#if POZNAN_DBMP_CALC_PRED_DATA
     832  m_acCUMvField2nd[eRefPicList].setMvPtr(pcCU->getCUMvField2nd(eRefPicList)->getMv()     + uiAbsPartIdx);
     833  m_acCUMvField2nd[eRefPicList].setMvdPtr(pcCU->getCUMvField2nd(eRefPicList)->getMvd()    + uiAbsPartIdx);
     834  m_acCUMvField2nd[eRefPicList].setRefIdxPtr(pcCU->getCUMvField2nd(eRefPicList)->getRefIdx() + uiAbsPartIdx);
     835#endif
     836
    789837#if HHI_MPI
    790838  m_piTextureModeDepth = pcCU->getTextureModeDepth() + uiAbsPartIdx;
     
    857905  m_acCUMvField[1].copyFrom( pcCU->getCUMvField( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset );
    858906 
     907#if POZNAN_DBMP_CALC_PRED_DATA
     908  m_acCUMvField2nd[0].copyFrom( pcCU->getCUMvField2nd( REF_PIC_LIST_0 ), pcCU->getTotalNumPart(), uiOffset );
     909  m_acCUMvField2nd[1].copyFrom( pcCU->getCUMvField2nd( REF_PIC_LIST_1 ), pcCU->getTotalNumPart(), uiOffset );
     910#endif
     911
    859912  UInt uiTmp  = g_uiMaxCUWidth*g_uiMaxCUHeight >> (uiDepth<<1);
    860913  UInt uiTmp2 = uiPartUnitIdx*uiTmp;
     
    943996  m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU );
    944997  m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU );
     998 
     999#if POZNAN_DBMP_CALC_PRED_DATA
     1000  m_acCUMvField2nd[0].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU );
     1001  m_acCUMvField2nd[1].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU );
     1002#endif
    9451003 
    9461004  UInt uiTmp  = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>(uhDepth<<1);
     
    10301088  m_acCUMvField[0].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart );
    10311089  m_acCUMvField[1].copyTo( rpcCU->getCUMvField( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart );
     1090 
     1091#if POZNAN_DBMP_CALC_PRED_DATA
     1092  m_acCUMvField2nd[0].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_0 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart );
     1093  m_acCUMvField2nd[1].copyTo( rpcCU->getCUMvField2nd( REF_PIC_LIST_1 ), m_uiAbsIdxInLCU, uiPartStart, uiQNumPart );
     1094#endif
    10321095 
    10331096  UInt uiTmp  = (g_uiMaxCUWidth*g_uiMaxCUHeight)>>((uhDepth+uiPartDepth)<<1);
     
    26972760#endif
    26982761 
     2762#if POZNAN_DBMP
     2763  Bool bDBMPMerge = getSlice()->getMP()->isDBMPEnabled();
     2764  UInt uiDBMPAddr = POZNAN_DBMP_MRG_CAND;
     2765#endif
     2766 
    26992767  bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    27002768  for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui )
     
    27112779    pcCULeft = NULL;
    27122780  }
    2713   if( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) )
     2781  if( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx )
     2782#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     2783    && !pcCULeft->isCUSkiped( uiLeftPartIdx )
     2784#endif
     2785  )
    27142786  {
    27152787    abCandIsInter[uiLeftAddr] = true;
     
    27372809    pcCUAbove = NULL;
    27382810  }
    2739   if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx ) )
     2811  if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
     2812#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     2813    && !pcCUAbove->isCUSkiped( uiAbovePartIdx )
     2814#endif
     2815  )
    27402816  {
    27412817    abCandIsInter[uiAboveAddr] = true;
     
    31833259#endif
    31843260
     3261#if POZNAN_DBMP
     3262  //===== add point-to-point merge with depth maps =====
     3263  if ( bDBMPMerge )
     3264  {
     3265    //prediction of motion data for points with disocclusion:
     3266        UInt uiRefArrayAddr = uiDBMPAddr;
     3267        for(UInt ui=0; ui<MRG_MAX_NUM_CANDS; ui++) if ( ui!=uiDBMPAddr && abCandIsInter[ui] ) {uiRefArrayAddr = ui; break;}     
     3268        if(uiRefArrayAddr != uiDBMPAddr)
     3269        {
     3270                puhInterDirNeighbours[uiDBMPAddr] = puhInterDirNeighbours[uiRefArrayAddr];
     3271                pcMvFieldNeighbours[uiDBMPAddr << 1].setMvField(pcMvFieldNeighbours[uiRefArrayAddr << 1].getMv(),pcMvFieldNeighbours[uiRefArrayAddr << 1].getRefIdx());
     3272                pcMvFieldNeighbours[(uiDBMPAddr << 1)+1].setMvField(pcMvFieldNeighbours[(uiRefArrayAddr << 1)+1].getMv(),pcMvFieldNeighbours[(uiRefArrayAddr << 1)+1].getRefIdx());
     3273        }
     3274        else
     3275        {
     3276                TComMv cMVzero; cMVzero.setZero();
     3277                if( getSlice()->isInterB() )
     3278                {
     3279                        puhInterDirNeighbours[uiDBMPAddr] = 3;
     3280                        pcMvFieldNeighbours[uiDBMPAddr << 1].setMvField(cMVzero,0);
     3281                        pcMvFieldNeighbours[(uiDBMPAddr << 1)+1].setMvField(cMVzero,0);
     3282                }
     3283                else
     3284                {
     3285                        if(getSlice()->getNumRefIdx(REF_PIC_LIST_0)>0)
     3286                        {
     3287                                puhInterDirNeighbours[uiDBMPAddr] = 1;
     3288                                pcMvFieldNeighbours[uiDBMPAddr << 1].setMvField(cMVzero,0);
     3289                        }
     3290                        else if(getSlice()->getNumRefIdx(REF_PIC_LIST_1)>0)
     3291                        {
     3292                                puhInterDirNeighbours[uiDBMPAddr] = 2;
     3293                                pcMvFieldNeighbours[(uiDBMPAddr << 1)+1].setMvField(cMVzero,0);
     3294                        }
     3295                        else puhInterDirNeighbours[uiDBMPAddr] = 0;
     3296                }
     3297        }       
     3298        if(puhInterDirNeighbours[uiDBMPAddr])
     3299        {               
     3300                abCandIsInter[uiDBMPAddr] = true;
     3301                puiNeighbourCandIdx[uiDBMPAddr] = uiDBMPAddr + 1;
     3302        }
     3303  }
     3304#endif
     3305
    31853306
    31863307  //===== remove duplicates =====
    31873308  for( UInt uiOuter = 0; uiOuter < MRG_MAX_NUM_CANDS; uiOuter++ )
    31883309  {
     3310#if POZNAN_DBMP
     3311    if(uiOuter==POZNAN_DBMP_MRG_CAND) continue;
     3312#endif
    31893313    if( abCandIsInter[ uiOuter ] && ( puiNeighbourCandIdx[uiOuter] == uiOuter + 1 ) )
    31903314    {
    31913315      for( UInt uiIter = uiOuter + 1; uiIter < MRG_MAX_NUM_CANDS; uiIter++ )
    31923316      {
     3317#if POZNAN_DBMP
     3318        if(uiIter==POZNAN_DBMP_MRG_CAND) continue;
     3319#endif
    31933320        if( abCandIsInter[ uiIter ] )
    31943321        {
     
    32713398  if( uiIter == 0 )
    32723399  {
    3273     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     3400    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     3401#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     3402       && !pcCorner->isCUSkiped( uiCornerPUIdx )
     3403#endif
     3404    )
    32743405    {
    32753406      rbValidCand = true;
     
    33063437  else
    33073438  {
    3308     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     3439    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     3440#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     3441       && !pcCorner->isCUSkiped( uiCornerPUIdx )
     3442#endif
     3443    )
    33093444    {
    33103445      rbValidCand = true;
     
    44644599    return false;
    44654600 
     4601#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     4602  if (pColCU->isSkipped(uiPartIdxCenter))
     4603    return false;
     4604#endif
     4605 
    44664606  if( m_pcSlice->getRefPic(eRefPicList, iRefIdx)->getViewIdx() != m_pcSlice->getViewIdx() )
    44674607    return false;
     
    48214961  }
    48224962#endif
     4963
     4964#if POZNAN_DBMP_CALC_PRED_DATA
     4965  pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->copyTo( &m_acCUMvField2nd[0], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition );
     4966  pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->copyTo( &m_acCUMvField2nd[1], -Int(uiAbsPartIdxSrc) + uiAbsPartIdxDst, uiAbsPartIdxSrc, uiNumPartition );
     4967#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     4968  for( UInt ui = 0; ui < uiNumPartition; ui++ )
     4969  {
     4970    m_acCUMvField2nd[0].getMv( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 );
     4971    m_acCUMvField2nd[0].getMv( uiAbsPartIdxDst + ui ) >>= 2;
     4972
     4973    m_acCUMvField2nd[1].getMv( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 );
     4974    m_acCUMvField2nd[1].getMv( uiAbsPartIdxDst + ui ) >>= 2;
     4975
     4976    m_acCUMvField2nd[0].getMvd( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 );
     4977    m_acCUMvField2nd[0].getMvd( uiAbsPartIdxDst + ui ) >>= 2;
     4978
     4979    m_acCUMvField2nd[1].getMvd( uiAbsPartIdxDst + ui ) += TComMv( 2, 2 );
     4980    m_acCUMvField2nd[1].getMvd( uiAbsPartIdxDst + ui ) >>= 2;
     4981  }
     4982#endif
     4983#endif
    48234984}
    48244985#endif
     
    48294990  riPosY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]] + getCUPelY(); 
    48304991}
     4992#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     4993Int TComDataCU::CuQpIncrementFunction(Pel uiBlockMax)
     4994{
     4995  if((uiBlockMax >> g_uiBitIncrement) >= 256 || (uiBlockMax >> g_uiBitIncrement) <0)
     4996  {
     4997    fprintf(stderr, "Bitincrement = %d, uiBlockMax = %d\n", g_uiBitIncrement, uiBlockMax);
     4998    exit(333);
     4999  }
     5000  Float fVal = (Float)((255 - (uiBlockMax >> g_uiBitIncrement)) >> 4);
     5001  fVal = (fVal * fVal);
     5002#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     5003  fVal = (Float)( fVal + getPic()->getTexDqpAccordingToDepthOffset() * 32); // add offset, if offset is negative than objects in front will have smaller QP than originaly - quality in front will be increased and in bacground will be decreased
     5004  fVal = (Float)( fVal * getPic()->getTexDqpAccordingToDepthMul()); //
     5005#else
     5006  fVal = (Float)( fVal + POZNAN_TEXTURE_TU_DELTA_QP_OFFSET * 32); // add offset, if offset is negative objects in front will have smaller QP than in original approach - quality in front will be increased and in bacground will be decreased
     5007  fVal = (Float)( fVal * POZNAN_TEXTURE_TU_DELTA_QP_MUL); //
     5008#endif
     5009  return (Int)fVal >> 5;
     5010}
     5011 Int  TComDataCU::getQpOffsetForTextCU(UInt uiPartIdx, Bool bIsIntra)
     5012 {
     5013   if(!getPic()->getSlice(0)->getSPS()->getUseTexDqpAccordingToDepth())
     5014   {
     5015     return 0;
     5016   }
     5017   if(this->getPic()->getSlice(0)->getSPS()->isDepth())
     5018   {
     5019     return 0;
     5020   }
     5021#if POZNAN_TEXTURE_TU_DELTA_QP_NOT_IN_BASE_VIEW
     5022   //if(!getPic()->getIsSideView())
     5023   if(this->getPic()->getViewIdx() == 0)
     5024   {
     5025     return 0;
     5026   }
     5027#endif
     5028   UInt iCuAddr = getAddr();
     5029   //TComPic * pcDepthPic = getPic()->getDepthPic();
     5030   TComPicYuv * pcDepthPicYUV = getPic()->getPicYuvSynthDepth();
     5031   if(pcDepthPicYUV /*pcDepthPic*/ == NULL)
     5032   {
     5033    char errortext[200];
     5034    sprintf(errortext, "depth map expected");
     5035    fprintf(stderr, "%s\n", errortext);
     5036    exit(123);
     5037   }
     5038   //TComDataCU* rpcCUDepth = pcDepthPic->getCU(iCuAddr);
     5039   Pel uiDepthLumaTransformBlockMax;
     5040   if(bIsIntra)
     5041   {
     5042     // in intra block CU each TU block has QP chosen separatly so dQP is calculated for TU
     5043     uiDepthLumaTransformBlockMax = getDepthLumaTransformBlockMax( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx );
     5044   }
     5045   else
     5046   {
     5047     // in inter block CU all TU block has the same QP so dQP is calculated for CU
     5048     uiDepthLumaTransformBlockMax = getDepthLumaCodingBlockMax( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx );
     5049   }
     5050#if POZNAN_NONLINEAR_DEPTH
     5051   TComNonlinearDepthBackward cNonlinearDepthBwd(getSlice()->getSPS()->getDepthPower(), g_uiBitIncrement, g_uiBitIncrement);
     5052   uiDepthLumaTransformBlockMax = (Pel)( cNonlinearDepthBwd(uiDepthLumaTransformBlockMax) + 0.5);
     5053#endif
     5054   Int iDeltaQP = CuQpIncrementFunction(uiDepthLumaTransformBlockMax);
     5055#if POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW
     5056   //Int iMaxCUHeight = this->getPic()->getPicSym()->getMaxCUHeight();
     5057   //Int iPicHeight   = this->getPic()->getPicSym()->getPicHeight();
     5058   Int iMaxCUHeight = this->getPic()->getPicYuvRec()->getMaxCuHeight();
     5059   Int iPicHeight   = this->getPic()->getPicYuvRec()->getHeight();
     5060   Int iLastPelYInFirstCURow = 0 + iMaxCUHeight;
     5061   Int iFirstPelYInLastCURow = iPicHeight - iMaxCUHeight;
     5062   Int iCUStartPelY = getCUPelY();
     5063   if((iCUStartPelY <= iLastPelYInFirstCURow) || (iCUStartPelY >= iFirstPelYInLastCURow))
     5064   {
     5065#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     5066     iDeltaQP += getPic()->getTexDqpAccordingToDepthTopBottomRow();// POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW;
     5067#else
     5068     iDeltaQP += POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_ROW_VAL;// POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW;
     5069#endif
     5070   }
     5071#endif
     5072   return iDeltaQP;
     5073 }
     5074
     5075Int cmpProc(const Void *arg1, const Void *arg2)
     5076{
     5077    return *((Pel*)arg2) - *((Pel*)arg1);
     5078}
     5079
     5080// Function gets median value of depth block that has the same size and position as texture block that calls this function
     5081Pel  TComDataCU::getDepthLumaCodingBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5082
     5083  static Pel pSortTable [64 * 64];
     5084  Int CUWidth, CUHeight;
     5085  sortDepthLumaCodingBlock( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, CUWidth, CUHeight );
     5086  return pSortTable[(CUHeight * CUWidth) / 2];
     5087}
     5088
     5089// Function gets maximal value of depth block that has the same size and position as texture block that calls this function
     5090Pel TComDataCU::getDepthLumaCodingBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5091
     5092  return maxDepthLumaCodingBlock( pcDepthPicYUV /*rpcCUDepth*/, iCuAddr, uiPartIdx); 
     5093}
     5094Void TComDataCU::sortDepthLumaCodingBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& CUWidth, Int& CUHeight )
     5095{
     5096  Int x, y;
     5097  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5098  // CU size:
     5099  CUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5100  CUWidth  = getWidth(uiPartIdx);
     5101  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5102  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5103  Int iNumBase4x4InBlock = (CUWidth >> 2) * (CUHeight >> 2);
     5104
     5105  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5106  // Address of block
     5107  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5108
     5109  Int p =0;
     5110  Int iStride  = getPic()->getPicYuvRec()->getStride();
     5111  for ( y = CUHeight - 1; y >= 0; y-- )
     5112  {
     5113    for ( x = CUWidth - 1; x >= 0; x-- )
     5114    {
     5115      pSortTable[p] = pPel[x]; ++p;
     5116    }
     5117    pPel += iStride;
     5118  }
     5119  // sort elements
     5120  qsort(pSortTable, CUHeight * CUWidth, sizeof(Pel), cmpProc);
     5121}
     5122
     5123Pel TComDataCU::maxDepthLumaCodingBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx)
     5124{
     5125  Int x, y;
     5126  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5127  // CU size:
     5128  Int CUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5129  Int CUWidth  = getWidth(uiPartIdx);
     5130  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5131  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5132  Int iNumBase4x4InBlock = (CUWidth >> 2) * (CUHeight >> 2);
     5133
     5134  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5135  // Address of block
     5136  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5137
     5138  Pel  pValue = 0;
     5139  Int  iStride = getPic()->getPicYuvRec()->getStride();
     5140  for ( y = CUHeight - 1; y >= 0; y-- )
     5141  {
     5142    for ( x = CUWidth - 1; x >= 0; x-- )
     5143    {
     5144      if (pPel[x]>pValue) pValue = pPel[x];
     5145    }
     5146    pPel += iStride;
     5147  }
     5148  return pValue;
     5149}
     5150
     5151// Function gets median value of depth block that has the same size and position as texture block that calls this function
     5152Pel  TComDataCU::getDepthLumaTransformBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5153
     5154  static Pel pSortTable [64 * 64];
     5155  Int TUWidth, TUHeight;
     5156  sortDepthLumaTransformBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, TUWidth, TUHeight );
     5157  return pSortTable[(TUHeight * TUWidth) / 2];
     5158}
     5159
     5160// Function gets maximal value of depth block that has the same size and position as texture block that calls this function
     5161Pel TComDataCU::getDepthLumaTransformBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5162
     5163  return maxDepthLumaTransformBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx );
     5164}
     5165Void TComDataCU::sortDepthLumaTransformBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& TUWidth, Int& TUHeight )
     5166{
     5167  Int x, y;
     5168  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5169  // CU size:
     5170  TUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5171  TUWidth  = getWidth(uiPartIdx);
     5172  // correct CU size to trnsform size:
     5173  if( getTransformIdx(uiPartIdx) )
     5174  {
     5175    TUWidth  = TUWidth >> 1;
     5176    TUHeight = TUHeight >> 1;
     5177  }
     5178  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5179  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5180  Int iNumBase4x4InBlock = (TUWidth >> 2) * (TUHeight >> 2);
     5181
     5182  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5183  // Address of block
     5184  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5185
     5186  int p = 0;
     5187  Int  iStride  = getPic()->getPicYuvRec()->getStride();
     5188  for ( y = TUHeight - 1; y >= 0; y-- )
     5189  {
     5190    for ( x = TUWidth - 1; x >= 0; x-- )
     5191    {
     5192      pSortTable[p] = pPel[x];
     5193    }
     5194    pPel += iStride;
     5195  }
     5196  // sort elements
     5197  qsort(pSortTable, TUHeight * TUWidth, sizeof(Pel), cmpProc);
     5198}
     5199Pel TComDataCU::maxDepthLumaTransformBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx)
     5200{
     5201  Int x, y;
     5202  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5203  // CU size:
     5204  Int TUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5205  Int TUWidth  = getWidth(uiPartIdx);
     5206  // correct CU size to trnsform size:
     5207  if( getTransformIdx(uiPartIdx) )
     5208  {
     5209    TUWidth  = TUWidth >> 1;
     5210    TUHeight = TUHeight >> 1;
     5211  }
     5212  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5213  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5214  Int iNumBase4x4InBlock = (TUWidth >> 2) * (TUHeight >> 2);
     5215
     5216  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5217  // Address of block
     5218  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5219
     5220  Pel pValue = 0;
     5221  Int iStride  = getPic()->getPicYuvRec()->getStride();
     5222  for ( y = TUHeight - 1; y >= 0; y-- )
     5223  {
     5224    for ( x = TUWidth - 1; x >= 0; x-- )
     5225    {
     5226      if (pPel[x]>pValue) pValue = pPel[x];
     5227    }
     5228    pPel += iStride;
     5229  }
     5230  return pValue;
     5231}
     5232// Function gets median value of depth block that has the same size and position as texture block that calls this function
     5233Pel  TComDataCU::getDepthLumaPredictionBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5234
     5235  static Pel pSortTable [64 * 64];
     5236  Int PUWidth, PUHeight;
     5237  sortDepthLumaPredictionBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, PUWidth, PUHeight );
     5238  return pSortTable[(PUHeight * PUWidth) / 2];
     5239}
     5240
     5241// Function gets maximal value of depth block that has the same size and position as texture block that calls this function
     5242Pel  TComDataCU::getDepthLumaPredictionBlockMax( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx )
     5243
     5244  static Pel pSortTable [64 * 64];
     5245  Int PUWidth, PUHeight;
     5246  sortDepthLumaPredictionBlock( pcDepthPicYUV/*rpcCUDepth*/, iCuAddr, uiPartIdx, pSortTable, PUWidth, PUHeight );
     5247  return pSortTable[0];
     5248}
     5249Void TComDataCU::sortDepthLumaPredictionBlock ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& PUWidth, Int& PUHeight )
     5250{
     5251  Int x, y;
     5252  UInt uiAbsZorderIdx  = getZorderIdxInCU() + uiPartIdx;
     5253  // CU size:
     5254  PUHeight = getHeight(uiPartIdx); // Size is based on coded texture block size not on depth picture size
     5255  PUWidth  = getWidth(uiPartIdx);
     5256  // correct CU size to partition size:
     5257  if( getPartitionSize(uiPartIdx) == SIZE_Nx2N || getPartitionSize(uiPartIdx) == SIZE_NxN )
     5258  {
     5259    PUWidth = PUWidth >> 1;
     5260  }
     5261  if( getPartitionSize(uiPartIdx) == SIZE_2NxN || getPartitionSize(uiPartIdx) == SIZE_NxN )
     5262  {
     5263    PUHeight = PUHeight >> 1;
     5264  }
     5265 
     5266  // uiAbsZorderIdx is z order idx of one particular base block (4x4 pix) in block that we process
     5267  // What we need is z-order idx of first Base block (4x4 pix) in this block
     5268  Int iNumBase4x4InBlock = (PUWidth >> 2) * (PUHeight >> 2);
     5269  if(getPartitionSize(uiPartIdx) == SIZE_Nx2N)
     5270  {
     5271    iNumBase4x4InBlock = iNumBase4x4InBlock << 1; // KUBA if PU is Nx2N than to count start z-order idx we need to make such trick
     5272  }
     5273  UInt uiAbsZorderIdxBlockStart = (uiAbsZorderIdx / iNumBase4x4InBlock) * iNumBase4x4InBlock;
     5274  // Address of block
     5275  Pel* pPel   = pcDepthPicYUV/*rpcCUDepth->getPic()->getPicYuvRec()*/->getLumaAddr ( iCuAddr, uiAbsZorderIdxBlockStart );
     5276
     5277  UInt  uiStride  = getPic()->getPicYuvRec()->getStride();
     5278  for ( y = PUHeight - 1; y >= 0; y-- )
     5279  {
     5280    for ( x = PUWidth - 1; x >= 0; x-- )
     5281    {
     5282      pSortTable[y*PUWidth + x] = pPel[y*uiStride + x];
     5283    }
     5284  }
     5285  // sort elements
     5286  qsort(pSortTable, PUHeight * PUWidth, sizeof(Pel), cmpProc);
     5287}
     5288#endif
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComDataCU.h

    r5 r28  
    105105#endif//SNY_DQP
    106106 
     107#if POZNAN_DBMP_CALC_PRED_DATA
     108  TComCUMvField m_acCUMvField2nd[2];              ///< array of motion vectors selected for points with no MP prediction available
     109#endif
     110 
    107111  // -------------------------------------------------------------------------------------------------------------------
    108112  // neighbour access variables
     
    310314#endif
    311315 
     316#if POZNAN_DBMP_CALC_PRED_DATA
     317  TComCUMvField* getCUMvField2nd         ( RefPicList e )          { return  &m_acCUMvField2nd[e];  }
     318#endif
     319 
    312320  // -------------------------------------------------------------------------------------------------------------------
    313321  // member functions for coding tool information
     
    529537  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; }
    530538  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
     539#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     540  Bool          isCUSkiped( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_SYNTH; }
     541#endif
    531542 
    532543  // -------------------------------------------------------------------------------------------------------------------
     
    585596#endif //QC_MDCS
    586597
     598#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     599 Int            CuQpIncrementFunction  ( Pel uiBlockMax );
     600 Int            getQpOffsetForTextCU   ( UInt uiPartIdx, Bool bIsIntra );
     601 Pel            getDepthLumaCodingBlockMedian    ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     602 Pel            getDepthLumaCodingBlockMax       ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     603 Void           sortDepthLumaCodingBlock         ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx, Pel * pSortTable, Int& TUWidth, Int& TUHeight);
     604 Pel            maxDepthLumaCodingBlock          ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     605 Pel            getDepthLumaTransformBlockMedian ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     606 Pel            getDepthLumaTransformBlockMax    ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     607 Void           sortDepthLumaTransformBlock      ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx , Pel * pSortTable, Int& TUWidth, Int& TUHeight);
     608 Pel            maxDepthLumaTransformBlock       ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     609 Pel            getDepthLumaPredictionBlockMedian( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     610 Pel            getDepthLumaPredictionBlockMax   ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx );
     611 Void           sortDepthLumaPredictionBlock     ( TComPicYuv * pcDepthPicYUV/*TComDataCU* rpcCUDepth*/, UInt iCuAddr, UInt uiPartIdx , Pel * pSortTable, Int& PUWidth, Int& PUHeight);
     612#endif
    587613};
    588614
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComDepthMapGenerator.cpp

    r21 r28  
    985985    xInterPredictCUDepthMap( pcSubCU, pcSubDM );
    986986    break;
     987#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     988  case MODE_SYNTH:
     989    //What to do? Need Fix!
     990    xIntraPredictCUDepthMap( pcSubCU, pcSubDM );
     991    break;
     992#endif
    987993  default:
    988994    AOT( true );
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComLoopFilter.cpp

    r5 r28  
    444444 
    445445  //-- Set BS for Intra MB : BS = 4 or 3
    446   if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) )
     446  if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ)
     447#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     448     || pcCUP->isCUSkiped(uiPartP) || pcCUQ->isCUSkiped(uiPartQ)
     449#endif
     450  )
    447451  {
    448452    uiBs = bAtCUBoundary ? 4 : 3;   // Intra MB && MB boundary
     
    450454 
    451455  //-- Set BS for not Intra MB : BS = 2 or 1 or 0
    452   if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) )
     456  if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ)
     457#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     458     && !pcCUP->isCUSkiped(uiPartP) && !pcCUQ->isCUSkiped(uiPartQ)
     459#endif
     460  )
    453461  {
    454462    if ( pcCUQ->getCbf( uiPartQ, TEXT_LUMA, pcCUQ->getTransformIdx(uiPartQ)) != 0 || pcCUP->getCbf( uiPartP, TEXT_LUMA, pcCUP->getTransformIdx(uiPartP) ) != 0)
     
    528536  }   // enf of "if( not Intra )"
    529537 
     538#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU //if one of the block is CUSkipped dont use loop filter
     539  if ( pcCUP->isCUSkiped(uiPartP) || pcCUQ->isCUSkiped(uiPartQ))
     540  {
     541    uiBs = 0;
     542  }
     543#endif
     544
    530545  m_aapucBS[iDir][0][uiAbsPartIdx] = uiBs;
    531546  if ( bAtCUBoundary || bAtCUHalf )
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPic.cpp

    r21 r28  
    5050  m_apcPicYuv[0]      = NULL;
    5151  m_apcPicYuv[1]      = NULL;
     52#if POZNAN_AVAIL_MAP
     53  m_apcPicYuvAvail     = NULL;
     54#endif
     55#if POZNAN_SYNTH_VIEW
     56  m_apcPicYuvSynth     = NULL;
     57#endif
     58#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     59  m_apcPicYuvSynthDepth= NULL;
     60#endif
    5261#if DEPTH_MAP_GENERATION
    5362  m_pcPredDepthMap    = NULL;
     
    118127    m_apcPicYuv[1]  = NULL;
    119128  }
     129#if POZNAN_AVAIL_MAP
     130  if (m_apcPicYuvAvail)
     131  {
     132    m_apcPicYuvAvail->destroy();
     133    delete m_apcPicYuvAvail;
     134    m_apcPicYuvAvail  = NULL;
     135  }
     136#endif
     137
     138#if POZNAN_SYNTH_VIEW
     139  if (m_apcPicYuvSynth)
     140  {
     141    m_apcPicYuvSynth->destroy();
     142    delete m_apcPicYuvSynth;
     143    m_apcPicYuvSynth  = NULL;
     144  }
     145#endif
     146#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     147  if (m_apcPicYuvSynthDepth)
     148  {
     149    m_apcPicYuvSynthDepth->destroy();
     150    delete m_apcPicYuvSynthDepth;
     151    m_apcPicYuvSynthDepth  = NULL;
     152  }
     153#endif
    120154 
    121155#if DEPTH_MAP_GENERATION
     
    195229}
    196230
     231#if POZNAN_AVAIL_MAP
     232Void
     233TComPic::addAvailabilityBuffer()
     234{
     235  AOT( m_apcPicYuvAvail );
     236  AOF( m_apcPicYuv[1] );
     237  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
     238  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
     239  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
     240  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
     241  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
     242  m_apcPicYuvAvail      = new TComPicYuv;
     243  m_apcPicYuvAvail      ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     244}
     245#endif
     246
     247#if POZNAN_SYNTH_VIEW
     248Void
     249TComPic::addSynthesisBuffer()
     250{
     251  AOT( m_apcPicYuvSynth );
     252  AOF( m_apcPicYuv[1] );
     253  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
     254  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
     255  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
     256  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
     257  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
     258  m_apcPicYuvSynth      = new TComPicYuv;
     259  m_apcPicYuvSynth      ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     260}
     261#endif
     262
     263#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     264Void
     265TComPic::addSynthesisDepthBuffer()
     266{
     267  AOT( m_apcPicYuvSynthDepth );
     268  AOF( m_apcPicYuv[1] );
     269  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
     270  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
     271  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
     272  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
     273  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
     274  m_apcPicYuvSynthDepth      = new TComPicYuv;
     275  m_apcPicYuvSynthDepth      ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     276}
     277#endif
     278
    197279#if PARALLEL_MERGED_DEBLK
    198280Void
     
    286368}
    287369
     370#if POZNAN_AVAIL_MAP
     371Void
     372TComPic::removeAvailabilityBuffer()
     373{
     374  if( m_apcPicYuvAvail )
     375  {
     376    m_apcPicYuvAvail->destroy();
     377    delete m_apcPicYuvAvail;
     378    m_apcPicYuvAvail  = NULL;
     379  }
     380}
     381#endif
     382
     383#if POZNAN_SYNTH_VIEW
     384Void
     385TComPic::removeSynthesisBuffer()
     386{
     387  if( m_apcPicYuvSynth )
     388  {
     389    m_apcPicYuvSynth->destroy();
     390    delete m_apcPicYuvSynth;
     391    m_apcPicYuvSynth  = NULL;
     392  }
     393}
     394#endif
     395
     396#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     397Void
     398TComPic::removeSynthesisDepthBuffer()
     399{
     400  if( m_apcPicYuvSynthDepth )
     401  {
     402    m_apcPicYuvSynthDepth->destroy();
     403    delete m_apcPicYuvSynthDepth;
     404    m_apcPicYuvSynthDepth  = NULL;
     405  }
     406}
     407#endif
     408
    288409#if PARALLEL_MERGED_DEBLK
    289410Void
     
    351472#endif
    352473
     474#if POZNAN_AVAIL_MAP
     475Void TComPic::checkSynthesisAvailability( TComDataCU*& rpcCU, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, Bool *&rpbCUSynthesied )
     476{
     477  rpbCUSynthesied[0] = true;
     478  rpbCUSynthesied[1] = true;
     479  rpbCUSynthesied[2] = true;
     480  rpbCUSynthesied[3] = true;
     481
     482  if (!getPicYuvAvail())
     483  {
     484    rpbCUSynthesied[0] = false;
     485    rpbCUSynthesied[1] = false;
     486    rpbCUSynthesied[2] = false;
     487    rpbCUSynthesied[3] = false;
     488    return;   
     489  }
     490 
     491  Int x, y;
     492  Bool bAvailable = true;
     493  Pel* pAvail  = getPicYuvAvail()->getLumaAddr ( iCuAddr, uiAbsZorderIdx );
     494  Int CUHeight = g_uiMaxCUHeight >> uiPartDepth; //rpcCU->getHeight(uiAbsZorderIdx);
     495  Int CUWidth  = g_uiMaxCUWidth  >> uiPartDepth; //rpcCU->getWidth(uiAbsZorderIdx);
     496 
     497  Int  iStride  = getPicYuvAvail()->getStride();
     498  for ( y = ((CUHeight - 1) >> 1); y >= 0; y-- )
     499  {
     500    for ( x = ((CUWidth - 1) >> 1); x >= 0; x-- )
     501    {
     502      rpbCUSynthesied[0] &= (pAvail[x] != 0);
     503    }
     504    for ( x = CUWidth - 1; x >= ((CUWidth) >> 1); x-- )
     505    {
     506      rpbCUSynthesied[1] &= (pAvail[x] != 0);
     507    }
     508    pAvail += iStride;
     509  }
     510  //for ( y = CUHeight - 1; y >= ((CUHeight) >> 1); y-- )
     511  for ( y = ((CUHeight - 1) >> 1); y >= 0; y-- ) //Owieczka
     512  {
     513    for ( x = ((CUWidth - 1) >> 1); x >= 0; x-- )
     514    {
     515      rpbCUSynthesied[2] &= (pAvail[x] != 0);
     516    }
     517    for ( x = CUWidth - 1; x >= ((CUWidth) >> 1); x-- )
     518    {
     519      rpbCUSynthesied[3] &= (pAvail[x] != 0);
     520    }
     521    pAvail += iStride;
     522  }
     523
     524  //rpbCUSynthesied[0] = !rpbCUSynthesied[0];
     525  //rpbCUSynthesied[1] = !rpbCUSynthesied[1];
     526  //rpbCUSynthesied[2] = !rpbCUSynthesied[2];
     527  //rpbCUSynthesied[3] = !rpbCUSynthesied[3];
     528}
     529#endif
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPic.h

    r21 r28  
    6161
    6262  TComPicYuv*           m_apcPicYuv[2];           //  Texture,  0:org / 1:rec
     63
     64#if POZNAN_AVAIL_MAP
     65  TComPicYuv*           m_apcPicYuvAvail;         //  Availability Map - Does the given pixel can be synthesised in receiver
     66#endif
     67
     68#if POZNAN_SYNTH_VIEW
     69  TComPicYuv*           m_apcPicYuvSynth;         //  Sythesied image
     70#endif
     71#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     72  TComPicYuv*           m_apcPicYuvSynthDepth;         //  Sythesied depth image
     73#endif
     74
    6375#if DEPTH_MAP_GENERATION
    6476  TComPicYuv*           m_pcPredDepthMap;         //  estimated depth map
     
    101113#if HHI_INTERVIEW_SKIP
    102114  TComPicYuv*           m_pcUsedPelsMap;
     115#endif
     116#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     117  Double                m_dTexDqpAccordingToDepthOffset;
     118  Double                m_dTexDqpAccordingToDepthMul;
     119  Int                   m_iTexDqpAccordingToDepthTopBottomRow;
    103120#endif
    104121
     
    129146  TComPicYuv*   getPicYuvOrg()        { return  m_apcPicYuv[0]; }
    130147  TComPicYuv*   getPicYuvRec()        { return  m_apcPicYuv[1]; }
     148
     149#if POZNAN_AVAIL_MAP
     150  TComPicYuv*   getPicYuvAvail()      { return  m_apcPicYuvAvail; } //Owieczka - returns available map from other pic image
     151#endif
     152
     153#if POZNAN_SYNTH_VIEW
     154  TComPicYuv*   getPicYuvSynth()      { return  m_apcPicYuvSynth; } //Owieczka - returns synth form other pic in image
     155#endif
     156#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     157  TComPicYuv*   getPicYuvSynthDepth() { return  m_apcPicYuvSynthDepth; };    //  Sythesied depth image
     158#endif
    131159
    132160#if DEPTH_MAP_GENERATION
     
    203231
    204232  Void          addOriginalBuffer       ();
     233#if POZNAN_AVAIL_MAP
     234  Void          addAvailabilityBuffer   ();
     235#endif
     236#if POZNAN_SYNTH_VIEW
     237  Void          addSynthesisBuffer      ();
     238#endif
     239#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     240  Void          addSynthesisDepthBuffer ();
     241#endif
    205242#if PARALLEL_MERGED_DEBLK
    206243  Void          addDeblockBuffer        ();
     
    221258
    222259  Void          removeOriginalBuffer    ();
     260#if POZNAN_SYNTH_VIEW
     261  Void          removeSynthesisBuffer   ();
     262#endif
     263#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     264  Void          removeSynthesisDepthBuffer ();
     265#endif
     266#if POZNAN_AVAIL_MAP
     267  Void          removeAvailabilityBuffer();
     268#endif
    223269#if PARALLEL_MERGED_DEBLK
    224270  Void          removeDeblockBuffer     ();
     
    235281#if HHI_INTERVIEW_SKIP
    236282  Void          removeUsedPelsMapBuffer ();
     283#endif
     284
     285#if POZNAN_AVAIL_MAP
     286  Void          checkSynthesisAvailability(  TComDataCU*& rpcBestCU, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, Bool *&rpbCUSynthesied);
    237287#endif
    238288
     
    254304  const SEImessages* getSEIs() const { return m_SEIs; }
    255305
     306#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     307  Double getTexDqpAccordingToDepthOffset( )      { return m_dTexDqpAccordingToDepthOffset;}
     308  Double getTexDqpAccordingToDepthMul( )         { return m_dTexDqpAccordingToDepthMul;}
     309  Int    getTexDqpAccordingToDepthTopBottomRow( ){ return m_iTexDqpAccordingToDepthTopBottomRow;}
     310  Void   setTexDqpAccordingToDepthOffset      ( Double dTexDqpAccordingToDepthOffset    ){ m_dTextureCuDeltaQpOffset       = dTexDqpAccordingToDepthOffset; }
     311  Void   setTexDqpAccordingToDepthMul         ( Double dTexDqpAccordingToDepthMul       ){ m_dTexDqpAccordingToDepthMul          = dTexDqpAccordingToDepthMul; }
     312  Void   setTexDqpAccordingToDepthTopBottomRow( Int iTexDqpAccordingToDepthTopBottomRow ){ m_iTexDqpAccordingToDepthTopBottomRow = iTexDqpAccordingToDepthTopBottomRow; } 
     313#endif
    256314};// END CLASS DEFINITION TComPic
    257315
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicSym.h

    r5 r28  
    4343
    4444// Include files
     45#if POZNAN_MP
     46#include "../TLibCommon/TComMP.h"
     47#endif
     48
    4549#include "CommonDef.h"
    4650#include "TComSlice.h"
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicYuv.cpp

    r17 r28  
    88#include <assert.h>
    99#include <memory.h>
     10#include <math.h>
    1011
    1112#ifdef __APPLE__
     
    455456  }
    456457}
     458#if POZNAN_NONLINEAR_DEPTH
     459Void TComPicYuv::nonlinearDepthForward(TComPicYuv *pcPicDst, Float p)
     460{
     461  Int           x,y;
     462  TComNonlinearDepthForward cNonlinearDepthFwd(p, g_uiBitIncrement, g_uiBitIncrement);
     463
     464  // Luma
     465  Pel* pPelSrc = getLumaAddr();
     466  Pel* pPelDst = pcPicDst->getLumaAddr();
     467  for(y=0; y<m_iPicHeight; y++)
     468        {
     469    for(x=0; x<m_iPicWidth; x++)
     470    {
     471      pPelDst[x] = (Pel)( cNonlinearDepthFwd(pPelSrc[x]) + 0.5);
     472    }
     473    pPelDst += pcPicDst->getStride();
     474    pPelSrc += getStride();
     475  }
     476  // Chroma
     477  copyToPicCb(pcPicDst);
     478  copyToPicCr(pcPicDst);
     479}
     480Void TComPicYuv::nonlinearDepthBackward(TComPicYuv *pcPicDst, Float p)
     481{
     482  Int           x,y;
     483  TComNonlinearDepthBackward cNonlinearDepthBwd(p, g_uiBitIncrement, g_uiBitIncrement);
     484
     485  // Luma
     486  Pel* pPelSrc = getLumaAddr();
     487  Pel* pPelDst = pcPicDst->getLumaAddr();
     488  for(y=0; y<m_iPicHeight; y++)
     489        {
     490    for(x=0; x<m_iPicWidth; x++)
     491    {
     492      pPelDst[x] = (Pel)( cNonlinearDepthBwd(pPelSrc[x]) + 0.5);
     493    }
     494    pPelDst += pcPicDst->getStride();
     495    pPelSrc += getStride();
     496  }
     497  // Chroma
     498  copyToPicCb(pcPicDst);
     499  copyToPicCr(pcPicDst);
     500}
     501#endif
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPicYuv.h

    r5 r28  
    4444#include "CommonDef.h"
    4545
     46#if POZNAN_NONLINEAR_DEPTH
     47
     48#include <math.h>
     49
     50class TComNonlinearDepthForward // OLGIERD - Z-NL-Power conversion
     51{
     52private:
     53  Double m_fMul;
     54  Float m_fPower;
     55
     56public:
     57
     58  TComNonlinearDepthForward(Float fPower, Int iInputBitIncrement, Int iOutputBitIncrement)
     59  {
     60    m_fPower = fPower;
     61    Double fPostMul = (1<<(8+iOutputBitIncrement))-1; // OLGIERD ToDo - should be or not?
     62    Double fPreMul  = 1.0/((1<<(8+iInputBitIncrement))-1);
     63    m_fMul = fPostMul*pow(fPreMul,(Double)fPower);
     64  };
     65
     66  inline Double operator() (Double Value)
     67  {   
     68    if (Value<0) return -pow( -Value,(Double)m_fPower)*m_fMul;
     69    return pow(Value,(Double)m_fPower)*m_fMul;
     70  };
     71};
     72
     73class TComNonlinearDepthBackward // OLGIERD - Z-NL-Power conversion
     74{
     75private:
     76  Double m_fMul;
     77  Float m_fPower;
     78
     79public:
     80
     81  TComNonlinearDepthBackward(Float fPower, Int iInputBitIncrement, Int iOutputBitIncrement)
     82  {     
     83    m_fPower = fPower = 1.0/fPower;
     84    Double fPostMul = (1<<(8+iOutputBitIncrement))-1; // OLGIERD ToDo - should be or not?
     85    Double fPreMul  = 1.0/((1<<(8+iInputBitIncrement))-1);
     86    m_fMul = fPostMul*pow(fPreMul,(Double)fPower);
     87  };
     88
     89  inline Double operator() (Double Value)
     90  {   
     91    if (Value<0) return -pow( -Value,(Double)m_fPower)*m_fMul;
     92    return pow(Value,(Double)m_fPower)*m_fMul;
     93  };
     94};
     95#endif
    4696// ====================================================================================================================
    4797// Class definition
     
    175225  Void  setChromaTo  ( Pel pVal ); 
    176226
     227#if POZNAN_NONLINEAR_DEPTH
     228  Void nonlinearDepthForward(TComPicYuv *pcPicDst, Float p);
     229  Void nonlinearDepthBackward(TComPicYuv *pcPicDst, Float p);
     230#endif
    177231};// END CLASS DEFINITION TComPicYuv
    178232
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPrediction.cpp

    r21 r28  
    15211521    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    15221522
     1523#if POZNAN_DBMP
     1524        if(pcCU->getMergeIndex(uiPartAddr)==POZNAN_DBMP_MRG_CAND)
     1525        {
     1526#if DEPTH_MAP_GENERATION
     1527                motionCompensation_DBMP( pcCU, pcYuvPred, eRefPicList, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     1528#else
     1529                motionCompensation_DBMP( pcCU, pcYuvPred, eRefPicList, iPartIdx );
     1530#endif
     1531                return;
     1532        }
     1533#endif
     1534
    15231535#if DEPTH_MAP_GENERATION
    15241536    if( bPrdDepthMap )
     
    15581570    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    15591571
     1572#if POZNAN_DBMP
     1573        if(pcCU->getMergeIndex(uiPartAddr)==POZNAN_DBMP_MRG_CAND)
     1574        {
     1575#if DEPTH_MAP_GENERATION
     1576                motionCompensation_DBMP( pcCU, pcYuvPred, eRefPicList, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     1577#else
     1578                motionCompensation_DBMP( pcCU, pcYuvPred, eRefPicList, iPartIdx );
     1579#endif
     1580                continue;
     1581        }
     1582#endif
     1583
    15601584#if DEPTH_MAP_GENERATION
    15611585    if( bPrdDepthMap )
     
    15911615  return;
    15921616}
     1617
     1618#if POZNAN_DBMP
     1619#if DEPTH_MAP_GENERATION
     1620Void TComPrediction::motionCompensation_DBMP ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     1621#else
     1622Void TComPrediction::motionCompensation_DBMP ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
     1623#endif
     1624{
     1625  if(!pcCU->getSlice()->getMP()->isDBMPEnabled()) return;
     1626
     1627  Int         iPartIdxOrg = iPartIdx;
     1628  Int         iWidth;
     1629  Int         iHeight;
     1630  UInt        uiPartAddr;
     1631
     1632  Int             x,y;
     1633  Int             px,py,iCUBaseX,iCUBaseY;
     1634  Int             ref_frame0, ref_frame1;
     1635  Int             ref_frame0_idx, ref_frame1_idx;
     1636  TComMv          mv0,mv1;
     1637 
     1638  Int             ref_frame0_idx_2nd, ref_frame1_idx_2nd;
     1639  TComMv          mv0_2nd,mv1_2nd;
     1640
     1641  Pel* piDstCb;
     1642  Pel* piDstCr;
     1643  Pel aiUTab[MAX_CU_SIZE];
     1644  Pel aiVTab[MAX_CU_SIZE];
     1645  Pel iULast;
     1646  Pel iVLast;
     1647  Pel iTemp;
     1648
     1649  TComMP* pcMP = pcCU->getSlice()->getMP();
     1650  UInt uiViewId = pcCU->getSlice()->getSPS()->getViewId();
     1651  Bool bIsDepth = pcCU->getSlice()->getSPS()->isDepth();
     1652
     1653#if POZNAN_DBMP_CALC_PRED_DATA
     1654  UInt uiPointCnt;
     1655#endif
     1656   
     1657  for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ )
     1658  {
     1659        if ( iPartIdxOrg >= 0 ) iPartIdx = iPartIdxOrg;
     1660
     1661    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
     1662
     1663        //get motion data used for no-MP predicted points
     1664#if POZNAN_DBMP_CALC_PRED_DATA
     1665        ref_frame0_idx_2nd = pcCU->getCUMvField2nd(REF_PIC_LIST_0)->getRefIdx(uiPartAddr);
     1666        mv0_2nd = pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     1667
     1668        ref_frame1_idx_2nd = pcCU->getCUMvField2nd(REF_PIC_LIST_1)->getRefIdx(uiPartAddr);
     1669        mv1_2nd = pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     1670#else
     1671        ref_frame0_idx_2nd = pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiPartAddr);
     1672        mv0_2nd = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     1673
     1674        ref_frame1_idx_2nd = pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiPartAddr);
     1675        mv1_2nd = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     1676#endif
     1677
     1678        iCUBaseX = pcCU->getCUPelX()+g_auiRasterToPelX[ g_auiZscanToRaster[uiPartAddr] ];
     1679        iCUBaseY = pcCU->getCUPelY()+g_auiRasterToPelY[ g_auiZscanToRaster[uiPartAddr] ];
     1680
     1681#if DEPTH_MAP_GENERATION
     1682    if( bPrdDepthMap )
     1683    {
     1684      iWidth  >>= uiSubSampExpX;
     1685      iHeight >>= uiSubSampExpY;
     1686    }
     1687#endif
     1688
     1689#if POZNAN_DBMP_CALC_PRED_DATA
     1690        uiPointCnt = 0;
     1691#endif
     1692
     1693        for( py = 0; py < iHeight; py++)
     1694        {
     1695                for( px = 0; px < iWidth; px++)
     1696                {
     1697#if DEPTH_MAP_GENERATION
     1698                        if( bPrdDepthMap )
     1699                        {
     1700                                x = iCUBaseX+(px<<uiSubSampExpX);
     1701                                y = iCUBaseY+(py<<uiSubSampExpY);
     1702                        }
     1703                        else
     1704#endif
     1705                        {
     1706                                x = iCUBaseX+px;
     1707                                y = iCUBaseY+py;
     1708                        }
     1709
     1710                        pcMP->getDBMPPredData(pcCU, x, y, ref_frame0, ref_frame0_idx, mv0, ref_frame0_idx_2nd, mv0_2nd,
     1711                                                                                ref_frame1, ref_frame1_idx, mv1, ref_frame1_idx_2nd, mv1_2nd);
     1712
     1713                        pcCU->getCUMvField(REF_PIC_LIST_0)->setRefIdx(ref_frame0_idx, uiPartAddr);
     1714                        pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv0, uiPartAddr );
     1715
     1716                        pcCU->getCUMvField(REF_PIC_LIST_1)->setRefIdx(ref_frame1_idx, uiPartAddr);
     1717                        pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv1, uiPartAddr );
     1718
     1719                        if ( eRefPicList != REF_PIC_LIST_X )
     1720                        {
     1721#if DEPTH_MAP_GENERATION
     1722                          xPredInterUni_DBMP (pcCU, uiPartAddr, px, py, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     1723#else
     1724                          xPredInterUni_DBMP (pcCU, uiPartAddr, px, py, eRefPicList, pcYuvPred, iPartIdx );
     1725#endif
     1726#ifdef WEIGHT_PRED
     1727                          if ( pcCU->getSlice()->getPPS()->getUseWP() )
     1728                          {
     1729                            xWeightedPredictionUni_DBMP( pcCU, pcYuvPred, uiPartAddr, px, py, eRefPicList, pcYuvPred, iPartIdx );
     1730                          }
     1731#endif
     1732                        }
     1733                        else
     1734                        {
     1735#if DEPTH_MAP_GENERATION
     1736                          xPredInterBi_DBMP  (pcCU, uiPartAddr, px, py, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     1737#else
     1738                          xPredInterBi_DBMP  (pcCU, uiPartAddr, px, py, pcYuvPred, iPartIdx );
     1739#endif
     1740                        }                       
     1741
     1742                        if(!pcCU->getSlice()->getSPS()->isDepth()) // Chroma check only for non depth
     1743                        {
     1744                        piDstCb = pcYuvPred->getCbAddr( uiPartAddr ) + (py>>1)*pcYuvPred->getCStride();
     1745                        piDstCr = pcYuvPred->getCrAddr( uiPartAddr ) + (py>>1)*pcYuvPred->getCStride();
     1746
     1747                        //Chroma decimation 16x16 -> 8x8:
     1748                        if(py%2 && px%2)
     1749                        {
     1750                                iTemp = (aiUTab[px-1] + aiUTab[px] + iULast + piDstCb[px>>1] + 2)>>2;
     1751                                aiUTab[px-1] = iULast;
     1752                                iULast = piDstCb[px>>1];
     1753                                piDstCb[px>>1] = iTemp;
     1754
     1755                                iTemp = (aiVTab[px-1] + aiVTab[px] + iVLast + piDstCr[px>>1] + 2)>>2;
     1756                                aiVTab[px-1] = iVLast;
     1757                                iVLast = piDstCr[px>>1];
     1758                                piDstCr[px>>1] = iTemp;
     1759                        }
     1760                        else
     1761                        {
     1762                                aiUTab[(px==0)? iWidth-1 : (px-1)] = iULast;   
     1763                                iULast = piDstCb[px>>1];
     1764
     1765                                aiVTab[(px==0)? iWidth-1 : (px-1)] = iVLast;                           
     1766                                iVLast = piDstCr[px>>1];
     1767                        }       
     1768                        }
     1769
     1770#if !POZNAN_DBMP_COMPRESS_ME_DATA
     1771                        //save motion data for every CU point
     1772#if DEPTH_MAP_GENERATION
     1773                        if( !bPrdDepthMap )
     1774#endif
     1775                        {
     1776                                pcMP->setL0RefPOC(uiViewId,bIsDepth,x,y,ref_frame0);
     1777                                pcMP->setL0MvX(uiViewId,bIsDepth,x,y,mv0.getHor());
     1778                                pcMP->setL0MvY(uiViewId,bIsDepth,x,y,mv0.getVer());
     1779
     1780                                pcMP->setL1RefPOC(uiViewId,bIsDepth,x,y,ref_frame1);
     1781                                pcMP->setL1MvX(uiViewId,bIsDepth,x,y,mv1.getHor());
     1782                                pcMP->setL1MvY(uiViewId,bIsDepth,x,y,mv1.getVer());
     1783                        }
     1784#endif
     1785
     1786#if POZNAN_DBMP_CALC_PRED_DATA
     1787#if DEPTH_MAP_GENERATION
     1788                        if( !bPrdDepthMap )
     1789#endif
     1790                        {
     1791                                pcMP->getTempL0RefIdx()[uiPointCnt] = ref_frame0_idx;
     1792                                pcMP->getTempL0MvX()[uiPointCnt] = mv0.getHor();
     1793                                pcMP->getTempL0MvY()[uiPointCnt] = mv0.getVer();
     1794
     1795                                pcMP->getTempL1RefIdx()[uiPointCnt] = ref_frame1_idx;
     1796                                pcMP->getTempL1MvX()[uiPointCnt] = mv1.getHor();
     1797                                pcMP->getTempL1MvY()[uiPointCnt] = mv1.getVer();                       
     1798                        }
     1799                        uiPointCnt++;
     1800#endif
     1801
     1802                }
     1803        }
     1804
     1805        //set motion data representing CU with DBMP
     1806#if DEPTH_MAP_GENERATION
     1807        if( !bPrdDepthMap )
     1808#endif
     1809        {
     1810                PartSize ePartSize = pcCU->getPartitionSize( uiPartAddr ); //PartSize ePartSize = pcCU->getPartitionSize( 0 );
     1811#if POZNAN_DBMP_CALC_PRED_DATA
     1812                pcMP->xCalcDBMPPredData(uiPointCnt, ref_frame0_idx, mv0, ref_frame1_idx, mv1);
     1813               
     1814                pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( mv0, ref_frame0_idx, ePartSize, uiPartAddr, iPartIdx, 0 );         
     1815                pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( mv1, ref_frame1_idx, ePartSize, uiPartAddr, iPartIdx, 0 );
     1816#else
     1817                pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( mv0_2nd, ref_frame0_idx_2nd, ePartSize, uiPartAddr, iPartIdx, 0 );
     1818                pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( mv1_2nd, ref_frame1_idx_2nd, ePartSize, uiPartAddr, iPartIdx, 0 );
     1819#endif
     1820        }
     1821
     1822        if ( iPartIdxOrg >= 0 ) break;
     1823  }
     1824  return;
     1825}
     1826#endif
    15931827
    15941828#if HIGH_ACCURACY_BI
     
    21352369}
    21362370
     2371
     2372
     2373#if POZNAN_DBMP
     2374
     2375#if HIGH_ACCURACY_BI
     2376#if DEPTH_MAP_GENERATION
     2377Void TComPrediction::xPredInterUni_DBMP ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
     2378#else
     2379Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi )
     2380#endif
     2381#else
     2382#if DEPTH_MAP_GENERATION
     2383Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     2384#else
     2385Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx )
     2386#endif
     2387#endif
     2388{
     2389  Int         iRefIdx     = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           assert (iRefIdx >= 0);
     2390  TComMv      cMv         = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     2391  pcCU->clipMv(cMv);
     2392
     2393#if DEPTH_MAP_GENERATION
     2394  if( bPrdDepthMap )
     2395  {
     2396        UInt uiRShift = 0;
     2397        xPredInterPrdDepthMap_DBMP( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iPosX, iPosY, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift );
     2398    return;
     2399  }
     2400#endif
     2401
     2402#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     2403  if( pcCU->getSlice()->getSPS()->isDepth() )
     2404  {
     2405#if HIGH_ACCURACY_BI
     2406    UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 );
     2407#else
     2408    UInt uiRShift = 0;
     2409#endif
     2410#if DEPTH_MAP_GENERATION
     2411    xPredInterPrdDepthMap_DBMP( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, 0, 0, rpcYuvPred, uiRShift );
     2412#else
     2413    xPredInterPrdDepthMap_DBMP( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred, uiRShift );
     2414#endif
     2415  }
     2416  else
     2417  {
     2418#endif
     2419#if HIGH_ACCURACY_BI
     2420  if(!bi)
     2421  {
     2422    xPredInterLumaBlk_DBMP ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2423  }
     2424  else
     2425  {
     2426    xPredInterLumaBlk_DBMP_ha  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2427  }
     2428#else
     2429  xPredInterLumaBlk_DBMP       ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2430#endif
     2431#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     2432  }
     2433#endif
     2434
     2435#if HIGH_ACCURACY_BI
     2436  if (!bi)
     2437  {
     2438        xPredInterChromaBlk_DBMP     ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2439  }
     2440  else
     2441  {
     2442        xPredInterChromaBlk_DBMP_ha ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec()    , uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2443  }
     2444#else
     2445  xPredInterChromaBlk_DBMP     ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iPosX, iPosY, rpcYuvPred );
     2446#endif
     2447}
     2448
     2449#if DEPTH_MAP_GENERATION
     2450Void TComPrediction::xPredInterBi_DBMP ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
     2451#else
     2452Void TComPrediction::xPredInterBi_DBMP ( TComDataCU* pcCU, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvPred, Int iPartIdx )
     2453#endif
     2454{
     2455  TComYuv* pcMbYuv;
     2456  Int      iRefIdx[2] = {-1, -1};
     2457
     2458  for ( Int iRefList = 0; iRefList < 2; iRefList++ )
     2459  {
     2460    RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
     2461    iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     2462
     2463    if ( iRefIdx[iRefList] < 0 )
     2464    {
     2465      continue;
     2466    }
     2467
     2468    assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) );
     2469
     2470    pcMbYuv = &m_acYuvPred[iRefList];
     2471#if HIGH_ACCURACY_BI
     2472    if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 )
     2473#if DEPTH_MAP_GENERATION
     2474      xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     2475#else
     2476      xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, true );
     2477#endif
     2478    else
     2479#if DEPTH_MAP_GENERATION
     2480      xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     2481#else
     2482      xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx );
     2483#endif
     2484#else
     2485#if DEPTH_MAP_GENERATION
     2486    xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     2487#else
     2488    xPredInterUni_DBMP ( pcCU, uiPartAddr, iPosX, iPosY, eRefPicList, pcMbYuv, iPartIdx );
     2489#endif
     2490#endif
     2491  }
     2492
     2493#ifdef WEIGHT_PRED
     2494  if ( pcCU->getSlice()->getPPS()->getWPBiPredIdc() )
     2495  {
     2496    xWeightedPredictionBi_DBMP( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred );
     2497  }
     2498  else
     2499#endif
     2500
     2501#if DEPTH_MAP_GENERATION
     2502  if ( bPrdDepthMap )
     2503  {
     2504    xWeightedAveragePdm_DBMP( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred, uiSubSampExpX, uiSubSampExpY );
     2505  }
     2506  else
     2507  {
     2508    xWeightedAverage_DBMP( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred );
     2509  }
     2510#else
     2511  xWeightedAverage_DBMP( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iPosX, iPosY, rpcYuvPred );
     2512#endif
     2513}
     2514
     2515Void
     2516#if DEPTH_MAP_GENERATION
     2517TComPrediction::xPredInterPrdDepthMap_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift )
     2518#else
     2519TComPrediction::xPredInterPrdDepthMap_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv, UInt uiRShift )
     2520#endif
     2521{
     2522#if DEPTH_MAP_GENERATION
     2523  Int     iShiftX     = 2 + uiSubSampExpX;
     2524  Int     iShiftY     = 2 + uiSubSampExpY;
     2525  Int     iAddX       = ( 1 << iShiftX ) >> 1;
     2526  Int     iAddY       = ( 1 << iShiftY ) >> 1;
     2527  Int     iHor        = ( pcMv->getHor() + iAddX ) >> iShiftX;
     2528  Int     iVer        = ( pcMv->getVer() + iAddY ) >> iShiftY;
     2529#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     2530  if( pcCU->getSlice()->getSPS()->isDepth() )
     2531  {
     2532    iHor = pcMv->getHor();
     2533    iVer = pcMv->getVer();
     2534  }
     2535#endif
     2536  Int     iRefStride  = pcPicYuvRef->getStride();
     2537  Int     iDstStride  = rpcYuv->getStride();
     2538  Int     iRefOffset  = iHor + iVer * iRefStride;
     2539#else
     2540  Int     iFPelMask   = ~3;
     2541  Int     iRefStride  = pcPicYuvRef->getStride();
     2542  Int     iDstStride  = rpcYuv->getStride();
     2543  Int     iHor        = ( pcMv->getHor() + 2 ) & iFPelMask;
     2544  Int     iVer        = ( pcMv->getVer() + 2 ) & iFPelMask;
     2545#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     2546  if( pcCU->getSlice()->getSPS()->isDepth() )
     2547  {
     2548    iHor = pcMv->getHor() * 4;
     2549    iVer = pcMv->getVer() * 4;
     2550  }
     2551#endif
     2552  Int     ixFrac      = iHor & 0x3;
     2553  Int     iyFrac      = iVer & 0x3;
     2554  Int     iRefOffset  = ( iHor >> 2 ) + ( iVer >> 2 ) * iRefStride;
     2555#endif
     2556
     2557  Pel*    piRefY      = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2558  Pel*    piDstY      = rpcYuv->getLumaAddr( uiPartAddr );
     2559
     2560  piDstY[ iPosY*iDstStride + iPosX ] = piRefY[ iPosY*iRefStride + iPosX ] << uiRShift;
     2561}
     2562
     2563
     2564#if HIGH_ACCURACY_BI
     2565
     2566Void  TComPrediction::xPredInterLumaBlk_DBMP_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv )
     2567{
     2568  Int     iRefStride = pcPicYuvRef->getStride();
     2569  Int     iDstStride = rpcYuv->getStride();
     2570
     2571  Int     iRefOffset = ( pcMv->getHor() >> 2 ) + ( pcMv->getVer() >> 2 ) * iRefStride;
     2572  Pel*    piRefY     = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2573
     2574  Int     ixFrac  = pcMv->getHor() & 0x3;
     2575  Int     iyFrac  = pcMv->getVer() & 0x3;
     2576
     2577  Pel* piDstY = rpcYuv->getLumaAddr( uiPartAddr );
     2578  UInt shiftNum = 14-g_uiBitDepth-g_uiBitIncrement;
     2579
     2580  piDstY += iPosY*iDstStride+iPosX;
     2581  piRefY += iPosY*iRefStride+iPosX;
     2582
     2583  //  Integer point
     2584  if ( ixFrac == 0 && iyFrac == 0 )
     2585  {
     2586    *piDstY = (*piRefY)<<shiftNum;
     2587    return;
     2588  }
     2589
     2590  Int iWidth = 1;
     2591  Int iHeight = 1;
     2592
     2593  //  Half-pel horizontal
     2594  if ( ixFrac == 2 && iyFrac == 0 )
     2595  {
     2596    xCTI_FilterHalfHor_ha ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2597    return;
     2598  }
     2599
     2600  //  Half-pel vertical
     2601  if ( ixFrac == 0 && iyFrac == 2 )
     2602  {
     2603    xCTI_FilterHalfVer_ha ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2604    return;
     2605  }
     2606
     2607  Int   iExtStride = m_iYuvExtStride;//m_cYuvExt.getStride();
     2608  Int*  piExtY     = m_piYuvExt;//m_cYuvExt.getLumaAddr();
     2609
     2610  //  Half-pel center
     2611  if ( ixFrac == 2 && iyFrac == 2 )
     2612  {
     2613    xCTI_FilterHalfVer (piRefY - 3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2614    xCTI_FilterHalfHor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2615    return;
     2616  }
     2617
     2618  //  Quater-pel horizontal
     2619  if ( iyFrac == 0)
     2620  {
     2621    if ( ixFrac == 1)
     2622    {
     2623      xCTI_FilterQuarter0Hor_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2624      return;
     2625    }
     2626    if ( ixFrac == 3)
     2627    {
     2628      xCTI_FilterQuarter1Hor_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2629      return;
     2630    }
     2631  }
     2632  if ( iyFrac == 2 )
     2633  {
     2634    if ( ixFrac == 1)
     2635    {
     2636      xCTI_FilterHalfVer (piRefY -3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2637      xCTI_FilterQuarter0Hor_ha (piExtY + 3,  iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2638      return;
     2639    }
     2640    if ( ixFrac == 3)
     2641    {
     2642      xCTI_FilterHalfVer (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2643      xCTI_FilterQuarter1Hor_ha (piExtY + 3,  iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2644      return;
     2645    }
     2646  }
     2647
     2648  //  Quater-pel vertical
     2649  if( ixFrac == 0 )
     2650  {
     2651    if( iyFrac == 1 )
     2652    {
     2653      xCTI_FilterQuarter0Ver_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2654      return;
     2655    }
     2656    if( iyFrac == 3 )
     2657    {
     2658      xCTI_FilterQuarter1Ver_ha( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2659      return;
     2660    }
     2661  }
     2662
     2663  if( ixFrac == 2 )
     2664  {
     2665    if( iyFrac == 1 )
     2666    {
     2667      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2668      xCTI_FilterHalfHor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2669
     2670      return;
     2671    }
     2672    if( iyFrac == 3 )
     2673    {
     2674      xCTI_FilterQuarter1Ver (piRefY -3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2675      xCTI_FilterHalfHor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2676      return;
     2677    }
     2678  }
     2679
     2680  /// Quarter-pel center
     2681  if ( iyFrac == 1)
     2682  {
     2683    if ( ixFrac == 1)
     2684    {
     2685      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2686      xCTI_FilterQuarter0Hor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2687      return;
     2688    }
     2689    if ( ixFrac == 3)
     2690    {
     2691      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2692      xCTI_FilterQuarter1Hor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2693
     2694      return;
     2695    }
     2696  }
     2697  if ( iyFrac == 3 )
     2698  {
     2699    if ( ixFrac == 1)
     2700    {
     2701      xCTI_FilterQuarter1Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2702      xCTI_FilterQuarter0Hor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2703      return;
     2704    }
     2705    if ( ixFrac == 3)
     2706    {
     2707      xCTI_FilterQuarter1Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2708      xCTI_FilterQuarter1Hor_ha (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2709      return;
     2710    }
     2711  }
     2712}
     2713
     2714#endif
     2715
     2716Void  TComPrediction::xPredInterLumaBlk_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv )
     2717{
     2718  Int     iRefStride = pcPicYuvRef->getStride();
     2719  Int     iDstStride = rpcYuv->getStride();
     2720
     2721  Int     iRefOffset = ( pcMv->getHor() >> 2 ) + ( pcMv->getVer() >> 2 ) * iRefStride;
     2722  Pel*    piRefY     = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2723
     2724  Int     ixFrac  = pcMv->getHor() & 0x3;
     2725  Int     iyFrac  = pcMv->getVer() & 0x3;
     2726
     2727  Pel* piDstY = rpcYuv->getLumaAddr( uiPartAddr );
     2728 
     2729  piDstY += iPosY*iDstStride+iPosX;
     2730  piRefY += iPosY*iRefStride+iPosX;
     2731
     2732  //  Integer point
     2733  if ( ixFrac == 0 && iyFrac == 0 )
     2734  {
     2735    ::memcpy(piDstY, piRefY, sizeof(Pel));
     2736    return;
     2737  }
     2738
     2739  Int iWidth = 1;
     2740  Int iHeight = 1;
     2741
     2742  //  Half-pel horizontal
     2743  if ( ixFrac == 2 && iyFrac == 0 )
     2744  {
     2745    xCTI_FilterHalfHor ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2746    return;
     2747  }
     2748
     2749  //  Half-pel vertical
     2750  if ( ixFrac == 0 && iyFrac == 2 )
     2751  {
     2752    xCTI_FilterHalfVer ( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2753    return;
     2754  }
     2755
     2756  Int   iExtStride = m_iYuvExtStride;//m_cYuvExt.getStride();
     2757  Int*  piExtY     = m_piYuvExt;//m_cYuvExt.getLumaAddr();
     2758
     2759  //  Half-pel center
     2760  if ( ixFrac == 2 && iyFrac == 2 )
     2761  {
     2762
     2763    xCTI_FilterHalfVer (piRefY - 3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2764    xCTI_FilterHalfHor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2765    return;
     2766  }
     2767
     2768  //  Quater-pel horizontal
     2769  if ( iyFrac == 0)
     2770  {
     2771    if ( ixFrac == 1)
     2772    {
     2773      xCTI_FilterQuarter0Hor( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2774      return;
     2775    }
     2776    if ( ixFrac == 3)
     2777    {
     2778      xCTI_FilterQuarter1Hor( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2779      return;
     2780    }
     2781  }
     2782  if ( iyFrac == 2 )
     2783  {
     2784    if ( ixFrac == 1)
     2785    {
     2786      xCTI_FilterHalfVer (piRefY -3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2787      xCTI_FilterQuarter0Hor (piExtY + 3,  iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2788      return;
     2789    }
     2790    if ( ixFrac == 3)
     2791    {
     2792      xCTI_FilterHalfVer (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2793      xCTI_FilterQuarter1Hor (piExtY + 3,  iExtStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2794      return;
     2795    }
     2796  }
     2797
     2798  //  Quater-pel vertical
     2799  if( ixFrac == 0 )
     2800  {
     2801    if( iyFrac == 1 )
     2802    {
     2803      xCTI_FilterQuarter0Ver( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2804      return;
     2805    }
     2806    if( iyFrac == 3 )
     2807    {
     2808      xCTI_FilterQuarter1Ver( piRefY, iRefStride, 1, iWidth, iHeight, iDstStride, 1, piDstY );
     2809      return;
     2810    }
     2811  }
     2812
     2813  if( ixFrac == 2 )
     2814  {
     2815    if( iyFrac == 1 )
     2816    {
     2817      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2818      xCTI_FilterHalfHor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2819      return;
     2820    }
     2821    if( iyFrac == 3 )
     2822    {
     2823      xCTI_FilterQuarter1Ver (piRefY -3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2824      xCTI_FilterHalfHor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2825      return;
     2826    }
     2827  }
     2828
     2829  /// Quarter-pel center
     2830  if ( iyFrac == 1)
     2831  {
     2832    if ( ixFrac == 1)
     2833    {
     2834      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2835      xCTI_FilterQuarter0Hor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2836      return;
     2837    }
     2838    if ( ixFrac == 3)
     2839    {
     2840      xCTI_FilterQuarter0Ver (piRefY - 3,  iRefStride, 1, iWidth +7, iHeight, iExtStride, 1, piExtY );
     2841      xCTI_FilterQuarter1Hor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2842      return;
     2843    }
     2844  }
     2845  if ( iyFrac == 3 )
     2846  {
     2847    if ( ixFrac == 1)
     2848    {
     2849      xCTI_FilterQuarter1Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2850      xCTI_FilterQuarter0Hor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2851      return;
     2852    }
     2853    if ( ixFrac == 3)
     2854    {
     2855      xCTI_FilterQuarter1Ver (piRefY - 3,  iRefStride, 1, iWidth + 7, iHeight, iExtStride, 1, piExtY );
     2856      xCTI_FilterQuarter1Hor (piExtY + 3,  iExtStride, 1, iWidth    , iHeight, iDstStride, 1, piDstY );
     2857      return;
     2858    }
     2859  }
     2860}
     2861
     2862#if HIGH_ACCURACY_BI
     2863Void TComPrediction::xPredInterChromaBlk_DBMP_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv )
     2864{
     2865  Int     iRefStride  = pcPicYuvRef->getCStride();
     2866  Int     iDstStride  = rpcYuv->getCStride();
     2867
     2868  Int     iRefOffset  = (pcMv->getHor() >> 3) + (pcMv->getVer() >> 3) * iRefStride;
     2869
     2870  Pel*    piRefCb     = pcPicYuvRef->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2871  Pel*    piRefCr     = pcPicYuvRef->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2872
     2873  Pel* piDstCb = rpcYuv->getCbAddr( uiPartAddr );
     2874  Pel* piDstCr = rpcYuv->getCrAddr( uiPartAddr );
     2875
     2876  Int     ixFrac  = pcMv->getHor() & 0x7;
     2877  Int     iyFrac  = pcMv->getVer() & 0x7;
     2878  UInt    uiCWidth  = 1;
     2879  UInt    uiCHeight = 1;
     2880
     2881  piDstCb += (iPosY>>1)*iDstStride+(iPosX>>1);
     2882  piDstCr += (iPosY>>1)*iDstStride+(iPosX>>1);
     2883  piRefCb += (iPosY>>1)*iRefStride+(iPosX>>1);
     2884  piRefCr += (iPosY>>1)*iRefStride+(iPosX>>1);
     2885
     2886  xDCTIF_FilterC_ha(piRefCb, iRefStride,piDstCb,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac);
     2887  xDCTIF_FilterC_ha(piRefCr, iRefStride,piDstCr,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac);
     2888  return;
     2889}
     2890#endif
     2891
     2892//--
     2893Void TComPrediction::xPredInterChromaBlk_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, TComYuv*& rpcYuv )
     2894{
     2895  Int     iRefStride  = pcPicYuvRef->getCStride();
     2896  Int     iDstStride  = rpcYuv->getCStride();
     2897
     2898  Int     iRefOffset  = (pcMv->getHor() >> 3) + (pcMv->getVer() >> 3) * iRefStride;
     2899
     2900  Pel*    piRefCb     = pcPicYuvRef->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2901  Pel*    piRefCr     = pcPicYuvRef->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
     2902
     2903  Pel* piDstCb = rpcYuv->getCbAddr( uiPartAddr );
     2904  Pel* piDstCr = rpcYuv->getCrAddr( uiPartAddr );
     2905
     2906  Int     ixFrac  = pcMv->getHor() & 0x7;
     2907  Int     iyFrac  = pcMv->getVer() & 0x7;
     2908  UInt    uiCWidth  = 1;
     2909  UInt    uiCHeight = 1;
     2910
     2911  piDstCb += (iPosY>>1)*iDstStride+(iPosX>>1);
     2912  piDstCr += (iPosY>>1)*iDstStride+(iPosX>>1);
     2913  piRefCb += (iPosY>>1)*iRefStride+(iPosX>>1);
     2914  piRefCr += (iPosY>>1)*iRefStride+(iPosX>>1);
     2915
     2916  xDCTIF_FilterC(piRefCb, iRefStride,piDstCb,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac);
     2917  xDCTIF_FilterC(piRefCr, iRefStride,piDstCr,iDstStride,uiCWidth,uiCHeight, iyFrac, ixFrac);
     2918  return;
     2919}
     2920
     2921#endif
     2922
     2923
    21372924Void  TComPrediction::xDCTIF_FilterC ( Pel*  piRefC, Int iRefStride,Pel*  piDstC,Int iDstStride,
    21382925                                       Int iWidth, Int iHeight,Int iMVyFrac,Int iMVxFrac)
     
    22603047  }
    22613048}
     3049
     3050#if POZNAN_DBMP
     3051
     3052#if DEPTH_MAP_GENERATION
     3053Void TComPrediction::xWeightedAveragePdm_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY )
     3054{
     3055  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     3056  {
     3057    rpcYuvDst->addAvgPdm_DBMP( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY, uiSubSampExpX, uiSubSampExpY );
     3058  }
     3059  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     3060  {
     3061    pcYuvSrc0->copyPartToPartYuvPdm_DBMP( rpcYuvDst, uiPartIdx, iPosX, iPosY, uiSubSampExpX, uiSubSampExpY );
     3062  }
     3063  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     3064  {
     3065    pcYuvSrc1->copyPartToPartYuvPdm_DBMP( rpcYuvDst, uiPartIdx, iPosX, iPosY, uiSubSampExpX, uiSubSampExpY );
     3066  }
     3067  else
     3068  {
     3069    assert (0);
     3070  }
     3071}
     3072#endif
     3073
     3074Void TComPrediction::xWeightedAverage_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst )
     3075{
     3076  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     3077  {
     3078#ifdef ROUNDING_CONTROL_BIPRED
     3079    rpcYuvDst->addAvg_DBMP( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY, pcCU->getSlice()->isRounding());
     3080#else
     3081    rpcYuvDst->addAvg_DBMP( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY );
     3082#endif
     3083  }
     3084  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     3085  {
     3086    pcYuvSrc0->copyPartToPartYuv_DBMP( rpcYuvDst, uiPartIdx, iPosX, iPosY );
     3087  }
     3088  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     3089  {
     3090    pcYuvSrc1->copyPartToPartYuv_DBMP( rpcYuvDst, uiPartIdx, iPosX, iPosY );
     3091  }
     3092  else
     3093  {
     3094    assert (0);
     3095  }
     3096}
     3097#endif
    22623098
    22633099// AMVP
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComPrediction.h

    r21 r28  
    5252#endif
    5353
     54#if POZNAN_MP
     55#include "../TLibCommon/TComMP.h"
     56#endif
     57
    5458// ====================================================================================================================
    5559// Class definition
     
    124128#endif
    125129
     130#if POZNAN_DBMP
     131#if HIGH_ACCURACY_BI
     132#if DEPTH_MAP_GENERATION
     133  Void xPredInterUni_DBMP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false          );
     134#else
     135  Void xPredInterUni_DBMP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false          );
     136#endif
     137#else
     138#if DEPTH_MAP_GENERATION
     139  Void xPredInterUni_DBMP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
     140#else
     141  Void xPredInterUni_DBMP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx          );
     142#endif
     143#endif
     144#if DEPTH_MAP_GENERATION
     145  Void xPredInterBi_DBMP        ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
     146  Void xPredInterPrdDepthMap_DBMP( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift );
     147#else
     148  Void xPredInterBi_DBMP             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iPosX, Int iPosY,                         TComYuv*& rpcYuvPred, Int iPartIdx );
     149  Void xPredInterPrdDepthMap_DBMP    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv, UInt uiRShift );
     150#endif
     151 
     152  Void xPredInterLumaBlk_DBMP   ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv );
     153  Void xPredInterChromaBlk_DBMP ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv );
     154 
     155#if DEPTH_MAP_GENERATION
     156  Void xWeightedAveragePdm_DBMP      ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY );
     157#endif
     158  Void xWeightedAverage_DBMP         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iPosX, Int iPosY, TComYuv*& rpcYuvDst );
     159 
     160#if HIGH_ACCURACY_BI
     161  Void xPredInterLumaBlk_DBMP_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv );
     162  Void xPredInterChromaBlk_DBMP_ha( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iPosX, Int iPosY,                         TComYuv*& rpcYuv                            );
     163#endif
     164#endif
     165
    126166#if HHI_DMM_WEDGE_INTRA
    127167  Void xPredIntraWedgeFull       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder, Bool bDelta, UInt uiTabIdx, Int iDeltaDC1 = 0, Int iDeltaDC2 = 0 );
     
    160200#else
    161201  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
     202#endif
     203 
     204#if POZNAN_DBMP
     205#if DEPTH_MAP_GENERATION
     206  Void motionCompensation_DBMP         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
     207#else
     208  Void motionCompensation_DBMP         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
     209#endif
     210 
    162211#endif
    163212 
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r21 r28  
    306306    xSetRecResidualInterCU( pcSubCU, pcSubRes );
    307307    break;
     308#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     309  case MODE_SYNTH:
     310    xSetRecResidualIntraCU( pcSubCU, pcSubRes ); //MayBe it should be seperate function
     311    break;
     312#endif
    308313  default:
    309314    AOT( true );
     
    336341  UInt    uiLumaTrMode, uiChromaTrMode;
    337342  pcCU->convertTransIdx             ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode );
     343#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     344  m_pcTrQuant->setQPforQuant        ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(0/*uiAbsPartIdx*/, false), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     345#else
    338346  m_pcTrQuant->setQPforQuant        ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     347#endif
    339348  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
    340349  // chroma Cb
     
    343352  piCoeff     = pcCU->getCoeffCb();
    344353  pRes        = pcCUResidual->getCbAddr();
     354#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     355  m_pcTrQuant->setQPforQuant        ( pcCU->getQP( 0 ) + pcCU->getQpOffsetForTextCU(0/*uiAbsPartIdx*/, false), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     356#else
    345357  m_pcTrQuant->setQPforQuant        ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     358#endif
    346359  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    347360  // chroma Cr
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.cpp

    r21 r28  
    8989  initWpAcDcParam();
    9090#endif
     91
     92#if POZNAN_MP
     93  m_pcMP = NULL;
     94#endif
    9195}
    9296
    9397TComSlice::~TComSlice()
    9498{
     99#if POZNAN_MP
     100  m_pcMP = NULL;
     101#endif
    95102}
    96103
     
    681688#endif
    682689
     690#if POZNAN_DBMP
     691  m_uiDBMP = 0;
     692#endif
     693
     694#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     695  m_uiUseCUSkip = 0;
     696#endif
     697
     698
    683699  // AMVP parameter
    684700  ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) );
     
    730746    }
    731747  }
     748#if POZNAN_NONLINEAR_DEPTH
     749  m_fDepthPower = 1.0;
     750#endif
     751#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     752  m_bUseTexDqpAccordingToDepth = false;
     753#endif
    732754}
    733755
     
    745767  ::memset( m_aaiCodedScale,  0x00, sizeof( m_aaiCodedScale  ) );
    746768  ::memset( m_aaiCodedOffset, 0x00, sizeof( m_aaiCodedOffset ) );
     769#if POZNAN_NONLINEAR_DEPTH
     770  m_fDepthPower = 1.0;
     771#endif
    747772}
    748773
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComSlice.h

    r21 r28  
    5757#endif
    5858
     59#if POZNAN_MP
     60//#include "../TLibCommon/TComMP.h"
     61class TComMP;
     62#endif
     63
    5964// ====================================================================================================================
    6065// Class definition
     
    148153#endif
    149154
     155#if POZNAN_DBMP
     156  UInt  m_uiDBMP;
     157#endif
     158
     159#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     160  UInt  m_uiUseCUSkip;
     161#endif
     162
    150163#if DEPTH_MAP_GENERATION
    151164  TComDepthMapGenerator* m_pcDepthMapGenerator;
     
    153166#if HHI_INTER_VIEW_RESIDUAL_PRED
    154167  TComResidualGenerator* m_pcResidualGenerator;
     168#endif
     169
     170#if POZNAN_NONLINEAR_DEPTH
     171  Float  m_fDepthPower;
     172#endif
     173
     174#if POZNAN_MP
     175  TComMP* m_pcMP;
     176#endif
     177#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     178  Bool   m_bUseTexDqpAccordingToDepth;
    155179#endif
    156180
     
    208232
    209233  // Tool list
     234#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     235  Bool getUseALF      ()         { return (getViewId()>0)?false:m_bUseALF;}  //todo fix ALF
     236#else
    210237  Bool getUseALF      ()         { return m_bUseALF;        }
     238#endif
    211239  Bool getUseDQP      ()         { return m_bUseDQP;        }
    212240
     
    266294#if MTK_SAO
    267295  Void setUseSAO                  (Bool bVal)  {m_bUseSAO = bVal;}
     296#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU //todo fix SAO
     297  Bool getUseSAO     ()         { return (getViewId()>0)?false:m_bUseSAO;}
     298#else
    268299  Bool getUseSAO                  ()           {return m_bUseSAO;}
     300#endif
    269301#endif
    270302
     
    282314#if HHI_INTER_VIEW_RESIDUAL_PRED
    283315  Void  setMultiviewResPredMode  ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; }
     316#endif
     317
     318#if POZNAN_DBMP
     319  Void  setDBMP                  ( UInt uiDBMP )       { m_uiDBMP = uiDBMP; }
     320#endif
     321
     322#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     323  Void  setUseCUSkip                ( UInt uiUseCUSkip )     { m_uiUseCUSkip = uiUseCUSkip; }
    284324#endif
    285325
     
    297337#endif
    298338
     339#if POZNAN_DBMP
     340  UInt  getDBMP                  ()          { return m_uiDBMP;   }
     341#endif
     342
     343#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     344  UInt  getUseCUSkip                ()          { return m_uiUseCUSkip;   }
     345#endif
     346
    299347#if DEPTH_MAP_GENERATION
    300348  Void                    setDepthMapGenerator( TComDepthMapGenerator* pcDepthMapGenerator )  { m_pcDepthMapGenerator = pcDepthMapGenerator; }
     
    304352  Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
    305353  TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
     354#endif
     355#if POZNAN_NONLINEAR_DEPTH
     356  inline Void    setDepthPower(Float p)   {m_fDepthPower = p;}
     357  inline Float   getDepthPower()          {return m_fDepthPower;}
     358#else
     359  inline Float   getDepthPower()          {return 1.0f;}
     360#endif
     361#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     362  Void setUseTexDqpAccordingToDepth    (Bool bVal)  {m_bUseTexDqpAccordingToDepth = bVal;}
     363  Bool getUseTexDqpAccordingToDepth    ()           {return m_bUseTexDqpAccordingToDepth;}
    306364#endif
    307365};
     
    448506#endif
    449507
     508#if POZNAN_MP
     509  TComMP* m_pcMP;
     510#endif
     511
    450512public:
    451513  TComSlice();
     514#if POZNAN_MP
     515  ~TComSlice();
     516#else
    452517  virtual ~TComSlice();
     518#endif
    453519
    454520  Void      initSlice       ();
     
    614680#endif
    615681
     682#if POZNAN_MP
     683  Void setMP(TComMP* pcMP) { m_pcMP = pcMP; }
     684  TComMP* getMP() { return m_pcMP; }
     685#endif
     686
    616687protected:
    617688#if 0
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComWeightPrediction.cpp

    r5 r28  
    393393}
    394394
     395#if POZNAN_DBMP
     396
     397Void TComWeightPrediction::addWeightBi_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound )
     398{
     399  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     400  Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
     401  Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
     402 
     403  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     404  Pel* pSrcU1  = pcYuvSrc1->getCbAddr  ( iPartUnitIdx );
     405  Pel* pSrcV1  = pcYuvSrc1->getCrAddr  ( iPartUnitIdx );
     406 
     407  Pel* pDstY   = rpcYuvDst->getLumaAddr( iPartUnitIdx );
     408  Pel* pDstU   = rpcYuvDst->getCbAddr  ( iPartUnitIdx );
     409  Pel* pDstV   = rpcYuvDst->getCrAddr  ( iPartUnitIdx );
     410 
     411  // Luma : --------------------------------------------
     412  Int w0      = wp0[0].w;
     413  Int o0      = wp0[0].o;
     414  Int offset  = wp0[0].offset;
     415  Int shiftNum = 14 - (g_uiBitDepth + g_uiBitIncrement);
     416  Int shift   = wp0[0].shift + shiftNum;
     417  Int round   = (1<<(shift-1)) * bRound;
     418  Int w1      = wp1[0].w;
     419  Int o1      = wp1[0].o;
     420
     421  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     422  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     423  UInt  iDstStride  = rpcYuvDst->getStride();
     424 
     425  pDstY[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcY0[iPosY*iSrc0Stride+iPosX], w1,pSrcY1[iPosY*iSrc1Stride+iPosX], round, shift, offset);
     426   
     427  // Chromas : --------------------------------------------
     428  iSrc0Stride = pcYuvSrc0->getCStride();
     429  iSrc1Stride = pcYuvSrc1->getCStride();
     430  iDstStride  = rpcYuvDst->getCStride();
     431 
     432  iPosX = iPosX>>1;
     433  iPosY = iPosY>>1;
     434
     435  // Chroma U : --------------------------------------------
     436  w0      = wp0[1].w;
     437  o0      = wp0[1].o;
     438  offset  = wp0[1].offset;
     439  shift   = wp0[1].shift + shiftNum;
     440  round   = (1<<(shift-1));
     441  w1      = wp1[1].w;
     442  o1      = wp1[1].o;
     443 
     444  pDstU[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcU0[iPosY*iSrc0Stride+iPosX], w1,pSrcU1[iPosY*iSrc1Stride+iPosX], round, shift, offset);
     445
     446  // Chroma V : --------------------------------------------
     447  w0      = wp0[2].w;
     448  o0      = wp0[2].o;
     449  offset  = wp0[2].offset;
     450  shift   = wp0[2].shift + shiftNum;
     451  round   = (1<<(shift-1));
     452  w1      = wp1[2].w;
     453  o1      = wp1[2].o;
     454
     455  pDstV[iPosY*iDstStride+iPosX] = weightBidir(w0,pSrcV0[iPosY*iSrc0Stride+iPosX], w1,pSrcV1[iPosY*iSrc1Stride+iPosX], round, shift, offset);
     456}
     457
     458Void TComWeightPrediction::addWeightUni_DBMP( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, TComYuv* rpcYuvDst )
     459{
     460  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     461  Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
     462  Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
     463 
     464  Pel* pDstY   = rpcYuvDst->getLumaAddr( iPartUnitIdx );
     465  Pel* pDstU   = rpcYuvDst->getCbAddr  ( iPartUnitIdx );
     466  Pel* pDstV   = rpcYuvDst->getCrAddr  ( iPartUnitIdx );
     467 
     468  // Luma : --------------------------------------------
     469  Int w0      = wp0[0].w;
     470  Int offset  = wp0[0].offset;
     471  Int shift   = wp0[0].shift;
     472  Int round   = wp0[0].round;
     473
     474  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     475  UInt  iDstStride  = rpcYuvDst->getStride();
     476 
     477  pDstY[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcY0[iPosY*iSrc0Stride+iPosX], round, shift, offset);
     478   
     479  // Chromas : --------------------------------------------
     480  iSrc0Stride = pcYuvSrc0->getCStride();
     481  iDstStride  = rpcYuvDst->getCStride();
     482 
     483  iPosX = iPosX>>1;
     484  iPosY = iPosY>>1;
     485
     486  // Chroma U : --------------------------------------------
     487  w0      = wp0[1].w;
     488  offset  = wp0[1].offset;
     489  shift   = wp0[1].shift;
     490  round   = wp0[1].round;
     491 
     492  pDstU[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcU0[iPosY*iSrc0Stride+iPosX], round, shift, offset);
     493
     494  // Chroma V : --------------------------------------------
     495  w0      = wp0[2].w;
     496  offset  = wp0[2].offset;
     497  shift   = wp0[2].shift;
     498  round   = wp0[2].round;
     499
     500  pDstV[iPosY*iDstStride+iPosX] = weightUnidir(w0,pSrcV0[iPosY*iSrc0Stride+iPosX], round, shift, offset);
     501}
     502
     503Void TComWeightPrediction::xWeightedPredictionUni_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx )
     504{
     505  wpScalingParam  *pwp, *pwpTmp;
     506  Int             iRefIdx   = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           assert (iRefIdx >= 0);
     507  Int             ibdi = (g_uiBitDepth+g_uiBitIncrement);
     508
     509  if ( eRefPicList == REF_PIC_LIST_0 )
     510  {
     511    getWpScaling(pcCU, iRefIdx, -1, pwp, pwpTmp, ibdi);
     512  }
     513  else
     514  {
     515    getWpScaling(pcCU, -1, iRefIdx, pwpTmp, pwp, ibdi);
     516  }
     517  addWeightUni_DBMP( pcYuvSrc, uiPartAddr, iPosX, iPosY, pwp, rpcYuvPred );
     518}
     519
     520Void TComWeightPrediction::xWeightedPredictionBi_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv* rpcYuvDst )
     521{
     522  wpScalingParam  *pwp0, *pwp1;
     523  TComPPS         *pps = pcCU->getSlice()->getPPS();
     524
     525  if ( !pps->getUseWP() ) {
     526    printf("TComWeightPrediction::xWeightedPredictionBi():\tassert failed: useWP is false.\n");
     527    exit(0);
     528  }
     529
     530  Int ibdi = (g_uiBitDepth+g_uiBitIncrement);
     531  getWpScaling(pcCU, iRefIdx0, iRefIdx1, pwp0, pwp1, ibdi);
     532
     533  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     534  {
     535    addWeightBi_DBMP(pcYuvSrc0, pcYuvSrc1, uiPartIdx, iPosX, iPosY, pwp0, pwp1, rpcYuvDst );
     536  }
     537  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     538  {
     539    addWeightUni_DBMP( pcYuvSrc0, uiPartIdx, iPosX, iPosY, pwp0, rpcYuvDst );
     540  }
     541  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     542  {
     543    addWeightUni_DBMP( pcYuvSrc1, uiPartIdx, iPosX, iPosY, pwp1, rpcYuvDst );
     544  }
     545  else
     546    assert (0);
     547
     548}
     549#endif
     550
    395551#endif  // WEIGHT_PRED
    396552
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComWeightPrediction.h

    r2 r28  
    3737  Void  xWeightedPredictionBi( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* rpcYuvDst );
    3838
     39#if POZNAN_DBMP
     40  Void  addWeightBi_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, wpScalingParam *wp1, TComYuv* rpcYuvDst, Bool bRound=true );
     41  Void  addWeightUni_DBMP( TComYuv* pcYuvSrc0, UInt iPartUnitIdx, UInt iPosX, Int iPosY, wpScalingParam *wp0, TComYuv* rpcYuvDst );
     42
     43  Void  xWeightedPredictionUni_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc, UInt uiPartAddr, Int iPosX, Int iPosY, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx );
     44  Void  xWeightedPredictionBi_DBMP( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iPosX, Int iPosY, TComYuv* rpcYuvDst );
     45#endif
     46
    3947  __inline  Pel   xClip  ( Int x );
    4048  __inline  Pel   weightBidir( Int w0, Pel P0, Int w1, Pel P1, Int round, Int shift, Int offset);
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComYuv.cpp

    r21 r28  
    387387}
    388388
     389#if POZNAN_DBMP
     390
     391Void TComYuv::copyPartToPartYuv_DBMP   ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY )
     392{
     393  copyPartToPartLuma_DBMP   (pcYuvDst, uiPartIdx, uiPosX, uiPosY );
     394  copyPartToPartChroma_DBMP (pcYuvDst, uiPartIdx, uiPosX>>1, uiPosY>>1 );
     395}
     396
     397Void TComYuv::copyPartToPartLuma_DBMP  ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY )
     398{
     399  Pel* pSrc =           getLumaAddr(uiPartIdx);
     400  Pel* pDst = pcYuvDst->getLumaAddr(uiPartIdx);
     401  if( pSrc == pDst )
     402  {
     403    //th not a good idea
     404    //th best would be to fix the caller
     405    return ;
     406  }
     407 
     408  UInt  iSrcStride = getStride();
     409  UInt  iDstStride = pcYuvDst->getStride();
     410
     411  ::memcpy( pDst+uiPosY*iDstStride+uiPosX, pSrc+uiPosY*iSrcStride+uiPosX, sizeof(Pel) );
     412}
     413
     414Void TComYuv::copyPartToPartChroma_DBMP( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY )
     415{
     416  Pel*  pSrcU =           getCbAddr(uiPartIdx);
     417  Pel*  pSrcV =           getCrAddr(uiPartIdx);
     418  Pel*  pDstU = pcYuvDst->getCbAddr(uiPartIdx);
     419  Pel*  pDstV = pcYuvDst->getCrAddr(uiPartIdx);
     420 
     421  if( getCbAddr() == NULL || getCrAddr() == NULL || pcYuvDst->getCbAddr() == NULL || pcYuvDst->getCrAddr() == NULL ) //KUBA CHROMA
     422  {
     423    return ;
     424  }
     425  if( pSrcU == pDstU && pSrcV == pDstV)
     426  {
     427    //th not a good idea
     428    //th best would be to fix the caller
     429    return ;
     430  }
     431 
     432  UInt   iSrcStride = getCStride();
     433  UInt   iDstStride = pcYuvDst->getCStride();
     434
     435  ::memcpy( pDstU+uiPosY*iDstStride+uiPosX, pSrcU+uiPosY*iSrcStride+uiPosX, sizeof(Pel) );
     436  ::memcpy( pDstV+uiPosY*iDstStride+uiPosX, pSrcV+uiPosY*iSrcStride+uiPosX, sizeof(Pel) );
     437}
     438
     439#if DEPTH_MAP_GENERATION
     440Void TComYuv::copyPartToPartYuvPdm_DBMP   ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY, UInt uiSubSampExpX, UInt uiSubSampExpY )
     441{
     442  copyPartToPartLumaPdm_DBMP   (pcYuvDst, uiPartIdx, uiPosX, uiPosY, uiSubSampExpX, uiSubSampExpY );
     443}
     444
     445Void TComYuv::copyPartToPartLumaPdm_DBMP  ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY, UInt uiSubSampExpX, UInt uiSubSampExpY )
     446{
     447  UInt uiBlkX = g_auiRasterToPelX[ g_auiZscanToRaster[ uiPartIdx ] ] >> uiSubSampExpX;
     448  UInt uiBlkY = g_auiRasterToPelY[ g_auiZscanToRaster[ uiPartIdx ] ] >> uiSubSampExpY;
     449  Pel* pSrc   = getLumaAddr(uiPartIdx);
     450  Pel* pDst   = pcYuvDst->getLumaAddr() + uiBlkY * pcYuvDst->getStride() + uiBlkX;
     451 
     452  if( pSrc == pDst )
     453  {
     454    //th not a good idea
     455    //th best would be to fix the caller
     456    return ;
     457  }
     458 
     459  UInt  iSrcStride = getStride();
     460  UInt  iDstStride = pcYuvDst->getStride();
     461
     462  ::memcpy( pDst+uiPosY*iDstStride+uiPosX, pSrc+uiPosY*iSrcStride+uiPosX, sizeof(Pel) );
     463}
     464
     465#endif
     466
     467#endif
     468
    389469Void TComYuv::addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
    390470{
     
    862942#endif
    863943
     944#if POZNAN_DBMP
     945
     946#ifdef ROUNDING_CONTROL_BIPRED
     947
     948Void TComYuv::addAvg_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, Bool bRound )
     949{
     950  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     951  Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
     952  Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
     953 
     954  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     955  Pel* pSrcU1  = pcYuvSrc1->getCbAddr  ( iPartUnitIdx );
     956  Pel* pSrcV1  = pcYuvSrc1->getCrAddr  ( iPartUnitIdx );
     957 
     958  Pel* pDstY   = getLumaAddr( iPartUnitIdx );
     959  Pel* pDstU   = getCbAddr  ( iPartUnitIdx );
     960  Pel* pDstV   = getCrAddr  ( iPartUnitIdx );
     961 
     962  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     963  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     964  UInt  iDstStride  = getStride();
     965
     966#if HIGH_ACCURACY_BI
     967  Int shiftNum = 15 - (g_uiBitDepth + g_uiBitIncrement);
     968  Int offset = (1<<(shiftNum - 1));
     969 
     970  //Luma
     971  (pDstY+iPosY*iDstStride)[iPosX] = Clip(((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + offset) >> shiftNum );
     972   
     973  iSrc0Stride = pcYuvSrc0->getCStride();
     974  iSrc1Stride = pcYuvSrc1->getCStride();
     975  iDstStride  = getCStride();
     976
     977  //Chroma
     978  (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum );
     979  (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum );
     980 
     981#else
     982
     983  //Luma
     984  (pDstY+iPosY*iDstStride)[iPosX] = ((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + bRound) >> 1;
     985   
     986  iSrc0Stride = pcYuvSrc0->getCStride();
     987  iSrc1Stride = pcYuvSrc1->getCStride();
     988  iDstStride  = getCStride();
     989 
     990  //Chroma
     991  (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + bRound) >> 1;
     992  (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + bRound) >> 1;
     993#endif
     994}
     995
     996#endif
     997
     998Void TComYuv::addAvg_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY )
     999{
     1000  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     1001  Pel* pSrcU0  = pcYuvSrc0->getCbAddr  ( iPartUnitIdx );
     1002  Pel* pSrcV0  = pcYuvSrc0->getCrAddr  ( iPartUnitIdx );
     1003 
     1004  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     1005  Pel* pSrcU1  = pcYuvSrc1->getCbAddr  ( iPartUnitIdx );
     1006  Pel* pSrcV1  = pcYuvSrc1->getCrAddr  ( iPartUnitIdx );
     1007 
     1008  Pel* pDstY   = getLumaAddr( iPartUnitIdx );
     1009  Pel* pDstU   = getCbAddr  ( iPartUnitIdx );
     1010  Pel* pDstV   = getCrAddr  ( iPartUnitIdx );
     1011 
     1012  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     1013  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     1014  UInt  iDstStride  = getStride();
     1015#if HIGH_ACCURACY_BI
     1016  Int shiftNum = 15 - (g_uiBitDepth + g_uiBitIncrement);
     1017  Int offset = (1<<(shiftNum - 1));
     1018 
     1019  //Luma
     1020  (pDstY+iPosY*iDstStride)[iPosX] = Clip(((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + offset) >> shiftNum );
     1021
     1022  iSrc0Stride = pcYuvSrc0->getCStride();
     1023  iSrc1Stride = pcYuvSrc1->getCStride();
     1024  iDstStride  = getCStride();
     1025 
     1026  //Chroma
     1027  (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum );
     1028  (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = Clip(((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + offset) >> shiftNum );
     1029
     1030#else 
     1031  //Luma
     1032  (pDstY+iPosY*iDstStride)[iPosX] = ((pSrcY0+iPosY*iSrc0Stride)[iPosX] + (pSrcY1+iPosY*iSrc1Stride)[iPosX] + 1) >> 1;
     1033   
     1034  iSrc0Stride = pcYuvSrc0->getCStride();
     1035  iSrc1Stride = pcYuvSrc1->getCStride();
     1036  iDstStride  = getCStride();
     1037 
     1038  //Chroma
     1039  (pDstU+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcU0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcU1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + 1) >> 1;
     1040  (pDstV+(iPosY>>1)*iDstStride)[(iPosX>>1)] = ((pSrcV0+(iPosY>>1)*iSrc0Stride)[(iPosX>>1)] + (pSrcV1+(iPosY>>1)*iSrc1Stride)[(iPosX>>1)] + 1) >> 1;
     1041#endif
     1042}
     1043
     1044#if DEPTH_MAP_GENERATION
     1045Void TComYuv::addAvgPdm_DBMP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY )
     1046{
     1047  UInt uiBlkX  = g_auiRasterToPelX[ g_auiZscanToRaster[ iPartUnitIdx ] ] >> uiSubSampExpX;
     1048  UInt uiBlkY  = g_auiRasterToPelY[ g_auiZscanToRaster[ iPartUnitIdx ] ] >> uiSubSampExpY;
     1049  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     1050  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     1051  Pel* pDstY   = getLumaAddr() + uiBlkY * getStride() + uiBlkX;
     1052 
     1053  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     1054  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     1055  UInt  iDstStride  = getStride();
     1056
     1057  pDstY[iPosY*iDstStride+iPosX] = (pSrcY0[iPosY*iSrc0Stride+iPosX] + pSrcY1[iPosY*iSrc1Stride+iPosX] + 1) >> 1;
     1058}
     1059#endif
     1060
     1061#endif
    8641062
    8651063Void TComYuv::removeHighFreq( TComYuv* pcYuvSrc, UInt uiWidht, UInt uiHeight )
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TComYuv.h

    r21 r28  
    118118#endif
    119119 
     120#if POZNAN_DBMP
     121  Void    copyPartToPartYuv_DBMP        ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY ); 
     122  Void    copyPartToPartLuma_DBMP   ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY );
     123  Void    copyPartToPartChroma_DBMP ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY );
     124#if DEPTH_MAP_GENERATION
     125  Void    copyPartToPartYuvPdm_DBMP  ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY, UInt uiSubSampExpX, UInt uiSubSampExpY );
     126  Void    copyPartToPartLumaPdm_DBMP ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt uiPosX, UInt uiPosY, UInt uiSubSampExpX, UInt uiSubSampExpY );
     127#endif
     128#endif
     129 
    120130  // ------------------------------------------------------------------------------------------------------------------
    121131  //  Algebraic operation for YUV buffer
     
    143153#endif
    144154
     155#if POZNAN_DBMP
     156#ifdef ROUNDING_CONTROL_BIPRED
     157  Void    addAvg_DBMP            ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, Bool bRound );
     158#endif
     159  Void    addAvg_DBMP            ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY );
     160#if DEPTH_MAP_GENERATION
     161  Void    addAvgPdm_DBMP         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iPosX, UInt iPosY, UInt uiSubSampExpX, UInt uiSubSampExpY );
     162#endif
     163#endif
     164
    145165  //   Remove High frequency
    146166  Void    removeHighFreq    ( TComYuv* pcYuvSrc, UInt uiWidht, UInt uiHeight );
  • branches/0.3-poznan-univ/source/Lib/TLibCommon/TypeDef.h

    r21 r28  
    6565//<<<<< HHI 3DV tools <<<<<
    6666
    67 
     67//<<<<< Poznan 3DV tools <<<<<<
     68#define POZNAN_CU_SKIP              1 //Poznan Cu Skip
     69#define POZNAN_CU_SYNTH             1 //Poznan Cu Synth
     70
     71#define POZNAN_AVAIL_MAP            1 //Creates Availibity buffers in all needed classes
     72
     73#define POZNAN_SYNTH_VIEW           1 //Creates view synthesis buffers in all needed classes
     74#define POZNAN_SYNTH_DEPTH          1
     75
     76#define POZNAN_SYNTH                1 //Creates aligned synthesis classes in encoder and decoder
     77
     78#define POZNAN_ENCODE_ONLY_DISOCCLUDED_CU          1 //Poznan CU Skip
     79#define POZNAN_FILL_OCCLUDED_CU_WITH_SYNTHESIS     1 //Fill not sended CUs with synthesized data
     80
     81#define POZNAN_VSO_FIX              0
     82
     83#define POZNAN_CU_SKIP_PSNR         1 //Poznan Cu Skip Display psnr of the codded CUs only
     84
     85#define POZNAN_NONLINEAR_DEPTH              1    /// Non-linear depth processing (Maciej Kurc)
     86#define POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE 1    /// Send DepthPower as byte instead of float
     87
     88#if POZNAN_SYNTH
     89#define POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH 1 /// Increase QP for texture CUs that are in the background (according to proper depth map). This QP change is not encoded in a bitstream
     90#endif
     91#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH     
     92 #define POZNAN_TEXTURE_TU_DELTA_QP_NOT_IN_BASE_VIEW 1     /// should not be disabled in current software version - no depth synthesis map is available for base view anyway 
     93 #define POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_CU_ROW 1    /// increase of QP param for top and bottom LCU row in frame
     94 #define POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC 0 /// used for optimization of function calculating dQP from depth block max value. Standard values set if disabled. If enabled params are set in cfg file for encoder (no decoder is supported in that case).
     95  #if !POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
     96    #define POZNAN_TEXTURE_TU_DELTA_QP_OFFSET (-2.6)
     97    #define POZNAN_TEXTURE_TU_DELTA_QP_MUL (1)
     98    #define POZNAN_TEXTURE_TU_DELTA_QP_TOP_BOTTOM_ROW_VAL (0)
     99  #endif
     100#endif
     101
     102#define POZNAN_MP                                  1    /// Depth-Based Multiview Prediction of CU parameters
     103#if POZNAN_MP
     104
     105#define POZNAN_MP_USE_DEPTH_MAP_GENERATION 0 // determines if DEPTH_MAP_GENERATION is used for calculating corresponding pixel position in PUT multiview prediction (POZNAN_MP):
     106                                                                                                                                        //                      POZNAN_MP_USE_DEPTH_MAP_GENERATION=1 - use DEPTH_MAP_GENERATION,
     107                                                                                                                                        //                      POZNAN_MP_USE_DEPTH_MAP_GENERATION=0 - use reconstructed depth maps from neighboring views
     108
     109#define POZNAN_MP_FILL                             1    // Depth-Based Multiview Prediction of CU parameters with fill option for occluded areas
     110#if POZNAN_MP_FILL
     111#define POZNAN_MP_FILL_TYPE                        0    // Variant of fill algorithm used for occluded areas (0 - smaller disparity, 1 - larger disparity)
     112#endif
     113
     114// ---------------------------------------
     115
     116#define POZNAN_DBMP                                1    // Depth Based Motion Prediction prediction for MERGE
     117#if POZNAN_DBMP
     118#define POZNAN_DBMP_USE_FOR_TEXTURE                  1    //use Depth Based Motion Prediction in texture pictures (0 - no, 1 -yes)
     119#define POZNAN_DBMP_USE_FOR_DEPTH                  1    // use Depth Based Motion Prediction in depth pictures (0 - no, 1 -yes)
     120
     121#define POZNAN_DBMP_CALC_PRED_DATA              1    // Depth Based Motion Prediction motion data used for prediction in other CUs is calculated based on all CU points (otherwise motion data for none-MP points is used for prediction)
     122#define POZNAN_DBMP_COMPRESS_ME_DATA            0    // Depth Based Motion Prediction derives representative motion data from reference CUs even if they are DBMP-based predicted (otherwise motion data is derived with per-point resolution for DBMP-based predicted reference CUs)
     123#define POZNAN_DBMP_USE_IN_NONANCHOR_PIC_ONLY           1    // determines if Depth Based Motion Prediction is used in non-anchor pictures only
     124#endif
     125
     126#endif
     127
     128
     129//<<<<< Poznan 3DV tools <<<<<<
    68130
    69131////////////////////////////
     
    345407typedef       unsigned long       ULong;
    346408typedef       double              Double;
     409typedef       float               Float;
    347410
    348411// ====================================================================================================================
     
    580643  MODE_INTER,           ///< inter-prediction mode
    581644  MODE_INTRA,           ///< intra-prediction mode
     645#if POZNAN_SYNTH
     646  MODE_SYNTH,           ///< synth-mode
     647#endif
    582648  MODE_NONE = 15
    583649};
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r5 r28  
    237237  xReadFlag( uiCode ); pcSPS->setUseSAO       ( uiCode ? true : false );
    238238#endif
    239 
     239#if POZNAN_DBMP
     240          xReadFlag( uiCode );
     241          pcSPS->setDBMP  ( uiCode );
     242#endif
     243#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     244          xReadFlag( uiCode );
     245          pcSPS->setUseCUSkip ( uiCode );
     246#endif
    240247  xReadFlag( uiCode ); // SPS base view flag
    241248  if( uiCode )
     
    270277      xReadFlag( uiCode );
    271278      pcSPS->setUseMVI( uiCode ? true : false );
     279#endif
     280#if POZNAN_NONLINEAR_DEPTH
     281#if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
     282      uiCode = 0;
     283      xReadCode(8, uiCode);
     284      pcSPS->setDepthPower(dequantizeDepthPower(uiCode));
     285#else
     286      uiCode = 0;
     287      xReadCode(sizeof(float)*8, uiCode); // We do not send seign
     288      //uiCode &= ~0x80000000;
     289      pcSPS->setDepthPower(*((float*)&uiCode)); 
     290#endif
     291      printf("\nfDepthPower = %f", pcSPS->getDepthPower());
    272292#endif
    273293    }
     
    325345      pcSPS->setMultiviewResPredMode  ( uiMultiviewResPredMode );
    326346#endif
     347#endif
     348#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     349      xReadFlag( uiCode );
     350      pcSPS->setUseTexDqpAccordingToDepth( uiCode ? true : false );
    327351#endif
    328352#if HHI_MPI
     
    26212645
    26222646
    2623 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
     2647#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP
    26242648Void
    26252649TDecCavlc::parseMergeIndexMV( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth )
     
    26322656    uiNumCand++;
    26332657#endif
     2658#if POZNAN_DBMP
     2659  UInt uiModIdx;
     2660  const Bool bDBMPAvailable = pcCU->getSlice()->getMP()->isDBMPEnabled();
     2661#endif
    26342662  for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ )
    26352663  {
     
    26562684    if( uiIdx > uiMviMergePos )
    26572685    {
     2686#if POZNAN_DBMP
     2687          if(bDBMPAvailable)
     2688          {
     2689                  if(uiIdx==POZNAN_DBMP_MERGE_POS) uiModIdx = POZNAN_DBMP_MRG_CAND;
     2690                  else if(uiIdx>POZNAN_DBMP_MERGE_POS) uiModIdx = uiIdx--;
     2691                  else uiModIdx = uiIdx;
     2692          }
     2693          else uiModIdx = uiIdx;
     2694          if( pcCU->getNeighbourCandIdx( uiModIdx-1, uiAbsPartIdx ) != uiModIdx )
     2695          {
     2696        ruiMergeIndex++;
     2697      }
     2698#else
    26582699      if( pcCU->getNeighbourCandIdx( uiIdx - 1, uiAbsPartIdx ) != uiIdx )
    26592700      {
    26602701        ruiMergeIndex++;
    26612702      }
     2703#endif
    26622704    }
    26632705    else if( uiIdx < uiMviMergePos )
    26642706#endif
     2707#if POZNAN_DBMP
     2708        if(bDBMPAvailable)
     2709        {
     2710          if(uiIdx==POZNAN_DBMP_MERGE_POS) uiModIdx = POZNAN_DBMP_MRG_CAND;
     2711          else if(uiIdx>POZNAN_DBMP_MERGE_POS) uiModIdx = uiIdx--;
     2712          else uiModIdx = uiIdx;
     2713        }
     2714        else uiModIdx = uiIdx;
     2715        if( pcCU->getNeighbourCandIdx( uiModIdx, uiAbsPartIdx ) != uiModIdx + 1 )
     2716        {
     2717          ruiMergeIndex++;
     2718        }
     2719#else
    26652720    if( pcCU->getNeighbourCandIdx( uiIdx, uiAbsPartIdx ) != uiIdx + 1 )
    26662721    {
    26672722      ruiMergeIndex++;
    26682723    }
     2724#endif
    26692725  }
    26702726#if HHI_MPI
     
    26762732  {
    26772733    pcCU->setTextureModeDepthSubParts( uiDepth, uiAbsPartIdx, uiDepth );
     2734  }
     2735#endif
     2736#if POZNAN_DBMP
     2737  if(bDBMPAvailable)
     2738  {       
     2739        if(ruiMergeIndex==POZNAN_DBMP_MERGE_POS) ruiMergeIndex = POZNAN_DBMP_MRG_CAND;
     2740        else if(ruiMergeIndex>POZNAN_DBMP_MERGE_POS) ruiMergeIndex--;
    26782741  }
    26792742#endif
     
    26912754Void TDecCavlc::parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth )
    26922755{
    2693 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
     2756#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP
    26942757  if(
    26952758#if HHI_INTER_VIEW_MOTION_PRED
     
    26982761#if HHI_MPI
    26992762      ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ||
     2763#endif
     2764#if     POZNAN_DBMP 
     2765          ( pcCU->getSlice()->getMP()->isDBMPEnabled() ) ||
    27002766#endif
    27012767      0
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCAVLC.h

    r5 r28  
    195195  Void parseMergeFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
    196196  Void parseMergeIndex      ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
    197 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
     197#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP
    198198  Void parseMergeIndexMV    ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
    199199#endif
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCu.cpp

    r5 r28  
    4949  m_ppcYuvReco    = NULL;
    5050  m_ppcYuvResPred = NULL;
     51#if POZNAN_AVAIL_MAP
     52  m_ppcYuvAvail   = NULL;
     53#endif
     54#if POZNAN_SYNTH_VIEW
     55  m_ppcYuvSynth   = NULL;
     56#endif
    5157  m_ppcCU         = NULL;
    5258}
     
    7581  m_ppcYuvReco    = new TComYuv*    [m_uiMaxDepth-1];
    7682  m_ppcYuvResPred = new TComYuv*    [m_uiMaxDepth-1];
     83#if POZNAN_AVAIL_MAP
     84  m_ppcYuvAvail   = new TComYuv*    [m_uiMaxDepth-1];
     85#endif
     86#if POZNAN_SYNTH_VIEW
     87  m_ppcYuvSynth   = new TComYuv*    [m_uiMaxDepth-1];
     88#endif
    7789  m_ppcCU         = new TComDataCU* [m_uiMaxDepth-1];
    7890 
     
    8799    m_ppcYuvReco   [ui] = new TComYuv;    m_ppcYuvReco   [ui]->create( uiWidth, uiHeight );
    88100    m_ppcYuvResPred[ui] = new TComYuv;    m_ppcYuvResPred[ui]->create( uiWidth, uiHeight );
     101#if POZNAN_AVAIL_MAP
     102    m_ppcYuvAvail  [ui] = new TComYuv;    m_ppcYuvAvail  [ui]->create( uiWidth, uiHeight );
     103#endif
     104#if POZNAN_SYNTH_VIEW
     105    m_ppcYuvSynth  [ui] = new TComYuv;    m_ppcYuvSynth  [ui]->create( uiWidth, uiHeight );
     106#endif
     107
    89108    m_ppcCU        [ui] = new TComDataCU; m_ppcCU        [ui]->create( uiNumPartitions, uiWidth, uiHeight, true );
    90109  }
     
    106125    m_ppcYuvReco   [ui]->destroy(); delete m_ppcYuvReco   [ui]; m_ppcYuvReco   [ui] = NULL;
    107126    m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL;
     127#if POZNAN_AVAIL_MAP
     128    m_ppcYuvAvail  [ui]->destroy(); delete m_ppcYuvAvail  [ui]; m_ppcYuvAvail  [ui] = NULL;
     129#endif
     130#if POZNAN_SYNTH_VIEW
     131    m_ppcYuvSynth  [ui]->destroy(); delete m_ppcYuvSynth  [ui]; m_ppcYuvSynth  [ui] = NULL;
     132#endif
    108133    m_ppcCU        [ui]->destroy(); delete m_ppcCU        [ui]; m_ppcCU        [ui] = NULL;
    109134  }
     
    112137  delete [] m_ppcYuvReco;    m_ppcYuvReco    = NULL;
    113138  delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL;
     139#if POZNAN_AVAIL_MAP
     140  delete [] m_ppcYuvAvail;   m_ppcYuvAvail   = NULL;
     141#endif
     142#if POZNAN_SYNTH_VIEW
     143  delete [] m_ppcYuvSynth;   m_ppcYuvSynth   = NULL;
     144#endif
     145
    114146  delete [] m_ppcCU;         m_ppcCU         = NULL;
    115147}
     
    184216{
    185217  TComPic* pcPic = pcCU->getPic();
     218
     219#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     220  Bool bWholeCUCanBeSynthesized = false;
     221  Bool bOneSubCUCanNotBeSynthesied = false;
     222  Bool bSubCUCanBeSynthesized[4];
     223  Bool * pbSubCUCanBeSynthesized = bSubCUCanBeSynthesized;
     224  pcPic->checkSynthesisAvailability(pcCU, pcCU->getAddr(), uiAbsPartIdx, uiDepth, pbSubCUCanBeSynthesized); //KUBA SYNTH
     225  Int  iSubCUCanNotBeSynthesized = 0;
     226  Int  iSubCUCanBeSynthesizedCnt = 0;
     227  for(Int i = 0; i < 4; i++)
     228  {
     229    if (!bSubCUCanBeSynthesized[i])
     230    {
     231      iSubCUCanNotBeSynthesized = i;
     232    }
     233    else
     234    {
     235      iSubCUCanBeSynthesizedCnt ++;
     236    }
     237  }
     238  if(iSubCUCanBeSynthesizedCnt == 4)
     239  {
     240    bWholeCUCanBeSynthesized = true;
     241  }
     242  else if(iSubCUCanBeSynthesizedCnt == 3)
     243  {
     244    bOneSubCUCanNotBeSynthesied = true;
     245  }
     246
     247  if(bWholeCUCanBeSynthesized)
     248  {
     249    pcCU->setPredModeSubParts( MODE_SYNTH, uiAbsPartIdx, uiDepth );
     250    pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx );
     251    pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
     252    pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );
     253    //pcCU->setSizeSubParts( pcCU->getSlice()->getSPS()->getMaxCUWidth()>>uiDepth, pcCU->getSlice()->getSPS()->getMaxCUHeight()>>uiDepth, uiAbsPartIdx, uiDepth );
     254    return;   
     255  }
     256#endif
     257
    186258  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
    187259  UInt uiQNumParts      = uiCurNumParts>>2;
     
    195267  if( ( uiRPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiBPelY < pcCU->getSlice()->getSPS()->getHeight() ) )
    196268  {
     269#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     270    if(bOneSubCUCanNotBeSynthesied && (uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )) // Check if CU has 3 synthesied subCU - no split flag is send in that case and CU split is assumed
     271    {
     272      pcCU->setDepthSubParts( uiDepth + 1, uiAbsPartIdx );
     273    }
     274    else
     275#endif
    197276#if HHI_MPI
    198277    if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) )
     
    367446{
    368447  TComPic* pcPic = pcCU->getPic();
     448#if POZNAN_SYNTH_VIEW
     449  if(pcPic->getPicYuvSynth())  m_ppcYuvSynth[uiDepth]->copyFromPicYuv( pcPic->getPicYuvSynth(), pcCU->getAddr(), uiAbsPartIdx );
     450#endif
     451#if POZNAN_AVAIL_MAP
     452  if(pcPic->getPicYuvAvail())  m_ppcYuvAvail[uiDepth]->copyFromPicYuv( pcPic->getPicYuvAvail(), pcCU->getAddr(), uiAbsPartIdx );
     453#endif
    369454 
    370455  Bool bBoundary = false;
     
    411496      xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
    412497      break;
     498#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     499    case MODE_SYNTH:
     500    //  break;
     501#if POZNAN_FILL_OCCLUDED_CU_WITH_SYNTHESIS
     502      m_ppcYuvReco[uiDepth]->copyFromPicYuv(pcPic->getPicYuvSynth(), pcCU->getAddr(), uiAbsPartIdx);
     503#else
     504      m_ppcYuvReco[uiDepth]->copyFromPicYuv(pcPic->getPicYuvAvail(), pcCU->getAddr(), uiAbsPartIdx); //Poprawiæ
     505#endif
     506      //m_ppcYuvReco[uiDepth]->clear();
     507      break;
     508#endif
    413509    default:
    414510      assert(0);
     
    485581    m_pcPrediction->predIntraLumaAng( pcPattern, pcCU->getLumaIntraDir(uiPartIdx), pPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail );
    486582   
     583#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     584    m_pcTrQuant->setQPforQuant( pcCU->getQP(uiPartIdx) + pcCU->getQpOffsetForTextCU(uiPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     585#else
    487586    m_pcTrQuant->setQPforQuant( pcCU->getQP(uiPartIdx), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     587#endif
    488588#if INTRA_DST_TYPE_7
    489589  m_pcTrQuant->invtransformNxN(TEXT_LUMA, pcCU->getLumaIntraDir(uiPartIdx), pResi, uiStride, pCoeff, uiWidth, uiHeight );
     
    682782  }
    683783  //===== inverse transform =====
     784#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     785    m_pcTrQuant->setQPforQuant( pcCU->getQP(0) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     786#else
    684787  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     788#endif
    685789#if INTRA_DST_TYPE_7
    686790  m_pcTrQuant->invtransformNxN( TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight );
     
    789893
    790894  //===== inverse transform =====
     895#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     896  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0) + pcCU->getQpOffsetForTextCU(uiAbsPartIdx, true), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText );
     897#else
    791898  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText );
     899#endif
    792900#if INTRA_DST_TYPE_7
    793901  m_pcTrQuant->invtransformNxN( eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight );
     
    9651073  piCoeff = pcCU->getCoeffY();
    9661074  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
     1075#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     1076  Int QPoffset = pcCU->getQpOffsetForTextCU(uiAbsPartIdx, false);
     1077  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(uiAbsPartIdx) + QPoffset, !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     1078#else
    9671079  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA );
     1080#endif
    9681081  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
    9691082 
    9701083  // Cb and Cr
     1084#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     1085    m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ) + QPoffset, !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     1086#else
    9711087  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA );
     1088#endif
    9721089 
    9731090  uiWidth  >>= 1;
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecCu.h

    r5 r28  
    6161  TComYuv**           m_ppcYuvReco;       ///< array of prediction & reconstruction buffer
    6262  TComYuv**           m_ppcYuvResPred;    ///< residual prediction buffer
     63#if POZNAN_AVAIL_MAP
     64  TComYuv**           m_ppcYuvAvail;      ///< array of available map buffer
     65#endif
     66#if POZNAN_SYNTH_VIEW
     67  TComYuv**           m_ppcYuvSynth;      ///< array of synth buffer
     68#endif
    6369  TComDataCU**        m_ppcCU;            ///< CU data array
    6470 
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecEntropy.cpp

    r5 r28  
    430430  pcCU->setInterDirSubParts( puhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, uiPartIdx, uiDepth );
    431431
     432#if POZNAN_DBMP_CALC_PRED_DATA
     433  Int ref_idx0_DBMP,ref_idx1_DBMP;
     434  TComMv cMv0_DBMP( 0, 0 ),cMv1_DBMP( 0, 0 );
     435  if(uiMergeIndex==POZNAN_DBMP_MRG_CAND)
     436  {     
     437    pcCU->getCUMvField2nd( REF_PIC_LIST_0 )->setAllMvField( pcMvFieldNeighbours[ 2*uiMergeIndex ].getMv(), pcMvFieldNeighbours[ 2*uiMergeIndex ].getRefIdx(), eCUMode, uiAbsPartIdx, uiPartIdx, uiDepth );
     438    pcCU->getCUMvField2nd( REF_PIC_LIST_1 )->setAllMvField( pcMvFieldNeighbours[ 2*uiMergeIndex + 1 ].getMv(), pcMvFieldNeighbours[ 2*uiMergeIndex + 1 ].getRefIdx(), eCUMode, uiAbsPartIdx, uiPartIdx, uiDepth );     
     439    pcCU->getSlice()->getMP()->calcDBMPPredData(pcCU, uiAbsPartIdx, ref_idx0_DBMP, cMv0_DBMP, ref_idx1_DBMP, cMv1_DBMP);
     440  }
     441#endif
     442
    432443  TComMv cTmpMv( 0, 0 );
    433444  if ( pcCU->getSlice()->getNumRefIdx( REF_PIC_LIST_0 ) > 0  ) //if ( ref. frame list0 has at least 1 entry )
     
    436447    pcCU->setMVPNumSubParts( 0, REF_PIC_LIST_0, uiAbsPartIdx, uiPartIdx, uiDepth);
    437448    pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvd( cTmpMv, eCUMode, uiAbsPartIdx, uiPartIdx, uiDepth );
     449#if POZNAN_DBMP_CALC_PRED_DATA
     450    if(uiMergeIndex==POZNAN_DBMP_MRG_CAND)
     451       pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMv0_DBMP, ref_idx0_DBMP, eCUMode, uiAbsPartIdx, uiPartIdx, uiDepth );
     452    else
     453#endif
    438454    pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( pcMvFieldNeighbours[ 2*uiMergeIndex ].getMv(), pcMvFieldNeighbours[ 2*uiMergeIndex ].getRefIdx(), eCUMode, uiAbsPartIdx, uiPartIdx, uiDepth );
    439455
     
    444460    pcCU->setMVPNumSubParts( 0, REF_PIC_LIST_1, uiAbsPartIdx, uiPartIdx, uiDepth);
    445461    pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvd( cTmpMv, eCUMode, uiAbsPartIdx, uiPartIdx, uiDepth );
     462#if POZNAN_DBMP_CALC_PRED_DATA
     463    if(uiMergeIndex==POZNAN_DBMP_MRG_CAND)
     464       pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMv1_DBMP, ref_idx1_DBMP, eCUMode, uiAbsPartIdx, uiPartIdx, uiDepth );
     465    else
     466#endif
    446467    pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( pcMvFieldNeighbours[ 2*uiMergeIndex + 1 ].getMv(), pcMvFieldNeighbours[ 2*uiMergeIndex + 1 ].getRefIdx(), eCUMode, uiAbsPartIdx, uiPartIdx, uiDepth );
    447468  }
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecGop.cpp

    r5 r28  
    199199#endif
    200200
     201#if POZNAN_MP
     202        if( uiStartCUAddr == 0 )
     203    {
     204#if POZNAN_MP_USE_DEPTH_MAP_GENERATION
     205          pcSlice->getMP()->setDepthMapGenerator(m_pcDepthMapGenerator);
     206#endif
     207      pcSlice->getMP()->pairMultiview(rpcPic);
     208        }
     209#endif
     210
    201211    // decode slice
    202212    m_pcSliceDecoder->decompressSlice(pcBitstream, rpcPic);
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecSbac.cpp

    r5 r28  
    579579
    580580
    581 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
     581#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP
    582582Void TDecSbac::parseMergeIndexMV( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth )
    583583{
     
    585585  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
    586586  const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : MRG_MAX_NUM_CANDS;
     587#endif
     588#if POZNAN_DBMP
     589  const Bool bDBMPAvailable = pcCU->getSlice()->getMP()->isDBMPEnabled();
     590  Bool bDBMPModifyMergeIdx = true;
    587591#endif
    588592  //--- set number of candidates and availability ---
     
    611615    }
    612616  }
     617
     618#if POZNAN_DBMP
     619  if(bDBMPAvailable)
     620  {
     621    UInt uiDBMPMergePos = POZNAN_DBMP_MERGE_POS;
     622#if HHI_MPI
     623        if(bMVIAvailable && uiDBMPMergePos>=uiMviMergePos) uiDBMPMergePos++;
     624#endif
     625        for( Int iIdx = MRG_MAX_NUM_CANDS-2; iIdx >= (Int)uiDBMPMergePos; iIdx-- )
     626        {
     627                Int iWrIdx = iIdx+1;
     628#if HHI_MPI
     629                if(bMVIAvailable)
     630                {
     631                        if(iIdx==(Int)uiMviMergePos) continue;
     632                        if(iWrIdx==(Int)uiMviMergePos) iWrIdx++;
     633                }
     634#endif
     635                if(iWrIdx>=MRG_MAX_NUM_CANDS) continue;
     636
     637                abAvailable[ iWrIdx ] = abAvailable[ iIdx ];
     638        }
     639        abAvailable[ uiDBMPMergePos ] = ( pcCU->getNeighbourCandIdx( POZNAN_DBMP_MRG_CAND, uiAbsPartIdx ) == POZNAN_DBMP_MRG_CAND + 1 );
     640       
     641        uiNumCand = 0; for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ ) if(abAvailable[ uiIdx ]) uiNumCand++;
     642  }
     643#endif
     644
    613645  AOF( uiNumCand > 1 );
    614646
     
    665697  {
    666698    pcCU->setTextureModeDepthSubParts( uiDepth, uiAbsPartIdx, uiDepth );
     699#if POZNAN_DBMP
     700        bDBMPModifyMergeIdx = false;
     701#endif
     702  }
     703#endif
     704
     705#if POZNAN_DBMP
     706  if(bDBMPAvailable && bDBMPModifyMergeIdx)
     707  {
     708        if(ruiMergeIndex==POZNAN_DBMP_MERGE_POS) ruiMergeIndex = POZNAN_DBMP_MRG_CAND;
     709        else if(ruiMergeIndex>POZNAN_DBMP_MERGE_POS) ruiMergeIndex--;
    667710  }
    668711#endif
     
    694737Void TDecSbac::parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth )
    695738{
    696 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
     739#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP
    697740  if(
    698741#if HHI_INTER_VIEW_MOTION_PRED
     
    701744#if HHI_MPI
    702745      ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ||
     746#endif
     747#if     POZNAN_DBMP 
     748          ( pcCU->getSlice()->getMP()->isDBMPEnabled() ) ||
    703749#endif
    704750      0
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecSbac.h

    r5 r28  
    144144  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
    145145  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
    146 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
     146#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP
    147147  Void parseMergeIndexMV  ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
    148148#endif
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.cpp

    r21 r28  
    5353    m_aaiCodedScale       [ uiId ] = new Int [ MAX_NUMBER_VIEWS ];
    5454  }
     55#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     56  xCreateLUTs   ( (UInt)MAX_NUMBER_VIEWS, (UInt)MAX_NUMBER_VIEWS,  m_adBaseViewShiftLUT,  m_aiBaseViewShiftLUT);
     57
     58  m_iLog2Precision   = LOG2_DISP_PREC_LUT;
     59  m_uiBitDepthForLUT = 8; //fixed
     60#endif
    5561}
    5662
     
    6672  delete [] m_aiViewOrderIndex;
    6773  delete [] m_aiViewReceived;
     74
     75#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     76  xDeleteArray( m_adBaseViewShiftLUT,        MAX_NUMBER_VIEWS, MAX_NUMBER_VIEWS,  2 );
     77  xDeleteArray( m_aiBaseViewShiftLUT,        MAX_NUMBER_VIEWS, MAX_NUMBER_VIEWS,  2 );
     78#endif
    6879}
    6980
     
    7889  m_iLastPOC                = -1;
    7990  m_uiMaxViewId             = 0;
    80 }
     91#if POZNAN_NONLINEAR_DEPTH
     92  m_fDepthPower             = 1.0;
     93#endif
     94}
     95
     96#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     97Void
     98CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT)
     99{
     100  //AOF( m_uiBitDepthForLUT == 8 );
     101  //AOF(radLUT == NULL && raiLUT == NULL );
     102
     103  uiNumberSourceViews = Max( 1, uiNumberSourceViews );
     104  uiNumberTargetViews = Max( 1, uiNumberTargetViews );
     105
     106  radLUT         = new Double***[ uiNumberSourceViews ];
     107  raiLUT         = new Int   ***[ uiNumberSourceViews ];
     108
     109  for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )
     110  {
     111    radLUT        [ uiSourceView ] = new Double**[ uiNumberTargetViews ];
     112    raiLUT        [ uiSourceView ] = new Int   **[ uiNumberTargetViews ];
     113
     114    for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )
     115    {
     116      radLUT        [ uiSourceView ][ uiTargetView ]      = new Double*[ 2 ];
     117      radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];
     118      radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];
     119
     120      raiLUT        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
     121      raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
     122      raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
     123    }
     124  }
     125}
     126
     127Void
     128CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)
     129{
     130  Int     iLog2DivLuma   = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision;   AOF( iLog2DivLuma > 0 );
     131  Int     iLog2DivChroma = iLog2DivLuma + 1;
     132
     133  iOffset <<= m_uiBitDepthForLUT;
     134
     135  Double dScale  = (Double) iScale  / (( Double ) ( 1 << iLog2DivLuma ));
     136  Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));
     137
     138  // offsets including rounding offsets
     139  Int64 iOffsetLuma   = iOffset + ( ( 1 << iLog2DivLuma   ) >> 1 );
     140  Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );
     141
     142#if POZNAN_NONLINEAR_DEPTH
     143  TComNonlinearDepthBackward cNonlinearDepthBwd(m_fDepthPower, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0, (POZNAN_LUT_INCREASED_PRECISION) ? g_uiBitIncrement : 0);
     144#endif
     145
     146  for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
     147  {
     148    Double  dDepthValue = (Double)uiDepthValue;
     149    Int64   iDepthValue = (Int64)uiDepthValue;
     150#if POZNAN_NONLINEAR_DEPTH
     151    dDepthValue = cNonlinearDepthBwd(dDepthValue);
     152    iDepthValue = (Int64)(dDepthValue+0.5);
     153#endif
     154#if POZNAN_LUT_INCREASED_PRECISION
     155    dDepthValue /= (1<<g_uiBitIncrement);
     156#endif
     157
     158    // real-valued look-up tables
     159    Double  dShiftLuma      = ( dDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     160    Double  dShiftChroma    = dShiftLuma / 2;
     161    radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
     162    radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;
     163
     164    // integer-valued look-up tables
     165    Int64   iTempScale      = iDepthValue * iScale;
     166#if POZNAN_LUT_INCREASED_PRECISION
     167    iTempScale >>= g_uiBitIncrement;
     168#endif
     169    Int64   iTestScale      = ( iTempScale + iOffset       );   // for checking accuracy of camera parameters
     170    Int64   iShiftLuma      = ( iTempScale + iOffsetLuma   ) >> iLog2DivLuma;
     171    Int64   iShiftChroma    = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;
     172    raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;
     173    raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;
     174
     175    // maximum deviation
     176    //dMaxDispDev     = Max( dMaxDispDev,    fabs( Double( (Int) iTestScale   ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );
     177    //dMaxRndDispDvL  = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) );
     178    //dMaxRndDispDvC  = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );
     179  }
     180
     181  radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     182  radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     183  raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     184  raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     185}
     186
     187Bool
     188CamParsCollector::getNearestBaseView( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft)
     189{
     190  /*
     191  riNearestViewIdx = 0;
     192
     193  Bool bDecencdingVN = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] );
     194  Int  iFactor       = ( bDecencdingVN ? -1 : 1 );
     195
     196  if( ( m_aiBaseId2SortedId[iSynthViewIdx] - m_aiBaseId2SortedId[riNearestViewIdx] ) * iFactor  <= 0 )
     197  {
     198    rbRenderFromLeft = true;
     199  }
     200  else
     201  {
     202    rbRenderFromLeft = false;
     203  }
     204
     205  riRelDistToLeft = 128; //Not used for now;
     206//*/
     207  return true;
     208}
     209
     210#endif
    81211
    82212Void
     
    102232  if ( pcSlice->getSPS()->isDepth  () )
    103233  {
     234#if POZNAN_NONLINEAR_DEPTH
     235    m_fDepthPower = pcSlice->getSPS()->getDepthPower();
     236#endif
    104237    return;
     238  }
     239  else
     240  {
     241#if POZNAN_NONLINEAR_DEPTH
     242    pcSlice->getSPS()->setDepthPower(m_fDepthPower); // OLGIERD: ToDo - QP-Tex should not use getDepthPower() from texture SPS.
     243#endif
    105244  }
    106245  Bool  bFirstAU          = ( pcSlice->getPOC()               == 0 );
     
    161300        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedScale () [ uiBaseId ];
    162301        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedOffset() [ uiBaseId ];
     302#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     303        xInitLUTs(uiBaseId,uiViewId,m_aaiCodedScale [ uiBaseId ][ uiViewId ],m_aaiCodedOffset[ uiBaseId ][ uiViewId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT);
     304        xInitLUTs(uiViewId,uiBaseId,m_aaiCodedScale [ uiViewId ][ uiBaseId ],m_aaiCodedOffset[ uiViewId ][ uiBaseId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT);
     305#endif
    163306      }
    164307      else
     
    168311        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getSPS()->getInvCodedScale () [ uiBaseId ];
    169312        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseId ];
     313#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     314        xInitLUTs(uiBaseId,uiViewId,m_aaiCodedScale [ uiBaseId ][ uiViewId ],m_aaiCodedOffset[ uiBaseId ][ uiViewId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT);
     315        xInitLUTs(uiViewId,uiBaseId,m_aaiCodedScale [ uiViewId ][ uiBaseId ],m_aaiCodedOffset[ uiViewId ][ uiBaseId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT);
     316#endif
    170317      }
    171318    }
     
    182329        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedScale () [ uiBaseId ];
    183330        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedOffset() [ uiBaseId ];
     331#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     332        xInitLUTs(uiBaseId,uiViewId,m_aaiCodedScale [ uiBaseId ][ uiViewId ],m_aaiCodedOffset[ uiBaseId ][ uiViewId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT);
     333        xInitLUTs(uiViewId,uiBaseId,m_aaiCodedScale [ uiViewId ][ uiBaseId ],m_aaiCodedOffset[ uiViewId ][ uiBaseId ],m_adBaseViewShiftLUT,m_aiBaseViewShiftLUT);
     334#endif
    184335      }
    185336    }
     
    269420  m_bFirstSliceInSequence   = true;
    270421  m_pcCamParsCollector = 0;
     422#if POZNAN_MP
     423  m_pcMP = NULL;
     424#endif
    271425}
    272426
     
    299453#if HHI_INTER_VIEW_RESIDUAL_PRED
    300454  m_cResidualGenerator.destroy();
     455#endif
     456
     457#if POZNAN_MP
     458  m_pcMP = NULL;
    301459#endif
    302460}
     
    336494  m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator );
    337495#endif
     496
     497#if POZNAN_MP
     498  m_pcMP = pcTAppDecTop->getMP();
     499#endif
    338500}
    339501
     
    462624#if HHI_INTERVIEW_SKIP
    463625    pcPic->removeUsedPelsMapBuffer();
     626#endif
     627#if POZNAN_AVAIL_MAP
     628    pcPic->removeAvailabilityBuffer();
     629#endif
     630#if POZNAN_SYNTH_VIEW
     631    pcPic->removeSynthesisBuffer();
     632#endif
     633#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     634    pcPic->removeSynthesisDepthBuffer();
    464635#endif
    465636  }
     
    549720      else
    550721      {
     722#if POZNAN_NONLINEAR_DEPTH
     723        // For texture complete depth power information. Depth power is sended, for example, for base view depth map and it should be available prior non-base texture decoding
     724        if(!cTempSPS.isDepth() && cTempSPS.getViewId())
     725        {
     726          Float fDepthPower = getDecTop()->getPicFromView( 0, pcPic->getPOC(), true )->getSPS()->getDepthPower();
     727          cTempSPS.setDepthPower(fDepthPower);
     728        }
     729#endif
    551730        cComSPS = cTempSPS;
    552731        return false;
     
    563742      }
    564743      m_uiValidPS |= 1;
     744
     745#if POZNAN_MP
     746#if POZNAN_MP_USE_DEPTH_MAP_GENERATION
     747      m_pcMP->init( m_cSPS.getHeight(), m_cSPS.getWidth() );
     748#else
     749      m_pcMP->init( m_cSPS.getHeight(), m_cSPS.getWidth(), m_pcCamParsCollector->getBaseViewShiftLUTI());
     750#endif
     751#endif
    565752
    566753      return false;
     
    686873      m_apcSlicePilot = pcPic->getPicSym()->getSlice(m_uiSliceIdx);
    687874      pcPic->getPicSym()->setSlice(pcSlice, m_uiSliceIdx);
     875
     876#if POZNAN_MP
     877          pcSlice->setMP(m_pcMP);
     878#endif
    688879
    689880      if (bNextSlice)
     
    744935#endif
    745936
     937#if POZNAN_SYNTH
     938      if( m_pcCamParsCollector)
     939      {
     940        m_pcCamParsCollector->setSlice( pcSlice );
     941      }
     942      //if(!getIsDepth())
     943      if(pcSlice->getSPS()->getUseCUSkip())
     944      {
     945        getDecTop()->storeSynthPicsInBuffer(pcSlice->getViewIdx(),pcSlice->getSPS()->getViewOrderIdx(),pcSlice->getPOC(),getIsDepth());
     946      }
     947#endif
     948
     949      //*
     950#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     951      if(!getIsDepth() && pcSlice->getSPS()->getUseTexDqpAccordingToDepth())
     952      {
     953        getDecTop()->storeDepthSynthPicsInBuffer(pcSlice->getViewIdx(),pcSlice->getSPS()->getViewOrderIdx(),pcSlice->getPOC());
     954      }
     955#endif
     956      //*/
     957
     958#if POZNAN_MP
     959        std::vector<TComPic*> apcSpatDataRefPics = getDecTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), m_cSPS.isDepth() );
     960        pcSlice->getMP()->setRefPicsList(&apcSpatDataRefPics); 
     961#if !POZNAN_MP_USE_DEPTH_MAP_GENERATION
     962        std::vector<TComPic*> apcSpatDepthRefPics = getDecTop()->getSpatialRefPics( pcPic->getViewIdx(), pcSlice->getPOC(), true );
     963        pcSlice->getMP()->setDepthRefPicsList(&apcSpatDepthRefPics);
     964#endif
     965#endif
     966
    746967      //  Decode a picture
    747968      m_cGopDecoder.decompressGop ( bEos, pcBitstream, pcPic, false );
     969
     970#if POZNAN_MP
     971          //pcSlice->getMP()->disable();
     972#endif
    748973
    749974      if( m_pcCamParsCollector )
  • branches/0.3-poznan-univ/source/Lib/TLibDecoder/TDecTop.h

    r21 r28  
    5555#include "TDecCAVLC.h"
    5656
     57#if POZNAN_MP
     58#include "../TLibCommon/TComMP.h"
     59#endif
     60
    5761// ====================================================================================================================
    5862// Class definition
     
    7175  Void  uninit      ();
    7276  Void  setSlice    ( TComSlice* pcSlice );
     77#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     78  Double****          getBaseViewShiftLUTD      ()  { return m_adBaseViewShiftLUT;   }
     79  Int****             getBaseViewShiftLUTI      ()  { return m_aiBaseViewShiftLUT;   }
     80
     81  Int**               getBaseViewOffsetI        ()  { return m_aaiCodedOffset;   }
     82  Int**               getBaseViewScaleI         ()  { return m_aaiCodedScale;   }
     83
     84  Bool                getNearestBaseView        ( Int iSynthViewIdx, Int &riNearestViewIdx, Int &riRelDistToLeft, Bool& rbRenderFromLeft);
     85#endif
    7386
    7487private:
     
    89102  Int     m_iLastPOC;
    90103  UInt    m_uiMaxViewId;
     104
     105#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     106
     107  UInt    m_uiBitDepthForLUT;
     108  UInt    m_iLog2Precision;
     109  UInt    m_uiInputBitDepth;
     110
     111  // look-up tables
     112  Double****          m_adBaseViewShiftLUT;                                                                             ///< Disparity LUT
     113  Int****             m_aiBaseViewShiftLUT;                                                                       ///< Disparity LUT
     114
     115  Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);
     116  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);
     117
     118  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );
     119  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2 );
     120  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize );
     121#endif
     122#if POZNAN_NONLINEAR_DEPTH
     123  Float               m_fDepthPower;
     124#endif
     125
     126
    91127};
     128
     129#if POZNAN_SYNTH || (POZNAN_MP && !POZNAN_MP_USE_DEPTH_MAP_GENERATION)
     130  template <class T>
     131Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )
     132{
     133  if( rpt )
     134  {
     135    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     136    {
     137      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     138      {
     139        for( UInt uiM = 0; uiM < uiSize3; uiM++ )
     140        {
     141          delete[] rpt[ uiK ][ uiL ][ uiM ];
     142        }
     143        delete[] rpt[ uiK ][ uiL ];
     144      }
     145      delete[] rpt[ uiK ];
     146    }
     147    delete[] rpt;
     148  }
     149  rpt = NULL;
     150};
     151
     152
     153template <class T>
     154Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )
     155{
     156  if( rpt )
     157  {
     158    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     159    {
     160      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     161      {
     162        delete[] rpt[ uiK ][ uiL ];
     163      }
     164      delete[] rpt[ uiK ];
     165    }
     166    delete[] rpt;
     167  }
     168  rpt = NULL;
     169};
     170
     171
     172template <class T>
     173Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )
     174{
     175  if( rpt )
     176  {
     177    for( UInt uiK = 0; uiK < uiSize; uiK++ )
     178    {
     179      delete[] rpt[ uiK ];
     180    }
     181    delete[] rpt;
     182  }
     183  rpt = NULL;
     184};
     185#endif
    92186
    93187
     
    138232#endif
    139233
     234#if POZNAN_MP
     235  TComMP*                                 m_pcMP;
     236#endif
     237
    140238  Bool                    m_bIsDepth;
    141239  Int                     m_iViewIdx;
  • branches/0.3-poznan-univ/source/Lib/TLibEncoder/TEncCavlc.cpp

    r5 r28  
    326326  xWriteFlag( pcSPS->getUseSAO() ? 1 : 0);
    327327#endif
     328#if POZNAN_DBMP
     329          xWriteFlag( pcSPS->getDBMP() );
     330#endif
     331#if POZNAN_ENCODE_ONLY_DISOCCLUDED_CU
     332          xWriteFlag( pcSPS->getUseCUSkip() );
     333#endif
    328334
    329335  if( pcSPS->getViewId() || pcSPS->isDepth() )
     
    340346#if HHI_MPI
    341347      xWriteFlag( pcSPS->getUseMVI() ? 1 : 0 );
     348#endif
     349#if POZNAN_NONLINEAR_DEPTH
     350      // Depth power coefficient
     351#if POZNAN_NONLINEAR_DEPTH_SEND_AS_BYTE
     352      UInt  uiCode = quantizeDepthPower(pcSPS->getDepthPower()); 
     353      xWriteCode(uiCode, 8);
     354#else
     355      float fCode  = pcSPS->getDepthPower();
     356      UInt  uiCode = *((UInt*)&fCode);
     357      //uiCode &= ~0x80000000;
     358      xWriteCode(uiCode, sizeof(float)*8); // we do not send sign?;
     359#endif
    342360#endif
    343361    }
     
    377395      }
    378396#endif
     397#if POZNAN_TEXTURE_TU_DELTA_QP_ACCORDING_TO_DEPTH
     398      xWriteFlag  ( pcSPS->getUseTexDqpAccordingToDepth() ? 1 : 0 );
     399#endif
    379400    }
    380401  }
     
    727748
    728749
    729 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
     750#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP
    730751Void
    731752TEncCavlc::codeMergeIndexMV( TComDataCU* pcCU, UInt uiAbsPartIdx )
     
    733754  UInt uiNumCand  = 0;
    734755  UInt uiMergeIdx = pcCU->getMergeIndex( uiAbsPartIdx );
     756
     757#if POZNAN_DBMP
     758  UInt uiModIdx;
     759  const Bool bDBMPAvailable = pcCU->getSlice()->getMP()->isDBMPEnabled();
     760  if(bDBMPAvailable)
     761  {       
     762          if(uiMergeIdx==POZNAN_DBMP_MRG_CAND) uiMergeIdx = POZNAN_DBMP_MERGE_POS;
     763          else if(uiMergeIdx>=POZNAN_DBMP_MERGE_POS) uiMergeIdx++;
     764  }
     765#endif
    735766#if HHI_MPI
    736767  const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
     
    750781    if( uiIdx < uiMviMergePos )
    751782    {
     783#if POZNAN_DBMP
     784          if(bDBMPAvailable)
     785          {
     786                  if(uiIdx==POZNAN_DBMP_MERGE_POS) uiModIdx = POZNAN_DBMP_MRG_CAND;
     787                  else if(uiIdx>POZNAN_DBMP_MERGE_POS) uiModIdx = uiIdx--;
     788                  else uiModIdx = uiIdx;
     789          }
     790          else uiModIdx = uiIdx;
     791          if( pcCU->getNeighbourCandIdx( uiModIdx, uiAbsPartIdx ) == uiModIdx + 1 )
     792          {
     793        uiNumCand++;
     794      }
     795      else if( uiIdx < uiMergeIdx )
     796      {
     797        uiUnaryIdx--;
     798      }
     799#else
    752800      if( pcCU->getNeighbourCandIdx( uiIdx, uiAbsPartIdx ) == uiIdx + 1 )
    753801      {
     
    758806        uiUnaryIdx--;
    759807      }
     808#endif
    760809    }
    761810    else if( uiIdx > uiMviMergePos )
    762811    {
     812#if POZNAN_DBMP
     813          if(bDBMPAvailable)
     814          {
     815                  if(uiIdx==POZNAN_DBMP_MERGE_POS) uiModIdx = POZNAN_DBMP_MRG_CAND;
     816                  else if(uiIdx>POZNAN_DBMP_MERGE_POS) uiModIdx = uiIdx--;
     817                  else uiModIdx = uiIdx;
     818          }
     819          else uiModIdx = uiIdx;
     820          if( pcCU->getNeighbourCandIdx( uiModIdx-1, uiAbsPartIdx ) == uiModIdx )
     821          {
     822        uiNumCand++;
     823      }
     824      else if( uiIdx < uiMergeIdx )
     825      {
     826        uiUnaryIdx--;
     827      }
     828#else
    763829      if( pcCU->getNeighbourCandIdx( uiIdx - 1, uiAbsPartIdx ) == uiIdx )
    764830      {
     
    769835        uiUnaryIdx--;
    770836      }
     837#endif
    771838    }
    772839  }
     
    775842  for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ )
    776843  {
     844#if POZNAN_DBMP
     845        if(bDBMPAvailable)
     846        {
     847          if(uiIdx==POZNAN_DBMP_MERGE_POS) uiModIdx = POZNAN_DBMP_MRG_CAND;
     848          else if(uiIdx>POZNAN_DBMP_MERGE_POS) uiModIdx = uiIdx--;
     849          else uiModIdx = uiIdx;
     850        }
     851        else uiModIdx = uiIdx;
     852        if( pcCU->getNeighbourCandIdx( uiModIdx, uiAbsPartIdx ) == uiModIdx + 1 )
     853        {
     854          uiNumCand++;
     855        }
     856        else if( uiIdx < uiMergeIdx )
     857        {
     858          uiUnaryIdx--;
     859        }
     860#else
    777861    if( pcCU->getNeighbourCandIdx( uiIdx, uiAbsPartIdx ) == uiIdx + 1 )
    778862    {
     
    783867      uiUnaryIdx--;
    784868    }
     869#endif
    785870  }
    786871#endif
     
    806891Void TEncCavlc::codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx )
    807892{
     893/* todo JAcek sprawdzic co jest zgane
    808894#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
    809895#if HHI_INTER_VIEW_MOTION_PRED && HHI_MPI
     
    814900#else
    815901  if( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE )
    816 #endif
     902#endif//*/
     903#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI || POZNAN_DBMP
     904