Update contrib.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
21 #include "H264DecTestEngine.h"
22 #include "T_DevVideoConstants.h"
25 #include <buffermanagementci.h> // Custom interface buffre management
30 #ifdef __SECUREOUTPUTCI__
31 #include <secureoutputci.h>
34 #include <Devvideoplay.h>
35 #include <Devvideobase.h>
36 #include <Devvideoconstants.h>
39 //#define __MEM_CHECK_
46 /* ----------------------------------------------------------------------------
47 * Name: CVDecTestEngine::~CVDecTestEngine()
48 * Purpose: Deconstructor
51 * --------------------------------------------------------------------------*/
53 CVDecTestEngine::~CVDecTestEngine ()
60 /* ----------------------------------------------------------------------------
61 * Name: CVDecTestEngine:NewL()
62 * Purpose: Create instance of test engine
63 * Parameters: MVDecEngineObserver& aTestClass
64 * Return: CVDecTestEngine*
65 * --------------------------------------------------------------------------*/
67 CVDecTestEngine* CVDecTestEngine::NewL(MVDecEngineObserver& aTestClass)
69 CVDecTestEngine* self = new(ELeave) CVDecTestEngine;
71 CleanupStack::PushL( self );
72 self->ConstructL(aTestClass);
79 /* ----------------------------------------------------------------------------
80 * Name: CVDecTestEngine::ConstructL()
81 * Purpose: Symbian second phase constructor, which may leave
82 * Parameters: MVDecEngineObserver& aTestClass
84 * --------------------------------------------------------------------------*/
87 void CVDecTestEngine::ConstructL(MVDecEngineObserver& aTestClass)
90 iTestClass = &aTestClass;
93 //Create Active object
94 iDecTestAO = new(ELeave) CVDecTestAO(this);
96 //clock source from system clock
97 iClock = CSystemClockSource::NewL();
101 /* ----------------------------------------------------------------------------
102 * Name: CVDecTestEngine::AssertTIntEqualL()
105 * Parameters: TInt aExpected, TInt aActual
107 * --------------------------------------------------------------------------*/
109 void CVDecTestEngine::AssertTIntEqualL(TInt aExpected, TInt aActual)
111 if ( aExpected != aActual )
113 User::Leave(aActual);
117 /* ----------------------------------------------------------------------------
118 * Name: CVDecTestEngine::SetUp()
119 * Purpose: Create DevVideoPlay, Initilize Engine paramters
120 * Parameters: TSize aSize, TBool aScreenAccess, TBool aSynchronized, TBool aCIBuffMgmt
122 * --------------------------------------------------------------------------*/
124 void CVDecTestEngine::SetUpL(TSize aSize, TBool aScreenAccess, TBool aCIBuffMgmt)
129 //Create DevVideoPlay
130 iDevvp = CMMFDevVideoPlay::NewL(*this);
131 PRINT((_L("CVDecTestEngine::SetUpL, DevVideo Created")))
133 PRINT((_L("CVDecTestEngine::SetUpL, mem alloc, iDevvp") ))
138 // Initilize Engine parameters
144 iCodecType = ENoCodec;
146 iFrameMatch = EFalse;
148 iFrameJumpCounter = 0;
149 iCorruptMarker = EFalse;
150 iOutCorruptedFileOpen = EFalse;
154 iFrameDropCounter = 0;
155 iFrameDropInterval = 0;
157 iFrameDropMarker = EFalse;
159 iFrameDropNumCounter = 0;
160 iSetPassword = EFalse;
161 iUseSecondScreen = EFalse;
164 #ifdef __CI_HEADERS__
165 iCIBuffMgmtOn = aCIBuffMgmt;
168 iDirectScreenAccess = aScreenAccess;
169 iSynchronized = EFalse;
170 iLandscapeMode =EFalse;
172 PRINT((_L("CVDecTestEngine::SetUpL, reserving data chunk")));
175 if (aSize.iWidth > 720 && aSize.iWidth > 576 )
177 iDataChunkSize = KMP4MaxCodedSize720P*4;
178 iDataThreshold = KMP4MaxCodedSize720P;
180 else if (aSize.iWidth > 640 && aSize.iWidth > 480 )
182 iDataChunkSize = KMP4MaxCodedSizePAL*4;
183 iDataThreshold = KMP4MaxCodedSizePAL;
185 else if (aSize.iWidth > 352 && aSize.iWidth > 288 )
187 iDataChunkSize = KMP4MaxCodedSizeVGA*4;
188 iDataThreshold = KMP4MaxCodedSizeVGA;
190 else if (aSize.iWidth <= 352 && aSize.iWidth > 176)
192 iDataChunkSize = KMP4MaxCodedSizeCIF*4;
193 iDataThreshold = KMP4MaxCodedSizeCIF;
197 iDataChunkSize = KMP4MaxCodedSizeQCIF*4;
198 iDataThreshold = KMP4MaxCodedSizeQCIF;
200 PRINT((_L("CVDecTestEngine::SetUpL, Data chunk size is [%d]"), iDataChunkSize));
201 PRINT((_L("CVDecTestEngine::SetUpL, Data threshold [%d]"), iDataThreshold));
202 iDataChunk = new (ELeave) TUint8[iDataChunkSize];
205 PRINT((_L("CVDecTestEngine::SetUpL, mem alloc, iDataChunk") ));
207 iReadDataChunk = iDataChunk;
208 iWriteDataChunk = iDataChunk;
211 iPictureSize.SetSize(aSize.iWidth,aSize.iHeight);
212 TRect rect(iPictureSize);
214 iFrameMeasurement = EFalse;
215 iDsaStarted = EFalse;
219 User::LeaveIfError( FbsStartup() );
220 PRINT((_L("CVDecTestEngine::SetUpL, Fbs server started:")))
226 if ( (err = iFs.Connect()) != KErrNone )
228 PRINT((_L("CVDecTestEngine::SetUpL, Open File server session fail ")))
233 /* ----------------------------------------------------------------------------
234 * Name: CVDecTestEngine::EnableFrameMeasurementTest
235 * Purpose: Enable Perforamce test flag
237 * Parameters: TBool a Enable
239 * --------------------------------------------------------------------------*/
241 void CVDecTestEngine::EnableFrameMeasurementTest(TBool aEnable)
243 iFrameMeasurement = aEnable;
246 /* ----------------------------------------------------------------------------
247 * Name: CVDecTestEngine::SetInputBufferSize
250 * Parameters: TBool a Enable
252 * --------------------------------------------------------------------------*/
254 void CVDecTestEngine::SetInputBufferSize(TInt aSize)
257 if ( iCIBuffMgmtOn ) //Custom interfarce Buffer management is used
259 PRINT((_L("CVDecTestEngine::SetInputBufferSize, CI Buffer management")))
260 #ifdef __CI_HEADERS__
261 iCIBuffMgmt = (MMmfVideoBufferManagement*)iDevvp->CustomInterface(iPostProcId, KMmfVideoBuffermanagementUid);
262 iCIBuffMgmt->MmvbmSetObserver(this);
263 iCIBuffMgmt->MmvbmEnable(ETrue);
265 MMmfVideoBufferManagement::TBufferOptions options;
266 options.iNumInputBuffers = KNumOfInputBuffers;
267 options.iBufferSize = iPictureSize;
269 iCIBuffMgmt->MmvbmSetBufferOptionsL(options);
271 PRINT((_L("CVDecTestEngine::SetInputBufferSize, CI Buffer management Set, Buff size:[%d],[%d]"),iPictureSize.iWidth,iPictureSize.iHeight))
275 else //Use default Devvideo API for buffer management
278 iRawInBuffer = new(ELeave) TVideoPicture;
281 PRINT((_L("CVDecTestEngine::SetInputBufferSize, mem alloc, iRawInBuffer") ));
283 TUint8* ptr = new (ELeave) TUint8[iInBuffSize];
286 PRINT((_L("CVDecTestEngine::SetInputBufferSize, mem alloc, ptr") ));
288 TPtr8* temp = new (ELeave) TPtr8(ptr, 0, iInBuffSize);
291 PRINT((_L("CVDecTestEngine::SetInputBufferSize, mem alloc, temp") ));
293 iRawInBuffer->iData.iRawData = temp;
295 iRawInBuffer->iData.iDataSize.SetSize(iPictureSize.iWidth,iPictureSize.iHeight); //set picture size
297 iRawInBuffer->iOptions = 0;
298 iRawInBuffer->iTimestamp = 0;
304 PRINT((_L("CVDecTestEngine::SetInputBufferSize, mem del, ptr & temp") ));
306 PRINT((_L("CVDecTestEngine::SetInputBufferSize, Buffer created: Size[%d]"),iInBuffSize))
311 /* ----------------------------------------------------------------------------
312 * Name: CVDecTestEngine::GetHeaderInformationL()
313 * Purpose: Ritrieve header Information
314 * Parameters: TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aDataUnitEncapsulation
316 *---------------------------------------------------------------------------*/
318 void CVDecTestEngine::GetHeaderInformationL(TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aDataUnitEncapsulation)
321 TVideoPictureHeader* headerInfo = NULL;
322 HBufC8* tempBuff = NULL;
324 //Read Picture header : Size is not known
325 TVideoInputBuffer* codedBuffer = new(ELeave) TVideoInputBuffer;
327 CleanupStack::PushL( codedBuffer );
329 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem alloc, codedBuffer") ))
331 iInBuffSize = KMaxCodedSize;
334 while ( (err == KErrOverflow) && (iInBuffSize <= KMaxCodedSize) )
336 tempBuff = HBufC8::NewL(iInBuffSize);
338 CleanupStack::PushL( tempBuff );
340 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem alloc, codedBuffer") ))
342 codedBuffer->iData.Set(tempBuff->Des());
343 if ( iFrameSizeList.Count() > 0 )
345 err = ReadOneCodedPicture(codedBuffer, iFrameSizeList[0] );
349 err = ReadOneCodedPicture(codedBuffer);
352 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, return err [%d]"),err))
354 if ( iInFile.Seek(ESeekStart,pos) )
357 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, err = KErrGeneral")))
363 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, err = KErrNotFound")))
368 CleanupStack::PopAndDestroy(tempBuff);
371 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem del, tempBuff") ))
373 iInBuffSize = 4*iInBuffSize;
377 // Reitrieve header information from bitstream
380 CleanupStack::PopAndDestroy(codedBuffer);
383 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem del, codedBuffer") ))
385 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Reading input data fail")))
390 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, call adaptation layer")))
391 headerInfo = iDevvp->GetHeaderInformationL(aDataUnitType,aDataUnitEncapsulation,codedBuffer);
393 CleanupStack::PopAndDestroy(tempBuff);
395 CleanupStack::PopAndDestroy(codedBuffer);
398 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem del, tempBuff & codedBuffer") ))
401 if ( !err && headerInfo )
404 iPictureSize = headerInfo->iDisplayedRect.Size();
405 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Picture Size :width[%d], height[%d]"),iPictureSize.iWidth,iPictureSize.iHeight))
408 iDispRect = headerInfo->iDisplayedRect;
409 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Displayed image portion: Width[%d] to Height[%d]"),headerInfo->iDisplayedRect.Width(),headerInfo->iDisplayedRect.Height()))
412 iDevvp->ReturnHeader(headerInfo);
415 else //temp modify because MP4HwDevice of Emuzed returns null information in 1st release
417 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Get header info fail")))
422 AssertTIntEqualL(KErrNone, err);
427 /* ----------------------------------------------------------------------------
428 * Name: CVDecTestEngine::GetHeaderInformationL()
429 * Purpose: Retrieve header Information
432 *---------------------------------------------------------------------------*/
434 void CVDecTestEngine::GetHeaderInformationL()
436 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, In")))
438 TVideoPictureHeader* headerInfo = NULL;
439 HBufC8* tempBuff = NULL;
441 //Read Picture header : Size is not known
442 TVideoInputBuffer* codedBuffer = new(ELeave) TVideoInputBuffer;
444 CleanupStack::PushL( codedBuffer );
446 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem alloc, codedBuffer") ))
448 iInBuffSize = KMaxCodedSize;
451 while ( (err == KErrOverflow) && (iInBuffSize <= KMaxCodedSize) )
453 tempBuff = HBufC8::NewL(iInBuffSize);
455 CleanupStack::PushL( tempBuff );
457 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem alloc, tempBuff") ))
459 codedBuffer->iData.Set(tempBuff->Des());
461 if ( iFrameSizeList.Count() > 0 )
463 err = ReadOneCodedPicture(codedBuffer, iFrameSizeList[0] );
467 err = ReadOneCodedPicture(codedBuffer);
472 if ( iInFile.Seek(ESeekStart,pos) )
484 CleanupStack::PopAndDestroy(tempBuff);
487 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem del, tempBuff") ))
489 iInBuffSize = 4*iInBuffSize;
494 // Reitrieve header information from bitstream
497 CleanupStack::PopAndDestroy(codedBuffer);
500 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem del, codedBuffer") ))
502 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Reading input data fail")))
508 headerInfo = iDevvp->GetHeaderInformationL(EDuCodedPicture,EDuElementaryStream,codedBuffer);
510 CleanupStack::PopAndDestroy(tempBuff);
511 CleanupStack::PopAndDestroy(codedBuffer);
515 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, mem del, tempBuff & codedBuffer") ))
522 iPictureSize = headerInfo->iDisplayedRect.Size();
523 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Picture Size :width[%d], height[%d]"),iPictureSize.iWidth,iPictureSize.iHeight))
526 iDispRect = headerInfo->iDisplayedRect;
527 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Displayed image portion: Width[%d] to Height[%d]"),headerInfo->iDisplayedRect.Width(),headerInfo->iDisplayedRect.Height()))
529 iDevvp->ReturnHeader(headerInfo);
534 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Get header info fail")))
540 // Set size of decoder input buffer
541 if ( iCodecType == EH263 )
543 if ( (iPictureSize.iWidth <= 176 ) && (iPictureSize.iHeight <= 144) )
545 iInBuffSize = KH263MaxCodedSizeQCIF;
549 iInBuffSize = KH263MaxCodedSizeCIF;
554 if ( (iPictureSize.iWidth <= 176 ) && (iPictureSize.iHeight <= 144) )
556 iInBuffSize = KMP4MaxCodedSizeQCIF;
558 else if ( (iPictureSize.iWidth <= 352 ) && (iPictureSize.iHeight <= 288) )
560 iInBuffSize = KMP4MaxCodedSizeCIF;
565 iInBuffSize = KMP4MaxCodedSizeVGA;
570 AssertTIntEqualL(KErrNone, err);
571 PRINT((_L("CVDecTestEngine::GetHeaderInformationL, Out")))
574 /* ----------------------------------------------------------------------------
575 * Name: CVDecTestEngine::SetCodecType
576 * Purpose: Set Cotec type
577 * Parameters: TVideoCodec aCodec
580 * --------------------------------------------------------------------------*/
582 void CVDecTestEngine::SetCodecType(TVideoCodec aCodec)
587 /* ----------------------------------------------------------------------------
588 * Name: CVDecTestEngine::GetBitstreamCountersL()
593 * --------------------------------------------------------------------------*/
595 void CVDecTestEngine::GetBitstreamCountersL()
597 PRINT((_L("CVDecTestEngine::GetBitstreamCountersL In")))
599 CMMFDevVideoPlay::TBitstreamCounters lCounters;
601 iDevvp->GetBitstreamCounters(lCounters);
603 PRINT((_L("CVDecTestEngine::GetBitstreamCountersL, Lost Packets = %d"),lCounters.iLostPackets))
604 PRINT((_L("CVDecTestEngine::GetBitstreamCountersL, Total Packets = %d"), lCounters.iTotalPackets))
606 PRINT((_L("CVDecTestEngine::GetBitstreamCountersL Out")))
609 /* ----------------------------------------------------------------------------
610 * Name: CVDecTestEngine::PreDecoderBufferBytes()
615 * --------------------------------------------------------------------------*/
617 void CVDecTestEngine::PreDecoderBufferBytes()
619 PRINT((_L("CVDecTestEngine::PreDecoderBufferBytes, In")))
621 TUint lBufferBytes = iDevvp->PreDecoderBufferBytes();
622 PRINT((_L("CVDecTestEngine::PreDecoderBufferBytes, Number of bytes of data in the pre-decoder buffer = %d"), lBufferBytes))
624 PRINT((_L("CVDecTestEngine::PreDecoderBufferBytes, Out")))
627 /* ----------------------------------------------------------------------------
628 * Name: CVDecTestEngine::PictureBufferBytes()
633 * --------------------------------------------------------------------------*/
635 void CVDecTestEngine::PictureBufferBytes()
637 PRINT((_L("CVDecTestEngine::PictureBufferBytes, In")))
639 TUint buffbyte = iDevvp->PictureBufferBytes();
640 PRINT((_L("CVDecTestEngine::PictureBufferBytes: total amount of memory allocated [%d]"),buffbyte))
642 PRINT((_L("CVDecTestEngine::PictureBufferBytes, Out")))
645 /* ----------------------------------------------------------------------------
646 * Name: CVDecTestEngine::SetPostProcessTypesL()
647 * Purpose: Set combination of postprocessor
649 * Parameters: TUint32 aCombination
651 * --------------------------------------------------------------------------*/
653 void CVDecTestEngine::SetPostProcessTypesL(TInt aHWDevice, TUint32 aCombination)
655 PRINT((_L("CVDecTestEngine::SetPostProcessTypesL, In")))
657 if (aHWDevice == EPostProcessor)
659 iDevvp->SetPostProcessTypesL(iPostProcId,aCombination);
663 iDevvp->SetPostProcessTypesL(iDecHWDevId,aCombination);
666 PRINT((_L("CVDecTestEngine::SetPostProcessTypesL, Out")))
670 /* ----------------------------------------------------------------------------
671 * Name: CVDecTestEngine::SetInputCropOptionsL()
672 * Purpose: Set input crop
674 * Parameters: TRect aCrop
676 * --------------------------------------------------------------------------*/
678 void CVDecTestEngine::SetInputCropOptionsL(TInt aHWDevice, TRect aCrop)
680 PRINT((_L("CVDecTestEngine::SetInputCropOptionsL, In")))
682 if (aHWDevice == EPostProcessor)
684 iDevvp->SetInputCropOptionsL(iPostProcId,aCrop);
688 iDevvp->SetInputCropOptionsL(iDecHWDevId,aCrop);
691 PRINT((_L("CVDecTestEngine::SetInputCropOptionsL, Out")))
694 /* ----------------------------------------------------------------------------
695 * Name: CVDecTestEngine::SetYuvToRgbOptionsL()
696 * Purpose: Set Yuv to Rgb options
698 * Parameters: TYuvToRgbOptions aOptions
700 * --------------------------------------------------------------------------*/
702 void CVDecTestEngine::SetYuvToRgbOptionsL(TInt aHWDevice, TYuvToRgbOptions aOptions)
704 PRINT((_L("CVDecTestEngine::SetYuvToRgbOptionsL, In")))
706 if (aHWDevice == EPostProcessor)
708 iDevvp->SetYuvToRgbOptionsL(iPostProcId, aOptions);
712 iDevvp->SetYuvToRgbOptionsL(iDecHWDevId, aOptions);
715 PRINT((_L("CVDecTestEngine::SetYuvToRgbOptionsL, Out")))
719 /* ----------------------------------------------------------------------------
720 * Name: CVDecTestEngine::SetRotateOptionsL()
721 * Purpose: Set Rotation
723 * Parameters: TRotationType aRotation
725 * --------------------------------------------------------------------------*/
726 void CVDecTestEngine::SetRotateOptionsL(TInt aHWDevice, TRotationType aRotation)
728 PRINT((_L("CVDecTestEngine::SetRotateOptionsL, In")))
730 if (aHWDevice == EPostProcessor)
732 iDevvp->SetRotateOptionsL(iPostProcId, aRotation);
736 iDevvp->SetRotateOptionsL(iDecHWDevId, aRotation);
739 PRINT((_L("CVDecTestEngine::SetRotateOptionsL, Out")))
743 /* ----------------------------------------------------------------------------
744 * Name: CVDecTestEngine::SetScaleOptionsL()
745 * Purpose: Set Scale with multiply factor
747 * Parameters: TSize aSize, TBool aAntiAliasFiltering
749 * --------------------------------------------------------------------------*/
750 void CVDecTestEngine::SetScaleOptionsL(TInt aHWDevice, TSize aSize, TBool aAntiAliasFiltering)
752 PRINT((_L("CVDecTestEngine::SetScaleOptionsL, In")));
754 if (aHWDevice == EPostProcessor)
756 iDevvp->SetScaleOptionsL(iPostProcId, aSize, aAntiAliasFiltering);
760 iDevvp->SetScaleOptionsL(iDecHWDevId, aSize, aAntiAliasFiltering);
763 PRINT((_L("CVDecTestEngine::SetScaleOptionsL, Scale option is set:width[%d],height[%d]"), aSize.iWidth,aSize.iHeight))
765 PRINT((_L("CVDecTestEngine::SetScaleOptionsL, Out")));
768 /* ----------------------------------------------------------------------------
769 * Name: CVDecTestEngine::SetScaleOptionsL()
770 * Purpose: Set Scale with multiply factor
772 * Parameters: TInt aNumFactor,TInt aDenoFactor, TBool aAntiAliasFiltering
774 * --------------------------------------------------------------------------*/
775 void CVDecTestEngine::SetScaleOptionsL(TInt aNumFactor,TInt aDenoFactor, TBool aAntiAliasFiltering)
777 PRINT((_L("CVDecTestEngine::SetScaleOptionsL, Out")));
779 TInt width = static_cast<TInt>(iPictureSize.iWidth*aNumFactor/aDenoFactor);
780 TInt height = static_cast<TInt>(iPictureSize.iHeight*aNumFactor/aDenoFactor);
782 TSize target(width, height);
784 iDevvp->SetScaleOptionsL(iPostProcId, target, aAntiAliasFiltering);
785 PRINT((_L("CVDecTestEngine::SetScaleOptionsL, Scale option is set:width[%d],height[%d]"),target.iWidth,target.iHeight))
787 PRINT((_L("CVDecTestEngine::SetScaleOptionsL, Out")));
791 /* ----------------------------------------------------------------------------
792 * Name: CVDecTestEngine::SetOutputCropOptionsL()
793 * Purpose: Set output crop
795 * Parameters: TRect aCrop
797 * --------------------------------------------------------------------------*/
798 void CVDecTestEngine::SetOutputCropOptionsL(TInt aHWDevice, TRect aCrop)
800 PRINT((_L("CVDecTestEngine::SetOutputCropOptionsL, In")));
802 if (aHWDevice == EPostProcessor)
804 iDevvp->SetOutputCropOptionsL(iPostProcId, aCrop);
808 iDevvp->SetOutputCropOptionsL(iDecHWDevId, aCrop);
811 PRINT((_L("CVDecTestEngine::SetOutputCropOptionsL, Out")));
815 /* ----------------------------------------------------------------------------
816 * Name: CVDecTestEngine::CommitL()
817 * Purpose: commit change of postprocessors after intialization or revert
821 * --------------------------------------------------------------------------*/
823 void CVDecTestEngine::CommitL()
825 PRINT((_L("CVDecTestEngine::CommitL, In")));
829 PRINT((_L("CVDecTestEngine::CommitL, Out")));
832 /* ----------------------------------------------------------------------------
833 * Name: CVDecTestEngine::Revert()
834 * Purpose: Revert any configuration changes that have not yet been committed
838 * --------------------------------------------------------------------------*/
839 void CVDecTestEngine::Revert()
841 PRINT((_L("CVDecTestEngine::Revert, In")));
845 PRINT((_L("CVDecTestEngine::Revert, Out")));
848 /* ----------------------------------------------------------------------------
849 * Name: CVDecTestEngine::SetClockSource()
850 * Purpose: Set SetHrdVbvSpec
851 * Note: This is called before initilaized
852 * Parameters: THrdVbvSpecification aHrdVbvSpec
854 * --------------------------------------------------------------------------*/
856 void CVDecTestEngine::SetClockSource()
858 PRINT((_L("CVDecTestEngine::SetClockSource, In")))
860 iDevvp->SetClockSource(iClock);
862 PRINT((_L("CVDecTestEngine::SetClockSource, Out")))
865 /* ----------------------------------------------------------------------------
866 * Name: CVDecTestEngine::SetHrdVbvSpec()
867 * Purpose: Set SetHrdVbvSpec
868 * Note: This is called before initilaized
869 * Parameters: THrdVbvSpecification aHrdVbvSpec
871 * --------------------------------------------------------------------------*/
873 void CVDecTestEngine::SetHrdVbvSpec(THrdVbvSpecification aHrdVbvSpec, const TDesC8& aHrdVbvParams)
875 PRINT((_L("CVDecTestEngine::SetHrdVbvSpec, In")))
877 iDevvp->SetHrdVbvSpec(aHrdVbvSpec, aHrdVbvParams);
879 PRINT((_L("CVDecTestEngine::SetHrdVbvSpec, Out")))
882 /* ----------------------------------------------------------------------------
883 * Name: CVDecTestEngine::SetPostProcSpecificOptionsL()
884 * Purpose: Set SetHrdVbvSpec
885 * Note: This is called before initilaized
886 * Parameters: THrdVbvSpecification aHrdVbvSpec
888 * --------------------------------------------------------------------------*/
890 void CVDecTestEngine::SetPostProcSpecificOptionsL(TInt aHWDevice, const TDesC8& aOptions)
892 PRINT((_L("CVDecTestEngine::SetPostProcSpecificOptionsL, In")))
894 if (aHWDevice == EPostProcessor)
896 iDevvp->SetPostProcSpecificOptionsL(iPostProcId, aOptions);
900 iDevvp->SetPostProcSpecificOptionsL(iDecHWDevId, aOptions);
903 PRINT((_L("CVDecTestEngine::SetPostProcSpecificOptionsL, Out")))
906 /* ----------------------------------------------------------------------------
907 * Name: CVDecTestEngine::SetScreenClipRegion()
908 * Purpose: Set SetHrdVbvSpec
909 * Note: This is called before initilaized
910 * Parameters: THrdVbvSpecification aHrdVbvSpec
912 * --------------------------------------------------------------------------*/
914 void CVDecTestEngine::SetScreenClipRegion(TRegion& aRegion)
916 PRINT((_L("CVDecTestEngine::SetScreenClipRegion, In")))
918 iDevvp->SetScreenClipRegion(aRegion);
920 PRINT((_L("CVDecTestEngine::SetScreenClipRegion, Out")))
923 /* ----------------------------------------------------------------------------
924 * Name: CVDecTestEngine::SetPauseOnClipFail()
925 * Purpose: Set SetHrdVbvSpec
926 * Note: This is called before initilaized
927 * Parameters: THrdVbvSpecification aHrdVbvSpec
929 * --------------------------------------------------------------------------*/
931 void CVDecTestEngine::SetPauseOnClipFail(TBool aPause)
933 PRINT((_L("CVDecTestEngine::SetPauseOnClipFail, In")))
935 iDevvp->SetPauseOnClipFail(aPause);
937 PRINT((_L("CVDecTestEngine::SetPauseOnClipFail, Out")))
940 /* ----------------------------------------------------------------------------
941 * Name: CVDecTestEngine::IsPlaying()
942 * Purpose: Set SetHrdVbvSpec
943 * Note: This is called before initilaized
944 * Parameters: THrdVbvSpecification aHrdVbvSpec
946 * --------------------------------------------------------------------------*/
948 void CVDecTestEngine::IsPlaying()
950 PRINT((_L("CVDecTestEngine::IsPlaying, In")))
952 TUint playing = iDevvp->IsPlaying();
953 PRINT((_L("CVDecTestEngine::IsPlaying, [%d]"), playing))
955 PRINT((_L("CVDecTestEngine::IsPlaying, Out")))
959 /* ----------------------------------------------------------------------------
960 * Name: CVDecTestEngine::GetPictureCounters()
961 * Purpose: Set SetHrdVbvSpec
962 * Note: This is called before initilaized
963 * Parameters: THrdVbvSpecification aHrdVbvSpec
965 * --------------------------------------------------------------------------*/
967 void CVDecTestEngine::GetPictureCounters()
969 PRINT((_L("CVDecTestEngine::GetPictureCounters, In")))
971 CMMFDevVideoPlay::TPictureCounters counters;
972 iDevvp->GetPictureCounters(counters);
974 PRINT((_L("CVDecTestEngine::GetPictureCounters, iPicturesSkipped, [%d]"), counters.iPicturesSkipped))
975 PRINT((_L("CVDecTestEngine::GetPictureCounters, iPicturesDecoded, [%d]"), counters.iPicturesDecoded))
976 PRINT((_L("CVDecTestEngine::GetPictureCounters, iPicturesDisplayed, [%d]"), counters.iPicturesDisplayed))
977 PRINT((_L("CVDecTestEngine::GetPictureCounters, iTotalPictures, [%d]"), counters.iTotalPictures))
979 PRINT((_L("CVDecTestEngine::GetPictureCounters, Out")))
982 /* ----------------------------------------------------------------------------
983 * Name: CVDecTestEngine::NumFreeBuffers()
984 * Purpose: Set SetHrdVbvSpec
985 * Note: This is called before initilaized
986 * Parameters: THrdVbvSpecification aHrdVbvSpec
988 * --------------------------------------------------------------------------*/
990 void CVDecTestEngine::NumFreeBuffers()
992 PRINT((_L("CVDecTestEngine::NumFreeBuffers, In")))
994 TUint playing = iDevvp->NumFreeBuffers();
995 PRINT((_L("CVDecTestEngine::NumFreeBuffers, [%d]"), playing))
997 PRINT((_L("CVDecTestEngine::NumFreeBuffers, Out")))
1001 /* ----------------------------------------------------------------------------
1002 * Name: CVDecTestEngine::NumComplexityLevels()
1003 * Purpose: Set SetHrdVbvSpec
1004 * Note: This is called before initilaized
1005 * Parameters: THrdVbvSpecification aHrdVbvSpec
1007 * --------------------------------------------------------------------------*/
1009 void CVDecTestEngine::NumComplexityLevels(TInt aHWDevice)
1011 PRINT((_L("CVDecTestEngine::NumComplexityLevels, In")))
1014 if (aHWDevice == EPostProcessor)
1016 number = iDevvp->NumComplexityLevels(iPostProcId);
1020 number = iDevvp->NumComplexityLevels(iDecHWDevId);
1023 PRINT((_L("CVDecTestEngine::NumComplexityLevels, [%d]"), number))
1025 PRINT((_L("CVDecTestEngine::NumComplexityLevels, Out")))
1028 /* ----------------------------------------------------------------------------
1029 * Name: CVDecTestEngine::InputEnd()
1030 * Purpose: Set SetHrdVbvSpec
1031 * Note: This is called before initilaized
1032 * Parameters: THrdVbvSpecification aHrdVbvSpec
1034 * --------------------------------------------------------------------------*/
1036 void CVDecTestEngine::InputEnd()
1038 PRINT((_L("CVDecTestEngine::InputEnd, In")))
1042 PRINT((_L("CVDecTestEngine::InputEnd, Out")))
1045 /* ----------------------------------------------------------------------------
1046 * Name: CVDecTestEngine::GetNewPictureInfo()
1047 * Purpose: Set SetHrdVbvSpec
1048 * Note: This is called before initilaized
1049 * Parameters: THrdVbvSpecification aHrdVbvSpec
1051 * --------------------------------------------------------------------------*/
1053 void CVDecTestEngine::GetNewPictureInfo(TTimeIntervalMicroSeconds& aEarliestTimestamp,
1054 TTimeIntervalMicroSeconds& aLatestTimestamp)
1056 PRINT((_L("CVDecTestEngine::GetNewPictureInfo, In")))
1059 iDevvp->GetNewPictureInfo(numbers, aEarliestTimestamp, aLatestTimestamp);
1060 PRINT((_L("CVDecTestEngine::GetNewPictureInfo, [%d]"), numbers))
1062 PRINT((_L("CVDecTestEngine::GetNewPictureInfo, Out")))
1066 /* ----------------------------------------------------------------------------
1067 * Name: CVDecTestEngine::GetTimedSnapshotL()
1068 * Purpose: Set SetHrdVbvSpec
1069 * Note: This is called before initilaized
1070 * Parameters: THrdVbvSpecification aHrdVbvSpec
1072 * --------------------------------------------------------------------------*/
1074 void CVDecTestEngine::GetTimedSnapshotL(const TUncompressedVideoFormat& aFormat,
1075 const TTimeIntervalMicroSeconds& aPresentationTimestamp)
1077 PRINT((_L("CVDecTestEngine::GetTimedSnapshotL, In")))
1079 iPictureDataSnapshot.iDataFormat = aFormat.iDataFormat;
1080 iPictureDataSnapshot.iDataSize = iPictureSize;
1082 PrintUncompressedFormat(aFormat);
1084 iDevvp->GetTimedSnapshotL(&iPictureDataSnapshot, aFormat, aPresentationTimestamp);
1086 PRINT((_L("CVDecTestEngine::GetTimedSnapshotL, Out")))
1089 /* ----------------------------------------------------------------------------
1090 * Name: CVDecTestEngine::GetTimedSnapshotL()
1091 * Purpose: Set SetHrdVbvSpec
1092 * Note: This is called before initilaized
1093 * Parameters: THrdVbvSpecification aHrdVbvSpec
1095 * --------------------------------------------------------------------------*/
1097 void CVDecTestEngine::GetTimedSnapshotL(const TUncompressedVideoFormat& aFormat,
1098 const TPictureId& aPictureId)
1100 PRINT((_L("CVDecTestEngine::GetTimedSnapshotL, In")))
1102 iPictureDataSnapshot.iDataFormat = aFormat.iDataFormat;
1103 iPictureDataSnapshot.iDataSize = iPictureSize;
1105 PrintUncompressedFormat(aFormat);
1107 iDevvp->GetTimedSnapshotL(&iPictureDataSnapshot, aFormat, aPictureId);
1109 PRINT((_L("CVDecTestEngine::GetTimedSnapshotL, Out")))
1112 /* ----------------------------------------------------------------------------
1113 * Name: CVDecTestEngine::CancelTimedSnapshot()
1114 * Purpose: Set SetHrdVbvSpec
1115 * Note: This is called before initilaized
1116 * Parameters: THrdVbvSpecification aHrdVbvSpec
1118 * --------------------------------------------------------------------------*/
1120 void CVDecTestEngine::CancelTimedSnapshot()
1122 PRINT((_L("CVDecTestEngine::CancelTimedSnapshot, In")))
1124 iDevvp->CancelTimedSnapshot();
1126 PRINT((_L("CVDecTestEngine::CancelTimedSnapshot, Out")))
1129 /* ----------------------------------------------------------------------------
1130 * Name: CVDecTestEngine::GetSupportedSnapshotFormatsL()
1131 * Purpose: Set SetHrdVbvSpec
1132 * Note: This is called before initilaized
1133 * Parameters: THrdVbvSpecification aHrdVbvSpec
1135 * --------------------------------------------------------------------------*/
1137 void CVDecTestEngine::GetSupportedSnapshotFormatsL()
1139 PRINT((_L("CVDecTestEngine::GetSupportedSnapshotFormatsL, In")))
1141 RArray<TUncompressedVideoFormat> formats;
1142 CleanupClosePushL(formats);
1144 iDevvp->GetSupportedSnapshotFormatsL(formats);
1146 for (TUint i = 0; i < formats.Count(); i++)
1148 PRINT((_L("CVDecTestEngine::GetSupportedSnapshotFormatsL, Format No.%d"), i))
1149 PrintUncompressedFormat(formats[i]);
1151 CleanupStack::PopAndDestroy(&formats);
1153 PRINT((_L("CVDecTestEngine::GetSupportedSnapshotFormatsL, Out")))
1157 /* ----------------------------------------------------------------------------
1158 * Name: CVDecTestEngine::SetComplexityLevel()
1159 * Purpose: Set Complexity Level of Decode and postprocessor
1160 * Note: This is called after initilaized
1161 * Parameters: TInt aDecLevel, TInt aPostProcLevel
1163 * --------------------------------------------------------------------------*/
1165 void CVDecTestEngine::SetComplexityLevel(TInt aHWDevice, TInt aLevel)
1167 PRINT((_L("CVDecTestEngine::SetComplexityLevel, In")))
1169 if (aHWDevice == EPostProcessor)
1171 iDevvp->SetComplexityLevel(iPostProcId, aLevel);
1175 iDevvp->SetComplexityLevel(iDecHWDevId, aLevel);
1178 PRINT((_L("CVDecTestEngine::SetComplexityLevel, Out")))
1183 /* ----------------------------------------------------------------------------
1184 * Name: CVDecTestEngine::GetComplexityLevelInfo()
1185 * Purpose: Get number and information of Complexity Level of Decode and postprocessor
1186 * Note: This is called after initilaized
1189 * --------------------------------------------------------------------------*/
1191 void CVDecTestEngine::GetComplexityLevelInfo(TInt aHWDevice, TInt aLevel)
1193 PRINT((_L("CVDecTestEngine::GetComplexityLevelInfo, In")))
1195 CMMFDevVideoPlay::TComplexityLevelInfo info;
1197 if (aHWDevice == EPostProcessor)
1199 iDevvp->GetComplexityLevelInfo(iPostProcId, aLevel, info);
1203 iDevvp->GetComplexityLevelInfo(iDecHWDevId, aLevel, info);
1206 PRINT((_L("CVDecTestEngine::GetComplexityLevelInfo, dec complexy level info[%x]"),info.iOptions))
1207 PRINT((_L("CVDecTestEngine::GetComplexityLevelInfo, iAvgPictureRate [%f]"),info.iAvgPictureRate))
1208 PRINT((_L("CVDecTestEngine::GetComplexityLevelInfo, iPictureSize width [%d] height[%d]"),info.iPictureSize.iWidth, info.iPictureSize.iHeight))
1209 PRINT((_L("CVDecTestEngine::GetComplexityLevelInfo, iRelativeImageQuality [%f]"),info.iRelativeImageQuality))
1210 PRINT((_L("CVDecTestEngine::GetComplexityLevelInfo, iRequiredMIPS [%d]"),info.iRequiredMIPS))
1211 PRINT((_L("CVDecTestEngine::GetComplexityLevelInfo, iRelativeProcessTime [%f]"),info.iRelativeProcessTime))
1213 PRINT((_L("CVDecTestEngine::GetComplexityLevelInfo, Out")))
1217 /* ----------------------------------------------------------------------------
1218 * Name: CVDecTestEngine::Redraw()
1219 * Purpose: Redraw latest picture
1220 * Note: only applicable when DSA is used and after initilaized
1223 * --------------------------------------------------------------------------*/
1225 void CVDecTestEngine::Redraw()
1227 PRINT((_L("CVDecTestEngine::Redraw, In")))
1231 PRINT((_L("CVDecTestEngine::Redraw, Out")))
1236 /* ----------------------------------------------------------------------------
1237 * Name: CVDecTestEngine::GetSnapshotL()
1242 * --------------------------------------------------------------------------*/
1244 void CVDecTestEngine::GetSnapshotL(TUncompressedVideoFormat& aFormat)
1246 PRINT((_L("CVDecTestEngine::GetSnapshotL, In")))
1249 TInt err = KErrNone;
1251 TPictureData picture;
1253 picture.iDataFormat = aFormat.iDataFormat;
1254 picture.iDataSize = iPictureSize;
1256 PRINT((_L("CVDecTestEngine::GetSnapshotL, before new []")))
1257 TUint8* data = new (ELeave)TUint8[iPictureSize.iWidth*iPictureSize.iHeight*2];
1258 PRINT((_L("CVDecTestEngine::GetSnapshotL, after new[]")))
1260 TPtr8 dataPtr(data, iPictureSize.iWidth*iPictureSize.iHeight*2);
1261 picture.iRawData = &dataPtr;
1263 CleanupStack::PushL(data);
1266 PRINT((_L("CVDecTestEngine::GetSnapshotL, mem alloc, data") ))
1268 PRINT((_L("CVDecTestEngine::GetSnapshotL, before snapshot")))
1269 result = iDevvp->GetSnapshotL(picture, aFormat);
1271 PRINT((_L("CVDecTestEngine::GetSnapshotL, snapshot received")))
1278 newFile.Append(iInFileName);
1280 temp2.Copy(newFile);
1281 PRINT((_L("CVDecTestEngine::GetSnapshotL, Opening the file [%S]"), &temp2))
1282 newFile.Delete(newFile.Length()-4, 4);
1283 newFile.Append(_L8("_snapshot"));
1284 newFile.Append(_L8(".yuv"));
1285 filename.Copy(newFile);
1290 PRINT((_L("CVDecTestEngine::GetSnapshotL, Opening the file [%S]"), &temp))
1291 err = snapshot.Replace(iFs, filename, EFileShareExclusive|EFileWrite);
1293 PRINT((_L("CVDecTestEngine::GetSnapshotL, writing the file")))
1295 if ( err!= KErrNone )
1297 PRINT((_L("CVDecTestEngine::GetSnapshotL, snapshot file open failed")))
1303 PRINT((_L("CVDecTestEngine::GetSnapshotL, Picture size %d"),picture.iRawData->Size()));
1304 PRINT((_L("CVDecTestEngine::GetSnapshotL, Picture length %d"),picture.iRawData->Length()));
1305 err = snapshot.Write(*(picture.iRawData),picture.iRawData->Size());
1306 if ( err!= KErrNone )
1308 PRINT((_L("CVDecTestEngine::GetSnapshotL, snapshot file write failed [%d]"), picture.iRawData->Size()))
1313 PRINT((_L("CVDecTestEngine::GetSnapshotL, Picture size %d"),picture.iRawData->Size()));
1319 PRINT((_L("CVDecTestEngine::GetSnapshotL, Error getting snapshot [%d]"), result))
1321 CleanupStack::PopAndDestroy( data );
1324 PRINT((_L("CVDecTestEngine::GetSnapShotL, mem del, ") ))
1326 PRINT((_L("CVDecTestEngine::GetSnapshotL, Out")))
1331 /* ----------------------------------------------------------------------------
1332 * Name: CVDecTestEngine::OpenFileL()
1333 * Purpose: Open input File
1334 * Note: DSA is used, output is display
1335 * Parameters: TFileName& aInFileName
1337 * --------------------------------------------------------------------------*/
1339 void CVDecTestEngine::OpenFileL(TFileName& aInFileName)
1341 PRINT((_L("CVDecTestEngine::OpenFileL, In")))
1343 iInFileName.Copy(aInFileName);
1345 if ( (err = iInFile.Open(iFs, aInFileName, EFileRead | EFileShareReadersOnly)) != KErrNone)
1347 PRINT((_L("CVDecTestEngine::OpenFiles, Input File open Failed")));
1350 PRINT((_L("CVDecTestEngine::OpenFileL, Out")))
1354 /* ----------------------------------------------------------------------------
1355 * Name: CVDecTestEngine::OpenFileL()
1356 * Purpose: Open input and output File
1357 * Note: Memory buffer output is used
1358 * Parameters: TFileName& aOutFileName, TFileName& aInFileName
1360 * --------------------------------------------------------------------------*/
1363 void CVDecTestEngine::OpenFileL(TFileName& aOutFileName, TFileName& aInFileName)
1365 PRINT((_L("CVDecTestEngine::OpenFileL, In")))
1366 TInt err = KErrNone;
1368 iInFileName.Copy(aInFileName);
1369 iOutFileName.Copy(aOutFileName);
1370 err = iInFile.Open(iFs, aInFileName, EFileRead | EFileShareReadersOnly);
1372 if ( err != KErrNone)
1374 PRINT((_L("CVDecTestEngine::OpenFiles, Input File open Failed")));
1379 iOutFileOpen = ETrue;
1380 err = iOutFile.Replace(iFs, aOutFileName, EFileShareExclusive|EFileWrite);
1382 if ( err!= KErrNone )
1384 PRINT((_L("CVDecTestEngine::OpenFiles, Output File Replace Failed")));
1390 AssertTIntEqualL(KErrNone,err);
1391 PRINT((_L("CVDecTestEngine::OpenFileL, Out")))
1396 /* ----------------------------------------------------------------------------
1397 * Name: CVDecTestEngine::CloseFile()
1398 * Purpose: Close File
1402 * --------------------------------------------------------------------------*/
1405 void CVDecTestEngine::CloseFile()
1413 PRINT((_L("CVDecTestEngine::CloseFile, Output file closed")))
1416 PRINT((_L("CVDecTestEngine::CloseFile, File Closed")))
1418 if( iCorruptMarker )
1420 iFs.Delete( iOutFileName );
1427 /* ----------------------------------------------------------------------------
1428 * Name: CVDecTestEngine::FrameJump()
1429 * Purpose: Jump backward or forward a number of frames
1431 * Parameters: TInt aNumToJump
1433 * --------------------------------------------------------------------------*/
1434 TInt CVDecTestEngine::FrameJump(TInt aNumToJump )
1436 PRINT((_L("CVDecTestEngine::FrameJump, In")))
1437 TInt err = KErrNone;
1439 if ( iState == ERunning )
1441 if ( iSynchronized )
1443 iClock->Suspend(); //Stop Clock source
1449 PRINT((_L("CVDecTestEngine::Pause(), Paused")))
1452 iFrameJump = aNumToJump;
1455 if( iFrameJump < 0 )
1457 TInt startFrame = iSentBuffCount + iFrameJump;
1458 if( startFrame < 0 )
1460 PRINT((_L("CVDecTestEngine::FrameJump, bad argument")))
1461 return KErrArgument;
1465 iFrameJump = startFrame;
1468 TInt beginningPos = 0;
1469 iInFile.Seek(ESeekStart, beginningPos);
1470 RArray<TInt> vFramesizes;
1471 ListFrameSizeL( vFramesizes );
1473 if( iFrameSizeList.Count() > iFrameJump )
1475 TInt startPosition = 0;
1476 for( TInt frameCounter = 0; frameCounter < iFrameSizeList.Count();
1479 startPosition += iFrameSizeList[ frameCounter ];
1481 iInFile.Seek(ESeekStart,startPosition);
1486 PRINT((_L("CVDecTestEngine::FrameJump, iFrameSizeList.Count value:[%ld]"),iFrameSizeList.Count()))
1495 PRINT((_L("CVDecTestEngine::FrameJump, iFrameJump value:[%ld]"),iFrameJump))
1496 PRINT((_L("CVDecTestEngine::FrameJump, Out")))
1503 /* ----------------------------------------------------------------------------
1504 * Name: CVDecTestEngine::SetFrameMatch()
1505 * Purpose: The test case fails if input and output frame number doesn't
1508 * Parameters: TBool aMatch
1510 * --------------------------------------------------------------------------*/
1511 void CVDecTestEngine::SetFrameMatch(TBool aMatch)
1514 iFrameMatch = aMatch;
1516 PRINT((_L("CVDecTestEngine::SetFrameMatch, frame match is set")))
1520 /* ----------------------------------------------------------------------------
1521 * Name: CVDecTestEngine::Initialize()
1522 * Purpose: Initilize Decoder/Postprocessor
1524 * Parameters: TBool aSynchronized
1526 * --------------------------------------------------------------------------*/
1529 TInt CVDecTestEngine::Initialize()
1531 PRINT((_L("CVDecTestEngine::Initialize, In")))
1535 // Do Initialization
1536 iDevvp->Initialize();
1537 PRINT((_L("CVDecTestEngine::Initialize, Initialize() returned")))
1538 if ( (iState != EInitialized) && (iError == KErrNone ) )
1540 iScheduler = new (ELeave) CActiveSchedulerWait;
1543 PRINT((_L("CVDecTestEngine::Initialize, mem alloc, iScheduler") ))
1546 iScheduler->Start();
1548 PRINT((_L("CVDecTestEngine::Initialize, out: error[%d]"),iError))
1552 /* ----------------------------------------------------------------------------
1553 * Name: CVDecTestEngine::InitializeAndDelete()
1554 * Purpose: Initilize Decoder/Postprocessor
1556 * Parameters: TBool aSynchronized
1558 * --------------------------------------------------------------------------*/
1561 TInt CVDecTestEngine::InitializeAndDelete()
1563 PRINT((_L("CVDecTestEngine::InitializeAndDelete, In")))
1565 iDeleteDecoderFromInitComp = ETrue;
1567 TInt err = Initialize();
1569 PRINT((_L("CVDecTestEngine::InitializeAndDelete, Out")))
1573 /* ----------------------------------------------------------------------------
1574 * Name: CVDecTestEngine::Start()
1575 * Purpose: Start Decoding/Postprocessing
1579 * --------------------------------------------------------------------------*/
1582 TInt CVDecTestEngine::Start(TBool aInputEnd)
1585 TInt err = KErrNone;
1586 iDisableInputEnd = aInputEnd;
1588 PRINT((_L("CVDecTestEngine::Start, Devvideo play started")))
1591 if ( iDirectScreenAccess && !iDsaStarted )
1593 TRAPD(err, StartDirectScreenAccessL());
1594 if (err != KErrNone)
1601 // Start DevVideoPlay
1605 //Reset Clock at Stream Start
1606 if ( iSynchronized )
1608 TTimeIntervalMicroSeconds offset(KStartOffset);
1609 Int64 time = offset.Int64();
1610 iClock->Reset(offset);
1614 // Start Data transfer
1615 iDecTestAO->RequestData();
1617 PRINT((_L("CVDecTestEngine::Start, Start data transfer - start () out")))
1624 /* ----------------------------------------------------------------------------
1625 * Name: CVDecTestEngine::Stop()
1626 * Purpose: Stop Decoding/Postprocessing
1630 * --------------------------------------------------------------------------*/
1633 TInt CVDecTestEngine::Stop()
1636 PRINT((_L("CVDecTestEngine::Stop, In ")))
1638 if ( (iState == ERunning ) || (iState == EPaused) )
1643 PRINT((_L("CVDecTestEngine::Stop, Stopped ")))
1647 if ( iDirectScreenAccess && iDsaStarted )
1649 iDevvp->AbortDirectScreenAccess();
1650 iDsaStarted = EFalse;
1651 PRINT((_L("CVDecTestEngine::Stop, DSA is aborted ")))
1653 PRINT((_L("CVDecTestEngine::VDecTestStartL, the number of Pictures sent: [%d]"),iSentBuffCount))
1656 else if ( iInputEnd )
1658 if ( iSentBuffCount != (iReturnedBuffCount + iPictureLoss) )
1662 PRINT((_L("CVDecTestEngine::VDecTestStopL, the number of Pictures sent and returned does not match: ")))
1665 PRINT((_L("CVDecTestEngine::VDecTestStopL, the number of Pictures sent and returned does not match: ")))
1666 PRINT((_L("The number of pictures, sent : [%d], returned:[%d] "),iSentBuffCount, iReturnedBuffCount ))
1670 PRINT((_L("CVDecTestEngine::Stop, Out")))
1676 /* ----------------------------------------------------------------------------
1677 * Name: CVDecTestEngine::TearDown()
1678 * Purpose: Cleanup resources
1682 * --------------------------------------------------------------------------*/
1685 void CVDecTestEngine::TearDown()
1687 PRINT((_L("CVDecTestEngine::TearDown(),In")))
1689 if( iInstantFpsEnabled )
1692 PRINT((_L("CVDecTestEngine::CloseFile, FPS Output file closed")))
1697 iDevvp->AbortDirectScreenAccess();
1698 PRINT((_L("CVDecTestEngine::TearDown(), Dsa aborted")))
1701 // Delete Devvideo play
1707 PRINT((_L("CVDecTestEngine::TearDown, mem del, iDevvp") ))
1710 iState = EStateNone;
1711 PRINT((_L("CVDecTestEngine::TearDown(),DevVideo deleted")))
1715 //Postproc input buffer
1716 if ( !iCIBuffMgmtOn && iRawInBuffer)
1718 delete (TUint8*)iRawInBuffer->iData.iRawData->Ptr();
1719 delete iRawInBuffer->iData.iRawData;
1720 delete iRawInBuffer;
1723 PRINT((_L("CVDecTestEngine::TearDown, mem del, iRawInBuffer & its 2 pointers") ))
1725 iRawInBuffer = NULL;
1728 if ( iScreenDevice )
1730 delete iScreenDevice;
1731 iScreenDevice = NULL;
1734 PRINT((_L("CVDecTestEngine::TearDown, mem del, iScreenDevice") ))
1736 RFbsSession::Disconnect();
1742 PRINT((_L("CVDecTestEngine::TearDown, mem del, iDataChunk") ))
1747 iFrameSizeList.Close();
1749 iInstantFpsList.Close();
1753 REComSession::FinalClose();
1754 PRINT( (_L("CVDecTestEngine::TearDown(), mem allocated: %d "), iMemAlloc))
1755 PRINT( (_L("CVDecTestEngine::TearDown(), mem deleted: %d "), iMemDelete))
1756 PRINT((_L("CVDecTestEngine::TearDown(),Out")))
1761 /* ----------------------------------------------------------------------------
1762 * Name: CVDecTestEngine::FillAndSendBufferL()
1763 * Purpose: Fill data into input buffer and send to devvideoplay
1767 * --------------------------------------------------------------------------*/
1770 void CVDecTestEngine::FillAndSendBufferL()
1772 PRINT((_L("CVDecTestEngine::FillAndSendBufferL(), In")))
1773 TInt err = KErrNone;
1777 iLastFrame = EFalse;
1778 //iCodedInBuffer->iOptions = TVideoInputBuffer::EDecodingTimestamp;
1779 //iCodedInBuffer->iDecodingTimestamp = iSentBuffCount+2;
1780 //ReadOneCodedPicture(iCodedInBuffer, 0); // Read compressed data of one picture from file
1781 //iDevvp->WriteCodedDataL(iCodedInBuffer); // Input Data Sent to Decoder
1782 if (!iDisableInputEnd)
1785 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Input End")))
1790 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Stream end")))
1797 PRINT((_L("CVDecTestEngine::FillAndSendBufferL(), iDecHWDevID found")))
1798 if ( iFrameSizeList.Count() > 0 )
1800 if (iFrameSizeList.Count() <= iSentBuffCount+1)
1804 TInt size = iFrameSizeList[iSentBuffCount];
1805 err = ReadOneCodedPicture(iCodedInBuffer, size); // Read compressed data of one picture from file
1807 PRINT((_L("CVDecTestEngine::FillAndSendBufferL(), 1 picture read")))
1809 if( iFrameDropMarker )
1811 if( iFrameDropCounter >= iFrameDropInterval )
1816 TInt size = iFrameSizeList[iSentBuffCount++];
1817 err = ReadOneCodedPicture(iCodedInBuffer, size); // Read compressed data of one picture from file
1819 iFrameDropNumCounter++;
1820 if( iFrameDropNumCounter >= iFrameDropNum )
1822 iFrameDropCounter = 0;
1823 iFrameDropNumCounter = 0;
1827 PRINT((_L("CVDecTestEngine::FillAndSendBufferL(), [%d] frame(s) dropped"), dropNum))
1835 err = ReadOneCodedPicture(iCodedInBuffer); // Read compressed data of one picture from file
1836 PRINT((_L("CVDecTestEngine::FillAndSendBufferL(), one picture read, err: [%d]"), err))
1838 if( iFrameDropMarker )
1840 if( iFrameDropCounter >= iFrameDropInterval )
1845 err = ReadOneCodedPicture(iCodedInBuffer);
1847 iFrameDropNumCounter++;
1848 if( iFrameDropNumCounter >= iFrameDropNum )
1850 iFrameDropCounter = 0;
1851 iFrameDropNumCounter = 0;
1855 PRINT((_L("CVDecTestEngine::FillAndSendBufferL(), [%d] frame(s) dropped"), dropNum))
1862 else // Postproc input case
1864 PRINT((_L("CVDecTestEngine::FillAndSendBufferL(), iDecHWDevID not found")))
1865 err = ReadRawPicture(); // Read raw data for one picture
1866 if( iFrameDropMarker )
1868 if( iFrameDropCounter >= iFrameDropInterval )
1873 err = ReadRawPicture(); // Read raw data for one picture
1875 iFrameDropNumCounter++;
1876 if( iFrameDropNumCounter >= iFrameDropNum )
1878 iFrameDropCounter = 0;
1879 iFrameDropNumCounter = 0;
1883 PRINT((_L("CVDecTestEngine::FillAndSendBufferL(), [%d] raw picture(s) dropped"), dropNum))
1888 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Empty buffer read skipping")))
1889 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Out")))
1893 // Corrupt the input if user requires
1895 if( iCorruptMarker )
1902 // End of the corrupting operation
1907 iCodedInBuffer->iOptions = TVideoInputBuffer::EDecodingTimestamp;
1911 iCodedInBuffer->iOptions |= TVideoInputBuffer::EPresentationTimestamp;
1916 if ( iSynchronized ) // Clock source is set >> real-time synchronization
1918 iCodedInBuffer->iDecodingTimestamp = iTimeStamp;
1921 iCodedInBuffer->iPresentationTimestamp = iTimeStamp;
1925 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, iTimestamp added:[%ld]"),iTimeStamp))
1926 iTimeStamp += iFrameTimeInterval;
1928 else // Clock source is not set
1930 iCodedInBuffer->iDecodingTimestamp = iSentBuffCount;
1933 iCodedInBuffer->iPresentationTimestamp = iSentBuffCount;
1938 TInt substreamID = 0;
1939 // iCodedInBuffer->iUser = (TAny*)(&substreamID);
1940 if(iCodedInBuffer->iUser != NULL ){
1941 *((TInt*)iCodedInBuffer->iUser) = substreamID;
1944 TUint32 msgSize = iCodedInBuffer->iData.Length();
1945 TUint8* tmpPtr = const_cast<TUint8 *>(iCodedInBuffer->iData.Ptr());
1950 PRINT((_L("TX:%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x,%02x"),tmpPtr[0],tmpPtr[1],tmpPtr[2],tmpPtr[3],tmpPtr[4],tmpPtr[5],tmpPtr[6],tmpPtr[7],tmpPtr[8],tmpPtr[9],tmpPtr[10],tmpPtr[11],tmpPtr[12],tmpPtr[13],tmpPtr[14],tmpPtr[15]))
1954 else if(msgSize >= 4)
1956 PRINT((_L("TX:%02x,%02x,%02x,%02x"),tmpPtr[0],tmpPtr[1],tmpPtr[2],tmpPtr[3]))
1962 for(TUint i = 0; i < msgSize; i++)
1964 PRINT((_L("TX: 0x%02x"),*tmpPtr++))
1971 iDevvp->WriteCodedDataL(iCodedInBuffer); // Input Data Sent to Decoder
1972 iCodedInBuffer = NULL;
1977 iRawInBuffer->iData.iDataSize.SetSize(iPictureSize.iWidth,iPictureSize.iHeight);
1979 iRawInBuffer->iOptions |= (TVideoPicture::ETimestamp);
1981 if ( iSynchronized )
1983 //TTimeIntervalMicroSeconds tsValue(iTimeStamp);
1984 iRawInBuffer->iTimestamp = iTimeStamp;
1985 iTimeStamp += iFrameTimeInterval;
1986 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, iTimestamp added:[%ld]"),iTimeStamp))
1990 iRawInBuffer->iTimestamp = iSentBuffCount;
1994 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, data size: w[%d] ,h[%d]"),iRawInBuffer->iData.iDataSize.iWidth, iRawInBuffer->iData.iDataSize.iHeight))
1995 iDevvp->WritePictureL(iRawInBuffer); // Input Data Sent to PostProcessor
2000 iRawInBuffer = NULL;
2005 iFrameDropCounter++;
2007 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Sent Frame: [%d] "),iSentBuffCount))
2013 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Error in reading data: [%d] "),iError))
2019 // if ( iFrameMeasurement )
2025 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Input end: sending last frame 0 ")))
2026 iDecTestAO->RequestData(); // Next Input Data for Decoder / PostProc
2030 if ( iState == ERunning )
2036 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Fast client request")))
2037 iDecTestAO->RequestData(); // Next Input Data for Decoder / PostProc
2041 if ( iDevvp->NumFreeBuffers() )
2043 iDecTestAO->RequestData(); // Next Input Data for Decoder / PostProc
2047 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, No input buffer available now")))
2055 PRINT((_L("CVDecTestEngine::FillAndSendBufferL, Out")))
2060 /* ----------------------------------------------------------------------------
2061 * Name: CVDecTestEngine::GetInputBufferL()
2062 * Purpose: Ritreave decoder input buffer
2066 * --------------------------------------------------------------------------*/
2069 void CVDecTestEngine::GetInputBufferL()
2071 TBool buffer = EFalse;
2073 if ( iState == ERunning )
2077 iCodedInBuffer = iDevvp->GetBufferL(iInBuffSize);
2078 if ( iCodedInBuffer )
2084 else if ( iCIBuffMgmtOn )
2086 PRINT((_L("CVDecTestEngine::GetInputBufferL(), Getting Input buffer(CI)...")))
2087 #ifdef __CI_HEADERS__
2088 TVideoPicture* inputBuff = iCIBuffMgmt->MmvbmGetBufferL(iPictureSize);
2092 iRawInBuffer = inputBuff;
2100 PRINT((_L("CVDecTestEngine::GetInputBufferL(), Got Input buffer")))
2101 FillAndSendBufferL();
2105 PRINT((_L("CVDecTestEngine::GetInputBufferL(), Couldn't get input buffer ")))
2112 /* ----------------------------------------------------------------------------
2113 * Name: CVDecTestEngine::ReadOneCodedPicture()
2114 * Purpose: Read one coded picture into decoder input buffer
2116 * Parameters: TVideoInputBuffer* aCodedInBuffer
2118 * --------------------------------------------------------------------------*/
2119 TInt CVDecTestEngine::ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer)
2121 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, In")))
2122 TInt buffLength = iInBuffSize;
2123 TBool found = EFalse;
2125 TUint8* testData =NULL;
2126 TInt err = KErrNone;
2129 if ( iCodecType == EVC1 )
2131 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, VC1")))
2132 return LoadNextFrameL(aCodedInBuffer);
2135 if ( aCodedInBuffer->iData.MaxLength() < buffLength )
2138 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Buffer is small, [%d]Byte"),aCodedInBuffer->iData.MaxLength()))
2143 aCodedInBuffer->iData.SetLength(0);
2145 //Buffer is not full, reset size of buffer
2146 if ( aCodedInBuffer->iData.Length() < buffLength)
2148 buffLength = aCodedInBuffer->iData.Length();
2151 testData = const_cast<TUint8*>(aCodedInBuffer->iData.Ptr());
2153 TUint8* iReadDataChunkTemp = iReadDataChunk;
2157 //Check the length of one coded picture
2158 if (iCodecType == EH263)
2160 TBool firstStartCode = EFalse;
2161 while (!iInputEnd && !found)
2163 TInt zeroCounter = 0;
2164 while ((byte = ReadByteFromFile()) == 0x00 && !iInputEnd)
2170 if ((zeroCounter >= 2) && ((byte & 0xFC) == 0x80))
2172 if (!firstStartCode)
2174 firstStartCode = ETrue;
2178 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, end of h263 picture found")))
2185 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, inputEndFound, %d"), pos))
2192 iReadDataChunk = iReadDataChunkTemp;
2193 ReadDataToBuffer(aCodedInBuffer, pos);
2196 else if ( iCodecType == EMPEG4 )
2198 TBool firstStartCode = EFalse;
2199 while (!iInputEnd && !found)
2201 TInt zeroCounter = 0;
2202 while ((byte = ReadByteFromFile()) == 0x00 && !iInputEnd)
2208 if ((zeroCounter >= 2) && (byte == 0x01))
2210 byte = ReadByteFromFile();
2213 if (byte == 0xB6 && !firstStartCode)
2215 firstStartCode = ETrue;
2217 else if (byte != 0xB1 && firstStartCode)
2219 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, end of mpeg-4 picture found [%d]"), pos-4))
2226 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, inputEndFound, %d"), pos))
2233 iReadDataChunk = iReadDataChunkTemp;
2234 ReadDataToBuffer(aCodedInBuffer, pos);
2236 else if ( iCodecType == EVP6 )
2238 TUint dataCount = 0;
2239 if (iSentBuffCount == 0)
2241 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, First VP6 frame")))
2242 //Read signature and version
2243 for (TUint i=0; i<5; i++)
2245 byte = ReadByteFromFile();
2247 TUint32 offset = (TUint32)(ReadByteFromFile())<< 24 | (TUint32)(ReadByteFromFile())<< 16 |
2248 (TUint32)(ReadByteFromFile())<< 8 | (TUint32)(ReadByteFromFile());
2250 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, offset %d"), offset))
2251 //Jump data after offset
2252 for (TUint i=0; i< offset-9; i++ )
2254 byte = ReadByteFromFile();
2256 dataCount += 9+offset-9;
2257 //Read previous tag size
2258 for (TUint i=0; i< 4; i++ )
2260 byte = ReadByteFromFile();
2267 TUint8 tagType = ReadByteFromFile();
2272 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, tagType %d"), tagType))
2274 while (tagType != 9 && !iInputEnd)
2276 TUint32 a = (TUint32)(ReadByteFromFile());
2277 TUint32 b = (TUint32)(ReadByteFromFile());
2278 TUint32 c = (TUint32)(ReadByteFromFile());
2279 TUint32 dataSize = (a << 16) | (b << 8) | (c);
2280 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, dataSize %d"), dataSize))
2281 ReadDataToBuffer(aCodedInBuffer, dataSize+7, ETrue);
2283 for (TUint i=0; i< 4; i++ )
2285 byte = ReadByteFromFile();
2287 tagType = ReadByteFromFile();
2288 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, tagType %d"), tagType))
2289 dataCount += dataSize+15;
2292 TUint32 a = (TUint32)(ReadByteFromFile());
2293 TUint32 b = (TUint32)(ReadByteFromFile());
2294 TUint32 c = (TUint32)(ReadByteFromFile());
2295 TUint32 dataSize = (a << 16) | (b << 8) | (c);
2296 //Discard timestamp and streamID
2297 for (TUint i=0; i< 7; i++ )
2299 byte = ReadByteFromFile();
2301 //Frametype and codec ID
2302 byte = ReadByteFromFile();
2303 //Read VP6 frame to buffer
2304 ReadDataToBuffer(aCodedInBuffer, dataSize-1);
2305 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, VP6 frame size %d"), dataSize))
2306 dataCount += dataSize+10;
2307 //Read previous tag size
2308 for (TUint i=0; i< 4; i++ )
2310 byte = ReadByteFromFile();
2314 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, unknown tags at the end of vp6 stream, discard")))
2321 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, inputEndFound")))
2322 //aCodedInBuffer.iData->Zero();
2326 else if ( iCodecType == EFLV )
2328 // FLV fileformat has 3 first bytes 'FLV'. Detect if file has container.
2329 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, find out bitstream type %d == %d."),iFLVFileType,EFLVNotSet));
2332 if(iFLVFileType == EFLVNotSet)
2334 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, find out bitstream type.")));
2336 byte = ReadByteFromFile();
2337 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, %02x"),byte));
2338 TUint8 byte2 = ReadByteFromFile();
2339 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, %02x"),byte2));
2340 TUint8 byte3 = ReadByteFromFile();
2341 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, %02x"),byte3));
2342 if ( (byte == 0x46) && (byte2 == 0x4C) && (byte3 == 0x56) )
2344 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, file with container detected.")));
2345 iFLVFileType = EFLVContainer;
2349 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, file raw bitstream detected.")));
2350 iFLVFileType = EFLVRaw;
2352 iReadDataChunk = iReadDataChunkTemp;
2355 if (iFLVFileType == EFLVContainer)
2357 // FLV frames have 00 00 x2 00 00 8x startcode, parse it.
2358 TBool firstStartCode = EFalse;
2359 TBool frameHeaderEnd = EFalse;
2360 TBool frameHeader = EFalse;
2361 while (!iInputEnd && !found)
2363 TInt zeroCounter = 0;
2364 while ((byte = ReadByteFromFile()) == 0x00 && !iInputEnd)
2370 if ((zeroCounter >= 2) && ((byte & 0xF8) == 0x80) && frameHeaderEnd)
2372 // FLV frames have some bytes in the beginning which needs to be removed
2375 iReadDataChunk = iReadDataChunkTemp;
2376 ReadDataToBuffer(aCodedInBuffer, pos-3);
2378 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, [%d] bytes of flash video frame header removed."), (iReadDataChunk - iReadDataChunkTemp)));
2379 iReadDataChunkTemp = iReadDataChunk;
2382 frameHeader = ETrue;
2384 else if (!firstStartCode)
2386 firstStartCode = ETrue;
2387 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, start of flash video picture found [%d]."), pos-3))
2392 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, end of flash video picture found [%d]"), pos-3))
2396 else if ((zeroCounter >= 2) && ((byte & 0x03) == 0x02))
2398 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, found frame end code at [%d]"), pos-3))
2400 frameHeaderEnd = ETrue;
2404 frameHeaderEnd = EFalse;
2409 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, inputEndFound, %d"), pos))
2412 // FLV file has four bytes which needs to be removed in the end
2417 // Go back to beginning of start code (3 bytes)
2419 // Go back to beginning of FLV file frame header(16 bytes)
2422 iReadDataChunk = iReadDataChunkTemp;
2423 ReadDataToBuffer(aCodedInBuffer, pos);
2425 // Raw flash bitstream file
2428 TBool firstStartCode = EFalse;
2429 while (!iInputEnd && !found)
2431 TInt zeroCounter = 0;
2432 while ((byte = ReadByteFromFile()) == 0x00 && !iInputEnd)
2438 if ((zeroCounter >= 2) && ((byte & 0xF8) == 0x80))
2440 if (!firstStartCode)
2442 firstStartCode = ETrue;
2446 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, end of flash video picture found [%d]"), pos-3))
2454 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, inputEndFound, %d"), pos))
2461 iReadDataChunk = iReadDataChunkTemp;
2462 ReadDataToBuffer(aCodedInBuffer, pos);
2465 else if ( iCodecType == EAVC )
2469 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, AU format case")))
2470 TBool auFound = EFalse;
2471 TBool firstMB = EFalse;
2472 TUint32 nalUnits = 0;
2473 TUint32 totalData = 0;
2474 iNalOffsetArray = new TUint32[KMaxNumberOfNals];
2475 iNalLengthArray = new TUint32[KMaxNumberOfNals];
2477 TInt previousNal = 0;
2480 TBool firstStartCode = EFalse;
2481 // Check if start code of Visual Object Sequence
2484 while (!iInputEnd && !found && !auFound)
2486 TInt zeroCounter = 0;
2487 while ((byte = ReadByteFromFile()) == 0x00 && !iInputEnd)
2493 if ((zeroCounter >= 2) && (byte == 0x01))
2495 if (!firstStartCode)
2497 firstStartCode = ETrue;
2498 nalStart = pos - KScLength;
2499 iNalOffsetArray[nalUnits] = pos+totalData;
2501 byte = ReadByteFromFile();
2504 if (((byte & 0x1F) == 7) && ( previousNal == 5 || previousNal == 1 ) )
2510 else if (((byte & 0x1F) == 5) || ((byte & 0x1F) == 1))
2512 byte = ReadByteFromFile();
2518 //NAL that belongs to the next AU
2519 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Next AU Nal Found")))
2526 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, First MB")))
2531 previousNal = byte & 0x1F;
2536 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, NAL start: [%d]"), nalStart ))
2537 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, end of h264 NAL found at [%d]"), pos ))
2541 GoBackInFile(KScLength); //go back before next start code
2546 if (!found && iInputEnd)
2549 if ( nalUnits == 0 )
2552 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture: pos: %d"),pos))
2553 iNalLengthArray[nalUnits] = pos;
2560 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Searching next NAL")))
2562 iNalLengthArray[nalUnits] = pos - 3 - nalStart;
2567 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, AU Found")))
2568 iReadDataChunk = iReadDataChunkTemp;
2569 ReadDataToBuffer(aCodedInBuffer, totalData);
2570 pos = totalData; //Set amount of data read from a file
2571 //Optional filler data to align the header at a 32-bit boundary
2572 while ((totalData % 4) != 0)
2574 testData[totalData] = 0;
2577 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Casting headerpointer")))
2578 TUint8* headerData = reinterpret_cast<TUint8*>(const_cast<TUint8*>(aCodedInBuffer->iData.Ptr()));
2579 TUint headerStart = totalData; //changing 8bit index to 32bit
2580 for (TUint i = 0; i < nalUnits; i++)
2582 *((TUint32*)&headerData[headerStart]) = static_cast<TUint32>(iNalOffsetArray[i]);
2583 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture: offset [%d] | [%d] "), iNalOffsetArray[i], headerData[headerStart]))
2584 *((TUint32*)&headerData[headerStart+4]) = static_cast<TUint32>(iNalLengthArray[i]);
2585 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture: size [%d] | [%d][%d][%d][%d] "), iNalLengthArray[i], headerData[headerStart+4],headerData[headerStart+5],headerData[headerStart+6],headerData[headerStart+7]))
2588 *((TUint32*)&headerData[headerStart]) = static_cast<TUint32>(nalUnits);
2590 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, deleting arrays")))
2591 delete iNalLengthArray;
2592 iNalLengthArray = NULL;
2594 delete iNalOffsetArray;
2595 iNalOffsetArray = NULL;
2598 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, mem del, iNalLengthArray") ))
2599 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, mem del, iNalOffsetArray") ))
2602 /*for (TUint i = 0; i < 100; i++)
2604 PRINT((_L("test data End [%d]"), testData[pos-100+i]))
2607 //Set Size to length of the header + one picure, and reset position to be read next time
2608 aCodedInBuffer->iData.SetLength(headerStart);
2609 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture,length of frame: [%d] "),pos))
2610 //TInt tempLength = pos - buffLength;
2611 //err = iInFile.Seek(ESeekCurrent,tempLength);
2618 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Bytestream case")))
2619 TBool auFound = EFalse;
2620 TBool firstMB = EFalse;
2621 TUint32 totalData = 0;
2622 TInt previousNal = 0;
2625 // Check if start code of Visual Object Sequence
2626 TBool firstStartCode = EFalse;
2629 while (!iInputEnd && !found)
2631 TInt zeroCounter = 0;
2632 while ((byte = ReadByteFromFile()) == 0x00 && !iInputEnd)
2638 if ((zeroCounter >= 2) && (byte == 0x01))
2640 if (!firstStartCode)
2642 firstStartCode = ETrue;
2643 nalStart = pos-KScLength;
2644 byte = ReadByteFromFile();
2647 if (((byte & 0x1F) == 7) && ( previousNal == 5 || previousNal == 1 ) )
2653 else if (((byte & 0x1F) == 5) || ((byte & 0x1F) == 1))
2655 byte = ReadByteFromFile();
2661 //NAL that belongs to the next AU
2662 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Next AU Nal Found")))
2669 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, First MB")))
2674 previousNal = byte & 0x1F;
2679 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, NAL start: [%d]"), nalStart ))
2680 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, end of h264 NAL found at [%d]"), pos ))
2683 GoBackInFile(KScLength); //go back before next start code
2688 if (!found && iInputEnd)
2696 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Searching next NAL")))
2701 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, AU Found")))
2702 iReadDataChunk = iReadDataChunkTemp;
2703 ReadDataToBuffer(aCodedInBuffer, totalData);
2704 pos = totalData; //Set amount of data read from a file
2705 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture,length of frame: [%d] "),pos));
2714 err = KErrNotSupported;
2715 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, codec type unknown")))
2718 if (err == KErrNone) // wk45 for listing frame size
2721 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Out")))
2725 /* ----------------------------------------------------------------------------
2726 * Name: CVDecTestEngine::ReadOneCodedPicture()
2727 * Purpose: Read one coded picture into decoder input buffer, frame size is known
2729 * Parameters: TVideoInputBuffer* aCodedInBuffer TInt Size
2731 * --------------------------------------------------------------------------*/
2733 TInt CVDecTestEngine::ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer, TInt aSize)
2735 TInt err = KErrNone;
2737 err = iInFile.Read(aCodedInBuffer->iData, aSize);
2738 PRINT((_L("CVDecTestEngine::ReadOneCodedPicture, Frame Size"),aSize ))
2740 if (err == KErrNone)
2755 /* ----------------------------------------------------------------------------
2756 * Name: CVDecTestEngine::ReadRawPicture()
2757 * Purpose: Read one raw picture into postprocessor input buffer
2761 * --------------------------------------------------------------------------*/
2764 TInt CVDecTestEngine::ReadRawPicture()
2766 TInt err = KErrNone;
2768 PRINT((_L("CVDecTestEngine::ReadRawPicture, Maximum data length in video picture: [%d]"),iRawInBuffer->iData.iRawData->MaxLength()))
2769 iRawInBuffer->iData.iRawData->Set((TUint8*)iRawInBuffer->iData.iRawData->Ptr(), 0, iInBuffSize);
2772 err = iInFile.Read(*(iRawInBuffer->iData.iRawData),iInBuffSize);
2773 PRINT((_L("CVDecTestEngine::ReadRawPicture, data length:[%d]"),iRawInBuffer->iData.iRawData->Length()))
2777 if ( (iRawInBuffer->iData.iRawData->Length()) == 0)
2783 PRINT((_L("CVDecTestEngine::ReadRawPicture, Out error:[%d]"),err))
2788 /* ----------------------------------------------------------------------------
2789 * Name: CVDecTestEngine::GetReturnedPictureL
2790 * Purpose: Retrieve output picuture
2791 * Note: Memory buffer output is used
2794 * --------------------------------------------------------------------------*/
2797 void CVDecTestEngine::GetReturnedPictureL()
2799 PRINT((_L("CVDecTestEngine::GetReturnedPictureL, In")))
2800 iOutBuffer = iDevvp->NextPictureL();
2804 PRINT((_L("CVDecTestEngine::GetReturnedPictureL, data Size in Byte:[%d]"),iOutBuffer->iData.iRawData->Size() ))
2805 iReturnedBuffCount++;
2806 SaveAndReturnPicture();
2808 PRINT((_L("CVDecTestEngine::GetReturnedPictureL, Out")))
2812 /* ----------------------------------------------------------------------------
2813 * Name: CVDecTestEngine::SaveAndReturnPicture()
2814 * Purpose: Store output data into a file
2815 * Note: Memory buffer output is used
2818 * --------------------------------------------------------------------------*/
2820 void CVDecTestEngine::SaveAndReturnPicture()
2822 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, In")))
2823 TInt err = KErrNone;
2825 if (iFrameMeasurement && iReturnedBuffCount == 1)
2827 iClock->Reset(); // Reset Timer
2828 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, clock reset")))
2832 if ( iFrameMeasurement )
2834 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, Frame measurement is on, %d. frame"), iReturnedBuffCount))
2835 TTimeIntervalMicroSeconds time;
2836 time = iClock->Time();
2837 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, time measured: [%d%d]"), I64HIGH(time.Int64()), I64LOW(time.Int64())))
2838 iFrameTime = (TReal)time.Int64()/1000000.0;
2839 if(iInstantFpsEnabled)
2841 iInstantFpsList.Append(time);
2847 err = iOutFile.Write(*(iOutBuffer->iData.iRawData),iOutBuffer->iData.iRawData->Size() );
2848 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, Output data stored: count[%d]"),iReturnedBuffCount))
2858 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, returning previous buffer (slow client)")))
2860 iDevvp->ReturnPicture(iOutBufferTemp);
2862 iOutBufferTemp = iOutBuffer;
2866 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, returning buffer")))
2867 iDevvp->ReturnPicture(iOutBuffer);
2873 if ( err != KErrNone )
2875 //iInputEnd = ETrue; Fix for MRII-7HW9R3
2877 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, Error in store data: [%d]"),iError))
2880 PRINT((_L("CVDecTestEngine::SaveAndReturnPicture, Out")))
2885 /* ----------------------------------------------------------------------------
2886 * Name: CVDecTestEngine::Pause()
2887 * Purpose: Pause decoding/postprocessing
2891 * --------------------------------------------------------------------------*/
2894 TInt CVDecTestEngine::Pause()
2896 TInt err = KErrNone;
2898 if ( iState == ERunning )
2900 if ( iSynchronized )
2902 iClock->Suspend(); //Stop Clock source
2906 PRINT((_L("CVDecTestEngine::Pause(), Paused")))
2916 /* ----------------------------------------------------------------------------
2917 * Name: CVDecTestEngine::Resume()
2918 * Purpose: Resume decoding/postprocessing
2922 * --------------------------------------------------------------------------*/
2924 TInt CVDecTestEngine::Resume()
2927 TInt err = KErrNone;
2929 if ( iState == EPaused )
2931 if ( iSynchronized )
2933 iClock->Resume(); //Restart Clock source
2937 PRINT((_L("CVDecTestEngine::Resume(), Resumed")))
2939 /*if ( iDecHWDevId )
2941 if ( iDevvp->NumFreeBuffers() )
2943 iDecTestAO->RequestData(); //Restart data transfer
2947 PRINT((_L("CVDecTestEngine::Resume, No input buffer available now")));
2950 iDecTestAO->RequestData();
2961 /* ----------------------------------------------------------------------------
2962 * Name: CVDecTestEngine::FreezePicture()
2963 * Purpose: Freeze decoding/postprocessing
2965 * Parameters: TTimeIntervalMicroSeconds aTimeStamp
2967 * --------------------------------------------------------------------------*/
2969 void CVDecTestEngine::FreezePicture(TTimeIntervalMicroSeconds aTimeStamp)
2971 iDevvp->FreezePicture(aTimeStamp);
2972 PRINT((_L("CVDecTestEngine::Freeze(), Freezed: timestamp[%ld]"), aTimeStamp.Int64()))
2976 /* ----------------------------------------------------------------------------
2977 * Name: CVDecTestEngine::ReleaseFreeze()
2978 * Purpose: Release Freeze
2980 * Parameters: TTimeIntervalMicroSeconds aTimeStamp
2982 * --------------------------------------------------------------------------*/
2985 void CVDecTestEngine::ReleaseFreeze(TTimeIntervalMicroSeconds aTimeStamp)
2987 iDevvp->ReleaseFreeze(aTimeStamp);
2988 PRINT((_L("CVDecTestEngine::ReleaseFreeze(), Freeze released")))
2992 /* ----------------------------------------------------------------------------
2993 * Name: CVDecTestEngine::StartDirectScreenAccessL
2994 * Purpose: Start DirectScreenAccess
2998 * --------------------------------------------------------------------------*/
3000 void CVDecTestEngine::StartDirectScreenAccessL(TRect aVideoRect, TRect aClipRegion)
3002 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL(), In")))
3005 User::LeaveIfError (RFbsSession::Connect());
3006 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL, connected to Fbs server :")))
3007 TInt err = KErrNone;
3008 if( iUseSecondScreen )
3010 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(1, EColor16MU));
3014 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(0, EColor16MU));
3016 if( err == KErrNotSupported )
3018 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL, EColor16MU is not supported, ")))
3019 if( iUseSecondScreen )
3021 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(1, EColor16MA));
3025 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(0, EColor16MA));
3029 if( err != KErrNone )
3031 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL, couldn't initialize screen device, err[%d]"),err))
3038 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL, mem alloc, iScreenDevice") ))
3043 TRegionFix<1> region(aClipRegion);
3046 iDevvp->StartDirectScreenAccessL(aVideoRect, *iScreenDevice, region);
3047 PRINT((_L("CVDecTestEngine::Start, DSA started")))
3048 iDsaStarted = ETrue;
3050 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL(), Out")))
3053 /* ----------------------------------------------------------------------------
3054 * Name: CVDecTestEngine::StartDirectScreenAccessL
3055 * Purpose: Start DirectScreenAccess
3059 * --------------------------------------------------------------------------*/
3061 void CVDecTestEngine::StartDirectScreenAccessL()
3063 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL(), In")))
3066 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL(), DSA already started- abort first")))
3067 AbortDirectScreenAccess();
3074 User::LeaveIfError (RFbsSession::Connect());
3075 PRINT((_L("CVDecTestEngine::Start, connected to Fbs server :")))
3078 TInt err = KErrNone;
3079 if( iUseSecondScreen )
3081 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(1, EColor16MU));
3085 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(0, EColor16MU));
3087 //TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(0, EColor16MU));
3088 if( err == KErrNotSupported )
3090 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL, EColor16MU is not supported, ")))
3091 if( iUseSecondScreen )
3093 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(1, EColor16MA));
3097 TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(0, EColor16MA));
3099 //TRAP(err, iScreenDevice = CFbsScreenDevice::NewL(0, EColor16MA));
3102 if ( err != KErrNone )
3104 PRINT((_L("CVDecTestEngine::Start, couldn't initialize screen device, err[%d]"),err))
3110 PRINT((_L("CVDecTestEngine::Start, disprect x[%d],y[%d] "),iDispRect.iTl.iX, iDispRect.iTl.iY))
3111 PRINT((_L("CVDecTestEngine::Start, disprect width[%d],height[%d] "),iDispRect.Width(),iDispRect.Height()))
3114 TRegionFix<1> region(iDispRect);
3117 iDevvp->StartDirectScreenAccessL(iDispRect, *iScreenDevice, region);
3118 PRINT((_L("CVDecTestEngine::Start, DSA started")))
3119 iDsaStarted = ETrue;
3122 PRINT((_L("CVDecTestEngine::StartDirectScreenAccessL(), Out")))
3125 /* ----------------------------------------------------------------------------
3126 * Name: CVDecTestEngine::AbortDirectScreenAccess
3127 * Purpose: AbortDirectScreenAccess
3131 * --------------------------------------------------------------------------*/
3133 void CVDecTestEngine::AbortDirectScreenAccess()
3135 if ( iDirectScreenAccess && iDsaStarted )
3137 iDevvp->AbortDirectScreenAccess();
3138 iDsaStarted = EFalse;
3139 PRINT((_L("CVDecTestEngine::AbortDirectScreenAccess, aborted ")))
3143 /* ----------------------------------------------------------------------------
3144 * Name: CVDecTestEngine::SetSecureOutputL
3145 * Purpose: Set sucure output enable
3147 * Parameters: TBool aSecure
3149 * --------------------------------------------------------------------------*/
3152 void CVDecTestEngine::SetSecureOutputL(TBool aSecure)
3154 PRINT((_L("CVDecTestEngine::SetSecureOutputL, In")))
3156 #ifdef __SECUREOUTPUTCI__
3158 MMmfVideoSecureOutput* secureOutput = NULL; // Custom interface Secure output
3160 secureOutput = (MMmfVideoSecureOutput*)iDevvp->CustomInterface(iPostProcId, KMmfVideoSecureOutputUid);
3164 PRINT((_L("CVDecTestEngine::SetSecureOutput, Failed to retrieve Secure CI")))
3165 User::Leave(KErrGeneral);
3168 secureOutput->MmvsoSetSecureOutputL(aSecure);
3172 PRINT((_L("CVDecTestEngine::SetSecureOutputL, Out [%d]"), aSecure))
3175 /* ----------------------------------------------------------------------------
3176 * Name: CVDecTestEngine::SetPosition
3177 * Purpose: Set postion
3179 * Parameters: TTimeIntervalMicroSeconds aTimeStamp
3181 * --------------------------------------------------------------------------*/
3184 void CVDecTestEngine::SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition)
3186 PRINT((_L("CVDecTestEngine::SetPosition, In")))
3188 iDevvp->SetPosition(aPlaybackPosition);
3190 PRINT((_L("CVDecTestEngine::SetPosition, Out")))
3193 /* ----------------------------------------------------------------------------
3194 * Name: CVDecTestEngine::ResetPosition
3195 * Purpose: Reset postion to start
3197 * Parameters: TTimeIntervalMicroSeconds aTimeStamp
3199 * --------------------------------------------------------------------------*/
3202 void CVDecTestEngine::ResetPosition()
3204 PRINT((_L("CVDecTestEngine::ResetPosition, In")))
3205 TTimeIntervalMicroSeconds starttime(0);
3207 iDevvp->SetPosition(starttime);
3208 PRINT((_L("CVDecTestEngine::ResetPosition, Reset Position to start of bitstream")))
3210 if ( iSynchronized )
3212 iClock->Reset(starttime);
3214 TTimeIntervalMicroSeconds currenttime = iClock->Time();
3215 PRINT((_L("CVDecTestEngine::ResetPosition, current time[%ld]"),currenttime.Int64() ))
3218 iInFile.Seek(ESeekStart,pos);
3221 PRINT((_L("CVDecTestEngine::ResetPosition, In")))
3227 /* ----------------------------------------------------------------------------
3228 * Name: CVDecTestEngine::PlaybackPosition
3229 * Purpose: Ritrieve Playback Position
3233 * --------------------------------------------------------------------------*/
3236 TTimeIntervalMicroSeconds CVDecTestEngine::PlaybackPosition()
3238 PRINT((_L("CVDecTestEngine::PlaybackPosition, In")))
3240 TTimeIntervalMicroSeconds position = iDevvp->PlaybackPosition();
3241 PRINT((_L("CVDecTestEngine::PlaybackPosition, Playback Position[%ld]"),position.Int64()))
3243 PRINT((_L("CVDecTestEngine::PlaybackPosition, Out")))
3248 /* ----------------------------------------------------------------------------
3249 * Name: CVDecTestEngine::DecodingPosition
3250 * Purpose: Ritrieve Decoding Position
3254 * --------------------------------------------------------------------------*/
3257 void CVDecTestEngine::DecodingPosition()
3259 PRINT((_L("CVDecTestEngine::DecodingPosition, In")))
3261 TTimeIntervalMicroSeconds position = iDevvp->DecodingPosition();
3262 PRINT((_L("CVDecTestEngine::DecodingPosition, Decoding Position[%ld]"),position.Int64()))
3264 PRINT((_L("CVDecTestEngine::DecodingPosition, Out")))
3267 /* ----------------------------------------------------------------------------
3268 * Name: CVDecTestEngine::GetFrameSizeCount
3269 * Purpose: Get frame size count after frame sizes are listed
3270 * Note: Called after initialization
3273 * --------------------------------------------------------------------------*/
3274 TInt CVDecTestEngine::GetFrameSizeCount()
3276 return iFrameSizeList.Count();
3279 /* ----------------------------------------------------------------------------
3280 * Name: CVDecTestEngine::EnableSynchronization
3281 * Purpose: Set Clock and enable synchronization
3282 * Note: Called before initialization and after Decoder/post-processor selected
3283 * Parameters: TInt aFrameRate
3285 * --------------------------------------------------------------------------*/
3287 void CVDecTestEngine::EnableSynchronization(TInt aFrameRate)
3289 PRINT((_L("CVDecTestEngine::EnableSynchronization, In")))
3291 iDevvp->SetClockSource(iClock);
3292 PRINT((_L("CVDecTestEngine::Synchronization, Clock source set")))
3294 iSynchronized = ETrue;
3295 iFrameTimeInterval = (TInt64)(1000000/aFrameRate);
3296 PRINT((_L("CVDecTestEngine::Synchronization, Frame rate:[%d]"),aFrameRate ))
3298 PRINT((_L("CVDecTestEngine::EnableSynchronization, Out")))
3302 /* ----------------------------------------------------------------------------
3303 * Name: CVDecTestEngine::SetWindowRect
3304 * Purpose: Set sucure output enable
3306 * Parameters: TInt aX, TInt aY, TSize aSize
3308 * --------------------------------------------------------------------------*/
3310 void CVDecTestEngine::SetWindowRect(TInt aX, TInt aY, TSize aSize )
3313 iDispRect.SetRect(TPoint(aX,aY),aSize);
3315 PRINT((_L("CVDecTestEngine::SetWindowRect, [%d], [%d]"),aX ,aY ))
3316 PRINT((_L("CVDecTestEngine::SetWindowRect, width[%d], height[%d]"),aSize.iWidth, aSize.iHeight))
3320 /* ----------------------------------------------------------------------------
3321 * Name: CVDecTestEngine::ListFrameSizeL
3322 * Purpose: List size of each frmae of coded bitstream for synchrinized
3327 * --------------------------------------------------------------------------*/
3329 void CVDecTestEngine::ListFrameSizeL(RArray<TInt> aFramesizes)
3332 if ( iCodecType == EVC1 ){
3334 PRINT((_L("CVDecTestEngine::ListFrameSizeL, not supported for VC1") ))
3335 User::Leave(KErrGeneral);
3339 TVideoInputBuffer* videoBuffer = new(ELeave) TVideoInputBuffer;
3341 HBufC8* tempBuff = HBufC8::NewL(iInBuffSize);
3344 PRINT((_L("CVDecTestEngine::ListFrameSizeL, mem alloc, videoBuffer & iInBuffSize") ))
3346 videoBuffer->iData.Set(tempBuff->Des());
3347 //iListFrameSize = ETrue;
3349 if(aFramesizes.Count() > 0)
3351 for (TUint i = 0; i < aFramesizes.Count(); i++)
3353 iFrameSizeList.AppendL(aFramesizes[i]);
3354 PRINT((_L("CVDecTestEngine::ListFrameSize, user input [%d]"),aFramesizes[i]))
3362 videoBuffer->iData.SetLength(0);
3363 framesize = ReadOneCodedPicture(videoBuffer);
3364 PRINT((_L("CVDecTestEngine::ListFrameSize, frame size[%d]"),framesize))
3365 // here append frame size in list
3367 if (framesize >= 0 )
3369 iFrameSizeList.AppendL(framesize);
3379 PRINT((_L("CVDecTestEngine::ListFrameSize, frame count[%d]"),iFrameSizeList.Count()))
3382 //Reset file postion to start
3385 iReadDataChunk = iDataChunk;
3386 iWriteDataChunk = iDataChunk;
3387 iDataReadFromFile = 0;
3388 iInFile.Seek(ESeekStart,pos);
3396 PRINT((_L("CVDecTestEngine::ListFrameSize, mem del, tempBuff & videoBuffer") ))
3400 PRINT((_L("CVDecTestEngine::ListFrameSize, error[%d]"),framesize ))
3401 User::Leave(framesize);
3407 /* ----------------------------------------------------------------------------
3408 * Name: CVDecTestEngine::SetLandscapeMode()
3409 * Purpose: Set landscape mode flag
3413 * --------------------------------------------------------------------------*/
3416 void CVDecTestEngine::SetLandscapeMode()
3419 iLandscapeMode = ETrue;
3420 PRINT((_L("CVDecTestEngine::SetLandscapeMode, Landscape mode is set") ))
3425 /* ----------------------------------------------------------------------------
3426 * Name: CVDecTestEngine::SelectDecoderL()
3431 * --------------------------------------------------------------------------*/
3432 void CVDecTestEngine::SelectDecoderL(const TUid& aUid)
3434 PRINT((_L("CVDecTestEngine::SelectDecoderL, In") ))
3437 iDecHWDevId = iDevvp->SelectDecoderL(aUid);
3439 #ifdef __RESOURCENOTIFICATION__
3440 MMmfVideoResourceHandler* handler = (MMmfVideoResourceHandler*)iDevvp->CustomInterface(iDecHWDevId, KUidMmfVideoResourceManagement );
3441 handler->MmvrhSetObserver(((MMmfVideoResourceObserver*)(this)));
3444 PRINT((_L("CVDecTestEngine::SelectDecoderL, Out") ))
3447 /* ----------------------------------------------------------------------------
3448 * Name: CVDecTestEngine::SelectPostProcessorL()
3453 * --------------------------------------------------------------------------*/
3454 void CVDecTestEngine::SelectPostProcessorL(const TUid& aUid)
3456 PRINT((_L("CVDecTestEngine::SelectPostProcessorL, In") ))
3458 iPostProcessorUid = aUid;
3459 iPostProcId = iDevvp->SelectPostProcessorL(aUid);
3461 PRINT((_L("CVDecTestEngine::SelectPostProcessorL, Out") ))
3464 /* ----------------------------------------------------------------------------
3465 * Name: CVDecTestEngine::SetBufferOptionsL()
3470 * --------------------------------------------------------------------------*/
3471 void CVDecTestEngine::SetBufferOptionsL(const CMMFDevVideoPlay::TBufferOptions& aOptions)
3473 PRINT((_L("CVDecTestEngine::SetBufferOptionsL, In") ))
3475 iInBuffSize = aOptions.iMaxInputBufferSize;
3476 iDevvp->SetBufferOptionsL(aOptions);
3478 PRINT((_L("CVDecTestEngine::SetBufferOptionsL, Out") ))
3481 /* ----------------------------------------------------------------------------
3482 * Name: CVDecTestEngine::SetVideoDestScreenL()
3487 * --------------------------------------------------------------------------*/
3488 void CVDecTestEngine::SetVideoDestScreenL(TBool aDest)
3490 PRINT((_L("CVDecTestEngine::SetVideoDestScreenL, In") ))
3492 iDevvp->SetVideoDestScreenL(aDest);
3494 PRINT((_L("CVDecTestEngine::SetVideoDestScreenL, Out") ))
3497 /* ----------------------------------------------------------------------------
3498 * Name: CVDecTestEngine::SynchronizeDecoding()
3503 * --------------------------------------------------------------------------*/
3504 void CVDecTestEngine::SynchronizeDecoding(TBool aSynch)
3506 PRINT((_L("CVDecTestEngine::SynchronizeDecoding, In") ))
3508 iDevvp->SynchronizeDecoding(aSynch);
3510 PRINT((_L("CVDecTestEngine::SynchronizeDecoding, Out") ))
3513 /* ----------------------------------------------------------------------------
3514 * Name: CVDecTestEngine::GetBufferOptions()
3519 * --------------------------------------------------------------------------*/
3520 void CVDecTestEngine::GetBufferOptions()
3522 PRINT((_L("CVDecTestEngine::GetBufferOptions, In") ))
3524 CMMFDevVideoPlay::TBufferOptions options;
3525 iDevvp->GetBufferOptions(options);
3527 PRINT((_L("CVDecTestEngine::GetBufferOptions: iPreDecodeBufferSize: [%d]\n iMaxPostDecodeBufferSize: [%d]\n"),
3528 options.iPreDecodeBufferSize, options.iMaxPostDecodeBufferSize))
3529 PRINT((_L("CVDecTestEngine::GetBufferOptions: iMaxInputBufferSize [%d]\n iMinNumInputBuffers [%d]\n "),
3530 options.iMaxInputBufferSize, options.iMinNumInputBuffers))
3531 PRINT((_L("CVDecTestEngine::GetBufferOptions: iPreDecoderBufferPeriod [%d] [%d]"), I64LOW(options.iPreDecoderBufferPeriod.Int64()), I64HIGH(options.iPreDecoderBufferPeriod.Int64())))
3532 PRINT((_L("CVDecTestEngine::GetBufferOptions: iPostDecoderBufferPeriod [%d] [%d]"), I64LOW(options.iPostDecoderBufferPeriod.Int64()), I64HIGH(options.iPostDecoderBufferPeriod.Int64())))
3534 PRINT((_L("CVDecTestEngine::GetBufferOptions, Out") ))
3537 /* ----------------------------------------------------------------------------
3538 * Name: CVDecTestEngine::SetInputFormatL()
3543 * --------------------------------------------------------------------------*/
3544 void CVDecTestEngine::SetInputFormatL(TInt aHwDev, const TUncompressedVideoFormat& aFormat)
3546 PRINT((_L("CVDecTestEngine::SetInputFormatL, In") ))
3548 if (aHwDev == EPostProcessor)
3550 iDevvp->SetInputFormatL(iPostProcId, aFormat);
3554 iDevvp->SetInputFormatL(iDecHWDevId, aFormat);
3557 PRINT((_L("CVDecTestEngine::SetInputFormatL, Out") ))
3560 /* ----------------------------------------------------------------------------
3561 * Name: CVDecTestEngine::SetOutputFormatL()
3566 * --------------------------------------------------------------------------*/
3567 void CVDecTestEngine::SetOutputFormatL(TInt aHwDev, const TUncompressedVideoFormat& aFormat)
3569 PRINT((_L("CVDecTestEngine::SetOutputFormatL, In") ))
3571 if (aHwDev == EPostProcessor)
3573 iDevvp->SetOutputFormatL(iPostProcId, aFormat);
3577 iDevvp->SetOutputFormatL(iDecHWDevId, aFormat);
3580 PRINT((_L("CVDecTestEngine::SetOutputFormatL, Out") ))
3583 /* ----------------------------------------------------------------------------
3584 * Name: CVDecTestEngine::SetInputFormatL()
3589 * --------------------------------------------------------------------------*/
3590 void CVDecTestEngine::SetInputFormatL(TInt aHwDev, const CCompressedVideoFormat& aFormat,
3591 TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aEncapsulation,
3594 PRINT((_L("CVDecTestEngine::SetInputFormatL, In") ))
3596 if (aHwDev == EPostProcessor)
3598 iDevvp->SetInputFormatL(iPostProcId, aFormat, aDataUnitType, aEncapsulation, aDataInOrder);
3602 iDevvp->SetInputFormatL(iDecHWDevId, aFormat, aDataUnitType, aEncapsulation, aDataInOrder);
3605 PRINT((_L("CVDecTestEngine::SetInputFormatL, Out") ))
3608 /* ----------------------------------------------------------------------------
3609 * Name: CVDecTestEngine::FindCommonFormats()
3614 * --------------------------------------------------------------------------*/
3615 void CVDecTestEngine::FindCommonFormatsL()
3617 PRINT((_L("CVDecTestEngine::FindCommonFormatsL, In") ))
3619 // Set Output Format for Decoder/Input Format for Postprocessor
3620 RArray<TUncompressedVideoFormat> decformats;
3621 TUncompressedVideoFormat commonFormat;
3624 iDevvp->GetOutputFormatListL(iDecHWDevId, decformats);
3626 CPostProcessorInfo* info;
3628 info = iDevvp->PostProcessorInfoLC(iPostProcessorUid);
3630 RArray<TUncompressedVideoFormat> ppformats;
3631 ppformats = info->SupportedFormats();
3633 //Find common format for dec output and postproc input
3634 TBool found = iDevvp->FindCommonFormat(decformats.Array(), ppformats.Array(), commonFormat);
3638 iDevvp->SetOutputFormatL(iDecHWDevId, commonFormat);
3639 PRINT((_L("CVDecTestEngine::FindCommonFormatsL, Decoder output Format set")))
3640 iDevvp->SetInputFormatL(iPostProcId, commonFormat);
3641 PRINT((_L("CVDecTestEngine::FindCommonFormatsL, Postprocessor input format set.")))
3642 PrintUncompressedFormat(commonFormat);
3646 PRINT((_L("CVDecTestEngine::FindCommonFormatsL, Common Format not found")))
3647 User::Leave( KErrNotFound);
3649 CleanupStack::PopAndDestroy(info);
3650 PRINT((_L("CVDecTestEngine::FindCommonFormatsL, closing array") ))
3652 PRINT((_L("CVDecTestEngine::FindCommonFormatsL, Out") ))
3655 /* ----------------------------------------------------------------------------
3656 * Name: CVDecTestEngine::FindDecodersL()
3661 * --------------------------------------------------------------------------*/
3662 TInt CVDecTestEngine::FindDecodersL(const TDesC8& aMimeType, TUint32 aPostProcType, TBool aExactMatch, TUid& aUid )
3664 PRINT((_L("CVDecTestEngine::FindDecodersL, In") ))
3666 TInt supports = KErrNotSupported;
3669 if (aUid.iUid == 0 && !aExactMatch)
3671 supports = KErrNone;
3674 RArray<TUid> decoders;
3675 CleanupClosePushL(decoders);
3676 iDevvp->FindDecodersL(aMimeType, aPostProcType, decoders, aExactMatch);
3677 for (TUint i = 0; i < decoders.Count(); i++)
3679 if (decoders[i].iUid == aUid.iUid)
3681 supports = KErrNone;
3684 PRINT((_L("CVDecTestEngine::FindDecodersL, Uid [%x]"), decoders[i].iUid ))
3686 CleanupStack::PopAndDestroy(&decoders);
3688 PRINT((_L("CVDecTestEngine::FindDecodersL, Out") ))
3693 /* ----------------------------------------------------------------------------
3694 * Name: CVDecTestEngine::FindPostProcessorsL()
3699 * --------------------------------------------------------------------------*/
3700 TInt CVDecTestEngine::FindPostProcessorsL(TUid& aUid, TUint32 aPostProcType)
3702 PRINT((_L("CVDecTestEngine::FindPostProcessorsL, In") ))
3704 TInt supports = KErrNotSupported;
3709 supports = KErrNone;
3712 RArray<TUid> postProcessors;
3713 CleanupClosePushL(postProcessors);
3714 iDevvp->FindPostProcessorsL(aPostProcType, postProcessors);
3715 for (TUint i = 0; i < postProcessors.Count(); i++)
3717 PRINT((_L("CVDecTestEngine::FindPostProcessorsL, Uid [%x]"), postProcessors[i].iUid ))
3719 if (postProcessors[i].iUid == aUid.iUid)
3721 supports = KErrNone;
3725 CleanupStack::PopAndDestroy(&postProcessors);
3727 PRINT((_L("CVDecTestEngine::FindPostProcessorsL, Out") ))
3731 /* ----------------------------------------------------------------------------
3732 * Name: CVDecTestEngine::GetDecoderListL()
3737 * --------------------------------------------------------------------------*/
3738 void CVDecTestEngine::GetDecoderListL()
3740 PRINT((_L("CVDecTestEngine::GetDecoderListL, In") ))
3742 RArray<TUid> decoders;
3743 CleanupClosePushL(decoders);
3744 iDevvp->GetDecoderListL(decoders);
3745 for (TUint i = 0; i < decoders.Count(); i++)
3747 PRINT((_L("CVDecTestEngine::GetDecoderListL, Uid [%x]"), decoders[i].iUid ))
3749 CleanupStack::PopAndDestroy(&decoders);
3751 PRINT((_L("CVDecTestEngine::GetDecoderListL, Out") ))
3754 /* ----------------------------------------------------------------------------
3755 * Name: CVDecTestEngine::ConfigureDecoderL()
3760 * --------------------------------------------------------------------------*/
3761 void CVDecTestEngine::ConfigureDecoderL(TVideoPictureHeader& aVideoPictureHeader)
3763 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, In") ))
3767 TBuf16<128> tempBuf;
3768 tempBuf.Copy( iPasswordForFLV);
3769 PRINT( ( _L( "CVDecTestEngine::ConfigureDecoderL(): password tempBuf: %S." ), &tempBuf ) )
3771 TPtrC8 metaData((TUint8*)iPasswordForFLV.Ptr(), iPasswordForFLV.Size());
3773 aVideoPictureHeader.iOptional = &metaData;
3777 iDevvp->ConfigureDecoderL(aVideoPictureHeader);
3779 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, Out") ))
3783 /* ----------------------------------------------------------------------------
3784 * Name: CVDecTestEngine::ConfigureDecoderL()
3789 * --------------------------------------------------------------------------*/
3790 void CVDecTestEngine::ConfigureDecoderL()
3792 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, In") ))
3794 if (iCodecType == EVC1)
3796 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, iCodectype VC1") ))
3797 TInt configPosition = 0;
3798 TUint configDataSize = 36; // MetaData is 36 Bytes in SP-L0 VC1 .
3799 TUint8* ptr = new (ELeave) TUint8[configDataSize+8];
3802 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, mem alloc, ptr") ))
3804 TUint32* ptr32 = reinterpret_cast<TUint32*>(ptr);
3807 TPtr8 configData((ptr+8), configDataSize);
3808 for (TUint i=0; i < 8; i++)
3810 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, beginning [%d]"), ptr[i] ))
3813 User::LeaveIfError(iInFile.Seek(ESeekStart, configPosition));
3814 User::LeaveIfError(iInFile.Read(configData, configDataSize));
3815 TVideoPictureHeader* configHeader = new TVideoPictureHeader;
3817 CleanupStack::PushL(configHeader);
3819 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, mem alloc, configHeader") ))
3822 TPtrC8 metaData(ptr,configDataSize+8);
3825 configHeader->iOptional = &metaData;
3826 configHeader->iLevel = -1;
3827 configHeader->iProfile = -1;
3829 iDevvp->ConfigureDecoderL(*configHeader);
3832 CleanupStack::Pop();
3835 delete configHeader;
3838 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, mem del, ptr & configHeader") ))
3843 TInt err = KErrNone;
3844 TVideoPictureHeader* headerInfo = NULL;
3845 HBufC8* tempBuff = NULL;
3847 //Read Picture header : Size is not known
3848 TVideoInputBuffer* codedBuffer = new(ELeave) TVideoInputBuffer;
3849 CleanupStack::PushL( codedBuffer );
3850 iInBuffSize = KMaxCodedSize;
3853 while ( (err == KErrOverflow) && (iInBuffSize <= KMaxCodedSize) )
3855 tempBuff = HBufC8::NewL(iInBuffSize);
3856 CleanupStack::PushL( tempBuff );
3857 codedBuffer->iData.Set(tempBuff->Des());
3859 if ( iFrameSizeList.Count() > 0 )
3861 err = ReadOneCodedPicture(codedBuffer, iFrameSizeList[0] );
3865 err = ReadOneCodedPicture(codedBuffer);
3867 //err = ReadOneCodedPicture(codedBuffer);
3870 if ( iInFile.Seek(ESeekStart,pos) )
3882 CleanupStack::PopAndDestroy(tempBuff);
3883 iInBuffSize = 4*iInBuffSize;
3888 // Reitrieve header information from bitstream
3891 CleanupStack::PopAndDestroy(codedBuffer);
3892 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, Reading input data fail")))
3898 headerInfo = iDevvp->GetHeaderInformationL(EDuCodedPicture,EDuElementaryStream,codedBuffer);
3900 CleanupStack::PopAndDestroy(tempBuff);
3901 CleanupStack::PopAndDestroy(codedBuffer);
3907 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, Configuring the decoder")))
3912 TBuf16<128> tempBuf;
3913 tempBuf.Copy( iPasswordForFLV);
3914 PRINT( ( _L( "CVDecTestEngine::ConfigureDecoderL(): password tempBuf: %S." ), &tempBuf ) )
3916 TPtrC8 metaData((TUint8*)iPasswordForFLV.Ptr(), iPasswordForFLV.Size());
3918 headerInfo->iOptional = &metaData;
3921 iDevvp->ConfigureDecoderL(*headerInfo);
3924 iDevvp->ReturnHeader(headerInfo);
3929 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, Get header info fail")))
3935 // Set size of decoder input buffer
3936 if ( iCodecType == EH263 )
3938 if ( (iPictureSize.iWidth <= 176 ) && (iPictureSize.iHeight <= 144) )
3939 iInBuffSize = KH263MaxCodedSizeQCIF;
3941 iInBuffSize = KH263MaxCodedSizeCIF;
3944 else //Mpeg4 and AVC and FLV
3946 if ( (iPictureSize.iWidth <= 176 ) && (iPictureSize.iHeight <= 144) )
3947 iInBuffSize = KMP4MaxCodedSizeQCIF;
3948 else if ( (iPictureSize.iWidth <= 352 ) && (iPictureSize.iHeight <= 288) )
3949 iInBuffSize = KMP4MaxCodedSizeCIF;
3950 else if ( (iPictureSize.iWidth <= 640 ) && (iPictureSize.iHeight <= 480) )
3951 iInBuffSize = KMP4MaxCodedSizeVGA;
3952 else if ( (iPictureSize.iWidth <= 720 ) && (iPictureSize.iHeight <= 576) )
3953 iInBuffSize = KMP4MaxCodedSizePAL;
3955 iInBuffSize = KMaxCodedSize;
3958 AssertTIntEqualL(KErrNone, err);
3962 iReadDataChunk = iDataChunk;
3963 iWriteDataChunk = iDataChunk;
3964 iDataReadFromFile = 0;
3965 iInFile.Seek(ESeekStart,pos);
3967 PRINT((_L("CVDecTestEngine::ConfigureDecoderL, Out") ))
3970 /* ----------------------------------------------------------------------------
3971 * Name: CVDecTestEngine::GetOutputFormatListL()
3976 * --------------------------------------------------------------------------*/
3977 void CVDecTestEngine::GetOutputFormatListL(TInt aHWDevice)
3979 PRINT((_L("CVDecTestEngine::GetOutputFormatListL, In") ))
3981 RArray<TUncompressedVideoFormat> formats;
3982 CleanupClosePushL(formats);
3983 if (aHWDevice == EPostProcessor)
3985 iDevvp->GetOutputFormatListL(iPostProcId, formats);
3989 iDevvp->GetOutputFormatListL(iDecHWDevId, formats);
3992 for (TUint i = 0; i < formats.Count(); i++)
3994 PRINT((_L("CVDecTestEngine::GetOutputFormatListL, Format No.%d"), i))
3995 PrintUncompressedFormat(formats[i]);
3997 CleanupStack::PopAndDestroy(&formats);
3999 PRINT((_L("CVDecTestEngine::GetOutputFormatListL, Out") ))
4002 /* ----------------------------------------------------------------------------
4003 * Name: CVDecTestEngine::SupportsOutputFormatL()
4008 * --------------------------------------------------------------------------*/
4009 TInt CVDecTestEngine::SupportsOutputFormatL(TInt aHwdev, const TUncompressedVideoFormat& aFormat)
4011 PRINT((_L("CVDecTestEngine::SupportsOutputFormatL, In") ))
4013 TInt result = KErrNotSupported;
4015 RArray<TUncompressedVideoFormat> formats;
4016 CleanupClosePushL(formats);
4017 if (aHwdev == EPostProcessor)
4019 iDevvp->GetOutputFormatListL(iPostProcId, formats);
4023 iDevvp->GetOutputFormatListL(iDecHWDevId, formats);
4026 for (TUint i = 0; i < formats.Count(); i++)
4028 PRINT((_L("CVDecTestEngine::SupportsOutputFormatL, Format No.%d"), i))
4029 if (formats[i] == aFormat)
4033 PrintUncompressedFormat(formats[i]);
4035 CleanupStack::PopAndDestroy(&formats);
4037 PRINT((_L("CVDecTestEngine::SupportsOutputFormatL, Out") ))
4042 /* ----------------------------------------------------------------------------
4043 * Name: CVDecTestEngine::GetPostProcessorListL()
4048 * --------------------------------------------------------------------------*/
4049 void CVDecTestEngine::GetPostProcessorListL()
4051 PRINT((_L("CVDecTestEngine::GetPostProcessorListL, Out") ))
4053 RArray<TUid> postProcessors;
4054 CleanupClosePushL(postProcessors);
4055 iDevvp->GetPostProcessorListL(postProcessors);
4056 for (TUint i = 0; i < postProcessors.Count(); i++)
4058 PRINT((_L("CVDecTestEngine::GetPostProcessorListL, Uid [%x]"), postProcessors[i].iUid ))
4060 CleanupStack::PopAndDestroy(&postProcessors);
4062 PRINT((_L("CVDecTestEngine::GetPostProcessorListL, Out") ))
4065 /* ----------------------------------------------------------------------------
4066 * Name: CVDecTestEngine::VideoDecoderInfoL()
4071 * --------------------------------------------------------------------------*/
4072 void CVDecTestEngine::VideoDecoderInfoL(TUid aVideoDecoder)
4074 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, In") ))
4076 CVideoDecoderInfo* info;
4077 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, 2test") ))
4078 info = iDevvp->VideoDecoderInfoLC(aVideoDecoder);
4080 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, test") ))
4082 TVersion version = info->Version();
4083 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, Manufacturer: %S"), &info->Manufacturer()))
4084 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, Identifier: %S"), &info->Identifier()))
4085 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, Version information:")))
4086 PRINT((_L("Major Version:[%d], Minor Version:[%d], Build number:[%d] "), version.iMajor,version.iMinor,version.iBuild))
4087 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, HW Accelerated:[%d]"),info->Accelerated()))
4088 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, Support Direct Screen:[%d]"),info->SupportsDirectDisplay()))
4089 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, MaxPictureSize, %dx%d"),info->MaxPictureSize().iWidth, info->MaxPictureSize().iHeight))
4090 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, MaxBitrate: [%d]"),info->MaxBitrate()))
4091 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, SupportsPictureLoss: [%d]"),info->SupportsPictureLoss()))
4092 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, SupportsSliceLoss: [%d]"),info->SupportsSliceLoss()))
4093 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, CodingStandardSpecificInfo: %S"), &info->CodingStandardSpecificInfo()))
4094 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, ImplementationSpecificInfo: %S"), &info->ImplementationSpecificInfo()))
4096 CleanupStack::PopAndDestroy(info);
4098 PRINT((_L("CVDecTestEngine::VideoDecoderInfoL, Out") ))
4101 /* ----------------------------------------------------------------------------
4102 * Name: CVDecTestEngine::PostProcessorInfoL()
4107 * --------------------------------------------------------------------------*/
4108 void CVDecTestEngine::PostProcessorInfoL(TUid aPostProcessor)
4110 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, In") ))
4112 CPostProcessorInfo* info;
4113 info = iDevvp->PostProcessorInfoLC(aPostProcessor);
4115 TVersion version = info->Version();
4116 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Manufacturer: %S"), &info->Manufacturer()))
4117 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Identifier: %S"), &info->Identifier()))
4118 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Version information:")))
4119 PRINT((_L("Major Version:[%d], Minor Version:[%d], Build number:[%d] "), version.iMajor,version.iMinor,version.iBuild))
4122 RArray<TUint32> combination = info->SupportedCombinations();
4124 for (TInt i=0; i < combination.Count(); i++)
4126 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, combiantion:[%x]"), combination.operator[](i)))
4129 //Color Conversion YUV to RGV
4130 TYuvToRgbCapabilities colorconv;
4131 colorconv = info->YuvToRgbCapabilities();
4132 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, YUV Sampling Pattern bit:[0x%x]"),colorconv.iSamplingPatterns))
4133 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, YUV Coefficient bit:[0x%x]"),colorconv.iCoefficients))
4134 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, RGB Formats bit:[0x%x]"),colorconv.iRgbFormats))
4135 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Lightness Control:[%d]"),colorconv.iLightnessControl))
4136 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Saturation Control:[%d]"),colorconv.iSaturationControl))
4137 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Contrast Control:[%d]"),colorconv.iContrastControl))
4138 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Gamma Correction:[%d]"),colorconv.iGammaCorrection))
4140 if(colorconv.iDitherTypes & EDitherNone)
4142 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, No dither support")))
4144 if(colorconv.iDitherTypes & EDitherOrdered)
4146 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Ordered Dither")))
4148 if(colorconv.iDitherTypes & EDitherErrorDiffusion)
4150 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Error diffusion dither")))
4152 if(colorconv.iDitherTypes & EDitherOther)
4154 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Other hardware device specific dithering type")))
4159 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, HW Accelerated:[%d]"),info->Accelerated()))
4161 //Support Direct Screen
4162 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Direct Screen:[%d]"),info->SupportsDirectDisplay()))
4166 rotation = info->SupportedRotations();
4168 if(rotation & 0x00000001)
4169 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Rotation: 90Clockwise ")))
4170 if(rotation & 0x00000002)
4171 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Rotation: 90Anticlockwise ")))
4172 if(rotation & 0x00000004)
4173 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Rotation: 180 ")))
4174 if(!(rotation & 0x00000007))
4175 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, No Rotation supported ")))
4178 TInt support = info->SupportsArbitraryScaling();
4179 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Arbitrary Scaling:[%d]"),support))
4184 RArray<TScaleFactor> scale = info->SupportedScaleFactors();
4186 for (TInt i=0; i<scale.Count(); i++)
4188 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Scalling Factor:[%d]/[%d]"),scale.operator[](i).iScaleNum, scale.operator[](i).iScaleDenom))
4192 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Support Anti Aliased filter:[%d]"),info->AntiAliasedScaling()))
4194 CleanupStack::PopAndDestroy(info);
4196 PRINT((_L("CVDecTestEngine::PostProcessorInfoL, Out") ))
4199 /* ----------------------------------------------------------------------------
4200 * Name: CVDecTestEngine::SupportsFormatL()
4201 * Purpose: Retrieves information about an installed video decoder
4204 * --------------------------------------------------------------------------*/
4206 TInt CVDecTestEngine::SupportsFormatL(const TUid& aUid, const CCompressedVideoFormat& aFormat)
4208 PRINT((_L("CVDecTestEngine::SupportsFormatL(),In")))
4210 TInt supports = KErrNotSupported;
4212 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4215 PRINT((_L("CVDecTestEngine::SupportsFormatL(),Error")))
4219 if (info->SupportsFormat(aFormat))
4221 PRINT((_L("CVDecTestEngine::SupportsFormatL, Supported format found")))
4225 CleanupStack::PopAndDestroy();
4227 PRINT((_L("CVDecTestEngine::SupportsFormatL(),Out")))
4232 /* ----------------------------------------------------------------------------
4233 * Name: CVDecTestEngine::SupportsFormatInfoL()
4234 * Purpose: Retrieves information about an installed video decoder
4237 * --------------------------------------------------------------------------*/
4239 TInt CVDecTestEngine::SupportsFormatInfoL(const TUid& aUid, const CCompressedVideoFormat& aFormat)
4241 PRINT((_L("CVDecTestEngine::SupportsFormatInfoL(),In")))
4243 TInt supports = KErrNotSupported;
4244 RPointerArray<CCompressedVideoFormat> formats;
4246 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4249 PRINT((_L("CVDecTestEngine::SupportsFormatInfoL(),Error")))
4254 formats = info->SupportedFormats();
4256 PRINT((_L("CVDecTestEngine::SupportsFormatInfoL(), supported formats")))
4258 for (TUint i = 0; i < formats.Count(); i++)
4261 format.Copy(formats[i]->MimeType());
4262 PRINT((_L("CVDecTestEngine::SupportsFormatInfoL, Format [%S]"), &format))
4263 //PRINT((_L("CVDecTestEngine::SupportsFormatInfoL, %d. Format [%S]"), &(formats[i]))
4264 if (*(formats[i]) == aFormat)
4266 supports = KErrNone;
4267 PRINT((_L("CVDecTestEngine::SupportsFormatInfoL, Supported format found")))
4271 CleanupStack::PopAndDestroy();
4273 PRINT((_L("CVDecTestEngine::SupportsFormatInfoL(),Out")))
4277 /* ----------------------------------------------------------------------------
4278 * Name: CVDecTestEngine::SupportsAccelerationL()
4279 * Purpose: Retrieves information about an installed video decoder
4282 * --------------------------------------------------------------------------*/
4284 TInt CVDecTestEngine::SupportsAccelerationL(TInt aHwDev, const TUid& aUid)
4286 PRINT((_L("CVDecTestEngine::SupportsAccelerationL(),In")))
4288 TInt supports = KErrNotSupported;
4289 TBool supported = EFalse;
4291 if (aHwDev == EPostProcessor)
4293 CPostProcessorInfo* info = iDevvp->PostProcessorInfoLC(aUid);
4296 PRINT((_L("CVDecTestEngine::SupportsAccelerationL(),Error")))
4299 supported = info->Accelerated();
4303 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4306 PRINT((_L("CVDecTestEngine::SupportsAccelerationL(),Error")))
4310 supported = info->Accelerated();
4315 supports = KErrNone;
4318 CleanupStack::PopAndDestroy();
4320 PRINT((_L("CVDecTestEngine::SupportsAccelerationL(),Out")))
4324 /* ----------------------------------------------------------------------------
4325 * Name: CVDecTestEngine::SupportsDirectDisplayL()
4326 * Purpose: Retrieves information about an installed video decoder
4329 * --------------------------------------------------------------------------*/
4331 TInt CVDecTestEngine::SupportsDirectDisplayL(TInt aHwDev, const TUid& aUid)
4333 PRINT((_L("CVDecTestEngine::SupportsDirectDisplayL(),In")))
4335 TInt supports = KErrNotSupported;
4336 TBool supported = EFalse;
4338 if (aHwDev == EPostProcessor)
4340 CPostProcessorInfo* info = iDevvp->PostProcessorInfoLC(aUid);
4343 PRINT((_L("CVDecTestEngine::SupportsDirectDisplayL(),Error")))
4347 supported = info->SupportsDirectDisplay();
4351 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4354 PRINT((_L("CVDecTestEngine::SupportsDirectDisplayL(),Error")))
4358 supported = info->SupportsDirectDisplay();
4363 supports = KErrNone;
4366 CleanupStack::PopAndDestroy();
4368 PRINT((_L("CVDecTestEngine::SupportsDirectDisplayL(),Out")))
4373 /* ----------------------------------------------------------------------------
4374 * Name: CVDecTestEngine::SupportsMaxPictureSizeL()
4375 * Purpose: Retrieves information about an installed video decoder
4378 * --------------------------------------------------------------------------*/
4380 TInt CVDecTestEngine::SupportsMaxPictureSizeL(const TUid& aUid, TSize aSize)
4382 PRINT((_L("CVDecTestEngine::SupportsMaxPictureSizeL(),In")))
4384 TInt supports = KErrNotSupported;
4386 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4389 PRINT((_L("CVDecTestEngine::SupportsMaxPictureSizeL(),Error")))
4393 TSize size = info->MaxPictureSize();
4395 if (size.iWidth >= aSize.iWidth && size.iHeight >= aSize.iHeight)
4397 supports = KErrNone;
4400 CleanupStack::PopAndDestroy();
4402 PRINT((_L("CVDecTestEngine::SupportsMaxPictureSizeL(),Out")))
4406 /* ----------------------------------------------------------------------------
4407 * Name: CVDecTestEngine::SupportsMaxPictureRateL()
4408 * Purpose: Retrieves information about an installed video decoder
4411 * --------------------------------------------------------------------------*/
4413 TInt CVDecTestEngine::SupportsMaxPictureRateL(const TUid& aUid, TPictureRateAndSize& aRateAndSize)
4415 PRINT((_L("CVDecTestEngine::SupportsMaxPictureRateL(),In")))
4417 TInt supports = KErrNotSupported;
4418 TPictureRateAndSize picRateAndSize;
4420 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4423 PRINT((_L("CVEncTestEngine::SupportsMaxPictureRateL(),Error")))
4427 RArray<TPictureRateAndSize> picRateAndSizeArray = info->MaxPictureRates();
4429 for (TUint i=0; i < picRateAndSizeArray.Count(); i++)
4431 picRateAndSize = picRateAndSizeArray[i];
4432 if (aRateAndSize.iPictureRate <= picRateAndSize.iPictureRate && aRateAndSize.iPictureSize.iWidth <= picRateAndSize.iPictureSize.iWidth &&
4433 aRateAndSize.iPictureSize.iHeight <= picRateAndSize.iPictureSize.iHeight)
4435 supports = KErrNone;
4439 CleanupStack::PopAndDestroy();
4441 PRINT((_L("CVDecTestEngine::SupportsMaxPictureRateL(),Out")))
4446 /* ----------------------------------------------------------------------------
4447 * Name: CVDecTestEngine::SupportsSliceLossL()
4448 * Purpose: Retrieves information about an installed video decoder
4451 * --------------------------------------------------------------------------*/
4453 TInt CVDecTestEngine::SupportsSliceLossL(const TUid& aUid)
4455 PRINT((_L("CVDecTestEngine::SupportsSliceLossL(),In")))
4457 TInt supports = KErrNotSupported;
4458 TBool supported = EFalse;
4460 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4463 PRINT((_L("CVDecTestEngine::SupportsSliceLossL(),Error")))
4467 supported = info->SupportsSliceLoss();
4471 supports = KErrNone;
4474 CleanupStack::PopAndDestroy();
4476 PRINT((_L("CVDecTestEngine::SupportsSliceLossL(),Out")))
4480 /* ----------------------------------------------------------------------------
4481 * Name: CVDecTestEngine::SupportsPictureLossL()
4482 * Purpose: Retrieves information about an installed video decoder
4485 * --------------------------------------------------------------------------*/
4487 TInt CVDecTestEngine::SupportsPictureLossL(const TUid& aUid)
4489 PRINT((_L("CVDecTestEngine::SupportsPictureLossL(),In")))
4491 TInt supports = KErrNotSupported;
4492 TBool supported = EFalse;
4494 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4497 PRINT((_L("CVDecTestEngine::SupportsPictureLossL(),Error")))
4501 supported = info->SupportsPictureLoss();
4505 supports = KErrNone;
4508 CleanupStack::PopAndDestroy();
4510 PRINT((_L("CVDecTestEngine::SupportsPictureLossL(),Out")))
4515 /* ----------------------------------------------------------------------------
4516 * Name: CVDecTestEngine::SupportsMaxBitrateL()
4517 * Purpose: Retrieves information about an installed video encoder
4520 * --------------------------------------------------------------------------*/
4522 TInt CVDecTestEngine::SupportsMaxBitrateL(const TUid& aUid, TInt aBitrate)
4524 PRINT((_L("CVDecTestEngine::SupportsMaxBitrateL(),In")))
4526 TInt supports = KErrNotSupported;
4529 CVideoDecoderInfo* info = iDevvp->VideoDecoderInfoLC(aUid);
4532 PRINT((_L("CVDecTestEngine::SupportsMaxBitrateL(),Error")))
4536 bitrate = info->MaxBitrate();
4538 if (aBitrate <= bitrate)
4540 supports = KErrNone;
4543 CleanupStack::PopAndDestroy();
4545 PRINT((_L("CVDecTestEngine::SupportsMaxBitrateL(),Out")))
4550 /* ----------------------------------------------------------------------------
4551 * Name: CVDecTestEngine::SetYuvToRgbOptionsL()
4556 * --------------------------------------------------------------------------*/
4557 void CVDecTestEngine::SetYuvToRgbOptionsL(TInt aHWDevice, const TYuvToRgbOptions& aOptions, const TYuvFormat& aYuvFormat, TRgbFormat aRgbFormat)
4559 PRINT((_L("CVDecTestEngine::SetYuvToRgbOptionsL, In") ))
4561 if (aHWDevice == EPostProcessor)
4563 iDevvp->SetYuvToRgbOptionsL(iPostProcId, aOptions, aYuvFormat, aRgbFormat);
4567 iDevvp->SetYuvToRgbOptionsL(iDecHWDevId, aOptions, aYuvFormat, aRgbFormat);
4570 PRINT((_L("CVDecTestEngine::SetYuvToRgbOptionsL, Out") ))
4573 /* ----------------------------------------------------------------------------
4574 * Name: CVDecTestEngine::SetSlowClient()
4579 * --------------------------------------------------------------------------*/
4580 void CVDecTestEngine::SetSlowClient(TBool aOption)
4582 PRINT((_L("CVDecTestEngine::SetSlowClient, In") ))
4584 iSetSlowClient = aOption;
4586 PRINT((_L("CVDecTestEngine::SetSlowClient, Out") ))
4589 /* ----------------------------------------------------------------------------
4590 * Name: CVDecTestEngine::SetFastClient()
4595 * --------------------------------------------------------------------------*/
4596 void CVDecTestEngine::SetFastClient(TBool aOption)
4598 PRINT((_L("CVDecTestEngine::SetFastClient, In") ))
4600 iSetFastClient = aOption;
4602 PRINT((_L("CVDecTestEngine::SetFastClient, Out") ))
4605 /* ----------------------------------------------------------------------------
4606 * Name: CVDecTestEngine::SetAUFormat()
4611 * --------------------------------------------------------------------------*/
4612 TInt CVDecTestEngine::SetAUFormat()
4614 PRINT((_L("CVDecTestEngine::SetAUFormat, In") ))
4616 if (iCodecType== EAVC)
4618 iSetAUFormat = ETrue;
4623 return KErrNotSupported;
4626 PRINT((_L("CVDecTestEngine::SetAUFormat, Out") ))
4631 /* ----------------------------------------------------------------------------
4632 * Name: CVDecTestEngine::MoveFileL()
4637 * --------------------------------------------------------------------------*/
4638 TInt CVDecTestEngine::MoveFileL(const TDesC &anOld, const TDesC &aNew)
4640 PRINT((_L("CVDecTestEngine::MoveFileL, In") ))
4642 CFileMan* fileman = CFileMan::NewL(iFs);
4645 PRINT((_L("CVDecTestEngine::MoveFileL, mem alloc, fileman") ))
4647 PRINT((_L("CVDecTestEngine::MoveFileL, fileman [%x]"), fileman))
4651 PRINT((_L("CVDecTestEngine::MoveFileL, File [%s] moving to [%s]"), &anOld, &aNew ))
4652 fileman->Move(anOld, aNew);
4654 PRINT((_L("CVDecTestEngine::MoveFileL, File [%s] moved to [%s]"), &anOld, &aNew ))
4659 PRINT((_L("CVDecTestEngine::MoveFileL, mem del, fileman") ))
4661 PRINT((_L("CVDecTestEngine::MoveFileL, Out") ))
4666 /* ----------------------------------------------------------------------------
4667 * Name: CVDecTestEngine::CopyFileL()
4672 * --------------------------------------------------------------------------*/
4673 TInt CVDecTestEngine::CopyFileL(const TDesC &anOld, const TDesC &aNew)
4675 PRINT((_L("CVDecTestEngine::CopyFileL, In") ))
4677 CFileMan* fileman = CFileMan::NewL(iFs);
4680 PRINT((_L("CVDecTestEngine::MoveFileL, mem alloc, fileman") ))
4682 PRINT((_L("CVDecTestEngine::CopyFileL, fileman [%x]"), fileman))
4686 PRINT((_L("CVDecTestEngine::CopyFileL, File [%s] copying to [%s]"), &anOld, &aNew ))
4687 fileman->Copy(anOld, aNew);
4689 PRINT((_L("CVDecTestEngine::CopyFileL, File [%s] copied to [%s]"), &anOld, &aNew ))
4694 PRINT((_L("CVDecTestEngine::CopyFileL, mem del, fileman") ))
4696 PRINT((_L("CVDecTestEngine::CopyFileL, Out") ))
4701 /* ----------------------------------------------------------------------------
4702 * Name: CVDecTestEngine::HandleNewBufferL()
4703 * Purpose: Get Next input data
4707 * --------------------------------------------------------------------------*/
4710 void CVDecTestEngine::HandleNewBufferL()
4713 if ( iState == ERunning && !iInputEnd )
4715 if ( iDecHWDevId || iCIBuffMgmtOn ) //Retrieve buffer from Hwdevice
4721 FillAndSendBufferL(); // Postproc input
4727 PRINT((_L("CVDecTestEngine::HandleNewBufferL, inputEnd found") ))
4730 PRINT((_L("CVDecTestEngine::HandleNewBufferL, Getting last input buffer") ))
4737 /* ----------------------------------------------------------------------------
4738 * Name: CVDecTestEngine::LoadNextFrameL()
4743 * --------------------------------------------------------------------------*/
4745 TInt CVDecTestEngine::LoadNextFrameL(TVideoInputBuffer* aCodedInBuffer)
4747 // Normal VC1 video reading
4748 // Read file after the file header
4749 PRINT((_L("CVDecTestEngine::LoadNextFrameL, In")));
4750 unsigned int frameDataSize = 4; //4 Bytes to obain the framesize
4751 unsigned int frameSize=0;
4752 unsigned int Timestamp;
4754 TUint8* ptr = new (ELeave) TUint8[frameDataSize]; // dynamic alloc 1
4757 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem alloc, ptr") ))
4759 TPtr8 frameData(ptr, frameDataSize);
4760 if ( (err = iInFile.Read(frameData, frameDataSize)) != KErrNone)
4762 PRINT((_L("CVDecTestEngine::LoadNextFrameL, Error reading file") ))
4767 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem del, ptr") ))
4773 if (frameData.Length() < 4)
4775 PRINT((_L("CVDecTestEngine::LoadNextFrameL, File end found") ))
4776 aCodedInBuffer->iData.SetLength( 0 );
4782 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem del, ptr") ))
4787 PRINT((_L("CVDecTestEngine::LoadNextFrameL, Reading Item") ))
4788 ReadItemLE(ptr, 4, (TUint8 *)&frameSize);
4789 PRINT((_L("CVDecTestEngine::LoadNextFrameL, before AND frameSize: %x"), frameSize ))
4791 if (frameData.Length() < 4)
4793 PRINT((_L("CVDecTestEngine::LoadNextFrameL, File end found") ))
4799 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem del, ptr") ))
4804 //RCV_V2_FRAMESIZE_FLAGS
4805 frameSize = frameSize & ~(0xff000000);
4807 PRINT((_L("CVDecTestEngine::LoadNextFrameL, frameSize: %d"), frameSize ))
4809 //Now obtain the Timestamp of the frame
4810 if ( (err = iInFile.Read(frameData, frameDataSize)) != KErrNone)
4812 PRINT((_L("CVDecTestEngine::LoadNextFrameL, Error reading file %d"), err ))
4816 PRINT((_L("CVDecTestEngine::LoadNextFrameL, Reading Item2") ))
4817 ReadItemLE(ptr, 4, (TUint8 *)&Timestamp);
4818 PRINT((_L("CVDecTestEngine::LoadNextFrameL, Timestamp: %d"), Timestamp ))
4824 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem del, ptr") ))
4830 tempFrame += frameSize + 8;
4831 PRINT((_L("CVDecTestEngine::LoadNextFrameL, tota data %d"), tempFrame ))
4832 PRINT((_L("CVDecTestEngine::LoadNextFrameL, frame"), iFrame))
4834 TInt currentPos = 0;
4835 iInFile.Seek(ESeekCurrent, currentPos );
4836 PRINT((_L("CVDecTestEngine::LoadNextFrameL, currentPos %d"), currentPos ))
4839 //Send metadata in the first frame
4843 //err = iInFile.Seek(ESeekCurrent,pos);
4844 err = iInFile.Seek(ESeekStart,pos);
4845 // pos -= 44; //header (36) and framesize+timestamp (8)
4846 // err = iInFile.Seek(ESeekCurrent,pos);
4847 PRINT((_L("CVDecTestEngine::LoadNextFrameL, first frame")))
4848 if ( (err = iInFile.Read(aCodedInBuffer->iData, frameSize+44)) != KErrNone)
4850 PRINT((_L("CVDecTestEngine::LoadNextFrameL, Error reading file %d"), err ))
4854 TUint8* ptr2 = new(ELeave)TUint8[4]; // dynamic alloc 2
4857 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem alloc, ptr2") ))
4860 TPtr8 firstPtr(ptr2,4,4);
4861 // aCodedInBuffer->iData.Insert(35,firstPtr);
4862 PRINT((_L("CVDecTestEngine::LoadNextFrameL, frame1"), iFrame))
4863 TUint8* ptr = new ( ELeave ) TUint8[8]; // dynamic alloc 3
4866 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem alloc, ptr") ))
4869 Mem::FillZ( ptr, 8 );
4872 TPtr8 anotherPtr(ptr, 8, 8);
4873 aCodedInBuffer->iData.Insert(0, anotherPtr );
4880 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem del, ptr2 & ptr") ))
4885 PRINT((_L("CVDecTestEngine::LoadNextFrameL, iFrame num != 0: %d"), iFrame ))
4888 err = iInFile.Seek(ESeekCurrent, pos);
4889 PRINT((_L("CVDecTestEngine::LoadNextFrameL, read file: %d"), err ))
4890 if ( (err = iInFile.Read(aCodedInBuffer->iData, frameSize+8)) != KErrNone)
4892 PRINT((_L("CVDecTestEngine::LoadNextFrameL, Error reading file %d"), err ))
4896 TUint8* ptr2 = new(ELeave)TUint8[4]; // dynamic alloc 4
4899 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem alloc, ptr2") ))
4902 TPtr8 firstPtr(ptr2,4,4);
4903 // aCodedInBuffer->iData.Insert(0, firstPtr);
4907 PRINT((_L("CVDecTestEngine::LoadNextFrameL, mem del, ptr2") ))
4911 TInt substreamID = 0;
4912 if(aCodedInBuffer->iUser != NULL){
4913 *((TInt*)aCodedInBuffer->iUser) = substreamID;
4915 iInFile.Seek(ESeekCurrent, currentPos );
4916 PRINT((_L("CVDecTestEngine::LoadNextFrameL, currentPos %d"), currentPos ))
4919 aCodedInBuffer->iSequenceNumber = iFrame;
4920 aCodedInBuffer->iOptions = TVideoInputBuffer::EPresentationTimestamp;
4922 aCodedInBuffer->iPresentationTimestamp = Timestamp;
4923 iTimeToPlay = aCodedInBuffer->iPresentationTimestamp ;
4926 aCodedInBuffer->iDecodingTimestamp = Timestamp;
4927 iPresentationTimestamp = aCodedInBuffer->iPresentationTimestamp ;
4933 PRINT(_L("CVDecTestEngine::LoadNextFrameL.. Out"));
4938 /* ----------------------------------------------------------------------------
4939 * Name: CVDecTestEngine::ReadItemLE()
4944 * --------------------------------------------------------------------------*/
4945 //Currently Supporting only upto 4Bytes
4946 TBool CVDecTestEngine::ReadItemLE(unsigned char *readBuffer, int Size,
4947 unsigned char* pItem)
4949 PRINT((_L("CVDecTestEngine::ReadItemLE, In")));
4950 unsigned int High=0, Low=0;
4951 unsigned char m_char;
4953 int numbytes = Size;
4956 /* Read a little-endian file value into a variable, regardless of host endianness */
4957 while (numbytes-- >0)
4959 m_char = readBuffer[i++];
4963 High |= m_char << (shift-32);
4967 Low |= m_char << shift;
4975 *pItem = (unsigned char)Low;
4979 *(unsigned short *)pItem = (unsigned short)Low;
4983 *(unsigned int *)pItem = (unsigned int)Low;
4987 //WARN("Unknown size (%d) item read requested",Size);
4992 PRINT((_L("CVDecTestEngine::ReadItemLE, Out")));
4996 /* ----------------------------------------------------------------------------
4997 * Name: CVDecTestEngine::GoBackInFile()
5002 * --------------------------------------------------------------------------*/
5003 void CVDecTestEngine::GoBackInFile(TUint aBytes)
5005 PRINT((_L("CVDecTestEngine::GoBackInFile, In")));
5007 //If read pointer is in the end of the buffer change it in the beginning
5008 if (iReadDataChunk - iDataChunk >= aBytes)
5010 iReadDataChunk -= aBytes;
5014 TInt endBytes = aBytes - (iReadDataChunk - iDataChunk);
5015 iReadDataChunk = iDataChunk+iDataChunkSize-endBytes;
5018 PRINT((_L("CVDecTestEngine::GoBackInFile, Out, ")));
5023 /* ----------------------------------------------------------------------------
5024 * Name: CVDecTestEngine::ReadByteFromFile()
5029 * --------------------------------------------------------------------------*/
5030 TUint8 CVDecTestEngine::ReadByteFromFile()
5032 //PRINT((_L("CVDecTestEngine::ReadByteFromFile, In")));
5033 if (iDataReadFromFile == 0)
5035 TInt err = CheckAndFillDataChunk();
5038 PRINT((_L("CVDecTestEngine::ReadByteFromFile, ERROR [%d]"), err));
5043 if (iReadDataChunk >= iDataChunk+iDataChunkSize)
5045 iReadDataChunk = iDataChunk;
5048 if (iEndOfData && iReadDataChunk == iWriteDataChunk && iDataReadFromFile != 0)
5050 PRINT((_L("CVDecTestEngine::ReadByteFromFile, Input End found")));
5057 TUint8 byte = iReadDataChunk[0];
5064 /* ----------------------------------------------------------------------------
5065 * Name: CVDecTestEngine::ReadDataToBuffer()
5070 * --------------------------------------------------------------------------*/
5071 void CVDecTestEngine::ReadDataToBuffer(TVideoInputBuffer* aCodedInBuffer, TInt aSize, TBool aDiscard)
5073 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, In")));
5074 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, iWriteDataChunk [%x]"), iWriteDataChunk));
5075 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, iReadDataChunk [%x]"), iReadDataChunk));
5076 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, iDataChunk [%x]"), iDataChunk));
5077 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, size [%d]"), aSize));
5081 TInt err = CheckAndFillDataChunk();
5084 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, ERROR [%d]"), err));
5088 aCodedInBuffer->iData.Zero();
5092 if (iReadDataChunk == iWriteDataChunk && iDataReadFromFile != 0)
5094 PRINT((_L("CVDecTestEngine::ReadByteFromFile, Input End found")));
5099 if (iReadDataChunk+aSize > iWriteDataChunk && iReadDataChunk < iWriteDataChunk)
5101 PRINT((_L("CVDecTestEngine::ReadByteFromFile, Input End found")));
5104 aCodedInBuffer->iData.Append(iReadDataChunk, (iWriteDataChunk-iReadDataChunk));
5106 iReadDataChunk += aSize;
5110 else if (iReadDataChunk+aSize > iDataChunk+iDataChunkSize && iReadDataChunk > iWriteDataChunk &&
5111 iDataChunk+aSize-(iDataChunkSize+iDataChunk-iReadDataChunk) > iWriteDataChunk)
5113 PRINT((_L("CVDecTestEngine::ReadByteFromFile, Input End found")));
5116 aCodedInBuffer->iData.Append(iReadDataChunk, (iDataChunkSize+(iDataChunk-iReadDataChunk)));
5118 iReadDataChunk = iDataChunk;
5121 aCodedInBuffer->iData.Append(iReadDataChunk, (iWriteDataChunk-iReadDataChunk));
5123 iReadDataChunk += iWriteDataChunk-iReadDataChunk;
5129 if (iReadDataChunk+aSize <= iDataChunk+iDataChunkSize)
5133 aCodedInBuffer->iData.Append(iReadDataChunk, aSize);
5135 iReadDataChunk +=aSize;
5137 else if (iReadDataChunk+aSize > iDataChunk+iDataChunkSize)
5139 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, iReadDataChunk+aSize > iDataChunk+iDataChunkSize")));
5142 aCodedInBuffer->iData.Append(iReadDataChunk, (iDataChunkSize+iDataChunk-iReadDataChunk));
5144 TInt end = aSize - ( iDataChunkSize+iDataChunk - iReadDataChunk );
5145 iReadDataChunk = iDataChunk;
5146 PRINT( ( _L( "CVDecTestEngine::ReadDataToBuffer, iReadDataChunk = iDataChunk") ) );
5149 aCodedInBuffer->iData.Append(iReadDataChunk, end);
5151 iReadDataChunk += end;
5154 err = CheckAndFillDataChunk();
5157 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, ERROR [%d]"), err));
5161 PRINT((_L("CVDecTestEngine::ReadDataToBuffer, Out")));
5164 /* ----------------------------------------------------------------------------
5165 * Name: CVDecTestEngine::CheckAndFillDataChunk()
5170 * --------------------------------------------------------------------------*/
5171 TInt CVDecTestEngine::CheckAndFillDataChunk()
5173 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, In")));
5175 TInt err = KErrNone;
5177 //If all the data is read return KerrNone
5180 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, End of data")));
5184 TInt32 read = (TInt32)(iReadDataChunk);
5185 TInt32 write = (TInt32)(iWriteDataChunk);
5186 TInt32 chunk = (TInt32)(iDataChunkSize);
5187 TInt32 thres = (TInt32)(iDataThreshold);
5188 //First time fill the whole buffer
5190 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, read %d, write %d, chunk %d, thres %d"), read, write, chunk, thres));
5192 if (iDataReadFromFile == 0)
5194 TPtr8 temp(iWriteDataChunk, iDataChunkSize, iDataChunkSize);
5195 if ( (err = iInFile.Read(temp, iDataChunkSize)) != KErrNone)
5197 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, Infile read [%d]"), err));
5200 if (temp.Length() < iDataChunkSize)
5202 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, end of file found [%d]"), temp.Length()));
5203 if(temp.Length()== 0){
5204 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, Error! Trying to read zero-sized input file")));
5208 iWriteDataChunk += temp.Length();
5209 iDataReadFromFile += temp.Length();
5212 iDataReadFromFile += iDataChunkSize;
5213 for (TUint i = 0; i < 20; i++)
5215 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, [%x]"), iReadDataChunk[i]));
5218 else if (((read-write) > (chunk-thres)) && (iSentBuffCount != 0))
5220 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, iReadDataChunk-iWriteDataChunk > iDataChunkSize-iDataThreshold")));
5221 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, iWriteDataChunk [%x]"), iWriteDataChunk));
5222 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, iReadDataChunk [%x]"), iReadDataChunk));
5223 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, iDataChunk [%x]"), iDataChunk));
5224 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, iReadDataChunk-iWriteDataChunk [%d]"), iReadDataChunk-iWriteDataChunk));
5225 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, iDataChunkSize-iDataThreshold [%d]"), iDataChunkSize-iDataThreshold));
5227 TPtr8 temp(iWriteDataChunk, iReadDataChunk-iWriteDataChunk, iReadDataChunk-iWriteDataChunk);
5228 if ( (err = iInFile.Read(temp, (iReadDataChunk-iWriteDataChunk))) != KErrNone)
5230 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, Infile read [%d]"), err));
5233 if (temp.Length() < iReadDataChunk-iWriteDataChunk)
5235 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, End of file found [%d]"), temp.Length()));
5237 iWriteDataChunk += temp.Length();
5240 iWriteDataChunk += iReadDataChunk-iWriteDataChunk;
5241 iDataReadFromFile += iReadDataChunk-iWriteDataChunk;
5243 else if (((write-read) < thres) && (iSentBuffCount != 0) && ((write-read) > 0))
5245 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, iReadDataChunk-iWriteDataChunk > -iDataThreshold")));
5246 //fill end of the buffer
5247 TPtr8 end(iWriteDataChunk, iDataChunk+iDataChunkSize-iWriteDataChunk, iDataChunk+iDataChunkSize-iWriteDataChunk);
5248 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, TPtr created")));
5249 if ( (err = iInFile.Read(end, (iDataChunkSize+iDataChunk-iWriteDataChunk))) != KErrNone)
5251 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, Infile read [%d]"), err));
5254 if (end.Length() < (iDataChunkSize+iDataChunk-iWriteDataChunk))
5256 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, End of file found [%d]"), end.Length()));
5258 iWriteDataChunk += end.Length();
5262 //fill beginning of the buffer
5263 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, end of data chunk filled [%d]"), end.Length()));
5264 TPtr8 begin(iDataChunk, iReadDataChunk-iDataChunk, iReadDataChunk-iDataChunk);
5265 if ( (err = iInFile.Read(begin, iReadDataChunk-iDataChunk)) != KErrNone)
5267 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, Infile read [%d]"), err));
5270 if (begin.Length() < (iReadDataChunk-iDataChunk))
5272 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, End of file found [%d]"), begin.Length()));
5274 iWriteDataChunk = iDataChunk+begin.Length();
5277 iWriteDataChunk = iDataChunk+begin.Length();
5278 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, beginning of data chunk filled [%d]"), begin.Length()));
5279 iDataReadFromFile += iDataChunkSize-(iWriteDataChunk-iReadDataChunk);
5281 else if (iWriteDataChunk == iDataChunk+iDataChunkSize)
5283 iWriteDataChunk = iDataChunk;
5286 PRINT((_L("CVDecTestEngine::CheckAndFillDataChunk, Out")));
5290 /* ----------------------------------------------------------------------------
5291 * Name: CVDecTestEngine::PrintUncompressedFormat()
5292 * Purpose: Get Next input data
5296 * --------------------------------------------------------------------------*/
5299 void CVDecTestEngine::PrintUncompressedFormat(const TUncompressedVideoFormat& aFormat)
5301 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, In")))
5303 switch (aFormat.iDataFormat)
5306 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iDataFormat = ERgbRawData")))
5308 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iDataFormat = ERgbFbsBitmap")))
5309 switch(aFormat.iRgbFormat)
5312 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iRgbFormat = ERgb16bit444")))
5315 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iRgbFormat = ERgb16bit565")))
5318 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iRgbFormat = ERgb32bit888")))
5320 case EFbsBitmapColor4K:
5321 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iRgbFormat = EFbsBitmapColor4K")))
5323 case EFbsBitmapColor64K:
5324 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iRgbFormat = EFbsBitmapColor64K")))
5326 case EFbsBitmapColor16M:
5327 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iRgbFormat = EFbsBitmapColor16M")))
5329 case EFbsBitmapColor16MU:
5330 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iRgbFormat = EFbsBitmapColor16MU")))
5333 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, Error reading iRgbFormat [%x]"), aFormat.iRgbFormat))
5337 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iDataFormat = EYuvRawData")))
5338 switch(aFormat.iYuvFormat.iCoefficients)
5341 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = EYuvRange0")))
5344 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = EYuvRange1")))
5347 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = EYuvBt709")))
5349 case EYuvBt709Range0:
5350 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = EYuvBt709Range0")))
5352 case EYuvBt709Range1:
5353 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = EYuvBt709Range1")))
5356 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = EYuvBt601")))
5358 case EYuvBt601Range0:
5359 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = EYuvBt601Range0")))
5361 case EYuvBt601Range1:
5362 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = EYuvBt601Range1")))
5364 case ECustomYuvMatrix:
5365 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iCoefficients = ECustomYuvMatrix")))
5368 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, Error reading iCoefficients [%x]"), aFormat.iYuvFormat.iCoefficients))
5370 switch(aFormat.iYuvFormat.iPattern)
5372 case EYuv420Chroma1:
5373 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iPattern = EYuv420Chroma1")))
5375 case EYuv420Chroma2:
5376 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iPattern = EYuv420Chroma2")))
5378 case EYuv420Chroma3:
5379 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iPattern = EYuv420Chroma3")))
5381 case EYuv422Chroma1:
5382 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iPattern = EYuv422Chroma1")))
5384 case EYuv422Chroma2:
5385 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iPattern = EYuv422Chroma2")))
5388 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, Error reading iPattern [%x]"), aFormat.iYuvFormat.iPattern))
5390 switch(aFormat.iYuvFormat.iDataLayout)
5392 case EYuvDataPlanar:
5393 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iDataLayout = EYuvDataPlanar")))
5395 case EYuvDataInterleavedLE:
5396 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iDataLayout = EYuvDataInterleavedLE")))
5398 case EYuvDataInterleavedBE:
5399 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iDataLayout = EYuvDataInterleavedBE")))
5401 case EYuvDataSemiPlanar:
5402 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iDataLayout = EYuvDataSemiPlanar")))
5405 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, Error reading iDataLayout [%x]"), aFormat.iYuvFormat.iDataLayout))
5407 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iAspectRatioNum [%d]"), aFormat.iYuvFormat.iAspectRatioNum))
5408 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, iAspectRatioDenom [%d]"), aFormat.iYuvFormat.iAspectRatioDenom))
5411 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, Error reading iDataFormat [%x]"), aFormat.iDataFormat))
5414 PRINT((_L("CVDecTestEngine::PrintUncompressedFormat, Out")))
5417 /* ----------------------------------------------------------------------------
5418 * Name: CVDecTestEngine::ConvertToRealL()
5419 * Purpose: Converts the given descriptor to TReal
5420 * Parameters: const TDesC& aPtr
5422 * --------------------------------------------------------------------------*/
5424 TReal CVDecTestEngine::ConvertToRealL(const TDesC& aPtr)
5426 PRINT((_L("CVDecTestEngine::ConvertToReal(),In")))
5428 TInt point = aPtr.Find(_L("."));
5432 if (point != KErrNotFound)
5435 integer = aPtr.Mid(0, point);
5436 decimal = aPtr.Mid(point+1);
5440 User::Leave(KErrArgument);
5442 TInt decimalInt = 0;
5443 TInt integerInt = 0;
5444 TLex lexInt(integer);
5445 TLex lexDec(decimal);
5447 if (lexInt.Val(integerInt) != KErrNone || lexDec.Val(decimalInt) != KErrNone)
5449 PRINT((_L("CVDecTestEngine::ConvertToReal(), error in descriptor")))
5450 User::Leave(KErrArgument);
5455 TReal length = static_cast<TReal>(aPtr.Length()-point-1);
5456 TReal denom = pow(10.0, length);
5459 real = (static_cast<TReal>(integerInt)) + (static_cast<TReal>(decimalInt)/denom);
5461 PRINT((_L("CVDecTestEngine::ConvertToReal(),integer [%d]"), integerInt))
5462 PRINT((_L("CVDecTestEngine::ConvertToReal(),decimal [%d]"), decimalInt))
5463 PRINT((_L("CVDecTestEngine::ConvertToReal(),denom [%f]"), denom))
5464 PRINT((_L("CVDecTestEngine::ConvertToReal(),real [%f]"), real))
5466 PRINT((_L("CVDecTestEngine::ConvertToReal(),Out")))
5471 /* ----------------------------------------------------------------------------
5472 * Name: CVDecTestEngine::MdvpoNewBuffers()
5473 * Purpose: Availability of Next buffer is notified
5477 * --------------------------------------------------------------------------*/
5480 void CVDecTestEngine::MdvpoNewBuffers()
5482 PRINT((_L("CVDecTestEngine::MdvpoNewBuffers(), Newbuffer is available")))
5484 //if ( iFrameMeasurement )
5487 if ( iState == ERunning)
5489 iDecTestAO->RequestData();
5495 /* ----------------------------------------------------------------------------
5496 * Name: CVDecTestEngine::MdvpoReturnPicture()
5497 * Purpose: Postprocessor Input buffer is returned
5498 * Note: Used when input to Postprocessing
5499 * Parameters: TVideoPicture* aPicture
5501 * --------------------------------------------------------------------------*/
5504 void CVDecTestEngine::MdvpoReturnPicture(TVideoPicture* aPicture)
5506 if ( iRawInBuffer == aPicture )
5508 PRINT((_L("CVDecTestEngine::MdvpoReturnPicture, a Picture returned ")))
5509 iDecTestAO->RequestData();
5514 PRINT((_L("CVDecTestEngine::MdvpoReturnPicture, Returned picture unknown")))
5515 iError = KErrGeneral;
5521 /* ----------------------------------------------------------------------------
5522 * Name: CVDecTestEngine::MdvpoSupplementalInformation()
5523 * Purpose: Supplementary information is notified
5525 * Parameters: const TDesC8& aData, const TTimeIntervalMicroSeconds& aTimestamp, const TPictureId& aPictureId
5527 * --------------------------------------------------------------------------*/
5530 void CVDecTestEngine::MdvpoSupplementalInformation(const TDesC8& /*aData*/, const TTimeIntervalMicroSeconds& /*aTimestamp*/, const TPictureId& /*aPictureId*/)
5532 PRINT((_L("CVDecTestEngine::MdvpoSupplementalInformation ")))
5536 /* ----------------------------------------------------------------------------
5537 * Name: CVDecTestEngine::MdvpoPictureLoss()
5538 * Purpose: Loss of a picture is notified
5542 * --------------------------------------------------------------------------*/
5544 void CVDecTestEngine::MdvpoPictureLoss()
5547 PRINT((_L("CVDecTestEngine::MdvpoPictureLoss, A picture lost. ")))
5552 /* ----------------------------------------------------------------------------
5553 * Name: CVDecTestEngine::MdvpoPictureLoss()
5554 * Purpose: Loss of pictures is notified
5556 * Parameters: const TArray<TPictureId>& aPictures
5558 * --------------------------------------------------------------------------*/
5560 void CVDecTestEngine::MdvpoPictureLoss(const TArray<TPictureId>& aPictures)
5562 TInt count = aPictures.Count();
5563 iPictureLoss += count;
5564 PRINT((_L("CVDecTestEngine::MdvpoPictureLoss, [%d] pictures lost. "),count))
5566 for ( TInt i =0; i<count;i++ )
5568 TPictureId id = aPictures[i];
5569 PRINT((_L("CVDecTestEngine::MdvpoPictureLoss, Picure:[%d]"),i))
5571 /* if(id.iIdType == TPictureId::EPictureNumber)
5572 PRINT((_L("CVDecTestEngine::MdvpoPictureLoss, Picture Type:Picture Number, ID:[%d]"),id.iId))
5573 else if (id.iIdType == TPictureId::ETemporalReference)
5574 PRINT((_L("CVDecTestEngine::MdvpoPictureLoss, Picture Type:Temporal Reference, ID:[%d]"),id.iId))
5576 PRINT((_L("CVDecTestEngine::MdvpoPictureLoss, Picture Type:Unidentified piture")))
5581 /* ----------------------------------------------------------------------------
5582 * Name: CVDecTestEngine::MdvpoSliceLoss
5583 * Purpose: Loss of slice is notified
5585 * Parameters: TUint aFirstMacroblock, TUint aNumMacroblocks, const TPictureId& aPicture
5587 * --------------------------------------------------------------------------*/
5589 void CVDecTestEngine::MdvpoSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/)
5592 PRINT((_L("CVDecTestEngine::MdvpoSliceLoss, In")))
5594 // PRINT((_L("CVDecTestEngine::MdvpoSliceLoss, [%d] consecutive Mactoblocks from [%d] in raster-scan order are lost"),aPicture.aNumMacroblocks ,aPicture.aFirstMacroblock))
5595 /* if( aPicture.iIdType == TPictureId::EPictureNumber)
5596 PRINT((_L("CVDecTestEngine::MdvpoSliceLoss, Picture Type:Picture Number, ID:[%d]"),aPicture.iId))
5597 else if (aPicture.iIdType == TPictureId::ETemporalReference)
5598 PRINT((_L("CVDecTestEngine::MdvpoSliceLoss, Picture Type:Temporal Reference, ID:[%d]"),aPicture.iId))
5600 PRINT((_L("CVDecTestEngine::MdvpoSliceLoss, Picture Type:Unidentified piture")))
5606 /* ----------------------------------------------------------------------------
5607 * Name: CVDecTestEngine::MdvpoReferencePictureSelection
5610 * Parameters: const TDesC8& aSelectionData
5612 * --------------------------------------------------------------------------*/
5615 void CVDecTestEngine::MdvpoReferencePictureSelection(const TDesC8& /*aSelectionData*/)
5617 PRINT((_L("CVDecTestEngine::MdvpoReferencePictureSelection ")))
5621 /* ----------------------------------------------------------------------------
5622 * Name: CVDecTestEngine::MdvpoTimedSnapshotComplete()
5625 * Parameters: TInt aError, TPictureData* aPictureData, const TTimeIntervalMicroSeconds& aPresentationTimestamp, const TPictureId& aPictureId
5627 * --------------------------------------------------------------------------*/
5629 void CVDecTestEngine::MdvpoTimedSnapshotComplete(TInt aError, TPictureData* aPictureData, const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/, const TPictureId& aPictureId)
5631 PRINT((_L("CVDecTestEngine::MdvpoTimedSnapshotComplete(),In, error [%d]"), aError))
5633 if ( aError == KErrNone )
5639 newFile.Delete(newFile.Length()-5, 4);
5640 newFile.Append(_L("_id_"));
5641 newFile.AppendNum(aPictureId.iId);
5642 newFile.Append(_L(".yuv"));
5643 filename.Copy(newFile);
5645 TInt err = snapshot.Replace(iFs, filename, EFileShareExclusive|EFileWrite);
5647 if ( err != KErrNone )
5649 PRINT((_L("CVDecTestEngine::GetSnapshotL, snapshot file open failed")))
5655 err = snapshot.Write(*(aPictureData->iRawData),aPictureData->iRawData->Size());
5656 if ( err!= KErrNone )
5658 PRINT((_L("CVDecTestEngine::GetSnapshotL, snapshot file write failed")))
5663 PRINT((_L("CVDecTestEngine::GetSnapshotL, Picture size"),aPictureData->iRawData->Size()));
5666 PRINT((_L("CVDecTestEngine::MdvpoTimedSnapshotComplete(),Out")))
5670 /* ----------------------------------------------------------------------------
5671 * Name: CVDecTestEngine::MdvpoNewPictures()
5676 * --------------------------------------------------------------------------*/
5678 void CVDecTestEngine::MdvpoNewPictures()
5681 PRINT((_L("CVDecTestEngine::MdvpoNewPictures(),In, New output picture is available")))
5683 GetReturnedPictureL();
5688 /* ----------------------------------------------------------------------------
5689 * Name: CVDecTestEngine::MdvpoFatalError()
5690 * Purpose: Fatal error is notified
5691 * Note: Decoder/Postprocessor to be deleted
5692 * Parameters: TInt aError
5694 * --------------------------------------------------------------------------*/
5696 void CVDecTestEngine::MdvpoFatalError(TInt aError)
5699 PRINT((_L("CVDecTestEngine::MdvpoFatalError, FATAL ERROR [%d]"),aError))
5703 iTestClass->MvdeSetError(aError);
5707 /* ----------------------------------------------------------------------------
5708 * Name: CVDecTestEngine::MdvpoInitComplete()
5709 * Purpose: Completion of initialization is notified
5711 * Parameters: TInt aError
5713 * --------------------------------------------------------------------------*/
5715 void CVDecTestEngine::MdvpoInitComplete(TInt aError)
5717 PRINT((_L("CVDecTestEngine::MdvpoInitComplete, In")))
5720 PRINT((_L("CVDecTestEngine::MdvpoInitComplete, Stopping SchedulerWait")))
5721 iScheduler->AsyncStop();
5726 PRINT((_L("CVDecTestEngine::MdvpoInitComplete, mem del, iScheduler") ))
5730 if ( aError != KErrNone )
5733 PRINT((_L("CVDecTestEngine::MdvpoInitComplete, Error code [%d]"),aError))
5737 if (iDeleteDecoderFromInitComp)
5744 PRINT((_L("CVDecTestEngine::MdvpoInitComplete, mem del, iDevvp") ))
5746 iState = EStateNone;
5747 PRINT((_L("CVDecTestEngine::MdvpoInitComplete,DevVideo deleted")))
5750 iState = EInitialized;
5751 PRINT((_L("CVDecTestEngine::MdvpoInitComplete, Initialized")))
5753 //Initilize parameters for Decoding/Playback
5754 iCodedInBuffer = NULL;
5757 iReturnedBuffCount = 0;
5760 iStreamEnd = EFalse;
5762 iNoBuffAvailable = 0;
5764 iTestClass->MvdeStreamEndReached(); // Notify observer data transfer is complete
5765 PRINT((_L("CVDecTestEngine::MdvpoInitComplete, Out")))
5769 /* ----------------------------------------------------------------------------
5770 * Name: CVDecTestEngine::MdvpoStreamEnd()
5771 * Purpose: End of stream is notified
5775 * --------------------------------------------------------------------------*/
5777 void CVDecTestEngine::MdvpoStreamEnd()
5782 iDevvp->ReturnPicture(iOutBufferTemp);
5784 PRINT((_L("CVDecTestEngine::MdvpoStreamEnd(), Stream end")))
5786 if (iFrameMeasurement && iFrameTime != 0)
5788 TReal framerate = (TReal)(iReturnedBuffCount-1) / iFrameTime;
5789 PRINT((_L("CVDecTestEngine::MdvpoStreamEnd(), Frame rate: [%f] fps"), framerate))
5791 if(iInstantFpsEnabled)
5793 TInt err = KErrNone;
5794 for(TUint i=0; i < iInstantFpsList.Count(); i++ )
5797 TBuf8 <0x100> tempBuff;
5798 TTimeIntervalMicroSeconds time = iInstantFpsList[ i ];
5799 tempBuff.AppendNum((TInt64)time.Int64());
5800 tempBuff.Append(KEnd);
5801 err = iFpsFile.Write(tempBuff,tempBuff.Size() );
5802 if( err != KErrNone )
5804 PRINT((_L("CVDecTestEngine::MdvpoStreamEnd(), iFpsFile write error: [%d]"), err))
5808 iTestClass->MvdeStreamEndReached(); // Notify observer data transfer is complete
5811 /* ----------------------------------------------------------------------------
5812 * Name: CVDecTestEngine::MmvbmoNewBuffers()
5813 * Purpose: Observer callback in Custom interface Buffer management
5814 * Client is notified a new buffer(s) is available
5815 * Note: This is used when custom interface buffer management is used
5818 * --------------------------------------------------------------------------*/
5820 #ifdef __CI_HEADERS__
5822 void CVDecTestEngine::MmvbmoNewBuffers()
5825 PRINT((_L("CVDecTestEngine::MmvbmoNewBuffers(), New input buffer is available")))
5826 if ( (iState == ERunning) && iCIBuffMgmtOn )
5828 iDecTestAO->RequestData();
5833 /* ----------------------------------------------------------------------------
5834 * Name: CVDecTestEngine::MmvbmoReleaseBuffers()
5835 * Purpose: Observer callback in Custom interface Buffer management
5836 * Client is notified to release all buffers it has, using MmvbmReleaseBuffer
5837 * Note: This is used when custom interface buffer management is used
5840 * --------------------------------------------------------------------------*/
5841 #ifdef __CI_HEADERS__
5842 void CVDecTestEngine::MmvbmoReleaseBuffers()
5846 iCIBuffMgmt->MmvbmReleaseBuffer(iRawInBuffer);
5847 iRawInBuffer = NULL;
5849 PRINT((_L("CVDecTestEngine::MmvbmoReleaseBuffers(), buffer released")))
5854 /* ----------------------------------------------------------------------------
5855 * Name: CVDecTestEngine::
5859 * --------------------------------------------------------------------------*/
5860 #ifdef __RESOURCENOTIFICATION__
5861 void CVDecTestEngine::MmvroResourcesLost(TUid aMediaDevice)
5863 PRINT((_L("CVDecTestEngine::MmvroResourcesLost(), Uid [%x]"), aMediaDevice.iUid))
5865 if (iDecoderUid.iUid != aMediaDevice.iUid)
5867 PRINT((_L("CVDecTestEngine::MmvroResourcesLost, UID is different")))
5873 iDecTestAO->Cancel();
5874 if ( iDirectScreenAccess && iDsaStarted )
5876 iDevvp->AbortDirectScreenAccess();
5877 iDsaStarted = EFalse;
5878 PRINT((_L("CVDecTestEngine::MmvroResourcesLost, DSA is aborted ")))
5882 PRINT((_L("CVDecTestEngine::MmvroResourcesLost, Out ")))
5886 /* ----------------------------------------------------------------------------
5887 * Name: CVDecTestEngine::
5891 * --------------------------------------------------------------------------*/
5892 #ifdef __RESOURCENOTIFICATION__
5893 void CVDecTestEngine::MmvroResourcesRestored(TUid aMediaDevice)
5895 PRINT((_L("CVDecTestEngine::MmvroResourcesRestored(), Uid [%x]"), aMediaDevice.iUid))
5897 if (iDecoderUid.iUid != aMediaDevice.iUid)
5899 PRINT((_L("CVDecTestEngine::MmvroResourcesRestored, UID is different")))
5903 if ( iDirectScreenAccess && !iDsaStarted )
5905 TRAPD(err, StartDirectScreenAccessL());
5906 if (err != KErrNone)
5908 PRINT((_L("CVDecTestEngine::MmvroResourcesRestored, couldn't start DSA, err[%d]"),err))
5913 PRINT((_L("CVDecTestEngine::MmvroResourcesRestored, DSA started")))
5918 // Start DevVideoPlay
5921 PRINT((_L("CVDecTestEngine::MmvroResourcesRestored(), Out")))
5926 /* ----------------------------------------------------------------------------
5927 * Name: CVDecTestAO::CVDecTestAO()
5928 * Purpose: Constructor
5929 * Parameters: CVDecTestEngine* aTestEngine
5931 * --------------------------------------------------------------------------*/
5933 CVDecTestAO::CVDecTestAO(CVDecTestEngine* aTestEngine) :
5934 CActive(EPriorityStandard)
5936 iTestEngine = aTestEngine;
5937 CActiveScheduler::Add(this);
5942 /* ----------------------------------------------------------------------------
5943 * Name: CVDecTestAO::~CVDecTestAO()
5944 * Purpose: Deconstructor
5947 * --------------------------------------------------------------------------*/
5949 CVDecTestAO::~CVDecTestAO()
5957 /* ----------------------------------------------------------------------------
5958 * Name: CVDecTestAO::RequestData()
5959 * Purpose: Asyncronous request of next input data
5962 * --------------------------------------------------------------------------*/
5964 void CVDecTestAO::RequestData()
5969 TRequestStatus* status = &iStatus;
5970 User::RequestComplete(status, KErrNone);
5976 PRINT((_L("CVDecTestAO::RequestData(), Async request already active")))
5980 /* ----------------------------------------------------------------------------
5981 * Name: CVDecTestAO::RunL()
5982 * Purpose: Active object RunL
5985 * --------------------------------------------------------------------------*/
5987 void CVDecTestAO::RunL()
5989 if (iTestEngine->iState == EPaused || iTestEngine->iState == EStopped)
5993 iTestEngine->HandleNewBufferL();
5996 /* ----------------------------------------------------------------------------
5997 * Name: CVDecTestAO::DoCancel()
6001 * --------------------------------------------------------------------------*/
6004 void CVDecTestAO::DoCancel()
6009 /* ----------------------------------------------------------------------------
6010 * Name: CVDecTestEngine::CorruptInput()
6011 * Purpose: Make the input file corrupted to test codec's robustness
6015 * --------------------------------------------------------------------------*/
6017 void CVDecTestEngine::CorruptInput(TInt aFilter, TInt aInterval,
6018 TInt aFrameNum, TInt aPct)
6020 PRINT((_L("CVDecTestEngine::CorruptInput(),In")))
6022 iCorruptMarker = ETrue;
6023 iCorruptCounter = 0;
6026 iInterval = aInterval;
6027 iFrameNum = aFrameNum;
6030 PRINT((_L("CVDecTestEngine::CorruptInput(),Out")))
6033 /* ----------------------------------------------------------------------------
6034 * Name: CVDecTestEngine::CorruptEngine()
6035 * Purpose: Make the content in the buffer corrupted
6039 * --------------------------------------------------------------------------*/
6041 void CVDecTestEngine::CorruptEngineL()
6043 PRINT((_L("CVDecTestEngine::CorruptEngin(), In")))
6048 if( iFrameCounter <= iInterval )
6050 if( iFrameCounter < iInterval )
6062 User::Leave( KErrGeneral);
6064 TInt frameLength = iCodedInBuffer->iData.Size();
6065 TInt maxLength = iCodedInBuffer->iData.MaxLength();
6067 TUint8* memoryLocation = NULL;
6068 TPtr8 tmpPointer(memoryLocation, frameLength, maxLength );
6069 HBufC8* tempBuff = NULL;
6070 tempBuff = HBufC8::NewL(iInBuffSize);
6071 CleanupStack::PushL( tempBuff );
6074 PRINT((_L("CVDecTestEngine::CorruptEngineL, mem alloc, tempBuff") ))
6076 tmpPointer.Set(tempBuff->Des());
6081 PRINT((_L("CVDecTestEngine::CorruptEngin(),Filter 0, In")))
6084 TInt lengthCopy = (TInt)( frameLength * iPercentage / 100 );
6087 tmpPointer.Set(iCodedInBuffer->iData);
6089 TInt corruptLength = frameLength - lengthCopy;
6090 TInt corruptLen = 0;
6091 for( TInt i = 0; i < corruptLength; i++ )
6093 tmpPointer.Append('F');
6096 PRINT((_L("CVDecTestEngine::CorruptEngin(),[%d] bytes are corrupted"), corruptLen ) )
6097 iCodedInBuffer->iData.Set(tmpPointer);
6099 PRINT((_L("CVDecTestEngine::CorruptEngin(),Filter 0, Out")))
6104 PRINT((_L("CVDecTestEngine::CorruptEngin(),Filter 1, In")))
6116 TInt increment = (TInt)( ( frameLength - headerLen )/ ( ( frameLength - headerLen) * iPercentage / 100) ) - 1;
6118 for(TInt i = headerLen; i < frameLength; )
6121 TUint8* memorySeg = NULL;
6122 TPtr8 segCopy(memorySeg,increment);
6123 HBufC8* segBuff = NULL;
6124 segBuff = HBufC8::NewL( increment );
6126 PRINT((_L("CVDecTestEngine::CorruptEngine, mem alloc, segBuff") ))
6130 CleanupStack::PushL( segBuff );
6131 segCopy.Set(segBuff->Des());
6133 if( i < frameLength - increment - 1 )
6135 segCopy = iCodedInBuffer->iData.MidTPtr(i, increment );
6136 segCopy.Append('F');
6138 PRINT((_L("CVDecTestEngine::CorruptEngin(),[%d]th byte is corrupted"), i ) )
6139 tmpPointer.Append( segCopy );
6142 else // end of the frame
6144 segCopy = iCodedInBuffer->iData.MidTPtr(i, (frameLength - i) );
6145 tmpPointer.Append( segCopy );
6149 CleanupStack::PopAndDestroy( segBuff );
6152 PRINT((_L("CVDecTestEngine::CorruptEngine, mem del, segBuff") ))
6155 iCodedInBuffer->iData.Set(tmpPointer);
6157 PRINT((_L("CVDecTestEngine::CorruptEngin(),Filter 1, Out")))
6159 if( iCorruptCounter == iFrameNum )
6162 iCorruptCounter = 0;
6164 CleanupStack::PopAndDestroy( tempBuff );
6167 PRINT((_L("CVDecTestEngine::CorruptEngine, mem del, tempBuff") ))
6169 PRINT((_L("CVDecTestEngine::CorruptEngin(), Out")))
6173 /* ----------------------------------------------------------------------------
6174 * Name: CVDecTestEngine::CorruptEngineL(TVideoInputBuffer*
6176 * Purpose: Make the content in the buffer corrupted
6178 * Parameters: TVideoInputBuffer* aCodedInBuffer
6180 * --------------------------------------------------------------------------*/
6182 void CVDecTestEngine::CorruptEngineL( TVideoInputBuffer* aCodedInBuffer )
6184 PRINT((_L("CVDecTestEngine::CorruptEngin(TVideoInputBuffer* aCodedInBuffer), In")))
6185 iFrameWriteLength = aCodedInBuffer->iData.Length();
6190 if( iFrameCounter <= iInterval )
6192 if( iFrameCounter < iInterval )
6195 PRINT((_L("CVDecTestEngine::CorruptEngin(TVideoInputBuffer* aCodedInBuffer), Out")))
6205 User::Leave( KErrGeneral);
6208 TInt frameLength = aCodedInBuffer->iData.Size();
6209 TInt maxLength = aCodedInBuffer->iData.MaxLength();
6211 TUint8* memoryLocation = NULL;
6212 TPtr8 tmpPointer(memoryLocation, frameLength, maxLength );
6213 HBufC8* tempBuff = NULL;
6214 tempBuff = HBufC8::NewL(iInBuffSize);
6216 CleanupStack::PushL( tempBuff );
6218 PRINT((_L("CVDecTestEngine::CorruptEngine, mem alloc, tempBuff") ))
6220 tmpPointer.Set(tempBuff->Des());
6225 PRINT((_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),Filter 0, In")))
6226 tmpPointer.Set( aCodedInBuffer->iData );
6227 PRINT((_L("Length of tmpPointer, %d"), tmpPointer.Length() ) )
6229 TInt corruptLength = (TInt)( ( frameLength - 8 )* iPercentage / 100 );
6231 TInt copyLength = frameLength - corruptLength;
6233 TInt corruptLen = 0;
6235 for( TInt i = copyLength; i < frameLength; i++ )
6237 // Corrupt the byte by chaning its value instead of setting "zero"
6238 if( tmpPointer[i] < 0x05 )
6240 tmpPointer[i] += 0x05;
6244 tmpPointer[i] -= 0x05;
6248 PRINT((_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),[%d] bytes are corrupted"), corruptLen ) )
6250 PRINT((_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),Filter 0, Out")))
6252 else if( iFilter == 1)
6255 PRINT((_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),Filter 1, In")))
6256 tmpPointer.Set( aCodedInBuffer->iData );
6257 PRINT((_L("Length of tmpPointer, %d"), tmpPointer.Length() ) )
6259 // first 8 bytes of each frame should not be corrupted
6262 TInt increment = (TInt)( ( frameLength - headerLen )/ ( ( frameLength - headerLen) * iPercentage / 100) ) - 1;
6263 TInt corruptLen = 0;
6264 for(TInt i = headerLen + 1; i < frameLength; i += increment)
6266 // Corrupt the byte by chaning its value instead of setting "zero"
6267 if( tmpPointer[i] < 0x05 )
6269 tmpPointer[i] += 0x05;
6273 tmpPointer[i] -= 0x05;
6275 // tmpPointer[i] = 0x00;
6278 PRINT((_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),[%d] bytes are corrupted"), corruptLen ) )
6280 PRINT(_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),Filter 1, Out"))
6282 else if( iFilter == 2)
6284 PRINT(_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),Filter 2, In"))
6285 tmpPointer.Set( aCodedInBuffer->iData );
6286 PRINT((_L("Length of tmpPointer, %d"), tmpPointer.Length() ) )
6288 TInt corruptLength = (TInt)( ( frameLength - 8 )* iPercentage / 100 );
6290 //TInt copyLength = frameLength - corruptLength;
6291 iFrameWriteLength -= corruptLength;
6292 PRINT((_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),[%d] bytes are removed"), corruptLength ) )
6293 // Modify the framesize value in the frame header
6294 TUint32 finalSize = (TUint32)( iFrameWriteLength - 8 );
6295 for( TInt i = 0; i < 3; i++ )
6297 tmpPointer[i] = (TUint8) ( ( finalSize & ( (0x000000ff)<<(8*i) ) )>> (i*8) );
6299 /* the above assignment equals followings
6300 tmpPointer[0] = (TUint8)( finalSize & ~(0xffffff00) );
6301 tmpPointer[1] = (TUint8)( ( finalSize & ~(0xffff00ff))>>8 );
6302 tmpPointer[2] = (TUint8)( ( finalSize & ~(0xff00ffff))>>16 );
6305 PRINT(_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),Filter 2, Out"))
6307 else // iFilter == 3
6309 PRINT(_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),Filter 3, In"))
6310 tmpPointer.Set( aCodedInBuffer->iData );
6311 TInt corruptLength = (TInt)( ( frameLength - 8 )* iPercentage / 100 );
6313 //TInt copyLength = frameLength - corruptLength;
6314 iFrameWriteLength -= corruptLength;
6315 // Modify the framesize value in the frame header
6316 TUint32 finalSize = (TUint32)( iFrameWriteLength - 8 );
6317 for( TInt i = 0; i < 3; i++ )
6320 tmpPointer[i] = (TUint8) ( ( finalSize & ( (0x000000ff)<<(8*i) ) )>> (i*8) );
6323 // Copy the other bytes for the header
6324 for( TInt i = 3; i < headerLen; i++ )
6327 tmpPointer[i] = aCodedInBuffer->iData[i];
6329 TInt increment = (TInt)( ( frameLength - headerLen )/ ( ( frameLength - headerLen) * iPercentage / 100) ) - 1;
6330 TInt incrementCounter = 0;
6331 TInt byteCounter = 0;
6333 for( TInt i = headerLen; i < iFrameWriteLength; i++ )
6336 // metadata assignment
6337 tmpPointer[i] = aCodedInBuffer->iData[j];
6338 if( byteCounter < corruptLength )
6344 if( incrementCounter == increment )
6347 incrementCounter = 0;
6353 PRINT(_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer),Filter 3, Out"))
6358 aCodedInBuffer->iData.Set(tmpPointer);
6359 if( iCorruptCounter == iFrameNum )
6362 iCorruptCounter = 0;
6364 CleanupStack::PopAndDestroy( tempBuff );
6367 PRINT((_L("CVDecTestEngine::CorrupEngineL, mem del, tempBuff") ))
6369 PRINT((_L("CorruptEngineL(TVideoInputBuffer* aCodedInBuffer), Out")))
6374 /* ----------------------------------------------------------------------------
6375 * Name: CVDecTestEngine::CreateCorruptedFile()
6376 * Purpose: Make the content in the buffer corrupted and output to a file
6380 * --------------------------------------------------------------------------*/
6382 TInt CVDecTestEngine::CreateCorruptedFileL()
6384 PRINT((_L("CVDecTestEngine::CreateCorruptedFileL, In")));
6385 // Only support VC-1 decoder
6387 // make new buffer for the data read from the file
6388 HBufC8* tmpBuff = NULL;
6390 TVideoInputBuffer* codedBuffer = new(ELeave) TVideoInputBuffer;
6391 CleanupStack::PushL( codedBuffer );
6393 tmpBuff = HBufC8::NewL(iInBuffSize);
6394 CleanupStack::PushL( tmpBuff );
6395 codedBuffer->iData.Set(tmpBuff->Des());
6396 // read content of the file in the buffer
6399 TInt frameDropNumCounter = 0;
6400 while ( !iInputEnd )
6402 // Read the VC1 input video from the very beginning
6403 if( iCodecType == EVC1)
6405 err = ReadVC1FrameL( codedBuffer );
6407 else if( iCodecType == EMPEG4 )
6409 err = ReadMPEG4FrameL( codedBuffer );
6419 PRINT((_L("CVDecTestEngine::CreateCorruptedFileL, Error reading file") ))
6424 PRINT((_L("CVDecTestEngine::LoadNextFrameL, End of file is found") ))
6429 // the frame is successfully read and ready to be corrupted
6431 // make some bytes corrupted
6432 if( !iFrameDropMarker )
6434 CorruptEngineL( codedBuffer );
6435 PRINT((_L("Corruption is done")));
6439 // Prepare a buffer for copying the bytes from the frame buffer
6441 TInt copyLen = codedBuffer->iData.Size();
6443 TUint8* memorySeg = NULL;
6444 TPtr8 segCopy(memorySeg,copyLen);
6445 HBufC8* segBuff = NULL;
6446 segBuff = HBufC8::NewL( copyLen );
6447 CleanupStack::PushL( segBuff );
6448 segCopy.Set(segBuff->Des());
6450 if( iFrameDropMarker )
6452 iFrameWriteLength = codedBuffer->iData.Length();
6453 // drop the frame specified by the user
6454 if( iFrameDropCounter < iFrameDropInterval )
6456 PRINT((_L("CVDecTestEngine::CreateCorruptedFileL,iFrameWriteLength [%d]"), iFrameWriteLength ) )
6457 err = iOutCorruptedFile.Write(codedBuffer->iData, iFrameWriteLength );
6458 PRINT((_L("Output to the file for frame drop successful")));
6459 if ( err!= KErrNone )
6461 PRINT((_L("Output corrupted File write Failed")));
6462 iOutCorruptedFile.Close();
6470 frameDropNumCounter++;
6471 PRINT((_L("Frame is dropped!")));
6474 if( frameDropNumCounter == iFrameDropNum )
6476 iFrameDropCounter = 0;
6477 frameDropNumCounter = 0;
6480 else //write corrupted frame to the file
6482 // Prepare a buffer for copying the bytes from the frame buffer
6483 /* TInt copyLen = codedBuffer->iData.Size();
6485 TUint8* memorySeg = NULL;
6486 TPtr8 segCopy(memorySeg,copyLen);
6487 HBufC8* segBuff = NULL;
6488 segBuff = HBufC8::NewL( copyLen );
6489 CleanupStack::PushL( segBuff );
6490 segCopy.Set(segBuff->Des());
6493 PRINT((_L("CVDecTestEngine::CreateCorruptedFileL,iFrameWriteLength [%d]"), iFrameWriteLength ) )
6494 err = iOutCorruptedFile.Write(codedBuffer->iData, iFrameWriteLength );
6496 if ( err!= KErrNone )
6498 PRINT((_L("Output corrupted File write Failed")));
6499 iOutCorruptedFile.Close();
6501 PRINT((_L("Output corrupted File is successful")));
6506 iOutCorruptedFile.Close();
6507 CleanupStack::PopAndDestroy( tmpBuff );
6508 CleanupStack::PopAndDestroy( codedBuffer );
6509 PRINT((_L("CVDecTestEngine::CreateCorruptedFileL, Out")));
6513 /* ----------------------------------------------------------------------------
6514 * Name: CVDecTestEngine::OpenFileToWriteL()
6515 * Purpose: Open output File To Write
6516 * Note: Memory buffer output is used
6517 * Parameters: TFileName& aOutFileName
6519 * --------------------------------------------------------------------------*/
6522 void CVDecTestEngine::OpenFileToWriteL(TFileName& aInFileName)
6524 PRINT((_L("CVDecTestEngine::OpenFileToWrite, In")));
6525 TInt err = KErrNone;
6527 iOutCorruptedFileName.Copy(aInFileName);
6529 err = iOutCorruptedFile.Replace(iFs, iOutCorruptedFileName, EFileShareExclusive|EFileWrite);
6531 iOutCorruptedFileOpen = ETrue;
6534 if ( err!= KErrNone )
6536 PRINT((_L("CVDecTestEngine::OpenFileToWrite, Output corrupted File Replace Failed")));
6537 iOutCorruptedFile.Close();
6540 AssertTIntEqualL(KErrNone,err);
6541 PRINT((_L("CVDecTestEngine::OpenFileToWrite, Out")));
6545 /* ----------------------------------------------------------------------------
6546 * Name: CVDecTestEngine::ReadVC1FrameL()
6551 * --------------------------------------------------------------------------*/
6553 TInt CVDecTestEngine::ReadVC1FrameL(TVideoInputBuffer* aCodedInBuffer)
6555 // Note: this function is used as part of corrupt engine to make input
6556 // VC1 video corrupted for codec robustness test
6557 // Reading VC1 input video from the very beginning of the file
6558 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, In")));
6559 unsigned int frameDataSize = 4; //4 Bytes to obain the framesize
6560 unsigned int frameSize=0;
6561 unsigned int Timestamp;
6563 TUint8* ptr = new (ELeave) TUint8[frameDataSize];
6566 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, mem alloc, ptr") ))
6568 TPtr8 frameData(ptr, frameDataSize);
6569 if ( (err = iInFile.Read(frameData, frameDataSize)) != KErrNone)
6571 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, Error reading file") ))
6575 if (frameData.Length() < 4)
6577 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, File end found") ))
6578 aCodedInBuffer->iData.SetLength( 0 );
6586 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, Reading Item") ))
6587 ReadItemLE(ptr, 4, (TUint8 *)&frameSize);
6588 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, before AND frameSize: %x"), frameSize ))
6590 //RCV_V2_FRAMESIZE_FLAGS
6591 frameSize = frameSize & ~(0xff000000);
6593 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, frameSize: %d"), frameSize ))
6595 //Now obtain the Timestamp of the frame
6596 if ( (err = iInFile.Read(frameData, frameDataSize)) != KErrNone)
6598 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, Error reading file %d"), err ))
6602 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, Reading Item2") ))
6603 ReadItemLE(ptr, 4, (TUint8 *)&Timestamp);
6604 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, Timestamp: %d"), Timestamp ))
6608 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, mem del, ptr") ))
6612 //Send metadata in the first frame
6615 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, iFrame num == 0, %d"), iFrame ))
6616 TInt pos = - ( KVc1HeaderLength + 8 ); // assume the codec is configured
6617 err = iInFile.Seek(ESeekCurrent,pos);
6619 // header length is 36, KVc1HeaderLength = 36
6620 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, file header, 36 bytes")))
6621 if ( (err = iInFile.Read(aCodedInBuffer->iData, KVc1HeaderLength)) != KErrNone)
6623 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, Error reading file %d"), err ))
6630 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, iFrame num = %d"), iFrame ))
6632 err = iInFile.Seek(ESeekCurrent, pos);
6633 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, read file: %d"), err ))
6634 if ( (err = iInFile.Read(aCodedInBuffer->iData, frameSize+8)) != KErrNone)
6636 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, Error reading file %d"), err ))
6641 TInt currentPos = 0;
6642 iInFile.Seek(ESeekCurrent, currentPos );
6643 PRINT((_L("CVDecTestEngine::ReadVC1FrameL, currentPos %d"), currentPos ))
6647 aCodedInBuffer->iSequenceNumber = iFrame;
6648 aCodedInBuffer->iOptions = TVideoInputBuffer::EPresentationTimestamp;
6650 aCodedInBuffer->iPresentationTimestamp = Timestamp;
6651 iTimeToPlay = aCodedInBuffer->iPresentationTimestamp ;
6654 aCodedInBuffer->iDecodingTimestamp = Timestamp;
6655 iPresentationTimestamp = aCodedInBuffer->iPresentationTimestamp ;
6662 iFrameDropCounter++;
6663 PRINT(_L("CVDecTestEngine::ReadVC1FrameL.. Out"));
6669 /* ----------------------------------------------------------------------------
6670 * Name: CVDecTestEngine::ReadMPEG4FrameL()
6675 * --------------------------------------------------------------------------*/
6677 TInt CVDecTestEngine::ReadMPEG4FrameL(TVideoInputBuffer* aCodedInBuffer)
6679 // Note: this function is used as part of corrupt engine to make input
6680 // MPEG4 video corrupted for codec robustness test
6681 // Reading MPEG4 input video from the very beginning of the file
6682 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, In")));
6683 TInt buffLength = iInBuffSize;
6685 //TUint8* testData =NULL;
6686 TInt err = KErrNone;
6688 if ( aCodedInBuffer->iData.MaxLength() < buffLength )
6691 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, Buffer is small, [%d]Byte"),aCodedInBuffer->iData.MaxLength()))
6695 aCodedInBuffer->iData.SetLength(0);
6697 //Buffer is not full, reset size of buffer
6698 if ( aCodedInBuffer->iData.Length() < buffLength)
6700 buffLength = aCodedInBuffer->iData.Length();
6706 TBool found = EFalse;
6707 TBool firstStartCode = EFalse;
6709 TInt currentPos = 0;
6710 iInFile.Seek(ESeekCurrent, currentPos );
6711 if( currentPos != 0 && currentPos == iCurrentFilePos )
6717 iCurrentFilePos = currentPos;
6719 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, currentPos %d"), currentPos ))
6720 while (!iInputEnd && !found)
6722 TInt zeroCounter = 0;
6723 err = iInFile.Read(aCodedInBuffer->iData, 1 ); // read one byte
6724 if( aCodedInBuffer->iData.Length() == 0 )
6731 while( aCodedInBuffer->iData[0] == 0x00 && !iInputEnd )
6735 err = iInFile.Read(aCodedInBuffer->iData, 1 ); // read one byte
6738 if ((zeroCounter >= 2) && (aCodedInBuffer->iData[0] == 0x01))
6740 //byte = ReadByteFromFile();
6741 err = iInFile.Read(aCodedInBuffer->iData, 1 ); // read one byte
6742 //PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, iData %d, f2"), aCodedInBuffer->iData[0] ))
6744 //if (byte == 0xB6 && !firstStartCode)
6745 if( aCodedInBuffer->iData[0] == 0xB6 && !firstStartCode )
6747 firstStartCode = ETrue;
6749 //else if (byte != 0xB1 && firstStartCode)
6750 else if( aCodedInBuffer->iData[0]!= 0xB1 && firstStartCode )
6752 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, end of mpeg-4 picture found [%d]"), pos-4))
6757 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, pos (read length), %d"), pos))
6758 TInt backward = 0 - pos;
6759 err = iInFile.Seek(ESeekCurrent, backward );// go back
6761 if( err != KErrNone)
6763 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, Error seeking file %d"), err ))
6769 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, inputEndFound, %d"), pos))
6779 err = iInFile.Seek( ESeekCurrent, currentPos);
6780 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, position goes back to the beginning, %d"), currentPos))
6781 if ( (err = iInFile.Read(aCodedInBuffer->iData, pos )) != KErrNone)
6783 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, Error reading file %d"), err ))
6786 if( aCodedInBuffer->iData.Length() < 4 )
6790 iFrameDropCounter++;
6792 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, iFrameDropCounter, %d"), iFrameDropCounter))
6793 PRINT((_L("CVDecTestEngine::ReadMPEG4FrameL, Out")));
6797 /* ----------------------------------------------------------------------------
6798 * Name: CVDecTestEngine::SetFrameDrop()
6801 * Parameters: TInt aFrameInterval, TInt aFrameNum, TBool aFrameDropMarker
6803 * --------------------------------------------------------------------------*/
6805 void CVDecTestEngine::SetFrameDrop(TInt aFrameInterval, TInt aFrameNum, TBool aFrameDropMarker )
6807 PRINT(_L("CVDecTestEngine::SetFrameDrop, In"));
6810 iFrameDropInterval = aFrameInterval;
6811 iFrameDropNum = aFrameNum;
6812 iFrameDropMarker = aFrameDropMarker;
6815 PRINT(_L("CVDecTestEngine::SetFrameDrop, Out"));
6818 /* ----------------------------------------------------------------------------
6819 * Name: CVDecTestEngine::SetFLVPassword()
6822 * Parameters: TDesC8& aPassword
6824 * --------------------------------------------------------------------------*/
6825 void CVDecTestEngine::SetFLVPassword(TDesC8& aPassword)
6827 PRINT(_L("CVDecTestEngine::SetFLVPassword, In"));
6829 _LIT8(KNullTerminate, "\0");
6830 iSetPassword = ETrue;
6831 iPasswordForFLV.Copy( aPassword);
6832 iPasswordForFLV.Append( KNullTerminate );
6833 TBuf16<128> passwordPrint;
6834 passwordPrint.Copy( iPasswordForFLV );
6836 PRINT((_L("CVDecTestEngine::SetFLVPassword, iPasswordForFLV [%S]"), &passwordPrint))
6837 PRINT(_L("CVDecTestEngine::SetFLVPassword, Out"));
6841 /* ----------------------------------------------------------------------------
6842 * Name: CVDecTestEngine::EnablingInstantFpsL()
6845 * Parameters: TFileName& aOutFileName
6847 * --------------------------------------------------------------------------*/
6848 void CVDecTestEngine::EnableInstantFpsL(TFileName& aOutFileName)
6850 TInt err = KErrNone;
6851 if (!iFrameMeasurement)
6854 PRINT((_L("CVDecTestEngine::EnableInstantFpsL(), Frame measurement is not enabled")))
6856 User::Leave(KErrGeneral);
6859 err = iFpsFile.Replace(iFs, aOutFileName, EFileShareExclusive|EFileWrite);
6861 if ( err != KErrNone)
6863 PRINT((_L("CVDecTestEngine::EnableInstantFpsL, Output File open Failed")));
6867 iInstantFpsEnabled = ETrue;
6870 /* ----------------------------------------------------------------------------
6871 * Name: CVDecTestEngine::SetSecondScreenAccess
6872 * Purpose: Set second screen
6874 * Parameters: TBool aStatus
6876 * --------------------------------------------------------------------------*/
6877 void CVDecTestEngine::SetSecondScreenAccess(TBool aStatus)
6879 iUseSecondScreen = aStatus;