[FFmpeg-devel] Hi, I want to ask a question about dxva2 in ffmpeg.Thanks

高伟 highgod0401 at gmail.com
Wed Jul 4 10:45:46 CEST 2012


Hi,
I trid to use dxva2 as hardware accelerate,and I use lockrect to get the
data from GPU to System memory.But I found the performace is so bad
,especially wmv3.Is there any way to copy the data more quickly?

Here is my code

int hb_va_extract( vlc_va_dxva2_t *dxva2,AVFrame *frame)

{
 LPDIRECT3DSURFACE9 d3d = (LPDIRECT3DSURFACE9)(uintptr_t)frame->data[3];
D3DLOCKED_RECT lock;
 if( FAILED( IDirect3DSurface9_LockRect( d3d, &lock, NULL, D3DLOCK_READONLY
)))
{
av_log(NULL, AV_LOG_ERROR, "Trying DXVA2\n" );
return FALSE;
}
 if( dxva2->render == MAKEFOURCC( 'N', 'V', '1', '2' ))
{
uint8_t *plane[2] =
{
(uint8_t *)lock.pBits,
(uint8_t*)lock.pBits + lock.Pitch * dxva2->surface_height
};
size_t  pitch[2] =
{
lock.Pitch,
lock.Pitch,
};
 hb_copy_from_nv12(plane, pitch, dxva2->width, dxva2->height, frame );
 }
IDirect3DSurface9_UnlockRect( d3d );

 return TRUE;
}

Tnanks

Best regards.


More information about the ffmpeg-devel mailing list