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 faaba1897920ea54344ca36ec8c6633d0a6ebf1d (commit)
from 14d0a7da4df6fac46b50da3afd0ab8fe35653e6f (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/faaba1897920ea54344ca36ec8c6633d0a6e…
commit faaba1897920ea54344ca36ec8c6633d0a6ebf1d
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Aug 1 00:10:28 2012 +0200
loaders: GIF: Add support for interlaced images.
diff --git a/libs/loaders/GP_GIF.c b/libs/loaders/GP_GIF.c
index aa999db..15e0c44 100644
--- a/libs/loaders/GP_GIF.c
+++ b/libs/loaders/GP_GIF.c
@@ -176,6 +176,44 @@ static int get_bg_color(GifFileType *gf, GP_Pixel *pixel)
return 1;
}
+/*
+ * The interlacing consists of 8 pixel high strips. Each pass adds some lines
+ * into each strip. This function maps y in the gif buffer to real y.
+ */
+static inline unsigned int interlace_real_y(GifFileType *gf, unsigned int y)
+{
+ const unsigned int h = gf->Image.Height;
+ unsigned int real_y;
+
+ /* Pass 1: Line 0 for each strip */
+ real_y = 8 * y;
+
+ if (real_y < h)
+ return real_y;
+
+ /* Pass 2: Line 4 for each strip */
+ real_y = 8 * (y - (h - 1)/8 - 1) + 4;
+
+ if (real_y < h)
+ return real_y;
+
+ /* Pass 3: Lines 2 and 6 */
+ real_y = 4 * (y - (h - 1)/4 - 1) + 2;
+
+ if (real_y < h)
+ return real_y;
+
+ /* Pass 4: Lines 1, 3, 5, and 7 */
+ real_y = 2 * (y - h/2 - h%2) + 1;
+
+ if (real_y < h)
+ return real_y;
+
+ GP_BUG("real_y > h");
+
+ return 0;
+}
+
GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback)
{
GifFileType *gf = f;
@@ -240,9 +278,16 @@ GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback)
DGifGetLine(gf, line, gf->Image.Width);
+ unsigned int real_y = y;
+
+ if (gf->Image.Interlace == 64) {
+ real_y = interlace_real_y(gf, y);
+ GP_DEBUG(3, "Interlace y -> real_y %u %u", y, real_y);
+ }
+
//TODO: just now we have only 8BPP
for (x = 0; x < gf->Image.Width; x++)
- GP_PutPixel_Raw_24BPP(res, x + gf->Image.Left, y, get_color(gf, line[x]));
+ GP_PutPixel_Raw_24BPP(res, x + gf->Image.Left, real_y, get_color(gf, line[x]));
if (GP_ProgressCallbackReport(callback, y - gf->Image.Top,
gf->Image.Height,
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_GIF.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 46 insertions(+), 1 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 c790f88c116700214c4bd14a8d350f302ba12993 (commit)
from 62f5963ad7a384999f52b96a18f5c253cde5290c (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/c790f88c116700214c4bd14a8d350f302ba1…
commit c790f88c116700214c4bd14a8d350f302ba12993
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Jul 22 12:53:12 2012 +0200
doc: Add median filter docs.
diff --git a/doc/filters.txt b/doc/filters.txt
index 68d7180..d15b3aa 100644
--- a/doc/filters.txt
+++ b/doc/filters.txt
@@ -1068,3 +1068,60 @@ image:images/dither/lenna_RGB333_HP_small.png[
"3-bit RGB Hilbert-Peano",
link="images/dither/lenna_RGB333_HP.png"]
+Median
+~~~~~~
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <filters/GP_Median.h>
+/* or */
+#include <GP.h>
+
+int GP_FilterMedianEx(const GP_Context *src,
+ GP_Coord x_src, GP_Coord y_src,
+ GP_Size w_src, GP_Size h_src,
+ GP_Context *dst,
+ GP_Coord x_dst, GP_Coord y_dst,
+ int xmed, int ymed,
+ GP_ProgressCallback *callback);
+
+GP_Context *GP_FilterMedianExAlloc(const GP_Context *src,
+ GP_Coord x_src, GP_Coord y_src,
+ GP_Size w_src, GP_Size h_src,
+ int xmed, int ymed,
+ GP_ProgressCallback *callback);
+
+int GP_FilterMedian(const GP_Context *src,
+ GP_Context *dst,
+ int xmed, int ymed,
+ GP_ProgressCallback *callback);
+
+GP_Context *GP_FilterMedianAlloc(const GP_Context *src,
+ int xmed, int ymed,
+ GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
+
+Constant time median filters (the computational complexity is independent of
+radius size).
+
+The xmed and ymed are radius values for x and y. The algorithm uses xmed
+respectively ymed pixel neighbors from each side so the result is median of
+rectangle of 2 * xmed + 1 x 2 * ymed + 1 pixels.
+
+.Original Image; Median 3x3, 5x5, 7x7, 9x9
+image:images/dither/lenna_small.png[
+ "Original Image",
+ link="images/dither/lenna.png"]
+image:images/median/lenna_small_med_3_3.png[
+ "Median 3x3",
+ link="images/median/lenna_med_3_3.png"]
+image:images/median/lenna_small_med_5_5.png[
+ "Median 5x5",
+ link="images/median/lenna_med_5_5.png"]
+image:images/median/lenna_small_med_7_7.png[
+ "Median 7x7",
+ link="images/median/lenna_med_7_7.png"]
+image:images/median/lenna_small_med_9_9.png[
+ "Median 9x9",
+ link="images/median/lenna_med_9_9.png"]
+
diff --git a/doc/images/median/lenna_med_3_3.png b/doc/images/median/lenna_med_3_3.png
new file mode 100644
index 0000000..abbc202
Binary files /dev/null and b/doc/images/median/lenna_med_3_3.png differ
diff --git a/doc/images/median/lenna_med_5_5.png b/doc/images/median/lenna_med_5_5.png
new file mode 100644
index 0000000..f205d49
Binary files /dev/null and b/doc/images/median/lenna_med_5_5.png differ
diff --git a/doc/images/median/lenna_med_7_7.png b/doc/images/median/lenna_med_7_7.png
new file mode 100644
index 0000000..5b11b19
Binary files /dev/null and b/doc/images/median/lenna_med_7_7.png differ
diff --git a/doc/images/median/lenna_med_9_9.png b/doc/images/median/lenna_med_9_9.png
new file mode 100644
index 0000000..f068dbb
Binary files /dev/null and b/doc/images/median/lenna_med_9_9.png differ
diff --git a/doc/images/median/lenna_small_med_3_3.png b/doc/images/median/lenna_small_med_3_3.png
new file mode 100644
index 0000000..eef311d
Binary files /dev/null and b/doc/images/median/lenna_small_med_3_3.png differ
diff --git a/doc/images/median/lenna_small_med_5_5.png b/doc/images/median/lenna_small_med_5_5.png
new file mode 100644
index 0000000..fca6ab4
Binary files /dev/null and b/doc/images/median/lenna_small_med_5_5.png differ
diff --git a/doc/images/median/lenna_small_med_7_7.png b/doc/images/median/lenna_small_med_7_7.png
new file mode 100644
index 0000000..8ba3aab
Binary files /dev/null and b/doc/images/median/lenna_small_med_7_7.png differ
diff --git a/doc/images/median/lenna_small_med_9_9.png b/doc/images/median/lenna_small_med_9_9.png
new file mode 100644
index 0000000..0eec833
Binary files /dev/null and b/doc/images/median/lenna_small_med_9_9.png differ
diff --git a/include/filters/GP_Median.h b/include/filters/GP_Median.h
index 891ae70..0547793 100644
--- a/include/filters/GP_Median.h
+++ b/include/filters/GP_Median.h
@@ -22,12 +22,12 @@
/*
- Constant time Median Filter (the computational complexity is independend of
+ Constant time Median Filter (the computational complexity is independent of
radius).
The xmed and ymed are radius values for x and y. The algorithm uses xmed
- respectively ymed pixel neighbours from each side so the result is median
- of rectangle of 2 * xmed + 1 x 2 * ymed + 1 pixels.
+ respectively ymed pixel neighbors from each side so the result is median of
+ rectangle of 2 * xmed + 1 x 2 * ymed + 1 pixels.
*/
-----------------------------------------------------------------------
Summary of changes:
doc/filters.txt | 57 +++++++++++++++++++++++++++++
doc/images/median/lenna_med_3_3.png | Bin 0 -> 331859 bytes
doc/images/median/lenna_med_5_5.png | Bin 0 -> 275419 bytes
doc/images/median/lenna_med_7_7.png | Bin 0 -> 241894 bytes
doc/images/median/lenna_med_9_9.png | Bin 0 -> 218719 bytes
doc/images/median/lenna_small_med_3_3.png | Bin 0 -> 89004 bytes
doc/images/median/lenna_small_med_5_5.png | Bin 0 -> 74908 bytes
doc/images/median/lenna_small_med_7_7.png | Bin 0 -> 66044 bytes
doc/images/median/lenna_small_med_9_9.png | Bin 0 -> 59615 bytes
include/filters/GP_Median.h | 6 ++--
10 files changed, 60 insertions(+), 3 deletions(-)
create mode 100644 doc/images/median/lenna_med_3_3.png
create mode 100644 doc/images/median/lenna_med_5_5.png
create mode 100644 doc/images/median/lenna_med_7_7.png
create mode 100644 doc/images/median/lenna_med_9_9.png
create mode 100644 doc/images/median/lenna_small_med_3_3.png
create mode 100644 doc/images/median/lenna_small_med_5_5.png
create mode 100644 doc/images/median/lenna_small_med_7_7.png
create mode 100644 doc/images/median/lenna_small_med_9_9.png
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.")