summaryrefslogtreecommitdiff
path: root/libavcodec/hevc.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/hevc.c
parent4f287a3c5007db853e4f1098ab194f9337e2f7da (diff)
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/hevc.c')
-rw-r--r--libavcodec/hevc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 926a19e9d2..544854ffc4 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -1461,8 +1461,8 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0,
int idx = ff_hevc_pel_weight[block_w];
int hshift = s->sps->hshift[1];
int vshift = s->sps->vshift[1];
- intptr_t mx = mv->x & ((1 << (2 + hshift)) - 1);
- intptr_t my = mv->y & ((1 << (2 + vshift)) - 1);
+ intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift);
+ intptr_t my = av_mod_uintp2(mv->y, 2 + vshift);
intptr_t _mx = mx << (1 - hshift);
intptr_t _my = my << (1 - vshift);
@@ -1530,10 +1530,10 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF
int hshift = s->sps->hshift[1];
int vshift = s->sps->vshift[1];
- intptr_t mx0 = mv0->x & ((1 << (2 + hshift)) - 1);
- intptr_t my0 = mv0->y & ((1 << (2 + vshift)) - 1);
- intptr_t mx1 = mv1->x & ((1 << (2 + hshift)) - 1);
- intptr_t my1 = mv1->y & ((1 << (2 + vshift)) - 1);
+ intptr_t mx0 = av_mod_uintp2(mv0->x, 2 + hshift);
+ intptr_t my0 = av_mod_uintp2(mv0->y, 2 + vshift);
+ intptr_t mx1 = av_mod_uintp2(mv1->x, 2 + hshift);
+ intptr_t my1 = av_mod_uintp2(mv1->y, 2 + vshift);
intptr_t _mx0 = mx0 << (1 - hshift);
intptr_t _my0 = my0 << (1 - vshift);
intptr_t _mx1 = mx1 << (1 - hshift);
@@ -1791,8 +1791,8 @@ static int luma_intra_pred_mode(HEVCContext *s, int x0, int y0, int pu_size,
int y_pu = y0 >> s->sps->log2_min_pu_size;
int min_pu_width = s->sps->min_pu_width;
int size_in_pus = pu_size >> s->sps->log2_min_pu_size;
- int x0b = x0 & ((1 << s->sps->log2_ctb_size) - 1);
- int y0b = y0 & ((1 << s->sps->log2_ctb_size) - 1);
+ int x0b = av_mod_uintp2(x0, s->sps->log2_ctb_size);
+ int y0b = av_mod_uintp2(y0, s->sps->log2_ctb_size);
int cand_up = (lc->ctb_up_flag || y0b) ?
s->tab_ipm[(y_pu - 1) * min_pu_width + x_pu] : INTRA_DC;