Mercurial > libavcodec.hg
comparison mpeg12.c @ 10177:981143737752 libavcodec
Move down HWAccel code path so that to fill in s->mb_x first.
author | gb |
---|---|
date | Wed, 16 Sep 2009 07:49:08 +0000 |
parents | a37ffec2074c |
children | 59ec306245a4 |
comparison
equal
deleted
inserted
replaced
10176:278d78d1bf19 | 10177:981143737752 |
---|---|
1712 skip_bits(&s->gb, 8); | 1712 skip_bits(&s->gb, 8); |
1713 } | 1713 } |
1714 | 1714 |
1715 s->mb_x=0; | 1715 s->mb_x=0; |
1716 | 1716 |
1717 for(;;) { | |
1718 int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); | |
1719 if (code < 0){ | |
1720 av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n"); | |
1721 return -1; | |
1722 } | |
1723 if (code >= 33) { | |
1724 if (code == 33) { | |
1725 s->mb_x += 33; | |
1726 } | |
1727 /* otherwise, stuffing, nothing to do */ | |
1728 } else { | |
1729 s->mb_x += code; | |
1730 break; | |
1731 } | |
1732 } | |
1733 if(s->mb_x >= (unsigned)s->mb_width){ | |
1734 av_log(s->avctx, AV_LOG_ERROR, "initial skip overflow\n"); | |
1735 return -1; | |
1736 } | |
1737 | |
1717 if (avctx->hwaccel) { | 1738 if (avctx->hwaccel) { |
1718 const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */ | 1739 const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */ |
1719 int start_code = -1; | 1740 int start_code = -1; |
1720 buf_end = ff_find_start_code(buf_start + 2, *buf + buf_size, &start_code); | 1741 buf_end = ff_find_start_code(buf_start + 2, *buf + buf_size, &start_code); |
1721 if (buf_end < *buf + buf_size) | 1742 if (buf_end < *buf + buf_size) |
1723 s->mb_y = mb_y; | 1744 s->mb_y = mb_y; |
1724 if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_end - buf_start) < 0) | 1745 if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_end - buf_start) < 0) |
1725 return DECODE_SLICE_ERROR; | 1746 return DECODE_SLICE_ERROR; |
1726 *buf = buf_end; | 1747 *buf = buf_end; |
1727 return DECODE_SLICE_OK; | 1748 return DECODE_SLICE_OK; |
1728 } | |
1729 | |
1730 for(;;) { | |
1731 int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); | |
1732 if (code < 0){ | |
1733 av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n"); | |
1734 return -1; | |
1735 } | |
1736 if (code >= 33) { | |
1737 if (code == 33) { | |
1738 s->mb_x += 33; | |
1739 } | |
1740 /* otherwise, stuffing, nothing to do */ | |
1741 } else { | |
1742 s->mb_x += code; | |
1743 break; | |
1744 } | |
1745 } | |
1746 if(s->mb_x >= (unsigned)s->mb_width){ | |
1747 av_log(s->avctx, AV_LOG_ERROR, "initial skip overflow\n"); | |
1748 return -1; | |
1749 } | 1749 } |
1750 | 1750 |
1751 s->resync_mb_x= s->mb_x; | 1751 s->resync_mb_x= s->mb_x; |
1752 s->resync_mb_y= s->mb_y= mb_y; | 1752 s->resync_mb_y= s->mb_y= mb_y; |
1753 s->mb_skip_run= 0; | 1753 s->mb_skip_run= 0; |