[FFmpeg-devel] [PATCH v2] avfilter/avf_aphasemeter: Add out-of-phase and mono detection

Romane Lafon romane at nomalab.com
Mon Jun 17 16:00:48 EEST 2019


Hello,
Thank you for your feedback.
I made a third version of my patch.
Regards,
Romane

Le lun. 27 mai 2019 à 21:07, Moritz Barsnick <barsnick at gmx.net> a écrit :

> 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
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list