Mercurial > libavcodec.hg
comparison utils.c @ 4558:4d1b45b20f8c libavcodec
simplify release_buffer using FFSWAP
author | aurel |
---|---|
date | Wed, 21 Feb 2007 23:46:25 +0000 |
parents | c31d78661cf2 |
children | 22c4464c8049 |
comparison
equal
deleted
inserted
replaced
4557:6d4ac79304da | 4558:4d1b45b20f8c |
---|---|
331 return 0; | 331 return 0; |
332 } | 332 } |
333 | 333 |
334 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ | 334 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ |
335 int i; | 335 int i; |
336 InternalBuffer *buf, *last, temp; | 336 InternalBuffer *buf, *last; |
337 | 337 |
338 assert(pic->type==FF_BUFFER_TYPE_INTERNAL); | 338 assert(pic->type==FF_BUFFER_TYPE_INTERNAL); |
339 assert(s->internal_buffer_count); | 339 assert(s->internal_buffer_count); |
340 | 340 |
341 buf = NULL; /* avoids warning */ | 341 buf = NULL; /* avoids warning */ |
346 } | 346 } |
347 assert(i < s->internal_buffer_count); | 347 assert(i < s->internal_buffer_count); |
348 s->internal_buffer_count--; | 348 s->internal_buffer_count--; |
349 last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; | 349 last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; |
350 | 350 |
351 temp= *buf; | 351 FFSWAP(InternalBuffer, *buf, *last); |
352 *buf= *last; | |
353 *last= temp; | |
354 | 352 |
355 for(i=0; i<3; i++){ | 353 for(i=0; i<3; i++){ |
356 pic->data[i]=NULL; | 354 pic->data[i]=NULL; |
357 // pic->base[i]=NULL; | 355 // pic->base[i]=NULL; |
358 } | 356 } |