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 | #if H_3D_PDM_CAM_PARAS |
---|
968 | Int iMinVOI = (1<<30); |
---|
969 | #endif |
---|
970 | Int iMinAbsVOI = (1<<30); |
---|
971 | Int iMinAbsVOIId = 0; |
---|
972 | for( Int iBaseId = 1; iBaseId < m_iNumberOfBaseViews; iBaseId++ ) |
---|
973 | { |
---|
974 | Int iAbsVOI = ( m_aiViewOrderIndex[ iBaseId ] < 0 ? -m_aiViewOrderIndex[ iBaseId ] : m_aiViewOrderIndex[ iBaseId ] ); |
---|
975 | if( iAbsVOI < iMinAbsVOI ) |
---|
976 | { |
---|
977 | #if H_3D_PDM_CAM_PARAS |
---|
978 | iMinVOI = m_aiViewOrderIndex[ iBaseId ]; |
---|
979 | #endif |
---|
980 | iMinAbsVOI = iAbsVOI; |
---|
981 | iMinAbsVOIId = iBaseId; |
---|
982 | } |
---|
983 | } |
---|
984 | AOF( iMinAbsVOIId != 0 && iMinAbsVOI != 0 ); |
---|
985 | xGetCameraShifts( 0, iMinAbsVOIId, m_uiFirstFrameId, dCamPosShift, dPicPosShift ); |
---|
986 | #if H_3D_PDM_CAM_PARAS |
---|
987 | Double dCamPosShiftVOI01 = dCamPosShift / Double( iMinVOI ); |
---|
988 | #endif |
---|
989 | |
---|
990 | //--- determine maximum absolute camera position shift, precision, and base scale --- |
---|
991 | Double dMaxAbsCamPosShift = 0.0; |
---|
992 | for( Int iTargetId = 1; iTargetId < m_iNumberOfBaseViews; iTargetId++ ) |
---|
993 | { |
---|
994 | for( Int iBaseId = 0; iBaseId < iTargetId; iBaseId++ ) |
---|
995 | { |
---|
996 | xGetCameraShifts( (UInt)iBaseId, (UInt)iTargetId, m_uiFirstFrameId, dCamPosShift, dPicPosShift ); |
---|
997 | dCamPosShift = ( dCamPosShift < 0.0 ? -dCamPosShift : dCamPosShift ); |
---|
998 | dMaxAbsCamPosShift = ( dCamPosShift > dMaxAbsCamPosShift ? dCamPosShift : dMaxAbsCamPosShift ); |
---|
999 | } |
---|
1000 | } |
---|
1001 | |
---|
1002 | #if H_3D_PDM_CAM_PARAS |
---|
1003 | Int iPrecision = 0; |
---|
1004 | #if 0 // enabling this lines might be reasonable, but produces different results for the 2 view and 3 view test cases |
---|
1005 | Double dEpsilon = 1e-15; |
---|
1006 | Double dAbsCamPosShiftVOI01 = ( dCamPosShiftVOI01 < 0.0 ? -dCamPosShiftVOI01 : dCamPosShiftVOI01 ); |
---|
1007 | Double dShiftRatio = dMaxAbsCamPosShift / dAbsCamPosShiftVOI01 - dEpsilon; |
---|
1008 | for( ; (Double)( 1 << iPrecision ) < dShiftRatio; iPrecision++ ); |
---|
1009 | #endif |
---|
1010 | Int iPrecShift = iPrecision + PDM_INTER_CALC_SHIFT + PDM_VIRT_DEPTH_PRECISION - 2; |
---|
1011 | AOF( iPrecShift < PDM_INTERNAL_CALC_BIT_DEPTH ); |
---|
1012 | Int iScaleVOI01 = 1 << iPrecShift; |
---|
1013 | m_iPdmPrecision = iPrecision; |
---|
1014 | |
---|
1015 | //--- loop over target views --- |
---|
1016 | for( Int iTargetId = 1; iTargetId < m_iNumberOfBaseViews; iTargetId++ ) |
---|
1017 | { |
---|
1018 | // set scale and offset parameters for other views |
---|
1019 | for( Int iBaseId = 0; iBaseId < iTargetId; iBaseId++ ) |
---|
1020 | { |
---|
1021 | xGetCameraShifts( (UInt)iBaseId, (UInt)iTargetId, m_uiFirstFrameId, dCamPosShift, dPicPosShift ); |
---|
1022 | Double dScale = Double( iScaleVOI01 ) * dCamPosShiftVOI01 / dCamPosShift; |
---|
1023 | Int iDiv = m_aiViewOrderIndex[ iTargetId ] - m_aiViewOrderIndex[ iBaseId ]; |
---|
1024 | Int iAdd = ( iDiv > 0 ? iDiv / 2 : -iDiv / 2 ); |
---|
1025 | Int iScalePred = ( iScaleVOI01 + iAdd ) / iDiv; |
---|
1026 | Double dFactor = dScale / (Double)iScalePred * pow( 2.0, PDM_LOG4_SCALE_DENOMINATOR ); |
---|
1027 | Int iNominator = (Int)floor( dFactor + .5 ); |
---|
1028 | Int iNomDelta = iNominator - ( 1 << PDM_LOG4_SCALE_DENOMINATOR ); |
---|
1029 | Int iScale = Int( ( (Int64)iNominator * (Int64)iScalePred + (Int64)( ( 1 << PDM_LOG4_SCALE_DENOMINATOR ) >> 1 ) ) >> PDM_LOG4_SCALE_DENOMINATOR ); |
---|
1030 | Double dOffset = -dPicPosShift * Double( iScale ) * pow( 2.0, 2 - PDM_OFFSET_SHIFT ); |
---|
1031 | Int iOffset = (Int)floor( dOffset + .5 ); |
---|
1032 | |
---|
1033 | m_aaiPdmScaleNomDelta [ iTargetId ][ iBaseId ] = iNomDelta; |
---|
1034 | m_aaiPdmOffset [ iTargetId ][ iBaseId ] = iOffset; |
---|
1035 | } |
---|
1036 | } |
---|
1037 | #endif |
---|
1038 | } |
---|
1039 | |
---|
1040 | |
---|
1041 | |
---|
1042 | TAppComCamPara::TAppComCamPara() |
---|
1043 | { |
---|
1044 | m_dViewNumPrec = VIEW_NUM_PREC; // fixed |
---|
1045 | m_iLog2Precision = -1; |
---|
1046 | m_uiInputBitDepth = 0; |
---|
1047 | m_uiBitDepthForLUT = 8; // fixed |
---|
1048 | m_uiFirstFrameId = 0; |
---|
1049 | m_uiLastFrameId = 0; |
---|
1050 | |
---|
1051 | m_iNumberOfBaseViews = -1; |
---|
1052 | m_iNumberOfSynthViews = -1; |
---|
1053 | |
---|
1054 | m_uiCamParsCodedPrecision = 0; |
---|
1055 | m_bCamParsVaryOverTime = true; |
---|
1056 | |
---|
1057 | m_aaiCodedScale = 0; |
---|
1058 | m_aaiCodedOffset = 0; |
---|
1059 | m_aaiScaleAndOffsetSet = 0; |
---|
1060 | |
---|
1061 | #if H_3D_PDM_CAM_PARAS |
---|
1062 | m_iPdmPrecision = 0; |
---|
1063 | m_aaiPdmScaleNomDelta = 0; |
---|
1064 | m_aaiPdmOffset = 0; |
---|
1065 | #endif |
---|
1066 | |
---|
1067 | m_adBaseViewShiftParameter = 0; |
---|
1068 | m_aiBaseViewShiftParameter = 0; |
---|
1069 | m_adSynthViewShiftParameter = 0; |
---|
1070 | m_aiSynthViewShiftParameter = 0; |
---|
1071 | |
---|
1072 | m_adBaseViewShiftLUT = 0; |
---|
1073 | m_aiBaseViewShiftLUT = 0; |
---|
1074 | m_adSynthViewShiftLUT = 0; |
---|
1075 | m_aiSynthViewShiftLUT = 0; |
---|
1076 | |
---|
1077 | m_bSetupFromCoded = false; |
---|
1078 | m_bCamParsCodedPrecSet = false; |
---|
1079 | |
---|
1080 | |
---|
1081 | } |
---|
1082 | |
---|
1083 | |
---|
1084 | TAppComCamPara::~TAppComCamPara() |
---|
1085 | { |
---|
1086 | xDeleteArray( m_adBaseViewShiftParameter, m_iNumberOfBaseViews, m_iNumberOfBaseViews ); |
---|
1087 | xDeleteArray( m_aiBaseViewShiftParameter, m_iNumberOfBaseViews, m_iNumberOfBaseViews ); |
---|
1088 | xDeleteArray( m_adBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 ); |
---|
1089 | xDeleteArray( m_aiBaseViewShiftLUT, m_iNumberOfBaseViews, m_iNumberOfBaseViews, 2 ); |
---|
1090 | |
---|
1091 | xDeleteArray( m_adSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews)); |
---|
1092 | xDeleteArray( m_aiSynthViewShiftParameter, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews)); |
---|
1093 | xDeleteArray( m_adSynthViewShiftLUT, m_iNumberOfBaseViews, std::max((Int) 1 ,m_iNumberOfSynthViews), 2 ); |
---|
1094 | xDeleteArray( m_aiSynthViewShiftLUT, m_iNumberOfBaseViews, std::max( (Int)1 ,m_iNumberOfSynthViews), 2 ); |
---|
1095 | |
---|
1096 | xDeleteArray( m_aaiCodedScale, m_iNumberOfBaseViews ); |
---|
1097 | xDeleteArray( m_aaiCodedOffset, m_iNumberOfBaseViews ); |
---|
1098 | xDeleteArray( m_aaiScaleAndOffsetSet, m_iNumberOfBaseViews ); |
---|
1099 | |
---|
1100 | #if H_3D_PDM_CAM_PARAS |
---|
1101 | xDeleteArray( m_aaiPdmScaleNomDelta, m_iNumberOfBaseViews ); |
---|
1102 | xDeleteArray( m_aaiPdmOffset, m_iNumberOfBaseViews ); |
---|
1103 | #endif |
---|
1104 | } |
---|
1105 | |
---|
1106 | Void |
---|
1107 | TAppComCamPara::xSetupBaseViewsFromCoded() |
---|
1108 | { |
---|
1109 | //===== get and sort views given in camera parameter file and set list of base views and related arrays ===== |
---|
1110 | // get left-right order and coding order from cfg-file |
---|
1111 | std::vector<Int> aiViewOrderIdx; // Left Right Order |
---|
1112 | std::vector<Int> aiViewId ; // Coding Order |
---|
1113 | |
---|
1114 | Int iMinViewOrderIdx = MAX_INT; |
---|
1115 | for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ ) |
---|
1116 | { |
---|
1117 | if (m_aadCameraParameters[uiRow].size() != 2 ) |
---|
1118 | break; |
---|
1119 | |
---|
1120 | Int iViewOrderIdx = (Int)( m_aadCameraParameters[ uiRow ][ 1 ] ); |
---|
1121 | iMinViewOrderIdx = std::min( iViewOrderIdx, iMinViewOrderIdx ); |
---|
1122 | |
---|
1123 | aiViewOrderIdx .push_back( iViewOrderIdx ); |
---|
1124 | aiViewId .push_back( (Int) m_aadCameraParameters[ uiRow ][ 0 ] ); |
---|
1125 | } |
---|
1126 | |
---|
1127 | // create base view numbers |
---|
1128 | AOT( aiViewId.size() != aiViewOrderIdx.size() ); |
---|
1129 | m_iNumberOfBaseViews = (Int) aiViewId.size(); |
---|
1130 | for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ ) |
---|
1131 | { |
---|
1132 | aiViewOrderIdx[iCurBaseView] = ( aiViewOrderIdx[iCurBaseView] - iMinViewOrderIdx); |
---|
1133 | m_aiBaseViews .push_back( aiViewOrderIdx[iCurBaseView] * ( (Int) m_dViewNumPrec) ); |
---|
1134 | m_aiBaseId2SortedId.push_back( iCurBaseView ); |
---|
1135 | m_aiBaseSortedId2Id.push_back( iCurBaseView ); |
---|
1136 | } |
---|
1137 | |
---|
1138 | m_iNumberOfBaseViews = (Int) m_aiBaseViews.size(); |
---|
1139 | |
---|
1140 | std::vector<Int> aiSortedViewOrderIdx = aiViewOrderIdx; |
---|
1141 | |
---|
1142 | // sort base views according to View Order Idx |
---|
1143 | m_aiSortedBaseViews = m_aiBaseViews; |
---|
1144 | for (Int iCurBaseView = 1; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ ) |
---|
1145 | { |
---|
1146 | Int iCurViewOrder = aiSortedViewOrderIdx[iCurBaseView]; |
---|
1147 | for (Int iCurSearchPos = iCurBaseView; iCurSearchPos >= 0; iCurSearchPos-- ) |
---|
1148 | { |
---|
1149 | if ( iCurViewOrder < aiSortedViewOrderIdx[iCurSearchPos] ) |
---|
1150 | { |
---|
1151 | Int iTempViewId = m_aiSortedBaseViews[iCurSearchPos]; |
---|
1152 | m_aiSortedBaseViews[iCurSearchPos] = m_aiSortedBaseViews[iCurBaseView]; |
---|
1153 | m_aiSortedBaseViews[iCurBaseView ] = iTempViewId; |
---|
1154 | |
---|
1155 | Int iTempViewOrderIdx = aiSortedViewOrderIdx[iCurSearchPos]; |
---|
1156 | aiSortedViewOrderIdx[iCurSearchPos] = aiSortedViewOrderIdx[iCurBaseView]; |
---|
1157 | aiSortedViewOrderIdx[iCurBaseView ] = iTempViewOrderIdx; |
---|
1158 | |
---|
1159 | Int iTempPos = m_aiBaseSortedId2Id[iCurSearchPos]; |
---|
1160 | m_aiBaseSortedId2Id[iCurSearchPos] = m_aiBaseSortedId2Id[iCurBaseView]; |
---|
1161 | m_aiBaseSortedId2Id[iCurBaseView] = iTempPos; |
---|
1162 | iCurBaseView--; |
---|
1163 | } |
---|
1164 | } |
---|
1165 | } |
---|
1166 | |
---|
1167 | for (Int iCurBaseView = 0; iCurBaseView < m_iNumberOfBaseViews; iCurBaseView++ ) |
---|
1168 | { |
---|
1169 | m_aiBaseId2SortedId[m_aiBaseSortedId2Id[iCurBaseView]] = iCurBaseView; |
---|
1170 | } |
---|
1171 | |
---|
1172 | m_aiViewsInCfgFile = m_aiSortedBaseViews; |
---|
1173 | |
---|
1174 | // check |
---|
1175 | if( m_aiViewsInCfgFile.size() < 2 ) |
---|
1176 | { |
---|
1177 | std::cerr << "Failed reading camera parameter file" << std::endl; |
---|
1178 | std::cerr << "At least two views must be given" << std::endl; |
---|
1179 | AOT(true); |
---|
1180 | exit( EXIT_FAILURE ); |
---|
1181 | } |
---|
1182 | |
---|
1183 | // translate coding order to view order |
---|
1184 | for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ ) |
---|
1185 | { |
---|
1186 | if (m_aadCameraParameters[uiRow].size() == 2 ) |
---|
1187 | continue; |
---|
1188 | |
---|
1189 | m_aadCameraParameters[ uiRow ][ 2 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 2 ] ) ]; |
---|
1190 | m_aadCameraParameters[ uiRow ][ 3 ] = (Double) aiViewOrderIdx[ xGetViewId( aiViewId, (Int) m_aadCameraParameters[ uiRow ][ 3 ] ) ]; |
---|
1191 | } |
---|
1192 | } |
---|
1193 | |
---|
1194 | Void TAppComCamPara::xSetupBaseViews( Char* pchBaseViewNumbers, UInt uiNumBaseViews ) |
---|
1195 | { |
---|
1196 | // init list |
---|
1197 | std::vector<Int> aiViewsInCfg; |
---|
1198 | for( UInt uiRow = 0; uiRow < m_aadCameraParameters.size(); uiRow++ ) |
---|
1199 | { |
---|
1200 | aiViewsInCfg.push_back( (Int)( m_aadCameraParameters[ uiRow ][ 0 ] * m_dViewNumPrec ) ); |
---|
1201 | } |
---|
1202 | // remove duplicated items |
---|
1203 | std::sort( aiViewsInCfg.begin(), aiViewsInCfg.end() ); |
---|
1204 | std::vector<Int>::iterator cIterNewEnd = std::unique( aiViewsInCfg.begin(), aiViewsInCfg.end() ); |
---|
1205 | aiViewsInCfg.erase( cIterNewEnd, aiViewsInCfg.end() ); |
---|
1206 | // sort (from left to right) |
---|
1207 | std::vector<Int> aiDummyI2SI, aiDummySI2I; |
---|
1208 | xGetSortedViewList( aiViewsInCfg, m_aiViewsInCfgFile, aiDummyI2SI, aiDummySI2I ); |
---|
1209 | // check |
---|
1210 | if( m_aiViewsInCfgFile.size() < 2 ) |
---|
1211 | { |
---|
1212 | std::cerr << "Failed reading config file" << std::endl; |
---|
1213 | std::cerr << "At least two views must be given" << std::endl; |
---|
1214 | exit( EXIT_FAILURE ); |
---|
1215 | } |
---|
1216 | |
---|
1217 | |
---|
1218 | |
---|
1219 | //===== set list of base views and related arrays ===== |
---|
1220 | if( pchBaseViewNumbers == 0 ) |
---|
1221 | { |
---|
1222 | std::cerr << "BaseViewCameraNumbers must be given" << std::endl; |
---|
1223 | exit( EXIT_FAILURE ); |
---|
1224 | }; |
---|
1225 | |
---|
1226 | convertNumberString( pchBaseViewNumbers, m_aiBaseViews, m_dViewNumPrec ); |
---|
1227 | while( (UInt)m_aiBaseViews.size() > uiNumBaseViews ) |
---|
1228 | { |
---|
1229 | m_aiBaseViews.pop_back(); |
---|
1230 | } |
---|
1231 | xGetSortedViewList( m_aiBaseViews, m_aiSortedBaseViews, m_aiBaseId2SortedId, m_aiBaseSortedId2Id ); |
---|
1232 | m_iNumberOfBaseViews = (Int)m_aiBaseViews.size(); |
---|
1233 | } |
---|
1234 | |
---|
1235 | |
---|
1236 | Void |
---|
1237 | TAppComCamPara::init( UInt uiNumBaseViews, |
---|
1238 | UInt uiInputBitDepth, |
---|
1239 | UInt uiCodedCamParsPrecision, |
---|
1240 | UInt uiStartFrameId, |
---|
1241 | UInt uiNumFrames, |
---|
1242 | Char* pchCfgFileName, |
---|
1243 | Char* pchBaseViewNumbers, |
---|
1244 | Char* pchSynthViewNumbers, |
---|
1245 | std::vector<Int>* paiSynthViewNumbers, |
---|
1246 | Int iLog2Precision ) |
---|
1247 | { |
---|
1248 | //===== set miscellaneous variables ===== |
---|
1249 | m_uiInputBitDepth = uiInputBitDepth; |
---|
1250 | m_uiFirstFrameId = uiStartFrameId; |
---|
1251 | m_uiLastFrameId = uiStartFrameId + uiNumFrames - 1; |
---|
1252 | m_uiCamParsCodedPrecision = uiCodedCamParsPrecision; |
---|
1253 | m_iLog2Precision = iLog2Precision; |
---|
1254 | #if HHI_INTERVIEW_SKIP |
---|
1255 | m_iCurrentFrameId = 0 ; |
---|
1256 | #endif |
---|
1257 | |
---|
1258 | xReadCameraParameterFile( pchCfgFileName ); |
---|
1259 | |
---|
1260 | m_bSetupFromCoded = ( m_aadCameraParameters[ 0 ].size() == 2 ); |
---|
1261 | |
---|
1262 | if ( m_bSetupFromCoded ) |
---|
1263 | { |
---|
1264 | std::cout << "Detected decoded camera parameter file. Overwriting base view settings from cfg file. " << std::endl; |
---|
1265 | xSetupBaseViewsFromCoded(); |
---|
1266 | } |
---|
1267 | else |
---|
1268 | { |
---|
1269 | xSetupBaseViews( pchBaseViewNumbers, uiNumBaseViews ); |
---|
1270 | } |
---|
1271 | |
---|
1272 | //===== set list of external (virtual) views ===== |
---|
1273 | m_aiSynthViews.clear(); |
---|
1274 | |
---|
1275 | if( pchSynthViewNumbers != 0 || paiSynthViewNumbers != 0) |
---|
1276 | { |
---|
1277 | std::vector<Int> aiTmpSynthViews; |
---|
1278 | |
---|
1279 | AOT( ( pchSynthViewNumbers != NULL ) && ( paiSynthViewNumbers != NULL ) ); |
---|
1280 | |
---|
1281 | if ( pchSynthViewNumbers != NULL ) |
---|
1282 | { |
---|
1283 | convertNumberString( pchSynthViewNumbers, aiTmpSynthViews, m_dViewNumPrec ); |
---|
1284 | } |
---|
1285 | else |
---|
1286 | { |
---|
1287 | aiTmpSynthViews = (*paiSynthViewNumbers); |
---|
1288 | } |
---|
1289 | |
---|
1290 | for( UInt uiSId = 0; uiSId < (UInt)aiTmpSynthViews.size(); uiSId++ ) |
---|
1291 | { |
---|
1292 | |
---|
1293 | Int iViewNumPrec = (Int) m_dViewNumPrec; |
---|
1294 | Int iLeftBaseViewIdx = aiTmpSynthViews[ uiSId ] / iViewNumPrec; |
---|
1295 | Int iRightBaseViewIdx = ( aiTmpSynthViews[ uiSId ] + (iViewNumPrec - 1) ) / iViewNumPrec; |
---|
1296 | |
---|
1297 | if ( iLeftBaseViewIdx < 0 || iRightBaseViewIdx >= m_iNumberOfBaseViews ) |
---|
1298 | { |
---|
1299 | std::cerr << "SynthViewCameraNumbers must be greater and equal to 0 and smaller than number of base views" << std::endl; |
---|
1300 | AOT(true); |
---|
1301 | exit( EXIT_FAILURE ); |
---|
1302 | } |
---|
1303 | |
---|
1304 | Int64 iLeftBaseViewRelNum = iLeftBaseViewIdx * iViewNumPrec; |
---|
1305 | Int64 iRightBaseViewRelNum = iRightBaseViewIdx * iViewNumPrec; |
---|
1306 | |
---|
1307 | Int64 iDiffBaseViewRelNum = iRightBaseViewRelNum - iLeftBaseViewRelNum; |
---|
1308 | |
---|
1309 | Int64 iSynthViewRelNum = aiTmpSynthViews[ uiSId ]; |
---|
1310 | Int64 iLeftBaseNum = m_aiSortedBaseViews[ iLeftBaseViewIdx ]; |
---|
1311 | Int64 iRightBaseNum = m_aiSortedBaseViews[ iRightBaseViewIdx ]; |
---|
1312 | Int64 iDiffBaseNum = iRightBaseNum - iLeftBaseNum; |
---|
1313 | Int64 iSynthViewNum; |
---|
1314 | |
---|
1315 | if ( iDiffBaseViewRelNum != 0) |
---|
1316 | { |
---|
1317 | AOT( (Int) iDiffBaseViewRelNum != iViewNumPrec ); |
---|
1318 | Int iFact = iDiffBaseNum > 0 ? 1 : -1; |
---|
1319 | iSynthViewNum = iLeftBaseNum + ( iDiffBaseNum * ( iSynthViewRelNum - iLeftBaseViewRelNum ) + (iViewNumPrec >> 1) * iFact ) / ( iViewNumPrec ); |
---|
1320 | } |
---|
1321 | else |
---|
1322 | { |
---|
1323 | iSynthViewNum = iLeftBaseNum; |
---|
1324 | } |
---|
1325 | |
---|
1326 | m_aiRelSynthViewsNum.push_back( aiTmpSynthViews[ uiSId ] ); |
---|
1327 | m_aiSynthViews .push_back( (Int) iSynthViewNum ); |
---|
1328 | } |
---|
1329 | } |
---|
1330 | m_iNumberOfSynthViews = (Int)m_aiSynthViews.size(); |
---|
1331 | |
---|
1332 | |
---|
1333 | //===== set derived parameters ===== |
---|
1334 | xGetViewOrderIndices( m_aiBaseId2SortedId, m_aiViewOrderIndex ); |
---|
1335 | m_bCamParsVaryOverTime = xGetCamParsChangeFlag(); |
---|
1336 | |
---|
1337 | |
---|
1338 | //===== create arrays ===== |
---|
1339 | xCreateLUTs ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT, m_adBaseViewShiftParameter, m_aiBaseViewShiftParameter ); |
---|
1340 | xCreateLUTs ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfSynthViews, m_adSynthViewShiftLUT, m_aiSynthViewShiftLUT, m_adSynthViewShiftParameter, m_aiSynthViewShiftParameter ); |
---|
1341 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiCodedScale ); |
---|
1342 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiCodedOffset ); |
---|
1343 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet ); |
---|
1344 | xInit2dArray ( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiScaleAndOffsetSet, 0 ); |
---|
1345 | |
---|
1346 | #if H_3D_PDM_CAM_PARAS |
---|
1347 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiPdmScaleNomDelta ); |
---|
1348 | xCreate2dArray( (UInt)m_iNumberOfBaseViews, (UInt)m_iNumberOfBaseViews, m_aaiPdmOffset ); |
---|
1349 | |
---|
1350 | //===== init disparity to virtual depth conversion parameters ===== |
---|
1351 | xSetPdmConversionParams(); |
---|
1352 | #endif |
---|
1353 | |
---|
1354 | //===== init arrays for first frame ===== |
---|
1355 | xSetShiftParametersAndLUT( m_uiFirstFrameId ); |
---|
1356 | } |
---|
1357 | |
---|
1358 | |
---|
1359 | Void |
---|
1360 | TAppComCamPara::check( Bool bCheckViewRange, Bool bCheckFrameRange ) |
---|
1361 | { |
---|
1362 | if( bCheckFrameRange ) |
---|
1363 | { |
---|
1364 | Double dDummy; |
---|
1365 | |
---|
1366 | for( UInt uiBaseView = 0; uiBaseView < m_aiBaseViews.size(); uiBaseView++ ) |
---|
1367 | { |
---|
1368 | if ( m_bSetupFromCoded ) |
---|
1369 | { |
---|
1370 | for( UInt uiTargetView = 0; uiTargetView < m_aiBaseViews.size(); uiTargetView++ ) |
---|
1371 | { |
---|
1372 | if ( uiTargetView == uiBaseView ) |
---|
1373 | continue; |
---|
1374 | |
---|
1375 | for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ ) |
---|
1376 | { |
---|
1377 | Int iDummy; |
---|
1378 | |
---|
1379 | xGetCodedCameraData( uiBaseView, uiTargetView, true , uiFrame, iDummy, iDummy, iDummy ); |
---|
1380 | } |
---|
1381 | } |
---|
1382 | } |
---|
1383 | else |
---|
1384 | { |
---|
1385 | for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ ) |
---|
1386 | { |
---|
1387 | Bool bInterpolatedCur; |
---|
1388 | xGetGeometryData( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur ); |
---|
1389 | xGetZNearZFar ( m_aiBaseViews[ uiBaseView ], uiFrame, dDummy, dDummy ); |
---|
1390 | |
---|
1391 | if( bInterpolatedCur ) |
---|
1392 | { |
---|
1393 | std::cerr << "Error: CameraParameters for BaseView " << (Double)m_aiBaseViews[ uiBaseView ] / m_dViewNumPrec << " and Frame " << uiFrame << " not defined. " << std::endl; |
---|
1394 | exit( EXIT_FAILURE ); |
---|
1395 | } |
---|
1396 | } |
---|
1397 | |
---|
1398 | } |
---|
1399 | } |
---|
1400 | |
---|
1401 | Bool bInterpolateFirst = true; |
---|
1402 | Bool bAnyInterpolated = false; |
---|
1403 | for( UInt uiERView = 0; uiERView < m_aiSynthViews.size() && !m_bSetupFromCoded; uiERView++ ) |
---|
1404 | { |
---|
1405 | Bool bInterpolated = false; |
---|
1406 | for( UInt uiFrame = m_uiFirstFrameId; uiFrame <= m_uiLastFrameId; uiFrame++ ) |
---|
1407 | { |
---|
1408 | Bool bInterpolatedCur; |
---|
1409 | xGetGeometryData( m_aiSynthViews[ uiERView ], uiFrame, dDummy, dDummy, dDummy, bInterpolatedCur ); |
---|
1410 | bInterpolated |= bInterpolatedCur; |
---|
1411 | } |
---|
1412 | |
---|
1413 | if( bInterpolated ) |
---|
1414 | { |
---|
1415 | bAnyInterpolated = true; |
---|
1416 | if ( bInterpolateFirst ) |
---|
1417 | { |
---|
1418 | std::cout << "Interpolating Camera Parameters for View(s) " ; |
---|
1419 | bInterpolateFirst = false; |
---|
1420 | } |
---|
1421 | std::cout << (Double)m_aiSynthViews[ uiERView ] / m_dViewNumPrec << " " ; |
---|
1422 | } |
---|
1423 | } |
---|
1424 | if ( bAnyInterpolated ) |
---|
1425 | std::cout << std::endl; |
---|
1426 | } |
---|
1427 | |
---|
1428 | if( bCheckViewRange ) |
---|
1429 | { |
---|
1430 | Bool bAllExist = true; |
---|
1431 | for( Int iSynthViewIdx = 0; iSynthViewIdx < m_iNumberOfSynthViews; iSynthViewIdx++ ) |
---|
1432 | { |
---|
1433 | Bool bIsBaseView; |
---|
1434 | Int iDummy; |
---|
1435 | Bool bExist = getLeftRightBaseView( iSynthViewIdx, iDummy, iDummy, iDummy, bIsBaseView ); |
---|
1436 | bAllExist &= ( bExist || bIsBaseView ); |
---|
1437 | } |
---|
1438 | if( !bAllExist ) |
---|
1439 | { |
---|
1440 | std::cerr << "SynthViewNumbers must be within the range of BaseViewNumbers" << std::endl; |
---|
1441 | exit( EXIT_FAILURE ); |
---|
1442 | } |
---|
1443 | } |
---|
1444 | } |
---|
1445 | |
---|
1446 | |
---|
1447 | Void |
---|
1448 | TAppComCamPara::update( UInt uiFrameId ) |
---|
1449 | { |
---|
1450 | |
---|
1451 | m_iCurrentFrameId = uiFrameId; |
---|
1452 | m_bCamParsCodedPrecSet = false; |
---|
1453 | |
---|
1454 | if ( m_bCamParsVaryOverTime ) |
---|
1455 | { |
---|
1456 | xSetShiftParametersAndLUT( m_uiFirstFrameId + uiFrameId ); |
---|
1457 | } |
---|
1458 | } |
---|
1459 | |
---|
1460 | #if H_3D_VSO |
---|
1461 | Void |
---|
1462 | TAppComCamPara::setDispCoeff( UInt uiFrameId, Int iViewIdx ) |
---|
1463 | { |
---|
1464 | UInt uiFrame = m_uiFirstFrameId + uiFrameId; |
---|
1465 | Int iSourceViewNum = m_aiBaseViews[ iViewIdx ]; |
---|
1466 | Double dBaseLine = 0.0; |
---|
1467 | Double dFL1, dCS1, dCP1, dZN1, dZF1; |
---|
1468 | Bool bInterpolated; |
---|
1469 | double dPos[3]; |
---|
1470 | |
---|
1471 | if( m_iNumberOfBaseViews == 3 ) |
---|
1472 | { |
---|
1473 | xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated ); |
---|
1474 | xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated ); |
---|
1475 | xGetGeometryData( m_aiBaseViews[2], uiFrame, dFL1, dPos[2], dCS1, bInterpolated ); |
---|
1476 | |
---|
1477 | xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated ); |
---|
1478 | xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 ); |
---|
1479 | |
---|
1480 | dBaseLine = ( std::max( dPos[0], std::max( dPos[1], dPos[2] ) ) - std::min( dPos[0], std::min( dPos[1], dPos[2] ) ) ) / 2.0; |
---|
1481 | } |
---|
1482 | else if( m_iNumberOfBaseViews == 2 ) |
---|
1483 | { |
---|
1484 | xGetGeometryData( m_aiBaseViews[0], uiFrame, dFL1, dPos[0], dCS1, bInterpolated ); |
---|
1485 | xGetGeometryData( m_aiBaseViews[1], uiFrame, dFL1, dPos[1], dCS1, bInterpolated ); |
---|
1486 | |
---|
1487 | xGetGeometryData( iSourceViewNum, uiFrame, dFL1, dCP1, dCS1, bInterpolated ); |
---|
1488 | xGetZNearZFar ( iSourceViewNum, uiFrame, dZN1, dZF1 ); |
---|
1489 | |
---|
1490 | dBaseLine = dPos[0] - dPos[1]; |
---|
1491 | } |
---|
1492 | |
---|
1493 | m_dDispCoeff = fabs( dFL1 * ( dBaseLine / 2.0 ) / 255.0 * ( 1.0/dZN1 - 1.0/dZF1 ) ); |
---|
1494 | } |
---|
1495 | #endif |
---|
1496 | |
---|
1497 | Bool |
---|
1498 | TAppComCamPara::getLeftRightBaseView( Int iSynthViewIdx, Int &riLeftViewIdx, Int &riRightViewIdx, Int &riRelDistToLeft, Bool& rbIsBaseView ) |
---|
1499 | { |
---|
1500 | Int iLeftSortedViewIdx, iRightSortedViewIdx, iDummy; |
---|
1501 | Bool bExist = xGetLeftRightView( m_aiSynthViews[ iSynthViewIdx ], m_aiSortedBaseViews, iDummy, iDummy, iLeftSortedViewIdx, iRightSortedViewIdx ); |
---|
1502 | rbIsBaseView = ( iLeftSortedViewIdx == iRightSortedViewIdx && iLeftSortedViewIdx != -1 ); |
---|
1503 | |
---|
1504 | Int iLeftViewIdx = ( iLeftSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iLeftSortedViewIdx ] : -1 ); |
---|
1505 | Int iRightViewIdx = ( iRightSortedViewIdx != -1 ? m_aiBaseSortedId2Id[ iRightSortedViewIdx ] : -1 ); |
---|
1506 | |
---|
1507 | if ( iLeftSortedViewIdx != -1 && iRightSortedViewIdx != -1 ) |
---|
1508 | { |
---|
1509 | riRelDistToLeft = getRelDistLeft( iSynthViewIdx, iLeftViewIdx, iRightViewIdx); |
---|
1510 | } |
---|
1511 | else |
---|
1512 | { |
---|
1513 | riRelDistToLeft = -1; |
---|
1514 | } |
---|
1515 | |
---|
1516 | riLeftViewIdx = iLeftViewIdx; |
---|
1517 | riRightViewIdx = iRightViewIdx; |
---|
1518 | |
---|
1519 | return bExist; |
---|
1520 | } |
---|
1521 | |
---|
1522 | Int TAppComCamPara::getRelDistLeft( Int iSynthViewIdx, Int iLeftViewIdx, Int iRightViewIdx ) |
---|
1523 | { |
---|
1524 | //GT: Get normalized distance |
---|
1525 | Int iLeftViewDist = abs ( m_aiBaseId2SortedId[ iLeftViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]); |
---|
1526 | Int iRightViewDist = abs ( m_aiBaseId2SortedId[ iRightViewIdx ] * ((Int) m_dViewNumPrec) - m_aiRelSynthViewsNum [ iSynthViewIdx ]); |
---|
1527 | Int64 iDistSum = iLeftViewDist + iRightViewDist; |
---|
1528 | return (iDistSum == 0) ? (1 << (REN_VDWEIGHT_PREC -1) ) : (Int) (( (((Int64) iLeftViewDist ) << REN_VDWEIGHT_PREC ) + (iDistSum >> 1) ) / iDistSum ); |
---|
1529 | } |
---|
1530 | |
---|
1531 | Int |
---|
1532 | TAppComCamPara::synthRelNum2Idx( Int iRelNum ) |
---|
1533 | { |
---|
1534 | return xGetViewId(m_aiRelSynthViewsNum, iRelNum ); |
---|
1535 | } |
---|
1536 | #endif |
---|