mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
mixed 8 char tabs & spaces -> spaces
This commit is contained in:
parent
071b8e6b46
commit
11ce826121
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "Imaging.h"
|
#include "Imaging.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBJPEG
|
#ifdef HAVE_LIBJPEG
|
||||||
|
|
||||||
#undef HAVE_PROTOTYPES
|
#undef HAVE_PROTOTYPES
|
||||||
#undef HAVE_STDLIB_H
|
#undef HAVE_STDLIB_H
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
#include "Jpeg.h"
|
#include "Jpeg.h"
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* Suspending output handler */
|
/* Suspending output handler */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
|
@ -64,16 +64,16 @@ jpeg_buffer_dest(j_compress_ptr cinfo, JPEGDESTINATION* destination)
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/* Error handler */
|
/* Error handler */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
METHODDEF(void)
|
METHODDEF(void)
|
||||||
error(j_common_ptr cinfo)
|
error(j_common_ptr cinfo)
|
||||||
{
|
{
|
||||||
JPEGERROR* error;
|
JPEGERROR* error;
|
||||||
error = (JPEGERROR*) cinfo->err;
|
error = (JPEGERROR*) cinfo->err;
|
||||||
(*cinfo->err->output_message) (cinfo);
|
(*cinfo->err->output_message) (cinfo);
|
||||||
longjmp(error->setjmp_buffer, 1);
|
longjmp(error->setjmp_buffer, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,59 +146,59 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
|
|
||||||
/* Use custom quantization tables */
|
/* Use custom quantization tables */
|
||||||
if (context->qtables) {
|
if (context->qtables) {
|
||||||
int i;
|
int i;
|
||||||
int quality = 100;
|
int quality = 100;
|
||||||
if (context->quality > 0) {
|
if (context->quality > 0) {
|
||||||
quality = context->quality;
|
quality = context->quality;
|
||||||
}
|
}
|
||||||
for (i = 0; i < sizeof(context->qtables)/sizeof(unsigned int); i++) {
|
for (i = 0; i < sizeof(context->qtables)/sizeof(unsigned int); i++) {
|
||||||
// TODO: Should add support for none baseline
|
// TODO: Should add support for none baseline
|
||||||
jpeg_add_quant_table(&context->cinfo, i, context->qtables[i],
|
jpeg_add_quant_table(&context->cinfo, i, context->qtables[i],
|
||||||
quality, TRUE);
|
quality, TRUE);
|
||||||
}
|
}
|
||||||
} else if (context->quality > 0) {
|
} else if (context->quality > 0) {
|
||||||
jpeg_set_quality(&context->cinfo, context->quality, 1);
|
jpeg_set_quality(&context->cinfo, context->quality, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set subsampling options */
|
/* Set subsampling options */
|
||||||
switch (context->subsampling)
|
switch (context->subsampling)
|
||||||
{
|
{
|
||||||
case 0: /* 1x1 1x1 1x1 (4:4:4) : None */
|
case 0: /* 1x1 1x1 1x1 (4:4:4) : None */
|
||||||
{
|
{
|
||||||
context->cinfo.comp_info[0].h_samp_factor = 1;
|
context->cinfo.comp_info[0].h_samp_factor = 1;
|
||||||
context->cinfo.comp_info[0].v_samp_factor = 1;
|
context->cinfo.comp_info[0].v_samp_factor = 1;
|
||||||
context->cinfo.comp_info[1].h_samp_factor = 1;
|
context->cinfo.comp_info[1].h_samp_factor = 1;
|
||||||
context->cinfo.comp_info[1].v_samp_factor = 1;
|
context->cinfo.comp_info[1].v_samp_factor = 1;
|
||||||
context->cinfo.comp_info[2].h_samp_factor = 1;
|
context->cinfo.comp_info[2].h_samp_factor = 1;
|
||||||
context->cinfo.comp_info[2].v_samp_factor = 1;
|
context->cinfo.comp_info[2].v_samp_factor = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: /* 2x1, 1x1, 1x1 (4:2:2) : Medium */
|
case 1: /* 2x1, 1x1, 1x1 (4:2:2) : Medium */
|
||||||
{
|
{
|
||||||
context->cinfo.comp_info[0].h_samp_factor = 2;
|
context->cinfo.comp_info[0].h_samp_factor = 2;
|
||||||
context->cinfo.comp_info[0].v_samp_factor = 1;
|
context->cinfo.comp_info[0].v_samp_factor = 1;
|
||||||
context->cinfo.comp_info[1].h_samp_factor = 1;
|
context->cinfo.comp_info[1].h_samp_factor = 1;
|
||||||
context->cinfo.comp_info[1].v_samp_factor = 1;
|
context->cinfo.comp_info[1].v_samp_factor = 1;
|
||||||
context->cinfo.comp_info[2].h_samp_factor = 1;
|
context->cinfo.comp_info[2].h_samp_factor = 1;
|
||||||
context->cinfo.comp_info[2].v_samp_factor = 1;
|
context->cinfo.comp_info[2].v_samp_factor = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: /* 2x2, 1x1, 1x1 (4:1:1) : High */
|
case 2: /* 2x2, 1x1, 1x1 (4:1:1) : High */
|
||||||
{
|
{
|
||||||
context->cinfo.comp_info[0].h_samp_factor = 2;
|
context->cinfo.comp_info[0].h_samp_factor = 2;
|
||||||
context->cinfo.comp_info[0].v_samp_factor = 2;
|
context->cinfo.comp_info[0].v_samp_factor = 2;
|
||||||
context->cinfo.comp_info[1].h_samp_factor = 1;
|
context->cinfo.comp_info[1].h_samp_factor = 1;
|
||||||
context->cinfo.comp_info[1].v_samp_factor = 1;
|
context->cinfo.comp_info[1].v_samp_factor = 1;
|
||||||
context->cinfo.comp_info[2].h_samp_factor = 1;
|
context->cinfo.comp_info[2].h_samp_factor = 1;
|
||||||
context->cinfo.comp_info[2].v_samp_factor = 1;
|
context->cinfo.comp_info[2].v_samp_factor = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
/* Use the lib's default */
|
/* Use the lib's default */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (context->progressive)
|
if (context->progressive)
|
||||||
jpeg_simple_progression(&context->cinfo);
|
jpeg_simple_progression(&context->cinfo);
|
||||||
context->cinfo.smoothing_factor = context->smooth;
|
context->cinfo.smoothing_factor = context->smooth;
|
||||||
|
@ -219,19 +219,19 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
jpeg_start_compress(&context->cinfo, FALSE);
|
jpeg_start_compress(&context->cinfo, FALSE);
|
||||||
/* suppress extra section */
|
/* suppress extra section */
|
||||||
context->extra_offset = context->extra_size;
|
context->extra_offset = context->extra_size;
|
||||||
//add exif header
|
//add exif header
|
||||||
if (context->rawExifLen > 0)
|
if (context->rawExifLen > 0)
|
||||||
jpeg_write_marker(&context->cinfo, JPEG_APP0+1, (unsigned char*)context->rawExif, context->rawExifLen);
|
jpeg_write_marker(&context->cinfo, JPEG_APP0+1, (unsigned char*)context->rawExif, context->rawExifLen);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* interchange stream */
|
/* interchange stream */
|
||||||
jpeg_start_compress(&context->cinfo, TRUE);
|
jpeg_start_compress(&context->cinfo, TRUE);
|
||||||
//add exif header
|
//add exif header
|
||||||
if (context->rawExifLen > 0)
|
if (context->rawExifLen > 0)
|
||||||
jpeg_write_marker(&context->cinfo, JPEG_APP0+1, (unsigned char*)context->rawExif, context->rawExifLen);
|
jpeg_write_marker(&context->cinfo, JPEG_APP0+1, (unsigned char*)context->rawExif, context->rawExifLen);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state->state++;
|
state->state++;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
@ -253,7 +253,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
state->state++;
|
state->state++;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user