summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-10-20 16:03:52 +0200
committerEven Rouault <even.rouault@spatialys.com>2021-10-20 16:04:26 +0200
commit71bb3c7ef25c20c0a59ac77cfc140e21ac115bdd (patch)
treeb0965ecb4ef30e063f423cbe7a41a7a78ab69723
parent1e45791e6b5c4f646a89ca9145f19bb8c45c9422 (diff)
downloadlibtiff-git-71bb3c7ef25c20c0a59ac77cfc140e21ac115bdd.tar.gz
tif_webp.c: white space fixing
-rw-r--r--libtiff/tif_webp.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/libtiff/tif_webp.c b/libtiff/tif_webp.c
index d5b99d35..ce632641 100644
--- a/libtiff/tif_webp.c
+++ b/libtiff/tif_webp.c
@@ -44,7 +44,7 @@
*/
typedef struct {
uint16_t nSamples; /* number of samples per pixel */
-
+
int lossless; /* lossy/lossless compression */
int quality_level; /* compression level */
WebPPicture sPicture; /* WebP Picture */
@@ -52,13 +52,13 @@ typedef struct {
uint8_t* pBuffer; /* buffer to hold raw data on encoding */
unsigned int buffer_offset; /* current offset into the buffer */
unsigned int buffer_size;
-
+
WebPIDecoder* psDecoder; /* WebPIDecoder */
WebPDecBuffer sDecBuffer; /* Decoder buffer */
int last_y; /* Last row decoded */
-
+
int state; /* state flags */
-
+
TIFFVGetMethod vgetparent; /* super-class method */
TIFFVSetMethod vsetparent; /* super-class method */
} WebPState;
@@ -76,7 +76,7 @@ int TWebPDatasetWriter(const uint8_t* data, size_t data_size,
{
static const char module[] = "TWebPDatasetWriter";
TIFF* tif = (TIFF*)(picture->custom_ptr);
-
+
if ( (tif->tif_rawcc + (tmsize_t)data_size) > tif->tif_rawdatasize ) {
TIFFErrorExt(tif->tif_clientdata, module,
"Buffer too small by %"TIFF_SIZE_FORMAT" bytes.",
@@ -86,7 +86,7 @@ int TWebPDatasetWriter(const uint8_t* data, size_t data_size,
_TIFFmemcpy(tif->tif_rawcp, data, data_size);
tif->tif_rawcc += data_size;
tif->tif_rawcp += data_size;
- return 1;
+ return 1;
}
}
@@ -102,7 +102,7 @@ TWebPEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
assert(sp != NULL);
assert(sp->state == LSTATE_INIT_ENCODE);
-
+
if((uint64_t)sp->buffer_offset +
(uint64_t)cc > sp->buffer_size )
{
@@ -116,7 +116,7 @@ TWebPEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
sp->buffer_offset += (unsigned)cc;
return 1;
-
+
}
static int
@@ -125,11 +125,11 @@ TWebPDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
static const char module[] = "WebPDecode";
VP8StatusCode status = VP8_STATUS_OK;
WebPState *sp = DecoderState(tif);
- (void) s;
+ (void) s;
assert(sp != NULL);
assert(sp->state == LSTATE_INIT_DECODE);
-
+
if (occ % sp->sDecBuffer.u.RGBA.stride)
{
TIFFErrorExt(tif->tif_clientdata, module,
@@ -142,13 +142,13 @@ TWebPDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) {
if (status == VP8_STATUS_INVALID_PARAM) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Invalid parameter used.");
+ "Invalid parameter used.");
} else if (status == VP8_STATUS_OUT_OF_MEMORY) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Out of memory.");
+ "Out of memory.");
} else {
TIFFErrorExt(tif->tif_clientdata, module,
- "Unrecognized error.");
+ "Unrecognized error.");
}
return 0;
} else {
@@ -157,10 +157,10 @@ TWebPDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
/* Returns the RGB/A image decoded so far */
buf = WebPIDecGetRGB(sp->psDecoder, &current_y, NULL, NULL, &stride);
-
+
if ((buf != NULL) &&
(occ <= (tmsize_t)stride * (current_y - sp->last_y))) {
- memcpy(op,
+ memcpy(op,
buf + (sp->last_y * stride),
occ);
@@ -169,7 +169,7 @@ TWebPDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
sp->last_y += occ / sp->sDecBuffer.u.RGBA.stride;
return 1;
} else {
- TIFFErrorExt(tif->tif_clientdata, module, "Unable to decode WebP data.");
+ TIFFErrorExt(tif->tif_clientdata, module, "Unable to decode WebP data.");
return 0;
}
}
@@ -227,7 +227,7 @@ TWebPSetupDecode(TIFF* tif)
"WEBP driver requires 8 bit unsigned data");
return 0;
}
-
+
/* if we were last encoding, terminate this mode */
if (sp->state & LSTATE_INIT_ENCODE) {
WebPPictureFree(&sp->sPicture);
@@ -256,7 +256,7 @@ TWebPPreDecode(TIFF* tif, uint16_t s)
TIFFDirectory* td = &tif->tif_dir;
(void) s;
assert(sp != NULL);
-
+
if (isTiled(tif)) {
segment_width = td->td_tilewidth;
segment_height = td->td_tilelength;
@@ -275,7 +275,7 @@ TWebPPreDecode(TIFF* tif, uint16_t s)
if( (sp->state & LSTATE_INIT_DECODE) == 0 )
tif->tif_setupdecode(tif);
-
+
if (sp->psDecoder != NULL) {
WebPIDelete(sp->psDecoder);
WebPFreeDecBuffer(&sp->sDecBuffer);
@@ -283,29 +283,29 @@ TWebPPreDecode(TIFF* tif, uint16_t s)
}
sp->last_y = 0;
-
+
WebPInitDecBuffer(&sp->sDecBuffer);
-
+
sp->sDecBuffer.is_external_memory = 0;
sp->sDecBuffer.width = segment_width;
sp->sDecBuffer.height = segment_height;
sp->sDecBuffer.u.RGBA.stride = segment_width * sp->nSamples;
sp->sDecBuffer.u.RGBA.size = segment_width * sp->nSamples * segment_height;
-
+
if (sp->nSamples > 3) {
sp->sDecBuffer.colorspace = MODE_RGBA;
} else {
sp->sDecBuffer.colorspace = MODE_RGB;
}
-
+
sp->psDecoder = WebPINewDecoder(&sp->sDecBuffer);
-
+
if (sp->psDecoder == NULL) {
TIFFErrorExt(tif->tif_clientdata, module,
"Unable to allocate WebP decoder.");
return 0;
}
-
+
return 1;
}
@@ -315,7 +315,7 @@ TWebPSetupEncode(TIFF* tif)
static const char module[] = "WebPSetupEncode";
uint16_t nBitsPerSample = tif->tif_dir.td_bitspersample;
uint16_t sampleFormat = tif->tif_dir.td_sampleformat;
-
+
WebPState* sp = EncoderState(tif);
assert(sp != NULL);
@@ -337,14 +337,14 @@ TWebPSetupEncode(TIFF* tif)
sp->nSamples );
return 0;
}
-
+
/* check bits per sample and data type */
if ((nBitsPerSample != 8) || (sampleFormat != SAMPLEFORMAT_UINT)) {
TIFFErrorExt(tif->tif_clientdata, module,
"WEBP driver requires 8 bit unsigned data");
return 0;
}
-
+
if (sp->state & LSTATE_INIT_DECODE) {
WebPIDelete(sp->psDecoder);
WebPFreeDecBuffer(&sp->sDecBuffer);
@@ -417,7 +417,7 @@ TWebPPreEncode(TIFF* tif, uint16_t s)
}
if( segment_width > 16383 || segment_height > 16383 ) {
- TIFFErrorExt(tif->tif_clientdata, module,
+ TIFFErrorExt(tif->tif_clientdata, module,
"WEBP maximum image dimensions are 16383 x 16383.");
return 0;
}
@@ -425,12 +425,12 @@ TWebPPreEncode(TIFF* tif, uint16_t s)
/* set up buffer for raw data */
/* given above check and that nSamples <= 4, buffer_size is <= 1 GB */
sp->buffer_size = segment_width * segment_height * sp->nSamples;
-
+
if (sp->pBuffer != NULL) {
_TIFFfree(sp->pBuffer);
- sp->pBuffer = NULL;
+ sp->pBuffer = NULL;
}
-
+
sp->pBuffer = _TIFFmalloc(sp->buffer_size);
if( !sp->pBuffer) {
TIFFErrorExt(tif->tif_clientdata, module, "Cannot allocate buffer");
@@ -476,7 +476,7 @@ TWebPPostEncode(TIFF* tif)
"WebPPictureImportRGB() failed");
return 0;
}
-
+
if (!WebPEncode(&sp->sEncoderConfig, &sp->sPicture)) {
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
@@ -554,10 +554,10 @@ TWebPCleanup(TIFF* tif)
sp->psDecoder = NULL;
sp->last_y = 0;
}
-
+
if (sp->pBuffer != NULL) {
_TIFFfree(sp->pBuffer);
- sp->pBuffer = NULL;
+ sp->pBuffer = NULL;
}
_TIFFfree(tif->tif_data);
@@ -593,7 +593,7 @@ TWebPVSetField(TIFF* tif, uint32_t tag, va_list ap)
"Need to upgrade WEBP driver, this version doesn't support "
"lossless compression.");
return 0;
- #endif
+ #endif
default:
return (*sp->vsetparent)(tif, tag, ap);
}
@@ -669,7 +669,7 @@ TIFFInitWebP(TIFF* tif, int scheme)
sp->nSamples = 0;
sp->psDecoder = NULL;
sp->last_y = 0;
-
+
sp->buffer_offset = 0;
sp->pBuffer = NULL;