Revision fb079883

View differences:

libavcodec/h263.c
730 730
    
731 731
    //    printf("**mb x=%d y=%d\n", s->mb_x, s->mb_y);
732 732
    if (!s->mb_intra) {
733
        /* compute cbp */
734 733
        int i, cbp;
735 734
        
736 735
        if(s->pict_type==B_TYPE){
......
1145 1144
            s->mv_bits+= get_bits_diff(s);
1146 1145
        }
1147 1146
    } else {
1148
        int li = s->h263_aic ? 0 : 1;
1149 1147
        assert(s->mb_intra);
1150 1148
        
1151 1149
        cbp = 0;
1152
        for(i=0; i<6; i++) {
1150
        if (s->h263_aic) {
1153 1151
            /* Predict DC */
1154
            if (s->h263_aic) {
1152
            for(i=0; i<6; i++) {
1155 1153
                int16_t level = block[i][0];
1156
            
1154
                int scale;
1155
                
1156
                if(i<4) scale= s->y_dc_scale;
1157
                else    scale= s->c_dc_scale;
1158

  
1157 1159
                pred_dc = h263_pred_dc(s, i, &dc_ptr[i]);
1158 1160
                level -= pred_dc;
1159 1161
                /* Quant */
1160
                if (level < 0)
1161
                    level = (level + (s->qscale >> 1))/(s->y_dc_scale);
1162
                if (level >= 0)
1163
                    level = (level + (scale>>1))/scale;
1162 1164
                else
1163
                    level = (level - (s->qscale >> 1))/(s->y_dc_scale);
1165
                    level = (level - (scale>>1))/scale;
1164 1166
                    
1165 1167
                /* AIC can change CBP */
1166 1168
                if (level == 0 && s->block_last_index[i] == 0)
1167 1169
                    s->block_last_index[i] = -1;
1168
                else if (level < -127)
1169
                    level = -127;
1170
                else if (level > 127)
1171
                    level = 127;
1172
                
1170

  
1171
                if(!s->modified_quant){
1172
                    if (level < -127)
1173
                        level = -127;
1174
                    else if (level > 127)
1175
                        level = 127;
1176
                }
1177

  
1173 1178
                block[i][0] = level;
1174 1179
                /* Reconstruction */ 
1175
                rec_intradc[i] = (s->y_dc_scale*level) + pred_dc;
1180
                rec_intradc[i] = scale*level + pred_dc;
1176 1181
                /* Oddify */
1177 1182
                rec_intradc[i] |= 1;
1178 1183
                //if ((rec_intradc[i] % 2) == 0)
......
1185 1190
                                
1186 1191
                /* Update AC/DC tables */
1187 1192
                *dc_ptr[i] = rec_intradc[i];
1193
                if (s->block_last_index[i] >= 0)
1194
                    cbp |= 1 << (5 - i);
1195
            }
1196
        }else{
1197
            for(i=0; i<6; i++) {
1198
                /* compute cbp */
1199
                if (s->block_last_index[i] >= 1)
1200
                    cbp |= 1 << (5 - i);
1188 1201
            }
1189
            /* compute cbp */
1190
            if (s->block_last_index[i] >= li)
1191
                cbp |= 1 << (5 - i);
1192 1202
        }
1193 1203

  
1194 1204
        cbpc = cbp & 3;
......
1907 1917
        
1908 1918
        break;
1909 1919
    case CODEC_ID_H263P:
1910
        s->fcode_tab= umv_fcode_tab;
1911
        s->min_qcoeff= -127;
1912
        s->max_qcoeff=  127;
1920
        if(s->umvplus)
1921
            s->fcode_tab= umv_fcode_tab;
1922
        else
1923
            s->fcode_tab= fcode_tab;
1924
        if(s->modified_quant){
1925
            s->min_qcoeff= -2047;
1926
            s->max_qcoeff=  2047;
1927
        }else{
1928
            s->min_qcoeff= -127;
1929
            s->max_qcoeff=  127;
1930
        }
1913 1931
        break;
1914 1932
        //Note for mpeg4 & h263 the dc-scale table will be set per frame as needed later 
1915 1933
    case CODEC_ID_FLV1:

Also available in: Unified diff