History

avcodec/rka: rename variable to something more representative

Paul B Mahol committed 3 years ago

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

Unified · Split

libavcodec/rka.c+15−15
@@ -59,8 +59,8 @@ typedef struct AdaptiveModel { · 58 unmodified lines
59} AdaptiveModel;59} AdaptiveModel;
60 60
61typedef struct ChContext {61typedef struct ChContext {
62 int cmode;62 int qfactor;
63 int cmode2;63 int vrq;
64 int last_nb_decoded;64 int last_nb_decoded;
65 unsigned srate_pad;65 unsigned srate_pad;
66 unsigned pos_idx;66 unsigned pos_idx;
@@ -131,7 +131,7 @@ static void adaptive_model_free(AdaptiveModel *am) · 64 unmodified lines
131static av_cold int rka_decode_init(AVCodecContext *avctx)131static av_cold int rka_decode_init(AVCodecContext *avctx)
132{132{
133 RKAContext *s = avctx->priv_data;133 RKAContext *s = avctx->priv_data;
134 int cmode;134 int qfactor;
135 135
136 if (avctx->extradata_size < 16)136 if (avctx->extradata_size < 16)
137 return AVERROR_INVALIDDATA;137 return AVERROR_INVALIDDATA;
@@ -160,14 +160,14 @@ static av_cold int rka_decode_init(AVCodecContext *avctx) · 22 unmodified lines
160 s->last_nb_samples = s->total_nb_samples % s->frame_samples;160 s->last_nb_samples = s->total_nb_samples % s->frame_samples;
161 s->correlated = avctx->extradata[15] & 1;161 s->correlated = avctx->extradata[15] & 1;
162 162
163 cmode = avctx->extradata[14] & 0xf;163 qfactor = avctx->extradata[14] & 0xf;
164 if ((avctx->extradata[15] & 4) != 0)164 if ((avctx->extradata[15] & 4) != 0)
165 cmode = -cmode;165 qfactor = -qfactor;
166 166
167 s->ch[0].cmode = s->ch[1].cmode = cmode < 0 ? 2 : cmode;167 s->ch[0].qfactor = s->ch[1].qfactor = qfactor < 0 ? 2 : qfactor;
168 s->ch[0].cmode2 = cmode < 0 ? FFABS(cmode) : 0;168 s->ch[0].vrq = qfactor < 0 ? FFABS(qfactor) : 0;
169 s->ch[1].cmode2 = cmode < 0 ? FFABS(cmode) : 0;169 s->ch[1].vrq = qfactor < 0 ? FFABS(qfactor) : 0;
170 av_log(avctx, AV_LOG_DEBUG, "cmode: %d\n", cmode);170 av_log(avctx, AV_LOG_DEBUG, "qfactor: %d\n", qfactor);
171 171
172 return 0;172 return 0;
173}173}
@@ -676,7 +676,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns · 502 unmodified lines
676 int m = 0, split, val, last_val = 0, ret;676 int m = 0, split, val, last_val = 0, ret;
677 unsigned idx = 3, bits = 0;677 unsigned idx = 3, bits = 0;
678 678
679 if (ctx->cmode == 0) {679 if (ctx->qfactor == 0) {
680 if (amdl_decode_int(&ctx->fshift, ac, &bits, 15) < 0)680 if (amdl_decode_int(&ctx->fshift, ac, &bits, 15) < 0)
681 return -1;681 return -1;
682 bits &= 31U;682 bits &= 31U;
@@ -728,7 +728,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns · 45 unmodified lines
728 for (int i = 15; i < filt.size; i++)728 for (int i = 15; i < filt.size; i++)
729 sum += filt.coeffs[i] * (unsigned)src[-i];729 sum += filt.coeffs[i] * (unsigned)src[-i];
730 sum = sum >> 6;730 sum = sum >> 6;
731 if (ctx->cmode == 0) {731 if (ctx->qfactor == 0) {
732 if (bits == 0) {732 if (bits == 0) {
733 ctx->buf1[off] = sum + val;733 ctx->buf1[off] = sum + val;
734 } else {734 } else {
@@ -737,7 +737,7 @@ static int decode_filter(RKAContext *s, ChContext *ctx, ACoder *ac, int off, uns · 2 unmodified lines
737 }737 }
738 ctx->buf0[off] = ctx->buf1[off] + (unsigned)ctx->buf0[off + -1];738 ctx->buf0[off] = ctx->buf1[off] + (unsigned)ctx->buf0[off + -1];
739 } else {739 } else {
740 val *= 1U << ctx->cmode;740 val *= 1U << ctx->qfactor;
741 sum += ctx->buf0[off + -1] + (unsigned)val;741 sum += ctx->buf0[off + -1] + (unsigned)val;
742 switch (s->bps) {742 switch (s->bps) {
743 case 16: sum = av_clip_int16(sum); break;743 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
748 m += (unsigned)FFABS(ctx->buf1[off]);748 m += (unsigned)FFABS(ctx->buf1[off]);
749 }749 }
750 }750 }
751 if (ctx->cmode2 != 0) {751 if (ctx->vrq != 0) {
752 int sum = 0;752 int sum = 0;
753 for (int i = (signed)((unsigned)m << 6) / split; i > 0; i = i >> 1)753 for (int i = (signed)((unsigned)m << 6) / split; i > 0; i = i >> 1)
754 sum++;754 sum++;
755 sum = sum - (ctx->cmode2 + 7);755 sum = sum - (ctx->vrq + 7);
756 ctx->cmode = FFMAX(sum, tab[ctx->cmode2]);756 ctx->qfactor = FFMAX(sum, tab[ctx->vrq]);
757 }757 }
758 758
759 x += split;759 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