Revision b50eef3a libavcodec/mpegvideo.c

View differences:

libavcodec/mpegvideo.c
155 155
        CHECKED_ALLOCZ(pict, c_size)
156 156
        s->last_picture_base[i] = pict;
157 157
        s->last_picture[i] = pict + pict_start;
158
        if(i>0) memset(s->last_picture_base[i], 128, c_size);
158 159
    
159 160
        CHECKED_ALLOCZ(pict, c_size)
160 161
        s->next_picture_base[i] = pict;
161 162
        s->next_picture[i] = pict + pict_start;
163
        if(i>0) memset(s->next_picture_base[i], 128, c_size);
162 164
        
163 165
        if (s->has_b_frames || s->codec_id==CODEC_ID_MPEG4) {
164 166
        /* Note the MPEG4 stuff is here cuz of buggy encoders which dont set the low_delay flag but 
......
166 168
            CHECKED_ALLOCZ(pict, c_size)
167 169
            s->aux_picture_base[i] = pict;
168 170
            s->aux_picture[i] = pict + pict_start;
171
            if(i>0) memset(s->aux_picture_base[i], 128, c_size);
169 172
        }
170 173
    }
171 174
    
......
886 889
    pix_op[dxy](dest_y, ptr, linesize, h);
887 890
    pix_op[dxy](dest_y + 8, ptr + 8, linesize, h);
888 891

  
892
    if(s->flags&CODEC_FLAG_GRAY) return;
893

  
889 894
    if (s->out_format == FMT_H263) {
890 895
        dxy = 0;
891 896
        if ((motion_x & 3) != 0)
......
949 954
    qpix_op[dxy](dest_y + linesize*8    , ptr + linesize*8    , linesize, linesize, motion_x&3, motion_y&3);
950 955
    qpix_op[dxy](dest_y + linesize*8 + 8, ptr + linesize*8 + 8, linesize, linesize, motion_x&3, motion_y&3);
951 956
    
957
    if(s->flags&CODEC_FLAG_GRAY) return;
958

  
952 959
    mx= (motion_x>>1) | (motion_x&1);
953 960
    my= (motion_y>>1) | (motion_y&1);
954 961

  
......
1037 1044
            dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize;
1038 1045
            pix_op[dxy](dest, ptr, s->linesize, 8);
1039 1046
        }
1047
    
1048
        if(s->flags&CODEC_FLAG_GRAY) break;
1040 1049
        /* In case of 8X8, we construct a single chroma motion vector
1041 1050
           with a special rounding */
1042 1051
        mx = 0;
......
1292 1301
                add_dequant_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize);
1293 1302
                add_dequant_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize);
1294 1303

  
1295
                add_dequant_dct(s, block[4], 4, dest_cb, s->linesize >> 1);
1296
                add_dequant_dct(s, block[5], 5, dest_cr, s->linesize >> 1);
1304
                if(!(s->flags&CODEC_FLAG_GRAY)){
1305
                    add_dequant_dct(s, block[4], 4, dest_cb, s->linesize >> 1);
1306
                    add_dequant_dct(s, block[5], 5, dest_cr, s->linesize >> 1);
1307
                }
1297 1308
            } else {
1298 1309
                add_dct(s, block[0], 0, dest_y, dct_linesize);
1299 1310
                add_dct(s, block[1], 1, dest_y + 8, dct_linesize);
1300 1311
                add_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize);
1301 1312
                add_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize);
1302 1313

  
1303
                add_dct(s, block[4], 4, dest_cb, s->linesize >> 1);
1304
                add_dct(s, block[5], 5, dest_cr, s->linesize >> 1);
1314
                if(!(s->flags&CODEC_FLAG_GRAY)){
1315
                    add_dct(s, block[4], 4, dest_cb, s->linesize >> 1);
1316
                    add_dct(s, block[5], 5, dest_cr, s->linesize >> 1);
1317
                }
1305 1318
            }
1306 1319
        } else {
1307 1320
            /* dct only in intra block */
......
1310 1323
            put_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize);
1311 1324
            put_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize);
1312 1325

  
1313
            put_dct(s, block[4], 4, dest_cb, s->linesize >> 1);
1314
            put_dct(s, block[5], 5, dest_cr, s->linesize >> 1);
1326
            if(!(s->flags&CODEC_FLAG_GRAY)){
1327
                put_dct(s, block[4], 4, dest_cb, s->linesize >> 1);
1328
                put_dct(s, block[5], 5, dest_cr, s->linesize >> 1);
1329
            }
1315 1330
        }
1316 1331
    }
1317 1332
 the_end:

Also available in: Unified diff