[vlc-commits] [Git][videolan/vlc][master] 2 commits: core: intialize float constants as floats

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Feb 25 05:18:01 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e330dd92 by Steve Lhomme at 2023-02-25T05:01:29+00:00
core: intialize float constants as floats

- - - - -
805ef112 by Steve Lhomme at 2023-02-25T05:01:29+00:00
subsvtt: intialize float constants as floats

- - - - -


4 changed files:

- modules/codec/webvtt/subsvtt.c
- src/player/player.c
- src/video_output/video_text.c
- src/video_output/video_widgets.c


Changes:

=====================================
modules/codec/webvtt/subsvtt.c
=====================================
@@ -57,8 +57,8 @@ typedef struct webvtt_dom_node_t webvtt_dom_node_t;
 typedef struct webvtt_dom_cue_t webvtt_dom_cue_t;
 
 #define WEBVTT_REGION_LINES_COUNT          18
-#define WEBVTT_DEFAULT_LINE_HEIGHT_VH    5.33
-#define WEBVTT_LINE_TO_HEIGHT_RATIO      1.06
+#define WEBVTT_DEFAULT_LINE_HEIGHT_VH    5.33f
+#define WEBVTT_LINE_TO_HEIGHT_RATIO      1.06f
 #define WEBVTT_MAX_DEPTH                 20 /* recursion prevention for now */
 
 enum webvtt_align_e
@@ -1770,7 +1770,7 @@ static void RenderRegions( decoder_t *p_dec, vlc_tick_t i_nzstart, vlc_tick_t i_
             v.i_left_offset = p_vttregion->anchor_x * p_vttregion->f_width;
             v.i_left = p_vttregion->viewport_anchor_x - v.i_left_offset;
             v.i_top_offset = p_vttregion->anchor_y * p_vttregion->i_lines_max_scroll *
-                             WEBVTT_DEFAULT_LINE_HEIGHT_VH / 100.0;
+                             WEBVTT_DEFAULT_LINE_HEIGHT_VH / 100.0f;
             v.i_top = p_vttregion->viewport_anchor_y - v.i_top_offset;
             /* !Variables */
 


=====================================
src/player/player.c
=====================================
@@ -1315,9 +1315,9 @@ static void
 vlc_player_ChangeRateOffset(vlc_player_t *player, bool increment)
 {
     static const float rates[] = {
-        1.0/64, 1.0/32, 1.0/16, 1.0/8, 1.0/4, 1.0/3, 1.0/2, 2.0/3,
-        1.0/1,
-        3.0/2, 2.0/1, 3.0/1, 4.0/1, 8.0/1, 16.0/1, 32.0/1, 64.0/1,
+        1.0f/64, 1.0f/32, 1.0f/16, 1.0f/8, 1.0f/4, 1.0f/3, 1.0f/2, 2.0f/3,
+        1.0f/1,
+        3.0f/2, 2.0f/1, 3.0f/1, 4.0f/1, 8.0f/1, 16.0f/1, 32.0f/1, 64.0f/1,
     };
     float rate = vlc_player_GetRate(player) * (increment ? 1.1f : 0.9f);
 


=====================================
src/video_output/video_text.c
=====================================
@@ -75,7 +75,7 @@ static void OSDTextUpdate(subpicture_t *subpic,
 
     r->p_text = text_segment_New( sys->text );
 
-    const float margin_ratio = 0.04;
+    const float margin_ratio = 0.04f;
     const int   margin_h     = margin_ratio * fmt_dst->i_visible_width;
     const int   margin_v     = margin_ratio * fmt_dst->i_visible_height;
 


=====================================
src/video_output/video_widgets.c
=====================================
@@ -205,8 +205,8 @@ static subpicture_region_t *OSDSlider(int type, int position,
  */
 static subpicture_region_t *OSDIcon(int type, const video_format_t *fmt)
 {
-    const float size_ratio   = 0.05;
-    const float margin_ratio = 0.07;
+    const float size_ratio   = 0.05f;
+    const float margin_ratio = 0.07f;
 
     const int size   = __MAX(fmt->i_visible_width, fmt->i_visible_height);
     const int width  = size * size_ratio;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b770c6400aaf76b947476d8f595da2b2571b762b...805ef1126cd31a0bc09945221ef1e97b862aab4b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b770c6400aaf76b947476d8f595da2b2571b762b...805ef1126cd31a0bc09945221ef1e97b862aab4b
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