[FFmpeg-devel] [PATCH] avfilter: add wpsnr video filter

Tomas Härdin tjoppen at acc.umu.se
Sat Oct 30 11:57:25 EEST 2021


fre 2021-10-29 klockan 21:17 -0400 skrev Ronald S. Bultje:
> Hi Thomas,
> 
> On Fri, Oct 29, 2021 at 9:12 AM Tomas Härdin <tjoppen at acc.umu.se>
> wrote:
> 
> > tor 2021-10-28 klockan 21:09 +0200 skrev Paul B Mahol:
> > > +    const uint16_t *src = (const uint16_t *)ssrc;
> > 
> > This is not -fstrict-aliasing safe
> > 
> 
> I don't believe that is correct. It's true we're not allowed to cast
> between two clashing types to access the same pointer (memory
> location),
> but the C standard would appear to make an exception for byte types.
> 
> Quoted from https://stackoverflow.com/a/99010/4726410 because I'm too
> lazy
> to dig through the standard:
> 
> "The types that C 2011 6.5 7 allows an lvalue to access are:
> - a type compatible with the effective type of the object,
> - a qualified version of a type compatible with the effective type of
> the
> object,
> - a type that is the signed or unsigned type corresponding to the
> effective
> type of the object,
> - a type that is the signed or unsigned type corresponding to a
> qualified
> version of the effective type of the object,
> - an aggregate or union type that includes one of the aforementioned
> types
> among its members (including, recursively, a member of a subaggregate
> or
> contained union), or
> - a character type."
> 
> uint8_t is a variant of the character (aka byte) type, and so the
> cast
> would not seem to violate strict aliasing rules.

Maybe we should upgrade to C11 then? This gives us access to more
useful language features. Type-generic expressions look very useful

/Tomas



More information about the ffmpeg-devel mailing list