Commit 62977ca4 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Fix BGR <-> RGB endianess problem with PNG's loading/converting/copying on big-endian machines.

parent 5b2c2711
...@@ -493,10 +493,12 @@ static struct ...@@ -493,10 +493,12 @@ static struct
/* Packed RGB formats */ /* Packed RGB formats */
#if defined(WORDS_BIGENDIAN) #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','5'), PIX_FMT_BGR555 },
{ VLC_FOURCC('R','V','1','6'), PIX_FMT_BGR565 }, { VLC_FOURCC('R','V','1','6'), PIX_FMT_BGR565 },
{ VLC_FOURCC('R','V','2','4'), PIX_FMT_BGR24 }, { VLC_FOURCC('R','V','2','4'), PIX_FMT_BGR24 },
#else #else
{ VLC_FOURCC('R','G','B','8'), PIX_FMT_RGB8 },
{ VLC_FOURCC('R','V','1','5'), PIX_FMT_RGB555 }, { VLC_FOURCC('R','V','1','5'), PIX_FMT_RGB555 },
{ VLC_FOURCC('R','V','1','6'), PIX_FMT_RGB565 }, { VLC_FOURCC('R','V','1','6'), PIX_FMT_RGB565 },
{ VLC_FOURCC('R','V','2','4'), PIX_FMT_RGB24 }, { VLC_FOURCC('R','V','2','4'), PIX_FMT_RGB24 },
......
...@@ -124,12 +124,25 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma ) ...@@ -124,12 +124,25 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
case PIX_FMT_YUV422: case PIX_FMT_YUV422:
return VLC_FOURCC('Y','U','Y','2'); 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: case PIX_FMT_RGB555:
return VLC_FOURCC('R','V','1','5'); return VLC_FOURCC('R','V','1','5');
case PIX_FMT_RGB565: case PIX_FMT_RGB565:
return VLC_FOURCC('R','V','1','6'); return VLC_FOURCC('R','V','1','6');
case PIX_FMT_RGB24: case PIX_FMT_RGB24:
return VLC_FOURCC('R','V','2','4'); return VLC_FOURCC('R','V','2','4');
#endif
case PIX_FMT_RGBA32: case PIX_FMT_RGBA32:
return VLC_FOURCC('R','V','3','2'); return VLC_FOURCC('R','V','3','2');
#ifdef PIX_FMT_RGBA #ifdef PIX_FMT_RGBA
...@@ -141,7 +154,6 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma ) ...@@ -141,7 +154,6 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
case PIX_FMT_YUV410P: case PIX_FMT_YUV410P:
case PIX_FMT_YUV411P: case PIX_FMT_YUV411P:
case PIX_FMT_BGR24:
default: default:
return 0; return 0;
} }
...@@ -838,7 +850,12 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec, ...@@ -838,7 +850,12 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
{ {
case PIX_FMT_YUV410P: case PIX_FMT_YUV410P:
case PIX_FMT_YUV411P: 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_BGR24:
case PIX_FMT_BGR8:
case PIX_FMT_PAL8: case PIX_FMT_PAL8:
for( i = 0; i < p_pic->i_planes; i++ ) for( i = 0; i < p_pic->i_planes; i++ )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment