[vlc-devel] [PATCH] Improve performance of zvbi subtitles

Finn Hughes finn.hughes1 at gmail.com
Wed Jun 12 10:59:07 CEST 2013


Thanks, patch updated with "for ( int i = 0" style loops.

Finn

On 11/06/13 18:42, Rémi Denis-Courmont wrote:
>     Hello,
>
> Looks good but...
>
> diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
> index 2a91f88..abe8c3e 100644
> --- a/modules/codec/zvbi.c
> +++ b/modules/codec/zvbi.c
> @@ -567,8 +584,38 @@ static void EventHandler( vbi_event *ev, void *user_data
> )
>           msg_Dbg( p_dec, "Network ID changed" );
>   }
>   
> +static int get_first_visible_row( vbi_char *p_text, int rows, int columns)
> +{
> +    int i;
> +
> +    for ( i = 0; i < rows * columns; i++ )
>
> Please use C++/C99 style for-loops in new code.
>
> +    {
> +        if ( p_text[i].opacity != VBI_TRANSPARENT_SPACE )
> +        {
> +            return i / columns;
> +        }
> +    }
> +
> +    return rows;
> +}
> +
> +static int get_last_visible_row( vbi_char *p_text, int rows, int columns)
> +{
> +    int i;
> +
> +    for ( i = rows * columns - 1; i >= 0; i-- )
> +    {
> +        if (p_text[i].opacity != VBI_TRANSPARENT_SPACE)
> +        {
> +            return ( i + columns - 1) / columns;
> +        }
> +    }
> +
> +    return 0;
> +}
> +
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Improve-performance-of-zvbi-subtitles.patch
Type: text/x-patch
Size: 6345 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20130612/9a6cff0e/attachment.bin>


More information about the vlc-devel mailing list