[FFmpeg-devel] [PATCH 1/2] lavfi: check links properties after configuring them.
u at pkh.me
Thu Nov 2 00:12:31 EET 2017
On Wed, Nov 01, 2017 at 11:01:22PM +0100, Nicolas George wrote:
> Le primidi 11 brumaire, an CCXXVI, Clement Boesch a écrit :
> > nb_filters and nb_outputs are signed so the counters better be the same
> > type.
> I re-checked, I think you are mistaken.
My bad, you're right, I was looking at the wrong header with the same
variable names. Dismiss my comment.
> > I think we already had that discussion but I'd rather have the counters
> > signed so the compiler can exploit the undefined property of signed
> > overflow to assume it will never happen.
> On the other hand, it forces it to make code that can handle negative as
> well, even though the value are positive. I really think it is better to
> inform the compiler of the intent, and the intent is that the numbers
> are positive, i.e. unsigned.
I'd say that a counter is unlikely to require a sign vs unsigned
optimization (and if it does and we know the counter is positive only, we
can explicit it with bit shifts etc). OTOH, the compiler will always have
to assume an overflow can happen if the initial counter value comes from
another variable, and you can't do much to hint it about it. Assuming a
loop overflow has IMO much more impact of what the compiler can do in the
general logic of the loop. But that's pure speculation from me.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 488 bytes
Desc: not available
More information about the ffmpeg-devel