[MPlayer-cvslog] r37423 - in trunk: codec-cfg.c configure etc/codecs.conf libmpcodecs/img_format.c libmpcodecs/img_format.h libmpcodecs/vd_ffmpeg.c libvo/vo_vdpau.c

michael subversion at mplayerhq.hu
Sat Jun 27 20:35:28 CEST 2015


Author: michael
Date: Sat Jun 27 20:35:28 2015
New Revision: 37423

Log:
vo_vdpau: Add support for VDPAU accelerated HEVC decoding

This change adds support for decoding HEVC content through VDPAU. Note
that as things currently stand, the nvidia drivers are buggy and the
output is not watcheable (its interlacing the top and bottom halves
of each frame), but that should be fixed within the driver, hopefully
without any further changes here.

Author: Philip Langdale <philipl at overt.org>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

Modified:
   trunk/codec-cfg.c
   trunk/configure
   trunk/etc/codecs.conf
   trunk/libmpcodecs/img_format.c
   trunk/libmpcodecs/img_format.h
   trunk/libmpcodecs/vd_ffmpeg.c
   trunk/libvo/vo_vdpau.c

Modified: trunk/codec-cfg.c
==============================================================================
--- trunk/codec-cfg.c	Mon Jun 22 23:03:38 2015	(r37422)
+++ trunk/codec-cfg.c	Sat Jun 27 20:35:28 2015	(r37423)
@@ -256,6 +256,7 @@ static const struct {
     {"VDPAU_WMV3",  IMGFMT_VDPAU_WMV3},
     {"VDPAU_VC1",   IMGFMT_VDPAU_VC1},
     {"VDPAU_MPEG4", IMGFMT_VDPAU_MPEG4},
+    {"VDPAU_HEVC",  IMGFMT_VDPAU_HEVC},
 
     {NULL,    0}
 };

Modified: trunk/configure
==============================================================================
--- trunk/configure	Mon Jun 22 23:03:38 2015	(r37422)
+++ trunk/configure	Sat Jun 27 20:35:28 2015	(r37423)
@@ -4721,6 +4721,7 @@ if test "$_vdpau" = auto && test "$_x11"
   _vdpau=no
   if test "$_dl" = yes ; then
     return_statement_check vdpau/vdpau_x11.h 'vdp_device_create_x11(0, 0, 0, 0)' VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 -lvdpau && _vdpau=yes
+    return_statement_check vdpau/vdpau_x11.h 'vdp_device_create_x11(0, 0, 0, 0)' VDP_DECODER_PROFILE_HEVC_MAIN -lvdpau && _vdpau_hevc=yes
   fi
 fi
 if test "$_vdpau" = yes ; then
@@ -4728,6 +4729,9 @@ if test "$_vdpau" = yes ; then
   libs_mplayer="$libs_mplayer -lvdpau"
   vomodules="vdpau $vomodules"
   libavhwaccels="$libavhwaccels H263_VDPAU_HWACCEL H264_VDPAU_HWACCEL MPEG1_VDPAU_HWACCEL MPEG2_VDPAU_HWACCEL MPEG4_VDPAU_HWACCEL VC1_VDPAU_HWACCEL WMV3_VDPAU_HWACCEL"
+  if test "$_vdpau_hevc" = yes ; then
+    libavhwaccels="$libavhwaccels HEVC_VDPAU_HWACCEL"
+  fi
 else
   def_vdpau='#define CONFIG_VDPAU 0'
   novomodules="vdpau $novomodules"

Modified: trunk/etc/codecs.conf
==============================================================================
--- trunk/etc/codecs.conf	Mon Jun 22 23:03:38 2015	(r37422)
+++ trunk/etc/codecs.conf	Sat Jun 27 20:35:28 2015	(r37423)
@@ -1398,6 +1398,16 @@ videocodec ffhevc
   out 422P,422P9,422P10,444P12
   out 444P,444P9,444P10,444P12
 
+videocodec ffhevcvdpau
+  info "FFmpeg HEVC / H.265 (VDPAU)"
+  status buggy
+  fourcc HEVC
+  fourcc hvc1
+  fourcc hev1
+  driver ffmpeg
+  dll hevc
+  out VDPAU_HEVC
+
 videocodec ffh264
   info "FFmpeg H.264"
   status working

Modified: trunk/libmpcodecs/img_format.c
==============================================================================
--- trunk/libmpcodecs/img_format.c	Mon Jun 22 23:03:38 2015	(r37422)
+++ trunk/libmpcodecs/img_format.c	Sat Jun 27 20:35:28 2015	(r37423)
@@ -142,6 +142,7 @@ const char *vo_format_name(int format)
     case IMGFMT_VDPAU_MPEG4:     return "MPEG-4 Part 2 VDPAU acceleration";
     case IMGFMT_VDPAU_WMV3:      return "WMV3 VDPAU acceleration";
     case IMGFMT_VDPAU_VC1:       return "VC1 VDPAU acceleration";
+    case IMGFMT_VDPAU_HEVC:      return "HEVC VDPAU acceleration";
     }
     snprintf(unknown_format,20,"Unknown 0x%04x",format);
     return unknown_format;

Modified: trunk/libmpcodecs/img_format.h
==============================================================================
--- trunk/libmpcodecs/img_format.h	Mon Jun 22 23:03:38 2015	(r37422)
+++ trunk/libmpcodecs/img_format.h	Sat Jun 27 20:35:28 2015	(r37423)
@@ -290,6 +290,7 @@ static inline int normalize_yuvp16(int f
 #define IMGFMT_VDPAU_WMV3          (IMGFMT_VDPAU|0x04)
 #define IMGFMT_VDPAU_VC1           (IMGFMT_VDPAU|0x05)
 #define IMGFMT_VDPAU_MPEG4         (IMGFMT_VDPAU|0x06)
+#define IMGFMT_VDPAU_HEVC          (IMGFMT_VDPAU|0x07)
 
 #define IMGFMT_IS_HWACCEL(fmt) (IMGFMT_IS_VDPAU(fmt) || IMGFMT_IS_XVMC(fmt))
 

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Mon Jun 22 23:03:38 2015	(r37422)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sat Jun 27 20:35:28 2015	(r37423)
@@ -235,6 +235,7 @@ static int pixfmt2imgfmt2(enum AVPixelFo
         case AV_CODEC_ID_MPEG4:      return IMGFMT_VDPAU_MPEG4;
         case AV_CODEC_ID_WMV3:       return IMGFMT_VDPAU_WMV3;
         case AV_CODEC_ID_VC1:        return IMGFMT_VDPAU_VC1;
+        case AV_CODEC_ID_HEVC:       return IMGFMT_VDPAU_HEVC;
         }
     return pixfmt2imgfmt(fmt);
 }

Modified: trunk/libvo/vo_vdpau.c
==============================================================================
--- trunk/libvo/vo_vdpau.c	Mon Jun 22 23:03:38 2015	(r37422)
+++ trunk/libvo/vo_vdpau.c	Sat Jun 27 20:35:28 2015	(r37423)
@@ -620,6 +620,12 @@ static int create_vdp_decoder(uint32_t f
     case IMGFMT_VDPAU_MPEG4:
         vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
         break;
+#ifdef VDP_DECODER_PROFILE_HEVC_MAIN;
+    case IMGFMT_VDPAU_HEVC:
+        vdp_decoder_profile = VDP_DECODER_PROFILE_HEVC_MAIN;
+        mp_msg(MSGT_VO, MSGL_V, "[vdpau] Creating HEVC hardware decoder for %d reference frames.\n", max_refs);
+        break;
+#endif
     default:
         goto err_out;
     }
@@ -1028,7 +1034,17 @@ static int draw_slice(uint8_t *image[],
 {
     VdpStatus vdp_st;
     struct vdpau_frame_data *rndr = (struct vdpau_frame_data *)image[0];
-    int max_refs = image_format == IMGFMT_VDPAU_H264 ? ((VdpPictureInfoH264 *)rndr->info)->num_ref_frames : 2;
+    int max_refs;
+    switch (image_format) {
+    case IMGFMT_VDPAU_H264:
+        max_refs = ((VdpPictureInfoH264 *)rndr->info)->num_ref_frames;
+        break;
+    case IMGFMT_VDPAU_HEVC:
+        max_refs = 16;
+        break;
+    default:
+        max_refs = 2;
+    }
 
     if (handle_preemption() < 0)
         return VO_TRUE;
@@ -1151,6 +1167,7 @@ static int query_format(uint32_t format)
     case IMGFMT_VDPAU_WMV3:
     case IMGFMT_VDPAU_VC1:
     case IMGFMT_VDPAU_MPEG4:
+    case IMGFMT_VDPAU_HEVC:
         // Note: this will break the current decoder
         // Not all implementations support safely instantiating
         // a second decoder, so this is the "lesser evil"


More information about the MPlayer-cvslog mailing list