[vlc-commits] picture_pool: remove internal picture_pool_NewExtended()

Steve Lhomme git at videolan.org
Thu Jan 23 11:36:08 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jan 22 12:06:35 2020 +0100| [c824820fc809324288f05a1f42d97a97da9fe908] | committer: Steve Lhomme

picture_pool: remove internal picture_pool_NewExtended()

Just keep picture_pool_New() that does exactly the same thing.

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

 src/misc/picture_pool.c | 34 +++++++---------------------------
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index 9181597a47..0eb53516ad 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -96,22 +96,13 @@ static picture_t *picture_pool_ClonePicture(picture_pool_t *pool,
                                  (void*)sys);
 }
 
-/**
- * Picture pool configuration
- */
-typedef struct {
-    unsigned  picture_count;
-    picture_t *const *picture;
-} picture_pool_configuration_t;
-
-static
-picture_pool_t *picture_pool_NewExtended(const picture_pool_configuration_t *cfg)
+picture_pool_t *picture_pool_New(unsigned count, picture_t *const *tab)
 {
-    if (unlikely(cfg->picture_count > POOL_MAX))
+    if (unlikely(count > POOL_MAX))
         return NULL;
 
     picture_pool_t *pool;
-    size_t size = sizeof (*pool) + cfg->picture_count * sizeof (picture_t *);
+    size_t size = sizeof (*pool) + count * sizeof (picture_t *);
 
     size += (-size) & (POOL_MAX - 1);
     pool = aligned_alloc(POOL_MAX, size);
@@ -120,28 +111,17 @@ picture_pool_t *picture_pool_NewExtended(const picture_pool_configuration_t *cfg
 
     vlc_mutex_init(&pool->lock);
     vlc_cond_init(&pool->wait);
-    if (cfg->picture_count == POOL_MAX)
+    if (count == POOL_MAX)
         pool->available = ~0ULL;
     else
-        pool->available = (1ULL << cfg->picture_count) - 1;
+        pool->available = (1ULL << count) - 1;
     atomic_init(&pool->refs,  1);
-    pool->picture_count = cfg->picture_count;
-    memcpy(pool->picture, cfg->picture,
-           cfg->picture_count * sizeof (picture_t *));
+    pool->picture_count = count;
+    memcpy(pool->picture, tab, count * sizeof (picture_t *));
     pool->canceled = false;
     return pool;
 }
 
-picture_pool_t *picture_pool_New(unsigned count, picture_t *const *tab)
-{
-    picture_pool_configuration_t cfg = {
-        .picture_count = count,
-        .picture = tab,
-    };
-
-    return picture_pool_NewExtended(&cfg);
-}
-
 picture_pool_t *picture_pool_NewFromFormat(const video_format_t *fmt,
                                            unsigned count)
 {



More information about the vlc-commits mailing list