summaryrefslogtreecommitdiff
path: root/libavcodec/proresenc_kostya.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2015-04-21 22:28:21 -0300
committerJames Almer <jamrial@gmail.com>2015-04-21 22:41:20 -0300
commitba625dd8a12b8f440af7f50c833e5c1005d67c85 (patch)
tree866b471ad22b28d6b5e74e94e9c8f78fb8b1d040 /libavcodec/proresenc_kostya.c
parent4f287a3c5007db853e4f1098ab194f9337e2f7da (diff)
downloadffmpeg-ba625dd8a12b8f440af7f50c833e5c1005d67c85.tar.gz
avcodec: use av_mod_uintp2() where useful
Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/proresenc_kostya.c')
-rw-r--r--libavcodec/proresenc_kostya.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 440cc8b48a..a2a8d73c0b 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -440,12 +440,11 @@ static int encode_slice_plane(ProresContext *ctx, PutBitContext *pb,
static void put_alpha_diff(PutBitContext *pb, int cur, int prev, int abits)
{
- const int mask = (1 << abits) - 1;
const int dbits = (abits == 8) ? 4 : 7;
const int dsize = 1 << dbits - 1;
int diff = cur - prev;
- diff &= mask;
+ diff = av_mod_uintp2(diff, abits);
if (diff >= (1 << abits) - dsize)
diff -= 1 << abits;
if (diff < -dsize || diff > dsize || !diff) {
@@ -689,12 +688,11 @@ static int estimate_slice_plane(ProresContext *ctx, int *error, int plane,
static int est_alpha_diff(int cur, int prev, int abits)
{
- const int mask = (1 << abits) - 1;
const int dbits = (abits == 8) ? 4 : 7;
const int dsize = 1 << dbits - 1;
int diff = cur - prev;
- diff &= mask;
+ diff = av_mod_uintp2(diff, abits);
if (diff >= (1 << abits) - dsize)
diff -= 1 << abits;
if (diff < -dsize || diff > dsize || !diff)