diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f397ad44862db93f8e6c27d5c4ac712246c99a8c..879eb7f136bf4998d3fcf489b677a423d03d1753 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -32,7 +32,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 52
 #define LIBAVCODEC_VERSION_MINOR 87
-#define LIBAVCODEC_VERSION_MICRO  1
+#define LIBAVCODEC_VERSION_MICRO  2
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 806733fc1118d4e10e6fa88cbd390820454c1b85..d0de3f6ac3f6cc6b6ca66a93ac4562c86d19b8cd 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -972,7 +972,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     c->pic.data[0] = NULL;
 
-    if (av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) {
+    if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) {
         return 1;
     }
 
diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index 3eddc6708f0a8d2b10b3e6dee2262d3225767c3b..bacd1f8e9f8c833613516016ca9cfdd22f7bd6ba 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -269,7 +269,7 @@ int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
     if (parse_source_parameters(avctx, gb, source))
         return -1;
 
-    if (av_check_image_size(source->width, source->height, 0, avctx))
+    if (av_image_check_size(source->width, source->height, 0, avctx))
         return -1;
 
     avcodec_set_dimensions(avctx, source->width, source->height);
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 7438773be044f651e139083fb42ca0e8fe0bb6f9..8212487f97a01adcf6359bc200dfe89691ddcf7a 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -306,7 +306,7 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     }
 
     avctx->pix_fmt = PIX_FMT_YUV422P;
-    if (av_check_image_size(ctx->width, ctx->height, 0, avctx))
+    if (av_image_check_size(ctx->width, ctx->height, 0, avctx))
         return -1;
     avcodec_set_dimensions(avctx, ctx->width, ctx->height);
 
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index a976ba40248cfa35d80018574afa27663a40ea49..f92b3d0e314bcf21d2ce726e5c4acbbed6203e76 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -140,7 +140,7 @@ static int decode_frame(AVCodecContext *avctx,
 
     if (s->picture.data[0])
         avctx->release_buffer(avctx, &s->picture);
-    if (av_check_image_size(w, h, 0, avctx))
+    if (av_image_check_size(w, h, 0, avctx))
         return -1;
     if (w != avctx->width || h != avctx->height)
         avcodec_set_dimensions(avctx, w, h);
diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index 2933136103a5933d18884d729ad92673697b688f..f506f7cc3e0d1e0a883052788ae5308024cc5c66 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -157,7 +157,7 @@ static int cmv_decode_frame(AVCodecContext *avctx,
         return buf_size;
     }
 
-    if (av_check_image_size(s->width, s->height, 0, s->avctx))
+    if (av_image_check_size(s->width, s->height, 0, s->avctx))
         return -1;
 
     /* shuffle */
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
index f12b3e60721715469739c011d02eb52bb05bbe3a..db92d6b69d37fc4da0739393ef84fb35572963d5 100644
--- a/libavcodec/eamad.c
+++ b/libavcodec/eamad.c
@@ -261,7 +261,7 @@ static int decode_frame(AVCodecContext *avctx,
     buf += 16;
 
     if (avctx->width != s->width || avctx->height != s->height) {
-        if (av_check_image_size(s->width, s->height, 0, avctx) < 0)
+        if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
             return -1;
         avcodec_set_dimensions(avctx, s->width, s->height);
         if (t->frame.data[0])
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index cfb0f8f5636b30a257a103ba8f372c04bdef464b..45c6644c568716ba7519d4214386beb97a859745 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -276,7 +276,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
         }
     }
 
-    if (av_check_image_size(s->width, s->height, 0, avctx))
+    if (av_image_check_size(s->width, s->height, 0, avctx))
         return -1;
 
     /* shuffle */
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index dd15f2dd70fc77c189d54b83e3725db2721037da..f53291de4285c225397b0bc452d23786a4379e1e 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -83,7 +83,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
         width = height = 0;
         break;
     }
-    if(av_check_image_size(width, height, 0, s->avctx))
+    if(av_image_check_size(width, height, 0, s->avctx))
         return -1;
     s->width = width;
     s->height = height;
diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index 06cd42142d39df826d2bc23317960cb7041d2464..4cc80017e894958c9978995c76011782a0b49cc5 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -297,7 +297,7 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *data_size, A
         return -1;
 
     avctx->pix_fmt = PIX_FMT_PAL8;
-    if (av_check_image_size(s->screen_width, s->screen_height, 0, avctx))
+    if (av_image_check_size(s->screen_width, s->screen_height, 0, avctx))
         return -1;
     avcodec_set_dimensions(avctx, s->screen_width, s->screen_height);
 
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 92dcead9aeb8f6a182635f254087102be167edd6..6c5e06517857916f7dac76720d379249a4287139 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -342,7 +342,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
     sps->mb_width = get_ue_golomb(&s->gb) + 1;
     sps->mb_height= get_ue_golomb(&s->gb) + 1;
     if((unsigned)sps->mb_width >= INT_MAX/16 || (unsigned)sps->mb_height >= INT_MAX/16 ||
-       av_check_image_size(16*sps->mb_width, 16*sps->mb_height, 0, h->s.avctx)){
+       av_image_check_size(16*sps->mb_width, 16*sps->mb_height, 0, h->s.avctx)){
         av_log(h->s.avctx, AV_LOG_ERROR, "mb_width/height overflow\n");
         goto fail;
     }
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 7ddcbc6c927bf27656e365dc86f39197bec2890a..19f41721544c422e6372370ecbde2ed33e77ed16 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -161,7 +161,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-    if ((err = av_check_image_size(avctx->width, avctx->height, 0, avctx)))
+    if ((err = av_image_check_size(avctx->width, avctx->height, 0, avctx)))
         return err;
     s->planesize = FFALIGN(avctx->width, 16) >> 3; // Align plane size in bits to word-boundary
     s->planebuf = av_malloc(s->planesize + FF_INPUT_BUFFER_PADDING_SIZE);
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index c29d92bc5baba25185cdb9efe5ca24eed879657d..ee4a4d284dc2b9e7cf052096d758486c4c55c854 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -501,13 +501,13 @@ int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){
 #if LIBAVCODEC_VERSION_MAJOR < 53
 int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
 {
-    return av_fill_image_linesizes(picture->linesize, pix_fmt, width);
+    return av_image_fill_linesizes(picture->linesize, pix_fmt, width);
 }
 
 int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
                     int height)
 {
-    return av_fill_image_pointers(picture->data, pix_fmt, height, ptr, picture->linesize);
+    return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture->linesize);
 }
 #endif
 
@@ -515,13 +515,13 @@ int avpicture_fill(AVPicture *picture, uint8_t *ptr,
                    enum PixelFormat pix_fmt, int width, int height)
 {
 
-    if(av_check_image_size(width, height, 0, NULL))
+    if(av_image_check_size(width, height, 0, NULL))
         return -1;
 
-    if (av_fill_image_linesizes(picture->linesize, pix_fmt, width))
+    if (av_image_fill_linesizes(picture->linesize, pix_fmt, width))
         return -1;
 
-    return av_fill_image_pointers(picture->data, pix_fmt, height, ptr, picture->linesize);
+    return av_image_fill_pointers(picture->data, pix_fmt, height, ptr, picture->linesize);
 }
 
 int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
@@ -597,7 +597,7 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width,
 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height)
 {
     AVPicture dummy_pict;
-    if(av_check_image_size(width, height, 0, NULL))
+    if(av_image_check_size(width, height, 0, NULL))
         return -1;
     switch (pix_fmt) {
     case PIX_FMT_RGB8:
@@ -797,7 +797,7 @@ void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
 #if LIBAVCODEC_VERSION_MAJOR < 53
 int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
 {
-    return av_get_image_linesize(pix_fmt, width, plane);
+    return av_image_get_linesize(pix_fmt, width, plane);
 }
 #endif
 
@@ -814,7 +814,7 @@ void av_picture_data_copy(uint8_t *dst_data[4], int dst_linesize[4],
     case FF_PIXEL_PLANAR:
         for(i = 0; i < pf->nb_channels; i++) {
             int h;
-            int bwidth = av_get_image_linesize(pix_fmt, width, i);
+            int bwidth = av_image_get_linesize(pix_fmt, width, i);
             h = height;
             if (i == 1 || i == 2) {
                 h= -((-height)>>desc->log2_chroma_h);
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index f2b6d0b789e853df07841c26084fe9740183126f..66ea987c38d076bf8313a1ac4dac856ca84c886f 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -996,7 +996,7 @@ static int iv_decode_frame(AVCodecContext *avctx,
     image_height = bytestream_get_le16(&buf_pos);
     image_width  = bytestream_get_le16(&buf_pos);
 
-    if(av_check_image_size(image_width, image_height, 0, avctx))
+    if(av_image_check_size(image_width, image_height, 0, avctx))
         return -1;
     if (image_width != avctx->width || image_height != avctx->height) {
         int ret;
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 7d2ba48b57730ba16cd98904b1f56951e3ebf8a1..a41d312a60aabccfa195d2ef9f1a11089b9e88ff 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -51,7 +51,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     h = (buf[1] + 1) * 8;
     buf += 2;
 
-    if (av_check_image_size(w, h, 0, avctx))
+    if (av_image_check_size(w, h, 0, avctx))
         return -1;
 
     if (w != avctx->width || h != avctx->height)
diff --git a/libavcodec/libdiracdec.c b/libavcodec/libdiracdec.c
index e26186f317c85f9eb7202ba211e8ffcd0c7aa97b..0e8454e3108ae94fab0a7aa1603c02b6c1556077 100644
--- a/libavcodec/libdiracdec.c
+++ b/libavcodec/libdiracdec.c
@@ -106,7 +106,7 @@ static int libdirac_decode_frame(AVCodecContext *avccontext,
             /* tell FFmpeg about sequence details */
             dirac_sourceparams_t *src_params = &p_dirac_params->p_decoder->src_params;
 
-            if (av_check_image_size(src_params->width, src_params->height,
+            if (av_image_check_size(src_params->width, src_params->height,
                                     0, avccontext) < 0) {
                 av_log(avccontext, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n",
                        src_params->width, src_params->height);
diff --git a/libavcodec/libopenjpeg.c b/libavcodec/libopenjpeg.c
index c7ccd1dd26504a4b6697d9d24197bfa7ead6a52c..a23b17f12ddc8d4d942950339dcf940068035c7f 100644
--- a/libavcodec/libopenjpeg.c
+++ b/libavcodec/libopenjpeg.c
@@ -114,7 +114,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
     }
     width  = image->comps[0].w << avctx->lowres;
     height = image->comps[0].h << avctx->lowres;
-    if(av_check_image_size(width, height, 0, avctx) < 0) {
+    if(av_image_check_size(width, height, 0, avctx) < 0) {
         av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height);
         goto done;
     }
diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
index 26f2c68a28a14c6e8556960e57b71488b370e91c..fc875bbf4218a47031472b4ea3f47ab5f320101e 100644
--- a/libavcodec/libschroedingerdec.c
+++ b/libavcodec/libschroedingerdec.c
@@ -170,7 +170,7 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
     p_schro_params->format = schro_decoder_get_video_format(decoder);
 
     /* Tell FFmpeg about sequence details. */
-    if (av_check_image_size(p_schro_params->format->width, p_schro_params->format->height,
+    if (av_image_check_size(p_schro_params->format->width, p_schro_params->format->height,
                             0, avccontext) < 0) {
         av_log(avccontext, AV_LOG_ERROR, "invalid dimensions (%dx%d)\n",
                p_schro_params->format->width, p_schro_params->format->height);
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 8fa7050654c388061a472ef73f72cc476363970c..12efb9f00ffc7c37d0ad4db7dd96d37651907dfe 100644
--- a/libavcodec/libvpxdec.c
+++ b/libavcodec/libvpxdec.c
@@ -87,7 +87,7 @@ static int vp8_decode(AVCodecContext *avctx,
         if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) {
             av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
                    avctx->width, avctx->height, img->d_w, img->d_h);
-            if (av_check_image_size(img->d_w, img->d_h, 0, avctx))
+            if (av_image_check_size(img->d_w, img->d_h, 0, avctx))
                 return AVERROR_INVALIDDATA;
             avcodec_set_dimensions(avctx, img->d_w, img->d_h);
         }
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 5f2324516b27cd09b8f3ef57ecd92df916955ddc..5686380e0a10474fa8b66af90823bd36bbd6fa17 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -219,7 +219,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
         height= s->height;
 
     av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height);
-    if(av_check_image_size(width, height, 0, s->avctx))
+    if(av_image_check_size(width, height, 0, s->avctx))
         return -1;
 
     nb_components = get_bits(&s->gb, 8);
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 42496ec97f1ba2250be9fba9eb06571532327a06..f4e80bafe1159337265896480d37e829adab6b6a 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -511,7 +511,7 @@ av_cold int MPV_common_init(MpegEncContext *s)
         return -1;
     }
 
-    if((s->width || s->height) && av_check_image_size(s->width, s->height, 0, s->avctx))
+    if((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx))
         return -1;
 
     dsputil_init(&s->dsp, s->avctx);
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index e52ea88b182e6cf926ecba85ddf118694804bc2c..26dcfd0d22bfc827cde2e60ce1def13bf18d7091 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -112,7 +112,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit
     if (quality >= 0)
         get_quant_quality(c, quality);
     if (width != c->width || height != c->height) {
-        if (av_check_image_size(height, width, 0, avctx) < 0)
+        if (av_image_check_size(height, width, 0, avctx) < 0)
             return 0;
         avctx->width = c->width = width;
         avctx->height = c->height = height;
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
index 988febbb8fb63496c872fe19c6dd564ca6b5f94c..c1b67cdee9e37642800fb8beb408bb51c7d485ad 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -143,7 +143,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     if (p->data[0])
         avctx->release_buffer(avctx, p);
 
-    if (av_check_image_size(w, h, 0, avctx))
+    if (av_image_check_size(w, h, 0, avctx))
         return -1;
     if (w != avctx->width || h != avctx->height)
         avcodec_set_dimensions(avctx, w, h);
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 545e48cfd6134181f245bf97ba5cc593b3a4e746..4b41d6daa31de62d91d2d061879c3a47092df2ec 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -270,7 +270,7 @@ static void parse_presentation_segment(AVCodecContext *avctx,
 
     dprintf(avctx, "Video Dimensions %dx%d\n",
             w, h);
-    if (av_check_image_size(w, h, 0, avctx) >= 0)
+    if (av_image_check_size(w, h, 0, avctx) >= 0)
         avcodec_set_dimensions(avctx, w, h);
 
     /* Skip 1 bytes of unknown, frame rate? */
diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
index 26c9c005f7bd88b05f484e0595e9e36d4f995fc2..8f46fc06e8b47952ede08ccdf3b79e3509196b08 100644
--- a/libavcodec/pictordec.c
+++ b/libavcodec/pictordec.c
@@ -136,7 +136,7 @@ static int decode_frame(AVCodecContext *avctx,
     avctx->pix_fmt = PIX_FMT_PAL8;
 
     if (s->width != avctx->width && s->height != avctx->height) {
-        if (av_check_image_size(s->width, s->height, 0, avctx) < 0)
+        if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
             return -1;
         avcodec_set_dimensions(avctx, s->width, s->height);
         if (s->frame.data[0])
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 8a2e7c01e10f674a40ae77dd19bf582f9d0fdeca..eb8989f1603e3e3e23a79c9f2cafbaa386e1a91f 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -442,7 +442,7 @@ static int decode_frame(AVCodecContext *avctx,
                 goto fail;
             s->width = bytestream_get_be32(&s->bytestream);
             s->height = bytestream_get_be32(&s->bytestream);
-            if(av_check_image_size(s->width, s->height, 0, avctx)){
+            if(av_image_check_size(s->width, s->height, 0, avctx)){
                 s->width= s->height= 0;
                 goto fail;
             }
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index de21d6ca75acb41d849138c6c92cd2a85c4774e5..536b344923ea66b49e1ca1cd4bb26a9ab3c97715 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -102,7 +102,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
             }
         }
         /* check that all tags are present */
-        if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_check_image_size(w, h, 0, avctx))
+        if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_image_check_size(w, h, 0, avctx))
             return -1;
 
         avctx->width  = w;
@@ -135,7 +135,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
         return -1;
     pnm_get(s, buf1, sizeof(buf1));
     avctx->height = atoi(buf1);
-    if(av_check_image_size(avctx->width, avctx->height, 0, avctx))
+    if(av_image_check_size(avctx->width, avctx->height, 0, avctx))
         return -1;
     if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
         pnm_get(s, buf1, sizeof(buf1));
diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c
index c026d966b086944d9491a938bf1856650a70fa92..a0644259fcdaea3a101fbe5724109c959aadc78a 100644
--- a/libavcodec/ptx.c
+++ b/libavcodec/ptx.c
@@ -65,7 +65,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     if (p->data[0])
         avctx->release_buffer(avctx, p);
 
-    if (av_check_image_size(w, h, 0, avctx))
+    if (av_image_check_size(w, h, 0, avctx))
         return -1;
     if (w != avctx->width || h != avctx->height)
         avcodec_set_dimensions(avctx, w, h);
diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c
index ac8c00c3f18693fbb634f079fbca61c9ae8b0515..aea0f68a6499009a31ee50551cd88c038240f3d0 100644
--- a/libavcodec/qtrleenc.c
+++ b/libavcodec/qtrleenc.c
@@ -63,7 +63,7 @@ static av_cold int qtrle_encode_init(AVCodecContext *avctx)
 {
     QtrleEncContext *s = avctx->priv_data;
 
-    if (av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) {
+    if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) {
         return -1;
     }
     s->avctx=avctx;
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index ad73d91a18320eb29bd32c85d9cf967610b91311..b6d87f4f09e49cedea3067fb1589b8211e28bd54 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -370,7 +370,7 @@ static int rv20_decode_picture_header(MpegEncContext *s)
         }
         if(new_w != s->width || new_h != s->height){
             av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h);
-            if (av_check_image_size(new_w, new_h, 0, s->avctx) < 0)
+            if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0)
                 return -1;
             MPV_common_end(s);
             avcodec_set_dimensions(s->avctx, new_w, new_h);
diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c
index 598a8f6ce3636502bfd2ad3585a42e3a2320ed9d..e236c8fa05bd4e59ac8e1c3e161ebfea9b0fc552 100644
--- a/libavcodec/rv40.c
+++ b/libavcodec/rv40.c
@@ -144,7 +144,7 @@ static int rv40_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceIn
     si->pts = get_bits(gb, 13);
     if(!si->type || !get_bits1(gb))
         rv40_parse_picture_size(gb, &w, &h);
-    if(av_check_image_size(w, h, 0, r->s.avctx) < 0)
+    if(av_image_check_size(w, h, 0, r->s.avctx) < 0)
         return -1;
     si->width  = w;
     si->height = h;
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index 9d42104591c8ffeaf9bc7afb7a9bc6409c85b58e..3c199e215eb0003213d88a347d606aebac01c912 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -202,7 +202,7 @@ static int decode_frame(AVCodecContext *avctx,
         return -1;
     }
 
-    if (av_check_image_size(s->width, s->height, 0, avctx))
+    if (av_image_check_size(s->width, s->height, 0, avctx))
         return -1;
     avcodec_set_dimensions(avctx, s->width, s->height);
 
diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
index 9fdfef5f1b7473bca40a31117e732b2d473e26d2..0696a53f15695b4ea3d2de42ada13900efdec51f 100644
--- a/libavcodec/sunrast.c
+++ b/libavcodec/sunrast.c
@@ -98,7 +98,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
     if (p->data[0])
         avctx->release_buffer(avctx, p);
 
-    if (av_check_image_size(w, h, 0, avctx))
+    if (av_image_check_size(w, h, 0, avctx))
         return -1;
     if (w != avctx->width || h != avctx->height)
         avcodec_set_dimensions(avctx, w, h);
diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index d5766476de5ccbec3dd0dd42310e59e8d6183b17..7b905a2d98c115baa14f01335b8d7bc050f10729 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -146,7 +146,7 @@ static int decode_frame(AVCodecContext *avctx,
     if(s->picture.data[0])
         avctx->release_buffer(avctx, &s->picture);
 
-    if(av_check_image_size(w, h, 0, avctx))
+    if(av_image_check_size(w, h, 0, avctx))
         return -1;
     if(w != avctx->width || h != avctx->height)
         avcodec_set_dimensions(avctx, w, h);
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 78c52cb2dd541476050e3d68029af6f6aaaaae4d..285cc4024920913ce94f67d263955c3df5ea41de 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -306,7 +306,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
             return -1;
         }
         if(s->width != s->avctx->width || s->height != s->avctx->height){
-            if(av_check_image_size(s->width, s->height, 0, s->avctx))
+            if(av_image_check_size(s->width, s->height, 0, s->avctx))
                 return -1;
             avcodec_set_dimensions(s->avctx, s->width, s->height);
         }
@@ -508,7 +508,7 @@ static int decode_frame(AVCodecContext *avctx,
         s->bpp = 1;
         avctx->pix_fmt = PIX_FMT_MONOBLACK;
         if(s->width != s->avctx->width || s->height != s->avctx->height){
-            if(av_check_image_size(s->width, s->height, 0, s->avctx))
+            if(av_image_check_size(s->width, s->height, 0, s->avctx))
                 return -1;
             avcodec_set_dimensions(s->avctx, s->width, s->height);
         }
diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index 320949ec1fd85d65fd88b18d4f04df9f897b4565..e7d3379391c0876c608b99e3b947a30bcf2440e2 100644
--- a/libavcodec/txd.c
+++ b/libavcodec/txd.c
@@ -80,7 +80,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     if (p->data[0])
         avctx->release_buffer(avctx, p);
 
-    if (av_check_image_size(w, h, 0, avctx))
+    if (av_image_check_size(w, h, 0, avctx))
         return -1;
     if (w != avctx->width || h != avctx->height)
         avcodec_set_dimensions(avctx, w, h);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f13b271fc62764ea55560aee41ec54af8efc3ace..b31f7ef45e3ccbb61f81a24ba2f4182c3800de40 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -215,7 +215,7 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
 
 #if LIBAVCODEC_VERSION_MAJOR < 53
 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
-    return av_check_image_size(w, h, 0, av_log_ctx);
+    return av_image_check_size(w, h, 0, av_log_ctx);
 }
 #endif
 
@@ -235,7 +235,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
         return -1;
     }
 
-    if(av_check_image_size(w, h, 0, s))
+    if(av_image_check_size(w, h, 0, s))
         return -1;
 
     if(s->internal_buffer==NULL){
@@ -487,7 +487,7 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
 
 #define SANE_NB_CHANNELS 128U
     if (((avctx->coded_width || avctx->coded_height)
-        && av_check_image_size(avctx->coded_width, avctx->coded_height, 0, avctx))
+        && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
         || avctx->channels > SANE_NB_CHANNELS) {
         ret = AVERROR(EINVAL);
         goto free_and_end;
@@ -554,7 +554,7 @@ int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf
         av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
         return -1;
     }
-    if(av_check_image_size(avctx->width, avctx->height, 0, avctx))
+    if(av_image_check_size(avctx->width, avctx->height, 0, avctx))
         return -1;
     if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
         int ret = avctx->codec->encode(avctx, buf, buf_size, pict);
@@ -604,7 +604,7 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
     int ret;
 
     *got_picture_ptr= 0;
-    if((avctx->coded_width||avctx->coded_height) && av_check_image_size(avctx->coded_width, avctx->coded_height, 0, avctx))
+    if((avctx->coded_width||avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
         return -1;
     if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
         ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 74b7e1b608e3ef3ba0d90623b9321fa298bc7ab5..457c6990b6cf5af2859c57b88663c27d0eeb0d01 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1981,7 +1981,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
     visible_width  = s->width  = get_bits(gb, 16) << 4;
     visible_height = s->height = get_bits(gb, 16) << 4;
 
-    if(av_check_image_size(s->width, s->height, 0, avctx)){
+    if(av_image_check_size(s->width, s->height, 0, avctx)){
         av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height);
         s->width= s->height= 0;
         return -1;
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 0ec050cc88bc72817715699671a624c2d5e86cb6..49cff251224632be08f917608c0945fa10f32234 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -223,7 +223,7 @@ static void vp8_decode_flush(AVCodecContext *avctx)
 
 static int update_dimensions(VP8Context *s, int width, int height)
 {
-    if (av_check_image_size(width, height, 0, s->avctx))
+    if (av_image_check_size(width, height, 0, s->avctx))
         return AVERROR_INVALIDDATA;
 
     vp8_decode_flush(s->avctx);
diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index 2d3e0e2369231558803160b1f6726e2825e45cea..97b8b50278f201af6062d96df8a5b4e13667d77d 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -148,7 +148,7 @@ static av_cold int vqa_decode_init(AVCodecContext *avctx)
     s->vqa_version = vqa_header[0];
     s->width = AV_RL16(&vqa_header[6]);
     s->height = AV_RL16(&vqa_header[8]);
-    if(av_check_image_size(s->width, s->height, 0, avctx)){
+    if(av_image_check_size(s->width, s->height, 0, avctx)){
         s->width= s->height= 0;
         return -1;
     }
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index ff1d5bf190049f7d75c8aa29a96b1854d54240da..22f9898d61d09e495dd78a6eacecf0539468803c 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -77,7 +77,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     // read header
     w = bytestream_get_le16(&buf);
     h = bytestream_get_le16(&buf);
-    if (av_check_image_size(w, h, 0, avctx) < 0)
+    if (av_image_check_size(w, h, 0, avctx) < 0)
         return -1;
     x = bytestream_get_le16(&buf);
     y = bytestream_get_le16(&buf);
diff --git a/libavcodec/yop.c b/libavcodec/yop.c
index b1064c97152fb933f432844698d8b399ad0d301e..57d100c26d715accf7137db5ccd0a6a4dafd4a4f 100644
--- a/libavcodec/yop.c
+++ b/libavcodec/yop.c
@@ -85,7 +85,7 @@ static av_cold int yop_decode_init(AVCodecContext *avctx)
     s->avctx = avctx;
 
     if (avctx->width & 1 || avctx->height & 1 ||
-        av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) {
+        av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0) {
         av_log(avctx, AV_LOG_ERROR, "YOP has invalid dimensions\n");
         return -1;
     }
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
index 09f366eeadf2528f5eeba1150f55f6d161ccbc96..9508f2277ff00def7c201880e2de95c4c7662763 100644
--- a/libavdevice/avdevice.h
+++ b/libavdevice/avdevice.h
@@ -23,7 +23,7 @@
 
 #define LIBAVDEVICE_VERSION_MAJOR 52
 #define LIBAVDEVICE_VERSION_MINOR  2
-#define LIBAVDEVICE_VERSION_MICRO  1
+#define LIBAVDEVICE_VERSION_MICRO  2
 
 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
                                                LIBAVDEVICE_VERSION_MINOR, \
diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c
index 50a113a72a28ed1e3befa072f8b5504d2a917a37..f640c769cd9812b867b9e7ed0fd90e706ee17bbf 100644
--- a/libavdevice/v4l.c
+++ b/libavdevice/v4l.c
@@ -117,7 +117,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
         }
     }
 
-    if(av_check_image_size(s->video_win.width, s->video_win.height, 0, s1) < 0)
+    if(av_image_check_size(s->video_win.width, s->video_win.height, 0, s1) < 0)
         return -1;
 
     desired_palette = -1;
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 0480d6886a81c0ab1926d5db2946ff4f506bdf4a..b8adf554a3bcc6a15190c699a68a8a517d173985 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -629,7 +629,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
 
         return AVERROR(EIO);
     }
-    if (av_check_image_size(s->width, s->height, 0, s1) < 0)
+    if (av_image_check_size(s->width, s->height, 0, s1) < 0)
         return AVERROR(EINVAL);
     s->frame_format = desired_format;
 
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index bc8c67e5232d81f1dbe24015f1a15095a0d5286a..221dfaa9e0bcc166ef9c5cf66e2256394a2d8fb7 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -381,7 +381,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
 
         for (i = 0; i < 4; i++) {
             int planew =
-                av_get_image_linesize(link->format, link->cur_buf->video->w, i);
+                av_image_get_linesize(link->format, link->cur_buf->video->w, i);
 
             if (!src[i]) continue;
 
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 721519a200d5e4ff71c11d0a4e3d97fc89ed42ee..bd949ad631257c53b75a7791690ef9eac608839e 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -26,7 +26,7 @@
 
 #define LIBAVFILTER_VERSION_MAJOR  1
 #define LIBAVFILTER_VERSION_MINOR 38
-#define LIBAVFILTER_VERSION_MICRO  1
+#define LIBAVFILTER_VERSION_MICRO  2
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
                                                LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index 19559b12500eb819a691a08a42aeb1d933172a75..7e44901e4acf76d498e10a1e09f917bf21eb3d0b 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -54,17 +54,17 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per
     pic->refcount = 1;
     ref->format   = link->format;
     pic->free     = avfilter_default_free_buffer;
-    av_fill_image_linesizes(pic->linesize, ref->format, ref->video->w);
+    av_image_fill_linesizes(pic->linesize, ref->format, ref->video->w);
 
     for (i = 0; i < 4; i++)
         pic->linesize[i] = FFALIGN(pic->linesize[i], 16);
 
-    tempsize = av_fill_image_pointers(pic->data, ref->format, ref->video->h, NULL, pic->linesize);
+    tempsize = av_image_fill_pointers(pic->data, ref->format, ref->video->h, NULL, pic->linesize);
     buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be
                                     // SIMD-friendly
     if (!buf)
         goto fail;
-    av_fill_image_pointers(pic->data, ref->format, ref->video->h, buf, pic->linesize);
+    av_image_fill_pointers(pic->data, ref->format, ref->video->h, buf, pic->linesize);
 
     memcpy(ref->data,     pic->data,     sizeof(ref->data));
     memcpy(ref->linesize, pic->linesize, sizeof(ref->linesize));
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 2ea6f7561830492de6943e049f839b66353e7035..880c9548e15ef1bc9ca5314508237064893ee91e 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -84,7 +84,7 @@ static int config_input(AVFilterLink *link)
     CropContext *crop = ctx->priv;
     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[link->format];
 
-    av_fill_image_max_pixsteps(crop->max_step, NULL, pix_desc);
+    av_image_fill_max_pixsteps(crop->max_step, NULL, pix_desc);
     crop->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
     crop->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
 
diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c
index acdfe8cffd9edd8317ed999e4c62dcd5ff1b00d0..4deb14a53d185517ef08f02b0508e7f5fa6d1373 100644
--- a/libavfilter/vf_hflip.c
+++ b/libavfilter/vf_hflip.c
@@ -70,7 +70,7 @@ static int config_props(AVFilterLink *inlink)
     FlipContext *flip = inlink->dst->priv;
     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[inlink->format];
 
-    av_fill_image_max_pixsteps(flip->max_step, NULL, pix_desc);
+    av_image_fill_max_pixsteps(flip->max_step, NULL, pix_desc);
     flip->hsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
     flip->vsub = av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
 
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 236cecfa948db845c3d9a01f4add625fef5e75b1..d79baeab22fb0e1e9978c3d7276bdd46b7585419 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -407,7 +407,7 @@ static int color_config_props(AVFilterLink *inlink)
 
     color->w &= ~((1 << color->hsub) - 1);
     color->h &= ~((1 << color->vsub) - 1);
-    if (av_check_image_size(color->w, color->h, 0, ctx) < 0)
+    if (av_image_check_size(color->w, color->h, 0, ctx) < 0)
         return AVERROR(EINVAL);
 
     memcpy(rgba_color, color->color, sizeof(rgba_color));