[FFmpeg-soc] [soc]: r851 - dirac/libavcodec/dirac.c
marco
subversion at mplayerhq.hu
Thu Aug 16 13:43:40 CEST 2007
Author: marco
Date: Thu Aug 16 13:43:40 2007
New Revision: 851
Log:
use avcodec_check_dimensions when allocating memory for a frame
Modified:
dirac/libavcodec/dirac.c
Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c (original)
+++ dirac/libavcodec/dirac.c Thu Aug 16 13:43:40 2007
@@ -1682,6 +1682,11 @@ static int dirac_subband_idwt_53(DiracCo
START_TIMER
+ if (avcodec_check_dimensions(s->avctx, synth_width, synth_height)) {
+ av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ return -1;
+ }
+
synth = av_malloc(synth_width * synth_height * sizeof(int16_t));
if (!synth) {
av_log(s->avctx, AV_LOG_ERROR, "av_malloc() failed\n");
@@ -1809,6 +1814,11 @@ static int dirac_subband_idwt_97(DiracCo
START_TIMER
+ if (avcodec_check_dimensions(s->avctx, synth_width, synth_height)) {
+ av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ return -1;
+ }
+
synth = av_malloc(synth_width * synth_height * sizeof(int16_t));
if (!synth) {
av_log(s->avctx, AV_LOG_ERROR, "av_malloc() failed\n");
@@ -2514,6 +2524,12 @@ static int dirac_motion_compensation(Dir
s->refwidth = s->width << 1;
s->refheight = s->height << 1;
+
+ if (avcodec_check_dimensions(s->avctx, s->refwidth, s->refheight)) {
+ av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ return -1;
+ }
+
for (i = 0; i < s->refs; i++) {
refidx[i] = reference_frame_idx(s, s->ref[i]);
ref[i] = &s->refframes[refidx[i]].frame;
@@ -2534,6 +2550,14 @@ static int dirac_motion_compensation(Dir
}
}
+ if (avcodec_check_dimensions(s->avctx, s->width, s->height)) {
+ for (i = 0; i < s->refs; i++)
+ av_free(s->refdata[i]);
+
+ av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ return -1;
+ }
+
mcpic = av_malloc(s->width * s->height * sizeof(int16_t));
if (!mcpic) {
for (i = 0; i < s->refs; i++)
@@ -2637,6 +2661,12 @@ static int dirac_decode_frame(DiracConte
START_TIMER
+ if (avcodec_check_dimensions(s->avctx, s->padded_luma_width,
+ s->padded_luma_height)) {
+ av_log(s->avctx, AV_LOG_ERROR, "avcodec_check_dimensions() failed\n");
+ return -1;
+ }
+
coeffs = av_malloc(s->padded_luma_width
* s->padded_luma_height
* sizeof(int16_t));
More information about the FFmpeg-soc
mailing list