toolchains: branch tlsa/update-jpeg-turbo created. a3ef28972bf8fa40a2741c45f7aff712f9a06973
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/a3ef28972bf8fa40a2...
...commit http://git.netsurf-browser.org/toolchains.git/commit/a3ef28972bf8fa40a274...
...tree http://git.netsurf-browser.org/toolchains.git/tree/a3ef28972bf8fa40a2741c...
The branch, tlsa/update-jpeg-turbo has been created
at a3ef28972bf8fa40a2741c45f7aff712f9a06973 (commit)
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/toolchains.git/commit/?id=a3ef28972bf8fa40...
commit a3ef28972bf8fa40a2741c45f7aff712f9a06973
Author: Michael Drake <michael.drake(a)codethink.co.uk>
Commit: Michael Drake <michael.drake(a)codethink.co.uk>
SDK: Update libjpeg-turbo.
Requires CMake.
diff --git a/sdk/Makefile b/sdk/Makefile
index b826999..ec1f0da 100644
--- a/sdk/Makefile
+++ b/sdk/Makefile
@@ -36,8 +36,7 @@ VERSION_LIBPNG := 1.6.37
# http://libjpeg.sourceforge.net/
VERSION_LIBJPEG := 8d
# https://libjpeg-turbo.org/
-# libjpeg turbo have dropped autotools support VERSION_LIBJPEG_TURBO := 2.0.2
-VERSION_LIBJPEG_TURBO := 1.5.3
+VERSION_LIBJPEG_TURBO := 2.1.3
# https://c-ares.haxx.se/
VERSION_LIBCARES := 1.15.0
# https://curl.haxx.se/
@@ -77,6 +76,19 @@ TARGET := $(shell $(cc__) -dumpmachine)
cleanenv := PATH="$(path__)" CC="$(cc__)" CXX="$(cxx__)" AR="$(ar__)" RANLIB="$(ranlib__)" CPPFLAGS="$(cppflags__)" LDFLAGS="$(ldflags__)" PKG_CONFIG_LIBDIR="$(pkg_config_libdir__)"
env := $(cleanenv) CFLAGS="$(cflags__)"
+# Cross-compiling CMake invocation.
+NS_SDK_CMAKE_CMD=cmake \
+ -DCMAKE_INSTALL_PREFIX="$(GCCSDK_INSTALL_ENV)" \
+ -DBUILD_SHARED_LIBS=OFF \
+ -DCMAKE_COLOR_MAKEFILE=OFF \
+ -DBUILD_DOC=OFF \
+ -DBUILD_DOCS=OFF \
+ -DBUILD_EXAMPLE=OFF \
+ -DBUILD_EXAMPLES=OFF \
+ -DBUILD_TEST=OFF \
+ -DBUILD_TESTS=OFF \
+ -DBUILD_TESTING=OFF \
+
RECIPES := $(CURDIR)/recipes
SOURCEDIR := $(CURDIR)/sources
BUILDDIR := $(CURDIR)/builddir-$(TARGET)
@@ -424,7 +436,6 @@ $(BUILDSTEPS)/libjpeg-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/jpegsrc.v$(V
$(SOURCEDIR)/jpegsrc.v$(VERSION_LIBJPEG).tar.gz:
$(FETCHSRC) sdk $(subst $(SOURCEDIR)/,,$@) "http://ijg.org/files/$(subst $(SOURCEDIR)/,,$@)" $@
-
# libjpegturbo
$(BUILDSTEPS)/libjpeg-turbo.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libjpeg-turbo-src.d
mkdir -p $(LIBJPEG_TURBO_BUILDDIR)
@@ -433,8 +444,12 @@ $(BUILDSTEPS)/libjpeg-turbo.d: $(BUILDSTEPS)/builddir.d $(BUILDSTEPS)/libjpeg-tu
ifneq ($(realpath $(RECIPES)/patches/libjpegturbo/$(TARGET)),)
for p in `ls $(RECIPES)/patches/libjpegturbo/$(TARGET)/*.p` ; do $(PATCH) -d $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO) -p0 <$$p ; done
endif
- cd $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO) && $(env) $(LIBJPEG_TURBO_ENV) ./configure --prefix=$(GCCSDK_INSTALL_ENV) --target=$(TARGET) --host=$(TARGET) --disable-shared
- cd $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO) && $(env) make install
+ mkdir -p $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO)/ns-sdk-build
+ cd $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO)/ns-sdk-build && $(env) $(LIBJPEG_TURBO_ENV) $(NS_SDK_CMAKE_CMD) \
+ -DENABLE_STATIC=ON \
+ -DENABLE_SHARED=OFF \
+ ..
+ cd $(LIBJPEG_TURBO_BUILDDIR)/libjpeg-turbo-$(VERSION_LIBJPEG_TURBO)/ns-sdk-build && $(env) make install VERBOSE=1
touch $@
$(BUILDSTEPS)/libjpeg-turbo-src.d: $(BUILDSTEPS)/sourcedir.d $(SOURCEDIR)/libjpeg-turbo-src-$(VERSION_LIBJPEG_TURBO).tar.gz
-----------------------------------------------------------------------
--
Cross-compilation toolchains and environments
1 year, 4 months
libnsgif: branch master updated. release/0.2.1-187-g75ed385
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsgif.git/shortlog/75ed38539447571ec961...
...commit http://git.netsurf-browser.org/libnsgif.git/commit/75ed38539447571ec961c9...
...tree http://git.netsurf-browser.org/libnsgif.git/tree/75ed38539447571ec961c985...
The branch, master has been updated
via 75ed38539447571ec961c985c8a1e9cbd76573e2 (commit)
via aa6e2af43ebb898167f6dc0bb8215eacf0a17389 (commit)
from 59566cafec6ba3f0eca7718859f2a742469d5b47 (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 -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsgif.git/commit/?id=75ed38539447571ec9...
commit 75ed38539447571ec961c985c8a1e9cbd76573e2
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
GIF: Ensure frame clipping is applied to max lzw output length.
diff --git a/src/gif.c b/src/gif.c
index aeb70f2..84d4209 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -525,7 +525,7 @@ static nsgif_error nsgif__decode_simple(
uint32_t *restrict frame_data,
uint32_t *restrict colour_table)
{
- uint32_t pixels = gif->info.width * height;
+ uint32_t pixels;
uint32_t written = 0;
nsgif_error ret = NSGIF_OK;
lzw_result res;
@@ -550,6 +550,7 @@ static nsgif_error nsgif__decode_simple(
}
frame_data += (offset_y * gif->info.width);
+ pixels = gif->info.width * height;
while (pixels > 0) {
res = lzw_decode_map(gif->lzw_ctx,
commitdiff http://git.netsurf-browser.org/libnsgif.git/commit/?id=aa6e2af43ebb898167...
commit aa6e2af43ebb898167f6dc0bb8215eacf0a17389
Author: DarthSim <darthsim(a)gmail.com>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
GIF: Try to recover after LZW_EOI_CODE.
diff --git a/src/gif.c b/src/gif.c
index 509883e..aeb70f2 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -471,7 +471,8 @@ static nsgif_error nsgif__decode_complex(
while (available == 0) {
if (res != LZW_OK) {
/* Unexpected end of frame, try to recover */
- if (res == LZW_OK_EOD) {
+ if (res == LZW_OK_EOD ||
+ res == LZW_EOI_CODE) {
ret = NSGIF_OK;
} else {
ret = nsgif__error_from_lzw(res);
@@ -557,7 +558,7 @@ static nsgif_error nsgif__decode_simple(
frame_data += written;
if (res != LZW_OK) {
/* Unexpected end of frame, try to recover */
- if (res == LZW_OK_EOD) {
+ if (res == LZW_OK_EOD || res == LZW_EOI_CODE) {
ret = NSGIF_OK;
} else {
ret = nsgif__error_from_lzw(res);
-----------------------------------------------------------------------
Summary of changes:
src/gif.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/gif.c b/src/gif.c
index 509883e..84d4209 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -471,7 +471,8 @@ static nsgif_error nsgif__decode_complex(
while (available == 0) {
if (res != LZW_OK) {
/* Unexpected end of frame, try to recover */
- if (res == LZW_OK_EOD) {
+ if (res == LZW_OK_EOD ||
+ res == LZW_EOI_CODE) {
ret = NSGIF_OK;
} else {
ret = nsgif__error_from_lzw(res);
@@ -524,7 +525,7 @@ static nsgif_error nsgif__decode_simple(
uint32_t *restrict frame_data,
uint32_t *restrict colour_table)
{
- uint32_t pixels = gif->info.width * height;
+ uint32_t pixels;
uint32_t written = 0;
nsgif_error ret = NSGIF_OK;
lzw_result res;
@@ -549,6 +550,7 @@ static nsgif_error nsgif__decode_simple(
}
frame_data += (offset_y * gif->info.width);
+ pixels = gif->info.width * height;
while (pixels > 0) {
res = lzw_decode_map(gif->lzw_ctx,
@@ -557,7 +559,7 @@ static nsgif_error nsgif__decode_simple(
frame_data += written;
if (res != LZW_OK) {
/* Unexpected end of frame, try to recover */
- if (res == LZW_OK_EOD) {
+ if (res == LZW_OK_EOD || res == LZW_EOI_CODE) {
ret = NSGIF_OK;
} else {
ret = nsgif__error_from_lzw(res);
--
NetSurf GIF Decoder
1 year, 5 months
libnsgif: branch master updated. release/0.2.1-185-g59566ca
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsgif.git/shortlog/59566cafec6ba3f0eca7...
...commit http://git.netsurf-browser.org/libnsgif.git/commit/59566cafec6ba3f0eca771...
...tree http://git.netsurf-browser.org/libnsgif.git/tree/59566cafec6ba3f0eca77188...
The branch, master has been updated
via 59566cafec6ba3f0eca7718859f2a742469d5b47 (commit)
via bf8bcf92da3259c99babe58309bb0db367665c7b (commit)
from 49a2c4374ab846b4d4cce982ea61946ee664628a (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 -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsgif.git/commit/?id=59566cafec6ba3f0ec...
commit 59566cafec6ba3f0eca7718859f2a742469d5b47
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Tests: Decoder: Print frame number of frames that fail to decode.
diff --git a/test/nsgif.c b/test/nsgif.c
index 3f9559e..61c63d0 100644
--- a/test/nsgif.c
+++ b/test/nsgif.c
@@ -221,7 +221,9 @@ static void decode(FILE* ppm, const char *name, nsgif_t *gif)
err = nsgif_frame_decode(gif, frame_new, &bitmap);
if (err != NSGIF_OK) {
- warning("nsgif_decode_frame", err);
+ fprintf(stderr, "Frame %"PRIu32": "
+ "nsgif_decode_frame failed: %s\n",
+ frame_new, nsgif_strerror(err));
/* Continue decoding the rest of the frames. */
} else if (ppm != NULL) {
commitdiff http://git.netsurf-browser.org/libnsgif.git/commit/?id=bf8bcf92da3259c99b...
commit bf8bcf92da3259c99babe58309bb0db367665c7b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Tests: Decoder: Print frame number in frame info.
diff --git a/test/nsgif.c b/test/nsgif.c
index e91d151..3f9559e 100644
--- a/test/nsgif.c
+++ b/test/nsgif.c
@@ -149,11 +149,12 @@ static void print_gif_info(const nsgif_info_t *info)
fprintf(stdout, " frames:\n");
}
-static void print_gif_frame_info(const nsgif_frame_info_t *info)
+static void print_gif_frame_info(const nsgif_frame_info_t *info, uint32_t i)
{
const char *disposal = nsgif_str_disposal(info->disposal);
- fprintf(stdout, " - disposal-method: %s\n", disposal);
+ fprintf(stdout, " - frame: %"PRIu32"\n", i);
+ fprintf(stdout, " disposal-method: %s\n", disposal);
fprintf(stdout, " transparency: %s\n", info->transparency ? "yes" : "no");
fprintf(stdout, " display: %s\n", info->display ? "yes" : "no");
fprintf(stdout, " delay: %"PRIu32"\n", info->delay);
@@ -214,7 +215,7 @@ static void decode(FILE* ppm, const char *name, nsgif_t *gif)
f_info = nsgif_get_frame_info(gif, frame_new);
if (f_info != NULL) {
- print_gif_frame_info(f_info);
+ print_gif_frame_info(f_info, frame_new);
}
}
-----------------------------------------------------------------------
Summary of changes:
test/nsgif.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/test/nsgif.c b/test/nsgif.c
index e91d151..61c63d0 100644
--- a/test/nsgif.c
+++ b/test/nsgif.c
@@ -149,11 +149,12 @@ static void print_gif_info(const nsgif_info_t *info)
fprintf(stdout, " frames:\n");
}
-static void print_gif_frame_info(const nsgif_frame_info_t *info)
+static void print_gif_frame_info(const nsgif_frame_info_t *info, uint32_t i)
{
const char *disposal = nsgif_str_disposal(info->disposal);
- fprintf(stdout, " - disposal-method: %s\n", disposal);
+ fprintf(stdout, " - frame: %"PRIu32"\n", i);
+ fprintf(stdout, " disposal-method: %s\n", disposal);
fprintf(stdout, " transparency: %s\n", info->transparency ? "yes" : "no");
fprintf(stdout, " display: %s\n", info->display ? "yes" : "no");
fprintf(stdout, " delay: %"PRIu32"\n", info->delay);
@@ -214,13 +215,15 @@ static void decode(FILE* ppm, const char *name, nsgif_t *gif)
f_info = nsgif_get_frame_info(gif, frame_new);
if (f_info != NULL) {
- print_gif_frame_info(f_info);
+ print_gif_frame_info(f_info, frame_new);
}
}
err = nsgif_frame_decode(gif, frame_new, &bitmap);
if (err != NSGIF_OK) {
- warning("nsgif_decode_frame", err);
+ fprintf(stderr, "Frame %"PRIu32": "
+ "nsgif_decode_frame failed: %s\n",
+ frame_new, nsgif_strerror(err));
/* Continue decoding the rest of the frames. */
} else if (ppm != NULL) {
--
NetSurf GIF Decoder
1 year, 5 months
libnsgif: branch master updated. release/0.2.1-183-g49a2c43
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsgif.git/shortlog/49a2c4374ab846b4d4cc...
...commit http://git.netsurf-browser.org/libnsgif.git/commit/49a2c4374ab846b4d4cce9...
...tree http://git.netsurf-browser.org/libnsgif.git/tree/49a2c4374ab846b4d4cce982...
The branch, master has been updated
via 49a2c4374ab846b4d4cce982ea61946ee664628a (commit)
via cd27d786ddb1a1491ce28788504f4e99870ef955 (commit)
via f8f094ab59f9ae71767a2a01c35224da9a04d583 (commit)
from cc18507ae1ffe1753eb7dc66e26f9d8a9231cba6 (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 -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsgif.git/commit/?id=49a2c4374ab846b4d4...
commit 49a2c4374ab846b4d4cce982ea61946ee664628a
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
API: Add function to control handling of small frame delays.
By default we match the mainstream behaviour, and this new
call allows that to be overriden by the client.
Note this only affects animations that are managed by LibNSGIF
via nsgif_frame_prepare().
diff --git a/include/nsgif.h b/include/nsgif.h
index 03f9b16..a02597c 100644
--- a/include/nsgif.h
+++ b/include/nsgif.h
@@ -408,4 +408,35 @@ const nsgif_frame_info_t *nsgif_get_frame_info(
const nsgif_t *gif,
uint32_t frame);
+/**
+ * Configure handling of small frame delays.
+ *
+ * Historically people created GIFs with a tiny frame delay, however the slow
+ * hardware of the time meant they actually played much slower. As computers
+ * sped up, to prevent animations playing faster than intended, decoders came
+ * to ignore overly small frame delays.
+ *
+ * By default a \ref nsgif_frame_prepare() managed animation will override
+ * frame delays of less than 2 centiseconds with a default frame delay of
+ * 10 centiseconds. This matches the behaviour of web browsers and other
+ * renderers.
+ *
+ * Both the minimum and the default values can be overridden for a given GIF
+ * by the client. To get frame delays exactly as specified by the GIF file, set
+ * \ref delay_min to zero.
+ *
+ * Note that this does not affect the frame delay in the frame info
+ * (\ref nsgif_frame_info_t) structure, which will always contain values
+ * specified by the GIF.
+ *
+ * \param[in] gif The \ref nsgif_t object to configure.
+ * \param[in] delay_min The minimum frame delay in centiseconds.
+ * \param[in] delay_default The delay to use if a frame delay is less than
+ * \ref delay_min.
+ */
+void nsgif_set_frame_delay_behaviour(
+ nsgif_t *gif,
+ uint16_t delay_min,
+ uint16_t delay_default);
+
#endif
diff --git a/src/gif.c b/src/gif.c
index 181e4e6..509883e 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -1450,6 +1450,16 @@ nsgif_error nsgif_create(
return NSGIF_OK;
}
+/* exported function documented in nsgif.h */
+void nsgif_set_frame_delay_behaviour(
+ nsgif_t *gif,
+ uint16_t delay_min,
+ uint16_t delay_default)
+{
+ gif->delay_min = delay_min;
+ gif->delay_default = delay_default;
+}
+
/**
* Read GIF header.
*
commitdiff http://git.netsurf-browser.org/libnsgif.git/commit/?id=cd27d786ddb1a1491c...
commit cd27d786ddb1a1491ce28788504f4e99870ef955
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
GIF: Clarify minimum frame delay handling.
diff --git a/src/gif.c b/src/gif.c
index 91999d3..181e4e6 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -20,6 +20,16 @@
/** Maximum colour table size */
#define NSGIF_MAX_COLOURS 256
+/** Default minimum allowable frame delay in cs. */
+#define NSGIF_FRAME_DELAY_MIN 2
+
+/**
+ * Default frame delay to apply.
+ *
+ * Used when a frame delay lower than the minimum is requested.
+ */
+#define NSGIF_FRAME_DELAY_DEFAULT 10
+
/** GIF frame data */
typedef struct nsgif_frame {
struct nsgif_frame_info info;
@@ -65,7 +75,10 @@ struct nsgif {
/** currently decoded image; stored as bitmap from bitmap_create callback */
nsgif_bitmap_t *frame_image;
+ /** Minimum allowable frame delay. */
uint16_t delay_min;
+
+ /** Frame delay to apply when delay is less than \ref delay_min. */
uint16_t delay_default;
/** number of animation loops so far */
@@ -1428,8 +1441,8 @@ nsgif_error nsgif_create(
gif->decoded_frame = NSGIF_FRAME_INVALID;
gif->prev_index = NSGIF_FRAME_INVALID;
- gif->delay_min = 2;
- gif->delay_default = 10;
+ gif->delay_min = NSGIF_FRAME_DELAY_MIN;
+ gif->delay_default = NSGIF_FRAME_DELAY_DEFAULT;
gif->colour_layout = nsgif__bitmap_fmt_to_colour_layout(bitmap_fmt);
commitdiff http://git.netsurf-browser.org/libnsgif.git/commit/?id=f8f094ab59f9ae7176...
commit f8f094ab59f9ae71767a2a01c35224da9a04d583
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
API: Don't expose loop_count.
It is internal state for a libnsgif managed animation, not
information about the GIF.
diff --git a/include/nsgif.h b/include/nsgif.h
index 0ee00e8..03f9b16 100644
--- a/include/nsgif.h
+++ b/include/nsgif.h
@@ -343,8 +343,6 @@ typedef struct nsgif_info {
uint32_t frame_count;
/** number of times to play animation (zero means loop forever) */
int loop_max;
- /** number of animation loops so far */
- int loop_count;
/** background colour in same pixel format as \ref nsgif_bitmap_t. */
uint32_t background;
} nsgif_info_t;
diff --git a/src/gif.c b/src/gif.c
index 84df50e..91999d3 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -68,6 +68,9 @@ struct nsgif {
uint16_t delay_min;
uint16_t delay_default;
+ /** number of animation loops so far */
+ int loop_count;
+
/** number of frames partially decoded */
uint32_t frame_count_partial;
@@ -1737,7 +1740,7 @@ static inline bool nsgif__animation_complete(int count, int max)
nsgif_error nsgif_reset(
nsgif_t *gif)
{
- gif->info.loop_count = 0;
+ gif->loop_count = 0;
gif->frame = NSGIF_FRAME_INVALID;
return NSGIF_OK;
@@ -1765,7 +1768,7 @@ nsgif_error nsgif_frame_prepare(
}
if (nsgif__animation_complete(
- gif->info.loop_count,
+ gif->loop_count,
gif->info.loop_max)) {
return NSGIF_ERR_ANIMATION_END;
}
@@ -1776,7 +1779,7 @@ nsgif_error nsgif_frame_prepare(
}
if (gif->frame != NSGIF_FRAME_INVALID && frame < gif->frame) {
- gif->info.loop_count++;
+ gif->loop_count++;
}
if (gif->info.frame_count == 1) {
@@ -1791,7 +1794,7 @@ nsgif_error nsgif_frame_prepare(
if (frame_next < frame) {
if (nsgif__animation_complete(
- gif->info.loop_count + 1,
+ gif->loop_count + 1,
gif->info.loop_max)) {
delay = NSGIF_INFINITE;
}
-----------------------------------------------------------------------
Summary of changes:
include/nsgif.h | 33 +++++++++++++++++++++++++++++++--
src/gif.c | 38 ++++++++++++++++++++++++++++++++------
2 files changed, 63 insertions(+), 8 deletions(-)
diff --git a/include/nsgif.h b/include/nsgif.h
index 0ee00e8..a02597c 100644
--- a/include/nsgif.h
+++ b/include/nsgif.h
@@ -343,8 +343,6 @@ typedef struct nsgif_info {
uint32_t frame_count;
/** number of times to play animation (zero means loop forever) */
int loop_max;
- /** number of animation loops so far */
- int loop_count;
/** background colour in same pixel format as \ref nsgif_bitmap_t. */
uint32_t background;
} nsgif_info_t;
@@ -410,4 +408,35 @@ const nsgif_frame_info_t *nsgif_get_frame_info(
const nsgif_t *gif,
uint32_t frame);
+/**
+ * Configure handling of small frame delays.
+ *
+ * Historically people created GIFs with a tiny frame delay, however the slow
+ * hardware of the time meant they actually played much slower. As computers
+ * sped up, to prevent animations playing faster than intended, decoders came
+ * to ignore overly small frame delays.
+ *
+ * By default a \ref nsgif_frame_prepare() managed animation will override
+ * frame delays of less than 2 centiseconds with a default frame delay of
+ * 10 centiseconds. This matches the behaviour of web browsers and other
+ * renderers.
+ *
+ * Both the minimum and the default values can be overridden for a given GIF
+ * by the client. To get frame delays exactly as specified by the GIF file, set
+ * \ref delay_min to zero.
+ *
+ * Note that this does not affect the frame delay in the frame info
+ * (\ref nsgif_frame_info_t) structure, which will always contain values
+ * specified by the GIF.
+ *
+ * \param[in] gif The \ref nsgif_t object to configure.
+ * \param[in] delay_min The minimum frame delay in centiseconds.
+ * \param[in] delay_default The delay to use if a frame delay is less than
+ * \ref delay_min.
+ */
+void nsgif_set_frame_delay_behaviour(
+ nsgif_t *gif,
+ uint16_t delay_min,
+ uint16_t delay_default);
+
#endif
diff --git a/src/gif.c b/src/gif.c
index 84df50e..509883e 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -20,6 +20,16 @@
/** Maximum colour table size */
#define NSGIF_MAX_COLOURS 256
+/** Default minimum allowable frame delay in cs. */
+#define NSGIF_FRAME_DELAY_MIN 2
+
+/**
+ * Default frame delay to apply.
+ *
+ * Used when a frame delay lower than the minimum is requested.
+ */
+#define NSGIF_FRAME_DELAY_DEFAULT 10
+
/** GIF frame data */
typedef struct nsgif_frame {
struct nsgif_frame_info info;
@@ -65,9 +75,15 @@ struct nsgif {
/** currently decoded image; stored as bitmap from bitmap_create callback */
nsgif_bitmap_t *frame_image;
+ /** Minimum allowable frame delay. */
uint16_t delay_min;
+
+ /** Frame delay to apply when delay is less than \ref delay_min. */
uint16_t delay_default;
+ /** number of animation loops so far */
+ int loop_count;
+
/** number of frames partially decoded */
uint32_t frame_count_partial;
@@ -1425,8 +1441,8 @@ nsgif_error nsgif_create(
gif->decoded_frame = NSGIF_FRAME_INVALID;
gif->prev_index = NSGIF_FRAME_INVALID;
- gif->delay_min = 2;
- gif->delay_default = 10;
+ gif->delay_min = NSGIF_FRAME_DELAY_MIN;
+ gif->delay_default = NSGIF_FRAME_DELAY_DEFAULT;
gif->colour_layout = nsgif__bitmap_fmt_to_colour_layout(bitmap_fmt);
@@ -1434,6 +1450,16 @@ nsgif_error nsgif_create(
return NSGIF_OK;
}
+/* exported function documented in nsgif.h */
+void nsgif_set_frame_delay_behaviour(
+ nsgif_t *gif,
+ uint16_t delay_min,
+ uint16_t delay_default)
+{
+ gif->delay_min = delay_min;
+ gif->delay_default = delay_default;
+}
+
/**
* Read GIF header.
*
@@ -1737,7 +1763,7 @@ static inline bool nsgif__animation_complete(int count, int max)
nsgif_error nsgif_reset(
nsgif_t *gif)
{
- gif->info.loop_count = 0;
+ gif->loop_count = 0;
gif->frame = NSGIF_FRAME_INVALID;
return NSGIF_OK;
@@ -1765,7 +1791,7 @@ nsgif_error nsgif_frame_prepare(
}
if (nsgif__animation_complete(
- gif->info.loop_count,
+ gif->loop_count,
gif->info.loop_max)) {
return NSGIF_ERR_ANIMATION_END;
}
@@ -1776,7 +1802,7 @@ nsgif_error nsgif_frame_prepare(
}
if (gif->frame != NSGIF_FRAME_INVALID && frame < gif->frame) {
- gif->info.loop_count++;
+ gif->loop_count++;
}
if (gif->info.frame_count == 1) {
@@ -1791,7 +1817,7 @@ nsgif_error nsgif_frame_prepare(
if (frame_next < frame) {
if (nsgif__animation_complete(
- gif->info.loop_count + 1,
+ gif->loop_count + 1,
gif->info.loop_max)) {
delay = NSGIF_INFINITE;
}
--
NetSurf GIF Decoder
1 year, 5 months
netsurf: branch master updated. release/3.10-235-geb7037a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/eb7037ac4fa71a3cfe86b...
...commit http://git.netsurf-browser.org/netsurf.git/commit/eb7037ac4fa71a3cfe86bcb...
...tree http://git.netsurf-browser.org/netsurf.git/tree/eb7037ac4fa71a3cfe86bcb7e...
The branch, master has been updated
via eb7037ac4fa71a3cfe86bcb7e32d750b4e7c14a7 (commit)
from 44e464e98daed2e0eab9cf52446ad2ab4e9a65a6 (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 -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=eb7037ac4fa71a3cfe8...
commit eb7037ac4fa71a3cfe86bcb7e32d750b4e7c14a7
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Amiga: Do not use pre-multiplied alpha with CompositeTags() (ie. OS4 RTG)
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 6734433..8eb34fb 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -6670,12 +6670,6 @@ int main(int argc, char** argv)
win_destroyed = false;
ami_font_setdevicedpi(0); /* for early font requests, eg treeview init */
- bitmap_set_format(&(bitmap_fmt_t) {
- .layout = BITMAP_LAYOUT_ARGB8888,
- .pma = true,
- });
- NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
-
window_list = NewObjList();
urldb_load(nsoption_charp(url_file));
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index fe1e58f..8bc1712 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -126,11 +126,34 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
if(depth < 16) {
gg->palette_mapped = true;
if(force32bit == false) palette_mapped = true;
+
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
+
} else {
gg->palette_mapped = false;
- if(force32bit == false) palette_mapped = false;
+
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = false,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
+
}
#else
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
+
+
/* Friend BitMaps are weird.
* For OS4, we shouldn't use a friend BitMap here (see below).
* For OS3 AGA, we get no display blitted if we use a friend BitMap,
@@ -149,7 +172,6 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
if(force32bit == false) palette_mapped = true;
} else {
gg->palette_mapped = false;
- if(force32bit == false) palette_mapped = false;
}
#endif
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/gui.c | 6 ------
frontends/amiga/plotters.c | 26 ++++++++++++++++++++++++--
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 6734433..8eb34fb 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -6670,12 +6670,6 @@ int main(int argc, char** argv)
win_destroyed = false;
ami_font_setdevicedpi(0); /* for early font requests, eg treeview init */
- bitmap_set_format(&(bitmap_fmt_t) {
- .layout = BITMAP_LAYOUT_ARGB8888,
- .pma = true,
- });
- NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
-
window_list = NewObjList();
urldb_load(nsoption_charp(url_file));
diff --git a/frontends/amiga/plotters.c b/frontends/amiga/plotters.c
index fe1e58f..8bc1712 100644
--- a/frontends/amiga/plotters.c
+++ b/frontends/amiga/plotters.c
@@ -126,11 +126,34 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
if(depth < 16) {
gg->palette_mapped = true;
if(force32bit == false) palette_mapped = true;
+
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
+
} else {
gg->palette_mapped = false;
- if(force32bit == false) palette_mapped = false;
+
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = false,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
+
}
#else
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian) (PMA)");
+
+
/* Friend BitMaps are weird.
* For OS4, we shouldn't use a friend BitMap here (see below).
* For OS3 AGA, we get no display blitted if we use a friend BitMap,
@@ -149,7 +172,6 @@ struct gui_globals *ami_plot_ra_alloc(ULONG width, ULONG height, bool force32bit
if(force32bit == false) palette_mapped = true;
} else {
gg->palette_mapped = false;
- if(force32bit == false) palette_mapped = false;
}
#endif
--
NetSurf Browser
1 year, 5 months
netsurf: branch master updated. release/3.10-234-g44e464e
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/44e464e98daed2e0eab9c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/44e464e98daed2e0eab9cf5...
...tree http://git.netsurf-browser.org/netsurf.git/tree/44e464e98daed2e0eab9cf524...
The branch, master has been updated
via 44e464e98daed2e0eab9cf52446ad2ab4e9a65a6 (commit)
from 7d5c449389162c3b11cecc0b4a969d50a693c8b1 (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 -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=44e464e98daed2e0eab...
commit 44e464e98daed2e0eab9cf52446ad2ab4e9a65a6
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Amiga: Use ARGB format bitmaps
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index cd2667b..e8534a3 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -347,26 +347,6 @@ int bitmap_get_height(void *bitmap)
}
}
-static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[i] << 8) | (data[i] >> 24);
- }
-}
-
-static void ami_bitmap_rgba_to_argb(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[ i] >> 8) | (data[i] << 24);
- }
-}
-
#ifdef BITMAP_DUMP
void bitmap_dump(struct bitmap *bitmap)
{
@@ -416,7 +396,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
TAG_DONE);
IDoMethod(dto, PDTM_WRITEPIXELARRAY, amiga_bitmap_get_buffer(bitmap),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bitmap), 0, 0,
+ PBPAFMT_ARGB, amiga_bitmap_get_rowstride(bitmap), 0, 0,
bitmap_get_width(bitmap), bitmap_get_height(bitmap));
}
@@ -441,7 +421,7 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
bm = amiga_bitmap_create(bmh->bmh_Width, bmh->bmh_Height, 0);
IDoMethod(dto, PDTM_READPIXELARRAY, amiga_bitmap_get_buffer(bm),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bm), 0, 0,
+ PBPAFMT_ARGB, amiga_bitmap_get_rowstride(bm), 0, 0,
bmh->bmh_Width, bmh->bmh_Height);
amiga_bitmap_set_opaque(bm, bitmap_test_opaque(bm));
@@ -497,7 +477,6 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
dithermode = DITHERMODE_FS;
}
- ami_bitmap_rgba_to_argb(bitmap);
bitmap->drawhandle = ObtainDrawHandle(
NULL,
&rp,
@@ -514,7 +493,6 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
ReleaseDrawHandle(bitmap->drawhandle);
bitmap->drawhandle = NULL;
}
- ami_bitmap_argb_to_rgba(bitmap);
} else {
if(guigfx_warned == false) {
amiga_warn_user("BMConvErr", NULL);
@@ -664,7 +642,7 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
for(y=0; y<height; y++) {
for(x=0; x<width; x++) {
- if ((*bmi & 0x000000ffU) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
+ if ((*bmi & 0xff000000U) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
else maskbit = 1;
bmi++;
bitmap->native_mask[(y*bpr) + (x/8)] |=
@@ -741,8 +719,6 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte
BLITA_DestY, 0,
TAG_DONE);
- ami_bitmap_argb_to_rgba(bitmap);
-
/**\todo In theory we should be able to move the bitmap to our native area
to try to avoid re-conversion (at the expense of memory) */
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 8e7bcbc..a7dc919 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -27,7 +27,7 @@
#include "netsurf/bitmap.h"
-#define AMI_BITMAP_FORMAT RGBFB_R8G8B8A8
+#define AMI_BITMAP_FORMAT RGBFB_A8R8G8B8
#define AMI_BITMAP_SCALE_ICON 0xFF
extern struct gui_bitmap_table *amiga_bitmap_table;
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 8eb34fb..6734433 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -6670,6 +6670,12 @@ int main(int argc, char** argv)
win_destroyed = false;
ami_font_setdevicedpi(0); /* for early font requests, eg treeview init */
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
+
window_list = NewObjList();
urldb_load(nsoption_charp(url_file));
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/bitmap.c | 30 +++---------------------------
frontends/amiga/bitmap.h | 2 +-
frontends/amiga/gui.c | 6 ++++++
3 files changed, 10 insertions(+), 28 deletions(-)
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index cd2667b..e8534a3 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -347,26 +347,6 @@ int bitmap_get_height(void *bitmap)
}
}
-static void ami_bitmap_argb_to_rgba(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[i] << 8) | (data[i] >> 24);
- }
-}
-
-static void ami_bitmap_rgba_to_argb(struct bitmap *bm)
-{
- if(bm == NULL) return;
-
- ULONG *data = (ULONG *)amiga_bitmap_get_buffer(bm);
- for(int i = 0; i < (bm->width * bm->height); i++) {
- data[i] = (data[ i] >> 8) | (data[i] << 24);
- }
-}
-
#ifdef BITMAP_DUMP
void bitmap_dump(struct bitmap *bitmap)
{
@@ -416,7 +396,7 @@ Object *ami_datatype_object_from_bitmap(struct bitmap *bitmap)
TAG_DONE);
IDoMethod(dto, PDTM_WRITEPIXELARRAY, amiga_bitmap_get_buffer(bitmap),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bitmap), 0, 0,
+ PBPAFMT_ARGB, amiga_bitmap_get_rowstride(bitmap), 0, 0,
bitmap_get_width(bitmap), bitmap_get_height(bitmap));
}
@@ -441,7 +421,7 @@ struct bitmap *ami_bitmap_from_datatype(char *filename)
bm = amiga_bitmap_create(bmh->bmh_Width, bmh->bmh_Height, 0);
IDoMethod(dto, PDTM_READPIXELARRAY, amiga_bitmap_get_buffer(bm),
- PBPAFMT_RGBA, amiga_bitmap_get_rowstride(bm), 0, 0,
+ PBPAFMT_ARGB, amiga_bitmap_get_rowstride(bm), 0, 0,
bmh->bmh_Width, bmh->bmh_Height);
amiga_bitmap_set_opaque(bm, bitmap_test_opaque(bm));
@@ -497,7 +477,6 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
dithermode = DITHERMODE_FS;
}
- ami_bitmap_rgba_to_argb(bitmap);
bitmap->drawhandle = ObtainDrawHandle(
NULL,
&rp,
@@ -514,7 +493,6 @@ static inline struct BitMap *ami_bitmap_get_generic(struct bitmap *bitmap,
ReleaseDrawHandle(bitmap->drawhandle);
bitmap->drawhandle = NULL;
}
- ami_bitmap_argb_to_rgba(bitmap);
} else {
if(guigfx_warned == false) {
amiga_warn_user("BMConvErr", NULL);
@@ -664,7 +642,7 @@ PLANEPTR ami_bitmap_get_mask(struct bitmap *bitmap, int width,
for(y=0; y<height; y++) {
for(x=0; x<width; x++) {
- if ((*bmi & 0x000000ffU) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
+ if ((*bmi & 0xff000000U) <= (ULONG)nsoption_int(mask_alpha)) maskbit = 0;
else maskbit = 1;
bmi++;
bitmap->native_mask[(y*bpr) + (x/8)] |=
@@ -741,8 +719,6 @@ static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *conte
BLITA_DestY, 0,
TAG_DONE);
- ami_bitmap_argb_to_rgba(bitmap);
-
/**\todo In theory we should be able to move the bitmap to our native area
to try to avoid re-conversion (at the expense of memory) */
diff --git a/frontends/amiga/bitmap.h b/frontends/amiga/bitmap.h
index 8e7bcbc..a7dc919 100755
--- a/frontends/amiga/bitmap.h
+++ b/frontends/amiga/bitmap.h
@@ -27,7 +27,7 @@
#include "netsurf/bitmap.h"
-#define AMI_BITMAP_FORMAT RGBFB_R8G8B8A8
+#define AMI_BITMAP_FORMAT RGBFB_A8R8G8B8
#define AMI_BITMAP_SCALE_ICON 0xFF
extern struct gui_bitmap_table *amiga_bitmap_table;
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 8eb34fb..6734433 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -6670,6 +6670,12 @@ int main(int argc, char** argv)
win_destroyed = false;
ami_font_setdevicedpi(0); /* for early font requests, eg treeview init */
+ bitmap_set_format(&(bitmap_fmt_t) {
+ .layout = BITMAP_LAYOUT_ARGB8888,
+ .pma = true,
+ });
+ NSLOG(netsurf, INFO, "Set bitmap format to 0xAARRGGBB (native endian)");
+
window_list = NewObjList();
urldb_load(nsoption_charp(url_file));
--
NetSurf Browser
1 year, 5 months