[FFmpeg-devel] [PATCH]lavf/rawdec: Simplify mlp/thd probe function
Carl Eugen Hoyos
cehoyos at ag.or.at
Fri Oct 2 03:29:05 CEST 2015
Hi!
Attached patch intends to slightly simplify the probe function.
Please review, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index ef84d37..7a72b5a 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -209,19 +209,18 @@ FF_DEF_RAWVIDEO_DEMUXER2(mjpeg, "raw MJPEG video", mjpeg_probe, "mjpg,mjpeg,mpo"
#if CONFIG_MLP_DEMUXER || CONFIG_TRUEHD_DEMUXER
static int av_always_inline mlp_thd_probe(AVProbeData *p, uint32_t sync)
{
- const uint8_t *buf, *last_buf = p->buf, *end = p->buf + p->buf_size;
- int frames = 0, valid = 0, size = 0;
+ const uint8_t *buf, *next_buf = p->buf, *end = p->buf + p->buf_size;
+ int frames = 0, valid = 0;
for (buf = p->buf; buf + 8 <= end; buf++) {
if (AV_RB32(buf + 4) == sync) {
frames++;
- if (last_buf + size == buf) {
+ if (buf == next_buf) {
valid++;
}
- last_buf = buf;
- size = (AV_RB16(buf) & 0xfff) * 2;
- } else if (buf - last_buf == size) {
- size += (AV_RB16(buf) & 0xfff) * 2;
+ next_buf = buf + (AV_RB16(buf) & 0xfff) * 2;
+ } else if (buf == next_buf) {
+ next_buf += (AV_RB16(buf) & 0xfff) * 2;
}
}
if (valid >= 100)
More information about the ffmpeg-devel
mailing list