vlc | branch: master | Steve Lhomme <[email protected]> | Thu Nov 30 10:53:08 2017 +0100| [cba85bd68ae6bb27536c7c859f5448a8f64b7a61] | committer: Steve Lhomme
hw:d3d11: move the VideoProcessorEnumerator creation in D3D11_CreateProcessor() > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cba85bd68ae6bb27536c7c859f5448a8f64b7a61 --- modules/hw/d3d11/d3d11_deinterlace.c | 33 +++++---------------------------- modules/hw/d3d11/d3d11_filters.c | 30 +++++------------------------- modules/hw/d3d11/d3d11_processor.c | 28 +++++++++++++++++++++++++++- modules/hw/d3d11/d3d11_processor.h | 7 +++++-- modules/hw/d3d11/d3d11_surface.c | 23 ++--------------------- 5 files changed, 44 insertions(+), 77 deletions(-) diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c index 61e0cf141d..c6224cabc1 100644 --- a/modules/hw/d3d11/d3d11_deinterlace.c +++ b/modules/hw/d3d11/d3d11_deinterlace.c @@ -363,36 +363,13 @@ int D3D11OpenDeinterlace(vlc_object_t *obj) return VLC_ENOOBJ; } - if (D3D11_Create(filter, &sys->hd3d) != VLC_SUCCESS) - goto error; - - if (D3D11_CreateProcessor(filter, &sys->d3d_dev, &sys->d3d_proc) != VLC_SUCCESS) - goto error; + video_format_t fmt_out = filter->fmt_out.video; + fmt_out.i_width = dstDesc.Width; + fmt_out.i_height = dstDesc.Height; - const video_format_t *fmt = &filter->fmt_out.video; - - D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc = { - .InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST, - .InputFrameRate = { - .Numerator = fmt->i_frame_rate, - .Denominator = fmt->i_frame_rate_base, - }, - .InputWidth = fmt->i_width, - .InputHeight = fmt->i_height, - .OutputWidth = dstDesc.Width, - .OutputHeight = dstDesc.Height, - .OutputFrameRate = { - .Numerator = fmt->i_frame_rate, - .Denominator = fmt->i_frame_rate_base, - }, - .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL, - }; - hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3d_proc.d3dviddev, &processorDesc, &sys->d3d_proc.procEnumerator); - if ( sys->d3d_proc.procEnumerator == NULL ) - { - msg_Dbg(filter, "Can't get a video processor for the video."); + if (D3D11_CreateProcessor(filter, &sys->d3d_dev, D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST, + &filter->fmt_out.video, &fmt_out, &sys->d3d_proc) != VLC_SUCCESS) goto error; - } UINT flags; #ifndef NDEBUG diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c index bbffbb0da2..a96274eb50 100644 --- a/modules/hw/d3d11/d3d11_filters.c +++ b/modules/hw/d3d11/d3d11_filters.c @@ -363,33 +363,13 @@ static int D3D11OpenAdjust(vlc_object_t *obj) return VLC_ENOOBJ; } - if (D3D11_CreateProcessor(filter, &sys->d3d_dev, &sys->d3d_proc) != VLC_SUCCESS) - goto error; + video_format_t fmt_out = filter->fmt_out.video; + fmt_out.i_width = dstDesc.Width; + fmt_out.i_height = dstDesc.Height; - const video_format_t *fmt = &filter->fmt_out.video; - - D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc = { - .InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE, - .InputFrameRate = { - .Numerator = fmt->i_frame_rate, - .Denominator = fmt->i_frame_rate_base, - }, - .InputWidth = fmt->i_width, - .InputHeight = fmt->i_height, - .OutputWidth = dstDesc.Width, - .OutputHeight = dstDesc.Height, - .OutputFrameRate = { - .Numerator = fmt->i_frame_rate, - .Denominator = fmt->i_frame_rate_base, - }, - .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL, - }; - hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3d_proc.d3dviddev, &processorDesc, &sys->d3d_proc.procEnumerator); - if ( sys->d3d_proc.procEnumerator == NULL ) - { - msg_Dbg(filter, "Can't get a video processor for the video."); + if (D3D11_CreateProcessor(filter, &sys->d3d_dev, D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE, + &filter->fmt_out.video, &fmt_out, &sys->d3d_proc) != VLC_SUCCESS) goto error; - } UINT flags; #ifndef NDEBUG diff --git a/modules/hw/d3d11/d3d11_processor.c b/modules/hw/d3d11/d3d11_processor.c index cff2096f30..37a2110ce7 100644 --- a/modules/hw/d3d11/d3d11_processor.c +++ b/modules/hw/d3d11/d3d11_processor.c @@ -37,7 +37,10 @@ #if defined(ID3D11VideoContext_VideoProcessorBlt) #undef D3D11_CreateProcessor -int D3D11_CreateProcessor(vlc_object_t *o, d3d11_device_t *d3d_dev, d3d11_processor_t *out) +int D3D11_CreateProcessor(vlc_object_t *o, d3d11_device_t *d3d_dev, + D3D11_VIDEO_FRAME_FORMAT srcFields, + const video_format_t *fmt_in, const video_format_t *fmt_out, + d3d11_processor_t *out) { HRESULT hr; *out = (d3d11_processor_t) { 0 }; @@ -54,6 +57,29 @@ int D3D11_CreateProcessor(vlc_object_t *o, d3d11_device_t *d3d_dev, d3d11_proces goto error; } + D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc = { + .InputFrameFormat = srcFields, + .InputFrameRate = { + .Numerator = fmt_in->i_frame_rate_base ? fmt_in->i_frame_rate : 0, + .Denominator = fmt_in->i_frame_rate_base, + }, + .InputWidth = fmt_in->i_width, + .InputHeight = fmt_in->i_height, + .OutputWidth = fmt_out->i_width, + .OutputHeight = fmt_out->i_height, + .OutputFrameRate = { + .Numerator = fmt_out->i_frame_rate_base ? fmt_out->i_frame_rate : 0, + .Denominator = fmt_out->i_frame_rate_base, + }, + .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL, + }; + hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(out->d3dviddev, &processorDesc, &out->procEnumerator); + if ( FAILED(hr) || out->procEnumerator == NULL ) + { + msg_Dbg(o, "Can't get a video processor for the video."); + goto error; + } + return VLC_SUCCESS; error: D3D11_ReleaseProcessor(out); diff --git a/modules/hw/d3d11/d3d11_processor.h b/modules/hw/d3d11/d3d11_processor.h index b2b9023589..17fae1d92c 100644 --- a/modules/hw/d3d11/d3d11_processor.h +++ b/modules/hw/d3d11/d3d11_processor.h @@ -36,8 +36,11 @@ typedef struct ID3D11VideoProcessor *videoProcessor; } d3d11_processor_t; -int D3D11_CreateProcessor(vlc_object_t *, d3d11_device_t *, d3d11_processor_t *out); -#define D3D11_CreateProcessor(a,b,c) D3D11_CreateProcessor(VLC_OBJECT(a),b,c) +int D3D11_CreateProcessor(vlc_object_t *, d3d11_device_t *, + D3D11_VIDEO_FRAME_FORMAT srcFields, + const video_format_t *fmt_in, const video_format_t *fmt_out, + d3d11_processor_t *out); +#define D3D11_CreateProcessor(a,b,c,d,e,f) D3D11_CreateProcessor(VLC_OBJECT(a),b,c,d,e,f) void D3D11_ReleaseProcessor(d3d11_processor_t *); #endif diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c index 18cf764002..c5482b80bf 100644 --- a/modules/hw/d3d11/d3d11_surface.c +++ b/modules/hw/d3d11/d3d11_surface.c @@ -85,29 +85,10 @@ static int SetupProcessor(filter_t *p_filter, d3d11_device_t *d3d_dev, filter_sys_t *sys = p_filter->p_sys; HRESULT hr; - if (D3D11_CreateProcessor(p_filter, d3d_dev, &sys->d3d_proc) != VLC_SUCCESS) + if (D3D11_CreateProcessor(p_filter, d3d_dev, D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE, + &p_filter->fmt_in.video, &p_filter->fmt_out.video, &sys->d3d_proc) != VLC_SUCCESS) goto error; - const video_format_t *fmt = &p_filter->fmt_in.video; - D3D11_VIDEO_PROCESSOR_CONTENT_DESC processorDesc = { - .InputFrameFormat = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE, - .InputFrameRate = { - .Numerator = fmt->i_frame_rate_base > 0 ? fmt->i_frame_rate : 0, - .Denominator = fmt->i_frame_rate_base, - }, - .InputWidth = fmt->i_width, - .InputHeight = fmt->i_height, - .OutputWidth = fmt->i_width, - .OutputHeight = fmt->i_height, - .Usage = D3D11_VIDEO_USAGE_PLAYBACK_NORMAL, - }; - hr = ID3D11VideoDevice_CreateVideoProcessorEnumerator(sys->d3d_proc.d3dviddev, &processorDesc, &sys->d3d_proc.procEnumerator); - if ( sys->d3d_proc.procEnumerator == NULL ) - { - msg_Dbg(p_filter, "Can't get a video processor for the video."); - goto error; - } - UINT flags; #ifndef NDEBUG D3D11_LogProcessorSupport(p_filter, sys->d3d_proc.procEnumerator); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
