[vlc-devel] commit: Fixed RGB ffmpeg color selection. (Laurent Aimar )

git version control git at videolan.org
Thu Aug 28 01:03:30 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Aug 28 00:33:36 2008 +0200| [fb7f014161f68c914e028adbea68b7ee9863c76e] | committer: Laurent Aimar 

Fixed RGB ffmpeg color selection.

I have some doubt about it, either swscale does not respect the ffmpeg doc
or the doc is wrong (about the rgb mask).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fb7f014161f68c914e028adbea68b7ee9863c76e
---

 modules/codec/avcodec/chroma.h |    7 ++++---
 modules/codec/png.c            |    9 +++------
 modules/video_filter/swscale.c |    4 ++--
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/modules/codec/avcodec/chroma.h b/modules/codec/avcodec/chroma.h
index 51f0c7b..3b1d67c 100644
--- a/modules/codec/avcodec/chroma.h
+++ b/modules/codec/avcodec/chroma.h
@@ -81,9 +81,10 @@ static const struct
     /* Packed RGB formats */
     VLC_RGB( VLC_FOURCC('R','G','B','4'), PIX_FMT_RGB4, PIX_FMT_BGR4, 0x10, 0x06, 0x01 )
     VLC_RGB( VLC_FOURCC('R','G','B','8'), PIX_FMT_RGB8, PIX_FMT_BGR8, 0xC0, 0x38, 0x07 )
-    VLC_RGB( VLC_FOURCC('R','V','1','5'), PIX_FMT_RGB555, PIX_FMT_BGR555, 0x7c00, 0x03e0, 0x001f )
-    VLC_RGB( VLC_FOURCC('R','V','1','6'), PIX_FMT_RGB565, PIX_FMT_BGR565, 0xf800, 0x07e0, 0x001f )
-    VLC_RGB( VLC_FOURCC('R','V','2','4'), PIX_FMT_RGB24, PIX_FMT_BGR24, 0xff0000, 0x00ff00, 0x0000ff )
+
+    VLC_RGB( VLC_FOURCC('R','V','1','5'), PIX_FMT_BGR555, PIX_FMT_RGB555, 0x7c00, 0x03e0, 0x001f )
+    VLC_RGB( VLC_FOURCC('R','V','1','6'), PIX_FMT_BGR565, PIX_FMT_RGB565, 0xf800, 0x07e0, 0x001f )
+    VLC_RGB( VLC_FOURCC('R','V','2','4'), PIX_FMT_BGR24, PIX_FMT_RGB24, 0xff0000, 0x00ff00, 0x0000ff )
 
     VLC_RGB( VLC_FOURCC('R','V','3','2'), PIX_FMT_RGB32, PIX_FMT_BGR32, 0x00ff0000, 0x0000ff00, 0x000000ff )
     VLC_RGB( VLC_FOURCC('R','V','3','2'), PIX_FMT_RGB32_1, PIX_FMT_BGR32_1, 0xff000000, 0x00ff0000, 0x0000ff00 )
diff --git a/modules/codec/png.c b/modules/codec/png.c
index bac19f5..7ed1c03 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -182,6 +182,9 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_dec->fmt_out.video.i_width = i_width;
     p_dec->fmt_out.video.i_height = i_height;
     p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
+    p_dec->fmt_out.video.i_rmask = 0x000000ff;
+    p_dec->fmt_out.video.i_gmask = 0x0000ff00;
+    p_dec->fmt_out.video.i_bmask = 0x00ff0000;
 
     if( i_color_type == PNG_COLOR_TYPE_PALETTE )
         png_set_palette_to_rgb( p_png );
@@ -201,12 +204,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     {
         p_dec->fmt_out.i_codec = VLC_FOURCC('R','V','2','4');
     }
-    if( i_color_type & PNG_COLOR_MASK_COLOR &&
-        p_dec->fmt_out.i_codec != VLC_FOURCC('R','V','2','4') )
-    {
-        /* Invert colors */
-        png_set_bgr( p_png );
-    }
 
     /* Get a new picture */
     p_pic = p_dec->pf_vout_buffer_new( p_dec );
diff --git a/modules/video_filter/swscale.c b/modules/video_filter/swscale.c
index 4d400ca..81a9632 100644
--- a/modules/video_filter/swscale.c
+++ b/modules/video_filter/swscale.c
@@ -285,7 +285,7 @@ static int GetParameters( ScalerConfiguration *p_cfg,
     }
     else if( p_fmti->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
     {
-        i_fmti = PIX_FMT_RGBA32;
+        i_fmti = PIX_FMT_BGR32;
         b_has_ai = true;
     }
 
@@ -296,7 +296,7 @@ static int GetParameters( ScalerConfiguration *p_cfg,
     }
     else if( p_fmto->i_chroma == VLC_FOURCC( 'R', 'G', 'B', 'A' ) )
     {
-        i_fmto = PIX_FMT_RGBA32;
+        i_fmto = PIX_FMT_BGR32;
         b_has_ao = true;
     }
 




More information about the vlc-devel mailing list