[MPlayer-dev-eng] [PATCH] af_pan: hard clipping, and more than 100% of source channels

Corey Hickey bugfood-ml at fatooh.org
Sat Sep 3 22:04:36 CEST 2005


Guillaume POIRIER wrote:
> Also it's a waste to do both the if(x>1 || x<-1) and the clamp(),
> since they probably both do the float comparisons.
> It would be faster to do:
> 
> if (x>1.0) { clip++; out[j] = 1.0; } else if (x<-1.0) { clip++; out[j]
> = -1.0; } else out[j] = x;

Dang, It got distracted with the manpage and forgot to finish that part.
:>) What I meant to do was approximately:

-----------------------------------------------------------------------
if(x > 1.0) {
  af_msg(AF_MSG_VERBOSE,
        "[pan] Clipping out-of-range value from %f to 1.0\n", x);
  out[j] = 1.0;
}
else if(x < -1.0) {
  af_msg(AF_MSG_VERBOSE,
        "[pan] Clipping out-of-range value from %f to -1.0\n", x);
  out[j] = -1.0;
}
else out[j] = x;
-----------------------------------------------------------------------

That would avoid testing multiple times. With regard to calling AF_MSG
for every clipped sample I don't think that's a big deal since unless
the user is horribly abusing the filter with an excessive multiplier,
clipping will happen for only a few samples. I was going to try to back
that up with numbers, but I see that Reimar is against clipping within
pan anyway. So I'll drop that portion of the patch and if anyone really
wants internal clipping we can come to an agreement on the
implementation later.

I've attached a new patch. Changes from previous:
- no clipping
- changed man to indicate how to use ",volume" for clipping
- put a note in changelog


-Corey
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pan-increase-noclip.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050903/97617c89/attachment.txt>


More information about the MPlayer-dev-eng mailing list