diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 87bfe7b811..5fdbac8d44 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -312,7 +312,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, filter->shift, filter->round); // fixed order prediction -#define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k) +#define PRED(x, k) (int32_t)((((uint64_t)(x) << (k)) - (x)) >> (k)) switch (s->bps) { case 1: *p += PRED(*predictor, 4); break; case 2: diff --git a/libavcodec/ttaenc.c b/libavcodec/ttaenc.c index 75d16642ea..ccd41a90c9 100644 --- a/libavcodec/ttaenc.c +++ b/libavcodec/ttaenc.c @@ -144,7 +144,7 @@ static int tta_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } temp = value; -#define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k) +#define PRED(x, k) (int32_t)((((uint64_t)(x) << (k)) - (x)) >> (k)) switch (s->bps) { case 1: value -= PRED(c->predictor, 4); break; case 2: