static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n,

                              int16_t **dc_val_ptr, int *dir_ptr)

{

    int a, b, c, wrap, pred, scale;

    int16_t *dc_val;

    static const uint16_t dcpred[32] = {

    -1, 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 A

     * C X

     */

    c = dc_val[ - 1];

    b = dc_val[ - 1 - wrap];

    a = dc_val[ - wrap];



    if (pq < 9 || !overlap)

    {

        /* Set outer values */

        if (!s->mb_y && (n!=2 && n!=3)) b=a=dcpred[scale];

        if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=dcpred[scale];

    }

    else

    {

        /* Set outer values */

        if (!s->mb_y && (n!=2 && n!=3)) b=a=0;

        if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=0;

    }



    if (abs(a - b) <= abs(b - c)) {

        pred = c;

        *dir_ptr = 1;//left

    } else {

        pred = a;

        *dir_ptr = 0;//top

    }



    /* update predictor */

    *dc_val_ptr = &dc_val[0];

    return pred;

}

static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n,

                              int16_t **dc_val_ptr, int *dir_ptr)

{

    int a, b, c, wrap, pred, scale;

    int16_t *dc_val;

    static const uint16_t dcpred[32] = {

    -1, 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

    };



    

    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];



    





    c = dc_val[ - 1];

    b = dc_val[ - 1 - wrap];

    a = dc_val[ - wrap];



    if (pq < 9 || !overlap)

    {

        

        if (!s->mb_y && (n!=2 && n!=3)) b=a=dcpred[scale];

        if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=dcpred[scale];

    }

    else

    {

        

        if (!s->mb_y && (n!=2 && n!=3)) b=a=0;

        if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=0;

    }



    if (abs(a - b) <= abs(b - c)) {

        pred = c;

        *dir_ptr = 1;

    } else {

        pred = a;

        *dir_ptr = 0;

    }



    

    *dc_val_ptr = &dc_val[0];

    return pred;

}

static inline int FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,

                              int16_t **VAR_4, int *VAR_5)

{

    int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;

    int16_t *dc_val;

    static const uint16_t VAR_12[32] = {

    -1, 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

    };



    

    if (VAR_3 < 4)     VAR_11 = VAR_0->y_dc_scale;

    else           VAR_11 = VAR_0->c_dc_scale;



    VAR_9 = VAR_0->block_wrap[VAR_3];

    dc_val= VAR_0->dc_val[0] + VAR_0->block_index[VAR_3];



    





    VAR_8 = dc_val[ - 1];

    VAR_7 = dc_val[ - 1 - VAR_9];

    VAR_6 = dc_val[ - VAR_9];



    if (VAR_2 < 9 || !VAR_1)

    {

        

        if (!VAR_0->mb_y && (VAR_3!=2 && VAR_3!=3)) VAR_7=VAR_6=VAR_12[VAR_11];

        if (VAR_0->mb_x == 0 && (VAR_3!=1 && VAR_3!=3)) VAR_7=VAR_8=VAR_12[VAR_11];

    }

    else

    {

        

        if (!VAR_0->mb_y && (VAR_3!=2 && VAR_3!=3)) VAR_7=VAR_6=0;

        if (VAR_0->mb_x == 0 && (VAR_3!=1 && VAR_3!=3)) VAR_7=VAR_8=0;

    }



    if (abs(VAR_6 - VAR_7) <= abs(VAR_7 - VAR_8)) {

        VAR_10 = VAR_8;

        *VAR_5 = 1;

    } else {

        VAR_10 = VAR_6;

        *VAR_5 = 0;

    }



    

    *VAR_4 = &dc_val[0];

    return VAR_10;

}

static inline int FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,
int16_t **VAR_4, int *VAR_5)
{ int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; int16_t *dc_val; static const uint16_t VAR_12[32] = { -1, 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
}; if (VAR_3 < 4)     VAR_11 = VAR_0->y_dc_scale; else           VAR_11 = VAR_0->c_dc_scale; VAR_9 = VAR_0->block_wrap[VAR_3]; dc_val= VAR_0->dc_val[0] + VAR_0->block_index[VAR_3]; VAR_8 = dc_val[ - 1]; VAR_7 = dc_val[ - 1 - VAR_9]; VAR_6 = dc_val[ - VAR_9]; if (VAR_2 < 9 || !VAR_1)
{ if (!VAR_0->mb_y && (VAR_3!=2 && VAR_3!=3)) VAR_7=VAR_6=VAR_12[VAR_11]; if (VAR_0->mb_x == 0 && (VAR_3!=1 && VAR_3!=3)) VAR_7=VAR_8=VAR_12[VAR_11]; } else
{ if (!VAR_0->mb_y && (VAR_3!=2 && VAR_3!=3)) VAR_7=VAR_6=0; if (VAR_0->mb_x == 0 && (VAR_3!=1 && VAR_3!=3)) VAR_7=VAR_8=0; } if (abs(VAR_6 - VAR_7) <= abs(VAR_7 - VAR_8)) { VAR_10 = VAR_8; *VAR_5 = 1; } else { VAR_10 = VAR_6; *VAR_5 = 0; } *VAR_4 = &dc_val[0]; return VAR_10; }