[FFmpeg-devel] [PATCH v2] avfilter/avf_aphasemeter: Add out-of-phase and mono detection
Moritz Barsnick
barsnick at gmx.net
Mon May 27 22:06:56 EEST 2019
On Mon, May 20, 2019 at 14:40:24 +0200, Romane Lafon wrote:
> + float tolerance = 1.0 - s->tolerance;
Strictly speaking 1.0f (or 1.f).
> + float angle = cos(s->angle/180.0*PI);
If you want a float as result, use cosf(s->angle / 180.f * M_PI). (I'm
aware PI and M_PI aren't explicitly marked as float, but you can't have
it all.)
> + if (!s->is_mono && ((tolerance - fphase) < FLT_EPSILON)) {
[...]
> + if (s->is_mono && ((tolerance - fphase) < FLT_EPSILON) && s->start_mono_presence) {
[...]
> + if (s->is_mono && ((tolerance - fphase) > FLT_EPSILON)) {
[...]
As tolerance and fphase are constant throughout this block of code, you
could do this floating point comparison once, and reuse the boolean
result.
BTW, I reckon the third of those comparisons should be ">=", to
properly complement the "<".
> + if (!s->is_out_phase && (angle - fphase) > FLT_EPSILON) {
[...]
> + if (s->is_out_phase && ((angle - fphase) > FLT_EPSILON) && s->start_out_phase_presence) {
[...]
> + if (s->is_out_phase && (angle - fphase) < FLT_EPSILON) {
[...]
Same here.
> + float tolerance = 1.0 - s->tolerance;
> + float angle = cos(s->angle/180.0*PI);
Same as above.
Cheers,
Moritz
More information about the ffmpeg-devel
mailing list