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

static int vc9_pred_dc ( MpegEncContext s,
int  n,
uint16_t **  dc_val_ptr,
int *  dir_ptr 
) [inline, static]

Get predicted DC value prediction dir: left=0, top=1

Parameters:
s MpegEncContext
[in] n block index in the current MB
dc_val_ptr Pointer to DC predictor
dir_ptr Prediction direction for use in AC prediction
Todo:
TODO: Actually do it the VC9 way
Todo:
TODO: Handle properly edges

Definition at line 1759 of file vc9.c.

References BI_TYPE, MpegEncContext::block_index, MpegEncContext::block_wrap, MpegEncContext::c_dc_scale, MpegEncContext::dc_val, MpegEncContext::first_slice_line, I_TYPE, MpegEncContext::mb_x, MpegEncContext::pict_type, and MpegEncContext::y_dc_scale.

Referenced by vc9_decode_block().

{
    int a, b, c, wrap, pred, scale;
    int16_t *dc_val;
    static const uint16_t dcpred[31] = {
        1024,  512,  341,  256,  205,  171,  146,  128,
         114,  102,   93,   85,   79,   73,   68,   64,
          60,   57,   54,   51,   49,   47,   45,   43,
          41,   39,   38,   37,   35,   34,   33
    };

    /* find prediction - wmv3_dc_scale always used here in fact */
    if (n < 4)     scale = s->y_dc_scale;
    else           scale = s->c_dc_scale;

    wrap = s->block_wrap[n];
    dc_val= s->dc_val[0] + s->block_index[n];

    /* B C
     * A X
     */
    a = dc_val[ - 1];
    b = dc_val[ - 1 - wrap];
    c = dc_val[ - wrap];

    /* XXX: Rule B is used only for I and BI frames in S/M/C profile
     *      with overlap filtering off
     */
    if ((s->pict_type == I_TYPE || s->pict_type == BI_TYPE) &&
        1 /* XXX: overlap filtering off */)
    {
        /* Set outer values */
        if (s->first_slice_line && n!=2) b=c=dcpred[scale];
        if (s->mb_x == 0) b=a=dcpred[scale];
    }
    else
    {
        /* Set outer values */
        if (s->first_slice_line && n!=2) b=c=0;
        if (s->mb_x == 0) b=a=0;

        /* XXX: Rule A needs to know if blocks are inter or intra :/ */
        if (0)
        {
            /* update predictor */
            *dc_val_ptr = &dc_val[0];
            dir_ptr = 0;
            return a;
        }
    }

    if (abs(a - b) <= abs(b - c)) {
        pred = c;
        *dir_ptr = 1;
    } else {
        pred = a;
        *dir_ptr = 0;
    }

    /* update predictor */
    *dc_val_ptr = &dc_val[0];
    return pred;
}


Generated by  Doxygen 1.6.0   Back to index