diff options
author | James Almer <jamrial@gmail.com> | 2015-04-21 22:28:21 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2015-04-21 22:41:20 -0300 |
commit | ba625dd8a12b8f440af7f50c833e5c1005d67c85 (patch) | |
tree | 866b471ad22b28d6b5e74e94e9c8f78fb8b1d040 /libavcodec/proresenc_kostya.c | |
parent | 4f287a3c5007db853e4f1098ab194f9337e2f7da (diff) | |
download | ffmpeg-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.c | 6 |
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) |