This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via a19009feb951a42521104ff1d2657ce9fc77df99 (commit)
from 0192d34fbb5325dc78143d0bb8438c6d2613aadd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/a19009feb951a42521104ff1d2657ce9fc77…
commit a19009feb951a42521104ff1d2657ce9fc77df99
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue May 27 20:53:55 2014 +0200
filters: ResizeLinearLF: Further optimalization
Optimize the inner loop further.
This reshuffles the multiplication and divisions saving a few
operations, which brings back the effectivity back as it was
before the precision fixes.
Signed-off-by: Cyril Hrubis <setan(a)ucw.cz>
diff --git a/libs/filters/GP_ResizeLinear.gen.c.t b/libs/filters/GP_ResizeLinear.gen.c.t
index d7b57a06..6a2b947d 100644
--- a/libs/filters/GP_ResizeLinear.gen.c.t
+++ b/libs/filters/GP_ResizeLinear.gen.c.t
@@ -50,20 +50,20 @@
for (x = 0; x < dst->w; x++) {
/* Get first left pixel */
%% for c in pt.chanslist
- uint32_t {{ c.name }}_tmp = {{ c.name }}[xmap[x]] * (MULT - xoff[x]) / DIV;
+ uint32_t {{ c.name }}_middle = 0;
+ uint32_t {{ c.name }}_first = {{ c.name }}[xmap[x]] * (MULT - xoff[x]);
%% endfor
/* Sum middle pixels */
for (j = xmap[x]+1; j < xmap[x+1]; j++) {
%% for c in pt.chanslist
- {{ c.name }}_tmp += {{ c.name }}[j] * MULT / DIV;
+ {{ c.name }}_middle += {{ c.name }}[j];
%% endfor
}
- /* Add last right pixel */
+ /* Add it all together with last pixel on the right */
%% for c in pt.chanslist
- {{ c.name }}_tmp += {{ c.name }}[xmap[x+1]] * xoff[x+1] / DIV;
-%% endfor
-%% for c in pt.chanslist
- {{ c.name }}_res[x] += {{ c.name }}_tmp * {{ mult }} / DIV;
+ {{ c.name }}_res[x] += ({{ c.name }}_middle * (MULT / DIV) +
+ ({{ c.name }}[xmap[x+1]] * xoff[x+1] +
+ {{ c.name }}_first) / DIV) * {{ mult }} / DIV;
%% endfor
}
%% endmacro
-----------------------------------------------------------------------
Summary of changes:
libs/filters/GP_ResizeLinear.gen.c.t | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via f0637e601e591b56c6b074a6ca7e51af29eb182d (commit)
from 0ccf9c3c0c8bc079bab8cefcbfeae1a3f5858f52 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/f0637e601e591b56c6b074a6ca7e51af29eb…
commit f0637e601e591b56c6b074a6ca7e51af29eb182d
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 25 15:29:35 2014 +0200
doc: Update gen.txt PixelChannel description
The PixelChannel is an object now (not a list).
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/doc/gen.txt b/doc/gen.txt
index 23edf2b8..ddb3082d 100644
--- a/doc/gen.txt
+++ b/doc/gen.txt
@@ -196,9 +196,25 @@ This object represents pixel type which describes the sizes and arrangements of
channels in a pixel. Note that it carries an instance of pixel size described
above.
-The chanslist is a list of triplets describing individual channels as
-[('chan_name', 'bit_offset', 'bit_size') ] where 'chan_name' is usually one of
-R, G, B, V (value, used for grayscale), A (opacity).
+[source,python]
+-------------------------------------------------------------------------------
+class PixelChannel():
+ # Index (position in pixel from left)
+ self.idx = idx
+ # Pixel channel name such as R, G, B, A, ...
+ self.name = name
+ # Bit offset in pixel
+ self.off = offset
+ # Channel bit size
+ self.size = size
+ # Maximal channel value
+ self.max = 2 ** size - 1
+ ...
+-------------------------------------------------------------------------------
+
+The chanslist describes pixel channel. There are some convenient members to be
+used directly from C code whose value is a hexadecimal string, i.e. 'C_mask',
+'C_max', 'C_shift'.
Templating language
~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------------
Summary of changes:
doc/gen.txt | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via b751bfc9b78d8dc25a503efce8582a8f6df10af7 (commit)
via 1479708a43cb28eada03dbf962fe98a623cd68d6 (commit)
from 76f73128753ed19cefe7e80e55520edccbb01b9a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/b751bfc9b78d8dc25a503efce8582a8f6df1…
commit b751bfc9b78d8dc25a503efce8582a8f6df10af7
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 11 14:06:56 2014 +0200
doc: Add resize filters to python docs.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/py_simple/resize.py b/demos/py_simple/resize.py
index 38a5b783..7d11e229 100755
--- a/demos/py_simple/resize.py
+++ b/demos/py_simple/resize.py
@@ -10,13 +10,10 @@ def main():
print("USAGE: %s imput_image output_image" % sys.argv[0]);
sys.exit(1)
- # Turns on debug messages
- core.SetDebugLevel(10);
-
# Load Image
src = loaders.Load(sys.argv[1])
# Resize image to the half of the original
- res = src.filters.ResizeAlloc(src.w//2, src.h//2, 2)
+ res = src.filters.ResizeLFIntAlloc(src.w//2, src.h//2)
# Save Image
res.loaders.Save(sys.argv[2])
diff --git a/doc/example_py_resize.txt b/doc/example_py_resize.txt
new file mode 100644
index 00000000..06504964
--- /dev/null
+++ b/doc/example_py_resize.txt
@@ -0,0 +1,8 @@
+Resize
+------
+A simple program that loads image, resizes it to half and saves result.
+
+[source,python]
+------------------------------------------------------------------
+include::../demos/py_simple/resize.py[]
+------------------------------------------------------------------
diff --git a/doc/filters_python.txt b/doc/filters_python.txt
index c1dadb84..fc202fbb 100644
--- a/doc/filters_python.txt
+++ b/doc/filters_python.txt
@@ -8,9 +8,10 @@ The filter functions could be called directly as +filters.Foo(img, ..)+ or
from submodule as +img.filters.Foo(..)+. Note that in the second case the
image is passed automatically as a first parameter.
-If filter has been aborted from callback 'OSError' with errno set to
-'ECANCELED' is raised, see progress callback
-link:core_python.html#Progress_Callback[documentation] for more information.
+If filter is aborted from a callback 'OSError' with errno set to
+'ECANCELED' is raised, see
+link:core_python.html#Progress_Callback[progress callback] for more
+information.
Point Filters
~~~~~~~~~~~~~
@@ -402,3 +403,29 @@ respectively y pixel neighbors from each side so the result is median of
rectangle of +2 * x + 1+ x +2 * y + 1+ pixels.
include::images/median/images.txt[]
+
+Resize
+~~~~~~
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+import gfxprim.filters as filters
+
+ # Nearest neighbour resize, fastest but lowest quality
+ res = img.ResizeNNAlloc(100, 100, callback=None)
+
+ # Fast and good quality with low pass on downscaling
+ res = img.ResizeLinearLFIntAlloc(100, 100, callback=None)
+
+ # Cubic interpolation, needs low pass (blur) applied before downscaling
+ res = img.ResizeCubicIntAlloc(100, 100, callback=None)
+
+ # All of the above, TYPE is numeric enum
+ res = img.ResizeAlloc(100, 100, TYPE, callback=None)
+
+-------------------------------------------------------------------------------
+
+Functions to resize (resample) image.
+
+TIP: See link:example_py_resize.html[resize example].
http://repo.or.cz/w/gfxprim.git/commit/1479708a43cb28eada03dbf962fe98a623cd…
commit 1479708a43cb28eada03dbf962fe98a623cd68d6
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 11 14:00:20 2014 +0200
pywrap: filters: Add ResizeCubicInt
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/pylib/gfxprim/filters/filters.i b/pylib/gfxprim/filters/filters.i
index a504f76a..3aeba03b 100644
--- a/pylib/gfxprim/filters/filters.i
+++ b/pylib/gfxprim/filters/filters.i
@@ -92,6 +92,10 @@ FILTER_FUNC(ResizeLinearInt);
FILTER_FUNC(ResizeLinearLFInt);
%include "GP_ResizeLinear.h"
+FILTER_FUNC(ResizeCubic);
+FILTER_FUNC(ResizeCubicInt);
+%include "GP_ResizeCubic.h"
+
/* Ditherings */
FILTER_FUNC(FloydSteinberg);
FILTER_FUNC(GP_FilterHilbertPeano);
-----------------------------------------------------------------------
Summary of changes:
demos/py_simple/resize.py | 5 +--
...mple_py_showimage.txt => example_py_resize.txt} | 8 ++--
doc/filters_python.txt | 33 ++++++++++++++++++--
pylib/gfxprim/filters/filters.i | 4 ++
4 files changed, 39 insertions(+), 11 deletions(-)
copy doc/{example_py_showimage.txt => example_py_resize.txt} (53%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")