[FFmpeg-devel] [PATCH] avfilter/palettegen: export color quantization ratio

Nicolas George george at nsup.org
Wed Feb 25 15:43:23 CET 2015

Le septidi 7 ventôse, an CCXXIII, Clement Boesch a écrit :
> +    float ratio = (float)nb_out / nb_in;
> +    snprintf(buf, sizeof(buf), "%f", ratio);

I wonder if both values could be useful instead individually. If so, either
set the string to %d/%d or set two metadata keys.

If not, use double instead of float, float is very rarely useful. And in
this particular case it will be converted to double by the vararg call.

> +    av_log(ctx, AV_LOG_INFO, "%d%s colors generated out of %d colors; ratio=%f\n",
> +           s->nb_boxes, s->reserve_transparent ? "(+1)" : "", s->nb_refs,
> +           set_colorquant_ratio_meta(out, s->nb_boxes, s->nb_refs));

This is your code, but I must say that I find returning the double value as
a secondary effect of a function called set_something() not very readable.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150225/b1c4e3ac/attachment.asc>

More information about the ffmpeg-devel mailing list