コード例 #1
0
	// Launches the CUDA kernels to fill in the texture data
	void CudaVideoRender::renderVideoFrame(bool bUseInterop )
	{
		static unsigned int nRepeatFrame = 0;
		int bIsProgressive = 1, bFPSComputed = 0;
		bool bFramesDecoded = false;

		if (nRepeatFrame > 0)
		{
			--nRepeatFrame;
		}
		if (0 != m_pFrameQueue)
		{
			bFramesDecoded = copyDecodedFrameToTexture(nRepeatFrame, true, &bIsProgressive);		
		}
	}
コード例 #2
0
ファイル: videoDecodeD3D9.cpp プロジェクト: huoyao/cudasdk
// Launches the CUDA kernels to fill in the texture data
void renderVideoFrame(HWND hWnd, bool bUseInterop)
{
    static unsigned int nRepeatFrame = 0;
    int repeatFactor = g_iRepeatFactor;
    int bIsProgressive = 1, bFPSComputed = 0;
    bool bFramesDecoded = false;

    if (0 != g_pFrameQueue)
    {
        // if not running, we simply don't copy
        // new frames from the decoder
        if (!g_bDeviceLost && g_bRunning)
        {
            bFramesDecoded = copyDecodedFrameToTexture(nRepeatFrame, true, &bIsProgressive);
        }
    }
    else
    {
        return;
    }

    if (bFramesDecoded)
    {
        while (repeatFactor-- > 0)
        {
            // draw the scene using the copied textures
            if (g_bUseDisplay && bUseInterop)
            {
                // We will always draw field/frame 0
                drawScene(0);

                if (!repeatFactor)
                {
                    computeFPS(hWnd, bUseInterop);
                }

                // If interlaced mode, then we will need to draw field 1 separately
                if (!bIsProgressive)
                {
                    drawScene(1);

                    if (!repeatFactor)
                    {
                        computeFPS(hWnd, bUseInterop);
                    }
                }

                bFPSComputed = 1;
            }
        }

        // Pass the Windows handle to show Frame Rate on the window title
        if (!bFPSComputed)
        {
            computeFPS(hWnd, bUseInterop);
        }
    }

    if (bFramesDecoded && g_bFrameStep)
    {
        if (g_bRunning)
        {
            g_bRunning = false;
        }
    }
}