libnsgif: Update to latest upstream (#2766)
That's great! Thank you for doing this, Michael.
This commit is contained in:
parent
55723a980f
commit
0c3092fa94
@ -8,7 +8,7 @@ but within the libvips build system.
|
|||||||
Run `./update.sh` to update this copy of libnsgif from the upstream repo. It
|
Run `./update.sh` to update this copy of libnsgif from the upstream repo. It
|
||||||
will also patch libnsgif.c to prevent it modifying the input.
|
will also patch libnsgif.c to prevent it modifying the input.
|
||||||
|
|
||||||
Last updated 4 Apr 2022.
|
Last updated 15 Apr 2022.
|
||||||
|
|
||||||
# To do
|
# To do
|
||||||
|
|
||||||
|
@ -471,7 +471,8 @@ static nsgif_error nsgif__decode_complex(
|
|||||||
while (available == 0) {
|
while (available == 0) {
|
||||||
if (res != LZW_OK) {
|
if (res != LZW_OK) {
|
||||||
/* Unexpected end of frame, try to recover */
|
/* Unexpected end of frame, try to recover */
|
||||||
if (res == LZW_OK_EOD) {
|
if (res == LZW_OK_EOD ||
|
||||||
|
res == LZW_EOI_CODE) {
|
||||||
ret = NSGIF_OK;
|
ret = NSGIF_OK;
|
||||||
} else {
|
} else {
|
||||||
ret = nsgif__error_from_lzw(res);
|
ret = nsgif__error_from_lzw(res);
|
||||||
@ -524,7 +525,7 @@ static nsgif_error nsgif__decode_simple(
|
|||||||
uint32_t *restrict frame_data,
|
uint32_t *restrict frame_data,
|
||||||
uint32_t *restrict colour_table)
|
uint32_t *restrict colour_table)
|
||||||
{
|
{
|
||||||
uint32_t pixels = gif->info.width * height;
|
uint32_t pixels;
|
||||||
uint32_t written = 0;
|
uint32_t written = 0;
|
||||||
nsgif_error ret = NSGIF_OK;
|
nsgif_error ret = NSGIF_OK;
|
||||||
lzw_result res;
|
lzw_result res;
|
||||||
@ -549,6 +550,7 @@ static nsgif_error nsgif__decode_simple(
|
|||||||
}
|
}
|
||||||
|
|
||||||
frame_data += (offset_y * gif->info.width);
|
frame_data += (offset_y * gif->info.width);
|
||||||
|
pixels = gif->info.width * height;
|
||||||
|
|
||||||
while (pixels > 0) {
|
while (pixels > 0) {
|
||||||
res = lzw_decode_map(gif->lzw_ctx,
|
res = lzw_decode_map(gif->lzw_ctx,
|
||||||
@ -557,7 +559,7 @@ static nsgif_error nsgif__decode_simple(
|
|||||||
frame_data += written;
|
frame_data += written;
|
||||||
if (res != LZW_OK) {
|
if (res != LZW_OK) {
|
||||||
/* Unexpected end of frame, try to recover */
|
/* Unexpected end of frame, try to recover */
|
||||||
if (res == LZW_OK_EOD) {
|
if (res == LZW_OK_EOD || res == LZW_EOI_CODE) {
|
||||||
ret = NSGIF_OK;
|
ret = NSGIF_OK;
|
||||||
} else {
|
} else {
|
||||||
ret = nsgif__error_from_lzw(res);
|
ret = nsgif__error_from_lzw(res);
|
||||||
|
@ -149,11 +149,12 @@ static void print_gif_info(const nsgif_info_t *info)
|
|||||||
fprintf(stdout, " frames:\n");
|
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);
|
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, " transparency: %s\n", info->transparency ? "yes" : "no");
|
||||||
fprintf(stdout, " display: %s\n", info->display ? "yes" : "no");
|
fprintf(stdout, " display: %s\n", info->display ? "yes" : "no");
|
||||||
fprintf(stdout, " delay: %"PRIu32"\n", info->delay);
|
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);
|
f_info = nsgif_get_frame_info(gif, frame_new);
|
||||||
if (f_info != NULL) {
|
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);
|
err = nsgif_frame_decode(gif, frame_new, &bitmap);
|
||||||
if (err != NSGIF_OK) {
|
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. */
|
/* Continue decoding the rest of the frames. */
|
||||||
|
|
||||||
} else if (ppm != NULL) {
|
} else if (ppm != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user