aacdec: remove checks for impossible error conditions

Originally committed as revision 24097 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Måns Rullgård 2010-07-07 20:23:56 +00:00
parent 96088566ee
commit 38b0410902

View File

@ -995,7 +995,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
const int c = 1024 / ics->num_windows; const int c = 1024 / ics->num_windows;
const uint16_t *offsets = ics->swb_offset; const uint16_t *offsets = ics->swb_offset;
float *coef_base = coef; float *coef_base = coef;
int err_idx;
for (g = 0; g < ics->num_windows; g++) for (g = 0; g < ics->num_windows; g++)
memset(coef + g * 128 + offsets[ics->max_sfb], 0, sizeof(float) * (c - offsets[ics->max_sfb])); memset(coef + g * 128 + offsets[ics->max_sfb], 0, sizeof(float) * (c - offsets[ics->max_sfb]));
@ -1031,7 +1030,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
const float *vq = ff_aac_codebook_vector_vals[cbt_m1]; const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
const uint16_t *cb_vector_idx = ff_aac_codebook_vector_idx[cbt_m1]; const uint16_t *cb_vector_idx = ff_aac_codebook_vector_idx[cbt_m1];
VLC_TYPE (*vlc_tab)[2] = vlc_spectral[cbt_m1].table; VLC_TYPE (*vlc_tab)[2] = vlc_spectral[cbt_m1].table;
const int cb_size = ff_aac_spectral_sizes[cbt_m1];
OPEN_READER(re, gb); OPEN_READER(re, gb);
switch (cbt_m1 >> 1) { switch (cbt_m1 >> 1) {
@ -1046,12 +1044,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
UPDATE_CACHE(re, gb); UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2); GET_VLC(code, re, gb, vlc_tab, 8, 2);
if (code >= cb_size) {
err_idx = code;
goto err_cb_overflow;
}
cb_idx = cb_vector_idx[code]; cb_idx = cb_vector_idx[code];
cf = VMUL4(cf, vq, cb_idx, sf + idx); cf = VMUL4(cf, vq, cb_idx, sf + idx);
} while (len -= 4); } while (len -= 4);
@ -1071,12 +1063,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
UPDATE_CACHE(re, gb); UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2); GET_VLC(code, re, gb, vlc_tab, 8, 2);
if (code >= cb_size) {
err_idx = code;
goto err_cb_overflow;
}
#if MIN_CACHE_BITS < 20 #if MIN_CACHE_BITS < 20
UPDATE_CACHE(re, gb); UPDATE_CACHE(re, gb);
#endif #endif
@ -1100,12 +1086,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
UPDATE_CACHE(re, gb); UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2); GET_VLC(code, re, gb, vlc_tab, 8, 2);
if (code >= cb_size) {
err_idx = code;
goto err_cb_overflow;
}
cb_idx = cb_vector_idx[code]; cb_idx = cb_vector_idx[code];
cf = VMUL2(cf, vq, cb_idx, sf + idx); cf = VMUL2(cf, vq, cb_idx, sf + idx);
} while (len -= 2); } while (len -= 2);
@ -1126,12 +1106,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
UPDATE_CACHE(re, gb); UPDATE_CACHE(re, gb);
GET_VLC(code, re, gb, vlc_tab, 8, 2); GET_VLC(code, re, gb, vlc_tab, 8, 2);
if (code >= cb_size) {
err_idx = code;
goto err_cb_overflow;
}
cb_idx = cb_vector_idx[code]; cb_idx = cb_vector_idx[code];
nnz = cb_idx >> 8 & 15; nnz = cb_idx >> 8 & 15;
sign = SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12); sign = SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12);
@ -1163,11 +1137,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
continue; continue;
} }
if (code >= cb_size) {
err_idx = code;
goto err_cb_overflow;
}
cb_idx = cb_vector_idx[code]; cb_idx = cb_vector_idx[code];
nnz = cb_idx >> 12; nnz = cb_idx >> 12;
nzt = cb_idx >> 8; nzt = cb_idx >> 8;
@ -1236,12 +1205,6 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
} }
} }
return 0; return 0;
err_cb_overflow:
av_log(ac->avctx, AV_LOG_ERROR,
"Read beyond end of ff_aac_codebook_vectors[%d][]. index %d >= %d\n",
band_type[idx], err_idx, ff_aac_spectral_sizes[band_type[idx]]);
return -1;
} }
static av_always_inline float flt16_round(float pf) static av_always_inline float flt16_round(float pf)