[FFmpeg-devel] [PATCH] tests: drop bc dependency

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Jan 20 21:58:33 CET 2015


On Mon, Jan 19, 2015 at 10:58:02PM +0100, Clément Bœsch wrote:
> -    echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
> +    awk "BEGIN { v=$1-$2; printf \"%d\\n\", ((v<0?v:-v) > $3) ? 1 : 0 }"

I'd suggest single quotes for the outer ones, then you do not need to
escape \ and ".
Also it's broken, you inverted the absolute value condition.
Lastly, at least with gawk the last ?: is pointless, conditions evaluate
to 1/0 like in C.


More information about the ffmpeg-devel mailing list