Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VDPAU / VAAPI: Use HEVC_MAIN GPU decoding (ffmpeg 2.8+) #7751

Merged
merged 4 commits into from Sep 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/depends/target/ffmpeg/FFMPEG-VERSION
@@ -1,5 +1,5 @@
LIBNAME=ffmpeg
BASE_URL=https://github.com/xbmc/FFmpeg/archive
VERSION=2.7.2-Jarvis-alpha1
VERSION=2.8.0-Jarvis-alpha3
ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz

2 changes: 1 addition & 1 deletion tools/depends/target/ffmpeg/Makefile
Expand Up @@ -44,7 +44,7 @@ ifeq ($(OS), ios)
endif
ifeq ($(OS), osx)
ffmpg_config += --disable-outdev=sdl
ffmpg_config += --disable-decoder=mpeg_xvmc --enable-vda --disable-crystalhd
ffmpg_config += --disable-decoder=mpeg_xvmc --enable-vda --disable-crystalhd --disable-videotoolbox
ffmpg_config += --target-os=darwin
ffmpg_config += --disable-securetransport
endif
Expand Down
13 changes: 12 additions & 1 deletion xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
Expand Up @@ -564,6 +564,15 @@ bool CDecoder::Open(AVCodecContext* avctx, AVCodecContext* mainctx, const enum P
}
break;
}
#if VA_CHECK_VERSION(0,38,0)
case AV_CODEC_ID_HEVC:
{
profile = VAProfileHEVCMain;
if (!m_vaapiConfig.context->SupportsProfile(profile))
return false;
break;
}
#endif
case AV_CODEC_ID_WMV3:
profile = VAProfileVC1Main;
if (!m_vaapiConfig.context->SupportsProfile(profile))
Expand All @@ -586,14 +595,16 @@ bool CDecoder::Open(AVCodecContext* avctx, AVCodecContext* mainctx, const enum P
return false;
}

if(avctx->codec_id == AV_CODEC_ID_H264)
if (avctx->codec_id == AV_CODEC_ID_H264)
{
m_vaapiConfig.maxReferences = avctx->refs;
if (m_vaapiConfig.maxReferences > 16)
m_vaapiConfig.maxReferences = 16;
if (m_vaapiConfig.maxReferences < 5)
m_vaapiConfig.maxReferences = 5;
}
else if (avctx->codec_id == AV_CODEC_ID_HEVC)
m_vaapiConfig.maxReferences = 16;
else
m_vaapiConfig.maxReferences = 2;

Expand Down
17 changes: 16 additions & 1 deletion xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
Expand Up @@ -66,6 +66,9 @@ CDecoder::Desc decoder_profiles[] = {
{"VC1_MAIN", VDP_DECODER_PROFILE_VC1_MAIN},
{"VC1_ADVANCED", VDP_DECODER_PROFILE_VC1_ADVANCED},
{"MPEG4_PART2_ASP", VDP_DECODER_PROFILE_MPEG4_PART2_ASP},
#ifdef VDP_DECODER_PROFILE_HEVC_MAIN
{"HEVC_MAIN", VDP_DECODER_PROFILE_HEVC_MAIN},
#endif
};
const size_t decoder_profile_count = sizeof(decoder_profiles)/sizeof(CDecoder::Desc);

Expand Down Expand Up @@ -844,6 +847,12 @@ void CDecoder::ReadFormatOf( AVCodecID codec
vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH;
vdp_chroma_type = VDP_CHROMA_TYPE_420;
break;
#ifdef VDP_DECODER_PROFILE_HEVC_MAIN
case AV_CODEC_ID_HEVC:
vdp_decoder_profile = VDP_DECODER_PROFILE_HEVC_MAIN;
vdp_chroma_type = VDP_CHROMA_TYPE_420;
break;
#endif
case AV_CODEC_ID_WMV3:
vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN;
vdp_chroma_type = VDP_CHROMA_TYPE_420;
Expand Down Expand Up @@ -882,12 +891,18 @@ bool CDecoder::ConfigVDPAU(AVCodecContext* avctx, int ref_frames)

ReadFormatOf(avctx->codec_id, vdp_decoder_profile, m_vdpauConfig.vdpChromaType);

if(avctx->codec_id == AV_CODEC_ID_H264)
if (avctx->codec_id == AV_CODEC_ID_H264)
{
m_vdpauConfig.maxReferences = ref_frames;
if (m_vdpauConfig.maxReferences > 16) m_vdpauConfig.maxReferences = 16;
if (m_vdpauConfig.maxReferences < 5) m_vdpauConfig.maxReferences = 5;
}
else if (avctx->codec_id == AV_CODEC_ID_HEVC)
{
// The DPB works quite differently in hevc and there isn't a per-file max
// reference number, so we force the maximum number (source: upstream ffmpeg)
m_vdpauConfig.maxReferences = 16;
}
else
m_vdpauConfig.maxReferences = 2;

Expand Down