question about lame's implementation of fast hartley transform

christian fafard <[email protected]> Fri, 14 Jun 2019 01:40:26 +0000
Newsgroups gmane.comp.audio.mp3.lame
Message-ID <BN6PR16MB1603345F870A3A503FE74A27CDEE0@BN6PR16MB1603.namprd16.prod.outlook.com>
Does anyone have an idea why lame's implementation of fht in fhc.c does not produce the same result as fftw3's hartley transform?

I replace the fht function with this one just to experiment a bit.

static void
fht(FLOAT * fz, int n)
{
  fftwf_plan p;
/*  n <<= 1; */

  p = fftwf_plan_r2r_1d(n, fz, fz, FFTW_DHT, FFTW_MEASURE);
  fftwf_execute(p);
  fftwf_destroy_plan(p);
}



but the result is very different, here's an exemple,
this is first float values seen through gdb.

Input data:
1: *fz@512 = {-0.643088341, 0.643088341, 0.643088341, -0.643088341, -0.437932163,
  0.437932163, 0.437932163, -0.437932163, -0.812352598, 0.812352598, 0.812352598,
  .
  .
  .

Original output:
1: *fz@512 = {-4.0118103, -3.62610149, 11.2137547, 12.436553, -8.06216335,
  -8.11365509, 4.39034939, 4.50206757, 2.0145545, -4.32877064, -7.13062429,
  .
  .
  .

Output with fftw3's implementation:
1: *fz@512 = {0, -0.111493349, 0.147750854, 0.222122014, -0.720430374, 0.591150761,
  -1.44490266, 0.107935905, -0.477344513, -0.294681787, -1.35580921, -1.11171722,
  .
  .
  .

thanks
Christian