[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 | * |
---|
[1179] | 6 | * Copyright (c) 2010-2015, 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 |
---|
[100] | 218 | TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip ) |
---|
| 219 | #else |
---|
[2] | 220 | TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin ) |
---|
[100] | 221 | #endif |
---|
[2] | 222 | { |
---|
| 223 | m_iNumOfBaseViews = iNumOfBaseViews; |
---|
| 224 | m_iNumOfRenModels = iNumOfModels; |
---|
| 225 | m_iWidth = iWidth; |
---|
| 226 | m_iHeight = iHeight; |
---|
| 227 | m_iShiftPrec = iShiftPrec; |
---|
| 228 | m_iHoleMargin = iHoleMargin; |
---|
[608] | 229 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 230 | m_bEarlySkip = bEarlySkip; |
---|
| 231 | #endif |
---|
[2] | 232 | |
---|
[100] | 233 | |
---|
[2] | 234 | // LUTs for sub pel shifting |
---|
| 235 | Int iNumEntries = (1 << ( m_iShiftPrec + 1) ) + 1 ; |
---|
| 236 | m_aaaiSubPelShiftLut[0] = new Int*[ iNumEntries ]; |
---|
| 237 | m_aaaiSubPelShiftLut[1] = new Int*[ iNumEntries ]; |
---|
| 238 | for (UInt uiEntry = 0; uiEntry < iNumEntries; uiEntry++) |
---|
| 239 | { |
---|
| 240 | m_aaaiSubPelShiftLut[0][uiEntry] = new Int[ iNumEntries ]; |
---|
| 241 | m_aaaiSubPelShiftLut[1][uiEntry] = new Int[ iNumEntries ]; |
---|
| 242 | } |
---|
| 243 | |
---|
[1313] | 244 | TRenFilter<REN_BIT_DEPTH>::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[0], 0 ); |
---|
| 245 | TRenFilter<REN_BIT_DEPTH>::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[1], 0 ); |
---|
[2] | 246 | |
---|
| 247 | m_iSampledWidth = iWidth << m_iShiftPrec; |
---|
| 248 | |
---|
| 249 | |
---|
| 250 | m_aapiCurVideoPel = new Pel** [m_iNumOfBaseViews]; |
---|
| 251 | m_aaiCurVideoStrides = new Int* [m_iNumOfBaseViews]; |
---|
| 252 | m_apiCurDepthPel = new Pel* [m_iNumOfBaseViews]; |
---|
| 253 | m_aiCurDepthStrides = new Int [m_iNumOfBaseViews]; |
---|
| 254 | |
---|
| 255 | m_aapiOrgVideoPel = new Pel** [m_iNumOfBaseViews]; |
---|
| 256 | m_aaiOrgVideoStrides = new Int* [m_iNumOfBaseViews]; |
---|
| 257 | |
---|
| 258 | m_apiOrgDepthPel = new Pel* [m_iNumOfBaseViews]; |
---|
| 259 | m_aiOrgDepthStrides = new Int [m_iNumOfBaseViews]; |
---|
| 260 | |
---|
| 261 | m_abSetupVideoFromOrgForView = new Bool[m_iNumOfBaseViews]; |
---|
| 262 | m_abSetupDepthFromOrgForView = new Bool[m_iNumOfBaseViews]; |
---|
| 263 | |
---|
| 264 | m_iNumOfCurRenModels = 0; |
---|
| 265 | m_apcCurRenModels = NULL; |
---|
| 266 | m_aiCurPosInModels = NULL; |
---|
| 267 | |
---|
| 268 | m_apcRenModels = new TRenSingleModel* [m_iNumOfRenModels]; |
---|
| 269 | |
---|
| 270 | m_aiNumOfModelsForDepthView = new Int [m_iNumOfBaseViews]; |
---|
| 271 | m_aapcRenModelForDepthView = new TRenSingleModel** [m_iNumOfBaseViews]; |
---|
| 272 | m_aaePosInModelForDepthView = new Int* [m_iNumOfBaseViews]; |
---|
| 273 | |
---|
| 274 | m_aiNumOfModelsForVideoView = new Int [m_iNumOfBaseViews]; |
---|
| 275 | m_aapcRenModelForVideoView = new TRenSingleModel** [m_iNumOfBaseViews]; |
---|
| 276 | m_aaePosInModelForVideoView = new Int* [m_iNumOfBaseViews]; |
---|
| 277 | m_aaeBaseViewPosInModel = new Int* [m_iNumOfBaseViews]; |
---|
| 278 | |
---|
| 279 | |
---|
| 280 | for (Int iModelNum = 0; iModelNum < m_iNumOfRenModels; iModelNum++) |
---|
| 281 | { |
---|
[100] | 282 | m_apcRenModels [iModelNum] = NULL; |
---|
[2] | 283 | } |
---|
| 284 | |
---|
| 285 | for (Int iViewNum = 0; iViewNum < m_iNumOfBaseViews; iViewNum++ ) |
---|
| 286 | { |
---|
| 287 | m_aiNumOfModelsForDepthView[ iViewNum ] = 0; |
---|
| 288 | m_aiNumOfModelsForVideoView[ iViewNum ] = 0; |
---|
| 289 | |
---|
| 290 | m_aapcRenModelForDepthView [iViewNum] = new TRenSingleModel*[m_iNumOfRenModels]; |
---|
| 291 | m_aapcRenModelForVideoView [iViewNum] = new TRenSingleModel*[m_iNumOfRenModels]; |
---|
| 292 | |
---|
| 293 | m_aaePosInModelForDepthView[iViewNum] = new Int [m_iNumOfRenModels]; |
---|
| 294 | m_aaePosInModelForVideoView[iViewNum] = new Int [m_iNumOfRenModels]; |
---|
| 295 | m_aaeBaseViewPosInModel [iViewNum] = new Int [m_iNumOfRenModels]; |
---|
| 296 | |
---|
| 297 | for (Int iModelNum = 0; iModelNum< m_iNumOfRenModels; iModelNum++) |
---|
| 298 | { |
---|
| 299 | m_aapcRenModelForDepthView [iViewNum] [iModelNum] = NULL; |
---|
| 300 | m_aapcRenModelForVideoView [iViewNum] [iModelNum] = NULL; |
---|
| 301 | m_aaePosInModelForDepthView[iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
| 302 | m_aaePosInModelForVideoView[iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
| 303 | m_aaeBaseViewPosInModel [iViewNum] [iModelNum] = VIEWPOS_INVALID; |
---|
| 304 | }; |
---|
| 305 | |
---|
| 306 | m_aaiCurVideoStrides [iViewNum] = new Int[3]; |
---|
| 307 | m_aaiCurVideoStrides [iViewNum][0] = m_iSampledWidth + (m_iPad << 1); |
---|
| 308 | m_aaiCurVideoStrides [iViewNum][1] = m_iSampledWidth + (m_iPad << 1); |
---|
| 309 | m_aaiCurVideoStrides [iViewNum][2] = m_iSampledWidth + (m_iPad << 1); |
---|
| 310 | |
---|
| 311 | m_aapiCurVideoPel [iViewNum] = new Pel*[3]; |
---|
| 312 | m_aapiCurVideoPel [iViewNum][0] = new Pel [ m_aaiCurVideoStrides[iViewNum][0] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 313 | m_aapiCurVideoPel [iViewNum][1] = new Pel [ m_aaiCurVideoStrides[iViewNum][1] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 314 | m_aapiCurVideoPel [iViewNum][2] = new Pel [ m_aaiCurVideoStrides[iViewNum][2] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 315 | |
---|
| 316 | m_aapiCurVideoPel [iViewNum][0] += m_aaiCurVideoStrides[iViewNum][0] * m_iPad + m_iPad; |
---|
| 317 | m_aapiCurVideoPel [iViewNum][1] += m_aaiCurVideoStrides[iViewNum][1] * m_iPad + m_iPad; |
---|
| 318 | m_aapiCurVideoPel [iViewNum][2] += m_aaiCurVideoStrides[iViewNum][2] * m_iPad + m_iPad; |
---|
| 319 | |
---|
| 320 | m_aiCurDepthStrides [iViewNum] = m_iWidth + (m_iPad << 1); |
---|
| 321 | m_apiCurDepthPel [iViewNum] = new Pel[ m_aiCurDepthStrides[iViewNum] * ( m_iHeight + (m_iPad << 1) ) ]; |
---|
| 322 | m_apiCurDepthPel [iViewNum] += m_aiCurDepthStrides[iViewNum] * m_iPad + m_iPad; |
---|
| 323 | |
---|
| 324 | m_aaiOrgVideoStrides [iViewNum] = new Int[3]; |
---|
| 325 | m_aaiOrgVideoStrides [iViewNum][0] = m_iSampledWidth + (m_iPad << 1); |
---|
| 326 | m_aaiOrgVideoStrides [iViewNum][1] = m_iSampledWidth + (m_iPad << 1); |
---|
| 327 | m_aaiOrgVideoStrides [iViewNum][2] = m_iSampledWidth + (m_iPad << 1); |
---|
| 328 | |
---|
| 329 | m_aapiOrgVideoPel [iViewNum] = new Pel*[3]; |
---|
| 330 | m_aapiOrgVideoPel [iViewNum][0] = new Pel [ m_aaiOrgVideoStrides[iViewNum][0] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 331 | m_aapiOrgVideoPel [iViewNum][1] = new Pel [ m_aaiOrgVideoStrides[iViewNum][1] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 332 | m_aapiOrgVideoPel [iViewNum][2] = new Pel [ m_aaiOrgVideoStrides[iViewNum][2] * ( m_iHeight + (m_iPad << 1) )]; |
---|
| 333 | |
---|
| 334 | m_aapiOrgVideoPel [iViewNum][0] += m_aaiOrgVideoStrides[iViewNum][0] * m_iPad + m_iPad; |
---|
| 335 | m_aapiOrgVideoPel [iViewNum][1] += m_aaiOrgVideoStrides[iViewNum][1] * m_iPad + m_iPad; |
---|
| 336 | m_aapiOrgVideoPel [iViewNum][2] += m_aaiOrgVideoStrides[iViewNum][2] * m_iPad + m_iPad; |
---|
| 337 | |
---|
| 338 | m_aiOrgDepthStrides [iViewNum] = m_iWidth + (m_iPad << 1); |
---|
| 339 | m_apiOrgDepthPel [iViewNum] = new Pel[ m_aiOrgDepthStrides[iViewNum] * ( m_iHeight + (m_iPad << 1) ) ]; |
---|
| 340 | m_apiOrgDepthPel [iViewNum] += m_aiOrgDepthStrides[iViewNum] * m_iPad + m_iPad; |
---|
| 341 | |
---|
| 342 | m_abSetupVideoFromOrgForView[iViewNum] = false; |
---|
| 343 | m_abSetupDepthFromOrgForView[iViewNum] = false; |
---|
| 344 | } |
---|
| 345 | } |
---|
| 346 | |
---|
| 347 | Void |
---|
| 348 | TRenModel::createSingleModel( Int iBaseViewNum, Int iContent, Int iModelNum, Int iLeftViewNum, Int iRightViewNum, Bool bUseOrgRef, Int iBlendMode ) |
---|
| 349 | { |
---|
| 350 | Int iMode = ( (iLeftViewNum != -1) && ( iRightViewNum != -1 ) ) ? 2 : ( iLeftViewNum != -1 ? 0 : ( iRightViewNum != -1 ? 1 : -1 ) ); |
---|
| 351 | |
---|
| 352 | AOT( iMode == -1); |
---|
[100] | 353 | AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); |
---|
[2] | 354 | AOT( iLeftViewNum < -1 || iLeftViewNum > m_iNumOfBaseViews ); |
---|
| 355 | AOT( iRightViewNum < -1 || iRightViewNum > m_iNumOfBaseViews ); |
---|
| 356 | AOT( iBaseViewNum < -1 || iBaseViewNum > m_iNumOfBaseViews ); |
---|
| 357 | AOT( iBaseViewNum != -1 && iBaseViewNum != iLeftViewNum && iBaseViewNum != iRightViewNum ); |
---|
| 358 | AOT( iContent < -1 || iContent > 1 ); |
---|
[1313] | 359 | AOT( iBlendMode < -1 || iBlendMode > 2 ); |
---|
[2] | 360 | |
---|
[1313] | 361 | Bool bBitInc = ( REN_BIT_DEPTH != ENC_INTERNAL_BIT_DEPTH ); |
---|
[100] | 362 | |
---|
| 363 | AOT( m_apcRenModels[iModelNum] ); |
---|
| 364 | |
---|
| 365 | if ( bBitInc ) |
---|
| 366 | { |
---|
| 367 | if ( iMode != 2 ) |
---|
| 368 | { // No Blending |
---|
| 369 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, true>; |
---|
| 370 | } |
---|
| 371 | else |
---|
| 372 | { |
---|
| 373 | switch ( iBlendMode ) |
---|
| 374 | { |
---|
| 375 | case BLEND_AVRG: // average |
---|
| 376 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, true>; |
---|
| 377 | break; |
---|
| 378 | case BLEND_LEFT: // left view is main view |
---|
| 379 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, true>; |
---|
| 380 | break; |
---|
| 381 | case BLEND_RIGHT: // right view is main view |
---|
| 382 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, true>; |
---|
| 383 | break; |
---|
| 384 | default: |
---|
| 385 | AOT(true); |
---|
| 386 | break; |
---|
| 387 | } |
---|
| 388 | } |
---|
| 389 | } |
---|
| 390 | else |
---|
| 391 | { |
---|
| 392 | if ( iMode != 2 ) |
---|
| 393 | { // No Blending |
---|
| 394 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, false>; |
---|
| 395 | } |
---|
| 396 | else |
---|
| 397 | { |
---|
| 398 | switch ( iBlendMode ) |
---|
| 399 | { |
---|
| 400 | case BLEND_AVRG: // average |
---|
| 401 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, false>; |
---|
| 402 | break; |
---|
| 403 | case BLEND_LEFT: // left view is main view |
---|
| 404 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, false>; |
---|
| 405 | break; |
---|
| 406 | case BLEND_RIGHT: // right view is main view |
---|
| 407 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, false>; |
---|
| 408 | break; |
---|
| 409 | default: |
---|
| 410 | AOT(true); |
---|
| 411 | break; |
---|
| 412 | } |
---|
| 413 | } |
---|
| 414 | } |
---|
| 415 | |
---|
| 416 | |
---|
[608] | 417 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 418 | m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, iBlendMode, m_bEarlySkip ); |
---|
| 419 | #else |
---|
[2] | 420 | m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, iBlendMode ); |
---|
[100] | 421 | #endif |
---|
[2] | 422 | |
---|
| 423 | if ( iLeftViewNum != -1 ) |
---|
| 424 | { |
---|
| 425 | xSetLRViewAndAddModel( iModelNum, iLeftViewNum, iContent, VIEWPOS_LEFT, (iBaseViewNum == -1 || iBaseViewNum == iLeftViewNum ) ); |
---|
| 426 | } |
---|
| 427 | |
---|
| 428 | if ( iRightViewNum != -1) |
---|
| 429 | { |
---|
| 430 | xSetLRViewAndAddModel( iModelNum, iRightViewNum, iContent, VIEWPOS_RIGHT, (iBaseViewNum == -1 || iBaseViewNum == iRightViewNum ) ); |
---|
| 431 | } |
---|
| 432 | } |
---|
| 433 | |
---|
| 434 | Void |
---|
| 435 | TRenModel::setBaseView( Int iViewNum, TComPicYuv* pcPicYuvVideoData, TComPicYuv* pcPicYuvDepthData, TComPicYuv* pcPicYuvOrgVideoData, TComPicYuv* pcPicYuvOrgDepthData ) |
---|
| 436 | { |
---|
| 437 | AOT( iViewNum < 0 || iViewNum > m_iNumOfBaseViews ); |
---|
[1313] | 438 | AOF( pcPicYuvVideoData->getHeight( COMPONENT_Y ) >= m_iUsedHeight + m_uiHorOff && pcPicYuvVideoData->getWidth( COMPONENT_Y ) == m_iWidth ); |
---|
| 439 | AOF( pcPicYuvDepthData->getHeight( COMPONENT_Y ) >= m_iUsedHeight + m_uiHorOff && pcPicYuvDepthData->getWidth( COMPONENT_Y ) == m_iWidth ); |
---|
| 440 | |
---|
| 441 | AOF( pcPicYuvVideoData ->getChromaFormat() == CHROMA_420 ); |
---|
| 442 | |
---|
[2] | 443 | pcPicYuvVideoData->extendPicBorder(); |
---|
| 444 | |
---|
[1313] | 445 | 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] ); |
---|
| 446 | 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] ); |
---|
| 447 | 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] ); |
---|
| 448 | 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] | 449 | |
---|
[2] | 450 | // Used for rendering reference pic from original video data |
---|
| 451 | m_abSetupVideoFromOrgForView[iViewNum] = (pcPicYuvOrgVideoData != NULL); |
---|
| 452 | m_abSetupDepthFromOrgForView[iViewNum] = (pcPicYuvOrgDepthData != NULL); |
---|
| 453 | |
---|
| 454 | if ( m_abSetupVideoFromOrgForView[iViewNum] ) |
---|
| 455 | { |
---|
[1313] | 456 | AOF( pcPicYuvOrgVideoData->getChromaFormat() == CHROMA_420 ); |
---|
| 457 | AOF( pcPicYuvOrgVideoData->getHeight( COMPONENT_Y ) >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgVideoData->getWidth( COMPONENT_Y) == m_iWidth ); |
---|
[124] | 458 | pcPicYuvOrgVideoData->extendPicBorder(); |
---|
[1313] | 459 | 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] ); |
---|
| 460 | 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] ); |
---|
| 461 | 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] | 462 | } |
---|
| 463 | |
---|
| 464 | if ( m_abSetupDepthFromOrgForView[iViewNum] ) |
---|
[1313] | 465 | { |
---|
| 466 | AOF( pcPicYuvOrgDepthData->getHeight( COMPONENT_Y ) >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgDepthData->getWidth( COMPONENT_Y ) == m_iWidth ); |
---|
| 467 | 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] | 468 | } |
---|
| 469 | } |
---|
| 470 | |
---|
| 471 | Void |
---|
| 472 | TRenModel::setSingleModel( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView ) |
---|
| 473 | { |
---|
| 474 | AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); |
---|
| 475 | |
---|
[124] | 476 | m_apcRenModels[iModelNum]->setupPart( m_uiHorOff, m_iUsedHeight ); |
---|
| 477 | |
---|
[2] | 478 | // Switch model to original data for setup if given to render reference |
---|
| 479 | Bool bAnyRefFromOrg = false; |
---|
| 480 | for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ ) |
---|
| 481 | { |
---|
| 482 | Bool bSetupFromOrgVideo = m_abSetupVideoFromOrgForView[iBaseViewIdx]; |
---|
| 483 | Bool bSetupFromOrgDepth = m_abSetupDepthFromOrgForView[iBaseViewIdx]; |
---|
[100] | 484 | bAnyRefFromOrg = bAnyRefFromOrg || bSetupFromOrgVideo || bSetupFromOrgDepth; |
---|
[2] | 485 | |
---|
[100] | 486 | if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID ) |
---|
[2] | 487 | { |
---|
| 488 | bAnyRefFromOrg = true; |
---|
| 489 | m_apcRenModels[iModelNum]->setLRView( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum], |
---|
| 490 | ( bSetupFromOrgVideo ? m_aapiOrgVideoPel : m_aapiCurVideoPel ) [iBaseViewIdx], |
---|
| 491 | ( bSetupFromOrgVideo ? m_aaiOrgVideoStrides: m_aaiCurVideoStrides) [iBaseViewIdx], |
---|
| 492 | ( bSetupFromOrgDepth ? m_apiOrgDepthPel : m_apiCurDepthPel ) [iBaseViewIdx], |
---|
| 493 | ( bSetupFromOrgDepth ? m_aiOrgDepthStrides : m_aiCurDepthStrides ) [iBaseViewIdx] ); |
---|
| 494 | } |
---|
| 495 | } |
---|
| 496 | |
---|
[124] | 497 | m_apcRenModels[iModelNum]->setup ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false ); |
---|
[2] | 498 | |
---|
| 499 | // Setup to Org |
---|
| 500 | if ( bAnyRefFromOrg ) |
---|
| 501 | { |
---|
| 502 | // Restore old values |
---|
| 503 | for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ ) |
---|
| 504 | { |
---|
| 505 | if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID ) |
---|
| 506 | { |
---|
| 507 | m_apcRenModels[iModelNum]->setLRView( |
---|
| 508 | m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum], |
---|
| 509 | m_aapiCurVideoPel [iBaseViewIdx], |
---|
| 510 | m_aaiCurVideoStrides [iBaseViewIdx], |
---|
| 511 | m_apiCurDepthPel [iBaseViewIdx], |
---|
| 512 | m_aiCurDepthStrides [iBaseViewIdx] |
---|
| 513 | ); |
---|
| 514 | } |
---|
| 515 | } |
---|
| 516 | |
---|
[100] | 517 | // setup keeping reference rendered from original data |
---|
[124] | 518 | m_apcRenModels[iModelNum]->setup ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true ); |
---|
[2] | 519 | } |
---|
| 520 | } |
---|
| 521 | |
---|
| 522 | Void |
---|
| 523 | TRenModel::setErrorMode( Int iView, Int iContent, int iPlane ) |
---|
| 524 | { |
---|
| 525 | AOT(iView > m_iNumOfBaseViews || iView < 0); |
---|
| 526 | AOT(iContent != 0 && iContent != 1); |
---|
| 527 | AOT(iPlane < 0 || iPlane > 3); |
---|
| 528 | |
---|
| 529 | m_iCurrentView = iView; |
---|
| 530 | m_iCurrentContent = iContent; |
---|
| 531 | m_iCurrentPlane = iPlane; |
---|
| 532 | |
---|
| 533 | if ( iContent == 1 ) |
---|
| 534 | { |
---|
| 535 | m_iNumOfCurRenModels = m_aiNumOfModelsForDepthView[iView]; |
---|
| 536 | m_apcCurRenModels = m_aapcRenModelForDepthView [iView]; |
---|
| 537 | m_aiCurPosInModels = m_aaePosInModelForDepthView[iView]; |
---|
| 538 | } |
---|
| 539 | else |
---|
| 540 | { |
---|
| 541 | m_iNumOfCurRenModels = m_aiNumOfModelsForVideoView[iView]; |
---|
| 542 | m_apcCurRenModels = m_aapcRenModelForVideoView [iView]; |
---|
| 543 | m_aiCurPosInModels = m_aaePosInModelForVideoView[iView]; |
---|
| 544 | } |
---|
| 545 | } |
---|
| 546 | |
---|
[100] | 547 | |
---|
[124] | 548 | Void |
---|
| 549 | TRenModel::setupPart ( UInt uiHorOff, Int iUsedHeight ) |
---|
| 550 | { |
---|
| 551 | AOT( iUsedHeight > m_iHeight ); |
---|
| 552 | m_uiHorOff = uiHorOff; |
---|
| 553 | m_iUsedHeight = iUsedHeight; |
---|
| 554 | } |
---|
[100] | 555 | |
---|
[608] | 556 | #if H_3D_VSO_EARLY_SKIP |
---|
[2] | 557 | RMDist |
---|
[100] | 558 | TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride) |
---|
| 559 | #else |
---|
| 560 | RMDist |
---|
[2] | 561 | TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
[100] | 562 | #endif |
---|
[2] | 563 | { |
---|
[100] | 564 | iStartPosY -= m_uiHorOff; |
---|
| 565 | |
---|
[2] | 566 | AOT( iWidth + iStartPosX > m_iWidth ); |
---|
[124] | 567 | AOT( iHeight + iStartPosY > m_iUsedHeight ); |
---|
| 568 | |
---|
[2] | 569 | AOT( iStartPosX < 0); |
---|
| 570 | AOT( iStartPosY < 0); |
---|
| 571 | AOT( iWidth < 0); |
---|
| 572 | AOT( iHeight < 0); |
---|
| 573 | |
---|
| 574 | RMDist iDist = 0; |
---|
| 575 | |
---|
| 576 | for (Int iModelNum = 0; iModelNum < m_iNumOfCurRenModels; iModelNum++ ) |
---|
| 577 | { |
---|
| 578 | if (m_iCurrentContent == 1) |
---|
| 579 | { |
---|
[608] | 580 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 581 | iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData , piOrgData, iOrgStride); |
---|
| 582 | #else |
---|
[2] | 583 | iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
[100] | 584 | #endif |
---|
[2] | 585 | } |
---|
| 586 | else |
---|
| 587 | { |
---|
| 588 | iDist += m_apcCurRenModels[iModelNum]->getDistVideo ( m_aiCurPosInModels[iModelNum], m_iCurrentPlane ,iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
| 589 | } |
---|
| 590 | } |
---|
| 591 | |
---|
| 592 | return ( iDist + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 593 | } |
---|
| 594 | |
---|
| 595 | Void |
---|
[1313] | 596 | TRenModel::setData( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData ) |
---|
[2] | 597 | { |
---|
[100] | 598 | iStartPosY -= m_uiHorOff; |
---|
| 599 | |
---|
[2] | 600 | iWidth = min(iWidth , m_iWidth - iStartPosX ); |
---|
[124] | 601 | iHeight = min(iHeight, m_iUsedHeight - iStartPosY ); |
---|
[2] | 602 | |
---|
| 603 | AOT( iStartPosX < 0); |
---|
| 604 | AOT( iStartPosY < 0); |
---|
| 605 | AOT( iWidth < 0); |
---|
| 606 | AOT( iHeight < 0); |
---|
| 607 | |
---|
| 608 | for (Int iModelNum = 0; iModelNum < m_iNumOfCurRenModels; iModelNum++ ) |
---|
| 609 | { |
---|
| 610 | if (m_iCurrentContent == 1) |
---|
| 611 | { |
---|
[608] | 612 | #if H_3D_VSO_EARLY_SKIP |
---|
[100] | 613 | Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; |
---|
| 614 | m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX ,iTargetStride ); |
---|
| 615 | #else |
---|
[2] | 616 | m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
[100] | 617 | #endif |
---|
[2] | 618 | } |
---|
| 619 | else |
---|
| 620 | { |
---|
| 621 | m_apcCurRenModels[iModelNum]->setVideo ( m_aiCurPosInModels[iModelNum], m_iCurrentPlane ,iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
| 622 | } |
---|
| 623 | } |
---|
| 624 | |
---|
[608] | 625 | #if H_3D_VSO_EARLY_SKIP |
---|
[2] | 626 | if (m_iCurrentContent == 1) |
---|
| 627 | { |
---|
| 628 | Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; |
---|
[1313] | 629 | TRenFilter<REN_BIT_DEPTH>::copy( piNewData, iStride, iWidth, iHeight, m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX, iTargetStride ); |
---|
[2] | 630 | } |
---|
[100] | 631 | #endif |
---|
[2] | 632 | } |
---|
| 633 | |
---|
| 634 | Void |
---|
[100] | 635 | TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv ) |
---|
[2] | 636 | { |
---|
[124] | 637 | m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv ); |
---|
[2] | 638 | } |
---|
| 639 | |
---|
| 640 | Void |
---|
[100] | 641 | TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv ) |
---|
[2] | 642 | { |
---|
[100] | 643 | m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv ); |
---|
[2] | 644 | } |
---|
| 645 | |
---|
| 646 | Void |
---|
| 647 | TRenModel::getTotalSSE( Int64& riSSEY, Int64& riSSEU, Int64& riSSEV ) |
---|
| 648 | { |
---|
| 649 | TComPicYuv cPicYuvSynth; |
---|
[1313] | 650 | cPicYuvSynth.create( m_iWidth, m_iUsedHeight, CHROMA_420, 1, 1, 1, true); |
---|
[2] | 651 | |
---|
| 652 | TComPicYuv cPicYuvTempRef; |
---|
[1313] | 653 | cPicYuvTempRef.create( m_iWidth, m_iUsedHeight, CHROMA_420, 1, 1, 1, true); |
---|
[2] | 654 | |
---|
| 655 | Int64 iSSEY = 0; |
---|
| 656 | Int64 iSSEU = 0; |
---|
| 657 | Int64 iSSEV = 0; |
---|
| 658 | |
---|
| 659 | for (Int iCurModel = 0; iCurModel < m_iNumOfCurRenModels; iCurModel++) |
---|
| 660 | { |
---|
[124] | 661 | m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth ); |
---|
| 662 | m_apcCurRenModels[iCurModel]->getRefVideo ( m_aiCurPosInModels[iCurModel], &cPicYuvTempRef ); |
---|
| 663 | |
---|
[1313] | 664 | 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 ); |
---|
| 665 | 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 ); |
---|
| 666 | 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] | 667 | } |
---|
| 668 | |
---|
| 669 | riSSEY = ( iSSEY + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 670 | riSSEU = ( iSSEU + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 671 | riSSEV = ( iSSEV + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 672 | |
---|
| 673 | cPicYuvTempRef.destroy(); |
---|
| 674 | cPicYuvSynth .destroy(); |
---|
| 675 | } |
---|
| 676 | |
---|
| 677 | Void |
---|
| 678 | TRenModel::xSetLRViewAndAddModel( Int iModelNum, Int iBaseViewNum, Int iContent, Int iViewPos, Bool bAdd ) |
---|
| 679 | { |
---|
| 680 | AOF(iViewPos == VIEWPOS_LEFT || iViewPos == VIEWPOS_RIGHT); |
---|
| 681 | AOF(iContent == -1 || iContent == 0 || iContent == 1); |
---|
| 682 | AOT( iBaseViewNum < 0 || iBaseViewNum > m_iNumOfBaseViews ); |
---|
| 683 | AOT( m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] != VIEWPOS_INVALID ); |
---|
| 684 | m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] = iViewPos; |
---|
| 685 | |
---|
| 686 | if (bAdd) |
---|
| 687 | { |
---|
| 688 | if (iContent == 0 || iContent == -1 ) |
---|
| 689 | { |
---|
| 690 | Int iNewModelIdxForView = m_aiNumOfModelsForVideoView[iBaseViewNum]++; |
---|
| 691 | m_aapcRenModelForVideoView [ iBaseViewNum ][ iNewModelIdxForView ] = m_apcRenModels[iModelNum]; |
---|
| 692 | m_aaePosInModelForVideoView[ iBaseViewNum ][ iNewModelIdxForView ] = iViewPos; |
---|
| 693 | } |
---|
| 694 | |
---|
| 695 | if (iContent == 1 || iContent == -1 ) |
---|
| 696 | { |
---|
| 697 | Int iNewModelIdxForView = m_aiNumOfModelsForDepthView[iBaseViewNum]++; |
---|
| 698 | m_aapcRenModelForDepthView [ iBaseViewNum ][ iNewModelIdxForView ] = m_apcRenModels[iModelNum]; |
---|
| 699 | m_aaePosInModelForDepthView[ iBaseViewNum ][ iNewModelIdxForView ] = iViewPos; |
---|
| 700 | } |
---|
| 701 | } |
---|
[189] | 702 | } |
---|
[1313] | 703 | #endif // NH_3D |
---|