[vlc-commits] vdpau/chroma: get the vdp from the decoder device

Steve Lhomme git at videolan.org
Mon Dec 2 13:43:22 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov 22 10:19:12 2019 +0100| [47c9655e19e6034fbd60bea3fb1caf5e3166e009] | committer: Steve Lhomme

vdpau/chroma: get the vdp from the decoder device

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47c9655e19e6034fbd60bea3fb1caf5e3166e009
---

 modules/hw/vdpau/chroma.c | 38 +++++---------------------------------
 1 file changed, 5 insertions(+), 33 deletions(-)

diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index 03805d8990..88ab3aa730 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -297,12 +297,13 @@ static picture_t *VideoExport(filter_t *filter, picture_t *src, picture_t *dst,
                               VdpYCbCrFormat format)
 {
     vlc_vdp_video_field_t *field = VDPAU_FIELD_FROM_PICCTX(src->context);
-    vlc_vdp_video_frame_t *psys = field->frame;
     VdpStatus err;
-    VdpVideoSurface surface = psys->surface;
+    VdpVideoSurface surface = field->frame->surface;
     void *planes[3];
     uint32_t pitches[3];
 
+    vdpau_decoder_device_t *vdpau_decoder =
+        GetVDPAUOpaqueContext(picture_GetVideoContext(src));
     picture_CopyProperties(dst, src);
 
     for (int i = 0; i < dst->i_planes; i++)
@@ -319,12 +320,12 @@ static picture_t *VideoExport(filter_t *filter, picture_t *src, picture_t *dst,
         pitches[1] = dst->p[2].i_pitch;
         pitches[2] = dst->p[1].i_pitch;
     }
-    err = vdp_video_surface_get_bits_y_cb_cr(psys->vdp, surface, format,
+    err = vdp_video_surface_get_bits_y_cb_cr(vdpau_decoder->vdp, surface, format,
                                              planes, pitches);
     if (err != VDP_STATUS_OK)
     {
         msg_Err(filter, "video %s %s failure: %s", "surface", "export",
-                vdp_get_error_string(psys->vdp, err));
+                vdp_get_error_string(vdpau_decoder->vdp, err));
         picture_Release(dst);
         dst = NULL;
     }
@@ -442,35 +443,6 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
         return NULL;
     }
 
-    /* Corner case: different VDPAU instances decoding and rendering */
-    vlc_vdp_video_field_t *field = VDPAU_FIELD_FROM_PICCTX(src->context);
-    if (field->frame->vdp != sys->vdp)
-    {
-        video_format_t fmt = src->format;
-        switch (sys->chroma)
-        {
-             case VDP_CHROMA_TYPE_420: fmt.i_chroma = VLC_CODEC_NV12; break;
-             case VDP_CHROMA_TYPE_422: fmt.i_chroma = VLC_CODEC_UYVY; break;
-             case VDP_CHROMA_TYPE_444: fmt.i_chroma = VLC_CODEC_NV24; break;
-             default: vlc_assert_unreachable();
-        }
-
-        picture_t *pic = picture_NewFromFormat(&fmt);
-        if (likely(pic != NULL))
-        {
-            pic = VideoExport(filter, src, pic, sys->format);
-            if (pic != NULL)
-                src = VideoImport(filter, pic);
-            else
-                src = NULL;
-        }
-        else
-        {
-            picture_Release(src);
-            src = NULL;
-        }
-    }
-
     /* Update history and take "present" picture field */
     sys->history[MAX_PAST + MAX_FUTURE] = src;
 



More information about the vlc-commits mailing list