all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Evgeny Zajcev <lg.zevlg@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: excessively slow image animation
Date: Thu, 14 Feb 2019 03:30:33 +0300	[thread overview]
Message-ID: <CAO=W_Zotc+Nh8yw4b=sK_kaT+KDCzGL3t-z=zc+QrD7J59Qn6A@mail.gmail.com> (raw)
In-Reply-To: <m35ztnhb7s.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 1850 bytes --]

ср, 13 февр. 2019 г. в 20:03, Lars Ingebrigtsen <larsi@gnus.org>:

> Evgeny Zajcev <lg.zevlg@gmail.com> writes:
>
> > I've got multi frame image at http://lgarc.narod.ru/giphy.mp4
> >
> > And run next code on it:
> >
> >   (let ((ctime (float-time)))
> >     (setq img (create-image "~/tmp/giphy.mp4" 'imagemagick nil :scale
> 1.0))
> >     (insert-image img)
> >     (cl-dotimes (index 65)
> >       (image-show-frame img index 'nocheck)
> >       (sit-for 0.0))
> >     (- (float-time) ctime))
> >   ==> 18.788017988204956
> >
> > 18 seconds to show every frame
>
> Wow, that's slow...
>
> [...]
>
> > Now I use method with bmp files.  I would like to use built in `:index'
> image
> > property to animate images, however current animation speed is totally
> not
> > acceptable.  Can this be fixed, or am I doing something wrong?
>
> If I remember correctly, I was the one that added the :index support for
> imagemagick images in Emacs.  It's quite likely that I was using
> non-optimal ways to do the animation and that imagemagick has better and
> faster ways of doing the computation.
>
> Have a look at imagemagick_compute_animated_image in image.c and rewrite
> to be faster.  :-)
>

The problem is that IM always decodes multi frame images to the last image
uppon MagickReadImage.  In this example it takes ~0.2 seconds (as time on
convert command shows), so just loading time without pixel operations, etc
would take 0.2*65=13 seconds

Animation code always do MagickReadImage uppon loading image, even if there
is cached wand.

Probable solution would be to use some other signature for the cache
(md5sum on blob, or md5sum on file, or maybe just the filename!)

In this case we can just get the wand from the cache, without calling
MagickReadImage on `:index' change

-- 
lg

[-- Attachment #2: Type: text/html, Size: 2626 bytes --]

  parent reply	other threads:[~2019-02-14  0:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 14:39 excessively slow image animation Evgeny Zajcev
2019-02-13 17:03 ` Lars Ingebrigtsen
2019-02-13 23:14   ` Alan Third
2019-02-13 23:29     ` Evgeny Zajcev
2019-02-14 18:21       ` Alan Third
2019-02-14 18:41         ` Evgeny Zajcev
2019-02-14  0:30   ` Evgeny Zajcev [this message]
2019-02-14  4:30     ` Stefan Monnier
2019-02-26 21:18 ` Daniel Pittman
2019-02-26 21:50   ` Evgeny Zajcev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAO=W_Zotc+Nh8yw4b=sK_kaT+KDCzGL3t-z=zc+QrD7J59Qn6A@mail.gmail.com' \
    --to=lg.zevlg@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.