|
1 |
|
2 // TestStepImageFrame.cpp |
|
3 |
|
4 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
5 // All rights reserved. |
|
6 // This component and the accompanying materials are made available |
|
7 // under the terms of "Eclipse Public License v1.0" |
|
8 // which accompanies this distribution, and is available |
|
9 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
10 // |
|
11 // Initial Contributors: |
|
12 // Nokia Corporation - initial contribution. |
|
13 // |
|
14 // Contributors: |
|
15 // |
|
16 // Description: |
|
17 // |
|
18 |
|
19 #include "TestStepImageFrame.h" |
|
20 #include <imageframe.h> |
|
21 #include <imageframeformats.hrh> |
|
22 #include "jpgimageframeprocessor.h" |
|
23 #include "JpegConsts.h" |
|
24 #include <e32def.h> |
|
25 #include <imageframeconst.hrh> |
|
26 |
|
27 _LIT(KGlobalChunkName, "TestRChunkICLA"); |
|
28 |
|
29 const TInt KMaxBlocks = 6; |
|
30 const TInt KImageSizeInBytes = 1024; |
|
31 const TInt KUniformValue1 = 128; |
|
32 const TInt KUniformValue2 = 0; |
|
33 const TInt KRChunkDataOffset = 10; |
|
34 const TInt KRChunkRestrictionFlags = 0; |
|
35 const TInt KMultiFrameNumber = 2; |
|
36 |
|
37 |
|
38 enum TFormatIndex |
|
39 { |
|
40 EUnknownFormat, |
|
41 EYCbCrMono, |
|
42 EYCbCr422Int, |
|
43 EYCbCr420Pla, |
|
44 EYCbCr420PlaRev |
|
45 }; |
|
46 |
|
47 enum TSizeIndex |
|
48 { |
|
49 EUnknownSize, |
|
50 EYCbCrMonoSize, |
|
51 EYCbCr422IntSize, |
|
52 EYCbCr420PlaSize |
|
53 }; |
|
54 |
|
55 const TInt KExpectedValuesIndx[][KMaxBlocks] = { |
|
56 {0,-1,-1,-1,-1,-1}, |
|
57 {0,1,2,3,-1,-1}, {0,0,2,3,-1,-1}, |
|
58 {0,1,2,3,4,5}, {0,0,2,2,4,5}, {0,1,0,1,4,5}, {0,0,0,0,4,5}, {}}; |
|
59 |
|
60 const TInt KFrameSizeData[][2] = { {16,16}, {32,32}, {64,128},{640,480},{4,4}}; |
|
61 const TInt KFrameTestSizeData[][2] = {{32,32},{13,14}, {18,12},{18,18},{640,480},{4,4}}; |
|
62 const TInt KExpectedBlocksValuesIndx[][4] = { {-1}, {0,0,0,0}, {1,2,1,2},{3,4,5,6},{640,480},{4,4}}; |
|
63 |
|
64 const TUid KFrameFormatDefaults[] = |
|
65 { |
|
66 {0}, |
|
67 {KFormatYUVMonochromeUidValue}, |
|
68 {KFormatYUV422InterleavedUidValue}, |
|
69 {KFormatYUV420PlanarUidValue}, |
|
70 {KFormatYUV420PlanarReversedUidValue} |
|
71 }; |
|
72 |
|
73 const TUid KFormatLists[][3] = |
|
74 { |
|
75 {{KFormatYUVMonochromeUidValue},{KColourSpaceYCbCrUidValue},{KSamplingMonochromeUidValue}}, |
|
76 {{KFormatYUV422InterleavedUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor422UidValue}}, |
|
77 {{KFormatYUV422InterleavedReversedUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor422UidValue}}, |
|
78 {{KFormatYYUV422InterleavedUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor422UidValue}}, |
|
79 {{KFormatYUV422PlanarUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor422UidValue}}, |
|
80 {{KFormatYUV420PlanarUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor420UidValue}}, |
|
81 {{KFormatYUV420PlanarReversedUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor420UidValue}}, |
|
82 {{KFormatYUV420SemiPlanarUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor420UidValue}}, |
|
83 {{KFormatYUV420InterleavedUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor420UidValue}}, |
|
84 {{KFormat16bitRGB444InterleavedUidValue},{KColourSpaceRGBUidValue},{KSamplingColor444UidValue}}, |
|
85 {{KFormat16BitRGB565InterleavedUidValue},{KColourSpaceRGBUidValue},{KSamplingColor444UidValue}}, |
|
86 {{KFormat32BitRGB888InterleavedUidValue},{KColourSpaceRGBUidValue},{KSamplingColor444UidValue}}, |
|
87 {{KFormatYUV444InterleavedUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor444UidValue}}, |
|
88 {{KFormatYUV444PlanarUidValue},{KColourSpaceYCbCrUidValue},{KSamplingColor444UidValue}}, |
|
89 {{0},{0},{0}} |
|
90 }; |
|
91 |
|
92 const TInt KTestClipValues [][2] = {{0,0}, {255,255}, {10, 10}, {-1, 0}, {256, 255}, {128, 128}, {0x7FFF, 0xFF}, {-10, 0}}; |
|
93 |
|
94 |
|
95 // |
|
96 // Various helper utility methods |
|
97 // |
|
98 // Method checking whether two formats are equal |
|
99 TBool RImageFrameUtil::FormatsEqual(const TFrameFormat& aFormat1, const TFrameFormat& aFormat2) |
|
100 { |
|
101 if ((aFormat1.FormatCode() == aFormat2.FormatCode()) && |
|
102 (aFormat1.ColourSpace() == aFormat2.ColourSpace()) ) |
|
103 { |
|
104 return ETrue; |
|
105 } |
|
106 else |
|
107 { |
|
108 return EFalse; |
|
109 } |
|
110 } |
|
111 |
|
112 // Method checking whether two layouts are equal |
|
113 TBool RImageFrameUtil::LayoutsEqual(const TFrameLayout& aLayout1, const TFrameLayout& aLayout2) |
|
114 { |
|
115 if ( aLayout1.Planes() != aLayout2.Planes()) |
|
116 { |
|
117 return EFalse; |
|
118 } |
|
119 else |
|
120 { |
|
121 for (TInt plane = 0; plane < aLayout1.Planes(); plane++) |
|
122 { |
|
123 if ((aLayout1.Start(plane) != aLayout2.Start(plane)) || |
|
124 (aLayout1.Length(plane) != aLayout2.Length(plane)) || |
|
125 (aLayout1.CurrentLength(plane) != aLayout2.CurrentLength(plane)) || |
|
126 (aLayout1.ScanLength(plane) != aLayout2.ScanLength(plane))) |
|
127 { |
|
128 return EFalse; |
|
129 } |
|
130 } |
|
131 return ETrue; |
|
132 } |
|
133 } |
|
134 |
|
135 // Method setting a buffer of specified size to a uniform value, either starting from start to end (forward) |
|
136 // or from end to front (backward) |
|
137 TBool RImageFrameUtil::CheckUniformAssignment(CImageFrame& aFrame, TInt aValue, |
|
138 TInt aBufferSize, TBool aForward) |
|
139 { |
|
140 TInt i = 0; |
|
141 TBool sucess = ETrue; |
|
142 const CImageFrame* frame1 = &aFrame; |
|
143 CImageFrame* frame = &aFrame; |
|
144 |
|
145 if (aForward) |
|
146 { |
|
147 // access forward |
|
148 for (i = 0; i < aBufferSize; i++ ) |
|
149 { |
|
150 frame->Data()[i] = aValue; |
|
151 if (frame1->Data()[i] != aValue) |
|
152 { |
|
153 sucess = EFail; |
|
154 break; |
|
155 } |
|
156 } |
|
157 } |
|
158 else |
|
159 { |
|
160 // access backward |
|
161 for (i = aBufferSize-1; i >= 0; i-- ) |
|
162 { |
|
163 frame->Data()[i] = aValue; |
|
164 if (frame1->Data()[i] != aValue) |
|
165 { |
|
166 sucess = EFail; |
|
167 break; |
|
168 } |
|
169 } |
|
170 } |
|
171 |
|
172 return sucess; |
|
173 } |
|
174 |
|
175 // Initialises the value of a Data unit to a specific value. |
|
176 void RImageFrameUtil::SetBlockToUniformValue(TDataUnit& aDataUnit, TInt aValue) |
|
177 { |
|
178 for (TInt i = 0; i < KJpgDCTBlockSize; i++) |
|
179 { |
|
180 aDataUnit.iCoeff[i] = aValue; |
|
181 } |
|
182 } |
|
183 |
|
184 // compares the values of two data units for the same index |
|
185 TBool RImageFrameUtil::CompareBlockValues(TDataUnit& aDataUnit1, |
|
186 TDataUnit& aDataUnit2) |
|
187 { |
|
188 TBool result = ETrue; |
|
189 for (TInt i=0; i < KJpgDCTBlockSize; i++) |
|
190 { |
|
191 if (aDataUnit1.iCoeff[i] != aDataUnit2.iCoeff[i]) |
|
192 { |
|
193 result = EFalse; |
|
194 break; |
|
195 } |
|
196 } |
|
197 return result; |
|
198 } |
|
199 |
|
200 // assignes specific values to a array of pointers to TDataUnit |
|
201 void RImageFrameUtil::InitPointerValuesL(TDataUnit* aDataUnit, RArray<const TDataUnit*> &aDataUnitPtr, TInt aBlocks) |
|
202 { |
|
203 aDataUnitPtr.Reset(); |
|
204 for (TInt i=0; i < aBlocks; i++) |
|
205 { |
|
206 aDataUnitPtr.AppendL(&aDataUnit[i]); |
|
207 } |
|
208 } |
|
209 |
|
210 TInt RImageFrameUtil::LayoutPlanes(const TFrameFormat& aFormat) |
|
211 { |
|
212 TInt32 code = aFormat.FormatCode().iUid; |
|
213 switch (code) |
|
214 { |
|
215 case KFormatYUVMonochromeUidValue: |
|
216 case KFormatYUV422InterleavedUidValue: |
|
217 { |
|
218 return 1; |
|
219 } |
|
220 |
|
221 case KFormatYUV420PlanarUidValue: |
|
222 case KFormatYUV420PlanarReversedUidValue: |
|
223 { |
|
224 return 3; |
|
225 } |
|
226 |
|
227 default: |
|
228 { |
|
229 return -1; |
|
230 } |
|
231 } |
|
232 } |
|
233 |
|
234 // method used to initialise a layout aon the basis of format code. |
|
235 // these are recommended example settings and used for demonstration only |
|
236 void RImageFrameUtil::InitLayoutValues(TFrameLayout& aLayout,TFrameFormat& aFormat, TSize& aSize, TInt& aRecommendedSize) |
|
237 { |
|
238 TInt bufferSize; |
|
239 |
|
240 switch (aFormat.FormatCode().iUid) |
|
241 { |
|
242 case KFormatYUVMonochromeUidValue: |
|
243 { |
|
244 bufferSize = aSize.iWidth * aSize.iHeight; |
|
245 aLayout.SetStart(0,0); |
|
246 aLayout.SetLength(0, bufferSize); |
|
247 aLayout.SetCurrentLength(0, bufferSize); |
|
248 aLayout.SetScanLength(0,aSize.iWidth); |
|
249 aRecommendedSize = bufferSize; |
|
250 break; |
|
251 } |
|
252 case KFormatYUV422InterleavedUidValue: |
|
253 { |
|
254 if (aSize.iWidth % 4) |
|
255 { |
|
256 aSize.iWidth = ((aSize.iWidth >> 2) + 1) << 2; |
|
257 } |
|
258 bufferSize = aSize.iWidth * aSize.iHeight * 2; |
|
259 aLayout.SetStart(0,0); |
|
260 aLayout.SetLength(0, bufferSize); |
|
261 aLayout.SetCurrentLength(0, bufferSize); |
|
262 aLayout.SetScanLength(0, aSize.iWidth * 2); |
|
263 aRecommendedSize = bufferSize; |
|
264 break; |
|
265 } |
|
266 case KFormatYUV420PlanarUidValue: |
|
267 case KFormatYUV420PlanarReversedUidValue: |
|
268 { |
|
269 bufferSize = aSize.iWidth * aSize.iHeight*3/2; |
|
270 TInt bufferSizeY = aSize.iWidth * aSize.iHeight; |
|
271 TInt bufferSizeUV = aSize.iWidth * aSize.iHeight/4; |
|
272 |
|
273 aLayout.SetStart(0,0); |
|
274 aLayout.SetStart(1,bufferSizeY); |
|
275 aLayout.SetStart(2,bufferSizeY+bufferSizeUV); |
|
276 aLayout.SetLength(0, bufferSizeY); |
|
277 aLayout.SetLength(1, bufferSizeUV); |
|
278 aLayout.SetLength(2, bufferSizeUV); |
|
279 aLayout.SetCurrentLength(0, bufferSizeY); |
|
280 aLayout.SetCurrentLength(1, bufferSizeUV); |
|
281 aLayout.SetCurrentLength(2, bufferSizeUV); |
|
282 aLayout.SetScanLength(0, aSize.iWidth); |
|
283 aLayout.SetScanLength(1, aSize.iWidth/2); |
|
284 aLayout.SetScanLength(2, aSize.iWidth/2); |
|
285 |
|
286 aRecommendedSize = bufferSize; |
|
287 break; |
|
288 } |
|
289 |
|
290 default: |
|
291 { |
|
292 |
|
293 } |
|
294 } |
|
295 } |
|
296 |
|
297 // |
|
298 // Base class - embeds the alloc functionaliity test as well |
|
299 // |
|
300 RImageFrameTest::RImageFrameTest(TBool aAllocTest): iAllocTest(aAllocTest) |
|
301 { |
|
302 } |
|
303 |
|
304 TVerdict RImageFrameTest::ProbeAllocTestsL() |
|
305 { |
|
306 // see if alloc fail stuff is enabled - ask if next alloc test will fail |
|
307 __UHEAP_SETFAIL(RHeap::EFailNext, 1); |
|
308 TAny *testAlloc = User::Alloc(1); |
|
309 TBool workingOk = (testAlloc == NULL); |
|
310 User::Free(testAlloc); |
|
311 __UHEAP_SETFAIL(RHeap::ENone, 0); |
|
312 |
|
313 if (!workingOk) |
|
314 { |
|
315 ERR_PRINTF1(_L("RImageFrameTest::ProbeAllocTestsL Alloc Testing does not work on this build")); |
|
316 return EInconclusive; |
|
317 } |
|
318 return EPass; |
|
319 } |
|
320 |
|
321 // Make sure that alloc tests are run only in debug mode |
|
322 TVerdict RImageFrameTest::DoTestStepL() |
|
323 { |
|
324 TVerdict verdict = EFail; |
|
325 |
|
326 if (iAllocTest) |
|
327 { |
|
328 |
|
329 TInt failCount = 1; |
|
330 TBool completed = EFalse; |
|
331 TBool badResult = EFalse; |
|
332 TBool reachedEnd = EFalse; // Note: declare outside loop to help with debugging |
|
333 TInt err = KErrNone; |
|
334 |
|
335 INFO_PRINTF2(_L("RImageFrameTest::DoTestStepL Alloc test %S starts"), &iTestStepName); |
|
336 |
|
337 // first make sure the alloc does not fail. |
|
338 TRAP(err, verdict = ProbeAllocTestsL()); |
|
339 |
|
340 if (verdict != EPass) |
|
341 { |
|
342 INFO_PRINTF2(_L("RImageFrameTest::DoTestStepL ProbeAllocTestsL returned %d error"), verdict); |
|
343 } |
|
344 |
|
345 if (verdict == EPass) |
|
346 { |
|
347 for (;;) |
|
348 { |
|
349 __UHEAP_SETFAIL(RHeap::EFailNext, failCount); |
|
350 __MM_HEAP_MARK; |
|
351 |
|
352 TRAP(err, verdict = DoTestL()); |
|
353 |
|
354 completed = EFalse; |
|
355 if (err == KErrNone) |
|
356 { |
|
357 TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test |
|
358 if (testAlloc == NULL) |
|
359 { |
|
360 reachedEnd = ETrue; |
|
361 failCount -= 1; |
|
362 } |
|
363 else |
|
364 { |
|
365 User::Free(testAlloc); |
|
366 } |
|
367 |
|
368 // see if valid result and break if wrong - might be premature result |
|
369 if (verdict != EPass) |
|
370 { |
|
371 badResult = ETrue; |
|
372 } |
|
373 |
|
374 completed = reachedEnd || badResult; |
|
375 } |
|
376 else if (err != KErrNoMemory) // bad error code |
|
377 { |
|
378 badResult = ETrue; |
|
379 completed = ETrue; |
|
380 } |
|
381 |
|
382 __MM_HEAP_MARKEND; |
|
383 // reset the heap |
|
384 __UHEAP_SETFAIL(RHeap::ENone, 0); |
|
385 |
|
386 if (err != KErrNoMemory) |
|
387 { |
|
388 ERR_PRINTF2(_L("RImageFrameTest::DoTestStepL Alloc Testing err %d"), err); |
|
389 User::Leave(err); |
|
390 } |
|
391 |
|
392 if (completed) |
|
393 { |
|
394 break; // exit loop |
|
395 } |
|
396 |
|
397 failCount += 1; |
|
398 } |
|
399 |
|
400 failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc. |
|
401 if (badResult) |
|
402 { |
|
403 verdict = EFail; |
|
404 } |
|
405 } |
|
406 } |
|
407 else |
|
408 { |
|
409 // just do the vanila tests; no alloc tests |
|
410 verdict = DoTestL(); |
|
411 } |
|
412 |
|
413 return verdict; |
|
414 } |
|
415 |
|
416 TVerdict RImageFrameTest::DoTestL() |
|
417 { |
|
418 ERR_PRINTF1(_L("RImageFrameTest::DoTestL This function should be everridden")); |
|
419 User::Leave(KErrAbort); |
|
420 return EFail; |
|
421 } |
|
422 |
|
423 void RImageFrameTest::InitLayoutValues(TFrameLayout& aLayout,TFrameFormat& aFormat, TSize& aSize, TInt& aRecommendedSize) |
|
424 { |
|
425 RImageFrameUtil::InitLayoutValues(aLayout, aFormat, aSize, aRecommendedSize); |
|
426 } |
|
427 |
|
428 TInt RImageFrameTest::LayoutPlanes(const TFrameFormat& aFormat) |
|
429 { |
|
430 return RImageFrameUtil::LayoutPlanes(aFormat); |
|
431 } |
|
432 |
|
433 // |
|
434 // RImageFrameDecDesc - testing creating and acessing for reading and writing a CImageFrame |
|
435 // |
|
436 RImageFrameDecDesc* RImageFrameDecDesc::NewL(TBool aAllocTest) |
|
437 { |
|
438 RImageFrameDecDesc* self = new (ELeave) RImageFrameDecDesc(aAllocTest); |
|
439 return self; |
|
440 } |
|
441 |
|
442 RImageFrameDecDesc::RImageFrameDecDesc(TBool aAllocTest):RImageFrameTest(aAllocTest) |
|
443 { |
|
444 |
|
445 if (!iAllocTest) |
|
446 { |
|
447 iTestStepName = _L("MM-ICL-IMGFRM-U-0001-HP"); |
|
448 } |
|
449 else |
|
450 { |
|
451 iTestStepName = _L("MM-ICL-IMGFRM-U-0101-HP"); |
|
452 } |
|
453 } |
|
454 |
|
455 TVerdict RImageFrameDecDesc::DoTestL() |
|
456 { |
|
457 TVerdict result = EPass; |
|
458 |
|
459 __MM_HEAP_MARK; |
|
460 |
|
461 // create a desc for the data |
|
462 HBufC8* buffer = HBufC8::NewMaxL(KImageSizeInBytes); |
|
463 CleanupStack::PushL(buffer); |
|
464 |
|
465 // create a new frame |
|
466 TPtr8 ptr = buffer->Des(); |
|
467 |
|
468 INFO_PRINTF4(_L("Test %S size %d max size %d"), &iTestStepName, ptr.Length(), ptr.MaxLength()); |
|
469 CImageFrame* frame = CImageFrame::NewL(ptr, ptr.MaxLength()); |
|
470 CleanupStack::PushL(frame); |
|
471 |
|
472 // verify frame type |
|
473 if (frame->IsChunk()) |
|
474 { |
|
475 INFO_PRINTF2(_L("Test %S The frame type is incorrect - expected descriptor"), &iTestStepName); |
|
476 result = EFail; |
|
477 } |
|
478 else |
|
479 { |
|
480 INFO_PRINTF2(_L("Test %S The frame type is correct - descriptor"), &iTestStepName); |
|
481 } |
|
482 |
|
483 // set the content of the frame to uniform value 1 |
|
484 // verify all cells have the same value |
|
485 // start to end |
|
486 TBool outcome = ETrue; |
|
487 outcome = RImageFrameUtil::CheckUniformAssignment(*frame, KUniformValue1, KImageSizeInBytes, ETrue); |
|
488 if (!outcome) |
|
489 { |
|
490 INFO_PRINTF2(_L("Test %S Uniform forward assignment failed"), &iTestStepName); |
|
491 result = EFail; |
|
492 } |
|
493 |
|
494 // set the content of the frame to uniform value 2 |
|
495 // verify all cells have the same value |
|
496 // end to front |
|
497 outcome = RImageFrameUtil::CheckUniformAssignment(*frame, KUniformValue2, KImageSizeInBytes, EFalse); |
|
498 if (!outcome) |
|
499 { |
|
500 INFO_PRINTF2(_L("Test %S Uniform backward assignment failed"), &iTestStepName); |
|
501 result = EFail; |
|
502 } |
|
503 |
|
504 // release all |
|
505 CleanupStack::PopAndDestroy(2,buffer); |
|
506 __MM_HEAP_MARKEND; |
|
507 |
|
508 return result; |
|
509 } |
|
510 |
|
511 // |
|
512 // RImageFrameDecChunk - testing creating and acessing for reading and writing a CImageFrame |
|
513 // |
|
514 RImageFrameDecChunk* RImageFrameDecChunk::NewL(TBool aAllocTest) |
|
515 { |
|
516 RImageFrameDecChunk* self = new (ELeave) RImageFrameDecChunk(aAllocTest); |
|
517 return self; |
|
518 } |
|
519 |
|
520 RImageFrameDecChunk::RImageFrameDecChunk(TBool aAllocTest):RImageFrameTest(aAllocTest) |
|
521 { |
|
522 if (!iAllocTest) |
|
523 { |
|
524 iTestStepName = _L("MM-ICL-IMGFRM-U-0002-HP"); |
|
525 } |
|
526 else |
|
527 { |
|
528 iTestStepName = _L("MM-ICL-IMGFRM-U-0102-HP"); |
|
529 } |
|
530 } |
|
531 |
|
532 TVerdict RImageFrameDecChunk::DoTestL() |
|
533 { |
|
534 TVerdict result = EPass; |
|
535 __MM_HEAP_MARK; |
|
536 // we create a RChunk |
|
537 RChunk chunk; |
|
538 TInt res = chunk.CreateGlobal(KGlobalChunkName, KImageSizeInBytes, KImageSizeInBytes, EOwnerProcess); |
|
539 User::LeaveIfError(res); |
|
540 CleanupClosePushL(chunk); |
|
541 |
|
542 // check chunk information |
|
543 INFO_PRINTF4(_L("Test %S size %d max size %d"), &iTestStepName, chunk.Size(), chunk.MaxSize()); |
|
544 INFO_PRINTF4(_L("Test %S chunk is readable %d is writable %d"), &iTestStepName, chunk.IsReadable(), chunk.IsWritable()); |
|
545 |
|
546 TFullName t; |
|
547 t = chunk.FullName(); |
|
548 if (t.Compare(KGlobalChunkName)==0) |
|
549 { |
|
550 INFO_PRINTF3(_L("Test %S chunk name correct %S"), &iTestStepName, &t); |
|
551 } |
|
552 else |
|
553 { |
|
554 INFO_PRINTF4(_L("Test %S chunk name unexpected %S exp %S"), &iTestStepName, &t, KGlobalChunkName); |
|
555 } |
|
556 |
|
557 chunk.SetRestrictions(KRChunkRestrictionFlags); |
|
558 |
|
559 // create a new frame using chunk |
|
560 CImageFrame* frame = CImageFrame::NewL(&chunk, KImageSizeInBytes, KRChunkDataOffset); |
|
561 CleanupStack::PushL(frame); |
|
562 |
|
563 // verify frame type and retrieve chunk and its name |
|
564 if (frame->IsChunk()) |
|
565 { |
|
566 RChunk& chunk1 = frame->DataChunk(); |
|
567 |
|
568 CImageFrame* frame1 = frame; |
|
569 const RChunk& chunk1c = frame1->DataChunk(); |
|
570 |
|
571 t = chunk1.FullName(); |
|
572 if (t.Compare(KGlobalChunkName)==0) |
|
573 { |
|
574 INFO_PRINTF2(_L("Test %S chunk obtained and name verified"), &iTestStepName); |
|
575 } |
|
576 |
|
577 t = chunk1c.FullName(); |
|
578 if (t.Compare(KGlobalChunkName)==0) |
|
579 { |
|
580 INFO_PRINTF2(_L("Test %S const chunk obtained and name verified"), &iTestStepName); |
|
581 } |
|
582 } |
|
583 else |
|
584 { |
|
585 INFO_PRINTF2(_L("Test %S The frame type is incorrect- expected chunk"),&iTestStepName); |
|
586 result = EFail; |
|
587 } |
|
588 |
|
589 // get the offset and compare with the set value |
|
590 if (frame->DataOffset()!=KRChunkDataOffset) |
|
591 { |
|
592 result = EFail; |
|
593 INFO_PRINTF4(_L("Test %S CImageFrame offset is wrong expected %d actual %d"), &iTestStepName, KRChunkDataOffset,frame->DataOffset() ); |
|
594 } |
|
595 |
|
596 // set the content of the frame to uniform value 1 |
|
597 // verify all cells have the same value |
|
598 // start to end |
|
599 TBool outcome = ETrue; |
|
600 outcome = RImageFrameUtil::CheckUniformAssignment(*frame, KUniformValue1, KImageSizeInBytes, ETrue); |
|
601 if (!outcome) |
|
602 { |
|
603 INFO_PRINTF2(_L("Test %S Uniform forward assignment failed"), &iTestStepName); |
|
604 result = EFail; |
|
605 } |
|
606 |
|
607 // set the content of the frame to uniform value 2 |
|
608 // verify all cells have the same value |
|
609 // end to front |
|
610 outcome = RImageFrameUtil::CheckUniformAssignment(*frame, KUniformValue2, KImageSizeInBytes, EFalse); |
|
611 if (!outcome) |
|
612 { |
|
613 INFO_PRINTF2(_L("Test %S Uniform backward assignment failed"), &iTestStepName); |
|
614 result = EFail; |
|
615 } |
|
616 |
|
617 CleanupStack::PopAndDestroy(2, &chunk); |
|
618 __MM_HEAP_MARKEND; |
|
619 return result; |
|
620 } |
|
621 |
|
622 // |
|
623 // RImageFrameEncDesc - testing creating and acessing the functionality of a CImageFrame |
|
624 // |
|
625 RImageFrameEncDesc* RImageFrameEncDesc::NewL(TBool aAllocTest) |
|
626 { |
|
627 RImageFrameEncDesc* self = new (ELeave) RImageFrameEncDesc(aAllocTest); |
|
628 return self; |
|
629 } |
|
630 |
|
631 RImageFrameEncDesc::RImageFrameEncDesc(TBool aAllocTest) : RImageFrameTest(aAllocTest) |
|
632 { |
|
633 |
|
634 if (!iAllocTest) |
|
635 { |
|
636 iTestStepName = _L("MM-ICL-IMGFRM-U-0003-HP"); |
|
637 } |
|
638 else |
|
639 { |
|
640 iTestStepName = _L("MM-ICL-IMGFRM-U-0103-HP"); |
|
641 } |
|
642 } |
|
643 |
|
644 TVerdict RImageFrameEncDesc::DoTestL() |
|
645 { |
|
646 TVerdict result = EPass; |
|
647 |
|
648 // create a new frame |
|
649 TInt index = 1; |
|
650 TSize frameSize(KFrameSizeData[index][0], KFrameSizeData[index][1]); |
|
651 TInt frameBufferSize = frameSize.iWidth * frameSize.iHeight; |
|
652 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCrMono]); |
|
653 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
654 |
|
655 __MM_HEAP_MARK; |
|
656 // Create a desc |
|
657 HBufC8* buffer = HBufC8::NewMaxL(frameBufferSize); |
|
658 CleanupStack::PushL(buffer); |
|
659 TPtr8 ptr = buffer->Des(); |
|
660 CImageFrame* frame = CImageFrame::NewL(ptr, frameBufferSize, frameSize, frameFormat,frameLayout); |
|
661 CleanupStack::PushL(frame); |
|
662 |
|
663 // verify frame type |
|
664 if (frame->IsChunk()) |
|
665 { |
|
666 result = EFail; |
|
667 INFO_PRINTF2(_L("Test %S CImageFrame wrong type"), &iTestStepName); |
|
668 } |
|
669 |
|
670 // size |
|
671 frame->SetFrameSizeInPixels(frameSize); |
|
672 |
|
673 // set values again |
|
674 frame->SetFrameFormatL(frameFormat); |
|
675 |
|
676 frame->SetFrameLayoutL(frameLayout); |
|
677 |
|
678 TSize frameSize1 = frame->FrameSizeInPixels(); |
|
679 if (frameSize != frameSize1) |
|
680 { |
|
681 result = EFail; |
|
682 INFO_PRINTF6(_L("Test %S different sizes test set %d %d got %d %d"), &iTestStepName, |
|
683 frameSize.iWidth, frameSize.iHeight, frameSize1.iWidth, frameSize1.iHeight ); |
|
684 } |
|
685 const TFrameFormat& frameFormat1 = static_cast<const TFrameFormat&>(frame->FrameFormat()); |
|
686 |
|
687 if (!RImageFrameUtil::FormatsEqual(frameFormat, frameFormat1)) |
|
688 { |
|
689 result = EFail; |
|
690 INFO_PRINTF4(_L("Test %S different formats test set %0x got %0x"), &iTestStepName, |
|
691 frameFormat.FormatCode().iUid, frameFormat1.FormatCode().iUid ); |
|
692 } |
|
693 |
|
694 const TFrameLayout& frameLayout1 = static_cast<const TFrameLayout&>(frame->FrameLayout()); |
|
695 |
|
696 if (!(RImageFrameUtil::LayoutsEqual(frameLayout, frameLayout1))) |
|
697 { |
|
698 result = EFail; |
|
699 INFO_PRINTF2(_L("Test %S different layouts "), &iTestStepName ); |
|
700 } |
|
701 |
|
702 // release all |
|
703 CleanupStack::PopAndDestroy(2, buffer); |
|
704 __MM_HEAP_MARKEND; |
|
705 |
|
706 return result; |
|
707 } |
|
708 |
|
709 // |
|
710 // RImageFrameEncChunk - testing creating and acessing the functionality of a CImageFrame |
|
711 // |
|
712 RImageFrameEncChunk* RImageFrameEncChunk::NewL(TBool aAllocTest) |
|
713 { |
|
714 RImageFrameEncChunk* self = new (ELeave) RImageFrameEncChunk(aAllocTest); |
|
715 return self; |
|
716 } |
|
717 |
|
718 RImageFrameEncChunk::RImageFrameEncChunk(TBool aAllocTest) : RImageFrameTest(aAllocTest) |
|
719 { |
|
720 |
|
721 if (!iAllocTest) |
|
722 { |
|
723 iTestStepName = _L("MM-ICL-IMGFRM-U-0004-HP"); |
|
724 } |
|
725 else |
|
726 { |
|
727 iTestStepName = _L("MM-ICL-IMGFRM-U-0104-HP"); |
|
728 } |
|
729 } |
|
730 |
|
731 TVerdict RImageFrameEncChunk::DoTestL() |
|
732 { |
|
733 TVerdict result = EPass; |
|
734 // create a new frame |
|
735 TInt index = 1; |
|
736 TSize frameSize(KFrameSizeData[index][0], KFrameSizeData[index][1]); |
|
737 TInt frameBufferSize = frameSize.iWidth * frameSize.iHeight; |
|
738 |
|
739 __MM_HEAP_MARK; |
|
740 // create a RChunk |
|
741 RChunk chunk; |
|
742 TInt res = chunk.CreateGlobal(KGlobalChunkName, frameBufferSize, frameBufferSize, EOwnerProcess); |
|
743 User::LeaveIfError(res); |
|
744 |
|
745 CleanupClosePushL(chunk); |
|
746 |
|
747 // chunk information |
|
748 INFO_PRINTF4(_L("Test %S %d %d"), &iTestStepName, chunk.Size(), chunk.MaxSize()); |
|
749 INFO_PRINTF4(_L("Test %S RChunk:: is readable %d is writable %d"), &iTestStepName, chunk.IsReadable(), chunk.IsWritable()); |
|
750 |
|
751 TFullName t = chunk.FullName(); |
|
752 if (t.Compare(KGlobalChunkName)==0) |
|
753 { |
|
754 INFO_PRINTF3(_L("Test %S name present %S"), &iTestStepName, &t); |
|
755 } |
|
756 |
|
757 chunk.SetRestrictions(KRChunkRestrictionFlags); |
|
758 |
|
759 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCrMono]); |
|
760 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
761 |
|
762 CImageFrame* frame = CImageFrame::NewL(&chunk, frameBufferSize, KRChunkDataOffset, frameSize, frameFormat, frameLayout); |
|
763 CleanupStack::PushL(frame); |
|
764 |
|
765 // get the type |
|
766 if (!frame->IsChunk()) |
|
767 { |
|
768 result = EFail; |
|
769 INFO_PRINTF2(_L("Test %S CImageFrame wrong type"), &iTestStepName); |
|
770 } |
|
771 // get the offset and compare with the set value |
|
772 if (frame->DataOffset()!=KRChunkDataOffset) |
|
773 { |
|
774 result = EFail; |
|
775 INFO_PRINTF4(_L("Test %S CImageFrame offset is wrong expected %d actual %d"), &iTestStepName, KRChunkDataOffset,frame->DataOffset() ); |
|
776 } |
|
777 |
|
778 // set values again |
|
779 frame->SetFrameFormatL(frameFormat); |
|
780 |
|
781 frame->SetFrameSizeInPixels(frameSize); |
|
782 |
|
783 frame->SetFrameLayoutL(frameLayout); |
|
784 |
|
785 // size |
|
786 TSize frameSize1 = frame->FrameSizeInPixels(); |
|
787 if ( frameSize != frameSize1) |
|
788 { |
|
789 result = EFail; |
|
790 INFO_PRINTF6(_L("Test %S different sizes test set %d %d got %d %d"), &iTestStepName, |
|
791 frameSize.iWidth, frameSize.iHeight,frameSize1.iWidth, frameSize1.iHeight ); |
|
792 } |
|
793 |
|
794 const TFrameFormat& frameFormat1 = static_cast<const TFrameFormat&>(frame->FrameFormat()); |
|
795 if (!RImageFrameUtil::FormatsEqual(frameFormat, frameFormat1)) |
|
796 { |
|
797 result = EFail; |
|
798 INFO_PRINTF4(_L("Test %S different formats test set %0x got %0x"), &iTestStepName, |
|
799 frameFormat.FormatCode().iUid, frameFormat1.FormatCode().iUid ); |
|
800 } |
|
801 |
|
802 const TFrameLayout& frameLayout1 = static_cast<const TFrameLayout&>(frame->FrameLayout()); |
|
803 |
|
804 if (!(RImageFrameUtil::LayoutsEqual(frameLayout, frameLayout1))) |
|
805 { |
|
806 result = EFail; |
|
807 INFO_PRINTF2(_L("Test %S different layouts "), &iTestStepName ); |
|
808 } |
|
809 |
|
810 CleanupStack::PopAndDestroy(2, &chunk); |
|
811 __MM_HEAP_MARKEND; |
|
812 return result; |
|
813 } |
|
814 |
|
815 // |
|
816 // RFormatTest - testing functionality of TFrameFormat class |
|
817 // |
|
818 RFormatTest* RFormatTest::NewL(TBool aAllocTest) |
|
819 { |
|
820 RFormatTest* self = new (ELeave) RFormatTest(aAllocTest); |
|
821 return self; |
|
822 } |
|
823 |
|
824 RFormatTest::RFormatTest(TBool /*aAllocTest*/) |
|
825 { |
|
826 |
|
827 iTestStepName = _L("MM-ICL-IMGFRM-U-0005-HP"); |
|
828 |
|
829 } |
|
830 |
|
831 TVerdict RFormatTest::DoTestStepL() |
|
832 { |
|
833 TVerdict result = EPass; |
|
834 TInt elements = sizeof(KFormatLists)/(3 * sizeof(TUid)); |
|
835 |
|
836 __MM_HEAP_MARK; |
|
837 // check the types |
|
838 for (TInt i = 0; i < elements; i++ ) |
|
839 { |
|
840 TFrameFormat format(KFormatLists[i][0]); |
|
841 if ((format.FormatCode()!=KFormatLists[i][0]) || |
|
842 (format.Sampling()!=KFormatLists[i][2]) || |
|
843 (format.ColourSpace()!=KFormatLists[i][1])) |
|
844 { |
|
845 result = EFail; |
|
846 } |
|
847 } |
|
848 |
|
849 // check duplication |
|
850 TFrameFormat format(KFormatLists[0][0]); |
|
851 TFrameFormat* format1 = static_cast<TFrameFormat*>(format.DuplicateL()); |
|
852 CleanupStack::PushL(format1); |
|
853 |
|
854 // check equivalence |
|
855 if (((format1->FormatCode()!=KFormatLists[0][0]) || |
|
856 (format1->Sampling()!=KFormatLists[0][2]) || |
|
857 (format1->ColourSpace()!=KFormatLists[0][1]))) |
|
858 { |
|
859 result = EFail; |
|
860 } |
|
861 // |
|
862 format1->SetColourSpace(KUidColourSpaceYUV); |
|
863 if (KUidColourSpaceYUV != format1->ColourSpace()) |
|
864 { |
|
865 result = EFail; |
|
866 } |
|
867 CleanupStack::PopAndDestroy(1); |
|
868 __MM_HEAP_MARKEND; |
|
869 |
|
870 return result; |
|
871 } |
|
872 |
|
873 /**********************************************/ |
|
874 // |
|
875 // RYuvMonoProcDesc - testing creating and acessing for reading and writing a Mono image processor |
|
876 // |
|
877 RYuvMonoProcDesc* RYuvMonoProcDesc::NewL(TBool aAllocTest) |
|
878 { |
|
879 RYuvMonoProcDesc* self = new (ELeave) RYuvMonoProcDesc(aAllocTest); |
|
880 return self; |
|
881 } |
|
882 |
|
883 RYuvMonoProcDesc::RYuvMonoProcDesc(TBool aAllocTest) : RImageFrameTest(aAllocTest) |
|
884 { |
|
885 if (!iAllocTest) |
|
886 { |
|
887 iTestStepName = _L("MM-ICL-IMGFRM-U-0010-HP"); |
|
888 } |
|
889 else |
|
890 { |
|
891 iTestStepName = _L("MM-ICL-IMGFRM-U-0110-HP"); |
|
892 } |
|
893 } |
|
894 |
|
895 TVerdict RYuvMonoProcDesc::DoTestL() |
|
896 { |
|
897 TVerdict result = EPass; |
|
898 |
|
899 __MM_HEAP_MARK; |
|
900 |
|
901 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCrMono]); |
|
902 TSize frameSize = TSize(KFrameTestSizeData[EYCbCrMonoSize][0],KFrameTestSizeData[EYCbCrMonoSize][1]); |
|
903 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
904 |
|
905 TInt bufferSize; |
|
906 InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
907 |
|
908 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
909 |
|
910 // create a desc |
|
911 HBufC8* buffer = HBufC8::NewMaxL(bufferSize); |
|
912 CleanupStack::PushL(buffer); |
|
913 |
|
914 // create a new frame |
|
915 TPtr8 ptr = buffer->Des(); |
|
916 CImageFrame* frame = CImageFrame::NewL(ptr, bufferSize, frameSize, frameFormat,frameLayout); |
|
917 CleanupStack::PushL(frame); |
|
918 |
|
919 // verify the type |
|
920 if (frame->IsChunk()) |
|
921 { |
|
922 result = EFail; |
|
923 INFO_PRINTF2(_L("Test %S image frame wrong type "), &iTestStepName); |
|
924 } |
|
925 |
|
926 // create processor |
|
927 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
928 CleanupStack::PushL(processor); |
|
929 CImageFrame& frame1 = processor->ImageFrame(); |
|
930 // create a TDataUnit |
|
931 const TInt blocks = 1; |
|
932 TDataUnit testUnit[blocks]; |
|
933 TDataUnit* testUnit2[blocks]; |
|
934 RArray<const TDataUnit*> testUnitPtr; |
|
935 CleanupClosePushL(testUnitPtr); |
|
936 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
937 |
|
938 TInt j=0; |
|
939 TPoint startPos; |
|
940 TPoint endPos; |
|
941 |
|
942 while (processor->MoreData()) |
|
943 { |
|
944 // init test unit |
|
945 j++; |
|
946 RImageFrameUtil::SetBlockToUniformValue(testUnit[0], ((j*10)&0xFF)); |
|
947 |
|
948 processor->GetCurrentPosition(startPos); |
|
949 processor->WriteBlockL(testUnitPtr); |
|
950 |
|
951 processor->SetCurrentPosition(startPos); |
|
952 testUnit2[0] = processor->ReadBlockL(); |
|
953 |
|
954 if (!RImageFrameUtil::CompareBlockValues(testUnit[0], (*testUnit2)[0])) |
|
955 { |
|
956 INFO_PRINTF2(_L("Test %S Block values different"), &iTestStepName); |
|
957 result = EFail; |
|
958 } |
|
959 |
|
960 processor->GetCurrentPosition(endPos); |
|
961 INFO_PRINTF6(_L("Test %S start position %d %d next %d %d"), &iTestStepName, |
|
962 startPos.iX, startPos.iY, endPos.iX, endPos.iY ); |
|
963 } |
|
964 |
|
965 // release all |
|
966 CleanupStack::PopAndDestroy(4, buffer); |
|
967 |
|
968 __MM_HEAP_MARKEND; |
|
969 return result; |
|
970 } |
|
971 |
|
972 // |
|
973 // RYuvMonoProcChunk - testing creating and acessing for reading and writing a Mono image processor |
|
974 // |
|
975 RYuvMonoProcChunk* RYuvMonoProcChunk::NewL(TBool aAllocTest) |
|
976 { |
|
977 RYuvMonoProcChunk* self = new (ELeave) RYuvMonoProcChunk(aAllocTest); |
|
978 return self; |
|
979 } |
|
980 RYuvMonoProcChunk::RYuvMonoProcChunk(TBool aAllocTest) : RImageFrameTest(aAllocTest) |
|
981 { |
|
982 if (!iAllocTest) |
|
983 { |
|
984 iTestStepName = _L("MM-ICL-IMGFRM-U-0011-HP"); |
|
985 } |
|
986 else |
|
987 { |
|
988 iTestStepName = _L("MM-ICL-IMGFRM-U-0111-HP"); |
|
989 } |
|
990 } |
|
991 |
|
992 TVerdict RYuvMonoProcChunk::DoTestL() |
|
993 { |
|
994 TVerdict result = EPass; |
|
995 __MM_HEAP_MARK; |
|
996 |
|
997 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCrMono]); |
|
998 TSize frameSize = TSize(KFrameTestSizeData[EYCbCrMonoSize][0],KFrameTestSizeData[EYCbCrMonoSize][1]); |
|
999 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
1000 |
|
1001 TInt bufferSize; |
|
1002 InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
1003 |
|
1004 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1005 |
|
1006 RChunk chunk; |
|
1007 TInt res = chunk.CreateGlobal(KGlobalChunkName, bufferSize, bufferSize, EOwnerProcess); |
|
1008 User::LeaveIfError(res); |
|
1009 |
|
1010 CleanupClosePushL(chunk); |
|
1011 // create a new frame |
|
1012 |
|
1013 CImageFrame* frame = CImageFrame::NewL(&chunk, bufferSize,0, frameSize, frameFormat, frameLayout); |
|
1014 CleanupStack::PushL(frame); |
|
1015 |
|
1016 // get the type |
|
1017 if (!frame->IsChunk()) |
|
1018 { |
|
1019 result = EFail; |
|
1020 INFO_PRINTF2(_L("Test %S image frame wrong type "), &iTestStepName); |
|
1021 } |
|
1022 |
|
1023 // create processor |
|
1024 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
1025 CleanupStack::PushL(processor); |
|
1026 |
|
1027 const TInt blocks = 1; |
|
1028 TDataUnit testUnit[blocks]; |
|
1029 TDataUnit* testUnit2[blocks]; |
|
1030 RArray<const TDataUnit*> testUnitPtr; |
|
1031 CleanupClosePushL(testUnitPtr); |
|
1032 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1033 |
|
1034 TInt j=0; |
|
1035 TPoint startPos; |
|
1036 TPoint endPos; |
|
1037 res = KErrNone; |
|
1038 |
|
1039 while (processor->MoreData()) |
|
1040 { |
|
1041 // init test unit |
|
1042 j++; |
|
1043 RImageFrameUtil::SetBlockToUniformValue(testUnit[0], ((j*10)&0xFF)); |
|
1044 |
|
1045 processor->GetCurrentPosition(startPos); |
|
1046 processor->WriteBlockL(testUnitPtr); |
|
1047 |
|
1048 processor->SetCurrentPosition(startPos); |
|
1049 testUnit2[0] = processor->ReadBlockL(); |
|
1050 |
|
1051 if (!RImageFrameUtil::CompareBlockValues(testUnit[0], (*testUnit2)[0])) |
|
1052 { |
|
1053 INFO_PRINTF2(_L("Test %S Block values different"), &iTestStepName); |
|
1054 result = EFail; |
|
1055 } |
|
1056 |
|
1057 processor->GetCurrentPosition(endPos); |
|
1058 INFO_PRINTF6(_L("Test %S start position %d %d next %d %d"), &iTestStepName, |
|
1059 startPos.iX, startPos.iY, endPos.iX, endPos.iY ); |
|
1060 } |
|
1061 |
|
1062 // release all |
|
1063 CleanupStack::PopAndDestroy(4, &chunk); |
|
1064 __MM_HEAP_MARKEND; |
|
1065 return result; |
|
1066 } |
|
1067 |
|
1068 // |
|
1069 // RYuv422IntlProcDesc - testing creating and acessing for reading and writing a YCbCr422 image processor |
|
1070 // |
|
1071 RYuv422IntlProcDesc* RYuv422IntlProcDesc::NewL(TBool aAllocTest) |
|
1072 { |
|
1073 RYuv422IntlProcDesc* self = new (ELeave) RYuv422IntlProcDesc(aAllocTest); |
|
1074 return self; |
|
1075 } |
|
1076 |
|
1077 RYuv422IntlProcDesc::RYuv422IntlProcDesc(TBool aAllocTest) : RImageFrameTest(aAllocTest) |
|
1078 { |
|
1079 |
|
1080 if (!iAllocTest) |
|
1081 { |
|
1082 iTestStepName = _L("MM-ICL-IMGFRM-U-0012-HP"); |
|
1083 } |
|
1084 else |
|
1085 { |
|
1086 iTestStepName = _L("MM-ICL-IMGFRM-U-0112-HP"); |
|
1087 } |
|
1088 } |
|
1089 |
|
1090 TVerdict RYuv422IntlProcDesc::DoTestL() |
|
1091 { |
|
1092 TVerdict result = EPass; |
|
1093 __MM_HEAP_MARK; |
|
1094 |
|
1095 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCr422Int]); |
|
1096 TSize frameSize = TSize(KFrameTestSizeData[EYCbCr422IntSize][0],KFrameTestSizeData[EYCbCr422IntSize][1]); |
|
1097 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
1098 |
|
1099 TInt bufferSize; |
|
1100 InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
1101 |
|
1102 |
|
1103 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1104 |
|
1105 // we create a desc |
|
1106 HBufC8* buffer = HBufC8::NewMaxL(bufferSize); |
|
1107 CleanupStack::PushL(buffer); |
|
1108 // create a new frame |
|
1109 |
|
1110 TPtr8 ptr = buffer->Des(); |
|
1111 CImageFrame* frame = CImageFrame::NewL(ptr, bufferSize,frameSize, frameFormat, frameLayout); |
|
1112 CleanupStack::PushL(frame); |
|
1113 |
|
1114 // get the type |
|
1115 if (frame->IsChunk()) |
|
1116 { |
|
1117 result = EFail; |
|
1118 INFO_PRINTF2(_L("Test %S image frame wrong type "), &iTestStepName); |
|
1119 } |
|
1120 |
|
1121 const TInt blocks = 4; |
|
1122 // create processor |
|
1123 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
1124 CleanupStack::PushL(processor); |
|
1125 |
|
1126 // create a TDataUnit |
|
1127 TDataUnit testUnit[blocks]; |
|
1128 TDataUnit* testUnit2[blocks]; |
|
1129 RArray<const TDataUnit*> testUnitPtr; |
|
1130 CleanupClosePushL(testUnitPtr); |
|
1131 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1132 |
|
1133 TInt j=0; |
|
1134 TPoint startPos; |
|
1135 TPoint endPos; |
|
1136 |
|
1137 while (processor->MoreData()) |
|
1138 { |
|
1139 // init test unit |
|
1140 j++; |
|
1141 for (TInt m=0; m < blocks; m++) |
|
1142 { |
|
1143 RImageFrameUtil::SetBlockToUniformValue(testUnit[m], (j*10+m)&0xFF); |
|
1144 } |
|
1145 |
|
1146 processor->GetCurrentPosition(startPos); |
|
1147 |
|
1148 processor->WriteBlockL(testUnitPtr); |
|
1149 |
|
1150 processor->SetCurrentPosition(startPos); |
|
1151 |
|
1152 testUnit2[0] = processor->ReadBlockL(); |
|
1153 |
|
1154 for (TInt m = 0; m < blocks; m++) |
|
1155 { |
|
1156 TInt g = KExpectedBlocksValuesIndx[EYCbCr422IntSize][j-1]; |
|
1157 TInt f = KExpectedValuesIndx[g][m]; |
|
1158 if (!RImageFrameUtil::CompareBlockValues(testUnit[f], (*testUnit2)[m])) |
|
1159 { |
|
1160 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, m); |
|
1161 result = EFail; |
|
1162 } |
|
1163 } |
|
1164 |
|
1165 processor->GetCurrentPosition(endPos); |
|
1166 INFO_PRINTF6(_L("Test %S start position %d %d next %d %d"), &iTestStepName, |
|
1167 startPos.iX, startPos.iY, endPos.iX, endPos.iY ); |
|
1168 } |
|
1169 |
|
1170 // release all |
|
1171 CleanupStack::PopAndDestroy(4, buffer); |
|
1172 __MM_HEAP_MARKEND; |
|
1173 return result; |
|
1174 } |
|
1175 |
|
1176 // |
|
1177 // RYuv422IntlProcChunk - testing creating and acessing for reading and writing a YCbCr422 image processor |
|
1178 // |
|
1179 RYuv422IntlProcChunk* RYuv422IntlProcChunk::NewL(TBool aAllocTest) |
|
1180 { |
|
1181 RYuv422IntlProcChunk* self = new (ELeave) RYuv422IntlProcChunk(aAllocTest); |
|
1182 return self; |
|
1183 } |
|
1184 RYuv422IntlProcChunk::RYuv422IntlProcChunk(TBool aAllocTest) : RImageFrameTest(aAllocTest) |
|
1185 { |
|
1186 if (!iAllocTest) |
|
1187 { |
|
1188 iTestStepName = _L("MM-ICL-IMGFRM-U-0013-HP"); |
|
1189 } |
|
1190 else |
|
1191 { |
|
1192 iTestStepName = _L("MM-ICL-IMGFRM-U-0113-HP"); |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 TVerdict RYuv422IntlProcChunk::DoTestL() |
|
1197 { |
|
1198 TVerdict result = EPass; |
|
1199 __MM_HEAP_MARK; |
|
1200 |
|
1201 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCr422Int]); |
|
1202 TSize frameSize = TSize(KFrameTestSizeData[EYCbCr422IntSize][0],KFrameTestSizeData[EYCbCr422IntSize][1]); |
|
1203 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
1204 |
|
1205 TInt bufferSize; |
|
1206 InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
1207 |
|
1208 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1209 |
|
1210 RChunk chunk; |
|
1211 TInt res = chunk.CreateGlobal(KGlobalChunkName, bufferSize, bufferSize, EOwnerProcess); |
|
1212 |
|
1213 User::LeaveIfError(res); |
|
1214 |
|
1215 CleanupClosePushL(chunk); |
|
1216 |
|
1217 // create a new frame |
|
1218 CImageFrame* frame = CImageFrame::NewL(&chunk, bufferSize, 0, frameSize, frameFormat, frameLayout); |
|
1219 CleanupStack::PushL(frame); |
|
1220 |
|
1221 // get the type |
|
1222 if (!frame->IsChunk() ) |
|
1223 { |
|
1224 result = EFail; |
|
1225 INFO_PRINTF2(_L("Test %S image frame wrong type "), &iTestStepName); |
|
1226 } |
|
1227 |
|
1228 const TInt blocks = 4; |
|
1229 // create processor |
|
1230 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
1231 CleanupStack::PushL(processor); |
|
1232 |
|
1233 // create a TDataUnit |
|
1234 TDataUnit testUnit[blocks]; |
|
1235 TDataUnit* testUnit2[blocks]; |
|
1236 RArray<const TDataUnit*> testUnitPtr; |
|
1237 CleanupClosePushL(testUnitPtr); |
|
1238 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1239 |
|
1240 TInt j=0; |
|
1241 TPoint startPos; |
|
1242 TPoint endPos; |
|
1243 |
|
1244 while (processor->MoreData()) |
|
1245 { |
|
1246 j++; |
|
1247 for (TInt m=0; m < blocks; m++) |
|
1248 { |
|
1249 RImageFrameUtil::SetBlockToUniformValue(testUnit[m], ((j*10+m)&0xFF)); |
|
1250 } |
|
1251 // init test unit |
|
1252 processor->GetCurrentPosition(startPos); |
|
1253 |
|
1254 processor->WriteBlockL(testUnitPtr); |
|
1255 |
|
1256 processor->SetCurrentPosition(startPos); |
|
1257 |
|
1258 testUnit2[0] = processor->ReadBlockL(); |
|
1259 |
|
1260 for (TInt m = 0; m < blocks; m++) |
|
1261 { |
|
1262 TInt g = KExpectedBlocksValuesIndx[EYCbCr422IntSize][j-1]; |
|
1263 TInt f = KExpectedValuesIndx[g][m]; |
|
1264 |
|
1265 if (!RImageFrameUtil::CompareBlockValues(testUnit[f], (*testUnit2)[m])) |
|
1266 { |
|
1267 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, m); |
|
1268 result = EFail; |
|
1269 } |
|
1270 } |
|
1271 |
|
1272 processor->GetCurrentPosition(endPos); |
|
1273 INFO_PRINTF6(_L("Test %S start position %d %d next %d %d"), &iTestStepName, |
|
1274 startPos.iX, startPos.iY, endPos.iX, endPos.iY ); |
|
1275 } |
|
1276 |
|
1277 |
|
1278 // release all |
|
1279 CleanupStack::PopAndDestroy(4, &chunk); |
|
1280 __MM_HEAP_MARKEND; |
|
1281 return result; |
|
1282 } |
|
1283 |
|
1284 // |
|
1285 // RYuv420PlnProcDesc - testing creating and acessing for reading and writing a YCbCr420Planar Reversed image processor |
|
1286 // |
|
1287 RYuv420PlnProcDesc* RYuv420PlnProcDesc::NewL(TBool aAllocTest) |
|
1288 { |
|
1289 RYuv420PlnProcDesc* self = new (ELeave) RYuv420PlnProcDesc(aAllocTest); |
|
1290 return self; |
|
1291 } |
|
1292 |
|
1293 RYuv420PlnProcDesc::RYuv420PlnProcDesc(TBool aAllocTest) : RImageFrameTest(aAllocTest) |
|
1294 { |
|
1295 |
|
1296 if (!iAllocTest) |
|
1297 { |
|
1298 iTestStepName = _L("MM-ICL-IMGFRM-U-0014-HP"); |
|
1299 } |
|
1300 else |
|
1301 { |
|
1302 iTestStepName = _L("MM-ICL-IMGFRM-U-0114-HP"); |
|
1303 } |
|
1304 } |
|
1305 |
|
1306 TVerdict RYuv420PlnProcDesc::DoTestL() |
|
1307 { |
|
1308 TVerdict result = EPass; |
|
1309 __MM_HEAP_MARK; |
|
1310 |
|
1311 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCr420PlaRev]); |
|
1312 TSize frameSize = TSize(KFrameTestSizeData[EYCbCr420PlaSize][0],KFrameTestSizeData[EYCbCr420PlaSize][1]); |
|
1313 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
1314 |
|
1315 TInt bufferSize; |
|
1316 InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
1317 |
|
1318 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1319 |
|
1320 // we create a desc |
|
1321 HBufC8* buffer = HBufC8::NewMaxL(bufferSize); |
|
1322 CleanupStack::PushL(buffer); |
|
1323 // create a new frame |
|
1324 |
|
1325 TPtr8 ptr = buffer->Des(); |
|
1326 CImageFrame* frame = CImageFrame::NewL(ptr, bufferSize,frameSize, frameFormat, frameLayout); |
|
1327 CleanupStack::PushL(frame); |
|
1328 |
|
1329 // get the type |
|
1330 if (frame->IsChunk()) |
|
1331 { |
|
1332 result = EFail; |
|
1333 INFO_PRINTF2(_L("Test %S image frame wrong type "), &iTestStepName); |
|
1334 } |
|
1335 |
|
1336 // create processor |
|
1337 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
1338 CleanupStack::PushL(processor); |
|
1339 |
|
1340 // create a TDataUnit |
|
1341 const TInt blocks = 6; |
|
1342 TDataUnit testUnit[blocks]; |
|
1343 TDataUnit* testUnit2[blocks]; |
|
1344 RArray<const TDataUnit*> testUnitPtr; |
|
1345 CleanupClosePushL(testUnitPtr); |
|
1346 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1347 |
|
1348 for(TInt i=0; i < blocks; i++) |
|
1349 { |
|
1350 testUnitPtr[i]=&testUnit[i]; |
|
1351 } |
|
1352 TInt j=0; |
|
1353 |
|
1354 TPoint startPos; |
|
1355 TPoint endPos; |
|
1356 |
|
1357 while (processor->MoreData()) |
|
1358 { |
|
1359 j++; |
|
1360 // init test unit |
|
1361 processor->GetCurrentPosition(startPos); |
|
1362 |
|
1363 for (TInt m=0; m < blocks; m++) |
|
1364 { |
|
1365 RImageFrameUtil::SetBlockToUniformValue(testUnit[m], ((j*10+m)&0xFF)); |
|
1366 } |
|
1367 |
|
1368 processor->WriteBlockL(testUnitPtr); |
|
1369 |
|
1370 processor->SetCurrentPosition(startPos); |
|
1371 |
|
1372 testUnit2[0] = processor->ReadBlockL(); |
|
1373 |
|
1374 for (TInt m=0; m < blocks; m++) |
|
1375 { |
|
1376 TInt g = KExpectedBlocksValuesIndx[EYCbCr420PlaSize][j-1]; |
|
1377 TInt f = KExpectedValuesIndx[g][m]; |
|
1378 |
|
1379 if (!RImageFrameUtil::CompareBlockValues(testUnit[f], (*testUnit2)[m])) |
|
1380 { |
|
1381 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, m); |
|
1382 result = EFail; |
|
1383 } |
|
1384 } |
|
1385 processor->GetCurrentPosition(endPos); |
|
1386 INFO_PRINTF6(_L("Test %S start position %d %d next %d %d"), &iTestStepName, |
|
1387 startPos.iX, startPos.iY, endPos.iX, endPos.iY ); |
|
1388 } |
|
1389 |
|
1390 // release all |
|
1391 CleanupStack::PopAndDestroy(4, buffer); |
|
1392 |
|
1393 __MM_HEAP_MARKEND; |
|
1394 return result; |
|
1395 } |
|
1396 |
|
1397 // |
|
1398 // RYuv420PlnProcChunk - testing creating and acessing for reading and writing a YCbCr420Planar Reversed image processor |
|
1399 // |
|
1400 RYuv420PlnProcChunk* RYuv420PlnProcChunk::NewL(TBool aAllocTest) |
|
1401 { |
|
1402 RYuv420PlnProcChunk* self = new (ELeave) RYuv420PlnProcChunk(aAllocTest); |
|
1403 return self; |
|
1404 } |
|
1405 RYuv420PlnProcChunk::RYuv420PlnProcChunk(TBool aAllocTest) : RImageFrameTest(aAllocTest) |
|
1406 { |
|
1407 |
|
1408 if (!iAllocTest) |
|
1409 { |
|
1410 iTestStepName = _L("MM-ICL-IMGFRM-U-0015-HP"); |
|
1411 } |
|
1412 else |
|
1413 { |
|
1414 iTestStepName = _L("MM-ICL-IMGFRM-U-0115-HP"); |
|
1415 } |
|
1416 } |
|
1417 |
|
1418 TVerdict RYuv420PlnProcChunk::DoTestL() |
|
1419 { |
|
1420 TVerdict result = EPass; |
|
1421 __MM_HEAP_MARK; |
|
1422 |
|
1423 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCr420PlaRev]); |
|
1424 TSize frameSize = TSize(KFrameTestSizeData[EYCbCr420PlaSize][0],KFrameTestSizeData[EYCbCr420PlaSize][1]); |
|
1425 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
1426 |
|
1427 TInt bufferSize; |
|
1428 InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
1429 |
|
1430 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1431 |
|
1432 RChunk chunk; |
|
1433 TInt res = chunk.CreateGlobal(KGlobalChunkName, bufferSize, bufferSize, EOwnerProcess); |
|
1434 |
|
1435 User::LeaveIfError(res); |
|
1436 |
|
1437 CleanupClosePushL(chunk); |
|
1438 // create a new frame |
|
1439 |
|
1440 CImageFrame* frame = CImageFrame::NewL(&chunk, bufferSize, 0, frameSize, frameFormat, frameLayout); |
|
1441 CleanupStack::PushL(frame); |
|
1442 |
|
1443 // get the type |
|
1444 if (!frame->IsChunk()) |
|
1445 { |
|
1446 result = EFail; |
|
1447 INFO_PRINTF2(_L("Test %S image frame wrong type "), &iTestStepName); |
|
1448 } |
|
1449 |
|
1450 const TInt blocks = 6; |
|
1451 |
|
1452 // create processor |
|
1453 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
1454 CleanupStack::PushL(processor); |
|
1455 |
|
1456 // create a TDataUnit |
|
1457 TDataUnit testUnit[blocks]; |
|
1458 TDataUnit* testUnit2[blocks]; |
|
1459 RArray<const TDataUnit*> testUnitPtr; |
|
1460 CleanupClosePushL(testUnitPtr); |
|
1461 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1462 |
|
1463 TInt j=0; |
|
1464 TPoint startPos; |
|
1465 TPoint endPos; |
|
1466 |
|
1467 while (processor->MoreData()) |
|
1468 { |
|
1469 // init test unit |
|
1470 j++; |
|
1471 for (TInt m=0; m < blocks; m++) |
|
1472 { |
|
1473 RImageFrameUtil::SetBlockToUniformValue(testUnit[m], (j*10+m)&0xFF); |
|
1474 } |
|
1475 // init test unit |
|
1476 processor->GetCurrentPosition(startPos); |
|
1477 |
|
1478 processor->WriteBlockL(testUnitPtr); |
|
1479 |
|
1480 processor->SetCurrentPosition(startPos); |
|
1481 |
|
1482 testUnit2[0] = processor->ReadBlockL(); |
|
1483 |
|
1484 for (TInt m=0; m < blocks; m++) |
|
1485 { |
|
1486 TInt g = KExpectedBlocksValuesIndx[EYCbCr420PlaSize][j-1]; |
|
1487 TInt f = KExpectedValuesIndx[g][m]; |
|
1488 |
|
1489 if (!RImageFrameUtil::CompareBlockValues(testUnit[f], (*testUnit2)[m])) |
|
1490 { |
|
1491 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, m); |
|
1492 result = EFail; |
|
1493 } |
|
1494 } |
|
1495 processor->GetCurrentPosition(endPos); |
|
1496 INFO_PRINTF6(_L("Test %S start position %d %d next %d %d"), &iTestStepName, |
|
1497 startPos.iX, startPos.iY, endPos.iX, endPos.iY ); |
|
1498 } |
|
1499 |
|
1500 // release all |
|
1501 CleanupStack::PopAndDestroy(4, &chunk); |
|
1502 |
|
1503 __MM_HEAP_MARKEND; |
|
1504 return result; |
|
1505 } |
|
1506 // |
|
1507 // RYuv420PlnRevProcDesc - testing creating and acessing for reading and writing a YCbCr420Planar image processor |
|
1508 // |
|
1509 RYuv420PlnRevProcDesc* RYuv420PlnRevProcDesc::NewL(TBool aAllocTest) |
|
1510 { |
|
1511 RYuv420PlnRevProcDesc* self = new (ELeave) RYuv420PlnRevProcDesc(aAllocTest); |
|
1512 return self; |
|
1513 } |
|
1514 |
|
1515 RYuv420PlnRevProcDesc::RYuv420PlnRevProcDesc(TBool aAllocTest):RImageFrameTest(aAllocTest) |
|
1516 { |
|
1517 |
|
1518 if (!iAllocTest) |
|
1519 { |
|
1520 iTestStepName = _L("MM-ICL-IMGFRM-U-0016-HP"); |
|
1521 } |
|
1522 else |
|
1523 { |
|
1524 iTestStepName = _L("MM-ICL-IMGFRM-U-0116-HP"); |
|
1525 } |
|
1526 } |
|
1527 |
|
1528 TVerdict RYuv420PlnRevProcDesc::DoTestL() |
|
1529 { |
|
1530 TVerdict result = EPass; |
|
1531 __MM_HEAP_MARK; |
|
1532 |
|
1533 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCr420Pla]); |
|
1534 TSize frameSize = TSize(KFrameTestSizeData[EYCbCr420PlaSize][0],KFrameTestSizeData[EYCbCr420PlaSize][1]); |
|
1535 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
1536 |
|
1537 TInt bufferSize; |
|
1538 InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
1539 |
|
1540 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1541 |
|
1542 // we create a desc |
|
1543 HBufC8* buffer = HBufC8::NewMaxL(bufferSize); |
|
1544 CleanupStack::PushL(buffer); |
|
1545 |
|
1546 // create a new frame |
|
1547 TPtr8 ptr = buffer->Des(); |
|
1548 CImageFrame* frame = CImageFrame::NewL(ptr, bufferSize, frameSize, frameFormat,frameLayout); |
|
1549 CleanupStack::PushL(frame); |
|
1550 |
|
1551 // get the type |
|
1552 if (frame->IsChunk()) |
|
1553 { |
|
1554 result = EFail; |
|
1555 INFO_PRINTF2(_L("Test %S image frame wrong type "), &iTestStepName); |
|
1556 } |
|
1557 |
|
1558 const TInt blocks = 6; |
|
1559 // create processor |
|
1560 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
1561 CleanupStack::PushL(processor); |
|
1562 |
|
1563 // create a TDataUnit |
|
1564 TDataUnit testUnit[blocks]; |
|
1565 TDataUnit* testUnit2[blocks]; |
|
1566 RArray<const TDataUnit*> testUnitPtr; |
|
1567 CleanupClosePushL(testUnitPtr); |
|
1568 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1569 |
|
1570 TInt j=0; |
|
1571 TPoint startPos; |
|
1572 TPoint endPos; |
|
1573 |
|
1574 while (processor->MoreData()) |
|
1575 { |
|
1576 j++; |
|
1577 for (TInt m=0; m < blocks; m++) |
|
1578 { |
|
1579 RImageFrameUtil::SetBlockToUniformValue(testUnit[m], ((j*10+m)&0xFF)); |
|
1580 } |
|
1581 |
|
1582 // init test unit |
|
1583 processor->GetCurrentPosition(startPos); |
|
1584 |
|
1585 processor->WriteBlockL(testUnitPtr); |
|
1586 |
|
1587 processor->SetCurrentPosition(startPos); |
|
1588 |
|
1589 testUnit2[0] = processor->ReadBlockL(); |
|
1590 |
|
1591 for (TInt m=0; m < blocks; m++) |
|
1592 { |
|
1593 TInt g = KExpectedBlocksValuesIndx[EYCbCr420PlaSize][j-1]; |
|
1594 TInt f = KExpectedValuesIndx[g][m]; |
|
1595 |
|
1596 if (!RImageFrameUtil::CompareBlockValues(testUnit[f], (*testUnit2)[m])) |
|
1597 { |
|
1598 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, m); |
|
1599 result = EFail; |
|
1600 } |
|
1601 } |
|
1602 |
|
1603 processor->GetCurrentPosition(endPos); |
|
1604 INFO_PRINTF6(_L("Test %S start position %d %d next %d %d"), &iTestStepName, |
|
1605 startPos.iX, startPos.iY, endPos.iX, endPos.iY ); |
|
1606 } |
|
1607 |
|
1608 // release all |
|
1609 CleanupStack::PopAndDestroy(4,buffer); |
|
1610 |
|
1611 __MM_HEAP_MARKEND; |
|
1612 return result; |
|
1613 } |
|
1614 |
|
1615 // |
|
1616 // RYuv420PlnRevProcChunk - testing creating and acessing for reading and writing a YCbCr420Planar(reversed) image processor |
|
1617 // |
|
1618 RYuv420PlnRevProcChunk* RYuv420PlnRevProcChunk::NewL(TBool aAllocTest) |
|
1619 { |
|
1620 RYuv420PlnRevProcChunk* self = new (ELeave) RYuv420PlnRevProcChunk(aAllocTest); |
|
1621 return self; |
|
1622 } |
|
1623 RYuv420PlnRevProcChunk::RYuv420PlnRevProcChunk(TBool aAllocTest):RImageFrameTest(aAllocTest) |
|
1624 { |
|
1625 |
|
1626 if (!iAllocTest) |
|
1627 { |
|
1628 iTestStepName = _L("MM-ICL-IMGFRM-U-0017-HP"); |
|
1629 } |
|
1630 else |
|
1631 { |
|
1632 iTestStepName = _L("MM-ICL-IMGFRM-U-0117-HP"); |
|
1633 } |
|
1634 } |
|
1635 |
|
1636 TVerdict RYuv420PlnRevProcChunk::DoTestL() |
|
1637 { |
|
1638 TVerdict result = EPass; |
|
1639 __MM_HEAP_MARK; |
|
1640 |
|
1641 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCr420Pla]); |
|
1642 TSize frameSize = TSize(KFrameTestSizeData[EYCbCr420PlaSize][0],KFrameTestSizeData[EYCbCr420PlaSize][1]); |
|
1643 TFrameLayout frameLayout(LayoutPlanes(frameFormat)); |
|
1644 |
|
1645 TInt bufferSize; |
|
1646 InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
1647 |
|
1648 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1649 |
|
1650 RChunk chunk; |
|
1651 TInt res = chunk.CreateGlobal(KGlobalChunkName, bufferSize, bufferSize, EOwnerProcess); |
|
1652 |
|
1653 User::LeaveIfError(res); |
|
1654 |
|
1655 CleanupClosePushL(chunk); |
|
1656 // create a new frame |
|
1657 |
|
1658 CImageFrame* frame = CImageFrame::NewL(&chunk, bufferSize, 0, frameSize, frameFormat,frameLayout); |
|
1659 CleanupStack::PushL(frame); |
|
1660 |
|
1661 // get the type |
|
1662 if (!frame->IsChunk()) |
|
1663 { |
|
1664 result = EFail; |
|
1665 INFO_PRINTF2(_L("Test %S image frame wrong type "), &iTestStepName); |
|
1666 } |
|
1667 |
|
1668 const TInt blocks = 6; |
|
1669 |
|
1670 // create processor |
|
1671 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
1672 CleanupStack::PushL(processor); |
|
1673 // create a TDataUnit |
|
1674 TDataUnit testUnit[blocks]; |
|
1675 TDataUnit* testUnit2[blocks]; |
|
1676 RArray<const TDataUnit*> testUnitPtr; |
|
1677 CleanupClosePushL(testUnitPtr); |
|
1678 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1679 |
|
1680 TInt j=0; |
|
1681 TPoint startPos; |
|
1682 TPoint endPos; |
|
1683 |
|
1684 while (processor->MoreData()) |
|
1685 { |
|
1686 j++; |
|
1687 for (TInt m=0; m < blocks; m++) |
|
1688 { |
|
1689 RImageFrameUtil::SetBlockToUniformValue(testUnit[m], ((j*10+m)&0xFF)); |
|
1690 } |
|
1691 // init test unit |
|
1692 processor->GetCurrentPosition(startPos); |
|
1693 processor->WriteBlockL(testUnitPtr); |
|
1694 processor->SetCurrentPosition(startPos); |
|
1695 |
|
1696 testUnit2[0] = processor->ReadBlockL(); |
|
1697 |
|
1698 for (TInt m = 0; m < blocks; m++) |
|
1699 { |
|
1700 TInt g = KExpectedBlocksValuesIndx[EYCbCr420PlaSize][j-1]; |
|
1701 TInt f = KExpectedValuesIndx[g][m]; |
|
1702 |
|
1703 if (!RImageFrameUtil::CompareBlockValues(testUnit[f], (*testUnit2)[m])) |
|
1704 { |
|
1705 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, m); |
|
1706 result = EFail; |
|
1707 } |
|
1708 } |
|
1709 processor->GetCurrentPosition(endPos); |
|
1710 INFO_PRINTF6(_L("Test %S start position %d %d next %d %d"), &iTestStepName, |
|
1711 startPos.iX, startPos.iY, endPos.iX, endPos.iY ); |
|
1712 } |
|
1713 |
|
1714 |
|
1715 // release all |
|
1716 CleanupStack::PopAndDestroy(4,&chunk); |
|
1717 __MM_HEAP_MARKEND; |
|
1718 return result; |
|
1719 } |
|
1720 |
|
1721 /***************************************************************************/ |
|
1722 // |
|
1723 // RImageFrameClip - testing creating and acessing for reading and writing with a Mono image processor but with |
|
1724 // values some of which require clipping |
|
1725 // |
|
1726 RImageFrameClip* RImageFrameClip::NewL(TBool aAllocTest) |
|
1727 { |
|
1728 RImageFrameClip* self = new (ELeave) RImageFrameClip(aAllocTest); |
|
1729 return self; |
|
1730 } |
|
1731 |
|
1732 RImageFrameClip::RImageFrameClip(TBool /*aAllocTest*/) |
|
1733 { |
|
1734 iTestStepName = _L("MM-ICL-IMGFRM-U-0018-HP"); |
|
1735 } |
|
1736 |
|
1737 TVerdict RImageFrameClip::DoTestStepL() |
|
1738 { |
|
1739 TVerdict result = EPass; |
|
1740 |
|
1741 __MM_HEAP_MARK; |
|
1742 |
|
1743 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCrMono]); |
|
1744 TSize frameSize = TSize(8,8); |
|
1745 TFrameLayout frameLayout(RImageFrameUtil::LayoutPlanes(frameFormat)); |
|
1746 |
|
1747 TInt bufferSize; |
|
1748 RImageFrameUtil::InitLayoutValues(frameLayout,frameFormat, frameSize, bufferSize); |
|
1749 |
|
1750 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1751 |
|
1752 // create a desc |
|
1753 HBufC8* buffer = HBufC8::NewMaxL(bufferSize); |
|
1754 CleanupStack::PushL(buffer); |
|
1755 |
|
1756 // create a new frame |
|
1757 TPtr8 ptr = buffer->Des(); |
|
1758 CImageFrame* frame = CImageFrame::NewL(ptr, bufferSize, frameSize, frameFormat, frameLayout); |
|
1759 CleanupStack::PushL(frame); |
|
1760 |
|
1761 // create processor |
|
1762 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frame); |
|
1763 CleanupStack::PushL(processor); |
|
1764 |
|
1765 // create a TDataUnit |
|
1766 const TInt blocks = 1; |
|
1767 TDataUnit testUnit[blocks]; |
|
1768 TDataUnit* testUnit2[blocks]; |
|
1769 RArray<const TDataUnit*> testUnitPtr; |
|
1770 CleanupClosePushL(testUnitPtr); |
|
1771 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1772 |
|
1773 TPoint startPos; |
|
1774 TPoint endPos; |
|
1775 |
|
1776 TInt elements = sizeof(KTestClipValues)/(sizeof(TInt)*2); |
|
1777 while (processor->MoreData()) |
|
1778 { |
|
1779 // init test unit |
|
1780 for (TInt j = 0; j < 64; j++) |
|
1781 { |
|
1782 testUnit[0].iCoeff[j] = KTestClipValues[j%elements][0]; |
|
1783 } |
|
1784 |
|
1785 processor->GetCurrentPosition(startPos); |
|
1786 |
|
1787 processor->WriteBlockL(testUnitPtr); |
|
1788 |
|
1789 processor->SetCurrentPosition(startPos); |
|
1790 |
|
1791 testUnit2[0] = processor->ReadBlockL(); |
|
1792 for (TInt j = 0; j < 64; j++) |
|
1793 { |
|
1794 if ((*testUnit2[0]).iCoeff[j] != KTestClipValues[j%elements][1]) |
|
1795 { |
|
1796 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, j); |
|
1797 result = EFail; |
|
1798 } |
|
1799 |
|
1800 } |
|
1801 } |
|
1802 |
|
1803 // release all |
|
1804 CleanupStack::PopAndDestroy(4, buffer); |
|
1805 __MM_HEAP_MARKEND; |
|
1806 return result; |
|
1807 } |
|
1808 |
|
1809 /***************************************************************************/ |
|
1810 // |
|
1811 // RImageFrameDescMultiFrame testing the creation and access of two CImageFrame objects sharing the |
|
1812 // same descriptor. |
|
1813 // |
|
1814 RImageFrameDescMultiFrame* RImageFrameDescMultiFrame::NewL(TBool aAllocTest) |
|
1815 { |
|
1816 RImageFrameDescMultiFrame* self = new (ELeave) RImageFrameDescMultiFrame(aAllocTest); |
|
1817 return self; |
|
1818 } |
|
1819 |
|
1820 RImageFrameDescMultiFrame::RImageFrameDescMultiFrame(TBool /*aAllocTest*/) |
|
1821 { |
|
1822 iTestStepName = _L("MM-ICL-IMGFRM-U-0040-HP"); |
|
1823 } |
|
1824 |
|
1825 TVerdict RImageFrameDescMultiFrame::DoTestStepL() |
|
1826 { |
|
1827 TVerdict result = EPass; |
|
1828 // make sure mo memory leaks |
|
1829 __MM_HEAP_MARK; |
|
1830 // image is predefined - we have several images at const offset. |
|
1831 // very much akin to a raw video stream feed |
|
1832 // init general stuff |
|
1833 TInt numFrames = KMultiFrameNumber; |
|
1834 TInt frameOffsets = KRChunkDataOffset; |
|
1835 |
|
1836 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCrMono]); |
|
1837 TSize frameSize = TSize(KFrameTestSizeData[EYCbCrMonoSize][0], KFrameTestSizeData[EYCbCrMonoSize][1]); |
|
1838 TFrameLayout frameLayout(RImageFrameUtil::LayoutPlanes(frameFormat)); |
|
1839 |
|
1840 TInt frameBufferSize; |
|
1841 RImageFrameUtil::InitLayoutValues(frameLayout,frameFormat, frameSize, frameBufferSize); |
|
1842 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1843 // total size |
|
1844 TInt bufferTSize = (frameOffsets + frameBufferSize) * numFrames; |
|
1845 |
|
1846 HBufC8* buffer = HBufC8::NewMaxL(bufferTSize); |
|
1847 CleanupStack::PushL(buffer); |
|
1848 |
|
1849 // create a new frame |
|
1850 TPtr8 ptr = buffer->Des(); |
|
1851 |
|
1852 // wrappers within the descriptor |
|
1853 CImageFrame* frameArray[KMultiFrameNumber]; |
|
1854 TInt startingOffset = frameOffsets; |
|
1855 |
|
1856 for (TInt i = 0; i < numFrames; i++) |
|
1857 { |
|
1858 TPtr8 ptr1 = (ptr.MidTPtr(startingOffset)); |
|
1859 // maybe we want to have the offsets as well? |
|
1860 CImageFrame* frame = CImageFrame::NewL(ptr1, frameBufferSize, frameSize, frameFormat, frameLayout); |
|
1861 CleanupStack::PushL(frame); |
|
1862 |
|
1863 // check the type |
|
1864 if (frame->IsChunk()) |
|
1865 { |
|
1866 result = EFail; |
|
1867 INFO_PRINTF2(_L("Test %S wrong type "), &iTestStepName); |
|
1868 } |
|
1869 startingOffset += frameBufferSize; |
|
1870 frameArray[i] = frame; |
|
1871 } |
|
1872 |
|
1873 const TInt blocks = 1; |
|
1874 |
|
1875 // create a TDataUnit |
|
1876 TDataUnit testUnit[blocks]; |
|
1877 TDataUnit* testUnit2[blocks]; |
|
1878 RArray<const TDataUnit*> testUnitPtr; |
|
1879 CleanupClosePushL(testUnitPtr); |
|
1880 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
1881 |
|
1882 // initialise to prevent warnings |
|
1883 testUnit2[0] = NULL; |
|
1884 TPoint startPos; |
|
1885 TPoint endPos; |
|
1886 |
|
1887 for (TInt frameIndx = 0; frameIndx < numFrames; frameIndx++) |
|
1888 { |
|
1889 startPos.SetXY(0,0); |
|
1890 // create processor |
|
1891 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frameArray[frameIndx]); |
|
1892 CleanupStack::PushL(processor); |
|
1893 |
|
1894 while (processor->MoreData()) |
|
1895 { |
|
1896 // init test unit |
|
1897 processor->GetCurrentPosition(startPos); |
|
1898 |
|
1899 for (TInt m=0; m < blocks; m++) |
|
1900 { |
|
1901 RImageFrameUtil::SetBlockToUniformValue(testUnit[m], 2+m); |
|
1902 } |
|
1903 TInt res; |
|
1904 TRAP(res, processor->WriteBlockL(testUnitPtr)); |
|
1905 if (res!=KErrNone) |
|
1906 { |
|
1907 INFO_PRINTF3(_L("Test %S failed to write MCU result %d "), &iTestStepName, res); |
|
1908 result = EFail; |
|
1909 } |
|
1910 processor->SetCurrentPosition(startPos); |
|
1911 TRAP(res, testUnit2[0] = processor->ReadBlockL()); |
|
1912 if (res!=KErrNone) |
|
1913 { |
|
1914 INFO_PRINTF3(_L("Test %S failed to read MCU result %d "), &iTestStepName, res); |
|
1915 result = EFail; |
|
1916 } |
|
1917 |
|
1918 for (TInt m = 0; m < blocks; m++) |
|
1919 { |
|
1920 if (!RImageFrameUtil::CompareBlockValues(testUnit[m], (*testUnit2)[m])) |
|
1921 { |
|
1922 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, m); |
|
1923 result = EFail; |
|
1924 } |
|
1925 } |
|
1926 |
|
1927 processor->GetCurrentPosition(endPos); |
|
1928 |
|
1929 } |
|
1930 INFO_PRINTF3(_L("Test %S Frame %d completed"), &iTestStepName, frameIndx); |
|
1931 CleanupStack::PopAndDestroy(1);// the processor |
|
1932 } |
|
1933 |
|
1934 // release all |
|
1935 CleanupStack::PopAndDestroy(2 + numFrames, buffer); |
|
1936 __MM_HEAP_MARKEND; |
|
1937 return result; |
|
1938 } |
|
1939 |
|
1940 // |
|
1941 // RImageFrameRChunkMultiFrame testing the creation and access of two CImageFrame objects sharing the |
|
1942 // same RChunk. |
|
1943 // |
|
1944 RImageFrameRChunkMultiFrame* RImageFrameRChunkMultiFrame::NewL(TBool aAllocTest) |
|
1945 { |
|
1946 RImageFrameRChunkMultiFrame* self = new (ELeave) RImageFrameRChunkMultiFrame(aAllocTest); |
|
1947 return self; |
|
1948 } |
|
1949 |
|
1950 RImageFrameRChunkMultiFrame::RImageFrameRChunkMultiFrame(TBool /*aAllocTest*/) |
|
1951 { |
|
1952 iTestStepName = _L("MM-ICL-IMGFRM-U-0041-HP"); |
|
1953 } |
|
1954 |
|
1955 TVerdict RImageFrameRChunkMultiFrame::DoTestStepL() |
|
1956 { |
|
1957 TVerdict result = EPass; |
|
1958 __MM_HEAP_MARK; |
|
1959 // image is predefined - we have several images at const offset. |
|
1960 // very much akin to a raw video stream feed |
|
1961 // init general stuff |
|
1962 TInt numFrames = KMultiFrameNumber; |
|
1963 TInt frameOffsets = KRChunkDataOffset; |
|
1964 |
|
1965 TFrameFormat frameFormat(KFrameFormatDefaults[EYCbCrMono]); |
|
1966 TSize frameSize = TSize(KFrameTestSizeData[EYCbCrMonoSize][0],KFrameTestSizeData[EYCbCrMonoSize][1]); |
|
1967 TFrameLayout frameLayout(RImageFrameUtil::LayoutPlanes(frameFormat)); |
|
1968 |
|
1969 TInt frameBufferSize; |
|
1970 RImageFrameUtil::InitLayoutValues(frameLayout,frameFormat, frameSize, frameBufferSize); |
|
1971 |
|
1972 INFO_PRINTF4(_L("Test %S Image size width %d height %d"), &iTestStepName, frameSize.iWidth, frameSize.iHeight); |
|
1973 |
|
1974 // chunk allocation |
|
1975 RChunk chunk; |
|
1976 TInt chunkSize = (frameOffsets + frameBufferSize) * numFrames; |
|
1977 TInt res = chunk.CreateGlobal(KGlobalChunkName, chunkSize, chunkSize, EOwnerProcess); |
|
1978 if (res!=KErrNone) |
|
1979 { |
|
1980 INFO_PRINTF3(_L("Test %S failed to create an RChunk %d"), &iTestStepName, res); |
|
1981 User::LeaveIfError(res); |
|
1982 } |
|
1983 |
|
1984 CleanupClosePushL(chunk); |
|
1985 |
|
1986 // wrappers within the chunk |
|
1987 CImageFrame* frameArray[KMultiFrameNumber]; |
|
1988 TInt startingOffset = frameOffsets; |
|
1989 |
|
1990 for (TInt i = 0; i < numFrames; i++) |
|
1991 { |
|
1992 // create frames |
|
1993 CImageFrame* frame = CImageFrame::NewL(&chunk, frameBufferSize, startingOffset, frameSize, frameFormat, frameLayout); |
|
1994 CleanupStack::PushL(frame); |
|
1995 |
|
1996 // check the type |
|
1997 if (!frame->IsChunk()) |
|
1998 { |
|
1999 result = EFail; |
|
2000 INFO_PRINTF1(_L("RImageFrameRChunkMultiFrame::wrong type ")); |
|
2001 } |
|
2002 startingOffset += frameBufferSize; |
|
2003 frameLayout.SetStart(0, startingOffset); |
|
2004 frameArray[i] = frame; |
|
2005 } |
|
2006 |
|
2007 const TInt blocks = 1; |
|
2008 |
|
2009 // create a TDataUnit |
|
2010 TDataUnit testUnit[blocks]; |
|
2011 TDataUnit* testUnit2[blocks]; |
|
2012 RArray<const TDataUnit*> testUnitPtr; |
|
2013 CleanupClosePushL(testUnitPtr); |
|
2014 RImageFrameUtil::InitPointerValuesL(testUnit, testUnitPtr, blocks); |
|
2015 |
|
2016 // initialise to prevent warnings |
|
2017 testUnit2[0] = NULL; |
|
2018 TPoint startPos; |
|
2019 TPoint endPos; |
|
2020 |
|
2021 for (TInt frameIndx = 0; frameIndx < numFrames; frameIndx++) |
|
2022 { |
|
2023 startPos.SetXY(0,0); |
|
2024 // create processor |
|
2025 CJpgImageFrameProcessor* processor = CJpgImageFrameProcessorUtility::NewL(*frameArray[frameIndx]); |
|
2026 CleanupStack::PushL(processor); |
|
2027 |
|
2028 while (processor->MoreData()) |
|
2029 { |
|
2030 // init test unit |
|
2031 processor->GetCurrentPosition(startPos); |
|
2032 |
|
2033 for (TInt m=0; m < blocks; m++) |
|
2034 { |
|
2035 RImageFrameUtil::SetBlockToUniformValue(testUnit[m], 2+m); |
|
2036 } |
|
2037 TInt res; |
|
2038 TRAP(res, processor->WriteBlockL(testUnitPtr)); |
|
2039 if (res!=KErrNone) |
|
2040 { |
|
2041 INFO_PRINTF3(_L("Test %S failed to write MCU result %d "), &iTestStepName, res); |
|
2042 result = EFail; |
|
2043 } |
|
2044 processor->SetCurrentPosition(startPos); |
|
2045 |
|
2046 TRAP(res,testUnit2[0] = processor->ReadBlockL()); |
|
2047 if (res!=KErrNone) |
|
2048 { |
|
2049 INFO_PRINTF3(_L("Test %S failed to read MCU result %d "), &iTestStepName, res); |
|
2050 result = EFail; |
|
2051 } |
|
2052 |
|
2053 for (TInt m = 0; m < blocks; m++) |
|
2054 { |
|
2055 if (!RImageFrameUtil::CompareBlockValues(testUnit[m], (*testUnit2)[m])) |
|
2056 { |
|
2057 INFO_PRINTF3(_L("Test %S Block values different unit %d"), &iTestStepName, m); |
|
2058 result = EFail; |
|
2059 } |
|
2060 } |
|
2061 |
|
2062 processor->GetCurrentPosition(endPos); |
|
2063 } |
|
2064 INFO_PRINTF3(_L("Test %S Frame %d completed"), &iTestStepName, frameIndx); |
|
2065 CleanupStack::PopAndDestroy(1);// the processor |
|
2066 } |
|
2067 |
|
2068 // release all |
|
2069 CleanupStack::PopAndDestroy(2+numFrames,&chunk); |
|
2070 __MM_HEAP_MARKEND; |
|
2071 return result; |
|
2072 } |