Commit 0fc82197 authored by rtognimp's avatar rtognimp

Support for samples with fft_order = 7

Fail init for unknown fft order, to prevent an array overflow
Output sound high-pitched compared to binary. Sample here
http://a1862.g.akamai.net/7/1862/14448/v1/esa.download.akamai.com/13452/qt/ESA_VenusExpress_110K_Stream.mov


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4724 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 8beaf135
...@@ -1876,10 +1876,7 @@ static int qdm2_decode_init(AVCodecContext *avctx) ...@@ -1876,10 +1876,7 @@ static int qdm2_decode_init(AVCodecContext *avctx)
s->group_order = av_log2(s->group_size) + 1; s->group_order = av_log2(s->group_size) + 1;
s->frame_size = s->group_size / 16; // 16 iterations per super block s->frame_size = s->group_size / 16; // 16 iterations per super block
if (s->fft_order == 8) s->sub_sampling = s->fft_order - 7;
s->sub_sampling = 1;
else
s->sub_sampling = 2;
s->frequency_range = 255 / (1 << (2 - s->sub_sampling)); s->frequency_range = 255 / (1 << (2 - s->sub_sampling));
switch ((s->sub_sampling * 2 + s->channels - 1)) { switch ((s->sub_sampling * 2 + s->channels - 1)) {
...@@ -1899,11 +1896,11 @@ static int qdm2_decode_init(AVCodecContext *avctx) ...@@ -1899,11 +1896,11 @@ static int qdm2_decode_init(AVCodecContext *avctx)
s->cm_table_select = tmp_val; s->cm_table_select = tmp_val;
if (s->sub_sampling == 0) if (s->sub_sampling == 0)
tmp = 16000; tmp = 7999;
else else
tmp = ((-(s->sub_sampling -1)) & 8000) + 20000; tmp = ((-(s->sub_sampling -1)) & 8000) + 20000;
/* /*
0: 16000 -> 1 0: 7999 -> 0
1: 20000 -> 2 1: 20000 -> 2
2: 28000 -> 2 2: 28000 -> 2
*/ */
...@@ -1914,8 +1911,11 @@ static int qdm2_decode_init(AVCodecContext *avctx) ...@@ -1914,8 +1911,11 @@ static int qdm2_decode_init(AVCodecContext *avctx)
else else
s->coeff_per_sb_select = 2; s->coeff_per_sb_select = 2;
if (s->fft_order != 8 && s->fft_order != 9) // Fail on unknown fft order, if it's > 9 it can overflow s->exptab[]
if ((s->fft_order < 7) || (s->fft_order > 9)) {
av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the developers!\n", s->fft_order); av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the developers!\n", s->fft_order);
return -1;
}
ff_fft_init(&s->fft_ctx, s->fft_order - 1, 1); ff_fft_init(&s->fft_ctx, s->fft_order - 1, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment