This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 7dda7f3b99 avcodec/mjpegdec: speed up find_marker()
7dda7f3b99 is described below
commit 7dda7f3b99a065c5562fb998b655b77f467c5488
Author: Ramiro Polla <[email protected]>
AuthorDate: Tue Sep 23 17:11:40 2025 +0200
Commit: Ramiro Polla <[email protected]>
CommitDate: Mon Dec 29 21:44:07 2025 +0000
avcodec/mjpegdec: speed up find_marker()
Minimize number of reads and simplify conditionals.
Also use memchr(), as suggested by Andreas Rheinhardt
<[email protected]>
---
libavcodec/mjpegdec.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 9b7afc96e8..76c81fb152 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -2194,17 +2194,19 @@ static int mjpeg_decode_com(MJpegDecodeContext *s)
static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
{
const uint8_t *buf_ptr;
- unsigned int v, v2;
int val;
int skipped = 0;
buf_ptr = *pbuf_ptr;
- while (buf_end - buf_ptr > 1) {
- v = *buf_ptr++;
- v2 = *buf_ptr;
- if ((v == 0xff) && (v2 >= SOF0) && (v2 <= COM) && buf_ptr < buf_end) {
+ while ((buf_ptr = memchr(buf_ptr, 0xff, buf_end - buf_ptr))) {
+ buf_ptr++;
+ while (buf_ptr < buf_end) {
val = *buf_ptr++;
- goto found;
+ if (val != 0xff) {
+ if ((val >= SOF0) && (val <= COM))
+ goto found;
+ break;
+ }
}
skipped++;
}
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]