Merge branch 'misc_palette' into 'master'

Misc palette cleaning

See merge request videolan/vlc!3969
This commit is contained in:
Steve Lhomme 2024-04-28 07:10:49 +00:00
commit 7bf0f64f06
5 changed files with 7 additions and 19 deletions

View File

@ -259,7 +259,7 @@
#define VLC_CODEC_I444_16L VLC_FOURCC('I','4','F','L')
#define VLC_CODEC_I444_16B VLC_FOURCC('I','4','F','B')
/* Palettized YUV with palette element Y:U:V:A */
/* Palettized YUV with palette 8-bit Y:U:V:A in memory order */
#define VLC_CODEC_YUVP VLC_FOURCC('Y','U','V','P')
/* Planar YUV 4:4:4 Y:U:V:A */
@ -333,7 +333,7 @@
/* RGB / RGBA */
/* Palettized RGB with palette element R:G:B */
/* Palettized 8-bit RGB with palette element 8-bit R:G:B:A in memory order */
#define VLC_CODEC_RGBP VLC_FOURCC('R','G','B','P')
/* 32-bit RGB, in memory address order: "XRGB" ignoring the x component */

View File

@ -530,12 +530,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
fmt.p_palette = &palette;
fmt.p_palette->i_entries = 4;
for( i = 0; i < fmt.p_palette->i_entries; i++ )
{
fmt.p_palette->palette[i][0] = p_sys->p_palette[i][0];
fmt.p_palette->palette[i][1] = p_sys->p_palette[i][1];
fmt.p_palette->palette[i][2] = p_sys->p_palette[i][2];
fmt.p_palette->palette[i][3] = p_sys->p_palette[i][3];
}
memcpy( fmt.p_palette->palette[i], p_sys->p_palette[i], 4 );
p_region = subpicture_region_New( &fmt );
if( !p_region )

View File

@ -479,12 +479,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
fmt.p_palette = &palette;
fmt.p_palette->i_entries = 4;
for( i = 0; i < fmt.p_palette->i_entries; i++ )
{
fmt.p_palette->palette[i][0] = p_sys->p_palette[i][0];
fmt.p_palette->palette[i][1] = p_sys->p_palette[i][1];
fmt.p_palette->palette[i][2] = p_sys->p_palette[i][2];
fmt.p_palette->palette[i][3] = p_sys->p_palette[i][3];
}
memcpy( fmt.p_palette->palette[i], p_sys->p_palette[i], 4);
p_region = subpicture_region_New( &fmt );
fmt.p_palette = NULL;

View File

@ -797,7 +797,7 @@ static const staticentry_t p_list_video[] = {
B(VLC_CODEC_YUVA_444_12L, "Planar YUV 4:4:4 Y:U:V:A 12bits LE"),
B(VLC_CODEC_YUVA_444_12B, "Planar YUV 4:4:4 Y:U:V:A 12bits BE"),
B(VLC_CODEC_RGBP, "Palettized RGB with palette element R:G:B"),
B(VLC_CODEC_RGBP, "Palettized RGB with palette element R:G:B:A"),
A("RGBP"),
B(VLC_CODEC_RGB233, "8 bits RGB 2:3:3"),

View File

@ -1059,16 +1059,14 @@ static struct subpicture_region_rendered *SpuRenderRegion(spu_t *spu,
new_palette.i_entries = 4;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
new_palette.palette[i][j] = sys->palette.palette[i][j];
memcpy(new_palette.palette[i], &sys->palette.palette[i], 4);
b_opaque |= (new_palette.palette[i][3] > 0x00);
}
if (old_palette->i_entries == new_palette.i_entries) {
for (int i = 0; i < old_palette->i_entries; i++)
{
for (int j = 0; j < 4; j++)
changed_palette |= old_palette->palette[i][j] != new_palette.palette[i][j];
changed_palette |= memcmp(old_palette->palette[i], new_palette.palette[i], 4);
b_old_opaque |= (old_palette->palette[i][3] > 0x00);
}
} else {