[vlc-devel] Poor subtitle performance and what's causing it

Tepe Hautamäki tp7000 at hotmail.com
Mon Feb 8 21:09:31 CET 2010


Hello, as VLC_help suggested, I'm reporting about a problem previously encountered here:

http://forum.videolan.org/viewtopic.php?f=2&t=69626&p=231143
http://forum.videolan.org/viewtopic.php?f=14&t=62367&p=208540
http://old.nabble.com/Very-slow-image-when-subtitles-activated-td26652044.html

and examined here by me:

http://forum.videolan.org/viewtopic.php?f=7&t=64957#p237708

The problem is basically that displaying subtitles takes a disproportionate amount
of CPU time (several times the video decoding overhead, depending on subtitle size)
and in extreme cases can cause frames to be skipped. I found this function in
modules/video_filter/blend.c to be the culprit:

static inline int vlc_blend( int v1, int v2, int a )
{
    /* TODO bench if the tests really increase speed */
    if( a == 0 )
        return v2;
    else if( a == MAX_TRANS )
        return v1;
    return ( v1 * a + v2 * (MAX_TRANS - a ) )>> TRANS_BITS;
}

After my forum post I did some more examining and the v2 value (the original value)
seems to be critical here, as vlc_blend is used in operations like this:

p_dst_y[i_x] = vlc_blend( p_src_y[i_x], p_dst_y[i_x], i_trans );

It seems that reading + writing the original data is slow. If the value v2 is
actually used in an operation, then slowdown will occur.

This problem appeared between versions 0.9.9 and 1.0.0. One intermediate buffer was
removed between these versions, which is the likely cause. Previously, the call
format was like this:

p_dst_y[i_x] = vlc_blend( p_src2_y[i_x], p_src1_y[i_x], i_trans );


-

 		 	   		  
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969


More information about the vlc-devel mailing list