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