[FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

Hendrik Leppkes h.leppkes at gmail.com
Sun Jan 4 22:49:16 CET 2015


On Sun, Jan 4, 2015 at 6:41 PM, wm4 <nfxjfg at googlemail.com> wrote:

> On Sun, 4 Jan 2015 17:47:20 +0100
> Michael Niedermayer <michaelni at gmx.at> wrote:
>
> > > >> +};
> > > >> +
> > > >> +
> > > >> +typedef struct CCaptionSubContext {
> > > >> +    AVClass *class;
> > > >> +    int parity_table[256];
> > > > this can be a static uint8_t table
> > > >
> > > I don't think static variable in structure are allowed in c language
> > > that is cpp thing.
> > >
> > > If you meant to remove that table from structure, then too its
> > > not efficient, we have to make parity table every time decode
> > > function is called.
> >
> > the table is constant and does not change, theres no need to have
> > a copy of it in each context or to "make it every time decode is
> > called"
> > a simple static uint8_t parity_table[256];
> > or even
> > static const uint8_t parity_table[256] = {...}
> >
>
> IMO such global writable state is bad style and should be avoided if
> possible. Even if it's only 256 bytes in this case. What's wrong with
> keeping it in the context?
>
>
I thought the point was that it was constant?


More information about the ffmpeg-devel mailing list