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 | |
---|
35 | |
---|
36 | |
---|
37 | // Include files |
---|
38 | #include "TAppComCamPara.h" |
---|
39 | |
---|
40 | |
---|
41 | #include <stdlib.h> |
---|
42 | #include <math.h> |
---|
43 | #include <errno.h> |
---|
44 | #include <assert.h> |
---|
45 | #include <vector> |
---|
46 | #include <iostream> |
---|
47 | #include <fstream> |
---|
48 | #include <algorithm> |
---|
49 | #include <functional> |
---|
50 | #include <string> |
---|
51 | #if H_3D |
---|
52 | |
---|
53 | |
---|
54 | Void |
---|
55 | TAppComCamPara::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams ) |
---|
56 | { |
---|
57 | AOF( m_uiBitDepthForLUT == 8 ); |
---|
58 | AOF( radShiftParams == NULL && raiShiftParams == NULL && radLUT == NULL && raiLUT == NULL ); |
---|
59 | |
---|
60 | uiNumberSourceViews = std::max( (UInt) 1, uiNumberSourceViews ); |
---|
61 | uiNumberTargetViews = std::max( (UInt) 1, uiNumberTargetViews ); |
---|
62 | |
---|
63 | radShiftParams = new Double** [ uiNumberSourceViews ]; |
---|
64 | raiShiftParams = new Int64 ** [ uiNumberSourceViews ]; |
---|
65 | radLUT = new Double***[ uiNumberSourceViews ]; |
---|
66 | raiLUT = new Int ***[ uiNumberSourceViews ]; |
---|
67 | |
---|
68 | for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ ) |
---|
69 | { |
---|
70 | radShiftParams[ uiSourceView ] = new Double* [ uiNumberTargetViews ]; |
---|
71 | raiShiftParams[ uiSourceView ] = new Int64 * [ uiNumberTargetViews ]; |
---|
72 | radLUT [ uiSourceView ] = new Double**[ uiNumberTargetViews ]; |
---|
73 | raiLUT [ uiSourceView ] = new Int **[ uiNumberTargetViews ]; |
---|
74 | |
---|
75 | for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ ) |
---|
76 | { |
---|
77 | radShiftParams[ uiSourceView ][ uiTargetView ] = new Double [ 2 ]; |
---|
78 | raiShiftParams[ uiSourceView ][ uiTargetView ] = new Int64 [ 2 ]; |
---|
79 | |
---|
80 | radLUT [ uiSourceView ][ uiTargetView ] = new Double*[ 2 ]; |
---|
81 | radLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ]; |
---|
82 | radLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ]; |
---|
83 | |
---|
84 | raiLUT [ uiSourceView ][ uiTargetView ] = new Int* [ 2 ]; |
---|
85 | raiLUT [ uiSourceView ][ uiTargetView ][ 0 ] = new Int [ 257 ]; |
---|
86 | raiLUT [ uiSourceView ][ uiTargetView ][ 1 ] = new Int [ 257 ]; |
---|
87 | } |
---|
88 | } |
---|
89 | } |
---|
90 | |
---|
91 | Void |
---|
92 | TAppComCamPara::xCreate2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray ) |
---|
93 | { |
---|
94 | AOT( raaiArray || uiNum1Ids == 0 || uiNum2Ids == 0 ); |
---|
95 | raaiArray = new Int* [ uiNum1Ids ]; |
---|
96 | for( UInt uiId1 = 0; uiId1 < uiNum1Ids; uiId1++ ) |
---|
97 | { |
---|
98 | raaiArray[ uiId1 ] = new Int [ uiNum2Ids ]; |
---|
99 | } |
---|
100 | } |
---|
101 | |
---|
102 | |
---|
103 | Void |
---|
104 | TAppComCamPara::xInit2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray, Int iValue ) |
---|
105 | { |
---|
106 | for( UInt uiId1 = 0; uiId1 < uiNum1Ids; uiId1++ ) |
---|
107 | { |
---|
108 | for( UInt uiId2 = 0; uiId2 < uiNum2Ids; uiId2++ ) |
---|
109 | { |
---|
110 | raaiArray[ uiId1 ][ uiId2 ] = iValue; |
---|
111 | } |
---|
112 | } |
---|
113 | } |
---|
114 | |
---|
115 | |
---|
116 | Void |
---|
117 | TAppComCamPara::convertNumberString( Char* pchViewNumberString, std::vector<Int>& raiViewNumbers, Double dViewNumPrec ) |
---|
118 | { |
---|
119 | Bool bStringIsRange = false; |
---|
120 | Int iIdx = 0; |
---|
121 | std::vector<Double> adViewNumbers; |
---|
122 | |
---|
123 | while( pchViewNumberString != 0 && pchViewNumberString[ iIdx ] != 0 ) |
---|
124 | { |
---|
125 | if( pchViewNumberString[ iIdx ] == ':' ) |
---|
126 | { |
---|
127 | bStringIsRange = true; |
---|
128 | pchViewNumberString[ iIdx ] = ' '; |
---|
129 | } |
---|
130 | iIdx++; |
---|
131 | } |
---|
132 | |
---|
133 | Char* pcNextStart = pchViewNumberString; |
---|
134 | Char* pcEnd = pcNextStart + iIdx; |
---|
135 | Char* pcOldStart = 0; |
---|
136 | |
---|
137 | while( pcNextStart < pcEnd ) |
---|
138 | { |
---|
139 | errno = 0; |
---|
140 | adViewNumbers.push_back( ( strtod( pcNextStart, &pcNextStart ) ) ); |
---|
141 | |
---|
142 | if( errno == ERANGE || pcNextStart == pcOldStart ) |
---|
143 | { |
---|
144 | std::cerr << "Error Parsing View Number String: `" << pchViewNumberString << "'" << std::endl; |
---|
145 | AOT(true); |
---|
146 | exit( EXIT_FAILURE ); |
---|
147 | }; |
---|
148 | |
---|
149 | while( pcNextStart < pcEnd && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; |
---|
150 | |
---|
151 | pcOldStart = pcNextStart; |
---|
152 | } |
---|
153 | |
---|
154 | if( bStringIsRange ) |
---|
155 | { |
---|
156 | if( adViewNumbers.size() != 3 ) |
---|
157 | { |
---|
158 | std::cerr << "Error Parsing SynthViewNumbers: `" << pchViewNumberString << "'" << std::endl; |
---|
159 | AOT(true); |
---|
160 | exit( EXIT_FAILURE ); |
---|
161 | } |
---|
162 | |
---|
163 | Double dRangeBegin = adViewNumbers[0]; |
---|
164 | Double dRangeStep = adViewNumbers[1]; |
---|
165 | Double dRangeEnd = adViewNumbers[2]; |
---|
166 | |
---|
167 | if( ( ( dRangeEnd - dRangeBegin > 0 ) != ( dRangeStep > 0 ) ) || dRangeStep == 0 ) |
---|
168 | { |
---|
169 | std::cerr << "Error Parsing SynthViewNumbers: `" << pchViewNumberString << "'" << std::endl; |
---|
170 | AOT(true); |
---|
171 | exit( EXIT_FAILURE ); |
---|
172 | } |
---|
173 | |
---|
174 | raiViewNumbers.clear(); |
---|
175 | |
---|
176 | Double dFac = ( dRangeBegin > dRangeEnd ? -1 : 1 ); |
---|
177 | |
---|
178 | for( Double dViewNumber = dRangeBegin; ( dViewNumber - dRangeEnd ) * dFac <= 0; dViewNumber += dRangeStep ) |
---|
179 | { |
---|
180 | raiViewNumbers.push_back( (Int)( dViewNumber * dViewNumPrec ) ); |
---|
181 | } |
---|
182 | } |
---|
183 | else |
---|
184 | { |
---|
185 | for( UInt uiViewNum = 0; uiViewNum < adViewNumbers.size(); uiViewNum++ ) |
---|
186 | { |
---|
187 | raiViewNumbers.push_back( (Int)( adViewNumbers[ uiViewNum ] * dViewNumPrec ) ); |
---|
188 | } |
---|
189 | } |
---|
190 | } |
---|
191 | |
---|
192 | |
---|
193 | Void |
---|
194 | TAppComCamPara::xReadCameraParameterFile( Char* pchCfgFileName ) |
---|
195 | { |
---|
196 | std::ifstream cCfgStream( pchCfgFileName, std::ifstream::in ); |
---|
197 | if( !cCfgStream ) |
---|
198 | { |
---|
199 | std::cerr << "Failed to open camera parameter file: `" << pchCfgFileName << "'" << std::endl; |
---|
200 | exit( EXIT_FAILURE ); |
---|
201 | } |
---|
202 | |
---|
203 | Int iLineNumber = 0; |
---|
204 | do |
---|
205 | { |
---|
206 | std::string cLine; |
---|
207 | getline( cCfgStream, cLine ); |
---|
208 | iLineNumber++; |
---|
209 | |
---|
210 | size_t iStart = cLine.find_first_not_of( " \t\n\r" ); |
---|
211 | |
---|
212 | if( iStart == std::string::npos ) |
---|
213 | { |
---|
214 | continue; |
---|
215 | } |
---|
216 | |
---|
217 | if( cLine[iStart] == '#' ) |
---|
218 | { |
---|
219 | continue; |
---|
220 | } |
---|
221 | |
---|
222 | Char* pcNextStart = (Char*) cLine.data(); |
---|
223 | Char* pcEnd = pcNextStart + cLine.length(); |
---|
224 | |
---|
225 | std::vector<Double> caNewLine; |
---|
226 | caNewLine.clear(); |
---|
227 | |
---|
228 | Char* pcOldStart = 0; |
---|
229 | while( pcNextStart < pcEnd ) |
---|
230 | { |
---|
231 | errno = 0; |
---|
232 | caNewLine.push_back( strtod( pcNextStart, &pcNextStart ) ) ; |
---|
233 | |
---|
234 | if( errno == ERANGE || ( pcNextStart == pcOldStart ) ) |
---|
235 | { |
---|
236 | std::cerr << "Failed reading config file: `" << pchCfgFileName << "' Error parsing double values in Line: " << iLineNumber << ' ' << std::endl; |
---|
237 | assert( 0 ); |
---|
238 | exit( EXIT_FAILURE ); |
---|
239 | }; |
---|
240 | pcOldStart = pcNextStart; |
---|
241 | |
---|
242 | while( ( pcNextStart < pcEnd ) && ( *pcNextStart == ' ' || *pcNextStart == '\t' || *pcNextStart == '\r' ) ) pcNextStart++; |
---|
243 | } |
---|
244 | |
---|
245 | if ( ( caNewLine.size() != 2 ) && ( caNewLine.size() != 7 ) && ( caNewLine.size() != 6 ) && ( caNewLine.size() != 8 ) ) |
---|
246 | { |
---|
247 | std::cerr << "Failed reading config file: `" << pchCfgFileName << "'" << std::endl; |
---|
248 | std::cerr << "Invalid number of entries" << std::endl; |
---|
249 | AOF(false); |
---|
250 | exit( EXIT_FAILURE ); |
---|
251 | } |
---|
252 | m_aadCameraParameters.push_back( caNewLine ); |
---|
253 | } |
---|
254 | while( cCfgStream ); |
---|
255 | } |
---|
256 | |
---|
257 | Void |
---|
258 | TAppComCamPara::xGetCodedCameraData( UInt uiSourceView, UInt uiTargetView, Bool bByIdx, UInt uiFrame, Int& riScale, Int& riOffset, Int& riPrecision ) |
---|
259 | { |
---|
260 | if( bByIdx ) |
---|
261 | { |
---|
262 | uiSourceView = m_aiBaseViews[ uiSourceView ]; |
---|
263 | uiTargetView = m_aiBaseViews[ uiTargetView ]; |
---|
264 | } |
---|
265 | |
---|
266 | Int iFoundLine = -1; |
---|
267 | for( UInt uiCurViewLine = 0; uiCurViewLine < m_aadCameraParameters.size(); uiCurViewLine++ ) |
---|
268 | { |
---|
269 | if ( m_aadCameraParameters[uiCurViewLine].size() == 2 ) |
---|
270 | continue; |
---|
271 | |
---|
272 | if( ( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 3 ] * m_dViewNumPrec ) == uiSourceView ) |
---|
273 | && ( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 2 ] * m_dViewNumPrec ) == uiTargetView ) |
---|
274 | ) |
---|
275 | { |
---|
276 | if( ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 0 ] <= uiFrame ) && ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 1 ] >= uiFrame ) ) |
---|
277 | { |
---|
278 | if( iFoundLine != -1 ) |
---|
279 | { |
---|
280 | std::cerr << "Error CameraParameters for SourceView " << (Double) uiSourceView / m_dViewNumPrec << " and Target View " << (Double) uiTargetView / m_dViewNumPrec << " and Frame " << uiFrame << " given multiple times." << std::endl; |
---|
281 | AOT(true); |
---|
282 | exit( EXIT_FAILURE ); |
---|
283 | } |
---|
284 | else |
---|
285 | { |
---|
286 | iFoundLine = uiCurViewLine; |
---|
287 | } |
---|
288 | } |
---|
289 | } |
---|
290 | } |
---|
291 | |
---|
292 | if ( iFoundLine == -1 ) |
---|
293 | { |
---|
294 | std::cerr << "Error CameraParameters for SourceView " << (Double) uiSourceView / m_dViewNumPrec << " and Target View " << (Double) uiTargetView / m_dViewNumPrec << " and Frame " << uiFrame << " not found." << std::endl; |
---|
295 | AOT(true); |
---|
296 | exit( EXIT_FAILURE ); |
---|
297 | } |
---|
298 | |
---|
299 | riScale = (Int)( m_aadCameraParameters[ iFoundLine ][ 4 ] ); |
---|
300 | riOffset = (Int)( m_aadCameraParameters[ iFoundLine ][ 5 ] ); |
---|
301 | riPrecision = (Int)( m_aadCameraParameters[ iFoundLine ][ 6 ] ); |
---|
302 | } |
---|
303 | |
---|
304 | Bool |
---|
305 | TAppComCamPara::xGetCameraDataRow( Int iView, UInt uiFrame, UInt& ruiFoundLine ) |
---|
306 | { |
---|
307 | ruiFoundLine = -1; |
---|
308 | for( UInt uiCurViewLine = 0; uiCurViewLine < m_aadCameraParameters.size(); uiCurViewLine++ ) |
---|
309 | { |
---|
310 | if( (Int)( m_aadCameraParameters[ uiCurViewLine ][ 0 ] * m_dViewNumPrec ) == iView ) |
---|
311 | { |
---|
312 | if( ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 1 ] <= uiFrame ) && ( (UInt)m_aadCameraParameters[ uiCurViewLine ][ 2 ] >= uiFrame ) ) |
---|
313 | { |
---|
314 | if( ruiFoundLine != -1 ) |
---|
315 | { |
---|
316 | std::cerr << "Error CameraParameters for View " << (Double) iView / m_dViewNumPrec << " and Frame " << uiFrame << " given multiple times." << std::endl; |
---|
317 | exit( EXIT_FAILURE ); |
---|
318 | } |
---|
319 | else |
---|
320 | { |
---|
321 | ruiFoundLine = uiCurViewLine; |
---|
322 | } |
---|
323 | } |
---|
324 | } |
---|
325 | } |
---|
326 | return ( ruiFoundLine == -1 ); |
---|
327 | } |
---|
328 | |
---|
329 | |
---|
330 | Void |
---|
331 | TAppComCamPara::xGetSortedViewList( const std::vector<Int>& raiViews, std::vector<Int>& raiSortedViews, std::vector<Int>& raiId2SortedId, std::vector<Int>& raiSortedId2Id ) |
---|
332 | { |
---|
333 | AOF( raiViews.size() > 0 ); |
---|
334 | Int iNumViews = (Int)raiViews.size(); |
---|
335 | raiId2SortedId = std::vector<Int>( raiViews.size(), -1 ); |
---|
336 | raiSortedId2Id.clear(); |
---|
337 | raiSortedViews.clear(); |
---|
338 | for( Int iSortId = 0; iSortId < iNumViews; iSortId++ ) |
---|
339 | { |
---|
340 | Int iLeftMostBaseId = -1; |
---|
341 | for( Int iBaseId = 0; iLeftMostBaseId == -1 && iBaseId < iNumViews; iBaseId++ ) |
---|
342 | { |
---|
343 | if( raiId2SortedId[ iBaseId ] == -1 ) |
---|
344 | { |
---|
345 | UInt uiFoundLine = -1; |
---|
346 | xGetCameraDataRow( raiViews[ iBaseId ], 0, uiFoundLine ); |
---|
347 | AOT( uiFoundLine == -1 ); // something wrong |
---|
348 | Double dXPos = m_aadCameraParameters[ uiFoundLine ][ 4 ]; |
---|
349 | Double dZNear = m_aadCameraParameters[ uiFoundLine ][ 6 ]; |
---|
350 | Double dZFar = m_aadCameraParameters[ uiFoundLine ][ 7 ]; |
---|
351 | Double dSign = ( dZFar > 0 ? 1.0 : -1.0 ); |
---|
352 | Bool bLeftMost = true; |
---|
353 | AOF( dZNear * dZFar > 0.0 ); // otherwise, z parameters are not correct |
---|
354 | |
---|
355 | for( Int iTestBaseId = 0; bLeftMost && iTestBaseId < iNumViews; iTestBaseId++ ) |
---|
356 | { |
---|
357 | if( iTestBaseId != iBaseId && raiId2SortedId[ iTestBaseId ] == -1 ) |
---|
358 | { |
---|
359 | UInt uiFoundLineTest = -1; |
---|
360 | xGetCameraDataRow( raiViews[ iTestBaseId ], 0, uiFoundLineTest ); |
---|
361 | AOT( uiFoundLineTest == -1 ); // something wrong |
---|
362 | Double dXPosTest = m_aadCameraParameters[ uiFoundLineTest ][ 4 ]; |
---|
363 | Double dZNearTest = m_aadCameraParameters[ uiFoundLineTest ][ 6 ]; |
---|
364 | Double dZFarTest = m_aadCameraParameters[ uiFoundLineTest ][ 7 ]; |
---|
365 | AOF( dZNearTest * dZFarTest > 0.0 ); // otherwise, z parameters are not correct |
---|
366 | AOF( dZNearTest * dSign > 0.0 ); // otherwise, z parameters are not consistent |
---|
367 | Double dDeltaXPos = dSign * ( dXPosTest - dXPos ); |
---|
368 | bLeftMost = ( bLeftMost && dDeltaXPos > 0.0 ); |
---|
369 | } |
---|
370 | } |
---|
371 | if( bLeftMost ) |
---|
372 | { |
---|
373 | iLeftMostBaseId = iBaseId; |
---|
374 | } |
---|
375 | } |
---|
376 | } |
---|
377 | AOT( iLeftMostBaseId == -1 ); // something wrong |
---|
378 | raiId2SortedId[ iLeftMostBaseId ] = iSortId; |
---|
379 | raiSortedId2Id.push_back( iLeftMostBaseId ); |
---|
380 | raiSortedViews.push_back( raiViews[ iLeftMostBaseId ] ); |
---|
381 | } |
---|
382 | |
---|
383 | // sanity check |
---|
384 | if( iNumViews > 2 ) |
---|
385 | { |
---|
386 | Int iDeltaView = gSign( raiSortedViews[ 1 ] - raiSortedViews[ 0 ] ); |
---|
387 | Bool bOutOfOrder = false; |
---|
388 | for( Int iSIdx = 2; iSIdx < iNumViews; iSIdx++ ) |
---|
389 | { |
---|
390 | bOutOfOrder = ( bOutOfOrder || iDeltaView * gSign( raiSortedViews[ iSIdx ] - raiSortedViews[ iSIdx - 1 ] ) < 0 ); |
---|
391 | } |
---|
392 | if( bOutOfOrder ) |
---|
393 | { |
---|
394 | std::cerr << "ERROR: View numbering must be strictly increasing or decreasing from left to right" << std::endl; |
---|
395 | exit(EXIT_FAILURE); |
---|
396 | } |
---|
397 | } |
---|
398 | } |
---|
399 | |
---|
400 | |
---|
401 | Void |
---|
402 | TAppComCamPara::xGetViewOrderIndices( const std::vector<Int>& raiId2SortedId, std::vector<Int>& raiVOIdx ) |
---|
403 | { |
---|
404 | AOF( raiId2SortedId.size() ); |
---|
405 | raiVOIdx = raiId2SortedId; |
---|
406 | Int iSize = (Int)raiId2SortedId.size(); |
---|
407 | Int iOffs = raiId2SortedId[ 0 ]; |
---|
408 | for( Int iIdx = 0; iIdx < iSize; iIdx++ ) |
---|
409 | { |
---|
410 | raiVOIdx[ iIdx ] -= iOffs; |
---|
411 | } |
---|
412 | } |
---|
413 | |
---|
414 | |
---|
415 | Bool |
---|
416 | TAppComCamPara::xGetCamParsChangeFlag() |
---|
417 | { |
---|
418 | Bool bChangeDetected = false; |
---|
419 | for( Int iBaseViewId = 0; !bChangeDetected && iBaseViewId < m_iNumberOfBaseViews; iBaseViewId++ ) |
---|
420 | { |
---|
421 | if ( m_bSetupFromCoded ) |
---|
422 | { |
---|
423 | for( Int iTargetViewId = 0; !bChangeDetected && iTargetViewId < m_iNumberOfBaseViews; iTargetViewId++ ) |
---|
424 | { |
---|
425 | Int iTargetView = m_aiBaseViews[iTargetViewId]; |
---|
426 | Int iSourceView = m_aiBaseViews[iBaseViewId ]; |
---|
427 | |
---|
428 | Int iS1 ,iSX; |
---|
429 | Int iO1 ,iOX; |
---|
430 | Int iP1 ,iPX; |
---|
431 | |
---|
432 | if ( iSourceView == iTargetView ) |
---|
433 | continue; |
---|
434 | |
---|
435 | xGetCodedCameraData( iSourceView, iTargetView, false, 0, iS1, iO1, iP1 ); |
---|
436 | for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ ) |
---|
437 | { |
---|
438 | xGetCodedCameraData( iSourceView, iTargetView, false, uiFrameId, iSX, iOX, iPX ); |
---|
439 | |
---|
440 | if( iS1 != iSX || iO1 != iOX || iP1 != iPX ) |
---|
441 | { |
---|
442 | bChangeDetected = true; |
---|
443 | } |
---|
444 | } |
---|
445 | } |
---|
446 | } |
---|
447 | else |
---|
448 | { |
---|
449 | Int iBaseView = m_aiBaseViews[ iBaseViewId ]; |
---|
450 | Double dFL1, dFLX; |
---|
451 | Double dCP1, dCPX; |
---|
452 | Double dCS1, dCSX; |
---|
453 | Double dZN1, dZNX; |
---|
454 | Double dZF1, dZFX; |
---|
455 | Bool bInterpolated; |
---|
456 | xGetGeometryData( iBaseView, m_uiFirstFrameId, dFL1, dCP1, dCS1, bInterpolated ); AOT( bInterpolated ); |
---|
457 | xGetZNearZFar ( iBaseView, m_uiFirstFrameId, dZN1, dZF1 ); |
---|
458 | |
---|
459 | for( UInt uiFrameId = m_uiFirstFrameId + 1; !bChangeDetected && uiFrameId <= m_uiLastFrameId; uiFrameId++ ) |
---|
460 | { |
---|
461 | xGetGeometryData( iBaseView, uiFrameId, dFLX, dCPX, dCSX, bInterpolated ); AOT( bInterpolated ); |
---|
462 | xGetZNearZFar ( iBaseView, uiFrameId, dZNX, dZFX ); |
---|
463 | |
---|
464 | if( dFL1 != dFLX || dCP1 != dCPX || dCS1 != dCSX || dZN1 != dZNX || dZF1 != dZFX ) |
---|
465 | { |
---|
466 | bChangeDetected = true; |
---|
467 | } |
---|
468 | } |
---|
469 | } |
---|
470 | } |
---|
471 | return bChangeDetected; |
---|
472 | } |
---|
473 | |
---|
474 | Int |
---|
475 | TAppComCamPara::xGetViewId( std::vector<Int> aiViewList, Int iBaseView ) |
---|
476 | { |
---|
477 | Int iViewId = -1; |
---|
478 | for( Int iId = 0; iId < (Int)aiViewList.size(); iId++ ) |
---|
479 | { |
---|
480 | if( aiViewList[ iId ] == iBaseView ) |
---|
481 | { |
---|
482 | iViewId = iId; |
---|
483 | break; |
---|
484 | } |
---|
485 | } |
---|
486 | AOT( iViewId == -1 ); |
---|
487 | return iViewId; |
---|
488 | } |
---|
489 | |
---|
490 | Int |
---|
491 | TAppComCamPara::xGetBaseViewId( Int iBaseView ) |
---|
492 | { |
---|
493 | return xGetViewId( m_aiBaseViews, iBaseView ); |
---|
494 | } |
---|
495 | |
---|
496 | |
---|
497 | Bool |
---|
498 | TAppComCamPara::xGetLeftRightView( Int iView, std::vector<Int> aiSortedViews, Int& riLeftView, Int& riRightView, Int& riLeftSortedViewIdx, Int& riRightSortedViewIdx ) |
---|
499 | { |
---|
500 | Bool bFoundLRView = false; |
---|
501 | Int iLeftView = -1; |
---|
502 | Int iRightView = -1; |
---|
503 | Int iLeftViewIdx = -1; |
---|
504 | Int iRightViewIdx = -1; |
---|
505 | Bool bDecencdingVN = ( aiSortedViews.size() >= 2 && aiSortedViews[ 0 ] > aiSortedViews[ 1 ] ); |
---|
506 | Int iFactor = ( bDecencdingVN ? -1 : 1 ); |
---|
507 | |
---|
508 | for( Int iIdx = -1; iIdx < (Int)aiSortedViews.size(); iIdx++ ) |
---|
509 | { |
---|
510 | if( iIdx == -1 ) |
---|
511 | { |
---|
512 | if( ( aiSortedViews[ iIdx + 1 ] - iView ) * iFactor > 0 ) |
---|
513 | { |
---|
514 | bFoundLRView = false; |
---|
515 | iLeftView = -1; |
---|
516 | iRightView = aiSortedViews[ iIdx + 1 ]; |
---|
517 | iLeftViewIdx = -1; |
---|
518 | iRightViewIdx = iIdx + 1; |
---|
519 | break; |
---|
520 | } |
---|
521 | } |
---|
522 | else if ( iIdx == (Int)aiSortedViews.size() - 1 ) |
---|
523 | { |
---|
524 | if( ( aiSortedViews[ iIdx ] - iView ) * iFactor < 0 ) |
---|
525 | { |
---|
526 | bFoundLRView = false; |
---|
527 | iLeftView = aiSortedViews[ iIdx ]; |
---|
528 | iRightView = -1; |
---|
529 | iLeftViewIdx = iIdx; |
---|
530 | iRightViewIdx = -1; |
---|
531 | break; |
---|
532 | } |
---|
533 | } |
---|
534 | else |
---|
535 | { |
---|
536 | if( ( ( aiSortedViews[ iIdx ] - iView ) * iFactor <= 0 ) && ( ( aiSortedViews[ iIdx + 1 ] - iView ) * iFactor >= 0 ) ) |
---|
537 | { |
---|
538 | bFoundLRView = true; |
---|
539 | iLeftView = aiSortedViews[ iIdx ]; |
---|
540 | iRightView = aiSortedViews[ iIdx + 1 ]; |
---|
541 | iLeftViewIdx = iIdx; |
---|
542 | iRightViewIdx = iIdx + 1; |
---|
543 | break; |
---|
544 | } |
---|
545 | } |
---|
546 | } |
---|
547 | |
---|
548 | if ( ( iView == iLeftView ) || ( iView == iRightView ) ) |
---|
549 | { |
---|
550 | iLeftViewIdx = ( iView == iLeftView ) ? iLeftViewIdx : iRightViewIdx; |
---|
551 | iRightViewIdx = iLeftViewIdx; |
---|
552 | iLeftView = iView; |
---|
553 | iRightView = iView; |
---|
554 | bFoundLRView = false; |
---|
555 | } |
---|
556 | |
---|
557 | riLeftView = iLeftView; |
---|
558 | riRightView = iRightView; |
---|
559 | riLeftSortedViewIdx = iLeftViewIdx; |
---|
560 | riRightSortedViewIdx = iRightViewIdx; |
---|
561 | |
---|
562 | return bFoundLRView; |
---|
563 | } |
---|
564 | |
---|
565 | |
---|
566 | Void |
---|
567 | TAppComCamPara::xGetPrevAndNextBaseView( Int iSourceViewNum, Int iTargetViewNum, Int& riPrevBaseViewNum, Int& riNextBaseViewNum ) |
---|
568 | { |
---|
569 | Int iLeftView; |
---|
570 | Int iRightView; |
---|
571 | Int iDummy; |
---|
572 | xGetLeftRightView( iTargetViewNum, m_aiSortedBaseViews, iLeftView, iRightView, iDummy, iDummy ); |
---|
573 | |
---|
574 | if( iLeftView == iRightView ) |
---|
575 | { |
---|
576 | riPrevBaseViewNum = iLeftView; |
---|
577 | riNextBaseViewNum = iLeftView; |
---|
578 | } |
---|
579 | else |
---|
580 | { |
---|
581 | Bool bDecencdingVN = ( m_aiSortedBaseViews.size() >= 2 && m_aiSortedBaseViews[ 0 ] > m_aiSortedBaseViews[ 1 ] ); |
---|
582 | Bool bNextViewIsLeft = ( bDecencdingVN ? ( iSourceViewNum < iTargetViewNum ) : ( iSourceViewNum > iTargetViewNum ) ); |
---|
583 | if ( bNextViewIsLeft ) |
---|
584 | { |
---|
585 | riPrevBaseViewNum = iRightView; |
---|
586 | riNextBaseViewNum = iLeftView; |
---|
587 | } |
---|
588 | else |
---|
589 | { |
---|
590 | riPrevBaseViewNum = iLeftView; |
---|
591 | riNextBaseViewNum = iRightView; |
---|
592 | } |
---|
593 | } |
---|
594 | } |
---|
595 | |
---|
596 | |
---|
597 | Void |
---|
598 | TAppComCamPara::xGetZNearZFar( Int iView, UInt uiFrame, Double& rdZNear, Double& rdZFar ) |
---|
599 | { |
---|
600 | UInt uiFoundLine = -1; |
---|
601 | if( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) || !( m_aadCameraParameters[ uiFoundLine ].size() < 8 ) ) |
---|
602 | { |
---|
603 | rdZNear = m_aadCameraParameters[ uiFoundLine ][ 6 ]; |
---|
604 | rdZFar = m_aadCameraParameters[ uiFoundLine ][ 7 ]; |
---|
605 | } |
---|
606 | else |
---|
607 | { |
---|
608 | std::cerr << "No ZNear or no ZFar for View " << (Double)iView / m_dViewNumPrec << " and Frame " << uiFrame << " given in CameraParameterFile" << std::endl; |
---|
609 | exit( EXIT_FAILURE ); |
---|
610 | } |
---|
611 | } |
---|
612 | |
---|
613 | |
---|
614 | Void |
---|
615 | TAppComCamPara::xGetGeometryData( Int iView, UInt uiFrame, Double& rdFocalLength, Double& rdPosition, Double& rdCameraShift, Bool& rbInterpolated ) |
---|
616 | { |
---|
617 | UInt uiFoundLine = -1; |
---|
618 | if ( !xGetCameraDataRow( iView, uiFrame, uiFoundLine ) ) |
---|
619 | { |
---|
620 | AOT( m_aadCameraParameters[ uiFoundLine ].size() < 6 ); |
---|
621 | rbInterpolated = false; |
---|
622 | rdFocalLength = m_aadCameraParameters[ uiFoundLine ][ 3 ]; |
---|
623 | rdPosition = m_aadCameraParameters[ uiFoundLine ][ 4 ]; |
---|
624 | rdCameraShift = m_aadCameraParameters[ uiFoundLine ][ 5 ]; |
---|
625 | } |
---|
626 | else |
---|
627 | { |
---|
628 | UInt uiLeftViewLine; |
---|
629 | UInt uiRightViewLine; |
---|
630 | Int iLeftView; |
---|
631 | Int iRightView; |
---|
632 | Int iDummy; |
---|
633 | |
---|
634 | if( !xGetLeftRightView( iView, m_aiViewsInCfgFile, iLeftView, iRightView, iDummy, iDummy ) || |
---|
635 | xGetCameraDataRow( iLeftView, uiFrame, uiLeftViewLine ) || |
---|
636 | xGetCameraDataRow( iRightView, uiFrame, uiRightViewLine ) |
---|
637 | ) |
---|
638 | { |
---|
639 | std::cerr << "No Left or no Right View next to View " << (Double)iView / m_dViewNumPrec << " for Frame " << uiFrame << " given in CameraParameterFile" << std::endl; |
---|
640 | AOT(true); |
---|
641 | exit( EXIT_FAILURE ); |
---|
642 | } |
---|
643 | AOT( m_aadCameraParameters[ uiLeftViewLine ].size() < 6 ); |
---|
644 | AOT( m_aadCameraParameters[ uiRightViewLine ].size() < 6 ); |
---|
645 | |
---|
646 | // Linear Interpolation |
---|
647 | Double dFactor = ( (Double)( iView - iLeftView ) ) / ( (Double)( iRightView - iLeftView ) ); |
---|
648 | rdFocalLength = m_aadCameraParameters[ uiLeftViewLine ][ 3 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 3 ] - m_aadCameraParameters[ uiLeftViewLine ][ 3 ] ); |
---|
649 | rdPosition = m_aadCameraParameters[ uiLeftViewLine ][ 4 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 4 ] - m_aadCameraParameters[ uiLeftViewLine ][ 4 ] ); |
---|
650 | rdCameraShift = m_aadCameraParameters[ uiLeftViewLine ][ 5 ] + dFactor * ( m_aadCameraParameters[ uiRightViewLine ][ 5 ] - m_aadCameraParameters[ uiLeftViewLine ][ 5 ] ); |
---|
651 | rbInterpolated = true; |
---|
652 | } |
---|
653 | } |
---|
654 | |
---|
655 | Bool |
---|
656 | TAppComCamPara::xGetShiftParameterReal( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bExternal, Bool bByIdx, Double& rdScale, Double& rdOffset ) |
---|
657 | { |
---|
658 | AOT( m_bSetupFromCoded ); |
---|
659 | |
---|
660 | Bool bInterpolatedSource; |
---|
661 | Double dMinDepthSource; |
---|
662 | Double dMaxDepthSource; |
---|
663 | Double dFocalLengthSource; |
---|
664 | Double dPositionSource; |
---|
665 | Double dIntersectionSource; |
---|
666 | |
---|
667 | Bool bInterpolatedTarget; |
---|
668 | Double dPositionTarget; |
---|
669 | Double dIntersectionTarget; |
---|
670 | Double dFocalLengthTarget; |
---|
671 | |
---|
672 | Int iTargetViewNum; |
---|
673 | Int iSourceViewNum; |
---|
674 | |
---|
675 | if( bByIdx ) |
---|
676 | { |
---|
677 | iSourceViewNum = m_aiBaseViews[ uiSourceView ]; |
---|
678 | iTargetViewNum = ( bExternal ? m_aiSynthViews[ uiTargetView ] : m_aiBaseViews[ uiTargetView ] ); |
---|
679 | } |
---|
680 | else |
---|
681 | { |
---|
682 | iSourceViewNum = (Int) uiSourceView; |
---|
683 | iTargetViewNum = (Int) uiTargetView; |
---|
684 | } |
---|
685 | |
---|
686 | xGetGeometryData( iSourceViewNum, uiFrame, dFocalLengthSource, dPositionSource, dIntersectionSource, bInterpolatedSource ); |
---|
687 | xGetZNearZFar ( iSourceViewNum, uiFrame, dMinDepthSource, dMaxDepthSource ); |
---|
688 | xGetGeometryData( iTargetViewNum, uiFrame, dFocalLengthTarget, dPositionTarget, dIntersectionTarget, bInterpolatedTarget ); |
---|
689 | |
---|
690 | Double dFactor = dFocalLengthSource * ( dPositionTarget - dPositionSource ); |
---|
691 | rdScale = dFactor * ( 1.0 / dMinDepthSource - 1.0 / dMaxDepthSource ) / (Double)( ( 1 << m_uiInputBitDepth ) - 1 ); |
---|
692 | rdOffset = dFactor / dMaxDepthSource - dIntersectionTarget + dIntersectionSource; |
---|
693 | |
---|
694 | return ( bInterpolatedSource || bInterpolatedTarget ); |
---|
695 | } |
---|
696 | |
---|
697 | |
---|
698 | Void |
---|
699 | TAppComCamPara::xGetShiftParameterCoded( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bByIdx, Int& riScale, Int& riOffset ) |
---|
700 | { |
---|
701 | if ( m_bSetupFromCoded ) |
---|
702 | { |
---|
703 | if ( uiSourceView == uiTargetView ) |
---|
704 | { |
---|
705 | riScale = 0; |
---|
706 | riOffset = 0; |
---|
707 | return; |
---|
708 | } |
---|
709 | Int iCamParsCodedPrecision; |
---|
710 | xGetCodedCameraData( uiSourceView, uiTargetView, bByIdx, uiFrame, riScale, riOffset, iCamParsCodedPrecision ); |
---|
711 | |
---|
712 | if ( m_bCamParsCodedPrecSet ) |
---|
713 | { |
---|
714 | AOT( m_uiCamParsCodedPrecision != (UInt) iCamParsCodedPrecision ); |
---|
715 | } |
---|
716 | else |
---|
717 | { |
---|
718 | m_uiCamParsCodedPrecision = (UInt) iCamParsCodedPrecision; |
---|
719 | m_bCamParsCodedPrecSet = true; |
---|
720 | } |
---|
721 | } |
---|
722 | else |
---|
723 | { |
---|
724 | Double dScale, dOffset; |
---|
725 | Bool bInterpolated = xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, false, bByIdx, dScale, dOffset ); |
---|
726 | AOT( bInterpolated ); // must be base view |
---|
727 | |
---|
728 | Double dMultOffset = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 ) ); |
---|
729 | Double dMultScale = (Double)( 1 << ( m_uiCamParsCodedPrecision + 1 + m_uiInputBitDepth ) ); |
---|
730 | riOffset = (Int)floor( dMultOffset * dOffset + .5 ); |
---|
731 | riScale = (Int)floor( dMultScale * dScale + .5 ); |
---|
732 | } |
---|
733 | |
---|
734 | } |
---|
735 | |
---|
736 | |
---|
737 | Void |
---|
738 | TAppComCamPara::xGetShiftParameterInt( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Bool bExternal, Bool bByIdx, Int64& riScale, Int64& riOffset ) |
---|
739 | { |
---|
740 | Int iTargetViewNum; |
---|
741 | Int iSourceViewNum; |
---|
742 | Int iPrevBaseViewNum; |
---|
743 | Int iNextBaseViewNum; |
---|
744 | Int iTargetViewRelNum; |
---|
745 | |
---|
746 | if( bByIdx ) |
---|
747 | { |
---|
748 | |
---|
749 | iSourceViewNum = m_aiBaseViews[ uiSourceView ]; |
---|
750 | |
---|
751 | if ( bExternal ) |
---|
752 | { |
---|
753 | iTargetViewNum = m_aiSynthViews [ uiTargetView ]; |
---|
754 | iTargetViewRelNum = m_aiRelSynthViewsNum[ uiTargetView ]; |
---|
755 | } |
---|
756 | else |
---|
757 | { |
---|
758 | iTargetViewNum = m_aiBaseViews [ uiTargetView ]; |
---|
759 | iTargetViewRelNum = m_aiBaseId2SortedId [ uiTargetView ] * ((Int) m_dViewNumPrec ); |
---|
760 | } |
---|
761 | } |
---|
762 | else |
---|
763 | { |
---|
764 | iSourceViewNum = (Int) uiSourceView; |
---|
765 | iTargetViewNum = (Int) uiTargetView; |
---|
766 | |
---|
767 | if ( bExternal ) |
---|
768 | { |
---|
769 | iTargetViewRelNum = m_aiRelSynthViewsNum[ xGetViewId( m_aiSynthViews, (Int) uiTargetView )]; |
---|
770 | } |
---|
771 | else |
---|
772 | { |
---|
773 | iTargetViewRelNum = m_aiBaseId2SortedId[ xGetBaseViewId( uiTargetView) ] * ((Int) m_dViewNumPrec ); |
---|
774 | } |
---|
775 | } |
---|
776 | xGetPrevAndNextBaseView( iSourceViewNum, iTargetViewNum, iPrevBaseViewNum, iNextBaseViewNum ); |
---|
777 | AOT( iPrevBaseViewNum == -1 ); // should not happen |
---|
778 | AOT( iNextBaseViewNum == -1 ); // should not happen |
---|
779 | |
---|
780 | Int iSrcId = xGetBaseViewId( iSourceViewNum ); |
---|
781 | Int iPrevId = xGetBaseViewId( iPrevBaseViewNum ); |
---|
782 | Int iNextId = xGetBaseViewId( iNextBaseViewNum ); |
---|
783 | AOF( m_aaiScaleAndOffsetSet[ iSrcId ][ iPrevId ] ); // coded scale and offset must be set |
---|
784 | AOF( m_aaiScaleAndOffsetSet[ iSrcId ][ iNextId ] ); // coded scale and offset must be set |
---|
785 | |
---|
786 | Int iNextBaseViewRelNum = m_aiBaseId2SortedId[ iNextId ] * ((Int) m_dViewNumPrec ); |
---|
787 | Int iPrevBaseViewRelNum = m_aiBaseId2SortedId[ iPrevId ] * ((Int) m_dViewNumPrec ); |
---|
788 | |
---|
789 | Int64 iPrevScale = (Int64)m_aaiCodedScale [ iSrcId ][ iPrevId ]; |
---|
790 | Int64 iNextScale = (Int64)m_aaiCodedScale [ iSrcId ][ iNextId ]; |
---|
791 | Int64 iPrevOffset = (Int64)m_aaiCodedOffset[ iSrcId ][ iPrevId ] << m_uiBitDepthForLUT; |
---|
792 | Int64 iNextOffset = (Int64)m_aaiCodedOffset[ iSrcId ][ iNextId ] << m_uiBitDepthForLUT; |
---|
793 | |
---|
794 | if( iPrevBaseViewNum == iNextBaseViewNum ) |
---|
795 | { |
---|
796 | riScale = iNextScale; |
---|
797 | riOffset = iNextOffset; |
---|
798 | } |
---|
799 | else |
---|
800 | { |
---|
801 | riScale = Int64( iTargetViewRelNum - iPrevBaseViewRelNum ) * iNextScale; |
---|
802 | riScale += Int64( iNextBaseViewRelNum - iTargetViewRelNum ) * iPrevScale; |
---|
803 | riOffset = Int64( iTargetViewRelNum - iPrevBaseViewRelNum ) * iNextOffset; |
---|
804 | riOffset += Int64( iNextBaseViewRelNum - iTargetViewRelNum ) * iPrevOffset; |
---|
805 | Int64 iD = Int64( iNextBaseViewRelNum - iPrevBaseViewRelNum ); |
---|
806 | Int64 iSA = ( riScale > 0 ? iD / 2 : -iD / 2 ); |
---|
807 | Int64 iOA = ( riOffset > 0 ? iD / 2 : -iD / 2 ); |
---|
808 | riScale = ( riScale + iSA ) / iD; |
---|
809 | riOffset = ( riOffset + iOA ) / iD; |
---|
810 | } |
---|
811 | } |
---|
812 | |
---|
813 | |
---|
814 | Void |
---|
815 | TAppComCamPara::xSetCodedScaleOffset( UInt uiFrame ) |
---|
816 | { |
---|
817 | for( UInt uiSourceId = 0; uiSourceId < m_iNumberOfBaseViews; uiSourceId++ ) |
---|
818 | { |
---|
819 | for( UInt uiTargetId = 0; uiTargetId < m_iNumberOfBaseViews; uiTargetId++ ) |
---|
820 | { |
---|
821 | Int iScale, iOffset; |
---|
822 | xGetShiftParameterCoded( uiSourceId, uiTargetId, uiFrame, true, iScale, iOffset ); |
---|
823 | m_aaiCodedScale [ uiSourceId ][ uiTargetId ] = iScale; |
---|
824 | m_aaiCodedOffset [ uiSourceId ][ uiTargetId ] = iOffset; |
---|
825 | m_aaiScaleAndOffsetSet [ uiSourceId ][ uiTargetId ] = 1; |
---|
826 | } |
---|
827 | } |
---|
828 | } |
---|
829 | |
---|
830 | |
---|
831 | Void |
---|
832 | TAppComCamPara::xSetShiftParametersAndLUT( UInt uiNumberSourceViews, UInt uiNumberTargetViews, UInt uiFrame, Bool bExternalReference , Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams ) |
---|
833 | { |
---|
834 | if( uiNumberSourceViews <= 1 || uiNumberTargetViews == 0 ) |
---|
835 | { |
---|
836 | return; |
---|
837 | } |
---|
838 | AOF( radShiftParams != NULL && raiShiftParams != NULL && radLUT != NULL && raiLUT != NULL ); |
---|
839 | AOF( m_uiBitDepthForLUT == 8 ); |
---|
840 | |
---|
841 | Int iLog2DivLuma = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision; AOF( iLog2DivLuma > 0 ); |
---|
842 | Int iLog2DivChroma = iLog2DivLuma + 1; |
---|
843 | Double dMaxDispDev = 0.0; |
---|
844 | Double dMaxRndDispDvL = 0.0; |
---|
845 | Double dMaxRndDispDvC = 0.0; |
---|
846 | for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ ) |
---|
847 | { |
---|
848 | for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ ) |
---|
849 | { |
---|
850 | |
---|
851 | // integer-valued scale and offset |
---|
852 | Int64 iScale, iOffset; |
---|
853 | xGetShiftParameterInt ( uiSourceView, uiTargetView, uiFrame, bExternalReference, true, iScale, iOffset ); |
---|
854 | raiShiftParams[ uiSourceView][ uiTargetView ][ 0 ] = iScale; |
---|
855 | raiShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = iOffset; |
---|
856 | |
---|
857 | // offsets including rounding offsets |
---|
858 | Int64 iOffsetLuma = iOffset + ( ( 1 << iLog2DivLuma ) >> 1 ); |
---|
859 | Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 ); |
---|
860 | |
---|
861 | // real-valued scale and offset |
---|
862 | Double dScale, dOffset; |
---|
863 | |
---|
864 | if ( m_bSetupFromCoded ) |
---|
865 | { |
---|
866 | dScale = (Double) iScale / (( Double ) ( 1 << iLog2DivLuma )); |
---|
867 | dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma )); |
---|
868 | } |
---|
869 | else |
---|
870 | { |
---|
871 | xGetShiftParameterReal( uiSourceView, uiTargetView, uiFrame, bExternalReference, true, dScale, dOffset ); |
---|
872 | } |
---|
873 | |
---|
874 | radShiftParams[ uiSourceView][ uiTargetView ][ 0 ] = dScale; |
---|
875 | radShiftParams[ uiSourceView][ uiTargetView ][ 1 ] = dOffset; |
---|
876 | |
---|
877 | for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ ) |
---|
878 | { |
---|
879 | // real-valued look-up tables |
---|
880 | Double dShiftLuma = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision ); |
---|
881 | Double dShiftChroma = dShiftLuma / 2; |
---|
882 | radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma; |
---|
883 | radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma; |
---|
884 | |
---|
885 | // integer-valued look-up tables |
---|
886 | Int64 iTempScale = (Int64)uiDepthValue * iScale; |
---|
887 | Int64 iTestScale = ( iTempScale + iOffset ); // for checking accuracy of camera parameters |
---|
888 | Int64 iShiftLuma = ( iTempScale + iOffsetLuma ) >> iLog2DivLuma; |
---|
889 | Int64 iShiftChroma = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma; |
---|
890 | raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma; |
---|
891 | raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma; |
---|
892 | |
---|
893 | // maximum deviation |
---|
894 | dMaxDispDev = std::max( dMaxDispDev, fabs( Double( (Int) iTestScale ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) ); |
---|
895 | dMaxRndDispDvL = std::max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma ) - dShiftLuma ) ); |
---|
896 | dMaxRndDispDvC = std::max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) ); |
---|
897 | } |
---|
898 | |
---|
899 | radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; |
---|
900 | radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; |
---|
901 | raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ]; |
---|
902 | raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ]; |
---|
903 | } |
---|
904 | } |
---|
905 | |
---|
906 | // check maximum deviation |
---|
907 | Double dMaxAllowedDispDev = Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ); // counting only the impact of camera parameter rounding |
---|
908 | Double dMaxAllowedRndDispDvL = 0.5 + Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ); // final rounding and impact of camera parameter rounding |
---|
909 | Double dMaxAllowedRndDispDvC = 0.5 + Double( 1 << m_iLog2Precision ) / Double( 1 << m_uiCamParsCodedPrecision ) / 2.0; // final rounding and impact of camera parameter rounding |
---|
910 | |
---|
911 | if( ( dMaxDispDev >= dMaxAllowedDispDev || dMaxRndDispDvL >= dMaxAllowedRndDispDvL || dMaxRndDispDvC >= dMaxAllowedRndDispDvC ) && !m_bSetupFromCoded ) |
---|
912 | { |
---|
913 | std::cout << "Warning: Something wrong with the accuracy of coded camera parameters:" << std::endl; |
---|
914 | if( dMaxDispDev >= dMaxAllowedDispDev ) |
---|
915 | { |
---|
916 | std::cout << " max disparity difference is " << dMaxDispDev << " (allowed: " << dMaxAllowedDispDev << ")" << std::endl; |
---|
917 | } |
---|
918 | if( dMaxRndDispDvL >= dMaxAllowedRndDispDvL ) |
---|
919 | { |
---|
920 | std::cout << " max rnd luma disp diff is " << dMaxRndDispDvL << " (allowed: " << dMaxAllowedRndDispDvL << ")" << std::endl; |
---|
921 | } |
---|
922 | if( dMaxRndDispDvC >= dMaxAllowedRndDispDvC ) |
---|
923 | { |
---|
924 | std::cout << " max rnd chroma disp diff is " << dMaxRndDispDvC << " (allowed: " << dMaxAllowedRndDispDvC << ")" << std::endl; |
---|
925 | } |
---|
926 | } |
---|
927 | } |
---|
928 | |
---|
929 | Void |
---|
930 | TAppComCamPara::xSetShiftParametersAndLUT( UInt uiFrame ) |
---|
931 | { |
---|
932 | xInit2dArray ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet, 0 ); |
---|
933 | xSetCodedScaleOffset ( uiFrame ); |
---|
934 | xSetShiftParametersAndLUT( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, uiFrame, false, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT, m_adBaseViewShiftParameter, m_aiBaseViewShiftParameter ); |
---|
935 | xSetShiftParametersAndLUT( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, uiFrame, true, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter ); |
---|
936 | }; |
---|
937 | |
---|
938 | |
---|
939 | Void |
---|
940 | TAppComCamPara::xGetCameraShifts( UInt uiSourceView, UInt uiTargetView, UInt uiFrame, Double& rdCamPosShift, Double& rdPicPosShift ) |
---|
941 | { |
---|
942 | Double dDummy, dCamPosSource, dCamPosTarget, dPicPosSource, dPicPosTarget; |
---|
943 | Bool bInterpolatedSource, bInterpolatedTarget; |
---|
944 | Int iTargetViewNum = m_aiBaseViews[ uiTargetView ]; |
---|
945 | Int iSourceViewNum = m_aiBaseViews[ uiSourceView ]; |
---|
946 | |
---|
947 | xGetGeometryData( iSourceViewNum, uiFrame, dDummy, dCamPosSource, dPicPosSource, bInterpolatedSource ); |
---|
948 | xGetGeometryData( iTargetViewNum, uiFrame, dDummy, dCamPosTarget, dPicPosTarget, bInterpolatedTarget ); |
---|
949 | AOT( bInterpolatedSource || bInterpolatedTarget ); |
---|
950 | |
---|
951 | rdCamPosShift = ( dCamPosTarget - dCamPosSource ); |
---|
952 | rdPicPosShift = -( dPicPosTarget - dPicPosSource ); // to be consistent |
---|
953 | } |
---|
954 | |
---|
955 | |
---|
956 | Void |
---|
957 | TAppComCamPara::xSetPdmConversionParams() |
---|
958 | { |
---|
959 | AOF( m_aiViewOrderIndex[ 0 ] == 0 ); |
---|
960 | if ( m_bSetupFromCoded || m_iNumberOfBaseViews < 2 ) |
---|
961 | { |
---|
962 | return; |
---|
963 | } |
---|
964 | |
---|
965 | //--- determine (virtual) camera parameter shift between view order index 1 and base view (view order index 0) --- |
---|
966 | Double dCamPosShift, dPicPosShift; |
---|
967 | Int iMinVOI = (1<<30); |
---|
968 | Int iMinAbsVOI = (1<<30); |
---|
969 | Int iMinAbsVOIId = 0; |
---|
970 | for( Int iBaseId = 1; iBaseId < m_iNumberOfBaseViews; iBaseId++ ) |
---|
971 | { |
---|
972 | Int iAbsVOI = ( m_aiViewOrderIndex[ iBaseId ] < 0 ? -m_aiViewOrderIndex[ iBaseId ] : m_aiViewOrderIndex[ iBaseId ] ); |
---|
973 | if( iAbsVOI < iMinAbsVOI ) |
---|
974 | { |
---|
975 | iMinVOI = m_aiViewOrderIndex[ iBaseId ]; |
---|
976 | iMinAbsVOI = iAbsVOI; |
---|
977 | iMinAbsVOIId = iBaseId; |
---|
978 | } |
---|
979 | } |
---|
980 | AOF( iMinAbsVOIId != 0 && iMinAbsVOI != 0 ); |
---|
981 | xGetCameraShifts( 0, iMinAbsVOIId, m_uiFirstFrameId, dCamPosShift, dPicPosShift ); |
---|
982 | #if H_3D_PDM_CAM_PARAS |
---|
983 | Double dCamPosShiftVOI01 = dCamPosShift / Double( iMinVOI ); |
---|
984 | #endif |
---|
985 | |
---|
986 | //--- determine maximum absolute camera position shift, precision, and base scale --- |
---|
987 | Double dMaxAbsCamPosShift = 0.0; |
---|
988 | for( Int iTargetId = 1; iTargetId < m_iNumberOfBaseViews; iTargetId++ ) |
---|
989 | { |
---|
990 | for( Int iBaseId = 0; iBaseId < iTargetId; iBaseId++ ) |
---|
991 | { |
---|
992 | xGetCameraShifts( (UInt)iBaseId, (UInt)iTargetId, m_uiFirstFrameId, dCamPosShift, dPicPosShift ); |
---|
993 | dCamPosShift = ( dCamPosShift < 0.0 ? -dCamPosShift : dCamPosShift ); |
---|
994 | dMaxAbsCamPosShift = ( dCamPosShift > dMaxAbsCamPosShift ? dCamPosShift : dMaxAbsCamPosShift ); |
---|
995 | } |
---|
996 | } |
---|
997 | |
---|
998 | #if H_3D_PDM_CAM_PARAS |
---|
999 | Int iPrecision = 0; |
---|
1000 | #if 0 // enabling this lines might be reasonable, but produces different results for the 2 view and 3 view test cases |
---|
1001 | Double dEpsilon = 1e-15; |
---|
1002 | Double dAbsCamPosShiftVOI01 = ( dCamPosShiftVOI01 < 0.0 ? -dCamPosShiftVOI01 : dCamPosShiftVOI01 ); |
---|
1003 | Double dShiftRatio = dMaxAbsCamPosShift / dAbsCamPosShiftVOI01 - dEpsilon; |
---|
1004 | for( ; (Double)( 1 << iPrecision ) < dShiftRatio; iPrecision++ ); |
---|
1005 | #endif |
---|
1006 | Int iPrecShift = iPrecision + PDM_INTER_CALC_SHIFT + PDM_VIRT_DEPTH_PRECISION - 2; |
---|
1007 | AOF( iPrecShift < PDM_INTERNAL_CALC_BIT_DEPTH ); |
---|
1008 | Int iScaleVOI01 = 1 << iPrecShift; |
---|
1009 | m_iPdmPrecision = iPrecision; |
---|
1010 | |
---|
1011 | //--- loop over target views --- |
---|
1012 | for( Int iTargetId = 1; iTargetId < m_iNumberOfBaseViews; iTargetId++ ) |
---|
1013 | { |
---|
1014 | // set scale and offset parameters for other views |
---|
1015 | for( Int iBaseId = 0; iBaseId < iTargetId; iBaseId++ ) |
---|
1016 | { |
---|
1017 | xGetCameraShifts( (UInt)iBaseId, (UInt)iTargetId, m_uiFirstFrameId, dCamPosShift, dPicPosShift ); |
---|
1018 | Double dScale = Double( iScaleVOI01 ) * dCamPosShiftVOI01 / dCamPosShift; |
---|
1019 | Int iDiv = m_aiViewOrderIndex[ iTargetId ] - m_aiViewOrderIndex[ iBaseId ]; |
---|
1020 | Int iAdd = ( iDiv > 0 ? iDiv / 2 : -iDiv / 2 ); |
---|
1021 | Int iScalePred = ( iScaleVOI01 + iAdd ) / iDiv; |
---|
1022 | Double dFactor = dScale / (Double)iScalePred * pow( 2.0, PDM_LOG4_SCALE_DENOMINATOR ); |
---|
1023 | Int iNominator = (Int)floor( dFactor + .5 ); |
---|
1024 | Int iNomDelta = iNominator - ( 1 << PDM_LOG4_SCALE_DENOMINATOR ); |
---|
1025 | Int iScale = Int( ( (Int64)iNominator * (Int64)iScalePred + (Int64)( ( 1 << PDM_LOG4_SCALE_DENOMINATOR ) >> 1 ) ) >> PDM_LOG4_SCALE_DENOMINATOR ); |
---|
1026 | Double dOffset = -dPicPosShift * Double( iScale ) * pow( 2.0, 2 - PDM_OFFSET_SHIFT ); |
---|
1027 | Int iOffset = (Int)floor( dOffset + .5 ); |
---|
1028 | |
---|
1029 | m_aaiPdmScaleNomDelta [ iTargetId ][ iBaseId ] = iNomDelta; |
---|
1030 | m_aaiPdmOffset [ iTargetId ][ iBaseId ] = iOffset; |
---|
1031 | } |
---|
1032 | } |
---|
1033 | #endif |
---|
1034 | } |
---|
1035 | |
---|
1036 | |
---|
1037 | |
---|
1038 | TAppComCamPara::TAppComCamPara() |
---|
1039 | { |
---|
1040 | m_dViewNumPrec = VIEW_NUM_PREC; // fixed |
---|
1041 | m_iLog2Precision = -1; |
---|
1042 | m_uiInputBitDepth = 0; |
---|
1043 | m_uiBitDepthForLUT = 8; // fixed |
---|
1044 | m_uiFirstFrameId = 0; |
---|
1045 | m_uiLastFrameId = 0; |
---|
1046 | |
---|
1047 | m_iNumberOfBaseViews = -1; |
---|
1048 | m_iNumberOfSynthViews = -1; |
---|
1049 | |
---|
1050 | m_uiCamParsCodedPrecision = 0; |
---|
1051 | m_bCamParsVaryOverTime = true; |
---|
1052 | |
---|
1053 | m_aaiCodedScale = 0; |
---|
1054 | m_aaiCodedOffset = 0; |
---|
1055 | m_aaiScaleAndOffsetSet = 0; |
---|
1056 | |
---|
1057 | #if H_3D_PDM_CAM_PARAS |
---|
1058 | m_iPdmPrecision = 0; |
---|
1059 | m_aaiPdmScaleNomDelta = 0; |
---|
1060 | m_aaiPdmOffset = 0; |
---|
1061 | #endif |
---|
1062 | |
---|
1063 | m_adBaseViewShiftParameter = 0; |
---|
1064 | m_aiBaseViewShiftParameter = 0; |
---|
1065 | m_adSynthViewShiftParameter = 0; |
---|
1066 | m_aiSynthViewShiftParameter = 0; |
---|
1067 | |
---|
1068 | m_adBaseViewShiftLUT = 0; |
---|
1069 | m_aiBaseViewShiftLUT = 0; |
---|
1070 | m_adSynthViewShiftLUT = 0; |
---|
1071 | m_aiSynthViewShiftLUT = 0; |
---|
1072 | |
---|
1073 | m_bSetupFromCoded = false; |
---|
1074 | m_bCamParsCodedPrecSet = false; |
---|
1075 | |
---|
1076 | |
---|
1077 | } |
---|
1078 | |
---|
1079 | |
---|
1080 | TAppComCamPara::~TAppComCamPara() |
---|
1081 | { |
---|
1082 | xDeleteArray( m_adBaseViewShiftParameter, m_iNumberOfBaseViews, m_iNumberOfBaseViews ); |
---|
1083 | xDeleteArray( m_aiBaseViewShiftParameter, m_iNumberOfBaseViews, m_iNumberOfBaseViews ); |
---|
1084 | xDeleteArray( m_adBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 ); |
---|
1085 | xDeleteArray( m_aiBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 ); |
---|
1086 | |
---|
1087 | xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews)); |
---|
1088 | xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews)); |
---|
1089 | xDeleteArray( m_adSynthViewShiftLUT, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews), 2 ); |
---|
1090 | xDeleteArray( m_aiSynthViewShiftLUT, m_iNumberOfBaseViews, std::max( (Int)1 ,m_iNumberOfSynthViews), 2 ); |
---|
1091 | |
---|
1092 | xDeleteArray( m_aaiCodedScale, m_iNumberOfBaseViews ); |
---|
1093 | xDeleteArray( m_aaiCodedOffset, m_iNumberOfBaseViews ); |
---|
1094 | xDeleteArray( m_aaiScaleAndOffsetSet, m_iNumberOfBaseViews ); |
---|
1095 | |
---|
1096 | #if H_3D_PDM_CAM_PARAS |
---|
1097 | xDeleteArray( m_aaiPdmScaleNomDelta, m_iNumberOfBaseViews ); |
---|
1098 | xDeleteArray( m_aaiPdmOffset, m_iNumberOfBaseViews ); |
---|
1099 | #endif |
---|
1100 | } |
---|
1101 | |
---|
1102 | Void |
---|
1103 | TAppComCamPara::xSetupBaseViewsFromCoded() |
---|
1104 | { |
---|
1105 | //===== get and sort views given in camera parameter file and set list of base views and related arrays ===== |
---|
1106 | // get left-right order and coding order from cfg-file |
---|
1107 | std::vector<Int> aiViewOrderIdx; // Left Right Order |
---|
1108 | std::vector<Int> aiViewId ; // Coding Order |
---|
1109 | |
---|
1110 | Int iMinViewOrderIdx = MAX_INT; |
---|
1111 | for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ ) |
---|
1112 | { |
---|
1113 | if (m_aadCameraParameters[uiRow].size() != 2 ) |
---|
1114 | break; |
---|
1115 | |
---|
1116 | Int iViewOrderIdx = (Int)( m_aadCameraParameters[ uiRow ][ 1 ] ); |
---|
1117 | iMinViewOrderIdx = std::min( iViewOrderIdx, iMinViewOrderIdx ); |
---|
1118 | |
---|
1119 | aiViewOrderIdx .push_back( iViewOrderIdx ); |
---|
1120 | aiViewId .push_back( (Int) m_aadCameraParameters[ uiRow ][ 0 ] ); |
---|
1121 | } |
---|
1122 | |
---|
1123 | // create base view numbers |
---|
1124 | AOT( aiViewId.size() != aiViewOrderIdx.size() ); |
---|
1125 | m_iNumberOfBaseViews = (Int) aiViewId.size(); |
---|
1126 | for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ ) |
---|
1127 | { |
---|
1128 | aiViewOrderIdx[iCurBaseView] = ( aiViewOrderIdx[iCurBaseView] - iMinViewOrderIdx); |
---|
1129 | m_aiBaseViews .push_back( aiViewOrderIdx[iCurBaseView] * ( (Int) m_dViewNumPrec) ); |
---|
1130 | m_aiBaseId2SortedId.push_back( iCurBaseView ); |
---|
1131 | m_aiBaseSortedId2Id.push_back( iCurBaseView ); |
---|
1132 | } |
---|
1133 | |
---|
1134 | m_iNumberOfBaseViews = (Int) m_aiBaseViews.size(); |
---|
1135 | |
---|
1136 | std::vector<Int> aiSortedViewOrderIdx = aiViewOrderIdx; |
---|
1137 | |
---|
1138 | // sort base views according to View Order Idx |
---|
1139 | m_aiSortedBaseViews = m_aiBaseViews; |
---|
1140 | for (Int iCurBaseView = 1; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ ) |
---|
1141 | { |
---|
1142 | Int iCurViewOrder = aiSortedViewOrderIdx[iCurBaseView]; |
---|
1143 | for (Int iCurSearchPos = iCurBaseView; iCurSearchPos >= 0; iCurSearchPos-- ) |
---|
1144 | { |
---|
1145 | if ( iCurViewOrder < aiSortedViewOrderIdx[iCurSearchPos] ) |
---|
1146 | { |
---|
1147 | Int iTempViewId = m_aiSortedBaseViews[iCurSearchPos]; |
---|
1148 | m_aiSortedBaseViews[iCurSearchPos] = m_aiSortedBaseViews[iCurBaseView]; |
---|
1149 | m_aiSortedBaseViews[iCurBaseView ] = iTempViewId; |
---|
1150 | |
---|
1151 | Int iTempViewOrderIdx = aiSortedViewOrderIdx[iCurSearchPos]; |
---|
1152 | aiSortedViewOrderIdx[iCurSearchPos] = aiSortedViewOrderIdx[iCurBaseView]; |
---|
1153 | aiSortedViewOrderIdx[iCurBaseView ] = iTempViewOrderIdx; |
---|
1154 | |
---|
1155 | Int iTempPos = m_aiBaseSortedId2Id[iCurSearchPos]; |
---|
1156 | m_aiBaseSortedId2Id[iCurSearchPos] = m_aiBaseSortedId2Id[iCurBaseView]; |
---|
1157 | m_aiBaseSortedId2Id[iCurBaseView] = iTempPos; |
---|
1158 | iCurBaseView--; |
---|
1159 | } |
---|
1160 | } |
---|
1161 | } |
---|
1162 | |
---|
1163 | for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ ) |
---|
1164 | { |
---|
1165 | m_aiBaseId2SortedId[m_aiBaseSortedId2Id[iCurBaseView]] = iCurBaseView; |
---|
1166 | } |
---|
1167 | |
---|
1168 | m_aiViewsInCfgFile = m_aiSortedBaseViews; |
---|
1169 | |
---|
1170 | // check |
---|
1171 | if( m_aiViewsInCfgFile.size() < 2 ) |
---|
1172 | { |
---|
1173 | std::cerr << "Failed reading camera parameter file" << std::endl; |
---|
1174 | std::cerr << "At least two views must be given" << std::endl; |
---|
1175 | AOT(true); |
---|
1176 | exit( EXIT_FAILURE ); |
---|
1177 | } |
---|
1178 | |
---|
1179 | // translate coding order to view order |
---|
1180 | for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ ) |
---|
1181 | { |
---|
1182 | if (m_aadCameraParameters[uiRow].size() == 2 ) |
---|
1183 | continue; |
---|
1184 | |
---|
1185 | m_aadCameraParameters[ uiRow ][ 2 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 2 ] ) ]; |
---|
1186 | m_aadCameraParameters[ uiRow ][ 3 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 3 ] ) ]; |
---|
1187 | } |
---|
1188 | } |
---|
1189 | |
---|
1190 | Void TAppComCamPara::xSetupBaseViews( Char* pchBaseViewNumbers, UInt uiNumBaseViews ) |
---|
1191 | { |
---|
1192 | // init list |
---|
1193 | std::vector<Int> aiViewsInCfg; |
---|
1194 | for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ ) |
---|
1195 | { |
---|
1196 | aiViewsInCfg.push_back( (Int)( m_aadCameraParameters[ uiRow ][ 0 ] * m_dViewNumPrec ) ); |
---|
1197 | } |
---|
1198 | // remove duplicated items |
---|
1199 | std::sort( aiViewsInCfg.begin(), aiViewsInCfg.end() ); |
---|
1200 | std::vector<Int>::iterator cIterNewEnd = std::unique( aiViewsInCfg.begin(), aiViewsInCfg.end() ); |
---|
1201 | aiViewsInCfg.erase( cIterNewEnd, aiViewsInCfg.end() ); |
---|
1202 | // sort (from left to right) |
---|
1203 | std::vector<Int> aiDummyI2SI, aiDummySI2I; |
---|
1204 | xGetSortedViewList( aiViewsInCfg, m_aiViewsInCfgFile, aiDummyI2SI, aiDummySI2I ); |
---|
1205 | // check |
---|
1206 | if( m_aiViewsInCfgFile.size() < 2 ) |
---|
1207 | { |
---|
1208 | std::cerr << "Failed reading config file" << std::endl; |
---|
1209 | std::cerr << "At least two views must be given" << std::endl; |
---|
1210 | exit( EXIT_FAILURE ); |
---|
1211 | } |
---|
1212 | |
---|
1213 | |
---|
1214 | |
---|
1215 | //===== set list of base views and related arrays ===== |
---|
1216 | if( pchBaseViewNumbers == 0 ) |
---|
1217 | { |
---|
1218 | std::cerr << "BaseViewCameraNumbers must be given" << std::endl; |
---|
1219 | exit( EXIT_FAILURE ); |
---|
1220 | }; |
---|
1221 | |
---|
1222 | convertNumberString( pchBaseViewNumbers, m_aiBaseViews, m_dViewNumPrec ); |
---|
1223 | while( (UInt)m_aiBaseViews.size() > uiNumBaseViews ) |
---|
1224 | { |
---|
1225 | m_aiBaseViews.pop_back(); |
---|
1226 | } |
---|
1227 | xGetSortedViewList( m_aiBaseViews, m_aiSortedBaseViews, m_aiBaseId2SortedId, m_aiBaseSortedId2Id ); |
---|
1228 | m_iNumberOfBaseViews = (Int)m_aiBaseViews.size(); |
---|
1229 | } |
---|
1230 | |
---|
1231 | |
---|
1232 | Void |
---|
1233 | TAppComCamPara::init( UInt uiNumBaseViews, |
---|
1234 | UInt uiInputBitDepth, |
---|
1235 | UInt uiCodedCamParsPrecision, |
---|
1236 | UInt uiStartFrameId, |
---|
1237 | UInt uiNumFrames, |
---|
1238 | Char* pchCfgFileName, |
---|
1239 | Char* pchBaseViewNumbers, |
---|
1240 | Char* pchSynthViewNumbers, |
---|
1241 | std::vector<Int>* paiSynthViewNumbers, |
---|
1242 | Int iLog2Precision ) |
---|
1243 | { |
---|
1244 | //===== set miscellaneous variables ===== |
---|
1245 | m_uiInputBitDepth = uiInputBitDepth; |
---|
1246 | m_uiFirstFrameId = uiStartFrameId; |
---|
1247 | m_uiLastFrameId = uiStartFrameId + uiNumFrames - 1; |
---|
1248 | m_uiCamParsCodedPrecision = uiCodedCamParsPrecision; |
---|
1249 | m_iLog2Precision = iLog2Precision; |
---|
1250 | #if HHI_INTERVIEW_SKIP |
---|
1251 | m_iCurrentFrameId = 0 ; |
---|
1252 | #endif |
---|
1253 | |
---|
1254 | xReadCameraParameterFile( pchCfgFileName ); |
---|
1255 | |
---|
1256 | m_bSetupFromCoded = ( m_aadCameraParameters[ 0 ].size() == 2 ); |
---|
1257 | |
---|
1258 | if ( m_bSetupFromCoded ) |
---|
1259 | { |
---|
1260 | std::cout << "Detected decoded camera parameter file. Overwriting base view settings from cfg file. " << std::endl; |
---|
1261 | xSetupBaseViewsFromCoded(); |
---|
1262 | } |
---|
1263 | else |
---|
1264 | { |
---|
1265 | xSetupBaseViews( pchBaseViewNumbers, uiNumBaseViews ); |
---|
1266 | } |
---|
1267 | |
---|
1268 | //===== set list of external (virtual) views ===== |
---|
1269 | m_aiSynthViews.clear(); |
---|
1270 | |
---|
1271 | if( pchSynthViewNumbers != 0 || paiSynthViewNumbers != 0) |
---|
1272 | { |
---|
1273 | std::vector<Int> aiTmpSynthViews; |
---|
1274 | |
---|
1275 | AOT( ( pchSynthViewNumbers != NULL ) && ( paiSynthViewNumbers != NULL ) ); |
---|
1276 | |
---|
1277 | if ( pchSynthViewNumbers != NULL ) |
---|
1278 | { |
---|
1279 | convertNumberString( pchSynthViewNumbers, aiTmpSynthViews, m_dViewNumPrec ); |
---|
1280 | } |
---|
1281 | else |
---|
1282 | { |
---|
1283 | aiTmpSynthViews = (*paiSynthViewNumbers); |
---|
1284 | } |
---|
1285 | |
---|
1286 | for( UInt uiSId = 0; uiSId < (UInt)aiTmpSynthViews.size(); uiSId++ ) |
---|
1287 | { |
---|
1288 | |
---|
1289 | Int iViewNumPrec = (Int) m_dViewNumPrec; |
---|
1290 | Int iLeftBaseViewIdx = aiTmpSynthViews[ uiSId ] / iViewNumPrec; |
---|
1291 | Int iRightBaseViewIdx = ( aiTmpSynthViews[ uiSId ] + (iViewNumPrec - 1) ) / iViewNumPrec; |
---|
1292 | |
---|
1293 | if ( iLeftBaseViewIdx < 0 || iRightBaseViewIdx >= m_iNumberOfBaseViews ) |
---|
1294 | { |
---|
1295 | std::cerr << "SynthViewCameraNumbers must be greater and equal to 0 and smaller than number of base views" << std::endl; |
---|
1296 | AOT(true); |
---|
1297 | exit( EXIT_FAILURE ); |
---|
1298 | } |
---|
1299 | |
---|
1300 | Int64 iLeftBaseViewRelNum = iLeftBaseViewIdx * iViewNumPrec; |
---|
1301 | Int64 iRightBaseViewRelNum = iRightBaseViewIdx * iViewNumPrec; |
---|
1302 | |
---|
1303 | Int64 iDiffBaseViewRelNum = iRightBaseViewRelNum - iLeftBaseViewRelNum; |
---|
1304 | |
---|
1305 | Int64 iSynthViewRelNum = aiTmpSynthViews[ uiSId ]; |
---|
1306 | Int64 iLeftBaseNum = m_aiSortedBaseViews[ iLeftBaseViewIdx ]; |
---|
1307 | Int64 iRightBaseNum = m_aiSortedBaseViews[ iRightBaseViewIdx ]; |
---|
1308 | Int64 iDiffBaseNum = iRightBaseNum - iLeftBaseNum; |
---|
1309 | Int64 iSynthViewNum; |
---|
1310 | |
---|
1311 | if ( iDiffBaseViewRelNum != 0) |
---|
1312 | { |
---|
1313 | AOT( (Int) iDiffBaseViewRelNum != iViewNumPrec ); |
---|
1314 | Int iFact = iDiffBaseNum > 0 ? 1 : -1; |
---|
1315 | iSynthViewNum = iLeftBaseNum + ( iDiffBaseNum * ( iSynthViewRelNum - iLeftBaseViewRelNum ) + (iViewNumPrec >> 1) * iFact ) / ( iViewNumPrec ); |
---|
1316 | } |
---|
1317 | else |
---|
1318 | { |
---|
1319 | iSynthViewNum = iLeftBaseNum; |
---|
1320 | } |
---|
1321 | |
---|
1322 | m_aiRelSynthViewsNum.push_back( aiTmpSynthViews[ uiSId ] ); |
---|
1323 | m_aiSynthViews .push_back( (Int) iSynthViewNum ); |
---|
1324 | } |
---|
1325 | } |
---|
1326 | m_iNumberOfSynthViews = (Int)m_aiSynthViews.size(); |
---|
1327 | |
---|
1328 | |
---|
1329 | //===== set derived parameters ===== |
---|
1330 | xGetViewOrderIndices( m_aiBaseId2SortedId, m_aiViewOrderIndex ); |
---|
1331 | m_bCamParsVaryOverTime = xGetCamParsChangeFlag(); |
---|
1332 | |
---|
1333 | |
---|
1334 | //===== create arrays ===== |
---|
1335 | xCreateLUTs ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT, m_adBaseViewShiftParameter, m_aiBaseViewShiftParameter ); |
---|
1336 | xCreateLUTs ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter ); |
---|
1337 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiCodedScale ); |
---|
1338 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiCodedOffset ); |
---|
1339 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet ); |
---|
1340 | xInit2dArray ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet, 0 ); |
---|
1341 | |
---|
1342 | #if H_3D_PDM_CAM_PARAS |
---|
1343 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiPdmScaleNomDelta ); |
---|
1344 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiPdmOffset ); |
---|
1345 | |
---|
1346 | //===== init disparity to virtual depth conversion parameters ===== |
---|
1347 | xSetPdmConversionParams(); |
---|
1348 | #endif |
---|
1349 | |
---|
1350 | //===== init arrays for first frame ===== |
---|
1351 | xSetShiftParametersAndLUT( m_uiFirstFrameId ); |
---|
1352 | } |
---|
1353 | |
---|
1354 | |
---|
1355 | Void |
---|
1356 | TAppComCamPara::check( Bool bCheckViewRange, Bool bCheckFrameRange ) |
---|
1357 | { |
---|
1358 | if( bCheckFrameRange ) |
---|
1359 | { |
---|
1360 | Double dDummy; |
---|
1361 | |
---|
1362 | for( UInt uiBaseView = 0; uiBaseView < m_aiBaseViews.size(); uiBaseView++ ) |
---|
1363 | { |
---|
1364 | if ( m_bSetupFromCoded ) |
---|
1365 | { |
---|
1366 | for( UInt uiTargetView = 0; uiTargetView < m_aiBaseViews.size(); uiTargetView++ ) |
---|
1367 | { |
---|
1368 | if ( uiTargetView == uiBaseView ) |
---|
1369 | continue; |
---|
1370 | |
---|
1371 | for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ ) |
---|
1372 | { |
---|
1373 | Int iDummy; |
---|
1374 | |
---|
1375 | xGetCodedCameraData( uiBaseView, uiTargetView, true , uiFrame, iDummy, iDummy, iDummy ); |
---|
1376 | } |
---|
1377 | } |
---|
1378 | } |
---|
1379 | else |
---|
1380 | { |
---|
1381 | for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ ) |
---|
1382 | { |
---|
1383 | Bool bInterpolatedCur; |
---|
1384 | xGetGeometryData( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur ); |
---|
1385 | xGetZNearZFar ( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy ); |
---|
1386 | |
---|
1387 | if( bInterpolatedCur ) |
---|
1388 | { |
---|
1389 | std::cerr << "Error: CameraParameters for BaseView " << (Double)m_aiBaseViews[ uiBaseView ] / m_dViewNumPrec << " and Frame " << uiFrame << " not defined. " << std::endl; |
---|
1390 | exit( EXIT_FAILURE ); |
---|
1391 | } |
---|
1392 | } |
---|
1393 | |
---|
1394 | } |
---|
1395 | } |
---|
1396 | |
---|
1397 | Bool bInterpolateFirst = true; |
---|
1398 | Bool bAnyInterpolated = false; |
---|
1399 | for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ ) |
---|
1400 | { |
---|
1401 | Bool bInterpolated = false; |
---|
1402 | for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ ) |
---|
1403 | { |
---|
1404 | Bool bInterpolatedCur; |
---|
1405 | xGetGeometryData( m_aiSynthViews[ uiERView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur ); |
---|
1406 | bInterpolated |= bInterpolatedCur; |
---|
1407 | } |
---|
1408 | |
---|
1409 | if( bInterpolated ) |
---|
1410 | { |
---|
1411 | bAnyInterpolated = true; |
---|
1412 | if ( bInterpolateFirst ) |
---|
1413 | { |
---|
1414 | std::cout << "Interpolating Camera Parameters for View(s) " ; |
---|
1415 | bInterpolateFirst = false; |
---|
1416 | } |
---|
1417 | std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ; |
---|
1418 | } |
---|
1419 | } |
---|
1420 | if ( bAnyInterpolated ) |
---|
1421 | std::cout << std::endl; |
---|
1422 | } |
---|
1423 | |
---|
1424 | if( bCheckViewRange ) |
---|
1425 | { |
---|
1426 | Bool bAllExist = true; |
---|
1427 | for( Int iSynthViewIdx = 0; iSynthViewIdx < m_iNumberOfSynthViews; iSynthViewIdx++ ) |
---|
1428 | { |
---|
1429 | Bool bIsBaseView; |
---|
1430 | Int iDummy; |
---|
1431 | Bool bExist = getLeftRightBaseView( iSynthViewIdx, iDummy, iDummy, iDummy, bIsBaseView ); |
---|
1432 | bAllExist &= ( bExist || bIsBaseView ); |
---|
1433 | } |
---|
1434 | if( !bAllExist ) |
---|
1435 | { |
---|
1436 | std::cerr << "SynthViewNumbers must be within the range of BaseViewNumbers" << std::endl; |
---|
1437 | exit( EXIT_FAILURE ); |
---|
1438 | } |
---|
1439 | } |
---|
1440 | } |
---|
1441 | |
---|
1442 | |
---|
1443 | Void |
---|
1444 | TAppComCamPara::update( UInt uiFrameId ) |
---|
1445 | { |
---|
1446 | |
---|
1447 | m_iCurrentFrameId = uiFrameId; |
---|
1448 | m_bCamParsCodedPrecSet = false; |
---|
1449 | |
---|
1450 | if ( m_bCamParsVaryOverTime ) |
---|
1451 | { |
---|
1452 | xSetShiftParametersAndLUT( m_uiFirstFrameId + uiFrameId ); |
---|
1453 | } |
---|
1454 | } |
---|
1455 | |
---|
1456 | #if H_3D_VSO |
---|
1457 | Void |
---|
1458 | TAppComCamPara::setDispCoeff( UInt uiFrameId, Int iViewIdx ) |
---|
1459 | { |
---|
1460 | UInt uiFrame = m_uiFirstFrameId + uiFrameId; |
---|
1461 | Int iSourceViewNum = m_aiBaseViews[ iViewIdx ]; |
---|
1462 | Double dBaseLine = 0.0; |
---|
1463 | Double dFL1, dCS1, dCP1, dZN1, dZF1; |
---|
1464 | Bool bInterpolated; |
---|
1465 | double dPos[3]; |
---|
1466 | |
---|
1467 | if( m_iNumberOfBaseViews == 3 ) |
---|
1468 | { |
---|
1469 | xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated ); |
---|
1470 | xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated ); |
---|
1471 | xGetGeometryData( m_aiBaseViews[2], uiFrame, dFL1, dPos[2], dCS1, bInterpolated ); |
---|
1472 | |
---|
1473 | xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated ); |
---|
1474 | xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 ); |
---|
1475 | |
---|
1476 | dBaseLine = ( std::max( dPos[0], std::max( dPos[1], dPos[2] ) ) - std::min( dPos[0], std::min( dPos[1], dPos[2] ) ) ) / 2.0; |
---|
1477 | } |
---|
1478 | else if( m_iNumberOfBaseViews == 2 ) |
---|
1479 | { |
---|
1480 | xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated ); |
---|
1481 | xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated ); |
---|
1482 | |
---|
1483 | xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated ); |
---|
1484 | xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 ); |
---|
1485 | |
---|
1486 | dBaseLine = dPos[0] - dPos[1]; |
---|
1487 | } |
---|
1488 | |
---|
1489 | m_dDispCoeff = fabs( dFL1 * ( dBaseLine / 2.0 ) / 255.0 * ( 1.0/dZN1 - 1.0/dZF1 ) ); |
---|
1490 | } |
---|
1491 | #endif |
---|
1492 | |
---|
1493 | Bool |
---|
1494 | TAppComCamPara::getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView ) |
---|
1495 | { |
---|
1496 | Int iLeftSortedViewIdx, iRightSortedViewIdx, iDummy; |
---|
1497 | Bool bExist = xGetLeftRightView( m_aiSynthViews[ iSynthViewIdx ], m_aiSortedBaseViews, iDummy, iDummy, iLeftSortedViewIdx, iRightSortedViewIdx ); |
---|
1498 | rbIsBaseView = ( iLeftSortedViewIdx == iRightSortedViewIdx && iLeftSortedViewIdx != -1 ); |
---|
1499 | |
---|
1500 | Int iLeftViewIdx = ( iLeftSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iLeftSortedViewIdx ] : -1 ); |
---|
1501 | Int iRightViewIdx = ( iRightSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iRightSortedViewIdx ] : -1 ); |
---|
1502 | |
---|
1503 | if ( iLeftSortedViewIdx != -1 && iRightSortedViewIdx != -1 ) |
---|
1504 | { |
---|
1505 | riRelDistToLeft = getRelDistLeft( iSynthViewIdx, iLeftViewIdx, iRightViewIdx); |
---|
1506 | } |
---|
1507 | else |
---|
1508 | { |
---|
1509 | riRelDistToLeft = -1; |
---|
1510 | } |
---|
1511 | |
---|
1512 | riLeftViewIdx = iLeftViewIdx; |
---|
1513 | riRightViewIdx = iRightViewIdx; |
---|
1514 | |
---|
1515 | return bExist; |
---|
1516 | } |
---|
1517 | |
---|
1518 | Int TAppComCamPara::getRelDistLeft( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx ) |
---|
1519 | { |
---|
1520 | //GT: Get normalized distance |
---|
1521 | Int iLeftViewDist = abs ( m_aiBaseId2SortedId[ iLeftViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]); |
---|
1522 | Int iRightViewDist = abs ( m_aiBaseId2SortedId[ iRightViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]); |
---|
1523 | Int64 iDistSum = iLeftViewDist + iRightViewDist; |
---|
1524 | return (iDistSum == 0) ? (1 << (REN_VDWEIGHT_PREC -1) ) : (Int) (( (((Int64) iLeftViewDist ) << REN_VDWEIGHT_PREC ) + (iDistSum >> 1) ) / iDistSum ); |
---|
1525 | } |
---|
1526 | |
---|
1527 | Int |
---|
1528 | TAppComCamPara::synthRelNum2Idx( Int iRelNum ) |
---|
1529 | { |
---|
1530 | return xGetViewId(m_aiRelSynthViewsNum, iRelNum ); |
---|
1531 | } |
---|
1532 | #endif |
---|