[vlc-commits] directx_va: no need to allocate dummy pictures anymore
Steve Lhomme
git at videolan.org
Tue Jun 13 15:02:14 CEST 2017
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Tue Jun 6 18:55:10 2017 +0200| [7a917e04ae3269ce50927e76dedf17d1b6aa8065] | committer: Jean-Baptiste Kempf
directx_va: no need to allocate dummy pictures anymore
We don't use their local picture_sys_t anymore
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a917e04ae3269ce50927e76dedf17d1b6aa8065
---
modules/codec/avcodec/d3d11va.c | 41 --------------------------------------
modules/codec/avcodec/directx_va.c | 7 +------
modules/codec/avcodec/directx_va.h | 7 -------
modules/codec/avcodec/dxva2.c | 24 ----------------------
4 files changed, 1 insertion(+), 78 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index d92f391c3c..d876db46cd 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -150,8 +150,6 @@ static int DxCreateDecoderSurfaces(vlc_va_t *, int codec_id, const video_format_
static void DxDestroySurfaces(vlc_va_t *);
static void SetupAVCodecContext(vlc_va_t *);
-static picture_t *DxAllocPicture(vlc_va_t *, const video_format_t *, unsigned index);
-
/* */
static void Setup(vlc_va_t *va, vlc_fourcc_t *chroma)
{
@@ -394,7 +392,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
dx_sys->pf_setup_avcodec_ctx = SetupAVCodecContext;
dx_sys->pf_get_input_list = DxGetInputList;
dx_sys->pf_setup_output = DxSetupOutput;
- dx_sys->pf_alloc_surface_pic = DxAllocPicture;
dx_sys->psz_decoder_dll = TEXT("D3D11.DLL");
va->sys = sys;
@@ -1005,41 +1002,3 @@ static void DxDestroySurfaces(vlc_va_t *va)
}
}
}
-
-static void DestroyPicture(picture_t *picture)
-{
- picture_sys_t *p_sys = picture->p_sys;
- ReleasePictureSys(p_sys);
- free(p_sys);
- free(picture);
-}
-
-static picture_t *DxAllocPicture(vlc_va_t *va, const video_format_t *fmt, unsigned index)
-{
- vlc_va_sys_t *sys = va->sys;
- if (sys->b_extern_pool)
- return sys->extern_pics[index];
-
- video_format_t src_fmt = *fmt;
- src_fmt.i_chroma = sys->i_chroma;
- picture_sys_t *pic_sys = calloc(1, sizeof(*pic_sys));
- if (unlikely(pic_sys == NULL))
- return NULL;
-
- pic_sys->decoder = sys->dx_sys.hw_surface[index];
- ID3D11VideoDecoderOutputView_GetResource(pic_sys->decoder, &pic_sys->resource[KNOWN_DXGI_INDEX]);
- pic_sys->context = sys->d3dctx;
-
- picture_resource_t res = {
- .p_sys = pic_sys,
- .pf_destroy = DestroyPicture,
- };
- picture_t *pic = picture_NewFromResource(&src_fmt, &res);
- if (unlikely(pic == NULL))
- {
- free(pic_sys);
- return NULL;
- }
- return pic;
-}
-
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 07ae37e97e..16700fbcd3 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -357,7 +357,6 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, AVCodecContext *avctx)
return VLC_ENOMEM;
}
atomic_init(&surface->refcount, 1);
- surface->p_pic = dx_sys->pf_alloc_surface_pic(va, &fmt, i);
dx_sys->surface[i] = surface;
}
@@ -372,12 +371,8 @@ void DestroyVideoDecoder(vlc_va_t *va, directx_sys_t *dx_sys)
dx_sys->pf_destroy_surfaces(va);
for (int i = 0; i < dx_sys->surface_count; i++)
- IUnknown_Release( dx_sys->hw_surface[i] );
-
- for (int i = 0; i < dx_sys->surface_count; i++)
{
- if (dx_sys->surface[i]->p_pic)
- picture_Release(dx_sys->surface[i]->p_pic);
+ IUnknown_Release( dx_sys->hw_surface[i] );
directx_va_Release(dx_sys->surface[i]);
}
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 086c21faed..73e3068f2c 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -45,7 +45,6 @@
/* */
struct vlc_va_surface_t {
atomic_uintptr_t refcount;
- picture_t *p_pic;
D3D_DecoderSurface *decoderSurface;
};
@@ -121,12 +120,6 @@ typedef struct
* Set the avcodec hw context after the decoder is created
*/
void (*pf_setup_avcodec_ctx)(vlc_va_t *);
- /**
- * @brief pf_alloc_surface_pic
- * @param fmt
- * @return
- */
- picture_t *(*pf_alloc_surface_pic)(vlc_va_t *, const video_format_t *, unsigned);
} directx_sys_t;
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 90b2919b70..4b2828ab0d 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -134,8 +134,6 @@ struct vlc_va_sys_t
struct dxva_context hw;
};
-static picture_t *DxAllocPicture(vlc_va_t *, const video_format_t *, unsigned index);
-
/* */
static int D3dCreateDevice(vlc_va_t *);
@@ -318,7 +316,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
dx_sys->pf_setup_avcodec_ctx = SetupAVCodecContext;
dx_sys->pf_get_input_list = DxGetInputList;
dx_sys->pf_setup_output = DxSetupOutput;
- dx_sys->pf_alloc_surface_pic = DxAllocPicture;
dx_sys->psz_decoder_dll = TEXT("DXVA2.DLL");
va->sys = sys;
@@ -793,24 +790,3 @@ static int DxResetVideoDecoder(vlc_va_t *va)
msg_Err(va, "DxResetVideoDecoder unimplemented");
return VLC_EGENERIC;
}
-
-static picture_t *DxAllocPicture(vlc_va_t *va, const video_format_t *fmt, unsigned index)
-{
- video_format_t src_fmt = *fmt;
- src_fmt.i_chroma = va->sys->i_chroma;
- picture_sys_t *pic_sys = calloc(1, sizeof(*pic_sys));
- if (unlikely(pic_sys == NULL))
- return NULL;
- pic_sys->surface = va->sys->dx_sys.hw_surface[index];
-
- picture_resource_t res = {
- .p_sys = pic_sys,
- };
- picture_t *pic = picture_NewFromResource(&src_fmt, &res);
- if (unlikely(pic == NULL))
- {
- free(pic_sys);
- return NULL;
- }
- return pic;
-}
More information about the vlc-commits
mailing list