Merge branch 'master' into dev

This commit is contained in:
DRC
2017-08-31 20:57:19 -05:00
4 changed files with 31 additions and 8 deletions

View File

@@ -73,6 +73,10 @@ the C API and `TJTransform.OPT_COPYNONE` in the Java API) that allows the
copying of markers (including EXIF and ICC profile data) to be disabled for a copying of markers (including EXIF and ICC profile data) to be disabled for a
particular transform. particular transform.
7. Fixed a NullPointerException in the TurboJPEG Java wrapper that occurred
when using the YUVImage constructor that creates an instance backed by separate
image planes and allocates memory for the image planes.
1.5.2 1.5.2
===== =====
@@ -140,6 +144,10 @@ timer, in order to improve the consistency of the results. Furthermore, the
`-warmup` option is now used to specify the amount of warmup time rather than `-warmup` option is now used to specify the amount of warmup time rather than
the number of warmup iterations. the number of warmup iterations.
11. Fixed an error (`short jump is out of range`) that occurred when assembling
the 32-bit x86 SIMD extensions with NASM versions prior to 2.04. This was a
regression introduced by 1.5 beta1[12].
1.5.1 1.5.1
===== =====

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C)2014 D. R. Commander. All Rights Reserved. * Copyright (C)2014, 2017 D. R. Commander. All Rights Reserved.
* Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. * Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -220,10 +220,13 @@ public class YUVImage {
throw new IllegalArgumentException("Invalid argument in YUVImage::setBuf()"); throw new IllegalArgumentException("Invalid argument in YUVImage::setBuf()");
int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3); int nc = (subsamp == TJ.SAMP_GRAY ? 1 : 3);
if (planes.length != nc || (offsets != null && offsets.length != nc) || if ((planes != null && planes.length != nc) ||
(offsets != null && offsets.length != nc) ||
(strides != null && strides.length != nc)) (strides != null && strides.length != nc))
throw new IllegalArgumentException("YUVImage::setBuf(): planes, offsets, or strides array is the wrong size"); throw new IllegalArgumentException("YUVImage::setBuf(): planes, offsets, or strides array is the wrong size");
if (planes == null)
planes = new byte[nc][];
if (offsets == null) if (offsets == null)
offsets = new int[nc]; offsets = new int[nc];
if (strides == null) if (strides == null)

View File

@@ -284,6 +284,18 @@ endif()
elseif(CPU_TYPE STREQUAL "powerpc") elseif(CPU_TYPE STREQUAL "powerpc")
check_c_source_compiles("
#include <altivec.h>
int main(void) {
__vector int vi = { 0, 0, 0, 0 };
return vi[0];
}" HAVE_ALTIVEC)
if(NOT HAVE_ALTIVEC)
simd_fail("SIMD extensions not available for this CPU (PowerPC SPE)")
return()
endif()
set(SIMD_SOURCES powerpc/jccolor-altivec.c powerpc/jcgray-altivec.c set(SIMD_SOURCES powerpc/jccolor-altivec.c powerpc/jcgray-altivec.c
powerpc/jcsample-altivec.c powerpc/jdcolor-altivec.c powerpc/jcsample-altivec.c powerpc/jdcolor-altivec.c
powerpc/jdmerge-altivec.c powerpc/jdsample-altivec.c powerpc/jdmerge-altivec.c powerpc/jdsample-altivec.c

View File

@@ -1,7 +1,7 @@
; ;
; jchuff-sse2.asm - Huffman entropy encoding (SSE2) ; jchuff-sse2.asm - Huffman entropy encoding (SSE2)
; ;
; Copyright (C) 2009-2011, 2014-2016, D. R. Commander. ; Copyright (C) 2009-2011, 2014-2017, D. R. Commander.
; Copyright (C) 2015, Matthieu Darbois. ; Copyright (C) 2015, Matthieu Darbois.
; ;
; Based on the x86 SIMD extension for IJG JPEG library ; Based on the x86 SIMD extension for IJG JPEG library
@@ -288,13 +288,13 @@ EXTN(jsimd_huff_encode_one_block_sse2):
.BLOOP: .BLOOP:
bsf ecx, edx ; r = __builtin_ctzl(index); bsf ecx, edx ; r = __builtin_ctzl(index);
jz .ELOOP jz near .ELOOP
lea esi, [esi+ecx*2] ; k += r; lea esi, [esi+ecx*2] ; k += r;
shr edx, cl ; index >>= r; shr edx, cl ; index >>= r;
mov DWORD [esp+temp3], edx mov DWORD [esp+temp3], edx
.BRLOOP: .BRLOOP:
cmp ecx, 16 ; while (r > 15) { cmp ecx, 16 ; while (r > 15) {
jl .ERLOOP jl near .ERLOOP
sub ecx, 16 ; r -= 16; sub ecx, 16 ; r -= 16;
mov DWORD [esp+temp], ecx mov DWORD [esp+temp], ecx
mov eax, INT [ebp + 240 * 4] ; code_0xf0 = actbl->ehufco[0xf0]; mov eax, INT [ebp + 240 * 4] ; code_0xf0 = actbl->ehufco[0xf0];
@@ -348,7 +348,7 @@ EXTN(jsimd_huff_encode_one_block_sse2):
sub eax, esi sub eax, esi
shr eax, 1 shr eax, 1
bsf ecx, edx ; r = __builtin_ctzl(index); bsf ecx, edx ; r = __builtin_ctzl(index);
jz .ELOOP2 jz near .ELOOP2
shr edx, cl ; index >>= r; shr edx, cl ; index >>= r;
add ecx, eax add ecx, eax
lea esi, [esi+ecx*2] ; k += r; lea esi, [esi+ecx*2] ; k += r;
@@ -356,13 +356,13 @@ EXTN(jsimd_huff_encode_one_block_sse2):
jmp .BRLOOP2 jmp .BRLOOP2
.BLOOP2: .BLOOP2:
bsf ecx, edx ; r = __builtin_ctzl(index); bsf ecx, edx ; r = __builtin_ctzl(index);
jz .ELOOP2 jz near .ELOOP2
lea esi, [esi+ecx*2] ; k += r; lea esi, [esi+ecx*2] ; k += r;
shr edx, cl ; index >>= r; shr edx, cl ; index >>= r;
mov DWORD [esp+temp3], edx mov DWORD [esp+temp3], edx
.BRLOOP2: .BRLOOP2:
cmp ecx, 16 ; while (r > 15) { cmp ecx, 16 ; while (r > 15) {
jl .ERLOOP2 jl near .ERLOOP2
sub ecx, 16 ; r -= 16; sub ecx, 16 ; r -= 16;
mov DWORD [esp+temp], ecx mov DWORD [esp+temp], ecx
mov eax, INT [ebp + 240 * 4] ; code_0xf0 = actbl->ehufco[0xf0]; mov eax, INT [ebp + 240 * 4] ; code_0xf0 = actbl->ehufco[0xf0];