diff options
author | Rodeo <[email protected]> | 2015-06-23 16:21:18 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2015-06-23 16:21:18 +0000 |
commit | a94ce281bb6883ea3d3cb11a20d8879e9c3675d2 (patch) | |
tree | 0c17dd018ace40dca38844ce4c4dc52293d2d331 | |
parent | 627c34a7be7178928e62437d79538b28a9e81b22 (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
-rw-r--r-- | libhb/common.c | 3 | ||||
-rw-r--r-- | libhb/common.h | 2 | ||||
-rw-r--r-- | libhb/vadxva2.c | 18 | ||||
-rw-r--r-- | libhb/vadxva2.h | 3 |
4 files changed, 23 insertions, 3 deletions
diff --git a/libhb/common.c b/libhb/common.c index 6b7859461..8cc1dc65d 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -4539,7 +4539,8 @@ int hb_use_dxva( hb_title_t * title ) || title->video_codec_param == AV_CODEC_ID_H264 || title->video_codec_param == AV_CODEC_ID_VC1 || title->video_codec_param == AV_CODEC_ID_WMV3 - || title->video_codec_param == AV_CODEC_ID_MPEG4 ) + || title->video_codec_param == AV_CODEC_ID_MPEG4 + || title->video_codec_param == AV_CODEC_ID_HEVC ) && title->opaque_priv ); } diff --git a/libhb/common.h b/libhb/common.h index 158ade247..76bff6a2e 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -70,6 +70,8 @@ #define HB_DVD_READ_BUFFER_SIZE 2048 +#define HBALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + typedef struct hb_handle_s hb_handle_t; typedef struct hb_hwd_s hb_hwd_t; typedef struct hb_list_s hb_list_t; 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, diff --git a/libhb/vadxva2.h b/libhb/vadxva2.h index 9f0e19705..d095d0c93 100644 --- a/libhb/vadxva2.h +++ b/libhb/vadxva2.h @@ -57,6 +57,7 @@ static const GUID DXVA2_ModeVC1_A = { 0x1b81beA0, 0xa0c7, 0x11d3, {0xb9, 0x84, 0 static const GUID DXVA2_ModeVC1_B = { 0x1b81beA1, 0xa0c7, 0x11d3, {0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} }; static const GUID DXVA2_ModeVC1_C = { 0x1b81beA2, 0xa0c7, 0x11d3, {0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} }; static const GUID DXVA2_ModeVC1_D = { 0x1b81beA3, 0xa0c7, 0x11d3, {0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5} }; +static const GUID DXVA2_ModeHEVC_VLD_Main = { 0x5b11d51b, 0x2f4c,0x4452, {0xbc, 0xc3, 0x09, 0xf2, 0xa1, 0x16, 0x0c, 0xc0} }; typedef struct { @@ -187,6 +188,8 @@ static const hb_dx_mode_t dxva2_modes[] = { "VC-1 IDCT", &DXVA2_ModeVC1_C, 0 }, { "VC-1 MoComp", &DXVA2_ModeVC1_B, 0 }, { "VC-1 post processing", &DXVA2_ModeVC1_A, 0 }, + + { "DXVA2_ModeHEVC_VLD_Main", &DXVA2_ModeHEVC_VLD_Main, AV_CODEC_ID_HEVC }, { NULL, NULL, 0 } }; |