Commit fb7f0141 authored by Laurent Aimar's avatar 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).
parent 9818e276
......@@ -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 )
......
......@@ -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 );
......
......@@ -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;
}
......
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