ref: 6a010f34acdd98de7da5ba2dde41c3f9d6178bbb
parent: 281958c01ba5b205e1d70a0babe7599c6e896a16
author: Sebastian Rasmussen <[email protected]>
date: Sat Apr 21 19:36:54 EDT 2018
jbig2dec: Differentiate error messages in generic region decoder. This makes it easier to know from where the error message originated.
--- a/jbig2_generic.c
+++ b/jbig2_generic.c
@@ -99,7 +99,7 @@
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template0");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template0 optimized");
result |= bit << (7 - x_minor);
CONTEXT = ((CONTEXT & 0x7bf7) << 1) | bit | ((line_m1 >> (7 - x_minor)) & 0x10) | ((line_m2 >> (7 - x_minor)) & 0x800);
}
@@ -159,7 +159,7 @@
CONTEXT |= jbig2_image_get_pixel(image, x + params->gbat[6], y + params->gbat[7]) << 15;
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template0");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template0 unoptimized");
jbig2_image_set_pixel(image, x, y, bit);
}
}
@@ -202,7 +202,7 @@
CONTEXT |= jbig2_image_get_pixel(image, x - 1, y - 2) << 12;
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template0");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template1 unoptimized");
jbig2_image_set_pixel(image, x, y, bit);
}
}
@@ -256,7 +256,7 @@
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template1");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template1 optimized");
result |= bit << (7 - x_minor);
CONTEXT = ((CONTEXT & 0xefb) << 1) | bit | ((line_m1 >> (8 - x_minor)) & 0x8) | ((line_m2 >> (8 - x_minor)) & 0x200);
}
@@ -304,7 +304,7 @@
CONTEXT |= jbig2_image_get_pixel(image, x - 1, y - 2) << 9;
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template0");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template2 unoptimized");
jbig2_image_set_pixel(image, x, y, bit);
}
}
@@ -359,7 +359,7 @@
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template2a");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template2 optimized");
result |= bit << (7 - x_minor);
CONTEXT = ((CONTEXT & 0x1bd) << 1) | bit | ((line_m1 >> (10 - x_minor)) & 0x4) | ((line_m2 >> (10 - x_minor)) & 0x80);
}
@@ -416,7 +416,7 @@
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template3");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template3 optimized");
result |= bit << (7 - x_minor);
CONTEXT = ((CONTEXT & 0x1f7) << 1) | bit | ((line_m1 >> (8 - x_minor)) & 0x10);
}
@@ -464,7 +464,7 @@
CONTEXT |= jbig2_image_get_pixel(image, x - 3, y - 1) << 9;
bit = jbig2_arith_decode(as, &GB_stats[CONTEXT], &code);
if (code)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template3");
+ return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode arithmetic code when handling generic template3 unoptimized");
jbig2_image_set_pixel(image, x, y, bit);
}
}