mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
dvdsubdec: make up clut values if they weren't set
This commit is contained in:
parent
455aaa3fbd
commit
0a786810af
1 changed files with 26 additions and 8 deletions
|
@ -37,15 +37,33 @@ gstspu_vobsub_recalc_palette (GstDVDSpu * dvdspu,
|
||||||
SpuState *state = &dvdspu->spu_state;
|
SpuState *state = &dvdspu->spu_state;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++, dest++) {
|
if (state->vobsub.current_clut[idx[0]] != 0) {
|
||||||
guint32 col = state->vobsub.current_clut[idx[i]];
|
for (i = 0; i < 4; i++, dest++) {
|
||||||
|
guint32 col = state->vobsub.current_clut[idx[i]];
|
||||||
|
|
||||||
/* Convert incoming 4-bit alpha to 8 bit for blending */
|
/* Convert incoming 4-bit alpha to 8 bit for blending */
|
||||||
dest->A = (alpha[i] << 4) | alpha[i];
|
dest->A = (alpha[i] << 4) | alpha[i];
|
||||||
dest->Y = ((guint16) ((col >> 16) & 0xff)) * dest->A;
|
dest->Y = ((guint16) ((col >> 16) & 0xff)) * dest->A;
|
||||||
/* U/V are stored as V/U in the clut words, so switch them */
|
/* U/V are stored as V/U in the clut words, so switch them */
|
||||||
dest->V = ((guint16) ((col >> 8) & 0xff)) * dest->A;
|
dest->V = ((guint16) ((col >> 8) & 0xff)) * dest->A;
|
||||||
dest->U = ((guint16) (col & 0xff)) * dest->A;
|
dest->U = ((guint16) (col & 0xff)) * dest->A;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int y = 240;
|
||||||
|
|
||||||
|
/* The CLUT presumably hasn't been set, so we'll just guess some
|
||||||
|
* values for the non-transparent colors (white, grey, black) */
|
||||||
|
for (i = 0; i < 4; i++, dest++) {
|
||||||
|
dest->A = (alpha[i] << 4) | alpha[i];
|
||||||
|
if (alpha[i] != 0) {
|
||||||
|
dest[0].Y = y * dest[0].A;
|
||||||
|
y -= 112;
|
||||||
|
if (y < 0)
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
dest[0].U = 128 * dest[0].A;
|
||||||
|
dest[0].V = 128 * dest[0].A;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue