mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
Merge commit '75644335b9'
* commit '75644335b9':
lavc: Move start code finding to utils.c
Conflicts:
configure
libavcodec/mpegvideo.c
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
2cdedcbcea
3 changed files with 36 additions and 36 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "libavutil/opt.h"
|
||||
#include "mpegvideo.h"
|
||||
#include "thread.h"
|
||||
#include "frame_thread_encoder.h"
|
||||
#include "internal.h"
|
||||
|
|
@ -3098,3 +3099,36 @@ int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
|
|||
avctx->extradata_size = buf->len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const uint8_t *avpriv_mpv_find_start_code(const uint8_t *av_restrict p,
|
||||
const uint8_t *end,
|
||||
uint32_t *av_restrict state)
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(p <= end);
|
||||
if (p >= end)
|
||||
return end;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
uint32_t tmp = *state << 8;
|
||||
*state = tmp + *(p++);
|
||||
if (tmp == 0x100 || p == end)
|
||||
return p;
|
||||
}
|
||||
|
||||
while (p < end) {
|
||||
if (p[-1] > 1 ) p += 3;
|
||||
else if (p[-2] ) p += 2;
|
||||
else if (p[-3]|(p[-1]-1)) p++;
|
||||
else {
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
p = FFMIN(p, end) - 4;
|
||||
*state = AV_RB32(p);
|
||||
|
||||
return p + 4;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue