[FFmpeg-cvslog] r18637 - trunk/libavcodec/rv34.c

Måns Rullgård mans
Tue Apr 21 18:15:40 CEST 2009


kostya <subversion at mplayerhq.hu> writes:

> Author: kostya
> Date: Tue Apr 21 06:42:27 2009
> New Revision: 18637
>
> Log:
> Make RV3/4 VLC tables use new static initialization method
>
> Modified:
>    trunk/libavcodec/rv34.c
>
> [...]
>
> +static const VLC_TYPE table_data[117592][2];

That is a HUGE array.  Is this really good for the cache?
Furthermore, it's const, and ...

> @@ -92,10 +117,12 @@ static void rv34_gen_vlc(const uint8_t *
>      for(i = 0; i < realsize; i++)
>          cw[i] = codes[bits2[i]]++;
>
> +    vlc->table = &table_data[table_offs[num]];

... here pointers into it are assigned to non-const pointers, ...

> +    vlc->table_allocated = table_offs[num + 1] - table_offs[num];
>      init_vlc_sparse(vlc, FFMIN(maxbits, 9), realsize,
>                      bits2, 1, 1,
>                      cw,    2, 2,
> -                    syms,  2, 2, INIT_VLC_USE_STATIC);
> +                    syms,  2, 2, INIT_VLC_USE_NEW_STATIC);

... and written to here.

GCC, for some reason, allocates this array in the .bss section.  Other
compilers (armcc and icc) make it read-only, as they should, resulting
in a crash at runtime.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-cvslog mailing list