[438] | 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 | |
---|
| 34 | #include "TRenImage.h" |
---|
| 35 | #include "TRenFilter.h" |
---|
| 36 | #include "TRenModel.h" |
---|
[446] | 37 | |
---|
| 38 | #if H_3D_VSO |
---|
[438] | 39 | /////////// TRENMODEL ////////////////////// |
---|
| 40 | TRenModel::TRenModel() |
---|
| 41 | { |
---|
| 42 | m_iPad = PICYUV_PAD; |
---|
| 43 | m_iWidth = -1; |
---|
| 44 | m_iHeight = -1; |
---|
| 45 | m_iUsedHeight = -1; |
---|
| 46 | m_iNumOfBaseViews = -1; |
---|
| 47 | m_iSampledWidth = -1; |
---|
| 48 | m_iShiftPrec = 0; |
---|
| 49 | m_iHoleMargin = 1; |
---|
| 50 | m_uiHorOff = -1; |
---|
[446] | 51 | #if H_3D_VSO_EARLY_SKIP |
---|
[438] | 52 | m_bEarlySkip = false; |
---|
| 53 | #endif |
---|
| 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 |
---|
[446] | 217 | #if H_3D_VSO_EARLY_SKIP |
---|
[438] | 218 | TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip ) |
---|
| 219 | #else |
---|
| 220 | TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin ) |
---|
| 221 | #endif |
---|
| 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; |
---|
[446] | 229 | #if H_3D_VSO_EARLY_SKIP |
---|
[438] | 230 | m_bEarlySkip = bEarlySkip; |
---|
| 231 | #endif |
---|
| 232 | |
---|
| 233 | |
---|
| 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 | |
---|
| 244 | TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[0], 0 ); |
---|
| 245 | TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[1], 0 ); |
---|
| 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 | { |
---|
| 282 | m_apcRenModels [iModelNum] = NULL; |
---|
| 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); |
---|
| 353 | AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); |
---|
| 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 ); |
---|
| 359 | AOT( iBlendMode < -1 || iBlendMode > 2 ); |
---|
[446] | 360 | AOT( g_bitDepthY != g_bitDepthC ); |
---|
[438] | 361 | |
---|
[446] | 362 | Bool bBitInc = ( DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) != 0); |
---|
[438] | 363 | |
---|
| 364 | AOT( m_apcRenModels[iModelNum] ); |
---|
| 365 | |
---|
| 366 | if ( bBitInc ) |
---|
| 367 | { |
---|
| 368 | if ( iMode != 2 ) |
---|
| 369 | { // No Blending |
---|
| 370 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, true>; |
---|
| 371 | } |
---|
| 372 | else |
---|
| 373 | { |
---|
| 374 | switch ( iBlendMode ) |
---|
| 375 | { |
---|
| 376 | case BLEND_AVRG: // average |
---|
| 377 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, true>; |
---|
| 378 | break; |
---|
| 379 | case BLEND_LEFT: // left view is main view |
---|
| 380 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, true>; |
---|
| 381 | break; |
---|
| 382 | case BLEND_RIGHT: // right view is main view |
---|
| 383 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, true>; |
---|
| 384 | break; |
---|
| 385 | default: |
---|
| 386 | AOT(true); |
---|
| 387 | break; |
---|
| 388 | } |
---|
| 389 | } |
---|
| 390 | } |
---|
| 391 | else |
---|
| 392 | { |
---|
| 393 | if ( iMode != 2 ) |
---|
| 394 | { // No Blending |
---|
| 395 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, false>; |
---|
| 396 | } |
---|
| 397 | else |
---|
| 398 | { |
---|
| 399 | switch ( iBlendMode ) |
---|
| 400 | { |
---|
| 401 | case BLEND_AVRG: // average |
---|
| 402 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, false>; |
---|
| 403 | break; |
---|
| 404 | case BLEND_LEFT: // left view is main view |
---|
| 405 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, false>; |
---|
| 406 | break; |
---|
| 407 | case BLEND_RIGHT: // right view is main view |
---|
| 408 | m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, false>; |
---|
| 409 | break; |
---|
| 410 | default: |
---|
| 411 | AOT(true); |
---|
| 412 | break; |
---|
| 413 | } |
---|
| 414 | } |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | |
---|
[446] | 418 | #if H_3D_VSO_EARLY_SKIP |
---|
[438] | 419 | m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, iBlendMode, m_bEarlySkip ); |
---|
| 420 | #else |
---|
| 421 | m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin, bUseOrgRef, iBlendMode ); |
---|
| 422 | #endif |
---|
| 423 | |
---|
| 424 | if ( iLeftViewNum != -1 ) |
---|
| 425 | { |
---|
| 426 | xSetLRViewAndAddModel( iModelNum, iLeftViewNum, iContent, VIEWPOS_LEFT, (iBaseViewNum == -1 || iBaseViewNum == iLeftViewNum ) ); |
---|
| 427 | } |
---|
| 428 | |
---|
| 429 | if ( iRightViewNum != -1) |
---|
| 430 | { |
---|
| 431 | xSetLRViewAndAddModel( iModelNum, iRightViewNum, iContent, VIEWPOS_RIGHT, (iBaseViewNum == -1 || iBaseViewNum == iRightViewNum ) ); |
---|
| 432 | } |
---|
| 433 | } |
---|
| 434 | |
---|
| 435 | Void |
---|
| 436 | TRenModel::setBaseView( Int iViewNum, TComPicYuv* pcPicYuvVideoData, TComPicYuv* pcPicYuvDepthData, TComPicYuv* pcPicYuvOrgVideoData, TComPicYuv* pcPicYuvOrgDepthData ) |
---|
| 437 | { |
---|
| 438 | AOT( iViewNum < 0 || iViewNum > m_iNumOfBaseViews ); |
---|
| 439 | AOF( pcPicYuvVideoData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvVideoData->getWidth() == m_iWidth ); |
---|
| 440 | AOF( pcPicYuvDepthData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvDepthData->getWidth() == m_iWidth ); |
---|
| 441 | |
---|
| 442 | pcPicYuvVideoData->extendPicBorder(); |
---|
| 443 | |
---|
| 444 | TRenFilter::sampleHorUp ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr() + m_uiHorOff * pcPicYuvVideoData->getStride () , pcPicYuvVideoData->getStride() , m_iWidth, m_iUsedHeight, m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] ); |
---|
| 445 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCbAddr() + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] ); |
---|
| 446 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCrAddr() + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] ); |
---|
| 447 | TRenFilter::copy ( pcPicYuvDepthData->getLumaAddr() + m_uiHorOff * pcPicYuvDepthData->getStride () , pcPicYuvDepthData->getStride(), m_iWidth, m_iUsedHeight, m_apiCurDepthPel [ iViewNum], m_aiCurDepthStrides [iViewNum] ); |
---|
| 448 | |
---|
| 449 | // Used for rendering reference pic from original video data |
---|
| 450 | m_abSetupVideoFromOrgForView[iViewNum] = (pcPicYuvOrgVideoData != NULL); |
---|
| 451 | m_abSetupDepthFromOrgForView[iViewNum] = (pcPicYuvOrgDepthData != NULL); |
---|
| 452 | |
---|
| 453 | if ( m_abSetupVideoFromOrgForView[iViewNum] ) |
---|
| 454 | { |
---|
| 455 | AOF( pcPicYuvOrgVideoData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgVideoData->getWidth() == m_iWidth ); |
---|
| 456 | pcPicYuvOrgVideoData->extendPicBorder(); |
---|
| 457 | TRenFilter::sampleHorUp ( m_iShiftPrec, pcPicYuvOrgVideoData->getLumaAddr() + m_uiHorOff * pcPicYuvOrgVideoData->getStride() , pcPicYuvOrgVideoData->getStride() , m_iWidth, m_iUsedHeight, m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] ); |
---|
| 458 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCbAddr() + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] ); |
---|
| 459 | TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCrAddr() + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] ); |
---|
| 460 | } |
---|
| 461 | |
---|
| 462 | if ( m_abSetupDepthFromOrgForView[iViewNum] ) |
---|
| 463 | { |
---|
| 464 | AOF( pcPicYuvOrgDepthData->getHeight() >= m_iUsedHeight + m_uiHorOff && pcPicYuvOrgDepthData->getWidth() == m_iWidth ); |
---|
| 465 | TRenFilter::copy ( pcPicYuvOrgDepthData->getLumaAddr() + m_uiHorOff * pcPicYuvOrgDepthData->getStride() , pcPicYuvOrgDepthData->getStride(), m_iWidth, m_iUsedHeight, m_apiOrgDepthPel [ iViewNum], m_aiOrgDepthStrides [iViewNum] ); |
---|
| 466 | } |
---|
| 467 | } |
---|
| 468 | |
---|
| 469 | Void |
---|
| 470 | TRenModel::setSingleModel( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView ) |
---|
| 471 | { |
---|
| 472 | AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); |
---|
| 473 | |
---|
| 474 | m_apcRenModels[iModelNum]->setupPart( m_uiHorOff, m_iUsedHeight ); |
---|
| 475 | |
---|
| 476 | // Switch model to original data for setup if given to render reference |
---|
| 477 | Bool bAnyRefFromOrg = false; |
---|
| 478 | for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ ) |
---|
| 479 | { |
---|
| 480 | Bool bSetupFromOrgVideo = m_abSetupVideoFromOrgForView[iBaseViewIdx]; |
---|
| 481 | Bool bSetupFromOrgDepth = m_abSetupDepthFromOrgForView[iBaseViewIdx]; |
---|
| 482 | bAnyRefFromOrg = bAnyRefFromOrg || bSetupFromOrgVideo || bSetupFromOrgDepth; |
---|
| 483 | |
---|
| 484 | if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID ) |
---|
| 485 | { |
---|
| 486 | bAnyRefFromOrg = true; |
---|
| 487 | m_apcRenModels[iModelNum]->setLRView( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum], |
---|
| 488 | ( bSetupFromOrgVideo ? m_aapiOrgVideoPel : m_aapiCurVideoPel ) [iBaseViewIdx], |
---|
| 489 | ( bSetupFromOrgVideo ? m_aaiOrgVideoStrides: m_aaiCurVideoStrides) [iBaseViewIdx], |
---|
| 490 | ( bSetupFromOrgDepth ? m_apiOrgDepthPel : m_apiCurDepthPel ) [iBaseViewIdx], |
---|
| 491 | ( bSetupFromOrgDepth ? m_aiOrgDepthStrides : m_aiCurDepthStrides ) [iBaseViewIdx] ); |
---|
| 492 | } |
---|
| 493 | } |
---|
| 494 | |
---|
| 495 | m_apcRenModels[iModelNum]->setup ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false ); |
---|
| 496 | |
---|
| 497 | // Setup to Org |
---|
| 498 | if ( bAnyRefFromOrg ) |
---|
| 499 | { |
---|
| 500 | // Restore old values |
---|
| 501 | for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ ) |
---|
| 502 | { |
---|
| 503 | if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID ) |
---|
| 504 | { |
---|
| 505 | m_apcRenModels[iModelNum]->setLRView( |
---|
| 506 | m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum], |
---|
| 507 | m_aapiCurVideoPel [iBaseViewIdx], |
---|
| 508 | m_aaiCurVideoStrides [iBaseViewIdx], |
---|
| 509 | m_apiCurDepthPel [iBaseViewIdx], |
---|
| 510 | m_aiCurDepthStrides [iBaseViewIdx] |
---|
| 511 | ); |
---|
| 512 | } |
---|
| 513 | } |
---|
| 514 | |
---|
| 515 | // setup keeping reference rendered from original data |
---|
| 516 | m_apcRenModels[iModelNum]->setup ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true ); |
---|
| 517 | } |
---|
| 518 | } |
---|
| 519 | |
---|
| 520 | Void |
---|
| 521 | TRenModel::setErrorMode( Int iView, Int iContent, int iPlane ) |
---|
| 522 | { |
---|
| 523 | AOT(iView > m_iNumOfBaseViews || iView < 0); |
---|
| 524 | AOT(iContent != 0 && iContent != 1); |
---|
| 525 | AOT(iPlane < 0 || iPlane > 3); |
---|
| 526 | |
---|
| 527 | m_iCurrentView = iView; |
---|
| 528 | m_iCurrentContent = iContent; |
---|
| 529 | m_iCurrentPlane = iPlane; |
---|
| 530 | |
---|
| 531 | if ( iContent == 1 ) |
---|
| 532 | { |
---|
| 533 | m_iNumOfCurRenModels = m_aiNumOfModelsForDepthView[iView]; |
---|
| 534 | m_apcCurRenModels = m_aapcRenModelForDepthView [iView]; |
---|
| 535 | m_aiCurPosInModels = m_aaePosInModelForDepthView[iView]; |
---|
| 536 | } |
---|
| 537 | else |
---|
| 538 | { |
---|
| 539 | m_iNumOfCurRenModels = m_aiNumOfModelsForVideoView[iView]; |
---|
| 540 | m_apcCurRenModels = m_aapcRenModelForVideoView [iView]; |
---|
| 541 | m_aiCurPosInModels = m_aaePosInModelForVideoView[iView]; |
---|
| 542 | } |
---|
| 543 | } |
---|
| 544 | |
---|
| 545 | |
---|
| 546 | Void |
---|
| 547 | TRenModel::setupPart ( UInt uiHorOff, Int iUsedHeight ) |
---|
| 548 | { |
---|
| 549 | AOT( iUsedHeight > m_iHeight ); |
---|
| 550 | m_uiHorOff = uiHorOff; |
---|
| 551 | m_iUsedHeight = iUsedHeight; |
---|
| 552 | } |
---|
| 553 | |
---|
[446] | 554 | #if H_3D_VSO_EARLY_SKIP |
---|
[438] | 555 | RMDist |
---|
| 556 | TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride) |
---|
| 557 | #else |
---|
| 558 | RMDist |
---|
| 559 | TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
| 560 | #endif |
---|
| 561 | { |
---|
| 562 | iStartPosY -= m_uiHorOff; |
---|
| 563 | |
---|
| 564 | AOT( iWidth + iStartPosX > m_iWidth ); |
---|
| 565 | AOT( iHeight + iStartPosY > m_iUsedHeight ); |
---|
| 566 | |
---|
| 567 | AOT( iStartPosX < 0); |
---|
| 568 | AOT( iStartPosY < 0); |
---|
| 569 | AOT( iWidth < 0); |
---|
| 570 | AOT( iHeight < 0); |
---|
| 571 | |
---|
| 572 | RMDist iDist = 0; |
---|
| 573 | |
---|
| 574 | for (Int iModelNum = 0; iModelNum < m_iNumOfCurRenModels; iModelNum++ ) |
---|
| 575 | { |
---|
| 576 | if (m_iCurrentContent == 1) |
---|
| 577 | { |
---|
[446] | 578 | #if H_3D_VSO_EARLY_SKIP |
---|
[438] | 579 | iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData , piOrgData, iOrgStride); |
---|
| 580 | #else |
---|
| 581 | iDist += m_apcCurRenModels[iModelNum]->getDistDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
| 582 | #endif |
---|
| 583 | } |
---|
| 584 | else |
---|
| 585 | { |
---|
| 586 | iDist += m_apcCurRenModels[iModelNum]->getDistVideo ( m_aiCurPosInModels[iModelNum], m_iCurrentPlane ,iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
| 587 | } |
---|
| 588 | } |
---|
| 589 | |
---|
| 590 | return ( iDist + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 591 | } |
---|
| 592 | |
---|
| 593 | Void |
---|
| 594 | TRenModel::setData( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) |
---|
| 595 | { |
---|
| 596 | iStartPosY -= m_uiHorOff; |
---|
| 597 | |
---|
| 598 | iWidth = min(iWidth , m_iWidth - iStartPosX ); |
---|
| 599 | iHeight = min(iHeight, m_iUsedHeight - iStartPosY ); |
---|
| 600 | |
---|
| 601 | AOT( iStartPosX < 0); |
---|
| 602 | AOT( iStartPosY < 0); |
---|
| 603 | AOT( iWidth < 0); |
---|
| 604 | AOT( iHeight < 0); |
---|
| 605 | |
---|
| 606 | for (Int iModelNum = 0; iModelNum < m_iNumOfCurRenModels; iModelNum++ ) |
---|
| 607 | { |
---|
| 608 | if (m_iCurrentContent == 1) |
---|
| 609 | { |
---|
[446] | 610 | #if H_3D_VSO_EARLY_SKIP |
---|
[438] | 611 | Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; |
---|
| 612 | m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX ,iTargetStride ); |
---|
| 613 | #else |
---|
| 614 | m_apcCurRenModels[iModelNum]->setDepth ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
| 615 | #endif |
---|
| 616 | } |
---|
| 617 | else |
---|
| 618 | { |
---|
| 619 | m_apcCurRenModels[iModelNum]->setVideo ( m_aiCurPosInModels[iModelNum], m_iCurrentPlane ,iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData ); |
---|
| 620 | } |
---|
| 621 | } |
---|
| 622 | |
---|
[446] | 623 | #if H_3D_VSO_EARLY_SKIP |
---|
[438] | 624 | if (m_iCurrentContent == 1) |
---|
| 625 | { |
---|
| 626 | Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ]; |
---|
| 627 | TRenFilter::copy( piNewData, iStride, iWidth, iHeight, m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX, iTargetStride ); |
---|
| 628 | } |
---|
| 629 | #endif |
---|
| 630 | } |
---|
| 631 | |
---|
| 632 | Void |
---|
| 633 | TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv ) |
---|
| 634 | { |
---|
| 635 | m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv ); |
---|
| 636 | } |
---|
| 637 | |
---|
| 638 | Void |
---|
| 639 | TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv ) |
---|
| 640 | { |
---|
| 641 | m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv ); |
---|
| 642 | } |
---|
| 643 | |
---|
| 644 | Void |
---|
| 645 | TRenModel::getTotalSSE( Int64& riSSEY, Int64& riSSEU, Int64& riSSEV ) |
---|
| 646 | { |
---|
| 647 | TComPicYuv cPicYuvSynth; |
---|
| 648 | cPicYuvSynth.create( m_iWidth, m_iUsedHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth ); |
---|
| 649 | |
---|
| 650 | TComPicYuv cPicYuvTempRef; |
---|
| 651 | cPicYuvTempRef.create( m_iWidth, m_iUsedHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth); |
---|
| 652 | |
---|
| 653 | Int64 iSSEY = 0; |
---|
| 654 | Int64 iSSEU = 0; |
---|
| 655 | Int64 iSSEV = 0; |
---|
| 656 | |
---|
| 657 | for (Int iCurModel = 0; iCurModel < m_iNumOfCurRenModels; iCurModel++) |
---|
| 658 | { |
---|
| 659 | m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth ); |
---|
| 660 | m_apcCurRenModels[iCurModel]->getRefVideo ( m_aiCurPosInModels[iCurModel], &cPicYuvTempRef ); |
---|
| 661 | |
---|
[446] | 662 | iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(), m_iWidth, m_iUsedHeight , cPicYuvTempRef.getLumaAddr(), cPicYuvTempRef.getStride() , true ); |
---|
| 663 | iSSEU += TRenFilter::SSE( cPicYuvSynth.getCbAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCbAddr() , cPicYuvTempRef.getCStride(), false ); |
---|
| 664 | iSSEV += TRenFilter::SSE( cPicYuvSynth.getCrAddr() , cPicYuvSynth.getCStride(), m_iWidth >> 1, m_iUsedHeight >> 1, cPicYuvTempRef.getCrAddr() , cPicYuvTempRef.getCStride(), false ); |
---|
[438] | 665 | } |
---|
| 666 | |
---|
| 667 | riSSEY = ( iSSEY + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 668 | riSSEU = ( iSSEU + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 669 | riSSEV = ( iSSEV + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels; |
---|
| 670 | |
---|
| 671 | cPicYuvTempRef.destroy(); |
---|
| 672 | cPicYuvSynth .destroy(); |
---|
| 673 | } |
---|
| 674 | |
---|
| 675 | Void |
---|
| 676 | TRenModel::xSetLRViewAndAddModel( Int iModelNum, Int iBaseViewNum, Int iContent, Int iViewPos, Bool bAdd ) |
---|
| 677 | { |
---|
| 678 | AOF(iViewPos == VIEWPOS_LEFT || iViewPos == VIEWPOS_RIGHT); |
---|
| 679 | AOF(iContent == -1 || iContent == 0 || iContent == 1); |
---|
| 680 | AOT( iBaseViewNum < 0 || iBaseViewNum > m_iNumOfBaseViews ); |
---|
| 681 | AOT( m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] != VIEWPOS_INVALID ); |
---|
| 682 | m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] = iViewPos; |
---|
| 683 | |
---|
| 684 | if (bAdd) |
---|
| 685 | { |
---|
| 686 | if (iContent == 0 || iContent == -1 ) |
---|
| 687 | { |
---|
| 688 | Int iNewModelIdxForView = m_aiNumOfModelsForVideoView[iBaseViewNum]++; |
---|
| 689 | m_aapcRenModelForVideoView [ iBaseViewNum ][ iNewModelIdxForView ] = m_apcRenModels[iModelNum]; |
---|
| 690 | m_aaePosInModelForVideoView[ iBaseViewNum ][ iNewModelIdxForView ] = iViewPos; |
---|
| 691 | } |
---|
| 692 | |
---|
| 693 | if (iContent == 1 || iContent == -1 ) |
---|
| 694 | { |
---|
| 695 | Int iNewModelIdxForView = m_aiNumOfModelsForDepthView[iBaseViewNum]++; |
---|
| 696 | m_aapcRenModelForDepthView [ iBaseViewNum ][ iNewModelIdxForView ] = m_apcRenModels[iModelNum]; |
---|
| 697 | m_aaePosInModelForDepthView[ iBaseViewNum ][ iNewModelIdxForView ] = iViewPos; |
---|
| 698 | } |
---|
| 699 | } |
---|
| 700 | } |
---|
[446] | 701 | #endif // H_3D |
---|