#include <precomp.h>
#include "tif_predict.h"
Go to the source code of this file.
|
static int | horAcc8 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | horAcc16 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | horAcc32 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | swabHorAcc16 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | swabHorAcc32 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | horDiff8 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | horDiff16 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | horDiff32 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | swabHorDiff16 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | swabHorDiff32 (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | fpAcc (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | fpDiff (TIFF *tif, uint8 *cp0, tmsize_t cc) |
|
static int | PredictorDecodeRow (TIFF *tif, uint8 *op0, tmsize_t occ0, uint16 s) |
|
static int | PredictorDecodeTile (TIFF *tif, uint8 *op0, tmsize_t occ0, uint16 s) |
|
static int | PredictorEncodeRow (TIFF *tif, uint8 *bp, tmsize_t cc, uint16 s) |
|
static int | PredictorEncodeTile (TIFF *tif, uint8 *bp0, tmsize_t cc0, uint16 s) |
|
static int | PredictorSetup (TIFF *tif) |
|
static int | PredictorSetupDecode (TIFF *tif) |
|
static int | PredictorSetupEncode (TIFF *tif) |
|
static int | PredictorVSetField (TIFF *tif, uint32 tag, va_list ap) |
|
static int | PredictorVGetField (TIFF *tif, uint32 tag, va_list ap) |
|
static void | PredictorPrintDir (TIFF *tif, FILE *fd, long flags) |
|
int | TIFFPredictorInit (TIFF *tif) |
|
int | TIFFPredictorCleanup (TIFF *tif) |
|
◆ FIELD_PREDICTOR
◆ PredictorState
◆ REPEAT4
Value:
default: { \
case 0: ; \
}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition at line 261 of file tif_predict.c.
◆ fpAcc()
Definition at line 410 of file tif_predict.c.
411{
418
420 {
422 "%s", "cc%(bps*stride))!=0");
423 return 0;
424 }
425
427 if (!tmp)
428 return 0;
429
434 }
435
440 for (byte = 0; byte < bps; byte++) {
441 #if WORDS_BIGENDIAN
443 #else
445 tmp[(bps -
byte - 1) * wc +
count];
446 #endif
447 }
448 }
450 return 1;
451}
GLuint GLuint GLsizei count
void TIFFErrorExt(thandle_t fd, const char *module, const char *fmt,...)
#define PredictorState(tif)
void * _TIFFmalloc(tmsize_t s)
void _TIFFmemcpy(void *d, const void *s, tmsize_t c)
Referenced by PredictorSetupDecode().
◆ fpDiff()
Definition at line 646 of file tif_predict.c.
647{
654
656 {
658 "%s", "(cc%(bps*stride))!=0");
659 return 0;
660 }
661
663 if (!tmp)
664 return 0;
665
669 for (byte = 0; byte < bps; byte++) {
670 #if WORDS_BIGENDIAN
672 #else
673 cp[(bps -
byte - 1) * wc +
count] =
674 tmp[bps *
count +
byte];
675 #endif
676 }
677 }
679
684 return 1;
685}
Referenced by PredictorSetupEncode().
◆ horAcc16()
◆ horAcc32()
◆ horAcc8()
Definition at line 280 of file tif_predict.c.
281{
283
284 unsigned char*
cp = (
unsigned char*) cp0;
286 {
288 "%s", "(cc%stride)!=0");
289 return 0;
290 }
291
293
294
295
297 unsigned int cr =
cp[0];
298 unsigned int cg =
cp[1];
299 unsigned int cb =
cp[2];
303 cp[0] = (
unsigned char) ((cr +=
cp[0]) & 0xff);
304 cp[1] = (
unsigned char) ((cg +=
cp[1]) & 0xff);
305 cp[2] = (
unsigned char) ((
cb +=
cp[2]) & 0xff);
308 }
310 unsigned int cr =
cp[0];
311 unsigned int cg =
cp[1];
312 unsigned int cb =
cp[2];
313 unsigned int ca =
cp[3];
317 cp[0] = (
unsigned char) ((cr +=
cp[0]) & 0xff);
318 cp[1] = (
unsigned char) ((cg +=
cp[1]) & 0xff);
319 cp[2] = (
unsigned char) ((
cb +=
cp[2]) & 0xff);
320 cp[3] = (
unsigned char) ((
ca +=
cp[3]) & 0xff);
323 }
324 } else {
326 do {
331 }
332 }
333 return 1;
334}
static HMODULE MODULEINFO DWORD cb
Referenced by PredictorSetupDecode().
◆ horDiff16()
◆ horDiff32()
◆ horDiff8()
Definition at line 509 of file tif_predict.c.
510{
513 unsigned char*
cp = (
unsigned char*) cp0;
514
516 {
518 "%s", "(cc%stride)!=0");
519 return 0;
520 }
521
524
525
526
528 unsigned int r1, g1,
b1;
529 unsigned int r2 =
cp[0];
530 unsigned int g2 =
cp[1];
531 unsigned int b2 =
cp[2];
532 do {
534 g1 =
cp[4];
cp[4] = (
unsigned char)((g1-g2)&0xff); g2 = g1;
537 }
while ((
cc -= 3) > 0);
539 unsigned int r1, g1,
b1,
a1;
540 unsigned int r2 =
cp[0];
541 unsigned int g2 =
cp[1];
542 unsigned int b2 =
cp[2];
543 unsigned int a2 =
cp[3];
544 do {
546 g1 =
cp[5];
cp[5] = (
unsigned char)((g1-g2)&0xff); g2 = g1;
550 }
while ((
cc -= 4) > 0);
551 } else {
553 do {
556 }
557 }
558 return 1;
559}
static const struct update_accum a1
static const struct update_accum a2
static CRYPT_DATA_BLOB b2[]
static CRYPT_DATA_BLOB b1[]
Referenced by PredictorSetupEncode().
◆ PredictorDecodeRow()
Definition at line 457 of file tif_predict.c.
458{
460
464
465 if ((*
sp->decoderow)(tif, op0, occ0,
s)) {
466 return (*
sp->decodepfunc)(tif, op0, occ0);
467 } else
468 return 0;
469}
Referenced by PredictorSetupDecode().
◆ PredictorDecodeTile()
Definition at line 479 of file tif_predict.c.
480{
482
485
486 if ((*
sp->decodetile)(tif, op0, occ0,
s)) {
489 if((occ0%rowsize) !=0)
490 {
492 "%s", "occ0%rowsize != 0");
493 return 0;
494 }
496 while (occ0 > 0) {
497 if( !(*
sp->decodepfunc)(tif, op0, rowsize) )
498 return 0;
499 occ0 -= rowsize;
500 op0 += rowsize;
501 }
502 return 1;
503 } else
504 return 0;
505}
Referenced by PredictorSetupDecode().
◆ PredictorEncodeRow()
◆ PredictorEncodeTile()
Definition at line 703 of file tif_predict.c.
704{
705 static const char module[] =
"PredictorEncodeTile";
709 unsigned char* bp;
710 int result_code;
711
715
716
717
718
719
721 if( working_copy ==
NULL )
722 {
725 cc0 );
726 return 0;
727 }
728 memcpy( working_copy, bp0, cc0 );
729 bp = working_copy;
730
731 rowsize =
sp->rowsize;
733 if((cc0%rowsize)!=0)
734 {
736 "%s", "(cc0%rowsize)!=0");
738 return 0;
739 }
741 (*
sp->encodepfunc)(tif, bp, rowsize);
743 bp += rowsize;
744 }
745 result_code = (*
sp->encodetile)(tif, working_copy, cc0,
s);
746
748
749 return result_code;
750}
#define memcpy(s1, s2, n)
#define TIFF_SSIZE_FORMAT
Referenced by PredictorSetupEncode().
◆ PredictorPrintDir()
Definition at line 797 of file tif_predict.c.
798{
800
804 switch (
sp->predictor) {
806 case 2:
fprintf(
fd,
"horizontal differencing ");
break;
807 case 3:
fprintf(
fd,
"floating point predictor ");
break;
808 }
810 }
813}
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define TIFFFieldSet(tif, field)
Referenced by TIFFPredictorInit().
◆ PredictorSetup()
static int PredictorSetup |
( |
TIFF * |
tif | ) |
|
|
static |
Definition at line 53 of file tif_predict.c.
54{
55 static const char module[] =
"PredictorSetup";
56
59
60 switch (
sp->predictor)
61 {
63 return 1;
69 "Horizontal differencing \"Predictor\" not supported with %d-bit samples",
71 return 0;
72 }
73 break;
77 "Floating point \"Predictor\" not supported with %d data format",
79 return 0;
80 }
86 "Floating point \"Predictor\" not supported with %d-bit samples",
88 return 0;
89 }
90 break;
91 default:
93 "\"Predictor\" value %d not supported",
95 return 0;
96 }
99
100
101
104 else
106 if (
sp->rowsize == 0)
107 return 0;
108
109 return 1;
110}
uint16 td_samplesperpixel
tmsize_t TIFFScanlineSize(TIFF *tif)
tmsize_t TIFFTileRowSize(TIFF *tif)
#define PREDICTOR_FLOATINGPOINT
#define SAMPLEFORMAT_IEEEFP
#define PREDICTOR_HORIZONTAL
#define PLANARCONFIG_CONTIG
Referenced by PredictorSetupDecode(), and PredictorSetupEncode().
◆ PredictorSetupDecode()
static int PredictorSetupDecode |
( |
TIFF * |
tif | ) |
|
|
static |
Definition at line 113 of file tif_predict.c.
114{
117
118
119
120
122 return 0;
123
124 if (
sp->predictor == 2) {
126 case 8:
sp->decodepfunc =
horAcc8;
break;
129 }
130
131
132
133
135 {
142 }
143
144
145
146
147
148
149
150
158 }
159 }
160 }
161
162 else if (
sp->predictor == 3) {
164
165
166
167
169 {
176 }
177
178
179
180
181
184 }
185
186
187
188
189 }
190
191 return 1;
192}
TIFFCodeMethod tif_decodestrip
TIFFPostMethod tif_postdecode
TIFFCodeMethod tif_decoderow
TIFFCodeMethod tif_decodetile
static int swabHorAcc16(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int PredictorDecodeRow(TIFF *tif, uint8 *op0, tmsize_t occ0, uint16 s)
static int PredictorDecodeTile(TIFF *tif, uint8 *op0, tmsize_t occ0, uint16 s)
static int horAcc16(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int PredictorSetup(TIFF *tif)
static int horAcc32(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int fpAcc(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int horAcc8(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int swabHorAcc32(TIFF *tif, uint8 *cp0, tmsize_t cc)
void _TIFFNoPostDecode(TIFF *tif, uint8 *buf, tmsize_t cc)
Referenced by TIFFPredictorInit().
◆ PredictorSetupEncode()
static int PredictorSetupEncode |
( |
TIFF * |
tif | ) |
|
|
static |
Definition at line 195 of file tif_predict.c.
196{
199
201 return 0;
202
203 if (
sp->predictor == 2) {
208 }
209
210
211
212
214 {
221 }
222
223
224
225
226
227
228
229
237 }
238 }
239 }
240
241 else if (
sp->predictor == 3) {
243
244
245
246
248 {
255 }
256 }
257
258 return 1;
259}
TIFFCodeMethod tif_encodestrip
TIFFCodeMethod tif_encodetile
TIFFCodeMethod tif_encoderow
static int swabHorDiff16(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int fpDiff(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int PredictorEncodeRow(TIFF *tif, uint8 *bp, tmsize_t cc, uint16 s)
static int swabHorDiff32(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int horDiff8(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int PredictorEncodeTile(TIFF *tif, uint8 *bp0, tmsize_t cc0, uint16 s)
static int horDiff16(TIFF *tif, uint8 *cp0, tmsize_t cc)
static int horDiff32(TIFF *tif, uint8 *cp0, tmsize_t cc)
Referenced by TIFFPredictorInit().
◆ PredictorVGetField()
Definition at line 779 of file tif_predict.c.
780{
782
785
789 break;
790 default:
792 }
793 return 1;
794}
#define TIFFTAG_PREDICTOR
void int int ULONGLONG int va_list * ap
Referenced by TIFFPredictorInit().
◆ PredictorVSetField()
Definition at line 759 of file tif_predict.c.
760{
762
765
770 break;
771 default:
772 return (*
sp->vsetparent)(tif,
tag,
ap);
773 }
775 return 1;
776}
#define TIFFSetFieldBit(tif, field)
Referenced by TIFFPredictorInit().
◆ swabHorAcc16()
◆ swabHorAcc32()
◆ swabHorDiff16()
◆ swabHorDiff32()
◆ TIFFPredictorCleanup()
int TIFFPredictorCleanup |
( |
TIFF * |
tif | ) |
|
Definition at line 857 of file tif_predict.c.
858{
860
862
868
869 return 1;
870}
TIFFTagMethods tif_tagmethods
TIFFBoolMethod tif_setupencode
TIFFBoolMethod tif_setupdecode
◆ TIFFPredictorInit()
int TIFFPredictorInit |
( |
TIFF * |
tif | ) |
|
Definition at line 816 of file tif_predict.c.
817{
819
821
822
823
824
828 "Merging Predictor codec-specific tags failed");
829 return 0;
830 }
831
832
833
834
844
849
853 return 1;
854}
int _TIFFMergeFields(TIFF *tif, const TIFFField info[], uint32 n)
static void PredictorPrintDir(TIFF *tif, FILE *fd, long flags)
static int PredictorSetupDecode(TIFF *tif)
static int PredictorSetupEncode(TIFF *tif)
static const TIFFField predictFields[]
static int PredictorVGetField(TIFF *tif, uint32 tag, va_list ap)
static int PredictorVSetField(TIFF *tif, uint32 tag, va_list ap)
#define TIFFArrayCount(a)
◆ predictFields
Initial value:= {
{
TIFFTAG_PREDICTOR, 1, 1,
TIFF_SHORT, 0,
TIFF_SETGET_UINT16,
TIFF_SETGET_UINT16,
FIELD_PREDICTOR,
FALSE,
FALSE,
"Predictor",
NULL },
}
Definition at line 754 of file tif_predict.c.
Referenced by TIFFPredictorInit().