Logo Search packages:      
Sourcecode: blender version File versions

void mpeg4_pred_ac ( MpegEncContext s,
DCTELEM *  block,
int  n,
int  dir 
)

predicts the ac.

Parameters:
n block index (0-3 are luma, 4-5 are chroma)
dir the ac prediction direction

Definition at line 2604 of file h263.c.

References MpegEncContext::ac_pred, MpegEncContext::ac_val, MpegEncContext::block_index, MpegEncContext::block_wrap, MpegEncContext::current_picture, MpegEncContext::dsp, DSPContext::idct_permutation, MpegEncContext::mb_stride, MpegEncContext::mb_x, MpegEncContext::mb_y, and MpegEncContext::qscale.

Referenced by mpeg4_decode_block(), and vc9_decode_block().

{
    int i;
    int16_t *ac_val, *ac_val1;
    int8_t * const qscale_table= s->current_picture.qscale_table;

    /* find prediction */
    ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
    ac_val1 = ac_val;
    if (s->ac_pred) {
        if (dir == 0) {
            const int xy= s->mb_x-1 + s->mb_y*s->mb_stride;
            /* left prediction */
            ac_val -= 16;

            if(s->mb_x==0 || s->qscale == qscale_table[xy] || n==1 || n==3){
                /* same qscale */
                for(i=1;i<8;i++) {
                    block[s->dsp.idct_permutation[i<<3]] += ac_val[i];
                }
            }else{
                /* different qscale, we must rescale */
                for(i=1;i<8;i++) {
                    block[s->dsp.idct_permutation[i<<3]] += ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale);
                }
            }
        } else {
            const int xy= s->mb_x + s->mb_y*s->mb_stride - s->mb_stride;
            /* top prediction */
            ac_val -= 16 * s->block_wrap[n];

            if(s->mb_y==0 || s->qscale == qscale_table[xy] || n==2 || n==3){
                /* same qscale */
                for(i=1;i<8;i++) {
                    block[s->dsp.idct_permutation[i]] += ac_val[i + 8];
                }
            }else{
                /* different qscale, we must rescale */
                for(i=1;i<8;i++) {
                    block[s->dsp.idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale);
                }
            }
        }
    }
    /* left copy */
    for(i=1;i<8;i++)
        ac_val1[i    ] = block[s->dsp.idct_permutation[i<<3]];

    /* top copy */
    for(i=1;i<8;i++)
        ac_val1[8 + i] = block[s->dsp.idct_permutation[i   ]];

}


Generated by  Doxygen 1.6.0   Back to index