mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 08:55:11 +01:00
Move num_loops out of the image_config
For the GIF format, it isn't necessarily before the first frame.
This commit is contained in:
1 parent
36fd9cfd31
commit
7be9c39283
10 files changed
+187
-65
No files matched your search
@@ -453,7 +453,6 @@ typedef struct {
|
|||||||
struct {
|
struct {
|
||||||
wuffs_base__range_ii_u64 workbuf_len;
|
wuffs_base__range_ii_u64 workbuf_len;
|
||||||
uint64_t first_frame_io_position;
|
uint64_t first_frame_io_position;
|
||||||
uint32_t num_loops;
|
|
||||||
bool first_frame_is_opaque;
|
bool first_frame_is_opaque;
|
||||||
} private_impl;
|
} private_impl;
|
||||||
|
|
||||||
@@ -464,13 +463,11 @@ typedef struct {
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint64_t workbuf_len0,
|
uint64_t workbuf_len0,
|
||||||
uint64_t workbuf_len1,
|
uint64_t workbuf_len1,
|
||||||
uint32_t num_loops,
|
|
||||||
uint64_t first_frame_io_position,
|
uint64_t first_frame_io_position,
|
||||||
bool first_frame_is_opaque);
|
bool first_frame_is_opaque);
|
||||||
inline void invalidate();
|
inline void invalidate();
|
||||||
inline bool is_valid();
|
inline bool is_valid();
|
||||||
inline wuffs_base__range_ii_u64 workbuf_len();
|
inline wuffs_base__range_ii_u64 workbuf_len();
|
||||||
inline uint32_t num_loops();
|
|
||||||
inline uint64_t first_frame_io_position();
|
inline uint64_t first_frame_io_position();
|
||||||
inline bool first_frame_is_opaque();
|
inline bool first_frame_is_opaque();
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
@@ -486,7 +483,6 @@ wuffs_base__image_config__initialize(wuffs_base__image_config* c,
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint64_t workbuf_len0,
|
uint64_t workbuf_len0,
|
||||||
uint64_t workbuf_len1,
|
uint64_t workbuf_len1,
|
||||||
uint32_t num_loops,
|
|
||||||
uint64_t first_frame_io_position,
|
uint64_t first_frame_io_position,
|
||||||
bool first_frame_is_opaque) {
|
bool first_frame_is_opaque) {
|
||||||
if (!c) {
|
if (!c) {
|
||||||
@@ -500,7 +496,6 @@ wuffs_base__image_config__initialize(wuffs_base__image_config* c,
|
|||||||
c->private_impl.workbuf_len.min_incl = workbuf_len0;
|
c->private_impl.workbuf_len.min_incl = workbuf_len0;
|
||||||
c->private_impl.workbuf_len.max_incl = workbuf_len1;
|
c->private_impl.workbuf_len.max_incl = workbuf_len1;
|
||||||
c->private_impl.first_frame_io_position = first_frame_io_position;
|
c->private_impl.first_frame_io_position = first_frame_io_position;
|
||||||
c->private_impl.num_loops = num_loops;
|
|
||||||
c->private_impl.first_frame_is_opaque = first_frame_is_opaque;
|
c->private_impl.first_frame_is_opaque = first_frame_is_opaque;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -524,11 +519,6 @@ wuffs_base__image_config__workbuf_len(wuffs_base__image_config* c) {
|
|||||||
return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});
|
return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t //
|
|
||||||
wuffs_base__image_config__num_loops(wuffs_base__image_config* c) {
|
|
||||||
return c ? c->private_impl.num_loops : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t //
|
static inline uint64_t //
|
||||||
wuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {
|
wuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {
|
||||||
return c ? c->private_impl.first_frame_io_position : 0;
|
return c ? c->private_impl.first_frame_io_position : 0;
|
||||||
@@ -548,12 +538,11 @@ wuffs_base__image_config::initialize(wuffs_base__pixel_format pixfmt,
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint64_t workbuf_len0,
|
uint64_t workbuf_len0,
|
||||||
uint64_t workbuf_len1,
|
uint64_t workbuf_len1,
|
||||||
uint32_t num_loops,
|
|
||||||
uint64_t first_frame_io_position,
|
uint64_t first_frame_io_position,
|
||||||
bool first_frame_is_opaque) {
|
bool first_frame_is_opaque) {
|
||||||
wuffs_base__image_config__initialize(
|
wuffs_base__image_config__initialize(
|
||||||
this, pixfmt, pixsub, width, height, workbuf_len0, workbuf_len1,
|
this, pixfmt, pixsub, width, height, workbuf_len0, workbuf_len1,
|
||||||
num_loops, first_frame_io_position, first_frame_is_opaque);
|
first_frame_io_position, first_frame_is_opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void //
|
inline void //
|
||||||
@@ -571,11 +560,6 @@ wuffs_base__image_config::workbuf_len() {
|
|||||||
return wuffs_base__image_config__workbuf_len(this);
|
return wuffs_base__image_config__workbuf_len(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t //
|
|
||||||
wuffs_base__image_config::num_loops() {
|
|
||||||
return wuffs_base__image_config__num_loops(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline uint64_t //
|
inline uint64_t //
|
||||||
wuffs_base__image_config::first_frame_io_position() {
|
wuffs_base__image_config::first_frame_io_position() {
|
||||||
return wuffs_base__image_config__first_frame_io_position(this);
|
return wuffs_base__image_config__first_frame_io_position(this);
|
||||||
|
|||||||
@@ -143,11 +143,11 @@ const baseImagePublicH = "" +
|
|||||||
"ent from the format's intrinsic one? For\n// example, decoding a JPEG image straight to RGBA instead of to YCbCr?\nstatic inline uint64_t //\nwuffs_base__pixel_config__pixbuf_len(wuffs_base__pixel_config* c) {\n if (c) {\n uint64_t n =\n ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height);\n // TODO: handle things other than 1 byte per pixel. When doing so, consider\n // that the +1024 below could overflow.\n if (wuffs_base__pixel_format__is_indexed(c->private_impl.pixfmt)) {\n n += 1024;\n }\n return n;\n }\n return 0;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__pixel_config::initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height) {\n wuffs_base__pixel_config__initialize(this, pixfmt, pixsub, width, height);\n}\n\ninline void //\nwuffs_base__pixel_config::invalidate() {\n wuffs_base__pixel_config__i" +
|
"ent from the format's intrinsic one? For\n// example, decoding a JPEG image straight to RGBA instead of to YCbCr?\nstatic inline uint64_t //\nwuffs_base__pixel_config__pixbuf_len(wuffs_base__pixel_config* c) {\n if (c) {\n uint64_t n =\n ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height);\n // TODO: handle things other than 1 byte per pixel. When doing so, consider\n // that the +1024 below could overflow.\n if (wuffs_base__pixel_format__is_indexed(c->private_impl.pixfmt)) {\n n += 1024;\n }\n return n;\n }\n return 0;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__pixel_config::initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height) {\n wuffs_base__pixel_config__initialize(this, pixfmt, pixsub, width, height);\n}\n\ninline void //\nwuffs_base__pixel_config::invalidate() {\n wuffs_base__pixel_config__i" +
|
||||||
"nvalidate(this);\n}\n\ninline bool //\nwuffs_base__pixel_config::is_valid() {\n return wuffs_base__pixel_config__is_valid(this);\n}\n\ninline wuffs_base__pixel_format //\nwuffs_base__pixel_config::pixel_format() {\n return wuffs_base__pixel_config__pixel_format(this);\n}\n\ninline wuffs_base__pixel_subsampling //\nwuffs_base__pixel_config::pixel_subsampling() {\n return wuffs_base__pixel_config__pixel_subsampling(this);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__pixel_config::bounds() {\n return wuffs_base__pixel_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::width() {\n return wuffs_base__pixel_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::height() {\n return wuffs_base__pixel_config__height(this);\n}\n\ninline uint64_t //\nwuffs_base__pixel_config::pixbuf_len() {\n return wuffs_base__pixel_config__pixbuf_len(this);\n}\n\n#endif // __cplusplus\n\n" +
|
"nvalidate(this);\n}\n\ninline bool //\nwuffs_base__pixel_config::is_valid() {\n return wuffs_base__pixel_config__is_valid(this);\n}\n\ninline wuffs_base__pixel_format //\nwuffs_base__pixel_config::pixel_format() {\n return wuffs_base__pixel_config__pixel_format(this);\n}\n\ninline wuffs_base__pixel_subsampling //\nwuffs_base__pixel_config::pixel_subsampling() {\n return wuffs_base__pixel_config__pixel_subsampling(this);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__pixel_config::bounds() {\n return wuffs_base__pixel_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::width() {\n return wuffs_base__pixel_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::height() {\n return wuffs_base__pixel_config__height(this);\n}\n\ninline uint64_t //\nwuffs_base__pixel_config::pixbuf_len() {\n return wuffs_base__pixel_config__pixbuf_len(this);\n}\n\n#endif // __cplusplus\n\n" +
|
||||||
"" +
|
"" +
|
||||||
"// --------\n\ntypedef struct {\n wuffs_base__pixel_config pixcfg;\n\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__range_ii_u64 workbuf_len;\n uint64_t first_frame_io_position;\n uint32_t num_loops;\n bool first_frame_is_opaque;\n } private_impl;\n\n#ifdef __cplusplus\n inline void initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque);\n inline void invalidate();\n inline bool is_valid();\n inline wuffs_base__range_ii_u64 workbuf_len();\n inline uint32_t num_loops();\n inline uint64_t first_frame_io_position();\n inline" +
|
"// --------\n\ntypedef struct {\n wuffs_base__pixel_config pixcfg;\n\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__range_ii_u64 workbuf_len;\n uint64_t first_frame_io_position;\n bool first_frame_is_opaque;\n } private_impl;\n\n#ifdef __cplusplus\n inline void initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque);\n inline void invalidate();\n inline bool is_valid();\n inline wuffs_base__range_ii_u64 workbuf_len();\n inline uint64_t first_frame_io_position();\n inline bool first_frame_is_opaque();\n#endif // __cplusplus\n\n} wuffs_base__image_config;\n\n// TODO: Should " +
|
||||||
" bool first_frame_is_opaque();\n#endif // __cplusplus\n\n} wuffs_base__image_config;\n\n// TODO: Should this function return bool? An error type?\nstatic inline void //\nwuffs_base__image_config__initialize(wuffs_base__image_config* c,\n wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n if (!c) {\n return;\n }\n if (wuffs_base__pixel_format__is_valid(pixfmt)) {\n c->pixcfg.private_impl.pixfmt = pixfmt;\n c->pixcfg.private_impl.pixsub = pixsub;\n c->pixcfg.private_impl.width = width;\n c->pixcfg.pr" +
|
"this function return bool? An error type?\nstatic inline void //\nwuffs_base__image_config__initialize(wuffs_base__image_config* c,\n wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n if (!c) {\n return;\n }\n if (wuffs_base__pixel_format__is_valid(pixfmt)) {\n c->pixcfg.private_impl.pixfmt = pixfmt;\n c->pixcfg.private_impl.pixsub = pixsub;\n c->pixcfg.private_impl.width = width;\n c->pixcfg.private_impl.height = height;\n c->private_impl.workbuf_len.min_incl = workbuf_len0;\n c->private_impl.workbuf_len.max_incl = workbuf_len1;\n c->private_" +
|
||||||
"ivate_impl.height = height;\n c->private_impl.workbuf_len.min_incl = workbuf_len0;\n c->private_impl.workbuf_len.max_incl = workbuf_len1;\n c->private_impl.first_frame_io_position = first_frame_io_position;\n c->private_impl.num_loops = num_loops;\n c->private_impl.first_frame_is_opaque = first_frame_is_opaque;\n return;\n }\n *c = ((wuffs_base__image_config){});\n}\n\nstatic inline void //\nwuffs_base__image_config__invalidate(wuffs_base__image_config* c) {\n if (c) {\n *c = ((wuffs_base__image_config){});\n }\n}\n\nstatic inline bool //\nwuffs_base__image_config__is_valid(wuffs_base__image_config* c) {\n return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg));\n}\n\nstatic inline wuffs_base__range_ii_u64 //\nwuffs_base__image_config__workbuf_len(wuffs_base__image_config* c) {\n return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});\n}\n\nstatic inline uint32_t //\nwuffs_base__image_config__num_loops(wuffs_base__image_config* c) {\n return c ? c->private_impl.num_loops : 0;\n}\n\nstatic" +
|
"impl.first_frame_io_position = first_frame_io_position;\n c->private_impl.first_frame_is_opaque = first_frame_is_opaque;\n return;\n }\n *c = ((wuffs_base__image_config){});\n}\n\nstatic inline void //\nwuffs_base__image_config__invalidate(wuffs_base__image_config* c) {\n if (c) {\n *c = ((wuffs_base__image_config){});\n }\n}\n\nstatic inline bool //\nwuffs_base__image_config__is_valid(wuffs_base__image_config* c) {\n return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg));\n}\n\nstatic inline wuffs_base__range_ii_u64 //\nwuffs_base__image_config__workbuf_len(wuffs_base__image_config* c) {\n return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});\n}\n\nstatic inline uint64_t //\nwuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {\n return c ? c->private_impl.first_frame_io_position : 0;\n}\n\nstatic inline bool //\nwuffs_base__image_config__first_frame_is_opaque(wuffs_base__image_config* c) {\n return c ? c->private_impl.first_frame_is_opaque : false;\n}\n\n#ifdef __cplu" +
|
||||||
" inline uint64_t //\nwuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {\n return c ? c->private_impl.first_frame_io_position : 0;\n}\n\nstatic inline bool //\nwuffs_base__image_config__first_frame_is_opaque(wuffs_base__image_config* c) {\n return c ? c->private_impl.first_frame_is_opaque : false;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__image_config::initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint32_t num_loops,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n wuffs_base__image_config__initialize(\n this, pixfmt, pixsub, width, height, workbuf_le" +
|
"splus\n\ninline void //\nwuffs_base__image_config::initialize(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height,\n uint64_t workbuf_len0,\n uint64_t workbuf_len1,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n wuffs_base__image_config__initialize(\n this, pixfmt, pixsub, width, height, workbuf_len0, workbuf_len1,\n first_frame_io_position, first_frame_is_opaque);\n}\n\ninline void //\nwuffs_base__image_config::invalidate() {\n wuffs_base__image_config__invalidate(this);\n}\n\ninline bool //\nwuffs_base__image_config::is_valid() {\n return wuffs_base__image_config__is_valid(this);\n}\n\ninline wuffs_base__range_ii_u64 //\nwuffs_base__image_config::workbuf_len() {\n return wuffs_base__image_co" +
|
||||||
"n0, workbuf_len1,\n num_loops, first_frame_io_position, first_frame_is_opaque);\n}\n\ninline void //\nwuffs_base__image_config::invalidate() {\n wuffs_base__image_config__invalidate(this);\n}\n\ninline bool //\nwuffs_base__image_config::is_valid() {\n return wuffs_base__image_config__is_valid(this);\n}\n\ninline wuffs_base__range_ii_u64 //\nwuffs_base__image_config::workbuf_len() {\n return wuffs_base__image_config__workbuf_len(this);\n}\n\ninline uint32_t //\nwuffs_base__image_config::num_loops() {\n return wuffs_base__image_config__num_loops(this);\n}\n\ninline uint64_t //\nwuffs_base__image_config::first_frame_io_position() {\n return wuffs_base__image_config__first_frame_io_position(this);\n}\n\ninline bool //\nwuffs_base__image_config::first_frame_is_opaque() {\n return wuffs_base__image_config__first_frame_is_opaque(this);\n}\n\n#endif // __cplusplus\n\n" +
|
"nfig__workbuf_len(this);\n}\n\ninline uint64_t //\nwuffs_base__image_config::first_frame_io_position() {\n return wuffs_base__image_config__first_frame_io_position(this);\n}\n\ninline bool //\nwuffs_base__image_config::first_frame_is_opaque() {\n return wuffs_base__image_config__first_frame_is_opaque(this);\n}\n\n#endif // __cplusplus\n\n" +
|
||||||
"" +
|
"" +
|
||||||
"// --------\n\n// wuffs_base__animation_blend encodes, for an animated image, how to blend the\n// transparent pixels of this frame with the existing canvas. In Porter-Duff\n// compositing operator terminology:\n// - 0 means the frame may be transparent, and should be blended \"src over\n// dst\", also known as just \"over\".\n// - 1 means the frame may be transparent, and should be blended \"src\".\n// - 2 means the frame is completely opaque, so that \"src over dst\" and \"src\"\n// are equivalent.\n//\n// These semantics are conservative. It is valid for a completely opaque frame\n// to have a blend value other than 2.\ntypedef uint8_t wuffs_base__animation_blend;\n\n#define WUFFS_BASE__ANIMATION_BLEND__SRC_OVER_DST \\\n ((wuffs_base__animation_blend)0)\n#define WUFFS_BASE__ANIMATION_BLEND__SRC ((wuffs_base__animation_blend)1)\n#define WUFFS_BASE__ANIMATION_BLEND__OPAQUE ((wuffs_base__animation_blend)2)\n\n" +
|
"// --------\n\n// wuffs_base__animation_blend encodes, for an animated image, how to blend the\n// transparent pixels of this frame with the existing canvas. In Porter-Duff\n// compositing operator terminology:\n// - 0 means the frame may be transparent, and should be blended \"src over\n// dst\", also known as just \"over\".\n// - 1 means the frame may be transparent, and should be blended \"src\".\n// - 2 means the frame is completely opaque, so that \"src over dst\" and \"src\"\n// are equivalent.\n//\n// These semantics are conservative. It is valid for a completely opaque frame\n// to have a blend value other than 2.\ntypedef uint8_t wuffs_base__animation_blend;\n\n#define WUFFS_BASE__ANIMATION_BLEND__SRC_OVER_DST \\\n ((wuffs_base__animation_blend)0)\n#define WUFFS_BASE__ANIMATION_BLEND__SRC ((wuffs_base__animation_blend)1)\n#define WUFFS_BASE__ANIMATION_BLEND__OPAQUE ((wuffs_base__animation_blend)2)\n\n" +
|
||||||
"" +
|
"" +
|
||||||
|
|||||||
@@ -307,7 +307,6 @@ const char* play() {
|
|||||||
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src);
|
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src);
|
||||||
|
|
||||||
if (first_play) {
|
if (first_play) {
|
||||||
first_play = false;
|
|
||||||
wuffs_base__image_config ic = ((wuffs_base__image_config){});
|
wuffs_base__image_config ic = ((wuffs_base__image_config){});
|
||||||
z = wuffs_gif__decoder__decode_image_config(&dec, &ic, src_reader);
|
z = wuffs_gif__decoder__decode_image_config(&dec, &ic, src_reader);
|
||||||
if (z) {
|
if (z) {
|
||||||
@@ -331,7 +330,6 @@ const char* play() {
|
|||||||
}
|
}
|
||||||
memset(pixbuf.ptr, 0, pixbuf.len);
|
memset(pixbuf.ptr, 0, pixbuf.len);
|
||||||
memset(curr_dst_buffer, 0, dst_len);
|
memset(curr_dst_buffer, 0, dst_len);
|
||||||
num_loops_remaining = wuffs_base__image_config__num_loops(&ic);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -404,6 +402,12 @@ const char* play() {
|
|||||||
|
|
||||||
// TODO: should a zero duration mean to show this frame forever?
|
// TODO: should a zero duration mean to show this frame forever?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (first_play) {
|
||||||
|
first_play = false;
|
||||||
|
num_loops_remaining = wuffs_gif__decoder__num_animation_loops(&dec);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ var Funcs = []string{
|
|||||||
// ---- image_config
|
// ---- image_config
|
||||||
|
|
||||||
"image_config.initialize!(pixfmt u32, pixsub u32, width u32, height u32, " +
|
"image_config.initialize!(pixfmt u32, pixsub u32, width u32, height u32, " +
|
||||||
"workbuf_len0 u64, workbuf_len1 u64, num_loops u32, " +
|
"workbuf_len0 u64, workbuf_len1 u64, " +
|
||||||
"first_frame_io_position u64, first_frame_is_opaque bool)",
|
"first_frame_io_position u64, first_frame_is_opaque bool)",
|
||||||
|
|
||||||
// ---- pixel_buffer
|
// ---- pixel_buffer
|
||||||
|
|||||||
@@ -1721,7 +1721,6 @@ typedef struct {
|
|||||||
struct {
|
struct {
|
||||||
wuffs_base__range_ii_u64 workbuf_len;
|
wuffs_base__range_ii_u64 workbuf_len;
|
||||||
uint64_t first_frame_io_position;
|
uint64_t first_frame_io_position;
|
||||||
uint32_t num_loops;
|
|
||||||
bool first_frame_is_opaque;
|
bool first_frame_is_opaque;
|
||||||
} private_impl;
|
} private_impl;
|
||||||
|
|
||||||
@@ -1732,13 +1731,11 @@ typedef struct {
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint64_t workbuf_len0,
|
uint64_t workbuf_len0,
|
||||||
uint64_t workbuf_len1,
|
uint64_t workbuf_len1,
|
||||||
uint32_t num_loops,
|
|
||||||
uint64_t first_frame_io_position,
|
uint64_t first_frame_io_position,
|
||||||
bool first_frame_is_opaque);
|
bool first_frame_is_opaque);
|
||||||
inline void invalidate();
|
inline void invalidate();
|
||||||
inline bool is_valid();
|
inline bool is_valid();
|
||||||
inline wuffs_base__range_ii_u64 workbuf_len();
|
inline wuffs_base__range_ii_u64 workbuf_len();
|
||||||
inline uint32_t num_loops();
|
|
||||||
inline uint64_t first_frame_io_position();
|
inline uint64_t first_frame_io_position();
|
||||||
inline bool first_frame_is_opaque();
|
inline bool first_frame_is_opaque();
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
@@ -1754,7 +1751,6 @@ wuffs_base__image_config__initialize(wuffs_base__image_config* c,
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint64_t workbuf_len0,
|
uint64_t workbuf_len0,
|
||||||
uint64_t workbuf_len1,
|
uint64_t workbuf_len1,
|
||||||
uint32_t num_loops,
|
|
||||||
uint64_t first_frame_io_position,
|
uint64_t first_frame_io_position,
|
||||||
bool first_frame_is_opaque) {
|
bool first_frame_is_opaque) {
|
||||||
if (!c) {
|
if (!c) {
|
||||||
@@ -1768,7 +1764,6 @@ wuffs_base__image_config__initialize(wuffs_base__image_config* c,
|
|||||||
c->private_impl.workbuf_len.min_incl = workbuf_len0;
|
c->private_impl.workbuf_len.min_incl = workbuf_len0;
|
||||||
c->private_impl.workbuf_len.max_incl = workbuf_len1;
|
c->private_impl.workbuf_len.max_incl = workbuf_len1;
|
||||||
c->private_impl.first_frame_io_position = first_frame_io_position;
|
c->private_impl.first_frame_io_position = first_frame_io_position;
|
||||||
c->private_impl.num_loops = num_loops;
|
|
||||||
c->private_impl.first_frame_is_opaque = first_frame_is_opaque;
|
c->private_impl.first_frame_is_opaque = first_frame_is_opaque;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1792,11 +1787,6 @@ wuffs_base__image_config__workbuf_len(wuffs_base__image_config* c) {
|
|||||||
return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});
|
return c ? c->private_impl.workbuf_len : ((wuffs_base__range_ii_u64){});
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint32_t //
|
|
||||||
wuffs_base__image_config__num_loops(wuffs_base__image_config* c) {
|
|
||||||
return c ? c->private_impl.num_loops : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline uint64_t //
|
static inline uint64_t //
|
||||||
wuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {
|
wuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {
|
||||||
return c ? c->private_impl.first_frame_io_position : 0;
|
return c ? c->private_impl.first_frame_io_position : 0;
|
||||||
@@ -1816,12 +1806,11 @@ wuffs_base__image_config::initialize(wuffs_base__pixel_format pixfmt,
|
|||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint64_t workbuf_len0,
|
uint64_t workbuf_len0,
|
||||||
uint64_t workbuf_len1,
|
uint64_t workbuf_len1,
|
||||||
uint32_t num_loops,
|
|
||||||
uint64_t first_frame_io_position,
|
uint64_t first_frame_io_position,
|
||||||
bool first_frame_is_opaque) {
|
bool first_frame_is_opaque) {
|
||||||
wuffs_base__image_config__initialize(
|
wuffs_base__image_config__initialize(
|
||||||
this, pixfmt, pixsub, width, height, workbuf_len0, workbuf_len1,
|
this, pixfmt, pixsub, width, height, workbuf_len0, workbuf_len1,
|
||||||
num_loops, first_frame_io_position, first_frame_is_opaque);
|
first_frame_io_position, first_frame_is_opaque);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void //
|
inline void //
|
||||||
@@ -1839,11 +1828,6 @@ wuffs_base__image_config::workbuf_len() {
|
|||||||
return wuffs_base__image_config__workbuf_len(this);
|
return wuffs_base__image_config__workbuf_len(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t //
|
|
||||||
wuffs_base__image_config::num_loops() {
|
|
||||||
return wuffs_base__image_config__num_loops(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline uint64_t //
|
inline uint64_t //
|
||||||
wuffs_base__image_config::first_frame_io_position() {
|
wuffs_base__image_config::first_frame_io_position() {
|
||||||
return wuffs_base__image_config__first_frame_io_position(this);
|
return wuffs_base__image_config__first_frame_io_position(this);
|
||||||
@@ -2678,6 +2662,9 @@ wuffs_gif__decoder__decode_image_config(wuffs_gif__decoder* self,
|
|||||||
wuffs_base__image_config* a_dst,
|
wuffs_base__image_config* a_dst,
|
||||||
wuffs_base__io_reader a_src);
|
wuffs_base__io_reader a_src);
|
||||||
|
|
||||||
|
WUFFS_BASE__MAYBE_STATIC uint32_t //
|
||||||
|
wuffs_gif__decoder__num_animation_loops(wuffs_gif__decoder* self);
|
||||||
|
|
||||||
WUFFS_BASE__MAYBE_STATIC uint64_t //
|
WUFFS_BASE__MAYBE_STATIC uint64_t //
|
||||||
wuffs_gif__decoder__num_decoded_frame_configs(wuffs_gif__decoder* self);
|
wuffs_gif__decoder__num_decoded_frame_configs(wuffs_gif__decoder* self);
|
||||||
|
|
||||||
@@ -2757,7 +2744,6 @@ struct wuffs_gif__decoder__struct {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t coro_susp_point;
|
uint32_t coro_susp_point;
|
||||||
uint32_t v_num_loops;
|
|
||||||
bool v_ffio;
|
bool v_ffio;
|
||||||
} c_decode_image_config[1];
|
} c_decode_image_config[1];
|
||||||
struct {
|
struct {
|
||||||
@@ -2844,6 +2830,11 @@ struct wuffs_gif__decoder__struct {
|
|||||||
return wuffs_gif__decoder__decode_image_config(this, a_dst, a_src);
|
return wuffs_gif__decoder__decode_image_config(this, a_dst, a_src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline uint32_t //
|
||||||
|
num_animation_loops() {
|
||||||
|
return wuffs_gif__decoder__num_animation_loops(this);
|
||||||
|
}
|
||||||
|
|
||||||
inline uint64_t //
|
inline uint64_t //
|
||||||
num_decoded_frame_configs() {
|
num_decoded_frame_configs() {
|
||||||
return wuffs_gif__decoder__num_decoded_frame_configs(this);
|
return wuffs_gif__decoder__num_decoded_frame_configs(this);
|
||||||
@@ -6961,13 +6952,11 @@ wuffs_gif__decoder__decode_image_config(wuffs_gif__decoder* self,
|
|||||||
}
|
}
|
||||||
wuffs_base__status status = NULL;
|
wuffs_base__status status = NULL;
|
||||||
|
|
||||||
uint32_t v_num_loops;
|
|
||||||
bool v_ffio;
|
bool v_ffio;
|
||||||
|
|
||||||
uint32_t coro_susp_point =
|
uint32_t coro_susp_point =
|
||||||
self->private_impl.c_decode_image_config[0].coro_susp_point;
|
self->private_impl.c_decode_image_config[0].coro_susp_point;
|
||||||
if (coro_susp_point) {
|
if (coro_susp_point) {
|
||||||
v_num_loops = self->private_impl.c_decode_image_config[0].v_num_loops;
|
|
||||||
v_ffio = self->private_impl.c_decode_image_config[0].v_ffio;
|
v_ffio = self->private_impl.c_decode_image_config[0].v_ffio;
|
||||||
} else {
|
} else {
|
||||||
v_ffio = false;
|
v_ffio = false;
|
||||||
@@ -6994,10 +6983,6 @@ wuffs_gif__decoder__decode_image_config(wuffs_gif__decoder* self,
|
|||||||
if (status) {
|
if (status) {
|
||||||
goto suspend;
|
goto suspend;
|
||||||
}
|
}
|
||||||
v_num_loops = 1;
|
|
||||||
if (self->private_impl.f_seen_num_loops) {
|
|
||||||
v_num_loops = self->private_impl.f_num_loops;
|
|
||||||
}
|
|
||||||
v_ffio =
|
v_ffio =
|
||||||
(!self->private_impl.f_gc_has_transparent_index &&
|
(!self->private_impl.f_gc_has_transparent_index &&
|
||||||
(self->private_impl.f_frame_rect_x0 == 0) &&
|
(self->private_impl.f_frame_rect_x0 == 0) &&
|
||||||
@@ -7008,7 +6993,7 @@ wuffs_gif__decoder__decode_image_config(wuffs_gif__decoder* self,
|
|||||||
wuffs_base__image_config__initialize(
|
wuffs_base__image_config__initialize(
|
||||||
a_dst, 570687496, 0, self->private_impl.f_width,
|
a_dst, 570687496, 0, self->private_impl.f_width,
|
||||||
self->private_impl.f_height, ((uint64_t)(self->private_impl.f_width)),
|
self->private_impl.f_height, ((uint64_t)(self->private_impl.f_width)),
|
||||||
((uint64_t)(self->private_impl.f_width)), v_num_loops,
|
((uint64_t)(self->private_impl.f_width)),
|
||||||
self->private_impl.f_frame_config_io_position, v_ffio);
|
self->private_impl.f_frame_config_io_position, v_ffio);
|
||||||
}
|
}
|
||||||
self->private_impl.f_call_sequence = 1;
|
self->private_impl.f_call_sequence = 1;
|
||||||
@@ -7022,7 +7007,6 @@ wuffs_gif__decoder__decode_image_config(wuffs_gif__decoder* self,
|
|||||||
goto suspend;
|
goto suspend;
|
||||||
suspend:
|
suspend:
|
||||||
self->private_impl.c_decode_image_config[0].coro_susp_point = coro_susp_point;
|
self->private_impl.c_decode_image_config[0].coro_susp_point = coro_susp_point;
|
||||||
self->private_impl.c_decode_image_config[0].v_num_loops = v_num_loops;
|
|
||||||
self->private_impl.c_decode_image_config[0].v_ffio = v_ffio;
|
self->private_impl.c_decode_image_config[0].v_ffio = v_ffio;
|
||||||
|
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -7033,6 +7017,23 @@ exit:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------- func gif.decoder.num_animation_loops
|
||||||
|
|
||||||
|
WUFFS_BASE__MAYBE_STATIC uint32_t //
|
||||||
|
wuffs_gif__decoder__num_animation_loops(wuffs_gif__decoder* self) {
|
||||||
|
if (!self) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self->private_impl.f_seen_num_loops) {
|
||||||
|
return self->private_impl.f_num_loops;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// -------- func gif.decoder.num_decoded_frame_configs
|
// -------- func gif.decoder.num_decoded_frame_configs
|
||||||
|
|
||||||
WUFFS_BASE__MAYBE_STATIC uint64_t //
|
WUFFS_BASE__MAYBE_STATIC uint64_t //
|
||||||
|
|||||||
@@ -502,7 +502,8 @@ var gifGlobals struct {
|
|||||||
|
|
||||||
func stateGif(line string) (stateFunc, error) {
|
func stateGif(line string) (stateFunc, error) {
|
||||||
const (
|
const (
|
||||||
cmdL = "lzw "
|
cmdL = "lzw "
|
||||||
|
cmdLC = "loopCount "
|
||||||
)
|
)
|
||||||
outer:
|
outer:
|
||||||
switch {
|
switch {
|
||||||
@@ -562,6 +563,27 @@ outer:
|
|||||||
}
|
}
|
||||||
out = append(out, 0x00)
|
out = append(out, 0x00)
|
||||||
return stateGif, nil
|
return stateGif, nil
|
||||||
|
|
||||||
|
case strings.HasPrefix(line, cmdLC):
|
||||||
|
s := line[len(cmdLC):]
|
||||||
|
loopCount, _, ok := parseNum(s)
|
||||||
|
if !ok || 0xFFFF < loopCount {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
out = append(out,
|
||||||
|
0x21, // Extension Introducer.
|
||||||
|
0xFF, // Application Extension Label.
|
||||||
|
0x0B, // Block Size.
|
||||||
|
)
|
||||||
|
out = append(out, "NETSCAPE2.0"...)
|
||||||
|
out = append(out,
|
||||||
|
0x03, // Block Size.
|
||||||
|
0x01, // Magic Number.
|
||||||
|
byte(loopCount),
|
||||||
|
byte(loopCount>>8),
|
||||||
|
0x00, // Block Terminator.
|
||||||
|
)
|
||||||
|
return stateGif, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("bad stateGif command: %q", line)
|
return nil, fmt.Errorf("bad stateGif command: %q", line)
|
||||||
|
|||||||
@@ -127,11 +127,6 @@ pub func decoder.decode_image_config!??(dst nptr base.image_config, src base.io_
|
|||||||
|
|
||||||
// TODO: if this.end_of_data, return an error and/or set dst to zero?
|
// TODO: if this.end_of_data, return an error and/or set dst to zero?
|
||||||
|
|
||||||
var num_loops base.u32 = 1
|
|
||||||
if this.seen_num_loops {
|
|
||||||
num_loops = this.num_loops
|
|
||||||
}
|
|
||||||
|
|
||||||
var ffio base.bool = (not this.gc_has_transparent_index) and
|
var ffio base.bool = (not this.gc_has_transparent_index) and
|
||||||
(this.frame_rect_x0 == 0) and
|
(this.frame_rect_x0 == 0) and
|
||||||
(this.frame_rect_y0 == 0) and
|
(this.frame_rect_y0 == 0) and
|
||||||
@@ -150,7 +145,6 @@ pub func decoder.decode_image_config!??(dst nptr base.image_config, src base.io_
|
|||||||
height:this.height,
|
height:this.height,
|
||||||
workbuf_len0:this.width as base.u64,
|
workbuf_len0:this.width as base.u64,
|
||||||
workbuf_len1:this.width as base.u64,
|
workbuf_len1:this.width as base.u64,
|
||||||
num_loops:num_loops,
|
|
||||||
first_frame_io_position:this.frame_config_io_position,
|
first_frame_io_position:this.frame_config_io_position,
|
||||||
first_frame_is_opaque:ffio)
|
first_frame_is_opaque:ffio)
|
||||||
}
|
}
|
||||||
@@ -158,6 +152,13 @@ pub func decoder.decode_image_config!??(dst nptr base.image_config, src base.io_
|
|||||||
this.call_sequence = 1
|
this.call_sequence = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub func decoder.num_animation_loops() base.u32 {
|
||||||
|
if this.seen_num_loops {
|
||||||
|
return this.num_loops
|
||||||
|
}
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
pub func decoder.num_decoded_frame_configs() base.u64 {
|
pub func decoder.num_decoded_frame_configs() base.u64 {
|
||||||
return this.num_decoded_frame_configs_value
|
return this.num_decoded_frame_configs_value
|
||||||
}
|
}
|
||||||
|
|||||||
+74
-7
@@ -294,10 +294,6 @@ const char* do_test_wuffs_gif_decode(const char* filename,
|
|||||||
RETURN_FAIL("workbuf_len: got %" PRIu64 ", want 160",
|
RETURN_FAIL("workbuf_len: got %" PRIu64 ", want 160",
|
||||||
wuffs_base__image_config__workbuf_len(&ic).max_incl);
|
wuffs_base__image_config__workbuf_len(&ic).max_incl);
|
||||||
}
|
}
|
||||||
if (wuffs_base__image_config__num_loops(&ic) != 1) {
|
|
||||||
RETURN_FAIL("num_loops: got %" PRIu32 ", want 1",
|
|
||||||
wuffs_base__image_config__num_loops(&ic));
|
|
||||||
}
|
|
||||||
if (!wuffs_base__image_config__first_frame_is_opaque(&ic)) {
|
if (!wuffs_base__image_config__first_frame_is_opaque(&ic)) {
|
||||||
RETURN_FAIL("first_frame_is_opaque: got false, want true");
|
RETURN_FAIL("first_frame_is_opaque: got false, want true");
|
||||||
}
|
}
|
||||||
@@ -306,6 +302,11 @@ const char* do_test_wuffs_gif_decode(const char* filename,
|
|||||||
if (z) {
|
if (z) {
|
||||||
RETURN_FAIL("set_from_slice: \"%s\"", z);
|
RETURN_FAIL("set_from_slice: \"%s\"", z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t got = wuffs_gif__decoder__num_animation_loops(&dec);
|
||||||
|
if (got != 1) {
|
||||||
|
RETURN_FAIL("num_animation_loops: got %" PRIu32 ", want 1", got);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wuffs_base__slice_u8 workbuf = ((wuffs_base__slice_u8){
|
wuffs_base__slice_u8 workbuf = ((wuffs_base__slice_u8){
|
||||||
@@ -504,9 +505,10 @@ const char* do_test_wuffs_gif_decode_animated(
|
|||||||
.len = workbuf_len,
|
.len = workbuf_len,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (wuffs_base__image_config__num_loops(&ic) != want_num_loops) {
|
uint32_t got_num_loops = wuffs_gif__decoder__num_animation_loops(&dec);
|
||||||
RETURN_FAIL("num_loops: got %" PRIu32 ", want %" PRIu32,
|
if (got_num_loops != want_num_loops) {
|
||||||
wuffs_base__image_config__num_loops(&ic), want_num_loops);
|
RETURN_FAIL("num_loops: got %" PRIu32 ", want %" PRIu32, got_num_loops,
|
||||||
|
want_num_loops);
|
||||||
}
|
}
|
||||||
|
|
||||||
wuffs_base__pixel_buffer pb = ((wuffs_base__pixel_buffer){});
|
wuffs_base__pixel_buffer pb = ((wuffs_base__pixel_buffer){});
|
||||||
@@ -786,6 +788,70 @@ const char* test_wuffs_gif_decode_input_is_a_png() {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* test_wuffs_gif_decode_multiple_loop_counts() {
|
||||||
|
CHECK_FOCUS(__func__);
|
||||||
|
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||||
|
.data = global_src_slice,
|
||||||
|
});
|
||||||
|
const char* z =
|
||||||
|
read_file(&src, "../../data/artificial/gif-multiple-loop-counts.gif");
|
||||||
|
if (z) {
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
|
wuffs_gif__decoder dec = ((wuffs_gif__decoder){});
|
||||||
|
z = wuffs_gif__decoder__check_wuffs_version(&dec, sizeof dec, WUFFS_VERSION);
|
||||||
|
if (z) {
|
||||||
|
RETURN_FAIL("check_wuffs_version: \"%s\"", z);
|
||||||
|
}
|
||||||
|
wuffs_base__image_config ic = ((wuffs_base__image_config){});
|
||||||
|
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src);
|
||||||
|
z = wuffs_gif__decoder__decode_image_config(&dec, &ic, src_reader);
|
||||||
|
if (z) {
|
||||||
|
RETURN_FAIL("decode_image_config: \"%s\"", z);
|
||||||
|
}
|
||||||
|
|
||||||
|
// See test/data/artificial/gif-multiple-loop-counts.gif.make-artificial.txt
|
||||||
|
// for the want_num_animation_loops source. Note that the GIF wire format's
|
||||||
|
// loop counts are the number of animation loops *after* the first play
|
||||||
|
// through, and Wuffs' are the number *including* the first play through.
|
||||||
|
|
||||||
|
uint32_t want_num_animation_loops[4] = {1, 1, 51, 31};
|
||||||
|
|
||||||
|
uint32_t i;
|
||||||
|
for (i = 0; true; i++) {
|
||||||
|
{
|
||||||
|
z = wuffs_gif__decoder__decode_frame_config(&dec, NULL, src_reader);
|
||||||
|
if (i == WUFFS_TESTLIB_ARRAY_SIZE(want_num_animation_loops)) {
|
||||||
|
if (z != wuffs_base__warning__end_of_data) {
|
||||||
|
RETURN_FAIL("decode_frame_config #%" PRIu32 ": got \"%s\"", i, z);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (z) {
|
||||||
|
RETURN_FAIL("decode_frame_config #%" PRIu32 ": got \"%s\"", i, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t got = wuffs_gif__decoder__num_animation_loops(&dec);
|
||||||
|
uint32_t want = want_num_animation_loops[i];
|
||||||
|
if (got != want) {
|
||||||
|
RETURN_FAIL("num_animation_loops #%" PRIu32 ": got %" PRIu32
|
||||||
|
", want %" PRIu32,
|
||||||
|
i, got, want);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t got = wuffs_gif__decoder__num_animation_loops(&dec);
|
||||||
|
uint32_t want = 41;
|
||||||
|
if (got != want) {
|
||||||
|
RETURN_FAIL("num_animation_loops #%" PRIu32 ": got %" PRIu32
|
||||||
|
", want %" PRIu32,
|
||||||
|
i, got, want);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
const char* do_test_wuffs_gif_num_decoded(bool frame_config) {
|
const char* do_test_wuffs_gif_num_decoded(bool frame_config) {
|
||||||
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
wuffs_base__io_buffer src = ((wuffs_base__io_buffer){
|
||||||
.data = global_src_slice,
|
.data = global_src_slice,
|
||||||
@@ -1260,6 +1326,7 @@ proc tests[] = {
|
|||||||
test_wuffs_gif_decode_input_is_a_gif_many_medium_reads, //
|
test_wuffs_gif_decode_input_is_a_gif_many_medium_reads, //
|
||||||
test_wuffs_gif_decode_input_is_a_gif_many_small_reads, //
|
test_wuffs_gif_decode_input_is_a_gif_many_small_reads, //
|
||||||
test_wuffs_gif_decode_input_is_a_png, //
|
test_wuffs_gif_decode_input_is_a_png, //
|
||||||
|
test_wuffs_gif_decode_multiple_loop_counts, //
|
||||||
test_wuffs_gif_num_decoded_frame_configs, //
|
test_wuffs_gif_num_decoded_frame_configs, //
|
||||||
test_wuffs_gif_num_decoded_frames, //
|
test_wuffs_gif_num_decoded_frames, //
|
||||||
test_wuffs_gif_io_position_one_chunk, //
|
test_wuffs_gif_io_position_one_chunk, //
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 139 B |
@@ -0,0 +1,43 @@
|
|||||||
|
# Feed this file to script/make-artificial.go
|
||||||
|
|
||||||
|
make gif
|
||||||
|
|
||||||
|
header
|
||||||
|
|
||||||
|
image {
|
||||||
|
imageWidthHeight 2 2
|
||||||
|
palette {
|
||||||
|
0x00 0x00 0xFF
|
||||||
|
0x11 0x00 0xFF
|
||||||
|
0x22 0x00 0xFF
|
||||||
|
0x33 0x00 0xFF
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
frame {
|
||||||
|
frameLeftTopWidthHeight 0 0 1 1
|
||||||
|
}
|
||||||
|
lzw 2 0x00
|
||||||
|
|
||||||
|
frame {
|
||||||
|
frameLeftTopWidthHeight 0 0 1 1
|
||||||
|
}
|
||||||
|
lzw 2 0x00
|
||||||
|
|
||||||
|
loopCount 50
|
||||||
|
|
||||||
|
frame {
|
||||||
|
frameLeftTopWidthHeight 0 0 1 1
|
||||||
|
}
|
||||||
|
lzw 2 0x00
|
||||||
|
|
||||||
|
loopCount 30
|
||||||
|
|
||||||
|
frame {
|
||||||
|
frameLeftTopWidthHeight 0 0 1 1
|
||||||
|
}
|
||||||
|
lzw 2 0x00
|
||||||
|
|
||||||
|
loopCount 40
|
||||||
|
|
||||||
|
trailer
|
||||||
Reference in new issue
Block a user