[FFmpeg-soc] [soc]: r714 - dirac/libavcodec/dirac.c
marco
subversion at mplayerhq.hu
Sun Aug 12 00:28:14 CEST 2007
Author: marco
Date: Sun Aug 12 00:28:14 2007
New Revision: 714
Log:
just allocate the memory for the coefficients once
Modified:
dirac/libavcodec/dirac.c
Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c (original)
+++ dirac/libavcodec/dirac.c Sun Aug 12 00:28:14 2007
@@ -2325,13 +2325,19 @@ static int dirac_motion_compensation(AVC
*/
static int dirac_decode_frame(AVCodecContext *avctx) {
DiracContext *s = avctx->priv_data;
+ int *coeffs;
int comp;
int x,y;
START_TIMER
+ coeffs = av_malloc(s->padded_luma_width * s->padded_luma_height * sizeof(int));
+ if (! coeffs) {
+ av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
+ return -1;
+ }
+
for (comp = 0; comp < 3; comp++) {
- int *coeffs;
uint8_t *frame = s->picture.data[comp];
int width, height;
@@ -2347,12 +2353,6 @@ START_TIMER
s->padded_height = s->padded_chroma_height;
}
- coeffs = av_malloc(s->padded_width * s->padded_height * sizeof(int));
- if (! coeffs) {
- av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
- return -1;
- }
-
memset(coeffs, 0, s->padded_width * s->padded_height * sizeof(int));
if (!s->zero_res)
@@ -2370,9 +2370,10 @@ START_TIMER
for (y = 0; y < height; y++)
frame[x + y * s->picture.linesize[comp]]
= av_clip_uint8(coeffs[x + y * s->padded_width]);
- av_free(coeffs);
}
+ av_free(coeffs);
+
STOP_TIMER("dirac_frame_decode");
return 0;
More information about the FFmpeg-soc
mailing list