if(s->inter_intra_pred){ s->h263_aic_dir=0; put_bits(&s->pb, table_inter_intra[s->h263_aic_dir][1], table_inter_intra[s->h263_aic_dir][0]); }
void msmpeg4_encode_mb(MpegEncContext * s,                        DCTELEM block[6][64],                       int motion_x, int motion_y){    int cbp, coded_cbp, i;    int pred_x, pred_y;    UINT8 *coded_block;    handle_slices(s);        if (!s->mb_intra) {	/* compute cbp */        set_stat(ST_INTER_MB);	cbp = 0;	for (i = 0; i < 6; i++) {	    if (s->block_last_index[i] >= 0)		cbp |= 1 << (5 - i);	}	if (s->use_skip_mb_code && (cbp | motion_x | motion_y) == 0) {	    /* skip macroblock */	    put_bits(&s->pb, 1, 1);	    return;	}        if (s->use_skip_mb_code)            put_bits(&s->pb, 1, 0);	/* mb coded */                if(s->msmpeg4_version<=2){            put_bits(&s->pb,                      v2_mb_type[cbp&3][1],                      v2_mb_type[cbp&3][0]);            if((cbp&3) != 3) coded_cbp= cbp ^ 0x3C;            else             coded_cbp= cbp;            put_bits(&s->pb,                      cbpy_tab[coded_cbp>>2][1],                      cbpy_tab[coded_cbp>>2][0]);                                    h263_pred_motion(s, 0, &pred_x, &pred_y);            msmpeg4v2_encode_motion(s, motion_x - pred_x);            msmpeg4v2_encode_motion(s, motion_y - pred_y);        }else{            put_bits(&s->pb,                      table_mb_non_intra[cbp + 64][1],                      table_mb_non_intra[cbp + 64][0]);            /* motion vector */            h263_pred_motion(s, 0, &pred_x, &pred_y);            msmpeg4_encode_motion(s, motion_x - pred_x,                                   motion_y - pred_y);        }    } else {	/* compute cbp */	cbp = 0;        coded_cbp = 0;	for (i = 0; i < 6; i++) {            int val, pred;            val = (s->block_last_index[i] >= 1);            cbp |= val << (5 - i);            if (i < 4) {                /* predict value for close blocks only for luma */                pred = coded_block_pred(s, i, &coded_block);                *coded_block = val;                val = val ^ pred;            }            coded_cbp |= val << (5 - i);	}#if 0        if (coded_cbp)            printf("cbp=%x %x\n", cbp, coded_cbp);#endif        if(s->msmpeg4_version<=2){            if (s->pict_type == I_TYPE) {                put_bits(&s->pb,                          v2_intra_cbpc[cbp&3][1], v2_intra_cbpc[cbp&3][0]);            } else {                if (s->use_skip_mb_code)                    put_bits(&s->pb, 1, 0);	/* mb coded */                put_bits(&s->pb,                          v2_mb_type[(cbp&3) + 4][1],                          v2_mb_type[(cbp&3) + 4][0]);            }            put_bits(&s->pb, 1, 0);	/* no AC prediction yet */            put_bits(&s->pb,                      cbpy_tab[cbp>>2][1],                      cbpy_tab[cbp>>2][0]);        }else{            if (s->pict_type == I_TYPE) {                set_stat(ST_INTRA_MB);                put_bits(&s->pb,                          table_mb_intra[coded_cbp][1], table_mb_intra[coded_cbp][0]);            } else {                if (s->use_skip_mb_code)                    put_bits(&s->pb, 1, 0);	/* mb coded */                put_bits(&s->pb,                          table_mb_non_intra[cbp][1],                          table_mb_non_intra[cbp][0]);            }            set_stat(ST_INTRA_MB);            put_bits(&s->pb, 1, 0);	/* no AC prediction yet */        }    }    for (i = 0; i < 6; i++) {        msmpeg4_encode_block(s, block[i], i);    }}