[vlc-commits] [Git][videolan/vlc][master] 2 commits: bitmapinfoheader: use the chroma description to the number of bits per pixel

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Oct 26 09:06:33 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
87a22d1e by Steve Lhomme at 2023-10-26T08:45:49+00:00
bitmapinfoheader: use the chroma description to the number of bits per pixel

- - - - -
5fed85a9 by Steve Lhomme at 2023-10-26T08:45:49+00:00
bitmapinfoheader: regroup chromas by biCompression value

- - - - -


1 changed file:

- modules/demux/avi/bitmapinfoheader.h


Changes:

=====================================
modules/demux/avi/bitmapinfoheader.h
=====================================
@@ -265,43 +265,35 @@ static inline int CreateBitmapInfoHeader( const es_format_t *fmt,
                                           uint8_t **p_bih_extra,
                                           size_t *pi_total )
 {
-    uint16_t biBitCount = 0;
-    uint32_t biCompression = BI_RGB;
+    const vlc_chroma_description_t *desc =
+        vlc_fourcc_GetChromaDescription(fmt->i_codec);
+    uint16_t biBitCount = desc != NULL ? desc->pixel_size * 8 : 0;
+    uint32_t biCompression;
     bool b_has_alpha = false;
     switch( fmt->i_codec )
     {
         case VLC_CODEC_XRGB:
-            biBitCount = 32;
+        case VLC_CODEC_BGR24:
+        case VLC_CODEC_BGR565LE:
+        case VLC_CODEC_BGR555LE:
+        case VLC_CODEC_RGBP:
+        case VLC_CODEC_GREY:
+            biCompression = BI_RGB;
             break;
         case VLC_CODEC_BGRX:
         case VLC_CODEC_XBGR:
         case VLC_CODEC_RGBX:
-            biBitCount = 32;
             biCompression = BI_BITFIELDS;
             break;
         case VLC_CODEC_BGRA:
         case VLC_CODEC_RGBA:
         case VLC_CODEC_ARGB:
         case VLC_CODEC_ABGR:
-            biBitCount = 32;
             biCompression = BI_BITFIELDS;
             b_has_alpha = true;
             break;
-        case VLC_CODEC_BGR24:
-            biBitCount = 24;
-            break;
         case VLC_CODEC_RGB24:
             return VLC_EINVAL;
-        case VLC_CODEC_BGR565LE:
-            biBitCount = 16;
-            break;
-        case VLC_CODEC_BGR555LE:
-            biBitCount = 16;
-            break;
-        case VLC_CODEC_RGBP:
-        case VLC_CODEC_GREY:
-            biBitCount = 8;
-            break;
         case VLC_CODEC_MP4V:
             biCompression = VLC_FOURCC( 'X', 'V', 'I', 'D' );
             break;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/adeb34f6140dad4c92409a061196ed2a59b4e07f...5fed85a97f268116c2c8ddfdd11e34fa6c5c3d08

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/adeb34f6140dad4c92409a061196ed2a59b4e07f...5fed85a97f268116c2c8ddfdd11e34fa6c5c3d08
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