comparison rv34.c @ 8754:f471abd09fef libavcodec

Move RV3/4 frame type check up so 1-slice unanchored B-frames are checked, too.
author kostya
date Sat, 07 Feb 2009 10:46:51 +0000
parents 42e258f2b931
children 58706d84c938
comparison
equal deleted inserted replaced
8753:64acd0cc269d 8754:f471abd09fef
1394 slices_hdr = buf + 4; 1394 slices_hdr = buf + 4;
1395 buf += 8 * slice_count; 1395 buf += 8 * slice_count;
1396 }else 1396 }else
1397 slice_count = avctx->slice_count; 1397 slice_count = avctx->slice_count;
1398 1398
1399 //parse first slice header to check whether this frame can be decoded
1400 if(get_slice_offset(avctx, slices_hdr, 0) > buf_size){
1401 av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
1402 return -1;
1403 }
1404 init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), buf_size-get_slice_offset(avctx, slices_hdr, 0));
1405 if(r->parse_slice_header(r, &r->s.gb, &si) < 0){
1406 av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
1407 return -1;
1408 }
1409 if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
1410 return -1;
1411
1399 for(i=0; i<slice_count; i++){ 1412 for(i=0; i<slice_count; i++){
1400 int offset= get_slice_offset(avctx, slices_hdr, i); 1413 int offset= get_slice_offset(avctx, slices_hdr, i);
1401 int size; 1414 int size;
1402 if(i+1 == slice_count) 1415 if(i+1 == slice_count)
1403 size= buf_size - offset; 1416 size= buf_size - offset;
1418 else 1431 else
1419 size = buf_size - offset; 1432 size = buf_size - offset;
1420 }else 1433 }else
1421 r->si.end = si.start; 1434 r->si.end = si.start;
1422 } 1435 }
1423 if(!i && si.type == FF_B_TYPE && (!s->last_picture_ptr || !s->last_picture_ptr->data[0]))
1424 return -1;
1425 last = rv34_decode_slice(r, r->si.end, buf + offset, size); 1436 last = rv34_decode_slice(r, r->si.end, buf + offset, size);
1426 s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; 1437 s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start;
1427 if(last) 1438 if(last)
1428 break; 1439 break;
1429 } 1440 }