[MPlayer-dev-eng] [PATCH] More accurate af_volume

Zoltan Hidvegi mplayer at hzoli.2y.net
Sun Feb 20 23:17:33 CET 2005


Reimar Döffinger wrote:
> Hi,
> On Sun, Feb 20, 2005 at 09:21:34PM +0100, Reimar Döffinger wrote:
> > On Sun, Feb 20, 2005 at 01:55:16PM -0600, Zoltan Hidvegi wrote:
> > > Reimar Döffinger wrote:
> > > > Next, I don't understand why you need to clamp before scaling?
> > > 
> > > If you don't, the multiply will overflow on 32-bit.
> > 
> > As I understand the code, vol will be 65536 at most. As you assume that
> > int is at least 32 bits and the input is 16 bits I don't think it can overflow??
> 
> Um, sorry, now I see where I thought wrong... Will have to check, but I
> guess the old code could overflow, too?

Yes, but only at about 48dB, so in practice that was not a problem.

> I must say, I'm not too happy about the additional (also complexity)
> xmax and xmin calculations... Can't think of anything much better for
> the moment.

I've moved the calculations to the control code, and removed the
volume max calculation.  Also, nobody has complained so far about
allowing reentrant calls to af_volume, so I assume that's OK.  See the
attached patch.

Zoli
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: af_volume.patch
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050220/f96f0380/attachment.asc>


More information about the MPlayer-dev-eng mailing list