avcodec/vc1: simplify find_next_marker()

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
zhaoxiu.zeng 2015-02-13 00:02:04 +08:00 committed by Michael Niedermayer
parent 3e2714992b
commit b39ac9d210
1 changed files with 4 additions and 6 deletions

View File

@ -26,6 +26,7 @@
#include <stdint.h> #include <stdint.h>
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "internal.h"
/** Markers used in VC-1 AP frame data */ /** Markers used in VC-1 AP frame data */
//@{ //@{
@ -57,12 +58,9 @@ enum Profile {
*/ */
static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, const uint8_t *end) static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, const uint8_t *end)
{ {
uint32_t mrk = 0xFFFFFFFF; if (end - src >= 4) {
uint32_t mrk = 0xFFFFFFFF;
if (end-src < 4) src = avpriv_find_start_code(src, end, &mrk);
return end;
while (src < end) {
mrk = (mrk << 8) | *src++;
if (IS_MARKER(mrk)) if (IS_MARKER(mrk))
return src - 4; return src - 4;
} }