From 150b5c4a9029618661a31492312beb9ec4418c82 Mon Sep 17 00:00:00 2001 From: DRC Date: Fri, 15 Aug 2014 16:40:34 +0000 Subject: [PATCH 1/2] Make the wrapped functions static git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1358 632fc199-4ca6-4c93-a231-07263d6284db --- turbojpeg-jni.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c index 44db1bb8..77ca28da 100644 --- a/turbojpeg-jni.c +++ b/turbojpeg-jni.c @@ -98,7 +98,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init return; } -JNIEXPORT jint JNICALL TJCompressor_compress +static jint TJCompressor_compress (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint x, jint y, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual, jint flags) @@ -194,7 +194,7 @@ JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3 return 0; } -JNIEXPORT void JNICALL TJCompressor_encodeYUV +static void TJCompressor_encodeYUV (JNIEnv *env, jobject obj, jarray src, jint srcElementSize, jint width, jint pitch, jint height, jint pf, jbyteArray dst, jint subsamp, jint flags) { @@ -351,7 +351,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress return; } -JNIEXPORT void JNICALL TJDecompressor_decompress +static void TJDecompressor_decompress (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jarray dst, jint dstElementSize, jint x, jint y, jint width, jint pitch, jint height, jint pf, jint flags) From c4ac1e2b15645017fa58f1e2abe3b96feebc18ff Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 21 Aug 2014 01:55:22 +0000 Subject: [PATCH 2/2] Fix an extremely rare crash that can occur when compressing a very high-frequency MCU using quality 100 and no subsampling, and when dynamically allocating the JPEG buffer in the destination manager. Even with a test program designed specifically to reproduce the crash, it only occurred once in about 25 million iterations. More details here: https://sourceforge.net/p/libjpeg-turbo/bugs/64 git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.3.x@1365 632fc199-4ca6-4c93-a231-07263d6284db --- jchuff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jchuff.c b/jchuff.c index 5afeb194..648d3fd2 100644 --- a/jchuff.c +++ b/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, D. R. Commander. + * Copyright (C) 2009-2011, 2014 D. R. Commander. * For conditions of distribution and use, see the accompanying README file. * * This file contains Huffman entropy encoding routines. @@ -426,7 +426,7 @@ dump_buffer (working_state * state) LOCAL(boolean) flush_bits (working_state * state) { - JOCTET _buffer[BUFSIZE], *buffer; + JOCTET _buffer[BUFSIZE + 8], *buffer; size_t put_buffer; int put_bits; size_t bytes, bytestocopy; int localbuf = 0; @@ -455,7 +455,7 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, int temp, temp2, temp3; int nbits; int r, code, size; - JOCTET _buffer[BUFSIZE], *buffer; + JOCTET _buffer[BUFSIZE + 8], *buffer; size_t put_buffer; int put_bits; int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0]; size_t bytes, bytestocopy; int localbuf = 0;