[FFmpeg-devel] [PATCH] lavc/mjpegdec: hint next marker position in ff_mjpeg_find_marker

Michael Niedermayer michaelni at gmx.at
Sat Jan 28 03:25:34 EET 2017


On Fri, Jan 27, 2017 at 09:47:18AM +0100, Matthieu Bouron wrote:
> On Fri, Jan 27, 2017 at 02:30:40AM +0100, Michael Niedermayer wrote:
> > On Thu, Jan 26, 2017 at 05:47:51PM +0100, Matthieu Bouron wrote:
> > > Speeds up next marker search when a SOS marker is found.
> > > 
> > > ff_mjpeg_find_marker goes from 54% to 30% under perf record ffmpeg -i
> > > sample_2992x4000.jpg
> > > ---
> > >  libavcodec/mjpegdec.c | 31 +++++++++++++++++++++++++------
> > >  libavcodec/mjpegdec.h |  2 +-
> > >  libavcodec/mxpegdec.c |  5 +++--
> > >  3 files changed, 29 insertions(+), 9 deletions(-)
> > 
> > this breaks decoding multiple jpeg files
> > for example tickets//856/nint.jpg
> 
> New patch attached fixing the issue.
> 
> [...]

>  mjpegdec.c |   31 +++++++++++++++++++++++++------
>  mjpegdec.h |    2 +-
>  mxpegdec.c |    5 +++--
>  3 files changed, 29 insertions(+), 9 deletions(-)
> 6ba49d73c189b197bdc1a983e26ccd49713c617c  0001-lavc-mjpegdec-hint-next-marker-position-in-ff_mjpeg_.patch
> From ebef63ebdc75872d52529d5b74b6d05254d4c0fd Mon Sep 17 00:00:00 2001
> From: Matthieu Bouron <matthieu.bouron at gmail.com>
> Date: Thu, 26 Jan 2017 15:17:36 +0100
> Subject: [PATCH] lavc/mjpegdec: hint next marker position in
>  ff_mjpeg_find_marker
> 
> Speeds up next marker search when a SOS marker is found.
> 
> ff_mjpeg_find_marker goes from 54% to 30% under perf record ffmpeg -i
> sample_2992x4000.jpg

the patch seems to work but
why is the "buf_ptr += (get_bits_count(&s->gb) + 7) / 8;" not
already skiping all that what the buf_hint does ?
is the difference the unescaping ?
maybe the buf_hint stuff can be simplified by adjusting buf_ptr instead
?

or maybe i misunderstand

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170128/7707a779/attachment.sig>


More information about the ffmpeg-devel mailing list