[Ffmpeg-devel] understanding unreference_pic()

Chengji Zhao czhao
Thu Jun 9 07:41:01 CEST 2005


Dear all,
I have been studying the H.264 decoder of ffmpeg for a while.
There is one function I feel very difficult to follow though the 
function only has 12 lines. .
In order to make you understand my question, I copied the function to here.

static inline void unreference_pic(H264Context *h, Picture *pic){
    int i;
    pic->reference=0;
    if(pic == h->delayed_output_pic)
        pic->reference=1;
    else{
        for(i = 0; h->delayed_pic[i]; i++)
            if(pic == h->delayed_pic[i]){
                pic->reference=1;
                break;
            }
    }
}

The thing I feel confused is that  this function will be called when a 
picture is marked as not used for reference anymore.
so the first line is easy to understand. But what the rest of code is doing?
Can somebody briefly explains it to me?

many thanks
Chengji





More information about the ffmpeg-devel mailing list