[Ffmpeg-devel] Help needed with MPC decoder

Benjamin Larsson banan
Fri Dec 15 17:48:38 CET 2006


Kostya Shishkov skrev:
> Here is my attempt to write MPC SV7 decoder.
> I believe that parsing is OK while signal reconstruction is not. It
> should be quite similar to MPEG Audio Layer 1 and 2 reconstuction -
> 1152 samples per frame, 32 subbands with 36 samples in each subband.
> Please help to make it work. And as for the structure - it is just
> development version and it will be cleaned, formatted and maybe
> redesigned before final version.
> ------------------------------------------------------------------------
> +
> +/**
> + * @file mpc.c Musepack decoder
> + * A mdct based codec with frames of 1152 samples
>   
This is wrong, a Polyphase Quadrature Filter (PQF) is used.
> + * divided into 32 bands.
> + */
>   

And I tried the decoder and it crashed, bt follows and sample is from mphq:

(gdb) run -v 9 -i 01\ -\ Right\ Here\,\ Right\ Now.mpc test.wav
Starting program: /home/banan/ffmpeg/ffmpeg_g -v 9 -i 01\ -\ Right\ 
Here\,\ Right\ Now.mpc test.wav
FFmpeg version SVN-r7284, Copyright (c) 2000-2006 Fabrice Bellard, et al.
  configuration: 
  libavutil version: 49.1.0
  libavcodec version: 51.26.0
  libavformat version: 51.6.0
  built on Dec 15 2006 16:51:15, gcc: 4.1.2 20060928 (prerelease) 
(Ubuntu 4.1.1-13ubuntu5)
Input #0, mpc, from '01 - Right Here, Right Now.mpc':
  Duration: N/A, bitrate: N/A
  Stream #0.0, 32/1225: Audio: mpc7, 44100 Hz, stereo
File 'test.wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'test.wav':
  Stream #0.0, 1/90000: Audio: pcm_s16le, 44100 Hz, stereo, 1411 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Bits: 5FD00000 0 1 2
IS: 0, MSS: 1, TG: 1, LFL: 168, bands: 31
Initing VLC
Press [q] to stop encoding
Bits avail: 128, used 98
Bits avail: 96, used 92
Bits avail: 128, used 118
Bits avail: 128, used 112
Bits avail: 128, used 106
Bits avail: 128, used 100
Bits avail: 96, used 94
Bits avail: 128, used 120
Bits avail: 128, used 114
Bits avail: 128, used 108
Bits avail: 128, used 102
Bits avail: 96, used 96
Bits avail: 96, used 90
Bits avail: 128, used 116

Program received signal SIGSEGV, Segmentation fault.
0x081d47d7 in ff_mpa_synth_filter (synth_buf_ptr=0x8555c40, 
synth_buf_offset=0x8556c40, window=0x852ebc0,
    dither_state=0xbfc30818, samples=0xb7d21488, incr=2, 
sb_samples=0x85570d0) at mpegaudiodec.c:876
876             synth_buf[j] = v;

(gdb) bt
#0  0x081d47d7 in ff_mpa_synth_filter (synth_buf_ptr=0x8555c40, 
synth_buf_offset=0x8556c40, window=0x852ebc0,
    dither_state=0xbfc30818, samples=0xb7d21488, incr=2, 
sb_samples=0x85570d0) at mpegaudiodec.c:876
#1  0x08395bab in mpc7_decode_frame (avctx=0x85490d0, data=0xb7d21008, 
data_size=0xbfc30cf8, buf=0x8568240 "(",
    buf_size=2308) at mpc.c:335
#2  0x080bd6f1 in avcodec_decode_audio (avctx=0x85490d0, 
samples=0xb7d21008, frame_size_ptr=0xbfc30cf8, buf=0x8568240 "(",
    buf_size=2308) at utils.c:928
#3  0x0805d9d5 in output_packet (ist=0x8552950, ist_index=0, 
ost_table=0x85529d0, nb_ostreams=1, pkt=0xbfc30f00)
    at ffmpeg.c:1071
#4  0x0805fbd5 in main (argc=-559358615, argv=0x122ddd8d) at ffmpeg.c:1936
(gdb)   disass $pc-32 $pc+32
Dump of assembler code from 0x81d47b7 to 0x81d47f7:
0x081d47b7 <ff_mpa_synth_filter+4295>:  mov    0x250(%esp),%eax
0x081d47be <ff_mpa_synth_filter+4302>:  mov    (%edi),%edi
0x081d47c0 <ff_mpa_synth_filter+4304>:  lea    (%eax,%edi,4),%eax
0x081d47c3 <ff_mpa_synth_filter+4307>:  mov    %edi,0xb0(%esp)
0x081d47ca <ff_mpa_synth_filter+4314>:  mov    %eax,%ebp
0x081d47cc <ff_mpa_synth_filter+4316>:  mov    %eax,0xac(%esp)
0x081d47d3 <ff_mpa_synth_filter+4323>:  mov    0xfffffffc(%ecx,%edx,4),%eax
0x081d47d7 <ff_mpa_synth_filter+4327>:  mov    %eax,0xfffffffc(%ebp,%edx,4)
0x081d47db <ff_mpa_synth_filter+4331>:  add    $0x1,%edx
0x081d47de <ff_mpa_synth_filter+4334>:  cmp    $0x21,%edx
0x081d47e1 <ff_mpa_synth_filter+4337>:  jne    0x81d47d3 
<ff_mpa_synth_filter+4323>
0x081d47e3 <ff_mpa_synth_filter+4339>:  mov    %ebp,%eax
0x081d47e5 <ff_mpa_synth_filter+4341>:  add    $0x800,%eax
0x081d47ea <ff_mpa_synth_filter+4346>:  mov    %ebp,0x4(%esp)
0x081d47ee <ff_mpa_synth_filter+4350>:  movl   $0x80,0x8(%esp)
0x081d47f6 <ff_mpa_synth_filter+4358>:  mov    %eax,(%esp)
End of assembler dump.
(gdb)   info all-registers
eax            0xdea8dd69       -559358615
ecx            0xbfc2dc78       -1077748616
edx            0x1      1
ebx            0xfd13eb80       -49026176
esp            0xbfc2dac0       0xbfc2dac0
ebp            0x9caf9c8        0x9caf9c8
esi            0x874f8bd        141883581
edi            0x5d6762 6121314
eip            0x81d47d7        0x81d47d7 <ff_mpa_synth_filter+4327>
eflags         0x210217 [ CF PF AF IF RF ID ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51
st0            0        (raw 0x00000000000000000000)
st1            0        (raw 0x00000000000000000000)
st2            0        (raw 0x00000000000000000000)
st3            44100    (raw 0x400eac44000000000000)
st4            1.000000000000000015902891109759918e+100 (raw 
0x414b924d692ca61be800)
st5            0        (raw 0x00000000000000000000)
st6            0        (raw 0x00000000000000000000)
st7            0        (raw 0x00000000000000000000)
fctrl          0x37f    895
fstat          0x21     33
ftag           0xffff   65535
fiseg          0x73     115
fioff          0x8395b12        137976594
foseg          0x7b     123
fooff          0x855be4c        139837004
fop            0x5c1    1473
xmm0           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 
0x0}, v2_int64 = {0x0, 0x0},
  uint128 = 0x00000000000000000000000000000000}
xmm1           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 
0x0}, v2_int64 = {0x0, 0x0},
  uint128 = 0x00000000000000000000000000000000}
xmm2           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 
0x0}, v2_int64 = {0x0, 0x0},
  uint128 = 0x00000000000000000000000000000000}
xmm3           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {
---Type <return> to continue, or q <return> to quit---
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 
0x0}, v2_int64 = {0x0, 0x0},
  uint128 = 0x00000000000000000000000000000000}
xmm4           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 
0x0}, v2_int64 = {0x0, 0x0},
  uint128 = 0x00000000000000000000000000000000}
xmm5           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 
0x0}, v2_int64 = {0x0, 0x0},
  uint128 = 0x00000000000000000000000000000000}
xmm6           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 
0x0}, v2_int64 = {0x0, 0x0},
uint128 = 0x00000000000000000000000000000000}
xmm7           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 
0x0}, v2_int64 = {0x0, 0x0}, uint128 = 0x00000000000000000000000000000000}
mxcsr          0x1f80   [ IM DM ZM OM UM PM ]
mm0            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 
0x0, 0x0, 0x0}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm1            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 
0x0, 0x0, 0x0}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm2            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 
0x0, 0x0, 0x0}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm3            {uint64 = 0xac44000000000000, v2_int32 = {0x0, 
0xac440000}, v4_int16 = {0x0, 0x0, 0x0, 0xac44}, v8_int8 = {0x0, 0x0, 
0x0, 0x0, 0x0, 0x0, 0x44, 0xac}}
mm4            {uint64 = 0x924d692ca61be800, v2_int32 = {0xa61be800, 
0x924d692c}, v4_int16 = {0xe800, 0xa61b, 0x692c, 0x924d}, v8_int8 = 
{0x0, 0xe8, 0x1b, 0xa6, 0x2c, 0x69, 0x4d, 0x92}}
mm5            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 
0x0, 0x0, 0x0}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm6            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 
0x0, 0x0, 0x0}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm7            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 
0x0, 0x0, 0x0}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
(gdb)


And good work.

MvH
Benjamin Larsson




More information about the ffmpeg-devel mailing list