Commit b373aea1 authored by Thomas Guillem's avatar Thomas Guillem

d3d9: handle VLC_CODEC_D3D9_OPAQUE_10B upload/download

parent 6275ef83
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment