av_check_image_size() instead.
Originally committed as revision 24711 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "binkdata.h"
c->pic.data[0] = NULL;
- if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
+ if (av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) {
return 1;
}
* @author Marco Gerards <marco@gnu.org>
*/
+#include "libavcore/imgutils.h"
#include "dirac.h"
#include "avcodec.h"
#include "golomb.h"
if (parse_source_parameters(avctx, gb, source))
return -1;
- if (avcodec_check_dimensions(avctx, source->width, source->height))
+ if (av_check_image_size(source->width, source->height, 0, avctx))
return -1;
avcodec_set_dimensions(avctx, source->width, source->height);
//#define TRACE
//#define DEBUG
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dnxhddata.h"
}
avctx->pix_fmt = PIX_FMT_YUV422P;
- if (avcodec_check_dimensions(avctx, ctx->width, ctx->height))
+ if (av_check_image_size(ctx->width, ctx->height, 0, avctx))
return -1;
avcodec_set_dimensions(avctx, ctx->width, ctx->height);
*/
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "bytestream.h"
#include "avcodec.h"
if (s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
- if (avcodec_check_dimensions(avctx, w, h))
+ if (av_check_image_size(w, h, 0, avctx))
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
*/
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
typedef struct CmvContext {
return buf_size;
}
- if (avcodec_check_dimensions(s->avctx, s->width, s->height))
+ if (av_check_image_size(s->width, s->height, 0, s->avctx))
return -1;
/* shuffle */
#include "aandcttab.h"
#include "mpeg12.h"
#include "mpeg12data.h"
+#include "libavcore/imgutils.h"
#define EA_PREAMBLE_SIZE 8
#define MADk_TAG MKTAG('M', 'A', 'D', 'k') /* MAD i-frame */
buf += 16;
if (avctx->width != s->width || avctx->height != s->height) {
- if (avcodec_check_dimensions(avctx, s->width, s->height) < 0)
+ if (av_check_image_size(s->width, s->height, 0, avctx) < 0)
return -1;
avcodec_set_dimensions(avctx, s->width, s->height);
if (t->frame.data[0])
#define ALT_BITSTREAM_READER_LE
#include "get_bits.h"
#include "libavutil/lzo.h"
+#include "libavcore/imgutils.h"
#define EA_PREAMBLE_SIZE 8
#define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
}
}
- if (avcodec_check_dimensions(avctx, s->width, s->height))
+ if (av_check_image_size(s->width, s->height, 0, avctx))
return -1;
/* shuffle */
#include "mpegvideo.h"
#include "h263.h"
#include "flv.h"
+#include "libavcore/imgutils.h"
void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){
int is11 = get_bits1(gb);
width = height = 0;
break;
}
- if(avcodec_check_dimensions(s->avctx, width, height))
+ if(av_check_image_size(width, height, 0, s->avctx))
return -1;
s->width = width;
s->height = height;
//#define DEBUG
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "lzw.h"
return -1;
avctx->pix_fmt = PIX_FMT_PAL8;
- if (avcodec_check_dimensions(avctx, s->screen_width, s->screen_height))
+ if (av_check_image_size(s->screen_width, s->screen_height, 0, avctx))
return -1;
avcodec_set_dimensions(avctx, s->screen_width, s->screen_height);
* @author Michael Niedermayer <michaelni@gmx.at>
*/
+#include "libavcore/imgutils.h"
#include "internal.h"
#include "dsputil.h"
#include "avcodec.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 ||
- avcodec_check_dimensions(NULL, 16*sps->mb_width, 16*sps->mb_height)){
+ av_check_image_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;
}
* IFF PBM/ILBM bitmap decoder
*/
+#include "libavcore/imgutils.h"
#include "bytestream.h"
#include "avcodec.h"
#include "get_bits.h"
return AVERROR_INVALIDDATA;
}
- if ((err = avcodec_check_dimensions(avctx, avctx->width, avctx->height)))
+ if ((err = av_check_image_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);
enum PixelFormat pix_fmt, int width, int height)
{
- if(avcodec_check_dimensions(NULL, width, height))
+ if(av_check_image_size(width, height, 0, NULL))
return -1;
if (av_fill_image_linesizes(picture->linesize, pix_fmt, width))
int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height)
{
AVPicture dummy_pict;
- if(avcodec_check_dimensions(NULL, width, height))
+ if(av_check_image_size(width, height, 0, NULL))
return -1;
switch (pix_fmt) {
case PIX_FMT_RGB8:
#include <stdlib.h>
#include <string.h>
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "bytestream.h"
image_height = bytestream_get_le16(&buf_pos);
image_width = bytestream_get_le16(&buf_pos);
- if(avcodec_check_dimensions(avctx, image_width, image_height))
+ if(av_check_image_size(image_width, image_height, 0, avctx))
return -1;
if (image_width != avctx->width || image_height != avctx->height) {
int ret;
*/
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
typedef struct {
h = (buf[1] + 1) * 8;
buf += 2;
- if (avcodec_check_dimensions(avctx, w, h))
+ if (av_check_image_size(w, h, 0, avctx))
return -1;
if (w != avctx->width || h != avctx->height)
/* tell FFmpeg about sequence details */
dirac_sourceparams_t *src_params = &p_dirac_params->p_decoder->src_params;
- if (avcodec_check_dimensions(avccontext, src_params->width,
- src_params->height) < 0) {
+ if (av_check_image_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);
avccontext->height = avccontext->width = 0;
}
width = image->comps[0].w << avctx->lowres;
height = image->comps[0].h << avctx->lowres;
- if(avcodec_check_dimensions(avctx, width, height) < 0) {
+ if(av_check_image_size(width, height, 0, avctx) < 0) {
av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height);
goto done;
}
p_schro_params->format = schro_decoder_get_video_format(decoder);
/* Tell FFmpeg about sequence details. */
- if (avcodec_check_dimensions(avccontext, p_schro_params->format->width,
- p_schro_params->format->height) < 0) {
+ if (av_check_image_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);
avccontext->height = avccontext->width = 0;
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 (avcodec_check_dimensions(avctx, img->d_w, img->d_h))
+ if (av_check_image_size(img->d_w, img->d_h, 0, avctx))
return AVERROR_INVALIDDATA;
avcodec_set_dimensions(avctx, img->d_w, img->d_h);
}
//#define DEBUG
#include <assert.h>
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "mjpeg.h"
height= s->height;
av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height);
- if(avcodec_check_dimensions(s->avctx, width, height))
+ if(av_check_image_size(width, height, 0, s->avctx))
return -1;
nb_components = get_bits(&s->gb, 8);
*/
#include "libavutil/intmath.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "internal.h"
return -1;
}
- if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height))
+ if((s->width || s->height) && av_check_image_size(s->width, s->height, 0, s->avctx))
return -1;
dsputil_init(&s->dsp, s->avctx);
#include "libavutil/bswap.h"
#include "libavutil/lzo.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "rtjpeg.h"
if (quality >= 0)
get_quant_quality(c, quality);
if (width != c->width || height != c->height) {
- if (avcodec_check_dimensions(avctx, height, width) < 0)
+ if (av_check_image_size(height, width, 0, avctx) < 0)
return 0;
avctx->width = c->width = width;
avctx->height = c->height = height;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
if (p->data[0])
avctx->release_buffer(avctx, p);
- if (avcodec_check_dimensions(avctx, w, h))
+ if (av_check_image_size(w, h, 0, avctx))
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
* Pictor/PC Paint decoder
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "cga_data.h"
avctx->pix_fmt = PIX_FMT_PAL8;
if (s->width != avctx->width && s->height != avctx->height) {
- if (avcodec_check_dimensions(avctx, s->width, s->height) < 0)
+ if (av_check_image_size(s->width, s->height, 0, avctx) < 0)
return -1;
avcodec_set_dimensions(avctx, s->width, s->height);
if (s->frame.data[0])
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "png.h"
goto fail;
s->width = bytestream_get_be32(&s->bytestream);
s->height = bytestream_get_be32(&s->bytestream);
- if(avcodec_check_dimensions(avctx, s->width, s->height)){
+ if(av_check_image_size(s->width, s->height, 0, avctx)){
s->width= s->height= 0;
goto fail;
}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "pnm.h"
}
}
/* check that all tags are present */
- if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || avcodec_check_dimensions(avctx, w, h))
+ if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_check_image_size(w, h, 0, avctx))
return -1;
avctx->width = w;
return -1;
pnm_get(s, buf1, sizeof(buf1));
avctx->height = atoi(buf1);
- if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))
+ if(av_check_image_size(avctx->width, avctx->height, 0, avctx))
return -1;
if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
pnm_get(s, buf1, sizeof(buf1));
*/
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
typedef struct PTXContext {
if (p->data[0])
avctx->release_buffer(avctx, p);
- if (avcodec_check_dimensions(avctx, w, h))
+ if (av_check_image_size(w, h, 0, avctx))
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
{
QtrleEncContext *s = avctx->priv_data;
- if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
+ if (av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) {
return -1;
}
s->avctx=avctx;
* RV10/RV20 decoder
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
}
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 (avcodec_check_dimensions(s->avctx, new_w, new_h) < 0)
+ if (av_check_image_size(new_w, new_h, 0, s->avctx) < 0)
return -1;
MPV_common_end(s);
avcodec_set_dimensions(s->avctx, new_w, new_h);
* RV40 decoder
*/
+#include "libavcore/imgutils.h"
+
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
si->pts = get_bits(gb, 13);
if(!si->type || !get_bits1(gb))
rv40_parse_picture_size(gb, &w, &h);
- if(avcodec_check_dimensions(r->s.avctx, w, h) < 0)
+ if(av_check_image_size(w, h, 0, r->s.avctx) < 0)
return -1;
si->width = w;
si->height = h;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "bytestream.h"
#include "sgi.h"
return -1;
}
- if (avcodec_check_dimensions(avctx, s->width, s->height))
+ if (av_check_image_size(s->width, s->height, 0, avctx))
return -1;
avcodec_set_dimensions(avctx, s->width, s->height);
*/
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#define RT_OLD 0
if (p->data[0])
avctx->release_buffer(avctx, p);
- if (avcodec_check_dimensions(avctx, w, h))
+ if (av_check_image_size(w, h, 0, avctx))
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
*/
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
enum TargaCompr{
if(s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
- if(avcodec_check_dimensions(avctx, w, h))
+ if(av_check_image_size(w, h, 0, avctx))
return -1;
if(w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
#include "faxcompr.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
typedef struct TiffContext {
AVCodecContext *avctx;
return -1;
}
if(s->width != s->avctx->width || s->height != s->avctx->height){
- if(avcodec_check_dimensions(s->avctx, s->width, s->height))
+ if(av_check_image_size(s->width, s->height, 0, s->avctx))
return -1;
avcodec_set_dimensions(s->avctx, s->width, s->height);
}
s->bpp = 1;
avctx->pix_fmt = PIX_FMT_MONOBLACK;
if(s->width != s->avctx->width || s->height != s->avctx->height){
- if(avcodec_check_dimensions(s->avctx, s->width, s->height))
+ if(av_check_image_size(s->width, s->height, 0, s->avctx))
return -1;
avcodec_set_dimensions(s->avctx, s->width, s->height);
}
*/
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "s3tc.h"
if (p->data[0])
avctx->release_buffer(avctx, p);
- if (avcodec_check_dimensions(avctx, w, h))
+ if (av_check_image_size(w, h, 0, avctx))
return -1;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
return -1;
}
- if(avcodec_check_dimensions(s,w,h))
+ if(av_check_image_size(w, h, 0, s))
return -1;
if(s->internal_buffer==NULL){
#define SANE_NB_CHANNELS 128U
if (((avctx->coded_width || avctx->coded_height)
- && avcodec_check_dimensions(avctx, avctx->coded_width, avctx->coded_height))
+ && av_check_image_size(avctx->coded_width, avctx->coded_height, 0, avctx))
|| avctx->channels > SANE_NB_CHANNELS) {
ret = AVERROR(EINVAL);
goto free_and_end;
av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
return -1;
}
- if(avcodec_check_dimensions(avctx,avctx->width,avctx->height))
+ if(av_check_image_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);
int ret;
*got_picture_ptr= 0;
- if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height))
+ if((avctx->coded_width||avctx->coded_height) && av_check_image_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,
#include <stdlib.h>
#include <string.h>
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h"
visible_width = s->width = get_bits(gb, 16) << 4;
visible_height = s->height = get_bits(gb, 16) << 4;
- if(avcodec_check_dimensions(avctx, s->width, s->height)){
+ if(av_check_image_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;
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "vp56.h"
#include "vp8data.h"
static int update_dimensions(VP8Context *s, int width, int height)
{
- if (avcodec_check_dimensions(s->avctx, width, height))
+ if (av_check_image_size(width, height, 0, s->avctx))
return AVERROR_INVALIDDATA;
vp8_decode_flush(s->avctx);
#include <string.h>
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#define PALETTE_COUNT 256
s->vqa_version = vqa_header[0];
s->width = AV_RL16(&vqa_header[6]);
s->height = AV_RL16(&vqa_header[8]);
- if(avcodec_check_dimensions(avctx, s->width, s->height)){
+ if(av_check_image_size(s->width, s->height, 0, avctx)){
s->width= s->height= 0;
return -1;
}
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "get_bits.h"
#include "bytestream.h"
// read header
w = bytestream_get_le16(&buf);
h = bytestream_get_le16(&buf);
- if (avcodec_check_dimensions(avctx, w, h) < 0)
+ if (av_check_image_size(w, h, 0, avctx) < 0)
return -1;
x = bytestream_get_le16(&buf);
y = bytestream_get_le16(&buf);
*/
#include "libavutil/intreadwrite.h"
+#include "libavcore/imgutils.h"
#include "avcodec.h"
#include "get_bits.h"
s->avctx = avctx;
if (avctx->width & 1 || avctx->height & 1 ||
- avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
+ av_check_image_size(avctx->width, avctx->height, 0, avctx) < 0) {
av_log(avctx, AV_LOG_ERROR, "YOP has invalid dimensions\n");
return -1;
}
include $(SUBDIR)../config.mak
NAME = avdevice
-FFLIBS = avformat avcodec avutil
+FFLIBS = avformat avcodec avcore avutil
HEADERS = avdevice.h
#define LIBAVDEVICE_VERSION_MAJOR 52
#define LIBAVDEVICE_VERSION_MINOR 2
-#define LIBAVDEVICE_VERSION_MICRO 0
+#define LIBAVDEVICE_VERSION_MICRO 1
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
LIBAVDEVICE_VERSION_MINOR, \
#undef __STRICT_ANSI__ //workaround due to broken kernel headers
#include "config.h"
#include "libavutil/rational.h"
+#include "libavcore/imgutils.h"
#include "libavformat/avformat.h"
#include "libavcodec/dsputil.h"
#include <unistd.h>
}
}
- if(avcodec_check_dimensions(s1, s->video_win.width, s->video_win.height) < 0)
+ if(av_check_image_size(s->video_win.width, s->video_win.height, 0, s1) < 0)
return -1;
desired_palette = -1;
#endif
#include <time.h>
#include <strings.h>
+#include "libavcore/imgutils.h"
static const int desired_video_buffers = 256;
return AVERROR(EIO);
}
- if (avcodec_check_dimensions(s1, s->width, s->height) < 0)
+ if (av_check_image_size(s->width, s->height, 0, s1) < 0)
return AVERROR(EINVAL);
s->frame_format = desired_format;
#define LIBAVFILTER_VERSION_MAJOR 1
#define LIBAVFILTER_VERSION_MINOR 27
-#define LIBAVFILTER_VERSION_MICRO 0
+#define LIBAVFILTER_VERSION_MICRO 1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
#include "parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/colorspace.h"
+#include "libavcore/imgutils.h"
#include "libavcore/parseutils.h"
enum { RED = 0, GREEN, BLUE, ALPHA };
color->w &= ~((1 << color->hsub) - 1);
color->h &= ~((1 << color->vsub) - 1);
- if (avcodec_check_dimensions(ctx, color->w, color->h) < 0)
+ if (av_check_image_size(color->w, color->h, 0, ctx) < 0)
return AVERROR(EINVAL);
memcpy(rgba_color, color->color, sizeof(rgba_color));