Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 06-20-2008, 09:33 AM   #1
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default 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-05-2009 at 12:51 AM.
Dstruct is offline   Reply With Quote
Old 06-21-2008, 01:48 PM   #2
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

Here the link to the file rendered with Reaper


FIXED

Last edited by Dstruct; 03-05-2009 at 12:52 AM.
Dstruct is offline   Reply With Quote
Old 07-06-2008, 08:08 AM   #3
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

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-05-2009 at 12:52 AM.
Dstruct is offline   Reply With Quote
Old 07-08-2008, 10:38 AM   #4
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

Justin,

VLC media player 0.8.6h also gives distorted output on Reaper's 24bit FLAC files, so it's not just Foobar2000.
Dstruct is offline   Reply With Quote
Old 08-05-2008, 02:36 PM   #5
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

Still heavy distortion in Foobar2000 v0.9.5.5!

FIXED

Last edited by Dstruct; 03-05-2009 at 12:52 AM.
Dstruct is offline   Reply With Quote
Old 10-16-2008, 08:24 AM   #6
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

Reaper 2.52 still creates these distorted 24bit FLAC files.

FIXED

Last edited by Dstruct; 03-05-2009 at 12:52 AM.
Dstruct is offline   Reply With Quote
Old 02-03-2009, 08:20 AM   #7
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

Same problem in Reaper 2.55 and 3.alpha1.

FIXED

Last edited by Dstruct; 03-05-2009 at 12:52 AM.
Dstruct is offline   Reply With Quote
Old 03-04-2009, 10:44 PM   #8
lossfound
Human being with feelings
 
lossfound's Avatar
 
Join Date: Jul 2006
Posts: 284
Default

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?
lossfound is offline   Reply With Quote
Old 03-04-2009, 10:54 PM   #9
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

Quote:
Originally Posted by lossfound View Post
is there a fix or at least some kinda theory forthcoming?
I hope so!

FIXED

Last edited by Dstruct; 03-05-2009 at 12:52 AM.
Dstruct is offline   Reply With Quote
Old 03-04-2009, 11:01 PM   #10
lossfound
Human being with feelings
 
lossfound's Avatar
 
Join Date: Jul 2006
Posts: 284
Default

Quote:
Originally Posted by Dstruct View Post
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 11:06 PM.
lossfound is offline   Reply With Quote
Old 03-04-2009, 11:06 PM   #11
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

Quote:
Originally Posted by lossfound View Post
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-05-2009 at 12:46 AM.
Dstruct is offline   Reply With Quote
Old 03-05-2009, 12:34 AM   #12
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,948
Default

ok try reaper_flac.dll from LoL, should hopefully fix all around...
Justin is offline   Reply With Quote
Old 03-05-2009, 12:43 AM   #13
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,340
Default

Quote:
Originally Posted by Justin View Post
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
Dstruct is offline   Reply With Quote
Old 03-05-2009, 05:14 AM   #14
lossfound
Human being with feelings
 
lossfound's Avatar
 
Join Date: Jul 2006
Posts: 284
Default

Looks like he fixed the Wavpack issue too.

Justin, you rawk. Thanks for fixing this.
lossfound is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.