History

avcodec/apedec: Fix 48khz 24bit below insane level

Fixes: Ticket9816 Fixes: vlc.ape and APE_48K_24bit_2CH_02_01.ape Regression since: ed0001482a74b60f3d5bc5cd7e304c9d65b2fcd5.

Michael Niedermayer committed 3 years ago

Commit 80ad0e21 parent 696e1611 file · +13 −4Browse files

Unified · Split

libavcodec/apedec.c+13−4
@@ -1184,7 +1184,8 @@ static void predictor_decode_mono_3930(APEContext *ctx, int count) · 1183 unmodified lines
1184static av_always_inline int predictor_update_filter(APEPredictor64 *p,1184static av_always_inline int predictor_update_filter(APEPredictor64 *p,
1185 const int decoded, const int filter,1185 const int decoded, const int filter,
1186 const int delayA, const int delayB,1186 const int delayA, const int delayB,
1187 const int adaptA, const int adaptB)1187 const int adaptA, const int adaptB,
1188 int compression_level)
1188{1189{
1189 int64_t predictionA, predictionB;1190 int64_t predictionA, predictionB;
1190 int32_t sign;1191 int32_t sign;
@@ -1212,7 +1213,13 @@ static av_always_inline int predictor_update_filter(APEPredictor64 *p, · 21 unmodified lines
1212 p->buf[delayB - 3] * p->coeffsB[filter][3] +1213 p->buf[delayB - 3] * p->coeffsB[filter][3] +
1213 p->buf[delayB - 4] * p->coeffsB[filter][4];1214 p->buf[delayB - 4] * p->coeffsB[filter][4];
1214 1215
1215 p->lastA[filter] = decoded + ((int64_t)((uint64_t)predictionA + (predictionB >> 1)) >> 10);1216 if (compression_level < COMPRESSION_LEVEL_INSANE) {
1217 predictionA = (int32_t)predictionA;
1218 predictionB = (int32_t)predictionB;
1219 p->lastA[filter] = decoded + ((int32_t)(predictionA + (predictionB >> 1)) >> 10);
1220 } else {
1221 p->lastA[filter] = decoded + ((int64_t)((uint64_t)predictionA + (predictionB >> 1)) >> 10);
1222 }
1216 p->filterA[filter] = p->lastA[filter] + ((int64_t)(p->filterA[filter] * 31ULL) >> 5);1223 p->filterA[filter] = p->lastA[filter] + ((int64_t)(p->filterA[filter] * 31ULL) >> 5);
1217 1224
1218 sign = APESIGN(decoded);1225 sign = APESIGN(decoded);
@@ -1240,10 +1247,12 @@ static void predictor_decode_stereo_3950(APEContext *ctx, int count) · 21 unmodified lines
1240 while (count--) {1247 while (count--) {
1241 /* Predictor Y */1248 /* Predictor Y */
1242 *decoded0 = predictor_update_filter(p, *decoded0, 0, YDELAYA, YDELAYB,1249 *decoded0 = predictor_update_filter(p, *decoded0, 0, YDELAYA, YDELAYB,
1243 YADAPTCOEFFSA, YADAPTCOEFFSB);1250 YADAPTCOEFFSA, YADAPTCOEFFSB,
1251 ctx->compression_level);
1244 decoded0++;1252 decoded0++;
1245 *decoded1 = predictor_update_filter(p, *decoded1, 1, XDELAYA, XDELAYB,1253 *decoded1 = predictor_update_filter(p, *decoded1, 1, XDELAYA, XDELAYB,
1246 XADAPTCOEFFSA, XADAPTCOEFFSB);1254 XADAPTCOEFFSA, XADAPTCOEFFSB,
1255 ctx->compression_level);
1247 decoded1++;1256 decoded1++;
1248 1257
1249 /* Combined */1258 /* Combined */

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