# HG changeset patch # User andoma # Date 1191480792 0 # Node ID e71de81878c48c29e9a5240ab4d4eb4791ce563b # Parent e3d7a78e2df385f6fa9ea809ed096e993e915a8a Reorganize long reference management to minimize code duplication in upcoming PAFF implementation. patch by Jeff Downs, heydowns a borg d com original thread: Subject: [FFmpeg-devel] [PATCH] Implement PAFF in H.264 Date: 18/09/07 20:30 diff -r e3d7a78e2df3 -r e71de81878c4 h264.c --- a/h264.c Thu Oct 04 06:50:44 2007 +0000 +++ b/h264.c Thu Oct 04 06:53:12 2007 +0000 @@ -3224,6 +3224,17 @@ } /** + * Remove a picture from the long term reference list by its index in + * that list. This does no checking on the provided index; it is assumed + * to be valid. The removed entry is set to NULL. Other entries are unaffected. + * @param i index into h->long_ref of picture to remove. + */ +static void remove_long_at_index(H264Context *h, int i){ + h->long_ref[i]= NULL; + h->long_ref_count--; +} + +/** * * @return the removed picture or NULL if an error occurs */ @@ -3231,8 +3242,8 @@ Picture *pic; pic= h->long_ref[i]; - h->long_ref[i]= NULL; - if(pic) h->long_ref_count--; + if (pic) + remove_long_at_index(h, i); return pic; }