static int h264_init_context(AVCodecContext *avctx, H264Context *h)

{

    int i;



    h->avctx                 = avctx;



    h->picture_structure     = PICT_FRAME;

    h->slice_context_count   = 1;

    h->workaround_bugs       = avctx->workaround_bugs;

    h->flags                 = avctx->flags;

    h->prev_poc_msb          = 1 << 16;

    h->x264_build            = -1;

    h->recovery_frame        = -1;

    h->frame_recovered       = 0;



    h->next_outputed_poc = INT_MIN;

    for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++)

        h->last_pocs[i] = INT_MIN;



    ff_h264_reset_sei(h);



    avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;



    h->nb_slice_ctx = (avctx->active_thread_type & FF_THREAD_SLICE) ?  H264_MAX_THREADS : 1;

    h->slice_ctx = av_mallocz_array(h->nb_slice_ctx, sizeof(*h->slice_ctx));

    if (!h->slice_ctx) {

        h->nb_slice_ctx = 0;

        return AVERROR(ENOMEM);

    }



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

        h->DPB[i].f = av_frame_alloc();

        if (!h->DPB[i].f)

            return AVERROR(ENOMEM);

    }



    h->cur_pic.f = av_frame_alloc();

    if (!h->cur_pic.f)

        return AVERROR(ENOMEM);



    for (i = 0; i < h->nb_slice_ctx; i++)

        h->slice_ctx[i].h264 = h;



    return 0;

}

static int h264_init_context(AVCodecContext *avctx, H264Context *h)

{

    int i;



    h->avctx                 = avctx;



    h->picture_structure     = PICT_FRAME;

    h->slice_context_count   = 1;

    h->workaround_bugs       = avctx->workaround_bugs;

    h->flags                 = avctx->flags;

    h->prev_poc_msb          = 1 << 16;

    h->x264_build            = -1;

    h->recovery_frame        = -1;

    h->frame_recovered       = 0;



    h->next_outputed_poc = INT_MIN;

    for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++)

        h->last_pocs[i] = INT_MIN;



    ff_h264_reset_sei(h);



    avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;



    h->nb_slice_ctx = (avctx->active_thread_type & FF_THREAD_SLICE) ?  H264_MAX_THREADS : 1;

    h->slice_ctx = av_mallocz_array(h->nb_slice_ctx, sizeof(*h->slice_ctx));

    if (!h->slice_ctx) {

        h->nb_slice_ctx = 0;

        return AVERROR(ENOMEM);

    }



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

        h->DPB[i].f = av_frame_alloc();

        if (!h->DPB[i].f)

            return AVERROR(ENOMEM);

    }



    h->cur_pic.f = av_frame_alloc();

    if (!h->cur_pic.f)

        return AVERROR(ENOMEM);



    for (i = 0; i < h->nb_slice_ctx; i++)

        h->slice_ctx[i].h264 = h;



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, H264Context *VAR_1)

{

    int VAR_2;



    VAR_1->VAR_0                 = VAR_0;



    VAR_1->picture_structure     = PICT_FRAME;

    VAR_1->slice_context_count   = 1;

    VAR_1->workaround_bugs       = VAR_0->workaround_bugs;

    VAR_1->flags                 = VAR_0->flags;

    VAR_1->prev_poc_msb          = 1 << 16;

    VAR_1->x264_build            = -1;

    VAR_1->recovery_frame        = -1;

    VAR_1->frame_recovered       = 0;



    VAR_1->next_outputed_poc = INT_MIN;

    for (VAR_2 = 0; VAR_2 < MAX_DELAYED_PIC_COUNT; VAR_2++)

        VAR_1->last_pocs[VAR_2] = INT_MIN;



    ff_h264_reset_sei(VAR_1);



    VAR_0->chroma_sample_location = AVCHROMA_LOC_LEFT;



    VAR_1->nb_slice_ctx = (VAR_0->active_thread_type & FF_THREAD_SLICE) ?  H264_MAX_THREADS : 1;

    VAR_1->slice_ctx = av_mallocz_array(VAR_1->nb_slice_ctx, sizeof(*VAR_1->slice_ctx));

    if (!VAR_1->slice_ctx) {

        VAR_1->nb_slice_ctx = 0;

        return AVERROR(ENOMEM);

    }



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

        VAR_1->DPB[VAR_2].f = av_frame_alloc();

        if (!VAR_1->DPB[VAR_2].f)

            return AVERROR(ENOMEM);

    }



    VAR_1->cur_pic.f = av_frame_alloc();

    if (!VAR_1->cur_pic.f)

        return AVERROR(ENOMEM);



    for (VAR_2 = 0; VAR_2 < VAR_1->nb_slice_ctx; VAR_2++)

        VAR_1->slice_ctx[VAR_2].h264 = VAR_1;



    return 0;

}

static int FUNC_0(AVCodecContext *VAR_0, H264Context *VAR_1)
{ int VAR_2; VAR_1->VAR_0                 = VAR_0; VAR_1->picture_structure     = PICT_FRAME; VAR_1->slice_context_count   = 1; VAR_1->workaround_bugs       = VAR_0->workaround_bugs; VAR_1->flags                 = VAR_0->flags; VAR_1->prev_poc_msb          = 1 << 16; VAR_1->x264_build            = -1; VAR_1->recovery_frame        = -1; VAR_1->frame_recovered       = 0; VAR_1->next_outputed_poc = INT_MIN; for (VAR_2 = 0; VAR_2 < MAX_DELAYED_PIC_COUNT; VAR_2++) VAR_1->last_pocs[VAR_2] = INT_MIN; ff_h264_reset_sei(VAR_1); VAR_0->chroma_sample_location = AVCHROMA_LOC_LEFT; VAR_1->nb_slice_ctx = (VAR_0->active_thread_type & FF_THREAD_SLICE) ?  H264_MAX_THREADS : 1; VAR_1->slice_ctx = av_mallocz_array(VAR_1->nb_slice_ctx, sizeof(*VAR_1->slice_ctx)); if (!VAR_1->slice_ctx) { VAR_1->nb_slice_ctx = 0; return AVERROR(ENOMEM); } for (VAR_2 = 0; VAR_2 < H264_MAX_PICTURE_COUNT; VAR_2++) { VAR_1->DPB[VAR_2].f = av_frame_alloc(); if (!VAR_1->DPB[VAR_2].f)
return AVERROR(ENOMEM); } VAR_1->cur_pic.f = av_frame_alloc(); if (!VAR_1->cur_pic.f)
return AVERROR(ENOMEM); for (VAR_2 = 0; VAR_2 < VAR_1->nb_slice_ctx; VAR_2++) VAR_1->slice_ctx[VAR_2].h264 = VAR_1; return 0; }