[vlc-commits] direct3d: pass the source colorimetry to the output setup callback
Steve Lhomme
git at videolan.org
Thu May 9 15:31:08 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May 9 09:29:39 2019 +0200| [f7dd40a93e3b7089debb66145e18dc023753dd0c] | committer: Steve Lhomme
direct3d: pass the source colorimetry to the output setup callback
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f7dd40a93e3b7089debb66145e18dc023753dd0c
---
modules/video_output/win32/d3d_render.h | 8 ++++++++
modules/video_output/win32/direct3d11.c | 11 +++++++++++
modules/video_output/win32/direct3d9.c | 5 +++++
3 files changed, 24 insertions(+)
diff --git a/modules/video_output/win32/d3d_render.h b/modules/video_output/win32/d3d_render.h
index 29b4d7470d..062d1d7e5d 100644
--- a/modules/video_output/win32/d3d_render.h
+++ b/modules/video_output/win32/d3d_render.h
@@ -35,10 +35,18 @@ struct direct3d_cfg_t {
unsigned width;
unsigned height;
unsigned bitdepth;
+ bool full_range; /** video is full range or studio/limited range */
+ video_color_space_t colorspace; /** video color space */
+ video_color_primaries_t primaries; /** video color primaries */
+ video_transfer_func_t transfer; /** video transfer function */
};
struct output_cfg_t {
int surface_format;
+ bool full_range; /** video is full range or studio/limited range */
+ video_color_space_t colorspace; /** video color space */
+ video_color_primaries_t primaries; /** video color primaries */
+ video_transfer_func_t transfer; /** video transfer function */
};
typedef bool (*d3d_device_setup_cb)(void* opaque, const struct device_cfg_t*, struct device_setup_t* );
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 196587a050..a9caf168d6 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -204,6 +204,13 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd, const video_format_t *fmt)
}
break;
}
+ cfg.full_range = fmt->color_range == COLOR_RANGE_FULL ||
+ /* the YUV->RGB conversion already output full range */
+ is_d3d11_opaque(fmt->i_chroma) ||
+ vlc_fourcc_IsYUV(fmt->i_chroma);
+ cfg.primaries = fmt->primaries;
+ cfg.colorspace = fmt->space;
+ cfg.transfer = fmt->transfer;
struct output_cfg_t out;
if (!sys->updateOutputCb( sys->outside_opaque, &cfg, &out ))
@@ -485,6 +492,10 @@ static bool LocalSwapchainUpdateOutput( void *opaque, const struct direct3d_cfg_
if ( !UpdateSwapchain( vd, cfg ) )
return -1;
out->surface_format = vd->sys->display.pixelFormat->formatTexture;
+ out->full_range = vd->sys->display.colorspace->b_full_range;
+ out->colorspace = vd->sys->display.colorspace->color;
+ out->primaries = vd->sys->display.colorspace->primaries;
+ out->transfer = vd->sys->display.colorspace->transfer;
return true;
}
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index eb24cb9d7d..9eafc0b614 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -599,6 +599,11 @@ static int UpdateOutput(vout_display_t *vd, const video_format_t *fmt)
break;
}
+ cfg.full_range = fmt->color_range == COLOR_RANGE_FULL;
+ cfg.primaries = fmt->primaries;
+ cfg.colorspace = fmt->space;
+ cfg.transfer = fmt->transfer;
+
struct output_cfg_t out;
if (!sys->updateOutputCb( sys->outside_opaque, &cfg, &out ))
{
More information about the vlc-commits
mailing list