[vlc-commits] [Git][videolan/vlc][master] i420_rgb: simplify allocation

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Sep 9 10:01:32 UTC 2023



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


Commits:
80cc56d7 by Steve Lhomme at 2023-09-09T09:37:41+00:00
i420_rgb: simplify allocation

It's always i_bytespp * RGB_TABLE_SIZE.

- - - - -


1 changed file:

- modules/video_chroma/i420_rgb.c


Changes:

=====================================
modules/video_chroma/i420_rgb.c
=====================================
@@ -91,10 +91,6 @@ VIDEO_FILTER_WRAPPER_CLOSE_EXT( I420_RGB32, Deactivate )
  *****************************************************************************/
 static int Activate( filter_t *p_filter )
 {
-#ifdef PLUGIN_PLAIN
-    size_t i_tables_size;
-#endif
-
     if( !vlc_CPU_capable() )
         return VLC_EGENERIC;
     if( p_filter->fmt_out.video.i_width & 1
@@ -233,21 +229,7 @@ static int Activate( filter_t *p_filter )
     }
 
 #ifdef PLUGIN_PLAIN
-    switch( p_filter->fmt_out.video.i_chroma )
-    {
-    case VLC_CODEC_RGB8:
-        i_tables_size = PALETTE_TABLE_SIZE;
-        break;
-    case VLC_CODEC_RGB15:
-    case VLC_CODEC_RGB16:
-        i_tables_size = 2 * RGB_TABLE_SIZE;
-        break;
-    default: /* RV24, RV32 */
-        i_tables_size = 4 * RGB_TABLE_SIZE;
-        break;
-    }
-
-    p_sys->p_base = malloc( i_tables_size );
+    p_sys->p_base = malloc( p_sys->i_bytespp * RGB_TABLE_SIZE );
     if( p_sys->p_base == NULL )
     {
         free( p_sys->p_offset );



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

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80cc56d744569e5b2aeb50bb4ce6cf9eb30aed49
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