Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
d2b09537
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d2b09537
编写于
3月 24, 2020
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16891 from alalek:update_libjpeg-turbo
上级
2d63861c
ad4e5dbd
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
68 addition
and
48 deletion
+68
-48
3rdparty/libjpeg-turbo/CMakeLists.txt
3rdparty/libjpeg-turbo/CMakeLists.txt
+2
-2
3rdparty/libjpeg-turbo/README.md
3rdparty/libjpeg-turbo/README.md
+36
-26
3rdparty/libjpeg-turbo/src/jchuff.c
3rdparty/libjpeg-turbo/src/jchuff.c
+8
-4
3rdparty/libjpeg-turbo/src/jcmaster.c
3rdparty/libjpeg-turbo/src/jcmaster.c
+1
-1
3rdparty/libjpeg-turbo/src/jcphuff.c
3rdparty/libjpeg-turbo/src/jcphuff.c
+2
-2
3rdparty/libjpeg-turbo/src/jdhuff.c
3rdparty/libjpeg-turbo/src/jdhuff.c
+7
-3
3rdparty/libjpeg-turbo/src/jdmerge.c
3rdparty/libjpeg-turbo/src/jdmerge.c
+0
-2
3rdparty/libjpeg-turbo/src/jdsample.c
3rdparty/libjpeg-turbo/src/jdsample.c
+9
-5
3rdparty/libjpeg-turbo/src/jfdctint.c
3rdparty/libjpeg-turbo/src/jfdctint.c
+1
-1
3rdparty/libjpeg-turbo/src/jidctint.c
3rdparty/libjpeg-turbo/src/jidctint.c
+1
-1
3rdparty/libjpeg-turbo/src/jidctred.c
3rdparty/libjpeg-turbo/src/jidctred.c
+1
-1
未找到文件。
3rdparty/libjpeg-turbo/CMakeLists.txt
浏览文件 @
d2b09537
...
...
@@ -4,9 +4,9 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wsign-compare -Wshorten-6
set
(
VERSION_MAJOR 2
)
set
(
VERSION_MINOR 0
)
set
(
VERSION_REVISION
2
)
set
(
VERSION_REVISION
4
)
set
(
VERSION
${
VERSION_MAJOR
}
.
${
VERSION_MINOR
}
.
${
VERSION_REVISION
}
)
set
(
LIBJPEG_TURBO_VERSION_NUMBER 200000
2
)
set
(
LIBJPEG_TURBO_VERSION_NUMBER 200000
4
)
string
(
TIMESTAMP BUILD
"opencv-
${
OPENCV_VERSION
}
-libjpeg-turbo"
)
if
(
CMAKE_BUILD_TYPE STREQUAL
"Debug"
)
...
...
3rdparty/libjpeg-turbo/README.md
浏览文件 @
d2b09537
Background
==========
libjpeg-turbo is a JPEG image codec that uses SIMD instructions
(MMX, SSE2,
AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
on x86, x86-64, ARM, and PowerPC systems, as well as progressive JPEG
compression on x86 and x86-64 systems. On such systems, libjpeg-turbo is
generally 2-6x as fast as libjpeg, all else being equal. On other types of
systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
virtue of its highly-optimized Huffman coding routines. In many cases, the
performance of libjpeg-turbo
rivals that of proprietary high-speed JPEG codecs.
libjpeg-turbo is a JPEG image codec that uses SIMD instructions
to accelerate
baseline JPEG compression and decompression on x86, x86-64, ARM, PowerPC, and
MIPS systems, as well as progressive JPEG compression on x86 and x86-64
systems. On such systems, libjpeg-turbo is generally 2-6x as fast as libjpeg,
all else being equal. On other types of systems, libjpeg-turbo can still
outperform libjpeg by a significant amount, by virtue of its highly-optimized
Huffman coding routines. In many cases, the performance of libjpeg-turbo
rivals that of proprietary high-speed JPEG codecs.
libjpeg-turbo implements both the traditional libjpeg API as well as the less
powerful but more straightforward TurboJPEG API. libjpeg-turbo also features
...
...
@@ -135,25 +135,24 @@ without recompiling. libjpeg-turbo does not claim to support all of the
libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all
cases (see below.)
By passing an argument of
`--with-jpeg7`
or
`--with-jpeg8`
to
`configure`
, or
an argument of
`-DWITH_JPEG7=1`
or
`-DWITH_JPEG8=1`
to
`cmake`
, you can build a
version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so that
programs that are built against libjpeg v7 or v8 can be run with libjpeg-turbo.
The following section describes which libjpeg v7+ features are supported and
which aren't.
By passing an argument of
`-DWITH_JPEG7=1`
or
`-DWITH_JPEG8=1`
to
`cmake`
, you
can build a version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so
that programs that are built against libjpeg v7 or v8 can be run with
libjpeg-turbo. The following section describes which libjpeg v7+ features are
supported and which aren't.
### Support for libjpeg v7 and v8 Features
#### Fully supported
-
**libjpeg: IDCT scaling extensions in decompressor**
<br>
-
**libjpeg
API
: IDCT scaling extensions in decompressor**
<br>
libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
and 1/2 are SIMD-accelerated.)
-
**libjpeg: Arithmetic coding**
-
**libjpeg
API
: Arithmetic coding**
-
**libjpeg: In-memory source and destination managers**
<br>
-
**libjpeg
API
: In-memory source and destination managers**
<br>
See notes below.
-
**cjpeg: Separate quality settings for luminance and chrominance**
<br>
...
...
@@ -185,14 +184,14 @@ means of quality improvement. The reader is invited to peruse the research at
but it is the general belief of our project that these features have not
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
-
**libjpeg: DCT scaling in compressor**
<br>
-
**libjpeg
API
: DCT scaling in compressor**
<br>
`cinfo.scale_num`
and
`cinfo.scale_denom`
are silently ignored.
There is no technical reason why DCT scaling could not be supported when
emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
8/9 would be available, which is of limited usefulness.
-
**libjpeg: SmartScale**
<br>
-
**libjpeg
API
: SmartScale**
<br>
`cinfo.block_size`
is silently ignored.
SmartScale is an extension to the JPEG format that allows for DCT block
sizes other than 8x8. Providing support for this new format would be
...
...
@@ -205,7 +204,7 @@ demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
interest in providing this feature would be as a means of supporting
additional DCT scaling factors.
-
**libjpeg: Fancy downsampling in compressor**
<br>
-
**libjpeg
API
: Fancy downsampling in compressor**
<br>
`cinfo.do_fancy_downsampling`
is silently ignored.
This requires the DCT scaling feature, which is not supported.
...
...
@@ -247,15 +246,14 @@ don't, and it allows those functions to be provided in the "official"
libjpeg-turbo binaries.
Those who are concerned about maintaining strict conformance with the libjpeg
v6b or v7 API can pass an argument of
`--without-mem-srcdst`
to
`configure`
or
an argument of
`-DWITH_MEM_SRCDST=0`
to
`cmake`
prior to building
libjpeg-turbo. This will restore the pre-1.3 behavior, in which
v6b or v7 API can pass an argument of
`-DWITH_MEM_SRCDST=0`
to
`cmake`
prior to
building libjpeg-turbo. This will restore the pre-1.3 behavior, in which
`jpeg_mem_src()`
and
`jpeg_mem_dest()`
are only included when emulating the
libjpeg v8 API/ABI.
On Un
*
x systems, including the in-memory source/destination managers changes
the dynamic library version from 62.
1.0 to 62.2
.0 if using libjpeg v6b API/ABI
emulation and from 7.
1.0 to 7.2
.0 if using libjpeg v7 API/ABI emulation.
the dynamic library version from 62.
2.0 to 62.3
.0 if using libjpeg v6b API/ABI
emulation and from 7.
2.0 to 7.3
.0 if using libjpeg v7 API/ABI emulation.
Note that, on most Un
*
x systems, the dynamic linker will not look for a
function in a library until that function is actually used. Thus, if a program
...
...
@@ -331,7 +329,7 @@ in a way that makes the rest of the libjpeg infrastructure happy, so it is
necessary to use the slow Huffman decoder when decompressing a JPEG image that
has restart markers. This can cause the decompression performance to drop by
as much as 20%, but the performance will still be much greater than that of
libjpeg. Many consumer packages, such as Photo
S
hop, use restart markers when
libjpeg. Many consumer packages, such as Photo
s
hop, use restart markers when
generating JPEG images, so images generated by those programs will experience
this issue.
...
...
@@ -344,3 +342,15 @@ quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization
function in those cases. This causes performance to drop by as much as 40%.
It is therefore strongly advised that you use the slow integer forward DCT
whenever encoding images with a JPEG quality of 98 or higher.
Memory Debugger Pitfalls
========================
Valgrind and Memory Sanitizer (MSan) can generate false positives
(specifically, incorrect reports of uninitialized memory accesses) when used
with libjpeg-turbo's SIMD extensions. It is generally recommended that the
SIMD extensions be disabled, either by passing an argument of
`-DWITH_SIMD=0`
to
`cmake`
when configuring the build or by setting the environment variable
`JSIMD_FORCENONE`
to
`1`
at run time, when testing libjpeg-turbo with Valgrind,
MSan, or other memory debuggers.
3rdparty/libjpeg-turbo/src/jchuff.c
浏览文件 @
d2b09537
...
...
@@ -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.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
...
...
@@ -43,8 +43,8 @@
*/
/* NOTE: Both GCC and Clang define __GNUC__ */
#if defined
__GNUC__ && (defined __arm__ || defined __aarch64__
)
#if !defined
__thumb__ || defined __thumb2__
#if defined
(__GNUC__) && (defined(__arm__) || defined(__aarch64__)
)
#if !defined
(__thumb__) || defined(__thumb2__)
#define USE_CLZ_INTRINSIC
#endif
#endif
...
...
@@ -356,6 +356,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() \
...
...
@@ -363,6 +365,8 @@ dump_buffer(working_state *state)
} \
}
#endif
#define CHECKBUF31() { \
if (put_bits > 31) { \
EMIT_BYTE() \
...
...
@@ -428,7 +432,7 @@ dump_buffer(working_state *state)
* scanning order-- 1, 8, 16, etc.), then this will produce an encoded block
* larger than 200 bytes.
*/
#define BUFSIZE (DCTSIZE2 *
4
)
#define BUFSIZE (DCTSIZE2 *
8
)
#define LOAD_BUFFER() { \
if (state->free_in_buffer < BUFSIZE) { \
...
...
3rdparty/libjpeg-turbo/src/jcmaster.c
浏览文件 @
d2b09537
...
...
@@ -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. */
...
...
3rdparty/libjpeg-turbo/src/jcphuff.c
浏览文件 @
d2b09537
...
...
@@ -52,8 +52,8 @@
*/
/* NOTE: Both GCC and Clang define __GNUC__ */
#if defined
__GNUC__ && (defined __arm__ || defined __aarch64__
)
#if !defined
__thumb__ || defined __thumb2__
#if defined
(__GNUC__) && (defined(__arm__) || defined(__aarch64__)
)
#if !defined
(__thumb__) || defined(__thumb2__)
#define USE_CLZ_INTRINSIC
#endif
#endif
...
...
3rdparty/libjpeg-turbo/src/jdhuff.c
浏览文件 @
d2b09537
...
...
@@ -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, 2016, 2018, D. R. Commander.
* Copyright (C) 2009-2011, 2016, 2018
-2019
, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
...
...
@@ -589,7 +589,11 @@ decode_mcu_slow(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if
(
entropy
->
dc_needed
[
blkn
])
{
/* Convert DC difference to actual value, update last_dc_val */
int
ci
=
cinfo
->
MCU_membership
[
blkn
];
s
+=
state
.
last_dc_val
[
ci
];
/* This is really just
* s += state.last_dc_val[ci];
* It is written this way in order to shut up UBSan.
*/
s
=
(
int
)((
unsigned
int
)
s
+
(
unsigned
int
)
state
.
last_dc_val
[
ci
]);
state
.
last_dc_val
[
ci
]
=
s
;
if
(
block
)
{
/* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
...
...
@@ -684,7 +688,7 @@ decode_mcu_fast(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if
(
entropy
->
dc_needed
[
blkn
])
{
int
ci
=
cinfo
->
MCU_membership
[
blkn
];
s
+=
state
.
last_dc_val
[
ci
]
;
s
=
(
int
)((
unsigned
int
)
s
+
(
unsigned
int
)
state
.
last_dc_val
[
ci
])
;
state
.
last_dc_val
[
ci
]
=
s
;
if
(
block
)
(
*
block
)[
0
]
=
(
JCOEF
)
s
;
...
...
3rdparty/libjpeg-turbo/src/jdmerge.c
浏览文件 @
d2b09537
...
...
@@ -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); \
...
...
3rdparty/libjpeg-turbo/src/jdsample.c
浏览文件 @
d2b09537
...
...
@@ -8,6 +8,7 @@
* Copyright (C) 2010, 2015-2016, D. R. Commander.
* Copyright (C) 2014, MIPS Technologies, Inc., California.
* Copyright (C) 2015, Google, Inc.
* Copyright (C) 2019, Arm Limited.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
...
...
@@ -315,9 +316,9 @@ h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPARRAY
output_data
=
*
output_data_ptr
;
JSAMPROW
inptr0
,
inptr1
,
outptr
;
#if BITS_IN_JSAMPLE == 8
int
thiscolsum
;
int
thiscolsum
,
bias
;
#else
JLONG
thiscolsum
;
JLONG
thiscolsum
,
bias
;
#endif
JDIMENSION
colctr
;
int
inrow
,
outrow
,
v
;
...
...
@@ -327,15 +328,18 @@ h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
for
(
v
=
0
;
v
<
2
;
v
++
)
{
/* inptr0 points to nearest input row, inptr1 points to next nearest */
inptr0
=
input_data
[
inrow
];
if
(
v
==
0
)
/* next nearest is row above */
if
(
v
==
0
)
{
/* next nearest is row above */
inptr1
=
input_data
[
inrow
-
1
];
else
/* next nearest is row below */
bias
=
1
;
}
else
{
/* next nearest is row below */
inptr1
=
input_data
[
inrow
+
1
];
bias
=
2
;
}
outptr
=
output_data
[
outrow
++
];
for
(
colctr
=
0
;
colctr
<
compptr
->
downsampled_width
;
colctr
++
)
{
thiscolsum
=
GETJSAMPLE
(
*
inptr0
++
)
*
3
+
GETJSAMPLE
(
*
inptr1
++
);
*
outptr
++
=
(
JSAMPLE
)((
thiscolsum
+
1
)
>>
2
);
*
outptr
++
=
(
JSAMPLE
)((
thiscolsum
+
bias
)
>>
2
);
}
}
inrow
++
;
...
...
3rdparty/libjpeg-turbo/src/jfdctint.c
浏览文件 @
d2b09537
/*
* jfdctint.c
*
* This file was part of the Independent JPEG Group's software
.
* This file was part of the Independent JPEG Group's software
:
* Copyright (C) 1991-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander.
...
...
3rdparty/libjpeg-turbo/src/jidctint.c
浏览文件 @
d2b09537
/*
* jidctint.c
*
* This file was part of the Independent JPEG Group's software
.
* This file was part of the Independent JPEG Group's software
:
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modification developed 2002-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
...
...
3rdparty/libjpeg-turbo/src/jidctred.c
浏览文件 @
d2b09537
/*
* jidctred.c
*
* This file was part of the Independent JPEG Group's software
.
* This file was part of the Independent JPEG Group's software
:
* Copyright (C) 1994-1998, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录