Changeset 660db6d87715f5b677edbb8fddd071ad236511eb

Show
Ignore:
Timestamp:
06/27/02 21:46:32 (6 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 1025207192 +0000
git-parent:

[3a31acccc1b5720c3256c4677ac85282915fc610]

git-author:
Sam Hocevar <sam@videolan.org> 1025207192 +0000
Message:
  • ./plugins/dvd/dvd_es.c: error in selecting SPU stream.
  • ./plugins/spudec/spu_decoder.c: endianness fix for subtitles colour.
  • ./plugins/spudec/spu_decoder.c: little hack for preventing blank alpha
    palette.
  • ./plugins/spudec/spu_decoder.c: subtitle transparency support.

Patches imported from v0_4_1_branch.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • AUTHORS

    rd680938 r660db6d  
    175175D: IPv6 
    176176S: United Kingdom 
     177 
     178N: Roine Gustafsson 
     179E: roine@popstar.com 
     180D: spudec bug fixes 
    177181 
    178182N: Shane Harper 
  • ChangeLog

    r62e73f5 r660db6d  
    6868 
    69690.4.2 
    70 Mon, 20 Jun 2002 00:41:26 +0200 
    71  
     70Not released yet 
     71 
     72  * ./plugins/dvd/dvd_es.c: error in selecting SPU stream. 
     73  * ./plugins/spudec/spu_decoder.c: endianness fix for subtitles colour. 
     74  * ./plugins/spudec/spu_decoder.c: little hack for preventing blank alpha  
     75    palette. 
     76  * ./plugins/spudec/spu_decoder.c: subtitle transparency support. 
    7277  * ./plugins/macosx: new controls for audio output, and deinterlacing 
    7378    support. 
  • plugins/dvd/dvd_es.c

    r695669c r660db6d  
    22 ***************************************************************************** 
    33 * Copyright (C) 1998-2001 VideoLAN 
    4  * $Id: dvd_es.c,v 1.13 2002/06/02 13:49:35 sam Exp $ 
     4 * $Id: dvd_es.c,v 1.14 2002/06/27 19:46:32 sam Exp $ 
    55 * 
    66 * Author: St�ane Borel <stef@via.ecp.fr> 
     
    307307        if( i_spu > 0 ) 
    308308        { 
    309             i_spu += p_dvd->p_ifo->vts.manager_inf.i_audio_nb; 
    310             input_SelectES( p_input, p_input->stream.pp_es[i_spu] ); 
     309            int i = 0, j = 0; 
     310            for( i = 0; i < p_input->stream.i_es_number; i++ ) 
     311            { 
     312                if ( p_input->stream.pp_es[i]->i_type == DVD_SPU_ES ) 
     313                { 
     314                    j++; 
     315                    if ( i_spu == j ) break; 
     316                } 
     317            } 
     318            if( i_spu == j ) 
     319            { 
     320                input_SelectES( p_input, p_input->stream.pp_es[i] ); 
     321            } 
    311322        } 
    312323    } 
  • plugins/spudec/spu_decoder.c

    r92cae55 r660db6d  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000-2001 VideoLAN 
    5  * $Id: spu_decoder.c,v 1.28 2002/06/05 18:18:49 stef Exp $ 
     5 * $Id: spu_decoder.c,v 1.29 2002/06/27 19:46:32 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    379379    int i_date; 
    380380 
    381     int i
     381    int i, pi_alpha[4]
    382382 
    383383    /* XXX: temporary variables */ 
     
    445445                                          GetBits(&p_spudec->bit_stream, 4) ]; 
    446446 
     447                            /* FIXME: this job should be done sooner */ 
     448#ifndef WORDS_BIGENDIAN 
    447449                            p_spu->p_sys->pi_yuv[3-i][0] = (i_color>>16) & 0xff; 
    448450                            p_spu->p_sys->pi_yuv[3-i][1] = (i_color>>0) & 0xff; 
    449451                            p_spu->p_sys->pi_yuv[3-i][2] = (i_color>>8) & 0xff; 
     452#else 
     453                            p_spu->p_sys->pi_yuv[3-i][0] = (i_color>>8) & 0xff; 
     454                            p_spu->p_sys->pi_yuv[3-i][1] = (i_color>>24) & 0xff; 
     455                            p_spu->p_sys->pi_yuv[3-i][2] = (i_color>>16) & 0xff; 
     456#endif 
    450457                        } 
    451458                    } 
     
    461468  
    462469                    /* 04xxxx (alpha channel) */ 
    463                     for( i = 0; i < 4 ; i++ ) 
     470                    pi_alpha[3] = GetBits( &p_spudec->bit_stream, 4 ); 
     471                    pi_alpha[2] = GetBits( &p_spudec->bit_stream, 4 ); 
     472                    pi_alpha[1] = GetBits( &p_spudec->bit_stream, 4 ); 
     473                    pi_alpha[0] = GetBits( &p_spudec->bit_stream, 4 ); 
     474 
     475                    /* Ignore blank alpha palette. Sometimes spurious blank 
     476                     * alpha palettes are present - dunno why. */ 
     477                    if( pi_alpha[0] | pi_alpha[1] | pi_alpha[2] | pi_alpha[3] ) 
    464478                    { 
    465                         p_spu->p_sys->pi_alpha[3-i] 
    466                                        = GetBits( &p_spudec->bit_stream, 4 ); 
     479                        p_spu->p_sys->pi_alpha[0] = pi_alpha[0]; 
     480                        p_spu->p_sys->pi_alpha[1] = pi_alpha[1]; 
     481                        p_spu->p_sys->pi_alpha[2] = pi_alpha[2]; 
     482                        p_spu->p_sys->pi_alpha[3] = pi_alpha[3]; 
    467483                    } 
     484                    else 
     485                    { 
     486                        msg_Warn( p_spudec->p_fifo, 
     487                                  "ignoring blank alpha palette" ); 
     488                    } 
     489 
    468490                    i_index += 2; 
    469491  
     
    828850    u32  p_clut32[4]; 
    829851    u8  *p_dest; 
     852    u8  *p_destptr = (u8 *)p_dest; 
    830853    u16 *p_source = (u16 *)p_spu->p_sys->p_data; 
    831854 
    832855    int i_x, i_y; 
    833     int i_len, i_color
     856    int i_len, i_color, i_colprecomp, i_destalpha
    834857    u8  i_cnt; 
    835858 
     
    857880            /* Get the RLE part, then draw the line */ 
    858881            i_color = *p_source & 0x3; 
     882            i_len = *p_source++ >> 2; 
    859883 
    860884            switch( p_spu->p_sys->pi_alpha[ i_color ] ) 
    861885            { 
    862886                case 0x00: 
    863                     i_x -= *p_source++ >> 2; 
    864887                    break; 
    865888 
    866889                case 0x0f: 
    867                     i_len = *p_source++ >> 2; 
    868890                    memset( p_dest - i_x - i_y, 
    869891                            p_spu->p_sys->pi_yuv[i_color][0], i_len ); 
    870                     i_x -= i_len; 
    871892                    break; 
    872893 
    873894                default: 
    874                     /* FIXME: we should do transparency */ 
    875                     i_len = *p_source++ >> 2; 
    876                     memset( p_dest - i_x - i_y, 
    877                             p_spu->p_sys->pi_yuv[i_color][0], i_len ); 
    878                     i_x -= i_len; 
    879                     break; 
    880             } 
     895                    /* To be able to divide by 16 (>>4) we add 1 to the alpha. 
     896                     * This means Alpha 0 won't be completely transparent, but 
     897                     * that's handled in a special case above anyway. */ 
     898                    i_colprecomp = p_spu->p_sys->pi_yuv[i_color][0] 
     899                                    * (p_spu->p_sys->pi_alpha[ i_color ] + 1); 
     900                    i_destalpha = 15 - p_spu->p_sys->pi_alpha[ i_color ]; 
     901 
     902                    for ( p_destptr = p_dest - i_x - i_y; 
     903                          p_destptr < p_dest - i_x - i_y + i_len; 
     904                          p_destptr++ ) 
     905                    { 
     906                        *p_destptr = ( i_colprecomp + 
     907                                        *p_destptr * i_destalpha ) >> 4; 
     908                    } 
     909                    break; 
     910 
     911            } 
     912            i_x -= i_len; 
    881913        } 
    882914    }