Skip to content

Commit

Permalink
VDPAU: Use HEVC_MAIN GPU decoding (ffmpeg 2.8+)
Browse files Browse the repository at this point in the history
v2: Always use 16 ReFrames
  • Loading branch information
fritsch committed Aug 26, 2015
1 parent 7121243 commit a088d22
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
Original file line number Diff line number Diff line change
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

0 comments on commit a088d22

Please sign in to comment.