[vlc-commits] [Git][videolan/vlc][master] 5 commits: mux: avi: remove unused p_fmt argument

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Feb 24 13:54:19 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
1dd505ba by Alexandre Janniaux at 2024-02-24T13:37:11+00:00
mux: avi: remove unused p_fmt argument

Since commit 92d89bc3b3936ac04d25270ae94b7cac8f35f017, the argument is
not used nor needed anymore, so remove it.

- - - - -
485a45f3 by Alexandre Janniaux at 2024-02-24T13:37:11+00:00
freetype: remove unused i_chroma parameter

Since 83e18622101d6593f54e27f2d01879aca5de6d0f, the parameter i_chroma
is not used anymore.

- - - - -
d69dcb39 by Alexandre Janniaux at 2024-02-24T13:37:11+00:00
mp4: essetup: fix sign vs unsigned comparison

Since this index is only used as an array subscript, we can use a size
type and compare against ARRAY_SIZE without warnings.

- - - - -
3d35cdad by Alexandre Janniaux at 2024-02-24T13:37:11+00:00
yuvp: use early return

The function has two different behaviour depending on whether it copies
to an YUVA target or an RGB-like one. Splitting the simpler YUVA case
with early return allows to simplify the second case.

- - - - -
2c1fc010 by Alexandre Janniaux at 2024-02-24T13:37:11+00:00
video_chroma: yuvp: fix potentially undefined r,g,b,a

r,g,b,a variables won't be defined if the function to initialize them
fails. Signal that it can never happen because it was tested before.

- - - - -


4 changed files:

- modules/demux/mp4/essetup.c
- modules/mux/avi.c
- modules/text_renderer/freetype/freetype.c
- modules/video_chroma/yuvp.c


Changes:

=====================================
modules/demux/mp4/essetup.c
=====================================
@@ -134,7 +134,7 @@ static void SetupESDS( demux_t *p_demux, const mp4_track_t *p_track,
     if( p_fmt->i_codec == VLC_CODEC_SPU &&
             p_fmt->i_extra >= sizeof(p_fmt->subs.spu.palette) )
     {
-        for( int i = 0; i < ARRAY_SIZE(p_fmt->subs.spu.palette); i++ )
+        for (size_t i = 0; i < ARRAY_SIZE(p_fmt->subs.spu.palette); i++)
         {
             p_fmt->subs.spu.palette[i] = GetDWBE((char*)p_fmt->p_extra + i * 4);
         }


=====================================
modules/mux/avi.c
=====================================
@@ -463,9 +463,7 @@ static void DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
     free( p_input->p_sys );
 }
 
-static int PrepareSamples( const avi_stream_t *p_stream,
-                           const es_format_t *p_fmt,
-                           block_t **pp_block )
+static int PrepareSamples(const avi_stream_t *p_stream, block_t **pp_block)
 {
     if( p_stream->i_frames == 0 && p_stream->i_cat == VIDEO_ES )
     {
@@ -529,8 +527,7 @@ static int Mux      ( sout_mux_t *p_mux )
                 p_data->i_length = p_next->i_dts - p_data->i_dts;
             }
 
-            if( PrepareSamples( p_stream, &p_mux->pp_inputs[i]->fmt,
-                                &p_data ) != VLC_SUCCESS )
+            if (PrepareSamples(p_stream, &p_data) != VLC_SUCCESS)
             {
                 p_data = p_next;
                 continue;


=====================================
modules/text_renderer/freetype/freetype.c
=====================================
@@ -616,7 +616,6 @@ static inline void RenderAXYZ( filter_t *p_filter,
                               const FT_BBox *p_regionbbox,
                               const FT_BBox *p_paddedtextbbox,
                               const FT_BBox *p_textbbox,
-                              vlc_fourcc_t i_chroma,
                               const ft_drawing_functions *draw )
 {
     filter_sys_t *p_sys = p_filter->p_sys;
@@ -1133,9 +1132,7 @@ static subpicture_region_t *Render( filter_t *p_filter,
             }
 
             RenderAXYZ( p_filter, p_region_in, region, text_block.p_laid,
-                                 &renderbbox, &paddedbbox, &bbox,
-                                 *p_chroma,
-                                 func );
+                                 &renderbbox, &paddedbbox, &bbox, func );
         }
 
 //      if( (bboxcolor & 0xFF) == 0 )


=====================================
modules/video_chroma/yuvp.c
=====================================
@@ -122,46 +122,46 @@ static void Convert( filter_t *p_filter, picture_t *p_source,
                 p_a[x] = p_yuvp->palette[v][3];
             }
         }
+        return;
     }
-    else
-    {
-        video_palette_t rgbp;
-        int r, g, b, a;
 
-        GetPackedRgbIndexes(p_filter->fmt_out.video.i_chroma, &r, &g, &b, &a);
-        /* Create a RGBA palette */
-        rgbp.i_entries = p_yuvp->i_entries;
-        for( int i = 0; i < p_yuvp->i_entries; i++ )
+    video_palette_t rgbp;
+    int r, g, b, a;
+
+    if (GetPackedRgbIndexes(p_filter->fmt_out.video.i_chroma, &r, &g, &b, &a) != VLC_SUCCESS)
+        vlc_assert_unreachable();
+
+    /* Create a RGBA palette */
+    rgbp.i_entries = p_yuvp->i_entries;
+    for( int i = 0; i < p_yuvp->i_entries; i++ )
+    {
+        if( p_yuvp->palette[i][3] == 0 )
         {
-            if( p_yuvp->palette[i][3] == 0 )
-            {
-                memset( rgbp.palette[i], 0, sizeof( rgbp.palette[i] ) );
-                continue;
-            }
-            Yuv2Rgb( &rgbp.palette[i][r], &rgbp.palette[i][g], &rgbp.palette[i][b],
-                     p_yuvp->palette[i][0], p_yuvp->palette[i][1], p_yuvp->palette[i][2] );
-            rgbp.palette[i][a] = p_yuvp->palette[i][3];
+            memset( rgbp.palette[i], 0, sizeof( rgbp.palette[i] ) );
+            continue;
         }
+        Yuv2Rgb( &rgbp.palette[i][r], &rgbp.palette[i][g], &rgbp.palette[i][b],
+                 p_yuvp->palette[i][0], p_yuvp->palette[i][1], p_yuvp->palette[i][2] );
+        rgbp.palette[i][a] = p_yuvp->palette[i][3];
+    }
 
-        for( unsigned int y = 0; y < p_filter->fmt_in.video.i_height; y++ )
-        {
-            const uint8_t *p_line = &p_source->p->p_pixels[y*p_source->p->i_pitch];
-            uint8_t *p_pixels = &p_dest->p->p_pixels[y*p_dest->p->i_pitch];
+    for( unsigned int y = 0; y < p_filter->fmt_in.video.i_height; y++ )
+    {
+        const uint8_t *p_line = &p_source->p->p_pixels[y*p_source->p->i_pitch];
+        uint8_t *p_pixels = &p_dest->p->p_pixels[y*p_dest->p->i_pitch];
 
-            for( unsigned int x = 0; x < p_filter->fmt_in.video.i_width; x++ )
-            {
-                const int v = p_line[x];
+        for( unsigned int x = 0; x < p_filter->fmt_in.video.i_width; x++ )
+        {
+            const int v = p_line[x];
 
-                if( v >= rgbp.i_entries )  /* maybe assert ? */
-                    continue;
+            if( v >= rgbp.i_entries )  /* maybe assert ? */
+                continue;
 
-                p_pixels[4*x+0] = rgbp.palette[v][0];
-                p_pixels[4*x+1] = rgbp.palette[v][1];
-                p_pixels[4*x+2] = rgbp.palette[v][2];
-                p_pixels[4*x+3] = rgbp.palette[v][3];
-            }
+            p_pixels[4*x+0] = rgbp.palette[v][0];
+            p_pixels[4*x+1] = rgbp.palette[v][1];
+            p_pixels[4*x+2] = rgbp.palette[v][2];
+            p_pixels[4*x+3] = rgbp.palette[v][3];
         }
-
     }
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7817030df4cf542363e4cf07a5c8716dc7c2a1b0...2c1fc0105372fcba469f1663bc931cb0c3154186

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7817030df4cf542363e4cf07a5c8716dc7c2a1b0...2c1fc0105372fcba469f1663bc931cb0c3154186
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