Xyremap

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(Xyremap: add documentation (v0.5beta))
 
(Changelog)
 
(2 intermediate revisions by one user not shown)
Line 51: Line 51:
 
<br>
 
<br>
 
==Reverse Polish Notation===
 
==Reverse Polish Notation===
For more information on RPN itself, see http://en.wikipedia.org/wiki/Reverse_Polish_notation
+
For more information on RPN itself, see http://en.wikipedia.org/wiki/Reverse_Polish_notation and also http://horman.net/avisynth/rpn.php
  
 
<pre>
 
<pre>
For a list of available operations in this implementation, see the included rpn.html document.
+
For a list of available operations in this implementation,  
 +
see the included rpn.html document or here: http://horman.net/avisynth/rpn.php
  
 
xyremap sets the following variables:
 
xyremap sets the following variables:
Line 71: Line 72:
 
</pre>
 
</pre>
 
<br>
 
<br>
 +
 
== Changelog ==
 
== Changelog ==
 
  Version      Date            Changes<br>
 
  Version      Date            Changes<br>
 
  v0.5beta    2015/08/30      - some new RPN functions, a bug fix, and (approximately) gamma-aware interpolation  
 
  v0.5beta    2015/08/30      - some new RPN functions, a bug fix, and (approximately) gamma-aware interpolation  
 
                                 (see https://forum.doom9.org/showthread.php?p=1736501#post1736501)<br>
 
                                 (see https://forum.doom9.org/showthread.php?p=1736501#post1736501)<br>
  v0.4                        - new x86 RPN compiler; new functionality
+
  v0.4beta    2015/08/23      - new x86 RPN compiler; new functionality
 
                                 (see https://forum.doom9.org/showthread.php?p=1735605#post1735605)<br>
 
                                 (see https://forum.doom9.org/showthread.php?p=1735605#post1735605)<br>
  v0.3        2015/03/15      - version 0.3: new parameter "static" to speed up non-animating remaps<br>
+
  v0.3        2015/03/15      - new parameter "static" to speed up non-animating remaps<br>
  v0.2                         - bug fixes to pixel interpolator, min/max functions, added new RPN parameters<br>
+
  v0.2         2012/11/01      - bug fixes to pixel interpolator, min/max functions, added new RPN parameters
 +
                                (see https://forum.doom9.org/showthread.php?p=1598673#post1598673)<br>
 
  v0.1        2012/10/14      - initial release
 
  v0.1        2012/10/14      - initial release
 
<br>
 
<br>
 +
 
== Archived Downloads ==
 
== Archived Downloads ==
 
{| class="wikitable" border="1"; width="400px"
 
{| class="wikitable" border="1"; width="400px"
Line 101: Line 105:
 
<br>
 
<br>
 
-----------------------------------------------
 
-----------------------------------------------
'''Back to [[External_filters#Rotate|External Filters]] &larr;'''
+
'''Back to [[External_filters#Rotation.2FShear.2FSkew.2FPerspective|External Filters]] &larr;'''

Latest revision as of 20:54, 28 June 2020

Abstract
Author wonkey_monkey
Version v0.5beta
Download xyremap0.5beta.zip
Category Transformation
License Closed source
Discussion Doom9 Thread

Contents

[edit] Description

xyremap is a filter for remapping pixels using formulae written in reverse Polish notation (http://en.wikipedia.org/wiki/Reverse_Polish_notation)

[edit] Requirements


[edit] Syntax and Parameters

xyremap(clip, string "x", string "y", string "m", int "w", int "h", bool "draft", bool "static")

x: a formula, written in reverse Polish notation, to calculate source x coordinate for each remapped pixel
y: same as above for the y coordinate
m: same as above, used to multiply (darken) the pixel value
w: output width (defaults to input width)
h: output height (defaults to input height)
draft: nearest-neighbour interpolation if true (otherwise defaults to bicubic interpolation)
static: if the remapping is the same for all frames (no animation using variables n or t), set this to true to increase rendering speed


[edit] Examples

xyremap's formulae map output pixels to input pixels, with the origin at the top left.

To shift an image to the right by 10 pixels, use:

	xyremap(clip, "x 10 -")

Note that "-" is used instead of "+" because we are mapping from output to input pixels, not the other way around (which would be more intuitive).

Similarly to upscale a video in both dimensions:

	xyremap(clip, "x 0.5 *", "y 0.5 *")

To scale up from the center:

  xyremap(clip, "x w 0.5 * - 0.5 * u 0.5 * +", "y w 0.5 * - 0.5 * v 0.5 * +")



[edit] Reverse Polish Notation=

For more information on RPN itself, see http://en.wikipedia.org/wiki/Reverse_Polish_notation and also http://horman.net/avisynth/rpn.php

For a list of available operations in this implementation, 
see the included rpn.html document or here: http://horman.net/avisynth/rpn.php

xyremap sets the following variables:

	x: pixel x coordinate (note that this is the pixel center coordinate, so the leftmost pixel is x=0.5)
	y: pixel y coordinate (note that this is the pixel center coordinate, so the topmost pixel is y=0.5)
	a: pixel x coordinate normalised to [0-1]
	b: pixel y coordinate normalised to [0-1]
	c: pixel y coordinate normalised to [0-1*display_aspect_ratio]
	n: frame number
	t: t=n/framecount (so 0<=0<1)
	w: output width
	h: output height
	u: input width
	v: input height


[edit] Changelog

Version      Date            Changes
v0.5beta 2015/08/30 - some new RPN functions, a bug fix, and (approximately) gamma-aware interpolation (see https://forum.doom9.org/showthread.php?p=1736501#post1736501)
v0.4beta 2015/08/23 - new x86 RPN compiler; new functionality (see https://forum.doom9.org/showthread.php?p=1735605#post1735605)
v0.3 2015/03/15 - new parameter "static" to speed up non-animating remaps
v0.2 2012/11/01 - bug fixes to pixel interpolator, min/max functions, added new RPN parameters (see https://forum.doom9.org/showthread.php?p=1598673#post1598673)
v0.1 2012/10/14 - initial release


[edit] Archived Downloads

Version Download Mirror
v0.5beta xyremap0.5beta.zip xyremap0.5beta.zip
v0.3 xyremap0.3.zip xyremap0.3.zip


[edit] External Links




Back to External Filters

Personal tools