[FFmpeg-devel] [PATCH] avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPAT

Derek Buitenhuis derek.buitenhuis at gmail.com
Wed Jan 27 16:21:34 CET 2016


Libav, for some reason, merged this as a public API function. This will
aid in future merges.

A define is left for backwards compat, just in case some person
used it, since it is in a public header.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
---
 libavcodec/asvenc.c               |  8 ++++----
 libavcodec/ffv1dec.c              |  4 ++--
 libavcodec/ffv1enc.c              |  4 ++--
 libavcodec/h263dec.c              |  4 ++--
 libavcodec/h264_slice.c           |  6 +++---
 libavcodec/libwebpenc_common.c    |  8 ++++----
 libavcodec/libx264.c              |  2 +-
 libavcodec/mimic.c                |  2 +-
 libavcodec/mjpegdec.c             | 16 ++++++++--------
 libavcodec/mpegvideo.c            | 12 ++++++------
 libavcodec/smvjpegdec.c           |  2 +-
 libavcodec/snow.c                 | 12 ++++++------
 libavcodec/snowenc.c              |  6 +++---
 libavcodec/txd.c                  |  4 ++--
 libavcodec/utils.c                | 12 ++++++------
 libavdevice/opengl_enc.c          | 12 ++++++------
 libavfilter/deshake_opencl.c      |  2 +-
 libavfilter/drawutils.c           | 18 +++++++++---------
 libavfilter/framepool.c           |  2 +-
 libavfilter/unsharp_opencl.c      |  6 +++---
 libavfilter/vf_atadenoise.c       |  4 ++--
 libavfilter/vf_blend.c            |  4 ++--
 libavfilter/vf_boxblur.c          |  2 +-
 libavfilter/vf_codecview.c        |  4 ++--
 libavfilter/vf_convolution.c      |  2 +-
 libavfilter/vf_cover_rect.c       | 12 ++++++------
 libavfilter/vf_deband.c           |  4 ++--
 libavfilter/vf_decimate.c         |  4 ++--
 libavfilter/vf_delogo.c           |  8 ++++----
 libavfilter/vf_deshake.c          |  4 ++--
 libavfilter/vf_detelecine.c       |  2 +-
 libavfilter/vf_displace.c         |  4 ++--
 libavfilter/vf_eq.c               |  4 ++--
 libavfilter/vf_extractplanes.c    |  4 ++--
 libavfilter/vf_fade.c             |  4 ++--
 libavfilter/vf_fftfilt.c          |  4 ++--
 libavfilter/vf_fieldmatch.c       |  8 ++++----
 libavfilter/vf_framepack.c        |  4 ++--
 libavfilter/vf_fspp.c             | 10 +++++-----
 libavfilter/vf_geq.c              |  8 ++++----
 libavfilter/vf_gradfun.c          |  4 ++--
 libavfilter/vf_hflip.c            |  4 ++--
 libavfilter/vf_histogram.c        |  8 ++++----
 libavfilter/vf_hqdn3d.c           |  4 ++--
 libavfilter/vf_hue.c              |  4 ++--
 libavfilter/vf_idet.c             |  4 ++--
 libavfilter/vf_il.c               |  2 +-
 libavfilter/vf_interlace.c        |  2 +-
 libavfilter/vf_kerndeint.c        |  2 +-
 libavfilter/vf_lut.c              |  8 ++++----
 libavfilter/vf_maskedmerge.c      |  4 ++--
 libavfilter/vf_mcdeint.c          |  4 ++--
 libavfilter/vf_mergeplanes.c      |  8 ++++----
 libavfilter/vf_mpdecimate.c       |  4 ++--
 libavfilter/vf_neighbor.c         |  2 +-
 libavfilter/vf_noise.c            |  2 +-
 libavfilter/vf_overlay.c          |  8 ++++----
 libavfilter/vf_owdenoise.c        |  4 ++--
 libavfilter/vf_perspective.c      |  2 +-
 libavfilter/vf_phase.c            |  2 +-
 libavfilter/vf_pixdesctest.c      |  4 ++--
 libavfilter/vf_pp7.c              |  4 ++--
 libavfilter/vf_psnr.c             |  4 ++--
 libavfilter/vf_pullup.c           |  4 ++--
 libavfilter/vf_removegrain.c      |  4 ++--
 libavfilter/vf_repeatfields.c     |  2 +-
 libavfilter/vf_rotate.c           |  8 ++++----
 libavfilter/vf_sab.c              |  8 ++++----
 libavfilter/vf_showinfo.c         |  2 +-
 libavfilter/vf_signalstats.c      |  4 ++--
 libavfilter/vf_smartblur.c        |  8 ++++----
 libavfilter/vf_spp.c              |  8 ++++----
 libavfilter/vf_ssim.c             |  4 ++--
 libavfilter/vf_stack.c            |  2 +-
 libavfilter/vf_stereo3d.c         | 10 +++++-----
 libavfilter/vf_telecine.c         |  2 +-
 libavfilter/vf_tinterlace.c       |  6 +++---
 libavfilter/vf_transpose.c        |  6 +++---
 libavfilter/vf_unsharp.c          |  6 +++---
 libavfilter/vf_uspp.c             | 20 ++++++++++----------
 libavfilter/vf_vectorscope.c      |  4 ++--
 libavfilter/vf_vflip.c            |  4 ++--
 libavfilter/vf_vignette.c         |  4 ++--
 libavfilter/vf_w3fdif.c           |  2 +-
 libavfilter/vf_waveform.c         | 28 ++++++++++++++--------------
 libavfilter/vf_yadif.c            |  4 ++--
 libavfilter/vf_zoompan.c          |  4 ++--
 libavfilter/vsrc_mptestsrc.c      |  2 +-
 libavfilter/vsrc_testsrc.c        |  4 ++--
 libavformat/img2enc.c             |  2 +-
 libavformat/rtpenc_jpeg.c         |  4 ++--
 libavformat/uncodedframecrcenc.c  |  2 +-
 libavformat/yuv4mpegenc.c         |  4 ++--
 libavutil/common.h                |  4 +++-
 libavutil/frame.c                 |  2 +-
 libavutil/imgutils.c              |  2 +-
 libswscale/alphablend.c           |  2 +-
 libswscale/hscale.c               |  6 +++---
 libswscale/rgb2rgb_template.c     |  8 ++++----
 libswscale/swscale.c              |  8 ++++----
 libswscale/swscale_unscaled.c     |  6 +++---
 libswscale/utils.c                | 10 +++++-----
 libswscale/vscale.c               |  2 +-
 libswscale/x86/rgb2rgb_template.c |  8 ++++----
 104 files changed, 284 insertions(+), 282 deletions(-)

diff --git a/libavcodec/asvenc.c b/libavcodec/asvenc.c
index d51df80..ec98a0c 100644
--- a/libavcodec/asvenc.c
+++ b/libavcodec/asvenc.c
@@ -245,10 +245,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 
         for (i = 0; i<3; i++) {
             int x, y;
-            int w  = FF_CEIL_RSHIFT(pict->width, !!i);
-            int h  = FF_CEIL_RSHIFT(pict->height, !!i);
-            int w2 = FF_CEIL_RSHIFT(clone->width, !!i);
-            int h2 = FF_CEIL_RSHIFT(clone->height, !!i);
+            int w  = AV_CEIL_RSHIFT(pict->width, !!i);
+            int h  = AV_CEIL_RSHIFT(pict->height, !!i);
+            int w2 = AV_CEIL_RSHIFT(clone->width, !!i);
+            int h2 = AV_CEIL_RSHIFT(clone->height, !!i);
             for (y=0; y<h; y++)
                 for (x=w; x<w2; x++)
                     clone->data[i][x + y*clone->linesize[i]] =
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 5f13df8..d2bf3a8 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -435,8 +435,8 @@ static int decode_slice(AVCodecContext *c, void *arg)
 
     av_assert1(width && height);
     if (f->colorspace == 0 && (f->chroma_planes || !fs->transparency)) {
-        const int chroma_width  = FF_CEIL_RSHIFT(width,  f->chroma_h_shift);
-        const int chroma_height = FF_CEIL_RSHIFT(height, f->chroma_v_shift);
+        const int chroma_width  = AV_CEIL_RSHIFT(width,  f->chroma_h_shift);
+        const int chroma_height = AV_CEIL_RSHIFT(height, f->chroma_v_shift);
         const int cx            = x >> f->chroma_h_shift;
         const int cy            = y >> f->chroma_v_shift;
         decode_plane(fs, p->data[0] + ps*x + y*p->linesize[0], width, height, p->linesize[0], 0, 1);
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 0e88921..4de2934 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1176,8 +1176,8 @@ retry:
     }
 
     if (f->colorspace == 0 && c->pix_fmt != AV_PIX_FMT_YA8) {
-        const int chroma_width  = FF_CEIL_RSHIFT(width,  f->chroma_h_shift);
-        const int chroma_height = FF_CEIL_RSHIFT(height, f->chroma_v_shift);
+        const int chroma_width  = AV_CEIL_RSHIFT(width,  f->chroma_h_shift);
+        const int chroma_height = AV_CEIL_RSHIFT(height, f->chroma_v_shift);
         const int cx            = x >> f->chroma_h_shift;
         const int cy            = y >> f->chroma_v_shift;
 
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index ca7e5eb..628546b 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -699,8 +699,8 @@ frame_end:
             int x, y, p;
             av_frame_make_writable(pict);
             for (p=0; p<3; p++) {
-                int w = FF_CEIL_RSHIFT(pict-> width, !!p);
-                int h = FF_CEIL_RSHIFT(pict->height, !!p);
+                int w = AV_CEIL_RSHIFT(pict-> width, !!p);
+                int h = AV_CEIL_RSHIFT(pict->height, !!p);
                 int linesize = pict->linesize[p];
                 for (y=0; y<(h>>1); y++)
                     for (x=0; x<w; x++)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 1ac0059..6395cee 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -251,11 +251,11 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
         av_pix_fmt_get_chroma_sub_sample(pic->f->format,
                                          &h_chroma_shift, &v_chroma_shift);
 
-        for(i=0; i<FF_CEIL_RSHIFT(pic->f->height, v_chroma_shift); i++) {
+        for(i=0; i<AV_CEIL_RSHIFT(pic->f->height, v_chroma_shift); i++) {
             memset(pic->f->data[1] + pic->f->linesize[1]*i,
-                   0x80, FF_CEIL_RSHIFT(pic->f->width, h_chroma_shift));
+                   0x80, AV_CEIL_RSHIFT(pic->f->width, h_chroma_shift));
             memset(pic->f->data[2] + pic->f->linesize[2]*i,
-                   0x80, FF_CEIL_RSHIFT(pic->f->width, h_chroma_shift));
+                   0x80, AV_CEIL_RSHIFT(pic->f->width, h_chroma_shift));
         }
     }
 
diff --git a/libavcodec/libwebpenc_common.c b/libavcodec/libwebpenc_common.c
index a76b6da..21d7ada 100644
--- a/libavcodec/libwebpenc_common.c
+++ b/libavcodec/libwebpenc_common.c
@@ -167,8 +167,8 @@ int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s,
                         int sse = 0;
                         for (p = 0; p < 3; p++) {
                             int bs2 = bs >> !!p;
-                            int w = FF_CEIL_RSHIFT(frame->width , !!p);
-                            int h = FF_CEIL_RSHIFT(frame->height, !!p);
+                            int w = AV_CEIL_RSHIFT(frame->width , !!p);
+                            int h = AV_CEIL_RSHIFT(frame->height, !!p);
                             int xs = x >> !!p;
                             int ys = y >> !!p;
                             for (y2 = ys; y2 < FFMIN(ys + bs2, h); y2++) {
@@ -183,8 +183,8 @@ int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s,
                         if (!skip)
                             for (p = 0; p < 3; p++) {
                                 int bs2 = bs >> !!p;
-                                int w = FF_CEIL_RSHIFT(frame->width , !!p);
-                                int h = FF_CEIL_RSHIFT(frame->height, !!p);
+                                int w = AV_CEIL_RSHIFT(frame->width , !!p);
+                                int h = AV_CEIL_RSHIFT(frame->height, !!p);
                                 int xs = x >> !!p;
                                 int ys = y >> !!p;
                                 for (y2 = ys; y2 < FFMIN(ys + bs2, h); y2++) {
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 88406a3..0c3ebd5 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -552,7 +552,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
         x4->params.i_frame_reference    = avctx->refs;
     else if (x4->level) {
         int i;
-        int mbn = FF_CEIL_RSHIFT(avctx->width, 4) * FF_CEIL_RSHIFT(avctx->height, 4);
+        int mbn = AV_CEIL_RSHIFT(avctx->width, 4) * AV_CEIL_RSHIFT(avctx->height, 4);
         int level_id = -1;
         char *tail;
         int scale = X264_BUILD < 129 ? 384 : 1;
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index d4959ea..06fb393 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -395,7 +395,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
         avctx->height  = height;
         avctx->pix_fmt = AV_PIX_FMT_YUV420P;
         for (i = 0; i < 3; i++) {
-            ctx->num_vblocks[i] = FF_CEIL_RSHIFT(height,   3 + !!i);
+            ctx->num_vblocks[i] = AV_CEIL_RSHIFT(height,   3 + !!i);
             ctx->num_hblocks[i] =                width >> (3 + !!i);
         }
     } else if (width != ctx->avctx->width || height != ctx->avctx->height) {
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index a51c580..77a1ac2 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1266,8 +1266,8 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah,
 
     av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &chroma_h_shift,
                                      &chroma_v_shift);
-    chroma_width  = FF_CEIL_RSHIFT(s->width,  chroma_h_shift);
-    chroma_height = FF_CEIL_RSHIFT(s->height, chroma_v_shift);
+    chroma_width  = AV_CEIL_RSHIFT(s->width,  chroma_h_shift);
+    chroma_height = AV_CEIL_RSHIFT(s->height, chroma_v_shift);
 
     for (i = 0; i < nb_components; i++) {
         int c   = s->comp_index[i];
@@ -2241,8 +2241,8 @@ the_end:
             if (!s->upscale_h[p])
                 continue;
             if (p==1 || p==2) {
-                w = FF_CEIL_RSHIFT(w, hshift);
-                h = FF_CEIL_RSHIFT(h, vshift);
+                w = AV_CEIL_RSHIFT(w, hshift);
+                h = AV_CEIL_RSHIFT(h, vshift);
             }
             if (s->upscale_v[p])
                 h = (h+1)>>1;
@@ -2299,8 +2299,8 @@ the_end:
             if (!s->upscale_v[p])
                 continue;
             if (p==1 || p==2) {
-                w = FF_CEIL_RSHIFT(w, hshift);
-                h = FF_CEIL_RSHIFT(h, vshift);
+                w = AV_CEIL_RSHIFT(w, hshift);
+                h = AV_CEIL_RSHIFT(h, vshift);
             }
             dst = &((uint8_t *)s->picture_ptr->data[p])[(h - 1) * s->linesize[p]];
             for (i = h - 1; i; i--) {
@@ -2324,8 +2324,8 @@ the_end:
             int w = s->picture_ptr->width;
             int h = s->picture_ptr->height;
             if(index && index<3){
-                w = FF_CEIL_RSHIFT(w, hshift);
-                h = FF_CEIL_RSHIFT(h, vshift);
+                w = AV_CEIL_RSHIFT(w, hshift);
+                h = AV_CEIL_RSHIFT(h, vshift);
             }
             if(dst){
                 uint8_t *dst2 = dst + s->picture_ptr->linesize[index]*(h-1);
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 6d9e265..16ec875 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1175,11 +1175,11 @@ static void gray_frame(AVFrame *frame)
 
     for(i=0; i<frame->height; i++)
         memset(frame->data[0] + frame->linesize[0]*i, 0x80, frame->width);
-    for(i=0; i<FF_CEIL_RSHIFT(frame->height, v_chroma_shift); i++) {
+    for(i=0; i<AV_CEIL_RSHIFT(frame->height, v_chroma_shift); i++) {
         memset(frame->data[1] + frame->linesize[1]*i,
-               0x80, FF_CEIL_RSHIFT(frame->width, h_chroma_shift));
+               0x80, AV_CEIL_RSHIFT(frame->width, h_chroma_shift));
         memset(frame->data[2] + frame->linesize[2]*i,
-               0x80, FF_CEIL_RSHIFT(frame->width, h_chroma_shift));
+               0x80, AV_CEIL_RSHIFT(frame->width, h_chroma_shift));
     }
 }
 
@@ -1323,11 +1323,11 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
                 memset(s->last_picture_ptr->f->data[0] + s->last_picture_ptr->f->linesize[0]*i,
                        0x80, avctx->width);
             if (s->last_picture_ptr->f->data[2]) {
-                for(i=0; i<FF_CEIL_RSHIFT(avctx->height, v_chroma_shift); i++) {
+                for(i=0; i<AV_CEIL_RSHIFT(avctx->height, v_chroma_shift); i++) {
                     memset(s->last_picture_ptr->f->data[1] + s->last_picture_ptr->f->linesize[1]*i,
-                        0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
+                        0x80, AV_CEIL_RSHIFT(avctx->width, h_chroma_shift));
                     memset(s->last_picture_ptr->f->data[2] + s->last_picture_ptr->f->linesize[2]*i,
-                        0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
+                        0x80, AV_CEIL_RSHIFT(avctx->width, h_chroma_shift));
                 }
             }
 
diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
index 9c2fb38..9057e86 100644
--- a/libavcodec/smvjpegdec.c
+++ b/libavcodec/smvjpegdec.c
@@ -65,7 +65,7 @@ static inline void smv_img_pnt(uint8_t *dst_data[4], uint8_t *src_data[4],
     for (i = 0; i < planes_nb; i++) {
         int h = height;
         if (i == 1 || i == 2) {
-            h = FF_CEIL_RSHIFT(height, desc->log2_chroma_h);
+            h = AV_CEIL_RSHIFT(height, desc->log2_chroma_h);
         }
         smv_img_pnt_plane(&dst_data[i], src_data[i],
             src_linesizes[i], h, nlines);
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index fc2e727..a3e6afc 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -108,8 +108,8 @@ void ff_snow_reset_contexts(SnowContext *s){ //FIXME better initial contexts
 }
 
 int ff_snow_alloc_blocks(SnowContext *s){
-    int w= FF_CEIL_RSHIFT(s->avctx->width,  LOG2_MB_SIZE);
-    int h= FF_CEIL_RSHIFT(s->avctx->height, LOG2_MB_SIZE);
+    int w= AV_CEIL_RSHIFT(s->avctx->width,  LOG2_MB_SIZE);
+    int h= AV_CEIL_RSHIFT(s->avctx->height, LOG2_MB_SIZE);
 
     s->b_width = w;
     s->b_height= h;
@@ -535,8 +535,8 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) {
         int h= s->avctx->height;
 
         if(plane_index){
-            w = FF_CEIL_RSHIFT(w, s->chroma_h_shift);
-            h = FF_CEIL_RSHIFT(h, s->chroma_v_shift);
+            w = AV_CEIL_RSHIFT(w, s->chroma_h_shift);
+            h = AV_CEIL_RSHIFT(h, s->chroma_v_shift);
         }
         s->plane[plane_index].width = w;
         s->plane[plane_index].height= h;
@@ -590,8 +590,8 @@ static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *fra
 
     for(p=0; p < s->nb_planes; p++){
         int is_chroma= !!p;
-        int w= is_chroma ? FF_CEIL_RSHIFT(s->avctx->width,  s->chroma_h_shift) : s->avctx->width;
-        int h= is_chroma ? FF_CEIL_RSHIFT(s->avctx->height, s->chroma_v_shift) : s->avctx->height;
+        int w= is_chroma ? AV_CEIL_RSHIFT(s->avctx->width,  s->chroma_h_shift) : s->avctx->width;
+        int h= is_chroma ? AV_CEIL_RSHIFT(s->avctx->height, s->chroma_v_shift) : s->avctx->height;
         int ls= frame->linesize[p];
         uint8_t *src= frame->data[p];
 
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 658515d..7b1046c 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -1574,12 +1574,12 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     for(i=0; i < s->nb_planes; i++){
         int hshift= i ? s->chroma_h_shift : 0;
         int vshift= i ? s->chroma_v_shift : 0;
-        for(y=0; y<FF_CEIL_RSHIFT(height, vshift); y++)
+        for(y=0; y<AV_CEIL_RSHIFT(height, vshift); y++)
             memcpy(&s->input_picture->data[i][y * s->input_picture->linesize[i]],
                    &pict->data[i][y * pict->linesize[i]],
-                   FF_CEIL_RSHIFT(width, hshift));
+                   AV_CEIL_RSHIFT(width, hshift));
         s->mpvencdsp.draw_edges(s->input_picture->data[i], s->input_picture->linesize[i],
-                                FF_CEIL_RSHIFT(width, hshift), FF_CEIL_RSHIFT(height, vshift),
+                                AV_CEIL_RSHIFT(width, hshift), AV_CEIL_RSHIFT(height, vshift),
                                 EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
                                 EDGE_TOP | EDGE_BOTTOM);
 
diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index 0c95faa..d7fdde0 100644
--- a/libavcodec/txd.c
+++ b/libavcodec/txd.c
@@ -104,7 +104,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             if (!(flags & 1))
                 goto unsupported;
         case TXD_DXT1:
-            if (bytestream2_get_bytes_left(&gb) < FF_CEIL_RSHIFT(w, 2) * FF_CEIL_RSHIFT(h, 2) * 8)
+            if (bytestream2_get_bytes_left(&gb) < AV_CEIL_RSHIFT(w, 2) * AV_CEIL_RSHIFT(h, 2) * 8)
                 return AVERROR_INVALIDDATA;
             for (j = 0; j < avctx->height; j += 4) {
                 for (i = 0; i < avctx->width; i += 4) {
@@ -115,7 +115,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             }
             break;
         case TXD_DXT3:
-            if (bytestream2_get_bytes_left(&gb) < FF_CEIL_RSHIFT(w, 2) * FF_CEIL_RSHIFT(h, 2) * 16)
+            if (bytestream2_get_bytes_left(&gb) < AV_CEIL_RSHIFT(w, 2) * AV_CEIL_RSHIFT(h, 2) * 16)
                 return AVERROR_INVALIDDATA;
             for (j = 0; j < avctx->height; j += 4) {
                 for (i = 0; i < avctx->width; i += 4) {
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index abddd6f..37326e4 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -215,8 +215,8 @@ int ff_set_dimensions(AVCodecContext *s, int width, int height)
 
     s->coded_width  = width;
     s->coded_height = height;
-    s->width        = FF_CEIL_RSHIFT(width,  s->lowres);
-    s->height       = FF_CEIL_RSHIFT(height, s->lowres);
+    s->width        = AV_CEIL_RSHIFT(width,  s->lowres);
+    s->height       = AV_CEIL_RSHIFT(height, s->lowres);
 
     return ret;
 }
@@ -700,8 +700,8 @@ void ff_color_frame(AVFrame *frame, const int c[4])
     for (p = 0; p<desc->nb_components; p++) {
         uint8_t *dst = frame->data[p];
         int is_chroma = p == 1 || p == 2;
-        int bytes  = is_chroma ? FF_CEIL_RSHIFT(frame->width,  desc->log2_chroma_w) : frame->width;
-        int height = is_chroma ? FF_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
+        int bytes  = is_chroma ? AV_CEIL_RSHIFT(frame->width,  desc->log2_chroma_w) : frame->width;
+        int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
         for (y = 0; y < height; y++) {
             if (desc->comp[0].depth >= 9) {
                 for (x = 0; x<bytes; x++)
@@ -859,8 +859,8 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
     }
     if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
         if (frame->width <= 0 || frame->height <= 0) {
-            frame->width  = FFMAX(avctx->width,  FF_CEIL_RSHIFT(avctx->coded_width,  avctx->lowres));
-            frame->height = FFMAX(avctx->height, FF_CEIL_RSHIFT(avctx->coded_height, avctx->lowres));
+            frame->width  = FFMAX(avctx->width,  AV_CEIL_RSHIFT(avctx->coded_width,  avctx->lowres));
+            frame->height = FFMAX(avctx->height, AV_CEIL_RSHIFT(avctx->coded_height, avctx->lowres));
             override_dimensions = 0;
         }
     }
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index 851b947..ba8d36a 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -1032,8 +1032,8 @@ static av_cold int opengl_init_context(OpenGLContext *opengl)
         for (i = 1; i < num_planes; i++)
             if (opengl->non_pow_2_textures)
                 opengl_configure_texture(opengl, opengl->texture_name[i],
-                        FF_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w),
-                        FF_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h));
+                        AV_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w),
+                        AV_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h));
             else
                 opengl_configure_texture(opengl, opengl->texture_name[i], opengl->width, opengl->height);
         if (has_alpha)
@@ -1135,8 +1135,8 @@ static uint8_t* opengl_get_plane_pointer(OpenGLContext *opengl, AVPacket *pkt, i
 {
     uint8_t *data = pkt->data;
     int wordsize = opengl_type_size(opengl->type);
-    int width_chroma = FF_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w);
-    int height_chroma = FF_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h);
+    int width_chroma = AV_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w);
+    int height_chroma = AV_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h);
     int plane = desc->comp[comp_index].plane;
 
     switch(plane) {
@@ -1161,8 +1161,8 @@ static uint8_t* opengl_get_plane_pointer(OpenGLContext *opengl, AVPacket *pkt, i
 
 #define LOAD_TEXTURE_DATA(comp_index, sub)                                                  \
 {                                                                                           \
-    int width = sub ? FF_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w) : opengl->width;   \
-    int height = sub ? FF_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h): opengl->height; \
+    int width = sub ? AV_CEIL_RSHIFT(opengl->width, desc->log2_chroma_w) : opengl->width;   \
+    int height = sub ? AV_CEIL_RSHIFT(opengl->height, desc->log2_chroma_h): opengl->height; \
     uint8_t *data;                                                                          \
     int plane = desc->comp[comp_index].plane;                                               \
                                                                                             \
diff --git a/libavfilter/deshake_opencl.c b/libavfilter/deshake_opencl.c
index 2821248..91ae7d5 100644
--- a/libavfilter/deshake_opencl.c
+++ b/libavfilter/deshake_opencl.c
@@ -160,7 +160,7 @@ int ff_opencl_deshake_process_inout_buf(AVFilterContext *ctx, AVFrame *in, AVFra
     AVFilterLink *link = ctx->inputs[0];
     DeshakeContext *deshake = ctx->priv;
     const int hshift = av_pix_fmt_desc_get(link->format)->log2_chroma_h;
-    int chroma_height = FF_CEIL_RSHIFT(link->h, hshift);
+    int chroma_height = AV_CEIL_RSHIFT(link->h, hshift);
 
     if ((!deshake->opencl_ctx.cl_inbuf) || (!deshake->opencl_ctx.cl_outbuf)) {
         deshake->opencl_ctx.in_plane_size[0]  = (in->linesize[0] * in->height);
diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index f9a5eb8..23a0eb5 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -104,7 +104,7 @@ int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t
             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
 
             pixel_step[plane] = 1;
-            line_size = FF_CEIL_RSHIFT(w, hsub1) * pixel_step[plane];
+            line_size = AV_CEIL_RSHIFT(w, hsub1) * pixel_step[plane];
             line[plane] = av_malloc(line_size);
             if (!line[plane]) {
                 while(plane && line[plane-1])
@@ -128,8 +128,8 @@ void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4],
     for (plane = 0; plane < 4 && dst[plane]; plane++) {
         int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
         int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
-        int width  = FF_CEIL_RSHIFT(w, hsub1);
-        int height = FF_CEIL_RSHIFT(h, vsub1);
+        int width  = AV_CEIL_RSHIFT(w, hsub1);
+        int height = AV_CEIL_RSHIFT(h, vsub1);
 
         p = dst[plane] + (y >> vsub1) * dst_linesize[plane];
         for (i = 0; i < height; i++) {
@@ -150,8 +150,8 @@ void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
     for (plane = 0; plane < 4 && dst[plane]; plane++) {
         int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
         int vsub1 = plane == 1 || plane == 2 ? vsub : 0;
-        int width  = FF_CEIL_RSHIFT(w, hsub1);
-        int height = FF_CEIL_RSHIFT(h, vsub1);
+        int width  = AV_CEIL_RSHIFT(w, hsub1);
+        int height = AV_CEIL_RSHIFT(h, vsub1);
 
         p = dst[plane] + (y >> vsub1) * dst_linesize[plane];
         for (i = 0; i < height; i++) {
@@ -256,8 +256,8 @@ void ff_copy_rectangle2(FFDrawContext *draw,
     for (plane = 0; plane < draw->nb_planes; plane++) {
         p = pointer_at(draw, src, src_linesize, plane, src_x, src_y);
         q = pointer_at(draw, dst, dst_linesize, plane, dst_x, dst_y);
-        wp = FF_CEIL_RSHIFT(w, draw->hsub[plane]) * draw->pixelstep[plane];
-        hp = FF_CEIL_RSHIFT(h, draw->vsub[plane]);
+        wp = AV_CEIL_RSHIFT(w, draw->hsub[plane]) * draw->pixelstep[plane];
+        hp = AV_CEIL_RSHIFT(h, draw->vsub[plane]);
         for (y = 0; y < hp; y++) {
             memcpy(q, p, wp);
             p += src_linesize[plane];
@@ -275,8 +275,8 @@ void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color,
 
     for (plane = 0; plane < draw->nb_planes; plane++) {
         p0 = pointer_at(draw, dst, dst_linesize, plane, dst_x, dst_y);
-        wp = FF_CEIL_RSHIFT(w, draw->hsub[plane]);
-        hp = FF_CEIL_RSHIFT(h, draw->vsub[plane]);
+        wp = AV_CEIL_RSHIFT(w, draw->hsub[plane]);
+        hp = AV_CEIL_RSHIFT(h, draw->vsub[plane]);
         if (!hp)
             return;
         p = p0;
diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index ff3a4f7..6df574e 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -82,7 +82,7 @@ FFVideoFramePool *ff_video_frame_pool_init(AVBufferRef* (*alloc)(int size),
     for (i = 0; i < 4 && pool->linesize[i]; i++) {
         int h = FFALIGN(pool->height, 32);
         if (i == 1 || i == 2)
-            h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
+            h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
 
         pool->pools[i] = av_buffer_pool_init(pool->linesize[i] * h + 16 + 16 - 1,
                                              alloc);
diff --git a/libavfilter/unsharp_opencl.c b/libavfilter/unsharp_opencl.c
index 2cc0704..d84920c 100644
--- a/libavfilter/unsharp_opencl.c
+++ b/libavfilter/unsharp_opencl.c
@@ -170,8 +170,8 @@ int ff_opencl_apply_unsharp(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
     FFOpenclParam kernel2 = {0};
     int width = link->w;
     int height = link->h;
-    int cw = FF_CEIL_RSHIFT(link->w, unsharp->hsub);
-    int ch = FF_CEIL_RSHIFT(link->h, unsharp->vsub);
+    int cw = AV_CEIL_RSHIFT(link->w, unsharp->hsub);
+    int ch = AV_CEIL_RSHIFT(link->h, unsharp->vsub);
     size_t globalWorkSize1d = width * height + 2 * ch * cw;
     size_t globalWorkSize2dLuma[2];
     size_t globalWorkSize2dChroma[2];
@@ -385,7 +385,7 @@ int ff_opencl_unsharp_process_inout_buf(AVFilterContext *ctx, AVFrame *in, AVFra
     int ret = 0;
     AVFilterLink *link = ctx->inputs[0];
     UnsharpContext *unsharp = ctx->priv;
-    int ch = FF_CEIL_RSHIFT(link->h, unsharp->vsub);
+    int ch = AV_CEIL_RSHIFT(link->h, unsharp->vsub);
 
     if ((!unsharp->opencl_ctx.cl_inbuf) || (!unsharp->opencl_ctx.cl_outbuf)) {
         unsharp->opencl_ctx.in_plane_size[0]  = (in->linesize[0] * in->height);
diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c
index 799a027..aa09021 100644
--- a/libavfilter/vf_atadenoise.c
+++ b/libavfilter/vf_atadenoise.c
@@ -264,9 +264,9 @@ static int config_input(AVFilterLink *inlink)
 
     s->nb_planes = desc->nb_components;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-    s->planewidth[1]  = s->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
+    s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     s->planewidth[0]  = s->planewidth[3]  = inlink->w;
 
     depth = desc->comp[0].depth;
diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c
index f2c4b84..7bad311 100644
--- a/libavfilter/vf_blend.c
+++ b/libavfilter/vf_blend.c
@@ -369,8 +369,8 @@ static AVFrame *blend_frame(AVFilterContext *ctx, AVFrame *top_buf,
     for (plane = 0; plane < s->nb_planes; plane++) {
         int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
         int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
-        int outw = FF_CEIL_RSHIFT(dst_buf->width,  hsub);
-        int outh = FF_CEIL_RSHIFT(dst_buf->height, vsub);
+        int outw = AV_CEIL_RSHIFT(dst_buf->width,  hsub);
+        int outh = AV_CEIL_RSHIFT(dst_buf->height, vsub);
         FilterParams *param = &s->params[plane];
         ThreadData td = { .top = top_buf, .bottom = bottom_buf, .dst = dst_buf,
                           .w = outw, .h = outh, .param = param, .plane = plane,
diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c
index 6934076..8e43986 100644
--- a/libavfilter/vf_boxblur.c
+++ b/libavfilter/vf_boxblur.c
@@ -326,7 +326,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     AVFilterLink *outlink = inlink->dst->outputs[0];
     AVFrame *out;
     int plane;
-    int cw = FF_CEIL_RSHIFT(inlink->w, s->hsub), ch = FF_CEIL_RSHIFT(in->height, s->vsub);
+    int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub), ch = AV_CEIL_RSHIFT(in->height, s->vsub);
     int w[4] = { inlink->w, cw, cw, inlink->w };
     int h[4] = { in->height, ch, ch, in->height };
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c
index 086a56c..e70b397 100644
--- a/libavfilter/vf_codecview.c
+++ b/libavfilter/vf_codecview.c
@@ -206,8 +206,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 
         if (qp_table) {
             int x, y;
-            const int w = FF_CEIL_RSHIFT(frame->width,  s->hsub);
-            const int h = FF_CEIL_RSHIFT(frame->height, s->vsub);
+            const int w = AV_CEIL_RSHIFT(frame->width,  s->hsub);
+            const int h = AV_CEIL_RSHIFT(frame->height, s->vsub);
             uint8_t *pu = frame->data[1];
             uint8_t *pv = frame->data[2];
             const int lzu = frame->linesize[1];
diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index 0622cf8..2380cdc 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -103,7 +103,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->planewidth, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c
index a84203a..f7f6103 100644
--- a/libavfilter/vf_cover_rect.c
+++ b/libavfilter/vf_cover_rect.c
@@ -78,8 +78,8 @@ static void cover_rect(CoverContext *cover, AVFrame *in, int offx, int offy)
     for (p = 0; p < 3; p++) {
         uint8_t *data = in->data[p] + (offx>>!!p) + (offy>>!!p) * in->linesize[p];
         const uint8_t *src = cover->cover_frame->data[p];
-        int w = FF_CEIL_RSHIFT(cover->cover_frame->width , !!p);
-        int h = FF_CEIL_RSHIFT(cover->cover_frame->height, !!p);
+        int w = AV_CEIL_RSHIFT(cover->cover_frame->width , !!p);
+        int h = AV_CEIL_RSHIFT(cover->cover_frame->height, !!p);
         for (y = 0; y < h; y++) {
             for (x = 0; x < w; x++) {
                 data[x] = src[x];
@@ -98,10 +98,10 @@ static void blur(CoverContext *cover, AVFrame *in, int offx, int offy)
         int oy = offy>>!!p;
         int stride = in->linesize[p];
         uint8_t *data = in->data[p] + ox + oy * stride;
-        int w = FF_CEIL_RSHIFT(cover->width , !!p);
-        int h = FF_CEIL_RSHIFT(cover->height, !!p);
-        int iw = FF_CEIL_RSHIFT(in->width , !!p);
-        int ih = FF_CEIL_RSHIFT(in->height, !!p);
+        int w = AV_CEIL_RSHIFT(cover->width , !!p);
+        int h = AV_CEIL_RSHIFT(cover->height, !!p);
+        int iw = AV_CEIL_RSHIFT(in->width , !!p);
+        int ih = AV_CEIL_RSHIFT(in->height, !!p);
         for (y = 0; y < h; y++) {
             for (x = 0; x < w; x++) {
                 int c = 0;
diff --git a/libavfilter/vf_deband.c b/libavfilter/vf_deband.c
index f25cbdd..01728b1 100644
--- a/libavfilter/vf_deband.c
+++ b/libavfilter/vf_deband.c
@@ -218,9 +218,9 @@ static int config_input(AVFilterLink *inlink)
 
     s->nb_components = desc->nb_components;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-    s->planewidth[1]  = s->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
+    s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     s->planewidth[0]  = s->planewidth[3]  = inlink->w;
 
     s->deband = desc->comp[0].depth > 8 ? deband_16_c : deband_8_c;
diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c
index 8b950b4..e2c0a32 100644
--- a/libavfilter/vf_decimate.c
+++ b/libavfilter/vf_decimate.c
@@ -93,8 +93,8 @@ static void calc_diffs(const DecimateContext *dm, struct qitem *q,
         const int linesize2 = f2->linesize[plane];
         const uint8_t *f1p = f1->data[plane];
         const uint8_t *f2p = f2->data[plane];
-        int width    = plane ? FF_CEIL_RSHIFT(f1->width,  dm->hsub) : f1->width;
-        int height   = plane ? FF_CEIL_RSHIFT(f1->height, dm->vsub) : f1->height;
+        int width    = plane ? AV_CEIL_RSHIFT(f1->width,  dm->hsub) : f1->width;
+        int height   = plane ? AV_CEIL_RSHIFT(f1->height, dm->vsub) : f1->height;
         int hblockx  = dm->blockx / 2;
         int hblocky  = dm->blocky / 2;
 
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index 118caa6..63c3539 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -262,13 +262,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
         apply_delogo(out->data[plane], out->linesize[plane],
                      in ->data[plane], in ->linesize[plane],
-                     FF_CEIL_RSHIFT(inlink->w, hsub),
-                     FF_CEIL_RSHIFT(inlink->h, vsub),
+                     AV_CEIL_RSHIFT(inlink->w, hsub),
+                     AV_CEIL_RSHIFT(inlink->h, vsub),
                      sar, s->x>>hsub, s->y>>vsub,
                      /* Up and left borders were rounded down, inject lost bits
                       * into width and height to avoid error accumulation */
-                     FF_CEIL_RSHIFT(s->w + (s->x & ((1<<hsub)-1)), hsub),
-                     FF_CEIL_RSHIFT(s->h + (s->y & ((1<<vsub)-1)), vsub),
+                     AV_CEIL_RSHIFT(s->w + (s->x & ((1<<hsub)-1)), hsub),
+                     AV_CEIL_RSHIFT(s->h + (s->y & ((1<<vsub)-1)), vsub),
                      s->band>>FFMIN(hsub, vsub),
                      s->show, direct);
     }
diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c
index e7ece44..4eae988 100644
--- a/libavfilter/vf_deshake.c
+++ b/libavfilter/vf_deshake.c
@@ -437,8 +437,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
     char tmp[256];
     int ret = 0;
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
-    const int chroma_width  = FF_CEIL_RSHIFT(link->w, desc->log2_chroma_w);
-    const int chroma_height = FF_CEIL_RSHIFT(link->h, desc->log2_chroma_h);
+    const int chroma_width  = AV_CEIL_RSHIFT(link->w, desc->log2_chroma_w);
+    const int chroma_height = AV_CEIL_RSHIFT(link->h, desc->log2_chroma_h);
 
     out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
index 9af2a13..6fd9aad 100644
--- a/libavfilter/vf_detelecine.c
+++ b/libavfilter/vf_detelecine.c
@@ -147,7 +147,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->stride, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
diff --git a/libavfilter/vf_displace.c b/libavfilter/vf_displace.c
index b72f043..9daa0c9 100644
--- a/libavfilter/vf_displace.c
+++ b/libavfilter/vf_displace.c
@@ -257,9 +257,9 @@ static int config_input(AVFilterLink *inlink)
     s->step = av_get_padded_bits_per_pixel(desc) >> 3;
     hsub = desc->log2_chroma_w;
     vsub = desc->log2_chroma_h;
-    s->height[1] = s->height[2] = FF_CEIL_RSHIFT(inlink->h, vsub);
+    s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
     s->height[0] = s->height[3] = inlink->h;
-    s->width[1]  = s->width[2]  = FF_CEIL_RSHIFT(inlink->w, hsub);
+    s->width[1]  = s->width[2]  = AV_CEIL_RSHIFT(inlink->w, hsub);
     s->width[0]  = s->width[3]  = inlink->w;
 
     return 0;
diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
index 1519d3d..0b929f3 100644
--- a/libavfilter/vf_eq.c
+++ b/libavfilter/vf_eq.c
@@ -281,8 +281,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         int h = inlink->h;
 
         if (i == 1 || i == 2) {
-            w = FF_CEIL_RSHIFT(w, desc->log2_chroma_w);
-            h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
+            w = AV_CEIL_RSHIFT(w, desc->log2_chroma_w);
+            h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
         }
 
         if (eq->param[i].adjust)
diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c
index 6da3b2d..099c00f 100644
--- a/libavfilter/vf_extractplanes.c
+++ b/libavfilter/vf_extractplanes.c
@@ -176,8 +176,8 @@ static int config_output(AVFilterLink *outlink)
     const int output = outlink->srcpad - ctx->output_pads;
 
     if (s->map[output] == 1 || s->map[output] == 2) {
-        outlink->h = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
-        outlink->w = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
+        outlink->h = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+        outlink->w = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     }
 
     return 0;
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index 040e3fd..f7b2b6a 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -244,8 +244,8 @@ static int filter_slice_chroma(AVFilterContext *ctx, void *arg, int jobnr,
     FadeContext *s = ctx->priv;
     AVFrame *frame = arg;
     int i, j, plane;
-    const int width = FF_CEIL_RSHIFT(frame->width, s->hsub);
-    const int height= FF_CEIL_RSHIFT(frame->height, s->vsub);
+    const int width = AV_CEIL_RSHIFT(frame->width, s->hsub);
+    const int height= AV_CEIL_RSHIFT(frame->height, s->vsub);
     int slice_start = (height *  jobnr   ) / nb_jobs;
     int slice_end   = (height * (jobnr+1)) / nb_jobs;
 
diff --git a/libavfilter/vf_fftfilt.c b/libavfilter/vf_fftfilt.c
index 8cbfa35..307b41a 100644
--- a/libavfilter/vf_fftfilt.c
+++ b/libavfilter/vf_fftfilt.c
@@ -266,8 +266,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         int h = inlink->h;
 
         if (plane == 1 || plane == 2) {
-            w = FF_CEIL_RSHIFT(w, desc->log2_chroma_w);
-            h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
+            w = AV_CEIL_RSHIFT(w, desc->log2_chroma_w);
+            h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
         }
 
         rdft_horizontal(s, in, w, h, plane);
diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c
index 4225801..7e27762 100644
--- a/libavfilter/vf_fieldmatch.c
+++ b/libavfilter/vf_fieldmatch.c
@@ -153,12 +153,12 @@ AVFILTER_DEFINE_CLASS(fieldmatch);
 
 static int get_width(const FieldMatchContext *fm, const AVFrame *f, int plane)
 {
-    return plane ? FF_CEIL_RSHIFT(f->width, fm->hsub) : f->width;
+    return plane ? AV_CEIL_RSHIFT(f->width, fm->hsub) : f->width;
 }
 
 static int get_height(const FieldMatchContext *fm, const AVFrame *f, int plane)
 {
-    return plane ? FF_CEIL_RSHIFT(f->height, fm->vsub) : f->height;
+    return plane ? AV_CEIL_RSHIFT(f->height, fm->vsub) : f->height;
 }
 
 static int64_t luma_abs_diff(const AVFrame *f1, const AVFrame *f2)
@@ -270,8 +270,8 @@ static int calc_combed_score(const FieldMatchContext *fm, const AVFrame *src)
         uint8_t *cmkp  = fm->cmask_data[0];
         uint8_t *cmkpU = fm->cmask_data[1];
         uint8_t *cmkpV = fm->cmask_data[2];
-        const int width  = FF_CEIL_RSHIFT(src->width,  fm->hsub);
-        const int height = FF_CEIL_RSHIFT(src->height, fm->vsub);
+        const int width  = AV_CEIL_RSHIFT(src->width,  fm->hsub);
+        const int height = AV_CEIL_RSHIFT(src->height, fm->vsub);
         const int cmk_linesize   = fm->cmask_linesize[0] << 1;
         const int cmk_linesizeUV = fm->cmask_linesize[2];
         uint8_t *cmkpp  = cmkp - (cmk_linesize>>1);
diff --git a/libavfilter/vf_framepack.c b/libavfilter/vf_framepack.c
index 5533c44..dc9f38b 100644
--- a/libavfilter/vf_framepack.c
+++ b/libavfilter/vf_framepack.c
@@ -160,8 +160,8 @@ static void horizontal_frame_pack(AVFilterLink *outlink,
 
         for (plane = 0; plane < s->pix_desc->nb_components; plane++) {
             if (plane == 1 || plane == 2) {
-                length = FF_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
-                lines  = FF_CEIL_RSHIFT(out->height,    s->pix_desc->log2_chroma_h);
+                length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w);
+                lines  = AV_CEIL_RSHIFT(out->height,    s->pix_desc->log2_chroma_h);
             }
             for (i = 0; i < lines; i++) {
                 int j;
diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c
index e346294..c698904 100644
--- a/libavfilter/vf_fspp.c
+++ b/libavfilter/vf_fspp.c
@@ -526,7 +526,7 @@ static int config_input(AVFilterLink *inlink)
         return AVERROR(ENOMEM);
 
     if (!fspp->use_bframe_qp && !fspp->qp) {
-        fspp->non_b_qp_alloc_size = FF_CEIL_RSHIFT(inlink->w, 4) * FF_CEIL_RSHIFT(inlink->h, 4);
+        fspp->non_b_qp_alloc_size = AV_CEIL_RSHIFT(inlink->w, 4) * AV_CEIL_RSHIFT(inlink->h, 4);
         fspp->non_b_qp_table = av_calloc(fspp->non_b_qp_alloc_size, sizeof(*fspp->non_b_qp_table));
         if (!fspp->non_b_qp_table)
             return AVERROR(ENOMEM);
@@ -590,11 +590,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             /* if the qp stride is not set, it means the QP are only defined on
              * a line basis */
            if (!qp_stride) {
-                w = FF_CEIL_RSHIFT(inlink->w, 4);
+                w = AV_CEIL_RSHIFT(inlink->w, 4);
                 h = 1;
             } else {
                 w = qp_stride;
-                h = FF_CEIL_RSHIFT(inlink->h, 4);
+                h = AV_CEIL_RSHIFT(inlink->h, 4);
             }
             if (w * h > fspp->non_b_qp_alloc_size) {
                 int ret = av_reallocp_array(&fspp->non_b_qp_table, w, h);
@@ -615,8 +615,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             qp_table = fspp->non_b_qp_table;
 
         if (qp_table || fspp->qp) {
-            const int cw = FF_CEIL_RSHIFT(inlink->w, fspp->hsub);
-            const int ch = FF_CEIL_RSHIFT(inlink->h, fspp->vsub);
+            const int cw = AV_CEIL_RSHIFT(inlink->w, fspp->hsub);
+            const int ch = AV_CEIL_RSHIFT(inlink->h, fspp->vsub);
 
             /* get a new frame if in-place is not possible or if the dimensions
              * are not multiple of 8 */
diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c
index 40e71e0..88d3b75 100644
--- a/libavfilter/vf_geq.c
+++ b/libavfilter/vf_geq.c
@@ -75,8 +75,8 @@ static inline double getpix(void *priv, double x, double y, int plane)
     AVFrame *picref = geq->picref;
     const uint8_t *src = picref->data[plane];
     const int linesize = picref->linesize[plane];
-    const int w = (plane == 1 || plane == 2) ? FF_CEIL_RSHIFT(picref->width,  geq->hsub) : picref->width;
-    const int h = (plane == 1 || plane == 2) ? FF_CEIL_RSHIFT(picref->height, geq->vsub) : picref->height;
+    const int w = (plane == 1 || plane == 2) ? AV_CEIL_RSHIFT(picref->width,  geq->hsub) : picref->width;
+    const int h = (plane == 1 || plane == 2) ? AV_CEIL_RSHIFT(picref->height, geq->vsub) : picref->height;
 
     if (!src)
         return 0;
@@ -224,8 +224,8 @@ static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in)
         int x, y;
         uint8_t *dst = out->data[plane];
         const int linesize = out->linesize[plane];
-        const int w = (plane == 1 || plane == 2) ? FF_CEIL_RSHIFT(inlink->w, geq->hsub) : inlink->w;
-        const int h = (plane == 1 || plane == 2) ? FF_CEIL_RSHIFT(inlink->h, geq->vsub) : inlink->h;
+        const int w = (plane == 1 || plane == 2) ? AV_CEIL_RSHIFT(inlink->w, geq->hsub) : inlink->w;
+        const int h = (plane == 1 || plane == 2) ? AV_CEIL_RSHIFT(inlink->h, geq->vsub) : inlink->h;
 
         values[VAR_W]  = w;
         values[VAR_H]  = h;
diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c
index 8c11bda..e9af24f 100644
--- a/libavfilter/vf_gradfun.c
+++ b/libavfilter/vf_gradfun.c
@@ -173,8 +173,8 @@ static int config_input(AVFilterLink *inlink)
     if (!s->buf)
         return AVERROR(ENOMEM);
 
-    s->chroma_w = FF_CEIL_RSHIFT(inlink->w, hsub);
-    s->chroma_h = FF_CEIL_RSHIFT(inlink->h, vsub);
+    s->chroma_w = AV_CEIL_RSHIFT(inlink->w, hsub);
+    s->chroma_h = AV_CEIL_RSHIFT(inlink->h, vsub);
     s->chroma_r = av_clip(((((s->radius >> hsub) + (s->radius >> vsub)) / 2 ) + 1) & ~1, 4, 32);
 
     return 0;
diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index 96ffca8..6f92284 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -68,9 +68,9 @@ static int config_props(AVFilterLink *inlink)
 
     av_image_fill_max_pixsteps(s->max_step, NULL, pix_desc);
     s->planewidth[0]  = s->planewidth[3]  = inlink->w;
-    s->planewidth[1]  = s->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, hsub);
+    s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, hsub);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, vsub);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
 
     return 0;
 }
diff --git a/libavfilter/vf_histogram.c b/libavfilter/vf_histogram.c
index 3f50f12..3a4725b 100644
--- a/libavfilter/vf_histogram.c
+++ b/libavfilter/vf_histogram.c
@@ -183,9 +183,9 @@ static int config_input(AVFilterLink *inlink)
         h->fg_color = white_yuva_color;
     }
 
-    h->planeheight[1] = h->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, h->desc->log2_chroma_h);
+    h->planeheight[1] = h->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, h->desc->log2_chroma_h);
     h->planeheight[0] = h->planeheight[3] = inlink->h;
-    h->planewidth[1]  = h->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, h->desc->log2_chroma_w);
+    h->planewidth[1]  = h->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, h->desc->log2_chroma_w);
     h->planewidth[0]  = h->planewidth[3]  = inlink->w;
 
     return 0;
@@ -228,8 +228,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
     for (k = 0; k < 4 && out->data[k]; k++) {
         const int is_chroma = (k == 1 || k == 2);
-        const int dst_h = FF_CEIL_RSHIFT(outlink->h, (is_chroma ? h->odesc->log2_chroma_h : 0));
-        const int dst_w = FF_CEIL_RSHIFT(outlink->w, (is_chroma ? h->odesc->log2_chroma_w : 0));
+        const int dst_h = AV_CEIL_RSHIFT(outlink->h, (is_chroma ? h->odesc->log2_chroma_h : 0));
+        const int dst_w = AV_CEIL_RSHIFT(outlink->w, (is_chroma ? h->odesc->log2_chroma_w : 0));
 
         if (h->histogram_size <= 256) {
             for (i = 0; i < dst_h ; i++)
diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c
index 5b367ff..3fb69fc 100644
--- a/libavfilter/vf_hqdn3d.c
+++ b/libavfilter/vf_hqdn3d.c
@@ -311,8 +311,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     for (c = 0; c < 3; c++) {
         denoise(s, in->data[c], out->data[c],
                 s->line, &s->frame_prev[c],
-                FF_CEIL_RSHIFT(in->width,  (!!c * s->hsub)),
-                FF_CEIL_RSHIFT(in->height, (!!c * s->vsub)),
+                AV_CEIL_RSHIFT(in->width,  (!!c * s->hsub)),
+                AV_CEIL_RSHIFT(in->height, (!!c * s->vsub)),
                 in->linesize[c], out->linesize[c],
                 s->coefs[c ? CHROMA_SPATIAL : LUMA_SPATIAL],
                 s->coefs[c ? CHROMA_TMP     : LUMA_TMP]);
diff --git a/libavfilter/vf_hue.c b/libavfilter/vf_hue.c
index 92607f1..b5d7213 100644
--- a/libavfilter/vf_hue.c
+++ b/libavfilter/vf_hue.c
@@ -377,8 +377,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
 
     apply_lut(hue, outpic->data[1], outpic->data[2], outpic->linesize[1],
               inpic->data[1],  inpic->data[2],  inpic->linesize[1],
-              FF_CEIL_RSHIFT(inlink->w, hue->hsub),
-              FF_CEIL_RSHIFT(inlink->h, hue->vsub));
+              AV_CEIL_RSHIFT(inlink->w, hue->hsub),
+              AV_CEIL_RSHIFT(inlink->h, hue->vsub));
     if (hue->brightness)
         apply_luma_lut(hue, outpic->data[0], outpic->linesize[0],
                        inpic->data[0], inpic->linesize[0], inlink->w, inlink->h);
diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index 60ec23a..87d4144 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -128,8 +128,8 @@ static void filter(AVFilterContext *ctx)
         int refs = idet->cur->linesize[i];
 
         if (i && i<3) {
-            w = FF_CEIL_RSHIFT(w, idet->csp->log2_chroma_w);
-            h = FF_CEIL_RSHIFT(h, idet->csp->log2_chroma_h);
+            w = AV_CEIL_RSHIFT(w, idet->csp->log2_chroma_w);
+            h = AV_CEIL_RSHIFT(h, idet->csp->log2_chroma_h);
         }
 
         for (y = 2; y < h - 2; y++) {
diff --git a/libavfilter/vf_il.c b/libavfilter/vf_il.c
index 7aedb87..e0bf8d5 100644
--- a/libavfilter/vf_il.c
+++ b/libavfilter/vf_il.c
@@ -109,7 +109,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->chroma_height = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->chroma_height = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
 
     return 0;
 }
diff --git a/libavfilter/vf_interlace.c b/libavfilter/vf_interlace.c
index c92f67b..efa3128 100644
--- a/libavfilter/vf_interlace.c
+++ b/libavfilter/vf_interlace.c
@@ -139,7 +139,7 @@ static void copy_picture_field(InterlaceContext *s,
 
     for (plane = 0; plane < desc->nb_components; plane++) {
         int cols  = (plane == 1 || plane == 2) ? -(-inlink->w) >> hsub : inlink->w;
-        int lines = (plane == 1 || plane == 2) ? FF_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
+        int lines = (plane == 1 || plane == 2) ? AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
         uint8_t *dstp = dst_frame->data[plane];
         const uint8_t *srcp = src_frame->data[plane];
 
diff --git a/libavfilter/vf_kerndeint.c b/libavfilter/vf_kerndeint.c
index d2ef070..4825ed5 100644
--- a/libavfilter/vf_kerndeint.c
+++ b/libavfilter/vf_kerndeint.c
@@ -152,7 +152,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
     outpic->interlaced_frame = 0;
 
     for (plane = 0; plane < 4 && inpic->data[plane] && inpic->linesize[plane]; plane++) {
-        h = plane == 0 ? inlink->h : FF_CEIL_RSHIFT(inlink->h, kerndeint->vsub);
+        h = plane == 0 ? inlink->h : AV_CEIL_RSHIFT(inlink->h, kerndeint->vsub);
         bwidth = kerndeint->tmp_bwidth[plane];
 
         srcp_saved        = inpic->data[plane];
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index 38a25fe..5148663 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -418,8 +418,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) {
             int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
             int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
-            int h = FF_CEIL_RSHIFT(inlink->h, vsub);
-            int w = FF_CEIL_RSHIFT(inlink->w, hsub);
+            int h = AV_CEIL_RSHIFT(inlink->h, vsub);
+            int w = AV_CEIL_RSHIFT(inlink->w, hsub);
             const uint16_t *tab = s->lut[plane];
             const int in_linesize  =  in->linesize[plane] / 2;
             const int out_linesize = out->linesize[plane] / 2;
@@ -446,8 +446,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) {
             int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
             int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
-            int h = FF_CEIL_RSHIFT(inlink->h, vsub);
-            int w = FF_CEIL_RSHIFT(inlink->w, hsub);
+            int h = AV_CEIL_RSHIFT(inlink->h, vsub);
+            int w = AV_CEIL_RSHIFT(inlink->w, hsub);
             const uint16_t *tab = s->lut[plane];
             const int in_linesize  =  in->linesize[plane];
             const int out_linesize = out->linesize[plane];
diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c
index 38a4663..66f8fa5 100644
--- a/libavfilter/vf_maskedmerge.c
+++ b/libavfilter/vf_maskedmerge.c
@@ -163,9 +163,9 @@ static int config_input(AVFilterLink *inlink)
 
     hsub = desc->log2_chroma_w;
     vsub = desc->log2_chroma_h;
-    s->height[1] = s->height[2] = FF_CEIL_RSHIFT(inlink->h, vsub);
+    s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
     s->height[0] = s->height[3] = inlink->h;
-    s->width[1]  = s->width[2]  = FF_CEIL_RSHIFT(inlink->w, hsub);
+    s->width[1]  = s->width[2]  = AV_CEIL_RSHIFT(inlink->w, hsub);
     s->width[0]  = s->width[3]  = inlink->w;
 
     s->depth = desc->comp[0].depth;
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index e1c865a..ea32a24 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -197,8 +197,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
 
     for (i = 0; i < 3; i++) {
         int is_chroma = !!i;
-        int w = FF_CEIL_RSHIFT(inlink->w, is_chroma);
-        int h = FF_CEIL_RSHIFT(inlink->h, is_chroma);
+        int w = AV_CEIL_RSHIFT(inlink->w, is_chroma);
+        int h = AV_CEIL_RSHIFT(inlink->h, is_chroma);
         int fils = frame_dec->linesize[i];
         int srcs = inpic    ->linesize[i];
         int dsts = outpic   ->linesize[i];
diff --git a/libavfilter/vf_mergeplanes.c b/libavfilter/vf_mergeplanes.c
index 2d9db84..8128f33 100644
--- a/libavfilter/vf_mergeplanes.c
+++ b/libavfilter/vf_mergeplanes.c
@@ -192,11 +192,11 @@ static int config_output(AVFilterLink *outlink)
     outlink->sample_aspect_ratio = ctx->inputs[0]->sample_aspect_ratio;
 
     s->planewidth[1]  =
-    s->planewidth[2]  = FF_CEIL_RSHIFT(outlink->w, s->outdesc->log2_chroma_w);
+    s->planewidth[2]  = AV_CEIL_RSHIFT(outlink->w, s->outdesc->log2_chroma_w);
     s->planewidth[0]  =
     s->planewidth[3]  = outlink->w;
     s->planeheight[1] =
-    s->planeheight[2] = FF_CEIL_RSHIFT(outlink->h, s->outdesc->log2_chroma_h);
+    s->planeheight[2] = AV_CEIL_RSHIFT(outlink->h, s->outdesc->log2_chroma_h);
     s->planeheight[0] =
     s->planeheight[3] = outlink->h;
 
@@ -220,11 +220,11 @@ static int config_output(AVFilterLink *outlink)
         }
 
         inputp->planewidth[1]  =
-        inputp->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, indesc->log2_chroma_w);
+        inputp->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, indesc->log2_chroma_w);
         inputp->planewidth[0]  =
         inputp->planewidth[3]  = inlink->w;
         inputp->planeheight[1] =
-        inputp->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, indesc->log2_chroma_h);
+        inputp->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, indesc->log2_chroma_h);
         inputp->planeheight[0] =
         inputp->planeheight[3] = inlink->h;
         inputp->nb_planes = av_pix_fmt_count_planes(inlink->format);
diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c
index c0c498b..dc34511 100644
--- a/libavfilter/vf_mpdecimate.c
+++ b/libavfilter/vf_mpdecimate.c
@@ -130,8 +130,8 @@ static int decimate_frame(AVFilterContext *ctx,
         if (diff_planes(ctx,
                         cur->data[plane], cur->linesize[plane],
                         ref->data[plane], ref->linesize[plane],
-                        FF_CEIL_RSHIFT(ref->width,  hsub),
-                        FF_CEIL_RSHIFT(ref->height, vsub))) {
+                        AV_CEIL_RSHIFT(ref->width,  hsub),
+                        AV_CEIL_RSHIFT(ref->height, vsub))) {
             emms_c();
             return 0;
         }
diff --git a/libavfilter/vf_neighbor.c b/libavfilter/vf_neighbor.c
index c6bb67d..de4a12f 100644
--- a/libavfilter/vf_neighbor.c
+++ b/libavfilter/vf_neighbor.c
@@ -151,7 +151,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->planewidth, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
index dbdae7d..fa3863e 100644
--- a/libavfilter/vf_noise.c
+++ b/libavfilter/vf_noise.c
@@ -156,7 +156,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(n->bytewidth, inlink->format, inlink->w)) < 0)
         return ret;
 
-    n->height[1] = n->height[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    n->height[1] = n->height[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     n->height[0] = n->height[3] = inlink->h;
 
     return 0;
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 3eac7f0..37f19ea 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -520,10 +520,10 @@ static void blend_image(AVFilterContext *ctx,
         for (i = 0; i < 3; i++) {
             int hsub = i ? s->hsub : 0;
             int vsub = i ? s->vsub : 0;
-            int src_wp = FF_CEIL_RSHIFT(src_w, hsub);
-            int src_hp = FF_CEIL_RSHIFT(src_h, vsub);
-            int dst_wp = FF_CEIL_RSHIFT(dst_w, hsub);
-            int dst_hp = FF_CEIL_RSHIFT(dst_h, vsub);
+            int src_wp = AV_CEIL_RSHIFT(src_w, hsub);
+            int src_hp = AV_CEIL_RSHIFT(src_h, vsub);
+            int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub);
+            int dst_hp = AV_CEIL_RSHIFT(dst_h, vsub);
             int yp = y>>vsub;
             int xp = x>>hsub;
             uint8_t *s, *sp, *d, *dp, *a, *ap;
diff --git a/libavfilter/vf_owdenoise.c b/libavfilter/vf_owdenoise.c
index d4e90f8..3a77f89 100644
--- a/libavfilter/vf_owdenoise.c
+++ b/libavfilter/vf_owdenoise.c
@@ -227,8 +227,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     OWDenoiseContext *s = ctx->priv;
     AVFilterLink *outlink = ctx->outputs[0];
     AVFrame *out;
-    const int cw = FF_CEIL_RSHIFT(inlink->w, s->hsub);
-    const int ch = FF_CEIL_RSHIFT(inlink->h, s->vsub);
+    const int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub);
+    const int ch = AV_CEIL_RSHIFT(inlink->h, s->vsub);
 
     if (av_frame_is_writable(in)) {
         direct = 1;
diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c
index 13053f1..4949ee8 100644
--- a/libavfilter/vf_perspective.c
+++ b/libavfilter/vf_perspective.c
@@ -150,7 +150,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->height[1] = s->height[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->height[0] = s->height[3] = inlink->h;
 
     s->pv = av_realloc_f(s->pv, w * h, 2 * sizeof(*s->pv));
diff --git a/libavfilter/vf_phase.c b/libavfilter/vf_phase.c
index 35c343f..7249388 100644
--- a/libavfilter/vf_phase.c
+++ b/libavfilter/vf_phase.c
@@ -92,7 +92,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
diff --git a/libavfilter/vf_pixdesctest.c b/libavfilter/vf_pixdesctest.c
index 790dd0d..d6423ac 100644
--- a/libavfilter/vf_pixdesctest.c
+++ b/libavfilter/vf_pixdesctest.c
@@ -59,8 +59,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     AVFilterLink *outlink    = inlink->dst->outputs[0];
     AVFrame *out;
     int i, c, w = inlink->w, h = inlink->h;
-    const int cw = FF_CEIL_RSHIFT(w, priv->pix_desc->log2_chroma_w);
-    const int ch = FF_CEIL_RSHIFT(h, priv->pix_desc->log2_chroma_h);
+    const int cw = AV_CEIL_RSHIFT(w, priv->pix_desc->log2_chroma_w);
+    const int ch = AV_CEIL_RSHIFT(h, priv->pix_desc->log2_chroma_h);
 
     out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!out) {
diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c
index 9e78c39..570a1c9 100644
--- a/libavfilter/vf_pp7.c
+++ b/libavfilter/vf_pp7.c
@@ -328,8 +328,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         qp_table = av_frame_get_qp_table(in, &qp_stride, &pp7->qscale_type);
 
     if (!ctx->is_disabled) {
-        const int cw = FF_CEIL_RSHIFT(inlink->w, pp7->hsub);
-        const int ch = FF_CEIL_RSHIFT(inlink->h, pp7->vsub);
+        const int cw = AV_CEIL_RSHIFT(inlink->w, pp7->hsub);
+        const int ch = AV_CEIL_RSHIFT(inlink->h, pp7->vsub);
 
         /* get a new frame if in-place is not possible or if the dimensions
         * are not multiple of 8 */
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index bce5c51..89acd3c 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -266,9 +266,9 @@ static int config_input_ref(AVFilterLink *inlink)
     s->comps[2] = s->is_rgb ? 'b' : 'v' ;
     s->comps[3] = 'a';
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-    s->planewidth[1]  = s->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
+    s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     s->planewidth[0]  = s->planewidth[3]  = inlink->w;
     sum = 0;
     for (j = 0; j < s->nb_components; j++)
diff --git a/libavfilter/vf_pullup.c b/libavfilter/vf_pullup.c
index 100546d..fa76caa 100644
--- a/libavfilter/vf_pullup.c
+++ b/libavfilter/vf_pullup.c
@@ -194,9 +194,9 @@ static int config_input(AVFilterLink *inlink)
         return AVERROR(EINVAL);
     }
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-    s->planewidth[1]  = s->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
+    s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     s->planewidth[0]  = s->planewidth[3]  = inlink->w;
 
     s->metric_w      = (s->planewidth[mp]  - ((s->junk_left + s->junk_right)  << 3)) >> 3;
diff --git a/libavfilter/vf_removegrain.c b/libavfilter/vf_removegrain.c
index 898e50f..8ef0974 100644
--- a/libavfilter/vf_removegrain.c
+++ b/libavfilter/vf_removegrain.c
@@ -471,9 +471,9 @@ static int config_input(AVFilterLink *inlink)
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-    s->planewidth[1]  = s->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
+    s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     s->planewidth[0]  = s->planewidth[3]  = inlink->w;
 
     for (i = 0; i < s->nb_planes; i++) {
diff --git a/libavfilter/vf_repeatfields.c b/libavfilter/vf_repeatfields.c
index b9e73ec..3ac432b 100644
--- a/libavfilter/vf_repeatfields.c
+++ b/libavfilter/vf_repeatfields.c
@@ -65,7 +65,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c
index 36c4a7a..47dc01e 100644
--- a/libavfilter/vf_rotate.c
+++ b/libavfilter/vf_rotate.c
@@ -494,11 +494,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     for (plane = 0; plane < rot->nb_planes; plane++) {
         int hsub = plane == 1 || plane == 2 ? rot->hsub : 0;
         int vsub = plane == 1 || plane == 2 ? rot->vsub : 0;
-        const int outw = FF_CEIL_RSHIFT(outlink->w, hsub);
-        const int outh = FF_CEIL_RSHIFT(outlink->h, vsub);
+        const int outw = AV_CEIL_RSHIFT(outlink->w, hsub);
+        const int outh = AV_CEIL_RSHIFT(outlink->h, vsub);
         ThreadData td = { .in = in,   .out  = out,
-                          .inw  = FF_CEIL_RSHIFT(inlink->w, hsub),
-                          .inh  = FF_CEIL_RSHIFT(inlink->h, vsub),
+                          .inw  = AV_CEIL_RSHIFT(inlink->w, hsub),
+                          .inh  = AV_CEIL_RSHIFT(inlink->h, vsub),
                           .outh = outh, .outw = outw,
                           .xi = -(outw-1) * c / 2, .yi =  (outw-1) * s / 2,
                           .xprime = -(outh-1) * s / 2,
diff --git a/libavfilter/vf_sab.c b/libavfilter/vf_sab.c
index 6b88c86..3f0951f 100644
--- a/libavfilter/vf_sab.c
+++ b/libavfilter/vf_sab.c
@@ -214,8 +214,8 @@ static int config_props(AVFilterLink *inlink)
 
     close_filter_param(&s->chroma);
     ret = open_filter_param(&s->chroma,
-                            FF_CEIL_RSHIFT(inlink->w, s->hsub),
-                            FF_CEIL_RSHIFT(inlink->h, s->vsub), s->sws_flags);
+                            AV_CEIL_RSHIFT(inlink->w, s->hsub),
+                            AV_CEIL_RSHIFT(inlink->h, s->vsub), s->sws_flags);
     return ret;
 }
 
@@ -295,8 +295,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
     blur(outpic->data[0], outpic->linesize[0], inpic->data[0],  inpic->linesize[0],
          inlink->w, inlink->h, &s->luma);
     if (inpic->data[2]) {
-        int cw = FF_CEIL_RSHIFT(inlink->w, s->hsub);
-        int ch = FF_CEIL_RSHIFT(inlink->h, s->vsub);
+        int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub);
+        int ch = AV_CEIL_RSHIFT(inlink->h, s->vsub);
         blur(outpic->data[1], outpic->linesize[1], inpic->data[1], inpic->linesize[1], cw, ch, &s->chroma);
         blur(outpic->data[2], outpic->linesize[2], inpic->data[2], inpic->linesize[2], cw, ch, &s->chroma);
     }
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 464d92d..5146995 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -87,7 +87,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 
     for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++) {
         uint8_t *data = frame->data[plane];
-        int h = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
+        int h = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT(inlink->h, vsub) : inlink->h;
         int linesize = av_image_get_linesize(frame->format, frame->width, plane);
 
         if (linesize < 0)
diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c
index 88b715e..c340d6b 100644
--- a/libavfilter/vf_signalstats.c
+++ b/libavfilter/vf_signalstats.c
@@ -154,8 +154,8 @@ static int config_props(AVFilterLink *outlink)
     outlink->w = inlink->w;
     outlink->h = inlink->h;
 
-    s->chromaw = FF_CEIL_RSHIFT(inlink->w, s->hsub);
-    s->chromah = FF_CEIL_RSHIFT(inlink->h, s->vsub);
+    s->chromaw = AV_CEIL_RSHIFT(inlink->w, s->hsub);
+    s->chromah = AV_CEIL_RSHIFT(inlink->h, s->vsub);
 
     s->fs = inlink->w * inlink->h;
     s->cfs = s->chromaw * s->chromah;
diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c
index c3b12d9..117e0ec 100644
--- a/libavfilter/vf_smartblur.c
+++ b/libavfilter/vf_smartblur.c
@@ -167,8 +167,8 @@ static int config_props(AVFilterLink *inlink)
 
     alloc_sws_context(&s->luma, inlink->w, inlink->h, s->sws_flags);
     alloc_sws_context(&s->chroma,
-                      FF_CEIL_RSHIFT(inlink->w, s->hsub),
-                      FF_CEIL_RSHIFT(inlink->h, s->vsub),
+                      AV_CEIL_RSHIFT(inlink->w, s->hsub),
+                      AV_CEIL_RSHIFT(inlink->h, s->vsub),
                       s->sws_flags);
 
     return 0;
@@ -243,8 +243,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
     SmartblurContext  *s  = inlink->dst->priv;
     AVFilterLink *outlink     = inlink->dst->outputs[0];
     AVFrame *outpic;
-    int cw = FF_CEIL_RSHIFT(inlink->w, s->hsub);
-    int ch = FF_CEIL_RSHIFT(inlink->h, s->vsub);
+    int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub);
+    int ch = AV_CEIL_RSHIFT(inlink->h, s->vsub);
 
     outpic = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     if (!outpic) {
diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 1195454..fe579ce 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -374,11 +374,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             /* if the qp stride is not set, it means the QP are only defined on
              * a line basis */
             if (!qp_stride) {
-                w = FF_CEIL_RSHIFT(inlink->w, 4);
+                w = AV_CEIL_RSHIFT(inlink->w, 4);
                 h = 1;
             } else {
                 w = qp_stride;
-                h = FF_CEIL_RSHIFT(inlink->h, 4);
+                h = AV_CEIL_RSHIFT(inlink->h, 4);
             }
 
             if (w * h > s->non_b_qp_alloc_size) {
@@ -400,8 +400,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             qp_table = s->non_b_qp_table;
 
         if (qp_table || s->qp) {
-            const int cw = FF_CEIL_RSHIFT(inlink->w, s->hsub);
-            const int ch = FF_CEIL_RSHIFT(inlink->h, s->vsub);
+            const int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub);
+            const int ch = AV_CEIL_RSHIFT(inlink->h, s->vsub);
 
             /* get a new frame if in-place is not possible or if the dimensions
              * are not multiple of 8 */
diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c
index 7c43e98..dd8f264 100644
--- a/libavfilter/vf_ssim.c
+++ b/libavfilter/vf_ssim.c
@@ -288,9 +288,9 @@ static int config_input_ref(AVFilterLink *inlink)
     s->comps[2] = s->is_rgb ? 'B' : 'V';
     s->comps[3] = 'A';
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-    s->planewidth[1]  = s->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
+    s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     s->planewidth[0]  = s->planewidth[3]  = inlink->w;
     for (i = 0; i < s->nb_components; i++)
         sum += s->planeheight[i] * s->planewidth[i];
diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index 2fe3712..b6243eb 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -123,7 +123,7 @@ static int process_frame(FFFrameSync *fs)
             return ret;
         }
 
-        height[1] = height[2] = FF_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
+        height[1] = height[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
         height[0] = height[3] = inlink->h;
 
         for (p = 0; p < s->nb_planes; p++) {
diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c
index 85a5258..2036c94 100644
--- a/libavfilter/vf_stereo3d.c
+++ b/libavfilter/vf_stereo3d.c
@@ -582,7 +582,7 @@ static int config_output(AVFilterLink *outlink)
         return ret;
     s->nb_planes = av_pix_fmt_count_planes(outlink->format);
     av_image_fill_max_pixsteps(s->pixstep, NULL, desc);
-    s->pheight[1] = s->pheight[2] = FF_CEIL_RSHIFT(s->height, desc->log2_chroma_h);
+    s->pheight[1] = s->pheight[2] = AV_CEIL_RSHIFT(s->height, desc->log2_chroma_h);
     s->pheight[0] = s->pheight[3] = s->height;
     s->hsub = desc->log2_chroma_w;
     s->vsub = desc->log2_chroma_h;
@@ -781,10 +781,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
     for (i = 0; i < 4; i++) {
         int hsub = i == 1 || i == 2 ? s->hsub : 0;
         int vsub = i == 1 || i == 2 ? s->vsub : 0;
-        s->in_off_left[i]   = (FF_CEIL_RSHIFT(s->in.row_left,   vsub) + s->in.off_lstep)  * ileft->linesize[i]  + FF_CEIL_RSHIFT(s->in.off_left   * s->pixstep[i], hsub);
-        s->in_off_right[i]  = (FF_CEIL_RSHIFT(s->in.row_right,  vsub) + s->in.off_rstep)  * iright->linesize[i] + FF_CEIL_RSHIFT(s->in.off_right  * s->pixstep[i], hsub);
-        out_off_left[i]  = (FF_CEIL_RSHIFT(s->out.row_left,  vsub) + s->out.off_lstep) * oleft->linesize[i]  + FF_CEIL_RSHIFT(s->out.off_left  * s->pixstep[i], hsub);
-        out_off_right[i] = (FF_CEIL_RSHIFT(s->out.row_right, vsub) + s->out.off_rstep) * oright->linesize[i] + FF_CEIL_RSHIFT(s->out.off_right * s->pixstep[i], hsub);
+        s->in_off_left[i]   = (AV_CEIL_RSHIFT(s->in.row_left,   vsub) + s->in.off_lstep)  * ileft->linesize[i]  + AV_CEIL_RSHIFT(s->in.off_left   * s->pixstep[i], hsub);
+        s->in_off_right[i]  = (AV_CEIL_RSHIFT(s->in.row_right,  vsub) + s->in.off_rstep)  * iright->linesize[i] + AV_CEIL_RSHIFT(s->in.off_right  * s->pixstep[i], hsub);
+        out_off_left[i]  = (AV_CEIL_RSHIFT(s->out.row_left,  vsub) + s->out.off_lstep) * oleft->linesize[i]  + AV_CEIL_RSHIFT(s->out.off_left  * s->pixstep[i], hsub);
+        out_off_right[i] = (AV_CEIL_RSHIFT(s->out.row_right, vsub) + s->out.off_rstep) * oright->linesize[i] + AV_CEIL_RSHIFT(s->out.off_right * s->pixstep[i], hsub);
     }
 
     switch (s->out.format) {
diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c
index 37343bc..182c670 100644
--- a/libavfilter/vf_telecine.c
+++ b/libavfilter/vf_telecine.c
@@ -134,7 +134,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->stride, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c
index 3d6140f..835ece3 100644
--- a/libavfilter/vf_tinterlace.c
+++ b/libavfilter/vf_tinterlace.c
@@ -137,7 +137,7 @@ static int config_out_props(AVFilterLink *outlink)
 
         /* fill black picture with black */
         for (i = 0; i < 4 && tinterlace->black_data[i]; i++) {
-            int h = i == 1 || i == 2 ? FF_CEIL_RSHIFT(outlink->h, desc->log2_chroma_h) : outlink->h;
+            int h = i == 1 || i == 2 ? AV_CEIL_RSHIFT(outlink->h, desc->log2_chroma_h) : outlink->h;
             memset(tinterlace->black_data[i], black[i],
                    tinterlace->black_linesize[i] * h);
         }
@@ -211,8 +211,8 @@ void copy_picture_field(TInterlaceContext *tinterlace,
     int h;
 
     for (plane = 0; plane < desc->nb_components; plane++) {
-        int lines = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT(src_h, vsub) : src_h;
-        int cols  = plane == 1 || plane == 2 ? FF_CEIL_RSHIFT(    w, hsub) : w;
+        int lines = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT(src_h, vsub) : src_h;
+        int cols  = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT(    w, hsub) : w;
         uint8_t *dstp = dst[plane];
         const uint8_t *srcp = src[plane];
 
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index 3b6e36a..9555ff2 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -152,9 +152,9 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
         int hsub    = plane == 1 || plane == 2 ? s->hsub : 0;
         int vsub    = plane == 1 || plane == 2 ? s->vsub : 0;
         int pixstep = s->pixsteps[plane];
-        int inh     = FF_CEIL_RSHIFT(in->height, vsub);
-        int outw    = FF_CEIL_RSHIFT(out->width,  hsub);
-        int outh    = FF_CEIL_RSHIFT(out->height, vsub);
+        int inh     = AV_CEIL_RSHIFT(in->height, vsub);
+        int outw    = AV_CEIL_RSHIFT(out->width,  hsub);
+        int outh    = AV_CEIL_RSHIFT(out->height, vsub);
         int start   = (outh *  jobnr   ) / nb_jobs;
         int end     = (outh * (jobnr+1)) / nb_jobs;
         uint8_t *dst, *src;
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
index a56b023..d264e24 100644
--- a/libavfilter/vf_unsharp.c
+++ b/libavfilter/vf_unsharp.c
@@ -109,9 +109,9 @@ static int apply_unsharp_c(AVFilterContext *ctx, AVFrame *in, AVFrame *out)
     int i, plane_w[3], plane_h[3];
     UnsharpFilterParam *fp[3];
     plane_w[0] = inlink->w;
-    plane_w[1] = plane_w[2] = FF_CEIL_RSHIFT(inlink->w, s->hsub);
+    plane_w[1] = plane_w[2] = AV_CEIL_RSHIFT(inlink->w, s->hsub);
     plane_h[0] = inlink->h;
-    plane_h[1] = plane_h[2] = FF_CEIL_RSHIFT(inlink->h, s->vsub);
+    plane_h[1] = plane_h[2] = AV_CEIL_RSHIFT(inlink->h, s->vsub);
     fp[0] = &s->luma;
     fp[1] = fp[2] = &s->chroma;
     for (i = 0; i < 3; i++) {
@@ -204,7 +204,7 @@ static int config_props(AVFilterLink *link)
     ret = init_filter_param(link->dst, &s->luma,   "luma",   link->w);
     if (ret < 0)
         return ret;
-    ret = init_filter_param(link->dst, &s->chroma, "chroma", FF_CEIL_RSHIFT(link->w, s->hsub));
+    ret = init_filter_param(link->dst, &s->chroma, "chroma", AV_CEIL_RSHIFT(link->w, s->hsub));
     if (ret < 0)
         return ret;
 
diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c
index bd6c680..f963254 100644
--- a/libavfilter/vf_uspp.c
+++ b/libavfilter/vf_uspp.c
@@ -189,8 +189,8 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3],
 
     for (i = 0; i < 3; i++) {
         int is_chroma = !!i;
-        int w = FF_CEIL_RSHIFT(width,  is_chroma ? p->hsub : 0);
-        int h = FF_CEIL_RSHIFT(height, is_chroma ? p->vsub : 0);
+        int w = AV_CEIL_RSHIFT(width,  is_chroma ? p->hsub : 0);
+        int h = AV_CEIL_RSHIFT(height, is_chroma ? p->vsub : 0);
         int stride = p->temp_stride[i];
         int block = BLOCK >> (is_chroma ? p->hsub : 0);
 
@@ -263,8 +263,8 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3],
 
         offset = (BLOCKc-x1c) + (BLOCKc-y1c) * p->frame_dec->linesize[1];
 
-        for (y = 0; y < FF_CEIL_RSHIFT(height, p->vsub); y++) {
-            for (x = 0; x < FF_CEIL_RSHIFT(width, p->hsub); x++) {
+        for (y = 0; y < AV_CEIL_RSHIFT(height, p->vsub); y++) {
+            for (x = 0; x < AV_CEIL_RSHIFT(width, p->hsub); x++) {
                 p->temp[1][x + y * p->temp_stride[1]] += p->frame_dec->data[1][x + y * p->frame_dec->linesize[1] + offset];
                 p->temp[2][x + y * p->temp_stride[2]] += p->frame_dec->data[2][x + y * p->frame_dec->linesize[2] + offset];
             }
@@ -276,8 +276,8 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3],
         if (!dst[j])
             continue;
         store_slice_c(dst[j], p->temp[j], dst_stride[j], p->temp_stride[j],
-                      FF_CEIL_RSHIFT(width,  is_chroma ? p->hsub : 0),
-                      FF_CEIL_RSHIFT(height, is_chroma ? p->vsub : 0),
+                      AV_CEIL_RSHIFT(width,  is_chroma ? p->hsub : 0),
+                      AV_CEIL_RSHIFT(height, is_chroma ? p->vsub : 0),
                       8-p->log2_count);
     }
 }
@@ -325,8 +325,8 @@ static int config_input(AVFilterLink *inlink)
         int h = (height + 4 * BLOCK-1) & (~(2 * BLOCK-1));
 
         if (is_chroma) {
-            w = FF_CEIL_RSHIFT(w, uspp->hsub);
-            h = FF_CEIL_RSHIFT(h, uspp->vsub);
+            w = AV_CEIL_RSHIFT(w, uspp->hsub);
+            h = AV_CEIL_RSHIFT(h, uspp->vsub);
         }
 
         uspp->temp_stride[i] = w;
@@ -394,11 +394,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             /* if the qp stride is not set, it means the QP are only defined on
              * a line basis */
             if (!qp_stride) {
-                w = FF_CEIL_RSHIFT(inlink->w, 4);
+                w = AV_CEIL_RSHIFT(inlink->w, 4);
                 h = 1;
             } else {
                 w = qp_stride;
-                h = FF_CEIL_RSHIFT(inlink->h, 4);
+                h = AV_CEIL_RSHIFT(inlink->h, 4);
             }
 
             if (w * h > uspp->non_b_qp_alloc_size) {
diff --git a/libavfilter/vf_vectorscope.c b/libavfilter/vf_vectorscope.c
index 5f7cd56..2112b80 100644
--- a/libavfilter/vf_vectorscope.c
+++ b/libavfilter/vf_vectorscope.c
@@ -694,9 +694,9 @@ static int config_input(AVFilterLink *inlink)
 
     s->hsub = desc->log2_chroma_w;
     s->vsub = desc->log2_chroma_h;
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
-    s->planewidth[1]  = s->planewidth[2]  = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
+    s->planewidth[1]  = s->planewidth[2]  = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     s->planewidth[0]  = s->planewidth[3]  = inlink->w;
 
     return 0;
diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c
index 4a4ae0e..cb085e8 100644
--- a/libavfilter/vf_vflip.c
+++ b/libavfilter/vf_vflip.c
@@ -55,7 +55,7 @@ static AVFrame *get_video_buffer(AVFilterLink *link, int w, int h)
 
     for (i = 0; i < 4; i ++) {
         int vsub = i == 1 || i == 2 ? flip->vsub : 0;
-        int height = FF_CEIL_RSHIFT(h, vsub);
+        int height = AV_CEIL_RSHIFT(h, vsub);
 
         if (frame->data[i]) {
             frame->data[i] += (height - 1) * frame->linesize[i];
@@ -73,7 +73,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
 
     for (i = 0; i < 4; i ++) {
         int vsub = i == 1 || i == 2 ? flip->vsub : 0;
-        int height = FF_CEIL_RSHIFT(link->h, vsub);
+        int height = AV_CEIL_RSHIFT(link->h, vsub);
 
         if (frame->data[i]) {
             frame->data[i] += (height - 1) * frame->linesize[i];
diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c
index 54515e6..1d66c50 100644
--- a/libavfilter/vf_vignette.c
+++ b/libavfilter/vf_vignette.c
@@ -267,8 +267,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             const int chroma = plane == 1 || plane == 2;
             const int hsub = chroma ? s->desc->log2_chroma_w : 0;
             const int vsub = chroma ? s->desc->log2_chroma_h : 0;
-            const int w = FF_CEIL_RSHIFT(inlink->w, hsub);
-            const int h = FF_CEIL_RSHIFT(inlink->h, vsub);
+            const int w = AV_CEIL_RSHIFT(inlink->w, hsub);
+            const int h = AV_CEIL_RSHIFT(inlink->h, vsub);
 
             for (y = 0; y < h; y++) {
                 uint8_t *dstp = dst;
diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c
index a07efe4..e6f6628 100644
--- a/libavfilter/vf_w3fdif.c
+++ b/libavfilter/vf_w3fdif.c
@@ -166,7 +166,7 @@ static int config_input(AVFilterLink *inlink)
     if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
         return ret;
 
-    s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
+    s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     s->planeheight[0] = s->planeheight[3] = inlink->h;
 
     s->nb_planes = av_pix_fmt_count_planes(inlink->format);
diff --git a/libavfilter/vf_waveform.c b/libavfilter/vf_waveform.c
index d384258..4fb78bd 100644
--- a/libavfilter/vf_waveform.c
+++ b/libavfilter/vf_waveform.c
@@ -158,8 +158,8 @@ static void envelope_instant16(WaveformContext *s, AVFrame *out, int plane, int
     const int is_chroma = (component == 1 || component == 2);
     const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
     const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
-    const int dst_h = FF_CEIL_RSHIFT(out->height, shift_h);
-    const int dst_w = FF_CEIL_RSHIFT(out->width, shift_w);
+    const int dst_h = AV_CEIL_RSHIFT(out->height, shift_h);
+    const int dst_w = AV_CEIL_RSHIFT(out->width, shift_w);
     const int start = s->estart[plane];
     const int end = s->eend[plane];
     uint16_t *dst;
@@ -208,8 +208,8 @@ static void envelope_instant(WaveformContext *s, AVFrame *out, int plane, int co
     const int is_chroma = (component == 1 || component == 2);
     const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
     const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
-    const int dst_h = FF_CEIL_RSHIFT(out->height, shift_h);
-    const int dst_w = FF_CEIL_RSHIFT(out->width, shift_w);
+    const int dst_h = AV_CEIL_RSHIFT(out->height, shift_h);
+    const int dst_w = AV_CEIL_RSHIFT(out->width, shift_w);
     const int start = s->estart[plane];
     const int end = s->eend[plane];
     uint8_t *dst;
@@ -259,8 +259,8 @@ static void envelope_peak16(WaveformContext *s, AVFrame *out, int plane, int com
     const int is_chroma = (component == 1 || component == 2);
     const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
     const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
-    const int dst_h = FF_CEIL_RSHIFT(out->height, shift_h);
-    const int dst_w = FF_CEIL_RSHIFT(out->width, shift_w);
+    const int dst_h = AV_CEIL_RSHIFT(out->height, shift_h);
+    const int dst_w = AV_CEIL_RSHIFT(out->width, shift_w);
     const int start = s->estart[plane];
     const int end = s->eend[plane];
     int *emax = s->emax[plane][component];
@@ -331,8 +331,8 @@ static void envelope_peak(WaveformContext *s, AVFrame *out, int plane, int compo
     const int is_chroma = (component == 1 || component == 2);
     const int shift_w = (is_chroma ? s->desc->log2_chroma_w : 0);
     const int shift_h = (is_chroma ? s->desc->log2_chroma_h : 0);
-    const int dst_h = FF_CEIL_RSHIFT(out->height, shift_h);
-    const int dst_w = FF_CEIL_RSHIFT(out->width, shift_w);
+    const int dst_h = AV_CEIL_RSHIFT(out->height, shift_h);
+    const int dst_w = AV_CEIL_RSHIFT(out->width, shift_w);
     const int start = s->estart[plane];
     const int end = s->eend[plane];
     int *emax = s->emax[plane][component];
@@ -447,8 +447,8 @@ static void lowpass16(WaveformContext *s, AVFrame *in, AVFrame *out,
     const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
     const int limit = s->max - 1;
     const int max = limit - intensity;
-    const int src_h = FF_CEIL_RSHIFT(in->height, shift_h);
-    const int src_w = FF_CEIL_RSHIFT(in->width, shift_w);
+    const int src_h = AV_CEIL_RSHIFT(in->height, shift_h);
+    const int src_w = AV_CEIL_RSHIFT(in->width, shift_w);
     const uint16_t *src_data = (const uint16_t *)in->data[plane];
     uint16_t *dst_data = (uint16_t *)out->data[plane] + (column ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
     uint16_t * const dst_bottom_line = dst_data + dst_linesize * ((s->size >> shift_h) - 1);
@@ -496,8 +496,8 @@ static void lowpass(WaveformContext *s, AVFrame *in, AVFrame *out,
     const int dst_linesize = out->linesize[plane];
     const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
     const int max = 255 - intensity;
-    const int src_h = FF_CEIL_RSHIFT(in->height, shift_h);
-    const int src_w = FF_CEIL_RSHIFT(in->width, shift_w);
+    const int src_h = AV_CEIL_RSHIFT(in->height, shift_h);
+    const int src_w = AV_CEIL_RSHIFT(in->width, shift_w);
     const uint8_t *src_data = in->data[plane];
     uint8_t *dst_data = out->data[plane] + (column ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
     uint8_t * const dst_bottom_line = dst_data + dst_linesize * ((s->size >> shift_h) - 1);
@@ -1205,8 +1205,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
     for (k = 0; k < s->ncomp; k++) {
         const int is_chroma = (k == 1 || k == 2);
-        const int dst_h = FF_CEIL_RSHIFT(outlink->h, (is_chroma ? s->desc->log2_chroma_h : 0));
-        const int dst_w = FF_CEIL_RSHIFT(outlink->w, (is_chroma ? s->desc->log2_chroma_w : 0));
+        const int dst_h = AV_CEIL_RSHIFT(outlink->h, (is_chroma ? s->desc->log2_chroma_h : 0));
+        const int dst_w = AV_CEIL_RSHIFT(outlink->w, (is_chroma ? s->desc->log2_chroma_w : 0));
         if (s->bits <= 8) {
             for (i = 0; i < dst_h ; i++)
                 memset(out->data[s->desc->comp[k].plane] +
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index 8791129..d9668d0 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -233,8 +233,8 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic,
         int h = dstpic->height;
 
         if (i == 1 || i == 2) {
-            w = FF_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w);
-            h = FF_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h);
+            w = AV_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w);
+            h = AV_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h);
         }
 
 
diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c
index 208d4d6..5acbe42 100644
--- a/libavfilter/vf_zoompan.c
+++ b/libavfilter/vf_zoompan.c
@@ -178,10 +178,10 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va
         return ret;
     }
 
-    px[1] = px[2] = FF_CEIL_RSHIFT(x, s->desc->log2_chroma_w);
+    px[1] = px[2] = AV_CEIL_RSHIFT(x, s->desc->log2_chroma_w);
     px[0] = px[3] = x;
 
-    py[1] = py[2] = FF_CEIL_RSHIFT(y, s->desc->log2_chroma_h);
+    py[1] = py[2] = AV_CEIL_RSHIFT(y, s->desc->log2_chroma_h);
     py[0] = py[3] = y;
 
     s->sws = sws_alloc_context();
diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c
index 1cdd3a4..25ad2ad 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -302,7 +302,7 @@ static int request_frame(AVFilterLink *outlink)
     MPTestContext *test = outlink->src->priv;
     AVFrame *picref;
     int w = WIDTH, h = HEIGHT,
-        cw = FF_CEIL_RSHIFT(w, test->hsub), ch = FF_CEIL_RSHIFT(h, test->vsub);
+        cw = AV_CEIL_RSHIFT(w, test->hsub), ch = AV_CEIL_RSHIFT(h, test->vsub);
     unsigned int frame = outlink->frame_count;
     enum test_type tt = test->test;
     int i;
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 181e2a7..54d8b26 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -1145,9 +1145,9 @@ static void draw_bar(TestSourceContext *test, const uint8_t color[4],
 
         if (plane == 1 || plane == 2) {
             px = x >> desc->log2_chroma_w;
-            pw = FF_CEIL_RSHIFT(w, desc->log2_chroma_w);
+            pw = AV_CEIL_RSHIFT(w, desc->log2_chroma_w);
             py = y >> desc->log2_chroma_h;
-            ph = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
+            ph = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
         } else {
             px = x;
             pw = w;
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 9291802..2f0aec1 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -129,7 +129,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
 
     if (img->split_planes) {
         int ysize = codec->width * codec->height;
-        int usize = FF_CEIL_RSHIFT(codec->width, desc->log2_chroma_w) * FF_CEIL_RSHIFT(codec->height, desc->log2_chroma_h);
+        int usize = AV_CEIL_RSHIFT(codec->width, desc->log2_chroma_w) * AV_CEIL_RSHIFT(codec->height, desc->log2_chroma_h);
         if (desc->comp[0].depth >= 9) {
             ysize *= 2;
             usize *= 2;
diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index 60629cf..72c07c7 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -42,8 +42,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
     s->timestamp = s->cur_timestamp;
 
     /* convert video pixel dimensions from pixels to blocks */
-    w = FF_CEIL_RSHIFT(s1->streams[0]->codec->width, 3);
-    h = FF_CEIL_RSHIFT(s1->streams[0]->codec->height, 3);
+    w = AV_CEIL_RSHIFT(s1->streams[0]->codec->width, 3);
+    h = AV_CEIL_RSHIFT(s1->streams[0]->codec->height, 3);
 
     /* get the pixel format type or fail */
     if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P ||
diff --git a/libavformat/uncodedframecrcenc.c b/libavformat/uncodedframecrcenc.c
index 17f4786..ed4532d 100644
--- a/libavformat/uncodedframecrcenc.c
+++ b/libavformat/uncodedframecrcenc.c
@@ -64,7 +64,7 @@ static void video_frame_cksum(AVBPrint *bp, AVFrame *frame)
         unsigned cksum = 0;
         int h = frame->height;
         if ((i == 1 || i == 2) && desc->nb_components >= 3)
-            h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
+            h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
         data = frame->data[i];
         for (y = 0; y < h; y++) {
             cksum = av_adler32_update(cksum, data, linesize[i]);
diff --git a/libavformat/yuv4mpegenc.c b/libavformat/yuv4mpegenc.c
index 25bf13f..6120c7e 100644
--- a/libavformat/yuv4mpegenc.c
+++ b/libavformat/yuv4mpegenc.c
@@ -209,8 +209,8 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
         // Adjust for smaller Cb and Cr planes
         av_pix_fmt_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift,
                                          &v_chroma_shift);
-        width  = FF_CEIL_RSHIFT(width,  h_chroma_shift);
-        height = FF_CEIL_RSHIFT(height, v_chroma_shift);
+        width  = AV_CEIL_RSHIFT(width,  h_chroma_shift);
+        height = AV_CEIL_RSHIFT(height, v_chroma_shift);
 
         ptr1 = frame->data[1];
         ptr2 = frame->data[2];
diff --git a/libavutil/common.h b/libavutil/common.h
index 7b7bcbe..0f30073 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -55,8 +55,10 @@
 /* assume b>0 */
 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
 /* Fast a/(1<<b) rounded toward +inf. Assume a>=0 and b>=0 */
-#define FF_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
+#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \
                                                        : ((a) + (1<<(b)) - 1) >> (b))
+/* Backwards compat. */
+#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT
 #define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b))
 #define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b))
 
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 92bbe09..9f9c720 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -188,7 +188,7 @@ static int get_video_buffer(AVFrame *frame, int align)
     for (i = 0; i < 4 && frame->linesize[i]; i++) {
         int h = FFALIGN(frame->height, 32);
         if (i == 1 || i == 2)
-            h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
+            h = AV_CEIL_RSHIFT(h, desc->log2_chroma_h);
 
         frame->buf[i] = av_buffer_alloc(frame->linesize[i] * h + 16 + 16/*STRIDE_ALIGN*/ - 1);
         if (!frame->buf[i])
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 783fdb4..3320664 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -325,7 +325,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
                 return;
             }
             if (i == 1 || i == 2) {
-                h = FF_CEIL_RSHIFT(height, desc->log2_chroma_h);
+                h = AV_CEIL_RSHIFT(height, desc->log2_chroma_h);
             }
             av_image_copy_plane(dst_data[i], dst_linesizes[i],
                                 src_data[i], src_linesizes[i],
diff --git a/libswscale/alphablend.c b/libswscale/alphablend.c
index 1f63493..b568659 100644
--- a/libswscale/alphablend.c
+++ b/libswscale/alphablend.c
@@ -50,7 +50,7 @@ int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[],
             int w = plane ? c->chrSrcW : c->srcW;
             int x_subsample = plane ? desc->log2_chroma_w: 0;
             int y_subsample = plane ? desc->log2_chroma_h: 0;
-            for (y = srcSliceY >> y_subsample; y < FF_CEIL_RSHIFT(srcSliceH, y_subsample); y++) {
+            for (y = srcSliceY >> y_subsample; y < AV_CEIL_RSHIFT(srcSliceH, y_subsample); y++) {
                 if (x_subsample || y_subsample) {
                     int alpha;
                     unsigned u;
diff --git a/libswscale/hscale.c b/libswscale/hscale.c
index 9f9d35b..eca0635 100644
--- a/libswscale/hscale.c
+++ b/libswscale/hscale.c
@@ -166,8 +166,8 @@ int ff_init_desc_hscale(SwsFilterDescriptor *desc, SwsSlice *src, SwsSlice *dst,
 static int chr_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH)
 {
     FilterContext *instance = desc->instance;
-    int srcW = FF_CEIL_RSHIFT(desc->src->width, desc->src->h_chr_sub_sample);
-    int dstW = FF_CEIL_RSHIFT(desc->dst->width, desc->dst->h_chr_sub_sample);
+    int srcW = AV_CEIL_RSHIFT(desc->src->width, desc->src->h_chr_sub_sample);
+    int dstW = AV_CEIL_RSHIFT(desc->dst->width, desc->dst->h_chr_sub_sample);
     int xInc = instance->xInc;
 
     uint8_t ** src1 = desc->src->plane[1].line;
@@ -201,7 +201,7 @@ static int chr_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int
 
 static int chr_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int sliceH)
 {
-    int srcW = FF_CEIL_RSHIFT(desc->src->width, desc->src->h_chr_sub_sample);
+    int srcW = AV_CEIL_RSHIFT(desc->src->width, desc->src->h_chr_sub_sample);
     ColorContext * instance = desc->instance;
     uint32_t * pal = instance->pal;
 
diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
index 1cc28cd..499d25b 100644
--- a/libswscale/rgb2rgb_template.c
+++ b/libswscale/rgb2rgb_template.c
@@ -855,7 +855,7 @@ static void yuyvtoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
                            int lumStride, int chromStride, int srcStride)
 {
     int y;
-    const int chromWidth = FF_CEIL_RSHIFT(width, 1);
+    const int chromWidth = AV_CEIL_RSHIFT(width, 1);
 
     for (y = 0; y < height; y++) {
         extract_even_c(src, ydst, width);
@@ -875,7 +875,7 @@ static void yuyvtoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
                            int lumStride, int chromStride, int srcStride)
 {
     int y;
-    const int chromWidth = FF_CEIL_RSHIFT(width, 1);
+    const int chromWidth = AV_CEIL_RSHIFT(width, 1);
 
     for (y = 0; y < height; y++) {
         extract_even_c(src, ydst, width);
@@ -893,7 +893,7 @@ static void uyvytoyuv420_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
                            int lumStride, int chromStride, int srcStride)
 {
     int y;
-    const int chromWidth = FF_CEIL_RSHIFT(width, 1);
+    const int chromWidth = AV_CEIL_RSHIFT(width, 1);
 
     for (y = 0; y < height; y++) {
         extract_even_c(src + 1, ydst, width);
@@ -913,7 +913,7 @@ static void uyvytoyuv422_c(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
                            int lumStride, int chromStride, int srcStride)
 {
     int y;
-    const int chromWidth = FF_CEIL_RSHIFT(width, 1);
+    const int chromWidth = AV_CEIL_RSHIFT(width, 1);
 
     for (y = 0; y < height; y++) {
         extract_even_c(src + 1, ydst, width);
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 1b39577..8d20577 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -373,7 +373,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
     yuv2packedX_fn yuv2packedX       = c->yuv2packedX;
     yuv2anyX_fn yuv2anyX             = c->yuv2anyX;
     const int chrSrcSliceY           =                srcSliceY >> c->chrSrcVSubSample;
-    const int chrSrcSliceH           = FF_CEIL_RSHIFT(srcSliceH,   c->chrSrcVSubSample);
+    const int chrSrcSliceH           = AV_CEIL_RSHIFT(srcSliceH,   c->chrSrcVSubSample);
     int should_dither                = is9_OR_10BPS(c->srcFormat) ||
                                        is16BPS(c->srcFormat);
     int lastDstY;
@@ -479,7 +479,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 
     ff_init_slice_from_src(vout_slice, (uint8_t**)dst, dstStride, c->dstW,
             dstY, dstH, dstY >> c->chrDstVSubSample,
-            FF_CEIL_RSHIFT(dstH, c->chrDstVSubSample), 0);
+            AV_CEIL_RSHIFT(dstH, c->chrDstVSubSample), 0);
     if (srcSliceY == 0) {
         hout_slice->plane[0].sliceY = lastInLumBuf + 1;
         hout_slice->plane[1].sliceY = lastInChrBuf + 1;
@@ -558,7 +558,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 
         // Do we have enough lines in this slice to output the dstY line
         enough_lines = lastLumSrcY2 < srcSliceY + srcSliceH &&
-                       lastChrSrcY < FF_CEIL_RSHIFT(srcSliceY + srcSliceH, c->chrSrcVSubSample);
+                       lastChrSrcY < AV_CEIL_RSHIFT(srcSliceY + srcSliceH, c->chrSrcVSubSample);
 
         if (!enough_lines) {
             lastLumSrcY = srcSliceY + srcSliceH - 1;
@@ -580,7 +580,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
         cPosY = hout_slice->plane[1].sliceY + hout_slice->plane[1].sliceH;
         if (cPosY <= lastChrSrcY && !hasChrHoles) {
             firstCPosY = FFMAX(firstChrSrcY, cPosY);
-            lastCPosY = FFMIN(lastChrSrcY + MAX_LINES_AHEAD, FF_CEIL_RSHIFT(srcSliceY + srcSliceH, c->chrSrcVSubSample) - 1);
+            lastCPosY = FFMIN(lastChrSrcY + MAX_LINES_AHEAD, AV_CEIL_RSHIFT(srcSliceY + srcSliceH, c->chrSrcVSubSample) - 1);
         } else {
             firstCPosY = lastInChrBuf + 1;
             lastCPosY = lastChrSrcY;
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 89d5131..74f3467 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -1413,9 +1413,9 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
     const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat);
     int plane, i, j;
     for (plane = 0; plane < 4; plane++) {
-        int length = (plane == 0 || plane == 3) ? c->srcW  : FF_CEIL_RSHIFT(c->srcW,   c->chrDstHSubSample);
-        int y =      (plane == 0 || plane == 3) ? srcSliceY: FF_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample);
-        int height = (plane == 0 || plane == 3) ? srcSliceH: FF_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample);
+        int length = (plane == 0 || plane == 3) ? c->srcW  : AV_CEIL_RSHIFT(c->srcW,   c->chrDstHSubSample);
+        int y =      (plane == 0 || plane == 3) ? srcSliceY: AV_CEIL_RSHIFT(srcSliceY, c->chrDstVSubSample);
+        int height = (plane == 0 || plane == 3) ? srcSliceH: AV_CEIL_RSHIFT(srcSliceH, c->chrDstVSubSample);
         const uint8_t *srcPtr = src[plane];
         uint8_t *dstPtr = dst[plane] + dstStride[plane] * y;
         int shiftonly = plane == 1 || plane == 2 || (!c->srcRange && plane == 0);
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 73aefc5..ef4241a 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1358,11 +1358,11 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
          (flags & SWS_FAST_BILINEAR)))
         c->chrSrcHSubSample = 1;
 
-    // Note the FF_CEIL_RSHIFT is so that we always round toward +inf.
-    c->chrSrcW = FF_CEIL_RSHIFT(srcW, c->chrSrcHSubSample);
-    c->chrSrcH = FF_CEIL_RSHIFT(srcH, c->chrSrcVSubSample);
-    c->chrDstW = FF_CEIL_RSHIFT(dstW, c->chrDstHSubSample);
-    c->chrDstH = FF_CEIL_RSHIFT(dstH, c->chrDstVSubSample);
+    // Note the AV_CEIL_RSHIFT is so that we always round toward +inf.
+    c->chrSrcW = AV_CEIL_RSHIFT(srcW, c->chrSrcHSubSample);
+    c->chrSrcH = AV_CEIL_RSHIFT(srcH, c->chrSrcVSubSample);
+    c->chrDstW = AV_CEIL_RSHIFT(dstW, c->chrDstHSubSample);
+    c->chrDstH = AV_CEIL_RSHIFT(dstH, c->chrDstVSubSample);
 
     FF_ALLOCZ_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail);
 
diff --git a/libswscale/vscale.c b/libswscale/vscale.c
index 39e1eec..72f799d 100644
--- a/libswscale/vscale.c
+++ b/libswscale/vscale.c
@@ -70,7 +70,7 @@ static int chr_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int slice
         return 0;
     else {
         VScalerContext *inst = desc->instance;
-        int dstW = FF_CEIL_RSHIFT(desc->dst->width, desc->dst->h_chr_sub_sample);
+        int dstW = AV_CEIL_RSHIFT(desc->dst->width, desc->dst->h_chr_sub_sample);
         int chrSliceY = sliceY >> desc->dst->v_chr_sub_sample;
 
         int first = FFMAX(1-inst->filter_size, inst->filter_pos[chrSliceY]);
diff --git a/libswscale/x86/rgb2rgb_template.c b/libswscale/x86/rgb2rgb_template.c
index b56e15c..95d4f8f 100644
--- a/libswscale/x86/rgb2rgb_template.c
+++ b/libswscale/x86/rgb2rgb_template.c
@@ -2457,7 +2457,7 @@ static void RENAME(yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
                                  int lumStride, int chromStride, int srcStride)
 {
     int y;
-    const int chromWidth = FF_CEIL_RSHIFT(width, 1);
+    const int chromWidth = AV_CEIL_RSHIFT(width, 1);
 
     for (y=0; y<height; y++) {
         RENAME(extract_even)(src, ydst, width);
@@ -2483,7 +2483,7 @@ static void RENAME(yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
                                  int lumStride, int chromStride, int srcStride)
 {
     int y;
-    const int chromWidth = FF_CEIL_RSHIFT(width, 1);
+    const int chromWidth = AV_CEIL_RSHIFT(width, 1);
 
     for (y=0; y<height; y++) {
         RENAME(extract_even)(src, ydst, width);
@@ -2507,7 +2507,7 @@ static void RENAME(uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
                                  int lumStride, int chromStride, int srcStride)
 {
     int y;
-    const int chromWidth = FF_CEIL_RSHIFT(width, 1);
+    const int chromWidth = AV_CEIL_RSHIFT(width, 1);
 
     for (y=0; y<height; y++) {
         RENAME(extract_odd)(src, ydst, width);
@@ -2533,7 +2533,7 @@ static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, co
                                  int lumStride, int chromStride, int srcStride)
 {
     int y;
-    const int chromWidth = FF_CEIL_RSHIFT(width, 1);
+    const int chromWidth = AV_CEIL_RSHIFT(width, 1);
 
     for (y=0; y<height; y++) {
         RENAME(extract_odd)(src, ydst, width);
-- 
2.7.0.rc3



More information about the ffmpeg-devel mailing list