alloc_parameter_set(H264Context *h, void **vec, const unsigned int id, const unsigned int max,

                    const size_t size, const char *name)

{

    if(id>=max) {

        av_log(h->s.avctx, AV_LOG_ERROR, "%s_id (%d) out of range\n", name, id);

        return NULL;

    }



    if(!vec[id]) {

        vec[id] = av_mallocz(size);

        if(vec[id] == NULL)

            av_log(h->s.avctx, AV_LOG_ERROR, "cannot allocate memory for %s\n", name);

    }

    return vec[id];

}

alloc_parameter_set(H264Context *h, void **vec, const unsigned int id, const unsigned int max,

                    const size_t size, const char *name)

{

    if(id>=max) {

        av_log(h->s.avctx, AV_LOG_ERROR, "%s_id (%d) out of range\n", name, id);

        return NULL;

    }



    if(!vec[id]) {

        vec[id] = av_mallocz(size);

        if(vec[id] == NULL)

            av_log(h->s.avctx, AV_LOG_ERROR, "cannot allocate memory for %s\n", name);

    }

    return vec[id];

}

FUNC_0(H264Context *VAR_0, void **VAR_1, const unsigned int VAR_2, const unsigned int VAR_3,

                    const size_t VAR_4, const char *VAR_5)

{

    if(VAR_2>=VAR_3) {

        av_log(VAR_0->s.avctx, AV_LOG_ERROR, "%s_id (%d) out of range\n", VAR_5, VAR_2);

        return NULL;

    }



    if(!VAR_1[VAR_2]) {

        VAR_1[VAR_2] = av_mallocz(VAR_4);

        if(VAR_1[VAR_2] == NULL)

            av_log(VAR_0->s.avctx, AV_LOG_ERROR, "cannot allocate memory for %s\n", VAR_5);

    }

    return VAR_1[VAR_2];

}

FUNC_0(H264Context *VAR_0, void **VAR_1, const unsigned int VAR_2, const unsigned int VAR_3,
const size_t VAR_4, const char *VAR_5)
{ if(VAR_2>=VAR_3) { av_log(VAR_0->s.avctx, AV_LOG_ERROR, "%s_id (%d) out of range\n", VAR_5, VAR_2); return NULL; } if(!VAR_1[VAR_2]) { VAR_1[VAR_2] = av_mallocz(VAR_4); if(VAR_1[VAR_2] == NULL)
av_log(VAR_0->s.avctx, AV_LOG_ERROR, "cannot allocate memory for %s\n", VAR_5); } return VAR_1[VAR_2]; }