History

avcodec/rka: rename variable to something more representative

Paul B Mahol committed 3 years ago

Commit 8bfadac1 parent 2cb24651 file · +15 −15Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/rka.c+15−15
@@ -59,8 +59,8 @@ typedef struct AdaptiveModel { · 58 unmodified lines
5959 } AdaptiveModel;
6060
6161 typedef struct ChContext {
62− int cmode;
63− int cmode2;
62+ int qfactor;
63+ int vrq;
6464 int last_nb_decoded;
6565 unsigned srate_pad;
6666 unsigned pos_idx;
@@ -131,7 +131,7 @@ static void adaptive_model_free(AdaptiveModel *am) · 64 unmodified lines
131131 static av_cold int rka_decode_init(AVCodecContext *avctx)
132132 {
133133 RKAContext *s = avctx->priv_data;
134− int cmode;
134+ int qfactor;
135135
136136 if (avctx->extradata_size < 16)
137137 return AVERROR_INVALIDDATA;
@@ -160,14 +160,14 @@ static av_cold int rka_decode_init(AVCodecContext *avctx) · 22 unmodified lines
160160 s->last_nb_samples = s->total_nb_samples % s->frame_samples;
161161 s->correlated = avctx->extradata[15] & 1;
162162
163− cmode = avctx->extradata[14] & 0xf;
163+ qfactor = avctx->extradata[14] & 0xf;
164164 if ((avctx->extradata[15] & 4) != 0)
165− cmode = -cmode;
165+ qfactor = -qfactor;
166166
167− s->ch[0].cmode = s->ch[1].cmode = cmode < 0 ? 2 : cmode;
168− s->ch[0].cmode2 = cmode < 0 ? FFABS(cmode) : 0;
169− s->ch[1].cmode2 = cmode < 0 ? FFABS(cmode) : 0;
170− av_log(avctx, AV_LOG_DEBUG, "cmode: %d\n", cmode);
167+ s->ch[0].qfactor = s->ch[1].qfactor = qfactor < 0 ? 2 : qfactor;
168+ s->ch[0].vrq = qfactor < 0 ? FFABS(qfactor) : 0;
169+ s->ch[1].vrq = qfactor < 0 ? FFABS(qfactor) : 0;
170+ av_log(avctx, AV_LOG_DEBUG, "qfactor: %d\n", qfactor);
171171
172172 return 0;
173173 }
@@ -676,7 +676,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns · 502 unmodified lines
676676 int m = 0, split, val, last_val = 0, ret;
677677 unsigned idx = 3, bits = 0;
678678
679− if (ctx->cmode == 0) {
679+ if (ctx->qfactor == 0) {
680680 if (amdl_decode_int(&ctx->fshift, ac, &bits, 15) < 0)
681681 return -1;
682682 bits &= 31U;
@@ -728,7 +728,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns · 45 unmodified lines
728728 for (int i = 15; i < filt.size; i++)
729729 sum += filt.coeffs[i] * (unsigned)src[-i];
730730 sum = sum >> 6;
731− if (ctx->cmode == 0) {
731+ if (ctx->qfactor == 0) {
732732 if (bits == 0) {
733733 ctx->buf1[off] = sum + val;
734734 } else {
@@ -737,7 +737,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns · 2 unmodified lines
737737 }
738738 ctx->buf0[off] = ctx->buf1[off] + (unsigned)ctx->buf0[off + -1];
739739 } else {
740− val *= 1U << ctx->cmode;
740+ val *= 1U << ctx->qfactor;
741741 sum += ctx->buf0[off + -1] + (unsigned)val;
742742 switch (s->bps) {
743743 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 · 4 unmodified lines
748748 m += (unsigned)FFABS(ctx->buf1[off]);
749749 }
750750 }
751− if (ctx->cmode2 != 0) {
751+ if (ctx->vrq != 0) {
752752 int sum = 0;
753753 for (int i = (signed)((unsigned)m << 6) / split; i > 0; i = i >> 1)
754754 sum++;
755− sum = sum - (ctx->cmode2 + 7);
756− ctx->cmode = FFMAX(sum, tab[ctx->cmode2]);
755+ sum = sum - (ctx->vrq + 7);
756+ ctx->qfactor = FFMAX(sum, tab[ctx->vrq]);
757757 }
758758
759759 x += split;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t