Mercurial > octave
view scripts/image/movie.m @ 29949:f254c302bb9c
remove JIT compiler from Octave sources
As stated in the NEWS file entry added with this changeset, no one
has ever seriously taken on further development of the JIT compiler in
Octave since it was first added as part of a Google Summer of Code
project in 2012 and it still does nothing significant. It is out of
date with the default interpreter that walks the parse tree. Even
though we have fixed the configure script to disable it by default,
people still ask questions about how to build it, but it doesn’t seem
that they are doing that to work on it but because they think it will
make Octave code run faster (it never did, except for some extremely
simple bits of code as examples for demonstration purposes only).
* NEWS: Note change.
* configure.ac, acinclude.m4: Eliminate checks and macros related to
the JIT compiler and LLVM.
* basics.txi, install.txi, octave.texi, vectorize.txi: Remove mention
of JIT compiler and LLVM.
* jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.cc,
jit-util.h, pt-jit.cc, pt-jit.h: Delete.
* libinterp/parse-tree/module.mk: Update.
* Array-jit.cc: Delete.
* libinterp/template-inst/module.mk: Update.
* test/jit.tst: Delete.
* test/module.mk: Update.
* interpreter.cc (interpreter::interpreter): Don't check options for
debug_jit or jit_compiler.
* toplev.cc (F__octave_config_info__): Remove JIT compiler and LLVM
info from struct.
* ov-base.h (octave_base_value::grab, octave_base_value::release):
Delete.
* ov-builtin.h, ov-builtin.cc (octave_builtin::to_jit,
octave_builtin::stash_jit): Delete.
(octave_builtin::m_jtype): Delete data member and all uses.
* ov-usr-fcn.h, ov-usr-fcn.cc (octave_user_function::m_jit_info):
Delete data member and all uses.
(octave_user_function::get_info, octave_user_function::stash_info): Delete.
* options.h (DEBUG_JIT_OPTION, JIT_COMPILER_OPTION): Delete macro
definitions and all uses.
* octave.h, octave.cc (cmdline_options::cmdline_options): Don't handle
DEBUG_JIT_OPTION, JIT_COMPILER_OPTION): Delete.
(cmdline_options::debug_jit, cmdline_options::jit_compiler): Delete
functions and all uses.
(cmdline_options::m_debug_jit, cmdline_options::m_jit_compiler): Delete
data members and all uses.
(octave_getopt_options long_opts): Remove "debug-jit" and
"jit-compiler" from the list.
* pt-eval.cc (tree_evaluator::visit_simple_for_command,
tree_evaluator::visit_complex_for_command,
tree_evaluator::visit_while_command,
tree_evaluator::execute_user_function): Eliminate JIT compiler code.
* pt-loop.h, pt-loop.cc (tree_while_command::get_info,
tree_while_command::stash_info, tree_simple_for_command::get_info,
tree_simple_for_command::stash_info): Delete functions and all uses.
(tree_while_command::m_compiled, tree_simple_for_command::m_compiled):
Delete member variable and all uses.
* usage.h (usage_string, octave_print_verbose_usage_and_exit): Remove
[--debug-jit] and [--jit-compiler] from the message.
* Array.h (Array<T>::Array): Remove constructor that was only intended
to be used by the JIT compiler.
(Array<T>::jit_ref_count, Array<T>::jit_slice_data,
Array<T>::jit_dimensions, Array<T>::jit_array_rep): Delete.
* Marray.h (MArray<T>::MArray): Remove constructor that was only
intended to be used by the JIT compiler.
* NDArray.h (NDArray::NDarray): Remove constructor that was only
intended to be used by the JIT compiler.
* dim-vector.h (dim_vector::to_jit): Delete.
(dim_vector::dim_vector): Remove constructor that was only intended to
be used by the JIT compiler.
* codeql-analysis.yaml, make.yaml: Don't require llvm-dev.
* subst-config-vals.in.sh, subst-cross-config-vals.in.sh: Don't
substitute OCTAVE_CONF_LLVM_CPPFLAGS, OCTAVE_CONF_LLVM_LDFLAGS, or
OCTAVE_CONF_LLVM_LIBS.
* Doxyfile.in: Don't define HAVE_LLVM.
* aspell-octave.en.pws: Eliminate jit, JIT, and LLVM from the list of
spelling exceptions.
* build-env.h, build-env.in.cc (LLVM_CPPFLAGS, LLVM_LDFLAGS,
LLVM_LIBS): Delete variables and all uses.
* libinterp/corefcn/module.mk (%canon_reldir%_libcorefcn_la_CPPFLAGS):
Remove $(LLVM_CPPFLAGS) from the list.
* libinterp/parse-tree/module.mk (%canon_reldir%_libparse_tree_la_CPPFLAGS):
Remove $(LLVM_CPPFLAGS) from the list.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 10 Aug 2021 16:42:29 -0400 |
parents | 7854d5752dd2 |
children | 796f54d4ddbf |
line wrap: on
line source
######################################################################## ## ## Copyright (C) 2017-2021 The Octave Project Developers ## ## See the file COPYRIGHT.md in the top-level directory of this ## distribution or <https://octave.org/copyright/>. ## ## This file is part of Octave. ## ## Octave is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, see ## <https://www.gnu.org/licenses/>. ## ######################################################################## ## -*- texinfo -*- ## @deftypefn {} {} movie (@var{mov}) ## @deftypefnx {} {} movie (@var{mov}, @var{n}) ## @deftypefnx {} {} movie (@var{mov}, @var{n}, @var{fps}) ## @deftypefnx {} {} movie (@var{h}, @dots{}) ## Play a movie defined by an array of frame structures. ## ## The movie @var{mov} must be a struct array of frames with fields ## @qcode{"cdata"} and @qcode{"colormap"}, as returned by the @code{getframe} ## function. By default all images are displayed once, at 12 fps, in the ## current axes. ## ## The optional argument @var{n} is a scalar or vector of integers that ## controls the number of times the movie is displayed and which particular ## frames are shown: ## ## @table @asis ## @item First element: ## ## @table @asis ## @item @var{n}(1) > 0 ## Play the movie @var{n}(1) times. ## ## @item @var{n}(1) < 0 ## Play the movie @code{abs (@var{n}(1)} times alternatively in forward and ## backward order. ## @end table ## ## @item Other elements (if any): ## Indices of the frames in @var{mov} that will be displayed. ## @end table ## ## If the first argument is a handle to a figure or axes @var{h}, the movie is ## played in that figure or axes instead of the current axes. ## ## @seealso{getframe, im2frame, frame2im} ## @end deftypefn function movie (varargin) if (nargin == 0 || nargin > 4) print_usage (); endif ## Extract possible handle argument hax = []; if (ishghandle (varargin{1})) typ = get (varargin{1}, "type"); if (strcmp (typ, "axes")) hax = varargin{1}; elseif (strcmp (typ, "figure")) hax = get (varargin{1}, "currentaxes"); if (isempty (hax)) hax = axes ("parent", varargin{1}); endif else error ("movie: H must be a handle to an axes or figure"); endif varargin(1) = []; nargin = nargin - 1; if (nargin == 0) print_usage (); endif endif ## Extract other arguments n = 1; fps = 12; idx = []; mov = varargin{1}; if (! isfield (mov, "cdata") || ! isfield (mov, "colormap")) error ("movie: MOV must be a frame struct array"); elseif (numel (mov) < 2) error ("movie: MOV must contain at least two frames"); endif if (nargin > 1) n = varargin{2}; if (! isindex (abs (n(1)))) error ("movie: N must be a non-zero integer"); endif if (! isscalar (n)) idx = n(2:end)(:)'; n = n(1); if (! isindex (idx, numel (mov))) error (["movie: All elements N(2:end) must be valid indices ", ... "into the MOV struct array"]); endif endif if (nargin > 2) fps = varargin{3}; if (! (isnumeric (fps) && isscalar (fps) && fps > 0)) error ("movie: FPS must be a numeric scalar > 0"); endif endif endif if (isempty (hax)) hax = gca (); endif ## Build the list of frames to be displayed if (isempty (idx)) idx = (1:numel (mov)); endif if (n > 0) idx = repmat (idx, 1, n); else n = -n; tmp = repmat ([idx fliplr(idx)], 1, fix (n/2)); if (fix (n/2) != n/2) idx = [tmp, idx]; else idx = tmp; endif endif ## Initialize graphics objects if (isempty (mov(1).cdata)) error ("movie: empty image data at frame 1"); endif him = findobj (hax, "-depth", 1, "tag", "__movie_frame__"); if (isempty (him)) him = image ("parent", hax, "cdata", mov(1).cdata, "tag", "__movie_frame__"); else set (him, "cdata", mov(1).cdata); endif set (hax, "ydir", "reverse", "visible", "off"); ## Initialize the timer t = tau = 1/fps; timerid = tic (); for ii = idx cdata = mov(ii).cdata; if (isempty (cdata)) error ("movie: empty image data at frame %d", ii); endif set (him, "cdata", cdata); if (! isempty (mov(ii).colormap)) set (hax, "colormap", mov(ii).colormap) endif pause (t - toc (timerid)); t += tau; endfor endfunction %!demo %! nframes = 20; %! colors = jet (nframes); %! baseim = ones (20, 20, 3, "uint8"); %! mov(nframes) = struct ("cdata", [], "colormap", []); %! for ii = 1:nframes %! im = baseim * 255; %! im(:,ii,1) = colors(ii,1) * 255; %! im(:,ii,2) = colors(ii,2) * 255; %! im(:,ii,3) = colors(ii,3) * 255; %! mov(ii).cdata = im; %! endfor %! clf (); %! title ("Play movie forward 2 times"); %! movie (mov, 2); %!demo %! nframes = 20; %! colors = jet (nframes); %! baseim = ones (20, 20, 3, "uint8"); %! mov(nframes) = struct ("cdata", [], "colormap", []); %! for ii = 1:nframes %! im = baseim * 255; %! im(:,ii,1) = colors(ii,1) * 255; %! im(:,ii,2) = colors(ii,2) * 255; %! im(:,ii,3) = colors(ii,3) * 255; %! mov(ii).cdata = im; %! endfor %! clf (); %! title ("Play movie forward and backward 5 times at 25 fps"); %! movie (mov, -5, 25); %!demo %! nframes = 20; %! colors = jet (nframes); %! baseim = ones (20, 20, 3, "uint8"); %! mov(nframes) = struct ("cdata", [], "colormap", []); %! for ii = 1:nframes %! im = baseim * 255; %! im(:,ii,1) = colors(ii,1) * 255; %! im(:,ii,2) = colors(ii,2) * 255; %! im(:,ii,3) = colors(ii,3) * 255; %! mov(ii).cdata = im; %! endfor %! clf (); %! title ("Play downsampled movie 5 times"); %! movie (mov, [5 1:3:nframes]); %!demo %! clf (); %! z = sombrero (); %! hs = surf (z); %! axis manual %! nframes = 50; %! mov(nframes) = struct ("cdata", [], "colormap", []); %! for ii = 1:nframes %! set (hs, "zdata", z * sin (2*pi*ii/nframes)); %! mov(ii) = getframe (); %! endfor %! clf (); %! movie (mov, 3, 25); ## Test input validation %!error <Invalid call> movie () %!error <Invalid call> movie (1,2,3,4,5) %!error <MOV must be a frame struct array> movie ({2}) %!error <MOV must contain at least two frames> %! movie (struct ("cdata", [], "colormap", [])); %!error <N must be a non-zero integer> %! movie (struct ("cdata", {[], []}, "colormap", []), 2.3); %!error <N must be a non-zero integer> %! movie (struct ("cdata", {[], []}, "colormap", []), [2.3 -6]); %!error <All elements N\(2:end\) must be valid indices into the MOV struct> %! movie (struct ("cdata", {[], []}, "colormap", []), [1 -1]); %!error <All elements N\(2:end\) must be valid indices into the MOV struct> %! movie (struct ("cdata", {[], []}, "colormap", []), [1 5]); %!error <FPS must be a numeric scalar . 0> %! movie (struct ("cdata", {[], []}, "colormap", []), 1, "a"); %!error <FPS must be a numeric scalar . 0> %! movie (struct ("cdata", {[], []}, "colormap", []), 1, [1 1]); %!error <FPS must be a numeric scalar . 0> %! movie (struct ("cdata", {[], []}, "colormap", []), 1, -1/12); %!error <empty image data at frame 1> %! hf = figure ("visible", "off"); %! unwind_protect %! movie (hf, struct ("cdata", {[], []}, "colormap", [])); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect %!error <empty image data at frame 2> %! hf = figure ("visible", "off"); %! unwind_protect %! movie (struct ("cdata", {ones(2), []}, "colormap", [])); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect