Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#1041 closed defect (fixed)

Illegal instruction when opening some files with (HE-)AAC streams

Reported by: qyot27 Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: aac sse
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Sometime between the 18th of February and the 25th of February, the AAC decoder (at least, I think it's the AAC decoder doing this) started breaking on certain files. I've observed it in native builds for both Windows (built with MinGW) and Linux. It seems to fail with files that contain AAC streams that MediaInfo? detects as being HE-AAC, as my purchases from iTunes (which report as standard LC-AAC) can open fine in the same FFmpeg builds that have issues with the streams that report as HE-AAC.

Since I also saw avconv crash with the same sample, I'm guessing this issue arose with one of the merges that occurred during the timeframe between the 18th and 25th. I tried to use git revert on specific AAC-related commits from that date range, but that didn't resolve the error.

Furthermore, even this HE-AAC thing doesn't seem to occur on other computers I have access to that are much newer and more powerful than mine. For reference, my setup has a Celeron Coppermine and 512MBs of PC133 SDRAM. Another computer that didn't exhibit this issue runs an Athlon64 Orleans with 2GBs of DDR2 SDRAM (I think DDR2-800). The actual FFmpeg binary used was the same on both computers.

The output of a working FFmpeg build:

./ffmpeg.exe -v 9 -loglevel 99 -i $HOME/sample-5.flv
ffmpeg version r37999 git-57182b9 Copyright (c) 2000-2012 the FFmpeg developers
  built on Feb 18 2012 21:44:50 with gcc 4.6.1
  configuration: --prefix=/home/qyot27/win32_build --cross-prefix=i686-w64-mingw32- --enable-gpl --enable-version3 --disable-w32threads --enable-memalign-hack --disable-decoder=utvideo --enable-libutvideo --enable-libxvid --disable-encoder=mpeg4 --enable-avisynth --cpu=pentium3 --extra-cflags='-I/home/qyot27/win32_build/include -march=pentium3 -mtune=pentium3 -DPTW32_STATIC_LIB' --extra-ldflags=-L/home/qyot27/win32_build/lib --target-os=mingw32 --arch=x86
  libavutil      51. 39.100 / 51. 39.100
  libavcodec     54.  3.100 / 54.  3.100
  libavformat    54.  1.100 / 54.  1.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 62.101 /  2. 62.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
[flv @ 00142840] Format flv probed with size=2048 and score=100
[h264 @ 00148A00] no picture 
[flv @ 00142840] All info found
rfps: 23.750000 0.011777
    Last message repeated 1 times
rfps: 23.833333 0.004697
rfps: 23.916667 0.000836
rfps: 24.000000 0.000195
rfps: 24.083333 0.002773
rfps: 24.166667 0.008572
    Last message repeated 1 times
rfps: 24.250000 0.017590
    Last message repeated 1 times
rfps: 47.666667 0.018788
rfps: 47.750000 0.009456
rfps: 47.833333 0.003344
rfps: 47.916667 0.000452
rfps: 48.000000 0.000779
rfps: 48.083333 0.004327
rfps: 48.166667 0.011094
rfps: 23.976024 0.000049
Input #0, flv, from '/home/qyot27/sample-5.flv':
  Metadata:
    moovPosition    : 272105568
    avcprofile      : 77
    avclevel        : 31
    aacaot          : 2
    videoframerate  : 24
    audiochannels   : 2
  Duration: 00:21:22.80, start: 0.000000, bitrate: 32 kb/s
    Stream #0:0, 41, 1/1000: Video: h264 (Main), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1001/48000, 23.98 tbr, 1k tbn, 47.95 tbc
    Stream #0:1, 36, 1/1000: Audio: aac, 44100 Hz, stereo, s16
At least one output file must be specified

The output of a non-working FFmpeg:

./ffmpeg -v 9 -loglevel 99 -i $HOME/sample-5.flv
ffmpeg version N-38556-g456d65a Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  5 2012 14:32:36 with gcc 4.6.1
  configuration: --prefix=/home/qyot27/linuxffmpeg_build --enable-gpl --enable-version3 --enable-libxvid --disable-encoder=mpeg4 --cpu=pentium3 --extra-cflags='-march=pentium3 -mtune=pentium3'
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54.  8.100 / 54.  8.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
[flv @ 0x95eeac0] Format flv probed with size=2048 and score=100
[h264 @ 0x95f4da0] no picture 
Illegal instruction

Only the audio (demuxed using the working build), still errors out with newer builds:

./ffmpeg -v 9 -loglevel 99 -i $HOME/sample-5.aac
ffmpeg version N-38556-g456d65a Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  5 2012 14:32:36 with gcc 4.6.1
  configuration: --prefix=/home/qyot27/linuxffmpeg_build --enable-gpl --enable-version3 --enable-libxvid --disable-encoder=mpeg4 --cpu=pentium3 --extra-cflags='-march=pentium3 -mtune=pentium3'
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54.  8.100 / 54.  8.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
[aac @ 0xa2f7ac0] Format aac probed with size=2048 and score=51
Illegal instruction

Remuxing instead to MKV or MP4 produces virtually the same result, with 'Illegal instruction' after the Format probing message (and the h264 no picture message, if the video stream has been retained; otherwise it jumps directly to 'Illegal instruction').

To show that it's not all AAC files, the output of a different file (bought from iTunes):

./ffmpeg -v 9 -loglevel 99 -i /home/qyot27/Music/Songbird\ Music/Depeche\ Mode\ -\ Never\ Let\ Me\ Down\ Again\ \(Single\ Version\).m4a 
ffmpeg version N-38556-g456d65a Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  5 2012 14:32:36 with gcc 4.6.1
  configuration: --prefix=/home/qyot27/linuxffmpeg_build --enable-gpl --enable-version3 --enable-libxvid --disable-encoder=mpeg4 --cpu=pentium3 --extra-cflags='-march=pentium3 -mtune=pentium3'
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54.  8.100 / 54.  8.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xaee3ac0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xaee3ac0] ISO: File Type Major Brand: M4A 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xaee3ac0] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/qyot27/Music/Songbird Music/Depeche Mode - Never Let Me Down Again (Single Version).m4a':
  Metadata:
    major_brand     : M4A 
    minor_version   : 0
    compatible_brands: M4A mp42isom
    creation_time   : 1941-06-18 03:43:01
    title           : Never Let Me Down Again (Single Version)
    artist          : Depeche Mode
    album_artist    : Depeche Mode
    album           : Singles Box 4
    genre           : Rock
    track           : 1/8
    disc            : 2/6
    date            : 2004-12-07T08:00:00Z
    gapless_playback: 0
    copyright       : ℗ 2004 Warner Bros. Records. Manufactured and Marketed by Warner Strategic Marketing
    media_type      : 1
  Duration: 00:04:22.03, start: 0.000000, bitrate: 278 kb/s
    Stream #0:0(eng), 1, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 259 kb/s
    Metadata:
      creation_time   : 1941-06-18 03:43:01
      handler_name    : 
At least one output file must be specified

or one I'd encoded myself:

./ffmpeg -v 9 -loglevel 99 -i /home/qyot27/Music/Songbird\ Music/Third\ Eye\ Blind\ -\ Semi-Charmed\ Life.m4a 
ffmpeg version N-38556-g456d65a Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  5 2012 14:32:36 with gcc 4.6.1
  configuration: --prefix=/home/qyot27/linuxffmpeg_build --enable-gpl --enable-version3 --enable-libxvid --disable-encoder=mpeg4 --cpu=pentium3 --extra-cflags='-march=pentium3 -mtune=pentium3'
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54.  8.100 / 54.  8.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xaba5ac0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xaba5ac0] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xaba5ac0] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/qyot27/Music/Songbird Music/Third Eye Blind - Semi-Charmed Life.m4a':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2008-02-17 22:24:11
    track           : 5/21
    genre           : Soundtrack
    album           : ESPN Presents Jock Rock 2000
    artist          : Third Eye Blind
    title           : Semi-Charmed Life
    date            : 1999
  Duration: 00:04:24.60, start: 0.000000, bitrate: 208 kb/s
    Stream #0:0(eng), 1, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 207 kb/s
    Metadata:
      creation_time   : 2008-02-17 22:24:11
      handler_name    : 
    Stream #0:1(eng), 0, 1/1000: Data: none (mp4s / 0x7334706D)
    Metadata:
      creation_time   : 2008-02-17 22:24:43
      handler_name    : 
    Stream #0:2(eng), 0, 1/1000: Data: none (mp4s / 0x7334706D)
    Metadata:
      creation_time   : 2008-02-17 22:24:43
      handler_name    : 
At least one output file must be specified

I don't know if a sample would be helpful if this actually requires a decade-old computer to reproduce the issue, but I've attached one anyway.

Attachments (1)

sample-5.aac (278.7 KB) - added by qyot27 5 years ago.

Download all attachments as: .zip

Change History (29)

Changed 5 years ago by qyot27

comment:1 Changed 5 years ago by cehoyos

  • Keywords aac added; aacdec removed

Since I am unable to reproduce your problem on my Pentium-M:
Can you reproduce the problem with "./configure && make"?
Please provide a backtrace with gdb and / or please use git bisect to find the change introducing the problem.

comment:2 Changed 5 years ago by llogan

I'm unable to duplicate this on a 400 MHz Pentium II "Deschutes" with plain ./configure. I also recommend trying with a plain configure to try to narrow down the issue.

comment:3 Changed 5 years ago by qyot27

Rebuilt FFmpeg with just ./configure, the Illegal instruction still happens. The backtrace seems to point to an SSE issue.

The full output of gdb as directed on the Bug Reporting page:

$ gdb ffmpeg_g
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/qyot27/ffmpeg_g...done.

(gdb) r -v 9 -loglevel 99 -i sample-5.aac
Starting program: /home/qyot27/ffmpeg_g -v 9 -loglevel 99 -i sample-5.aac
[Thread debugging using libthread_db enabled]
ffmpeg version N-38596-gf095391 Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  6 2012 14:21:10 with gcc 4.6.1
  configuration: --prefix=/home/qyot27/ffmpeg_build
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54. 10.100 / 54. 10.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
[aac @ 0x8e85ac0] Format aac probed with size=2048 and score=51

Program received signal SIGILL, Illegal instruction.
ff_sbr_hf_g_filt_sse.loop1 () at libavcodec/x86/sbrdsp.asm:107
107	    movq      [r0], m2

(gdb) bt
#0  ff_sbr_hf_g_filt_sse.loop1 () at libavcodec/x86/sbrdsp.asm:107
#1  0xb7f856b0 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

(gdb) disass $pc-32,$pc+32
Dump of assembler code from 0x86d4f35 to 0x86d4f75:
   0x086d4f35 <ff_sbr_hf_g_filt_sse.loop4+59>:	adc    %al,0x500c1(%ecx)
   0x086d4f3b <ff_sbr_hf_g_filt_sse.loop4+65>:	add    %al,-0x468afb3d(%ebx)
   0x086d4f41 <ff_sbr_hf_g_filt_sse.loop4+71>:	and    $0x3,%edi
   0x086d4f44 <ff_sbr_hf_g_filt_sse.loop4+74>:	je     0x86d4f68 <ff_sbr_hf_g_filt_sse.end>
   0x086d4f46 <ff_sbr_hf_g_filt_sse.loop1+0>:	movss  (%edx),%xmm0
   0x086d4f4a <ff_sbr_hf_g_filt_sse.loop1+4>:	movq   (%ecx),%xmm2
   0x086d4f4e <ff_sbr_hf_g_filt_sse.loop1+8>:	punpckldq %xmm0,%xmm0
   0x086d4f52 <ff_sbr_hf_g_filt_sse.loop1+12>:	mulps  %xmm0,%xmm2
=> 0x086d4f55 <ff_sbr_hf_g_filt_sse.loop1+15>:	movq   %xmm2,(%eax)
   0x086d4f59 <ff_sbr_hf_g_filt_sse.loop1+19>:	add    $0x8,%eax
   0x086d4f5c <ff_sbr_hf_g_filt_sse.loop1+22>:	add    $0x4,%edx
   0x086d4f5f <ff_sbr_hf_g_filt_sse.loop1+25>:	add    $0x140,%ecx
   0x086d4f65 <ff_sbr_hf_g_filt_sse.loop1+31>:	dec    %edi
   0x086d4f66 <ff_sbr_hf_g_filt_sse.loop1+32>:	jne    0x86d4f46 <ff_sbr_hf_g_filt_sse.loop1>
   0x086d4f68 <ff_sbr_hf_g_filt_sse.end+0>:	pop    %edi
   0x086d4f69 <ff_sbr_hf_g_filt_sse.end+1>:	pop    %esi
   0x086d4f6a <ff_sbr_hf_g_filt_sse.end+2>:	pop    %ebx
   0x086d4f6b <ff_sbr_hf_g_filt_sse.end+3>:	ret    
   0x086d4f6c <ff_sbr_hf_g_filt_sse.end+4>:	nop
   0x086d4f6d <ff_sbr_hf_g_filt_sse.end+5>:	nop
---Type <return> to continue, or q <return> to quit---
   0x086d4f6e <ff_sbr_hf_g_filt_sse.end+6>:	nop
   0x086d4f6f <ff_sbr_hf_g_filt_sse.end+7>:	nop
   0x086d4f70 <auto_matrix+0>:	push   %ebp
   0x086d4f71 <auto_matrix+1>:	mov    %eax,%ebp
   0x086d4f73 <auto_matrix+3>:	push   %edi
   0x086d4f74 <auto_matrix+4>:	push   %esi
End of assembler dump.

(gdb) info all-registers
eax            0xb7f91de0	-1208410656
ecx            0xb7fcc8c0	-1208170304
edx            0xb7f96880	-1208391552
ebx            0x0	0
esp            0xbfffd020	0xbfffd020
ebp            0xb7f91d20	0xb7f91d20
esi            0x2	2
edi            0x3	3
eip            0x86d4f55	0x86d4f55 <ff_sbr_hf_g_filt_sse.loop1+15>
eflags         0x210206	[ PF IF RF ID ]
cs             0x73	115
ss             0x7b	123
ds             0x7b	123
es             0x7b	123
fs             0x0	0
gs             0x33	51
st0            -inf	(raw 0xffff0000000000000000)
st1            -inf	(raw 0xffff0000000000000000)
st2            -0	(raw 0x80000000000000000000)
st3            0.9921586513519287109375	(raw 0x3ffefdfe1c0000000000)
st4            0.98437878945247803130769170820713043	(raw 0x3ffefc003f9393100000)
st5            1.1920928955078125e-07	(raw 0x3fe88000000000000000)
---Type <return> to continue, or q <return> to quit---
st6            0	(raw 0x00000000000000000000)
st7            1.58489322662353515625	(raw 0x3fffcaddc80000000000)
fctrl          0x37f	895
fstat          0x461	1121
ftag           0x101a	4122
fiseg          0x73	115
fioff          0x863674c	140732236
foseg          0x7b	123
fooff          0xb7fd8568	-1208122008
fop            0x5d8	1496
xmm0           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
  v16_int8 = {0x0, 0x0, 0xc0, 0xff, 0x0 <repeats 12 times>}, v8_int16 = {0x0, 
    0xffc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0xffc00000, 0x0, 0x0, 
    0x0}, v2_int64 = {0xffc00000, 0x0}, 
  uint128 = 0x000000000000000000000000ffc00000}
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, 0x0, 0xc0, 0xff, 0x0 <repeats 12 times>}, v8_int16 = {0x0, 
    0xffc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0xffc00000, 0x0, 0x0, 
    0x0}, v2_int64 = {0xffc00000, 0x0}, 
---Type <return> to continue, or q <return> to quit---
  uint128 = 0x000000000000000000000000ffc00000}
xmm3           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
  v16_int8 = {0x86, 0xe5, 0x4b, 0x2d, 0x4f, 0xd5, 0x54, 0x2d, 0x0, 0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xe586, 0x2d4b, 0xd54f, 0x2d54, 0x0, 
    0x0, 0x0, 0x0}, v4_int32 = {0x2d4be586, 0x2d54d54f, 0x0, 0x0}, v2_int64 = {
    0x2d54d54f2d4be586, 0x0}, uint128 = 0x00000000000000002d54d54f2d4be586}
xmm4           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
  v16_int8 = {0xb5, 0xb7, 0xd8, 0x2a, 0x8a, 0xdf, 0xc6, 0x2a, 0x3a, 0x62, 
    0x1d, 0x2c, 0x6f, 0x90, 0xe3, 0x2a}, v8_int16 = {0xb7b5, 0x2ad8, 0xdf8a, 
    0x2ac6, 0x623a, 0x2c1d, 0x906f, 0x2ae3}, v4_int32 = {0x2ad8b7b5, 
    0x2ac6df8a, 0x2c1d623a, 0x2ae3906f}, v2_int64 = {0x2ac6df8a2ad8b7b5, 
    0x2ae3906f2c1d623a}, uint128 = 0x2ae3906f2c1d623a2ac6df8a2ad8b7b5}
xmm5           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
  v16_int8 = {0x7c, 0xf9, 0xfa, 0x2c, 0xc9, 0x25, 0x5c, 0x2d, 0xfe, 0xbe, 
    0x5b, 0x29, 0x60, 0x85, 0x21, 0x2a}, v8_int16 = {0xf97c, 0x2cfa, 0x25c9, 
    0x2d5c, 0xbefe, 0x295b, 0x8560, 0x2a21}, v4_int32 = {0x2cfaf97c, 
    0x2d5c25c9, 0x295bbefe, 0x2a218560}, v2_int64 = {0x2d5c25c92cfaf97c, 
    0x2a218560295bbefe}, uint128 = 0x2a218560295bbefe2d5c25c92cfaf97c}
xmm6           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
  v16_int8 = {0x28, 0xe4, 0x7b, 0x37, 0xa0, 0x37, 0x82, 0x37, 0x2c, 0x59, 
    0x70, 0x37, 0xbd, 0x65, 0x6b, 0x37}, v8_int16 = {0xe428, 0x377b, 0x37a0, 
    0x3782, 0x592c, 0x3770, 0x65bd, 0x376b}, v4_int32 = {0x377be428, 
    0x378237a0, 0x3770592c, 0x376b65bd}, v2_int64 = {0x378237a0377be428, 
---Type <return> to continue, or q <return> to quit---
    0x376b65bd3770592c}, uint128 = 0x376b65bd3770592c378237a0377be428}
xmm7           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, 
  v16_int8 = {0x80, 0xe1, 0x10, 0x35, 0xe3, 0x2a, 0xf, 0x36, 0x2f, 0x5a, 0x25, 
    0x36, 0xd4, 0xff, 0xa9, 0x36}, v8_int16 = {0xe180, 0x3510, 0x2ae3, 0x360f, 
    0x5a2f, 0x3625, 0xffd4, 0x36a9}, v4_int32 = {0x3510e180, 0x360f2ae3, 
    0x36255a2f, 0x36a9ffd4}, v2_int64 = {0x360f2ae33510e180, 
    0x36a9ffd436255a2f}, uint128 = 0x36a9ffd436255a2f360f2ae33510e180}
mxcsr          0x1fb2	[ DE UE PE 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 = 0xfdfe1c0000000000, v2_int32 = {0x0, 0xfdfe1c00}, 
  v4_int16 = {0x0, 0x0, 0x1c00, 0xfdfe}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 
    0x1c, 0xfe, 0xfd}}
mm4            {uint64 = 0xfc003f9393100000, v2_int32 = {0x93100000, 
    0xfc003f93}, v4_int16 = {0x0, 0x9310, 0x3f93, 0xfc00}, v8_int8 = {0x0, 
    0x0, 0x10, 0x93, 0x93, 0x3f, 0x0, 0xfc}}
mm5            {uint64 = 0x8000000000000000, v2_int32 = {0x0, 0x80000000}, 
  v4_int16 = {0x0, 0x0, 0x0, 0x8000}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
    0x0, 0x80}}
---Type <return> to continue, or q <return> to quit---
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 = 0xcaddc80000000000, v2_int32 = {0x0, 0xcaddc800}, 
  v4_int16 = {0x0, 0x0, 0xc800, 0xcadd}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 
    0xc8, 0xdd, 0xca}}

(gdb)


I'll also go about trying to find the particular change. Looking at the commit log, it may have been this one, since it makes reference to sbr_hf_g_filt.

comment:4 Changed 5 years ago by qyot27

Update: Yes, apparently it is that commit.

git revert 2784d187919b48022a89633fb3b5a99ca97cf869 seems to resolve it.

comment:5 Changed 5 years ago by qyot27

Update 2

Reverting 2784d187919b48022a89633fb3b5a99ca97cf869 only allows it to use -acodec copy and not error out, but trying to decode HE-AAC results in a silent track with clicks. For it to decode like before, 34454c761f01275d4adaf40df6d70a59011c4a6c also needs to be reverted.

comment:6 Changed 5 years ago by cehoyos

  • Component changed from undetermined to avcodec
  • Priority changed from normal to important
  • Status changed from new to open

comment:7 Changed 5 years ago by cehoyos

comment:8 Changed 5 years ago by qyot27

I actually drew that patch out of Libav and tested it yesterday before it got merged in, and unless I screwed something up (which is very possible, as I can't quite remember if I'd been messing with git revert on that test), it only eliminated the error; decoding resulted in a silent track.

I'll rebuild with a fresh clone and test.

comment:10 Changed 5 years ago by qyot27

The new patch still results in silent decoding. I also tried with the unpatched git master since the most recent merge brought that change in, and it has the silence issue too. The output of a decoding operation:

./ffmpeg_g -v 9 -loglevel 99 -i sample-5.aac -acodec pcm_s16le testaac.wav
ffmpeg version N-38662-gbf807a5 Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  7 2012 22:19:10 with gcc 4.6.1
  configuration: --prefix=/home/qyot27/ffmpeg_build --extra-cflags='-m32 -DARCH_X86_32' --extra-ldflags=-m32
  libavutil      51. 42.100 / 51. 42.100
  libavcodec     54. 10.100 / 54. 10.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
[aac @ 0x9133ac0] Format aac probed with size=2048 and score=51
[aac @ 0x9133ac0] max_analyze_duration 5000000 reached at 5015510
[aac @ 0x9133ac0] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'sample-5.aac':
  Duration: 00:00:23.79, bitrate: 95 kb/s
    Stream #0:0, 111, 1/28224000: Audio: aac, 44100 Hz, stereo, s16, 95 kb/s
Output #0, wav, to 'testaac.wav':
  Metadata:
    encoder         : Lavf54.2.100
    Stream #0:0, 0, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (aac -> pcm_s16le)
Press [q] to stop, [?] for help
size=    4096kB time=00:00:23.77 bitrate=1411.2kbits/s    
video:0kB audio:4096kB global headers:0kB muxing overhead 0.001097%

comment:11 Changed 5 years ago by cehoyos

Does decoding work if you compile with "./configure --disable-asm && make" (or --disable-sse)?

comment:12 Changed 5 years ago by qyot27

Yes, decoding is fine if built with --disable-sse.

comment:13 Changed 5 years ago by cehoyos

Does decoding work if you compile with "./configure --disable-yasm && make" ?
If it does work, you could look at dsputil_init_sse() in libavcodec/x86/dsputil_mmx.c (line 2700) and test if removing the line with "scalarproduct_float" or "butterflies_float_interleave" fixes the problem.

(Sorry, but I cannot test myself atm.)

comment:14 Changed 5 years ago by qyot27

Building with --disable-yasm = decoding works

Commenting out scalarproduct_float = still silent
Commenting out butterflies_float_interleave = still silent
Commenting out both lines = still silent

Forcing SSE2 by changing line 35 of libavcodec/x86/sbrdsp_init.c from

if (mm_flags & AV_CPU_FLAG_SSE) {

to

if (mm_flags & AV_CPU_FLAG_SSE2) {

makes decoding work, but I don't know if that's the 'ideal' solution here.

comment:15 Changed 5 years ago by cehoyos

Is the responsible function ff_sbr_sum_square_sse() or ff_sbr_hf_g_filt_sse() (or both)?

comment:16 Changed 5 years ago by qyot27

ff_sbr_sum_square_sse() seems to be the one causing the issue. Commenting out those two lines in sbrdsp_init.c makes decoding work.

comment:17 Changed 5 years ago by cehoyos

Commenting out only "s->sum_square = ff_sbr_sum_square_sse;" does not help?

comment:18 Changed 5 years ago by qyot27

I didn't know which one would need to be removed, so I commented out both of the lines that referenced ff_sbr_sum_square_sse just to be overly cautious.

comment:19 Changed 5 years ago by qyot27

Now that I've had the time to test again, it is only the "s->sum_square = ff_sbr_sum_square_sse;" that causes the issue, not both lines.

comment:20 follow-up: Changed 5 years ago by ami_stuff

Probably related to ticket #213. My own build (compiled with --disable-yasm) works correctly.

comment:21 in reply to: ↑ 20 Changed 5 years ago by qyot27

Replying to ami_stuff:

Probably related to ticket #213. My own build (compiled with --disable-yasm) works correctly.

Except that this is caused by a line in libavcodec/x86/sbrdsp_init.c, a source file which didn't even exist until a little less than a month ago. Prior to which, HE-AAC decoding worked fine, and still works fine if the problematic line is commented out (as worked out from comments #14-19 above). And even with this issue, LC-AAC decoding still works.

Last edited 5 years ago by qyot27 (previous) (diff)

comment:22 Changed 5 years ago by ami_stuff

This is what I get on Athlon XP:

http://www.datafilehost.com/download-97c1ba24.html

C:\>ffmpeg -i sample-5.aac out.wav
ffmpeg version N-38938-ge01f478 Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar 20 2012 02:36:44 with gcc 4.5.0 20100414 (Fedora MinGW 4.5.0-1.fc
14)
  configuration: --prefix=/var/www/users/research/ffmpeg/snapshots/build --arch=
x86 --target-os=mingw32 --cross-prefix=i686-pc-mingw32- --cc='ccache i686-pc-min
gw32-gcc' --enable-w32threads --enable-memalign-hack --enable-runtime-cpudetect
--enable-cross-compile --enable-static --disable-shared --extra-libs='-lws2_32 -
lwinmm' --extra-cflags='--static -I/var/www/users/research/ffmpeg/snapshots/buil
d/include' --extra-ldflags='-static -L/var/www/users/research/ffmpeg/snapshots/b
uild/lib' --enable-bzlib --enable-zlib --enable-gpl --enable-version3 --enable-n
onfree --enable-libx264 --enable-libspeex --enable-libtheora --enable-libvorbis
--enable-libfaac --enable-libxvid --enable-libopencore-amrnb --enable-libopencor
e-amrwb --enable-libmp3lame --enable-libvpx --disable-decoder=libvpx
  libavutil      51. 42.100 / 51. 42.100
  libavcodec     54. 12.100 / 54. 12.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 65.101 /  2. 65.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
[aac @ 0x1da9be0] max_analyze_duration 5000000 reached at 5015510
[aac @ 0x1da9be0] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'sample-5.aac':
  Duration: 00:00:23.79, bitrate: 95 kb/s
    Stream #0:0: Audio: aac, 44100 Hz, stereo, s16, 95 kb/s
File 'out.wav' already exists. Overwrite ? [y/N] y
Output #0, wav, to 'out.wav':
  Metadata:
    encoder         : Lavf54.2.100
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16
, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (aac -> pcm_s16le)
Press [q] to stop, [?] for help
size=    4096kB time=00:00:23.77 bitrate=1411.2kbits/s
video:0kB audio:4096kB global headers:0kB muxing overhead 0.001097%

comment:23 Changed 5 years ago by qyot27

The issue is (as far as I can tell), that the assembly for function ff_sbr_sum_square_sse is somehow not fully correct SSE, perhaps - as was the case with ff_sbr_hf_g_filt_sse before it got fixed - mixed with SSE2 instructions. Processors that lack SSE2 support, like the Pentium III and Athlon XP, will generate silent output when attempting to process SBR-laced data because that assembly isn't strictly SSE and can't correctly be used on such processors. Comment out that specific line which calls it, and decoding works properly without having to disable all assembly optimizations. This was already known.

Version 0, edited 5 years ago by qyot27 (next)

comment:24 Changed 5 years ago by cehoyos

  • Keywords sse added

comment:25 follow-up: Changed 5 years ago by reimar

Could you please try below change? I always build for 64 bit, so not even compilation is tested from my side...

diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm
index 31a1c8b..682531d 100644
--- a/libavcodec/x86/sbrdsp.asm
+++ b/libavcodec/x86/sbrdsp.asm
@@ -68,7 +68,7 @@ cglobal sbr_sum_square, 2, 3, 6
     shufps      m0, m0, 1
     addss       m0, m1
 %if ARCH_X86_64 == 0
-    movd        r0m,  m0
+    movss       r0m,  m0
     fld         dword r0m
 %endif
     RET

comment:26 in reply to: ↑ 25 Changed 5 years ago by qyot27

Replying to reimar:

Could you please try below change? I always build for 64 bit, so not even compilation is tested from my side...

diff --git a/libavcodec/x86/sbrdsp.asm b/libavcodec/x86/sbrdsp.asm
index 31a1c8b..682531d 100644
--- a/libavcodec/x86/sbrdsp.asm
+++ b/libavcodec/x86/sbrdsp.asm
@@ -68,7 +68,7 @@ cglobal sbr_sum_square, 2, 3, 6
     shufps      m0, m0, 1
     addss       m0, m1
 %if ARCH_X86_64 == 0
-    movd        r0m,  m0
+    movss       r0m,  m0
     fld         dword r0m
 %endif
     RET

Tested. Decoding works correctly with this patch.

comment:27 Changed 5 years ago by reimar

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

Thanks, pushed and thus closing.

comment:28 Changed 5 years ago by ami_stuff

Fixed for me as well.

Note: See TracTickets for help on using tickets.