From: Mark Thompson <[email protected]>
Fault introduced in f3fdef108eb06b1e71b29152bf6822519e787efe
Use a straightforward expression instead of using bitmasks.
---
Your way seems fine to me.
libavcodec/apedec.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 85d26ae..a85ca9e 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1304,11 +1304,17 @@ static void do_apply_filter(APEContext *ctx, int
version, APEFilter *f,
/* Update the adaption coefficients */
absres = FFABS(res);
- if (absres)
- *f->adaptcoeffs = ((res & ((~0UL) << 31)) ^ ((~0UL) << 30)) >>
- (25 + (absres <= f->avg*3) + (absres <=
f->avg*4/3));
- else
+
+ if (absres) {
+ if (absres <= f->avg * 4 / 3)
+ *f->adaptcoeffs = -FFSIGN(res) * 8;
+ else if (absres <= f->avg * 3)
+ *f->adaptcoeffs = -FFSIGN(res) * 16;
+ else
+ *f->adaptcoeffs = -FFSIGN(res) * 32;
+ } else {
*f->adaptcoeffs = 0;
+ }
f->avg += (absres - f->avg) / 16;
--
2.6.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel