static int decode_i_picture_header(VC9Context *v)

{

  int pqindex, status = 0, ac_pred, condover;



    /* Prolog common to all frametypes should be done in caller */

    //BF = Buffer Fullness

    if (v->profile <= PROFILE_MAIN && get_bits(&v->gb, 7))

    {

        av_log(v, AV_LOG_DEBUG, "I BufferFullness not 0\n");

    }



    /* Quantizer stuff */

    pqindex = get_bits(&v->gb, 5);

    if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)

        v->pq = pquant_table[0][pqindex];

    else

    {

        v->pq = pquant_table[v->quantizer_mode-1][pqindex];

    }

    if (pqindex < 9) v->halfpq = get_bits(&v->gb, 1);

    if (v->quantizer_mode == QUANT_FRAME_EXPLICIT)

        v->pquantizer = get_bits(&v->gb, 1);

    av_log(v->avctx, AV_LOG_DEBUG, "I frame: QP=%i (+%i/2)\n",

           v->pq, v->halfpq);

#if HAS_ADVANCED_PROFILE

    if (v->profile <= PROFILE_MAIN)

#endif

    {

        if (v->extended_mv) v->mvrange = get_prefix(&v->gb, 0, 3);

        if (v->multires) v->respic = get_bits(&v->gb, 2);

    }

#if HAS_ADVANCED_PROFILE

    else

    {

        ac_pred = get_bits(&v->gb, 1);

        if (v->postprocflag) v->postproc = get_bits(&v->gb, 1);

        /* 7.1.1.34 + 8.5.2 */

        if (v->overlap && v->pq<9)

        {

            condover = get_bits(&v->gb, 1);

            if (condover)

            {

                condover = 2+get_bits(&v->gb, 1);

                if (condover == 3)

                    status = bitplane_decoding(v->over_flags_plane,

                                                   v->width_mb, v->height_mb, v);

            }

        }

    }

#endif



    /* Epilog should be done in caller */

    return status;

}

static int decode_i_picture_header(VC9Context *v)

{

  int pqindex, status = 0, ac_pred, condover;



    

    

    if (v->profile <= PROFILE_MAIN && get_bits(&v->gb, 7))

    {

        av_log(v, AV_LOG_DEBUG, "I BufferFullness not 0\n");

    }



    

    pqindex = get_bits(&v->gb, 5);

    if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)

        v->pq = pquant_table[0][pqindex];

    else

    {

        v->pq = pquant_table[v->quantizer_mode-1][pqindex];

    }

    if (pqindex < 9) v->halfpq = get_bits(&v->gb, 1);

    if (v->quantizer_mode == QUANT_FRAME_EXPLICIT)

        v->pquantizer = get_bits(&v->gb, 1);

    av_log(v->avctx, AV_LOG_DEBUG, "I frame: QP=%i (+%i/2)\n",

           v->pq, v->halfpq);

#if HAS_ADVANCED_PROFILE

    if (v->profile <= PROFILE_MAIN)

#endif

    {

        if (v->extended_mv) v->mvrange = get_prefix(&v->gb, 0, 3);

        if (v->multires) v->respic = get_bits(&v->gb, 2);

    }

#if HAS_ADVANCED_PROFILE

    else

    {

        ac_pred = get_bits(&v->gb, 1);

        if (v->postprocflag) v->postproc = get_bits(&v->gb, 1);

        

        if (v->overlap && v->pq<9)

        {

            condover = get_bits(&v->gb, 1);

            if (condover)

            {

                condover = 2+get_bits(&v->gb, 1);

                if (condover == 3)

                    status = bitplane_decoding(v->over_flags_plane,

                                                   v->width_mb, v->height_mb, v);

            }

        }

    }

#endif



    

    return status;

}

static int FUNC_0(VC9Context *VAR_0)

{

  int VAR_1, VAR_2 = 0, VAR_3, VAR_4;



    

    

    if (VAR_0->profile <= PROFILE_MAIN && get_bits(&VAR_0->gb, 7))

    {

        av_log(VAR_0, AV_LOG_DEBUG, "I BufferFullness not 0\n");

    }



    

    VAR_1 = get_bits(&VAR_0->gb, 5);

    if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT)

        VAR_0->pq = pquant_table[0][VAR_1];

    else

    {

        VAR_0->pq = pquant_table[VAR_0->quantizer_mode-1][VAR_1];

    }

    if (VAR_1 < 9) VAR_0->halfpq = get_bits(&VAR_0->gb, 1);

    if (VAR_0->quantizer_mode == QUANT_FRAME_EXPLICIT)

        VAR_0->pquantizer = get_bits(&VAR_0->gb, 1);

    av_log(VAR_0->avctx, AV_LOG_DEBUG, "I frame: QP=%i (+%i/2)\n",

           VAR_0->pq, VAR_0->halfpq);

#if HAS_ADVANCED_PROFILE

    if (VAR_0->profile <= PROFILE_MAIN)

#endif

    {

        if (VAR_0->extended_mv) VAR_0->mvrange = get_prefix(&VAR_0->gb, 0, 3);

        if (VAR_0->multires) VAR_0->respic = get_bits(&VAR_0->gb, 2);

    }

#if HAS_ADVANCED_PROFILE

    else

    {

        VAR_3 = get_bits(&VAR_0->gb, 1);

        if (VAR_0->postprocflag) VAR_0->postproc = get_bits(&VAR_0->gb, 1);

        

        if (VAR_0->overlap && VAR_0->pq<9)

        {

            VAR_4 = get_bits(&VAR_0->gb, 1);

            if (VAR_4)

            {

                VAR_4 = 2+get_bits(&VAR_0->gb, 1);

                if (VAR_4 == 3)

                    VAR_2 = bitplane_decoding(VAR_0->over_flags_plane,

                                                   VAR_0->width_mb, VAR_0->height_mb, VAR_0);

            }

        }

    }

#endif



    

    return VAR_2;

}

static int FUNC_0(VC9Context *VAR_0)
{ int VAR_1, VAR_2 = 0, VAR_3, VAR_4; if (VAR_0->profile <= PROFILE_MAIN && get_bits(&VAR_0->gb, 7))
{ av_log(VAR_0, AV_LOG_DEBUG, "I BufferFullness not 0\n"); } VAR_1 = get_bits(&VAR_0->gb, 5); if (VAR_0->quantizer_mode == QUANT_FRAME_IMPLICIT)
VAR_0->pq = pquant_table[0][VAR_1]; else
{ VAR_0->pq = pquant_table[VAR_0->quantizer_mode-1][VAR_1]; } if (VAR_1 < 9) VAR_0->halfpq = get_bits(&VAR_0->gb, 1); if (VAR_0->quantizer_mode == QUANT_FRAME_EXPLICIT)
VAR_0->pquantizer = get_bits(&VAR_0->gb, 1); av_log(VAR_0->avctx, AV_LOG_DEBUG, "I frame: QP=%i (+%i/2)\n",
VAR_0->pq, VAR_0->halfpq); #if HAS_ADVANCED_PROFILE
if (VAR_0->profile <= PROFILE_MAIN)
#endif
{ if (VAR_0->extended_mv) VAR_0->mvrange = get_prefix(&VAR_0->gb, 0, 3); if (VAR_0->multires) VAR_0->respic = get_bits(&VAR_0->gb, 2); } #if HAS_ADVANCED_PROFILE
else
{ VAR_3 = get_bits(&VAR_0->gb, 1); if (VAR_0->postprocflag) VAR_0->postproc = get_bits(&VAR_0->gb, 1); if (VAR_0->overlap && VAR_0->pq<9)
{ VAR_4 = get_bits(&VAR_0->gb, 1); if (VAR_4)
{ VAR_4 = 2+get_bits(&VAR_0->gb, 1); if (VAR_4 == 3)
VAR_2 = bitplane_decoding(VAR_0->over_flags_plane,
VAR_0->width_mb, VAR_0->height_mb, VAR_0); } } } #endif
return VAR_2; }