Changeset 5 in 3DVCSoftware for trunk/source/Lib/TLibEncoder
- Timestamp:
- 12 Dec 2011, 18:35:44 (13 years ago)
- Location:
- trunk/source/Lib/TLibEncoder
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibEncoder/SEIwrite.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/SEIwrite.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/TEncAnalyze.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/TEncBinCoder.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 258 291 xWriteFlag ( (pcSPS->getUseALF ()) ? 1 : 0 ); 259 292 xWriteFlag ( (pcSPS->getUseDQP ()) ? 1 : 0 ); 260 #if ! SB_NO_LowDelayCoding293 #if !HHI_NO_LowDelayCoding 261 294 xWriteFlag ( (pcSPS->getUseLDC ()) ? 1 : 0 ); 262 295 #endif … … 302 335 xWriteUvlc( pcSPS->getViewId() ); 303 336 xWriteSvlc( pcSPS->getViewOrderIdx() ); 304 #if HHI_DMM_INTRA 305 xWriteFlag( pcSPS->getUseDepthModelModes() ? 1 : 0 ); 306 #endif 337 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 338 xWriteFlag( pcSPS->getUseDMM() ? 1 : 0 ); 339 #endif 340 #if HHI_MPI 307 341 xWriteFlag( pcSPS->getUseMVI() ? 1 : 0 ); 342 #endif 308 343 } 309 344 else … … 324 359 } 325 360 } 361 #if DEPTH_MAP_GENERATION 326 362 xWriteUvlc( pcSPS->getPredDepthMapGeneration() ); 327 363 if( pcSPS->getPredDepthMapGeneration() ) … … 333 369 xWriteSvlc( pcSPS->getPdmOffset ()[ uiId ] ); 334 370 } 371 #if HHI_INTER_VIEW_MOTION_PRED 335 372 xWriteUvlc ( pcSPS->getMultiviewMvPredMode() ); 373 #endif 374 #if HHI_INTER_VIEW_RESIDUAL_PRED 336 375 xWriteFlag ( pcSPS->getMultiviewResPredMode() ); 337 } 376 #endif 377 } 378 #endif 338 379 } 339 380 } … … 686 727 687 728 729 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 688 730 Void 689 731 TEncCavlc::codeMergeIndexMV( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 691 733 UInt uiNumCand = 0; 692 734 UInt uiMergeIdx = pcCU->getMergeIndex( uiAbsPartIdx ); 693 #if MW_MVI_SIGNALLING_MODE == 1735 #if HHI_MPI 694 736 const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE; 695 const UInt uiMviMergePos = bMVIAvailable ? MVI_MERGE_POS : MRG_MAX_NUM_CANDS;737 const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : MRG_MAX_NUM_CANDS; 696 738 if( bMVIAvailable ) 697 739 { … … 699 741 const Bool bUseMVI = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1; 700 742 if( bUseMVI ) 701 uiMergeIdx = MVI_MERGE_POS;702 else if( uiMergeIdx >= MVI_MERGE_POS )743 uiMergeIdx = HHI_MPI_MERGE_POS; 744 else if( uiMergeIdx >= HHI_MPI_MERGE_POS ) 703 745 uiMergeIdx++; 704 746 } … … 754 796 } 755 797 } 756 798 #endif 757 799 758 800 … … 764 806 Void TEncCavlc::codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ) 765 807 { 766 #if MW_MVI_SIGNALLING_MODE == 1 808 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 809 #if HHI_INTER_VIEW_MOTION_PRED && HHI_MPI 767 810 if( ( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) || 768 811 ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ) 812 #elif HHI_MPI 813 if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 769 814 #else 770 815 if( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) … … 774 819 return; 775 820 } 821 #endif 776 822 777 823 Bool bLeftInvolved = false; … … 833 879 834 880 881 #if HHI_INTER_VIEW_RESIDUAL_PRED 835 882 Void 836 883 TEncCavlc::codeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 839 886 xWriteFlag( uiSymbol ); 840 887 } 841 888 #endif 842 889 843 890 Void TEncCavlc::codeAlfCtrlFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 940 987 #endif 941 988 } 942 943 #if MW_MVI_SIGNALLING_MODE == 0944 Void TEncCavlc::codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )945 {946 const Int iTextureModeDepth = pcCU->getTextureModeDepth( uiAbsPartIdx );947 if( iTextureModeDepth != -1 && uiDepth > iTextureModeDepth )948 return;949 UInt uiSymbol = iTextureModeDepth == uiDepth ? 1 : 0;950 xWriteFlag( uiSymbol );951 }952 #endif953 989 954 990 Void TEncCavlc::codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) -
trunk/source/Lib/TLibEncoder/TEncCavlc.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 193 226 #endif 194 227 Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 195 #if MW_MVI_SIGNALLING_MODE == 0196 Void codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );197 #endif198 228 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 199 229 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 230 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 200 231 Void codeMergeIndexMV ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 232 #endif 233 #if HHI_INTER_VIEW_RESIDUAL_PRED 201 234 Void codeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 235 #endif 202 236 Void codeAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 203 237 #if TSB_ALF_HEADER -
trunk/source/Lib/TLibEncoder/TEncCfg.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 /** \file TEncCfg.h … … 41 74 Int m_iRateGOPSize; 42 75 43 // SB44 76 std::string m_cInputFormatString ; 45 77 … … 75 107 Int m_iMaxDeltaQP; // Max. absolute delta QP (1:default) 76 108 77 //GTVSO109 #if HHI_VSO 78 110 //====== View Synthesis Optimization ====== 79 111 Bool m_bForceLambdaScale; 80 #if RDO_DIST_INT112 #if HHI_VSO_DIST_INT 81 113 Bool m_bAllowNegDist; 82 114 #endif 83 115 Double m_dLambdaScaleVSO; 84 116 UInt m_uiVSOMode; 85 //GT VSO end 117 #endif 86 118 87 119 //====== Tool list ======== … … 98 130 #endif 99 131 Bool m_bUseRDOQ; 100 #if ! SB_NO_LowDelayCoding132 #if !HHI_NO_LowDelayCoding 101 133 Bool m_bUseLDC; 102 134 #endif … … 104 136 Bool m_bUseFastEnc; 105 137 106 //GTVSO138 #if HHI_VSO 107 139 Bool m_bUseVSO; 108 //GT VSO end 109 110 Bool m_bOmitUnusedBlocks; 140 #endif 111 141 Bool m_bUseMRG; // SOPH: 112 142 #if LM_CHROMA … … 126 156 Bool m_bUseConstrainedIntraPred; 127 157 #endif 128 #if HHI_DMM_INTRA 129 Bool m_bUseDepthModelModes; 130 #endif 158 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 159 Bool m_bUseDMM; 160 #endif 161 #if HHI_MPI 131 162 Bool m_bUseMVI; 163 #endif 132 164 133 165 //====== Slice ======== … … 160 192 Int** m_aaiCodedOffset; 161 193 194 #if DEPTH_MAP_GENERATION 162 195 UInt m_uiPredDepthMapGeneration; 163 UInt m_uiMultiviewMvPredMode;164 196 UInt m_uiPdmPrecision; 165 197 Int** m_aaiPdmScaleNomDelta; 166 198 Int** m_aaiPdmOffset; 199 #endif 200 #if HHI_INTER_VIEW_MOTION_PRED 201 UInt m_uiMultiviewMvPredMode; 167 202 UInt m_uiMultiviewMvRegMode; 168 203 Double m_dMultiviewMvRegLambdaScale; 204 #endif 205 #if HHI_INTER_VIEW_RESIDUAL_PRED 169 206 UInt m_uiMultiviewResPredMode; 207 #endif 170 208 171 209 PicOrderCnt m_iQpChangeFrame; 172 210 Int m_iQpChangeOffsetVideo; 173 211 Int m_iQpChangeOffsetDepth; 174 #if SB_INTERVIEW_SKIP212 #if HHI_INTERVIEW_SKIP 175 213 UInt m_uiInterViewSkip; 176 #if SB_INTERVIEW_SKIP_LAMBDA_SCALE214 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 177 215 Double m_dInterViewSkipLambdaScale; 178 216 #endif … … 205 243 Void setCodedOffset ( Int** p ) { m_aaiCodedOffset = p; } 206 244 245 #if DEPTH_MAP_GENERATION 207 246 Void setPredDepthMapGeneration ( UInt u ) { m_uiPredDepthMapGeneration = u; } 208 Void setMultiviewMvPredMode ( UInt u ) { m_uiMultiviewMvPredMode = u; }209 247 Void setPdmPrecision ( UInt u ) { m_uiPdmPrecision = u; } 210 248 Void setPdmScaleNomDelta ( Int** p ) { m_aaiPdmScaleNomDelta = p; } 211 249 Void setPdmOffset ( Int** p ) { m_aaiPdmOffset = p; } 250 #endif 251 #if HHI_INTER_VIEW_MOTION_PRED 252 Void setMultiviewMvPredMode ( UInt u ) { m_uiMultiviewMvPredMode = u; } 212 253 Void setMultiviewMvRegMode ( UInt u ) { m_uiMultiviewMvRegMode = u; } 213 254 Void setMultiviewMvRegLambdaScale ( Double d) { m_dMultiviewMvRegLambdaScale = d; } 255 #endif 256 #if HHI_INTER_VIEW_RESIDUAL_PRED 214 257 Void setMultiviewResPredMode ( UInt u ) { m_uiMultiviewResPredMode = u; } 215 216 #if SB_INTERVIEW_SKIP 258 #endif 259 260 #if HHI_INTERVIEW_SKIP 217 261 Void setInterViewSkip ( UInt u ) { m_uiInterViewSkip = u; } 218 Bool getInterViewSkip ( ) { return bool(m_uiInterViewSkip) ;}219 #if SB_INTERVIEW_SKIP_LAMBDA_SCALE262 Bool getInterViewSkip ( ) { return (m_uiInterViewSkip?true:false) ;} 263 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 220 264 Void setInterViewSkipLambdaScale ( UInt u ) { m_dInterViewSkipLambdaScale = u; } 221 265 Double getInterViewSkipLambdaScale () { return m_dInterViewSkipLambdaScale; } … … 254 298 Void setMaxDeltaQP ( Int i ) { m_iMaxDeltaQP = i; } 255 299 256 //GTVSO300 #if HHI_VSO 257 301 //==== VSO ========== 258 302 Void setVSOMode ( UInt ui ) { m_uiVSOMode = ui; } 259 303 Void setForceLambdaScaleVSO ( Bool b ) { m_bForceLambdaScale = b; }; 260 304 Void setLambdaScaleVSO ( Double d ) { m_dLambdaScaleVSO = d; }; 261 #if RDO_DIST_INT305 #if HHI_VSO_DIST_INT 262 306 Void setAllowNegDist ( Bool b ) { m_bAllowNegDist = b; }; 263 307 #endif 264 //GT VSO end 308 #endif 265 309 266 310 //====== Sequence ======== … … 306 350 Int getMaxDeltaQP () { return m_iMaxDeltaQP; } 307 351 352 #if HHI_INTER_VIEW_MOTION_PRED 308 353 UInt getMultiviewMvRegMode () { return m_uiMultiviewMvRegMode; } 309 354 Double getMultiviewMvRegLambdaScale () { return m_dMultiviewMvRegLambdaScale; } 310 311 //GT VSO 355 #endif 356 357 #if HHI_VSO 312 358 //==== VSO ========== 313 359 UInt getVSOMode () { return m_uiVSOMode; } 314 360 Bool getForceLambdaScaleVSO () { return m_bForceLambdaScale; } 315 361 Double getLambdaScaleVSO () { return m_dLambdaScaleVSO; } 316 #if RDO_DIST_INT362 #if HHI_VSO_DIST_INT 317 363 Bool getAllowNegDist () { return m_bAllowNegDist; } 318 364 #endif 319 320 //GT VSO end 365 #endif 321 366 322 367 //==== Tool list ======== … … 330 375 #endif 331 376 Void setUseRDOQ ( Bool b ) { m_bUseRDOQ = b; } 332 #if ! SB_NO_LowDelayCoding377 #if !HHI_NO_LowDelayCoding 333 378 Void setUseLDC ( Bool b ) { m_bUseLDC = b; } 334 379 #endif 335 380 Void setUsePAD ( Bool b ) { m_bUsePAD = b; } 336 381 Void setUseFastEnc ( Bool b ) { m_bUseFastEnc = b; } 337 //GTVSO382 #if HHI_VSO 338 383 Void setUseVSO ( Bool b ) { m_bUseVSO = b; } 339 //GT VSO end 384 #endif 340 385 Void setUseMRG ( Bool b ) { m_bUseMRG = b; } // SOPH: 341 386 #if CONSTRAINED_INTRA_PRED … … 344 389 Void setdQPs ( Int* p ) { m_aidQP = p; } 345 390 Void setDeltaQpRD ( UInt u ) {m_uiDeltaQpRD = u; } 346 347 Void setOmitUnusedBlocks ( Bool b ) { m_bOmitUnusedBlocks = b; }348 391 349 392 Bool getUseSBACRD () { return m_bUseSBACRD; } … … 360 403 #endif 361 404 Bool getUseRDOQ () { return m_bUseRDOQ; } 362 #if ! SB_NO_LowDelayCoding405 #if !HHI_NO_LowDelayCoding 363 406 Bool getUseLDC () { return m_bUseLDC; } 364 407 #endif … … 366 409 Bool getUseFastEnc () { return m_bUseFastEnc; } 367 410 368 //GTVSO411 #if HHI_VSO 369 412 Bool getUseVSO () { return m_bUseVSO; } 370 //GT VSO end 413 #endif 371 414 Bool getUseMRG () { return m_bUseMRG; } // SOPH: 372 415 #if CONSTRAINED_INTRA_PRED 373 416 Bool getUseConstrainedIntraPred () { return m_bUseConstrainedIntraPred; } 374 417 #endif 375 #if HHI_DMM_INTRA 376 Void setUseDepthModelModes( Bool b) { m_bUseDepthModelModes = b; } 377 Bool getUseDepthModelModes() { return m_bUseDepthModelModes; } 378 #endif 379 380 Bool getOmitUnusedBlocks () { return m_bOmitUnusedBlocks; } 418 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 419 Void setUseDMM( Bool b) { m_bUseDMM = b; } 420 Bool getUseDMM() { return m_bUseDMM; } 421 #endif 381 422 382 423 #if LM_CHROMA … … 413 454 Bool getUseSAO () {return m_bUseSAO;} 414 455 #endif 456 #if HHI_MPI 415 457 Void setUseMVI (Bool bVal) {m_bUseMVI = bVal;} 458 #endif 416 459 417 460 void setPictureDigestEnabled(bool b) { m_pictureDigestEnabled = b; } -
trunk/source/Lib/TLibEncoder/TEncCu.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 1 33 2 34 … … 36 68 m_ppcResPredTmp = new TComYuv*[m_uhTotalDepth-1]; 37 69 38 #if MW_MVI_SIGNALLING_MODE == 170 #if HHI_MPI 39 71 m_puhDepthSaved = new UChar[1ll<<( ( m_uhTotalDepth - 1 )<<1 )]; 40 72 m_puhWidthSaved = new UChar[1ll<<( ( m_uhTotalDepth - 1 )<<1 )]; … … 77 109 Int i; 78 110 79 #if MW_MVI_SIGNALLING_MODE == 1111 #if HHI_MPI 80 112 delete[] m_puhDepthSaved; m_puhDepthSaved = NULL; 81 113 delete[] m_puhWidthSaved; m_puhWidthSaved = NULL; … … 245 277 246 278 247 //GTVSO279 #if HHI_VSO 248 280 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 249 281 { … … 251 283 } 252 284 else 285 #endif 253 286 { 254 287 m_ppcBestCU[0]->getTotalCost() = m_pcRdCost->calcRdCost( m_ppcBestCU[0]->getTotalBits(), m_ppcBestCU[0]->getTotalDistortion() ); 255 288 } 256 //GT VSO end 289 257 290 fBestCost = m_ppcBestCU[0]->getTotalCost(); 258 291 … … 276 309 m_ppcBestCU[0]->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 277 310 278 //GTVSO311 #if HHI_VSO 279 312 if (m_pcRdCost->getUseLambdaScaleVSO()) 280 313 { … … 282 315 } 283 316 else 317 #endif 284 318 { 285 319 m_ppcBestCU[0]->getTotalCost() = m_pcRdCost->calcRdCost( m_ppcBestCU[0]->getTotalBits(), m_ppcBestCU[0]->getTotalDistortion() ); 286 320 } 287 //GT VSO end288 321 289 322 if ( fBestCost > m_ppcBestCU[0]->getTotalCost() ) … … 309 342 m_ppcBestCU[0]->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits 310 343 311 //GTVSO344 #if HHI_VSO 312 345 if (m_pcRdCost->getUseLambdaScaleVSO()) 313 346 { … … 315 348 } 316 349 else 350 #endif 317 351 { 318 352 m_ppcBestCU[0]->getTotalCost() = m_pcRdCost->calcRdCost( m_ppcBestCU[0]->getTotalBits(), m_ppcBestCU[0]->getTotalDistortion() ); 319 353 } 320 //GT VSO end321 354 } 322 355 } … … 415 448 UInt uiBPelY = uiTPelY + rpcBestCU->getHeight(0) - 1; 416 449 417 #if ( SB_INTERVIEW_SKIP)450 #if ( HHI_INTERVIEW_SKIP) 418 451 Bool bFullyRenderedSec = true ; 419 452 if( m_pcEncCfg->getInterViewSkip() ) … … 445 478 bFullyRenderedSec = false ; 446 479 } 447 #if SB_INTERVIEW_SKIP_LAMBDA_SCALE480 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 448 481 if( bFullyRenderedSec ) 449 482 { … … 463 496 if( rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 464 497 { 498 #if HHI_INTER_VIEW_RESIDUAL_PRED 465 499 // check availability of residual prediction 466 500 Bool bResPredAvailable = false; … … 476 510 { 477 511 Bool bResPredFlag = ( uiResPrdId > 0 ); 512 #endif 478 513 479 514 // SKIP … … 483 518 { 484 519 #if !HHI_MRG_SKIP 520 #if HHI_INTER_VIEW_RESIDUAL_PRED 485 521 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 522 #endif 486 523 xCheckRDCostAMVPSkip ( rpcBestCU, rpcTempCU ); rpcTempCU->initEstData(); 487 524 #endif 525 #if HHI_INTER_VIEW_RESIDUAL_PRED 488 526 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 489 #if SB_INTERVIEW_SKIP 527 #endif 528 #if HHI_INTERVIEW_SKIP 490 529 xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, bFullyRenderedSec ); rpcTempCU->initEstData(); 491 530 #else … … 495 534 else 496 535 { 536 #if HHI_INTER_VIEW_RESIDUAL_PRED 497 537 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 538 #endif 498 539 xCheckRDCostAMVPSkip ( rpcBestCU, rpcTempCU ); rpcTempCU->initEstData(); 499 540 } … … 514 555 { 515 556 #if HHI_DISABLE_INTER_NxN_SPLIT 557 #if HHI_INTER_VIEW_RESIDUAL_PRED 516 558 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 517 #if SB_INTERVIEW_SKIP 559 #endif 560 #if HHI_INTERVIEW_SKIP 518 561 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec ); rpcTempCU->initEstData(); 519 562 #else … … 522 565 if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) 523 566 { 567 #if HHI_INTER_VIEW_RESIDUAL_PRED 524 568 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 525 #if SB_INTERVIEW_SKIP 569 #endif 570 #if HHI_INTERVIEW_SKIP 526 571 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec ); rpcTempCU->initEstData(); 527 572 #else … … 530 575 } 531 576 #else 577 #if HHI_INTER_VIEW_RESIDUAL_PRED 532 578 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 533 #if SB_INTERVIEW_SKIP 579 #endif 580 #if HHI_INTERVIEW_SKIP 534 581 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec ); rpcTempCU->initEstData(); 535 582 #else 536 583 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData(); 537 584 #endif 585 #if HHI_INTER_VIEW_RESIDUAL_PRED 538 586 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 539 #if SB_INTERVIEW_SKIP 587 #endif 588 #if HHI_INTERVIEW_SKIP 540 589 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN, bFullyRenderedSec ); rpcTempCU->initEstData(); 541 590 #else … … 549 598 #endif 550 599 { // 2NxN, Nx2N 600 #if HHI_INTER_VIEW_RESIDUAL_PRED 551 601 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 552 #if SB_INTERVIEW_SKIP 602 #endif 603 #if HHI_INTERVIEW_SKIP 553 604 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N, bFullyRenderedSec ); rpcTempCU->initEstData(); 554 605 #else 555 606 xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N ); rpcTempCU->initEstData(); 556 607 #endif 608 #if HHI_INTER_VIEW_RESIDUAL_PRED 557 609 rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag ); 558 #if SB_INTERVIEW_SKIP 610 #endif 611 #if HHI_INTERVIEW_SKIP 559 612 xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN, bFullyRenderedSec ); rpcTempCU->initEstData(); 560 613 #else … … 563 616 } 564 617 618 #if HHI_INTER_VIEW_RESIDUAL_PRED 565 619 } // uiResPrdId 620 #endif 566 621 } 567 622 … … 570 625 { 571 626 // speedup for inter frames 572 #if SB_INTERVIEW_SKIP627 #if HHI_INTERVIEW_SKIP 573 628 if( ( rpcBestCU->getSlice()->getSliceType() == I_SLICE || 574 629 rpcBestCU->getCbf( 0, TEXT_LUMA ) != 0 || … … 596 651 597 652 m_pcEntropyCoder->resetBits(); 598 #if MW_MVI_SIGNALLING_MODE == 0599 if( rpcBestCU->getSlice()->getSPS()->getUseMVI() && rpcBestCU->getSlice()->getSliceType() != I_SLICE )600 m_pcEntropyCoder->encodeMvInheritanceFlag( rpcBestCU, 0, uiDepth, true );601 #endif602 653 m_pcEntropyCoder->encodeSplitFlag( rpcBestCU, 0, uiDepth, true ); 603 654 rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 604 655 605 //GTVSO656 #if HHI_VSO 606 657 if (m_pcRdCost->getUseLambdaScaleVSO()) 607 658 { … … 609 660 } 610 661 else 611 { 612 #if SB_INTERVIEW_SKIP 662 #endif 663 { 664 #if HHI_INTERVIEW_SKIP 613 665 if( m_pcEncCfg->getInterViewSkip()) 614 666 { … … 631 683 rpcBestCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() ); 632 684 } 633 //GT VSO end685 634 686 635 687 // accumulate statistics for early skip … … 643 695 } 644 696 } 645 #if MW_MVI_SIGNALLING_MODE == 0 646 if( rpcBestCU->getSlice()->getSPS()->getUseMVI() && rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 647 { 648 xCheckRDCostMvInheritance( rpcBestCU, rpcTempCU, uiDepth, false ); rpcTempCU->initEstData(); 649 } 650 #elif MW_MVI_SIGNALLING_MODE == 1 697 #if HHI_MPI 651 698 if( rpcBestCU->getSlice()->getSPS()->getUseMVI() && rpcBestCU->getSlice()->getSliceType() != I_SLICE ) 652 699 { … … 666 713 if( bTrySplit && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) 667 714 { 715 #if HHI_VSO 668 716 // reset Model 669 717 if( m_pcRdCost->getUseRenModel() ) … … 675 723 m_pcRdCost->setRenModelData( m_ppcBestCU[uiDepth], 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 676 724 } 725 #endif 677 726 678 727 UChar uhNextDepth = uiDepth+1; … … 701 750 xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uhNextDepth ); 702 751 752 #if HHI_VSO 703 753 if( m_pcRdCost->getUseRenModel() ) 704 754 { … … 709 759 m_pcRdCost->setRenModelData( pcSubBestPartCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 710 760 } 761 #endif 711 762 rpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth ); // Keep best part data to current temporary data. 712 763 xCopyYuv2Tmp( pcSubBestPartCU->getTotalNumPart()*uiPartUnitIdx, uhNextDepth ); … … 718 769 m_pcEntropyCoder->resetBits(); 719 770 m_pcEntropyCoder->encodeSplitFlag( rpcTempCU, 0, uiDepth, true ); 720 #if MW_MVI_SIGNALLING_MODE == 0721 if( rpcBestCU->getSlice()->getSPS()->getUseMVI() && rpcBestCU->getSlice()->getSliceType() != I_SLICE )722 m_pcEntropyCoder->encodeMvInheritanceFlag( rpcTempCU, 0, uiDepth, true );723 #endif724 771 725 772 rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits 726 773 } 727 774 728 #if SB_INTERVIEW_SKIP_LAMBDA_SCALE775 #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE 729 776 if( bFullyRenderedSec ) 730 777 { … … 736 783 } 737 784 #endif 738 //GTVSO785 #if HHI_VSO 739 786 if ( m_pcRdCost->getUseLambdaScaleVSO()) 740 787 { … … 742 789 } 743 790 else 791 #endif 744 792 { 745 793 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 746 794 } 747 //GT VSO end748 795 749 796 if( m_bUseSBACRD ) … … 753 800 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth ); // RD compare current larger prediction 754 801 802 #if HHI_VSO 755 803 if( m_pcRdCost->getUseRenModel() ) 756 804 { … … 761 809 m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 762 810 } 811 #endif 763 812 } // with sub partitioned prediction. 764 813 … … 793 842 UInt uiBPelY = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1; 794 843 795 #if MW_MVI_SIGNALLING_MODE == 0796 if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE )797 {798 m_pcEntropyCoder->encodeMvInheritanceFlag( pcCU, uiAbsPartIdx, uiDepth );799 }800 #endif801 844 if( ( uiRPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiBPelY < pcCU->getSlice()->getSPS()->getHeight() ) ) 802 845 { 846 #if HHI_MPI 803 847 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) ) 848 #endif 804 849 m_pcEntropyCoder->encodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); 805 850 } … … 809 854 } 810 855 811 #if MW_MVI_SIGNALLING_MODE == 1856 #if HHI_MPI 812 857 if( uiDepth == pcCU->getTextureModeDepth( uiAbsPartIdx ) ) 813 858 { … … 870 915 #endif 871 916 917 #if HHI_MPI 872 918 if( !pcCU->getSlice()->isIntra() && pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) 919 #else 920 if( !pcCU->getSlice()->isIntra() ) 921 #endif 873 922 { 874 923 m_pcEntropyCoder->encodeSkipFlag( pcCU, uiAbsPartIdx ); … … 889 938 } 890 939 #endif 940 #if HHI_INTER_VIEW_RESIDUAL_PRED 891 941 m_pcEntropyCoder->encodeResPredFlag( pcCU, uiAbsPartIdx, 0 ); 942 #endif 892 943 return; 893 944 } 945 #if HHI_MPI 894 946 if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 ) 895 947 { 948 #endif 896 949 m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx ); 897 950 … … 901 954 m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx ); 902 955 956 #if HHI_INTER_VIEW_RESIDUAL_PRED 903 957 if( !pcCU->isIntra( uiAbsPartIdx ) ) 904 958 { 905 959 m_pcEntropyCoder->encodeResPredFlag( pcCU, uiAbsPartIdx, 0 ); 906 960 } 907 } 961 #endif 962 #if HHI_MPI 963 } 964 #endif 908 965 909 966 // Encode Coefficients … … 915 972 UChar uhDepth = rpcTempCU->getDepth( 0 ); 916 973 974 #if HHI_VSO 917 975 if( m_pcRdCost->getUseRenModel() ) 918 976 { … … 923 981 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 924 982 } 983 #endif 925 984 926 985 rpcTempCU->setPredModeSubParts( MODE_SKIP, 0, uhDepth ); … … 950 1009 * \returns Void 951 1010 */ 952 #if SB_INTERVIEW_SKIP1011 #if HHI_INTERVIEW_SKIP 953 1012 Void TEncCu::xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bSkipRes ) 954 1013 #else … … 961 1020 UInt uiNeighbourCandIdx[MRG_MAX_NUM_CANDS]; //MVs with same idx => same cand 962 1021 1022 #if HHI_INTER_VIEW_RESIDUAL_PRED 963 1023 Bool bResPrdAvail = rpcTempCU->getResPredAvail( 0 ); 964 1024 Bool bResPrdFlag = rpcTempCU->getResPredFlag ( 0 ); 1025 #endif 965 1026 966 1027 for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) … … 971 1032 UChar uhDepth = rpcTempCU->getDepth( 0 ); 972 1033 1034 #if HHI_VSO 973 1035 if( m_pcRdCost->getUseRenModel() ) 974 1036 { … … 979 1041 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 980 1042 } 1043 #endif 981 1044 982 1045 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level … … 990 1053 #if HHI_MRG_SKIP 991 1054 TComYuv* pcPredYuvTemp = NULL; 992 #if SB_INTERVIEW_SKIP1055 #if HHI_INTERVIEW_SKIP 993 1056 for( UInt uiNoResidual = (bSkipRes ? 1:0); uiNoResidual < 2; ++uiNoResidual ) 994 1057 #else … … 1015 1078 rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[1 + 2*uiMergeCand].getRefIdx(), SIZE_2Nx2N, 0, 0, 0 ); // interprets depth relative to rpcTempCU level 1016 1079 1080 #if HHI_INTER_VIEW_RESIDUAL_PRED 1017 1081 rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth ); 1018 1082 rpcTempCU->setResPredFlagSubParts ( bResPrdFlag, 0, 0, uhDepth ); 1083 #endif 1019 1084 1020 1085 #if HHI_MRG_SKIP 1021 1086 // do MC 1022 #if SB_INTERVIEW_SKIP1087 #if HHI_INTERVIEW_SKIP 1023 1088 if ( (uiNoResidual == 0) || bSkipRes ){ 1024 1089 #else … … 1036 1101 } 1037 1102 } 1038 1103 #if HHI_VSO 1039 1104 if( m_pcRdCost->getUseRenModel() ) 1040 1105 { //Reset … … 1045 1110 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1046 1111 } 1112 #endif 1047 1113 1048 1114 // estimate residual and encode everything … … 1082 1148 } 1083 1149 1084 #if SB_INTERVIEW_SKIP1150 #if HHI_INTERVIEW_SKIP 1085 1151 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bSkipRes) 1086 1152 #else … … 1090 1156 UChar uhDepth = rpcTempCU->getDepth( 0 ); 1091 1157 1158 #if HHI_VSO 1092 1159 if( m_pcRdCost->getUseRenModel() ) 1093 1160 { … … 1098 1165 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1099 1166 } 1167 #endif 1100 1168 1101 1169 rpcTempCU->setDepthSubParts( uhDepth, 0 ); 1102 1170 1171 #if HHI_INTER_VIEW_RESIDUAL_PRED 1103 1172 Bool bResPrdAvail = rpcTempCU->getResPredAvail( 0 ); 1104 1173 Bool bResPrdFlag = rpcTempCU->getResPredFlag ( 0 ); 1174 #endif 1105 1175 rpcTempCU->setPartSizeSubParts ( SIZE_2Nx2N, 0, uhDepth ); 1176 #if HHI_INTER_VIEW_RESIDUAL_PRED 1106 1177 rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth ); 1107 1178 rpcTempCU->setResPredFlagSubParts ( bResPrdFlag, 0, 0, uhDepth ); 1179 #endif 1108 1180 rpcTempCU->setPartSizeSubParts ( ePartSize, 0, uhDepth ); 1109 1181 rpcTempCU->setPredModeSubParts ( MODE_INTER, 0, uhDepth ); 1110 1182 1183 #if HHI_INTER_VIEW_RESIDUAL_PRED 1111 1184 if( rpcTempCU->getResPredFlag( 0 ) ) 1112 1185 { // subtract residual prediction from original in motion search 1113 1186 m_ppcOrigYuv[uhDepth]->add( m_ppcResPredTmp [uhDepth], rpcTempCU->getWidth( 0 ), rpcTempCU->getHeight( 0 ), true ); 1114 1187 } 1115 #if SB_INTERVIEW_SKIP 1188 #endif 1189 #if HHI_INTERVIEW_SKIP 1116 1190 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes ); 1117 1191 #else 1118 1192 m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] ); 1119 1193 #endif 1194 #if HHI_INTER_VIEW_RESIDUAL_PRED 1120 1195 if( rpcTempCU->getResPredFlag( 0 ) ) 1121 1196 { // add residual prediction to original again 1122 1197 m_ppcOrigYuv[uhDepth]->add( m_ppcResPredTmp [uhDepth], rpcTempCU->getWidth( 0 ), rpcTempCU->getHeight( 0 ) ); 1123 1198 } 1199 #endif 1124 1200 1125 1201 #if PART_MRG … … 1129 1205 } 1130 1206 #endif 1131 #if SB_INTERVIEW_SKIP1207 #if HHI_INTERVIEW_SKIP 1132 1208 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], m_ppcResPredTmp [uhDepth],bSkipRes ); 1133 1209 #else 1134 1210 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], m_ppcResPredTmp [uhDepth], false ); 1135 1211 #endif 1136 //GT VSO 1212 1213 #if HHI_VSO 1137 1214 if( m_pcRdCost->getUseLambdaScaleVSO() ) 1138 1215 { … … 1140 1217 } 1141 1218 else 1219 #endif 1142 1220 { 1143 1221 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1144 1222 } 1145 //GT VSO end1146 1223 1147 1224 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth ); … … 1152 1229 UInt uiDepth = rpcTempCU->getDepth( 0 ); 1153 1230 1154 // reset Model 1231 #if HHI_VSO 1155 1232 if( m_pcRdCost->getUseRenModel() ) 1156 1233 { … … 1161 1238 m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1162 1239 } 1240 #endif 1163 1241 1164 1242 rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth ); … … 1191 1269 1192 1270 rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits(); 1193 //GTVSO1271 #if HHI_VSO 1194 1272 if( m_pcRdCost->getUseLambdaScaleVSO()) 1195 1273 { … … 1197 1275 } 1198 1276 else 1277 #endif 1199 1278 { 1200 1279 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1201 1280 } 1202 //GT VSO end1203 1281 1204 1282 xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth ); … … 1239 1317 UChar uhDepth = rpcTempCU->getDepth(0); 1240 1318 1319 #if HHI_INTER_VIEW_RESIDUAL_PRED 1241 1320 Bool bResPrdAvail = rpcTempCU->getResPredAvail( 0 ); 1242 1321 Bool bResPrdFlag = rpcTempCU->getResPredFlag ( 0 ); 1322 #endif 1243 1323 1244 1324 AMVPInfo cAMVPInfo0; … … 1278 1358 rpcTempCU->setPredModeSubParts( MODE_SKIP, 0, uhDepth ); 1279 1359 rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); 1360 #if HHI_INTER_VIEW_RESIDUAL_PRED 1280 1361 rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth ); 1281 1362 rpcTempCU->setResPredFlagSubParts ( bResPrdFlag, 0, 0, uhDepth ); 1363 #endif 1282 1364 1283 1365 if (rpcTempCU->getSlice()->isInterB()) … … 1317 1399 } 1318 1400 1319 #if MW_MVI_SIGNALLING_MODE == 0 1320 Void TEncCu::xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bRecursiveCall ) 1321 #elif MW_MVI_SIGNALLING_MODE == 1 1401 #if HHI_MPI 1322 1402 Void TEncCu::xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bSkipResidual, Bool bRecursiveCall ) 1323 #else1324 #error1325 #endif1326 1403 { 1327 1404 assert( rpcTempCU->getSlice()->getSPS()->isDepth() ); … … 1342 1419 } 1343 1420 1421 #if HHI_VSO 1344 1422 if( m_pcRdCost->getUseRenModel() && !bRecursiveCall) 1345 1423 { … … 1350 1428 m_pcRdCost->setRenModelData( m_ppcTempCU[uhDepth], 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1351 1429 } 1430 #endif 1352 1431 1353 1432 Bool bSplit = uhDepth < pcTextureCU->getDepth( rpcTempCU->getZorderIdxInCU() ); … … 1377 1456 } 1378 1457 1379 #if MW_MVI_SIGNALLING_MODE == 01380 xCheckRDCostMvInheritance( pcSubBestPartCU, pcSubTempPartCU, uhTextureModeDepth, true );1381 #elif MW_MVI_SIGNALLING_MODE == 11382 1458 xCheckRDCostMvInheritance( pcSubBestPartCU, pcSubTempPartCU, uhTextureModeDepth, bSkipResidual, true ); 1383 #endif1384 1459 1385 1460 rpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth ); // Keep best part data to current temporary data. … … 1408 1483 assert( rpcTempCU->getPredictionMode( ui ) != MODE_NONE ); 1409 1484 } 1410 #if MW_MVI_SIGNALLING_MODE == 01411 if( rpcTempCU->getPredictionMode( 0 ) == MODE_SKIP )1412 {1413 rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth );1414 }1415 #elif MW_MVI_SIGNALLING_MODE == 11416 1485 rpcTempCU->setPredModeSubParts( bSkipResidual ? MODE_SKIP : MODE_INTER, 0, uhDepth ); 1417 #endif1418 1486 m_pcPredSearch->motionCompensation( rpcTempCU, m_ppcPredYuvTemp[uhDepth] ); 1419 1487 1420 1488 // get Original YUV data from picture 1421 1489 m_ppcOrigYuv[uhDepth]->copyFromPicYuv( rpcBestCU->getPic()->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() ); 1422 #if MW_MVI_SIGNALLING_MODE == 01423 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], m_ppcResPredTmp [uhDepth], false );1424 #elif MW_MVI_SIGNALLING_MODE == 11425 1490 m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], m_ppcResPredTmp [uhDepth], bSkipResidual ); 1426 #endif1427 1491 1428 1492 if( uhDepth == uhTextureModeDepth ) … … 1431 1495 } 1432 1496 } 1433 //GT VSO 1497 1498 #if HHI_VSO 1434 1499 if( m_pcRdCost->getUseLambdaScaleVSO() ) 1435 1500 { … … 1437 1502 } 1438 1503 else 1504 #endif 1439 1505 { 1440 1506 rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 1441 1507 } 1442 //GT VSO end1443 1508 1444 1509 xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth ); 1445 1510 1511 #if HHI_VSO 1446 1512 if( !bSplit && bRecursiveCall && m_pcRdCost->getUseRenModel() ) 1447 1513 { … … 1452 1518 m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 1453 1519 } 1520 #endif 1454 1521 } 1455 1522 … … 1458 1525 const UChar uhDepth = pcCU->getTextureModeDepth( 0 ); 1459 1526 m_pcEntropyCoder->resetBits(); 1460 #if MW_MVI_SIGNALLING_MODE == 01461 m_pcEntropyCoder->encodeMvInheritanceFlag( pcCU, 0, uhDepth, true );1462 #elif MW_MVI_SIGNALLING_MODE == 11463 1527 xSaveDepthWidthHeight( pcCU ); 1464 1528 pcCU->setSizeSubParts( g_uiMaxCUWidth>>uhDepth, g_uiMaxCUHeight>>uhDepth, 0, uhDepth ); … … 1527 1591 } 1528 1592 xRestoreDepthWidthHeight( pcCU ); 1529 #endif1530 1593 1531 1594 pcCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); 1532 1595 } 1533 1596 1534 #if MW_MVI_SIGNALLING_MODE == 11535 1597 Void TEncCu::xSaveDepthWidthHeight( TComDataCU* pcCU ) 1536 1598 { -
trunk/source/Lib/TLibEncoder/TEncCu.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 68 101 Bool m_bUseSBACRD; 69 102 70 #if MW_MVI_SIGNALLING_MODE == 1103 #if HHI_MPI 71 104 UChar *m_puhDepthSaved; 72 105 UChar *m_puhWidthSaved; … … 99 132 Void xCheckRDCostAMVPSkip( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU ); 100 133 101 #if SB_INTERVIEW_SKIP134 #if HHI_INTERVIEW_SKIP 102 135 Void xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bFullyRendered ) ; 103 136 #else … … 106 139 107 140 Void xCheckRDCostSkip ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bBSkipRes ); 108 #if SB_INTERVIEW_SKIP141 #if HHI_INTERVIEW_SKIP 109 142 Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered ) ; 110 143 #else … … 118 151 Void xCopyYuv2Tmp ( UInt uhPartUnitIdx, UInt uiDepth ); 119 152 Void xAddMVISignallingBits( TComDataCU* pcCU ); 120 #if MW_MVI_SIGNALLING_MODE == 0 121 Void xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bRecursiveCall ); 122 #elif MW_MVI_SIGNALLING_MODE == 1 153 #if HHI_MPI 123 154 Void xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bSkipResidual, Bool bRecursiveCall ); 124 155 Void xSaveDepthWidthHeight( TComDataCU* pcCU ); -
trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 408 441 } 409 442 } 410 #if MW_MVI_SIGNALLING_MODE == 1443 #if HHI_MPI 411 444 if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 412 445 uiNumCand++; … … 419 452 420 453 454 #if HHI_INTER_VIEW_RESIDUAL_PRED 421 455 Void 422 456 TEncEntropy::encodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD ) … … 437 471 m_pcEntropyCoderIf->codeResPredFlag( pcCU, uiAbsPartIdx ); 438 472 } 473 #endif 439 474 440 475 … … 517 552 m_pcEntropyCoderIf->codeSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); 518 553 } 519 520 #if MW_MVI_SIGNALLING_MODE == 0521 Void TEncEntropy::encodeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD )522 {523 if( bRD )524 uiAbsPartIdx = 0;525 m_pcEntropyCoderIf->codeMvInheritanceFlag( pcCU, uiAbsPartIdx, uiDepth );526 }527 #endif528 554 529 555 /** encode partition size … … 1568 1594 { 1569 1595 #if HHI_MRG_SKIP 1570 #if MW_MVI_SIGNALLING_MODE == 11596 #if HHI_MPI 1571 1597 if( !(pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N && 1572 1598 ( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth == pcCU->getTextureModeDepth( uiAbsPartIdx ) ) ) ) -
trunk/source/Lib/TLibEncoder/TEncEntropy.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 57 90 58 91 virtual Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 59 #if MW_MVI_SIGNALLING_MODE == 060 virtual Void codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;61 #endif62 92 virtual Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 63 93 virtual Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 94 #if HHI_INTER_VIEW_RESIDUAL_PRED 64 95 virtual Void codeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 96 #endif 65 97 virtual Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 66 98 … … 138 170 Void encodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); 139 171 Void encodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 140 #if MW_MVI_SIGNALLING_MODE == 0141 Void encodeMvInheritanceFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );142 #endif143 172 Void encodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 144 173 Void encodeInterDirPU ( TComDataCU* pcSubCU, UInt uiAbsPartIdx ); … … 152 181 Void encodeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx ); 153 182 #endif 183 #if HHI_INTER_VIEW_RESIDUAL_PRED 154 184 Void encodeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD = false ); 185 #endif 155 186 Void encodeAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 156 187 #if TSB_ALF_HEADER -
trunk/source/Lib/TLibEncoder/TEncFormattedStringParser.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 #include "TEncFormattedStringParser.h" -
trunk/source/Lib/TLibEncoder/TEncFormattedStringParser.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 #if !defined(AFX_TEncFormattedStringParser_H__268768B8_4D1D_484A_904E_586985833BAC__INCLUDED_) 2 35 #define AFX_TEncFormattedStringParser_H__268768B8_4D1D_484A_904E_586985833BAC__INCLUDED_ -
trunk/source/Lib/TLibEncoder/TEncGOP.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 13 46 #include <time.h> 14 47 15 // SB16 48 #include "../../App/TAppEncoder/TAppEncTop.h" 17 49 … … 25 57 m_pcSliceEncoder = NULL; 26 58 m_pcListPic = NULL; 27 59 28 60 m_pcEntropyCoder = NULL; 29 61 m_pcCavlcCoder = NULL; 30 62 m_pcSbacCoder = NULL; 31 63 m_pcBinCABAC = NULL; 64 #if DEPTH_MAP_GENERATION 32 65 m_pcDepthMapGenerator = NULL; 66 #endif 67 #if HHI_INTER_VIEW_RESIDUAL_PRED 33 68 m_pcResidualGenerator = NULL; 34 69 #endif 70 35 71 #if DCM_DECODING_REFRESH 36 72 m_bRefreshPending = 0; … … 69 105 m_pcSliceEncoder = pcTEncTop->getSliceEncoder(); 70 106 m_pcListPic = pcTEncTop->getListPic(); 71 107 72 108 m_pcEntropyCoder = pcTEncTop->getEntropyCoder(); 73 109 m_pcCavlcCoder = pcTEncTop->getCavlcCoder(); … … 76 112 m_pcLoopFilter = pcTEncTop->getLoopFilter(); 77 113 m_pcBitCounter = pcTEncTop->getBitCounter(); 114 #if DEPTH_MAP_GENERATION 78 115 m_pcDepthMapGenerator = pcTEncTop->getDepthMapGenerator(); 116 #endif 117 #if HHI_INTER_VIEW_RESIDUAL_PRED 79 118 m_pcResidualGenerator = pcTEncTop->getResidualGenerator(); 80 119 #endif 120 81 121 // Adaptive Loop filter 82 122 m_pcAdaptiveLoopFilter = pcTEncTop->getAdaptiveLoopFilter(); … … 97 137 { 98 138 TComSlice* pcSlice; 99 139 100 140 //-- For time output for each slice 101 141 long iBeforeTime = clock(); … … 104 144 pcBitstreamOut->resetBits(); 105 145 pcBitstreamOut->rewindStreamPacket(); 106 146 107 147 // Slice data initialization 108 148 pcPic->clearSliceBuffer(); … … 112 152 m_pcSliceEncoder->initEncSlice ( pcPic, pcSlice ); 113 153 pcSlice->setSliceIdx(0); 114 154 115 155 // Set SPS 116 156 pcSlice->setSPS( m_pcEncTop->getSPS() ); … … 120 160 // set mutliview parameters 121 161 pcSlice->initMultiviewSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() ); 122 162 123 163 #if DCM_DECODING_REFRESH 124 164 // Set the nal unit type … … 129 169 130 170 //pcSlice->setNalUnitType(getNalUnitType(uiPOCCurr)); 131 // Do decoding refresh marking if any 171 // Do decoding refresh marking if any 132 172 pcSlice->decodingRefreshMarking(m_uiPOCCDR, m_bRefreshPending, rcListPic); 133 173 #endif … … 140 180 141 181 pcSlice->setRefPicListFromGOPSTring( rcListPic, apcSpatRefPics ); 182 183 #if HHI_VSO 142 184 m_pcEncTop->getEncTop()->setMVDPic(pcPic->getViewIdx(), pcSlice->getPOC(), pcPic->getMVDReferenceInfo() ); 143 185 144 //GT VSO 145 Bool bUseVSO = m_pcEncTop->getUseVSO(); 186 187 Bool bUseVSO = m_pcEncTop->getUseVSO(); 146 188 m_pcRdCost->setUseVSO( bUseVSO ); 147 189 148 190 if ( bUseVSO ) 149 { 191 { 150 192 Int iVSOMode = m_pcEncTop->getVSOMode(); 151 m_pcRdCost->setVSOMode( iVSOMode ); 152 #if RDO_DIST_INT153 m_pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() ); 193 m_pcRdCost->setVSOMode( iVSOMode ); 194 #if HHI_VSO_DIST_INT 195 m_pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() ); 154 196 #endif 155 197 156 198 if ( iVSOMode == 4 ) 157 199 { 158 m_pcEncTop->getEncTop()->setupRenModel( pcSlice->getPOC(), pcPic->getViewIdx(), m_pcEncTop->isDepthCoder() ? 1 : 0 ); 200 m_pcEncTop->getEncTop()->setupRenModel( pcSlice->getPOC(), pcPic->getViewIdx(), m_pcEncTop->isDepthCoder() ? 1 : 0 ); 159 201 } 160 202 else … … 163 205 } 164 206 } 165 //GT VSO end 166 167 if ( m_pcEncTop->getOmitUnusedBlocks() ) 168 { 169 m_pcEncTop->getEncTop()->getUsedPelsMap( pcPic->getViewIdx(), pcPic->getPOC(), pcPic->getUsedPelsMap() ); 170 } 171 207 #endif 208 209 #if HHI_INTERVIEW_SKIP 210 if ( m_pcEncTop->getInterViewSkip() ) 211 { 212 m_pcEncTop->getEncTop()->getUsedPelsMap( pcPic->getViewIdx(), pcPic->getPOC(), pcPic->getUsedPelsMap() ); 213 } 214 #endif 215 172 216 pcSlice->setNoBackPredFlag( false ); 173 217 #if DCM_COMB_LIST … … 183 227 for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ ) 184 228 { 185 if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) ) 229 if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) ) 186 230 { 187 231 pcSlice->setNoBackPredFlag( false ); … … 199 243 pcSlice->generateCombinedList(); 200 244 #endif 201 245 202 246 /////////////////////////////////////////////////////////////////////////////////////////////////// Compress a slice 203 247 // Slice compression … … 237 281 m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx++] = uiNextCUAddr; 238 282 283 #if DEPTH_MAP_GENERATION 239 284 // init view component and predict virtual depth map 240 285 m_pcDepthMapGenerator->initViewComponent( pcPic ); 241 286 m_pcDepthMapGenerator->predictDepthMap ( pcPic ); 287 #if HHI_INTER_VIEW_MOTION_PRED 242 288 m_pcDepthMapGenerator->covertOrgDepthMap( pcPic ); 289 #endif 290 #if HHI_INTER_VIEW_RESIDUAL_PRED 243 291 m_pcResidualGenerator->initViewComponent( pcPic ); 292 #endif 293 #endif 244 294 245 295 while(uiNextCUAddr<pcPic->getPicSym()->getNumberOfCUsInFrame()) // determine slice boundaries … … 262 312 m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx++] = uiStartCUAddrSlice; 263 313 } 264 314 265 315 if (uiStartCUAddrSlice < pcPic->getPicSym()->getNumberOfCUsInFrame()) 266 316 { 267 pcPic->allocateNewSlice(); 317 pcPic->allocateNewSlice(); 268 318 pcPic->setCurrSliceIdx ( uiStartCUAddrSliceIdx-1 ); 269 319 m_pcSliceEncoder->setSliceIdx ( uiStartCUAddrSliceIdx-1 ); … … 286 336 uiStartCUAddrSlice = pcSlice->getSliceCurEndCUAddr(); 287 337 uiStartCUAddrEntropySlice = pcSlice->getEntropySliceCurEndCUAddr(); 288 } 338 } 289 339 290 340 uiNextCUAddr = (uiStartCUAddrSlice > uiStartCUAddrEntropySlice) ? uiStartCUAddrSlice : uiStartCUAddrEntropySlice; … … 292 342 m_uiStoredStartCUAddrForEncodingSlice[uiStartCUAddrSliceIdx++] = pcSlice->getSliceCurEndCUAddr(); 293 343 m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx++] = pcSlice->getSliceCurEndCUAddr(); 294 344 295 345 pcSlice = pcPic->getSlice(0); 296 346 #if MTK_SAO // PRE_DF … … 298 348 #endif 299 349 350 #if HHI_INTER_VIEW_RESIDUAL_PRED 300 351 // set residual picture 301 352 m_pcResidualGenerator->setRecResidualPic( pcPic ); 302 353 #endif 354 #if DEPTH_MAP_GENERATION 303 355 // update virtual depth map 304 356 m_pcDepthMapGenerator->updateDepthMap( pcPic ); 357 #endif 305 358 306 359 //-- Loop filter … … 329 382 for(UInt i=0; i< uiNumSlices ; i++) 330 383 { 331 (*m_pcAdaptiveLoopFilter)[i].create(pcPic, i, 332 m_uiStoredStartCUAddrForEncodingSlice[i], 384 (*m_pcAdaptiveLoopFilter)[i].create(pcPic, i, 385 m_uiStoredStartCUAddrForEncodingSlice[i], 333 386 m_uiStoredStartCUAddrForEncodingSlice[i+1]-1 334 387 ); … … 359 412 // generate start code 360 413 bs_SPS_PPS_SEI.write( 1, 32); 361 414 362 415 m_pcEntropyCoder->encodePPS( pcSlice->getPPS() ); 363 416 bs_SPS_PPS_SEI.write( 1, 1 ); … … 367 420 rbSeqFirst = false; 368 421 } 369 422 370 423 /* use the main bitstream buffer for storing the marshalled picture */ 371 424 m_pcEntropyCoder->setBitstream(pcBitstreamOut); 372 425 373 426 uiStartCUAddrSliceIdx = 0; 374 uiStartCUAddrSlice = 0; 427 uiStartCUAddrSlice = 0; 375 428 pcBitstreamOut->allocateMemoryForSliceLocations( pcPic->getPicSym()->getNumberOfCUsInFrame() ); // Assuming number of slices <= number of LCU. Needs to be changed for sub-LCU slice coding. 376 429 pcBitstreamOut->setSliceCount( 0 ); // intialize number of slices to zero, used while converting RBSP to NALU 377 430 378 431 uiStartCUAddrEntropySliceIdx = 0; 379 uiStartCUAddrEntropySlice = 0; 432 uiStartCUAddrEntropySlice = 0; 380 433 uiNextCUAddr = 0; 381 434 pcSlice = pcPic->getSlice(uiStartCUAddrSliceIdx); … … 401 454 uiStartCUAddrSliceIdx++; 402 455 uiStartCUAddrEntropySliceIdx++; 403 } 456 } 404 457 else if (uiNextCUAddr == m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx]) 405 458 { … … 422 475 423 476 // write SliceHeader 424 #if SB_DEBUG425 g_bEncoding = true ;426 #endif427 477 m_pcEntropyCoder->encodeSliceHeader ( pcSlice ); 428 #if SB_DEBUG 429 g_bEncoding = false ; 430 #endif 431 478 432 479 // is it needed? 433 480 if ( pcSlice->getSymbolMode() ) … … 437 484 m_pcEntropyCoder->resetEntropy (); 438 485 } 439 486 440 487 if (uiNextCUAddr==0) // Compute ALF params and write only for first slice header 441 488 { … … 452 499 #endif 453 500 m_pcAdaptiveLoopFilter->allocALFParam(&cAlfParam); 454 501 455 502 // set entropy coder for RD 456 503 if ( pcSlice->getSymbolMode() ) … … 464 511 m_pcEntropyCoder->resetEntropy (); 465 512 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 466 513 467 514 m_pcAdaptiveLoopFilter->startALFEnc(pcPic, m_pcEntropyCoder ); 468 515 #if MTK_SAO // PostDF … … 478 525 #endif 479 526 UInt uiMaxAlfCtrlDepth; 480 527 481 528 UInt64 uiDist, uiBits; 482 529 #if MTK_SAO … … 489 536 #endif 490 537 m_pcAdaptiveLoopFilter->endALFEnc(); 491 538 492 539 // set entropy coder for writing 493 540 m_pcSbacCoder->init( (TEncBinIf*)m_pcBinCABAC ); 494 #if SB_DEBUG495 g_bEncoding = true;496 #endif497 541 if ( pcSlice->getSymbolMode() ) 498 542 { … … 527 571 #endif 528 572 m_pcEntropyCoder->encodeAlfParam(&cAlfParam); 529 573 530 574 #if TSB_ALF_HEADER 531 575 if(cAlfParam.cu_control_flag) … … 534 578 } 535 579 #endif 536 g_bEncoding = false;537 580 m_pcAdaptiveLoopFilter->freeALFParam(&cAlfParam); 538 581 } 539 582 } 540 583 541 584 // File writing 542 #if SB_DEBUG543 g_bEncoding = true ;544 #endif545 585 m_pcSliceEncoder->encodeSlice( pcPic, pcBitstreamOut ); 546 #if SB_DEBUG 547 g_bEncoding = false ; 548 #endif 549 586 550 587 // End of bitstream & byte align 551 588 pcBitstreamOut->write( 1, 1 ); 552 589 pcBitstreamOut->writeAlignZero(); 553 590 554 591 UInt uiBoundingAddrSlice, uiBoundingAddrEntropySlice; 555 uiBoundingAddrSlice = m_uiStoredStartCUAddrForEncodingSlice[uiStartCUAddrSliceIdx]; 556 uiBoundingAddrEntropySlice = m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx]; 592 uiBoundingAddrSlice = m_uiStoredStartCUAddrForEncodingSlice[uiStartCUAddrSliceIdx]; 593 uiBoundingAddrEntropySlice = m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx]; 557 594 uiNextCUAddr = min(uiBoundingAddrSlice, uiBoundingAddrEntropySlice); 558 595 if (uiNextCUAddr < pcPic->getPicSym()->getNumberOfCUsInFrame()) // if more slices to be encoded insert start code … … 564 601 } 565 602 } // end iteration over slices 566 567 603 604 568 605 #if MTK_NONCROSS_INLOOP_FILTER 569 606 if(pcSlice->getSPS()->getUseALF()) … … 572 609 m_pcAdaptiveLoopFilter->destroySlice(); 573 610 } 574 #endif 575 576 611 #endif 612 613 577 614 pcBitstreamOut->flushBuffer(); 578 615 pcBitstreamOut->convertRBSPToPayload(0); 579 616 580 617 /*#if AMVP_BUFFERCOMPRESS 581 618 pcPic->compressMotion(); // moved to end of access unit 582 619 #endif */ 583 620 pcBitstreamOut->freeMemoryAllocatedForSliceLocations(); 584 621 585 622 //-- For time output for each slice 586 623 Double dEncTime = (double)(clock()-iBeforeTime) / CLOCKS_PER_SEC; 587 624 588 625 xCalculateAddPSNR( pcPic, pcPic->getPicYuvRec(), pcBitstreamOut->getNumberOfWrittenBits(), dEncTime ); 589 590 #if GERHARD_RM_DEBUG_MM591 if (m_pcRdCost->getUseRenModel() )592 {593 TRenModel* pcMMCheckModel = m_pcEncTop->getEncTop()->getMMCheckModel();594 TRenModel* pcRenModel = m_pcEncTop->getEncTop()->getRenModel ();595 TComPicYuv* pcPicYuvRec = pcPic->getPicYuvRec();596 pcMMCheckModel->setData(0,0, pcPicYuvRec->getWidth(), pcPicYuvRec->getHeight(), pcPicYuvRec->getStride(), pcPicYuvRec->getLumaAddr());597 Bool bEqual = pcRenModel->compare( pcMMCheckModel );598 599 if ( !bEqual )600 {601 std::cout << "Mismatch in Renderer Model !" << std::endl;602 }603 }604 #endif605 626 606 627 #if FIXED_ROUNDING_FRAME_MEMORY … … 643 664 pcBitstreamOut->insertAt(bs_SPS_PPS_SEI, 0); 644 665 645 #if SB_MEM_FIX646 666 bs_SPS_PPS_SEI.destroy(); 647 #endif648 667 pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut); 649 668 650 669 pcPic->setReconMark ( true ); 651 670 652 671 } 653 672 … … 656 675 TComSlice* pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx()); 657 676 Bool bCalcDist = false; 658 677 659 678 m_pcLoopFilter->setCfg(pcSlice->getLoopFilterDisable(), m_pcCfg->getLoopFilterAlphaC0Offget(), m_pcCfg->getLoopFilterBetaOffget()); 660 679 m_pcLoopFilter->loopFilterPic( pcPic ); 661 680 662 681 m_pcEntropyCoder->setEntropyCoder ( m_pcEncTop->getRDGoOnSbacCoder(), pcSlice ); 663 682 m_pcEntropyCoder->resetEntropy (); 664 683 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 665 684 666 685 // Adaptive Loop filter 667 686 if( pcSlice->getSPS()->getUseALF() ) … … 672 691 #endif 673 692 m_pcAdaptiveLoopFilter->allocALFParam(&cAlfParam); 674 693 675 694 m_pcAdaptiveLoopFilter->startALFEnc(pcPic, m_pcEntropyCoder); 676 695 677 696 UInt uiMaxAlfCtrlDepth; 678 697 m_pcAdaptiveLoopFilter->ALFProcess(&cAlfParam, pcSlice->getLambda(), ruiDist, ruiBits, uiMaxAlfCtrlDepth ); … … 680 699 m_pcAdaptiveLoopFilter->freeALFParam(&cAlfParam); 681 700 } 682 701 683 702 m_pcEntropyCoder->resetEntropy (); 684 703 ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits(); 685 704 686 705 if (!bCalcDist) 687 706 ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec()); … … 704 723 #endif 705 724 Int iTemp; 706 725 707 726 Int iStride = pcPic0->getStride(); 708 727 Int iWidth = pcPic0->getWidth(); 709 728 Int iHeight = pcPic0->getHeight(); 710 729 711 730 UInt64 uiTotalDiff = 0; 712 731 713 732 for( y = 0; y < iHeight; y++ ) 714 733 { … … 724 743 pSrc1 += iStride; 725 744 } 726 745 727 746 iHeight >>= 1; 728 747 iWidth >>= 1; 729 748 iStride >>= 1; 730 749 731 750 pSrc0 = pcPic0->getCbAddr(); 732 751 pSrc1 = pcPic1->getCbAddr(); 733 752 734 753 for( y = 0; y < iHeight; y++ ) 735 754 { … … 745 764 pSrc1 += iStride; 746 765 } 747 766 748 767 pSrc0 = pcPic0->getCrAddr(); 749 768 pSrc1 = pcPic1->getCrAddr(); 750 769 751 770 for( y = 0; y < iHeight; y++ ) 752 771 { … … 762 781 pSrc1 += iStride; 763 782 } 764 783 765 784 return uiTotalDiff; 766 785 } … … 772 791 UInt64 uiSSDU = 0; 773 792 UInt64 uiSSDV = 0; 774 793 775 794 Double dYPSNR = 0.0; 776 795 Double dUPSNR = 0.0; 777 796 Double dVPSNR = 0.0; 778 797 779 798 //===== calculate PSNR ===== 780 799 Pel* pOrg = pcPic ->getPicYuvOrg()->getLumaAddr(); 781 800 Pel* pRec = pcPicD->getLumaAddr(); 782 801 Int iStride = pcPicD->getStride(); 783 802 784 803 Int iWidth; 785 804 Int iHeight; 786 805 787 806 iWidth = pcPicD->getWidth () - m_pcEncTop->getPad(0); 788 807 iHeight = pcPicD->getHeight() - m_pcEncTop->getPad(1); 789 808 790 809 Int iSize = iWidth*iHeight; 791 810 792 811 UInt maxval = 255 * (1<<(g_uiBitDepth + g_uiBitIncrement -8)); 793 812 Double fRefValueY = (double) maxval * maxval * iSize; … … 804 823 pRec += iStride; 805 824 } 806 807 825 826 #if HHI_VSO 808 827 if ( m_pcRdCost->getUseRenModel() ) 809 828 { 810 TRenModel* pcRenModel = m_pcEncTop->getEncTop()->getRenModel(); 811 Int64 iDistVSOY, iDistVSOU, iDistVSOV; 812 pcRenModel->getTotalSSE( iDistVSOY, iDistVSOU, iDistVSOV ); 829 TRenModel* pcRenModel = m_pcEncTop->getEncTop()->getRenModel(); 830 Int64 iDistVSOY, iDistVSOU, iDistVSOV; 831 pcRenModel->getTotalSSE( iDistVSOY, iDistVSOU, iDistVSOV ); 813 832 dYPSNR = ( iDistVSOY ? 10.0 * log10( fRefValueY / (Double) iDistVSOY ) : 99.99 ); 814 833 dUPSNR = ( iDistVSOU ? 10.0 * log10( fRefValueC / (Double) iDistVSOU ) : 99.99 ); … … 816 835 } 817 836 else 818 { 837 #endif 838 { 819 839 iHeight >>= 1; 820 840 iWidth >>= 1; … … 822 842 pOrg = pcPic ->getPicYuvOrg()->getCbAddr(); 823 843 pRec = pcPicD->getCbAddr(); 824 844 825 845 for( y = 0; y < iHeight; y++ ) 826 846 { … … 833 853 pRec += iStride; 834 854 } 835 855 836 856 pOrg = pcPic ->getPicYuvOrg()->getCrAddr(); 837 857 pRec = pcPicD->getCrAddr(); 838 858 839 859 for( y = 0; y < iHeight; y++ ) 840 860 { … … 851 871 dVPSNR = ( uiSSDV ? 10.0 * log10( fRefValueC / (Double)uiSSDV ) : 99.99 ); 852 872 } 853 854 873 // fix: total bits should consider slice size bits (32bit) 855 874 uibits += 32; 856 875 857 876 #if RVM_VCEGAM10 858 877 m_vRVM_RP.push_back( uibits ); … … 906 925 printf( "[Y %6.4lf dB U %6.4lf dB V %6.4lf dB] ", dYPSNR, dUPSNR, dVPSNR ); 907 926 printf ("[ET %5.0f ] ", dEncTime ); 908 927 909 928 for (Int iRefList = 0; iRefList < 2; iRefList++) 910 929 { … … 972 991 { 973 992 Double dRVM = 0; 974 993 975 994 //if( m_pcCfg->getGOPSize() == 1 && m_pcCfg->getIntraPeriod() != 1 && m_pcCfg->getFrameToBeEncoded() > RVM_VCEGAM10_M * 2 ) 976 995 { … … 980 999 vRL.resize( N ); 981 1000 vB.resize( N ); 982 1001 983 1002 Int i; 984 1003 Double dRavg = 0 , dBavg = 0; … … 994 1013 dBavg += vB[i]; 995 1014 } 996 1015 997 1016 dRavg /= ( N - 2 * RVM_VCEGAM10_M ); 998 1017 dBavg /= ( N - 2 * RVM_VCEGAM10_M ); 999 1018 1000 1019 double dSigamB = 0; 1001 1020 for( i = RVM_VCEGAM10_M + 1 ; i < N - RVM_VCEGAM10_M + 1 ; i++ ) … … 1005 1024 } 1006 1025 dSigamB = sqrt( dSigamB / ( N - 2 * RVM_VCEGAM10_M ) ); 1007 1026 1008 1027 double f = sqrt( 12.0 * ( RVM_VCEGAM10_M - 1 ) / ( RVM_VCEGAM10_M + 1 ) ); 1009 1028 1010 1029 dRVM = dSigamB / dRavg * f; 1011 1030 } 1012 1031 1013 1032 return( dRVM ); 1014 1033 } -
trunk/source/Lib/TLibEncoder/TEncGOP.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 57 90 TEncBinCABAC* m_pcBinCABAC; 58 91 TComLoopFilter* m_pcLoopFilter; 92 #if DEPTH_MAP_GENERATION 59 93 TComDepthMapGenerator* m_pcDepthMapGenerator; 94 #endif 95 #if HHI_INTER_VIEW_RESIDUAL_PRED 60 96 TComResidualGenerator* m_pcResidualGenerator; 97 #endif 61 98 62 99 // Adaptive Loop filter -
trunk/source/Lib/TLibEncoder/TEncSbac.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 26 59 , m_uiMaxAlfCtrlDepth ( 0 ) 27 60 , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX ) 28 #if MW_MVI_SIGNALLING_MODE == 029 , m_cCUMvInheritanceFlagSCModel(1, 1, NUM_MVI_FLAG_CTX )30 #endif31 61 , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX ) 32 62 , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX ) … … 72 102 #endif 73 103 , m_cViewIdxSCModel ( 1, 1, NUM_VIEW_IDX_CTX ) 74 #if HHI_DMM_ INTRA104 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 75 105 , m_cIntraDMMSCModel ( 1, 1, NUM_DMM_CTX ) 76 106 , m_cIntraWedgeSCModel ( 1, 1, NUM_WEDGE_CTX ) … … 94 124 95 125 m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_SPLIT_FLAG ); 96 #if MW_MVI_SIGNALLING_MODE == 097 m_cCUMvInheritanceFlagSCModel.initBuffer( eSliceType, iQp, (Short*)INIT_MVI_FLAG );98 #endif99 126 100 127 m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_SKIP_FLAG ); … … 137 164 #endif 138 165 m_cViewIdxSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_VIEW_IDX ); 139 #if HHI_DMM_ INTRA166 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 140 167 m_cIntraDMMSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_INTRA_DMM ); 141 168 m_cIntraWedgeSCModel.initBuffer ( eSliceType, iQp, (Short*)INIT_INTRA_WEDGELET ); … … 307 334 return; 308 335 } 309 #if HHI_DMM_ INTRA336 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 310 337 Void TEncSbac::xWriteExGolombLevel( UInt uiSymbol, ContextModel& rcSCModel ) 311 338 { … … 388 415 389 416 this->m_cCUSplitFlagSCModel .copyFrom( &pSrc->m_cCUSplitFlagSCModel ); 390 #if MW_MVI_SIGNALLING_MODE == 0391 this->m_cCUMvInheritanceFlagSCModel.copyFrom( &pSrc->m_cCUMvInheritanceFlagSCModel );392 #endif393 417 this->m_cCUSkipFlagSCModel .copyFrom( &pSrc->m_cCUSkipFlagSCModel ); 394 418 this->m_cCUMergeFlagExtSCModel .copyFrom( &pSrc->m_cCUMergeFlagExtSCModel); … … 421 445 this->m_cMVPIdxSCModel .copyFrom( &pSrc->m_cMVPIdxSCModel ); 422 446 this->m_cViewIdxSCModel .copyFrom( &pSrc->m_cViewIdxSCModel ); 423 #if HHI_DMM_ INTRA447 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 424 448 this->m_cIntraDMMSCModel .copyFrom( &pSrc->m_cIntraDMMSCModel ); 425 449 this->m_cIntraWedgeSCModel .copyFrom( &pSrc->m_cIntraWedgeSCModel ); … … 636 660 637 661 662 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 638 663 Void TEncSbac::codeMergeIndexMV( TComDataCU* pcCU, UInt uiAbsPartIdx ) 639 664 { … … 641 666 Bool abAvailable[ MRG_MAX_NUM_CANDS ]; 642 667 UInt uiNumCand = 0; 643 #if MW_MVI_SIGNALLING_MODE == 1668 #if HHI_MPI 644 669 const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE; 645 const UInt uiMviMergePos = bMVIAvailable ? MVI_MERGE_POS : MRG_MAX_NUM_CANDS;670 const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : MRG_MAX_NUM_CANDS; 646 671 #endif 647 672 for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ ) 648 673 { 649 #if MW_MVI_SIGNALLING_MODE == 1674 #if HHI_MPI 650 675 if( uiIdx == uiMviMergePos ) 651 676 { … … 693 718 //--- determine unary index --- 694 719 UInt uiMergeIdx = pcCU->getMergeIndex( uiAbsPartIdx ); 695 #if MW_MVI_SIGNALLING_MODE == 1720 #if HHI_MPI 696 721 if( bMVIAvailable ) 697 722 { … … 699 724 if( bUseMVI ) 700 725 { 701 uiMergeIdx = MVI_MERGE_POS;702 } 703 else if( uiMergeIdx >= MVI_MERGE_POS )726 uiMergeIdx = HHI_MPI_MERGE_POS; 727 } 728 else if( uiMergeIdx >= HHI_MPI_MERGE_POS ) 704 729 { 705 730 uiMergeIdx++; … … 748 773 DTRACE_CABAC_T( "\n" ); 749 774 } 750 775 #endif 751 776 752 777 … … 758 783 Void TEncSbac::codeMergeIndex( TComDataCU* pcCU, UInt uiAbsPartIdx ) 759 784 { 760 #if MW_MVI_SIGNALLING_MODE == 1 785 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 786 #if HHI_INTER_VIEW_MOTION_PRED && HHI_MPI 761 787 if( ( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) || 762 788 ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ) 789 #elif HHI_MPI 790 if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) 763 791 #else 764 792 if( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) … … 768 796 return; 769 797 } 798 #endif 770 799 771 800 Bool bLeftInvolved = false; … … 884 913 885 914 915 #if HHI_INTER_VIEW_RESIDUAL_PRED 886 916 Void 887 917 TEncSbac::codeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) … … 891 921 m_pcBinIf->encodeBin( uiSymbol, m_cResPredFlagSCModel.get( 0, 0, uiCtx ) ); 892 922 } 923 #endif 893 924 894 925 … … 907 938 return; 908 939 } 909 910 #if MW_MVI_SIGNALLING_MODE == 0911 Void TEncSbac::codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )912 {913 const Int iTextureModeDepth = pcCU->getTextureModeDepth( uiAbsPartIdx );914 if( iTextureModeDepth != -1 && uiDepth > iTextureModeDepth )915 return;916 917 UInt uiCtx = pcCU->getCtxMvInheritanceFlag( uiAbsPartIdx, uiDepth );918 UInt uiSymbol = iTextureModeDepth == uiDepth ? 1 : 0;919 920 assert( uiCtx < 3 );921 m_pcBinIf->encodeBin( uiSymbol, m_cCUMvInheritanceFlagSCModel.get( 0, 0, uiCtx ) );922 }923 #endif924 940 925 941 Void TEncSbac::codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx ) … … 935 951 } 936 952 937 #if HHI_DMM_ INTRA953 #if HHI_DMM_WEDGE_INTRA 938 954 Void TEncSbac::xCodeWedgeFullInfo( TComDataCU* pcCU, UInt uiAbsPartIdx ) 939 955 { … … 1031 1047 } 1032 1048 } 1033 1049 #endif 1050 #if HHI_DMM_PRED_TEX 1034 1051 Void TEncSbac::xCodeWedgePredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx ) 1035 1052 { … … 1076 1093 UInt uiDir = pcCU->getLumaIntraDir( uiAbsPartIdx ); 1077 1094 1078 #if HHI_DMM_ INTRA1079 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseD epthModelModes() && pcCU->getWidth( uiAbsPartIdx ) < 64 )1095 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1096 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseDMM() && pcCU->getWidth( uiAbsPartIdx ) < 64 ) 1080 1097 { 1081 1098 m_pcBinIf->encodeBin( uiDir > MAX_MODE_ID_INTRA_DIR, m_cIntraDMMSCModel.get(0, 0, 0) ); … … 1086 1103 UInt uiDMMode = uiDir - (MAX_MODE_ID_INTRA_DIR+1); 1087 1104 1088 if( !pcCU->getTextureModeAllowance( uiAbsPartIdx ) ) 1089 { 1105 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX 1106 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) ); 1107 m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) ); 1108 1090 1109 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 ) 1091 1110 { 1092 if( uiDMMode > 1 ) 1093 { 1094 uiDMMode -= 4; 1111 m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) ); 1095 1112 } 1113 #else 1096 1114 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) ); 1097 if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );1098 }1099 else1100 {1101 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) );1102 }1103 }1104 else1105 {1106 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) );1107 if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );1108 1115 1109 1116 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 ) 1110 1117 { 1111 if( DMM_INTRA_MODE_BITS > 2 ) m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) );1112 } 1113 } 1114 1118 m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) ); 1119 } 1120 #endif 1121 #if HHI_DMM_WEDGE_INTRA 1115 1122 if( uiDir == DMM_WEDGE_FULL_IDX ) { xCodeWedgeFullInfo ( pcCU, uiAbsPartIdx ); } 1116 1123 if( uiDir == DMM_WEDGE_FULL_D_IDX ) { xCodeWedgeFullDeltaInfo ( pcCU, uiAbsPartIdx ); } 1117 1124 if( uiDir == DMM_WEDGE_PREDDIR_IDX ) { xCodeWedgePredDirInfo ( pcCU, uiAbsPartIdx ); } 1118 1125 if( uiDir == DMM_WEDGE_PREDDIR_D_IDX ) { xCodeWedgePredDirDeltaInfo ( pcCU, uiAbsPartIdx ); } 1126 #endif 1127 #if HHI_DMM_PRED_TEX 1119 1128 if( uiDir == DMM_WEDGE_PREDTEX_D_IDX ) { xCodeWedgePredTexDeltaInfo ( pcCU, uiAbsPartIdx ); } 1120 1129 if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX ) { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); } 1130 #endif 1121 1131 } 1122 1132 else … … 1204 1214 { 1205 1215 UInt uiDir = pcCU->getLumaIntraDir( uiAbsPartIdx ); 1206 #if HHI_DMM_ INTRA1207 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseD epthModelModes() && pcCU->getWidth( uiAbsPartIdx ) < 64 )1216 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1217 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseDMM() && pcCU->getWidth( uiAbsPartIdx ) < 64 ) 1208 1218 { 1209 1219 m_pcBinIf->encodeBin( uiDir > MAX_MODE_ID_INTRA_DIR, m_cIntraDMMSCModel.get(0, 0, 0) ); … … 1214 1224 UInt uiDMMode = uiDir - (MAX_MODE_ID_INTRA_DIR+1); 1215 1225 1216 if( !pcCU->getTextureModeAllowance( uiAbsPartIdx ) ) 1217 { 1226 #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX 1227 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) ); 1228 m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) ); 1229 1218 1230 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 ) 1219 1231 { 1220 if( uiDMMode > 1 ) 1221 { 1222 uiDMMode -= 4; 1232 m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) ); 1223 1233 } 1234 #else 1224 1235 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) ); 1225 if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );1226 }1227 else1228 {1229 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) );1230 }1231 }1232 else1233 {1234 m_pcBinIf->encodeBin( (uiDMMode & 0x01), m_cIntraDMMSCModel.get(0, 0, 1) );1235 if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );1236 1236 1237 1237 if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 ) 1238 1238 { 1239 if( DMM_INTRA_MODE_BITS > 2 ) m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) );1240 } 1241 } 1242 1239 m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) ); 1240 } 1241 #endif 1242 #if HHI_DMM_WEDGE_INTRA 1243 1243 if( uiDir == DMM_WEDGE_FULL_IDX ) { xCodeWedgeFullInfo ( pcCU, uiAbsPartIdx ); } 1244 1244 if( uiDir == DMM_WEDGE_FULL_D_IDX ) { xCodeWedgeFullDeltaInfo ( pcCU, uiAbsPartIdx ); } 1245 1245 if( uiDir == DMM_WEDGE_PREDDIR_IDX ) { xCodeWedgePredDirInfo ( pcCU, uiAbsPartIdx ); } 1246 1246 if( uiDir == DMM_WEDGE_PREDDIR_D_IDX ) { xCodeWedgePredDirDeltaInfo ( pcCU, uiAbsPartIdx ); } 1247 #endif 1248 #if HHI_DMM_PRED_TEX 1247 1249 if( uiDir == DMM_WEDGE_PREDTEX_D_IDX ) { xCodeWedgePredTexDeltaInfo ( pcCU, uiAbsPartIdx ); } 1248 1250 if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX ) { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); } 1251 #endif 1249 1252 } 1250 1253 else -
trunk/source/Lib/TLibEncoder/TEncSbac.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 85 118 #if E253 86 119 Void xWriteGoRiceExGolomb ( UInt uiSymbol, UInt &ruiGoRiceParam ); 87 #if HHI_DMM_ INTRA120 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 88 121 Void xWriteExGolombLevel ( UInt uiSymbol, ContextModel& rcSCModel ); 89 122 #endif … … 103 136 Void xCopyFrom ( TEncSbac* pSrc ); 104 137 105 #if HHI_DMM_ INTRA138 #if HHI_DMM_WEDGE_INTRA 106 139 Void xCodeWedgeFullInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 107 140 Void xCodeWedgeFullDeltaInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 141 108 142 Void xCodeWedgePredDirInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 109 143 Void xCodeWedgePredDirDeltaInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 144 #endif 145 #if HHI_DMM_PRED_TEX 110 146 Void xCodeWedgePredTexDeltaInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 111 147 Void xCodeContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx ); … … 130 166 Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 131 167 Void codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 168 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI 132 169 Void codeMergeIndexMV ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 170 #endif 171 #if HHI_INTER_VIEW_RESIDUAL_PRED 133 172 Void codeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 173 #endif 134 174 Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); 135 #if MW_MVI_SIGNALLING_MODE == 0136 Void codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );137 #endif138 175 Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ); 139 176 … … 182 219 UInt m_uiLastQp; 183 220 ContextModel3DBuffer m_cCUSplitFlagSCModel; 184 #if MW_MVI_SIGNALLING_MODE == 0185 ContextModel3DBuffer m_cCUMvInheritanceFlagSCModel;186 #endif187 221 ContextModel3DBuffer m_cCUSkipFlagSCModel; 188 222 ContextModel3DBuffer m_cCUMergeFlagExtSCModel; … … 227 261 #endif 228 262 ContextModel3DBuffer m_cViewIdxSCModel; 229 #if HHI_DMM_ INTRA263 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 230 264 ContextModel3DBuffer m_cIntraDMMSCModel; 231 265 ContextModel3DBuffer m_cIntraWedgeSCModel; -
trunk/source/Lib/TLibEncoder/TEncSearch.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 /** \file TEncSearch.cpp … … 911 944 Bool bLuma, 912 945 Bool bChroma, 913 Bool bRealCoeff /* just for test */ ) 946 Bool bRealCoeff /* just for test */ 947 ) 914 948 { 915 949 m_pcEntropyCoder->resetBits(); 916 950 xEncIntraHeader ( pcCU, uiTrDepth, uiAbsPartIdx, bLuma, bChroma ); 917 951 xEncSubdivCbfQT ( pcCU, uiTrDepth, uiAbsPartIdx, bLuma, bChroma ); 918 952 919 953 if( bLuma ) 920 954 { … … 940 974 TComYuv* pcResiYuv, 941 975 Dist& ruiDist 942 #if DMM_RES_CHECK_INTRA943 ,944 Bool bCheckNoRes945 #endif946 976 ) 947 977 { … … 973 1003 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 974 1004 975 #if HHI_DMM_ INTRA1005 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 976 1006 if( uiLumaPredMode > MAX_MODE_ID_INTRA_DIR ) 977 1007 { … … 984 1014 predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); 985 1015 } 986 987 #if DMM_RES_CHECK_INTRA988 if ( bCheckNoRes )989 {990 //prediction signal is already filled in this case991 //===== update distortion =====992 //GT VSO993 if ( m_pcRdCost->getUseVSO() )994 {995 ruiDist += m_pcRdCost->getDistVS ( pcCU, uiAbsPartIdx, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );996 997 #if GERHARD_VQM_XCHECK998 UInt uiDist1 = m_pcRdCost->getDistVS ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );999 UInt uiDist2 = m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );1000 assert(uiDist1 == uiDist2);1001 #endif1002 }1003 else1004 {1005 ruiDist += m_pcRdCost->getDistPart( piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight );1006 }1007 //GT VSO end1008 1009 pcCU->setCbfSubParts( 0, TEXT_LUMA, uiAbsPartIdx, uiFullDepth );1010 return;1011 }1012 #endif1013 1016 1014 1017 //===== get residual signal ===== … … 1088 1091 1089 1092 //===== update distortion ===== 1090 //GTVSO1093 #if HHI_VSO 1091 1094 if ( m_pcRdCost->getUseVSO() ) 1092 1095 { 1093 1096 ruiDist += m_pcRdCost->getDistVS ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 ); 1094 1095 #if GERHARD_VQM_XCHECK1096 UInt uiDist1 = m_pcRdCost->getDistVS ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );1097 UInt uiDist2 = m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );1098 assert(uiDist1 == uiDist2);1099 #endif1100 1097 } 1101 1098 else 1099 #endif 1102 1100 { 1103 1101 ruiDist += m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight ); 1104 1102 } 1105 //GT VSO end1106 1103 } 1107 1108 #if DMM_RES_CHECK_INTRA1109 Void1110 TEncSearch::xSetIntraNoResi( TComDataCU* pcCU,1111 UInt uiTrDepth,1112 UInt uiAbsPartIdx,1113 TComYuv* pcPredYuv,1114 TComYuv* pcResiYuv,1115 Bool bNoRes1116 )1117 {1118 UInt uiFullDepth = pcCU ->getDepth ( 0 ) + uiTrDepth;1119 UInt uiWidth = pcCU ->getWidth ( 0 ) >> uiTrDepth;1120 UInt uiHeight = pcCU ->getHeight ( 0 ) >> uiTrDepth;1121 UInt uiStride = pcPredYuv->getStride ();1122 Pel* piPred = pcPredYuv->getLumaAddr( uiAbsPartIdx );1123 Pel* piResi = pcResiYuv->getLumaAddr( uiAbsPartIdx );1124 Pel* piReco = pcPredYuv->getLumaAddr( uiAbsPartIdx );1125 1126 UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2;1127 UInt uiQTLayer = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;1128 UInt uiNumCoeffPerInc = pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 );1129 TCoeff* pcCoeff = m_ppcQTTempCoeffY[ uiQTLayer ] + uiNumCoeffPerInc * uiAbsPartIdx;1130 Pel* piRecQt = m_pcQTTempTComYuv[ uiQTLayer ].getLumaAddr( uiAbsPartIdx );1131 UInt uiRecQtStride = m_pcQTTempTComYuv[ uiQTLayer ].getStride ();1132 1133 UInt uiZOrder = pcCU->getZorderIdxInCU() + uiAbsPartIdx;1134 Pel* piRecIPred = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );1135 UInt uiRecIPredStride = pcCU->getPic()->getPicYuvRec()->getStride ();1136 1137 if ( bNoRes )1138 {1139 pcCU->setCbfSubParts( 0, TEXT_LUMA, uiAbsPartIdx, uiFullDepth );1140 1141 Pel* pResi = piResi;1142 memset( pcCoeff, 0, sizeof( TCoeff ) * uiWidth * uiHeight );1143 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1144 {1145 memset( pResi, 0, sizeof( Pel ) * uiWidth );1146 pResi += uiStride;1147 }1148 }1149 else1150 {1151 pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiFullDepth );1152 }1153 1154 //===== reconstruction =====1155 {1156 Pel* pPred = piPred;1157 Pel* pResi = piResi;1158 Pel* pReco = piReco;1159 Pel* pRecQt = piRecQt;1160 Pel* pRecIPred = piRecIPred;1161 for( UInt uiY = 0; uiY < uiHeight; uiY++ )1162 {1163 for( UInt uiX = 0; uiX < uiWidth; uiX++ )1164 {1165 pReco [ uiX ] = Clip( pPred[ uiX ] + pResi[uiX] );1166 pRecQt [ uiX ] = pReco[ uiX ];1167 pRecIPred[ uiX ] = pReco[ uiX ];1168 }1169 pPred += uiStride;1170 pResi += uiStride;1171 pReco += uiStride;1172 pRecQt += uiRecQtStride;1173 pRecIPred += uiRecIPredStride;1174 }1175 }1176 }1177 #endif1178 1104 1179 1105 Void … … 1362 1288 } 1363 1289 #endif 1364 #if HHI_DMM_ INTRA1290 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1365 1291 if( pcCU->getLumaIntraDir( uiAbsPartIdx ) > MAX_MODE_ID_INTRA_DIR ) 1366 1292 { … … 1378 1304 { 1379 1305 //----- store original entropy coding status ----- 1380 #if DMM_RES_CHECK_INTRA 1381 if( m_bUseSBACRD && ( bCheckSplit || pcCU->getSlice()->getSPS()->isDepth() ) ) 1306 if( m_bUseSBACRD && bCheckSplit ) 1382 1307 { 1383 1308 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] ); 1384 1309 } 1385 #else 1386 if( m_bUseSBACRD && bCheckSplit ) 1387 { 1388 m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] ); 1389 } 1390 #endif 1310 1391 1311 //----- code luma block with given intra prediction mode and store Cbf----- 1392 1312 dSingleCost = 0.0; … … 1409 1329 //----- determine rate and r-d cost ----- 1410 1330 UInt uiSingleBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1411 //GT VSO 1331 1332 #if HHI_VSO 1412 1333 if ( m_pcRdCost->getUseLambdaScaleVSO()) 1413 1334 { … … 1418 1339 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistY + uiSingleDistC ); 1419 1340 } 1420 //GT VSO end 1421 1422 #if DMM_RES_CHECK_INTRA 1423 if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) == 1 && pcCU->getLumaIntraDir( uiAbsPartIdx ) > MAX_MODE_ID_INTRA_DIR ) 1424 { 1425 m_pcRDGoOnSbacCoder->load ( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] ); 1426 1427 Double dSingleCostNoRes = MAX_DOUBLE; 1428 Dist uiSingleDistYNoRes = 0; 1429 //save cbf and coeffs 1430 xIntraCodingLumaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcOrgYuv, pcPredYuv, pcResiYuv, uiSingleDistYNoRes, true ); 1431 1432 //----- determine rate and r-d cost ----- 1433 UInt uiSingleBitsNoRes = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1434 //GT VSO 1435 if ( m_pcRdCost->getUseLambdaScaleVSO()) 1436 { 1437 dSingleCostNoRes = m_pcRdCost->calcRdCostVSO( uiSingleBitsNoRes, uiSingleDistYNoRes + uiSingleDistC ); 1438 } 1439 else 1440 { 1441 dSingleCostNoRes = m_pcRdCost->calcRdCost( uiSingleBitsNoRes, uiSingleDistYNoRes + uiSingleDistC ); 1442 } 1443 //GT VSO end 1444 1445 if ( dSingleCostNoRes < dSingleCost ) 1446 { 1447 xSetIntraNoResi( pcCU, uiTrDepth, uiAbsPartIdx, pcPredYuv, pcResiYuv, true ); 1448 dSingleCost = dSingleCostNoRes; 1449 uiSingleCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ); 1450 1451 } 1452 else 1453 { 1454 xSetIntraNoResi( pcCU, uiTrDepth, uiAbsPartIdx, pcPredYuv, pcResiYuv, false ); 1455 uiSingleCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ); 1456 } 1457 } 1341 #else 1342 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistY + uiSingleDistC ); 1458 1343 #endif 1459 1344 } … … 1520 1405 //----- determine rate and r-d cost ----- 1521 1406 UInt uiSplitBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false ); 1522 //GTVSO1407 #if HHI_VSO 1523 1408 if( m_pcRdCost->getUseLambdaScaleVSO() ) 1524 1409 { … … 1529 1414 dSplitCost = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistY + uiSplitDistC ); 1530 1415 } 1531 //GT VSO end 1416 #else 1417 dSplitCost = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistY + uiSplitDistC ); 1418 #endif 1532 1419 1533 1420 //===== compare and set best ===== … … 1601 1488 } 1602 1489 1490 #if HHI_VSO 1603 1491 if ( m_pcRdCost->getUseRenModel() && bCheckFull ) 1604 1492 { … … 1611 1499 m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight ); 1612 1500 } 1501 #endif 1613 1502 1614 1503 ruiDistY += uiSingleDistY; … … 1858 1747 uiMaxMode += 1; 1859 1748 #endif 1860 #if HHI_DMM_ INTRA1749 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1861 1750 Bool bTestDmm = false; 1862 if ( m_pcEncCfg->isDepthCoder() && m_pcEncCfg->getUseD epthModelModes() )1751 if ( m_pcEncCfg->isDepthCoder() && m_pcEncCfg->getUseDMM() ) 1863 1752 bTestDmm = true; 1864 1753 #endif … … 1900 1789 // use hadamard transform here 1901 1790 Dist uiSad; 1902 //GTVSO1791 #if HHI_VSO 1903 1792 if ( m_pcRdCost->getUseVSO() ) 1904 1793 { 1905 1794 Bool bSad = !m_pcRdCost->getUseRenModel(); 1906 1795 uiSad = m_pcRdCost->getDistVS(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, bSad, 0 ); 1907 #if GERHARD_VQM_XCHECK1908 UInt uiDist1 = m_pcRdCost->getDistVS ( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );1909 UInt uiDist2 = m_pcRdCost->getDistPart( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );1910 assert(uiDist1 == uiDist2);1911 #endif1912 1796 } 1913 1797 else … … 1915 1799 uiSad = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 1916 1800 } 1917 //GT VSO end 1801 #else 1802 uiSad = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 1803 #endif 1918 1804 1919 1805 UInt iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth ); 1920 //GT VSO 1806 1921 1807 Double dLambda; 1922 1808 #if HHI_VSO 1923 1809 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 1924 1810 { 1925 1811 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO(); 1812 //GT: Sad is SSE for VSO4 1926 1813 } 1927 1814 else … … 1929 1816 dLambda = m_pcRdCost->getSqrtLambda(); 1930 1817 } 1931 1932 //GT: Sad is SSE for VSO4 1818 #else 1819 dLambda = m_pcRdCost->getSqrtLambda(); 1820 #endif 1821 1933 1822 Double cost = (Double)uiSad + (Double)iModeBits * dLambda; 1934 //GT VSO end 1823 1935 1824 CandNum += xUpdateCandList( uiMode, cost, uiFastCandNum, CandModeList, CandCostList ); 1936 #if HHI_DMM_ INTRA1825 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1937 1826 if ( bTestDmm ) bTestDmm = uiSad ? true : false; 1938 1827 #endif … … 2004 1893 } 2005 1894 2006 #if HHI_DMM_INTRA 2007 if( m_pcEncCfg->isDepthCoder() && uiWidth >= 4 && uiWidth < 64 && m_pcEncCfg->getUseDepthModelModes() && bTestDmm ) 2008 { 2009 #if DMM_NO_TEXTURE_MODES 2010 pcCU->setTextureModeAllowanceSubParts( false, uiPartOffset, uiDepth + uiInitTrDepth ); 2011 #else 2012 UInt uiPartAddr = 0; 2013 Int iBlockWidth, iBlockHeight; 2014 2015 pcCU->getPartIndexAndSize( uiPU, uiPartAddr, iBlockWidth, iBlockHeight ); 2016 2017 TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getTexturePic()->getPicYuvRec(); 2018 Int iRefStride = pcPicYuvRef->getStride(); 2019 Pel* piRefY = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ); 2020 2021 TComYuv cTempYuv; cTempYuv.create( pcCU->getWidth(0), pcCU->getHeight(0) ); cTempYuv.clear(); 2022 UInt uiTempStride = cTempYuv.getStride(); 2023 Pel* piTempY = cTempYuv.getLumaAddr( uiPU, uiWidth ); 2024 2025 for ( Int y = 0; y < uiHeight; y++ ) 2026 { 2027 ::memcpy(piTempY, piRefY, sizeof(Pel)*uiWidth); 2028 piTempY += uiTempStride; 2029 piRefY += iRefStride; 2030 } 2031 2032 UInt64 uiDCSAD = cTempYuv.getLumaDistDCSAD( uiPartAddr, uiWidth ); 1895 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1896 if( m_pcEncCfg->isDepthCoder() && uiWidth >= 4 && uiWidth < 64 && m_pcEncCfg->getUseDMM() && bTestDmm && uiWidth == uiHeight ) 1897 { 1898 #if HHI_DMM_WEDGE_INTRA 1899 UInt uiTabIdx = 0; 1900 Int iDeltaDC1 = 0; 1901 Int iDeltaDC2 = 0; 1902 findWedgeFullMinDist( pcCU, uiPartOffset, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD ); 1903 pcCU->setWedgeFullTabIdxSubParts ( uiTabIdx, uiPartOffset, uiDepth + uiInitTrDepth ); 1904 pcCU->setWedgeFullDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth ); 1905 pcCU->setWedgeFullDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth ); 1906 1907 uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_FULL_IDX; 1908 uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_FULL_D_IDX; 1909 1910 if ( uiWidth > 4 ) 1911 { 1912 Int iWedgeDeltaEnd = 0; 1913 1914 iDeltaDC1 = 0; 1915 iDeltaDC2 = 0; 1916 1917 findWedgePredDirMinDist( pcCU, uiPartOffset, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iWedgeDeltaEnd, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD ); 1918 pcCU->setWedgePredDirTabIdxSubParts ( uiTabIdx, uiPartOffset, uiDepth + uiInitTrDepth ); 1919 pcCU->setWedgePredDirDeltaEndSubParts( iWedgeDeltaEnd, uiPartOffset, uiDepth + uiInitTrDepth ); 1920 pcCU->setWedgePredDirDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth ); 1921 pcCU->setWedgePredDirDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth ); 1922 1923 uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_PREDDIR_IDX; 1924 uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_PREDDIR_D_IDX; 1925 } 1926 #endif 1927 #if HHI_DMM_PRED_TEX 1928 TComYuv cTempYuv; cTempYuv.create( uiWidth, uiHeight ); cTempYuv.clear(); 1929 Pel* piTempY = cTempYuv.getLumaAddr(); 1930 1931 fillTexturePicTempBlock( pcCU, uiPartOffset, piTempY, uiWidth, uiHeight ); 1932 1933 piTempY = cTempYuv.getLumaAddr(); 1934 1935 UInt uiTexTabIdx = 0; 1936 Int iTexDeltaDC1 = 0; 1937 Int iTexDeltaDC2 = 0; 1938 findWedgeTexMinDist( pcCU, uiPartOffset, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTexTabIdx, iTexDeltaDC1, iTexDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD, piTempY ); 1939 pcCU->setWedgePredTexTabIdxSubParts ( uiTexTabIdx, uiPartOffset, uiDepth + uiInitTrDepth ); 1940 pcCU->setWedgePredTexDeltaDC1SubParts( iTexDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth ); 1941 pcCU->setWedgePredTexDeltaDC2SubParts( iTexDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth ); 1942 1943 uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_PREDTEX_IDX; 1944 uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_PREDTEX_D_IDX; 1945 1946 if ( uiWidth > 4 ) 1947 { 1948 piTempY = cTempYuv.getLumaAddr(); 1949 1950 iTexDeltaDC1 = 0; 1951 iTexDeltaDC2 = 0; 1952 1953 findContourPredTex( pcCU, uiPartOffset, piOrg, piPred, uiStride, uiWidth, uiHeight, iTexDeltaDC1, iTexDeltaDC2, bAboveAvail, bLeftAvail, piTempY ); 1954 pcCU->setContourPredTexDeltaDC1SubParts( iTexDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth ); 1955 pcCU->setContourPredTexDeltaDC2SubParts( iTexDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth ); 1956 1957 uiRdModeList[ uiNewMaxMode++ ] = DMM_CONTOUR_PREDTEX_IDX; 1958 uiRdModeList[ uiNewMaxMode++ ] = DMM_CONTOUR_PREDTEX_D_IDX; 1959 } 2033 1960 2034 1961 cTempYuv.destroy(); 2035 2036 if ( uiDCSAD < (UInt)(pcCU->getQP(0))/2 ) 2037 { 2038 pcCU->setTextureModeAllowanceSubParts( false, uiPartOffset, uiDepth + uiInitTrDepth ); 2039 } 2040 else 2041 { 2042 pcCU->setTextureModeAllowanceSubParts( true, uiPartOffset, uiDepth + uiInitTrDepth ); 2043 } 2044 #endif 2045 UChar uhNumAdd = 0; 2046 if ( uiWidth > 4 ) 2047 { 2048 uhNumAdd = 8; 2049 } 2050 else 2051 { 2052 uhNumAdd = 4; 2053 } 2054 Bool bWedgePredFull = false; 2055 Bool bWedgePredDir = false; 2056 Bool bWedgePredTex = false; 2057 Bool bContourPredTex = false; 2058 2059 for ( Int i = 0; i < uhNumAdd; i++ ) 2060 { 2061 UInt uiDMMid = g_aucAdditionalIntraModeList[i]; 2062 2063 if( !predIntraLumaDMMAvailable( uiDMMid, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) ) 2064 continue; 2065 2066 if( uiDMMid >= DMM_WEDGE_PREDTEX_IDX && uiDMMid <= DMM_CONTOUR_PREDTEX_D_IDX && pcCU->getTextureModeAllowance( uiPartOffset ) == false ) 2067 { 2068 continue; 2069 } 2070 if( !bWedgePredFull && (uiDMMid == DMM_WEDGE_FULL_IDX || uiDMMid == DMM_WEDGE_FULL_D_IDX) ) 2071 { 2072 UInt uiTabIdx = 0; 2073 Int iDeltaDC1 = 0; 2074 Int iDeltaDC2 = 0; 2075 findWedgeFullMinDist( pcCU, uiPU, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD ); 2076 pcCU->setWedgeFullTabIdxSubParts ( uiTabIdx, uiPartOffset, uiDepth + uiInitTrDepth ); 2077 pcCU->setWedgeFullDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth ); 2078 pcCU->setWedgeFullDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth ); 2079 bWedgePredFull = true; 2080 } 2081 2082 if( !bWedgePredDir && (uiDMMid == DMM_WEDGE_PREDDIR_IDX || uiDMMid == DMM_WEDGE_PREDDIR_D_IDX) ) 2083 { 2084 UInt uiTabIdx = 0; 2085 Int iWedgeDeltaEnd = 0; 2086 Int iDeltaDC1 = 0; 2087 Int iDeltaDC2 = 0; 2088 findWedgePredDirMinDist( pcCU, uiPU, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iWedgeDeltaEnd, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD ); 2089 pcCU->setWedgePredDirTabIdxSubParts ( uiTabIdx, uiPartOffset, uiDepth + uiInitTrDepth ); 2090 pcCU->setWedgePredDirDeltaEndSubParts( iWedgeDeltaEnd, uiPartOffset, uiDepth + uiInitTrDepth ); 2091 pcCU->setWedgePredDirDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth ); 2092 pcCU->setWedgePredDirDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth ); 2093 bWedgePredDir = true; 2094 } 2095 2096 if( !bWedgePredTex && (uiDMMid == DMM_WEDGE_PREDTEX_IDX || uiDMMid == DMM_WEDGE_PREDTEX_D_IDX) ) 2097 { 2098 UInt uiTabIdx = 0; 2099 Int iDeltaDC1 = 0; 2100 Int iDeltaDC2 = 0; 2101 findWedgeTexMinDist( pcCU, uiPU, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD ); 2102 pcCU->setWedgePredTexTabIdxSubParts ( uiTabIdx, uiPartOffset, uiDepth + uiInitTrDepth ); 2103 pcCU->setWedgePredTexDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth ); 2104 pcCU->setWedgePredTexDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth ); 2105 bWedgePredTex = true; 2106 } 2107 2108 if( !bContourPredTex && (uiDMMid == DMM_CONTOUR_PREDTEX_IDX || uiDMMid == DMM_CONTOUR_PREDTEX_D_IDX) ) 2109 { 2110 Int iDeltaDC1 = 0; 2111 Int iDeltaDC2 = 0; 2112 findContourPredTex( pcCU, uiPU, piOrg, piPred, uiStride, uiWidth, uiHeight, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail ); 2113 pcCU->setContourPredTexDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth ); 2114 pcCU->setContourPredTexDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth ); 2115 bContourPredTex = true; 2116 } 2117 2118 uiRdModeList[ uiNewMaxMode ] = uiDMMid; 2119 uiNewMaxMode++; 2120 } 1962 #endif 2121 1963 } 2122 1964 #endif … … 2137 1979 2138 1980 #if (!REFERENCE_SAMPLE_PADDING) 2139 #if HHI_DMM_ INTRA1981 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2140 1982 if ( !predIntraLumaDirAvailable( uiOrgMode, uiWidthBit, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) ) 2141 1983 continue; … … 2145 1987 #endif 2146 1988 #else 2147 #if HHI_DMM_ INTRA2148 if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) )1989 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 1990 if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) ) 2149 1991 continue; 2150 1992 #endif … … 2166 2008 2167 2009 // reset Model 2010 #if HHI_VSO 2168 2011 if( m_pcRdCost->getUseRenModel() ) 2169 2012 { 2170 2013 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 2171 2014 } 2015 #endif 2172 2016 2173 2017 #if HHI_RQT_INTRA_SPEEDUP … … 2223 2067 2224 2068 #if (!REFERENCE_SAMPLE_PADDING) 2225 #if HHI_DMM_ INTRA2069 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2226 2070 if ( !predIntraLumaDirAvailable( uiOrgMode, uiWidthBit, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) ) 2227 2071 continue; … … 2231 2075 #endif 2232 2076 #else 2233 #if HHI_DMM_ INTRA2234 if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) )2077 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2078 if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) ) 2235 2079 continue; 2236 2080 #endif … … 2250 2094 Double dPUCost = 0.0; 2251 2095 2096 #if HHI_VSO 2252 2097 // reset Model 2253 2098 if( m_pcRdCost->getUseRenModel() ) … … 2255 2100 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 2256 2101 } 2102 #endif 2257 2103 2258 2104 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost ); … … 2317 2163 } 2318 2164 2165 #if HHI_VSO 2319 2166 // set model 2320 2167 if( m_pcRdCost->getUseRenModel() ) … … 2323 2170 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piSrc, uiSrcStride, uiCompWidth, uiCompHeight); 2324 2171 } 2172 #endif 2325 2173 2326 2174 if( !bLumaOnly && !bSkipChroma ) … … 2483 2331 } 2484 2332 #endif 2485 #if HHI_DMM_ INTRA2333 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2486 2334 #if ADD_PLANAR_MODE 2487 2335 if ( uiModeList[uiMode] == 4 && pcCU->getLumaIntraDir(0) > MAX_MODE_ID_INTRA_DIR ) … … 2545 2393 2546 2394 #if (!REFERENCE_SAMPLE_PADDING) 2547 #if HHI_DMM_ INTRA2395 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2548 2396 Bool TEncSearch::predIntraLumaDirAvailable( UInt uiMode, UInt uiWidthBit, Bool bAboveAvail, Bool bLeftAvail, UInt uiWidth, UInt uiHeight, TComDataCU* pcCU, UInt uiAbsPartIdx ) 2549 2397 #else … … 2552 2400 { 2553 2401 Bool bDirAvailable; 2554 #if HHI_DMM_ INTRA2402 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2555 2403 if( uiMode > MAX_MODE_ID_INTRA_DIR ) 2556 2404 { 2557 return predIntraLumaDMMAvailable( uiMode, bAboveAvail, bLeftAvail, uiWidth, uiHeight , pcCU, uiAbsPartIdx);2405 return predIntraLumaDMMAvailable( uiMode, bAboveAvail, bLeftAvail, uiWidth, uiHeight ); 2558 2406 } 2559 2407 else … … 2572 2420 #endif 2573 2421 2574 #if HHI_DMM_INTRA 2575 Void TEncSearch::xSearchWedgeFullMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx ) 2576 { 2577 ruiTabIdx = 0; 2578 2579 // local pred buffer 2580 TComYuv cPredYuv; 2581 cPredYuv.create( uiWidth, uiHeight ); 2582 cPredYuv.clear(); 2583 2584 UInt uiPredStride = cPredYuv.getStride(); 2585 Pel* piPred = cPredYuv.getLumaAddr(); 2586 2587 Int iDC1 = 0; 2588 Int iDC2 = 0; 2589 // regular wedge search 2590 Dist uiBestDist = RDO_DIST_MAX; 2591 UInt uiBestTabIdx = 0; 2592 2593 for( UInt uiIdx = 0; uiIdx < pacWedgeList->size(); uiIdx++ ) 2594 { 2595 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRef, uiRefStride, iDC1, iDC2 ); 2596 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2597 2598 Dist uiActDist = RDO_DIST_MAX; 2599 if( m_pcRdCost->getUseVSO() ) 2600 { 2601 uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 ); 2602 } 2603 else 2604 { 2605 uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD ); 2606 } 2607 2608 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX ) 2609 { 2610 uiBestDist = uiActDist; 2611 uiBestTabIdx = uiIdx; 2612 } 2613 } 2614 ruiTabIdx = uiBestTabIdx; 2615 2616 cPredYuv.destroy(); 2617 return; 2618 } 2619 2620 Void TEncSearch::xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd ) 2621 { 2622 ruiTabIdx = 0; 2623 riWedgeDeltaEnd = 0; 2624 2625 // local pred buffer 2626 TComYuv cPredYuv; 2627 cPredYuv.create( uiWidth, uiHeight ); 2628 cPredYuv.clear(); 2629 2630 UInt uiPredStride = cPredYuv.getStride(); 2631 Pel* piPred = cPredYuv.getLumaAddr(); 2632 2633 Int iDC1 = 0; 2634 Int iDC2 = 0; 2635 2636 // regular wedge search 2637 Dist uiBestDist = RDO_DIST_MAX; 2638 UInt uiBestTabIdx = 0; 2639 Int iBestDeltaEnd = 0; 2640 2641 UInt uiIdx = 0; 2642 for( Int iTestDeltaEnd = -DMM_WEDGE_PREDDIR_DELTAEND_MAX; iTestDeltaEnd <= DMM_WEDGE_PREDDIR_DELTAEND_MAX; iTestDeltaEnd++ ) 2643 { 2644 uiIdx = getBestContinueWedge( pcCU, uiAbsPtIdx, uiWidth, uiHeight, iTestDeltaEnd ); 2645 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRef, uiRefStride, iDC1, iDC2 ); 2646 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2647 2648 Dist uiActDist = RDO_DIST_MAX; 2649 if( m_pcRdCost->getUseVSO() ) 2650 { 2651 uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 ); 2652 } 2653 else 2654 { 2655 uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD ); 2656 } 2657 2658 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX ) 2659 { 2660 uiBestDist = uiActDist; 2661 uiBestTabIdx = uiIdx; 2662 iBestDeltaEnd = iTestDeltaEnd; 2663 } 2664 else if( uiIdx == uiBestTabIdx && abs(iTestDeltaEnd) < abs(iBestDeltaEnd) ) 2665 { 2666 iBestDeltaEnd = iTestDeltaEnd; 2667 } 2668 } 2669 2670 ruiTabIdx = uiBestTabIdx; 2671 riWedgeDeltaEnd = iBestDeltaEnd; 2672 2673 cPredYuv.destroy(); 2674 return; 2675 } 2676 2677 Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, Bool bAboveAvail, Bool bLeftAvail, UInt uiWidth, UInt uiHeight, TComDataCU* pcCU, UInt uiAbsPartIdx ) 2678 { 2679 if( uiMode <= MAX_MODE_ID_INTRA_DIR ) return true; 2680 2681 Bool bDMMAvailable = m_pcEncCfg->getUseDepthModelModes(); 2682 2683 if( uiMode == DMM_WEDGE_FULL_IDX || 2684 uiMode == DMM_WEDGE_FULL_D_IDX || 2685 uiMode == DMM_WEDGE_PREDTEX_IDX || 2686 uiMode == DMM_WEDGE_PREDTEX_D_IDX || 2687 uiMode == DMM_CONTOUR_PREDTEX_IDX || 2688 uiMode == DMM_CONTOUR_PREDTEX_D_IDX || 2689 uiMode == DMM_WEDGE_PREDDIR_IDX || 2690 uiMode == DMM_WEDGE_PREDDIR_D_IDX ) 2691 { 2692 if( (uiWidth != uiHeight) || (uiWidth < DMM_WEDGEMODEL_MIN_SIZE) || (uiWidth > DMM_WEDGEMODEL_MAX_SIZE) ) 2693 { 2694 bDMMAvailable = false; 2695 } 2696 } 2697 2698 return bDMMAvailable; 2699 } 2700 2422 #if HHI_DMM_WEDGE_INTRA 2701 2423 Void TEncSearch::findWedgeFullMinDist( TComDataCU* pcCU, 2702 UInt uiAbsPtIdx,2703 Pel* piOrig,2704 Pel* piPredic,2705 UInt uiStride,2706 UInt uiWidth,2707 UInt uiHeight,2708 UInt& ruiTabIdx,2709 Int& riDeltaDC1,2710 Int& riDeltaDC2,2711 Bool bAbove,2712 Bool bLeft,2713 WedgeDist eWedgeDist2714 )2715 {2716 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );2717 2718 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];2719 xSearchWedgeFullMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx );2720 2721 TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));2722 xGetWedgeDeltaDCsMinDist( pcBestWedgelet, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft );2723 }2724 2725 Void TEncSearch::findWedgePredDirMinDist( TComDataCU* pcCU,2726 UInt uiAbsPtIdx,2727 Pel* piOrig,2728 Pel* piPredic,2729 UInt uiStride,2730 UInt uiWidth,2731 UInt uiHeight,2732 UInt& ruiTabIdx,2733 Int& riWedgeDeltaEnd,2734 Int& riDeltaDC1,2735 Int& riDeltaDC2,2736 Bool bAbove,2737 Bool bLeft,2738 WedgeDist eWedgeDist )2739 {2740 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );2741 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];2742 2743 ruiTabIdx = 0;2744 riWedgeDeltaEnd = 0;2745 2746 xSearchWedgePredDirMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, riWedgeDeltaEnd );2747 2748 TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));2749 xGetWedgeDeltaDCsMinDist( pcBestWedgelet, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft );2750 }2751 2752 Void TEncSearch::findWedgeTexMinDist( TComDataCU* pcCU,2753 2424 UInt uiAbsPtIdx, 2754 2425 Pel* piOrig, … … 2763 2434 Bool bLeft, 2764 2435 WedgeDist eWedgeDist 2765 ) 2766 { 2436 ) 2437 { 2438 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE ); 2439 2440 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 2441 xSearchWedgeFullMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx ); 2442 2443 TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx)); 2444 xGetWedgeDeltaDCsMinDist( pcBestWedgelet, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft ); 2445 } 2446 2447 Void TEncSearch::xSearchWedgeFullMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx ) 2448 { 2449 ruiTabIdx = 0; 2450 2451 // local pred buffer 2452 TComYuv cPredYuv; 2453 cPredYuv.create( uiWidth, uiHeight ); 2454 cPredYuv.clear(); 2455 2456 UInt uiPredStride = cPredYuv.getStride(); 2457 Pel* piPred = cPredYuv.getLumaAddr(); 2458 2459 Int iDC1 = 0; 2460 Int iDC2 = 0; 2461 // regular wedge search 2462 Dist uiBestDist = RDO_DIST_MAX; 2463 UInt uiBestTabIdx = 0; 2464 2465 for( UInt uiIdx = 0; uiIdx < pacWedgeList->size(); uiIdx++ ) 2466 { 2467 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRef, uiRefStride, iDC1, iDC2 ); 2468 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2469 2470 Dist uiActDist = RDO_DIST_MAX; 2471 #if HHI_VSO 2472 if( m_pcRdCost->getUseVSO() ) 2473 { 2474 uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 ); 2475 } 2476 else 2477 { 2478 uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD ); 2479 } 2480 #else 2481 uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD ); 2482 #endif 2483 2484 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX ) 2485 { 2486 uiBestDist = uiActDist; 2487 uiBestTabIdx = uiIdx; 2488 } 2489 } 2490 ruiTabIdx = uiBestTabIdx; 2491 2492 cPredYuv.destroy(); 2493 return; 2494 } 2495 2496 Void TEncSearch::findWedgePredDirMinDist( TComDataCU* pcCU, 2497 UInt uiAbsPtIdx, 2498 Pel* piOrig, 2499 Pel* piPredic, 2500 UInt uiStride, 2501 UInt uiWidth, 2502 UInt uiHeight, 2503 UInt& ruiTabIdx, 2504 Int& riWedgeDeltaEnd, 2505 Int& riDeltaDC1, 2506 Int& riDeltaDC2, 2507 Bool bAbove, 2508 Bool bLeft, 2509 WedgeDist eWedgeDist ) 2510 { 2767 2511 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE ); 2768 2512 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 2769 2513 2770 ruiTabIdx = getBestWedgeFromText( pcCU, uiAbsPtIdx, uiWidth, uiHeight ); 2514 ruiTabIdx = 0; 2515 riWedgeDeltaEnd = 0; 2516 2517 xSearchWedgePredDirMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, riWedgeDeltaEnd ); 2518 2519 TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx)); 2520 xGetWedgeDeltaDCsMinDist( pcBestWedgelet, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft ); 2521 } 2522 2523 Void TEncSearch::xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd ) 2524 { 2525 ruiTabIdx = 0; 2526 riWedgeDeltaEnd = 0; 2527 2528 // local pred buffer 2529 TComYuv cPredYuv; 2530 cPredYuv.create( uiWidth, uiHeight ); 2531 cPredYuv.clear(); 2532 2533 UInt uiPredStride = cPredYuv.getStride(); 2534 Pel* piPred = cPredYuv.getLumaAddr(); 2535 2536 Int iDC1 = 0; 2537 Int iDC2 = 0; 2538 2539 // regular wedge search 2540 Dist uiBestDist = RDO_DIST_MAX; 2541 UInt uiBestTabIdx = 0; 2542 Int iBestDeltaEnd = 0; 2543 2544 UInt uiIdx = 0; 2545 for( Int iTestDeltaEnd = -DMM_WEDGE_PREDDIR_DELTAEND_MAX; iTestDeltaEnd <= DMM_WEDGE_PREDDIR_DELTAEND_MAX; iTestDeltaEnd++ ) 2546 { 2547 uiIdx = getBestContinueWedge( pcCU, uiAbsPtIdx, uiWidth, uiHeight, iTestDeltaEnd ); 2548 calcWedgeDCs ( &(pacWedgeList->at(uiIdx)), piRef, uiRefStride, iDC1, iDC2 ); 2549 assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 ); 2550 2551 Dist uiActDist = RDO_DIST_MAX; 2552 #if HHI_VSO 2553 if( m_pcRdCost->getUseVSO() ) 2554 { 2555 uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 ); 2556 } 2557 else 2558 { 2559 uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD ); 2560 } 2561 #else 2562 uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD ); 2563 #endif 2564 2565 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX ) 2566 { 2567 uiBestDist = uiActDist; 2568 uiBestTabIdx = uiIdx; 2569 iBestDeltaEnd = iTestDeltaEnd; 2570 } 2571 else if( uiIdx == uiBestTabIdx && abs(iTestDeltaEnd) < abs(iBestDeltaEnd) ) 2572 { 2573 iBestDeltaEnd = iTestDeltaEnd; 2574 } 2575 } 2576 2577 ruiTabIdx = uiBestTabIdx; 2578 riWedgeDeltaEnd = iBestDeltaEnd; 2579 2580 cPredYuv.destroy(); 2581 return; 2582 } 2583 #endif 2584 2585 #if HHI_DMM_PRED_TEX 2586 Void TEncSearch::findWedgeTexMinDist( TComDataCU* pcCU, 2587 UInt uiAbsPtIdx, 2588 Pel* piOrig, 2589 Pel* piPredic, 2590 UInt uiStride, 2591 UInt uiWidth, 2592 UInt uiHeight, 2593 UInt& ruiTabIdx, 2594 Int& riDeltaDC1, 2595 Int& riDeltaDC2, 2596 Bool bAbove, 2597 Bool bLeft, 2598 WedgeDist eWedgeDist, 2599 Pel* piTextureRef 2600 ) 2601 { 2602 assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE ); 2603 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 2604 2605 ruiTabIdx = getBestWedgeFromText( pcCU, uiAbsPtIdx, uiWidth, uiHeight, eWedgeDist, piTextureRef ); 2771 2606 2772 2607 TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx)); … … 2784 2619 Int& riDeltaDC2, 2785 2620 Bool bAbove, 2786 Bool bLeft ) 2621 Bool bLeft, 2622 Pel* piTextureRef ) 2787 2623 { 2788 2624 // get contour pattern 2789 2625 TComWedgelet* pcContourWedge = new TComWedgelet( uiWidth, uiHeight ); 2790 getBestContourFromText( pcCU, uiAbsPtIdx, uiWidth, uiHeight, pcContourWedge );2626 getBestContourFromText( pcCU, uiAbsPtIdx, uiWidth, uiHeight, pcContourWedge, piTextureRef ); 2791 2627 2792 2628 xGetWedgeDeltaDCsMinDist( pcContourWedge, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft ); … … 2795 2631 delete pcContourWedge; 2796 2632 } 2797 2633 #endif 2634 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 2798 2635 Void TEncSearch::xGetWedgeDeltaDCsMinDist( TComWedgelet* pcWedgelet, 2799 2636 TComDataCU* pcCU, … … 2824 2661 riDeltaDC2 = iDC2 - iPredDC2; 2825 2662 2663 #if HHI_VSO 2826 2664 if( m_pcRdCost->getUseVSO() ) 2827 2665 { … … 2875 2713 riDeltaDC2 = iFullDeltaDC2; 2876 2714 } 2715 #endif 2877 2716 2878 2717 xDeltaDCQuantScaleDown( pcCU, riDeltaDC1 ); 2879 2718 xDeltaDCQuantScaleDown( pcCU, riDeltaDC2 ); 2719 } 2720 2721 Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight ) 2722 { 2723 if( uiMode <= MAX_MODE_ID_INTRA_DIR ) return true; 2724 2725 Bool bDMMAvailable = m_pcEncCfg->getUseDMM(); 2726 2727 #if HHI_DMM_WEDGE_INTRA 2728 if( uiMode == DMM_WEDGE_FULL_IDX || 2729 uiMode == DMM_WEDGE_FULL_D_IDX || 2730 uiMode == DMM_WEDGE_PREDDIR_IDX || 2731 uiMode == DMM_WEDGE_PREDDIR_D_IDX ) 2732 { 2733 if( (uiWidth != uiHeight) || (uiWidth < DMM_WEDGEMODEL_MIN_SIZE) || (uiWidth > DMM_WEDGEMODEL_MAX_SIZE) || ( ( uiMode == DMM_WEDGE_PREDDIR_IDX || uiMode == DMM_WEDGE_PREDDIR_D_IDX ) && uiWidth == 4 ) ) 2734 { 2735 bDMMAvailable = false; 2736 } 2737 } 2738 #endif 2739 #if HHI_DMM_PRED_TEX 2740 if( uiMode == DMM_WEDGE_PREDTEX_IDX || 2741 uiMode == DMM_WEDGE_PREDTEX_D_IDX || 2742 uiMode == DMM_CONTOUR_PREDTEX_IDX || 2743 uiMode == DMM_CONTOUR_PREDTEX_D_IDX ) 2744 { 2745 if( (uiWidth != uiHeight) || (uiWidth < DMM_WEDGEMODEL_MIN_SIZE) || (uiWidth > DMM_WEDGEMODEL_MAX_SIZE) || ( ( uiMode == DMM_CONTOUR_PREDTEX_IDX || uiMode == DMM_CONTOUR_PREDTEX_D_IDX ) && uiWidth == 4 ) ) 2746 { 2747 bDMMAvailable = false; 2748 } 2749 } 2750 2751 #endif 2752 2753 return bDMMAvailable; 2880 2754 } 2881 2755 … … 4033 3907 uiCost = ruiDist + m_pcRdCost->getCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum] ); 4034 3908 #else 4035 //GTVSO3909 #if HHI_VSO 4036 3910 if ( false /*m_pcRdCost->getUseVSO()*/ ) // GT: currently disabled 4037 3911 { 4038 #if GERHARD_VQM_XCHECK4039 UInt uiCost1 = m_pcRdCost->getDistVS ( pcCU, uiPartAddr, pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, true, 0);4040 UInt uiCost2 = m_pcRdCost->getDistPart( pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, DF_SAD );4041 assert(uiCost1 == uiCost2);4042 #endif4043 3912 uiCost = m_pcRdCost->getDistVS ( pcCU, uiPartAddr, pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, true, 0); 4044 3913 uiCost = (UInt) m_pcRdCost->calcRdCostVSO( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false, DF_SAD ); 4045 3914 } 4046 3915 else 3916 #endif 4047 3917 { 4048 3918 uiCost = m_pcRdCost->getDistPart( pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, DF_SAD ); 4049 3919 uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false, DF_SAD ); 4050 3920 } 4051 //GT VSO end4052 3921 #endif 4053 3922 return uiCost; … … 4123 3992 4124 3993 m_pcRdCost->setPredictor ( *pcMvPred ); 4125 #if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING3994 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4126 3995 if( pcCU->getSlice()->getSPS()->isDepth() ) 4127 3996 m_pcRdCost->setCostScale ( 0 ); … … 4130 3999 m_pcRdCost->setCostScale ( 2 ); 4131 4000 4001 #if HHI_INTER_VIEW_MOTION_PRED 4132 4002 { // init inter-view regularization 4133 4003 TComMv cOrgDepthMapMv; 4134 4004 Bool bMultiviewReg = pcCU->getIViewOrgDepthMvPred( iPartIdx, eRefPicList, iRefIdxPred, cOrgDepthMapMv ); 4135 #if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING4005 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4136 4006 if( bMultiviewReg && pcCU->getSlice()->getSPS()->isDepth() ) 4137 4007 { … … 4146 4016 } 4147 4017 } 4018 #endif 4148 4019 4149 4020 // Do integer search … … 4179 4050 4180 4051 m_pcRdCost->getMotionCost( 1, 0 ); 4181 #if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING4052 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4182 4053 if( ! pcCU->getSlice()->getSPS()->isDepth() ) 4183 4054 { … … 4203 4074 rcMv += (cMvHalf <<= 1); 4204 4075 rcMv += cMvQter; 4205 #if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING4076 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4206 4077 } 4207 4078 #endif 4208 4079 4209 4080 UInt uiMvBits = m_pcRdCost->getBits( rcMv.getHor(), rcMv.getVer() ); 4210 #if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING4081 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4211 4082 if( pcCU->getSlice()->getSPS()->isDepth() ) 4212 4083 ruiCost += m_pcRdCost->getCost( uiMvBits ); … … 4221 4092 { 4222 4093 Int iMvShift = 2; 4223 #if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING4094 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4224 4095 if( pcCU->getSlice()->getSPS()->isDepth() ) 4225 4096 iMvShift = 0; … … 4394 4265 UInt uiSearchRange = m_iSearchRange; 4395 4266 pcCU->clipMv( rcMv ); 4396 #if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING4267 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4397 4268 if( ! pcCU->getSlice()->getSPS()->isDepth() ) 4398 4269 #endif … … 4414 4285 TComMv cMv = m_acMvPredictors[index]; 4415 4286 pcCU->clipMv( cMv ); 4416 #if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING4287 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4417 4288 if( ! pcCU->getSlice()->getSPS()->isDepth() ) 4418 4289 #endif … … 4726 4597 pcYuvPred->copyToPartYuv( rpcYuvRec, 0 ); 4727 4598 4599 #if HHI_INTER_VIEW_RESIDUAL_PRED 4728 4600 // add residual prediction 4729 4601 if( pcCU->getResPredFlag( 0 ) ) … … 4732 4604 rpcYuvRec->clip( uiWidth, uiHeight ); 4733 4605 } 4734 4735 //GT VSO 4606 #endif 4607 4608 #if HHI_VSO 4736 4609 if ( m_pcRdCost->getUseVSO() ) 4737 4610 { 4738 #if GERHARD_VQM_XCHECK4739 UInt uiDistortion1 = m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight );4740 UInt uiDistortion2 = m_pcRdCost->getDistVS( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight , false, 0 );4741 assert( uiDistortion1 == uiDistortion2 );4742 #endif4743 4611 uiDistortion = m_pcRdCost->getDistVS( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight , false, 0 ); 4744 4612 } 4745 4613 else 4614 #endif 4746 4615 { 4747 4616 uiDistortion = m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight ) … … 4749 4618 + m_pcRdCost->getDistPart( rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 ); 4750 4619 } 4751 //GT VSO end4620 4752 4621 4753 4622 if( m_bUseSBACRD ) … … 4755 4624 4756 4625 m_pcEntropyCoder->resetBits(); 4757 #if MW_MVI_SIGNALLING_MODE == 14626 #if HHI_MPI 4758 4627 if( pcCU->getTextureModeDepth( 0 ) == -1 ) 4759 4628 { … … 4772 4641 } 4773 4642 #endif 4643 #if HHI_INTER_VIEW_RESIDUAL_PRED 4774 4644 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); 4775 #if MW_MVI_SIGNALLING_MODE == 1 4645 #endif 4646 #if HHI_MPI 4776 4647 } 4777 4648 #endif … … 4780 4651 pcCU->getTotalBits() = uiBits; 4781 4652 pcCU->getTotalDistortion() = uiDistortion; 4782 //GT VSO 4653 4654 #if HHI_VSO 4783 4655 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 4784 4656 { … … 4786 4658 } 4787 4659 else 4660 #endif 4788 4661 { 4789 4662 pcCU->getTotalCost() = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); 4790 4663 } 4791 //GT VSO end4792 4664 4793 4665 if( m_bUseSBACRD ) … … 4797 4669 pcCU->setTrIdxSubParts( 0, 0, pcCU->getDepth(0) ); 4798 4670 4671 #if HHI_VSO 4799 4672 // set Model 4800 4673 if( m_pcRdCost->getUseRenModel() ) … … 4804 4677 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 4805 4678 } 4679 #endif 4806 4680 4807 4681 return; … … 4828 4702 pcYuvPred->copyToPartYuv( rpcYuvRec, 0 ); 4829 4703 4704 #if HHI_INTER_VIEW_RESIDUAL_PRED 4830 4705 // add residual prediction 4831 4706 if( pcCU->getResPredFlag( 0 ) ) … … 4833 4708 rpcYuvRec->add( rpcYuvResPrd, uiWidth, uiHeight ); 4834 4709 } 4835 #if SB_INTERVIEW_SKIP 4710 #endif 4711 #if HHI_INTERVIEW_SKIP 4836 4712 if( bSkipRes) 4837 4713 { … … 4858 4734 4859 4735 Dist uiZeroDistortion = 0; 4860 //GTVSO4736 #if HHI_VSO 4861 4737 if ( m_pcRdCost->getUseVSO() ) 4862 4738 { 4863 4739 m_cYuvRecTemp.create( pcYuvPred->getWidth(), pcYuvPred->getHeight() ); 4864 4740 } 4741 #endif 4865 4742 4866 4743 xEstimateResidualQT( pcCU, 0, 0, pcYuvOrg, rpcYuvRec, rpcYuvResi, pcCU->getDepth(0), dCost, uiBits, uiDistortion, &uiZeroDistortion ); 4867 4744 4745 #if HHI_VSO 4868 4746 if ( m_pcRdCost->getUseVSO() ) 4869 4747 { 4870 4748 m_cYuvRecTemp.destroy(); 4871 4749 } 4872 //GT VSO end 4750 #endif 4751 4873 4752 4874 4753 double dZeroCost; 4754 #if HHI_VSO 4875 4755 if( m_pcRdCost->getUseLambdaScaleVSO() ) 4876 4756 { … … 4878 4758 } 4879 4759 else 4760 #endif 4880 4761 { 4881 4762 dZeroCost = m_pcRdCost->calcRdCost( 0, uiZeroDistortion ); … … 4926 4807 4927 4808 Double dExactCost; 4809 #if HHI_VSO 4928 4810 if( m_pcRdCost->getUseLambdaScaleVSO() ) 4929 4811 { … … 4931 4813 } 4932 4814 else 4815 #endif 4933 4816 { 4934 4817 dExactCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion ); … … 4970 4853 } 4971 4854 4855 #if HHI_VSO 4972 4856 // reset Model 4973 4857 if( m_pcRdCost->getUseRenModel() ) … … 4977 4861 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 4978 4862 } 4863 #endif 4979 4864 } 4980 4865 … … 5002 4887 // update with clipped distortion and cost (qp estimation loop uses unclipped values) 5003 4888 5004 //GTVSO4889 #if HHI_VSO 5005 4890 if ( m_pcRdCost->getUseVSO() ) 5006 4891 { 5007 #if GERHARD_VQM_XCHECK5008 UInt uiDistortionBest1 = m_pcRdCost->getDistVS ( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight, false, 0 );5009 UInt uiDistortionBest2 = m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight );5010 assert( uiDistortionBest1 == uiDistortionBest2 );5011 #endif5012 4892 uiDistortionBest = m_pcRdCost->getDistVS ( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight, false, 0 ); 5013 4893 } 5014 4894 else 4895 #endif 5015 4896 { 5016 4897 uiDistortionBest = m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(), pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(), uiWidth, uiHeight ) … … 5018 4899 + m_pcRdCost->getDistPart( rpcYuvRec->getCrAddr(), rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(), pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 ); 5019 4900 } 5020 //GT VSO end 5021 5022 //GT VSO 4901 4902 #if HHI_VSO 5023 4903 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 5024 4904 { … … 5026 4906 } 5027 4907 else 4908 #endif 5028 4909 { 5029 4910 dCostBest = m_pcRdCost->calcRdCost( uiBitsBest, uiDistortionBest ); 5030 4911 } 5031 //GT VSO end5032 4912 5033 4913 pcCU->getTotalBits() = uiBitsBest; … … 5044 4924 5045 4925 // set Model 4926 #if HHI_VSO 5046 4927 if( m_pcRdCost->getUseRenModel() ) 5047 4928 { … … 5050 4931 m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight ); 5051 4932 } 4933 #endif 5052 4934 } 5053 4935 … … 5167 5049 ::memset( m_pTempPel, 0, sizeof( Pel ) * uiNumSamplesLuma ); // not necessary needed for inside of recursion (only at the beginning) 5168 5050 5051 #if HHI_VSO 5169 5052 if ( m_pcRdCost->getUseVSO() ) 5170 5053 { 5171 5054 uiDistY = m_pcRdCost->getDistVS ( pcCU, uiAbsPartIdx, pcPred->getLumaAddr( uiAbsPartIdx ), pcPred->getStride(), pcOrg->getLumaAddr( uiAbsPartIdx), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false, 0 ); // initialized with zero residual distortion 5172 5173 #if GERHARD_VQM_XCHECK5174 UInt uiDist1 = m_pcRdCost->getDistPart( pcOrg->getLumaAddr( uiAbsPartIdx), pcOrg->getStride(), pcPred->getLumaAddr( uiAbsPartIdx ), pcPred->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize ); // initialized with zero residual distortion5175 UInt uiDist2 = m_pcRdCost->getDistPart( m_pTempPel, 1<< uiLog2TrSize, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize ); // initialized with zero residual distortion5176 assert( uiDist1 == uiDist2 );5177 #endif5178 5055 } 5179 5056 else 5057 #endif 5180 5058 { 5181 5059 #if IBDI_DISTORTION … … 5185 5063 #endif 5186 5064 } 5187 //GT VSO end 5065 5188 5066 5189 5067 if ( puiZeroDist ) … … 5203 5081 Dist uiNonzeroDistY; 5204 5082 5205 //GT VSO 5083 #if HHI_VSO 5206 5084 if ( m_pcRdCost->getUseVSO() ) 5207 5085 { … … 5209 5087 uiNonzeroDistY = m_pcRdCost->getDistVS( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(), 5210 5088 pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false, 0 ); 5211 5212 #if GERHARD_VQM_XCHECK5213 UInt uiDist1 = m_pcRdCost->getDistPart( m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(),5214 pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize );5215 5216 UInt uiDist2 = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),5217 pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize );5218 assert( uiDist1 == uiDist2);5219 #endif5220 5089 } 5221 5090 else 5091 #endif 5222 5092 { 5223 5093 uiNonzeroDistY = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(), 5224 5094 pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize ); 5225 5095 } 5226 //GT VSO end5227 5096 5228 5097 Double dSingleCostY; 5229 5098 Double dNullCostY; 5230 5099 5231 //GT VSO 5100 #if HHI_VSO 5232 5101 if ( m_pcRdCost->getUseLambdaScaleVSO()) 5233 5102 { … … 5236 5105 } 5237 5106 else 5107 #endif 5238 5108 { 5239 5109 dSingleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY ); 5240 5110 dNullCostY = m_pcRdCost->calcRdCost( 0, uiDistY ); 5241 5111 } 5242 //GT VSO end5243 5112 5244 5113 … … 5406 5275 5407 5276 uiSingleDist = uiDistY + uiDistU + uiDistV; 5408 //GTVSO5277 #if HHI_VSO 5409 5278 if ( m_pcRdCost->getUseLambdaScaleVSO()) 5410 5279 { … … 5412 5281 } 5413 5282 else 5283 #endif 5414 5284 { 5415 5285 dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist ); 5416 5286 } 5417 //GT VSO end5418 5287 } 5419 5288 … … 5467 5336 uiSubdivBits = m_pcEntropyCoder->getNumberOfWrittenBits(); 5468 5337 5469 //GTVSO5338 #if HHI_VSO 5470 5339 if ( m_pcRdCost->getUseLambdaScaleVSO()) 5471 5340 { … … 5473 5342 } 5474 5343 else 5344 #endif 5475 5345 { 5476 5346 dSubdivCost = m_pcRdCost->calcRdCost( uiSubdivBits, uiSubdivDist ); 5477 5347 } 5478 //GT VSO end5479 5348 5480 5349 if( uiYCbf || uiUCbf || uiVCbf || !bCheckFull ) … … 5495 5364 } 5496 5365 5366 #if HHI_VSO 5497 5367 if ( m_pcRdCost->getUseRenModel() ) 5498 5368 { … … 5515 5385 uiSrcStride = pcPred->getStride (); 5516 5386 } 5387 5517 5388 m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight ); 5518 5389 } 5390 #endif 5519 5391 5520 5392 rdCost += dSingleCost; … … 5762 5634 if ( pcCU->isSkipped( 0 ) ) 5763 5635 { 5764 #if MW_MVI_SIGNALLING_MODE == 0 5765 assert( pcCU->getTextureModeDepth( 0 ) == -1 ); 5766 #elif MW_MVI_SIGNALLING_MODE == 1 5636 #if HHI_MPI 5767 5637 if( pcCU->getTextureModeDepth( 0 ) != -1 ) 5768 5638 { … … 5787 5657 } 5788 5658 #endif 5659 #if HHI_INTER_VIEW_RESIDUAL_PRED 5789 5660 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); 5661 #endif 5790 5662 ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits(); 5791 5663 } … … 5793 5665 { 5794 5666 m_pcEntropyCoder->resetBits(); 5795 #if MW_MVI_SIGNALLING_MODE == 15667 #if HHI_MPI 5796 5668 if( pcCU->getTextureModeDepth( 0 ) == -1 ) 5797 5669 { 5798 5670 #endif 5799 m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true );5671 m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true ); 5800 5672 #if HHI_MRG_SKIP 5801 if (pcCU->getPredictionMode(0) == MODE_SKIP) 5802 { 5803 pcCU->setPredModeSubParts( MODE_INTER, 0, pcCU->getDepth(0) ); 5804 } 5805 #endif 5806 #if MW_MVI_SIGNALLING_MODE == 0 5807 if( pcCU->getTextureModeDepth( 0 ) == -1 ) 5808 { 5673 if (pcCU->getPredictionMode(0) == MODE_SKIP) 5674 { 5675 pcCU->setPredModeSubParts( MODE_INTER, 0, pcCU->getDepth(0) ); 5676 } 5809 5677 #endif 5810 5678 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); … … 5812 5680 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 5813 5681 5682 #if HHI_INTER_VIEW_RESIDUAL_PRED 5814 5683 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); 5815 } 5684 #endif 5685 #if HHI_MPI 5686 } 5687 #endif 5816 5688 m_pcEntropyCoder->encodeCoeff ( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0) ); 5817 5689 -
trunk/source/Lib/TLibEncoder/TEncSearch.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 71 104 72 105 73 //GTVSO106 #if HHI_VSO 74 107 TComYuv m_cYuvRecTemp; 75 //GT VSO end 108 #endif 76 109 77 110 // AMVP cost computation … … 104 137 105 138 #if (!REFERENCE_SAMPLE_PADDING) 106 #if HHI_DMM_ INTRA139 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 107 140 Bool predIntraLumaDirAvailable( UInt uiMode, UInt uiWidthBit, Bool bAboveAvail, Bool bLeftAvail, UInt uiWidth, UInt uiHeight, TComDataCU* pcCU, UInt uiAbsPartIdx ); 108 141 #else … … 111 144 #endif 112 145 113 #if HHI_DMM_ INTRA146 #if HHI_DMM_WEDGE_INTRA 114 147 Void xSearchWedgeFullMinDist ( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx ); 115 148 Void xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd ); 116 149 #endif 150 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 117 151 Void xGetWedgeDeltaDCsMinDist ( TComWedgelet* pcWedgelet, 118 152 TComDataCU* pcCU, … … 170 204 Dist uiPreCalcDistC ); 171 205 172 #if HHI_DMM_ INTRA206 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 173 207 Bool predIntraLumaDMMAvailable( UInt uiMode, 174 Bool bAboveAvail,175 Bool bLeftAvail,176 208 UInt uiWidth, 177 UInt uiHeight ,178 TComDataCU* pcCU, 179 UInt uiAbsPartIdx ); 209 UInt uiHeight ); 210 #endif 211 #if HHI_DMM_WEDGE_INTRA 180 212 Void findWedgeFullMinDist ( TComDataCU* pcCU, 181 213 UInt uiAbsPtIdx, … … 205 237 Bool bLeft, 206 238 WedgeDist eWedgeDist ); 239 #endif 240 #if HHI_DMM_PRED_TEX 207 241 Void findWedgeTexMinDist ( TComDataCU* pcCU, 208 242 UInt uiAbsPtIdx, … … 217 251 Bool bAbove, 218 252 Bool bLeft, 219 WedgeDist eWedgeDist ); 253 WedgeDist eWedgeDist, 254 Pel* piTextureRef = NULL ); 255 220 256 Void findContourPredTex ( TComDataCU* pcCU, 221 257 UInt uiAbsPtIdx, … … 228 264 Int& riDeltaDC2, 229 265 Bool bAbove, 230 Bool bLeft );231 266 Bool bLeft, 267 Pel* piTextureRef = NULL ); 232 268 #endif 233 269 … … 286 322 Bool bLuma, 287 323 Bool bChroma, 288 Bool bRealCoeff ); 324 Bool bRealCoeff 325 ); 289 326 290 327 Void xIntraCodingLumaBlk ( TComDataCU* pcCU, … … 295 332 TComYuv* pcResiYuv, 296 333 Dist& ruiDist 297 #if DMM_RES_CHECK_INTRA298 ,299 Bool bCheckNoRes = false300 #endif301 334 ); 302 303 #if DMM_RES_CHECK_INTRA304 Void xSetIntraNoResi ( TComDataCU* pcCU,305 UInt uiTrDepth,306 UInt uiAbsPartIdx,307 TComYuv* pcPredYuv,308 TComYuv* pcResiYuv,309 Bool bNoRes310 );311 #endif312 335 313 336 Void xIntraCodingChromaBlk ( TComDataCU* pcCU, -
trunk/source/Lib/TLibEncoder/TEncSeqStructure.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 -
trunk/source/Lib/TLibEncoder/TEncSeqStructure.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 8 41 #include <vector> 9 42 10 //SB11 43 #include <map> 12 44 -
trunk/source/Lib/TLibEncoder/TEncSlice.cpp
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 12 * * Redistributions of source code must retain the above copyright notice, 13 * this list of conditions and the following disclaimer. 14 * * Redistributions in binary form must reproduce the above copyright notice, 15 * this list of conditions and the following disclaimer in the documentation 16 * and/or other materials provided with the distribution. 17 * * Neither the name of the ISO/IEC nor the names of its contributors may 18 * be used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 1 34 2 35 … … 16 49 m_apcPicYuvPred = NULL; 17 50 m_apcPicYuvResi = NULL; 18 51 19 52 m_pdRdPicLambda = NULL; 20 53 m_pdRdPicQp = NULL; … … 34 67 m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth ); 35 68 } 36 69 37 70 // create residual picture 38 71 if( m_apcPicYuvResi == NULL ) … … 52 85 m_apcPicYuvPred = NULL; 53 86 } 54 87 55 88 // destroy residual picture 56 89 if ( m_apcPicYuvResi ) … … 60 93 m_apcPicYuvResi = NULL; 61 94 } 62 95 63 96 // free lambda and QP arrays 64 97 if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; } … … 71 104 m_pcCfg = pcEncTop; 72 105 m_pcListPic = pcEncTop->getListPic(); 73 74 //SB 106 75 107 m_pcPicEncoder = pcEncTop->getPicEncoder(); 76 108 m_pcCuEncoder = pcEncTop->getCuEncoder(); 77 109 m_pcPredSearch = pcEncTop->getPredSearch(); 78 110 79 111 m_pcEntropyCoder = pcEncTop->getEntropyCoder(); 80 112 m_pcCavlcCoder = pcEncTop->getCavlcCoder(); … … 82 114 m_pcBinCABAC = pcEncTop->getBinCABAC(); 83 115 m_pcTrQuant = pcEncTop->getTrQuant(); 84 116 85 117 m_pcBitCounter = pcEncTop->getBitCounter(); 86 118 m_pcRdCost = pcEncTop->getRdCost(); 87 119 m_pppcRDSbacCoder = pcEncTop->getRDSbacCoder(); 88 120 m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder(); 89 121 90 122 // create lambda and QP arrays 91 123 m_pdRdPicLambda = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 ); … … 111 143 Double dQP; 112 144 Double dLambda; 113 145 114 146 rpcSlice = pcPic->getSlice(0); 115 147 rpcSlice->setSliceBits(0); … … 117 149 rpcSlice->initSlice(); 118 150 rpcSlice->setPOC( pcPic->getPOC() ); 119 151 120 152 // slice type 121 153 SliceType eSliceType = pcPic->getSliceType() ; 122 154 rpcSlice->setSliceType ( eSliceType ); 123 155 124 156 // ------------------------------------------------------------------------------------------------------------------ 125 157 // Non-referenced frame marking 126 158 // ------------------------------------------------------------------------------------------------------------------ 127 159 128 160 rpcSlice->setReferenced(pcPic->getReferenced()) ; 129 161 130 162 // ------------------------------------------------------------------------------------------------------------------ 131 163 // QP setting … … 133 165 134 166 Double dOrigQP = double(pcPic->getQP()); 135 167 136 168 // ------------------------------------------------------------------------------------------------------------------ 137 169 // Lambda computation 138 170 // ------------------------------------------------------------------------------------------------------------------ 139 171 140 172 Int iQP; 141 173 … … 149 181 // compute QP value 150 182 dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1); 151 183 152 184 // compute lambda value 153 185 Int NumberBFrames = ( m_pcCfg->getRateGOPSize() - 1 ); … … 206 238 // if hadamard is used in ME process 207 239 if ( !m_pcCfg->getUseHADME() ) dLambda *= 0.95; 208 240 209 241 iQP = Max( MIN_QP, Min( MAX_QP, (Int)floor( dQP + 0.5 ) ) ); 210 242 211 243 m_pdRdPicLambda[iDQpIdx] = dLambda; 212 244 m_pdRdPicQp [iDQpIdx] = dQP; 213 245 m_piRdPicQp [iDQpIdx] = iQP; 214 246 } 215 247 216 248 // obtain dQP = 0 case 217 249 dLambda = m_pdRdPicLambda[0]; 218 250 dQP = m_pdRdPicQp [0]; 219 251 iQP = m_piRdPicQp [0]; 220 252 221 253 // store lambda 222 //GTVSO223 m_pcRdCost->setUseLambdaScaleVSO ( (m_pcCfg->getUseVSO() || m_pcCfg->getForceLambdaScaleVSO()) && m_pcCfg->isDepthCoder() ); 224 m_pcRdCost->setLambdaVSO( dLambda * m_pcCfg->getLambdaScaleVSO() ); 225 //GT VSO end 254 #if HHI_VSO 255 m_pcRdCost->setUseLambdaScaleVSO ( (m_pcCfg->getUseVSO() || m_pcCfg->getForceLambdaScaleVSO()) && m_pcCfg->isDepthCoder() ); 256 m_pcRdCost->setLambdaVSO( dLambda * m_pcCfg->getLambdaScaleVSO() ); 257 #endif 226 258 227 259 m_pcRdCost ->setLambda ( dLambda ); 228 260 m_pcTrQuant->setLambda ( dLambda ); 229 261 rpcSlice ->setLambda ( dLambda ); 262 #if HHI_INTER_VIEW_MOTION_PRED 230 263 m_pcRdCost ->setLambdaMVReg ( dLambda * m_pcCfg->getMultiviewMvRegLambdaScale() ); 231 264 #endif 265 232 266 //#if HB_LAMBDA_FOR_LDC 233 267 // // restore original slice type … … 237 271 // } 238 272 // eSliceType = (iPOCLast == 0 || uiPOCCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType; 239 // 273 // 240 274 // rpcSlice->setSliceType ( eSliceType ); 241 275 //#endif 242 276 243 277 rpcSlice->setSliceQp ( iQP ); 244 278 rpcSlice->setSliceQpDelta ( 0 ); 245 279 rpcSlice->setNumRefIdx ( REF_PIC_LIST_0, eSliceType == I_SLICE ? 0 : pcPic->getNumRefs(REF_PIC_LIST_0) ) ; 246 280 rpcSlice->setNumRefIdx ( REF_PIC_LIST_1, eSliceType == I_SLICE ? 0 : pcPic->getNumRefs(REF_PIC_LIST_1) ) ; 247 281 248 282 rpcSlice->setSymbolMode ( m_pcCfg->getSymbolMode()); 249 283 rpcSlice->setLoopFilterDisable( m_pcCfg->getLoopFilterDisable() ); 250 284 251 285 rpcSlice->setDepth ( 0 ); 252 286 rpcSlice->setViewIdx ( pcPic->getViewIdx() ); … … 256 290 assert( m_apcPicYuvPred ); 257 291 assert( m_apcPicYuvResi ); 258 292 259 293 pcPic->setPicYuvPred( m_apcPicYuvPred ); 260 294 pcPic->setPicYuvResi( m_apcPicYuvResi ); … … 277 311 Int iMaxSR = m_pcCfg->getSearchRange(); 278 312 Int iNumPredDir = pcSlice->isInterP() ? 1 : 2; 279 313 280 314 for (Int iDir = 0; iDir <= iNumPredDir; iDir++) 281 315 { … … 299 333 // if deltaQP RD is not used, simply return 300 334 if ( m_pcCfg->getDeltaQpRD() == 0 ) return; 301 335 302 336 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 303 337 Double dPicRdCostBest = MAX_DOUBLE; … … 306 340 UInt64 uiPicBitsBest; 307 341 UInt uiQpIdxBest = 0; 308 342 309 343 Double dFrameLambda; 310 344 #if FULL_NBIT … … 313 347 Int SHIFT_QP = 12; 314 348 #endif 315 349 316 350 // set frame lambda 317 351 if (m_pcCfg->getGOPSize() > 1) … … 324 358 } 325 359 m_pcRdCost ->setFrameLambda(dFrameLambda); 326 m_pcRdCost ->setFrameLambdaVSO( dFrameLambda * m_pcCfg->getLambdaScaleVSO() ); 327 360 #if HHI_VSO 361 m_pcRdCost ->setFrameLambdaVSO( dFrameLambda * m_pcCfg->getLambdaScaleVSO() ); 362 #endif 363 328 364 // for each QP candidate 329 365 for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ ) … … 333 369 m_pcTrQuant ->setLambda ( m_pdRdPicLambda[uiQpIdx] ); 334 370 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdx] ); 371 #if HHI_INTER_VIEW_MOTION_PRED 335 372 m_pcRdCost ->setLambdaMVReg ( m_pdRdPicLambda[uiQpIdx] * m_pcCfg->getMultiviewMvRegLambdaScale() ); 336 373 #endif 374 337 375 // try compress 338 376 compressSlice ( rpcPic ); 339 377 340 378 Double dPicRdCost; 341 379 UInt64 uiPicDist = m_uiPicDist; 342 380 UInt64 uiALFBits = 0; 343 381 344 382 m_pcPicEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits ); 345 383 346 384 // compute RD cost and choose the best 347 385 dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME); 348 386 349 387 if ( dPicRdCost < dPicRdCostBest ) 350 388 { … … 352 390 dPicRdCostBest = dPicRdCost; 353 391 dSumCURdCostBest = m_dPicRdCost; 354 392 355 393 uiPicBitsBest = m_uiPicTotalBits + uiALFBits; 356 394 uiPicDistBest = uiPicDist; 357 395 } 358 396 } 359 397 360 398 // set best values 361 399 pcSlice ->setSliceQp ( m_piRdPicQp [uiQpIdxBest] ); … … 363 401 m_pcTrQuant ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); 364 402 pcSlice ->setLambda ( m_pdRdPicLambda[uiQpIdxBest] ); 403 #if HHI_INTER_VIEW_MOTION_PRED 365 404 m_pcRdCost ->setLambdaMVReg ( m_pdRdPicLambda[uiQpIdxBest] * m_pcCfg->getMultiviewMvRegLambdaScale() ); 405 #endif 366 406 } 367 407 … … 377 417 TComSlice* pcSlice = rpcPic->getSlice(getSliceIdx()); 378 418 xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false ); 379 419 380 420 #ifdef WEIGHT_PRED 381 421 //------------------------------------------------------------------------------ … … 411 451 m_dPicRdCost = 0; 412 452 m_uiPicDist = 0; 413 453 414 454 // set entropy coder 415 455 if( m_pcCfg->getUseSBACRD() ) … … 430 470 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 431 471 } 432 472 433 473 // initialize ALF parameters 434 474 m_pcEntropyCoder->setAlfCtrl(false); 435 475 m_pcEntropyCoder->setMaxAlfCtrlDepth(0); //unnecessary 436 476 437 477 // for every CU in slice 438 478 for( uiCUAddr = uiStartCUAddr; uiCUAddr < uiBoundingCUAddr; uiCUAddr++ ) … … 443 483 TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr ); 444 484 pcCU->initCU( rpcPic, uiCUAddr ); 445 485 446 486 // if RD based on SBAC is used 447 487 if( m_pcCfg->getUseSBACRD() ) … … 450 490 m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice ); 451 491 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 452 492 453 493 // run CU encoder 454 494 m_pcCuEncoder->compressCU( pcCU ); 455 495 456 496 // restore entropy coder to an initial stage 457 497 m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice ); 458 498 m_pcEntropyCoder->setBitstream ( m_pcBitCounter ); 459 499 pppcRDSbacCoder->setBinCountingEnableFlag( true ); 460 500 461 501 m_pcCuEncoder->encodeCU( pcCU ); 462 502 … … 474 514 break; 475 515 } 476 516 477 517 UInt uiBinsCoded = pppcRDSbacCoder->getBinsCoded(); 478 518 if (m_pcCfg->getEntropySliceMode()==SHARP_MULTIPLE_CONSTRAINT_BASED_ENTROPY_SLICE && uiBinsCoded > m_pcCfg->getEntropySliceArgument()) … … 494 534 m_pcCavlcCoder ->setAdaptFlag(true); 495 535 m_pcCuEncoder->encodeCU( pcCU ); 496 536 497 537 uiBitsCoded += m_pcBitCounter->getNumberOfWrittenBits(); 498 538 if (m_pcCfg->getSliceMode()==AD_HOC_SLICES_FIXED_NUMBER_OF_BYTES_IN_SLICE && ( ( pcSlice->getSliceBits() + uiBitsCoded ) >> 3 ) > m_pcCfg->getSliceArgument()) … … 521 561 m_pcCavlcCoder ->setAdaptFlag(false); 522 562 } 523 563 524 564 m_uiPicTotalBits += pcCU->getTotalBits(); 525 565 m_dPicRdCost += pcCU->getTotalCost(); … … 556 596 m_pcEntropyCoder->resetEntropy(); 557 597 } 558 598 559 599 // set bitstream 560 600 m_pcEntropyCoder->setBitstream( rpcBitstream ); … … 588 628 #if ENC_DEC_TRACE 589 629 g_bJustDoIt = g_bEncDecTraceDisable; 590 #endif 630 #endif 591 631 } 592 632 } … … 603 643 UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame(); 604 644 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame; 605 if (bEncodeSlice) 645 if (bEncodeSlice) 606 646 { 607 647 UInt uiCUAddrIncrement; … … 620 660 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame; 621 661 break; 622 } 662 } 623 663 pcSlice->setSliceCurEndCUAddr( uiBoundingCUAddrSlice ); 624 664 } … … 636 676 uiBoundingCUAddrSlice = uiNumberOfCUsInFrame; 637 677 break; 638 } 678 } 639 679 pcSlice->setSliceCurEndCUAddr( uiBoundingCUAddrSlice ); 640 680 } … … 644 684 uiStartCUAddrEntropySlice = pcSlice->getEntropySliceCurStartCUAddr(); 645 685 uiBoundingCUAddrEntropySlice = uiNumberOfCUsInFrame; 646 if (bEncodeSlice) 686 if (bEncodeSlice) 647 687 { 648 688 UInt uiCUAddrIncrement; … … 661 701 uiBoundingCUAddrEntropySlice = uiNumberOfCUsInFrame; 662 702 break; 663 } 703 } 664 704 pcSlice->setEntropySliceCurEndCUAddr( uiBoundingCUAddrEntropySlice ); 665 705 } … … 677 717 uiBoundingCUAddrEntropySlice = uiNumberOfCUsInFrame; 678 718 break; 679 } 719 } 680 720 pcSlice->setEntropySliceCurEndCUAddr( uiBoundingCUAddrEntropySlice ); 681 721 } -
trunk/source/Lib/TLibEncoder/TEncSlice.h
r2 r5 1 /* The copyright in this software is being made available under the BSD 2 * License, included below. This software may be subject to other third party 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2011, ISO/IEC 7 * All rights reserved. 8 *