~ubuntu-branches/ubuntu/lucid/ffmpeg/lucid-security

« back to all changes in this revision

Viewing changes to libavcodec/rv34.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-03-13 09:18:28 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090313091828-n4ktby5eca487uhv
Tags: 3:0.svn20090303-1ubuntu1+unstripped1
merge from ubuntu.jaunty branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
787
787
    case RV34_MB_B_DIRECT:
788
788
        //surprisingly, it uses motion scheme from next reference frame
789
789
        next_bt = s->next_picture_ptr->mb_type[s->mb_x + s->mb_y * s->mb_stride];
790
 
        for(j = 0; j < 2; j++)
791
 
            for(i = 0; i < 2; i++)
792
 
                for(k = 0; k < 2; k++)
793
 
                    for(l = 0; l < 2; l++)
794
 
                        s->current_picture_ptr->motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][k]);
 
790
        if(IS_INTRA(next_bt))
 
791
            fill_rectangle(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], 2, 2, s->b8_stride, 0, 4);
 
792
        else
 
793
            for(j = 0; j < 2; j++)
 
794
                for(i = 0; i < 2; i++)
 
795
                    for(k = 0; k < 2; k++)
 
796
                        for(l = 0; l < 2; l++)
 
797
                            s->current_picture_ptr->motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][k]);
795
798
        if(IS_16X16(next_bt)) //we can use whole macroblock MC
796
799
            rv34_mc_2mv(r, block_type);
797
800
        else
1396
1399
    }else
1397
1400
        slice_count = avctx->slice_count;
1398
1401
 
 
1402
    //parse first slice header to check whether this frame can be decoded
 
1403
    if(get_slice_offset(avctx, slices_hdr, 0) > buf_size){
 
1404
        av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
 
1405
        return -1;
 
1406
    }
 
1407
    init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), buf_size-get_slice_offset(avctx, slices_hdr, 0));
 
1408
    if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){
 
1409
        av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
 
1410
        return -1;
 
1411
    }
 
1412
    if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
 
1413
        return -1;
 
1414
    /* skip b frames if we are in a hurry */
 
1415
    if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
 
1416
    if(   (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE)
 
1417
       || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=FF_I_TYPE)
 
1418
       ||  avctx->skip_frame >= AVDISCARD_ALL)
 
1419
        return buf_size;
 
1420
    /* skip everything if we are in a hurry>=5 */
 
1421
    if(avctx->hurry_up>=5)
 
1422
        return buf_size;
 
1423
 
1399
1424
    for(i=0; i<slice_count; i++){
1400
1425
        int offset= get_slice_offset(avctx, slices_hdr, i);
1401
1426
        int size;
1420
1445
            }else
1421
1446
                r->si.end = si.start;
1422
1447
        }
1423
 
        if(!i && si.type == FF_B_TYPE && (!s->last_picture_ptr || !s->last_picture_ptr->data[0]))
1424
 
            return -1;
1425
1448
        last = rv34_decode_slice(r, r->si.end, buf + offset, size);
1426
1449
        s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start;
1427
1450
        if(last)