[vlc-commits] [Git][videolan/vlc][master] 3 commits: d3d11_scaler: fix position when the source as a SAR

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 25 15:12:34 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
233bd702 by Steve Lhomme at 2023-05-25T14:55:37+00:00
d3d11_scaler: fix position when the source as a SAR

- - - - -
894142a0 by Steve Lhomme at 2023-05-25T14:55:37+00:00
direct3d11: get the d3d_format from the d3d11_scaler

It could select a different format than the one the decoder sends.

- - - - -
1f529133 by Steve Lhomme at 2023-05-25T14:55:37+00:00
d3d11_scaler: force RGBA output from the video processor

- - - - -


3 changed files:

- modules/video_output/win32/d3d11_scaler.cpp
- modules/video_output/win32/d3d11_scaler.h
- modules/video_output/win32/direct3d11.cpp


Changes:

=====================================
modules/video_output/win32/d3d11_scaler.cpp
=====================================
@@ -40,11 +40,12 @@ struct d3d11_scaler
 static const d3d_format_t *GetDirectRenderingFormat(vlc_object_t *vd, d3d11_device_t *d3d_dev, vlc_fourcc_t i_src_chroma)
 {
     UINT supportFlags = D3D11_FORMAT_SUPPORT_SHADER_LOAD | D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT;
-    return FindD3D11Format( vd, d3d_dev, i_src_chroma, DXGI_RGB_FORMAT|DXGI_YUV_FORMAT, 0, 0, 0, DXGI_CHROMA_GPU, supportFlags );
+    return FindD3D11Format( vd, d3d_dev, i_src_chroma, DXGI_RGB_FORMAT|DXGI_YUV_FORMAT, 0, 0, 0,
+                            DXGI_CHROMA_CPU|DXGI_CHROMA_GPU, supportFlags );
 }
 
 d3d11_scaler *D3D11_UpscalerCreate(vlc_object_t *vd, d3d11_device_t *d3d_dev, vlc_fourcc_t i_chroma,
-                                   bool super_res)
+                                   bool super_res, const d3d_format_t **out_fmt)
 {
     bool canProcess = !super_res;
     // NVIDIA 530+ driver
@@ -66,7 +67,15 @@ d3d11_scaler *D3D11_UpscalerCreate(vlc_object_t *vd, d3d11_device_t *d3d_dev, vl
         return nullptr;
     }
 
-    const d3d_format_t *fmt = GetDirectRenderingFormat(vd, d3d_dev, i_chroma);
+    const d3d_format_t *fmt = nullptr;
+    if ((*out_fmt)->bitsPerChannel > 10)
+        fmt = GetDirectRenderingFormat(vd, d3d_dev, VLC_CODEC_RGBA64);
+    if (fmt == nullptr && (*out_fmt)->bitsPerChannel > 8)
+        fmt = GetDirectRenderingFormat(vd, d3d_dev, VLC_CODEC_RGBA10);
+    if (fmt == nullptr)
+        fmt = GetDirectRenderingFormat(vd, d3d_dev, VLC_CODEC_RGBA);
+    if (fmt == nullptr)
+        fmt = GetDirectRenderingFormat(vd, d3d_dev, VLC_CODEC_BGRA);
     if (fmt == nullptr || fmt->formatTexture == DXGI_FORMAT_UNKNOWN)
     {
         msg_Warn(vd, "chroma upscale of %4.4s not supported", (char*)&i_chroma);
@@ -94,6 +103,7 @@ d3d11_scaler *D3D11_UpscalerCreate(vlc_object_t *vd, d3d11_device_t *d3d_dev, vl
 
     scaleProc->d3d_fmt = fmt;
     scaleProc->super_res = super_res;
+    *out_fmt = scaleProc->d3d_fmt;
     return scaleProc;
 error:
     delete scaleProc;
@@ -137,6 +147,8 @@ int D3D11_UpscalerUpdate(vlc_object_t *vd, d3d11_scaler *scaleProc, d3d11_device
     quad_fmt->i_width = quad_fmt->i_visible_width = out_width;
     quad_fmt->i_y_offset = 0;
     quad_fmt->i_height = quad_fmt->i_visible_height = out_height;
+    quad_fmt->i_sar_num = 1;
+    quad_fmt->i_sar_den = 1;
 
     if (scaleProc->Width == out_width && scaleProc->Height == out_height &&
         vout_display_PlaceEquals(&scaleProc->place, &place))


=====================================
modules/video_output/win32/d3d11_scaler.h
=====================================
@@ -20,7 +20,7 @@ extern "C" {
 
 struct d3d11_scaler;
 
-struct d3d11_scaler *D3D11_UpscalerCreate(vlc_object_t *, d3d11_device_t*, vlc_fourcc_t i_chroma, bool super_res);
+struct d3d11_scaler *D3D11_UpscalerCreate(vlc_object_t *, d3d11_device_t*, vlc_fourcc_t i_chroma, bool super_res, const d3d_format_t **);
 void D3D11_UpscalerDestroy(struct d3d11_scaler *);
 int D3D11_UpscalerUpdate(vlc_object_t *, struct d3d11_scaler *, d3d11_device_t*,
                          const video_format_t *, video_format_t *,


=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -783,7 +783,7 @@ static void InitScaleProcessor(vout_display_t *vd)
         return;
 
     sys->scaleProc = D3D11_UpscalerCreate(VLC_OBJECT(vd), sys->d3d_dev, sys->picQuad.quad_fmt.i_chroma,
-                                          sys->upscaleMode == upscale_SuperResolution);
+                                          sys->upscaleMode == upscale_SuperResolution, &sys->picQuad.generic.textureFormat);
     if (sys->scaleProc == NULL)
     {
         msg_Dbg(vd, "forcing linear sampler");



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/78cd293ffc5b777f2ca05010b11c565eb30ad035...1f529133a4440d3fc0b04a77cb06638aebe32170

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/78cd293ffc5b777f2ca05010b11c565eb30ad035...1f529133a4440d3fc0b04a77cb06638aebe32170
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list