[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 | |
---|
| 34 | #include "TRenImage.h" |
---|
| 35 | #include "TRenFilter.h" |
---|
| 36 | #include "TRenModel.h" |
---|
[608] | 37 | |
---|
[1313] | 38 | #if NH_3D_VSO |
---|
[2] | 39 | /////////// TRENMODEL ////////////////////// |
---|
| 40 | TRenModel::TRenModel() |
---|
| 41 | { |
---|
[56] | 42 | m_iPad = PICYUV_PAD; |
---|
[2] | 43 | m_iWidth = -1; |
---|
| 44 | m_iHeight = -1; |
---|
[124] | 45 | m_iUsedHeight = -1; |
---|
[2] | 46 | m_iNumOfBaseViews = -1; |
---|
| 47 | m_iSampledWidth = -1; |
---|
| 48 | m_iShiftPrec = 0; |
---|
| 49 | m_iHoleMargin = 1; |
---|
[100] | 50 | m_uiHorOff = -1; |
---|
[608] | 51 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 52 | m_bEarlySkip = false; |
---|
| 53 | #endif |
---|
[2] | 54 | |
---|
| 55 | // Current Error Type /// |
---|
| 56 | m_iCurrentView = -1; |
---|
| 57 | m_iCurrentContent = -1; |
---|
| 58 | m_iCurrentPlane = -1; |
---|
| 59 | |
---|
| 60 | // Array of Models used to determine the Current Error /// |
---|
| 61 | m_iNumOfCurRenModels = -1; |
---|
| 62 | m_apcCurRenModels = NULL; |
---|
| 63 | m_aiCurPosInModels = NULL; |
---|
| 64 | |
---|
| 65 | // Array of Models /// |
---|
| 66 | m_iNumOfRenModels = -1; |
---|
| 67 | m_apcRenModels = NULL; |
---|
| 68 | |
---|
| 69 | // Mapping from View number to models /// |
---|
| 70 | m_aiNumOfModelsForDepthView = NULL; |
---|
| 71 | m_aapcRenModelForDepthView = NULL; |
---|
| 72 | m_aaePosInModelForDepthView = NULL; |
---|
| 73 | |
---|
| 74 | m_aiNumOfModelsForVideoView = NULL; |
---|
| 75 | m_aapcRenModelForVideoView = NULL; |
---|
| 76 | m_aaePosInModelForVideoView = NULL; |
---|
| 77 | m_aaeBaseViewPosInModel = NULL; |
---|
| 78 | |
---|
| 79 | // Data |
---|
| 80 | m_aapiCurVideoPel = NULL; |
---|
| 81 | m_aaiCurVideoStrides = NULL; |
---|
| 82 | m_apiCurDepthPel = NULL; |
---|
| 83 | m_aiCurDepthStrides = NULL; |
---|
| 84 | |
---|
| 85 | m_aapiOrgVideoPel = NULL; |
---|
| 86 | m_aaiOrgVideoStrides = NULL; |
---|
| 87 | m_apiOrgDepthPel = NULL; |
---|
| 88 | m_aiOrgDepthStrides = NULL; |
---|
| 89 | |
---|
| 90 | m_aaaiSubPelShiftLut[0]= NULL; |
---|
| 91 | m_aaaiSubPelShiftLut[1]= NULL; |
---|
| 92 | |
---|
| 93 | /// Current Setup data /// |
---|
| 94 | m_abSetupVideoFromOrgForView = NULL; |
---|
| 95 | m_abSetupDepthFromOrgForView = NULL; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | TRenModel::~TRenModel() |
---|
| 99 | { |
---|
| 100 | if ( m_apcRenModels ) |
---|
| 101 | { |
---|
| 102 | for (Int iNumModel = 0; iNumModel < m_iNumOfRenModels; iNumModel++) |
---|
| 103 | { |
---|
| 104 | if ( m_apcRenModels[iNumModel] ) delete m_apcRenModels[iNumModel]; |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | delete[] m_apcRenModels; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | for (Int iViewNum = 0; iViewNum < m_iNumOfBaseViews; iViewNum++) |
---|
| 111 | { |
---|
| 112 | if ( m_aapcRenModelForDepthView && m_aapcRenModelForDepthView [iViewNum] ) |
---|
| 113 | { |
---|
| 114 | delete[] m_aapcRenModelForDepthView [iViewNum]; |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | if ( m_aaePosInModelForDepthView && m_aaePosInModelForDepthView[iViewNum] ) |
---|
| 118 | { |
---|
| 119 | delete[] m_aaePosInModelForDepthView[iViewNum]; |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | if ( m_aapcRenModelForVideoView && m_aapcRenModelForVideoView[iViewNum] ) |
---|
| 123 | { |
---|
| 124 | delete[] m_aapcRenModelForVideoView[iViewNum]; |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | if ( m_aaePosInModelForVideoView && m_aaePosInModelForVideoView[iViewNum] ) |
---|
| 128 | { |
---|
| 129 | delete[] m_aaePosInModelForVideoView[iViewNum]; |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | if ( m_aaeBaseViewPosInModel && m_aaeBaseViewPosInModel[iViewNum] ) |
---|
| 133 | { |
---|
| 134 | delete[] m_aaeBaseViewPosInModel[iViewNum]; |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | if ( m_aapiCurVideoPel && m_aapiCurVideoPel [iViewNum] ) |
---|
| 138 | { |
---|
| 139 | delete[] ( m_aapiCurVideoPel [iViewNum][0] - m_iPad * m_aaiCurVideoStrides[iViewNum][0] - m_iPad ); |
---|
| 140 | delete[] ( m_aapiCurVideoPel [iViewNum][1] - m_iPad * m_aaiCurVideoStrides[iViewNum][1] - m_iPad ); |
---|
| 141 | delete[] ( m_aapiCurVideoPel [iViewNum][2] - m_iPad * m_aaiCurVideoStrides[iViewNum][2] - m_iPad ); |
---|
| 142 | delete[] m_aapiCurVideoPel [iViewNum]; |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | if ( m_aaiCurVideoStrides && m_aaiCurVideoStrides [iViewNum] ) |
---|
| 146 | { |
---|
| 147 | delete[] m_aaiCurVideoStrides [iViewNum]; |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | if ( m_apiCurDepthPel ) |
---|
| 151 | { |
---|
| 152 | delete[] ( m_apiCurDepthPel [iViewNum] - m_iPad * m_aiCurDepthStrides [iViewNum] - m_iPad ); |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | if ( m_aapiOrgVideoPel && m_aapiOrgVideoPel [iViewNum] ) |
---|
| 156 | { |
---|
| 157 | delete[] ( m_aapiOrgVideoPel [iViewNum][0] - m_iPad * m_aaiOrgVideoStrides[iViewNum][0] - m_iPad ); |
---|
| 158 | delete[] ( m_aapiOrgVideoPel [iViewNum][1] - m_iPad * m_aaiOrgVideoStrides[iViewNum][1] - m_iPad ); |
---|
| 159 | delete[] ( m_aapiOrgVideoPel [iViewNum][2] - m_iPad * m_aaiOrgVideoStrides[iViewNum][2] - m_iPad ); |
---|
| 160 | delete[] m_aapiOrgVideoPel [iViewNum]; |
---|
| 161 | } |
---|
| 162 | |
---|
| 163 | if ( m_aaiOrgVideoStrides && m_aaiOrgVideoStrides [iViewNum] ) |
---|
| 164 | { |
---|
| 165 | delete[] m_aaiOrgVideoStrides [iViewNum]; |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | if ( m_apiOrgDepthPel && m_apiOrgDepthPel [iViewNum ] ) |
---|
| 169 | { |
---|
| 170 | delete[] ( m_apiOrgDepthPel [iViewNum] - m_iPad * m_aiOrgDepthStrides [iViewNum] - m_iPad ); |
---|
| 171 | } |
---|
| 172 | } |
---|
| 173 | |
---|
| 174 | if(m_aiNumOfModelsForDepthView) delete[] m_aiNumOfModelsForDepthView; |
---|
| 175 | if(m_aapcRenModelForDepthView ) delete[] m_aapcRenModelForDepthView ; |
---|
| 176 | if(m_aaePosInModelForDepthView) delete[] m_aaePosInModelForDepthView; |
---|
| 177 | |
---|
| 178 | if(m_aiNumOfModelsForVideoView) delete[] m_aiNumOfModelsForVideoView; |
---|
| 179 | if(m_aapcRenModelForVideoView ) delete[] m_aapcRenModelForVideoView ; |
---|
| 180 | if(m_aaePosInModelForVideoView) delete[] m_aaePosInModelForVideoView; |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | if(m_aaeBaseViewPosInModel ) delete[] m_aaeBaseViewPosInModel ; |
---|
| 184 | if(m_aapiCurVideoPel ) delete[] m_aapiCurVideoPel ; |
---|
| 185 | if(m_aaiCurVideoStrides ) delete[] m_aaiCurVideoStrides ; |
---|
| 186 | |
---|
| 187 | if(m_abSetupVideoFromOrgForView) delete[] m_abSetupVideoFromOrgForView; |
---|
| 188 | if(m_abSetupDepthFromOrgForView) delete[] m_abSetupDepthFromOrgForView; |
---|
| 189 | |
---|
| 190 | if(m_aapiOrgVideoPel ) delete[] m_aapiOrgVideoPel ; |
---|
| 191 | if(m_aaiOrgVideoStrides ) delete[] m_aaiOrgVideoStrides ; |
---|
| 192 | |
---|
| 193 | if(m_apiOrgDepthPel ) delete[] m_apiOrgDepthPel ; |
---|
| 194 | if(m_aiOrgDepthStrides ) delete[] m_aiOrgDepthStrides ; |
---|
| 195 | |
---|
| 196 | if(m_apiCurDepthPel ) delete[] m_apiCurDepthPel ; |
---|
| 197 | if(m_aiCurDepthStrides ) delete[] m_aiCurDepthStrides ; |
---|
| 198 | |
---|
| 199 | Int iNumEntries = (1 << ( m_iShiftPrec + 1) ) + 1 ; |
---|
| 200 | |
---|
| 201 | for (UInt uiEntry = 0; uiEntry < iNumEntries; uiEntry++) |
---|
| 202 | { |
---|
| 203 | if ( m_aaaiSubPelShiftLut[0] && m_aaaiSubPelShiftLut[0][uiEntry] ) |
---|
| 204 | delete[] m_aaaiSubPelShiftLut[0][uiEntry]; |
---|
| 205 | |
---|
| 206 | if ( m_aaaiSubPelShiftLut[1] && m_aaaiSubPelShiftLut[1][uiEntry] ) |
---|
| 207 | delete[] m_aaaiSubPelShiftLut[1][uiEntry]; |
---|
| 208 | } |
---|
| 209 | |
---|
| 210 | if( m_aaaiSubPelShiftLut[0] ) delete[] m_aaaiSubPelShiftLut[0]; |
---|
| 211 | if( m_aaaiSubPelShiftLut[1] ) delete[] m_aaaiSubPelShiftLut[1]; |
---|
| 212 | } |
---|
| 213 | |
---|
| 214 | |
---|
| 215 | |
---|
| 216 | Void |
---|
[608] | 217 | #if H_3D_VSO_EARLY_SKIP |
---|
[1396] | 218 | TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bLimOutput, Bool bEarlySkip ) |
---|
[100] | 219 | #else |
---|
[1396] | 220 | TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bLimOutput ) |
---|
[100] | 221 | #endif |
---|
[2] | 222 | { |
---|
[1396] | 223 | m_bLimOutput = bLimOutput; |
---|
| 224 | |
---|
[2] | 225 | m_iNumOfBaseViews = iNumOfBaseViews; |
---|
| 226 | m_iNumOfRenModels = iNumOfModels; |
---|
| 227 | m_iWidth = iWidth; |
---|
| 228 | m_iHeight = iHeight; |
---|
| 229 | m_iShiftPrec = iShiftPrec; |
---|
| 230 | m_iHoleMargin = iHoleMargin; |
---|
[608] | 231 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 232 | m_bEarlySkip = bEarlySkip; |
---|
| 233 | #endif |
---|
[2] | 234 | |
---|
[100] | 235 | |
---|
[2] | 236 | // LUTs for sub pel shifting |
---|
| 237 | Int iNumEntries = (1 << ( m_iShiftPrec + 1) ) + 1 ; |
---|
| 238 | m_aaaiSubPelShiftLut[0] = new Int*[ iNumEntries ]; |
---|
| 239 | m_aaaiSubPelShiftLut[1] = new Int*[ iNumEntries ]; |
---|
| 240 | for (UInt uiEntry = 0; uiEntry < iNumEntries; uiEntry++) |
---|
| 241 | { |
---|
| 242 | m_aaaiSubPelShiftLut[0][uiEntry] = new Int[ iNumEntries ]; |
---|
| 243 | m_aaaiSubPelShiftLut[1][uiEntry] = new Int[ iNumEntries ]; |
---|
| 244 | } |
---|
| 245 | |
---|
[1313] | 246 | TRenFilter<REN_BIT_DEPTH>::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[0], 0 ); |
---|
| 247 | TRenFilter<REN_BIT_DEPTH>::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[1], 0 ); |
---|
[2] | 248 | |
---|
| 249 | m_iSampledWidth = iWidth << m_iShiftPrec; |
---|
| 250 | |
---|
| 251 | |
---|
| 252 | m_aapiCurVideoPel = new Pel** [m_iNumOfBaseViews]; |
---|
| 253 | m_aaiCurVideoStrides = new Int* [m_iNumOfBaseViews]; |
---|
| 254 | m_apiCurDepthPel = new Pel* [m_iNumOfBaseViews]; |
---|
| 255 | m_aiCurDepthStrides = new Int [m_iNumOfBaseViews]; |
---|
| 256 | |
---|
| 257 | m_aapiOrgVideoPel = new Pel** [m_iNumOfBaseViews]; |
---|
| 258 | m_aaiOrgVideoStrides = new Int* [m_iNumOfBaseViews]; |
---|
| 259 | |
---|
| 260 | m_apiOrgDepthPel = new Pel* [m_iNumOfBaseViews]; |
---|
| 261 | m_aiOrgDepthStrides = new Int [m_iNumOfBaseViews]; |
---|
| 262 | |
---|
| 263 | m_abSetupVideoFromOrgForView = new Bool[m_iNumOfBaseViews]; |
---|
| 264 | m_abSetupDepthFromOrgForView = new Bool[m_iNumOfBaseViews]; |
---|
| 265 | |
---|
| 266 | m_iNumOfCurRenModels = 0; |
---|
| 267 | m_apcCurRenModels = NULL; |
---|
| 268 | m_aiCurPosInModels = NULL; |
---|
| 269 | |
---|
| 270 | m_apcRenModels = new TRenSingleModel* [m_iNumOfRenModels]; |
---|
| 271 | |
---|
| 272 | m_aiNumOfModelsForDepthView = new Int [m_iNumOfBaseViews]; |
---|
| 273 | m_aapcRenModelForDepthView = new TRenSingleModel** [m_iNumOfBaseViews]; |
---|
| 274 | m_aaePosInModelForDepthView = new Int* [m_iNumOfBaseViews]; |
---|
| 275 | |
---|
| 276 | m_aiNumOfModelsForVideoView = new Int [m_iNumOfBaseViews]; |
---|
| 277 | m_aapcRenModelForVideoView = new TRenSingleModel** [m_iNumOfBaseViews]; |
---|
| 278 | m_aaePosInModelForVideoView = new Int* [m_iNumOfBaseViews]; |
---|
| 279 | m_aaeBaseViewPosInModel = new Int* [m_iNumOfBaseViews]; |
---|
| 280 | |
---|
| 281 | |
---|
| 282 | for (Int iModelNum = 0; iModelNum < m_iNumOfRenModels; iModelNum++) |
---|
| 283 | { |
---|
[100] | 284 | m_apcRenModels [iModelNum] = NULL; |
---|
[2] | 285 | } |
---|
| 286 | |
---|
| 287 | for (Int iViewNum = 0; iViewNum < m_iNumOfBaseViews; iViewNum++ ) |
---|
| 288 | { |
---|
| 289 | m_aiNumOfModelsForDepthView[ iViewNum ] = 0; |
---|
| 290 | m_aiNumOfModelsForVideoView[ iViewNum ] = 0; |
---|
| 291 | |
---|
| 292 | m_aapcRenModelForDepthView [iViewNum] = new TRenSingleModel*[m_iNumOfRenModels]; |
---|
| 293 | m_aapcRenModelForVideoView [iViewNum] = new TRenSingleModel*[m_iNumOfRenModels]; |
---|
| 294 | |
---|
| 295 | m_aaePosInModelForDepthView[iViewNum] = new Int [m_iNumOfRenModels]; |
---|
| 296 | m_aaePosInModelForVideoView[iViewNum] = new Int [m_iNumOfRenModels]; |
---|
| 297 | m_aaeBaseViewPosInModel [iViewNum] = new Int [m_iNumOfRenModels]; |
---|
| 298 | |
---|
| 299 | for (Int iModelNum = 0; iModelNum< m_iNumOfRenModels; iModelNum++) |
---|
| 300 | { |
---|
| 301 | m_aapcRenModelForDepthView [iViewNum] [iModelNum] = NULL; |
---|
| 302 | m_aapcRenModelForVideoView [iViewNum] [iModelNum] = NULL; |
---|
| 303 | m_aaePosInModelForDepthView[iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
| 304 | m_aaePosInModelForVideoView[iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
| 305 | m_aaeBaseViewPosInModel [iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
| 306 | }; |
---|
| 307 | |
---|
| 308 | m_aaiCurVideoStrides [iViewNum] = new Int[3]; |
---|
| 309 | m_aaiCurVideoStrides [iViewNum][0] = m_iSampledWidth + (m_iPad << 1); |
---|
| 310 | m_aaiCurVideoStrides [iViewNum][1] = m_iSampledWidth + (m_iPad << 1); |
---|
| 311 | m_aaiCurVideoStrides [iViewNum][2] = m_iSampledWidth + (m_iPad << 1); |
---|
| 312 | |
---|
| 313 | m_aapiCurVideoPel [iViewNum] = new Pel*[3]; |
---|
| 314 | m_aapiCurVideoPel [iViewNum][0] = new Pel [ m_aaiCurVideoStrides[iViewNum][0] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 315 | m_aapiCurVideoPel [iViewNum][1] = new Pel [ m_aaiCurVideoStrides[iViewNum][1] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 316 | m_aapiCurVideoPel [iViewNum][2] = new Pel [ m_aaiCurVideoStrides[iViewNum][2] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 317 | |
---|
| 318 | m_aapiCurVideoPel [iViewNum][0] += m_aaiCurVideoStrides[iViewNum][0] * m_iPad + m_iPad; |
---|
| 319 | m_aapiCurVideoPel [iViewNum][1] += m_aaiCurVideoStrides[iViewNum][1] * m_iPad + m_iPad; |
---|
| 320 | m_aapiCurVideoPel [iViewNum][2] += m_aaiCurVideoStrides[iViewNum][2] * m_iPad + m_iPad; |
---|
| 321 | |
---|
| 322 | m_aiCurDepthStrides [iViewNum] = m_iWidth + (m_iPad << 1); |
---|
| 323 | m_apiCurDepthPel [iViewNum] = new Pel[ m_aiCurDepthStrides[iViewNum] * ( m_iHeight + (m_iPad << 1) ) ]; |
---|
| 324 | m_apiCurDepthPel [iViewNum] += m_aiCurDepthStrides[iViewNum] * m_iPad + m_iPad; |
---|
| 325 | |
---|
| 326 | m_aaiOrgVideoStrides [iViewNum] = new Int[3]; |
---|
| 327 | m_aaiOrgVideoStrides [iViewNum][0] = m_iSampledWidth + (m_iPad << 1); |
---|
| 328 | m_aaiOrgVideoStrides [iViewNum][1] = m_iSampledWidth + (m_iPad << 1); |
---|
| 329 | m_aaiOrgVideoStrides [iViewNum][2] = m_iSampledWidth + (m_iPad << 1); |
---|
| 330 | |
---|
| 331 | m_aapiOrgVideoPel [iViewNum] = new Pel*[3]; |
---|
| 332 | m_aapiOrgVideoPel [iViewNum][0] = new Pel [ m_aaiOrgVideoStrides[iViewNum][0] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 333 | m_aapiOrgVideoPel [iViewNum][1] = new Pel [ m_aaiOrgVideoStrides[iViewNum][1] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 334 | m_aapiOrgVideoPel [iViewNum][2] = new Pel [ m_aaiOrgVideoStrides[iViewNum][2] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 335 | |
---|
| 336 | m_aapiOrgVideoPel [iViewNum][0] += m_aaiOrgVideoStrides[iViewNum][0] * m_iPad + m_iPad; |
---|
| 337 | m_aapiOrgVideoPel [iViewNum][1] += m_aaiOrgVideoStrides[iViewNum][1] * m_iPad + m_iPad; |
---|
| 338 | m_aapiOrgVideoPel [iViewNum][2] += m_aaiOrgVideoStrides[iViewNum][2] * m_iPad + m_iPad; |
---|
| 339 | |
---|
| 340 | m_aiOrgDepthStrides [iViewNum] = m_iWidth + (m_iPad << 1); |
---|
| 341 | m_apiOrgDepthPel [iViewNum] = new Pel[ m_aiOrgDepthStrides[iViewNum] * ( m_iHeight + (m_iPad << 1) ) ]; |
---|
| 342 | m_apiOrgDepthPel [iViewNum] += m_aiOrgDepthStrides[iViewNum] * m_iPad + m_iPad; |
---|
| 343 | |
---|
| 344 | m_abSetupVideoFromOrgForView[iViewNum] = false; |
---|
| 345 | m_abSetupDepthFromOrgForView[iViewNum] = false; |
---|
| 346 | } |
---|
| 347 | } |
---|
| 348 | |
---|
| 349 | Void |
---|
| 350 | TRenModel::createSingleModel( Int iBaseViewNum, Int iContent, Int iModelNum, Int iLeftViewNum, Int iRightViewNum, Bool bUseOrgRef, Int iBlendMode ) |
---|
| 351 | { |
---|
| 352 | Int iMode = ( (iLeftViewNum != -1) && ( iRightViewNum != -1 ) ) ? 2 : ( iLeftViewNum != -1 ? 0 : ( iRightViewNum != -1 ? 1 : -1 ) ); |
---|
| 353 | |
---|
| 354 | AOT( iMode == -1); |
---|
[100] | 355 | AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); |
---|
[2] | 356 | AOT( iLeftViewNum < -1 || iLeftViewNum > m_iNumOfBaseViews ); |
---|
| 357 | AOT( iRightViewNum < -1 || iRightViewNum > m_iNumOfBaseViews ); |
---|
| 358 | AOT( iBaseViewNum < -1 || iBaseViewNum > m_iNumOfBaseViews ); |
---|
| 359 | AOT( iBaseViewNum != -1 && iBaseViewNum != iLeftViewNum && iBaseViewNum != iRightViewNum ); |
---|
| 360 | AOT( iContent < -1 || iContent > 1 ); |
---|
[1313] | 361 | AOT( iBlendMode < -1 || iBlendMode > 2 ); |
---|
[2] | 362 | |
---|
[1313] | 363 | Bool bBitInc = ( REN_BIT_DEPTH != ENC_INTERNAL_BIT_DEPTH ); |
---|
[100] | 364 | |
---|
| 365 | AOT( m_apcRenModels[iModelNum] ); |
---|
| 366 | |
---|
| 367 | if ( bBitInc ) |
---|
| 368 | { |
---|
| 369 | if ( iMode != 2 ) |
---|
| 370 | { // No Blending |
---|
| 371 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, true>; |
---|
| 372 | } |
---|
| 373 | else |
---|
| 374 | { |
---|
| 375 | switch ( iBlendMode ) |
---|
| 376 | { |
---|
| 377 | case BLEND_AVRG: // average |
---|
| 378 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, true>; |
---|
| 379 | break; |
---|
| 380 | case BLEND_LEFT: // left view is main view |
---|
| 381 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, true>; |
---|
| 382 | break; |
---|
| 383 | case BLEND_RIGHT: // right view is main view |
---|
| 384 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, true>; |
---|
| 385 | break; |
---|
| 386 | default: |
---|
| 387 | AOT(true); |
---|
| 388 | break; |
---|
| 389 | } |
---|
| 390 | } |
---|
| 391 | } |
---|
| 392 | else |
---|
| 393 | { |
---|
| 394 | if ( iMode != 2 ) |
---|
| 395 | { // No Blending |
---|
| 396 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, false>; |
---|
| 397 | } |
---|
| 398 | else |
---|
| 399 | { |
---|
| 400 | switch ( iBlendMode ) |
---|
| 401 | { |
---|
| 402 | case BLEND_AVRG: // average |
---|
| 403 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, false>; |
---|
| 404 | break; |
---|
| 405 | case BLEND_LEFT: // left view is main view |
---|
| 406 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, false>; |
---|
| 407 | break; |
---|
| 408 | case BLEND_RIGHT: // right view is main view |
---|
| 409 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, false>; |
---|
| 410 | break; |
---|
| 411 | default: |
---|
| 412 | AOT(true); |
---|
| 413 | break; |
---|
| 414 | } |
---|
| 415 | } |
---|
| 416 | } |
---|
| 417 | |
---|
| 418 | |
---|
[608] | 419 | #if H_3D_VSO_EARLY_SKIP |
---|
[1396] | 420 | m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, ( iMode != 2 ) ? BLEND_NONE : iBlendMode , m_bLimOutput, m_bEarlySkip ); |
---|
[2] | 421 | |
---|
[1396] | 422 | #else |
---|
| 423 | m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, ( iMode != 2 ) ? BLEND_NONE : iBlendMode, m_bLimOutput ); |
---|
| 424 | #endif |
---|
| 425 | |
---|
[2] | 426 | if ( iLeftViewNum != -1 ) |
---|
| 427 | { |
---|
| 428 | xSetLRViewAndAddModel( iModelNum, iLeftViewNum, iContent, VIEWPOS_LEFT, (iBaseViewNum == -1 || iBaseViewNum == iLeftViewNum ) ); |
---|
| 429 | } |
---|
| 430 | |
---|
| 431 | if ( iRightViewNum != -1) |
---|
| 432 | { |
---|
| 433 | xSetLRViewAndAddModel( iModelNum, iRightViewNum, iContent, VIEWPOS_RIGHT, (iBaseViewNum == -1 || iBaseViewNum == iRightViewNum ) ); |
---|
| 434 | } |
---|
| 435 | } |
---|
| 436 | |
---|
| 437 | Void |
---|
| 438 | TRenModel::setBaseView( Int iViewNum, TComPicYuv* pcPicYuvVideoData, TComPicYuv* pcPicYuvDepthData, TComPicYuv* pcPicYuvOrgVideoData, TComPicYuv* pcPicYuvOrgDepthData ) |
---|
| 439 | { |
---|
| 440 | AOT( iViewNum < 0 || iViewNum > m_iNumOfBaseViews ); |
---|
[1313] | 441 | AOF( pcPicYuvVideoData->getHeight( COMPONENT_Y ) >= m_iUsedHeight + m_uiHorOff && pcPicYuvVideoData->getWidth( COMPONENT_Y ) == m_iWidth ); |
---|
| 442 | AOF( pcPicYuvDepthData->getHeight( COMPONENT_Y ) >= m_iUsedHeight + m_uiHorOff && pcPicYuvDepthData->getWidth( COMPONENT_Y ) == m_iWidth ); |
---|
| 443 | |
---|
| 444 | AOF( pcPicYuvVideoData ->getChromaFormat() == CHROMA_420 ); |
---|
| 445 | |
---|
[2] | 446 | pcPicYuvVideoData->extendPicBorder(); |
---|
| 447 | |
---|
[1313] | 448 | TRenFilter<REN_BIT_DEPTH>::sampleHorUp ( m_iShiftPrec, pcPicYuvVideoData->getAddr( COMPONENT_Y ) + m_uiHorOff * pcPicYuvVideoData->getStride( COMPONENT_Y ) , pcPicYuvVideoData->getStride( COMPONENT_Y ) , m_iWidth, m_iUsedHeight, m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] ); |
---|
| 449 | TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getAddr( COMPONENT_Cb ) + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getStride( COMPONENT_Cb) , pcPicYuvVideoData->getStride( COMPONENT_Cb ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] ); |
---|
| 450 | TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getAddr( COMPONENT_Cr ) + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getStride( COMPONENT_Cr) , pcPicYuvVideoData->getStride( COMPONENT_Cr ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] ); |
---|
| 451 | TRenFilter<REN_BIT_DEPTH>::copy ( pcPicYuvDepthData->getAddr( COMPONENT_Y ) + m_uiHorOff * pcPicYuvDepthData->getStride( COMPONENT_Y ) , pcPicYuvDepthData->getStride( COMPONENT_Y ), m_iWidth, m_iUsedHeight, m_apiCurDepthPel [ iViewNum], m_aiCurDepthStrides [iViewNum] ); |
---|
[100] | 452 | |
---|
[2] | 453 | // Used for rendering reference pic from original video data |
---|
| 454 | m_abSetupVideoFromOrgForView[iViewNum] = (pcPicYuvOrgVideoData != NULL); |
---|
| 455 | m_abSetupDepthFromOrgForView[iViewNum] = (pcPicYuvOrgDepthData != NULL); |
---|
| 456 | |
---|
| 457 | if ( m_abSetupVideoFromOrgForView[iViewNum] ) |
---|
| 458 | { |
---|
[1313] | 459 | AOF( pcPicYuvOrgVideoData->getChromaFormat() == CHROMA_420 ); |
---|
| 460 | AOF( pcPicYuvOrgVideoData->getHeight( COMPONENT_Y ) >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgVideoData->getWidth( COMPONENT_Y) == m_iWidth ); |
---|
[124] | 461 | pcPicYuvOrgVideoData->extendPicBorder(); |
---|
[1313] | 462 | TRenFilter<REN_BIT_DEPTH>::sampleHorUp ( m_iShiftPrec, pcPicYuvOrgVideoData->getAddr( COMPONENT_Y ) + m_uiHorOff * pcPicYuvOrgVideoData->getStride( COMPONENT_Y ), pcPicYuvOrgVideoData->getStride( COMPONENT_Y ) , m_iWidth, m_iUsedHeight, m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] ); |
---|
| 463 | TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getAddr( COMPONENT_Cb ) + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getStride( COMPONENT_Cb ), pcPicYuvOrgVideoData->getStride( COMPONENT_Cb ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] ); |
---|
| 464 | TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getAddr( COMPONENT_Cr ) + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getStride( COMPONENT_Cr ), pcPicYuvOrgVideoData->getStride( COMPONENT_Cr ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] ); |
---|
[2] | 465 | } |
---|
| 466 | |
---|
| 467 | if ( m_abSetupDepthFromOrgForView[iViewNum] ) |
---|
[1313] | 468 | { |
---|
| 469 | AOF( pcPicYuvOrgDepthData->getHeight( COMPONENT_Y ) >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgDepthData->getWidth( COMPONENT_Y ) == m_iWidth ); |
---|
| 470 | TRenFilter<REN_BIT_DEPTH>::copy ( pcPicYuvOrgDepthData->getAddr( COMPONENT_Y ) + m_uiHorOff * pcPicYuvOrgDepthData->getStride( COMPONENT_Y) , pcPicYuvOrgDepthData->getStride( COMPONENT_Y), m_iWidth, m_iUsedHeight, m_apiOrgDepthPel [ iViewNum], m_aiOrgDepthStrides [iViewNum] ); |
---|
[2] | 471 | } |
---|
| 472 | } |
---|
| 473 | |
---|
| 474 | Void |
---|
[1396] | 475 | TRenModel::setSingleModel( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView, Int iEncViewSIdx) |
---|
[2] | 476 | { |
---|
| 477 | AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); |
---|
| 478 | |
---|
[124] | 479 | m_apcRenModels[iModelNum]->setupPart( m_uiHorOff, m_iUsedHeight ); |
---|
| 480 | |
---|
[2] | 481 | // Switch model to original data for setup if given to render reference |
---|
| 482 | Bool bAnyRefFromOrg = false; |
---|
| 483 | for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ ) |
---|
| 484 | { |
---|
| 485 | Bool bSetupFromOrgVideo = m_abSetupVideoFromOrgForView[iBaseViewIdx]; |
---|
| 486 | Bool bSetupFromOrgDepth = m_abSetupDepthFromOrgForView[iBaseViewIdx]; |
---|
[100] | 487 | bAnyRefFromOrg = bAnyRefFromOrg || bSetupFromOrgVideo || bSetupFromOrgDepth; |
---|
[2] | 488 | |
---|
[100] | 489 | if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID ) |
---|
[2] | 490 | { |
---|
| 491 | m_apcRenModels[iModelNum]->setLRView( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum], |
---|
| 492 | ( bSetupFromOrgVideo ? m_aapiOrgVideoPel : m_aapiCurVideoPel ) [iBaseViewIdx], |
---|
| 493 | ( bSetupFromOrgVideo ? m_aaiOrgVideoStrides: m_aaiCurVideoStrides) [iBaseViewIdx], |
---|
| 494 | ( bSetupFromOrgDepth ? m_apiOrgDepthPel : m_apiCurDepthPel ) [iBaseViewIdx], |
---|
| 495 | ( bSetupFromOrgDepth ? m_aiOrgDepthStrides : m_aiCurDepthStrides ) [iBaseViewIdx] ); |
---|
| 496 | } |
---|
| 497 | } |
---|
| 498 | |
---|
[1396] | 499 | // Render |
---|
| 500 | m_apcRenModels[iModelNum]->setupLut( ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft ); |
---|
| 501 | |
---|
| 502 | // Copy yuv to reference if given. |
---|
| 503 | AOT( pcPicYuvRefView != NULL && bAnyRefFromOrg ); |
---|
| 504 | |
---|
| 505 | if (pcPicYuvRefView ) |
---|
| 506 | { |
---|
| 507 | m_apcRenModels[iModelNum]->setupRefView( pcPicYuvRefView ); |
---|
[2] | 508 | } |
---|
[1396] | 509 | |
---|
| 510 | m_apcRenModels[iModelNum]->renderAll( ); |
---|
| 511 | |
---|
| 512 | // pcPicYuvRefView != NULL && bAnyRefFromOrg --> invalid combination |
---|
| 513 | // pcPicYuvRefView != NULL && !bAnyRefFromOrg --> distortion correct; reference view correct; current view correct |
---|
| 514 | // pcPicYuvRefView == NULL && bAnyRefFromOrg --> distortion TBD ; reference view TBD ; current view TBD |
---|
| 515 | // pcPicYuvRefView == NULL && !bAnyRefFromOrg --> distortion TBD ; reference view TBD ; current view correct |
---|
| 516 | |
---|
| 517 | if ( pcPicYuvRefView == NULL ) |
---|
| 518 | { |
---|
| 519 | // Update reference view |
---|
| 520 | m_apcRenModels[iModelNum]->setStructSynthViewAsRefView(); |
---|
| 521 | |
---|
| 522 | // pcPicYuvRefView != NULL && bAnyRefFromOrg --> invalid combination |
---|
| 523 | // pcPicYuvRefView != NULL && !bAnyRefFromOrg --> distortion correct; reference view correct; current view correct |
---|
| 524 | // pcPicYuvRefView == NULL && bAnyRefFromOrg --> distortion TBD ; reference view correct; current view TBD |
---|
| 525 | // pcPicYuvRefView == NULL && !bAnyRefFromOrg --> distortion TBD ; reference view correct; current view correct |
---|
| 526 | |
---|
| 527 | if ( bAnyRefFromOrg ) |
---|
| 528 | { |
---|
| 529 | // Update current view and distortion |
---|
| 530 | for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ ) |
---|
| 531 | { |
---|
| 532 | if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID ) |
---|
| 533 | { |
---|
| 534 | m_apcRenModels[iModelNum]->setLRView( |
---|
| 535 | m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum], |
---|
| 536 | m_aapiCurVideoPel [iBaseViewIdx], |
---|
| 537 | m_aaiCurVideoStrides [iBaseViewIdx], |
---|
| 538 | m_apiCurDepthPel [iBaseViewIdx], |
---|
| 539 | m_aiCurDepthStrides [iBaseViewIdx] |
---|
| 540 | ); |
---|
| 541 | } |
---|
| 542 | } |
---|
| 543 | m_apcRenModels[iModelNum]->renderAll( ); |
---|
| 544 | } |
---|
| 545 | else |
---|
| 546 | { |
---|
| 547 | // Update to distortion |
---|
| 548 | m_apcRenModels[iModelNum]->resetStructError(); |
---|
| 549 | } |
---|
| 550 | } |
---|
| 551 | |
---|
| 552 | if ( m_bLimOutput ) |
---|
| 553 | { |
---|
| 554 | AOT( m_aaeBaseViewPosInModel[ iEncViewSIdx ][iModelNum] == VIEWPOS_INVALID ); |
---|
| 555 | Int curViewPosInModel = m_aaeBaseViewPosInModel[ iEncViewSIdx ][iModelNum]; |
---|
| 556 | m_apcRenModels[iModelNum]->setLimOutStruct( (curViewPosInModel == VIEWPOS_RIGHT) ? VIEWPOS_LEFT : VIEWPOS_RIGHT ); |
---|
| 557 | } |
---|
[2] | 558 | } |
---|
| 559 | |
---|
| 560 | Void |
---|
| 561 | TRenModel::setErrorMode( Int iView, Int iContent, int iPlane ) |
---|
| 562 | { |
---|
| 563 | AOT(iView > m_iNumOfBaseViews || iView < 0); |
---|
| 564 | AOT(iContent != 0 && iContent != 1); |
---|
| 565 | AOT(iPlane < 0 || iPlane > 3); |
---|
| 566 | |
---|
| 567 | m_iCurrentView = iView; |
---|
| 568 | m_iCurrentContent = iContent; |
---|
| 569 | m_iCurrentPlane = iPlane; |
---|
| 570 | |
---|
| 571 | if ( iContent == 1 ) |
---|
| 572 | { |
---|
| 573 | m_iNumOfCurRenModels = m_aiNumOfModelsForDepthView[iView]; |
---|
| 574 | m_apcCurRenModels = m_aapcRenModelForDepthView [iView]; |
---|
| 575 | m_aiCurPosInModels = m_aaePosInModelForDepthView[iView]; |
---|
| 576 | } |
---|
| 577 | else |
---|
| 578 | { |
---|
| 579 | m_iNumOfCurRenModels = m_aiNumOfModelsForVideoView[iView]; |
---|
| 580 | m_apcCurRenModels = m_aapcRenModelForVideoView [iView]; |
---|
| 581 | m_aiCurPosInModels = m_aaePosInModelForVideoView[iView]; |
---|
| 582 | } |
---|
| 583 | } |
---|
| 584 | |
---|
[100] | 585 | |
---|
[124] | 586 | Void |
---|
| 587 | TRenModel::setupPart ( UInt uiHorOff, Int iUsedHeight ) |
---|
| 588 | { |
---|
[1396] | 589 | // AOT( iUsedHeight > m_iHeight ); |
---|
[124] | 590 | m_uiHorOff = uiHorOff; |
---|
| 591 | m_iUsedHeight = iUsedHeight; |
---|
| 592 | } |
---|
[100] | 593 | |
---|
[608] | 594 | #if H_3D_VSO_EARLY_SKIP |
---|
[2] | 595 | RMDist |
---|
[100] | 596 | TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride) |
---|
| 597 | #else |
---|
| 598 | RMDist |
---|
[2] | 599 | TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
[100] | 600 | #endif |
---|
[2] | 601 | { |
---|
[100] | 602 | iStartPosY -= m_uiHorOff; |
---|
| 603 | |
---|
[2] | 604 | AOT( iWidth + iStartPosX > m_iWidth ); |
---|
[124] | 605 | AOT( iHeight + iStartPosY > m_iUsedHeight ); |
---|
| 606 | |
---|
[2] | 607 | AOT( iStartPosX < 0); |
---|
| 608 | AOT( iStartPosY < 0); |
---|
| 609 | AOT( iWidth < 0); |
---|
| 610 | AOT( iHeight < 0); |
---|
| 611 | |
---|
| 612 | RMDist iDist = 0; |
---|
| 613 | |
---|
| 614 | for (Int iModelNum = 0; iModelNum < m_iNumOfCurRenModels; iModelNum++ ) |
---|
| 615 | { |
---|
| 616 | if (m_iCurrentContent == 1) |
---|
| 617 | { |
---|
[608] | 618 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 619 | iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData , piOrgData, iOrgStride); |
---|
| 620 | #else |
---|
[2] | 621 | iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
[100] | 622 | #endif |
---|
[2] | 623 | } |
---|
| 624 | else |
---|
| 625 | { |
---|
| 626 | iDist += m_apcCurRenModels[iModelNum]->getDistVideo ( m_aiCurPosInModels[iModelNum], m_iCurrentPlane ,iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
| 627 | } |
---|
| 628 | } |
---|
[1396] | 629 | return m_iNumOfCurRenModels > 0 ? ( iDist + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels : 0; |
---|
[2] | 630 | } |
---|
| 631 | |
---|
| 632 | Void |
---|
[1313] | 633 | TRenModel::setData( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) |
---|
[2] | 634 | { |
---|
[100] | 635 | iStartPosY -= m_uiHorOff; |
---|
| 636 | |
---|
[2] | 637 | iWidth = min(iWidth , m_iWidth - iStartPosX ); |
---|
[124] | 638 | iHeight = min(iHeight, m_iUsedHeight - iStartPosY ); |
---|
[2] | 639 | |
---|
| 640 | AOT( iStartPosX < 0); |
---|
| 641 | AOT( iStartPosY < 0); |
---|
| 642 | AOT( iWidth < 0); |
---|
| 643 | AOT( iHeight < 0); |
---|
| 644 | |
---|
| 645 | for (Int iModelNum = 0; iModelNum < m_iNumOfCurRenModels; iModelNum++ ) |
---|
| 646 | { |
---|
| 647 | if (m_iCurrentContent == 1) |
---|
| 648 | { |
---|
[608] | 649 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 650 | Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; |
---|
| 651 | m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX ,iTargetStride ); |
---|
| 652 | #else |
---|
[2] | 653 | m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
[100] | 654 | #endif |
---|
[2] | 655 | } |
---|
| 656 | else |
---|
| 657 | { |
---|
| 658 | m_apcCurRenModels[iModelNum]->setVideo ( m_aiCurPosInModels[iModelNum], m_iCurrentPlane ,iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
| 659 | } |
---|
| 660 | } |
---|
| 661 | |
---|
[608] | 662 | #if H_3D_VSO_EARLY_SKIP |
---|
[2] | 663 | if (m_iCurrentContent == 1) |
---|
| 664 | { |
---|
| 665 | Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; |
---|
[1313] | 666 | TRenFilter<REN_BIT_DEPTH>::copy( piNewData, iStride, iWidth, iHeight, m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX, iTargetStride ); |
---|
[2] | 667 | } |
---|
[100] | 668 | #endif |
---|
[2] | 669 | } |
---|
| 670 | |
---|
| 671 | Void |
---|
[100] | 672 | TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv ) |
---|
[2] | 673 | { |
---|
[124] | 674 | m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv ); |
---|
[2] | 675 | } |
---|
| 676 | |
---|
| 677 | Void |
---|
[100] | 678 | TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv ) |
---|
[2] | 679 | { |
---|
[100] | 680 | m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv ); |
---|
[2] | 681 | } |
---|
| 682 | |
---|
| 683 | Void |
---|
| 684 | TRenModel::getTotalSSE( Int64& riSSEY, Int64& riSSEU, Int64& riSSEV ) |
---|
| 685 | { |
---|
| 686 | TComPicYuv cPicYuvSynth; |
---|
[1313] | 687 | cPicYuvSynth.create( m_iWidth, m_iUsedHeight, CHROMA_420, 1, 1, 1, true); |
---|
[2] | 688 | |
---|
| 689 | TComPicYuv cPicYuvTempRef; |
---|
[1313] | 690 | cPicYuvTempRef.create( m_iWidth, m_iUsedHeight, CHROMA_420, 1, 1, 1, true); |
---|
[2] | 691 | |
---|
| 692 | Int64 iSSEY = 0; |
---|
| 693 | Int64 iSSEU = 0; |
---|
| 694 | Int64 iSSEV = 0; |
---|
| 695 | |
---|
| 696 | for (Int iCurModel = 0; iCurModel < m_iNumOfCurRenModels; iCurModel++) |
---|
| 697 | { |
---|
[124] | 698 | m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth ); |
---|
| 699 | m_apcCurRenModels[iCurModel]->getRefVideo ( m_aiCurPosInModels[iCurModel], &cPicYuvTempRef ); |
---|
| 700 | |
---|
[1313] | 701 | iSSEY += TRenFilter<REN_BIT_DEPTH>::SSE( cPicYuvSynth.getAddr( COMPONENT_Y ), cPicYuvSynth.getStride( COMPONENT_Y ), m_iWidth, m_iUsedHeight , cPicYuvTempRef.getAddr( COMPONENT_Y ), cPicYuvTempRef.getStride( COMPONENT_Y ), true ); |
---|
| 702 | iSSEU += TRenFilter<REN_BIT_DEPTH>::SSE( cPicYuvSynth.getAddr( COMPONENT_Cb ), cPicYuvSynth.getStride( COMPONENT_Cb ), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getAddr( COMPONENT_Cb ), cPicYuvTempRef.getStride( COMPONENT_Cb ), false ); |
---|
| 703 | iSSEV += TRenFilter<REN_BIT_DEPTH>::SSE( cPicYuvSynth.getAddr( COMPONENT_Cr ), cPicYuvSynth.getStride( COMPONENT_Cr ), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getAddr( COMPONENT_Cr ), cPicYuvTempRef.getStride( COMPONENT_Cr ), false ); |
---|
[2] | 704 | } |
---|
| 705 | |
---|
| 706 | riSSEY = ( iSSEY + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 707 | riSSEU = ( iSSEU + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 708 | riSSEV = ( iSSEV + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 709 | |
---|
| 710 | cPicYuvTempRef.destroy(); |
---|
| 711 | cPicYuvSynth .destroy(); |
---|
| 712 | } |
---|
| 713 | |
---|
| 714 | Void |
---|
| 715 | TRenModel::xSetLRViewAndAddModel( Int iModelNum, Int iBaseViewNum, Int iContent, Int iViewPos, Bool bAdd ) |
---|
| 716 | { |
---|
| 717 | AOF(iViewPos == VIEWPOS_LEFT || iViewPos == VIEWPOS_RIGHT); |
---|
| 718 | AOF(iContent == -1 || iContent == 0 || iContent == 1); |
---|
| 719 | AOT( iBaseViewNum < 0 || iBaseViewNum > m_iNumOfBaseViews ); |
---|
| 720 | AOT( m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] != VIEWPOS_INVALID ); |
---|
| 721 | m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] = iViewPos; |
---|
| 722 | |
---|
| 723 | if (bAdd) |
---|
| 724 | { |
---|
| 725 | if (iContent == 0 || iContent == -1 ) |
---|
| 726 | { |
---|
| 727 | Int iNewModelIdxForView = m_aiNumOfModelsForVideoView[iBaseViewNum]++; |
---|
| 728 | m_aapcRenModelForVideoView [ iBaseViewNum ][ iNewModelIdxForView ] = m_apcRenModels[iModelNum]; |
---|
| 729 | m_aaePosInModelForVideoView[ iBaseViewNum ][ iNewModelIdxForView ] = iViewPos; |
---|
| 730 | } |
---|
| 731 | |
---|
| 732 | if (iContent == 1 || iContent == -1 ) |
---|
| 733 | { |
---|
| 734 | Int iNewModelIdxForView = m_aiNumOfModelsForDepthView[iBaseViewNum]++; |
---|
| 735 | m_aapcRenModelForDepthView [ iBaseViewNum ][ iNewModelIdxForView ] = m_apcRenModels[iModelNum]; |
---|
| 736 | m_aaePosInModelForDepthView[ iBaseViewNum ][ iNewModelIdxForView ] = iViewPos; |
---|
| 737 | } |
---|
| 738 | } |
---|
[189] | 739 | } |
---|
[1313] | 740 | #endif // NH_3D |
---|