IPB

Welcome Guest ( Log In | Register )

> foobar2000 Tech Support Forum Rules

Please read foobar2000 Tech Support Forum Rules before posting and comply with all the points.
Failure to provide all the information pointed out in the above document in your post is considered wasting other people's time and in extreme cases will lead to your topic getting locked without a reply.


See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
corrupted(?) 24-bit FLAC file not playable, split from: "FLAC support update" (57774) (TOS #5)
Dandruff
post Mar 4 2008, 08:55
Post #1





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



mmh, foobar2000 v0.9.5.1 doesn't playback 24 bit flac files properly here! foobar basically can read the file, but the output gets distorted!

Reaper for example plays it fine!


FIXED

This post has been edited by Dandruff: Mar 5 2009, 08:49
Go to the top of the page
+Quote Post
DotNoir
post Mar 4 2008, 09:48
Post #2





Group: Members (Donating)
Posts: 250
Joined: 10-April 03
From: Tampere, Finland
Member No.: 5911



QUOTE (Dandruff @ Mar 4 2008, 09:55) *
mmh, foobar2000 v0.9.5.1 doesn't playback 24 bit flac files properly here! foobar basically can read the file, but the output gets distorted!

here an example: http://www.outburst-audio.com/misc/24-bps.flac (1.2 MB)



Reaper for example plays it fine!


The FLAC file is corrupted, got this error with the FLACs own FLACTester (comes with the FLAC installer)
CODE
[1/1]    C:\Users\Antti\Downloads\24-bps.flac...FLAC__STREAM_DECODER_UNPARSEABLE_STREAM
1 files, 1 errors [1]


Also, Reaper can't play it here.


--------------------
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe
Go to the top of the page
+Quote Post
Dandruff
post Mar 4 2008, 10:09
Post #3





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



QUOTE (DotNoir @ Mar 4 2008, 09:48) *
The FLAC file is corrupted, got this error with the FLACs own FLACTester (comes with the FLAC installer)
CODE
[1/1]    C:\Users\Antti\Downloads\24-bps.flac...FLAC__STREAM_DECODER_UNPARSEABLE_STREAM
1 files, 1 errors [1]


ok, thanks - i'll forward this to the reaper developer. but with the updated dll posted below, reaper plays the file fine.


QUOTE (DotNoir @ Mar 4 2008, 09:48) *
Also, Reaper can't play it here.


it can (in the next version). here the updated dll for reaper 2.106: http://landoleet.org/reaper_flac.dll from http://www.cockos.com/forum/showthread.php?p=162266



so foobar should play 24 bps files properly? did you test it with a file?

This post has been edited by Dandruff: Mar 4 2008, 10:12
Go to the top of the page
+Quote Post
DotNoir
post Mar 4 2008, 11:31
Post #4





Group: Members (Donating)
Posts: 250
Joined: 10-April 03
From: Tampere, Finland
Member No.: 5911



Here's a 24bit flac I just made. works fine in fb2k.


--------------------
Two things are infinite: the universe and human stupidity; and I'm not sure about the universe
Go to the top of the page
+Quote Post
Dandruff
post Mar 4 2008, 12:13
Post #5





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



alright, thanks!
Go to the top of the page
+Quote Post
Dandruff
post Mar 4 2008, 22:29
Post #6





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



reaper developer has no clue why the encoded 24 bps files don't play properly in foobar2000. he said that the flac command line decoder is able to decode it. of course reaper (with the updated dll) itself also can decode it fine ...


http://www.cockos.com/forum/showpost.php?p...mp;postcount=33


strange thing blink.gif
Go to the top of the page
+Quote Post
Dandruff
post Mar 7 2008, 10:31
Post #7





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



QUOTE (Dandruff @ Mar 4 2008, 10:09) *
QUOTE (DotNoir @ Mar 4 2008, 09:48) *
Also, Reaper can't play it here.


it can (in the next version). here the updated dll for reaper 2.106: http://landoleet.org/reaper_flac.dll from http://www.cockos.com/forum/showthread.php?p=162266

Reaper 2.108 now got released with FLAC 1.2.1 encoding and decoding support. But foobar2000 still can't decode 24 bps files created with Reaper. Sound gets distorted heavily.

I've also started a thread about this problem at the FLAC SourceForge project page: http://sourceforge.net/tracker/index.php?f...amp;atid=213478


Any ideas?

This post has been edited by Dandruff: Mar 8 2008, 06:42
Go to the top of the page
+Quote Post
Egor
post Mar 7 2008, 11:59
Post #8





Group: Members
Posts: 826
Joined: 29-September 04
Member No.: 17374



Confirmed, foobar2000 0.9.5.1 cannot properly decode the sample - output is heavily distorted (verified with "Convert to... WAV" option to eliminate possible hardware problems).

Apparently, that's a bug in foobar2000. Winamp 5.52 can play the sample, and the reference FLAC CLI tools version 1.2.0 and 1.2.1 can decode it as well.
Go to the top of the page
+Quote Post
Dandruff
post Mar 8 2008, 06:43
Post #9





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



QUOTE (Egor @ Mar 7 2008, 11:59) *
Apparently, that's a bug in foobar2000.

Thanks! That's what the Reaper developer said to me too.


Any Foobar2000 developer reading here?

This post has been edited by Dandruff: Mar 8 2008, 06:44
Go to the top of the page
+Quote Post
Egor
post Mar 8 2008, 12:18
Post #10





Group: Members
Posts: 826
Joined: 29-September 04
Member No.: 17374



Since the topic got new title, I have to say that the sample is not corrupted, it is a valid 1.2.x flac file (at least, the latest reference flac tools say the file is OK).
I guess flac-tester had a problem with that 24-bit file because it is not 1.2.x-compatible. The new compression method was accidently added in the 1.2.1 flac encoder for 24-bit audio, so pre-1.2.0 decoders cannot decode such 24b samples (no backwards compatibility, unfortunately).
Go to the top of the page
+Quote Post
Dandruff
post Mar 10 2008, 19:52
Post #11





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



QUOTE (Egor @ Mar 8 2008, 12:18) *
Since the topic got new title, I have to say that the sample is not corrupted, it is a valid 1.2.x flac file (at least, the latest reference flac tools say the file is OK).

good to know, thanks! the reaper developer also didn't trust the flac-tester utility biggrin.gif

This post has been edited by Dandruff: Mar 10 2008, 20:00
Go to the top of the page
+Quote Post
Peter
post Apr 13 2008, 14:52
Post #12


foobar2000 developer


Group: Admin
Posts: 3280
Joined: 30-September 01
Member No.: 84



On this file, libFLAC returns 24-bit samples improperly padded to 32-bit, with most significant bits filled with garbage instead of correct sign expansion. I'd like to hear a reply from Josh about this before I implement a workaround which would have negative impact on everyone's decoding speeds, even on correct files.

This problem isn't 24-bit specific at all, the same issue could potentially occur with 16-bit files.
Go to the top of the page
+Quote Post
Dandruff
post Apr 21 2008, 23:25
Post #13





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



QUOTE (Dandruff @ Mar 4 2008, 08:55) *
foobar2000 v0.9.5.1 doesn't playback 24 bit flac files properly here! foobar basically can read the file, but the output gets distorted!

here an example: http://www.outburst-audio.com/misc/24-bps.flac (1.2 MB)



FIXED in version 0.9.5.2! Many thanks!
Go to the top of the page
+Quote Post
Peter
post Apr 27 2008, 19:12
Post #14


foobar2000 developer


Group: Admin
Posts: 3280
Joined: 30-September 01
Member No.: 84



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.

Edit: since the original file link no longer works, I uploaded a copy of the offending file.
Attached File(s)
Attached File  24_bps.flac ( 1.23MB ) Number of downloads: 269
 
Go to the top of the page
+Quote Post
Dandruff
post Apr 27 2008, 19:58
Post #15





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



Ok, thank you Peter! I've added your reply to the FLAC SourceForge Tracker: http://sourceforge.net/tracker/index.php?f...amp;atid=213478
Go to the top of the page
+Quote Post
Dandruff
post May 26 2008, 16:19
Post #16





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



QUOTE (Peter @ Apr 27 2008, 19:12) *
Looks like I accidentally left the fix active in 0.9.5.2 release.


0.9.5.3 still can play this "corrupted" file fine!
Go to the top of the page
+Quote Post
jcoalson
post May 30 2008, 07:25
Post #17


FLAC Developer


Group: Developer
Posts: 1526
Joined: 27-February 02
Member No.: 1408



looking at this now...
Go to the top of the page
+Quote Post
jcoalson
post May 30 2008, 07:52
Post #18


FLAC Developer


Group: Developer
Posts: 1526
Joined: 27-February 02
Member No.: 1408



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
Go to the top of the page
+Quote Post
Dandruff
post May 30 2008, 09:45
Post #19





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



QUOTE (jcoalson @ May 30 2008, 07:52) *
I'm pretty sure 24_bps.flac is corrupt, was it created with reaper?


Thanks for the reaply! Yes, it was created with Reaper.

I've forwarded your reply to http://www.cockos.com/forum/showpost.php?p...mp;postcount=44
Go to the top of the page
+Quote Post
Dandruff
post Mar 5 2009, 08:49
Post #20





Group: Members
Posts: 493
Joined: 20-April 04
Member No.: 13618



Ok, Cockos just fixed it for the next version: http://forum.cockos.com/showthread.php?p=291813
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 16th September 2014 - 02:33