summaryrefslogtreecommitdiffstats
path: root/libhb/vadxva2.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2015-06-23 16:21:18 +0000
committerRodeo <[email protected]>2015-06-23 16:21:18 +0000
commita94ce281bb6883ea3d3cb11a20d8879e9c3675d2 (patch)
tree0c17dd018ace40dca38844ce4c4dc52293d2d331 /libhb/vadxva2.c
parent627c34a7be7178928e62437d79538b28a9e81b22 (diff)
libhb: add DXVA2-accelerated HEVC decoding.
Patch by Zhang Zhiqiang. Thanks! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7308 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/vadxva2.c')
-rw-r--r--libhb/vadxva2.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/libhb/vadxva2.c b/libhb/vadxva2.c
index 6ea0cad9b..3c1dc0cf3 100644
--- a/libhb/vadxva2.c
+++ b/libhb/vadxva2.c
@@ -124,19 +124,33 @@ void hb_va_close( hb_va_dxva2_t *dxva2 )
*/
static int hb_dx_create_video_decoder( hb_va_dxva2_t *dxva2, int codec_id, const hb_title_t* fmt )
{
+ int surface_alignment;
dxva2->width = fmt->geometry.width;
dxva2->height = fmt->geometry.height;
- dxva2->surface_width = (fmt->geometry.width + 15) & ~15;
- dxva2->surface_height = (fmt->geometry.height + 15) & ~15;
+
switch( codec_id )
{
case AV_CODEC_ID_H264:
dxva2->surface_count = 16 + 1;
+ surface_alignment = 16;
+ break;
+ case AV_CODEC_ID_HEVC:
+ dxva2->surface_count = 16 + 1;
+ surface_alignment = 128;
+ break;
+ case AV_CODEC_ID_MPEG2VIDEO:
+ dxva2->surface_count = 2 + 1;
+ surface_alignment = 32;
break;
default:
dxva2->surface_count = 2 + 1;
+ surface_alignment = 16;
break;
}
+
+ dxva2->surface_width = HBALIGN(fmt->geometry.width, surface_alignment);
+ dxva2->surface_height = HBALIGN(fmt->geometry.height, surface_alignment);
+
LPDIRECT3DSURFACE9 surface_list[VA_DXVA2_MAX_SURFACE_COUNT];
if( FAILED( IDirectXVideoDecoderService_CreateSurface( dxva2->vs,
dxva2->surface_width,