ref: d89f78a5cb864865e102192f5a44d6b149f0bf71
parent: d489de65d56c8277d5b078759c20a921f429cd63
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Wed Dec 1 14:40:05 EST 2004
Trial implementation of separate GR_stats for refinement arithmetic coding. git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@343 ded80894-8fb9-0310-811b-c03f3676ab4d
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -206,7 +206,8 @@
Jbig2Segment *segment,
const Jbig2SymbolDictParams *params,
const byte *data, size_t size,
- Jbig2ArithCx *GB_stats)
+ Jbig2ArithCx *GB_stats,
+ Jbig2ArithCx *GR_stats)
{
Jbig2SymbolDict *SDNEWSYMS;
Jbig2SymbolDict *SDEXSYMS;
@@ -396,7 +397,7 @@
rparams.TPGRON = 0;
memcpy(rparams.grat, params->sdrat, 4);
jbig2_decode_refinement_region(ctx, segment,
- &rparams, as, image, GB_stats);
+ &rparams, as, image, GR_stats);
SDNEWSYMS->glyphs[NSYMSDECODED] = image;
@@ -484,6 +485,7 @@
int sdat_bytes;
int offset;
Jbig2ArithCx *GB_stats = NULL;
+ Jbig2ArithCx *GR_stats = NULL;
if (segment->data_length < 10)
goto too_short;
@@ -570,6 +572,11 @@
params.SDTEMPLATE == 1 ? 8192 : 1024;
GB_stats = jbig2_alloc(ctx->allocator, stats_size);
memset(GB_stats, 0, stats_size);
+ if (!params.SDRTEMPLATE) {
+ stats_size = params.SDRTEMPLATE ? 1 << 1 : 1 << 13;
+ GR_stats = jbig2_alloc(ctx->allocator, stats_size);
+ memset(GR_stats, 0, stats_size);
+ }
}
if (flags & 0x0100) {
@@ -581,12 +588,12 @@
¶ms,
segment_data + offset,
segment->data_length - offset,
- GB_stats);
+ GB_stats, GR_stats);
#ifdef DUMP_SYMDICT
if (segment->result) jbig2_dump_symbol_dict(ctx, segment);
#endif
- /* todo: retain or free GB_stats */
+ /* todo: retain or free GB_stats, GR_stats */
return (segment->result != NULL) ? 0 : -1;