1
0
Fork 0

avcodec/rka: rename variable to something more representative

This commit is contained in:
Paul B Mahol 2023-09-30 13:22:32 +02:00
parent 2cb2465cc7
commit 8bfadacfd1
1 changed files with 15 additions and 15 deletions

View File

@ -59,8 +59,8 @@ typedef struct AdaptiveModel {
} AdaptiveModel;
typedef struct ChContext {
int cmode;
int cmode2;
int qfactor;
int vrq;
int last_nb_decoded;
unsigned srate_pad;
unsigned pos_idx;
@ -131,7 +131,7 @@ static void adaptive_model_free(AdaptiveModel *am)
static av_cold int rka_decode_init(AVCodecContext *avctx)
{
RKAContext *s = avctx->priv_data;
int cmode;
int qfactor;
if (avctx->extradata_size < 16)
return AVERROR_INVALIDDATA;
@ -160,14 +160,14 @@ static av_cold int rka_decode_init(AVCodecContext *avctx)
s->last_nb_samples = s->total_nb_samples % s->frame_samples;
s->correlated = avctx->extradata[15] & 1;
cmode = avctx->extradata[14] & 0xf;
qfactor = avctx->extradata[14] & 0xf;
if ((avctx->extradata[15] & 4) != 0)
cmode = -cmode;
qfactor = -qfactor;
s->ch[0].cmode = s->ch[1].cmode = cmode < 0 ? 2 : cmode;
s->ch[0].cmode2 = cmode < 0 ? FFABS(cmode) : 0;
s->ch[1].cmode2 = cmode < 0 ? FFABS(cmode) : 0;
av_log(avctx, AV_LOG_DEBUG, "cmode: %d\n", cmode);
s->ch[0].qfactor = s->ch[1].qfactor = qfactor < 0 ? 2 : qfactor;
s->ch[0].vrq = qfactor < 0 ? FFABS(qfactor) : 0;
s->ch[1].vrq = qfactor < 0 ? FFABS(qfactor) : 0;
av_log(avctx, AV_LOG_DEBUG, "qfactor: %d\n", qfactor);
return 0;
}
@ -676,7 +676,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
int m = 0, split, val, last_val = 0, ret;
unsigned idx = 3, bits = 0;
if (ctx->cmode == 0) {
if (ctx->qfactor == 0) {
if (amdl_decode_int(&ctx->fshift, ac, &bits, 15) < 0)
return -1;
bits &= 31U;
@ -728,7 +728,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
for (int i = 15; i < filt.size; i++)
sum += filt.coeffs[i] * (unsigned)src[-i];
sum = sum >> 6;
if (ctx->cmode == 0) {
if (ctx->qfactor == 0) {
if (bits == 0) {
ctx->buf1[off] = sum + val;
} else {
@ -737,7 +737,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
}
ctx->buf0[off] = ctx->buf1[off] + (unsigned)ctx->buf0[off + -1];
} else {
val *= 1U << ctx->cmode;
val *= 1U << ctx->qfactor;
sum += ctx->buf0[off + -1] + (unsigned)val;
switch (s->bps) {
case 16: sum = av_clip_int16(sum); break;
@ -748,12 +748,12 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns
m += (unsigned)FFABS(ctx->buf1[off]);
}
}
if (ctx->cmode2 != 0) {
if (ctx->vrq != 0) {
int sum = 0;
for (int i = (signed)((unsigned)m << 6) / split; i > 0; i = i >> 1)
sum++;
sum = sum - (ctx->cmode2 + 7);
ctx->cmode = FFMAX(sum, tab[ctx->cmode2]);
sum = sum - (ctx->vrq + 7);
ctx->qfactor = FFMAX(sum, tab[ctx->vrq]);
}
x += split;