From c9872edafeb35978253d9d9cacd53e0bc182e976 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 9 Mar 2009 14:30:41 +0000 Subject: Allocate buffer for lzo compression correctly also for large frame sizes. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28910 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ve_nuv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c index 4b1691a932..132e23a944 100644 --- a/libmpcodecs/ve_nuv.c +++ b/libmpcodecs/ve_nuv.c @@ -24,8 +24,7 @@ #include "native/rtjpegn.h" #define LZO_AL(size) (((size) + (sizeof(long) - 1)) / sizeof(long)) -#define LZO_IN_LEN (1024*1024L) -#define LZO_OUT_LEN (LZO_IN_LEN + LZO_IN_LEN / 64 + 16 + 3) +#define LZO_OUT_LEN(in) ((in) + (in) / 64 + 16 + 3) //===========================================================================// @@ -85,6 +84,8 @@ static int config(struct vf_instance_s* vf, mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); mux_v->aspect = (float)d_width/d_height; vf->priv->buffer = realloc(vf->priv->buffer,vf->priv->buf_size); + if (vf->priv->lzo) + vf->priv->zbuffer = realloc(vf->priv->zbuffer, FRAMEHEADERSIZE + LZO_OUT_LEN(vf->priv->buf_size)); vf->priv->tbl_wrote = 0; return 1; @@ -218,8 +219,7 @@ static int vf_open(vf_instance_t *vf, char* args){ if(lzo_init() != LZO_E_OK) { mp_msg(MSGT_VFILTER,MSGL_WARN,"LZO init failed: no lzo compression\n"); vf->priv->lzo = 0; - } - vf->priv->zbuffer = (lzo_bytep)malloc(FRAMEHEADERSIZE + LZO_OUT_LEN); + } else vf->priv->zmem = malloc(sizeof(long)*LZO_AL(LZO1X_1_MEM_COMPRESS)); } -- cgit v1.2.3