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 | #include "TRenImagePlane.h" |
---|
36 | #include "TRenFilter.h" |
---|
37 | #include <string.h> |
---|
38 | /////// TRenImagePlane /////// |
---|
39 | |
---|
40 | template<class T> |
---|
41 | TRenImagePlane<T>::TRenImagePlane() { m_bClean = true; } |
---|
42 | |
---|
43 | template<class T> |
---|
44 | TRenImagePlane<T>::TRenImagePlane(UInt uiWidth, UInt uiHeight, UInt uiPad, UInt uiBitDepth ) |
---|
45 | : m_uiWidth (uiWidth), |
---|
46 | m_uiHeight (uiHeight), |
---|
47 | m_uiStride (uiWidth+2*uiPad), |
---|
48 | m_uiWidthOrg (uiWidth+2*uiPad), |
---|
49 | m_uiHeightOrg(uiHeight+2*uiPad), |
---|
50 | m_uiPad (uiPad), |
---|
51 | m_uiBitDepth (uiBitDepth) |
---|
52 | { |
---|
53 | m_pcDataOrg = new T[ m_uiWidthOrg * m_uiHeightOrg ]; |
---|
54 | m_pcData = m_pcDataOrg + m_uiPad * m_uiStride + m_uiPad; |
---|
55 | m_bClean = true; |
---|
56 | } |
---|
57 | |
---|
58 | template<class T> |
---|
59 | TRenImagePlane<T>::TRenImagePlane(TRenImagePlane* pcPlane) |
---|
60 | : m_uiWidth (pcPlane->getWidth ()) |
---|
61 | , m_uiHeight (pcPlane->getHeight ()) |
---|
62 | , m_uiStride (pcPlane->getStride ()) |
---|
63 | , m_uiWidthOrg (pcPlane->getWidthOrg()) |
---|
64 | , m_uiHeightOrg(pcPlane->getHeightOrg()) |
---|
65 | , m_uiPad (pcPlane->getPad ()) |
---|
66 | , m_uiBitDepth (pcPlane->getBitDepth()) |
---|
67 | { |
---|
68 | m_pcData = new T[m_uiWidthOrg*m_uiHeightOrg]; |
---|
69 | m_bClean = true; |
---|
70 | assign( pcPlane ); |
---|
71 | } |
---|
72 | |
---|
73 | template<typename T> |
---|
74 | TRenImagePlane<T>::TRenImagePlane( T* pcDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad, UInt uiBitDepth ) |
---|
75 | : m_pcData (pcDataOrg + uiStride * uiPad + uiPad ) |
---|
76 | , m_uiWidth (uiWidthOrg - 2* uiPad ) |
---|
77 | , m_uiHeight (uiHeightOrg - 2* uiPad ) |
---|
78 | , m_uiStride (uiStride ) |
---|
79 | , m_pcDataOrg (pcDataOrg ) |
---|
80 | , m_uiWidthOrg (uiWidthOrg ) |
---|
81 | , m_uiHeightOrg(uiHeightOrg) |
---|
82 | , m_uiPad (uiPad ) |
---|
83 | , m_bClean (false ) |
---|
84 | , m_uiBitDepth (uiBitDepth ) |
---|
85 | { |
---|
86 | |
---|
87 | } |
---|
88 | |
---|
89 | template<typename T> |
---|
90 | Void TRenImagePlane<T>::setData( T* pDataOrg, UInt uiWidthOrg, UInt uiHeightOrg, UInt uiStride, UInt uiPad, Bool bClean /*= false*/ ) |
---|
91 | { |
---|
92 | deleteData(); |
---|
93 | m_uiPad = uiPad; |
---|
94 | m_pcDataOrg = pDataOrg; |
---|
95 | m_uiWidthOrg = uiWidthOrg; |
---|
96 | m_uiHeightOrg = uiHeightOrg; |
---|
97 | m_uiWidth = uiWidthOrg - 2* uiPad; |
---|
98 | m_uiHeight = uiHeightOrg - 2* uiPad; |
---|
99 | m_uiStride = uiStride; |
---|
100 | m_pcData = m_pcDataOrg + uiPad * m_uiStride + uiPad; |
---|
101 | m_bClean = bClean; |
---|
102 | } |
---|
103 | |
---|
104 | template<typename T> |
---|
105 | Void TRenImagePlane<T>::setData( TRenImagePlane<T>* pcInPlane, Bool bClean ) |
---|
106 | { |
---|
107 | deleteData(); |
---|
108 | m_uiPad = pcInPlane->getPad(); |
---|
109 | m_pcDataOrg = pcInPlane->getPlaneDataOrg(); |
---|
110 | m_uiWidthOrg = pcInPlane->getWidthOrg(); |
---|
111 | m_uiHeightOrg = pcInPlane->getHeightOrg(); |
---|
112 | m_uiWidth = pcInPlane->getWidth(); |
---|
113 | m_uiHeight = pcInPlane->getHeight(); |
---|
114 | m_uiStride = pcInPlane->getStride(); |
---|
115 | m_pcData = pcInPlane->getPlaneData(); |
---|
116 | m_bClean = bClean; |
---|
117 | pcInPlane->setClean( !m_bClean ); |
---|
118 | } |
---|
119 | |
---|
120 | template<typename T> |
---|
121 | Void TRenImagePlane<T>::setClean( Bool bClean ) |
---|
122 | { |
---|
123 | m_bClean = bClean; |
---|
124 | } |
---|
125 | |
---|
126 | template<class T> |
---|
127 | T* TRenImagePlane<T>::getPlaneData() |
---|
128 | { |
---|
129 | return m_pcData; |
---|
130 | } |
---|
131 | |
---|
132 | |
---|
133 | template<class T> |
---|
134 | T* TRenImagePlane<T>::getPlaneDataOrg() |
---|
135 | { |
---|
136 | return m_pcDataOrg; |
---|
137 | } |
---|
138 | |
---|
139 | |
---|
140 | template<class T> |
---|
141 | Void TRenImagePlane<T>::assign(Pel* pcSourceData, UInt uiSourceStride ) |
---|
142 | { |
---|
143 | T* pcTargetData = m_pcDataOrg; |
---|
144 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
145 | { |
---|
146 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
147 | { |
---|
148 | pcTargetData[uiXPos] = (T) pcSourceData[uiXPos]; |
---|
149 | } |
---|
150 | pcTargetData += m_uiStride; |
---|
151 | pcSourceData += uiSourceStride; |
---|
152 | } |
---|
153 | } |
---|
154 | |
---|
155 | template<class T> |
---|
156 | Void TRenImagePlane<T>::assign(Pel cData) |
---|
157 | { |
---|
158 | T* pcTargetData = m_pcDataOrg; |
---|
159 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
160 | { |
---|
161 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
162 | { |
---|
163 | pcTargetData[uiXPos] = (T) cData; |
---|
164 | } |
---|
165 | pcTargetData += m_uiStride; |
---|
166 | } |
---|
167 | } |
---|
168 | |
---|
169 | template<class T> |
---|
170 | Void TRenImagePlane<T>::assign(Double* pdData, UInt uiSourceStride ) |
---|
171 | { |
---|
172 | T* pcTargetData = m_pcDataOrg; |
---|
173 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
174 | { |
---|
175 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
176 | { |
---|
177 | pcTargetData[uiXPos] = (T) pdData[uiXPos]; |
---|
178 | } |
---|
179 | pcTargetData += m_uiStride; |
---|
180 | pdData += uiSourceStride; |
---|
181 | |
---|
182 | } |
---|
183 | } |
---|
184 | |
---|
185 | template<class T> |
---|
186 | Void TRenImagePlane<T>::assign(Double dData) |
---|
187 | { |
---|
188 | T* pcTargetData = m_pcDataOrg; |
---|
189 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
190 | { |
---|
191 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
192 | { |
---|
193 | pcTargetData[uiXPos] = (T) dData; |
---|
194 | } |
---|
195 | pcTargetData += m_uiStride; |
---|
196 | } |
---|
197 | } |
---|
198 | |
---|
199 | |
---|
200 | template<class T> |
---|
201 | Void TRenImagePlane<T>::assign(Bool* pbData, UInt uiSourceStride ) |
---|
202 | { |
---|
203 | T* pcTargetData = m_pcDataOrg; |
---|
204 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
205 | { |
---|
206 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
207 | { |
---|
208 | pcTargetData[uiXPos] = (T) pbData[uiXPos]; |
---|
209 | } |
---|
210 | pcTargetData += m_uiStride; |
---|
211 | pbData += uiSourceStride; |
---|
212 | } |
---|
213 | } |
---|
214 | |
---|
215 | template<class T> |
---|
216 | Void TRenImagePlane<T>::assign(Int iData) |
---|
217 | { |
---|
218 | T* pcTargetData = m_pcDataOrg; |
---|
219 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
220 | { |
---|
221 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
222 | { |
---|
223 | pcTargetData[uiXPos] = (T) iData; |
---|
224 | } |
---|
225 | pcTargetData += m_uiStride; |
---|
226 | } |
---|
227 | } |
---|
228 | |
---|
229 | template<class T> |
---|
230 | Void TRenImagePlane<T>::assign(Int* piData, UInt uiSourceStride ) |
---|
231 | { |
---|
232 | T* pcTargetData = m_pcDataOrg; |
---|
233 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
234 | { |
---|
235 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
236 | { |
---|
237 | pcTargetData[uiXPos] = (T) piData[uiXPos]; |
---|
238 | } |
---|
239 | pcTargetData += m_uiStride; |
---|
240 | piData += uiSourceStride; |
---|
241 | } |
---|
242 | } |
---|
243 | |
---|
244 | template<class T> |
---|
245 | Void TRenImagePlane<T>::assign(Bool data) |
---|
246 | { |
---|
247 | T* pcTargetData = m_pcDataOrg; |
---|
248 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
249 | { |
---|
250 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
251 | { |
---|
252 | pcTargetData[uiXPos] = (T) data; |
---|
253 | } |
---|
254 | pcTargetData += m_uiStride; |
---|
255 | } |
---|
256 | } |
---|
257 | |
---|
258 | // Assignments to Bool |
---|
259 | |
---|
260 | template<> |
---|
261 | Void TRenImagePlane<Bool>::assign(Int* piData, UInt uiSourceStride ) |
---|
262 | { |
---|
263 | Bool* pcTargetData = m_pcDataOrg; |
---|
264 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
265 | { |
---|
266 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
267 | { |
---|
268 | pcTargetData[uiXPos] = (piData[uiXPos] == 0); |
---|
269 | } |
---|
270 | pcTargetData += m_uiStride; |
---|
271 | piData += uiSourceStride; |
---|
272 | |
---|
273 | } |
---|
274 | } |
---|
275 | |
---|
276 | template<> |
---|
277 | Void TRenImagePlane<Bool>::assign(Int iData) |
---|
278 | { |
---|
279 | Bool* pcTargetData = m_pcDataOrg; |
---|
280 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
281 | { |
---|
282 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
283 | { |
---|
284 | pcTargetData[uiXPos] = (iData == 0); |
---|
285 | } |
---|
286 | pcTargetData += m_uiStride; |
---|
287 | } |
---|
288 | } |
---|
289 | |
---|
290 | template<> |
---|
291 | Void TRenImagePlane<Bool>::assign(Pel* pcData, UInt uiSourceStride ) |
---|
292 | { |
---|
293 | Bool* pcTargetData = m_pcDataOrg; |
---|
294 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
295 | { |
---|
296 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
297 | { |
---|
298 | pcTargetData[uiXPos] = (pcData[uiXPos] == 0); |
---|
299 | } |
---|
300 | pcTargetData += m_uiStride; |
---|
301 | pcData += uiSourceStride; |
---|
302 | |
---|
303 | } |
---|
304 | } |
---|
305 | |
---|
306 | template<> |
---|
307 | Void TRenImagePlane<Bool>::assign(Pel cData) |
---|
308 | { |
---|
309 | Bool* pcTargetData = m_pcDataOrg; |
---|
310 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
311 | { |
---|
312 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
313 | { |
---|
314 | pcTargetData[uiXPos] = (cData == 0); |
---|
315 | } |
---|
316 | pcTargetData += m_uiStride; |
---|
317 | } |
---|
318 | } |
---|
319 | |
---|
320 | template<> |
---|
321 | Void TRenImagePlane<Bool>::assign(Double* pdData, UInt uiSourceStride ) |
---|
322 | { |
---|
323 | Bool* pcTargetData = m_pcDataOrg; |
---|
324 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
325 | { |
---|
326 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
327 | { |
---|
328 | pcTargetData[uiXPos] = ( pdData[uiXPos] == 0); |
---|
329 | } |
---|
330 | pcTargetData += m_uiStride; |
---|
331 | pdData += uiSourceStride; |
---|
332 | |
---|
333 | } |
---|
334 | } |
---|
335 | |
---|
336 | |
---|
337 | |
---|
338 | template<> |
---|
339 | Void TRenImagePlane<Bool>::assign(Double dData) |
---|
340 | { |
---|
341 | Bool* pcTargetData = m_pcDataOrg; |
---|
342 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
343 | { |
---|
344 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
345 | { |
---|
346 | pcTargetData [uiXPos] = (dData == 0); |
---|
347 | } |
---|
348 | pcTargetData += m_uiStride; |
---|
349 | } |
---|
350 | } |
---|
351 | |
---|
352 | |
---|
353 | // Assignments to Pel |
---|
354 | template<> |
---|
355 | Void TRenImagePlane<Pel>::assign(Double* pdData, UInt uiSourceStride ) |
---|
356 | { |
---|
357 | Pel* pcTargetData = m_pcDataOrg; |
---|
358 | for (UInt uiYPos = 0; uiYPos < m_uiHeightOrg; uiYPos++) |
---|
359 | { |
---|
360 | for (UInt uiXPos = 0; uiXPos < m_uiWidthOrg; uiXPos++) |
---|
361 | { |
---|
362 | pcTargetData[uiXPos] = (Pel) ( pdData[uiXPos] + pdData[uiXPos] < 0 ? -0.5 : 0.5 ) ; |
---|
363 | } |
---|
364 | pcTargetData += m_uiStride; |
---|
365 | pdData += uiSourceStride; |
---|
366 | } |
---|
367 | } |
---|
368 | |
---|
369 | template<class T> |
---|
370 | Void TRenImagePlane<T>::assign(TRenImagePlane<T>* pcPlane) |
---|
371 | { |
---|
372 | assign(pcPlane->getPlaneDataOrg(), pcPlane->getStride()); |
---|
373 | } |
---|
374 | |
---|
375 | template<class T> |
---|
376 | Void TRenImagePlane<T>::assign(TRenImagePlane<T>* pcPlane, UInt uiRow, UInt uiStartOffset, UInt uiEndOffset) |
---|
377 | { |
---|
378 | T* pcTargetData = m_pcData + uiRow * m_uiStride; |
---|
379 | T* pcSourceData = pcPlane->getPlaneData() + uiRow * pcPlane->getStride(); |
---|
380 | |
---|
381 | for (UInt uiPosX = uiStartOffset; uiPosX <= uiEndOffset; uiPosX++) |
---|
382 | { |
---|
383 | pcTargetData[uiPosX] = pcSourceData[uiPosX]; |
---|
384 | } |
---|
385 | |
---|
386 | } |
---|
387 | |
---|
388 | template<class T> |
---|
389 | Void TRenImagePlane<T>::assign(TRenImagePlane<T>* pcSourcePlane, UInt uiSourceRowStart, UInt uiSourceColStart, UInt uiWidth, UInt uiHeight) |
---|
390 | { |
---|
391 | T* acSourceData; |
---|
392 | T* acDestData; |
---|
393 | |
---|
394 | acSourceData = pcSourcePlane->getPlaneData(); |
---|
395 | acSourceData += uiSourceRowStart * pcSourcePlane->getStride() + uiSourceColStart; |
---|
396 | acDestData = m_pcData; |
---|
397 | |
---|
398 | for (UInt uiPosY = 0; uiPosY < uiHeight ; uiPosY++) |
---|
399 | { |
---|
400 | for (UInt uiPosX = 0; uiPosX < uiWidth ; uiPosX++) |
---|
401 | { |
---|
402 | acDestData[uiPosX] = acSourceData[uiPosX]; |
---|
403 | } |
---|
404 | acSourceData += pcSourcePlane->getStride(); |
---|
405 | acDestData += this ->getStride(); |
---|
406 | }; |
---|
407 | } |
---|
408 | |
---|
409 | |
---|
410 | |
---|
411 | template<class T> |
---|
412 | Void TRenImagePlane<T>::assign( T data , UInt uiRow, UInt uiStartOffset, UInt uiEndOffset) |
---|
413 | { |
---|
414 | T* pcTargetData = m_pcData + uiRow * m_uiStride; |
---|
415 | for (UInt uiPosX = uiStartOffset; uiPosX <= uiEndOffset; uiPosX++) |
---|
416 | { |
---|
417 | pcTargetData[uiPosX] = data; |
---|
418 | } |
---|
419 | } |
---|
420 | |
---|
421 | |
---|
422 | template<class T> |
---|
423 | Void TRenImagePlane<T>::devide( Double dDevisor ) |
---|
424 | { |
---|
425 | T* pcTargetData = m_pcDataOrg; |
---|
426 | for (UInt uiPosY = 0; uiPosY < (m_uiHeightOrg); uiPosY++) |
---|
427 | { |
---|
428 | for (UInt uiPosX = 0; uiPosX < m_uiWidthOrg; uiPosX++) |
---|
429 | { |
---|
430 | pcTargetData[uiPosX] = (T) ( ( Double )pcTargetData[uiPosX] / dDevisor ); |
---|
431 | } |
---|
432 | pcTargetData += m_uiStride; |
---|
433 | } |
---|
434 | }; |
---|
435 | |
---|
436 | template<class T> |
---|
437 | Void TRenImagePlane<T>::multiply( Double dMultiplier ) { |
---|
438 | T* pcTargetData = m_pcDataOrg; |
---|
439 | for (UInt uiPosY = 0; uiPosY < (m_uiHeightOrg); uiPosY++) |
---|
440 | { |
---|
441 | for (UInt uiPosX = 0; uiPosX < m_uiWidthOrg; uiPosX++) |
---|
442 | { |
---|
443 | pcTargetData[uiPosX] = (T) ( ( Double )pcTargetData[uiPosX] * dMultiplier ); |
---|
444 | } |
---|
445 | pcTargetData += m_uiStride; |
---|
446 | } |
---|
447 | }; |
---|
448 | |
---|
449 | |
---|
450 | template<> |
---|
451 | Void TRenImagePlane<Bool>::devide( Double dDevisor ) |
---|
452 | { |
---|
453 | assert(0); |
---|
454 | }; |
---|
455 | |
---|
456 | template<> |
---|
457 | Void TRenImagePlane<Bool>::multiply( Double dMultiplier ) |
---|
458 | { |
---|
459 | assert(0); |
---|
460 | }; |
---|
461 | |
---|
462 | |
---|
463 | template<class T> |
---|
464 | Void TRenImagePlane<T>::deleteData() |
---|
465 | { |
---|
466 | if (m_bClean) |
---|
467 | { |
---|
468 | if (m_pcDataOrg) |
---|
469 | { |
---|
470 | delete[] m_pcDataOrg; |
---|
471 | }; |
---|
472 | } |
---|
473 | } |
---|
474 | |
---|
475 | template<class T> |
---|
476 | TRenImagePlane<T>::~TRenImagePlane() |
---|
477 | { |
---|
478 | deleteData(); |
---|
479 | } |
---|
480 | |
---|
481 | |
---|
482 | template<typename T> |
---|
483 | Void TRenImagePlane<T>::extendMargin() |
---|
484 | { |
---|
485 | Int iPad = (Int) m_uiPad; |
---|
486 | T* pcData = m_pcData; |
---|
487 | |
---|
488 | for ( Int iPosY = 0; iPosY < (Int) m_uiHeight; iPosY++) |
---|
489 | { |
---|
490 | for ( Int iPosX = 0; iPosX < (Int) iPad; iPosX++ ) |
---|
491 | { |
---|
492 | pcData[ -iPad + iPosX ] = pcData[0]; |
---|
493 | pcData[m_uiWidth + iPosX ] = pcData[m_uiWidth -1 ]; |
---|
494 | } |
---|
495 | pcData += m_uiStride; |
---|
496 | } |
---|
497 | |
---|
498 | |
---|
499 | pcData -= (m_uiStride + iPad); |
---|
500 | for ( Int iPosY = 0; iPosY < iPad; iPosY++ ) |
---|
501 | { |
---|
502 | memcpy( pcData + (iPosY+1)*m_uiStride, pcData, sizeof(T)*(m_uiWidth + (iPad<<1)) ); |
---|
503 | } |
---|
504 | |
---|
505 | pcData -= ((m_uiHeight-1) * m_uiStride); |
---|
506 | for ( Int iPosY = 0; iPosY < iPad; iPosY++ ) |
---|
507 | { |
---|
508 | memcpy( pcData - (iPosY+1)*m_uiStride, pcData, sizeof(T)*(m_uiWidth + (iPad<<1)) ); |
---|
509 | } |
---|
510 | } |
---|
511 | |
---|
512 | template class TRenImagePlane<Pel>; |
---|
513 | template class TRenImagePlane<Double>; |
---|
514 | template class TRenImagePlane<Bool>; |
---|
515 | template class TRenImagePlane<Int>; |
---|
516 | |
---|
517 | /////// TRenImagePlanePart /////// |
---|
518 | |
---|
519 | template<typename T> |
---|
520 | TRenImagePlanePart<T>::TRenImagePlanePart( TRenImagePlane<T>* pPlane, UInt uHorOff, UInt uVerOff, UInt uWidth, UInt uHeight ) |
---|
521 | : TRenImagePlane<T>( pPlane->getPlaneData() + uHorOff + uVerOff * pPlane->getStride(), uWidth, uHeight, pPlane->getStride(),0, pPlane->getBitDepth()) |
---|
522 | { |
---|
523 | |
---|
524 | } |
---|
525 | |
---|
526 | template<typename T> |
---|
527 | TRenImagePlanePart<T>::~TRenImagePlanePart() |
---|
528 | { |
---|
529 | this->m_pcData = NULL; |
---|
530 | } |
---|
531 | |
---|
532 | template class TRenImagePlanePart<Pel>; |
---|
533 | template class TRenImagePlanePart<Double>; |
---|
534 | template class TRenImagePlanePart<Bool>; |
---|
535 | template class TRenImagePlanePart<Int>; |
---|