[FFmpeg-devel] Hi, I want to adk a question about wmv3 hardware acceleration.The function" IDirect3DSurface9_LockRect" very slow for the WMV3 format.

高伟 highgod0401 at gmail.com
Fri Jun 29 04:43:01 CEST 2012


Hi

I add dxva2 to ffmpeg.exe,and use it to decode video.Then I get data from
video card.I use the function like vlc just like the follows.


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;
}

I tested the h264,mpeg2,vc1,wmv3 video.h264,mpeg2,vc1 just cost 1-2 ms when
call function IDirect3DSurface9_LockRect.but when wmv3 format video called
this function, it almost cost 12ms,so I don't know why it cost so much
time.Is there any differences for different video formats?

Thanks


More information about the ffmpeg-devel mailing list