[vlc-commits] d3d9: handle VLC_CODEC_D3D9_OPAQUE_10B upload/download
Thomas Guillem
git at videolan.org
Fri Mar 16 16:08:34 CET 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 16 16:03:31 2018 +0100| [b373aea13890437adb257860888784d653988d82] | committer: Thomas Guillem
d3d9: handle VLC_CODEC_D3D9_OPAQUE_10B upload/download
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b373aea13890437adb257860888784d653988d82
---
modules/hw/d3d9/dxa9.c | 48 ++++++++++++++++++++++++++++++++++++++----------
1 file changed, 38 insertions(+), 10 deletions(-)
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index 93970c970c..259e0153c4 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -109,7 +109,8 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
if (dst->format.i_chroma == VLC_CODEC_I420)
picture_SwapUV( dst );
- } else if (desc.Format == MAKEFOURCC('N','V','1','2')) {
+ } else if (desc.Format == MAKEFOURCC('N','V','1','2')
+ || desc.Format == MAKEFOURCC('P','0','1','0')) {
const uint8_t *plane[2] = {
lock.pBits,
(uint8_t*)lock.pBits + lock.Pitch * desc.Height
@@ -118,11 +119,16 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
lock.Pitch,
lock.Pitch,
};
- Copy420_SP_to_P(dst, plane, pitch,
- __MIN(desc.Height, src->format.i_y_offset + src->format.i_visible_height),
- p_copy_cache);
-
- if (dst->format.i_chroma != VLC_CODEC_I420)
+ if (desc.Format == MAKEFOURCC('N','V','1','2'))
+ Copy420_SP_to_P(dst, plane, pitch,
+ __MIN(desc.Height, src->format.i_y_offset + src->format.i_visible_height),
+ p_copy_cache);
+ else
+ Copy420_16_SP_to_P(dst, plane, pitch,
+ __MIN(desc.Height, src->format.i_y_offset + src->format.i_visible_height),
+ 6, p_copy_cache);
+
+ if (dst->format.i_chroma != VLC_CODEC_I420 && dst->format.i_chroma != VLC_CODEC_I420_10L)
picture_SwapUV(dst);
} else {
msg_Err(p_filter, "Unsupported DXA9 conversion from 0x%08X to YV12", desc.Format);
@@ -142,7 +148,8 @@ static void DXA9_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
if (!GetLock(p_filter, p_sys->surface, &lock, &desc))
return;
- if (desc.Format == MAKEFOURCC('N','V','1','2')) {
+ if (desc.Format == MAKEFOURCC('N','V','1','2')
+ || desc.Format == MAKEFOURCC('P','0','1','0')) {
const uint8_t *plane[2] = {
lock.pBits,
(uint8_t*)lock.pBits + lock.Pitch * desc.Height
@@ -291,20 +298,38 @@ int D3D9OpenConverter( vlc_object_t *obj )
{
filter_t *p_filter = (filter_t *)obj;
- if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
+ if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE &&
+ p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
return VLC_EGENERIC;
if ( p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
|| p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width )
return VLC_EGENERIC;
+ uint8_t pixel_bytes = 1;
switch( p_filter->fmt_out.video.i_chroma ) {
case VLC_CODEC_I420:
case VLC_CODEC_YV12:
+ if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
+ return VLC_EGENERIC;
+ p_filter->pf_video_filter = DXA9_YV12_Filter;
+ break;
+ case VLC_CODEC_I420_10L:
+ if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
+ return VLC_EGENERIC;
p_filter->pf_video_filter = DXA9_YV12_Filter;
+ pixel_bytes = 2;
break;
case VLC_CODEC_NV12:
+ if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
+ return VLC_EGENERIC;
+ p_filter->pf_video_filter = DXA9_NV12_Filter;
+ break;
+ case VLC_CODEC_P010:
+ if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
+ return VLC_EGENERIC;
p_filter->pf_video_filter = DXA9_NV12_Filter;
+ pixel_bytes = 2;
break;
default:
return VLC_EGENERIC;
@@ -314,7 +339,7 @@ int D3D9OpenConverter( vlc_object_t *obj )
if (!p_sys)
return VLC_ENOMEM;
- if (CopyInitCache(&p_sys->cache, p_filter->fmt_in.video.i_width ))
+ if (CopyInitCache(&p_sys->cache, p_filter->fmt_in.video.i_width * pixel_bytes))
{
free(p_sys);
return VLC_ENOMEM;
@@ -340,7 +365,8 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
picture_t *p_dst = NULL;
video_format_t fmt_staging;
- if ( p_filter->fmt_out.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
+ if ( p_filter->fmt_out.video.i_chroma != VLC_CODEC_D3D9_OPAQUE
+ && p_filter->fmt_out.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
return VLC_EGENERIC;
if ( p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
@@ -350,6 +376,8 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
switch( p_filter->fmt_in.video.i_chroma ) {
case VLC_CODEC_I420:
case VLC_CODEC_YV12:
+ case VLC_CODEC_I420_10L:
+ case VLC_CODEC_P010:
p_filter->pf_video_filter = YV12_D3D9_Filter;
break;
default:
More information about the vlc-commits
mailing list