Logo Search packages:      
Sourcecode: blender version File versions  Download package

static int vc9_decode_b_mb ( VC9Context v,
DCTELEM  block[6][64] 
) [static]

Decode one B-frame MB (in Simple/Main profile)

Todo:
TODO: Extend to AP
Warning:
XXX: Used for decoding BI MBs FIXME: DC value for inter blocks not set

Definition at line 2163 of file vc9.c.

References MpegEncContext::ac_pred, VC9Context::bfraction, BitPlane::data, VC9Context::direct_mb_plane, MpegEncContext::gb, GET_MQUANT, GET_MVDATA, BitPlane::is_raw, MpegEncContext::mb_intra, MpegEncContext::mb_width, MpegEncContext::mb_x, MpegEncContext::mb_y, VC9Context::pq, VC9Context::s, VC9Context::skip_mb_plane, VC9Context::tt_index, VC9Context::ttmbf, and vc9_decode_block().

Referenced by standard_decode_mbs().

{
    MpegEncContext *s = &v->s;
    GetBitContext *gb = &v->s.gb;
    int mb_offset, i /* MB / B postion information */;
    int b_mv_type = BMV_TYPE_BACKWARD;
    int mquant, mqdiff; /* MB quant stuff */
    int ttmb; /* MacroBlock transform type */

    static const int size_table[6] = { 0, 2, 3, 4, 5, 8 },
        offset_table[6] = { 0, 1, 3, 7, 15, 31 };
    int mb_has_coeffs = 1; /* last_flag */
    int dmv1_x, dmv1_y, dmv2_x, dmv2_y; /* Differential MV components */
    int index, index1; /* LUT indices */
    int val, sign; /* MVDATA temp values */

    mb_offset = s->mb_width*s->mb_y + s->mb_x; //FIXME: arrays aren't using stride

    if (v->direct_mb_plane.is_raw)
        v->direct_mb_plane.data[mb_offset] = get_bits(gb, 1);
    if (v->skip_mb_plane.is_raw)
        v->skip_mb_plane.data[mb_offset] = get_bits(gb, 1);

    if (!v->direct_mb_plane.data[mb_offset])
    {
        if (v->skip_mb_plane.data[mb_offset])
        {
            b_mv_type = decode012(gb);
            if (v->bfraction > 420 /*1/2*/ &&
                b_mv_type < 3) b_mv_type = 1-b_mv_type;
        }
        else
        {
            GET_MVDATA(dmv1_x, dmv1_y);
            if (!s->mb_intra /* b_mv1 tells not intra */)
            {
                b_mv_type = decode012(gb);
                if (v->bfraction > 420 /*1/2*/ &&
                    b_mv_type < 3) b_mv_type = 1-b_mv_type;
            }
        }
    }
    if (!v->skip_mb_plane.data[mb_offset])
    {
        if (mb_has_coeffs /* BMV1 == "last" */)
        {
            GET_MQUANT();
            if (s->mb_intra /* intra mb */)
                s->ac_pred = get_bits(gb, 1);
        }
        else
        {
            /* if bmv1 tells MVs are interpolated */
            if (b_mv_type == BMV_TYPE_INTERPOLATED)
            {
                GET_MVDATA(dmv2_x, dmv2_y);
                mquant = v->pq; //FIXME: initialization not necessary ?
            }
            /* GET_MVDATA has reset some stuff */
            if (mb_has_coeffs /* b_mv2 == "last" */)
            {
                if (s->mb_intra /* intra_mb */)
                    s->ac_pred = get_bits(gb, 1);
                GET_MQUANT();
            }
        }
    }

    //End1
    if (v->ttmbf)
        ttmb = get_vlc2(gb, vc9_ttmb_vlc[v->tt_index].table,
                        VC9_TTMB_VLC_BITS, 12);

    //End2
    for (i=0; i<6; i++)
    {
        vc9_decode_block(v, block[i], i, 0 /*cbp[i]*/, mquant); //FIXME
    }
    return 0;
}


Generated by  Doxygen 1.6.0   Back to index