New submission from Vitor <[email protected]>:
In PPC/GCC 4.2.4, GSM decoding of fate-suite/gsm/ciao.wav is not bit-exact to
other archs.
While it is not reproducible in my x86 box, applying the following patch shows
there is something fishy going on. In my core2, I get the following output:
vi...@vitor-laptop:~/ffmpeg/ffmpeg.3$ ./ffmpeg -i
~/ffmpeg/fate/fate-suite/gsm/ciao.wav -f md5 -
FFmpeg version SVN-r24541, Copyright (c) 2000-2010 the FFmpeg developers
built on Jul 27 2010 13:58:01 with gcc 4.4.3
configuration: --cc='ccache gcc' --cpu='host'
--samples='/home/vitor/ffmpeg/fate/fate-suite'
libavutil 50.23. 0 / 50.23. 0
libavcore 0. 1. 0 / 0. 1. 0
libavcodec 52.84. 1 / 52.84. 1
libavformat 52.77. 0 / 52.77. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.26. 1 / 1.26. 1
libswscale 0.11. 0 / 0.11. 0
[wav @ 0x9d73470] Estimating duration from bitrate, this may be inaccurate
Input #0, wav, from '/home/vitor/ffmpeg/fate/fate-suite/gsm/ciao.wav':
Duration: 00:00:03.59, bitrate: 13 kb/s
Stream #0.0: Audio: gsm_ms, 8000 Hz, 1 channels, s16, 13 kb/s
Output #0, md5, to 'pipe:':
Metadata:
encoder : Lavf52.77.0
Stream #0.0: Audio: pcm_s16le, 8000 Hz, 1 channels, s16, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
Should be always 0: 0
Multiple frames in a packet from stream 0
Should be always 0: 72
MD5=aedc4ec86d60815d1f214c3ff944b13b
size= 0kB time=3.56 bitrate= 0.1kbits/s
video:0kB audio:56kB global headers:0kB muxing overhead -99.935042%
Note the "Should be always 0: 72" message.
----------
files: gsm_show_bug.diff
messages: 11446
priority: normal
status: new
substatus: new
title: Decoding GSM file currupts memory somehow
type: bug
________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/issue2133>
________________________________________________Index: libavcodec/gsmdec.c
===================================================================
--- libavcodec/gsmdec.c (revision 24541)
+++ libavcodec/gsmdec.c (working copy)
@@ -36,7 +36,7 @@
typedef struct {
int16_t ref_buf[280];
int v[9];
- int lar[2][8];
+ int lar[2][9];
int lar_idx;
int msr;
} GSMContext;
@@ -263,6 +263,7 @@
int buf_size = avpkt->size;
int16_t *samples = data;
int frame_bytes = 2 * avctx->frame_size;
+ GSMContext *ctx = avctx->priv_data;
if (*data_size < frame_bytes)
return -1;
@@ -288,6 +289,7 @@
return res;
}
*data_size = frame_bytes;
+ av_log(NULL, AV_LOG_ERROR, "Should be always 0: %i\n", ctx->lar[2][8]);
return avctx->block_align;
}