Mercurial > libavcodec.hg
diff parser.c @ 3086:befacb1cb573 libavcodec
faster find_startcode()
author | michael |
---|---|
date | Sat, 04 Feb 2006 20:32:02 +0000 |
parents | d85afa120256 |
children | eb3d3988aff2 |
line wrap: on
line diff
--- a/parser.c Sat Feb 04 10:04:13 2006 +0000 +++ b/parser.c Sat Feb 04 20:32:02 2006 +0000 @@ -272,28 +272,6 @@ return 0; } -static int find_start_code(const uint8_t **pbuf_ptr, const uint8_t *buf_end) -{ - const uint8_t *buf_ptr; - unsigned int state=0xFFFFFFFF, v; - int val; - - buf_ptr = *pbuf_ptr; - while (buf_ptr < buf_end) { - v = *buf_ptr++; - if (state == 0x000001) { - state = ((state << 8) | v) & 0xffffff; - val = state; - goto found; - } - state = ((state << 8) | v) & 0xffffff; - } - val = -1; - found: - *pbuf_ptr = buf_ptr; - return val; -} - /* XXX: merge with libavcodec ? */ #define MPEG1_FRAME_RATE_BASE 1001 @@ -335,7 +313,8 @@ s->repeat_pict = 0; buf_end = buf + buf_size; while (buf < buf_end) { - start_code = find_start_code(&buf, buf_end); + start_code= -1; + buf= ff_find_start_code(buf, buf_end, &start_code); bytes_left = buf_end - buf; switch(start_code) { case PICTURE_START_CODE: