Merge branch 'master' into dev
This commit is contained in:
@@ -45,6 +45,12 @@ approximately 2x when using the fast integer IDCT
|
||||
platforms when passing invalid arguments to certain methods in the TurboJPEG
|
||||
Java API.
|
||||
|
||||
2. Fixed a regression in the SIMD feature detection code, introduced by
|
||||
the AVX2 SIMD extensions (2.0 beta1[1]), that was known to cause an illegal
|
||||
instruction exception, in rare cases, on CPUs that lack support for CPUID leaf
|
||||
07H (or on which the maximum CPUID leaf has been limited by way of a BIOS
|
||||
setting.)
|
||||
|
||||
|
||||
2.0.2
|
||||
=====
|
||||
|
||||
6
jchuff.c
6
jchuff.c
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2011, 2014-2016, 2018, D. R. Commander.
|
||||
* Copyright (C) 2009-2011, 2014-2016, 2018-2019, D. R. Commander.
|
||||
* Copyright (C) 2015, Matthieu Darbois.
|
||||
* Copyright (C) 2018, Matthias Räncker.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
@@ -363,6 +363,8 @@ dump_buffer(working_state *state)
|
||||
put_buffer = (put_buffer << size) | code; \
|
||||
}
|
||||
|
||||
#if SIZEOF_SIZE_T != 8 && !defined(_WIN64)
|
||||
|
||||
#define CHECKBUF15() { \
|
||||
if (put_bits > 15) { \
|
||||
EMIT_BYTE() \
|
||||
@@ -370,6 +372,8 @@ dump_buffer(working_state *state)
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define CHECKBUF31() { \
|
||||
if (put_bits > 31) { \
|
||||
EMIT_BYTE() \
|
||||
|
||||
@@ -492,8 +492,8 @@ prepare_for_pass(j_compress_ptr cinfo)
|
||||
*/
|
||||
master->pass_type = output_pass;
|
||||
master->pass_number++;
|
||||
/*FALLTHROUGH*/
|
||||
#endif
|
||||
/*FALLTHROUGH*/
|
||||
case output_pass:
|
||||
/* Do a data-output pass. */
|
||||
/* We need not repeat per-scan setup if prior optimization pass did it. */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2012 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2011, 2014, 2016, D. R. Commander.
|
||||
* Copyright (C) 2011, 2014, 2016, 2019, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -27,6 +27,8 @@
|
||||
extern void *malloc(size_t size);
|
||||
extern void free(void *ptr);
|
||||
#endif
|
||||
void jpeg_mem_dest_tj(j_compress_ptr cinfo, unsigned char **outbuffer,
|
||||
unsigned long *outsize, boolean alloc);
|
||||
|
||||
|
||||
#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2011 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2011, 2016, D. R. Commander.
|
||||
* Copyright (C) 2011, 2016, 2019, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -23,6 +23,9 @@
|
||||
#include "jpeglib.h"
|
||||
#include "jerror.h"
|
||||
|
||||
void jpeg_mem_src_tj(j_decompress_ptr cinfo, const unsigned char *inbuffer,
|
||||
unsigned long insize);
|
||||
|
||||
|
||||
/*
|
||||
* Initialize source --- called by jpeg_read_header
|
||||
|
||||
@@ -429,8 +429,6 @@ h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
|
||||
#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
|
||||
|
||||
#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)
|
||||
|
||||
#define WRITE_TWO_PIXELS_LE(addr, pixels) { \
|
||||
((INT16 *)(addr))[0] = (INT16)(pixels); \
|
||||
((INT16 *)(addr))[1] = (INT16)((pixels) >> 16); \
|
||||
|
||||
15
md5/md5hl.c
15
md5/md5hl.c
@@ -6,7 +6,7 @@
|
||||
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||
* ----------------------------------------------------------------------------
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C)2016, 2018 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2016, 2018-2019 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
#include "./md5.h"
|
||||
|
||||
char *MD5End(MD5_CTX *ctx, char *buf)
|
||||
static char *MD5End(MD5_CTX *ctx, char *buf)
|
||||
{
|
||||
int i;
|
||||
unsigned char digest[LENGTH];
|
||||
@@ -89,7 +89,7 @@ char *MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
|
||||
off_t n;
|
||||
|
||||
MD5Init(&ctx);
|
||||
#if _WIN32
|
||||
#ifdef _WIN32
|
||||
f = _open(filename, O_RDONLY | O_BINARY);
|
||||
#else
|
||||
f = open(filename, O_RDONLY);
|
||||
@@ -123,12 +123,3 @@ char *MD5FileChunk(const char *filename, char *buf, off_t ofs, off_t len)
|
||||
return 0;
|
||||
return (MD5End(&ctx, buf));
|
||||
}
|
||||
|
||||
char *MD5Data(const void *data, unsigned int len, char *buf)
|
||||
{
|
||||
MD5_CTX ctx;
|
||||
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, (unsigned char *)data, len);
|
||||
return (MD5End(&ctx, buf));
|
||||
}
|
||||
|
||||
@@ -118,7 +118,6 @@ read_2_bytes(void)
|
||||
#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */
|
||||
#define M_EOI 0xD9 /* End Of Image (end of datastream) */
|
||||
#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
|
||||
#define M_APP0 0xE0 /* Application-specific marker, type N */
|
||||
#define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */
|
||||
#define M_COM 0xFE /* COMment */
|
||||
|
||||
|
||||
@@ -51,29 +51,14 @@ EXTN(jpeg_simd_cpu_support):
|
||||
xor eax, edx
|
||||
jz near .return ; CPUID is not supported
|
||||
|
||||
; Check for MMX instruction support
|
||||
; Check whether CPUID leaf 07H is supported
|
||||
; (leaf 07H is used to check for AVX2 instruction support)
|
||||
xor eax, eax
|
||||
cpuid
|
||||
test eax, eax
|
||||
jz near .return
|
||||
|
||||
xor eax, eax
|
||||
inc eax
|
||||
cpuid
|
||||
mov eax, edx ; eax = Standard feature flags
|
||||
|
||||
test eax, 1<<23 ; bit23:MMX
|
||||
jz short .no_mmx
|
||||
or edi, byte JSIMD_MMX
|
||||
.no_mmx:
|
||||
test eax, 1<<25 ; bit25:SSE
|
||||
jz short .no_sse
|
||||
or edi, byte JSIMD_SSE
|
||||
.no_sse:
|
||||
test eax, 1<<26 ; bit26:SSE2
|
||||
jz short .no_sse2
|
||||
or edi, byte JSIMD_SSE2
|
||||
.no_sse2:
|
||||
cmp eax, 7
|
||||
jl short .no_avx2 ; Maximum leaf < 07H
|
||||
|
||||
; Check for AVX2 instruction support
|
||||
mov eax, 7
|
||||
@@ -102,6 +87,26 @@ EXTN(jpeg_simd_cpu_support):
|
||||
or edi, JSIMD_AVX2
|
||||
.no_avx2:
|
||||
|
||||
; Check CPUID leaf 01H for MMX, SSE, and SSE2 support
|
||||
xor eax, eax
|
||||
inc eax
|
||||
cpuid
|
||||
mov eax, edx ; eax = Standard feature flags
|
||||
|
||||
; Check for MMX instruction support
|
||||
test eax, 1<<23 ; bit23:MMX
|
||||
jz short .no_mmx
|
||||
or edi, byte JSIMD_MMX
|
||||
.no_mmx:
|
||||
test eax, 1<<25 ; bit25:SSE
|
||||
jz short .no_sse
|
||||
or edi, byte JSIMD_SSE
|
||||
.no_sse:
|
||||
test eax, 1<<26 ; bit26:SSE2
|
||||
jz short .no_sse2
|
||||
or edi, byte JSIMD_SSE2
|
||||
.no_sse2:
|
||||
|
||||
; Check for 3DNow! instruction support
|
||||
mov eax, 0x80000000
|
||||
cpuid
|
||||
|
||||
@@ -38,14 +38,23 @@ EXTN(jpeg_simd_cpu_support):
|
||||
|
||||
xor rdi, rdi ; simd support flag
|
||||
|
||||
; Assume that all x86-64 processors support SSE & SSE2 instructions
|
||||
or rdi, JSIMD_SSE2
|
||||
or rdi, JSIMD_SSE
|
||||
|
||||
; Check whether CPUID leaf 07H is supported
|
||||
; (leaf 07H is used to check for AVX2 instruction support)
|
||||
mov rax, 0
|
||||
cpuid
|
||||
cmp rax, 7
|
||||
jl short .return ; Maximum leaf < 07H
|
||||
|
||||
; Check for AVX2 instruction support
|
||||
mov rax, 7
|
||||
xor rcx, rcx
|
||||
cpuid
|
||||
mov rax, rbx ; rax = Extended feature flags
|
||||
|
||||
or rdi, JSIMD_SSE2
|
||||
or rdi, JSIMD_SSE
|
||||
test rax, 1<<5 ; bit5:AVX2
|
||||
jz short .return
|
||||
|
||||
|
||||
49
tjbench.c
49
tjbench.c
@@ -95,7 +95,7 @@ int (*customFilter) (short *, tjregion, tjregion, int, int, tjtransform *);
|
||||
double benchTime = 5.0, warmup = 1.0;
|
||||
|
||||
|
||||
char *formatName(int subsamp, int cs, char *buf)
|
||||
static char *formatName(int subsamp, int cs, char *buf)
|
||||
{
|
||||
if (cs == TJCS_YCbCr)
|
||||
return (char *)subNameLong[subsamp];
|
||||
@@ -107,7 +107,7 @@ char *formatName(int subsamp, int cs, char *buf)
|
||||
}
|
||||
|
||||
|
||||
char *sigfig(double val, int figs, char *buf, int len)
|
||||
static char *sigfig(double val, int figs, char *buf, int len)
|
||||
{
|
||||
char format[80];
|
||||
int digitsAfterDecimal = figs - (int)ceil(log10(fabs(val)));
|
||||
@@ -122,9 +122,9 @@ char *sigfig(double val, int figs, char *buf, int len)
|
||||
|
||||
|
||||
/* Custom DCT filter which produces a negative of the image */
|
||||
int dummyDCTFilter(short *coeffs, tjregion arrayRegion, tjregion planeRegion,
|
||||
int componentIndex, int transformIndex,
|
||||
tjtransform *transform)
|
||||
static int dummyDCTFilter(short *coeffs, tjregion arrayRegion,
|
||||
tjregion planeRegion, int componentIndex,
|
||||
int transformIndex, tjtransform *transform)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -135,11 +135,12 @@ int dummyDCTFilter(short *coeffs, tjregion arrayRegion, tjregion planeRegion,
|
||||
|
||||
|
||||
/* Decompression test */
|
||||
int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
|
||||
unsigned long *jpegSize, unsigned char *dstBuf, int w, int h,
|
||||
int subsamp, int jpegQual, char *fileName, int tilew, int tileh)
|
||||
static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
|
||||
unsigned long *jpegSize, unsigned char *dstBuf, int w, int h,
|
||||
int subsamp, int jpegQual, char *fileName, int tilew,
|
||||
int tileh)
|
||||
{
|
||||
char tempStr[1024], sizeStr[20] = "\0", qualStr[13] = "\0", *ptr;
|
||||
char tempStr[1024], sizeStr[24] = "\0", qualStr[13] = "\0", *ptr;
|
||||
FILE *file = NULL;
|
||||
tjhandle handle = NULL;
|
||||
int row, col, iter = 0, dstBufAlloc = 0, retval = 0;
|
||||
@@ -249,10 +250,10 @@ int decomp(unsigned char *srcBuf, unsigned char **jpegBuf,
|
||||
if (!doWrite) goto bailout;
|
||||
|
||||
if (sf.num != 1 || sf.denom != 1)
|
||||
snprintf(sizeStr, 20, "%d_%d", sf.num, sf.denom);
|
||||
snprintf(sizeStr, 24, "%d_%d", sf.num, sf.denom);
|
||||
else if (tilew != w || tileh != h)
|
||||
snprintf(sizeStr, 20, "%dx%d", tilew, tileh);
|
||||
else snprintf(sizeStr, 20, "full");
|
||||
snprintf(sizeStr, 24, "%dx%d", tilew, tileh);
|
||||
else snprintf(sizeStr, 24, "full");
|
||||
if (decompOnly)
|
||||
snprintf(tempStr, 1024, "%s_%s.%s", fileName, sizeStr, ext);
|
||||
else
|
||||
@@ -303,8 +304,8 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
int fullTest(unsigned char *srcBuf, int w, int h, int subsamp, int jpegQual,
|
||||
char *fileName)
|
||||
static int fullTest(unsigned char *srcBuf, int w, int h, int subsamp,
|
||||
int jpegQual, char *fileName)
|
||||
{
|
||||
char tempStr[1024], tempStr2[80];
|
||||
FILE *file = NULL;
|
||||
@@ -504,7 +505,7 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
int decompTest(char *fileName)
|
||||
static int decompTest(char *fileName)
|
||||
{
|
||||
FILE *file = NULL;
|
||||
tjhandle handle = NULL;
|
||||
@@ -724,7 +725,7 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
void usage(char *progName)
|
||||
static void usage(char *progName)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -902,14 +903,14 @@ int main(int argc, char *argv[])
|
||||
else if (!strcasecmp(argv[i], "-copynone"))
|
||||
xformOpt |= TJXOPT_COPYNONE;
|
||||
else if (!strcasecmp(argv[i], "-benchtime") && i < argc - 1) {
|
||||
double temp = atof(argv[++i]);
|
||||
double tempd = atof(argv[++i]);
|
||||
|
||||
if (temp > 0.0) benchTime = temp;
|
||||
if (tempd > 0.0) benchTime = tempd;
|
||||
else usage(argv[0]);
|
||||
} else if (!strcasecmp(argv[i], "-warmup") && i < argc - 1) {
|
||||
double temp = atof(argv[++i]);
|
||||
double tempd = atof(argv[++i]);
|
||||
|
||||
if (temp >= 0.0) warmup = temp;
|
||||
if (tempd >= 0.0) warmup = tempd;
|
||||
else usage(argv[0]);
|
||||
printf("Warmup time = %.1f seconds\n\n", warmup);
|
||||
} else if (!strcasecmp(argv[i], "-alloc"))
|
||||
@@ -920,16 +921,16 @@ int main(int argc, char *argv[])
|
||||
printf("Testing YUV planar encoding/decoding\n\n");
|
||||
doYUV = 1;
|
||||
} else if (!strcasecmp(argv[i], "-yuvpad") && i < argc - 1) {
|
||||
int temp = atoi(argv[++i]);
|
||||
int tempi = atoi(argv[++i]);
|
||||
|
||||
if (temp >= 1) yuvPad = temp;
|
||||
if (tempi >= 1) yuvPad = tempi;
|
||||
} else if (!strcasecmp(argv[i], "-subsamp") && i < argc - 1) {
|
||||
i++;
|
||||
if (toupper(argv[i][0]) == 'G') subsamp = TJSAMP_GRAY;
|
||||
else {
|
||||
int temp = atoi(argv[i]);
|
||||
int tempi = atoi(argv[i]);
|
||||
|
||||
switch (temp) {
|
||||
switch (tempi) {
|
||||
case 444: subsamp = TJSAMP_444; break;
|
||||
case 422: subsamp = TJSAMP_422; break;
|
||||
case 440: subsamp = TJSAMP_440; break;
|
||||
|
||||
15
tjexample.c
15
tjexample.c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C)2011-2012, 2014-2015, 2017 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
* Copyright (C)2011-2012, 2014-2015, 2017, 2019 D. R. Commander.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -71,9 +71,9 @@ int numScalingFactors = 0;
|
||||
|
||||
/* DCT filter example. This produces a negative of the image. */
|
||||
|
||||
int customFilter(short *coeffs, tjregion arrayRegion, tjregion planeRegion,
|
||||
int componentIndex, int transformIndex,
|
||||
tjtransform *transform)
|
||||
static int customFilter(short *coeffs, tjregion arrayRegion,
|
||||
tjregion planeRegion, int componentIndex,
|
||||
int transformIndex, tjtransform *transform)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -84,7 +84,7 @@ int customFilter(short *coeffs, tjregion arrayRegion, tjregion planeRegion,
|
||||
}
|
||||
|
||||
|
||||
void usage(char *programName)
|
||||
static void usage(char *programName)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -355,9 +355,10 @@ int main(int argc, char **argv)
|
||||
|
||||
if (!strcasecmp(outFormat, "jpg")) {
|
||||
/* Output image format is JPEG. Compress the uncompressed image. */
|
||||
unsigned char *jpegBuf = NULL; /* Dynamically allocate the JPEG buffer */
|
||||
unsigned long jpegSize = 0;
|
||||
|
||||
jpegBuf = NULL; /* Dynamically allocate the JPEG buffer */
|
||||
|
||||
if (outQual < 0)
|
||||
outQual = DEFAULT_QUALITY;
|
||||
printf(", %s subsampling, quality = %d\n", subsampName[outSubsamp],
|
||||
|
||||
58
tjunittest.c
58
tjunittest.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2009-2014, 2017-2018 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2009-2014, 2017-2019 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -46,7 +46,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
void usage(char *progName)
|
||||
static void usage(char *progName)
|
||||
{
|
||||
printf("\nUSAGE: %s [options]\n\n", progName);
|
||||
printf("Options:\n");
|
||||
@@ -96,7 +96,7 @@ int exitStatus = 0;
|
||||
#define BAILOUT() { exitStatus = -1; goto bailout; }
|
||||
|
||||
|
||||
void initBuf(unsigned char *buf, int w, int h, int pf, int flags)
|
||||
static void initBuf(unsigned char *buf, int w, int h, int pf, int flags)
|
||||
{
|
||||
int roffset = tjRedOffset[pf];
|
||||
int goffset = tjGreenOffset[pf];
|
||||
@@ -174,8 +174,8 @@ void initBuf(unsigned char *buf, int w, int h, int pf, int flags)
|
||||
}
|
||||
|
||||
|
||||
int checkBuf(unsigned char *buf, int w, int h, int pf, int subsamp,
|
||||
tjscalingfactor sf, int flags)
|
||||
static int checkBuf(unsigned char *buf, int w, int h, int pf, int subsamp,
|
||||
tjscalingfactor sf, int flags)
|
||||
{
|
||||
int roffset = tjRedOffset[pf];
|
||||
int goffset = tjGreenOffset[pf];
|
||||
@@ -270,8 +270,8 @@ bailout:
|
||||
|
||||
#define PAD(v, p) ((v + (p) - 1) & (~((p) - 1)))
|
||||
|
||||
int checkBufYUV(unsigned char *buf, int w, int h, int subsamp,
|
||||
tjscalingfactor sf)
|
||||
static int checkBufYUV(unsigned char *buf, int w, int h, int subsamp,
|
||||
tjscalingfactor sf)
|
||||
{
|
||||
int row, col;
|
||||
int hsf = tjMCUWidth[subsamp] / 8, vsf = tjMCUHeight[subsamp] / 8;
|
||||
@@ -296,7 +296,7 @@ int checkBufYUV(unsigned char *buf, int w, int h, int subsamp,
|
||||
}
|
||||
}
|
||||
if (subsamp != TJSAMP_GRAY) {
|
||||
int halfway = 16 / vsf * sf.num / sf.denom;
|
||||
halfway = 16 / vsf * sf.num / sf.denom;
|
||||
|
||||
for (row = 0; row < ch; row++) {
|
||||
for (col = 0; col < cw; col++) {
|
||||
@@ -342,7 +342,8 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
void writeJPEG(unsigned char *jpegBuf, unsigned long jpegSize, char *filename)
|
||||
static void writeJPEG(unsigned char *jpegBuf, unsigned long jpegSize,
|
||||
char *filename)
|
||||
{
|
||||
FILE *file = fopen(filename, "wb");
|
||||
|
||||
@@ -356,9 +357,9 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
void compTest(tjhandle handle, unsigned char **dstBuf, unsigned long *dstSize,
|
||||
int w, int h, int pf, char *basename, int subsamp, int jpegQual,
|
||||
int flags)
|
||||
static void compTest(tjhandle handle, unsigned char **dstBuf,
|
||||
unsigned long *dstSize, int w, int h, int pf,
|
||||
char *basename, int subsamp, int jpegQual, int flags)
|
||||
{
|
||||
char tempStr[1024];
|
||||
unsigned char *srcBuf = NULL, *yuvBuf = NULL;
|
||||
@@ -414,9 +415,10 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
void _decompTest(tjhandle handle, unsigned char *jpegBuf,
|
||||
unsigned long jpegSize, int w, int h, int pf, char *basename,
|
||||
int subsamp, int flags, tjscalingfactor sf)
|
||||
static void _decompTest(tjhandle handle, unsigned char *jpegBuf,
|
||||
unsigned long jpegSize, int w, int h, int pf,
|
||||
char *basename, int subsamp, int flags,
|
||||
tjscalingfactor sf)
|
||||
{
|
||||
unsigned char *dstBuf = NULL, *yuvBuf = NULL;
|
||||
int _hdrw = 0, _hdrh = 0, _hdrsubsamp = -1;
|
||||
@@ -481,9 +483,9 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
void decompTest(tjhandle handle, unsigned char *jpegBuf,
|
||||
unsigned long jpegSize, int w, int h, int pf, char *basename,
|
||||
int subsamp, int flags)
|
||||
static void decompTest(tjhandle handle, unsigned char *jpegBuf,
|
||||
unsigned long jpegSize, int w, int h, int pf,
|
||||
char *basename, int subsamp, int flags)
|
||||
{
|
||||
int i, n = 0;
|
||||
tjscalingfactor *sf = tjGetScalingFactors(&n);
|
||||
@@ -505,8 +507,8 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
void doTest(int w, int h, const int *formats, int nformats, int subsamp,
|
||||
char *basename)
|
||||
static void doTest(int w, int h, const int *formats, int nformats, int subsamp,
|
||||
char *basename)
|
||||
{
|
||||
tjhandle chandle = NULL, dhandle = NULL;
|
||||
unsigned char *dstBuf = NULL;
|
||||
@@ -552,7 +554,7 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
void bufSizeTest(void)
|
||||
static void bufSizeTest(void)
|
||||
{
|
||||
int w, h, i, subsamp;
|
||||
unsigned char *srcBuf = NULL, *dstBuf = NULL;
|
||||
@@ -633,8 +635,8 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
void initBitmap(unsigned char *buf, int width, int pitch, int height, int pf,
|
||||
int flags)
|
||||
static void initBitmap(unsigned char *buf, int width, int pitch, int height,
|
||||
int pf, int flags)
|
||||
{
|
||||
int roffset = tjRedOffset[pf];
|
||||
int goffset = tjGreenOffset[pf];
|
||||
@@ -667,8 +669,8 @@ void initBitmap(unsigned char *buf, int width, int pitch, int height, int pf,
|
||||
}
|
||||
|
||||
|
||||
int cmpBitmap(unsigned char *buf, int width, int pitch, int height, int pf,
|
||||
int flags, int gray2rgb)
|
||||
static int cmpBitmap(unsigned char *buf, int width, int pitch, int height,
|
||||
int pf, int flags, int gray2rgb)
|
||||
{
|
||||
int roffset = tjRedOffset[pf];
|
||||
int goffset = tjGreenOffset[pf];
|
||||
@@ -718,8 +720,8 @@ int cmpBitmap(unsigned char *buf, int width, int pitch, int height, int pf,
|
||||
}
|
||||
|
||||
|
||||
int doBmpTest(const char *ext, int width, int align, int height, int pf,
|
||||
int flags)
|
||||
static int doBmpTest(const char *ext, int width, int align, int height, int pf,
|
||||
int flags)
|
||||
{
|
||||
char filename[80], *md5sum, md5buf[65];
|
||||
int ps = tjPixelSize[pf], pitch = PAD(width * ps, align), loadWidth = 0,
|
||||
@@ -807,7 +809,7 @@ bailout:
|
||||
}
|
||||
|
||||
|
||||
int bmpTest(void)
|
||||
static int bmpTest(void)
|
||||
{
|
||||
int align, width = 35, height = 39, format;
|
||||
|
||||
|
||||
4
tjutil.c
4
tjutil.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011, 2019 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -26,6 +26,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "tjutil.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C)2011-2018 D. R. Commander. All Rights Reserved.
|
||||
* Copyright (C)2011-2019 D. R. Commander. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -35,10 +35,9 @@
|
||||
#include <jni.h>
|
||||
#include "java/org_libjpegturbo_turbojpeg_TJCompressor.h"
|
||||
#include "java/org_libjpegturbo_turbojpeg_TJDecompressor.h"
|
||||
#include "java/org_libjpegturbo_turbojpeg_TJTransformer.h"
|
||||
#include "java/org_libjpegturbo_turbojpeg_TJ.h"
|
||||
|
||||
#define PAD(v, p) ((v + (p) - 1) & (~((p) - 1)))
|
||||
|
||||
#define BAILIF0(f) { \
|
||||
if (!(f) || (*env)->ExceptionCheck(env)) { \
|
||||
goto bailout; \
|
||||
@@ -104,7 +103,7 @@
|
||||
cArray = NULL; \
|
||||
}
|
||||
|
||||
int ProcessSystemProperties(JNIEnv *env)
|
||||
static int ProcessSystemProperties(JNIEnv *env)
|
||||
{
|
||||
jclass cls;
|
||||
jmethodID mid;
|
||||
@@ -520,7 +519,7 @@ bailout:
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL TJCompressor_encodeYUV_12
|
||||
static void JNICALL TJCompressor_encodeYUV_12
|
||||
(JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint width,
|
||||
jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
|
||||
{
|
||||
|
||||
@@ -1364,12 +1364,12 @@ static int setDecodeDefaults(struct jpeg_decompress_struct *dinfo,
|
||||
}
|
||||
|
||||
|
||||
int my_read_markers(j_decompress_ptr dinfo)
|
||||
static int my_read_markers(j_decompress_ptr dinfo)
|
||||
{
|
||||
return JPEG_REACHED_SOS;
|
||||
}
|
||||
|
||||
void my_reset_marker_reader(j_decompress_ptr dinfo)
|
||||
static void my_reset_marker_reader(j_decompress_ptr dinfo)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user