aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/apedec.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-10-06 01:24:42 +0200
committerPaul B Mahol <onemda@gmail.com>2020-10-12 12:20:26 +0200
commitea0972f6dd3ad51451b8acb9797364eddfecada5 (patch)
tree5fdbe0ea852e31a7c14db6c0a9ce8bf2a9178185 /libavcodec/apedec.c
parented0001482a74b60f3d5bc5cd7e304c9d65b2fcd5 (diff)
downloadffmpeg-ea0972f6dd3ad51451b8acb9797364eddfecada5.tar.gz
avcodec/apedec: properly calculate and store absolute value
Diffstat (limited to 'libavcodec/apedec.c')
-rw-r--r--libavcodec/apedec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 273abe2490..aa4d8fa524 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1311,7 +1311,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
int32_t *data, int count, int order, int fracbits)
{
int res;
- int absres;
+ unsigned absres;
while (count--) {
/* round fixedpoint scalar product */
@@ -1335,7 +1335,7 @@ static void do_apply_filter(APEContext *ctx, int version, APEFilter *f,
/* Version 3.98 and later files */
/* Update the adaption coefficients */
- absres = res < 0 ? -(unsigned)res : res;
+ absres = FFABS(res);
if (absres)
*f->adaptcoeffs = APESIGN(res) *
(8 << ((absres > f->avg * 3) + (absres > f->avg * 4 / 3)));