int coefsend;
int bitsend;
DECLARE_ALIGNED(16, int16_t, coefs)[MAX_ORDER + WMALL_COEFF_PAD_SIZE/sizeof(int16_t)];
- DECLARE_ALIGNED(16, int16_t, lms_prevvalues)[MAX_ORDER * 2];
- DECLARE_ALIGNED(16, int16_t, lms_updates)[MAX_ORDER * 2];
+ DECLARE_ALIGNED(16, int16_t, lms_prevvalues)[MAX_ORDER * 2 + WMALL_COEFF_PAD_SIZE/sizeof(int16_t)];
+ DECLARE_ALIGNED(16, int16_t, lms_updates)[MAX_ORDER * 2 + WMALL_COEFF_PAD_SIZE/sizeof(int16_t)];
int recent;
} cdlms[WMALL_MAX_CHANNELS][9];
{
int recent = s->cdlms[ich][ilms].recent;
int range = 1 << s->bits_per_sample - 1;
+ int order = s->cdlms[ich][ilms].order;
if (recent)
recent--;
else {
- memcpy(&s->cdlms[ich][ilms].lms_prevvalues[s->cdlms[ich][ilms].order],
- s->cdlms[ich][ilms].lms_prevvalues,
- 2 * s->cdlms[ich][ilms].order);
- memcpy(&s->cdlms[ich][ilms].lms_updates[s->cdlms[ich][ilms].order],
- s->cdlms[ich][ilms].lms_updates,
- 2 * s->cdlms[ich][ilms].order);
- recent = s->cdlms[ich][ilms].order - 1;
+ memcpy(s->cdlms[ich][ilms].lms_prevvalues + order,
+ s->cdlms[ich][ilms].lms_prevvalues, 2 * order);
+ memcpy(s->cdlms[ich][ilms].lms_updates + order,
+ s->cdlms[ich][ilms].lms_updates, 2 * order);
+ recent = order - 1;
}
s->cdlms[ich][ilms].lms_prevvalues[recent] = av_clip(input, -range, range - 1);
else
s->cdlms[ich][ilms].lms_updates[recent] = s->update_speed[ich];
- s->cdlms[ich][ilms].lms_updates[recent + (s->cdlms[ich][ilms].order >> 4)] >>= 2;
- s->cdlms[ich][ilms].lms_updates[recent + (s->cdlms[ich][ilms].order >> 3)] >>= 1;
+ s->cdlms[ich][ilms].lms_updates[recent + (order >> 4)] >>= 2;
+ s->cdlms[ich][ilms].lms_updates[recent + (order >> 3)] >>= 1;
s->cdlms[ich][ilms].recent = recent;
+ memset(s->cdlms[ich][ilms].lms_updates + recent + order, 0,
+ sizeof(s->cdlms[ich][ilms].lms_updates) - 2*(recent+order));
}
static void use_high_update_speed(WmallDecodeCtx *s, int ich)
+ s->cdlms[ch][ilms].recent,
s->cdlms[ch][ilms].lms_updates
+ s->cdlms[ch][ilms].recent,
- s->cdlms[ch][ilms].order,
+ FFALIGN(s->cdlms[ch][ilms].order,
+ WMALL_COEFF_PAD_SIZE),
WMASIGN(residue));
input = residue + (pred >> s->cdlms[ch][ilms].scaling);
lms_update(s, ch, ilms, input);