Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -402,7 +402,7 @@ static inline int get_dmv(Mpeg12SliceContext *const s) · 401 unmodified lines | |||
| 402 | #define MT_16X8 2 | 402 | #define MT_16X8 2 |
| 403 | #define MT_DMV 3 | 403 | #define MT_DMV 3 |
| 404 | 404 | ||
| 405 | static int mpeg_decode_mb(Mpeg12SliceContext *const s) | 405 | static int mpeg_decode_mb(Mpeg12SliceContext *const s, int *mb_skip_run) |
| 406 | { | 406 | { |
| 407 | int i, j, k, cbp, val, mb_type, motion_type; | 407 | int i, j, k, cbp, val, mb_type, motion_type; |
| 408 | const int mb_block_count = 4 + (1 << s->c.chroma_format); | 408 | const int mb_block_count = 4 + (1 << s->c.chroma_format); |
| @@ -412,7 +412,7 @@ static int mpeg_decode_mb(Mpeg12SliceContext *const s) · 3 unmodified lines | |||
| 412 | 412 | ||
| 413 | av_assert2(s->c.mb_skipped == 0); | 413 | av_assert2(s->c.mb_skipped == 0); |
| 414 | 414 | ||
| 415 | if (s->c.mb_skip_run-- != 0) { | 415 | if ((*mb_skip_run)-- != 0) { |
| 416 | if (s->c.pict_type == AV_PICTURE_TYPE_P) { | 416 | if (s->c.pict_type == AV_PICTURE_TYPE_P) { |
| 417 | s->c.mb_skipped = 1; | 417 | s->c.mb_skipped = 1; |
| 418 | s->c.cur_pic.mb_type[s->c.mb_x + s->c.mb_y * s->c.mb_stride] = | 418 | s->c.cur_pic.mb_type[s->c.mb_x + s->c.mb_y * s->c.mb_stride] = |
| @@ -1432,7 +1432,6 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y, · 1013 unmodified lines | |||
| 1432 | 1432 | ||
| 1433 | s->c.resync_mb_x = s->c.mb_x; | 1433 | s->c.resync_mb_x = s->c.mb_x; |
| 1434 | s->c.resync_mb_y = s->c.mb_y = mb_y; | 1434 | s->c.resync_mb_y = s->c.mb_y = mb_y; |
| 1435 | s->c.mb_skip_run = 0; | ||
| 1436 | ff_init_block_index(&s->c); | 1435 | ff_init_block_index(&s->c); |
| 1437 | 1436 | ||
| 1438 | if (s->c.mb_y == 0 && s->c.mb_x == 0 && (s->c.first_field || s->c.picture_structure == PICT_FRAME)) { | 1437 | if (s->c.mb_y == 0 && s->c.mb_x == 0 && (s->c.first_field || s->c.picture_structure == PICT_FRAME)) { |
| @@ -1456,8 +1455,8 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y, · 17 unmodified lines | |||
| 1456 | } | 1455 | } |
| 1457 | } | 1456 | } |
| 1458 | 1457 | ||
| 1459 | for (;;) { | 1458 | for (int mb_skip_run = 0;;) { |
| 1460 | ret = mpeg_decode_mb(s); | 1459 | ret = mpeg_decode_mb(s, &mb_skip_run); |
| 1461 | if (ret < 0) | 1460 | if (ret < 0) |
| 1462 | return ret; | 1461 | return ret; |
| 1463 | 1462 | ||
| @@ -1552,7 +1551,7 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y, · 88 unmodified lines | |||
| 1552 | !s->c.progressive_sequence && | 1551 | !s->c.progressive_sequence && |
| 1553 | left <= 25 && | 1552 | left <= 25 && |
| 1554 | left >= 0 && | 1553 | left >= 0 && |
| 1555 | s->c.mb_skip_run == -1 && | 1554 | mb_skip_run == -1 && |
| 1556 | (!left || show_bits(&s->gb, left) == 0)) | 1555 | (!left || show_bits(&s->gb, left) == 0)) |
| 1557 | goto eos; | 1556 | goto eos; |
| 1558 | 1557 | ||
| @@ -1560,9 +1559,9 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y, · 1 unmodified line | |||
| 1560 | } | 1559 | } |
| 1561 | 1560 | ||
| 1562 | /* skip mb handling */ | 1561 | /* skip mb handling */ |
| 1563 | if (s->c.mb_skip_run == -1) { | 1562 | if (mb_skip_run == -1) { |
| 1564 | /* read increment again */ | 1563 | /* read increment again */ |
| 1565 | s->c.mb_skip_run = 0; | 1564 | mb_skip_run = 0; |
| 1566 | for (;;) { | 1565 | for (;;) { |
| 1567 | int code = get_vlc2(&s->gb, ff_mbincr_vlc, | 1566 | int code = get_vlc2(&s->gb, ff_mbincr_vlc, |
| 1568 | MBINCR_VLC_BITS, 2); | 1567 | MBINCR_VLC_BITS, 2); |
| @@ -1572,9 +1571,9 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y, · 3 unmodified lines | |||
| 1572 | } | 1571 | } |
| 1573 | if (code >= 33) { | 1572 | if (code >= 33) { |
| 1574 | if (code == 33) { | 1573 | if (code == 33) { |
| 1575 | s->c.mb_skip_run += 33; | 1574 | mb_skip_run += 33; |
| 1576 | } else if (code == 35) { | 1575 | } else if (code == 35) { |
| 1577 | if (s->c.mb_skip_run != 0 || show_bits(&s->gb, 15) != 0) { | 1576 | if (mb_skip_run != 0 || show_bits(&s->gb, 15) != 0) { |
| 1578 | av_log(s->c.avctx, AV_LOG_ERROR, "slice mismatch\n"); | 1577 | av_log(s->c.avctx, AV_LOG_ERROR, "slice mismatch\n"); |
| 1579 | return AVERROR_INVALIDDATA; | 1578 | return AVERROR_INVALIDDATA; |
| 1580 | } | 1579 | } |
| @@ -1582,11 +1581,11 @@ static int mpeg_decode_slice(Mpeg12SliceContext *const s, int mb_y, · 1 unmodified line | |||
| 1582 | } | 1581 | } |
| 1583 | /* otherwise, stuffing, nothing to do */ | 1582 | /* otherwise, stuffing, nothing to do */ |
| 1584 | } else { | 1583 | } else { |
| 1585 | s->c.mb_skip_run += code; | 1584 | mb_skip_run += code; |
| 1586 | break; | 1585 | break; |
| 1587 | } | 1586 | } |
| 1588 | } | 1587 | } |
| 1589 | if (s->c.mb_skip_run) { | 1588 | if (mb_skip_run) { |
| 1590 | int i; | 1589 | int i; |
| 1591 | if (s->c.pict_type == AV_PICTURE_TYPE_I) { | 1590 | if (s->c.pict_type == AV_PICTURE_TYPE_I) { |
| 1592 | av_log(s->c.avctx, AV_LOG_ERROR, | 1591 | av_log(s->c.avctx, AV_LOG_ERROR, |