 |
|
|
06-20-2008, 09:33 AM
|
#1
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
24 bit FLAC render creates "corrupted" files (FIXED)
Ok, making a new thread for this.
Coming from http://www.cockos.com/forum/showpost...2&postcount=44
Quote:
|
Originally Posted by Peter (Foobar2000 developer)
Looks like I accidentally left the fix active in 0.9.5.2 release. I still don't believe that this is a legit behavior of FLAC tools and anybody else converting FLAC decoder's output to floating-point values will run into the same problem.
I hope Josh is looking into this.
|
http://www.hydrogenaudio.org/forums/...dpost&p=561926
Looks like Reaper doesn't encode correctly to 24 bit FLAC:
Quote:
|
Originally Posted by jcoalson (FLAC developer)
ok, short story, I'm pretty sure 24_bps.flac is corrupt, was it created with reaper? I would like to see the code it is using to call libFLAC because I'll bet it's not passing in properly sign-extended data to FLAC__stream_encoder_process().
the giveaway is that if you decode it to wav with flac.exe and re-encode it with flac.exe, this .flac file is ~20% smaller than 24_bps.flac. and it all happens to work because of 1) the magic of 2's-complement arithmetic; 2) flac.exe does the same 'fix' that foobar is now doing. these 2 things together magically cancel out the initial encoding error.
long story:
in this clip, sample 0 of channel 0 is 0 and sample 1 of channel 0 is -364 (0xfffe94 in the wav file). the first FLAC subframe of channel 0 is a FIXED subframe with order 1, meaning the first sample (0) is stored raw and the second sample (-364) is stored as a residual value "sample[1]-sample[0]" == -364 - 0 == -364
but that is not what is actually in 24_bps.flac, the first residual sample it has encoded is 16776852 (0xfffe94), which is exactly what I would expect if the client passed in bad data (explained next), and also explains why the compression ratio is bad (because 16776852 takes more bits to store than -364)
when samples are passed in to FLAC__stream_encoder_process(), they must be 32-bit signed ints regardless of the sample resolution. so to pass in -364, the sample value should be 0xfffffe94, but if the client is not sign-extending properly, it will pass in 0xfffe94 and due to the above mentioned magic, it will all appear to work (magic extends even to the md5 summing).
now this could have been avoided if libFLAC did range checking on the input but this noticeably slows things down, which I am hesitant to do for something that should be caught in testing. (maybe it could be done in debug builds.)
Josh
|
http://www.hydrogenaudio.org/forums/...dpost&p=568080
FIXED
Last edited by Dstruct; 03-04-2009 at 11:51 PM.
|
|
|
06-21-2008, 01:48 PM
|
#2
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Here the link to the file rendered with Reaper
FIXED
Last edited by Dstruct; 03-04-2009 at 11:52 PM.
|
|
|
07-06-2008, 08:08 AM
|
#3
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Justin,
can you have a look at this again? Because in Foobar2000 v0.9.5.4, the dirty hack got removed. So Reaper's 24bit FLAC files now play totally distorted in Foobar2000 again (as in version 0.9.5.1)!
FIXED
Last edited by Dstruct; 03-04-2009 at 11:52 PM.
|
|
|
07-08-2008, 10:38 AM
|
#4
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Justin,
VLC media player 0.8.6h also gives distorted output on Reaper's 24bit FLAC files, so it's not just Foobar2000.
|
|
|
08-05-2008, 02:36 PM
|
#5
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Still heavy distortion in Foobar2000 v0.9.5.5!
FIXED
Last edited by Dstruct; 03-04-2009 at 11:52 PM.
|
|
|
10-16-2008, 08:24 AM
|
#6
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Reaper 2.52 still creates these distorted 24bit FLAC files.
FIXED
Last edited by Dstruct; 03-04-2009 at 11:52 PM.
|
|
|
02-03-2009, 07:20 AM
|
#7
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Same problem in Reaper 2.55 and 3.alpha1.
FIXED
Last edited by Dstruct; 03-04-2009 at 11:52 PM.
|
|
|
03-04-2009, 09:44 PM
|
#8
|
|
Mortal
Join Date: Jul 2006
Posts: 249
|
I can also confirm that FLAC 24 bit files are corrupted and horrifically distorted coming out of 2.56. Gee, I'd really like to be able to use REAPER and Autorender to directly export track-split, fully tagged 24/96 FLAC LP rips. Looks like this has been at issue for awhile... is there a fix or at least some kinda theory forthcoming?
|
|
|
03-04-2009, 09:54 PM
|
#9
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Quote:
Originally Posted by lossfound
is there a fix or at least some kinda theory forthcoming?
|
I hope so!
FIXED
Last edited by Dstruct; 03-04-2009 at 11:52 PM.
|
|
|
03-04-2009, 10:01 PM
|
#10
|
|
Mortal
Join Date: Jul 2006
Posts: 249
|
Quote:
Originally Posted by Dstruct
I hope so! 
|
Heh, well, at least you now have someone else who is upset about it
eta: Oh yeah, the resulting corrupted 24-bit FLAC files are basically the same size as the 24/96 .wavs generating them, while correctly generated FLAC files from the same source are of course about 50-55% of the .wav size. Maybe this could serve as some kind of hint.
ALSO eta: 16-bit FLAC files come out of REAPER just great. It's only 24-bit that is at issue.
Last edited by lossfound; 03-04-2009 at 10:06 PM.
|
|
|
03-04-2009, 10:06 PM
|
#11
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Quote:
Originally Posted by lossfound
eta: Oh yeah, the resulting corrupted 24-bit FLAC files are basically the same size as the 24/96 .wavs generating them
|
Oh really? Didn't noticed that. Should be a very helpful hint I guess!
FIXED
Last edited by Dstruct; 03-04-2009 at 11:46 PM.
|
|
|
03-04-2009, 11:34 PM
|
#12
|
|
Administrator
Join Date: Jan 2005
Location: san francisco
Posts: 5,998
|
ok try reaper_flac.dll from LoL, should hopefully fix all around...
|
|
|
03-04-2009, 11:43 PM
|
#13
|
|
Mortal
Join Date: Jul 2006
Posts: 8,737
|
Quote:
Originally Posted by Justin
ok try reaper_flac.dll from LoL, should hopefully fix all around...
|
It does! Another bug gone
Btw: There's still an open issue with WavPack if you have some time -> http://forum.cockos.com/showthread.php?t=31373
|
|
|
03-05-2009, 04:14 AM
|
#14
|
|
Mortal
Join Date: Jul 2006
Posts: 249
|
Looks like he fixed the Wavpack issue too.
Justin, you rawk. Thanks for fixing this.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 10:36 AM.
|