On 19.11.2015 01:31, Michael Niedermayer wrote: > On Thu, Nov 19, 2015 at 12:31:17AM +0100, Andreas Cadhalpun wrote: >> So far so good. However, the next time sbr_dequant is called this breaks: >> noise_facs[1][0].exp = 6 - 536870912 + 1 = -536870905; >> > >> This is obviously completely bogus. > > yes > > >> Instead this code needs a function like av_exp2_sf. > > no, thats not the problem > this code is missing error checks and only adding error checks will > fix that > > there is read_sbr_noise() which reads data > there is sbr_dequant() which converts the data from "read data" to > lets call it "dequantized data"
That makes sense, thanks for explaining. > what you describe sounds like that sbr_dequant() is called on top of > the output from sbr_dequant(), that sounds like a error condition > for both fixed and float Indeed. A patch checking for that is attached. Best regards, Andreas
>From 0237ebfca9571d2d3e51f5c5dc15f8f5a516510a Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com> Date: Fri, 20 Nov 2015 00:04:50 +0100 Subject: [PATCH] aacsbr: don't call sbr_dequant twice without intermediate read_sbr_data Doing that doesn't make sense, because the only purpose of sbr_dequant is to process the data from read_sbr_data. Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com> --- libavcodec/aacsbr_template.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/aacsbr_template.c b/libavcodec/aacsbr_template.c index cf18862..564930a 100644 --- a/libavcodec/aacsbr_template.c +++ b/libavcodec/aacsbr_template.c @@ -1041,6 +1041,7 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr, unsigned int cnt = get_bits_count(gb); sbr->id_aac = id_aac; + sbr->start = 2; if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) { if (read_sbr_single_channel_element(ac, sbr, gb)) { @@ -1476,6 +1477,12 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int sbr_turnoff(sbr); } + if (sbr->start == 1) { + av_log(ac->avctx, AV_LOG_ERROR, + "No quantized data read for sbr_dequant.\n"); + sbr_turnoff(sbr); + } + if (!sbr->kx_and_m_pushed) { sbr->kx[0] = sbr->kx[1]; sbr->m[0] = sbr->m[1]; @@ -1485,6 +1492,7 @@ void AAC_RENAME(ff_sbr_apply)(AACContext *ac, SpectralBandReplication *sbr, int if (sbr->start) { sbr_dequant(sbr, id_aac); + sbr->start = 1; } for (ch = 0; ch < nch; ch++) { /* decode channel */ -- 2.6.2
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel