#include "libavutil/crc.h"
#include "libavutil/float_dsp.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "avcodec.h"
} else
return AVERROR_INVALIDDATA;
+ if (c->total_band_count > FF_ARRAY_ELEMS(c->ch->imdct_in))
+ return AVERROR_INVALIDDATA;
+
+
while (get_bits_left(gb) >= 32) {
chunk = get_bits_long(gb, 32);
if (chunk == MKBETAG('v', 'b', 'r', 0)) {
int index, unsigned band_count, unsigned base_band_count,
unsigned stereo_band_count)
{
- float ratio_l = intensity_ratio_table[ch1->intensity[index]];
+ float ratio_l = intensity_ratio_table[ch2->intensity[index]];
float ratio_r = ratio_l - 2.0f;
float *c1 = &ch1->imdct_in[base_band_count];
float *c2 = &ch2->imdct_in[base_band_count];
return;
for (int i = 0, k = start_band, l = start_band - 1; i < hfr_group_count; i++){
- for (int j = 0; j < bands_per_hfr_group && k < total_band_count; j++, k++, l--){
- ch->imdct_in[k] = scale_conversion_table[ch->hfr_scale[i] - ch->scale_factors[l]] * ch->imdct_in[l];
+ for (int j = 0; j < bands_per_hfr_group && k < total_band_count && l >= 0; j++, k++, l--){
+ ch->imdct_in[k] = scale_conversion_table[ scale_conv_bias +
+ av_clip_intp2(ch->hfr_scale[i] - ch->scale_factors[l], 6) ] * ch->imdct_in[l];
}
}
} else {
factor += delta - half_max;
}
+ factor = av_clip_uintp2(factor, 6);
ch->scale_factors[i] = factor;
}
return 0;
}
-AVCodec ff_hca_decoder = {
+const AVCodec ff_hca_decoder = {
.name = "hca",
.long_name = NULL_IF_CONFIG_SMALL("CRI HCA"),
.type = AVMEDIA_TYPE_AUDIO,