[vlc-commits] es_format: remove right RGB shifts

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


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 17 19:07:10 2018 +0200| [623190938c91cdc2b7f571c2baad3d9235d48bf1] | committer: Rémi Denis-Courmont

es_format: remove right RGB shifts

RGB shifts carry zero entropy as they can trivially be recomputed from
the RGB masks. And then, they were only two users.

This saves 12 bytes per format.

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

 include/vlc_es.h     |  6 +++---
 src/misc/es_format.c | 12 ++++--------
 src/misc/filter.c    |  3 ---
 3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/include/vlc_es.h b/include/vlc_es.h
index 217c921357..052659f204 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -366,9 +366,9 @@ struct video_format_t
     unsigned int i_frame_rate_base;              /**< frame rate denominator */
 
     uint32_t i_rmask, i_gmask, i_bmask;      /**< color masks for RGB chroma */
-    int i_rrshift, i_lrshift;
-    int i_rgshift, i_lgshift;
-    int i_rbshift, i_lbshift;
+    int i_lrshift;
+    int i_lgshift;
+    int i_lbshift;
     video_palette_t *p_palette;              /**< video palette from demuxer */
     video_orientation_t orientation;                /**< picture orientation */
     video_color_primaries_t primaries;                  /**< color primaries */
diff --git a/src/misc/es_format.c b/src/misc/es_format.c
index 08c1efd5f5..716f9b111f 100644
--- a/src/misc/es_format.c
+++ b/src/misc/es_format.c
@@ -39,10 +39,9 @@
  * It transforms a color mask into right and left shifts
  * FIXME copied from video_output.c
  */
-static void MaskToShift( int *pi_left, int *pi_right, uint32_t i_mask )
+static void MaskToShift( int *pi_left, uint32_t i_mask )
 {
     *pi_left = ctz(i_mask);
-    *pi_right = 8 - vlc_popcount(i_mask);
 }
 
 /* */
@@ -81,12 +80,9 @@ void video_format_FixRgb( video_format_t *p_fmt )
         }
     }
 
-    MaskToShift( &p_fmt->i_lrshift, &p_fmt->i_rrshift,
-                 p_fmt->i_rmask );
-    MaskToShift( &p_fmt->i_lgshift, &p_fmt->i_rgshift,
-                 p_fmt->i_gmask );
-    MaskToShift( &p_fmt->i_lbshift, &p_fmt->i_rbshift,
-                 p_fmt->i_bmask );
+    MaskToShift( &p_fmt->i_lrshift, p_fmt->i_rmask );
+    MaskToShift( &p_fmt->i_lgshift, p_fmt->i_gmask );
+    MaskToShift( &p_fmt->i_lbshift, p_fmt->i_bmask );
 }
 
 void video_format_Setup( video_format_t *p_fmt, vlc_fourcc_t i_chroma,
diff --git a/src/misc/filter.c b/src/misc/filter.c
index 505b0eddc7..a57097b119 100644
--- a/src/misc/filter.c
+++ b/src/misc/filter.c
@@ -118,9 +118,6 @@ filter_t *filter_NewBlend( vlc_object_t *p_this,
     p_blend->fmt_out.video.i_rmask  = p_dst_chroma->i_rmask;
     p_blend->fmt_out.video.i_gmask  = p_dst_chroma->i_gmask;
     p_blend->fmt_out.video.i_bmask  = p_dst_chroma->i_bmask;
-    p_blend->fmt_out.video.i_rrshift= p_dst_chroma->i_rrshift;
-    p_blend->fmt_out.video.i_rgshift= p_dst_chroma->i_rgshift;
-    p_blend->fmt_out.video.i_rbshift= p_dst_chroma->i_rbshift;
     p_blend->fmt_out.video.i_lrshift= p_dst_chroma->i_lrshift;
     p_blend->fmt_out.video.i_lgshift= p_dst_chroma->i_lgshift;
     p_blend->fmt_out.video.i_lbshift= p_dst_chroma->i_lbshift;



More information about the vlc-commits mailing list