[vlc-devel] commit: Fix BGR <-> RGB endianess problem with PNG's loading/converting/ copying on big-endian machines. (Jean-Paul Saman )
git version control
git at videolan.org
Wed Mar 5 16:01:34 CET 2008
vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Wed Mar 5 16:00:54 2008 +0100| [62977ca46b92d769a7626605a7153f85ceb8bba5]
Fix BGR <-> RGB endianess problem with PNG's loading/converting/copying on big-endian machines.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=62977ca46b92d769a7626605a7153f85ceb8bba5
---
modules/codec/ffmpeg/ffmpeg.c | 2 ++
modules/codec/ffmpeg/video.c | 19 ++++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/modules/codec/ffmpeg/ffmpeg.c b/modules/codec/ffmpeg/ffmpeg.c
index 2ffeebd..5e4e797 100644
--- a/modules/codec/ffmpeg/ffmpeg.c
+++ b/modules/codec/ffmpeg/ffmpeg.c
@@ -493,10 +493,12 @@ static struct
/* Packed RGB formats */
#if defined(WORDS_BIGENDIAN)
+ { VLC_FOURCC('R','G','B','8'), PIX_FMT_BGR8 },
{ VLC_FOURCC('R','V','1','5'), PIX_FMT_BGR555 },
{ VLC_FOURCC('R','V','1','6'), PIX_FMT_BGR565 },
{ VLC_FOURCC('R','V','2','4'), PIX_FMT_BGR24 },
#else
+ { VLC_FOURCC('R','G','B','8'), PIX_FMT_RGB8 },
{ VLC_FOURCC('R','V','1','5'), PIX_FMT_RGB555 },
{ VLC_FOURCC('R','V','1','6'), PIX_FMT_RGB565 },
{ VLC_FOURCC('R','V','2','4'), PIX_FMT_RGB24 },
diff --git a/modules/codec/ffmpeg/video.c b/modules/codec/ffmpeg/video.c
index 9ae5fa4..fc25687 100644
--- a/modules/codec/ffmpeg/video.c
+++ b/modules/codec/ffmpeg/video.c
@@ -124,12 +124,25 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
case PIX_FMT_YUV422:
return VLC_FOURCC('Y','U','Y','2');
+#if defined(WORDS_BIGENDIAN)
+ case PIX_FMT_BGR8:
+ return VLC_FOURCC('R','G','B','8');
+ case PIX_FMT_BGR555:
+ return VLC_FOURCC('R','V','1','5');
+ case PIX_FMT_BGR565:
+ return VLC_FOURCC('R','V','1','6');
+ case PIX_FMT_BGR24:
+ return VLC_FOURCC('R','V','2','4');
+#else
+ case PIX_FMT_RGB8:
+ return VLC_FOURCC('R','G','B','8');
case PIX_FMT_RGB555:
return VLC_FOURCC('R','V','1','5');
case PIX_FMT_RGB565:
return VLC_FOURCC('R','V','1','6');
case PIX_FMT_RGB24:
return VLC_FOURCC('R','V','2','4');
+#endif
case PIX_FMT_RGBA32:
return VLC_FOURCC('R','V','3','2');
#ifdef PIX_FMT_RGBA
@@ -141,7 +154,6 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
case PIX_FMT_YUV410P:
case PIX_FMT_YUV411P:
- case PIX_FMT_BGR24:
default:
return 0;
}
@@ -838,7 +850,12 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
{
case PIX_FMT_YUV410P:
case PIX_FMT_YUV411P:
+ case PIX_FMT_RGB32:
+ case PIX_FMT_RGB24:
+ case PIX_FMT_RGB8:
+ case PIX_FMT_BGR32:
case PIX_FMT_BGR24:
+ case PIX_FMT_BGR8:
case PIX_FMT_PAL8:
for( i = 0; i < p_pic->i_planes; i++ )
{
More information about the vlc-devel
mailing list