Skip to content

Commit

Permalink
Clarify documentation in tiffio.c and pdfapp.c
Browse files Browse the repository at this point in the history
* Also clean up pixaWriteMemWebPAnim()
  • Loading branch information
DanBloomberg committed Dec 24, 2023
1 parent bd71b10 commit aa18831
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
10 changes: 10 additions & 0 deletions src/pdfapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
* Image processing operations on multiple images followed by wrapping
* them into a pdf.
*
* There are two possible ways to specify the set of images:
* (1) an array of pathnames
* (2) a directory, typically with an additional pattern for selection.
* We use (1) because it is both simpler and more general.
*
* Corresponding to each function here is:
* (1) the image processing function that is carried out on each image
* (2) a program in prog that extracts images from a pdf and calls this
* function with an array of their pathnames.
*
* |=============================================================|
* | Important notes |
* |=============================================================|
Expand Down
13 changes: 6 additions & 7 deletions src/tiffio.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,14 @@
* * The exception is the old-style jpeg tiff format (OJPEG), which
* is not supported.
* * We support two formats requiring external libraries: ZIP and JPEG
* Both libz and libjpeg are required.
* All computers should have the zip library.
* * At present we do not support WEBP in tiff, which uses
* libwebp and was added in tifflib 4.1.0 in 2019.
* Note 3: On Windows with 2 bpp or 4 bpp images, the bytes in the
* tiff-compressed file depend on the pad bits, but not on the
* decoded raster image when read. Because it is sometimes
* convenient to use a golden file with a byte-by-byte check
* to verify invariance, we set the pad bits to 0 before writing,
* in pixWriteToTiffStream().
* Note 3: We set the pad bits to 0 before writing in pixWriteToTiffStream().
* Although they don't affect the raster image after decompression,
* it is sometimes convenient to use a golden file with a
* byte-by-byte check to verify invariance. The issue came up
* on Windows for 2 and 4 bpp images.
* </pre>
*/

Expand Down
14 changes: 7 additions & 7 deletions src/webpanimio.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ WebPPicture frame;
return ERROR_INT("cannot initialize WebP config", __func__, 1);
config.lossless = lossless;
config.quality = quality;
enc = WebPAnimEncoderNew(w, h, &enc_options);
if (enc == NULL)
if ((enc = WebPAnimEncoderNew(w, h, &enc_options)) == NULL)
return ERROR_INT("cannot create WebP encoder", __func__, 1);

for (i = 0; i < n; i++) {
Expand Down Expand Up @@ -239,16 +238,17 @@ WebPPicture frame;
return ERROR_INT("cannot add frame to animation", __func__, 1);
}
}
/* add a blank frame */
/* Add a blank frame */
if (!WebPAnimEncoderAdd(enc, NULL, duration * i, NULL)) {
WebPAnimEncoderDelete(enc);
return ERROR_INT("cannot add blank frame to animation", __func__, 1);
WebPAnimEncoderDelete(enc);
return ERROR_INT("blank frame not added to animation", __func__, 1);
}
/* encode the data */

/* Encode the data */
ret_webp = WebPAnimEncoderAssemble(enc, &webp_data);
WebPAnimEncoderDelete(enc);
if (!ret_webp)
return ERROR_INT("cannot assemble animation", __func__, 1);
return ERROR_INT("cannot assemble animation", __func__, 1);

/* Set the loopcount if requested. Note that when you make a mux,
* it imports the webp_data that was previously made, including
Expand Down

0 comments on commit aa18831

Please sign in to comment.