[vlc-commits] [Git][videolan/vlc][master] codec: cvdsub: refactor RLE unpacking

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Aug 17 09:40:24 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
c2a9b076 by François Cartegnie at 2026-08-17T09:29:05+00:00
codec: cvdsub: refactor RLE unpacking

refs #29864

- - - - -


1 changed file:

- modules/codec/cvdsub.c


Changes:

=====================================
modules/codec/cvdsub.c
=====================================
@@ -590,8 +590,7 @@ static void RenderImage( decoder_t *p_dec, block_t *p_data,
     decoder_sys_t *p_sys = p_dec->p_sys;
     uint8_t *p_dest = dst_pic->Y_PIXELS;
     int i_field;            /* The subtitles are interlaced */
-    int i_row, i_column;    /* scanline row/column number */
-    uint8_t i_color, i_count;
+    size_t i_row, i_column; /* scanline row/column number */
     bs_t bs;
 
     bs_init( &bs, p_data->p_buffer + p_sys->i_image_offset,
@@ -604,31 +603,27 @@ static void RenderImage( decoder_t *p_dec, block_t *p_data,
             for( i_column = 0; i_column < p_sys->i_width; i_column++ )
             {
                 uint8_t i_val = bs_read( &bs, 4 );
+                uint8_t *p = &p_dest[i_row * dst_pic->Y_PITCH + i_column];
+                size_t i_count;
+                uint8_t i_color;
 
                 if( i_val == 0 )
                 {
                     /* Fill the rest of the line with next color */
                     i_color = bs_read( &bs, 4 );
-
-                    memset( &p_dest[i_row * dst_pic->Y_PITCH +
-                                    i_column], i_color,
-                            p_sys->i_width - i_column );
+                    i_count = p_sys->i_width - i_column;
                     i_column = p_sys->i_width;
-                    continue;
                 }
                 else
                 {
                     /* Normal case: get color and repeat count */
                     i_count = (i_val >> 2);
                     i_color = i_val & 0x3;
-
                     i_count = __MIN( i_count, p_sys->i_width - i_column );
-
-                    memset( &p_dest[i_row * dst_pic->Y_PITCH +
-                                    i_column], i_color, i_count );
                     i_column += i_count - 1;
-                    continue;
                 }
+
+                memset( p, i_color, i_count );
             }
 
             bs_align( &bs );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c2a9b0766817a392ac3231ef883728e2f2c9625c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c2a9b0766817a392ac3231ef883728e2f2c9625c
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list