Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#169 closed defect (fixed)

IFF 8SVX stereo files (with FIB/EXP compression) decodes incorrectly

Reported by: ami_stuff Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: 8svx roundup
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Issue 1589 (& Issue 1427)

Attached files decodes incorrectly.

Please see

https://roundup.libav.org/issue1427

for more info as well.

Author: ami_stuff 	Date: 2009-12-05.02:37:04 

>> What about 8SVX_FIB/EXP 2 channel files? This looks like it is just
>> correct for 8bit PCM.

> The "spec" and sketchy documentation available do not say anything about 
> stereo 8svx compressed sampling. My assumption is that such samples are not 
> defined. Same goes for 16bit stereo samples. IIRC we only have one compressed 
> sample available and that is mono.
> More importantly, stereo samples are present in a number of anim files, which 
> are again uncompressed.
> I'll be happy to add functionality as and when samples surface.

Here are compressed IFF 8SVX stereo files. These files don't sound "clean" and
of course too fast - issue1427.

There is also availabe sourcecode of decoder and encoder:

http://aminet.net/package/mus/misc/wavepak	

C:\>ffmpeg -i 8svx_exp.iff
FFmpeg version SVN-r20726, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  built on Dec  4 2009 06:03:38 with gcc 4.2.4
  configuration: --enable-memalign-hack --prefix=/mingw --cross-prefix=i686-ming
w32- --cc=ccache-i686-mingw32-gcc --target-os=mingw32 --arch=i686 --cpu=i686 --e
nable-avisynth --enable-gpl --enable-version3 --enable-zlib --enable-bzlib --ena
ble-libgsm --enable-libfaad --enable-pthreads --enable-libvorbis --enable-libthe
ora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid
--enable-libschroedinger --enable-libx264 --enable-libopencore_amrwb --enable-li
bopencore_amrnb
  libavutil     50. 5. 1 / 50. 5. 1
  libavcodec    52.42. 0 / 52.42. 0
  libavformat   52.40. 0 / 52.40. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 2 /  0. 7. 2
[IFF @ 0x3eced0]Estimating duration from bitrate, this may be inaccurate
Input #0, IFF, from '8svx_exp.iff':
  Duration: 00:00:02.53, start: 0.000000, bitrate: 705 kb/s
    Stream #0.0: Audio: 8svx_exp, 44100 Hz, 2 channels, s16, 705 kb/s
At least one output file must be specified


C:\>ffmpeg -i 8svx_fib.iff
FFmpeg version SVN-r20726, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  built on Dec  4 2009 06:03:38 with gcc 4.2.4
  configuration: --enable-memalign-hack --prefix=/mingw --cross-prefix=i686-ming
w32- --cc=ccache-i686-mingw32-gcc --target-os=mingw32 --arch=i686 --cpu=i686 --e
nable-avisynth --enable-gpl --enable-version3 --enable-zlib --enable-bzlib --ena
ble-libgsm --enable-libfaad --enable-pthreads --enable-libvorbis --enable-libthe
ora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid
--enable-libschroedinger --enable-libx264 --enable-libopencore_amrwb --enable-li
bopencore_amrnb
  libavutil     50. 5. 1 / 50. 5. 1
  libavcodec    52.42. 0 / 52.42. 0
  libavformat   52.40. 0 / 52.40. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 2 /  0. 7. 2
[IFF @ 0x3ecee0]Estimating duration from bitrate, this may be inaccurate
Input #0, IFF, from '8svx_fib.iff':
  Duration: 00:00:02.53, start: 0.000000, bitrate: 705 kb/s
    Stream #0.0: Audio: 8svx_fib, 44100 Hz, 2 channels, s16, 705 kb/s
At least one output file must be specified
Author: BastyCDGS 	Date: 2010-05-05.18:58:18 	

I've done an analysis of this and found out that the decoder trys to interleave
stereo samples to packet buffer and not to the whole length of BODY chunk.

Fix will be pretty straight forward, I think...but I'm busy right now with
IFF-ILBM and IFF-ANIM, so please be patient.

Attachments (2)

8svx_exp.iff (218.5 KB) - added by ami_stuff 6 years ago.
8svx_fib.iff (218.5 KB) - added by ami_stuff 6 years ago.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by ami_stuff

Changed 6 years ago by ami_stuff

comment:1 Changed 6 years ago by saste

  • Analyzed by developer set
  • Component changed from undetermined to avformat
  • Reproduced by developer set
  • Status changed from new to open
  • Version changed from unspecified to git-master

Hi,

I confirm the analysis of Basty, IFF demuxer assumes a fixed packet size of 1024 for audio, which works fine for mono, but not for stereo audio, from what I can read from the xine sources (xine-lib/src/demuxers/demux_iff.c), which decodes the files fine, all left samples are stored at the beginning, right samples at the end of the file. I'll try to come with a solution soon.

BTW can you provide more stereo (compressed and uncompressed) samples?

Last edited 6 years ago by saste (previous) (diff)

comment:2 Changed 6 years ago by ami_stuff

Thanks for working on the fix.

Sorry, I have no more samples for test. IFF 8SVX stereo files are rare and I have only these files which I create myself with sox and wavepak. I think the best will be to apply the patch which fixes playback of the samples from issue 1427 and 1589 and in case I find any bugs with some random generated samples with amiga programs then I will create a bugreport.

BTW. seeking support would be great too, currently FFplay can't seek even uncompressed mono samples.

comment:3 Changed 6 years ago by saste

  • Resolution set to fixed
  • Status changed from open to closed

Fixed in commit:

commit e280a4da2ae6fd44f0079358ecc5aa08e388a5ed
Author: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Date: Sun May 15 13:24:46 2011 +0200

iff/8svx: redesign 8SVX demuxing and decoding for handling stereo samples correctly


Make the iff demuxer send the whole audio chunk to the decoder as a
single packet, move stereo interleaving from the iff demuxer to the
decoder, and introduce an 8svx_raw decoder which performs
stereo interleaving.


This is required for handling stereo data correctly, indeed samples
are stored like:
LLLLLL....RRRRRR


that is all left samples are at the beginning of the chunk, all right
samples at the end, so it is necessary to store and process the whole
buffer in order to decode each frame. Thus the decoder needs all the
audio chunk before it can return interleaved data.


Fix decoding of files 8svx_exp.iff and 8svx_fib.iff, fix trac issue #169.

comment:4 Changed 5 years ago by cehoyos

  • Keywords 8svx added

comment:5 Changed 4 years ago by cehoyos

  • Keywords roundup added
Note: See TracTickets for help on using tickets.