[vlc-commits] [Git][videolan/vlc][master] 13 commits: vout_wrapper: split the main pool allocation

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Aug 15 16:13:05 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
68403add by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout_wrapper: split the main pool allocation

No actual changes in the result.

- - - - -
e6d1db2e by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: create the private pool independently from the display pool

Since we reserved pictures, the bigger size of the pool is not a benefit.
It was necessary in 3.0 where the pool was coming from the display module.
We can split them since they always worked on different pictures.

vd->source is the same video format as osys->display_fmt used for the
display pool in this case since there is no converter.

- - - - -
e0e3976b by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: remove VOUT_MAX_PICTURES

We don't need extra pictures in the private pool. We use this pool for
temporary pictures in filters and blending. They are never queued/pending.

- - - - -
e8b7483c by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: move the private pool outside of the vout wrapper

vd->source and sys->original are the same format.

We use the maximum size that was used for now, so private_picture + kept_picture.

- - - - -
4dc0706f by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: move private_pool variable

It's no longer needed in the wrapper structure.

- - - - -
637effdc by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: simplify the interlacing state usage

- - - - -
971a456c by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: rename the display pool to converter pool

It's only used by the converter.

- - - - -
0e1c0675 by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: move the display pool allocation in the vout creation

If it fails for the selected display module, we may skip to another
one that will succeed in allocating the pool.

- - - - -
4236b917 by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: only create the converter filter chain if a converter is needed

We also don't allocate the converter pool if we don't need to.

Now osys->converters can be NULL. In that case vout_ConvertForDisplay()
is just a pass through, and doesn't need to call an empty filter chain
for nothing.

- - - - -
5e9aae63 by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: simplify the converter pool creation

It's only created when there's a converter. We don't need to check anymore.

We can remove the unused vout_IsDisplayConverted().

- - - - -
4337ce5c by Steve Lhomme at 2023-08-15T13:03:00+00:00
vout: only use 2 pictures in the converter pool

We don't need more. It's never queued, only possibly kept for displaying.

- - - - -
53c21ea2 by Steve Lhomme at 2023-08-15T13:03:00+00:00
picture_pool: remove unused local function

picture_pool_GetSize() is not used anymore.

- - - - -
ed8f57fa by Steve Lhomme at 2023-08-15T13:03:00+00:00
picture_pool: remove unused Reserve function

It was useful in the past when the vout was allocating buffers once. We don't
need this trick anymore.

- - - - -


10 changed files:

- include/vlc_picture_pool.h
- src/libvlccore.sym
- src/misc/picture_pool.c
- src/test/picture_pool.c
- src/video_output/display.c
- src/video_output/interlacing.c
- src/video_output/video_output.c
- src/video_output/vout_private.h
- src/video_output/vout_wrapper.c
- src/video_output/vout_wrapper.h


Changes:

=====================================
include/vlc_picture_pool.h
=====================================
@@ -104,29 +104,4 @@ VLC_API picture_t * picture_pool_Get( picture_pool_t * ) VLC_USED;
  */
 VLC_API picture_t *picture_pool_Wait(picture_pool_t *) VLC_USED;
 
-/**
- * Reserves pictures from a pool and creates a new pool with those.
- *
- * When the new pool is released, pictures are returned to the master pool.
- * If the master pool was already released, pictures will be destroyed.
- *
- * @param pool A pool from ::picture_pool_New or ::picture_pool_NewFromFormat
- * @param count number of picture to reserve
- *
- * @return the new pool, or NULL if there were not enough pictures available
- * or on error
- *
- * @note This function is thread-safe (but it might return NULL if other
- * threads have already allocated too many pictures).
- */
-VLC_API picture_pool_t * picture_pool_Reserve(picture_pool_t *pool, unsigned count)
-VLC_USED;
-
-/**
- * @return the total number of pictures in the given pool
- * @note This function is thread-safe.
- */
-unsigned picture_pool_GetSize(const picture_pool_t *);
-
-
 #endif /* VLC_PICTURE_POOL_H */


=====================================
src/libvlccore.sym
=====================================
@@ -335,7 +335,6 @@ picture_pool_Release
 picture_pool_Get
 picture_pool_New
 picture_pool_NewFromFormat
-picture_pool_Reserve
 picture_pool_Wait
 picture_Reset
 picture_Setup


=====================================
src/misc/picture_pool.c
=====================================
@@ -153,34 +153,6 @@ error:
     return NULL;
 }
 
-picture_pool_t *picture_pool_Reserve(picture_pool_t *master, unsigned count)
-{
-    if (count == 0)
-        vlc_assert_unreachable();
-    if (unlikely(count > POOL_MAX))
-        return NULL;
-
-    picture_t *picture[POOL_MAX];
-    unsigned i;
-
-    for (i = 0; i < count; i++) {
-        picture[i] = picture_pool_Get(master);
-        if (picture[i] == NULL)
-            goto error;
-    }
-
-    picture_pool_t *pool = picture_pool_New(count, picture);
-    if (!pool)
-        goto error;
-
-    return pool;
-
-error:
-    while (i > 0)
-        picture_Release(picture[--i]);
-    return NULL;
-}
-
 picture_t *picture_pool_Get(picture_pool_t *pool)
 {
 
@@ -214,8 +186,3 @@ picture_t *picture_pool_Wait(picture_pool_t *pool)
 
     return picture_pool_ClonePicture(pool, i);
 }
-
-unsigned picture_pool_GetSize(const picture_pool_t *pool)
-{
-    return pool->picture_count;
-}


=====================================
src/test/picture_pool.c
=====================================
@@ -35,7 +35,7 @@
 const char vlc_module_name[] = "test_picture_pool";
 
 static video_format_t fmt;
-static picture_pool_t *pool, *reserve;
+static picture_pool_t *pool;
 
 static void test(bool zombie)
 {
@@ -52,9 +52,6 @@ static void test(bool zombie)
     for (unsigned i = 0; i < PICTURES; i++)
         assert(picture_pool_Get(pool) == NULL);
 
-    // Reserve currently assumes that all pictures are free (or reserved).
-    //assert(picture_pool_Reserve(pool, 1) == NULL);
-
     for (unsigned i = 0; i < PICTURES / 2; i++)
         picture_Hold(pics[i]);
 
@@ -79,28 +76,10 @@ static void test(bool zombie)
         assert(pics[i] != NULL);
     }
 
-    for (unsigned i = 0; i < PICTURES; i++)
-        picture_Release(pics[i]);
-
-    reserve = picture_pool_Reserve(pool, PICTURES / 2);
-    assert(reserve != NULL);
-
-    for (unsigned i = 0; i < PICTURES / 2; i++) {
-        pics[i] = picture_pool_Get(pool);
-        assert(pics[i] != NULL);
-    }
-
-    for (unsigned i = PICTURES / 2; i < PICTURES; i++) {
-        assert(picture_pool_Get(pool) == NULL);
-        pics[i] = picture_pool_Get(reserve);
-        assert(pics[i] != NULL);
-    }
-
     if (!zombie)
         for (unsigned i = 0; i < PICTURES; i++)
             picture_Release(pics[i]);
 
-    picture_pool_Release(reserve);
     picture_pool_Release(pool);
 
     if (zombie)
@@ -115,10 +94,6 @@ int main(void)
     pool = picture_pool_NewFromFormat(&fmt, PICTURES);
     assert(pool != NULL);
 
-    reserve = picture_pool_Reserve(pool, PICTURES / 2);
-    assert(reserve != NULL);
-
-    picture_pool_Release(reserve);
     picture_pool_Release(pool);
 
     test(false);


=====================================
src/video_output/display.c
=====================================
@@ -243,7 +243,7 @@ typedef struct {
      /* filters to convert the vout source to fmt, NULL means no conversion
       * can be done and nothing will be displayed */
     filter_chain_t *converters;
-    picture_pool_t *pool;
+    picture_pool_t *converter_pool;
 } vout_display_priv_t;
 
 /*****************************************************************************
@@ -259,8 +259,7 @@ static picture_t *VideoBufferNew(filter_t *filter)
            osys->display_fmt.i_width  == fmt->i_width  &&
            osys->display_fmt.i_height == fmt->i_height);
 
-    assert(picture_pool_GetSize(osys->pool) >= 3);
-    return picture_pool_Get(osys->pool);
+    return picture_pool_Get(osys->converter_pool);
 }
 
 static vlc_decoder_device * DisplayHoldDecoderDevice(vlc_object_t *o, void *sys)
@@ -283,10 +282,6 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
         .sys = vd,
     };
 
-    osys->converters = filter_chain_NewVideo(vd, false, &owner);
-    if (unlikely(osys->converters == NULL))
-        return VLC_ENOMEM;
-
     video_format_t v_src = osys->source;
     v_src.i_sar_num = 0;
     v_src.i_sar_den = 0;
@@ -299,6 +294,23 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
     if (!convert)
         return VLC_SUCCESS;
 
+    assert(osys->converter_pool == NULL);
+    // 1 for current converter + 1 for previously displayed
+    osys->converter_pool = picture_pool_NewFromFormat(&osys->display_fmt, 1+1);
+    if (osys->converter_pool == NULL)
+    {
+        msg_Err(vd, "Failed to allocate converter pool");
+        return VLC_ENOMEM;
+    }
+
+    osys->converters = filter_chain_NewVideo(vd, false, &owner);
+    if (unlikely(osys->converters == NULL))
+    {
+        picture_pool_Release(osys->converter_pool);
+        osys->converter_pool = NULL;
+        return VLC_ENOMEM;
+    }
+
     msg_Dbg(vd, "A filter to adapt decoder %4.4s to display %4.4s is needed",
             (const char *)&v_src.i_chroma, (const char *)&v_dst.i_chroma);
 
@@ -319,6 +331,9 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
         msg_Err(vd, "Failed to adapt decoder format to display");
         filter_chain_Delete(osys->converters);
         osys->converters = NULL;
+
+        picture_pool_Release(osys->converter_pool);
+        osys->converter_pool = NULL;
     }
     return ret;
 }
@@ -348,33 +363,12 @@ static void VoutDisplayCropRatio(unsigned *left, unsigned *top, unsigned *right,
     }
 }
 
-/**
- * It retrieves a picture pool from the display
- */
-picture_pool_t *vout_GetPool(vout_display_t *vd, unsigned count)
-{
-    vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
-
-    if (osys->pool == NULL)
-        osys->pool = picture_pool_NewFromFormat(&osys->display_fmt, count);
-    return osys->pool;
-}
-
-bool vout_IsDisplayFiltered(vout_display_t *vd)
-{
-    vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
-
-    return osys->converters == NULL || !filter_chain_IsEmpty(osys->converters);
-}
-
 picture_t *vout_ConvertForDisplay(vout_display_t *vd, picture_t *picture)
 {
     vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
 
-    if (osys->converters == NULL) {
-        picture_Release(picture);
-        return NULL;
-    }
+    if (osys->converters == NULL)
+        return picture;
 
     return filter_chain_VideoFilter(osys->converters, picture);
 }
@@ -407,9 +401,9 @@ static void vout_display_Reset(vout_display_t *vd)
         osys->converters = NULL;
     }
 
-    if (osys->pool != NULL) {
-        picture_pool_Release(osys->pool);
-        osys->pool = NULL;
+    if (osys->converter_pool != NULL) {
+        picture_pool_Release(osys->converter_pool);
+        osys->converter_pool = NULL;
     }
 
     assert(vd->ops->reset_pictures);
@@ -664,7 +658,14 @@ int vout_SetDisplayFormat(vout_display_t *vd, const video_format_t *fmt,
 
     /* On update_format success, the vout display accepts the target format, so
      * no display converters are needed. */
-    filter_chain_Clear(osys->converters);
+    if (osys->converters != NULL)
+    {
+        filter_chain_Delete(osys->converters);
+        osys->converters = NULL;
+        assert(osys->converter_pool != NULL);
+        picture_pool_Release(osys->converter_pool);
+        osys->converter_pool = NULL;
+    }
 
     return VLC_SUCCESS;
 }
@@ -691,7 +692,7 @@ vout_display_t *vout_display_New(vlc_object_t *parent,
                                            source, &cfg->display);
     }
 
-    osys->pool = NULL;
+    osys->converter_pool = NULL;
 
     video_format_Copy(&osys->source, source);
     osys->crop.mode = VOUT_CROP_NONE;
@@ -767,8 +768,8 @@ void vout_display_Delete(vout_display_t *vd)
     if (osys->converters != NULL)
         filter_chain_Delete(osys->converters);
 
-    if (osys->pool != NULL)
-        picture_pool_Release(osys->pool);
+    if (osys->converter_pool != NULL)
+        picture_pool_Release(osys->converter_pool);
 
     if (vd->ops->close != NULL)
         vd->ops->close(vd);


=====================================
src/video_output/interlacing.c
=====================================
@@ -91,13 +91,13 @@ static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
     return VLC_SUCCESS;
 }
 
-void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys)
+void vout_InitInterlacingSupport(vout_thread_t *vout, vout_interlacing_state_t *sys)
 {
     vlc_value_t val;
 
     msg_Dbg(vout, "Deinterlacing available");
 
-    sys->interlacing.has_deint = false;
+    sys->has_deint = false;
 
     /* Create the configuration variables */
     /* */
@@ -147,31 +147,31 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys
 
     var_Create(vout, "sout-deinterlace-mode", VLC_VAR_STRING);
 
-    sys->interlacing.is_interlaced = false;
+    sys->is_interlaced = false;
 }
 
-void vout_ReinitInterlacingSupport(vout_thread_t *vout, vout_thread_private_t *sys)
+void vout_ReinitInterlacingSupport(vout_thread_t *vout, vout_interlacing_state_t *sys)
 {
-    sys->interlacing.is_interlaced = false;
+    sys->is_interlaced = false;
     var_SetBool(vout, "deinterlace-needed", false);
 }
 
-void vout_SetInterlacingState(vout_thread_t *vout, vout_thread_private_t *sys, bool is_interlaced)
+void vout_SetInterlacingState(vout_thread_t *vout, vout_interlacing_state_t *sys, bool is_interlaced)
 {
     const bool interlacing_change =
-        is_interlaced != sys->interlacing.is_interlaced;
+        is_interlaced != sys->is_interlaced;
 
     /* Wait 30s before quitting interlacing mode */
     const bool is_after_deadline =
-        sys->interlacing.date + VLC_TICK_FROM_SEC(30) < vlc_tick_now();
+        sys->date + VLC_TICK_FROM_SEC(30) < vlc_tick_now();
 
     if (interlacing_change && (is_interlaced || is_after_deadline))
     {
         msg_Dbg(vout, "Detected %s video",
                  is_interlaced ? "interlaced" : "progressive");
         var_SetBool(vout, "deinterlace-needed", is_interlaced);
-        sys->interlacing.is_interlaced = is_interlaced;
+        sys->is_interlaced = is_interlaced;
     }
     if (is_interlaced)
-        sys->interlacing.date = vlc_tick_now();
+        sys->date = vlc_tick_now();
 }


=====================================
src/video_output/video_output.c
=====================================
@@ -69,7 +69,7 @@ typedef struct vout_thread_sys_t
 {
     struct vout_thread_t obj;
 
-    vout_thread_private_t private;
+    vout_interlacing_state_t interlacing;
 
     bool dummy;
 
@@ -169,6 +169,7 @@ typedef struct vout_thread_sys_t
 
     vlc_atomic_rc_t rc;
 
+    picture_pool_t  *private_pool; // interactive + static filters & blending
 } vout_thread_sys_t;
 
 #define VOUT_THREAD_TO_SYS(vout) \
@@ -734,7 +735,7 @@ static picture_t *VoutVideoFilterInteractiveNewPicture(filter_t *filter)
 {
     vout_thread_sys_t *sys = filter->owner.sys;
 
-    picture_t *picture = picture_pool_Get(sys->private.private_pool);
+    picture_t *picture = picture_pool_Get(sys->private_pool);
     if (picture) {
         picture_Reset(picture);
         video_format_CopyCropAr(&picture->format, &filter->fmt_out.video);
@@ -789,7 +790,7 @@ static void ChangeFilters(vout_thread_sys_t *vout)
     vlc_array_init(&array_static);
     vlc_array_init(&array_interactive);
 
-    if (sys->private.interlacing.has_deint)
+    if (sys->interlacing.has_deint)
     {
         vout_filter_t *e = malloc(sizeof(*e));
 
@@ -1197,7 +1198,7 @@ static int PrerenderPicture(vout_thread_sys_t *sys, picture_t *filtered,
     picture_t *snap_pic = todisplay;
     if (!vd_does_blending && blending_before_converter && subpic) {
         if (sys->spu_blend) {
-            picture_t *blent = picture_pool_Get(sys->private.private_pool);
+            picture_t *blent = picture_pool_Get(sys->private_pool);
             if (blent) {
                 video_format_CopyCropAr(&blent->format, &filtered->format);
                 picture_Copy(blent, filtered);
@@ -1393,9 +1394,9 @@ static void UpdateDeinterlaceFilter(vout_thread_sys_t *sys)
 {
     vlc_mutex_lock(&sys->filter.lock);
     if (sys->filter.changed ||
-        sys->private.interlacing.has_deint != sys->filter.new_interlaced)
+        sys->interlacing.has_deint != sys->filter.new_interlaced)
     {
-        sys->private.interlacing.has_deint = sys->filter.new_interlaced;
+        sys->interlacing.has_deint = sys->filter.new_interlaced;
         ChangeFilters(sys);
     }
     vlc_mutex_unlock(&sys->filter.lock);
@@ -1663,7 +1664,7 @@ static int vout_Start(vout_thread_sys_t *vout, vlc_video_context *vctx, const vo
     vlc_mutex_unlock(&sys->window_lock);
 
     sys->decoder_fifo = picture_fifo_New();
-    sys->private.private_pool = NULL;
+    sys->private_pool = NULL;
 
     sys->filter.configuration = NULL;
     video_format_Copy(&sys->filter.src_fmt, &sys->original);
@@ -1719,7 +1720,18 @@ static int vout_Start(vout_thread_sys_t *vout, vlc_video_context *vctx, const vo
     dcfg.display.width = sys->window_width;
     dcfg.display.height = sys->window_height;
 
-    sys->display = vout_OpenWrapper(&vout->obj, &sys->private, sys->splitter_name, &dcfg,
+    const unsigned private_picture  = 4; /* XXX 3 for filter, 1 for SPU */
+    const unsigned kept_picture     = 1; /* last displayed picture */
+
+    sys->private_pool =
+        picture_pool_NewFromFormat(&sys->original,
+                                   private_picture + kept_picture);
+    if (sys->private_pool == NULL) {
+        vlc_queuedmutex_unlock(&sys->display_lock);
+        goto error;
+    }
+
+    sys->display = vout_OpenWrapper(&vout->obj, sys->splitter_name, &dcfg,
                                     &sys->original, vctx);
     if (sys->display == NULL) {
         vlc_queuedmutex_unlock(&sys->display_lock);
@@ -1732,8 +1744,6 @@ static int vout_Start(vout_thread_sys_t *vout, vlc_video_context *vctx, const vo
         vout_SetDisplayAspect(sys->display, num, den);
     vlc_queuedmutex_unlock(&sys->display_lock);
 
-    assert(sys->private.private_pool != NULL);
-
     sys->displayed.current       = NULL;
     sys->displayed.decoded       = NULL;
     sys->displayed.date          = VLC_TICK_INVALID;
@@ -1760,6 +1770,11 @@ error:
         filter_chain_Delete(ci);
     if (cs != NULL)
         filter_chain_Delete(cs);
+    if (sys->private_pool)
+    {
+        picture_pool_Release(sys->private_pool);
+        sys->private_pool = NULL;
+    }
     video_format_Clean(&sys->filter.src_fmt);
     if (sys->filter.src_vctx)
     {
@@ -1810,7 +1825,7 @@ static void *Thread(void *object)
 
         const bool picture_interlaced = sys->displayed.is_interlaced;
 
-        vout_SetInterlacingState(&vout->obj, &sys->private, picture_interlaced);
+        vout_SetInterlacingState(&vout->obj, &sys->interlacing, picture_interlaced);
     }
     return NULL;
 }
@@ -1826,11 +1841,16 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
         filter_DeleteBlend(sys->spu_blend);
 
     /* Destroy the rendering display */
-    if (sys->private.private_pool != NULL)
+    if (sys->private_pool != NULL)
+    {
         vout_FlushUnlocked(vout, true, VLC_TICK_MAX);
 
+        picture_pool_Release(sys->private_pool);
+        sys->private_pool = NULL;
+    }
+
     vlc_queuedmutex_lock(&sys->display_lock);
-    vout_CloseWrapper(&vout->obj, &sys->private, sys->display);
+    vout_CloseWrapper(&vout->obj, sys->display);
     sys->display = NULL;
     vlc_queuedmutex_unlock(&sys->display_lock);
 
@@ -1857,7 +1877,7 @@ static void vout_ReleaseDisplay(vout_thread_sys_t *vout)
         picture_fifo_Delete(sys->decoder_fifo);
         sys->decoder_fifo = NULL;
     }
-    assert(sys->private.private_pool == NULL);
+    assert(sys->private_pool == NULL);
 
     vlc_mutex_lock(&sys->window_lock);
     vout_display_window_SetMouseHandler(sys->display_cfg.window, NULL, NULL);
@@ -2036,7 +2056,9 @@ vout_thread_t *vout_Create(vlc_object_t *object)
     sys->title.timeout  = var_InheritInteger(vout, "video-title-timeout");
     sys->title.position = var_InheritInteger(vout, "video-title-position");
 
-    vout_InitInterlacingSupport(vout, &sys->private);
+    sys->private_pool = NULL;
+
+    vout_InitInterlacingSupport(vout, &sys->interlacing);
 
     sys->is_late_dropped = var_InheritBool(vout, "drop-late-frames");
 
@@ -2183,7 +2205,7 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
     if (sys->display != NULL)
         vout_StopDisplay(cfg->vout);
 
-    vout_ReinitInterlacingSupport(cfg->vout, &sys->private);
+    vout_ReinitInterlacingSupport(cfg->vout, &sys->interlacing);
 
     sys->delay = 0;
     sys->rate = 1.f;


=====================================
src/video_output/vout_private.h
=====================================
@@ -28,27 +28,23 @@
 #include <vlc_picture_pool.h>
 #include <vlc_vout_display.h>
 
-typedef struct vout_thread_private_t vout_thread_private_t;
+typedef struct vout_interlacing_state_t vout_interlacing_state_t;
 
 /* */
-struct vout_thread_private_t
+struct vout_interlacing_state_t
 {
-    struct {
-        bool        is_interlaced;
-        bool        has_deint;
-        vlc_tick_t  date;
-    } interlacing;
-
-    picture_pool_t  *private_pool;
+    bool        is_interlaced;
+    bool        has_deint;
+    vlc_tick_t  date;
 };
 
 /* */
-vout_display_t *vout_OpenWrapper(vout_thread_t *, vout_thread_private_t *, const char *,
+vout_display_t *vout_OpenWrapper(vout_thread_t *, const char *,
                      const vout_display_cfg_t *, const video_format_t *, vlc_video_context *);
-void vout_CloseWrapper(vout_thread_t *, vout_thread_private_t *, vout_display_t *vd);
+void vout_CloseWrapper(vout_thread_t *, vout_display_t *vd);
 
-void vout_InitInterlacingSupport(vout_thread_t *, vout_thread_private_t *);
-void vout_ReinitInterlacingSupport(vout_thread_t *, vout_thread_private_t *);
-void vout_SetInterlacingState(vout_thread_t *, vout_thread_private_t *, bool is_interlaced);
+void vout_InitInterlacingSupport(vout_thread_t *, vout_interlacing_state_t *);
+void vout_ReinitInterlacingSupport(vout_thread_t *, vout_interlacing_state_t *);
+void vout_SetInterlacingState(vout_thread_t *, vout_interlacing_state_t *, bool is_interlaced);
 
 #endif // LIBVLC_VOUT_PRIVATE_H


=====================================
src/video_output/vout_wrapper.c
=====================================
@@ -49,21 +49,10 @@ static void VoutViewpointMoved(void *sys, const vlc_viewpoint_t *vp)
     var_SetAddress(vout, "viewpoint-moved", (void*)vp);
 }
 
-/* Minimum number of display picture */
-#define DISPLAY_PICTURE_COUNT (1)
-
-/* It should be high enough to absorb jitter due to difficult picture(s)
- * to decode but not too high as memory is not that cheap.
- *
- * It can be made lower at compilation time if needed, but performance
- * may be degraded.
- */
-#define VOUT_MAX_PICTURES (20)
-
 /*****************************************************************************
  *
  *****************************************************************************/
-vout_display_t *vout_OpenWrapper(vout_thread_t *vout, vout_thread_private_t *sys,
+vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
                      const char *splitter_name, const vout_display_cfg_t *cfg,
                      const video_format_t *fmt, vlc_video_context *vctx)
 {
@@ -89,29 +78,6 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout, vout_thread_private_t *sys
     if (vd == NULL)
         return NULL;
 
-    const unsigned private_picture  = 4; /* XXX 3 for filter, 1 for SPU */
-    const unsigned kept_picture     = 1; /* last displayed picture */
-    const unsigned reserved_picture = DISPLAY_PICTURE_COUNT +
-                                      private_picture +
-                                      kept_picture;
-
-    picture_pool_t *display_pool = vout_GetPool(vd, reserved_picture);
-    if (display_pool == NULL)
-        goto error;
-
-    if (!vout_IsDisplayFiltered(vd)) {
-        sys->private_pool = picture_pool_Reserve(display_pool, private_picture);
-    } else {
-        sys->private_pool =
-            picture_pool_NewFromFormat(vd->source,
-                                       __MAX(VOUT_MAX_PICTURES,
-                                             private_picture + kept_picture));
-    }
-    if (sys->private_pool == NULL) {
-        picture_pool_Release(display_pool);
-        goto error;
-    }
-
 #ifdef _WIN32
     var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
     var_AddCallback(vout, "video-wallpaper", Forward, vd);
@@ -119,22 +85,13 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout, vout_thread_private_t *sys
     var_SetBool(VLC_OBJECT(vout), "viewpoint-changeable",
                 vd->fmt->projection_mode != PROJECTION_MODE_RECTANGULAR);
     return vd;
-
-error:
-    vout_display_Delete(vd);
-    return NULL;
 }
 
 /*****************************************************************************
  *
  *****************************************************************************/
-void vout_CloseWrapper(vout_thread_t *vout, vout_thread_private_t *sys, vout_display_t *vd)
+void vout_CloseWrapper(vout_thread_t *vout, vout_display_t *vd)
 {
-    assert(sys->private_pool);
-
-    picture_pool_Release(sys->private_pool);
-    sys->private_pool = NULL;
-
 #ifdef _WIN32
     var_DelCallback(vout, "video-wallpaper", Forward, vd);
 #else


=====================================
src/video_output/vout_wrapper.h
=====================================
@@ -28,9 +28,6 @@
 /* XXX DO NOT use it outside the vout module wrapper XXX */
 struct vout_crop;
 
-picture_pool_t *vout_GetPool(vout_display_t *vd, unsigned count);
-
-bool vout_IsDisplayFiltered(vout_display_t *);
 picture_t * vout_ConvertForDisplay(vout_display_t *, picture_t *);
 void vout_FilterFlush(vout_display_t *);
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/81385c97e51c634f1f5028a51548f0796e2a60ff...ed8f57fa284b543655c3396391b45447bf2ad2a4

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/81385c97e51c634f1f5028a51548f0796e2a60ff...ed8f57fa284b543655c3396391b45447bf2ad2a4
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