summaryrefslogtreecommitdiffstats
path: root/spudec.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-09 22:47:41 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-09 22:47:41 +0200
commit8e593f5a34b4827d6ec97dd875c802267a6f03b7 (patch)
tree648fde930e4a2b836a9803b17944c370a9608c72 /spudec.c
parentbf31241e932818df3bc2eba55cf06c2b9ee3f56f (diff)
parent5c10618fa191d306e6d6674dd2fc7ad46476f85d (diff)
downloadmpv-8e593f5a34b4827d6ec97dd875c802267a6f03b7.tar.bz2
mpv-8e593f5a34b4827d6ec97dd875c802267a6f03b7.tar.xz
Merge svn changes up to r30529
Diffstat (limited to 'spudec.c')
-rw-r--r--spudec.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/spudec.c b/spudec.c
index 05ec81f514..e03328ab8b 100644
--- a/spudec.c
+++ b/spudec.c
@@ -175,14 +175,9 @@ static inline int mkalpha(int i)
{
/* In mplayer's alpha planes, 0 is transparent, then 1 is nearly
opaque upto 255 which is transparent */
- switch (i) {
- case 0xf:
- return 1;
- case 0:
- return 0;
- default:
- return (0xf - i) << 4;
- }
+ // extend 4 -> 8 bit
+ i |= i << 4;
+ return (uint8_t)(-i);
}
/* Cut the sub to visible part */
@@ -359,7 +354,7 @@ static void compute_palette(spudec_handle_t *this, packet_t *packet)
static void spudec_process_control(spudec_handle_t *this, int pts100)
{
- int a,b; /* Temporary vars */
+ int a,b,c,d; /* Temporary vars */
unsigned int date, type;
unsigned int off;
unsigned int start_off = 0;
@@ -422,10 +417,22 @@ static void spudec_process_control(spudec_handle_t *this, int pts100)
break;
case 0x04:
/* Alpha */
- this->alpha[0] = this->packet[off] >> 4;
- this->alpha[1] = this->packet[off] & 0xf;
- this->alpha[2] = this->packet[off + 1] >> 4;
- this->alpha[3] = this->packet[off + 1] & 0xf;
+ a = this->packet[off] >> 4;
+ b = this->packet[off] & 0xf;
+ c = this->packet[off + 1] >> 4;
+ d = this->packet[off + 1] & 0xf;
+ // Note: some DVDs change these values to create a fade-in/fade-out effect
+ // We can not handle this, so just keep the highest value during the display time.
+ if (display) {
+ a = FFMAX(a, this->alpha[0]);
+ b = FFMAX(b, this->alpha[1]);
+ c = FFMAX(c, this->alpha[2]);
+ d = FFMAX(d, this->alpha[3]);
+ }
+ this->alpha[0] = a;
+ this->alpha[1] = b;
+ this->alpha[2] = c;
+ this->alpha[3] = d;
mp_msg(MSGT_SPUDEC,MSGL_DBG2,"Alpha %d, %d, %d, %d\n",
this->alpha[0], this->alpha[1], this->alpha[2], this->alpha[3]);
off+=2;