summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemco Bloemen <Remco.Bloemen@gmail.com>2009-09-28 22:29:16 +0100
committerRemco Bloemen <Remco.Bloemen@gmail.com>2009-09-28 22:29:16 +0100
commit62a2bebae1e21a1c40e81d396d046af2db79eddb (patch)
tree2483444180f1308906e39ad78cf9049172984317
parent21f1b993013b54f3909d2fa497fd6a9a9e147190 (diff)
downloadxine-lib-62a2bebae1e21a1c40e81d396d046af2db79eddb.tar.gz
xine-lib-62a2bebae1e21a1c40e81d396d046af2db79eddb.tar.bz2
Incorrect int-to-float conversion in the JACK output plugin
Using bitmeter, I found that xine's jack output suffers from the problem mentioned at the bottom of bitmeter's home page. "Although JACK itself works entirely with IEEE floating point values the conversion to and from analog audio uses integers, as do popular audio storage technologies like DAT and Red Book CDs. For correct operation JACK software which uses such integers should use the same conversion ratios as JACK itself. e.g. 16-bit samples should be divided by exactly 32768. A common mistake is to choose the value 32767 instead. You can't hear this, or see it with ordinary meters, but the bitmeter shows a clear signature for audio processed in this way. The 8th bit of the mantissa (counting the rightmost as the 0th) is orange, indicating that an unusually high percentage of samples have this bit set." (from http://users.ecs.soton.ac.uk/njl98r/code/audio/bitmeter/ via Google cache)
-rw-r--r--ChangeLog1
-rw-r--r--src/audio_out/audio_jack_out.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ef1e5753d..84c51e994 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@ xine-lib (1.1.17) 2009-??-??
* Allow reading of non-block-sized chunks from audio CDs.
* Add a user agent & protocol hack ("qthttp://...") to allow direct
viewing of Apple film trailers.
+ * Fixed int-to-float conversion in the JACK output plugin.
xine-lib (1.1.16.3) 2009-04-03
* Security fixes:
diff --git a/src/audio_out/audio_jack_out.c b/src/audio_out/audio_jack_out.c
index 10c58c774..cd7da67cd 100644
--- a/src/audio_out/audio_jack_out.c
+++ b/src/audio_out/audio_jack_out.c
@@ -163,7 +163,7 @@ static int write_buffer_16 (jack_driver_t *this, unsigned char *data, int len)
for (i = 0; i < samples; i++) {
/* Read in 16bits, write out floats */
p_write = (float *) (&(this->buffer[write_pos]));
- *p_write = ((float) (p_read[i])) / 32767.0f;
+ *p_write = ((float) (p_read[i])) / 32768.0f;
write_pos = (write_pos + sizeof (float)) % BUFFSIZE;
}
this->write_pos = write_pos;