[5] | 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 | * |
---|
[1405] | 6 | * Copyright (c) 2010-2016, ITU/ISO/IEC |
---|
[5] | 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 | */ |
---|
[2] | 33 | |
---|
[608] | 34 | |
---|
[2] | 35 | #ifndef __TRENMODEL__ |
---|
| 36 | #define __TRENMODEL__ |
---|
| 37 | |
---|
| 38 | #include "TRenImage.h" |
---|
| 39 | #include "TRenSingleModel.h" |
---|
| 40 | #include "../TLibCommon/CommonDef.h" |
---|
| 41 | #include "../TLibCommon/TComPicYuv.h" |
---|
| 42 | #include "../TLibCommon/TypeDef.h" |
---|
| 43 | |
---|
[1313] | 44 | #if NH_3D_VSO |
---|
[608] | 45 | |
---|
[2] | 46 | class TRenModel |
---|
| 47 | { |
---|
| 48 | public: |
---|
| 49 | |
---|
| 50 | TRenModel(); |
---|
| 51 | ~TRenModel(); |
---|
| 52 | |
---|
| 53 | // Creation |
---|
[608] | 54 | #if H_3D_VSO_EARLY_SKIP |
---|
[1396] | 55 | Void create ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bLimOutput, Bool bEarlySkip ); |
---|
[100] | 56 | #else |
---|
[1396] | 57 | Void create ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bLimOutput ); |
---|
[100] | 58 | #endif |
---|
[2] | 59 | Void createSingleModel( Int iBaseViewNum, Int iContent, Int iModelNum, Int iLeftViewNum, Int iRightViewNum, Bool bUseOrgRef, Int iBlendMode ); |
---|
| 60 | |
---|
| 61 | // Set new Frame |
---|
| 62 | Void setBaseView ( Int iViewNum, TComPicYuv* pcPicYuvVideoData, TComPicYuv* pcPicYuvDepthData, TComPicYuv* pcPicYuvOrgVideoData, TComPicYuv* pcPicYuvOrgDepthData ); |
---|
[1396] | 63 | Void setSingleModel ( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView, Int curViewIdx = VIEWPOS_INVALID ); |
---|
[2] | 64 | |
---|
[100] | 65 | // Set horizontal offset |
---|
[124] | 66 | Void setupPart ( UInt uiHorOff, Int iUsedHeight ); |
---|
[100] | 67 | |
---|
[2] | 68 | // Set Mode |
---|
[124] | 69 | Void setErrorMode ( Int iView, Int iContent, Int iPlane ); |
---|
[2] | 70 | |
---|
| 71 | // Get Distortion, set Data |
---|
[608] | 72 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 73 | Int64 getDist ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride); |
---|
| 74 | #else |
---|
[2] | 75 | Int64 getDist ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ); |
---|
[100] | 76 | #endif |
---|
[1313] | 77 | Void setData ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ); |
---|
[2] | 78 | |
---|
| 79 | // Get Rendered View |
---|
| 80 | |
---|
[100] | 81 | Void getSynthVideo ( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuvSynthVideo ); |
---|
| 82 | Void getSynthDepth ( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuvSynthDepth ); |
---|
| 83 | |
---|
[2] | 84 | // Get Total Distortion |
---|
| 85 | Void getTotalSSE (Int64& riSSEY, Int64& riSSEU, Int64& riSSEV ); |
---|
| 86 | |
---|
| 87 | private: |
---|
| 88 | // helpers |
---|
| 89 | Void xSetLRViewAndAddModel( Int iModelNum, Int iBaseViewNum, Int iContent, Int iViewPos, Bool bAdd ); |
---|
| 90 | |
---|
| 91 | // Settings |
---|
| 92 | Int m_iShiftPrec; |
---|
| 93 | Int** m_aaaiSubPelShiftLut[2]; |
---|
| 94 | Int m_iHoleMargin; |
---|
[608] | 95 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 96 | Bool m_bEarlySkip; |
---|
| 97 | #endif |
---|
[1396] | 98 | Bool m_bLimOutput; |
---|
[2] | 99 | |
---|
| 100 | /// Size of Video and Depth |
---|
| 101 | Int m_iWidth; |
---|
| 102 | Int m_iHeight; |
---|
| 103 | Int m_iSampledWidth; |
---|
| 104 | Int m_iPad; |
---|
[124] | 105 | Int m_iUsedHeight; // height currently used in buffer, whereas m_iHeight is the total height of the buffer |
---|
[2] | 106 | |
---|
[124] | 107 | |
---|
[2] | 108 | Int m_iNumOfBaseViews; |
---|
| 109 | |
---|
[100] | 110 | // Horizontal Offset in input data |
---|
| 111 | UInt m_uiHorOff; |
---|
| 112 | |
---|
[2] | 113 | /// Current Error Type /// |
---|
| 114 | Int m_iCurrentView; |
---|
| 115 | Int m_iCurrentContent; |
---|
| 116 | Int m_iCurrentPlane; |
---|
| 117 | |
---|
| 118 | /// Array of Models used to determine the Current Error /// |
---|
| 119 | Int m_iNumOfCurRenModels; |
---|
| 120 | TRenSingleModel** m_apcCurRenModels; // Array of pointers used for determination of current error |
---|
| 121 | Int* m_aiCurPosInModels; // Position of Current View in Model |
---|
| 122 | |
---|
| 123 | /// Array of Models /// |
---|
| 124 | Int m_iNumOfRenModels; |
---|
| 125 | TRenSingleModel** m_apcRenModels; // Array of pointers to all created models |
---|
| 126 | |
---|
| 127 | /// Mapping from View number and Content type to models /// |
---|
| 128 | Int* m_aiNumOfModelsForDepthView; |
---|
| 129 | TRenSingleModel*** m_aapcRenModelForDepthView; // Dim1: ViewNumber |
---|
| 130 | Int** m_aaePosInModelForDepthView; // Position in Model ( Left or Right) |
---|
| 131 | |
---|
| 132 | Int* m_aiNumOfModelsForVideoView; |
---|
| 133 | TRenSingleModel*** m_aapcRenModelForVideoView; // Dim1: ViewNumber |
---|
| 134 | Int** m_aaePosInModelForVideoView; // Position in Model ( Left or Right) (local model numbering) |
---|
| 135 | |
---|
| 136 | /// Position of Base Views in Models ( global model numbering ) |
---|
| 137 | Int** m_aaeBaseViewPosInModel; |
---|
| 138 | |
---|
| 139 | /// Current Setup data /// |
---|
| 140 | Bool* m_abSetupVideoFromOrgForView; //: Dim1: ViewNumber, 0 ... use org; 1 ... use coded; 2; use org ref and coded in RDO |
---|
| 141 | Bool* m_abSetupDepthFromOrgForView; |
---|
| 142 | |
---|
| 143 | /// DATA // |
---|
| 144 | // Cur |
---|
| 145 | |
---|
| 146 | /// Number of Base Views |
---|
| 147 | Pel*** m_aapiCurVideoPel ; // Dim1: ViewNumber: Plane 0-> Y, 1->U, 2->V |
---|
| 148 | Int** m_aaiCurVideoStrides; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane 0-> Y, 1->U, 2->V |
---|
| 149 | |
---|
| 150 | Pel** m_apiCurDepthPel ; // Dim1: ViewPosition |
---|
| 151 | Int* m_aiCurDepthStrides ; // Dim1: ViewPosition |
---|
| 152 | |
---|
| 153 | Pel*** m_aapiOrgVideoPel ; // Dim1: ViewPosition Dim2: Plane 0-> Y, 1->U, 2->V |
---|
| 154 | Int** m_aaiOrgVideoStrides; // Dim1: ViewPosition Dim2: Plane 0-> Y, 1->U, 2->V |
---|
| 155 | |
---|
| 156 | Pel** m_apiOrgDepthPel ; // Dim1: ViewPosition |
---|
| 157 | Int* m_aiOrgDepthStrides ; // Dim1: ViewPosition |
---|
| 158 | }; |
---|
| 159 | |
---|
[1313] | 160 | #endif // NH_3D |
---|
[2] | 161 | #endif //__TRENMODEL__ |
---|
[210] | 162 | |
---|