NetBSD Problem Report #25521
Received: (qmail 3155 invoked by uid 605); 10 May 2004 10:53:03 -0000
Message-Id: <m1BN8P0-00AaW6C@hera.dachau.marco.de>
Date: Mon, 10 May 2004 12:52:54 +0200 (CEST)
From: Matthias Pfaller <leo@dachau.marco.de>
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: leo@dachau.marco.de (Matthias Pfaller)
To: gnats-bugs@gnats.NetBSD.org
Subject: pkgsrc/audio/normalize applies wrong volume adjustments
>Number: 25521
>Category: pkg
>Synopsis: pkgsrc/audio/normalize applies wrong volume adjustments
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 10 10:54:00 +0000 2004
>Closed-Date: Mon Dec 27 21:39:32 +0000 2004
>Last-Modified: Mon Dec 27 21:39:32 +0000 2004
>Originator: Matthias Pfaller
>Release: NetBSD 1.6ZK
>Organization:
Matthias Pfaller Software Entwicklung
marco Systemanalyse und Entwicklung GmbH Tel +49 8131 5161-41
Hans-B=F6ckler-Str. 2, D 85221 Dachau Fax +49 8131 5161-66
http://www.marco.de/ Email leo@dachau.marco.de
>Environment:
<The following information is extracted from your kernel. Please>
<append output of "ldd", "ident" where relevant (multiple lines).>
System: NetBSD joghurt 1.6ZK NetBSD 1.6ZK (SIN) #1: Sat Mar 27 16:17:47 CET=
2004 leo@sin:/usr/src/sys/arch/i386/compile/SIN i386
Architecture: i386
Machine: i386
>Description:
When trying to normalize a bunch of mp3-files, normalize will
(sometimes) apply volumeadjustments of about ~-300db...
>How-To-Repeat:
Use normalize on a couple of mp3 files.
>Fix:
One part of the structure (maxpow) isn't initialized. Initialize it to 0.
While we are at it, compute the 100 element sum only once and from there on
only subtract to be deleted elements and add new elements.
--- mpegvolume.c 2002-08-26 08:32:26.000000000 +0200
+++ /tmp/mpegvolume.c 2004-05-10 12:41:34.000000000 +0200
@@ -77,6 +77,7 @@
int buflen; /* elements allocated to buffer */
int start; /* index of first element in buffer */
int n; /* num of elements in buffer */
+ long long sum;
} datasmooth_t;
=20
struct decode_struct {
@@ -136,14 +137,18 @@
ds->sums[c] =3D 0;
end =3D ((ds->powsmooth[c].start + ds->powsmooth[c].n)
% ds->powsmooth[c].buflen);
- ds->powsmooth[c].buf[end] =3D pow;
if (ds->powsmooth[c].n =3D=3D ds->powsmooth[c].buflen) {
ds->powsmooth[c].start =3D ((ds->powsmooth[c].start + 1)
% ds->powsmooth[c].buflen);
- pow =3D get_smoothed_data(&ds->powsmooth[c]);
+ ds->powsmooth[c].sum -=3D ds->powsmooth[c].buf[end];
+ ds->powsmooth[c].sum +=3D ds->powsmooth[c].buf[end] =3D pow;
+ pow =3D ds->powsmooth[c].sum;
+// pow =3D get_smoothed_data(&ds->powsmooth[c]);
if (pow > ds->maxpow)
ds->maxpow =3D pow;
} else {
+ ds->powsmooth[c].buf[end] =3D pow;
+ ds->powsmooth[c].sum +=3D pow;
ds->powsmooth[c].n++;
}
}
@@ -312,12 +317,14 @@
*/
ds->si->bits_per_sample =3D 16;
ds->sums[0] =3D ds->sums[1] =3D 0;
+ ds->maxpow =3D 0;
=20
/* set up smoothing window buffer */
for (c =3D 0; c < 2; c++) {
ds->powsmooth[c].buflen =3D 100; /* use a 100-element (1 second) win=
dow */
ds->powsmooth[c].buf =3D (double *)xmalloc(ds->powsmooth[c].buflen *=
sizeof(double));
ds->powsmooth[c].start =3D ds->powsmooth[c].n =3D 0;
+ ds->powsmooth[c].sum =3D 0;
}
}
=20
>Release-Note:
>Audit-Trail:
From: Matthias Pfaller <leo@dachau.marco.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/25521
Date: Mon, 10 May 2004 14:12:07 +0200 (CEST)
The part of the patch, that tries to speedup the avaraging seems to do
the wrong thing. Please use that patch instead (which only fixes the original
problem):
--- mpegvolume.c.orig 2002-08-26 08:32:26.000000000 +0200
+++ mpegvolume.c 2004-05-10 14:04:56.000000000 +0200
@@ -312,6 +312,7 @@
*/
ds->si->bits_per_sample = 16;
ds->sums[0] = ds->sums[1] = 0;
+ ds->maxpow = 0;
/* set up smoothing window buffer */
for (c = 0; c < 2; c++) {
Matthias
From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: PR/25521 CVS commit: pkgsrc/audio/normalize
Date: Mon, 27 Dec 2004 21:38:06 +0000 (UTC)
Module Name: pkgsrc
Committed By: wiz
Date: Mon Dec 27 21:38:06 UTC 2004
Modified Files:
pkgsrc/audio/normalize: Makefile distinfo
Added Files:
pkgsrc/audio/normalize/patches: patch-aa
Log Message:
Update to 0.7.6nb5: apply bugfix from Matthias Pfaller in PR 25521.
To generate a diff of this commit:
cvs rdiff -r1.13 -r1.14 pkgsrc/audio/normalize/Makefile
cvs rdiff -r1.3 -r1.4 pkgsrc/audio/normalize/distinfo
cvs rdiff -r0 -r1.4 pkgsrc/audio/normalize/patches/patch-aa
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: wiz@netbsd.org
State-Changed-When: Mon, 27 Dec 2004 21:39:32 +0000
State-Changed-Why:
Committed the second patch.
Please feed it back to the program's author, thank you.
>Unformatted:
<Please check that the above is correct for the bug being reported,>
<and append source date of snapshot, if applicable (one line).>
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.