[vlc-commits] blend: strip useless private data

Rémi Denis-Courmont git at videolan.org
Mon Dec 17 18:46:06 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 17 17:49:26 2018 +0200| [8356890a25ae1d071006774d8f44d21980694dbe] | committer: Rémi Denis-Courmont

blend: strip useless private data

The RGB converter only cares about right shifts to extract component
values. No need to copy the whole enourmous video format.

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

 modules/video_filter/blend.cpp | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/video_filter/blend.cpp b/modules/video_filter/blend.cpp
index 3339abe528..a805e112d6 100644
--- a/modules/video_filter/blend.cpp
+++ b/modules/video_filter/blend.cpp
@@ -461,15 +461,20 @@ struct convertYuv8ToRgb {
 };
 
 struct convertRgbToRgbSmall {
-    convertRgbToRgbSmall(const video_format_t *dst, const video_format_t *) : fmt(*dst) {}
+    convertRgbToRgbSmall(const video_format_t *dst, const video_format_t *)
+    {
+        rshift = 8 - vlc_popcount(dst->i_rmask);
+        bshift = 8 - vlc_popcount(dst->i_bmask);
+        gshift = 8 - vlc_popcount(dst->i_gmask);
+    }
     void operator()(CPixel &p)
     {
-        p.i >>= fmt.i_rrshift;
-        p.j >>= fmt.i_rgshift;
-        p.k >>= fmt.i_rbshift;
+        p.i >>= rshift;
+        p.j >>= gshift;
+        p.k >>= bshift;
     }
 private:
-    const video_format_t &fmt;
+    unsigned rshift, gshift, bshift;
 };
 
 struct convertYuvpToAny {



More information about the vlc-commits mailing list