void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){

    int i;

    InternalBuffer *buf, *last;

    AVCodecInternal *avci = s->internal;



    assert(s->codec_type == AVMEDIA_TYPE_VIDEO);



    assert(pic->type==FF_BUFFER_TYPE_INTERNAL);

    assert(avci->buffer_count);



    if (avci->buffer) {

        buf = NULL; /* avoids warning */

        for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize

            buf = &avci->buffer[i];

            if (buf->data[0] == pic->data[0])

                break;

        }

        assert(i < avci->buffer_count);

        avci->buffer_count--;

        last = &avci->buffer[avci->buffer_count];



        FFSWAP(InternalBuffer, *buf, *last);

    }



    for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {

        pic->data[i]=NULL;

//        pic->base[i]=NULL;

    }

//printf("R%X\n", pic->opaque);



    if(s->debug&FF_DEBUG_BUFFERS)

        av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d "

               "buffers used\n", pic, avci->buffer_count);

}

void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){

    int i;

    InternalBuffer *buf, *last;

    AVCodecInternal *avci = s->internal;



    assert(s->codec_type == AVMEDIA_TYPE_VIDEO);



    assert(pic->type==FF_BUFFER_TYPE_INTERNAL);

    assert(avci->buffer_count);



    if (avci->buffer) {

        buf = NULL; 

        for (i = 0; i < avci->buffer_count; i++) { 

            buf = &avci->buffer[i];

            if (buf->data[0] == pic->data[0])

                break;

        }

        assert(i < avci->buffer_count);

        avci->buffer_count--;

        last = &avci->buffer[avci->buffer_count];



        FFSWAP(InternalBuffer, *buf, *last);

    }



    for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {

        pic->data[i]=NULL;



    }





    if(s->debug&FF_DEBUG_BUFFERS)

        av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d "

               "buffers used\n", pic, avci->buffer_count);

}

void FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1){

    int VAR_2;

    InternalBuffer *buf, *last;

    AVCodecInternal *avci = VAR_0->internal;



    assert(VAR_0->codec_type == AVMEDIA_TYPE_VIDEO);



    assert(VAR_1->type==FF_BUFFER_TYPE_INTERNAL);

    assert(avci->buffer_count);



    if (avci->buffer) {

        buf = NULL; 

        for (VAR_2 = 0; VAR_2 < avci->buffer_count; VAR_2++) { 

            buf = &avci->buffer[VAR_2];

            if (buf->data[0] == VAR_1->data[0])

                break;

        }

        assert(VAR_2 < avci->buffer_count);

        avci->buffer_count--;

        last = &avci->buffer[avci->buffer_count];



        FFSWAP(InternalBuffer, *buf, *last);

    }



    for (VAR_2 = 0; VAR_2 < AV_NUM_DATA_POINTERS; VAR_2++) {

        VAR_1->data[VAR_2]=NULL;



    }





    if(VAR_0->debug&FF_DEBUG_BUFFERS)

        av_log(VAR_0, AV_LOG_DEBUG, "default_release_buffer called on VAR_1 %p, %d "

               "buffers used\n", VAR_1, avci->buffer_count);

}

void FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1){ int VAR_2; InternalBuffer *buf, *last; AVCodecInternal *avci = VAR_0->internal; assert(VAR_0->codec_type == AVMEDIA_TYPE_VIDEO); assert(VAR_1->type==FF_BUFFER_TYPE_INTERNAL); assert(avci->buffer_count); if (avci->buffer) { buf = NULL; for (VAR_2 = 0; VAR_2 < avci->buffer_count; VAR_2++) { buf = &avci->buffer[VAR_2]; if (buf->data[0] == VAR_1->data[0])
break; } assert(VAR_2 < avci->buffer_count); avci->buffer_count--; last = &avci->buffer[avci->buffer_count]; FFSWAP(InternalBuffer, *buf, *last); } for (VAR_2 = 0; VAR_2 < AV_NUM_DATA_POINTERS; VAR_2++) { VAR_1->data[VAR_2]=NULL; } if(VAR_0->debug&FF_DEBUG_BUFFERS)
av_log(VAR_0, AV_LOG_DEBUG, "default_release_buffer called on VAR_1 %p, %d "
"buffers used\n", VAR_1, avci->buffer_count); }