Author Topic: Bug: incorrect channel layout when decoding 7-channel FLAC  (Read 656 times)

Posoleposo

  • Posts: 3
XMPLay 3.8.5, FLAC decoder revision 12.
When decoding 7-channel FLAC file with no WAVEFORMATEXTENSIBLE_CHANNEL_MASK, XMPlay outputs channel layout FL,FR,FC,LFE,BL,BR,BC. But, according to FLAC specification, it should be FL,FR,FC,LFE,BC,SL,SR - https://xiph.org/flac/format.html#frame_header
Quote
7 channels: front left, front right, front center, LFE, back center, side left, side right

Incorrect channel layout also leads to invalid downmixing.

Sample 7-channel FLAC file - https://www.dropbox.com/s/dihi4sk1b2lihkv/42%20-%207%20channels%20%286.1%29.flac?dl=1
« Last Edit: 11 Sep '22 - 15:14 by Posoleposo »

Ian @ un4seen

  • Administrator
  • Posts: 24738
There does indeed appear to be a problem with that. Here's an updated FLAC plugin for you to try:

   www.un4seen.com/stuff/xmp-flac.dll

Let me know if you still have the problem with it.

Posoleposo

  • Posts: 3
Thanks.
Now there is no problem with downmixing.
But when converted to wav using "Write to disk", resulting wav file still has channel mask FL,FR,FC,LFE,BL,BR,BC, not FL,FR,FC,LFE,BC,SL,SR.
Now i understood: original problem was not channel mask itself, but actual channels order in signal not corresponding to channel mask. Actual channels order in decoded signal was correct  for 7-channel FLAC (FL,FR,FC,LFE,BC,SL,SR), but output channel mask was FL,FR,FC,LFE,BL,BR,BC. Now you have changed cahnnels order to correspond to channel mask. But to be 100% correct, it was needed to change channel mask, not channel oder. Because FLAC specification clearly prescribes to use side channels for 7-channel signal, not back.

BTW, reference FLAC 1.4.0 was released recently.

Ian @ un4seen

  • Administrator
  • Posts: 24738
Oh yes, that'll need an XMPlay update then. Here's one for you to try:

   www.un4seen.com/stuff/xmplay.exe

Try that with the release FLAC plugin version and see if there's still a problem.

Regarding FLAC 1.4.0, it removed the assembler/intrinsic decoder optimizations and decoding is quite a bit slower now in my tests. FLAC decoding was always very fast, so it's still quite fast now, but I'll see if those optimizations can be reintroduced before a new XMPlay FLAC plugin is released.

Posoleposo

  • Posts: 3
www.un4seen.com/stuff/xmplay.exe

Try that with the release FLAC plugin version and see if there's still a problem.

I tested this xmplay.exe with FLAC decoder revision 12 and everything seems correct now.

Ian @ un4seen

  • Administrator
  • Posts: 24738
Great! The change will be kept in the next XMPlay release.