From 4a49ab77c6bb2348992e1e70b14f2d1efaf7ddbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= <Reimar.Doeffinger@gmx.de>
Date: Tue, 13 Oct 2009 20:13:28 +0000
Subject: [PATCH] Remove unnecessary calls to avcodec_check_dimensions, the
 check is already done at a higher level.

Originally committed as revision 20229 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/8bps.c        | 4 ----
 libavcodec/cscd.c        | 3 ---
 libavcodec/dxa.c         | 4 ----
 libavcodec/flashsvenc.c  | 4 ----
 libavcodec/lcldec.c      | 4 ----
 libavcodec/mmvideo.c     | 3 ---
 libavcodec/qdrw.c        | 4 ----
 libavcodec/roqvideoenc.c | 6 ------
 libavcodec/smacker.c     | 4 ----
 libavcodec/truemotion2.c | 3 ---
 libavcodec/tscc.c        | 4 ----
 libavcodec/v210dec.c     | 2 --
 libavcodec/v210x.c       | 2 --
 libavcodec/vb.c          | 4 ----
 libavcodec/vmnc.c        | 3 ---
 libavcodec/xan.c         | 3 ---
 libavcodec/zmbv.c        | 3 ---
 libavcodec/zmbvenc.c     | 4 ----
 18 files changed, 64 deletions(-)

diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index 28187b03601..fb5ef717326 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -159,10 +159,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
         c->pic.data[0] = NULL;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
-
         switch (avctx->bits_per_coded_sample) {
                 case 8:
                         avctx->pix_fmt = PIX_FMT_PAL8;
diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index e58cf7861d7..45edca382c1 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -216,9 +216,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
 
 static av_cold int decode_init(AVCodecContext *avctx) {
     CamStudioContext *c = avctx->priv_data;
-    if (avcodec_check_dimensions(avctx, avctx->height, avctx->width) < 0) {
-        return 1;
-    }
     switch (avctx->bits_per_coded_sample) {
         case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
         case 24: avctx->pix_fmt = PIX_FMT_BGR24; break;
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c
index 69aed3c89e2..c06ab85cc79 100644
--- a/libavcodec/dxa.c
+++ b/libavcodec/dxa.c
@@ -295,10 +295,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
     c->avctx = avctx;
     avctx->pix_fmt = PIX_FMT_PAL8;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return -1;
-    }
-
     c->dsize = avctx->width * avctx->height * 2;
     if((c->decomp_buf = av_malloc(c->dsize)) == NULL) {
         av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c
index 3512b026989..4d2b47979f2 100644
--- a/libavcodec/flashsvenc.c
+++ b/libavcodec/flashsvenc.c
@@ -108,10 +108,6 @@ static av_cold int flashsv_encode_init(AVCodecContext *avctx)
         return -1;
     }
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return -1;
-    }
-
     // Needed if zlib unused or init aborted before deflateInit
     memset(&(s->zstream), 0, sizeof(z_stream));
 
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 15c686e0a97..d4fe65ccebb 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -458,10 +458,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return 1;
     }
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
-
     /* Check codec type */
     if ((avctx->codec_id == CODEC_ID_MSZH  && avctx->extradata[7] != CODEC_MSZH) ||
         (avctx->codec_id == CODEC_ID_ZLIB  && avctx->extradata[7] != CODEC_ZLIB)) {
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index 6dc95589c6d..596ca7aec47 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -58,9 +58,6 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
 
     avctx->pix_fmt = PIX_FMT_PAL8;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height))
-        return -1;
-
     s->frame.reference = 1;
     if (avctx->get_buffer(avctx, &s->frame)) {
         av_log(s->avctx, AV_LOG_ERROR, "mmvideo: get_buffer() failed\n");
diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
index 0f9609159cc..cd53bfb3386 100644
--- a/libavcodec/qdrw.c
+++ b/libavcodec/qdrw.c
@@ -135,10 +135,6 @@ static int decode_frame(AVCodecContext *avctx,
 static av_cold int decode_init(AVCodecContext *avctx){
 //    QdrawContext * const a = avctx->priv_data;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
-
     avctx->pix_fmt= PIX_FMT_PAL8;
 
     return 0;
diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
index 0f74ddd6719..8dc77bd414c 100644
--- a/libavcodec/roqvideoenc.c
+++ b/libavcodec/roqvideoenc.c
@@ -939,12 +939,6 @@ static int roq_encode_init(AVCodecContext *avctx)
     if (((avctx->width)&(avctx->width-1))||((avctx->height)&(avctx->height-1)))
         av_log(avctx, AV_LOG_ERROR, "Warning: dimensions not power of two\n");
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height)) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n",
-               avctx->width, avctx->height);
-        return -1;
-    }
-
     enc->width = avctx->width;
     enc->height = avctx->height;
 
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 0d39027b0b2..18eaebc6adb 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -514,10 +514,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     c->avctx = avctx;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
-
     avctx->pix_fmt = PIX_FMT_PAL8;
 
 
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index ee3d6d92120..09c500146d9 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -813,9 +813,6 @@ static av_cold int decode_init(AVCodecContext *avctx){
     TM2Context * const l = avctx->priv_data;
     int i;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return -1;
-    }
     if((avctx->width & 3) || (avctx->height & 3)){
         av_log(avctx, AV_LOG_ERROR, "Width and height must be multiple of 4\n");
         return -1;
diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
index d1a924da400..b00b5c5568d 100644
--- a/libavcodec/tscc.c
+++ b/libavcodec/tscc.c
@@ -141,10 +141,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     c->height = avctx->height;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
-
     // Needed if zlib unused or init aborted before inflateInit
     memset(&(c->zstream), 0, sizeof(z_stream));
     switch(avctx->bits_per_coded_sample){
diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 08c954d88e5..ceeccb63460 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -30,8 +30,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
         return -1;
     }
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0)
-        return -1;
     avctx->pix_fmt             = PIX_FMT_YUV422P16;
     avctx->bits_per_raw_sample = 10;
 
diff --git a/libavcodec/v210x.c b/libavcodec/v210x.c
index fe1b6de30ad..549a157f418 100644
--- a/libavcodec/v210x.c
+++ b/libavcodec/v210x.c
@@ -27,8 +27,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "v210x needs even width\n");
         return -1;
     }
-    if(avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0)
-        return -1;
     avctx->pix_fmt = PIX_FMT_YUV422P16;
     avctx->bits_per_raw_sample= 10;
 
diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index 02efa030a5a..551b10657ce 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -251,10 +251,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
     c->avctx = avctx;
     avctx->pix_fmt = PIX_FMT_PAL8;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return -1;
-    }
-
     c->frame      = av_malloc( avctx->width * avctx->height);
     c->prev_frame = av_malloc( avctx->width * avctx->height);
 
diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c
index a97655a27c3..b4c07f76e46 100644
--- a/libavcodec/vmnc.c
+++ b/libavcodec/vmnc.c
@@ -468,9 +468,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
     c->width = avctx->width;
     c->height = avctx->height;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
     c->bpp = avctx->bits_per_coded_sample;
     c->bpp2 = c->bpp/8;
 
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index 83b64ca0504..fcfd9c6d0c1 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -74,9 +74,6 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
 
     avctx->pix_fmt = PIX_FMT_PAL8;
 
-    if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))
-        return -1;
-
     s->buffer1_size = avctx->width * avctx->height;
     s->buffer1 = av_malloc(s->buffer1_size);
     s->buffer2_size = avctx->width * avctx->height;
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index de2eb9c4c67..35a31c09246 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -602,9 +602,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
     c->width = avctx->width;
     c->height = avctx->height;
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
     c->bpp = avctx->bits_per_coded_sample;
 
     // Needed if zlib unused or init aborted before inflateInit
diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
index 5a1428e4a8e..0131b5d1f3f 100644
--- a/libavcodec/zmbvenc.c
+++ b/libavcodec/zmbvenc.c
@@ -263,10 +263,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
         return -1;
     }
 
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return -1;
-    }
-
     // Needed if zlib unused or init aborted before deflateInit
     memset(&(c->zstream), 0, sizeof(z_stream));
     c->comp_size = avctx->width * avctx->height + 1024 +
-- 
GitLab