mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-22 06:05:33 -06:00
uppsrc: Fixed all -Wall warnings (except logical parenthesis and misplaced else)
git-svn-id: svn://ultimatepp.org/upp/trunk@6902 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0bbcfcc963
commit
33747551bf
29 changed files with 167 additions and 152 deletions
|
|
@ -928,7 +928,7 @@ dword NanoStrings::Add(const String& s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(over.GetCount() >= 0xc0000000)
|
if(over.GetCount() >= 0x70000000)
|
||||||
Panic("NanoStrings: Out of addressing space");
|
Panic("NanoStrings: Out of addressing space");
|
||||||
dword ws = 0xc0000000 | over.GetCount();
|
dword ws = 0xc0000000 | over.GetCount();
|
||||||
over.Add(s).Shrink();
|
over.Add(s).Shrink();
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,6 @@ String XmlTag::operator()(const char *text)
|
||||||
{
|
{
|
||||||
StringBuffer r;
|
StringBuffer r;
|
||||||
r << tag << ">";
|
r << tag << ">";
|
||||||
int fbi = r.GetCount();
|
|
||||||
const char *s = text;
|
const char *s = text;
|
||||||
bool wastag = true;
|
bool wastag = true;
|
||||||
bool wasslash = true;
|
bool wasslash = true;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ void FontSysData::Init(Font font, int angle)
|
||||||
cairo_matrix_init_identity(ctm);
|
cairo_matrix_init_identity(ctm);
|
||||||
cairo_matrix_init_scale(font_matrix, font.GetHeight(), font.GetHeight());
|
cairo_matrix_init_scale(font_matrix, font.GetHeight(), font.GetHeight());
|
||||||
|
|
||||||
FT_Face ft = FTFace(font);
|
|
||||||
if(font.IsItalic() && !(FTFace(font)->style_flags & FT_STYLE_FLAG_ITALIC)) {
|
if(font.IsItalic() && !(FTFace(font)->style_flags & FT_STYLE_FLAG_ITALIC)) {
|
||||||
cairo_matrix_t sheer[1];
|
cairo_matrix_t sheer[1];
|
||||||
cairo_matrix_init_identity(sheer);
|
cairo_matrix_init_identity(sheer);
|
||||||
|
|
|
||||||
|
|
@ -45,5 +45,5 @@ public:
|
||||||
void Cy(int cy_) { cy = cy_; }
|
void Cy(int cy_) { cy = cy_; }
|
||||||
|
|
||||||
DDARasterizer();
|
DDARasterizer();
|
||||||
~DDARasterizer();
|
virtual ~DDARasterizer();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ double GisCoords::Data::ProjectDeviation(Pointf lonlat1, Pointf lonlat2, int bra
|
||||||
|
|
||||||
double GisCoords::Data::ProjectRatio(Pointf lonlat, int branch) const
|
double GisCoords::Data::ProjectRatio(Pointf lonlat, int branch) const
|
||||||
{
|
{
|
||||||
Pointf proj = Project(lonlat, branch);
|
/*Pointf proj = */Project(lonlat, branch);
|
||||||
static const double DELTA = 1e-3;
|
static const double DELTA = 1e-3;
|
||||||
Sizef east = Project(lonlat + Sizef(DELTA, 0), branch);
|
Sizef east = Project(lonlat + Sizef(DELTA, 0), branch);
|
||||||
Sizef north = Project(lonlat + Sizef(0, DELTA), branch);
|
Sizef north = Project(lonlat + Sizef(0, DELTA), branch);
|
||||||
|
|
|
||||||
|
|
@ -485,7 +485,7 @@ double ConicalRadiusFunction::Get(double phi) const
|
||||||
double ang = phi / 2 + M_PI / 4;
|
double ang = phi / 2 + M_PI / 4;
|
||||||
double diff = M_PI / 2 - ang;
|
double diff = M_PI / 2 - ang;
|
||||||
double out;
|
double out;
|
||||||
static double prev = 0;
|
// static double prev = 0;
|
||||||
// bool limit = false;
|
// bool limit = false;
|
||||||
out = (diff <= LAMBERT_LIMDIFF ? diff * (k0 - k1 * diff) : pow(cos(ang) / sin(ang), n));
|
out = (diff <= LAMBERT_LIMDIFF ? diff * (k0 - k1 * diff) : pow(cos(ang) / sin(ang), n));
|
||||||
return out * rho_coef;
|
return out * rho_coef;
|
||||||
|
|
@ -524,7 +524,7 @@ GisCoordsUTM::GisCoordsUTM(
|
||||||
|
|
||||||
Pointf GisCoordsUTM::LonLat(Pointf xy) const
|
Pointf GisCoordsUTM::LonLat(Pointf xy) const
|
||||||
{
|
{
|
||||||
int paspol = ffloor(xy.x / 1000000);
|
// int paspol = ffloor(xy.x / 1000000);
|
||||||
xy.x = xy.x - xmeteroffset;
|
xy.x = xy.x - xmeteroffset;
|
||||||
double xyx2 = xy.x * xy.x;
|
double xyx2 = xy.x * xy.x;
|
||||||
double b1 = (xy.y - ymeteroffset) / 111134.861084 * DEGRAD, b = b1;
|
double b1 = (xy.y - ymeteroffset) / 111134.861084 * DEGRAD, b = b1;
|
||||||
|
|
@ -546,10 +546,10 @@ Pointf GisCoordsUTM::LonLat(Pointf xy) const
|
||||||
Pointf GisCoordsUTM::Project(Pointf lonlat, int branch) const
|
Pointf GisCoordsUTM::Project(Pointf lonlat, int branch) const
|
||||||
{
|
{
|
||||||
double LL = (lonlat.x - central_meridian) * DEGRAD;
|
double LL = (lonlat.x - central_meridian) * DEGRAD;
|
||||||
double LL2 = LL * LL, LL3 = LL2 * LL;
|
double LL2 = LL * LL;//, LL3 = LL2 * LL;
|
||||||
lonlat *= DEGRAD;
|
lonlat *= DEGRAD;
|
||||||
double sx = sin(lonlat.y), cx = cos(lonlat.y);
|
double sx = sin(lonlat.y), cx = cos(lonlat.y);
|
||||||
double cx2 = cx * cx, cx3 = cx2 * cx;
|
double cx2 = cx * cx;//, cx3 = cx2 * cx;
|
||||||
double B = 111134.861084 / DEGRAD * lonlat.y - 16036.480269 * sin(2 * lonlat.y)
|
double B = 111134.861084 / DEGRAD * lonlat.y - 16036.480269 * sin(2 * lonlat.y)
|
||||||
+ 16.828067 * sin(4 * lonlat.y) - 0.021975 * sin(6 * lonlat.y) + 0.000031 * sin(8 * lonlat.y);
|
+ 16.828067 * sin(4 * lonlat.y) - 0.021975 * sin(6 * lonlat.y) + 0.000031 * sin(8 * lonlat.y);
|
||||||
double T = sx / cx, T2 = T * T;
|
double T = sx / cx, T2 = T * T;
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ double GisInverse::Get(double y) const
|
||||||
else if(ymap[sec] > y && ymap[sec + 1] < y)
|
else if(ymap[sec] > y && ymap[sec + 1] < y)
|
||||||
{
|
{
|
||||||
double lx = rawxmin + xstep * sec, hx = lx + xstep;
|
double lx = rawxmin + xstep * sec, hx = lx + xstep;
|
||||||
double ly = ymap[sec], hy = ymap[sec + 1];
|
// double ly = ymap[sec], hy = ymap[sec + 1];
|
||||||
while(hx - lx > epsilon)
|
while(hx - lx > epsilon)
|
||||||
{
|
{
|
||||||
/* double dh = hy - ly, mx, my;
|
/* double dh = hy - ly, mx, my;
|
||||||
|
|
@ -290,12 +290,12 @@ double GisInverse::Get(double y) const
|
||||||
if(my > y)
|
if(my > y)
|
||||||
{
|
{
|
||||||
lx = mx;
|
lx = mx;
|
||||||
ly = my;
|
// ly = my;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hx = mx;
|
hx = mx;
|
||||||
hy = my;
|
// hy = my;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (lx + hx) / 2;
|
return (lx + hx) / 2;
|
||||||
|
|
@ -367,9 +367,9 @@ String GisInverseTiming(double xmin, double xmax, const GisFunction& fn, int sec
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
double x;
|
// double x;
|
||||||
for(int i = 0; i < 1000; i++)
|
for(int i = 0; i < 1000; i++)
|
||||||
x = inverse(yval[i]);
|
/*x = */inverse(yval[i]);
|
||||||
}
|
}
|
||||||
while((duration = msecs(start)) < 500);
|
while((duration = msecs(start)) < 500);
|
||||||
double nsecs = duration * 1000.0 / double(count);
|
double nsecs = duration * 1000.0 / double(count);
|
||||||
|
|
@ -696,7 +696,7 @@ String GisInterpolatorTiming(double xmin, double xmax, const GisFunction& fn, in
|
||||||
String dump = interpolator.CreateDump(xmin, xmax, fn, buckets, sections, samples, check);
|
String dump = interpolator.CreateDump(xmin, xmax, fn, buckets, sections, samples, check);
|
||||||
double dmax = 0;
|
double dmax = 0;
|
||||||
double step_check = (xmax - xmin) / check;
|
double step_check = (xmax - xmin) / check;
|
||||||
double step_64K = (xmax - xmin) / 65536;
|
// double step_64K = (xmax - xmin) / 65536;
|
||||||
Buffer<double> check_table(1000);
|
Buffer<double> check_table(1000);
|
||||||
for(int c = 0; c < 1000; c++)
|
for(int c = 0; c < 1000; c++)
|
||||||
check_table[c] = xmin + c / 999.0;
|
check_table[c] = xmin + c / 999.0;
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ void Delaunay::AddHull(int i)
|
||||||
{ // collinear, extend fan
|
{ // collinear, extend fan
|
||||||
Triangle& tm = triangles[im];
|
Triangle& tm = triangles[im];
|
||||||
int in = tm.Next(2);
|
int in = tm.Next(2);
|
||||||
Triangle& tn = triangles[in];
|
// Triangle& tn = triangles[in];
|
||||||
|
|
||||||
int j = tm[1];
|
int j = tm[1];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ Matrixf MatrixfMirror(Pointf A, Pointf B)
|
||||||
double vx2 = sqr(V.x);
|
double vx2 = sqr(V.x);
|
||||||
double vy2 = sqr(V.y);
|
double vy2 = sqr(V.y);
|
||||||
double det = vx2 + vy2;
|
double det = vx2 + vy2;
|
||||||
double dif = (vx2 - vy2) / det;
|
// double dif = (vx2 - vy2) / det;
|
||||||
double mul = 2 * V.x * V.y / det;
|
double mul = 2 * V.x * V.y / det;
|
||||||
Matrixf out(Pointf(vx2 - vy2, mul), Pointf(mul, vy2 - vx2));
|
Matrixf out(Pointf(vx2 - vy2, mul), Pointf(mul, vy2 - vx2));
|
||||||
out.Fix(A);
|
out.Fix(A);
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ Vector<double> LinearSolver::Solve()
|
||||||
{
|
{
|
||||||
Point pivot = pivots[r];
|
Point pivot = pivots[r];
|
||||||
const double *row = Row(pivot.y);
|
const double *row = Row(pivot.y);
|
||||||
int px = pivot.x;
|
// int px = pivot.x;
|
||||||
double out = row[rows]; // right side
|
double out = row[rows]; // right side
|
||||||
for(int s = r; ++s < pivots.GetCount();)
|
for(int s = r; ++s < pivots.GetCount();)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ NAMESPACE_UPP
|
||||||
#define POLY_TIMING(n) // RTIMING(n)
|
#define POLY_TIMING(n) // RTIMING(n)
|
||||||
#define POLY_LOGGING 0 // 1 = on, 0 = off
|
#define POLY_LOGGING 0 // 1 = on, 0 = off
|
||||||
|
|
||||||
|
/*
|
||||||
static bool ContainsPoints(const Point *poly, int count, Point P)
|
static bool ContainsPoints(const Point *poly, int count, Point P)
|
||||||
{
|
{
|
||||||
if(count <= 2 || IsNull(P))
|
if(count <= 2 || IsNull(P))
|
||||||
|
|
@ -52,7 +53,7 @@ static bool ContainsPoints(const Point *poly, int count, Point P)
|
||||||
}
|
}
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
static inline int PolyCompare(Pointf P, Pointf A, Pointf B, Size ap, Size bp)
|
static inline int PolyCompare(Pointf P, Pointf A, Pointf B, Size ap, Size bp)
|
||||||
{
|
{
|
||||||
if(ap.cx < 0 && bp.cx < 0 || ap.cy > 0 && bp.cy > 0 || ap.cy < 0 && bp.cy < 0)
|
if(ap.cx < 0 && bp.cx < 0 || ap.cy > 0 && bp.cy > 0 || ap.cy < 0 && bp.cy < 0)
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ bool Crosses(const Rectf& R, Pointf A, Pointf B)
|
||||||
{ 9, 2, 1, 2, 1, 9 },
|
{ 9, 2, 1, 2, 1, 9 },
|
||||||
};
|
};
|
||||||
|
|
||||||
ax = clue2[ay][ax];
|
ax = clue2[(int)ay][(int)ax];
|
||||||
|
|
||||||
double temp;
|
double temp;
|
||||||
switch(ax >> 1)
|
switch(ax >> 1)
|
||||||
|
|
@ -479,7 +479,7 @@ Vector<int> ConvexHullOrder(const Array<Pointf>& points)
|
||||||
// VecArcIterator::
|
// VecArcIterator::
|
||||||
|
|
||||||
VecArcIterator::VecArcIterator(Pointf start, Pointf end, double bulge, Callback1<Pointf> lineto)
|
VecArcIterator::VecArcIterator(Pointf start, Pointf end, double bulge, Callback1<Pointf> lineto)
|
||||||
: clip(Null), arc(start, end, bulge), lineto(lineto)
|
: arc(start, end, bulge), clip(Null), lineto(lineto)
|
||||||
{
|
{
|
||||||
level = DEFAULT_LEVEL;
|
level = DEFAULT_LEVEL;
|
||||||
precision = 1; // default precision
|
precision = 1; // default precision
|
||||||
|
|
@ -488,7 +488,7 @@ VecArcIterator::VecArcIterator(Pointf start, Pointf end, double bulge, Callback1
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
VecArcIterator::VecArcIterator(const VecArc& arc, Callback1<Pointf> lineto)
|
VecArcIterator::VecArcIterator(const VecArc& arc, Callback1<Pointf> lineto)
|
||||||
: clip(Null), arc(arc), lineto(lineto)
|
: arc(arc), clip(Null), lineto(lineto)
|
||||||
{
|
{
|
||||||
level = DEFAULT_LEVEL;
|
level = DEFAULT_LEVEL;
|
||||||
precision = 1; // default precision
|
precision = 1; // default precision
|
||||||
|
|
@ -887,8 +887,8 @@ Pointf VecArc::GetPointAt(Pointf P, Pointf Q, double l, double h, double t)
|
||||||
double beta = 2 * atan(lambda);
|
double beta = 2 * atan(lambda);
|
||||||
t = sin((2 * t - 1) * beta) / sin(beta);
|
t = sin((2 * t - 1) * beta) / sin(beta);
|
||||||
C += (Q - P) * (t / 2);
|
C += (Q - P) * (t / 2);
|
||||||
double k2 = k * k;
|
// double k2 = k * k;
|
||||||
double k4 = k2 * k2;
|
// double k4 = k2 * k2;
|
||||||
double l2 = lambda * lambda;
|
double l2 = lambda * lambda;
|
||||||
double opl = 1 + l2;
|
double opl = 1 + l2;
|
||||||
t *= t;
|
t *= t;
|
||||||
|
|
@ -1018,10 +1018,10 @@ VecArc VecCurve::Segment(int i) const
|
||||||
|
|
||||||
VecArcInfo::VecArcInfo()
|
VecArcInfo::VecArcInfo()
|
||||||
: C(Null)
|
: C(Null)
|
||||||
, radius(Null)
|
, bow(Null)
|
||||||
, alpha(Null)
|
, alpha(Null)
|
||||||
, beta(Null)
|
, beta(Null)
|
||||||
, bow(Null)
|
, radius(Null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,6 @@ void QTFEncodePara(String& qtf, const RichPara& p, const RichPara::Format& style
|
||||||
String data = object.Write();
|
String data = object.Write();
|
||||||
const char *q = data.Begin();
|
const char *q = data.Begin();
|
||||||
const char *slim = data.End();
|
const char *slim = data.End();
|
||||||
int n = 0;
|
|
||||||
qtf.Reserve(8 * data.GetLength() / 7);
|
qtf.Reserve(8 * data.GetLength() / 7);
|
||||||
if(object.IsText()) {
|
if(object.IsText()) {
|
||||||
qtf << "`";
|
qtf << "`";
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,19 @@
|
||||||
#define ATTRIBUTE(x, d) schema.Attribute(x, d);
|
#define ATTRIBUTE(x, d) schema.Attribute(x, d);
|
||||||
#define TABLE_SUFFIX(s) schema.TableSuffix(s);
|
#define TABLE_SUFFIX(s) schema.TableSuffix(s);
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
|
||||||
|
#define TYPE(x)\
|
||||||
|
static void SCHEMA_##x(SqlSchema& schema) __attribute__((unused)); \
|
||||||
|
static void SCHEMA_##x(SqlSchema& schema) {
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#define TYPE(x)\
|
#define TYPE(x)\
|
||||||
static void SCHEMA_##x(SqlSchema& schema) {
|
static void SCHEMA_##x(SqlSchema& schema) {
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TYPE_I(x, b1)\
|
#define TYPE_I(x, b1)\
|
||||||
static void SCHEMA_##x(SqlSchema& schema) { SCHEMA_##b1(schema);
|
static void SCHEMA_##x(SqlSchema& schema) { SCHEMA_##b1(schema);
|
||||||
|
|
||||||
|
|
@ -45,6 +55,10 @@ void TABLE_##x(SqlSchema& schema) { schema.Table(#x); SCHEMA_##x(schema); schema
|
||||||
#define CONFIG(x, d) schema.Config(x, d);
|
#define CONFIG(x, d) schema.Config(x, d);
|
||||||
#define UPGRADE(x) schema.Upgrade(x);
|
#define UPGRADE(x) schema.Upgrade(x);
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
static void All_Tables(SqlSchema& schema) __attribute__((unused));
|
||||||
|
#endif
|
||||||
|
|
||||||
static void All_Tables(SqlSchema& schema) {
|
static void All_Tables(SqlSchema& schema) {
|
||||||
|
|
||||||
#include SCHEMADIALECT
|
#include SCHEMADIALECT
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ static int StrBool(char c)
|
||||||
}
|
}
|
||||||
|
|
||||||
DbfStream::Field::Field(const char *_name, char type, byte width, byte decimal)
|
DbfStream::Field::Field(const char *_name, char type, byte width, byte decimal)
|
||||||
: type(type), width(width), decimal(decimal), offset(0)
|
: offset(0), type(type), width(width), decimal(decimal)
|
||||||
{
|
{
|
||||||
if(_name) {
|
if(_name) {
|
||||||
const char *p = reinterpret_cast<const char *>(memchr(_name, 0, 11));
|
const char *p = reinterpret_cast<const char *>(memchr(_name, 0, 11));
|
||||||
|
|
@ -462,7 +462,7 @@ bool DbfStream::StreamHeader(bool full)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(fpt.IsOpen() && fpt.IsLoading()) { // read FPT header
|
if(fpt.IsOpen() && fpt.IsLoading()) { // read FPT header
|
||||||
int nextfree = fpt.Get32be();
|
// int nextfree = fpt.Get32be();
|
||||||
fpt_block_size = fpt.Get32be();
|
fpt_block_size = fpt.Get32be();
|
||||||
if(fpt_block_size <= 0 || fpt_block_size >= 1 << 24)
|
if(fpt_block_size <= 0 || fpt_block_size >= 1 << 24)
|
||||||
fpt.Close(); // has_memo = false;
|
fpt.Close(); // has_memo = false;
|
||||||
|
|
@ -958,7 +958,7 @@ Value DbfStream::GetItemMemo(int i, bool binary) const
|
||||||
if(pos >= fpt.GetSize())
|
if(pos >= fpt.GetSize())
|
||||||
return Value();
|
return Value();
|
||||||
fpt.Seek(pos);
|
fpt.Seek(pos);
|
||||||
int fieldtype = fpt.Get32be();
|
// int fieldtype = fpt.Get32be();
|
||||||
int len = fpt.Get32be();
|
int len = fpt.Get32be();
|
||||||
if(len > 0) {
|
if(len > 0) {
|
||||||
StringBuffer outbuf(len);
|
StringBuffer outbuf(len);
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
|
||||||
c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private;
|
c_diff_ptr diff = (c_diff_ptr) losslsc->diff_private;
|
||||||
JDIMENSION MCU_col_num; /* index of current MCU within row */
|
JDIMENSION MCU_col_num; /* index of current MCU within row */
|
||||||
JDIMENSION MCU_count; /* number of MCUs encoded */
|
JDIMENSION MCU_count; /* number of MCUs encoded */
|
||||||
JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
|
// JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
|
||||||
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
||||||
int comp, ci, yoffset, samp_row, samp_rows, samps_across;
|
int comp, ci, yoffset, samp_row, samp_rows, samps_across;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
|
||||||
|
|
@ -493,7 +493,7 @@ encode_mcus_gather (j_compress_ptr cinfo, JDIFFIMAGE diff_buf,
|
||||||
for (sampn = 0; sampn < cinfo->data_units_in_MCU; sampn++) {
|
for (sampn = 0; sampn < cinfo->data_units_in_MCU; sampn++) {
|
||||||
register int temp;
|
register int temp;
|
||||||
register int nbits;
|
register int nbits;
|
||||||
c_derived_tbl *dctbl = entropy->cur_tbls[sampn];
|
// c_derived_tbl *dctbl = entropy->cur_tbls[sampn];
|
||||||
long * counts = entropy->cur_counts[sampn];
|
long * counts = entropy->cur_counts[sampn];
|
||||||
|
|
||||||
/* Encode the difference per section H.1.2.2 */
|
/* Encode the difference per section H.1.2.2 */
|
||||||
|
|
|
||||||
|
|
@ -68,32 +68,32 @@ METHODDEF(void) process_data_buffer_main
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
/* Do nothing in raw-data mode. */
|
/* Do nothing in raw-data mode. */
|
||||||
if (cinfo->raw_data_in)
|
if (cinfo->raw_data_in)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
main->cur_iMCU_row = 0; /* initialize counters */
|
main_->cur_iMCU_row = 0; /* initialize counters */
|
||||||
main->rowgroup_ctr = 0;
|
main_->rowgroup_ctr = 0;
|
||||||
main->suspended = FALSE;
|
main_->suspended = FALSE;
|
||||||
main->pass_mode = pass_mode; /* save mode for use by process_data */
|
main_->pass_mode = pass_mode; /* save mode for use by process_data */
|
||||||
|
|
||||||
switch (pass_mode) {
|
switch (pass_mode) {
|
||||||
case JBUF_PASS_THRU:
|
case JBUF_PASS_THRU:
|
||||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||||
if (main->whole_image[0] != NULL)
|
if (main_->whole_image[0] != NULL)
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
#endif
|
#endif
|
||||||
main->pub.process_data = process_data_simple_main;
|
main_->pub.process_data = process_data_simple_main;
|
||||||
break;
|
break;
|
||||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||||
case JBUF_SAVE_SOURCE:
|
case JBUF_SAVE_SOURCE:
|
||||||
case JBUF_CRANK_DEST:
|
case JBUF_CRANK_DEST:
|
||||||
case JBUF_SAVE_AND_PASS:
|
case JBUF_SAVE_AND_PASS:
|
||||||
if (main->whole_image[0] == NULL)
|
if (main_->whole_image[0] == NULL)
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
main->pub.process_data = process_data_buffer_main;
|
main_->pub.process_data = process_data_buffer_main;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|
@ -114,47 +114,47 @@ process_data_simple_main (j_compress_ptr cinfo,
|
||||||
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
|
||||||
JDIMENSION in_rows_avail)
|
JDIMENSION in_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
unsigned data_unit = cinfo->data_unit;
|
unsigned data_unit = cinfo->data_unit;
|
||||||
|
|
||||||
while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
while (main_->cur_iMCU_row < cinfo->total_iMCU_rows) {
|
||||||
/* Read input data if we haven't filled the main buffer yet */
|
/* Read input data if we haven't filled the main_ buffer yet */
|
||||||
if (main->rowgroup_ctr < data_unit)
|
if (main_->rowgroup_ctr < data_unit)
|
||||||
(*cinfo->prep->pre_process_data) (cinfo,
|
(*cinfo->prep->pre_process_data) (cinfo,
|
||||||
input_buf, in_row_ctr, in_rows_avail,
|
input_buf, in_row_ctr, in_rows_avail,
|
||||||
main->buffer, &main->rowgroup_ctr,
|
main_->buffer, &main_->rowgroup_ctr,
|
||||||
(JDIMENSION) data_unit);
|
(JDIMENSION) data_unit);
|
||||||
|
|
||||||
/* If we don't have a full iMCU row buffered, return to application for
|
/* If we don't have a full iMCU row buffered, return to application for
|
||||||
* more data. Note that preprocessor will always pad to fill the iMCU row
|
* more data. Note that preprocessor will always pad to fill the iMCU row
|
||||||
* at the bottom of the image.
|
* at the bottom of the image.
|
||||||
*/
|
*/
|
||||||
if (main->rowgroup_ctr != data_unit)
|
if (main_->rowgroup_ctr != data_unit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Send the completed row to the compressor */
|
/* Send the completed row to the compressor */
|
||||||
if (! (*cinfo->codec->compress_data) (cinfo, main->buffer)) {
|
if (! (*cinfo->codec->compress_data) (cinfo, main_->buffer)) {
|
||||||
/* If compressor did not consume the whole row, then we must need to
|
/* If compressor did not consume the whole row, then we must need to
|
||||||
* suspend processing and return to the application. In this situation
|
* suspend processing and return to the application. In this situation
|
||||||
* we pretend we didn't yet consume the last input row; otherwise, if
|
* we pretend we didn't yet consume the last input row; otherwise, if
|
||||||
* it happened to be the last row of the image, the application would
|
* it happened to be the last row of the image, the application would
|
||||||
* think we were done.
|
* think we were done.
|
||||||
*/
|
*/
|
||||||
if (! main->suspended) {
|
if (! main_->suspended) {
|
||||||
(*in_row_ctr)--;
|
(*in_row_ctr)--;
|
||||||
main->suspended = TRUE;
|
main_->suspended = TRUE;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* We did finish the row. Undo our little suspension hack if a previous
|
/* We did finish the row. Undo our little suspension hack if a previous
|
||||||
* call suspended; then mark the main buffer empty.
|
* call suspended; then mark the main_ buffer empty.
|
||||||
*/
|
*/
|
||||||
if (main->suspended) {
|
if (main_->suspended) {
|
||||||
(*in_row_ctr)++;
|
(*in_row_ctr)++;
|
||||||
main->suspended = FALSE;
|
main_->suspended = FALSE;
|
||||||
}
|
}
|
||||||
main->rowgroup_ctr = 0;
|
main_->rowgroup_ctr = 0;
|
||||||
main->cur_iMCU_row++;
|
main_->cur_iMCU_row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -246,16 +246,16 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
||||||
{
|
{
|
||||||
my_main_ptr main;
|
my_main_ptr main_;
|
||||||
int ci;
|
int ci;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
int data_unit = cinfo->data_unit;
|
int data_unit = cinfo->data_unit;
|
||||||
|
|
||||||
main = (my_main_ptr)
|
main_ = (my_main_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_main_controller));
|
SIZEOF(my_main_controller));
|
||||||
cinfo->main = (struct jpeg_c_main_controller *) main;
|
cinfo->main = (struct jpeg_c_main_controller *) main_;
|
||||||
main->pub.start_pass = start_pass_main;
|
main_->pub.start_pass = start_pass_main;
|
||||||
|
|
||||||
/* We don't need to create a buffer in raw-data mode. */
|
/* We don't need to create a buffer in raw-data mode. */
|
||||||
if (cinfo->raw_data_in)
|
if (cinfo->raw_data_in)
|
||||||
|
|
@ -270,7 +270,7 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
||||||
/* Note we pad the bottom to a multiple of the iMCU height */
|
/* Note we pad the bottom to a multiple of the iMCU height */
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
|
main_->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
|
||||||
compptr->width_in_data_units * data_unit,
|
compptr->width_in_data_units * data_unit,
|
||||||
(JDIMENSION) jround_up((long) compptr->height_in_data_units,
|
(JDIMENSION) jround_up((long) compptr->height_in_data_units,
|
||||||
|
|
@ -282,12 +282,12 @@ jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
#ifdef FULL_MAIN_BUFFER_SUPPORTED
|
||||||
main->whole_image[0] = NULL; /* flag for no virtual arrays */
|
main_->whole_image[0] = NULL; /* flag for no virtual arrays */
|
||||||
#endif
|
#endif
|
||||||
/* Allocate a strip buffer for each component */
|
/* Allocate a strip buffer for each component */
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
main->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
main_->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
compptr->width_in_data_units * data_unit,
|
compptr->width_in_data_units * data_unit,
|
||||||
(JDIMENSION) (compptr->v_samp_factor * data_unit));
|
(JDIMENSION) (compptr->v_samp_factor * data_unit));
|
||||||
|
|
|
||||||
|
|
@ -452,7 +452,7 @@ per_scan_setup (j_compress_ptr cinfo)
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
prepare_for_pass (j_compress_ptr cinfo)
|
prepare_for_pass (j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
|
// j_lossy_c_ptr lossyc = (j_lossy_c_ptr) cinfo->codec;
|
||||||
my_master_ptr master = (my_master_ptr) cinfo->master;
|
my_master_ptr master = (my_master_ptr) cinfo->master;
|
||||||
|
|
||||||
switch (master->pass_type) {
|
switch (master->pass_type) {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,8 @@ METHODDEF(void) start_pass
|
||||||
reset_predictor(cinfo, ci); \
|
reset_predictor(cinfo, ci); \
|
||||||
restart = TRUE; \
|
restart = TRUE; \
|
||||||
} \
|
} \
|
||||||
}
|
} \
|
||||||
|
(void)restart;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -117,7 +118,8 @@ METHODDEF(void) start_pass
|
||||||
if (cinfo->restart_interval) { \
|
if (cinfo->restart_interval) { \
|
||||||
if (--pred->restart_rows_to_go[ci] == 0) \
|
if (--pred->restart_rows_to_go[ci] == 0) \
|
||||||
reset_predictor(cinfo, ci); \
|
reset_predictor(cinfo, ci); \
|
||||||
}
|
} \
|
||||||
|
(void)Rc;(void)Ra;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -259,8 +261,8 @@ reset_predictor (j_compress_ptr cinfo, int ci)
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass (j_compress_ptr cinfo)
|
start_pass (j_compress_ptr cinfo)
|
||||||
{
|
{
|
||||||
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
|
// j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
|
||||||
c_pred_ptr pred = (c_pred_ptr) losslsc->pred_private;
|
// c_pred_ptr pred = (c_pred_ptr) losslsc->pred_private;
|
||||||
int ci;
|
int ci;
|
||||||
|
|
||||||
/* Check that the restart interval is an integer multiple of the number
|
/* Check that the restart interval is an integer multiple of the number
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ METHODDEF(void)
|
||||||
simple_downscale(j_compress_ptr cinfo,
|
simple_downscale(j_compress_ptr cinfo,
|
||||||
JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width)
|
JSAMPROW input_buf, JSAMPROW output_buf, JDIMENSION width)
|
||||||
{
|
{
|
||||||
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
|
// j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
|
||||||
unsigned xindex;
|
unsigned xindex;
|
||||||
|
|
||||||
for (xindex = 0; xindex < width; xindex++)
|
for (xindex = 0; xindex < width; xindex++)
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ start_output_pass (j_decompress_ptr cinfo)
|
||||||
{
|
{
|
||||||
#ifdef BLOCK_SMOOTHING_SUPPORTED
|
#ifdef BLOCK_SMOOTHING_SUPPORTED
|
||||||
j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec;
|
j_lossy_d_ptr lossyd = (j_lossy_d_ptr) cinfo->codec;
|
||||||
d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private;
|
// d_coef_ptr coef = (d_coef_ptr) lossyd->coef_private;
|
||||||
|
|
||||||
/* If multipass, check to see whether to use block smoothing on this pass */
|
/* If multipass, check to see whether to use block smoothing on this pass */
|
||||||
if (lossyd->coef_arrays != NULL) {
|
if (lossyd->coef_arrays != NULL) {
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ consume_data (j_decompress_ptr cinfo)
|
||||||
d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private;
|
d_diff_ptr diff = (d_diff_ptr) losslsd->diff_private;
|
||||||
// JDIMENSION MCU_col_num; /* index of current MCU within row */
|
// JDIMENSION MCU_col_num; /* index of current MCU within row */
|
||||||
// JDIMENSION MCU_count; /* number of MCUs decoded */
|
// JDIMENSION MCU_count; /* number of MCUs decoded */
|
||||||
JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
// JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
|
||||||
int comp, ci; //, yoffset, row, prev_row;
|
int comp, ci; //, yoffset, row, prev_row;
|
||||||
JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
|
JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||||
* This is done only once, not once per pass.
|
* This is done only once, not once per pass.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
int ci, rgroup;
|
int ci, rgroup;
|
||||||
int M = cinfo->min_codec_data_unit;
|
int M = cinfo->min_codec_data_unit;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
@ -168,10 +168,10 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||||
/* Get top-level space for component array pointers.
|
/* Get top-level space for component array pointers.
|
||||||
* We alloc both arrays with one call to save a few cycles.
|
* We alloc both arrays with one call to save a few cycles.
|
||||||
*/
|
*/
|
||||||
main->xbuffer[0] = (JSAMPIMAGE)
|
main_->xbuffer[0] = (JSAMPIMAGE)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
|
cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
|
||||||
main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components;
|
main_->xbuffer[1] = main_->xbuffer[0] + cinfo->num_components;
|
||||||
|
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
|
|
@ -184,9 +184,9 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
|
2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
|
||||||
xbuf += rgroup; /* want one row group at negative offsets */
|
xbuf += rgroup; /* want one row group at negative offsets */
|
||||||
main->xbuffer[0][ci] = xbuf;
|
main_->xbuffer[0][ci] = xbuf;
|
||||||
xbuf += rgroup * (M + 4);
|
xbuf += rgroup * (M + 4);
|
||||||
main->xbuffer[1][ci] = xbuf;
|
main_->xbuffer[1][ci] = xbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,7 +200,7 @@ make_funny_pointers (j_decompress_ptr cinfo)
|
||||||
* This will be repeated at the beginning of each pass.
|
* This will be repeated at the beginning of each pass.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
int ci, i, rgroup;
|
int ci, i, rgroup;
|
||||||
int M = cinfo->min_codec_data_unit;
|
int M = cinfo->min_codec_data_unit;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
@ -210,10 +210,10 @@ make_funny_pointers (j_decompress_ptr cinfo)
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) /
|
rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) /
|
||||||
cinfo->min_codec_data_unit; /* height of a row group of component */
|
cinfo->min_codec_data_unit; /* height of a row group of component */
|
||||||
xbuf0 = main->xbuffer[0][ci];
|
xbuf0 = main_->xbuffer[0][ci];
|
||||||
xbuf1 = main->xbuffer[1][ci];
|
xbuf1 = main_->xbuffer[1][ci];
|
||||||
/* First copy the workspace pointers as-is */
|
/* First copy the workspace pointers as-is */
|
||||||
buf = main->buffer[ci];
|
buf = main_->buffer[ci];
|
||||||
for (i = 0; i < rgroup * (M + 2); i++) {
|
for (i = 0; i < rgroup * (M + 2); i++) {
|
||||||
xbuf0[i] = xbuf1[i] = buf[i];
|
xbuf0[i] = xbuf1[i] = buf[i];
|
||||||
}
|
}
|
||||||
|
|
@ -240,7 +240,7 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
|
||||||
* This changes the pointer list state from top-of-image to the normal state.
|
* This changes the pointer list state from top-of-image to the normal state.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
int ci, i, rgroup;
|
int ci, i, rgroup;
|
||||||
int M = cinfo->min_codec_data_unit;
|
int M = cinfo->min_codec_data_unit;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
@ -250,8 +250,8 @@ set_wraparound_pointers (j_decompress_ptr cinfo)
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) /
|
rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) /
|
||||||
cinfo->min_codec_data_unit; /* height of a row group of component */
|
cinfo->min_codec_data_unit; /* height of a row group of component */
|
||||||
xbuf0 = main->xbuffer[0][ci];
|
xbuf0 = main_->xbuffer[0][ci];
|
||||||
xbuf1 = main->xbuffer[1][ci];
|
xbuf1 = main_->xbuffer[1][ci];
|
||||||
for (i = 0; i < rgroup; i++) {
|
for (i = 0; i < rgroup; i++) {
|
||||||
xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
|
xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
|
||||||
xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
|
xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
|
||||||
|
|
@ -269,7 +269,7 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
||||||
* Also sets rowgroups_avail to indicate number of nondummy row groups in row.
|
* Also sets rowgroups_avail to indicate number of nondummy row groups in row.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
int ci, i, rgroup, iMCUheight, rows_left;
|
int ci, i, rgroup, iMCUheight, rows_left;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
JSAMPARRAY xbuf;
|
JSAMPARRAY xbuf;
|
||||||
|
|
@ -286,12 +286,12 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
||||||
* so we need only do it once.
|
* so we need only do it once.
|
||||||
*/
|
*/
|
||||||
if (ci == 0) {
|
if (ci == 0) {
|
||||||
main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
|
main_->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
|
||||||
}
|
}
|
||||||
/* Duplicate the last real sample row rgroup*2 times; this pads out the
|
/* Duplicate the last real sample row rgroup*2 times; this pads out the
|
||||||
* last partial rowgroup and ensures at least one full rowgroup of context.
|
* last partial rowgroup and ensures at least one full rowgroup of context.
|
||||||
*/
|
*/
|
||||||
xbuf = main->xbuffer[main->whichptr][ci];
|
xbuf = main_->xbuffer[main_->whichptr][ci];
|
||||||
for (i = 0; i < rgroup * 2; i++) {
|
for (i = 0; i < rgroup * 2; i++) {
|
||||||
xbuf[rows_left + i] = xbuf[rows_left-1];
|
xbuf[rows_left + i] = xbuf[rows_left-1];
|
||||||
}
|
}
|
||||||
|
|
@ -306,27 +306,27 @@ set_bottom_pointers (j_decompress_ptr cinfo)
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
|
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
switch (pass_mode) {
|
switch (pass_mode) {
|
||||||
case JBUF_PASS_THRU:
|
case JBUF_PASS_THRU:
|
||||||
if (cinfo->upsample->need_context_rows) {
|
if (cinfo->upsample->need_context_rows) {
|
||||||
main->pub.process_data = process_data_context_main;
|
main_->pub.process_data = process_data_context_main;
|
||||||
make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
|
make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
|
||||||
main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
main_->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||||
main->context_state = CTX_PREPARE_FOR_IMCU;
|
main_->context_state = CTX_PREPARE_FOR_IMCU;
|
||||||
main->iMCU_row_ctr = 0;
|
main_->iMCU_row_ctr = 0;
|
||||||
} else {
|
} else {
|
||||||
/* Simple case with no context needed */
|
/* Simple case with no context needed */
|
||||||
main->pub.process_data = process_data_simple_main;
|
main_->pub.process_data = process_data_simple_main;
|
||||||
}
|
}
|
||||||
main->buffer_full = FALSE; /* Mark buffer empty */
|
main_->buffer_full = FALSE; /* Mark buffer empty */
|
||||||
main->rowgroup_ctr = 0;
|
main_->rowgroup_ctr = 0;
|
||||||
break;
|
break;
|
||||||
#ifdef QUANT_2PASS_SUPPORTED
|
#ifdef QUANT_2PASS_SUPPORTED
|
||||||
case JBUF_CRANK_DEST:
|
case JBUF_CRANK_DEST:
|
||||||
/* For last pass of 2-pass quantization, just crank the postprocessor */
|
/* For last pass of 2-pass quantization, just crank the postprocessor */
|
||||||
main->pub.process_data = process_data_crank_post;
|
main_->pub.process_data = process_data_crank_post;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|
@ -346,14 +346,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
||||||
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||||
JDIMENSION out_rows_avail)
|
JDIMENSION out_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
JDIMENSION rowgroups_avail;
|
JDIMENSION rowgroups_avail;
|
||||||
|
|
||||||
/* Read input data if we haven't filled the main buffer yet */
|
/* Read input data if we haven't filled the main_ buffer yet */
|
||||||
if (! main->buffer_full) {
|
if (! main_->buffer_full) {
|
||||||
if (! (*cinfo->codec->decompress_data) (cinfo, main->buffer))
|
if (! (*cinfo->codec->decompress_data) (cinfo, main_->buffer))
|
||||||
return; /* suspension forced, can do nothing more */
|
return; /* suspension forced, can do nothing more */
|
||||||
main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
main_->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There are always min_codec_data_unit row groups in an iMCU row. */
|
/* There are always min_codec_data_unit row groups in an iMCU row. */
|
||||||
|
|
@ -364,14 +364,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Feed the postprocessor */
|
/* Feed the postprocessor */
|
||||||
(*cinfo->post->post_process_data) (cinfo, main->buffer,
|
(*cinfo->post->post_process_data) (cinfo, main_->buffer,
|
||||||
&main->rowgroup_ctr, rowgroups_avail,
|
&main_->rowgroup_ctr, rowgroups_avail,
|
||||||
output_buf, out_row_ctr, out_rows_avail);
|
output_buf, out_row_ctr, out_rows_avail);
|
||||||
|
|
||||||
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
|
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
|
||||||
if (main->rowgroup_ctr >= rowgroups_avail) {
|
if (main_->rowgroup_ctr >= rowgroups_avail) {
|
||||||
main->buffer_full = FALSE;
|
main_->buffer_full = FALSE;
|
||||||
main->rowgroup_ctr = 0;
|
main_->rowgroup_ctr = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -386,15 +386,15 @@ process_data_context_main (j_decompress_ptr cinfo,
|
||||||
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||||
JDIMENSION out_rows_avail)
|
JDIMENSION out_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr main = (my_main_ptr) cinfo->main;
|
my_main_ptr main_ = (my_main_ptr) cinfo->main;
|
||||||
|
|
||||||
/* Read input data if we haven't filled the main buffer yet */
|
/* Read input data if we haven't filled the main_ buffer yet */
|
||||||
if (! main->buffer_full) {
|
if (! main_->buffer_full) {
|
||||||
if (! (*cinfo->codec->decompress_data) (cinfo,
|
if (! (*cinfo->codec->decompress_data) (cinfo,
|
||||||
main->xbuffer[main->whichptr]))
|
main_->xbuffer[main_->whichptr]))
|
||||||
return; /* suspension forced, can do nothing more */
|
return; /* suspension forced, can do nothing more */
|
||||||
main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
main_->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||||
main->iMCU_row_ctr++; /* count rows received */
|
main_->iMCU_row_ctr++; /* count rows received */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Postprocessor typically will not swallow all the input data it is handed
|
/* Postprocessor typically will not swallow all the input data it is handed
|
||||||
|
|
@ -402,47 +402,47 @@ process_data_context_main (j_decompress_ptr cinfo,
|
||||||
* to exit and restart. This switch lets us keep track of how far we got.
|
* to exit and restart. This switch lets us keep track of how far we got.
|
||||||
* Note that each case falls through to the next on successful completion.
|
* Note that each case falls through to the next on successful completion.
|
||||||
*/
|
*/
|
||||||
switch (main->context_state) {
|
switch (main_->context_state) {
|
||||||
case CTX_POSTPONED_ROW:
|
case CTX_POSTPONED_ROW:
|
||||||
/* Call postprocessor using previously set pointers for postponed row */
|
/* Call postprocessor using previously set pointers for postponed row */
|
||||||
(*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
|
(*cinfo->post->post_process_data) (cinfo, main_->xbuffer[main_->whichptr],
|
||||||
&main->rowgroup_ctr, main->rowgroups_avail,
|
&main_->rowgroup_ctr, main_->rowgroups_avail,
|
||||||
output_buf, out_row_ctr, out_rows_avail);
|
output_buf, out_row_ctr, out_rows_avail);
|
||||||
if (main->rowgroup_ctr < main->rowgroups_avail)
|
if (main_->rowgroup_ctr < main_->rowgroups_avail)
|
||||||
return; /* Need to suspend */
|
return; /* Need to suspend */
|
||||||
main->context_state = CTX_PREPARE_FOR_IMCU;
|
main_->context_state = CTX_PREPARE_FOR_IMCU;
|
||||||
if (*out_row_ctr >= out_rows_avail)
|
if (*out_row_ctr >= out_rows_avail)
|
||||||
return; /* Postprocessor exactly filled output buf */
|
return; /* Postprocessor exactly filled output buf */
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
case CTX_PREPARE_FOR_IMCU:
|
case CTX_PREPARE_FOR_IMCU:
|
||||||
/* Prepare to process first M-1 row groups of this iMCU row */
|
/* Prepare to process first M-1 row groups of this iMCU row */
|
||||||
main->rowgroup_ctr = 0;
|
main_->rowgroup_ctr = 0;
|
||||||
main->rowgroups_avail = (JDIMENSION) (cinfo->min_codec_data_unit - 1);
|
main_->rowgroups_avail = (JDIMENSION) (cinfo->min_codec_data_unit - 1);
|
||||||
/* Check for bottom of image: if so, tweak pointers to "duplicate"
|
/* Check for bottom of image: if so, tweak pointers to "duplicate"
|
||||||
* the last sample row, and adjust rowgroups_avail to ignore padding rows.
|
* the last sample row, and adjust rowgroups_avail to ignore padding rows.
|
||||||
*/
|
*/
|
||||||
if (main->iMCU_row_ctr == cinfo->total_iMCU_rows)
|
if (main_->iMCU_row_ctr == cinfo->total_iMCU_rows)
|
||||||
set_bottom_pointers(cinfo);
|
set_bottom_pointers(cinfo);
|
||||||
main->context_state = CTX_PROCESS_IMCU;
|
main_->context_state = CTX_PROCESS_IMCU;
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
case CTX_PROCESS_IMCU:
|
case CTX_PROCESS_IMCU:
|
||||||
/* Call postprocessor using previously set pointers */
|
/* Call postprocessor using previously set pointers */
|
||||||
(*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
|
(*cinfo->post->post_process_data) (cinfo, main_->xbuffer[main_->whichptr],
|
||||||
&main->rowgroup_ctr, main->rowgroups_avail,
|
&main_->rowgroup_ctr, main_->rowgroups_avail,
|
||||||
output_buf, out_row_ctr, out_rows_avail);
|
output_buf, out_row_ctr, out_rows_avail);
|
||||||
if (main->rowgroup_ctr < main->rowgroups_avail)
|
if (main_->rowgroup_ctr < main_->rowgroups_avail)
|
||||||
return; /* Need to suspend */
|
return; /* Need to suspend */
|
||||||
/* After the first iMCU, change wraparound pointers to normal state */
|
/* After the first iMCU, change wraparound pointers to normal state */
|
||||||
if (main->iMCU_row_ctr == 1)
|
if (main_->iMCU_row_ctr == 1)
|
||||||
set_wraparound_pointers(cinfo);
|
set_wraparound_pointers(cinfo);
|
||||||
/* Prepare to load new iMCU row using other xbuffer list */
|
/* Prepare to load new iMCU row using other xbuffer list */
|
||||||
main->whichptr ^= 1; /* 0=>1 or 1=>0 */
|
main_->whichptr ^= 1; /* 0=>1 or 1=>0 */
|
||||||
main->buffer_full = FALSE;
|
main_->buffer_full = FALSE;
|
||||||
/* Still need to process last row group of this iMCU row, */
|
/* Still need to process last row group of this iMCU row, */
|
||||||
/* which is saved at index M+1 of the other xbuffer */
|
/* which is saved at index M+1 of the other xbuffer */
|
||||||
main->rowgroup_ctr = (JDIMENSION) (cinfo->min_codec_data_unit + 1);
|
main_->rowgroup_ctr = (JDIMENSION) (cinfo->min_codec_data_unit + 1);
|
||||||
main->rowgroups_avail = (JDIMENSION) (cinfo->min_codec_data_unit + 2);
|
main_->rowgroups_avail = (JDIMENSION) (cinfo->min_codec_data_unit + 2);
|
||||||
main->context_state = CTX_POSTPONED_ROW;
|
main_->context_state = CTX_POSTPONED_ROW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -475,15 +475,15 @@ process_data_crank_post (j_decompress_ptr cinfo,
|
||||||
GLOBAL(void)
|
GLOBAL(void)
|
||||||
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||||
{
|
{
|
||||||
my_main_ptr main;
|
my_main_ptr main_;
|
||||||
int ci, rgroup, ngroups;
|
int ci, rgroup, ngroups;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
main = (my_main_ptr)
|
main_ = (my_main_ptr)
|
||||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
SIZEOF(my_main_controller));
|
SIZEOF(my_main_controller));
|
||||||
cinfo->main = (struct jpeg_d_main_controller *) main;
|
cinfo->main = (struct jpeg_d_main_controller *) main_;
|
||||||
main->pub.start_pass = start_pass_main;
|
main_->pub.start_pass = start_pass_main;
|
||||||
|
|
||||||
if (need_full_buffer) /* shouldn't happen */
|
if (need_full_buffer) /* shouldn't happen */
|
||||||
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
|
||||||
|
|
@ -504,7 +504,7 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||||
ci++, compptr++) {
|
ci++, compptr++) {
|
||||||
rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) /
|
rgroup = (compptr->v_samp_factor * compptr->codec_data_unit) /
|
||||||
cinfo->min_codec_data_unit; /* height of a row group of component */
|
cinfo->min_codec_data_unit; /* height of a row group of component */
|
||||||
main->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
main_->buffer[ci] = (*cinfo->mem->alloc_sarray)
|
||||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
compptr->width_in_data_units * compptr->codec_data_unit,
|
compptr->width_in_data_units * compptr->codec_data_unit,
|
||||||
(JDIMENSION) (rgroup * ngroups));
|
(JDIMENSION) (rgroup * ngroups));
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,8 @@
|
||||||
Rb = GETJSAMPLE(prev_row[xindex]); \
|
Rb = GETJSAMPLE(prev_row[xindex]); \
|
||||||
Ra = (diff_buf[xindex] + PREDICTOR) & 0xFFFF; \
|
Ra = (diff_buf[xindex] + PREDICTOR) & 0xFFFF; \
|
||||||
undiff_buf[xindex] = Ra; \
|
undiff_buf[xindex] = Ra; \
|
||||||
}
|
} \
|
||||||
|
(void)Rc;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ TIFFReadDirectory(TIFF* tif)
|
||||||
size_t fix;
|
size_t fix;
|
||||||
uint16 dircount;
|
uint16 dircount;
|
||||||
uint16 previous_tag = 0;
|
uint16 previous_tag = 0;
|
||||||
int diroutoforderwarning = 0, compressionknown = 0;
|
int diroutoforderwarning = 0;//, compressionknown = 0;
|
||||||
int haveunknowntags = 0;
|
int haveunknowntags = 0;
|
||||||
|
|
||||||
tif->tif_diroff = tif->tif_nextdiroff;
|
tif->tif_diroff = tif->tif_nextdiroff;
|
||||||
|
|
@ -255,8 +255,8 @@ TIFFReadDirectory(TIFF* tif)
|
||||||
dp->tdir_type, dp->tdir_offset);
|
dp->tdir_type, dp->tdir_offset);
|
||||||
if (!TIFFSetField(tif, dp->tdir_tag, (uint16)v))
|
if (!TIFFSetField(tif, dp->tdir_tag, (uint16)v))
|
||||||
goto bad;
|
goto bad;
|
||||||
else
|
// else
|
||||||
compressionknown = 1;
|
// compressionknown = 1;
|
||||||
break;
|
break;
|
||||||
/* XXX: workaround for broken TIFFs */
|
/* XXX: workaround for broken TIFFs */
|
||||||
} else if (dp->tdir_type == TIFF_LONG) {
|
} else if (dp->tdir_type == TIFF_LONG) {
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ static int
|
||||||
_TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
|
_TIFFPrettyPrintField(TIFF* tif, FILE* fd, ttag_t tag,
|
||||||
uint32 value_count, void *raw_data)
|
uint32 value_count, void *raw_data)
|
||||||
{
|
{
|
||||||
TIFFDirectory *td = &tif->tif_dir;
|
// TIFFDirectory *td = &tif->tif_dir;
|
||||||
|
|
||||||
switch (tag)
|
switch (tag)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@ extern "C" void _TIFFmemset(void* p, int v, tsize_t c) { memset(p, v,
|
||||||
extern "C" void _TIFFmemcpy(void* d, const tdata_t s, tsize_t c) { memcpy(d, s, c); }
|
extern "C" void _TIFFmemcpy(void* d, const tdata_t s, tsize_t c) { memcpy(d, s, c); }
|
||||||
extern "C" int _TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c) { return memcmp(p1, p2, c); }
|
extern "C" int _TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c) { return memcmp(p1, p2, c); }
|
||||||
|
|
||||||
|
/*
|
||||||
static void Blt2to4(byte *dest, const byte *src, unsigned count)
|
static void Blt2to4(byte *dest, const byte *src, unsigned count)
|
||||||
{
|
{
|
||||||
byte b;
|
byte b;
|
||||||
|
|
@ -162,7 +163,7 @@ static void Blt2to4(byte *dest, const byte *src, unsigned count)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
static void BltPack11(byte *dest, const byte *src, byte bit_shift, unsigned count)
|
static void BltPack11(byte *dest, const byte *src, byte bit_shift, unsigned count)
|
||||||
{
|
{
|
||||||
if(bit_shift == 0)
|
if(bit_shift == 0)
|
||||||
|
|
@ -406,7 +407,7 @@ static void BltPack44(byte *dest, const byte *src, bool shift, unsigned count)
|
||||||
dest[c2] = (dest[c2] & 15) | (src[c2] & 0xF0);
|
dest[c2] = (dest[c2] & 15) | (src[c2] & 0xF0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
static void BltPack4(byte *dest, const byte *src, unsigned count)
|
static void BltPack4(byte *dest, const byte *src, unsigned count)
|
||||||
{
|
{
|
||||||
#define BLT_PACK_4_4(o) dest[(o)] = src[4 * (o)]; dest[(o) + 1] = src[4 * (o) + 4]; \
|
#define BLT_PACK_4_4(o) dest[(o)] = src[4 * (o)]; dest[(o) + 1] = src[4 * (o) + 4]; \
|
||||||
|
|
@ -438,7 +439,7 @@ static void BltPack4(byte *dest, const byte *src, unsigned count)
|
||||||
if(count & 1)
|
if(count & 1)
|
||||||
dest[0] = src[0];
|
dest[0] = src[0];
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
static tsize_t ReadStream(thandle_t fd, tdata_t buf, tsize_t size)
|
static tsize_t ReadStream(thandle_t fd, tdata_t buf, tsize_t size)
|
||||||
{
|
{
|
||||||
Stream *stream = reinterpret_cast<Stream *>(fd);
|
Stream *stream = reinterpret_cast<Stream *>(fd);
|
||||||
|
|
@ -654,7 +655,7 @@ static void putContig1(TIFFRGBAImage *img, tif_uint32 *cp,
|
||||||
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
||||||
{
|
{
|
||||||
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
||||||
Size size = helper->size;
|
// Size size = helper->size;
|
||||||
int iw = toskew + w;
|
int iw = toskew + w;
|
||||||
bool keep_y = (iw >= 0);
|
bool keep_y = (iw >= 0);
|
||||||
int x8 = x >> 3;
|
int x8 = x >> 3;
|
||||||
|
|
@ -674,7 +675,7 @@ static void putContig2(TIFFRGBAImage *img, tif_uint32 *cp,
|
||||||
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
||||||
{
|
{
|
||||||
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
||||||
Size size = helper->size;
|
// Size size = helper->size;
|
||||||
int iw = toskew + w;
|
int iw = toskew + w;
|
||||||
bool keep_y = (iw >= 0);
|
bool keep_y = (iw >= 0);
|
||||||
int x4 = x >> 2;
|
int x4 = x >> 2;
|
||||||
|
|
@ -694,7 +695,7 @@ static void putContig4(TIFFRGBAImage *img, tif_uint32 *cp,
|
||||||
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
||||||
{
|
{
|
||||||
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
||||||
Size size = helper->size; //dest.GetSize();
|
// Size size = helper->size; //dest.GetSize();
|
||||||
int iw = toskew + w;
|
int iw = toskew + w;
|
||||||
bool keep_y = (iw >= 0);
|
bool keep_y = (iw >= 0);
|
||||||
int x2 = x >> 1;
|
int x2 = x >> 1;
|
||||||
|
|
@ -715,7 +716,7 @@ static void putContig8(TIFFRGBAImage *img, tif_uint32 *cp,
|
||||||
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
||||||
{
|
{
|
||||||
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
||||||
Size size = helper->size;
|
// Size size = helper->size;
|
||||||
int iw = toskew + w;
|
int iw = toskew + w;
|
||||||
bool keep_y = (iw >= 0);
|
bool keep_y = (iw >= 0);
|
||||||
// byte *dest = helper->dest.GetUpScan(y) + x;
|
// byte *dest = helper->dest.GetUpScan(y) + x;
|
||||||
|
|
@ -731,7 +732,7 @@ static void putContigRGB(TIFFRGBAImage *img, tif_uint32 *cp, tif_uint32 x, tif_u
|
||||||
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
tif_int32 fromskew, tif_int32 toskew, byte *pp)
|
||||||
{
|
{
|
||||||
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
||||||
Size size = helper->size;
|
// Size size = helper->size;
|
||||||
int iw = toskew + w;
|
int iw = toskew + w;
|
||||||
int wh = w * h;
|
int wh = w * h;
|
||||||
if(wh > helper->buffer.GetCount())
|
if(wh > helper->buffer.GetCount())
|
||||||
|
|
@ -747,7 +748,7 @@ static void putSeparate(TIFFRGBAImage *img, tif_uint32 *cp,
|
||||||
tif_int32 fromskew, tif_int32 toskew, byte *r, byte *g, byte *b, byte *a)
|
tif_int32 fromskew, tif_int32 toskew, byte *r, byte *g, byte *b, byte *a)
|
||||||
{
|
{
|
||||||
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
TIFRaster::Data *helper = (TIFRaster::Data *)img;
|
||||||
Size size = helper->size;
|
// Size size = helper->size;
|
||||||
int wh = w * h;
|
int wh = w * h;
|
||||||
if(wh > helper->buffer.GetCount())
|
if(wh > helper->buffer.GetCount())
|
||||||
helper->buffer.SetCount(wh);
|
helper->buffer.SetCount(wh);
|
||||||
|
|
@ -813,7 +814,7 @@ void TIFRaster::Data::Warning(const char *fn, const char *fmt, va_list ap)
|
||||||
if(!memcmp(fn, "tiff@", 5) && IsDigit(fn[5])) {
|
if(!memcmp(fn, "tiff@", 5) && IsDigit(fn[5])) {
|
||||||
int addr = stou(fn + 5);
|
int addr = stou(fn + 5);
|
||||||
if(addr != -1 && addr != 0) {
|
if(addr != -1 && addr != 0) {
|
||||||
TIFRaster::Data& wrapper = *reinterpret_cast<TIFRaster::Data *>(addr);
|
// TIFRaster::Data& wrapper = *reinterpret_cast<TIFRaster::Data *>(addr);
|
||||||
LLOG("TIF warning: " << VFormat(fmt, ap));
|
LLOG("TIF warning: " << VFormat(fmt, ap));
|
||||||
// RLOG("TiffWrapper::Warning: " << wrapper.errors);
|
// RLOG("TiffWrapper::Warning: " << wrapper.errors);
|
||||||
}
|
}
|
||||||
|
|
@ -825,7 +826,7 @@ void TIFRaster::Data::Error(const char *fn, const char *fmt, va_list ap)
|
||||||
if(!memcmp(fn, "tiff@", 5) && IsDigit(fn[5])) {
|
if(!memcmp(fn, "tiff@", 5) && IsDigit(fn[5])) {
|
||||||
int addr = stou(fn + 5);
|
int addr = stou(fn + 5);
|
||||||
if(addr != -1 && addr != 0) {
|
if(addr != -1 && addr != 0) {
|
||||||
Data& wrapper = *reinterpret_cast<Data *>(addr);
|
// Data& wrapper = *reinterpret_cast<Data *>(addr);
|
||||||
LLOG("TIF error: " << VFormat(fmt, ap));
|
LLOG("TIF error: " << VFormat(fmt, ap));
|
||||||
// RLOG("TiffWrapper::Error: " << wrapper.errors);
|
// RLOG("TiffWrapper::Error: " << wrapper.errors);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ void UnZip::ReadDir()
|
||||||
|
|
||||||
zip->Seek(offset);
|
zip->Seek(offset);
|
||||||
for(int i = 0; i < entries; i++) {
|
for(int i = 0; i < entries; i++) {
|
||||||
int64 rof = zip->GetPos() - offset;
|
|
||||||
if(zip->Get32le() != 0x02014b50 && zip->IsEof())
|
if(zip->Get32le() != 0x02014b50 && zip->IsEof())
|
||||||
return;
|
return;
|
||||||
File& f = file.Add();
|
File& f = file.Add();
|
||||||
|
|
@ -99,7 +98,7 @@ bool UnZip::ReadFile(Stream& out, Gate2<int, int> progress)
|
||||||
zip->Seek(f.offset);
|
zip->Seek(f.offset);
|
||||||
if(zip->Get32le() != 0x04034b50)
|
if(zip->Get32le() != 0x04034b50)
|
||||||
return false;
|
return false;
|
||||||
int ver = zip->Get16le();
|
zip->Get16le();
|
||||||
zip->Get16le(); // Skip header, use info from centrall dir
|
zip->Get16le(); // Skip header, use info from centrall dir
|
||||||
zip->Get16le();
|
zip->Get16le();
|
||||||
zip->Get32le();
|
zip->Get32le();
|
||||||
|
|
@ -110,7 +109,7 @@ bool UnZip::ReadFile(Stream& out, Gate2<int, int> progress)
|
||||||
dword extralen = zip->Get16le();
|
dword extralen = zip->Get16le();
|
||||||
zip->SeekCur(filelen + extralen);
|
zip->SeekCur(filelen + extralen);
|
||||||
dword crc;
|
dword crc;
|
||||||
int l;
|
dword l;
|
||||||
if(f.method == 0) {
|
if(f.method == 0) {
|
||||||
Buffer<byte> temp(65536);
|
Buffer<byte> temp(65536);
|
||||||
int loaded;
|
int loaded;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue