From: kramm Date: Mon, 19 May 2003 18:55:51 +0000 (+0000) Subject: bugfix for segfault on rgb2yuv conversion. X-Git-Tag: release-0-5-0~222 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=9d9d03c670f5ccc4752bb0aab0d51f1c573a20bb bugfix for segfault on rgb2yuv conversion. --- diff --git a/lib/h.263/swfvideo.c b/lib/h.263/swfvideo.c index e8b420d..1d26152 100644 --- a/lib/h.263/swfvideo.c +++ b/lib/h.263/swfvideo.c @@ -43,6 +43,8 @@ void swf_SetVideoStreamDefine(TAG*tag, VIDEOSTREAM*stream, U16 frames, U16 width #endif memset(stream, 0, sizeof(VIDEOSTREAM)); stream->olinex = width; + stream->owidth = width; + stream->oheight = height; width+=15;width&=~15; height+=15;height&=~15; stream->linex = width; @@ -1292,7 +1294,8 @@ void swf_SetVideoStreamIFrame(TAG*tag, VIDEOSTREAM*s, RGBA*pic, int quant) writeHeader(tag, s->width, s->height, s->frame, quant, TYPE_IFRAME); - rgb2yuv(s->current, pic, s->linex, s->olinex, s->width, s->height); + memset(s->current, 0, s->linex*s->height*sizeof(YUV)); + rgb2yuv(s->current, pic, s->linex, s->olinex, s->owidth, s->oheight); //dostat(s); @@ -1316,7 +1319,8 @@ void swf_SetVideoStreamPFrame(TAG*tag, VIDEOSTREAM*s, RGBA*pic, int quant) writeHeader(tag, s->width, s->height, s->frame, quant, TYPE_PFRAME); - rgb2yuv(s->current, pic, s->linex, s->olinex, s->width, s->height); + memset(s->current, 0, s->linex*s->height*sizeof(YUV)); + rgb2yuv(s->current, pic, s->linex, s->olinex, s->owidth, s->oheight); memset(s->mvdx, 0, s->bbx*s->bby*sizeof(int)); memset(s->mvdy, 0, s->bbx*s->bby*sizeof(int));