static int h264_init_context(AVCodecContext *avctx, H264Context *h)
{
    int i;
    h->avctx                 = avctx;
    h->picture_structure     = PICT_FRAME;
    h->workaround_bugs       = avctx->workaround_bugs;
    h->flags                 = avctx->flags;
    h->poc.prev_poc_msb      = 1 << 16;
    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_sei_uninit(&h->sei);
    avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
    h->nb_slice_ctx = (avctx->active_thread_type & FF_THREAD_SLICE) ? avctx->thread_count : 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);
    h->output_frame = av_frame_alloc();
    if (!h->output_frame)
        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->workaround_bugs       = avctx->workaround_bugs;
    h->flags                 = avctx->flags;
    h->poc.prev_poc_msb      = 1 << 16;
    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_sei_uninit(&h->sei);
    avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
    h->nb_slice_ctx = (avctx->active_thread_type & FF_THREAD_SLICE) ? avctx->thread_count : 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);
    h->output_frame = av_frame_alloc();
    if (!h->output_frame)
        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->workaround_bugs       = VAR_0->workaround_bugs;
    VAR_1->flags                 = VAR_0->flags;
    VAR_1->poc.prev_poc_msb      = 1 << 16;
    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_sei_uninit(&VAR_1->sei);
    VAR_0->chroma_sample_location = AVCHROMA_LOC_LEFT;
    VAR_1->nb_slice_ctx = (VAR_0->active_thread_type & FF_THREAD_SLICE) ? VAR_0->thread_count : 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);
    VAR_1->output_frame = av_frame_alloc();
    if (!VAR_1->output_frame)
        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->workaround_bugs       = VAR_0->workaround_bugs; VAR_1->flags                 = VAR_0->flags; VAR_1->poc.prev_poc_msb      = 1 << 16; 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_sei_uninit(&VAR_1->sei); VAR_0->chroma_sample_location = AVCHROMA_LOC_LEFT; VAR_1->nb_slice_ctx = (VAR_0->active_thread_type & FF_THREAD_SLICE) ? VAR_0->thread_count : 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); VAR_1->output_frame = av_frame_alloc(); if (!VAR_1->output_frame)
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; }