diff options
author | Gwenole Beauchesne <gbeauchesne@splitted-desktop.com> | 2009-02-24 16:12:47 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-02-24 16:12:47 +0000 |
commit | ee3e36315e25d74da1079b4bafe3fd36fc9f3406 (patch) | |
tree | 05baf04219f4e8292536c5ba434ede4da9992c9c /libavcodec/h263.c | |
parent | cd3356ff73bb9ed2ee0190a1d240adcb6d5e9864 (diff) | |
download | ffmpeg-ee3e36315e25d74da1079b4bafe3fd36fc9f3406.tar.gz |
Add ff_h263_find_resync_marker() to find the bit position of the next resync_marker, if any.
patch by Gwenole Beauchesne gbeauchesne splitted-desktopcom
based on suggested implementation by me
Originally committed as revision 17560 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h263.c')
-rw-r--r-- | libavcodec/h263.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c index b02b0ad2f4..2a25cdae67 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -3293,6 +3293,27 @@ void ff_mpeg4_clean_buffers(MpegEncContext *s) } /** + * finds the next resync_marker + * @param p pointer to buffer to scan + * @param end pointer to the end of the buffer + * @return pointer to the next resync_marker, or \p end if none was found + */ +const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8_t * restrict end) +{ + assert(p < end); + + end-=2; + p++; + for(;p<end; p+=2){ + if(!*p){ + if (!p[-1] && p[1]) return p - 1; + else if(!p[ 1] && p[2]) return p; + } + } + return end+2; +} + +/** * decodes the group of blocks / video packet header. * @return bit position of the resync_marker, or <0 if none was found */ |