コード例 #1
0
HRESULT CStreamParser::ParsePlanarPCM(Packet *pPacket)
{
  CMediaType mt = m_pPin->GetActiveMediaType();

  WORD nChannels = 0, nBPS = 0, nBlockAlign = 0;
  audioFormatTypeHandler(mt.Format(), mt.FormatType(), nullptr, &nChannels, &nBPS, &nBlockAlign, nullptr);

  // Mono needs no special handling
  if (nChannels == 1)
    return Queue(pPacket);

  Packet *out = new Packet();
  out->CopyProperties(pPacket);
  out->SetDataSize(pPacket->GetDataSize());

  int nBytesPerChannel = nBPS / 8;
  int nAudioBlocks = pPacket->GetDataSize() / nChannels;
  BYTE *out_data = out->GetData();
  const BYTE *in_data = pPacket->GetData();

  for (int i = 0; i < nAudioBlocks; i += nBytesPerChannel) {
    // interleave the channels into audio blocks
    for (int c = 0; c < nChannels; c++) {
      memcpy(out_data + (c * nBytesPerChannel), in_data + (nAudioBlocks * c), nBytesPerChannel);
    }
    // Skip to the next output block
    out_data += nChannels * nBytesPerChannel;

    // skip to the next input sample
    in_data += nBytesPerChannel;
  }

  return Queue(out);
}
コード例 #2
0
ファイル: StreamParser.cpp プロジェクト: cynics/LAVFilters
HRESULT CStreamParser::Parse(const GUID &gSubtype, Packet *pPacket)
{
  if (gSubtype != m_gSubtype) {
    m_gSubtype = gSubtype;
    Flush();
  }
  
  if (!pPacket || (pPacket->dwFlags & LAV_PACKET_PARSED)) {
    Queue(pPacket);
  } else if (m_gSubtype == MEDIASUBTYPE_AVC1 && (m_strContainer == "mpegts" || pPacket->dwFlags & LAV_PACKET_H264_ANNEXB)) {
    ParseH264AnnexB(pPacket);
  } else if (m_gSubtype == MEDIASUBTYPE_HDMVSUB) {
    ParsePGS(pPacket);
  } else if (m_gSubtype == MEDIASUBTYPE_HDMV_LPCM_AUDIO) {
    pPacket->RemoveHead(4);
    Queue(pPacket);
  } else if (pPacket->dwFlags & LAV_PACKET_MOV_TEXT) {
    ParseMOVText(pPacket);
  } else if (m_strContainer == "avi" && m_gSubtype == MEDIASUBTYPE_ASS) {
    ParseRawSSA(pPacket);
  } else if (m_gSubtype == MEDIASUBTYPE_AAC && (m_strContainer != "matroska" && m_strContainer != "mp4")) {
    ParseAAC(pPacket);
  } else if (m_gSubtype == MEDIASUBTYPE_UTF8 && (pPacket->dwFlags & LAV_PACKET_SRT)) {
    ParseSRT(pPacket);
  } else {
    Queue(pPacket);
  }

  return S_OK;
}
コード例 #3
0
bool FCircularQueueTest::RunTest( const FString& Parameters )
{
	const uint32 QueueSize = 8;

	// empty queue
	{
		TCircularQueue<int32> Queue(QueueSize);

		TestTrue(TEXT("Newly created queues must be empty"), Queue.IsEmpty());
		TestFalse(TEXT("Newly created queues must not be full"), Queue.IsFull());
	}

	// partially filled
	{
		TCircularQueue<int32> Queue(QueueSize);
		int32 Value;
	
		TestTrue(TEXT("Adding to an empty queue must succeed"), Queue.Enqueue(666));
		TestFalse(TEXT("Partially filled queues must not be empty"), Queue.IsEmpty());
		TestFalse(TEXT("Partially filled queues must not be full"), Queue.IsFull());
		TestTrue(TEXT("Peeking at a partially filled queue must succeed"), Queue.Peek(Value));
	}

	// full queue
	{
		TCircularQueue<int32> Queue(QueueSize);

		for (int32 Index = 0; Index < QueueSize - 1; ++Index)
		{
			TestTrue(TEXT("Adding to non-full queue must succeed"), Queue.Enqueue(Index));
		}

		TestFalse(TEXT("Full queues must not be empty"), Queue.IsEmpty());
		TestTrue(TEXT("Full queues must be full"), Queue.IsFull());
		TestFalse(TEXT("Adding to full queue must fail"), Queue.Enqueue(666));

		int32 Value;

		for (int32 Index = 0; Index < QueueSize - 1; ++Index)
		{
			TestTrue(TEXT("Peeking at a none-empty queue must succeed"), Queue.Peek(Value));
			TestEqual(TEXT("The peeked at value must be correct"), Value, Index);
			TestTrue(TEXT("Removing from a non-empty queue must succeed"), Queue.Dequeue(Value));
			TestEqual(TEXT("The removed value must be correct"), Value, Index);
		}

		TestTrue(TEXT("A queue that had all items removed must be empty"), Queue.IsEmpty());
		TestFalse(TEXT("A queue that had all items removed must not be full"), Queue.IsFull());
	}

	return true;
}
コード例 #4
0
ファイル: task.cpp プロジェクト: hbirchtree/coffeecutie
u64 RuntimeQueue::Queue(
    ThreadId const& targetThread, RuntimeTask&& task, rqe& ec)
{
    if(!VerifyTask(task, ec))
        return 0;

    if(task.flags & RuntimeTask::Periodic)
    {
        task.time = RuntimeTask::clock::now() + task.interval;
    }

    if(!context->globalMod.try_lock())
    {
        ec = RQE::ShuttingDown;
        return 0;
    }

    auto thread_id = targetThread.hash();
    auto q_it      = context->queues.find(thread_id);

    if(q_it == context->queues.end())
    {
        context->globalMod.unlock();
        ec = RQE::InvalidQueue;
        return 0;
    } else
    {
        context->globalMod.unlock();
        return Queue(&q_it->second, std::move(task), ec);
    }
}
コード例 #5
0
OsclReturnCode FillBufferDoneThreadSafeCallbackAOEnc::ReceiveEvent(OMX_OUT OMX_HANDLETYPE aComponent,
        OMX_OUT OMX_PTR aAppData,
        OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer)
{

    // Note: this method executes in the context of remote thread trying to make the callback
    OsclReturnCode status;
    OsclProcStatus::eOsclProcError sema_status;

    // Wait on the remote thread control semaphore. If the queue is full, must block and wait
    // for the AO to dequeue some previous event. If the queue is not full, proceed
    sema_status = RemoteThreadCtrlSema.Wait();
    if (sema_status != OsclProcStatus::SUCCESS_ERROR)
        return OsclFailure;

    // NOTE: the semaphore will prevent the mempool allocate to be used if the queue is full

    // allocate the memory for the callback event specific data
    FillBufferDoneSpecificData* ED = (FillBufferDoneSpecificData*) iMemoryPool->allocate(sizeof(FillBufferDoneSpecificData));

    // pack the relevant data into the structure
    ED->hComponent = aComponent;
    ED->pAppData = aAppData;
    ED->pBuffer = aBuffer;

    // convert the pointer into OsclAny ptr
    OsclAny* P = (OsclAny*) ED;
    // now , queue the event pointer
    status = Queue(P);

    return status;
}
コード例 #6
0
// Delete all in folder, then folder itself
void CImImap4Compound::DeleteFolderL(TRequestStatus& aStatus, const TMsvId aSource)
	{
	LOG_COMMANDS((iSession->LogText(_L8("COMPOUND DeleteFolder(%x)"),aSource)));

	Queue(aStatus);

	// Save parameters
	iSourceFolder=aSource;
	iSequence=SeqDeleteFolder;

	// The folder might be a mailbox (in which case it needs selecting, messages
	// deleting, closing, then deletion of the folder) or it might be a \Noselect
	// folder, which we just delete.
	User::LeaveIfError(iEntry->SetEntry(aSource));
	TMsvEmailEntry folder=iEntry->Entry();
	if (!folder.Mailbox())
		{
		DBG((iSession->LogText(_L8("Folder is marked \\NoSelect: just delete it"))));

		// Skip the first few steps
		iStep=2;
		}
	else
		{
		DBG((iSession->LogText(_L8("Folder is a mailbox: deleting messages and folder"))));

		// Start from folder selection
		iStep=0;
		}

	DoRunL();
	}
コード例 #7
0
// Delete
void CImImap4Compound::DeleteL(TRequestStatus& aStatus, const CMsvEntrySelection& aSourceSel)
	{
	LOG_COMMANDS( (iSession->LogText(_L8("COMPOUND Delete selection"))));

	Queue(aStatus);

	// Save parameters
	iSource=aSourceSel[0];
	delete iSourceSel;
	iSourceSel = NULL;
	iSourceSel=aSourceSel.CopyL();
	iMessageSelection=iSelectionStillToDelete=aSourceSel.Count();

	// Find the offending source folder
	if ((iSourceFolder=FindFolderL(iSource))==NULL)
		{
		Complete(KErrNotFound);
		return;
		}

	// Select it
	iStep=0;
	iSequence=SeqDelete;
	DoRunL();
	}
コード例 #8
0
void CImImap4Compound::GenericCopyL(TRequestStatus& aStatus, const CMsvEntrySelection& aSourceSel, const TMsvId aDestination, TInt* aSequence)
	{
	DBG((iSession->LogText(_L8("CImImap4Compound::GenericCopyL()"))));
 	Queue(aStatus);

	// Save parameters
	iSource=aSourceSel[0];
	delete iSourceSel;
	iSourceSel = NULL;
	iSourceSel=aSourceSel.CopyL();
	iDestinationFolder=aDestination;
	iMessageSelection=iSelectionStillToCopy=iSelectionStillToDelete=aSourceSel.Count();

	// Check that selection elements are contiguous. Just call Copy on contiguous selections.
	
	iSourceFolder=FindFolderL((*iSourceSel)[iSelectionStillToCopy-1]);

	// Find the offending source folder
	if (iSourceFolder == NULL &&
		aSequence != SeqMoveFromLocal && aSequence != SeqCopyFromLocal)
		{
		Complete(KErrNotFound);
		return;
		}

	// Select it
	iStep=0;
	iSequence=aSequence;
	DoRunL();
	}
コード例 #9
0
void CCmdUndertaker::RunL()
	{
	TInt handle = iDeadThreadHandle;
	Queue(); // Queue early, to try and avoid missing notifications
	// We don't use the RunL if we're in paranoid mode - the undertaker notifications are serviced directly in DoWork() without an active scheduler
	ProcessHandle(handle);
	}
コード例 #10
0
/**
Resumes the operation following a migration.
*/
void CImapCompoundDeleteFolder::ResumeOperationL(TRequestStatus& aStatus, CImapSession& aSession)
	{
	iSession = &aSession;
	__LOG_TEXT(iSession->LogId(), "CImapCompoundDeleteFolder::Resuming");
	__ASSERT_DEBUG(iCurrentStep==ESuspendedForMigrate, TImapServerPanic::ImapPanic(TImapServerPanic::EDeleteCompoundUnexpectedState));
	iStopForMigrate = EFalse;
	
	// Switch on next step - some "next steps" require a SELEECT first...
	switch (iNextStep)
		{
		case ESelectSourceMailboxRW:
		case EDeleteFolder:
			{
			// just return to the main state machine
			CompleteSelf();
			break;
			}

		case EDeleteAllMessages:
		case ECloseFolder:
		case EDeleteLocalFolder:
		case EFinished:
			// not expected
		default:
			{
			__ASSERT_DEBUG(EFalse, TImapServerPanic::ImapPanic(TImapServerPanic::EDeleteCompoundUnexpectedState));
			// abandon the compound operation
			iNextStep=EFinished;
			CompleteSelf();
			break;
			}
		}
	Queue(aStatus);
	}
コード例 #11
0
ファイル: smspsend.cpp プロジェクト: kuailexs/symbiandump-os1
void CSmsMessageSend::Start(CSmsMessage& aSmsMessage, TInt aOptions,
                            const TSmsAddr& aSmsAddr, TRequestStatus& aStatus)
{
    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGESEND_START_1, "CSmsMessageSend::Start()");

    __ASSERT_DEBUG(iState == ESmsMessageSendIdle,SmspPanic(KSmspPanicUnexpectedState));

    //
    // Store the request status that we will complete when finished...
    //
    Queue(aStatus);

    //
    // Initialise member data...
    //
    iSmsMessage=&aSmsMessage;
    iSmsMessage->ParsedToFromAddress(iToFromTelNumber);
    iOptions = aOptions;
    iSmsAddr = aSmsAddr;

    iSmsPDUData.iType      = aSmsMessage.Type();
    iSmsPDUData.iTotal     = 0;
    iSmsPDUData.iSent      = 0;
    iSmsPDUData.iDelivered = 0;

    iSendError = KErrNone;
    iSmsEventLogger->Event().SetId(KLogNullId);

    //
    // Begin by setting the bearer...
    //
    iState = ESmsMessageSendSetBearer;
    iSmspSetBearer.NotifyBearerSet(iStatus);
    SetActive();
} // CSmsMessageSend::Start
コード例 #12
0
ファイル: Queue.C プロジェクト: Regan-Koopmans/ProjectApricot
Queue<T>& Queue<T>::operator=(const Queue<T>& other)
{
	Node * nodePointer = head;
	Node * tempPointer = 0;
	
	while (nodePointer)
	{
		tempPointer = nodePointer;
		nodePointer = nodePointer->next;
		delete tempPointer;
	}
	head = 0;	

	if (!other.head)
	{
		Queue();
		return *this;
	}
	else
	{
		Node * otherPointer = other.head;
		while (otherPointer)
		{
			enqueue(otherPointer->element);
			otherPointer = otherPointer->next;
		}
	}
	
	return *this;
	
}
コード例 #13
0
/**
Deletes a session.

@param aSession The session to delete. This routine takes immediate ownsership
                of the session.
@param aClientStatus Signals completion of the request
*/
void CPopSessionManager::DeleteSession(CImPop3Session& aSession,
                                       TRequestStatus& aClientStatus)
	{
	iSession = &aSession;
	QuitSession();
	Queue(aClientStatus);
	}
コード例 #14
0
void CImImap4Compound::NewOnlySyncL(TRequestStatus& aStatus, const TMsvId aFolder)
	{
	LOG_COMMANDS((iSession->LogText(_L8("COMPOUND NewOnlySync(%x)"),aFolder)));

	Queue(aStatus);

	if (iSession->ImapIdleSupported())
		{
		// Igmore sync as Imap Idle is supported
		Complete(KErrNone);
		return;
		}

	// Check folder is a mailbox
	User::LeaveIfError(iEntry->SetEntry(aFolder));
	TMsvEmailEntry mbcheck=iEntry->Entry();
	if (!mbcheck.Mailbox())
		{
		// Not a mailbox, so we can't sync it
		Complete(KErrNotSupported);
		return;
		}

	// Select it
	iStep=0;
	iSequence=SeqNewSync;
	iSourceFolder=aFolder;
	DoRunL();
	}
コード例 #15
0
void CImapCompoundDelete::StartOperation(TRequestStatus& aStatus, CImapSession& aSession)
	{
	iSession = &aSession;
	__LOG_TEXT(iSession->LogId(), "CImapCompoundDelete::StartOperation()");
	iNextStep = ESelectSourceMailboxRW;
	Queue(aStatus);
	CompleteSelf();
	}
コード例 #16
0
void CSvgtRasterizerOOMPropertyMonitor::ConstructL()
    {
    
    if (CActiveScheduler::Current())    
        {
        User::LeaveIfError(iOomWatcher.Attach(KSvgtPropertyCategory, ESvgtPropertyBool));
        Queue();
        }
    }
コード例 #17
0
ファイル: LurkMsg.cpp プロジェクト: jason-amju/amjulib
void Lurker::ShowYesNo(const std::string& q, const Colour& fgCol, const Colour& bgCol, 
  CommandFunc no, CommandFunc yes)
{
  LurkMsg msg(q, fgCol, bgCol,AMJU_CENTRE, 0);
  msg.SetNoCommand(no);
  msg.SetYesCommand(yes);

  Queue(msg);
}
コード例 #18
0
void CImapOpSyncSubs::SynchroniseSubscriptionsL(TRequestStatus& aStatus)
	{
	// Do we need to know what folders are subscribed remotely?
	if (iImapSettings.Synchronise() == EUseLocal && 
		(iImapSettings.Subscribe() == EUpdateNeither || iImapSettings.Subscribe() == EUpdateLocal))
		{
		// Just update any remote subscriptions
		iNextSyncAction = CImapSyncManager::EUpdateRemoteSubscription;
		Queue(aStatus);
		CompleteSelf();
		SetActive();
		}
	else
		{
		// Update our list of remotely subscribed folders
		// First, we need to go through the entire service, resetting all
		// the 'remote subscribed' flags.
		ResetSubscriptionFlagsL(iServiceId);

		// Build a buffer to quote the folder path (it may be necessary)
		HBufC16* path=HBufC16::NewLC(iImapSettings.FolderPath().Length()+2);
		path->Des().Copy(iImapSettings.FolderPath());
		if (iImapSettings.FolderPath().Length())
			{
			path->Des().Append(iImapSettings.PathSeparator());
			}

		path->Des().Append(KStarChar);
		
		// Quote it
		CImapFolder::DoQuoteL(path);

		// List this tree
		iNextSyncAction = CImapSyncManager::EProcessRemoteSubscription;
		iServerEntry.SetEntry(iServiceId);
		TMsvEmailEntry entry = iServerEntry.Entry();
		
		iSession.LsubL(iStatus, KNullDesC, path->Des(), iImapListFolderInfo);

		Queue(aStatus);
		SetActive();
		CleanupStack::PopAndDestroy(path);
		}
	}
コード例 #19
0
void CImImap4Compound::SynchroniseL(TRequestStatus& aStatus)
	{
	LOG_COMMANDS((iSession->LogText(_L8("COMPOUND Synchronise"))));

	Queue(aStatus);

	iStep=0;
	iSequence=SeqSynchronise;
	DoRunL();	
	}
コード例 #20
0
ファイル: T_SCHED.CPP プロジェクト: cdaffara/symbiandump-os2
void CTestActive::RunL()
	{
	Queue();
	switch (iState++)
		{
	case 0:
		test.Next(_L("Extended error"));
		CBaActiveScheduler::DisplayExtendedError(KUidTest,66);
		test.Next(_L("Leave for alert"));
		CBaActiveScheduler::LeaveForAlert(KUidBaflDll,77);
		CBaActiveScheduler::DisplayExtendedError(KUidTest,88); // won't reach here
		break;
	case 1:
		test.Next(_L("Leave"));
		User::Leave(-22);
		CBaActiveScheduler::DisplayExtendedError(KUidBaflDll,9); // won't reach here
		break;
	case 2:
		test.Next(_L("Leave no alert"));
		CBaActiveScheduler::LeaveNoAlert();
		CBaActiveScheduler::DisplayExtendedError(KUidTest,55); // won't reach here
		break;
	case 3:
		test.Next(_L("Extended error again"));
		CBaActiveScheduler::DisplayExtendedError(KUidBaflDll,33);
		test.Next(_L("Leave for info print"));
		CBaActiveScheduler::LeaveForInfoPrint(KUidTest,11);
		CBaActiveScheduler::DisplayExtendedError(KUidBaflDll,88); // won't reach here
		break;
	case 4:
		test.Next(_L("Simple error handler"));
		CBaActiveScheduler::LeaveForErrorHandler(&iSimpleErrorHandler);
		CBaActiveScheduler::DisplayExtendedError(KUidBaflDll,87); // won't reach here
		break;
	case 5:
		test.Next(_L("Complex error handler - 1"));
		CBaActiveScheduler::LeaveForErrorHandler(&iComplexErrorHandler);
		CBaActiveScheduler::DisplayExtendedError(KUidBaflDll,86); // won't reach here
		break;
	case 6:
		test.Next(_L("Complex error handler - 2"));
		iComplexErrorHandler.SetState(6);
		CBaActiveScheduler::LeaveForErrorHandler(&iComplexErrorHandler);
		CBaActiveScheduler::DisplayExtendedError(KUidBaflDll,85); // won't reach here
		break;
	case 7:
		test.Next(_L("Exit"));
		CBaActiveScheduler::Exit();
		CBaActiveScheduler::DisplayExtendedError(KUidBaflDll,99); // won't reach here
		break;
	case 8:
		CBaActiveScheduler::DisplayExtendedError(KUidBaflDll,999); // won't reach here
		break;
		}
	}
コード例 #21
0
ファイル: smsulog.cpp プロジェクト: cdaffara/symbiandump-os1
/**
 *  Gets the specified event from the log.
 *  
 *  The event itself can be obtained using a subsequent call to Event().
 *  
 *  @param aStatus Asynchronous status word to signal when the operation is complete
 *  @param aId Log event ID for the event
 *  @capability ReadUserData
 */
EXPORT_C void CSmsEventLogger::GetEvent(TRequestStatus& aStatus,TLogId aId)
	{
    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSMSEVENTLOGGER_GETEVENT_1, "CSmsEventLogger::GetEvent");

	__ASSERT_DEBUG(iState==ESmsEventLoggerIdle,SmsuPanic(KSmsuPanicUnexpectedState));
	iState=ESmsEventLoggerGettingEvent;
	Queue(aStatus);
	iLogEvent->SetId(aId);
	iLogWrapper->Log().GetEvent(*iLogEvent,iStatus);
	SetActive();
	} // CSmsEventLogger::GetEvent
コード例 #22
0
void CImImap4Compound::SelectL(TRequestStatus& aStatus, const TMsvId aFolder)
	{
	LOG_COMMANDS((iSession->LogText(_L8("COMPOUND Select(%x)"),aFolder)));

	Queue(aStatus);

	iStep=0;
	iSequence=SeqSelect;
	iSourceFolder=aFolder;
	DoRunL();
	}
コード例 #23
0
ファイル: smspdel.cpp プロジェクト: cdaffara/symbiandump-os1
/**
 *  Starts CSmsPDUDelete active object
 *  Calls private methd OpenStore
 *  
 *  @param aStatus     Reguest status
 *  @param aStoreIndex Index to the store to be read
 */
void CSmsPDUDelete::Start(CArrayFix<TGsmSmsSlotEntry>& aLocationArray, TRequestStatus& aStatus)
	{
	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPDUDELETE_START_1, "CSmsPDUDelete::Start()");

	__ASSERT_DEBUG(iState==ESmsPDUDeleteIdle,SmspPanic(KSmspPanicUnexpectedState));

	Queue(aStatus);

	iLocationArray=&aLocationArray;
	iState=ESmsPDUDeleteOpeningStore;
	OpenStore();
	} // CSmsPDUDelete::Start
コード例 #24
0
void CImImap4Compound::RenameL(TRequestStatus& aStatus, const TMsvId aTarget, const TDesC& aNewName)
	{
	LOG_COMMANDS((iSession->LogText(_L8("COMPOUND Rename(%x)"),aTarget)));

	Queue(aStatus);

	iStep=0;
	iSequence=SeqRename;
	iSource=aTarget;
	iLeafName=aNewName;
	DoRunL();	
	}
コード例 #25
0
/**
Gets a new logged in POP session.
The caller passes a reference to a session pointer which they should initially
set to NULL. If the client status is completed with KErrNone, then their pointer
will have been updated to point to the new session. If the client status completes
with an error then their pointer will not be updated.

@param aSettings POP settings
@param aIAPPrefs IAP preferences
@param aSession Used to store session to pass back to caller
@param aClientStatus Signals completion of the request
*/
void CPopSessionManager::GetSessionL(CImPop3Settings& aSettings,
												 CImIAPPreferences& aIAPPrefs,
												 CImPop3Session*& aSession,
												 TRequestStatus& aClientStatus)
	{
	iSettings = &aSettings;
	iIAPPrefs = &aIAPPrefs;
	iStoreSession = &aSession;

	CreateConnectionL();

	Queue(aClientStatus);
	}
コード例 #26
0
void CImImap4Compound::CreateL(TRequestStatus& aStatus, const TMsvId aParent, const TDesC& aLeafName, const TBool aFolder)
	{
	LOG_COMMANDS((iSession->LogText(_L8("COMPOUND Create(%x)"),aParent)));

	Queue(aStatus);

	iStep=0;
	iSequence=SeqCreate;
	iSource=aParent;
	iLeafName=aLeafName;
	iFolder=aFolder;
	DoRunL();	
	}
コード例 #27
0
int main(int argc, char *argv[]) {

  DATA_TYPE *A;
  DATA_TYPE *B_outputFromGpu;

  /////////////////////////
  size_t oldSizes[2] = { NI, NJ };
  size_t newSizes[2];
  getNewSizes(oldSizes, NULL, newSizes, NULL, "Convolution2D_kernel", 2);
  NI = newSizes[0];
  NJ = newSizes[1];
  /////////////////////////

  A = (DATA_TYPE *)malloc(NI * NJ * sizeof(DATA_TYPE));
  B_outputFromGpu = (DATA_TYPE *)malloc(NI * NJ * sizeof(DATA_TYPE));

  init(A);
   
  platform = new Platform(PLATFORM_ID);
  context = platform->getContext();
  Device device = platform->getDevice(DEVICE_ID);
  Queue queue = Queue(*context,device,Queue::EnableProfiling);

  cl_mem_init(A,queue);
  SourceFile kernelFile = KERNEL_DIRECTORY KERNEL_FILE_NAME; 
 
  // Create a program from the kernel source
  Program program(context,kernelFile);
  if(!program.build(device)) {
      std::cout << "Error building the program: " << "\n";
      std::cout << program.getBuildLog(device) << "\n";
      return 1;
    }
 
  // Create the OpenCL kernel
  kernel = program.createKernel(kernelName.c_str()); 
  cl_launch_kernel(queue);


  queue.readBuffer(*b_mem_obj,NI * NJ * sizeof(DATA_TYPE),(void*) B_outputFromGpu);
  queue.finish();

  conv2D(A, B_outputFromGpu);

  free(A);
  free(B_outputFromGpu);

  cl_clean_up();
  return 0;
}
コード例 #28
0
ファイル: smspenum.cpp プロジェクト: cdaffara/symbiandump-os1
/**
 *  Starts CSmsStoreRead active object
 *  Calls GetMessageStoreInfo method from the MM API
 *  
 *  @param aStatus Reguest status
 *  @param aStoreIndex Index to the store to be read
 */
void CSmsStoreRead::Start( TRequestStatus& aStatus, TInt aStoreIndex )
	{
	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_START_1, "CSmsStoreRead::Start()");

	iState = ESmsStoreReadGettingStoreInfo;
	// Initialises current slot index
	iCurrentSlotIndex = 0;

	// Gets current store info
	iSmsMessaging.GetMessageStoreInfo( iStatus, aStoreIndex, iStoreInfoPckg );

	Queue(aStatus);
	TimedSetActive(iSmsSettings.Timeout());
	} // CSmsStoreRead::Start
コード例 #29
0
	// Method used in the Task, orogen component.
	bool SamplesInput::Update_Velocity_Seabotix(base::samples::RigidBodyState &sample_position, std::queue<base::samples::RigidBodyState> &queueOfRBS, int size, base::samples::RigidBodyState &actual_RBS, base::samples::RigidBodyAcceleration &actual_RBA)
	{
		base::samples::RigidBodyState rbs;
		// Position that will be take in account when applying the filter. May vary from -(queue.size-1)/2 to (queue.size-1)/2 where 0 is at the center of the queue.
		double t = 0;
		// Order of the polynomial
		double n = 3;
		// step used to establish the derivatives
		double step = 0.05; 	// 0.05 from observed values in Seabotix
		Convert_Seabotix(sample_position, rbs);
		Queue(size, rbs, queueOfRBS);
		return Filter_SV(queueOfRBS, t, n, step, actual_RBS, actual_RBA); //Velocity(queueOfRBS, size, actual_RBS, actual_RBA, t, n, step);

	}
コード例 #30
0
ファイル: console.cpp プロジェクト: cdaffara/symbiandump-os1
void CConsoleReader::RunL()
	{
	TInt err = iStatus.Int();
	if (err)
		{
		iObserver.CoHandleError(err);
		}
	else
		{
		TUint keyCode = iRawRead ? iRawReadBuf[0] : iStdin.KeyCode();
		TUint modifiers = iRawRead ? 0 : iStdin.KeyModifiers();
		iObserver.CoHandleKey(keyCode, modifiers);
		}
	Queue();
	}