Mercurial > mplayer.hg
comparison libmpcodecs/vf.c @ 8631:3edba4a36c81
(temporary?) fix for redundant buffer re-allocation
author | arpi |
---|---|
date | Sun, 29 Dec 2002 02:57:49 +0000 |
parents | 14af7d96df34 |
children | d7237ee9db7f |
comparison
equal
deleted
inserted
replaced
8630:11888c95481b | 8631:3edba4a36c81 |
---|---|
182 // mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); | 182 // mpi->flags&=~(MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE|MP_IMGFLAG_DIRECT); |
183 mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; | 183 mpi->flags&=MP_IMGFLAG_ALLOCATED|MP_IMGFLAG_TYPE_DISPLAYED|MP_IMGFLAGMASK_COLORS; |
184 // accept restrictions & draw_slice flags only: | 184 // accept restrictions & draw_slice flags only: |
185 mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); | 185 mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK); |
186 if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; | 186 if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK; |
187 if((mpi->width!=w2 || mpi->height!=h) && !(mpi->flags&MP_IMGFLAG_DIRECT)){ | 187 if(mpi->width!=w2 || mpi->height!=h){ |
188 mpi->width=w2; mpi->chroma_width=w2>>mpi->chroma_x_shift; | 188 // printf("vf.c: MPI parameters changed! %dx%d -> %dx%d \n", mpi->width,mpi->height,w2,h); |
189 mpi->height=h; mpi->chroma_height=h>>mpi->chroma_y_shift; | |
190 if(mpi->flags&MP_IMGFLAG_ALLOCATED){ | 189 if(mpi->flags&MP_IMGFLAG_ALLOCATED){ |
191 // need to re-allocate buffer memory: | 190 if(mpi->width<w2 || mpi->height<h){ |
192 free(mpi->planes[0]); | 191 // need to re-allocate buffer memory: |
193 mpi->flags&=~MP_IMGFLAG_ALLOCATED; | 192 free(mpi->planes[0]); |
193 mpi->flags&=~MP_IMGFLAG_ALLOCATED; | |
194 printf("vf.c: have to REALLOCATE buffer memory :(\n"); | |
195 } | |
196 } else { | |
197 mpi->width=w2; mpi->chroma_width=w2>>mpi->chroma_x_shift; | |
198 mpi->height=h; mpi->chroma_height=h>>mpi->chroma_y_shift; | |
194 } | 199 } |
195 } | 200 } |
196 if(!mpi->bpp) mp_image_setfmt(mpi,outfmt); | 201 if(!mpi->bpp) mp_image_setfmt(mpi,outfmt); |
197 if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){ | 202 if(!(mpi->flags&MP_IMGFLAG_ALLOCATED) && mpi->type>MP_IMGTYPE_EXPORT){ |
198 | 203 |
244 mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height; | 249 mpi->planes[1]=mpi->planes[2]+mpi->chroma_width*mpi->chroma_height; |
245 } | 250 } |
246 } else { | 251 } else { |
247 if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; | 252 if(!mpi->stride[0]) mpi->stride[0]=mpi->width*mpi->bpp/8; |
248 } | 253 } |
254 // printf("clearing img!\n"); | |
249 vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); | 255 vf_mpi_clear(mpi,0,0,mpi->width,mpi->height); |
250 mpi->flags|=MP_IMGFLAG_ALLOCATED; | 256 mpi->flags|=MP_IMGFLAG_ALLOCATED; |
251 } | 257 } |
252 } | 258 } |
253 if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ | 259 if(!(mpi->flags&MP_IMGFLAG_TYPE_DISPLAYED)){ |
265 mpi->chroma_width, mpi->chroma_height, mpi->chroma_x_shift, mpi->chroma_y_shift); | 271 mpi->chroma_width, mpi->chroma_height, mpi->chroma_x_shift, mpi->chroma_y_shift); |
266 mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED; | 272 mpi->flags|=MP_IMGFLAG_TYPE_DISPLAYED; |
267 } | 273 } |
268 | 274 |
269 } | 275 } |
276 // printf("\rVF_MPI: %p %p %p %d %d %d \n", | |
277 // mpi->planes[0],mpi->planes[1],mpi->planes[2], | |
278 // mpi->stride[0],mpi->stride[1],mpi->stride[2]); | |
270 return mpi; | 279 return mpi; |
271 } | 280 } |
272 | 281 |
273 //============================================================================ | 282 //============================================================================ |
274 | 283 |