[vlc-commits] [Git][videolan/vlc][master] 3 commits: avcodec/chroma: remove unused RGB macros

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Oct 10 12:15:57 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b44d2c4b by Steve Lhomme at 2023-10-10T11:54:30+00:00
avcodec/chroma: remove unused RGB macros

- - - - -
2b9e31f9 by Steve Lhomme at 2023-10-10T11:54:30+00:00
avcodec/chroma: simplify headers

We only need the VLC FourCC's and the libavutil enum.

- - - - -
1eed0681 by Steve Lhomme at 2023-10-10T11:54:30+00:00
avcodec/chroma: use ARRAY_SIZE to iterate the chroma list

This should be slightly faster than dereferencing the table fourcc.
And it makes the table 1 item smaller!

- - - - -


1 changed file:

- modules/codec/avcodec/chroma.c


Changes:

=====================================
modules/codec/avcodec/chroma.c
=====================================
@@ -26,33 +26,17 @@
 #endif
 
 #include <vlc_common.h>
-#include <vlc_codec.h>
+#include <vlc_es.h>
 
 /*
  * Common header for swscale, avcodec (and avformat).
  * Only libavutil can be depended on here.
  */
-#include <libavutil/avutil.h>
-#include <libavutil/pixfmt.h>
 #include "chroma.h"
 
 /*****************************************************************************
  * Chroma fourcc -> libavutil pixfmt mapping
  *****************************************************************************/
-#if defined(WORDS_BIGENDIAN)
-#   define VLC_RGB_ES( fcc, leid, beid ) \
-    { fcc, beid },
-#else
-#   define VLC_RGB_ES( fcc, leid, beid ) \
-    { fcc, leid },
-#endif
-
-#define VLC_RGB( fcc, leid, beid, rmask, gmask, bmask ) \
-    { fcc, leid, rmask, gmask, bmask }, \
-    { fcc, beid, bmask, gmask, rmask }, \
-    VLC_RGB_ES( fcc, leid, beid )
-
-
 static const struct
 {
     vlc_fourcc_t  i_chroma;
@@ -219,12 +203,11 @@ static const struct
 
     /* XYZ */
     {VLC_CODEC_XYZ12, AV_PIX_FMT_XYZ12BE,  COLOR_RANGE_UNDEF },
-    { 0, 0, COLOR_RANGE_UNDEF }
 };
 
 int GetVlcChroma( video_format_t *fmt, enum AVPixelFormat i_ffmpeg_chroma )
 {
-    for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
+    for( size_t i = 0; i < ARRAY_SIZE(chroma_table); i++ )
     {
         if( chroma_table[i].i_chroma_id == i_ffmpeg_chroma )
         {
@@ -239,7 +222,7 @@ int GetVlcChroma( video_format_t *fmt, enum AVPixelFormat i_ffmpeg_chroma )
 
 enum AVPixelFormat FindFfmpegChroma( vlc_fourcc_t fourcc )
 {
-    for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
+    for( size_t i = 0; i < ARRAY_SIZE(chroma_table) != 0; i++ )
         if( chroma_table[i].i_chroma == fourcc )
             return chroma_table[i].i_chroma_id;
     return AV_PIX_FMT_NONE;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bc152ad969ac0713f4acece6cada03e5d63db417...1eed0681cdc5da8e3ce7bc5d6b59c2658206c186

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/bc152ad969ac0713f4acece6cada03e5d63db417...1eed0681cdc5da8e3ce7bc5d6b59c2658206c186
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