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