]> git.sesse.net Git - ffmpeg/blobdiff - avconv_dxva2.c
codec_desc: Add missing DXV entry
[ffmpeg] / avconv_dxva2.c
index 95321dd398a62113afb32a39d4dd6c709b22c081..8ca08c3ce2d1b1db7cfe16aa75a2c37722feb4ec 100644 (file)
 
 #include <stdint.h>
 
-/* initguid.h needs to be above d3d/dxva to ensure
-   the GUIDs are initialized properly */
-#include <initguid.h>
-
 #include <d3d9.h>
 #include <dxva2api.h>
 
 #include "libavutil/imgutils.h"
 #include "libavutil/pixfmt.h"
 
-typedef IDirect3D9* WINAPI pDirect3DCreate9(UINT);
-typedef HRESULT WINAPI pCreateDeviceManager9(UINT *, IDirect3DDeviceManager9 **);
-
-/* GUIDs not defined in the common dxva2api.h in mingw-w64 */
-#ifndef _MSC_VER
-DEFINE_GUID(DXVA2_ModeMPEG2and1_VLD, 0x86695f12, 0x340e,0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60);
-DEFINE_GUID(DXVA2_ModeVC1_D2010,     0x1b81beA4, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
-DEFINE_GUID(DXVA2_NoEncrypt,         0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
-#endif
+/* define all the GUIDs used directly here,
+   to avoid problems with inconsistent dxva2api.h versions in mingw-w64 and different MSVC version */
+#include <initguid.h>
+DEFINE_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02);
 
+DEFINE_GUID(DXVA2_ModeMPEG2_VLD,      0xee27417f, 0x5e28,0x4e65,0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9);
+DEFINE_GUID(DXVA2_ModeMPEG2and1_VLD,  0x86695f12, 0x340e,0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60);
+DEFINE_GUID(DXVA2_ModeH264_E,         0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA2_ModeH264_F,         0x1b81be69, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
 DEFINE_GUID(DXVADDI_Intel_ModeH264_E, 0x604F8E68, 0x4951,0x4C54,0x88,0xFE,0xAB,0xD2,0x5C,0x15,0xB3,0xD6);
+DEFINE_GUID(DXVA2_ModeVC1_D,          0x1b81beA3, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA2_ModeVC1_D2010,      0x1b81beA4, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
+DEFINE_GUID(DXVA2_ModeHEVC_VLD_Main,  0x5b11d51b, 0x2f4c,0x4452,0xbc,0xc3,0x09,0xf2,0xa1,0x16,0x0c,0xc0);
+DEFINE_GUID(DXVA2_NoEncrypt,          0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5);
 DEFINE_GUID(GUID_NULL,                0x00000000, 0x0000,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);
 
+typedef IDirect3D9* WINAPI pDirect3DCreate9(UINT);
+typedef HRESULT WINAPI pCreateDeviceManager9(UINT *, IDirect3DDeviceManager9 **);
+
 typedef struct dxva2_mode {
   const GUID     *guid;
   enum AVCodecID codec;
@@ -79,6 +81,9 @@ static const dxva2_mode dxva2_modes[] = {
     { &DXVA2_ModeVC1_D,          AV_CODEC_ID_VC1  },
     { &DXVA2_ModeVC1_D,          AV_CODEC_ID_WMV3 },
 
+    /* HEVC/H.265 */
+    { &DXVA2_ModeHEVC_VLD_Main,  AV_CODEC_ID_HEVC },
+
     { NULL,                      0 },
 };
 
@@ -524,6 +529,10 @@ static int dxva2_create_decoder(AVCodecContext *s)
        but it causes issues for H.264 on certain AMD GPUs..... */
     if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO)
         surface_alignment = 32;
+    /* the HEVC DXVA2 spec asks for 128 pixel aligned surfaces to ensure
+       all coding features have enough room to work with */
+    else if  (s->codec_id == AV_CODEC_ID_HEVC)
+        surface_alignment = 128;
     else
         surface_alignment = 16;
 
@@ -531,7 +540,7 @@ static int dxva2_create_decoder(AVCodecContext *s)
     ctx->num_surfaces = 4;
 
     /* add surfaces based on number of possible refs */
-    if (s->codec_id == AV_CODEC_ID_H264)
+    if (s->codec_id == AV_CODEC_ID_H264 || s->codec_id == AV_CODEC_ID_HEVC)
         ctx->num_surfaces += 16;
     else
         ctx->num_surfaces += 2;