summaryrefslogtreecommitdiffstats
path: root/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp')
-rw-r--r--kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp b/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp
index 8abefffe..054d4e09 100644
--- a/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp
+++ b/kviewshell/plugins/djvu/libdjvu/JB2EncodeCodec.cpp
@@ -104,13 +104,13 @@ public:
protected:
void CodeNum(const int num, const int lo, const int hi, NumContext &ctx);
- void encode_libonly_tqshape(const GP<JB2Image> &jim, int tqshapeno);
+ void encode_libonly_shape(const GP<JB2Image> &jim, int shapeno);
// virtual
bool CodeBit(const bool bit, BitContext &ctx);
void code_comment(GUTF8String &comment);
void code_record_type(int &rectype);
int code_match_index(int &index, JB2Dict &jim);
- void code_inherited_tqshape_count(JB2Dict &jim);
+ void code_inherited_shape_count(JB2Dict &jim);
void code_image_size(JB2Dict &jim);
void code_image_size(JB2Image &jim);
void code_absolute_location(JB2Blit *jblt, int rows, int columns);
@@ -228,18 +228,18 @@ JB2Dict::JB2Codec::Encode::code_record_type(int &rectype)
int
JB2Dict::JB2Codec::Encode::code_match_index(int &index, JB2Dict &jim)
{
- int match=tqshape2lib[index];
- CodeNum(match, 0, lib2tqshape.hbound(), dist_match_index);
+ int match=shape2lib[index];
+ CodeNum(match, 0, lib2shape.hbound(), dist_match_index);
return match;
}
// CODE PAIRS
void
-JB2Dict::JB2Codec::Encode::code_inherited_tqshape_count(JB2Dict &jim)
+JB2Dict::JB2Codec::Encode::code_inherited_shape_count(JB2Dict &jim)
{
- CodeNum(jim.get_inherited_tqshape_count(),
- 0, BIGPOSITIVE, inherited_tqshape_count_dist);
+ CodeNum(jim.get_inherited_shape_count(),
+ 0, BIGPOSITIVE, inherited_shape_count_dist);
}
void
@@ -360,12 +360,12 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Dict> &gjim)
// -------------------------
// THIS IS THE ENCODING PART
// -------------------------
- int firsttqshape = jim.get_inherited_tqshape_count();
- int ntqshape = jim.get_tqshape_count();
+ int firstshape = jim.get_inherited_shape_count();
+ int nshape = jim.get_shape_count();
init_library(jim);
// Code headers.
int rectype = RETQUIRED_DICT_OR_RESET;
- if (jim.get_inherited_tqshape_count() > 0)
+ if (jim.get_inherited_shape_count() > 0)
code_record(rectype, gjim, 0);
rectype = START_OF_DATA;
code_record(rectype, gjim, 0);
@@ -373,18 +373,18 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Dict> &gjim)
rectype = PRESERVED_COMMENT;
if (!! jim.comment)
code_record(rectype, gjim, 0);
- // Encode every tqshape
- int tqshapeno;
- DJVU_PROGRESS_TASK(jb2code,"jb2 encode", ntqshape-firsttqshape);
- for (tqshapeno=firsttqshape; tqshapeno<ntqshape; tqshapeno++)
+ // Encode every shape
+ int shapeno;
+ DJVU_PROGRESS_TASK(jb2code,"jb2 encode", nshape-firstshape);
+ for (shapeno=firstshape; shapeno<nshape; shapeno++)
{
- DJVU_PROGRESS_RUN(jb2code, (tqshapeno-firsttqshape)|0xff);
- // Code tqshape
- JB2Shape &jshp = jim.get_tqshape(tqshapeno);
+ DJVU_PROGRESS_RUN(jb2code, (shapeno-firstshape)|0xff);
+ // Code shape
+ JB2Shape &jshp = jim.get_shape(shapeno);
rectype=(jshp.parent >= 0)
?MATCHED_REFINE_LIBRARY_ONLY:NEW_MARK_LIBRARY_ONLY;
code_record(rectype, gjim, &jshp);
- add_library(tqshapeno, jshp);
+ add_library(shapeno, jshp);
// Check numcoder status
if (cur_ncell > CELLCHUNK)
{
@@ -413,35 +413,35 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim)
// -------------------------
int i;
init_library(jim);
- int firsttqshape = jim.get_inherited_tqshape_count();
- int ntqshape = jim.get_tqshape_count();
+ int firstshape = jim.get_inherited_shape_count();
+ int nshape = jim.get_shape_count();
int nblit = jim.get_blit_count();
- // Initialize tqshape2lib
- tqshape2lib.resize(0,ntqshape-1);
- for (i=firsttqshape; i<ntqshape; i++)
- tqshape2lib[i] = -1;
- // Determine tqshapes that go into library (tqshapeno>=firsttqshape)
- // tqshape2lib is -2 if used by one blit
- // tqshape2lib is -3 if used by more than one blit
- // tqshape2lib is -4 if used as a parent
+ // Initialize shape2lib
+ shape2lib.resize(0,nshape-1);
+ for (i=firstshape; i<nshape; i++)
+ shape2lib[i] = -1;
+ // Determine shapes that go into library (shapeno>=firstshape)
+ // shape2lib is -2 if used by one blit
+ // shape2lib is -3 if used by more than one blit
+ // shape2lib is -4 if used as a parent
for (i=0; i<nblit; i++)
{
JB2Blit *jblt = jim.get_blit(i);
- int tqshapeno = jblt->tqshapeno;
- if (tqshapeno < firsttqshape)
+ int shapeno = jblt->shapeno;
+ if (shapeno < firstshape)
continue;
- if (tqshape2lib[tqshapeno] >= -2)
- tqshape2lib[tqshapeno] -= 1;
- tqshapeno = jim.get_tqshape(tqshapeno).parent;
- while (tqshapeno>=firsttqshape && tqshape2lib[tqshapeno]>=-3)
+ if (shape2lib[shapeno] >= -2)
+ shape2lib[shapeno] -= 1;
+ shapeno = jim.get_shape(shapeno).parent;
+ while (shapeno>=firstshape && shape2lib[shapeno]>=-3)
{
- tqshape2lib[tqshapeno] = -4;
- tqshapeno = jim.get_tqshape(tqshapeno).parent;
+ shape2lib[shapeno] = -4;
+ shapeno = jim.get_shape(shapeno).parent;
}
}
// Code headers.
int rectype = RETQUIRED_DICT_OR_RESET;
- if (jim.get_inherited_tqshape_count() > 0)
+ if (jim.get_inherited_shape_count() > 0)
code_record(rectype, gjim, 0, 0);
rectype = START_OF_DATA;
code_record(rectype, gjim, 0, 0);
@@ -456,20 +456,20 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim)
{
DJVU_PROGRESS_RUN(jb2code, blitno|0xff);
JB2Blit *jblt = jim.get_blit(blitno);
- int tqshapeno = jblt->tqshapeno;
- JB2Shape &jshp = jim.get_tqshape(tqshapeno);
- // Tests if tqshape exists in library
- if (tqshape2lib[tqshapeno] >= 0)
+ int shapeno = jblt->shapeno;
+ JB2Shape &jshp = jim.get_shape(shapeno);
+ // Tests if shape exists in library
+ if (shape2lib[shapeno] >= 0)
{
int rectype = MATCHED_COPY;
code_record(rectype, gjim, 0, jblt);
}
- // Avoid coding null tqshapes/blits
+ // Avoid coding null shapes/blits
else if (jshp.bits)
{
// Make sure all parents have been coded
- if (jshp.parent>=0 && tqshape2lib[jshp.parent]<0)
- encode_libonly_tqshape(gjim, jshp.parent);
+ if (jshp.parent>=0 && shape2lib[jshp.parent]<0)
+ encode_libonly_shape(gjim, jshp.parent);
// Allocate library entry when needed
#define LIBRARY_CONTAINS_ALL
int libraryp = 0;
@@ -478,7 +478,7 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim)
libraryp = 1;
#endif
#ifdef LIBRARY_CONTAINS_SHARED // worse
- if (tqshape2lib[tqshapeno] <= -3)
+ if (shape2lib[shapeno] <= -3)
libraryp = 1;
#endif
#ifdef LIBRARY_CONTAINS_ALL // better
@@ -500,9 +500,9 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim)
int rectype = (libraryp ? MATCHED_REFINE : MATCHED_REFINE_IMAGE_ONLY);
code_record(rectype, gjim, &jshp, jblt);
}
- // Add tqshape to library
+ // Add shape to library
if (libraryp)
- add_library(tqshapeno, jshp);
+ add_library(shapeno, jshp);
}
// Check numcoder status
if (cur_ncell > CELLCHUNK)
@@ -522,27 +522,27 @@ JB2Dict::JB2Codec::Encode::code(const GP<JB2Image> &gjim)
////////////////////////////////////////
void
-JB2Dict::JB2Codec::Encode::encode_libonly_tqshape(
- const GP<JB2Image> &gjim, int tqshapeno )
+JB2Dict::JB2Codec::Encode::encode_libonly_shape(
+ const GP<JB2Image> &gjim, int shapeno )
{
if(!gjim)
{
G_THROW( ERR_MSG("JB2Image.bad_number") );
}
JB2Image &jim=*gjim;
- // Recursively encode parent tqshape
- JB2Shape &jshp = jim.get_tqshape(tqshapeno);
- if (jshp.parent>=0 && tqshape2lib[jshp.parent]<0)
- encode_libonly_tqshape(gjim, jshp.parent);
- // Test that library tqshape must be encoded
- if (tqshape2lib[tqshapeno] < 0)
+ // Recursively encode parent shape
+ JB2Shape &jshp = jim.get_shape(shapeno);
+ if (jshp.parent>=0 && shape2lib[jshp.parent]<0)
+ encode_libonly_shape(gjim, jshp.parent);
+ // Test that library shape must be encoded
+ if (shape2lib[shapeno] < 0)
{
// Code library entry
int rectype=(jshp.parent >= 0)
?NEW_MARK_LIBRARY_ONLY:MATCHED_REFINE_LIBRARY_ONLY;
code_record(rectype, gjim, &jshp, 0);
- // Add tqshape to library
- add_library(tqshapeno, jshp);
+ // Add shape to library
+ add_library(shapeno, jshp);
// Check numcoder status
if (cur_ncell > CELLCHUNK)
{