[FFmpeg-devel] [PATCH] Optimize QTRLE encoding

Michael Niedermayer michaelni at gmx.at
Sun Feb 17 16:30:12 CET 2013


On Fri, Feb 15, 2013 at 04:02:09PM -0500, Malcolm Bechard wrote:
> On Fri, Feb 15, 2013 at 3:12 PM, Alexis Ballier <alexis.ballier at gmail.com>wrote:
> 
> > looks good to me, thanks
> >
> > just one nitpick:
> >
> > @@ -164,6 +218,7 @@ static void qtrle_encode_line(QtrleEncContext *s,
> > const AVFrame *p, int line, ui
> >
> >          total_repeat_cost = s->length_table[i + repeatcount] + 1 +
> > s->pixel_size;
> >
> > +
> >          /* skip code is free for the first pixel, it costs one byte
> > for repeat and bulk copy
> >           * so let's make it aware */
> >          if (i == 0) {
> >
> >
> > this hunk appears in your diff, I think some people would prefer if it
> > were removed ^^
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> 
> Ok, here's an update with that removed.
> 
> Malcolm

>  qtrleenc.c |   87 ++++++++++++++++++++++++++++++++++++++++++++++---------------
>  1 file changed, 67 insertions(+), 20 deletions(-)
> c88603b1c5e1ec4a7ec66add209069e03c66b662  0001-Improve-QTRLE-encoding-performance-no-change-to-outp.patch
> From 0af76909ff8bc12264451ad2df74f02df65ab5ce Mon Sep 17 00:00:00 2001
> From: Malcolm Bechard <malcolm.bechard at gmail.com>
> Date: Fri, 15 Feb 2013 10:53:27 -0500
> Subject: [PATCH] Improve QTRLE encoding performance, no change to output file
>  size/content.
> 
> Avoid searching for the lowest bulk cost for each pixel that isn't a repeat/skip. Instead store the lowest cost as we go along each pixel, and use it as needed.

Size tests: with 24, 15 and 8 bit:

-rw-r----- 1 michael michael 148395633 Feb 17 16:23 ref16.mov
-rw-r----- 1 michael michael 148402969 Feb 17 16:25 tes16.mov

-rw-r----- 1 michael michael  80398700 Feb 17 16:24 ref8.mov
-rw-r----- 1 michael michael  80400305 Feb 17 16:25 tes8.mov

-rw-r----- 1 michael michael 212635829 Feb 17 16:22 ref.mov
-rw-r----- 1 michael michael 212644628 Feb 17 16:25 tes.mov

thus while faster this is not optimal anymore
the difference is tiny though

Can optimality AND speed be combined ?
or should 2 variants be written
I also suspect if optimality is given up more speed can be achived

15second of matrixbench used for testing

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130217/d5d10660/attachment.asc>


More information about the ffmpeg-devel mailing list