Removing explicit progressive support
This commit is contained in:
parent
4e4aae1a9f
commit
67315131d0
|
@ -41,7 +41,6 @@ typedef struct cs_jpeg_pars
|
|||
int quality;
|
||||
bool exif_copy;
|
||||
int dct_method;
|
||||
bool progressive;
|
||||
} cs_jpeg_pars;
|
||||
```
|
||||
The first 3 parameters matters, in term of compression, while the others will be set by the compressor/decompressor
|
||||
|
@ -49,7 +48,6 @@ during the compression progress and thus they will be overwritten.
|
|||
- **quality**: in a range from 0 to 100, the quality of the resulting image. **Note** that 0 means _optimization_ (see below). Default: 0.
|
||||
- **exif_copy**: set it to _true_ to copy EXIF tag info after compression. Default: false.
|
||||
- **dct_method**: one of the turbojpeg DCT flags. Default: TJFLAG_FASTDCT.
|
||||
- **progressive**: set to _true_ to output a progressive JPEG, _false_ for scanline. Default: false.
|
||||
|
||||
### PNG
|
||||
```C
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "png.h"
|
||||
#include "jpeg.h"
|
||||
|
||||
bool cs_compress(const char *input_path, char *output_path, cs_image_pars *options)
|
||||
bool cs_compress(const char *input_path, const char *output_path, cs_image_pars *options)
|
||||
{
|
||||
FILE *pInputFile;
|
||||
image_type type;
|
||||
|
@ -21,12 +21,6 @@ bool cs_compress(const char *input_path, char *output_path, cs_image_pars *optio
|
|||
|
||||
fclose(pInputFile);
|
||||
|
||||
//Same input and output, we need to use a temporary file
|
||||
if (strcmp(input_path, output_path) == 0) {
|
||||
output_path = realloc(output_path, (strlen(output_path) + 4) * sizeof(char));
|
||||
snprintf(output_path, strlen(output_path) + 4, "%s.cs", output_path);
|
||||
}
|
||||
|
||||
if (type == UNKN) {
|
||||
display_error(WARNING, 103);
|
||||
} else if (type == CS_JPEG) {
|
||||
|
@ -51,7 +45,6 @@ void initialize_jpeg_parameters(cs_image_pars *options)
|
|||
options->jpeg.quality = 0;
|
||||
options->jpeg.exif_copy = false;
|
||||
options->jpeg.dct_method = 2048;
|
||||
options->jpeg.progressive = false;
|
||||
}
|
||||
|
||||
void initialize_png_parameters(cs_image_pars *par)
|
||||
|
|
|
@ -13,7 +13,6 @@ typedef struct cs_jpeg_pars
|
|||
int quality;
|
||||
bool exif_copy;
|
||||
int dct_method;
|
||||
bool progressive;
|
||||
/*
|
||||
* Parameters you have no reason to set as they will be
|
||||
* overwritten during the process
|
||||
|
@ -53,7 +52,7 @@ typedef enum error_level
|
|||
WARNING = 1
|
||||
} error_level;
|
||||
|
||||
bool cs_compress(const char *input_path, char *output_path, cs_image_pars *options);
|
||||
bool cs_compress(const char *input_path, const char *output_path, cs_image_pars *options);
|
||||
cs_image_pars initialize_parameters();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -96,11 +96,6 @@ bool cs_jpeg_optimize(const char *input_file, const char *output_file, cs_jpeg_p
|
|||
|
||||
//CRITICAL - This is the optimization step
|
||||
dstinfo.optimize_coding = true;
|
||||
//TODO
|
||||
//Progressive
|
||||
if (options->progressive) {
|
||||
jpeg_simple_progression(&dstinfo);
|
||||
}
|
||||
|
||||
//Set the output file parameters
|
||||
jpeg_stdio_dest(&dstinfo, fp);
|
||||
|
|
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
cs_image_pars options = initialize_parameters();
|
||||
cs_compress(argv[1], argv[2], &options);
|
||||
bool result = cs_compress(argv[1], argv[2], &options);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(result);
|
||||
}
|
Loading…
Reference in New Issue