1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Compare commits

..

1129 Commits

Author SHA1 Message Date
Alexander Alekhin 6bdb9ca725 OpenCV release (3.4.8)
OpenCV 3.4.8
2019-10-09 14:42:29 +03:00
Maksim Shabunin 1ca74c3c03 Merge pull request #15544 from mshabunin:disable_posix_memalign
* Disable posix_memalign by default

* core: fix memalign parameter handling
2019-10-09 14:06:12 +03:00
Alexander Smorkalov c3a588037a Merge pull request #15666 from seanm:Wnewline 2019-10-09 11:04:44 +00:00
Marcin Tolysz 3fd36c1be1 Merge pull request #15658 from tolysz:patch-1
* Cuda + OpenGL on ARM

There might be multiple ways of getting OpenCV compile on Tegra (NVIDIA Jetson) platform, but mainly they modify CUDA(8,9,10...) source code, this one fixes it for all installations. 
( https://devtalk.nvidia.com/default/topic/1007290/jetson-tx2/building-opencv-with-opengl-support-/post/5141945/#5141945 et al.).
This way is exactly the same as the one proposed but the code change happens in OpenCV.

* Updated,
The link provided mentions: cuda8 + 9, I have cuda 10 + 10.1 (and can confirm it is still defined this way).
NVIDIA is probably using some other "secret" backend with Jetson.
2019-10-09 11:38:10 +03:00
Sean McBride 24effe8cd6 Fixed clang -Wnewline-eof warning by adding newline to end of file 2019-10-09 10:12:09 +03:00
Alexander Alekhin 2ff1fb60ad Merge pull request #15661 from alalek:fix_android_build_avx2 2019-10-08 23:36:26 +00:00
Alexander Alekhin 374d952e09 Merge pull request #15664 from alalek:build_eliminate_cuda_warnings 2019-10-08 15:27:54 +00:00
Alexander Alekhin 6efdfee3f0 build: eliminate CUDA warnings 2019-10-08 15:30:02 +03:00
Alexander Alekhin 42ac089e12 build: update AVX2 check
- _mm256_bslli_epi128() works in GCC 4.9.3+ only
- Android NDK r10 doesn't support this instruction
2019-10-08 13:12:02 +03:00
Alexander Alekhin 4748aca61f Merge pull request #15642 from alalek:issue_15597 2019-10-08 00:33:20 +03:00
Sayed Adel f2fe6f40c2 Merge pull request #15510 from seiko2plus:issue15506
* core: rework and optimize SIMD implementation of dotProd

  - add new universal intrinsics v_dotprod[int32], v_dotprod_expand[u&int8, u&int16, int32], v_cvt_f64(int64)
  - add a boolean param for all v_dotprod&_expand intrinsics that change the behavior of addition order between
    pairs in some platforms in order to reach the maximum optimization when the sum among all lanes is what only matters
  - fix clang build on ppc64le
  - support wide universal intrinsics for dotProd_32s
  - remove raw SIMD and activate universal intrinsics for dotProd_8
  - implement SIMD optimization for dotProd_s16&u16
  - extend performance test data types of dotprod
  - fix GCC VSX workaround of vec_mule and vec_mulo (in little-endian it must be swapped)
  - optimize v_mul_expand(int32) on VSX

* core: remove boolean param from v_dotprod&_expand and implement v_dotprod_fast&v_dotprod_expand_fast

  this changes made depend on "terfendail" review
2019-10-07 22:01:35 +03:00
Alexander Alekhin 7837ae0e19 Merge pull request #15654 from sturkmen72:patch-3 2019-10-07 16:15:04 +00:00
Alexander Alekhin a007220c52 imgproc: update histogram test 2019-10-07 15:06:43 +03:00
Alexander Alekhin ebb77bb311 Merge pull request #15653 from tolysz:patch-1 2019-10-07 12:04:13 +00:00
Marcin Tolysz 53400d86e2 Fix compiler warnings for latest cuda npp which defines this itself as:
```
#define NPP_VER_MAJOR 10
#define NPP_VER_MINOR 2
#define NPP_VER_PATCH 0
#define NPP_VER_BUILD 243

#define NPP_VERSION (NPP_VER_MAJOR * 1000 +     \
                     NPP_VER_MINOR *  100 +     \
                     NPP_VER_PATCH)
2019-10-07 11:45:26 +01:00
Suleyman TURKMEN c0489963bb Update copy.cpp 2019-10-07 11:59:52 +03:00
Alexander Alekhin 98fc098216 Merge pull request #15646 from alalek:fix_avx512_detection 2019-10-05 15:30:09 +00:00
Alexander Alekhin 953c60829e Merge pull request #15644 from wise86-android:upgradePySetup 2019-10-05 15:29:13 +00:00
Alexander Alekhin 6d811f9879 Merge pull request #15641 from alalek:dnn_pytest_update_3.4 2019-10-05 15:28:52 +00:00
Alexander Alekhin 22d0c57a1c Merge pull request #15602 from alalek:core_softfloat_ubsan_shift 2019-10-05 15:27:35 +00:00
Wise86 b1485d0337 upgrade the file to use the correct package name and include py3/gtk3 support 2019-10-05 14:53:09 +02:00
Alexander Alekhin bdc097495a fix avx512 detection
- renamed Cascade Lake AVX512_CEL => AVX512_CLX (align with Intel SDE tool)
- fixed CLX instruction sets (no IFMA/VBMI)
- added flag to bypass CPU baseline check: OPENCV_SKIP_CPU_BASELINE_CHECK
2019-10-05 11:03:57 +00:00
Alexander Alekhin feff8bf972 Merge pull request #15626 from alalek:dnn_openvino_2019r3 2019-10-04 19:45:37 +00:00
Alexander Alekhin f301f17b61 imgproc: accurate histogram value thresholding 2019-10-04 19:56:25 +03:00
Alexander Alekhin c13a5ce229 Merge pull request #15622 from dkurt:enet_ie_cpu 2019-10-04 16:31:05 +00:00
Alexander Alekhin ab5252c18e dnn(pytest): backport changes from master, update test setUp() 2019-10-04 18:43:35 +03:00
Dmitry Kurtaev e35fd463e7 Enable ENet with Inference Engine backend on CPU 2019-10-04 18:10:11 +03:00
Alexander Alekhin fd11e3a81d dnn: update IE tests 2019-10-04 17:49:10 +03:00
Alexander Alekhin 22d86116ee Merge pull request #15634 from alalek:issue_15083_4903 2019-10-04 11:54:54 +00:00
Alexander Alekhin deea46000e Merge pull request #15637 from APrigarina:3.4_version2
QR-Code detection: accuracy improvement (fixed)
2019-10-04 14:09:35 +03:00
APrigarina c99db2b9db bug fix 2019-10-04 13:02:54 +03:00
Alexander Alekhin c69245da1f imgproc: fix fitLine() implementation
- update optimal solutions on each iteration
2019-10-03 21:23:52 +00:00
Alexander Alekhin 2b66495a9d dnn: use OpenVINO 2019R3 defines 2019-10-02 18:47:01 +03:00
Alexander Alekhin a105f56957 Merge pull request #15621 from alalek:cmake_ipp_licenses 2019-10-02 14:30:17 +00:00
Alexander Alekhin 23bd1866ca Merge pull request #15620 from alalek:issue_14727 2019-10-02 14:29:56 +00:00
Alexander Alekhin 59c182ed2b Merge pull request #15467 from elmsfu:dshow/add_save_graph_file 2019-10-02 14:27:56 +00:00
Alexander Alekhin c06115cb3f Merge pull request #15619 from alalek:dnn_eltwise_sum_ie_ocl 2019-10-01 18:02:45 +00:00
Elms 8b483a91bc dshow: Add ability to save direct show graph 2019-10-01 09:46:07 -07:00
Alexander Alekhin 8814645c8d dnn(test): skip IE/OCL test for "sum" 2019-10-01 18:29:47 +03:00
Alexander Alekhin c92f3072b4 cmake: add check for IPP IW license files 2019-10-01 18:24:03 +03:00
Alexander Alekhin ffea927ac2 Merge pull request #15618 from alalek:dnn_test_async_timeout 2019-10-01 14:48:47 +00:00
Alexander Alekhin 77346d7286 core: workaround transform() inplace calls 2019-10-01 16:52:14 +03:00
Alexander Alekhin 440a937d24 dnn: increase async test timeout 2019-10-01 13:31:57 +03:00
Alexander Alekhin ba0b3983c6 Merge pull request #15609 from sturkmen72:update_loadsave_cpp 2019-09-30 18:37:21 +00:00
Sebastián Gurin a3144cbadc Merge pull request #15480 from cancerberoSgx:estimateAffine2D
js - cv.estimateAffine2D, cv.warpPolar
2019-09-30 21:35:26 +03:00
ann 5c9a624a85 Merge pull request #15356 from APrigarina:3.4_version2
QR-Code detection: accuracy improvement

* first commit

* resize improvement

* resize improvement

* dummy commit

* warnings fix

* warnings fix

* warnings fix

* test added

* resize fix

* resize fix

* tests changed

* tests changed
2019-09-30 21:33:58 +03:00
Suleyman TURKMEN d88d1c9935 Update loadsave.cpp 2019-09-28 23:24:17 +03:00
Alexander Alekhin ed9bca969c core: fix UBSAN in softfloat 2019-09-27 16:29:50 +03:00
Alexander Alekhin aa61e79615 Merge pull request #15600 from alalek:imgproc_pyramid_fix_indexing 2019-09-27 10:21:52 +00:00
Brandon 25dee8383c Merge pull request #15595 from frastlin:rodrigues
* Added Rodrigues to the JS embindgen.py and a unittest in test_calib3d.js on 3.4 base
2019-09-27 13:06:07 +03:00
Alexander Alekhin f81e401cd0 imgproc: fix indexing issue in pyramids
UBSAN violation expression: 'tab = tabR - x;'
2019-09-26 18:09:47 +03:00
Alexander Alekhin 7ce9428e96 Merge pull request #15580 from smbz:dnn-lstm-reverse 2019-09-25 15:54:06 +00:00
Alexander Alekhin 677b94c92e Merge pull request #15579 from alalek:ocl_use_host_mem_ptr_flag 2019-09-25 15:12:59 +00:00
Andrew Ryrie b88435fdc2 dnn: Allow LSTM layer to operate in reverse direction
This is useful for bidirectional LSTMs.
2019-09-25 14:12:43 +01:00
Alexander Alekhin 790927bb55 Merge pull request #15582 from terfendail:pyrdown_oob 2019-09-25 12:37:31 +00:00
Lubov Batanina e923712d81 Merge pull request #15572 from l-bat:deconv3d
Fix computation of internal shapes in Deconvolution layer

* Fix computation of internal shapes

* Refactoring
2019-09-25 15:35:04 +03:00
Alexander Alekhin eacadf0e73 core(ocl): add flag OPENCV_OPENCL_ENABLE_MEM_USE_HOST_PTR
to control CL_MEM_USE_HOST_PTR usage
2019-09-25 15:12:36 +03:00
Alexander Alekhin e3daf489c8 Merge pull request #15581 from takacsd:3.4 2019-09-25 10:45:49 +00:00
Vitaly Tuzov 1c17b3281a Fixed OOB reading in pyrDown 2019-09-25 13:24:17 +03:00
Alexander Alekhin d2cacac07a Merge pull request #15573 from alalek:build_cxx11_warnings 2019-09-24 22:08:55 +00:00
takacsd e0be771b64 Add option to disable features in iOS build. 2019-09-24 17:42:35 +02:00
Wenzhao Xiang c2096771cb Merge pull request #15371 from Wenzhao-Xiang:gsoc_2019
[GSoC 2019] Improve the performance of JavaScript version of OpenCV (OpenCV.js)

* [GSoC 2019]

Improve the performance of JavaScript version of OpenCV (OpenCV.js):
1. Create the base of OpenCV.js performance test:
     This perf test is based on benchmark.js(https://benchmarkjs.com). And first add `cvtColor`, `Resize`, `Threshold` into it.
2. Optimize the OpenCV.js performance by WASM threads:
     This optimization is based on Web Worker API and SharedArrayBuffer, so it can be only used in browser.
3. Optimize the OpenCV.js performance by WASM SIMD:
     Add WASM SIMD backend for OpenCV Universal Intrinsics. It's experimental as WASM SIMD is still in development.

* [GSoC2019] 

1. use short license header
2. fix documentation node issue
3. remove the unused `hasSIMD128()` api

* [GSoC2019]

1. fix emscripten define
2. use fallback function for f16

* [GSoC2019]

Fix rebase issue
2019-09-24 16:30:42 +03:00
Alexander Alekhin 3cf9185159 Merge pull request #15538 from terfendail:wui_checkany 2019-09-23 15:52:24 +00:00
Maksim Shabunin c8abf2ad14 backport: fixed warnings produced by clang-9.0.0
ea3dc78986
https://github.com/opencv/opencv_contrib/commit/83fc27cb99db4435d07974090fbdc77d831931cd
2019-09-23 18:36:18 +03:00
Alexander Alekhin c4d2e3c0b3 Merge pull request #15566 from alalek:issue_15558 2019-09-23 09:22:06 +00:00
Alexander Alekhin b40fd6de32 Merge pull request #15565 from alalek:issue_15561 2019-09-23 09:21:49 +00:00
Alexander Alekhin 3516d0835e Merge pull request #15564 from alalek:issue_15560 2019-09-23 09:21:27 +00:00
Alexander Alekhin fcc69d5a60 core(test): fix check conditions 2019-09-22 11:28:41 +00:00
Alexander Alekhin fef7fc343e ml: add checks of empty train data 2019-09-22 11:12:19 +00:00
Alexander Alekhin ad2854c8b3 imgcodecs: add check image.empty() in imwrite()/imencode() 2019-09-22 10:45:00 +00:00
Alexander Alekhin eabbe38001 Merge pull request #15554 from alalek:pr15422_patch_files
* 3rdparty: libpng v1.6.37 MSA patch (pr15422)

original files: https://github.com/glennrp/libpng/tree/v1.6.37/mips

* 3rdparty: libwebp MSA asm patch (pr15422)
2019-09-21 00:07:24 +03:00
mipsopen-fwu b1ea91d8bd Merge pull request #15422 from mipsopen-fwu:msa-dev
* Added MSA implementations for mips platforms. Intrinsics for MSA and build scripts for MIPS platforms are added.

Signed-off-by: Fei Wu <fwu@wavecomp.com>

* Removed some unused code in mips.toolchain.cmake.

Signed-off-by: Fei Wu <fwu@wavecomp.com>

* Added comments for mips toolchain configuration and disabled compiling warnings for libpng.

Signed-off-by: Fei Wu <fwu@wavecomp.com>

* Fixed the build error of unsupported opcode 'pause' when mips isa_rev is less than 2.

Signed-off-by: Fei Wu <fwu@wavecomp.com>

* 1. Removed FP16 related item in MSA option defines in OpenCVCompilerOptimizations.cmake.
2. Use CV_CPU_COMPILE_MSA instead of __mips_msa for MSA feature check in cv_cpu_dispatch.h.
3. Removed hasSIMD128() in intrin_msa.hpp.
4. Define CPU_MSA as 150.
Signed-off-by: Fei Wu <fwu@wavecomp.com>

* 1. Removed unnecessary CV_SIMD128_64F guarding in intrin_msa.hpp.
2. Removed unnecessary CV_MSA related code block in dotProd_8u().

Signed-off-by: Fei Wu <fwu@wavecomp.com>

* 1. Defined CPU_MSA_FLAGS_ON as "-mmsa".
2. Removed CV_SIMD128_64F guardings in intrin_msa.hpp.

Signed-off-by: Fei Wu <fwu@wavecomp.com>

* Removed unused msa_mlal_u16() and msa_mlal_s16 from msa_macros.h.

Signed-off-by: Fei Wu <fwu@wavecomp.com>
2019-09-20 19:52:48 +03:00
Vitaly Tuzov 66842f5a18 Extended v_check_any/v_check_all universal intrinsics to support 64-bit integer 2019-09-19 18:31:31 +03:00
Alexander Alekhin 33e9fe9312 Merge pull request #15540 from alalek:issue_15278_2 2019-09-18 20:12:36 +00:00
Alexander Alekhin 65c209fad3 Merge pull request #15519 from mshabunin:fix-custom-install 2019-09-18 15:31:25 +00:00
dab0bby a9163a53d3 Merge pull request #15477 from dab0bby:remove-old-build-java-option
* remove old BUILD_opencv_java option

* replace old build_java option with new BUILD_JAVA option
2019-09-18 18:30:01 +03:00
Alexander Alekhin c657c6cbac cmake: use 'long long' for atomic check 2019-09-18 15:18:09 +00:00
Alexander Alekhin 8167d47efc Merge pull request #15516 from dkurt:dnn_detection_model_fix_3.4 2019-09-18 11:22:27 +00:00
Alexander Alekhin 1ecea1f4a6 Merge pull request #15529 from collinbrake:feature_grammar_fixes 2019-09-18 11:19:59 +00:00
Alexander Alekhin 46fd112f9b Merge pull request #15399 from terfendail:perf_stereobm 2019-09-17 14:26:43 +00:00
collin bcf7d3160c Grammer fixes on python image display tutorial 2019-09-16 17:57:22 -04:00
Daniel Kapusi d2872afce0 Merge pull request #15341 from DiebBlue:is5769
* issue 5769 fixed: cv::stereoRectify fails if given inliers mask of type vector<uchar>

* issue5769 fix using reshape and add regression test

* regression test with outlier detection, testing vector and mat data

* Size comparision of wrong vector within CV_Assert in regression test corrected

* cleanup test code
2019-09-17 00:04:05 +03:00
Alexander Alekhin 70c88a2087 Merge pull request #15517 from mshabunin:fix-osx-avfoundation-auth 2019-09-16 15:28:34 +00:00
Alexander Alekhin 7770ba1f10 Merge pull request #15491 from terfendail:undistort_fix 2019-09-16 15:24:29 +00:00
Vitaly Tuzov 7b3a752012 Fixed universal intrinsic undistort() implementation 2019-09-16 17:16:38 +03:00
Maksim Shabunin 5a75808516 Windows: partially restore install config generation 2019-09-16 12:11:48 +03:00
Alexander Alekhin 03c4c67dad Merge pull request #15518 from mshabunin:fix-osx-qt 2019-09-13 17:06:00 +00:00
Alexander Alekhin f5f9187720 Merge pull request #15476 from cancerberoSgx:js-docker 2019-09-13 17:04:52 +00:00
Alexander Alekhin 89b82e796e Merge pull request #15449 from mshabunin:cmake-download-params 2019-09-13 17:03:28 +00:00
Alexander Alekhin 48fa39f675 Merge pull request #15487 from dkurt:fix_ie_2019r1 2019-09-13 16:57:34 +00:00
Alexander Alekhin 69c19dc3d3 Merge pull request #15511 from pmur:vmuleo-fix-gcc7 2019-09-13 16:48:18 +00:00
Maksim Shabunin 5c0502b470 Fixed OSX build with Qt 2019-09-13 15:23:59 +03:00
Maksim Shabunin f10fce9ab4 AVFoundation: backported runtime authorization check from master 2019-09-13 13:20:29 +03:00
Maksim Shabunin aaad238c6e AVFoundation: fix authorization request not being shown 2019-09-13 13:11:35 +03:00
Dmitry Kurtaev 741aee6901 Fix dnn object detection sample 2019-09-13 11:50:50 +03:00
Dmitry Kurtaev 0428f60d66 Fix OpenVINO 2019R1 compilation 2019-09-13 09:22:34 +03:00
Paul E. Murphy b465c82696 core: workaround old gcc vec_mul{e,o} (Issue #15506)
ISA 2.07 (aka POWER8) effectively extended the expanding multiply
operation to word types. The altivec intrinsics prior to gcc 8 did
not get the update.

Workaround this deficiency similar to other fixes.

This was exposed by commit 33fb253a66
which leverages the int -> dword expanding multiply.

This fixes Issue #15506
2019-09-12 09:54:02 -05:00
Alexander Alekhin 8609198b05 Merge pull request #15466 from alalek:ffmpeg_update_3.4 2019-09-10 09:57:38 +00:00
Vitaly Tuzov bf8b5ffeb1 Added performance test for StereoBM algorithm 2019-09-09 16:37:06 +03:00
Sebastián Gurín a17231a6b4 js docker build docs emcc latest warning 2019-09-06 15:18:34 -03:00
Alexander Alekhin b3a0507546 Merge pull request #15475 from alalek:build_eliminate_warning_array_bounds 2019-09-06 15:57:52 +00:00
Alexander Alekhin f139a0bda8 Merge pull request #15461 from alalek:imgproc_connectedcomponents_allocation 2019-09-06 15:32:04 +00:00
Alexander Alekhin bdf23ce855 ts: eliminate -Warray-bounds warning 2019-09-06 18:06:02 +03:00
Alexander Alekhin 6a49887695 ffmpeg/3.4: update FFmpeg wrapper 2019-09-05 21:36:06 +00:00
Alexander Alekhin e7b6753a10 imgproc: avoid manual memory allocation in connectedcomponents.cpp 2019-09-05 16:20:08 +03:00
Jaime fafada28eb Merge pull request #14872 from AhiyaHiya:feature/topmost_window
* Added mechanism to set/toggle NORMAL window to TOPMOST window.

* highgui: remove unnecessary/legacy code
2019-09-05 13:55:17 +03:00
Alexander Alekhin 4ffb5b62ea Merge pull request #15170 from sturkmen72:update_samples 2019-09-05 10:44:06 +00:00
Suleyman TURKMEN f73395122c Update Samples 2019-09-05 01:10:51 +03:00
Alexander Alekhin 0a13633411 Merge pull request #15444 from alalek:ocl_fix_fft_kernel 2019-09-04 16:25:34 +00:00
Everton Constantino 76e403cf25 Merge pull request #15440 from everton1984:new_integral_tests
* Adding all possible data type interactions to the perf tests since some
use SIMD acceleration and others do not.

* Disabling full tests by default.

* Giving proper names, removing magic numbers and sanity checks of new
performance tests for the integral function.

* Giving proper names, making array static.
2019-09-04 19:14:00 +03:00
huihut fe42933ac5 Merge pull request #15433 from huihut:master
* fix 'chmod' is not recognized as an internal or external command in Windows

https://github.com/opencv/opencv/issues/14939

* cmake: update PCH command handling
2019-09-04 18:36:56 +03:00
Maksim Shabunin 9d4f01626c cmake: add directory creation to download helper scripts 2019-09-04 17:09:13 +03:00
Maksim Shabunin d974d4c6ce cmake: download tries, customizable download parameters 2019-09-04 17:09:13 +03:00
Dmitry Kurtaev ba703157cf Merge pull request #15063 from dkurt:dnn_ie_ocv_layers
* Wrap unsupported by IE layers as custom layers

* Replace pointers to layers blobs to their shapes

* Enable Faster R-CNN with IE backend on CPU
2019-09-03 18:58:57 +03:00
Alexander Alekhin 8bd2720c28 core(ocl): fix fft kernel compilation
- error: variables in the local address space can only be declared in the outermost scope of a kernel function
2019-09-03 15:46:53 +03:00
Alexander Alekhin 7e46766c8d Merge pull request #15437 from devnexen:fbsd_opencl_build_fix 2019-09-03 12:21:02 +00:00
Alexander Alekhin 9ef5373776 Merge pull request #15435 from alalek:update_version_3.4.8-pre 2019-09-03 12:04:23 +00:00
Alexander Alekhin abd7d63b74 Merge pull request #15424 from mshabunin:add-cmake-docs 2019-09-03 10:50:45 +00:00
David Carlier 6769ee3748 OpenCL: FreeBSD build fix 2019-09-02 18:30:53 +01:00
Alexander Alekhin 0fda243a05 pre: OpenCV 3.4.8 (version++) 2019-09-02 14:20:49 +03:00
Alexander Alekhin 70dfae31a2 experimental version++ 2019-09-02 14:17:36 +03:00
Alexander Alekhin 048ddbf9ee Merge pull request #15339 from pmur:dotprod-32s-vsx 2019-08-31 11:16:04 +00:00
Alexander Alekhin 2a6527e751 Merge pull request #15402 from ChipKerchner:normUnroll 2019-08-31 11:10:05 +00:00
Chip Kerchner 26228e6b4d Merge pull request #15358 from ChipKerchner:imgwarpToHal
* Convert ImgWarp from SSE SIMD to HAL - 2.8x faster on Power (VSX) and 15% speedup on x86

* Change compile flag from CV_SIMD128 to CV_SIMD128_64F for use of v_float64x2 type

* Changing WarpPerspectiveLine from class functions and dispatching to static functions.

* Re-add dynamic runtime and dispatch execution.

* RRestore SSE4_1 optimizations inside opt_SSE4_1 namespace
2019-08-31 13:47:58 +03:00
Maksim Shabunin f3aab47f94 Assorted documentation fixes
* removed private flann documentation
* common tutorial images moved to doc/images
* grouping issues
2019-08-31 01:50:11 +03:00
Alexander Alekhin f224d740a3 Merge pull request #15414 from kuzi117:instr 2019-08-30 12:03:19 +00:00
Alexander Alekhin 700f7a275f Merge pull request #15418 from mshabunin:try-install-layout-34 2019-08-29 18:42:58 +00:00
Alexander Alekhin e319340253 Merge pull request #15417 from alalek:ts_fix_callback_signature 2019-08-29 18:40:19 +00:00
Alexander Alekhin 6508bbcef5 Merge pull request #15412 from kuzi117:ambig 2019-08-29 18:39:00 +00:00
Braedy Kuzma 9bf8b496d6 Use commonly supported instruction mnemonic. 2019-08-29 10:00:40 -06:00
Braedy Kuzma d4120dd2fe Disambiguate vecpopcnt for (u)dword2. 2019-08-29 09:54:56 -06:00
Maksim Shabunin 8c849a48cc Ported install layout refactoring from master branch 2019-08-29 17:01:49 +03:00
Alexander Alekhin 654d0c29ad ts: fix callback function signature
detected by UBSAN
2019-08-29 15:09:32 +03:00
Alexander Alekhin 8d0b3dad5c Merge pull request #15357 from ChipKerchner:fastCorner 2019-08-29 08:26:31 +00:00
Lubov Batanina 90eb529bc4 Merge pull request #15395 from l-bat:fully_connected
* Fix IE FullyConnected layer

* Fix MyriadX
2019-08-29 10:52:02 +03:00
Alexander Alekhin 6506c19ac3 Merge pull request #15407 from terfendail:test_check_any 2019-08-28 16:39:01 +00:00
Chip Kerchner 30a60d396b Merge pull request #15274 from ChipKerchner:lkpyramidToHal
* Convert lkpyramid from SSE SIMD to HAL - 90% faster on Power (VSX).

* Replace stores with reduce_sum.  Rework to handle endianess correctly.

* Fix compiler warnings by casting values explicitly to shorts

* Switch to CV_SIMD128 compiler definition.  Unroll loop to 8 elements since we've already loaded the data.
2019-08-28 18:56:48 +03:00
Vitaly Tuzov d134ec54c5 Extend tests for v_check_any and v_check_all intrinsics 2019-08-28 14:53:31 +03:00
Alexander Alekhin ca7640e10f Merge pull request #15401 from ChipKerchner:vectorReduceInt8Bug 2019-08-27 19:59:39 +00:00
ChipKerchner 288e6f9c07 –Improve vectorization in the 'norm' functions 2019-08-27 12:15:19 -05:00
ChipKerchner 70b883cfeb Fix macro bug with v_reduce_min and v_reduce_max for chars in VSX 2019-08-27 11:38:53 -05:00
Alexander Alekhin ea525d5685 Merge pull request #15400 from terfendail:fix_check_any 2019-08-27 14:07:23 +00:00
Vitaly Tuzov 1b40528e1a Fix for AVX2 implementation of v_check_any(), v_check_all() intrinsics 2019-08-27 14:31:23 +03:00
atinfinity 824465ea27 Merge pull request #15388 from atinfinity:impl-turbo-colormap
Implementation of colormap "Turbo" (#15388)

* implemented turbo colormap

* add colormap image

* changed float value to avoid cast

* sorted flag check alphabetically
2019-08-26 17:55:10 +03:00
Alexander Alekhin 4a33014edc Merge pull request #15391 from dkurt:fix_15141 2019-08-26 12:17:21 +00:00
Dmitry Kurtaev 57676cf64d Fix https://github.com/opencv/opencv/issues/15141 2019-08-24 23:14:26 +03:00
Alexander Alekhin 114674c3d9 Merge pull request #15383 from alalek:fix_15379 2019-08-23 16:19:36 +00:00
Alexander Alekhin c05595e482 Merge pull request #15382 from alalek:fix_15287 2019-08-23 16:09:13 +00:00
Alexander Alekhin d4d7ab0620 Merge pull request #15380 from alalek:fix_build_icc 2019-08-23 16:07:21 +00:00
Alexander Alekhin c74206e4de Merge pull request #15376 from ilya-lavrenov:detect_openvino 2019-08-23 16:05:15 +00:00
Giles Payne 96d5cbd036 Merge pull request #15350 from komakai:apple-debug-build
* Add debug build option to MacOs and iOS build scripts

* osx: allow selection of MACOSX_DEPLOYMENT_TARGET

* Add --debug_info flag to iOS and macOS builds for building with debug info
2019-08-23 18:22:29 +03:00
Ilya Lavrenov d0c4a92b4c Adopted detection of Inference Engine 2019-08-23 17:37:57 +03:00
Alexander Alekhin d7409604b5 core: handle empty Mat in Mat_ assignment operators 2019-08-23 16:54:24 +03:00
Alexander Alekhin 29dbeb253c build: fix build with ICC 2019-08-23 16:36:32 +03:00
Alexander Alekhin 5a497077f1 objdetect: add input check in HOG detector 2019-08-23 16:14:53 +03:00
Alexander Alekhin 6bf6d1dc6b Merge pull request #15373 from pmur:libpng-vsx-fix 2019-08-22 20:54:34 +00:00
Alexander Alekhin 56e832ee43 Merge pull request #15372 from alalek:core_stat_fix_intrin 2019-08-22 20:52:54 +00:00
Alexander Alekhin 601096f360 Merge pull request #15370 from alalek:core_fastmath_hpp_update 2019-08-22 17:05:38 +00:00
Alexander Alekhin aa09febf79 Merge pull request #15353 from alalek:cmake_check_atomic 2019-08-22 15:43:34 +00:00
Paul E. Murphy 8aca1934ff libpng: update check for VSX enablement
The deprecated flag ENABLE_VSX should not be used to enable this
feature. Instead, use the baseline cpu feature set to determine.
2019-08-22 10:08:01 -05:00
Alexander Alekhin 8a0b93bc4d core: update fastmath.hpp 2019-08-22 16:43:07 +03:00
Alexander Alekhin 8b1fe8f6e0 core: fix stat SIMD code 2019-08-22 16:37:26 +03:00
Alexander Alekhin 7243eda2ff Merge pull request #15316 from sturkmen72:update_seamless_cloning_cpp 2019-08-22 11:37:38 +00:00
Prakhar Varshney 3f7cc45686 Merge pull request #15345 from prakhar9998:patch-1
* fix broken code link

resolves  #15344

* Update stitcher.markdown

* update 3.4 link
2019-08-22 12:25:27 +03:00
Alexander Alekhin 84b8a2fb05 Merge pull request #15303 from dkurt:fix_15296 2019-08-21 16:59:20 +00:00
Alexander Alekhin c93e2ff81d Merge pull request #15365 from Zyrin:3.4 2019-08-21 15:55:25 +00:00
Alexander Alekhin 0cdfd72529 Merge pull request #15368 from dab0bby:patch-2 2019-08-21 15:10:25 +00:00
dab0bby 70ce2bbb9e fix typo and reference 2019-08-21 14:52:31 +02:00
Alexander Alekhin 464972855e cmake: add libatomic check 2019-08-21 13:02:36 +03:00
Rosen Penev 58ca013b90 Merge pull request #15279 from neheb:patch-1
* jas_stream: Add definition for L_tmpnam if missing

uClibc-ng for some reason does not provide a definition when some
deprecated APIs are disabled. Value taken from the musl libc.

* 3rdparty: move uClibc-ng workaround into config file
2019-08-21 12:59:09 +03:00
Zyrin 869ea22f34 Use std::move in Mat_<T> move constructors 2019-08-21 11:12:00 +02:00
Zyrin 8ef8088686 Fix stack overflow on gcc with c++17 (#15343) 2019-08-21 10:57:03 +02:00
Alexander Alekhin c5e9bbe4f3 Merge pull request #15335 from lixit:master 2019-08-20 22:10:11 +00:00
Paul E. Murphy 33fb253a66 core: vectorize dotProd_32s
Use 4x FMA chains to sum on SIMD 128 FP64 targets. On
x86 this showed about 1.4x improvement.

For PPC, do a full multiply (32x32->64b), convert to DP
then accumulate. This may be slightly less precise for
some inputs. But is 1.5x faster than the above which
is about 1.5x than the FMA above for ~2.5x speedup.
2019-08-20 15:28:36 -05:00
ChipKerchner 51ceabb2eb Change fast corner flags in HAL version from char array to single int 2019-08-20 13:25:35 -05:00
xitong b1a5c76215 Fix a typo 2019-08-20 12:01:40 +08:00
Alexander Alekhin 9612397aa2 Merge pull request #15329 from craterkamath:fixTypoCamshift 2019-08-19 19:01:43 +00:00
craterkamath 04f720d56a Fixed Typo Closes #15148 2019-08-19 22:52:00 +05:30
Alexander Alekhin b8f35aa109 Merge pull request #15322 from alalek:backport_15318 2019-08-16 15:40:22 +00:00
Suleyman TURKMEN a1e96a7deb Update seamless_cloning.cpp 2019-08-16 17:35:22 +03:00
luz.paz fcc7d8dd4e Fix modules/ typos
Found using `codespell -q 3 -S ./3rdparty -L activ,amin,ang,atleast,childs,dof,endwhile,halfs,hist,iff,nd,od,uint`

backporting of commit: ec43292e1e
2019-08-16 17:34:29 +03:00
Alexander Alekhin 7df3141bbc Merge pull request #15309 from alalek:backport_15305 2019-08-15 12:02:24 +00:00
luz.paz 57ccf14952 FIx misc. source and comment typos
Found via `codespell -q 3 -S ./3rdparty,./modules -L amin,ang,atleast,dof,endwhile,hist,uint`

backporting of commit: 32aba5e64b
2019-08-15 13:09:52 +03:00
Alexander Alekhin 13ecd5bb25 Merge pull request #15122 from pmur:fast-math-improvements 2019-08-14 19:28:05 +00:00
Alexander Alekhin a703b9ed84 Merge pull request #15101 from alalek:cmake_initialization 2019-08-14 19:17:07 +00:00
Dmitry Kurtaev e4a80aee09 Fix #15296 2019-08-14 19:44:05 +03:00
Alexander Alekhin 26551f178c Merge pull request #15301 from alalek:backport 2019-08-14 16:40:24 +00:00
Alexander Alekhin 32772a5436 3.4: backported changes from 'master' branch 2019-08-14 16:36:08 +03:00
Alexander Alekhin 7c96857c02 Merge pull request #15292 from alalek:build_warnings_xcode_10_3 2019-08-13 14:18:48 +00:00
Alexander Alekhin 15b8a8d935 build: eliminate warnings with Xcode 10.3 2019-08-13 15:06:13 +03:00
Alexander Alekhin e0cb01e2cf Merge pull request #15249 from dkurt:dnn_ie_tests_2019r2 2019-08-12 16:32:38 +00:00
Hugo Lindström 935067ee05 Merge pull request #15265 from hugolm84:wince-armv7-supports-neon
* WINCE 8.0 requires ARMv7 Thumb2 and thus have NEON instructions

* Only add NEON if on _ARM_
2019-08-09 18:01:37 +03:00
Chip Kerchner d513fb4c8e Merge pull request #15199 from ChipKerchner:hogToHal
Convert HOG from SSE SIMD to HAL - 35-45% faster on Power (VSX) (#15199)

* Convert SSE SIMD to HAL. 35-45% improvement for Power (VSX)

* Remove CV_NEON code. Use v_floor instead of 3 lines of code.

* Invert comparison logic to simplify code.

* Change initialization from v_load to constructor type.
2019-08-08 18:57:03 +03:00
Alexander Alekhin 596b8a5d06 Merge pull request #15263 from alalek:videoio_skip_msmf_tests3 2019-08-08 15:47:08 +00:00
Alexander Alekhin 6f267be6f1 Merge pull request #15260 from tomoaki0705:suppressNoisyWarning 2019-08-08 15:45:29 +00:00
Jake Howard 76b40a37e7 Merge pull request #15111 from RealOrangeOne:patch-1
* Remove unavoidable print of CV error

The return value covers whether the device exists.

This might be better hidden behind a debug flag, but I couldn't work out how to do that nicely.

* Use `CV_LOG_WARNING` macro to log rather than removing it entirely
2019-08-08 16:56:49 +03:00
Alexander Alekhin a77275e650 videoio(test): skip unstable MSMF tests (3) 2019-08-08 16:25:19 +03:00
Tomoaki Teshima 40c71a2463 suppress noisy warning
* add -Wno-psabi when using GCC 6
  * add -Wundef for CUDA 10
  * add -Wdeprecated-declarations when using GCC 7
  * add -Wstrict-aliasing and -Wtautological-compare for GCC 7
  * replace cudaThreadSynchronize with cudaDeviceSynchronize
2019-08-08 21:49:32 +09:00
Alexander Alekhin 5ef548a985 cmake: update initialization 2019-08-08 15:23:16 +03:00
Paul E. Murphy f38a61c66d fast_math: implement optimized PPC routines
Implement cvRound using inline asm. No compiler support
exists today to properly optimize this. This results in
about a 4x speedup over the default rounding. Likewise,
simplify the growing number of rounding function overloads.

For P9 enabled targets, utilize the classification
testing instruction to test for Inf/Nan values. Operation
speedup is about 1.2x for FP32, and 1.5x for FP64 operands.

For P8 targets, fallback to the GCC nan inline. It provides
a 1.1/1.4x improvement for FP32/FP64 arguments.
2019-08-07 15:01:18 -05:00
Paul E. Murphy 3f92bcc11a fast_math: selectively use GCC rounding builtins when available
Add a new macro definition OPENCV_USE_FASTMATH_GCC_BUILTINS to enable
usage of GCC inline math functions, if available and requested by the
user.

Likewise, enable it for POWER. This is nearly always a substantial
improvement over using integer manipulation as most operations can
be done in several instructions with no branching. The result is a
1.5-1.8x speedup in the ceil/floor operations.

1. As tested with AT 12.0-1 (GCC 8.3.1) compiler on P9 LE.
2019-08-07 15:01:18 -05:00
Paul E. Murphy b2135be594 fast_math: add extra perf/unit tests
Add a basic sanity test to verify the rounding functions
work as expected.

Likewise, extend the rounding performance test to cover the
additional float -> int fast math functions.
2019-08-07 14:59:46 -05:00
Dmitry Kurtaev 6193e403e7 Enable some tests for 2019R2 2019-08-07 09:07:53 +03:00
Alexander Alekhin 32da0705cf Merge pull request #15102 from dgel:force_input_format_ffmpeg 2019-08-06 20:52:57 +00:00
Alexander Alekhin ba1a48c2ce Merge pull request #14901 from fishjam:issue_8834 2019-08-06 20:52:21 +00:00
Alexander Alekhin 821f17d666 Merge pull request #15235 from pmur:vsx-v_signmask-vbpermq 2019-08-06 20:09:22 +00:00
Lubov Batanina 0e1ef8f8e1 Merge pull request #15184 from l-bat:IE_R2
Support new IE API (#15184)

* Add support OpenVINO R2 for layers

* Add Core API

* Fix tests

* Fix expectNoFallbacksFromIE for ONNX nets

* Remove deprecated API

* Remove td

* Remove TargetDevice

* Fix Async

* Add test

* Fix detectMyriadX

* Fix test

* Fix warning
2019-08-06 22:20:26 +03:00
Douwe Gelling 96a27f4266 allow forcing the input format for ffmpeg backend with env var 2019-08-06 19:30:39 +03:00
fishjam 26ac5a3bdc try to fix VideoCapture different time stamp 2019-08-06 19:04:22 +03:00
ilbalance cf93a05d2d Merge pull request #15230 from ilbalance:js_rotate
* in OpenCV.js added 'rotate' function and test sample

* value test added
2019-08-06 12:55:15 +03:00
Alexander Alekhin 90ccd2f37c Merge pull request #15239 from alalek:videoio_skip_msmf_tests2 2019-08-05 18:08:48 +00:00
Alexander Alekhin a4b4432015 videoio(test): skip unstable MSMF tests (2) 2019-08-05 19:13:17 +03:00
Alexander Alekhin 365323afec Merge pull request #15234 from alalek:backport 2019-08-05 15:09:22 +00:00
Alexander Alekhin 99f709ca96 Merge pull request #15233 from alalek:videoio_skip_msmf_tests 2019-08-05 15:08:41 +00:00
Alexander Alekhin 3fc02353be Merge pull request #15228 from flyseaworld:exif/read_num_dir 2019-08-05 15:07:40 +00:00
Sebastián Gurin ca79f75b32 OpenCV.js docker container build instructions
backport of commit: 59b0314a0e
2019-08-05 17:21:34 +03:00
Victor Romero 987bb2ca61 Fix build for UWP
backport of commit: f18cbd036a
2019-08-05 17:19:36 +03:00
TheGoddessInari 960bb540ec Make sure to use defined(__GNUC__) instead of bare __GNUC__ in flann2 header.
This fixes a compiler error on MSVC with Unreal Engine (at least).

backport of commit: 4e998c9ade
2019-08-05 17:19:12 +03:00
John Smith b9d6fc9dad Fix cv::selectROI rectangle rendering issue
backport of commit: 95c65aff75
2019-08-05 17:18:30 +03:00
Paul E. Murphy 1031b7f4bc hal: vsx: further optimize v_signmask
Use the quadword bit permutation instruction to creatively move
the sign bits to create the mask. Note that values above 127 will
result in 0.
2019-08-05 09:00:22 -05:00
Alexander Alekhin 406313bbc5 videoio(test): skip unstable MSMF tests 2019-08-05 16:57:26 +03:00
yaohai [姚海] cadb4dee14 fix exif bug 2019-08-05 16:41:07 +03:00
Alexander Alekhin d2c64b566b Merge pull request #15227 from tomoaki0705:fixFallThroughCarotene 2019-08-05 12:44:00 +00:00
Alexander Alekhin c5069266dc Merge pull request #15222 from hmaarrfk:verify_carbon 2019-08-05 12:43:13 +00:00
Tomoaki Teshima d6ba235655 fix fall through warning 2019-08-05 17:42:48 +09:00
Mark Harfouche 63775320ae Verify Carbon correctly on OSX 2019-08-04 18:26:28 -04:00
Alexander Alekhin b584c23061 Merge pull request #15158 from dkurt:fix_tf_ssd_configs 2019-08-02 16:08:55 +00:00
Alexander Alekhin ba934ff1ce Merge pull request #15202 from hugolm84:support_build_shared_for_wince 2019-08-02 15:34:02 +00:00
Alexander Alekhin b811420d28 Merge pull request #15188 from mshabunin:fix-v4l-old 2019-08-02 12:25:23 +00:00
Maksim Shabunin b231e91d87 Fix for building with old V4L 2019-08-02 11:19:49 +03:00
Alexander Alekhin 977d2c4330 Merge pull request #15197 from mshabunin:restore-ipp-cut 2019-08-01 16:33:37 +00:00
Alexander Alekhin 3f4004ae45 Merge pull request #15195 from mshabunin:disable-pch 2019-08-01 16:33:10 +00:00
Hugo Lindström 03fe1cb7fc Support building shared libraries on WINCE. 2019-08-01 15:28:04 +02:00
Maksim Shabunin 4dadf17bd9 Merge pull request #15168 from dkurt:dnn_onnx_15120 2019-07-31 15:03:23 +00:00
Maksim Shabunin 6d5ac67681 Restored IPP call reduction 2019-07-31 15:41:22 +03:00
Maksim Shabunin 1275248f39 PCH: disable by default on all platforms except MSVC 2019-07-31 15:20:01 +03:00
dcouwenh d3cf0d2c06 Bayer VNG Demosaicing Fix #2 (Merge pull request #15086)
* Update demosaicing.cpp

Fixed calculation of Bs for non-green pixels.

* Fixed cvtColor perf test for bayer VNG
2019-07-30 23:49:46 +03:00
Maksim Shabunin 5ef7325874 Merge pull request #15176 from dkurt:fix_14993 2019-07-30 14:26:33 +00:00
Lubov Batanina 5a6b23e8f3 Support for several min and max sizes in PriorBox layer (Merge pull request #15076)
* Support for several min and max sizes in PriorBox layer

* Fix minSize

* Check size

* Modify initInfEngine

* Fix tests

* Fix IE support

* Add priorbox test

* Remove inputs
2019-07-30 17:23:47 +03:00
Maksim Shabunin e90438fe3c Merge pull request #14938 from LaurentBerger:face_clip 2019-07-30 14:18:51 +00:00
Maksim Shabunin f7d5b39ec9 Merge pull request #15169 from dkurt:dnn_onnx_drop_vgg16 2019-07-30 14:15:34 +00:00
Maksim Shabunin eec9fa9d5e Merge pull request #15181 from berak:java_print_blob 2019-07-30 14:13:02 +00:00
berak 4d3989817c java: fix Mat.toString() for higher dimensions 2019-07-29 19:39:09 +02:00
Dmitry Kurtaev 59864a3bbc Fix #14993 2019-07-28 22:32:37 +03:00
Dmitry Kurtaev f9f160404a Add support for slice from ONNX with multiple outputs 2019-07-28 21:20:25 +03:00
Dmitry Kurtaev ebaefbb745 Remove VGG16 from ONNX test because there is VGG16_bn 2019-07-27 23:04:25 +03:00
Dmitry Kurtaev 47c5ee5d9c Fixes for OpenCV face detection network 2019-07-27 17:25:09 +02:00
Dmitry Kurtaev 77d4e3e8d2 Fix 2019R2 tests 2019-07-27 13:30:15 +03:00
Dmitry Kurtaev a0c3bb70a9 Modify SSD from TensorFlow graph generation script to enable MyriadX 2019-07-26 13:57:08 +03:00
Alexander Alekhin 2693ed9b22 Merge tag '3.4.7' 2019-07-25 19:19:49 +00:00
Alexander Alekhin 4a7ca5a291 OpenCV version++ (3.4.7)
OpenCV 3.4.7
2019-07-25 19:01:19 +00:00
Alexander Alekhin 7295983964 Merge pull request #15139 from alalek:openvino_2019R2 2019-07-25 18:59:56 +00:00
Alexander Alekhin 39a6889767 Merge pull request #15118 from dkurt:fix_15106 2019-07-25 18:56:32 +00:00
Chip Kerchner 0db4fb1835 Merge pull request #15136 from ChipKerchner:dotProd_unroll
* Unroll multiply and add instructions in dotProd_32f - 35% faster.

* Eliminate unnecessary v_reduce_sum instructions.
2019-07-25 21:21:32 +03:00
Alexander Alekhin ac425f67e4 Merge pull request #15150 from alalek:fix_15124_15125 2019-07-25 18:19:04 +00:00
Dmitry Kurtaev a2125594ea Fix false positives of face detection network for large faces 2019-07-25 20:09:59 +03:00
Alexander Alekhin 416c693b3f dnn(test): OpenVINO 2019R2 2019-07-25 19:01:16 +03:00
Alexander Alekhin 321c74ccd6 objdetect: validate feature rectangle on reading 2019-07-25 18:58:53 +03:00
Alexander Alekhin 6158bd2afa Merge pull request #15103 from alalek:simd_intrinsics_in_user_code 2019-07-25 11:36:36 +00:00
Alexander Alekhin d2911a8d41 dnn: use OpenVINO 2019R2 defines 2019-07-24 21:37:03 +00:00
Hugo Lindström 2ee00e7f7d Merge pull request #15059 from hugolm84:improved-support-for-wince
* Improve support for Windows Embedded Compact

* Remove redundant set(WINCE true) and format CMake
2019-07-24 23:12:09 +03:00
Alexander Alekhin ad092bf1ce Merge pull request #15107 from dkurt:js_features2d_drawings 2019-07-21 17:57:19 +00:00
Alexander Alekhin 557990fdcf Merge pull request #15104 from alalek:videoio_fix_debug_message 2019-07-21 17:56:41 +00:00
Dmitry Kurtaev a66a1a24d7 Fix drawKeypoints and drawMatches for JS 2019-07-20 23:47:26 +03:00
Alexander Alekhin 099f4f9e7c Merge pull request #15093 from tomoaki0705:fixCudaLegacyRansac 2019-07-20 08:07:14 +00:00
Alexander Alekhin 8bac8b513c core: support SIMD intrinsics in user code 2019-07-19 20:33:32 +00:00
Lubov Batanina 781f4d439e Merge pull request #15032 from l-bat:reduce_mean
* Added support for the ONNX "ReduceMean" Layer. (as this is the same as the GlobalAveragePool)

* Add ReduceMean test

* Fix ONNX importer

* Fix ReduceMean

* Add assert

* Split test

* Fix split test
2019-07-19 19:18:34 +03:00
Alexander Alekhin a8a71eb200 Merge pull request #15092 from alalek:videoio_gstreamer_more_get_checks 2019-07-19 15:50:54 +00:00
Alexander Alekhin 61f589ddd0 videoio(gstreamer): more .get() checks 2019-07-19 13:16:58 +03:00
Tomoaki Teshima c6de84d868 cudalegacy: fix test failure of SolvePnPRansac
* use SOLVE_EPNP for the initial guess
2019-07-19 17:50:00 +09:00
Alexander Alekhin 228af2d617 videoio: fix debug message 2019-07-18 21:45:07 +00:00
Alexander Alekhin 002904e445 Merge pull request #15050 from alalek:core_fix_base64_packed_struct 2019-07-18 19:07:06 +00:00
Vitaly Tuzov e0f8bb83a6 Merge pull request #14994 from terfendail:wintr_undistort
WUI based implementation to initUndistortRectifyMap (#14994)

* Add initUndistortRectifyMap performance test

* Move cv namespace boundaries

* Add wide universal intrinsics based implementation to initUndistortRectifyMap

* Dispatch undistort
2019-07-18 19:32:51 +03:00
Lubov Batanina 12fdaf895e Merge pull request #15057 from l-bat:fix_vizualizer
* Fix dumpToFile

* Add test

* Fix test
2019-07-18 18:41:08 +03:00
Alexander Alekhin c12e26ff28 Merge pull request #15071 from l-bat:tf_split 2019-07-18 08:12:42 +00:00
Liubov Batanina 0d2bc7b5fd Fix TF Split layer 2019-07-17 15:50:50 +03:00
Alexander Alekhin e4e0bb533d Merge pull request #15052 from alalek:dnn_fix_required_data 2019-07-16 16:00:33 +00:00
Alexander Alekhin f5e01f7b49 Merge pull request #15037 from hugolm84:noop-noexcept-for-vs13 2019-07-16 13:28:15 +00:00
Chip Kerchner c9fcc12e3b Merge pull request #15048 from ChipKerchner:reduceStoreGatheringThreshold
* Reduce store gathering pressures - speeds thresholds by up to 20%

* Rename temporary histogram array and initialize so that MACOSX builder is happy
2019-07-16 16:10:49 +03:00
Alexander Alekhin 4ea8526e9f core(persistence): fix writeRaw() / readRaw() struct support
- writeRaw(): support structs
- readRaw(): 'len' is buffer limit in bytes (documentation is fixed)
2019-07-16 14:03:39 +03:00
Alexander Alekhin 5ccb2a4cbd dnn(test): fix required data 2019-07-16 07:53:50 +00:00
Alexander Alekhin c3b838b738 core(persistence): struct storage layout without alignment gaps 2019-07-15 21:37:20 +00:00
Alexander Alekhin 054c796213 Merge pull request #15026 from terfendail:gaussian_fix 2019-07-12 18:31:09 +00:00
Hugo Lindström 245c256b1c Support compiliation for <=VS13 2019-07-12 19:02:36 +02:00
Alexander Alekhin 6aa07cdc7e Merge pull request #15025 from alalek:issue_14281 2019-07-12 15:28:44 +00:00
Vitaly Tuzov 894ad33bf4 Fix pixel value evaluation overflow in bit-exact GaussianBlur implementation 2019-07-12 18:11:51 +03:00
Lubov Batanina 34f6b05467 Merge pull request #14996 from l-bat:ocv_deconv3d
* Support Deconvolution3D on IE backend

* Add test tag

* Fix tests
2019-07-12 15:51:44 +03:00
Alexander Alekhin 32c6e58bdb imgproc: fix unaligned memory access
may cause crashes on ARM platform
2019-07-11 20:49:47 +00:00
Lubov Batanina 8bcd7e122a Merge pull request #14842 from l-bat:ocv_conv3d
* Support Conv3D on OCV backend

* Add header

* Add perf tests

* Support pool3d

* Enable Resnet34_kinetics on OCV backend

* Add test

* Fix conv

* Optimize Conv2D
2019-07-11 20:13:52 +03:00
Alexander Alekhin 3c086fb2fe Merge pull request #15001 from antmicro:v4l2-y10-support 2019-07-09 14:34:11 +00:00
Alexander Alekhin 32b6ebb670 Merge pull request #14989 from alalek:issue_14978 2019-07-09 14:14:06 +00:00
Tomasz Gorochowik 4997a6bf06 V4L2: Add V4L2_PIX_FMT_Y10 (10 bit grey) support 2019-07-09 14:36:00 +02:00
Alexander Alekhin 1e9e2aa95c Merge pull request #14811 from jxu:ubuntu-doc-fix 2019-07-08 16:47:19 +00:00
jxu b9399a5df8 Fix python setup in ubuntu dependencies 2019-07-07 15:15:31 -04:00
Alexander Alekhin eedbd1ad59 imgcodecs: force reshaping of imdecode() input into a single row
OpenCV upstream stuff may reinterpret vector as column.
2019-07-06 10:11:29 +00:00
Alexander Alekhin 7589225fc0 Merge pull request #14981 from alalek:android_camera_use_calc_frame_size_method 2019-07-06 08:20:20 +00:00
Alexander Alekhin 39a975cb29 Merge pull request #14983 from tomoaki0705:fixOclCvtColorMRGBA 2019-07-05 09:31:08 +00:00
Tomoaki Teshima 594a95839c fix test failure of OCL_ImgProc/CvtColor8u.mRGBA2RGBA 2019-07-05 11:22:22 +09:00
Alexander Alekhin 3998b41d68 android: JavaCamera2View use calculateCameraFrameSize() method
from CameraBridgeViewBase (common base with JavaCameraView)
2019-07-04 21:43:09 +00:00
Diego 57fae4a6a1 Merge pull request #14858 from dvd42:instancenorm_onnx
Instancenorm onnx (#14858)

* Onnx unsupported operation handling

* instance norm implementation

* Revert "Onnx unsupported operation handling"

* instance norm layer test

* onnx instancenorm layer
2019-07-04 21:15:04 +03:00
Alexander Alekhin 3200fe0e53 Merge pull request #14970 from terfendail:undistort_avx2_fix 2019-07-04 14:01:27 +00:00
Vitaly Tuzov 82e5b961d3 Fixed initUndistortRectifyMap AVX2 implementation 2019-07-04 15:49:33 +03:00
Alexander Alekhin e00b0f6f47 Merge pull request #14860 from vonchenplus:ocv_maxpoolgrad 2019-07-04 09:57:14 +03:00
Diego 6dfe2ddc21 Merge pull request #14959 from dvd42:onnx_clip
* onnx clip operation
2019-07-04 08:56:00 +03:00
Alexander Alekhin fee87c5fdb Merge pull request #14975 from alalek:clang_suppress_warnings 2019-07-03 22:33:26 +00:00
Alexander Alekhin 07fe1cd6b8 videoio: eliminate build warnings (clang) 2019-07-03 21:57:05 +00:00
Alexander Alekhin ac14cee71c Merge pull request #14974 from alalek:ts_optional_files_runtime_check 2019-07-03 19:14:43 +00:00
Alexander Alekhin f795878d1a Merge pull request #14973 from alalek:itt_aarch64_support 2019-07-03 19:13:57 +00:00
Alexander Alekhin bc95c609ff ts: runtime check for misused 'optional' test data files 2019-07-03 20:07:44 +03:00
Alexander Alekhin ca022fdb4c 3rdparty(itt): support AARCH64 2019-07-03 18:35:43 +03:00
gal0is 206b546e5a tensroflow support maxpoolgrad 2019-07-03 09:53:17 +08:00
Alexander Alekhin 2370079220 Merge pull request #14954 from rafagjordana:fix_blob_detection_insertion_sort 2019-07-02 21:14:02 +00:00
Alexander Alekhin 02936dcf86 Merge pull request #14926 from alalek:tbb_version_2019u8 2019-07-02 21:12:00 +00:00
Alexander Alekhin ff877af2af Merge pull request #14929 from alalek:cmake_rpath_link_support 2019-07-02 20:31:33 +00:00
Rafa Gomez-Jordana 9a24886282 Fix blob detector insertion sort 2019-07-02 19:54:27 +00:00
Alexander Alekhin 350532ea2c Merge pull request #14964 from arnaudbrejeon:bug_fix_14955 2019-07-02 19:50:47 +00:00
Alexander Alekhin 3b8701e97e Merge pull request #14963 from alalek:pr14925_fix 2019-07-02 19:43:09 +00:00
arnaudbrejeon a37201abee Fix crash, add assert and test 2019-07-02 09:56:31 -07:00
Alexander Alekhin e3e8a58799 Merge pull request #14958 from tomoaki0705:fixArmFp16Behavior 2019-07-02 16:40:21 +00:00
Alexander Alekhin 275579a835 Merge pull request #14925 from StefanBruens:handle_absolute_include_path 2019-07-02 16:05:53 +00:00
Tomoaki Teshima db6a6ccaba re-enable CPU_BASELINE=FP16 on Armv7 platform 2019-07-02 21:57:15 +09:00
Alexander Alekhin 69560588fe Merge pull request #14953 from alalek:core_static_analysis_eval_expr 2019-07-02 09:44:29 +00:00
armenpoghosov edf2cbd5f7 Merge pull request #14828 from armenpoghosov:parmen_RANSACPointSetRegistrator_getSubset_disaster_cleanup
Parmen ransac point set registrator get subset disaster cleanup (#14828)
2019-07-01 21:57:28 +03:00
Alexander Alekhin b00e19a8da Merge pull request #14837 from Cartucho:fix_laplace_operator_on_python 2019-07-01 17:00:25 +00:00
Alexander Alekhin 6dea8309c5 Merge pull request #14880 from dkurt:dnn_ie_tests 2019-07-01 16:58:57 +00:00
Vitaly Tuzov 9befb7a1d7 Merge pull request #14916 from terfendail:wsignmask_deprecated
* Avoid using v_signmask universal intrinsic and mark it as deprecated

* Renamed v_find_negative to v_scan_forward
2019-07-01 19:53:51 +03:00
Alexander Alekhin 44836c7f78 core: evaluate CV_Error() parameters during static scans 2019-07-01 18:17:03 +03:00
LaurentBerger 97681d0607 Add clip to deploy.prototxt 2019-06-30 18:39:05 +02:00
StefanBruens 3e4a195b61 Merge pull request #14936 from StefanBruens:crosscorr_cleanup
Crosscorr cleanup (#14936)

* Simplify code for convolution destination type/size

For the 2d filter code, destination size equals source size, and the
crossCorr function even (re-)creates the output matrix with the given size.

The number of channels also have to match. The destination type() is the
one used to create the output matrix, so we can use its type() here.

This is a preparatory patch.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>

* Remove redundant destination size and type parameters from crossCorr

All calling sites of crossCorr already use (...,
mat, mat.size(), mat.type(), ...), so the parameters are redundant.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2019-06-30 19:04:25 +03:00
Alexander Alekhin 915427621f Merge pull request #14934 from StefanBruens:silence_assignment_operator_warning 2019-06-30 07:47:07 +00:00
Stefan Brüns e9a2e665b2 Explicitly default operator= for Vec<T, n>
Due to the explicitly declared copy constructor Vec<T, n>::Vec(Vec <T,n>&)
GCC 9 warns if there is no assignment operator, as having one typically
requires the other (rule-of-three, constructor/desctructor/assginment).

As the values are just a plain array the default assignment operator does
the right thing. Tell the compiler explicitly to default it.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2019-06-29 22:11:00 +02:00
Alexander Alekhin 25d62cc929 Merge pull request #14931 from dkurt:fix_dnn_js_sample_v4 2019-06-29 17:26:31 +00:00
Alexander Alekhin 93ef27aeba Merge pull request #14920 from StefanBruens:fix_arm_on_aarch64_detection 2019-06-29 17:17:16 +00:00
Dmitry Kurtaev a04ab2298b Fix JS sample of dnn 2019-06-29 19:21:14 +03:00
Alexander Alekhin 43e457c883 3rdparty: TBB version 2018u1 => 2019u8
- make it configurable via OPENCV_TBB_RELEASE + OPENCV_TBB_RELEASE_MD5
- remove legacy support
2019-06-29 11:16:49 +00:00
Alexander Alekhin bc79f477dd cmake: support rpath-link linker option
- builds with CMAKE_SKIP_RPATH=ON should properly find project .so files from <build>/lib directory
- $ORIGIN doesn't work properly in cross-compilation mode
2019-06-29 11:03:45 +00:00
Alexander Alekhin e3aa96ccf2 cmake: normalize include directories in OpenCVConfig.cmake 2019-06-28 20:57:58 +00:00
Stefan Brüns 0a45b8c478 Handle absolute OPENCV_INCLUDE_INSTALL_PATH correctly
In case OPENCV_INCLUDE_INSTALL_PATH is absolute (i.e. starts with a "/"),
the path ends up with a double "/".

While this is mostly equivalent to a single slash, it may have a nasty
side effect when:
- OpenCV_INSTALL_PATH is empty
- OPENCV_INCLUDE_INSTALL_PATH is "/usr/include"
- the calling build script uses "-isystem" to specify the path to the
  headers of dependencies (to avoid warnings)

Specifying "-isystem /usr/include" breaks the path ordering, and GCC can
no longer find its "stdlib.h", thus CMake filters such statements.
Unfortunately it fails to do so when using "//usr/include".
2019-06-28 15:44:45 +02:00
Dmitry Kurtaev 75f4c1abf2 Enable some tests for Inference Engine backend 2019-06-28 15:52:31 +03:00
Stefan Brüns e10c01047c Fix detection of 32bit ARM builds on Aarch64
It is perfectly possible to compile ARM binaries on Aarch64. Generalize
the code to no only swap X86 with X86_64, but also ARM and AARCH64.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
2019-06-28 14:17:30 +02:00
Alexander Alekhin 8937e8756e Merge pull request #14918 from alalek:dnn_ie_compilation 2019-06-27 21:34:41 +00:00
Alexander Alekhin a743de0e24 dnn: adjust compilation options 2019-06-27 17:37:31 +03:00
Alexander Alekhin c531e275cc Merge pull request #14914 from Nuzhny007:3.4 2019-06-27 14:22:15 +00:00
Alexander Alekhin e59c6caee5 Merge pull request #14905 from savuor:fix/inst_region_unique 2019-06-27 10:16:59 +00:00
Alexander Alekhin 54fc60eb37 Merge pull request #14881 from dkurt:dnn_ie_num_threads 2019-06-27 10:14:24 +00:00
Nuzhny007 031e57b359 Fixed names conflict with dldt 2019-06-27 13:13:48 +03:00
Dmitry Kurtaev 96a2f80bf2 Limit number of threads in CPU plugin of IE by OpenCV's getNumThreads 2019-06-27 12:09:00 +03:00
Rostislav Vasilikhin f2f600f807 fixed multi instrumentations 2019-06-27 01:17:26 +03:00
Alexander Alekhin 24790e4061 Merge pull request #14899 from alalek:dnn_fix_bnll_layer
* dnn: fix BNLLLayer implementation

details: https://github.com/BVLC/caffe/blame/1.0/src/caffe/layers/bnll_layer.cpp#L17

* dnn: enable OCV/OpenCL BNLL layer
2019-06-26 23:04:26 +03:00
Alexander Alekhin c251915198 Merge pull request #14895 from alalek:dnn_ie_extensions_path 2019-06-26 20:03:57 +00:00
Alexander Alekhin 4112866821 Merge pull request #14886 from alalek:fix_grabcut_kmeans_call_14879 2019-06-26 20:03:04 +00:00
Apoorv Goel 5b521bb778 Merge pull request #14898 from UnderscoreAsterisk:flann-warnings-and-4376
Keep a local copy of `features` from `flann::GenericIndex ` constructor (#14898)

* Fix warnings on Windows

* Fix #4376
2019-06-26 19:35:11 +03:00
Alexander Alekhin 3cfd8cc1fe Merge pull request #14900 from opencv:dnn_fix_js_sample_v3 2019-06-26 15:54:46 +00:00
Dmitry Kurtaev 411ca87a86 Remove extra ")" 2019-06-26 17:27:56 +03:00
Alexander Alekhin 2172544bb7 Merge pull request #14890 from alalek:dnn_consistent_protobuf_readers 2019-06-26 14:13:03 +00:00
Alexander Alekhin df7049d465 Merge pull request #14889 from alalek:issue_14863 2019-06-26 14:10:14 +00:00
Alexander Alekhin 01a41d86bc Merge pull request #14775 from cudawarped:master 2019-06-26 13:35:21 +00:00
Alexander Alekhin 0a461e7922 Merge pull request #13252 from take1014:filter2d_13179 2019-06-26 13:34:10 +00:00
James Bowley daa308f81c Update obsolete flag in Intel video decoder.
Old flag resulted in software implementation being selected when the Intel decoder is not the primary adapter.
2019-06-26 12:32:20 +03:00
Alexander Alekhin 333e51b217 dnn: configure plugin path for InferenceEngine 2019-06-26 06:41:01 +00:00
Alexander Alekhin 8fd87033ef Merge pull request #14869 from alalek:samples_msvs2019_support 2019-06-25 22:07:02 +00:00
Alexander Alekhin 44d146af9a Merge pull request #14814 from alalek:dnn_skip_test_tags 2019-06-25 22:00:25 +00:00
Alexander Alekhin f3e9eb3371 dnn: both protobuf readers have similar behavior
- ReadProtoFromTextFile
- ReadProtoFromTextBuffer
2019-06-25 18:03:04 +03:00
Alexander Alekhin 63e4b35c19 Merge pull request #14849 from thangktran:thangktran/feature/fillPoly_and_fillConvexPoly_js_binding 2019-06-25 15:01:12 +00:00
Alexander Alekhin e8a703a71d core(intrin): v_load_low() workaround for aarch64+clang 2019-06-25 17:29:04 +03:00
Alexander Alekhin 9b9e04a061 Merge pull request #14875 from Legoless:master 2019-06-25 10:53:49 +00:00
Alexander Alekhin 4a6888ccf6 imgproc: fix kmeans() call from grabCut() 2019-06-25 13:42:04 +03:00
Dal Rupnik e755c66418 [#14873] Fix code signing issue in Try Compile script 2019-06-25 10:02:54 +02:00
Alexander Alekhin e8ff5cac1d Merge pull request #14876 from dkurt:fix_js_face_recognition_v2 2019-06-24 18:29:05 +00:00
Dmitry Kurtaev d17d3b66aa Fix face recognition JS sample 2019-06-24 16:41:37 +03:00
Feng Chen 5620306c70 Merge pull request #14845 from vonchenplus:ocv_mirrorpad
* tensorflow support mirror pad

* revert macro define

* revert macro define

* reduce code duplication

* revert macro define
2019-06-24 12:27:42 +03:00
tribta e8283f94ed Fix Python code, for the tutorial_laplace_operator, to get the same result between the Cpp, Java and Python 2019-06-23 18:03:01 +01:00
Alexander Alekhin 894f208de3 dnn(test): replace SkipTestException with tags 2019-06-23 13:12:23 +00:00
Alexander Alekhin f8c96cb18a Merge pull request #14847 from alalek:dnn_fix_test_data_searching 2019-06-23 12:42:27 +00:00
Alexander Alekhin e72f451173 Merge pull request #14305 from cameron-martin:calib3d-js 2019-06-22 16:43:40 +00:00
Alexander Alekhin 5c63be3c6e samples: support MSVS 2019 compiler
requires CMake 3.14+
2019-06-22 16:24:21 +00:00
Alexander Alekhin e21f89a16d Merge pull request #14864 from dkurt:fix_js_face_recognition 2019-06-22 07:15:02 +00:00
Lubov Batanina 16294437d5 Merge pull request #14833 from l-bat:ocv_eltwise3d
* Support Eltwise3d

* Refactoring

* Fix test
2019-06-22 10:13:28 +03:00
Dmitry Kurtaev d75a089690 Fix face recognition sample for JS 2019-06-21 21:53:52 -07:00
Alexander Alekhin 4b205680df Merge pull request #14855 from alalek:update_version_3.4.7-pre 2019-06-21 17:26:40 +03:00
Alexander Alekhin 779f59da6b pre: OpenCV 3.4.7 (version++) 2019-06-21 16:57:17 +03:00
Alexander Alekhin f5ddaef46b experimental version++ 2019-06-21 16:57:17 +03:00
Alexander Alekhin aa6c66aa54 Merge pull request #14848 from alalek:build_warnings_avx512 2019-06-21 13:53:52 +00:00
Alexander Alekhin 6b32bd5f15 Merge pull request #14834 from alalek:videoio_gstreamer_issues 2019-06-21 13:38:34 +00:00
Alexander Alekhin 31a22c27fe Merge pull request #14836 from alalek:static_analysis_issues_3.4 2019-06-21 10:26:09 +00:00
Cameron Martin 0ae053fdf8 js: Add findHomography js bindings.
Removed constants from legacy C api and switched out header with shorter version.

Removed blank line that was failing CI.
2019-06-21 13:13:53 +03:00
Alexander Alekhin d8c5bd92ae Merge pull request #14737 from Wenzhao-Xiang:master 2019-06-20 19:01:32 +00:00
Thang Tran 2a67375239 js: added fillPoly() and fillConvexPoly() 2019-06-20 19:56:23 +02:00
Alexander Alekhin 5ac55fc132 core: eliminate AVX512 build warnings
from MSVS2017 and GCC8 -O1 mode
2019-06-20 20:00:09 +03:00
Alexander Alekhin 13a782c039 test: fix usage of findDataFile()
misused 'optional' mode
2019-06-20 18:20:14 +03:00
Alexander Alekhin 8ab6efb8c0 videoio: refactor GStreamer backend
- exception safe smart pointers, fixed many memory leaks
- fixed errors handling
- fixed strings handling
- fixed file existence check
- fixed toFraction() implementation
- add 'drop=true' for v4l2 input
- avoid overriding custom pipelines sink's 'max-buffers' value
- updated valgrind supression rules
- added support for GStreamer native leaks tracking (via gst_deinit() call)
- repaired capturing through GStreamer0.10 (fixed CV_8UC1)
2019-06-20 17:48:18 +03:00
Alexander Alekhin ab24325df3 videoio(test): avoid raw ptr in ffmpeg tests
causes leaks if FFmpeg is disabled through OPENCV_VIDEOIO_PRIORITY_FFMPEG=0
2019-06-20 17:48:18 +03:00
Alexander Alekhin 681e0323f2 core: backport toLowerCase()/toUpperCase() 2019-06-20 17:48:18 +03:00
Alexander Alekhin baf372ad3d videoio(test): add extra videoio tests 2019-06-20 17:48:18 +03:00
Alexander Alekhin 95d9cfb5c3 static analysis issues 2019-06-20 13:55:20 +03:00
Alexander Alekhin 264679a725 Merge pull request #14816 from gal0is:gal0is-branch 2019-06-17 13:54:53 +00:00
gal0is bb7dc5f992 Solve the import issue in Python2. 2019-06-16 06:10:00 +08:00
Alexander Alekhin 1f519eea89 Merge pull request #14815 from alalek:valgrind_suppress_openexr_threadpool 2019-06-15 16:18:57 +00:00
Alexander Alekhin b8c080de12 valgrind: suppress OpenEXR ThreadPool 2019-06-15 14:38:37 +00:00
Alexander Alekhin b6e41ebf27 Merge pull request #14808 from alalek:issue_14807 2019-06-14 22:44:43 +00:00
Kang Yifei ba0ed79635 Merge pull request #14800 from FanaticsKang:add_undistortPoint_test
Test request by #14583 (#14800)

* add test to show the undistort bug

* move test to calib3d
2019-06-14 22:57:21 +03:00
Alexander Alekhin 8ca4252303 Merge pull request #14583 from FanaticsKang:fix_undistortPoint_bug 2019-06-14 18:30:26 +00:00
Alexander Alekhin b909df5531 Merge pull request #14747 from dkurt:fix_14683 2019-06-14 16:41:55 +00:00
Alexander Alekhin 3697ebef47 cmake: typo in hook name 2019-06-14 19:07:54 +03:00
Kang 549c53121a fix the bug, when k[4] is negative, icdist may be negative at the edge of image. 2019-06-14 19:00:36 +03:00
Dmitry Kurtaev dfdc91f8c9 dnn: fix MVN layer (issue 14683) 2019-06-14 18:38:05 +03:00
Dmitry Kurtaev eba696a41e Merge pull request #14792 from dkurt:dnn_ie_min_version_r5
* Remove Inference Engine 2018R3 and 2018R4

* Fix 2018R5
2019-06-14 18:17:02 +03:00
Alexander Alekhin 54a14c877c Merge pull request #14794 from terfendail:wui512_interleavenames 2019-06-14 14:20:34 +00:00
Alexander Alekhin fc0498b5bd Merge pull request #14790 from alalek:update_ffmpeg_3.4 2019-06-14 13:40:59 +00:00
Vitaly Tuzov a29e59a770 Rename parameters in AVX512 implementation of v_load_deinterleave and v_store_interleave 2019-06-14 14:16:30 +03:00
Alexander Alekhin f9eab2de5e Merge pull request #14673 from janstarzy:hidden-vis-with-java7 2019-06-13 17:59:39 +00:00
Jan Starzynski e9ed7eb68d make -fvisibility=hidden work with java 1.7 2019-06-13 17:39:10 +02:00
wenzhao 3f5c85e933 opencv.js: fix the loading issue of opencv.js(WASM) in face recognition 2019-06-13 11:26:27 +08:00
Alexander Alekhin 6aab6a251c ffmpeg: update 3.4.6
libvpx: 1.8.0
2019-06-12 16:54:47 +00:00
Alexander Alekhin 1c661e7548 Merge pull request #14784 from alalek:backport_14779 2019-06-11 20:36:16 +00:00
Alexander Alekhin a457fbdb58 Merge pull request #14783 from alalek:backport_14777 2019-06-11 20:12:01 +00:00
Vitaly Tuzov d2aadabc5e Merge pull request #14743 from terfendail:wui512_fixvswarn
Fix for MSVS2019 build warnings (#14743)

* AVX512 arch support for MSVS

* Fix for MSVS2019 build warnings: updated integral() AVX512 implementation

* Fix for MSVS2019 build warnings: reworked v_rotate_right AVX512 implementation

* fix indentation
2019-06-11 23:07:39 +03:00
Alexander Alekhin f8791f072d core: avoid function type cast, make happy UBSAN
backporting of commit: d3d13c41c4
2019-06-11 19:36:47 +00:00
Alexander Alekhin db7f689728 imgcodecs(tiff): add more checks
backporting of commit: f6230ae019
2019-06-11 19:22:24 +00:00
Alexander Alekhin b3e6c97d98 Merge pull request #14736 from mshabunin:minimal-python-3 2019-06-11 13:01:05 +00:00
Maksim Shabunin 10d61a2b44 Limited API support for Python3 2019-06-11 15:15:49 +03:00
Alexander Alekhin 878af7ada8 Merge pull request #14725 from alalek:update_openexr_2.3.0
3rdparty: update OpenEXR 2.3.0 (#14725)

* openexr 2.2.1

* openexr 2.3.0

* openexr: build fixes

* openexr: build dwa tables on-demand
2019-06-10 20:04:23 +03:00
Alexander Alekhin d2f9cfcf81 Merge pull request #14760 from ChipKerchner:3.4 2019-06-09 17:43:02 +00:00
Alexander Alekhin 52644f067e Merge pull request #14764 from alalek:core_intrin_drop_hasSIMD_checks 2019-06-09 17:11:45 +00:00
Alexander Alekhin 417ac94456 Merge pull request #14767 from alalek:imgcodecs_test_exr 2019-06-08 22:44:37 +00:00
Alexander Alekhin 02bfd20760 imgcodecs(test): add OpenEXR I/O test 2019-06-08 21:30:26 +00:00
Alexander Alekhin 6d916c5bb4 Merge pull request #14440 from alalek:async_array 2019-06-08 20:57:15 +00:00
Alexander Alekhin 1e9ad5476d core(intrin): drop hasSIMD128 checks
- use compile-time checks instead (`#if CV_SIMD128`)
- runtime checks are useless
2019-06-08 19:20:20 +00:00
Lubov Batanina 5e80191d27 Merge pull request #14697 from l-bat:Slice_ONNX
* Support Slice layer in ONNX importer

* Add IE support

* Fix ONNX importer

* Fix Slice
2019-06-08 16:52:40 +03:00
Chip Kerchner Chip.Kerchner@ibm.com 058367f34c Rewrite code in BGR2Gray functions so that auto vectorizer does a better job. 2019-06-07 11:48:05 -05:00
Alexander Alekhin 254f88f805 Merge pull request #14759 from alalek:java_gen_unicode 2019-06-07 16:02:12 +00:00
Alexander Alekhin 60fb1fde75 java: wrap StringIO() to support unicode strings 2019-06-07 17:05:58 +03:00
Alexander Alekhin 00367289bd Merge pull request #14754 from allnes:java_qr_code 2019-06-07 12:49:25 +00:00
Alexander Nesterov a9769b9202 Remove check and added binding tests 2019-06-07 14:53:40 +00:00
Alexander Alekhin 6d62be55b3 Merge pull request #14756 from mshabunin:fix-avx512-detection 2019-06-07 12:35:39 +00:00
Alexander Alekhin 002925466b Merge pull request #14717 from alalek:core_visibility_handling 2019-06-07 11:49:30 +00:00
Alexander Alekhin 8fae361768 Merge pull request #14750 from alalek:sample_fix_encoding 2019-06-07 11:12:28 +00:00
Maksim Shabunin 65919ed839 AVX 512 detection: workaround for older GCC 2019-06-07 13:58:09 +03:00
Alexander Alekhin cdee3d33b4 Merge pull request #14752 from SchultzC:3.4 2019-06-07 10:44:39 +00:00
Alexander Alekhin f5ca9d3fe1 python: visibility 2019-06-07 07:23:15 +00:00
Alexander Alekhin 4a8fd71a2e core: fix visibility handling 2019-06-07 07:23:15 +00:00
SchultzC 1e6e18ff05 Changed to integer division 2019-06-06 14:50:45 -07:00
Alexander Alekhin 5c05b7bc01 Merge pull request #14749 from alalek:fix_android_javadoc 2019-06-06 21:07:23 +00:00
Alexander Alekhin a51d46cbf9 samples: skip findFile() in encoding mode 2019-06-06 20:42:55 +00:00
Alexander Alekhin c6deba6003 android: fix javadoc 2019-06-06 20:22:42 +00:00
Alexander Alekhin 08019732e2 Merge pull request #14729 from arnaudbrejeon:bug_fix_14722 2019-06-06 19:44:06 +00:00
Alexander Alekhin aab9ef4290 Merge pull request #14667 from asashour:javadoc 2019-06-06 10:57:39 +00:00
utibenkei 03382d29cc Merge pull request #14693 from utibenkei:fix_java_simpleblobdetector
* java: fix java SimpleBlobDetector

* add SIMPLEBLOBFeatureDetectorTest

* add package org.opencv.test.features2d;

* fix SIMPLEBLOBFeatureDetectorTest
2019-06-06 13:05:41 +03:00
SchultzC 3833d86f0f Merge pull request #14733 from SchultzC:3.4
* cast positional arguments to int

* Changed to integer division based

* removed white space

* removed white space
2019-06-06 13:02:45 +03:00
Alexander Alekhin 94ec0e9b74 Merge pull request #14724 from asashour:typos 2019-06-06 10:01:03 +00:00
arnaudbrejeon e8e020ffb7 Add test 2019-06-05 09:15:18 -07:00
arnaudbrejeon e9b8571afc Fix bug 2019-06-05 09:15:04 -07:00
Alexander Alekhin 51631b90af Merge pull request #14726 from alalek:backport_14716 2019-06-05 15:54:46 +00:00
Alexander Alekhin a2445c44cb imgcodecs: sanitize PAM decoding
backporting of commit: 76fca0e755
2019-06-05 18:12:43 +03:00
Ahmed Ashour 5c56b8ce92 java: generated code to have javadoc 2019-06-05 12:44:03 +02:00
Ahmed Ashour 1aca1d582e Fix some typos 2019-06-05 12:24:13 +02:00
Lubov Batanina 3efd2df87f Merge pull request #14682 from l-bat:axpy_layer
* Add Axpy layer

* Fix test

* fix caffe importer
2019-06-05 00:18:06 +03:00
Ted Steiner f1fb002682 Merge pull request #14678 from tedsteiner:qnx
Fix build issue on QNX platform (#14678)

* QNX compatibility

* core: unify gettimeofday() usage
2019-06-04 19:45:21 +03:00
Alexander Alekhin d5a0d6783a Merge pull request #14710 from bommo1:bommo1-14265 2019-06-04 16:44:42 +00:00
Alexander Alekhin 5fde16ba90 Merge pull request #14712 from SchultzC:master 2019-06-04 16:43:45 +00:00
rasmus25 394bc91e07 Merge pull request #14718 from rasmus25:3.4
* Revert the bad parts of b085158d59 to fix https://github.com/opencv/opencv/issues/11131
but preserve the good parts to keep https://github.com/opencv/opencv/issues/10791 fixed

* calib3d: add regression test for stereoCalibrate to fix https://github.com/opencv/opencv/issues/11131
2019-06-04 18:43:42 +03:00
SchultzC edb3337ead Remove divide by 1000
because t = (time.time() - t) will return seconds,  dividing by 1000 to obtain seconds will be incorrect.
2019-06-04 08:17:37 -07:00
Alexander Alekhin fa96507fe7 Merge pull request #14719 from alalek:update_protobuf_3.5.2 2019-06-04 13:10:17 +00:00
Alexander Alekhin 1febb12942 3rdparty: apply protobuf v3.5.1..v3.5.2 patch
https://github.com/protocolbuffers/protobuf/compare/v3.5.1..v3.5.2
2019-06-04 12:57:34 +03:00
Alexander Alekhin 9802b4e123 Merge pull request #14707 from alalek:update_libwebp_1.0.2 2019-06-04 09:21:35 +00:00
Alexander Alekhin e1ef7a2288 Merge pull request #14705 from alalek:update_libjpeg_9c 2019-06-04 09:21:17 +00:00
Alexander Alekhin f768f89803 Merge pull request #14704 from alalek:fix_missing_files_libjpeg_turbo_2.0.2 2019-06-04 09:19:58 +00:00
Alexander Alekhin 1f75c67c56 Merge pull request #14701 from alalek:update_libpng_1.6.37 2019-06-04 09:19:26 +00:00
Alexander Alekhin f1b6228d4f 3rdparty(webp): enable -std=c99 2019-06-03 22:23:34 +00:00
Alexander Alekhin d58f9ae824 3rdparty: update libwebp 1.0.0 => 1.0.2
https://github.com/webmproject/libwebp/releases/tag/v1.0.2
2019-06-03 22:23:34 +00:00
bommo1 a38157a1f4 Fix https://github.com/opencv/opencv/issues/14265 2019-06-03 23:05:03 +02:00
Alexander Alekhin f355b3505f Merge pull request #14661 from dkurt:ie_deconv_adj 2019-06-03 16:58:17 +00:00
Vitaly Tuzov 3b015dfc7d Merge pull request #14210 from terfendail:wui_512
AVX512 wide universal intrinsics (#14210)

* Added implementation of 512-bit wide universal intrinsics(WIP)

* Added implementation of 512-bit wide universal intrinsics: implemented WUI vector types(WIP)

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented load/store

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented fp16 load/store

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented recombine and zip, implemented non-saturating and saturating arithmetics

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented bit operations

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented comparisons

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented lane shifts and reduction

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented absolute values

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented rounding and cast to float

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented LUT

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented type extension/narrowing and matrix operations

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented load_deinterleave for 2 and 3 channels images

* Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented load_deinterleave for 2- and implemented for 4-channel images

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented store_interleave

* Added implementation of 512-bit wide universal intrinsics(WIP): implemented signmask and checks

* Added implementation of 512-bit wide universal intrinsics(WIP): build fixes

* Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented popcount in case AVX512_BITALG is unavailable

* Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented zip

* Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented rotate for s8 and s16

* Added implementation of 512-bit wide universal intrinsics(WIP): reimplemented interleave/deinterleave for s8 and s16

* Added implementation of 512-bit wide universal intrinsics(WIP): updated v512_set macros

* Added implementation of 512-bit wide universal intrinsics(WIP): fix for GCC wrong _mm512_abs_pd definition

* Added implementation of 512-bit wide universal intrinsics(WIP): reworked v_zip to avoid AVX512_VBMI intrinsics

* Added implementation of 512-bit wide universal intrinsics(WIP): reworked v_invsqrt to avoid AVX512_ER intrinsics

* Added implementation of 512-bit wide universal intrinsics(WIP): reworked v_rotate, v_popcount and interleave/deinterleave for U8 to avoid AVX512_VBMI intrinsics

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed integral image SIMD part

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed warnings

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed load_deinterleave for u8 and u16

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed v_invsqrt accuracy for f64

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed interleave/deinterleave for u32 and u64

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed interleave_pairs, interleave_quads and pack_triplets

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed rotate_left

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed rotate_left/right, part 2

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed 512-wide universal intrinsics based resize

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed findContours by avoiding use of uint64 dependent 512-wide v_signmask()

* Added implementation of 512-bit wide universal intrinsics(WIP): fixed trailing whitespaces

* Added implementation of 512-bit wide universal intrinsics(WIP): reworked specific intrinsic sets dependent parts to check availability of intrinsics based on CPU feature group defines

* Added implementation of 512-bit wide universal intrinsics(WIP):Updated AVX512 implementation of v_popcount to avoid AVX512VPOPCNTDQ intrinsics if unavailable.

* Added implementation of 512-bit wide universal intrinsics(WIP): Fixed universal intrinsics data initialisation, v_mul_wrap, v_floor, v_ceil and v_signmask.

* Added implementation of 512-bit wide universal intrinsics(WIP): Removed hasSIMD512()

* Added implementation of 512-bit wide universal intrinsics(WIP): Fixes for gcc build

* Added implementation of 512-bit wide universal intrinsics(WIP): Reworked v_signmask, v_check_any() and v_check_all() implementation.
2019-06-03 18:05:35 +03:00
Alexander Alekhin 0ec72cbd10 3rdparty: update libjpeg 9c
https://www.ijg.org/
2019-06-03 16:21:02 +03:00
Alexander Alekhin 68e220e7bb 3rdparty: fix missing files from libjpeg-turbo 2.0.2 2019-06-03 15:42:51 +03:00
Alexander Alekhin 143b3d2b5b 3rdparty(libpng): re-apply OpenCV patches 2019-06-03 15:04:51 +03:00
Alexander Alekhin e96c94c4e4 3rdparty: update libpng 1.6.37
http://www.libpng.org/pub/png/libpng.html
https://github.com/glennrp/libpng/releases
2019-06-03 14:49:44 +03:00
Dmitry Kurtaev 9c0af1f675 Enable more deconvolution layer configurations with IE backend 2019-06-03 08:15:52 +03:00
Alexander Alekhin 3289a0aff9 Merge pull request #14687 from terfendail:wint_reducefix 2019-05-31 14:52:50 +00:00
Vitaly Tuzov 723165f878 fix for AVX2 version of v_reduce_min intrinsic 2019-05-31 16:14:54 +03:00
Alexander Alekhin 805ab6331f Merge pull request #14662 from dkurt:dnn_tf_fix_identity_switch 2019-05-30 20:22:17 +00:00
Alexander Alekhin 738435b1dd Merge pull request #14679 from alalek:cmake_update_option_enable_fast_math 2019-05-30 18:24:30 +00:00
Alexander Alekhin d8b42792a6 cmake: update ENABLE_FAST_MATH option 2019-05-30 19:44:35 +03:00
Lubov Batanina f94253b82b Merge pull request #14627 from l-bat:demo_kinetics
* Support 3D ResNet-34-kinetics

* Update sample

* Remove preprocess

* Change test

* Fix sample
2019-05-30 17:36:00 +03:00
Alexander Alekhin 8ea2f59d33 Merge pull request #14671 from alalek:dnn_test_fast_read 2019-05-30 06:48:34 +00:00
Alexander Alekhin d6d4571628 Merge pull request #14675 from alalek:backport_14664 2019-05-29 21:09:24 +00:00
Alexander Alekhin 43de95eb19 3rdparty(libpng): fix leak in png_handle_eXIf
backporting of commit: 419a6d51b3
2019-05-29 20:15:55 +00:00
mehlukas 0ecc2b8c17 Merge pull request #14674 from mehlukas:3.4-moveObjdetect
Merge two Haar Cascade tutorials (#14674)

* move haar cascade introduction, add code explanation, mark content as moved

* switch to ref for include to provide correct breadcrumb navigation
2019-05-29 23:13:27 +03:00
Alexander Alekhin 52548bde05 dnn(test): replace file content reading 2019-05-29 23:08:33 +03:00
Alexander Alekhin 29b3f66507 Merge pull request #14606 from asashour:java_inline_return 2019-05-29 20:03:54 +00:00
Dmitry Kurtaev 081d9bc73f Fix Identity Switch from Keras 2019-05-29 17:13:21 +03:00
Alexander Alekhin 0d477d7364 Merge pull request #14651 from alalek:dnn_test_update_debug_tags 2019-05-28 16:26:49 +00:00
Alexander Alekhin e0d88cb7a4 Merge pull request #14614 from mehlukas:3.4-movevideo 2019-05-28 16:22:56 +00:00
Alexander Alekhin 571dfa7605 Merge pull request #14652 from LaurentBerger:I14644 2019-05-28 11:11:27 +00:00
Ahmed Ashour ca8a1d2cff java: generated code inline return 2019-05-28 08:34:02 +02:00
Alexander Alekhin 38a3c1ce6b dnn(test): update test tags for Debug build 2019-05-27 20:12:30 +00:00
LaurentBerger a3be8d7cd7 dead link 2019-05-27 21:57:10 +02:00
Alexander Alekhin 483e9f341c Merge pull request #14626 from dkurt:dnn_ie_slice_layer 2019-05-27 16:27:14 +00:00
Alexander Alekhin aaf56c2839 Merge pull request #14649 from savuor:fix/luv_hls_read_oob 2019-05-27 16:24:55 +00:00
Alexey Nikolaev 05563f5bc4 Merge pull request #14592 from aleksey-nikolaev:master
VideoCapture Direct Show. Added getter for CV_CAP_PROP_CONVERT_RGB, CAP_PROP_CHANNEL properties. (#14592)

* Added getter for CV_CAP_PROP_CONVERT_RGB, CAP_PROP_CHANNEL properties.
Some refactoring.

* One space less.
2019-05-27 19:18:36 +03:00
Lubov Batanina 61d3222a22 Merge pull request #14537 from l-bat:fix_network_vizualizer
Fix dnn visualizer (#14537)

* Fixed print layer params

* Fix print
2019-05-27 19:17:07 +03:00
Alexander Alekhin a81c0e6db9 Merge pull request #14447 from catree:fix_issue_14423 2019-05-27 15:00:21 +00:00
Alexander Alekhin d73261844e Merge pull request #14622 from asashour:junit 2019-05-27 14:55:45 +00:00
Alexander Alekhin b07f951e6b Merge pull request #14591 from thangktran:thangktran/feature/floodFill-on-opencv.js 2019-05-27 14:54:46 +00:00
Alexander Alekhin 42484f3bcb Merge pull request #14647 from alalek:fix_coverity_issues 2019-05-27 14:32:02 +00:00
Alexander Alekhin d7c465d49e Merge pull request #14643 from mshabunin:fix-ie-status 2019-05-27 14:31:10 +00:00
Alexander Alekhin c5204a74c0 Merge pull request #14633 from alalek:java_test_filter 2019-05-27 14:13:25 +00:00
Alexander Alekhin 4a2544ff4b Merge pull request #14632 from alalek:java_test_debug 2019-05-27 14:13:10 +00:00
Alexander Alekhin c9b3e718db Merge pull request #14609 from janstarzy:tiff-orientation-fix 2019-05-27 13:39:51 +00:00
Dmitry Kurtaev 44d21e5a79 Enable Slice layer on Inference Engine backend 2019-05-27 16:28:01 +03:00
Rostislav Vasilikhin 8c698262ea rgb2hls_b: out of bounds read fixed 2019-05-27 16:19:52 +03:00
Alexander Alekhin 1094ed64e9 Merge pull request #14605 from terfendail:wsignmask_fixavx 2019-05-27 13:19:39 +00:00
Rostislav Vasilikhin 791ebd05fc out of bounds read fixed in rgb2luv_b 2019-05-27 16:19:01 +03:00
Alexander Alekhin 483f28723c calib3d: initialize local vars, fix indentation in for loops 2019-05-27 14:39:47 +03:00
Maksim Shabunin a550e50683 Fix IE status message on MacOS 2019-05-27 10:26:16 +03:00
Maksim Shabunin 472f3b7347 Fix TBB debug 2019-05-27 10:26:06 +03:00
utibenkei 898cf70210 Merge pull request #14597 from utibenkei:fix_java_missing_consts
* java: fix java missing_consts

* java: test Calib3d constants
2019-05-26 19:43:34 +03:00
Alexander Alekhin b958498074 java(test): test package filtering
Usage example:
- run.py -a -t java --package=calib3d
2019-05-26 15:12:05 +00:00
Alexander Alekhin 171dd9eff5 java(test): enable debug mode to show useful stacktraces 2019-05-26 14:54:44 +00:00
Rostislav Vasilikhin e07ffe902e Merge pull request #14616 from savuor:hsv_wide
HSV and HLS color conversions rewritten to wide intrinsics (#14616)

* RGB2HSV_b vectorized

* RGB2HSV_f: widen

* RGB2HSV_f: shorten, more intuitive

* HSV2RGB_f and HSV2RGB_b widen

* hls2rgb_f widen

* instrumentation instead vx_cleanup

* RGB2HLS_f widen

* RGB2HLS_b rewritten to wide universal intrinsics

* define guard against no SIMD code

* hls2rgb_b rewritten

* extra define removed

* warning fixed

* hls2rgb_b: performance fixed
2019-05-24 23:01:08 +03:00
Alexander Alekhin 9b130efbb3 Merge pull request #14623 from alalek:fix_14617 2019-05-24 19:57:54 +00:00
Alexander Alekhin 22701f0c27 imgcodecs(CAP_IMAGES): fix handling of input pattern 2019-05-24 22:13:25 +03:00
Vitaly Tuzov f0fb91f2d4 Fixed v_signmask implementation for AVX2, updated universal intrinsics tests. 2019-05-24 19:34:54 +03:00
Ahmed Ashour f9564e053d java: test: use assertNotNull and assertFalse 2019-05-24 10:45:09 +02:00
Lukas Mehl 2acc7c96e7 remove bgsgm tutorial, set references to OpenCV-Tutorials 2019-05-23 17:11:44 +02:00
Alexander Alekhin 1810702bf0 Merge pull request #14610 from mshabunin:fix-gtk-gl 2019-05-23 15:05:18 +00:00
Alexander Alekhin 96e2126ade Merge pull request #14602 from asashour:java_lang_ 2019-05-23 15:04:38 +00:00
Jan Starzynski fb9c083a51 handle all orientations properly 2019-05-23 16:51:25 +02:00
Maksim Shabunin dc28a1aba2 highgui: fixed build GTK2+OpenGL 2019-05-23 16:30:22 +03:00
Ahmed Ashour f3319f6140 java: remove redundant declaration of java.lang package 2019-05-23 14:06:34 +02:00
Alexander Alekhin def8fa2248 Merge pull request #14557 from mshabunin:win-lapack 2019-05-22 18:59:31 +00:00
Alexander Alekhin 2fd1a4eef7 Merge pull request #14520 from kupferb:patch-1 2019-05-22 18:16:48 +00:00
Maksim Shabunin fff7b7e459 LAPACK: add support for complex numbers for MSVC 2019-05-22 18:43:45 +03:00
catree 7ed858e38e Fix issue with solvePnPRansac and Nx3 1-channel input when the number of points is 5. Try to uniform the input shape of projectPoints and undistortPoints. 2019-05-22 14:19:16 +02:00
Alexander Alekhin f629cdfe2c Merge pull request #14459 from dkurt:tf_strided_slice 2019-05-22 11:30:34 +00:00
Dmitry Kurtaev 26e426adb1 StridedSlice from TensorFlow 2019-05-22 12:45:52 +03:00
Alexander Alekhin 190467b6c1 Merge pull request #14586 from dianlujitao:master 2019-05-21 18:30:02 +00:00
Thang Tran eb243847eb js: added floodFill function to JS binding
previously floodFill() is white-list without any implementation.
floodFill() is now fully functional in JS.
2019-05-21 14:19:50 +02:00
Alexander Alekhin a433394870 Merge pull request #14362 from catree:feat_ippe 2019-05-20 18:16:52 +00:00
Rostislav Vasilikhin e90e0ef9aa Merge pull request #14106 from savuor:lab_wide
Lab, Luv and XYZ conversions rewritten to wide intrinsics (#14106)

* rgb2xyz<float> re-vectorized

* rgb2xyz_i vectorized for ushort and uchar

* xyz2rgb<float> vectorized

* xyz2rgb_i vectorized for both uchar and ushort

* intermediate conversions (int->float) rewritten

* packed rgb2luv rewritten

* (some) float conversions rewritten

* burnt volatile int _3 and similar

* RGB2Lab_b rewritten

* tests: logging made better

* RGB2Lab_f (LRGB path) rewritten

* Lab2RGBfloat rewritten

* Lab2RGBinteger and Lab2RGB_b rewritten to wide universal intrinsics

* Luv2RGBinteger wide vectorized

* RGB2Lab_b fixed: v_sub_wrap instead of saturated sub

* warnings fixed

* trying to fix compilation on older compilers

* using 16x8 registers for 8-element dot product

* cleanup added

* splineInterpolate: loop unrolled, perf fix for f32x4

* Lab2RGBfloat: grab 2x more data to process on f32x4

* nrepeats for Luv2RGBfloat, +20% perf

* minor

* nrepeats to RGB2Lab_f

* Lab2RGBinteger: no tab for linear BGR

* nrepeats for RGB2Luvfloat

* Luv2RGBinteger: no tab for linear RGB

* +10% more to perf of Luv2RGBfloat

* nrepeats for 256-simd for Lab2RGBfloat

* less warnings

* BOM removed

* CV_SIMD_WIDTH used for lanes number checking

* trilinearPackedInterpolate: 128-bit specialization added

* fix build; no vx_cleanup(), instrumentation instead
2019-05-20 21:10:20 +03:00
Sergiu Deitsch bc4b2d521c Merge pull request #13337 from sergiud:eigen-cross-compile
* added support for Eigen cross-compilation

* cmake: fix Eigen detection
2019-05-20 21:05:42 +03:00
dianlujitao f0f50b757d Fix LogSoftmax for ONNX
Fix wrong indentation as well while at it
2019-05-20 22:55:31 +08:00
catree 33cb9c5ca5 Add SOLVEPNP_IPPE for planar pose estimation. Add solvePnPGeneric function that returns all the pose solutions and the reprojection errors. 2019-05-20 11:56:54 +02:00
Alexander Alekhin 132253c9f3 dnn: use AsyncArray 2019-05-18 19:32:23 +00:00
Alexander Alekhin 9340af1a8a core: Async API / AsyncArray 2019-05-18 19:32:23 +00:00
Alexander Alekhin 447116a93c Merge pull request #14524 from kohei-us:onnx-load-binary-blob 2019-05-18 16:19:34 +00:00
Alexander Alekhin d848594deb Merge pull request #14445 from l-bat:batchnorm3d 2019-05-17 17:03:53 +00:00
Alexander Alekhin dbc7faca46 Merge pull request #14574 from catree:fix_norm_type_typo 2019-05-17 04:19:05 +00:00
catree b5e2ec4ea4 Fix typo in NormTypes documentation. 2019-05-16 19:22:41 +02:00
Kohei Yoshida 7b4aefedea Add support for loading ONNX model from in-memory buffer. 2019-05-16 11:26:20 -04:00
Alexander Alekhin 30a595789c Merge pull request #14463 from thangktran:thangktran/fix-imgproc-intersectConvexConvex 2019-05-16 14:50:20 +00:00
Alexander Alekhin 6ca3c7f59f Merge pull request #14517 from FadyEssam:remove_redundant_imports 2019-05-16 11:03:44 +00:00
Alexander Alekhin 84fd8190f3 Merge pull request #14232 from terfendail:popcount_rework 2019-05-15 17:58:11 +00:00
Vitaly Tuzov 7a55f2af3b Updated AVX2 implementation of v_popcount for u8. 2019-05-15 19:39:25 +03:00
Alexander Alekhin 88996323b6 Merge pull request #14569 from alalek:fixup_14558 2019-05-15 16:21:31 +00:00
Alexander Alekhin 8b192b76c0 Merge pull request #14561 from alalek:fix_ctors_with_uninitialized_vars 2019-05-15 16:21:07 +00:00
Daniel Ingram 962d57b4d6 Merge pull request #14559 from daniel-s-ingram:master
* Fix typo: 'divisble' -> 'divisible'

* Fix typo: 'One of arguments' -> 'One of the arguments'
2019-05-15 18:41:43 +03:00
Alexander Alekhin 18151e79bb cmake(samples): use LINK_PRIVATE in target_link_libraries 2019-05-15 18:38:00 +03:00
Alexander Alekhin a70e1eecd9 Merge pull request #14552 from dkurt:fixed_detections_out_blob 2019-05-15 15:17:05 +00:00
Alexander Alekhin 3e876c5066 Merge pull request #14505 from alalek:android_fix_14477 2019-05-15 12:58:23 +00:00
mehlukas 6bff0e24f8 Merge pull request #14314 from mehlukas:3.4-opticalflow
Extend optical flow tutorial (#14314)

* extend python optical flow tutorial with cpp example code and add it to general tutorial directory

* remove unused parameters, fix comparison between signed and unsigned int

* fix hsv range problem

* switch to samples::findFile for sample file location

* switch to command line parameter for path

* remove old tutorial as in 14393

* minor fixes
2019-05-15 15:13:57 +03:00
mehlukas 47c45e5bd3 Merge pull request #14393 from mehlukas:3.4-meanshift
Extend meanshift tutorial (#14393)

* copy original tutorial and python code

* add cpp code, fix python code

* add camshift cpp code, fix bug in meanshift code

* add description to ToC page

* fix shadowing previous local declaration

* fix grammar: with -> within

* docs: remove content of old py_meanshift tutorial, add link

* docs: replace meanshift tutorial subpage in Python tutorials

* switch to ref to fix wrong breadcrumb navigation

* switch to cmdline for path as in #14314

* Apply suggestions from code review

* order programming languages alphabetically
2019-05-15 13:34:20 +03:00
Alexander Alekhin 8936a0f3a5 android: fix JavaCamera2View UV plane handling 2019-05-15 07:57:50 +00:00
Alexander Alekhin 68012bfbf9 calib3d: fix uninitialized fields in ctors 2019-05-14 19:15:13 +00:00
Alexander Alekhin 9fabc3406f Merge pull request #14558 from alalek:cmake_samples_threading_3.4 2019-05-14 19:02:23 +00:00
Alexander Alekhin e7338024f6 Merge pull request #14516 from dkurt:dnn_async_samples 2019-05-14 19:01:43 +00:00
Dmitry Kurtaev 63bb97cc19 Asynchronous C++ sample 2019-05-14 19:09:07 +03:00
Vitaly Tuzov 1220dd4877 Updated v_popcount description, reference implementation and test. 2019-05-14 18:59:40 +03:00
Vitaly Tuzov 96ab78dc4f Reworked v_popcount implementation to provide number of bits in a single lane 2019-05-14 18:59:38 +03:00
Alexander Alekhin 3201ea89d6 cmake: enable threading in samples
- moved code into separate file due issue with handling of CMake policies
2019-05-14 17:29:46 +03:00
Liubov Batanina dfa753c6b4 Support OCV backend 2019-05-14 16:44:57 +03:00
Dmitry Kurtaev 6389dfe49c Fixed DetectionOutput output blob shape 2019-05-14 15:09:32 +03:00
Liubov Batanina dadb1473c1 Add BatchNorm3d layer 2019-05-14 12:44:48 +03:00
Dmitry Kurtaev c3b0a68a2b Async mode for dnn's object detection sample 2019-05-14 09:58:47 +03:00
kupferb f024425dd0 Update haarfeatures.cpp
Detailed description for my proposal can be found here
https://github.com/opencv/opencv/issues/14128
2019-05-13 16:41:03 +03:00
Fady Essam 1b294c013a remove unnecessary imports in knn tutorials 2019-05-09 00:01:57 +02:00
Alexander Alekhin b998c06d08 Merge pull request #14501 from LaurentBerger:MatchLayer_text_graph_ssd 2019-05-07 15:49:54 +00:00
Alexander Alekhin 5ba8aa781c Merge pull request #14460 from dkurt:dnn_tf_no_extra_clone 2019-05-07 14:48:50 +00:00
Alexander Alekhin 455323ed58 Merge pull request #14500 from mshabunin:backport-avfoundation 2019-05-07 14:44:33 +00:00
Alexander Alekhin eb161942de Merge pull request #14486 from alalek:cmake_dispatch_all 2019-05-07 14:25:02 +00:00
LaurentBerger fa8e301c69 extends regex matching for conv group of layers 2019-05-07 16:17:25 +02:00
Alexander Alekhin 55c02ff628 Merge pull request #14491 from mshabunin:add-clang-hardening 2019-05-07 14:13:07 +00:00
Maksim Shabunin 9a81ff7315 Backported AVFoundation fixes from master branch 2019-05-07 13:57:44 +03:00
Maksim Shabunin 5acfa524cb Added support for Clang build hardening (including Apple) 2019-05-07 13:00:43 +03:00
Alexander Alekhin 94c7d99d0d Merge pull request #14489 from dkurt:fix_14464 2019-05-06 19:16:26 +00:00
Dmitry Kurtaev 471b83ccd5 Modify paddings computation for SAME pad mode 2019-05-06 10:49:10 +03:00
Alexander Alekhin 7bb8d89ef3 Merge pull request #14484 from dkurt:dnn_ie_fix_async_u8 2019-05-05 11:51:54 +00:00
Alexander Alekhin 6b6222bfbb cmake: support CPU_DISPATCH=ALL, fix misused CPU_DISPATCH
- CPU_DISPATCH_FINAL should be used for filtering
2019-05-05 11:24:21 +00:00
Sayed Adel 5a77f4cee3 Merge pull request #14007 from seiko2plus:core_avx512_infa
* core: improve AVX512 infrastructure by adding more CPU features groups

* cmake: use groups for AVX512 optimization flags

* core: remove gap in CPU flags enumeration

* cmake: restore default CPU_DISPATCH
2019-05-05 14:19:49 +03:00
Dmitry Kurtaev adc1ef9308 Fix uint8 input data for Async mode of dnn 2019-05-05 12:49:38 +03:00
Alexander Alekhin fc57129300 Merge pull request #14431 from catree:feat_solvePnPRefine 2019-05-02 20:44:58 +00:00
Alexander Alekhin b7ca3d77a6 Merge pull request #14465 from unrandomness:master 2019-05-01 22:00:02 +00:00
seungju ceff82877d fix a typo in md file
fix a typo in ml_intro.md, tress -> trees
2019-05-01 14:05:33 +02:00
Thang Tran 1aff378ae8 imgproc: fixed bug from intersectConvexConvex
Added checks for all of vertices from each contour instead of checking
only for the first vertex.
2019-05-01 11:06:30 +02:00
Alexander Alekhin 163d5e4d39 Merge pull request #14368 from dkurt:dnn_ie_tests 2019-04-30 19:35:00 +00:00
Alexander Alekhin bc9893799d Merge pull request #14457 from alalek:dnn_fix_msvc_build 2019-04-30 16:49:33 +00:00
Alexander Alekhin 1c092a181d Merge pull request #14454 from dkurt:dnn_tf_subgraph_fusion 2019-04-30 16:24:32 +00:00
Dmitry Kurtaev a6ed8f268a Remove extra weights cloning from TensorFlow importer 2019-04-30 19:18:41 +03:00
Alexander Alekhin ddfaa41f07 Merge pull request #14452 from alalek:issue_14432 2019-04-30 16:15:46 +00:00
Lubov Batanina 77fa59c3da Merge pull request #14301 from l-bat:conv3d
Support Convolution3D layer on IE backend (#14301)

* Add Convolution3D layer

* Disable CXX11

* Fixed tests

* Add Pooling3D layer

* Merge Conv2d with Conv3d and Pool2d with Pool3d layers

* Split pads

* Add Deconvolution layer

* Refactoring

* Deduplication

* Refactoring

* Add utils for Convolution and Pooling layers
2019-04-30 17:08:17 +03:00
Alexander Alekhin 3bcbd2a078 Merge pull request #14451 from alalek:fix_perf_calibation 2019-04-30 14:01:13 +00:00
Alexander Alekhin 85ea37ac01 Merge pull request #14450 from alalek:ts_hide_zero_memory_message 2019-04-30 14:00:36 +00:00
catree dac31e84fb Add solvePnPRefineLM to refine a pose according to a Levenberg-Marquardt iterative minimization process. Add solvePnPRefineVVS to refine a pose using a virtual visual servoing scheme. 2019-04-30 14:31:11 +02:00
Alexander Alekhin 138a80611c build: avoid MSVC ICE 2019-04-30 14:16:01 +03:00
Alexander Alekhin 2da00161c5 Merge pull request #14446 from mshabunin:old-v4l 2019-04-30 10:41:33 +00:00
Dmitry Kurtaev 9408c3e640 Refactored TensorFlow subgraphs fusion 2019-04-30 09:21:05 +03:00
Alexander Alekhin 1c180f4c7f imgproc: fix RemoveOverlaps() with empty input vector 2019-04-29 21:15:23 +00:00
Alexander Alekhin cd4926778e ts: fix perf calibation
properly handle "check" mode with:
"--perf_min_samples=1 --perf_force_samples=1"
2019-04-29 19:10:38 +00:00
Alexander Alekhin 38c0278be3 ts: silence zero memory usage messages 2019-04-29 18:28:54 +00:00
Alexander Alekhin ffd4a27901 Merge pull request #14443 from dkurt:fix_14435 2019-04-29 18:21:22 +00:00
Maksim Shabunin 683acd9ae2 Support very old V4L 2019-04-29 18:14:58 +03:00
ostarling 643d9df42d Merge pull request #14411 from ostarling:3.4_fix_for_14242
* Fix for Homogenous precision #14242:
 - moved scale computation to an inline function
 - use std::numeric_limits<float>::epsilon() instead of != 0.0

* Fix for Homogenous precision #14242:
 - fixed warnings for type conversion

* Fix for Homogenous precision #14242:
 - use float epsilon() for truncation of doubles
2019-04-29 17:12:04 +03:00
Alexander Alekhin 84847cf4c3 Merge pull request #14342 from Victorlouisdg:bugfix-JavaCamera2View-green 2019-04-29 10:54:34 +00:00
Dmitry Kurtaev 61b928d9bd Add an assertion for Async request status 2019-04-29 08:16:28 +03:00
Alexander Alekhin e8a626d43a Merge pull request #14407 from dkurt:dnn_ie_fix_batch_detection 2019-04-27 21:48:56 +00:00
Alexander Alekhin 025f679dbc Merge pull request #14434 from seiko2plus:vsx_fix_reduce_sad 2019-04-27 18:01:29 +00:00
Sayed Adel afb157df67 core:vsx fix sum of v_reduce_sad 2019-04-27 02:01:24 +02:00
Alexander Alekhin 82be2d6210 Merge pull request #14430 from alalek:cmake_fix_include_pkgconfig_3.4 2019-04-26 20:18:59 +00:00
Alexander Alekhin b95fdc1992 Merge pull request #14394 from alalek:build_support_memory_sanitizers 2019-04-26 16:13:52 +00:00
Alexander Alekhin d17699363c Merge pull request #14385 from terfendail:intrin_sad 2019-04-26 15:34:02 +00:00
Alexander Alekhin 90c34c5c17 cmake: fix pkg-config handling
backporting commit c9f3f4d1d3
2019-04-26 18:25:47 +03:00
Alexander Alekhin 0023d8a106 Merge pull request #14410 from adamrankin:master 2019-04-25 18:45:14 +00:00
Dmitry Kurtaev 4f6be11c0e Check if Inference Engine networks are fully supported by backend 2019-04-25 11:27:17 +03:00
Adam Rankin a164a131f9 BUG: Qt5 components not correctly detected if only Qt5_DIR is provided, when this is supported by Qt CMake system.
Fixed by updating Qt5 find_package call to use modern CMake syntax
2019-04-24 15:46:30 -04:00
Alexander Alekhin 0431ecb9e2 Merge pull request #14408 from l-bat:onnx_deconv 2019-04-24 14:30:09 +00:00
Vitaly Tuzov 18d10d6b86 Fixed v_reduce_sad intrinsics implementation and added tests 2019-04-24 14:53:59 +03:00
Alexander Alekhin cd879bedb4 Merge pull request #14406 from thangktran:thangktran/java-wrapper-for-find4QuadCornerSubpix 2019-04-24 11:44:05 +00:00
Liubov Batanina 45ced8e022 Fix ONNX deconvolution 2019-04-24 14:37:52 +03:00
Dmitry Kurtaev 520e351489 Fix batching in DetectionOutput layer 2019-04-24 12:08:49 +03:00
Thang Tran 2f7fc1a598 calib3d: add find4QuadCornerSubpix java wrapper
Fixes: https://github.com/opencv/opencv/issues/14169
2019-04-24 08:45:28 +02:00
Sheel-Patel ec39f0dc9e Merge pull request #14122 from Sheel-Patel:patch-1
Grammatical errors for help() in detect_mser.cpp (#14122)

* Grammatical errors for help() statement

Corrected spelling of "synthetic" and added grammatical clarification for keys to press to change view or use mouse.

* Adjustment of superfluous spaces
2019-04-24 01:45:27 +03:00
Alexander Alekhin e98222dfb3 Merge pull request #14260 from allanrodriguez:sample-digits-cpp 2019-04-23 22:38:07 +00:00
Alexander Alekhin 3b3347857f Merge pull request #14395 from alalek:ts_catch_missing_files 2019-04-23 14:46:05 +00:00
Alexander Alekhin 7d2190a5d4 ts: +ENV{OPENCV_TEST_REQUIRE_DATA}
similar to '--test_require_data' parameter
2019-04-22 21:42:06 +00:00
Alexander Alekhin c1981f28ad build: +OPENCV_ENABLE_MEMORY_SANITIZER flag 2019-04-22 21:35:25 +00:00
Alexander Alekhin 8eb685de9d Merge pull request #14390 from dkurt:dnn_onnx_const_reshape 2019-04-22 15:55:19 +00:00
Alexander Alekhin 9bfaf4fe40 Merge pull request #14389 from alalek:cmake_fix_pch_build_with_vtk 2019-04-22 15:54:08 +00:00
Alexander Alekhin de4be8e610 Merge pull request #14384 from terfendail:fp16_depint 2019-04-22 15:52:53 +00:00
Alexander Alekhin 0bbd28e0d4 Merge pull request #14382 from alalek:backport_14373 2019-04-22 15:52:10 +00:00
Alexander Alekhin 8fac166b66 Merge pull request #14379 from sturkmen72:upd_GeneralizedHough 2019-04-22 15:51:47 +00:00
masa-iwm 5c404bb142 Merge pull request #14376 from masa-iwm:3.4
* fix getting platformIDs in initializeContextFromD3D11Device
2019-04-22 18:50:31 +03:00
Dmitry Kurtaev 9b635830bc Run Reshape layer for const input from ONNX models 2019-04-22 17:57:46 +03:00
Alexander Alekhin 319e891d7d cmake: guard macro definitions in PCH scripts
fixes build with VTK
2019-04-22 17:43:32 +03:00
Vitaly Tuzov 4a54aa3fbd Cleared up deprecated intrinsics for FP16 2019-04-22 10:35:37 +03:00
Suleyman TURKMEN 3f9343e238 Update imgproc.hpp 2019-04-22 00:48:11 +03:00
Alexander Alekhin f7856a0f35 imgcodecs(tiff): update tile size checks
backporting of commit: 25247b9f6e
2019-04-21 18:36:39 +00:00
Alexander Alekhin 5c0a98cfb6 Merge pull request #14369 from ManthanKeim:patch-1 2019-04-20 19:30:54 +00:00
Manthan Keim 269c28e69e Update py_svm_opencv.markdown
Fixes a broken link for histograms of Oriented Gradients.
2019-04-20 18:52:13 +00:00
Dmitry Kurtaev a5c92c2029 Merge pull request #13694 from dkurt:dnn_ie_async
Asynchronous API from Intel's Inference Engine (#13694)

* Add forwardAsync for asynchronous mode from Intel's Inference Engine

* Python test for forwardAsync

* Replace Future_Mat to AsyncMat

* Shadow AsyncMat

* Isolate InferRequest callback

* Manage exceptions in Async API of IE
2019-04-19 21:01:19 +03:00
Alexander Alekhin 3abae3c511 Merge pull request #14366 from alalek:win32_fix_pdb 2019-04-19 12:42:16 +00:00
Alexander Alekhin 2e4d771005 cmake: fix PDB handling 2019-04-19 14:53:35 +03:00
Alexander Alekhin 4f764b812e Merge pull request #14315 from dkurt:tf_squeeze_and_slim_softmax_v2 2019-04-18 16:01:24 +00:00
Alexander Alekhin f7b6e30156 Merge pull request #14354 from alalek:workaround_apple_dyld_bug 2019-04-17 19:09:15 +00:00
Alexander Alekhin 9dccfe2a96 Merge pull request #13917 from sturkmen72:removed_c_api 2019-04-17 19:04:33 +00:00
Alexander Alekhin 2b84039a16 Merge pull request #14313 from alalek:cmake_pch_fix_defines_from_interface_targets 2019-04-17 19:02:28 +00:00
Alexander Alekhin 96610c7ee1 Merge pull request #14332 from LaurentBerger:loadknearest 2019-04-17 19:00:42 +00:00
Alexander Alekhin 52f16e0f55 tests: workaround for DYLD_LIBRARY_PATH on Apple MacOSX 2019-04-17 15:19:33 +03:00
Alexander Alekhin dedd966002 Merge pull request #14345 from dkurt:fix_dnn_ie_mac 2019-04-16 19:18:49 +00:00
Alexander Alekhin 6d3ae8d4ca Merge pull request #14341 from alalek:cmake_fix_pkgconfig_libs 2019-04-16 19:04:07 +00:00
Alexander Alekhin c667de9b68 dnn: force visibility(default) for IE headers 2019-04-16 18:18:31 +03:00
LaurentBerger 621e3eaed8 Add Ptr KNearest::load and python binding 2019-04-16 16:32:37 +02:00
Alexander Alekhin 3ef046b6c9 Merge pull request #14338 from alalek:fix_13849 2019-04-16 13:42:27 +00:00
Alexander Alekhin 74d5cdb6d8 Merge pull request #14343 from alalek:dnn_static_scans_namespace 2019-04-16 13:11:23 +00:00
Alexander Alekhin ebe13a9613 Merge pull request #14337 from alalek:ts_flush_stdout 2019-04-16 13:08:40 +00:00
Alexander Alekhin 7c1d9fea8b Merge pull request #14308 from m000:master 2019-04-16 11:58:21 +00:00
Alexander Alekhin 59e4f85898 Merge pull request #14347 from dkurt:dnn_samples 2019-04-16 11:50:46 +00:00
Dmitry Kurtaev a304069687 Remove preprocessing parameters from README 2019-04-16 13:29:33 +03:00
Dmitry Kurtaev 62d079fa69 Fix Normalize layer for Mac 2019-04-16 12:39:04 +03:00
Alexander Alekhin 3902694075 static scans: preserve namespace name 2019-04-16 06:49:47 +00:00
vdgussem 00861b668a Changed the way Images are converted into rgba Mats so that JavaCamera2View also shows correct colors when the Image contains I420 or YV12 data 2019-04-16 01:38:59 +02:00
Alexander Alekhin 0d747daf47 cmake: use absolute library paths from 'pkgconfig'
- drop legacy check_module() macro
- drop 'ALIASOF_'
2019-04-15 22:11:49 +00:00
Alexander Alekhin 78384d8923 build: avoid highgui dependency 2019-04-15 18:59:51 +00:00
Alexander Alekhin c9a76ede94 Merge pull request #14328 from lainy:3.4 2019-04-15 11:03:37 +00:00
lain 246733382f Fix OpenCVConfig.cmake for Arch Linux. 2019-04-14 12:22:57 -07:00
Alexander Alekhin d1387b25eb Merge pull request #14318 from dkurt:fix_ie_github 2019-04-14 17:33:11 +00:00
Allan Rodriguez 86561fef90 Added C++ version of digits.py. 2019-04-13 22:29:30 -07:00
Alexander Alekhin 64fd1c95a5 ts: flush stdout/stderr before test launch 2019-04-13 21:08:06 +00:00
Manolis Stamatogiannakis ef16e4203e Fix compile error with external TBB and -DBUILD_SHARED_LIBS=OFF.
Adds IMPORTED for the TBB::tbb alias target as otherwise cmake produces
the following error:

CMake Error: install(EXPORT "OpenCVModules" ...) includes target "opencv_core" which requires target "tbb" that is not in the export set.

This problem occurs with the defaults used by homebrew on macOS, which
compiles both static and shared versions of TBB and OpenCV.
2019-04-13 21:53:04 +02:00
Dmitry Kurtaev 92cbec6fb1 Fix dnn with IE from GitHub 2019-04-13 19:02:03 +03:00
Dmitry Kurtaev 0cfd95c097 Fix TensorFlow's Squeeze and a new fusion for SoftMax from slim backend 2019-04-13 17:04:31 +03:00
Nick Yang 169dc9c311 Merge pull request #14297 from shxuy:patch-1
fix just a typo of the word 'word' (#14297)
2019-04-12 19:32:08 +03:00
Lubov Batanina 60a841c797 Merge pull request #14255 from l-bat:networks_visualization
* Add networks visualization

* Disable CXX11

* Fixed multy inputs support

* Added output shapes

* Added color for DLIE/CPU

* Fixed graph colors
2019-04-12 19:31:07 +03:00
michal-kowalczyk a246d8d8e9 Merge pull request #13709 from michal-kowalczyk:flush-processed-samples-number
* Add flushing to printing number of processed positive/negative samples so that user is informed of updates quickly.

* use flush C api instead of C++ api
2019-04-12 18:51:35 +03:00
Alexander Alekhin 64629cb94e Merge pull request #12783 from alalek:test_tag 2019-04-12 15:35:41 +00:00
Alexander Alekhin 9515137cb2 cmake: fix PCH generation
process defines from INTERFACE targets
2019-04-12 17:39:02 +03:00
Alexander Alekhin 5f500692f1 Merge pull request #14284 from dkurt:fix_14236 2019-04-12 13:05:38 +00:00
Alexander Alekhin 227ec19929 Merge pull request #14277 from dkurt:ie_enable_tests_2019r1 2019-04-12 13:05:19 +00:00
Dmitry Kurtaev a2bbfa1db5 Enable some tests for Inference Engine 2019R1 2019-04-12 15:21:42 +03:00
Alexander Alekhin a9ddf12187 Merge pull request #14078 from alalek:test_python_from_modules 2019-04-12 11:39:12 +00:00
Alexander Alekhin 39630e076a Merge pull request #14294 from alalek:issue_14286
cmake: fix WITH_OPENCL_D3D11_NV check
2019-04-11 17:50:15 +03:00
Alexander Alekhin 7621b91769 Merge pull request #14292 from alalek:issue_14291
* macosx: fix C++11 build

backporting commit c3cf35ab63

* macosx: eliminate build warning
2019-04-11 17:46:28 +03:00
kiwixz c8056b3e27 Merge pull request #14276 from kiwixz:pr/fix_compound
Do not use compound literals (fix MSVC C4576) (#14276)

* do not use compound literals (compat cpp98)

* only fix msvc path

* remove unnecessary cplusplus check
2019-04-11 17:44:28 +03:00
Alexander Alekhin a0a1fb5fec python: discover tests from module/misc/python/test paths 2019-04-10 18:35:35 +00:00
Dmitry Kurtaev 7ce2397b62 Fix a bug in FusedBatchNorm (TensorFlow) layer importer 2019-04-09 13:35:34 +03:00
Alexander Alekhin e0841f3d6e dnn(test-tags): add time / memory tags 2019-04-08 19:18:25 +00:00
Alexander Alekhin b38de57f9a ts: test tags for flexible/reliable tests filtering
- added functionality to collect memory usage of OpenCL sybsystem
- memory usage of fastMalloc() (disabled by default):
  * It is not accurate sometimes - external memory profiler is required.
- specify common `CV_TEST_TAG_` macros
- added applyTestTag() function
- write memory usage / enabled tags into Google Tests output file (.xml)
2019-04-08 19:12:49 +00:00
Alexander Alekhin dad2247b56 Merge tag '3.4.6' 2019-04-07 11:02:40 +00:00
Alexander Alekhin 33b765d797 OpenCV version++ (3.4.6)
OpenCV 3.4.6
2019-04-06 21:43:23 +00:00
Alexander Alekhin 4368f04afa Merge pull request #14271 from alalek:issue_14259 2019-04-06 21:37:10 +00:00
Alexander Alekhin b5961cc5d1 calib3d: don't change input data
- estimateAffine2D/estimateAffinePartial2D() calls
2019-04-06 19:28:41 +00:00
Alexander Alekhin 28925572f6 Merge pull request #14268 from alalek:fix_ossfuzz_13283 2019-04-05 18:56:19 +00:00
Alexander Alekhin 0c490accae imgcodecs(tiff): check TIFF tile size
oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13280
oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13283
2019-04-05 18:13:15 +03:00
Alexander Alekhin 1b5a9c9718 Merge pull request #14256 from alalek:fix_docs_links_3.4 2019-04-05 12:45:50 +00:00
Alexander Alekhin bd43e4f28b Merge pull request #14251 from dkurt:dnn_tf_manage_switch 2019-04-05 12:43:22 +00:00
Dmitry Kurtaev ec41a4897a Remove Switch and Merge nodes from TensorFlow networks 2019-04-05 12:32:35 +03:00
Alexander Alekhin 1fb93b62c0 Merge pull request #14249 from alalek:imgcodecs_tiff_update_3.4 2019-04-04 16:17:09 +00:00
Alexander Alekhin d38869eb76 docs: fix links
- replace tutorial links via docs.opencv.org
- remove link on OpenCV 2.4
- avoid links on outdated packages
2019-04-04 18:57:22 +03:00
mehlukas ab21dc6d47 Merge pull request #14245 from mehlukas:3.4-fixtutorial
* improve thresholding tutorial, fix grammar issues and incorrections

* keep full list of simple thresholding types
2019-04-04 17:44:03 +03:00
BALACHANDAR S aa167434e6 Merge pull request #14252 from balachandarsv:master-mac-openvino-support
* Mac support for op inference engine

Adding condition to check for mac and add corresponding libraries

* Adding mac support in test cases
2019-04-04 17:37:45 +03:00
Alexander Alekhin ba5ddd6499 imgcodecs(tiff): sanitize tiff decoder
- more checks
- drop separate branches for 32FC1/32FC3(read) handling
- added for 32F/64F non-compressed
- added tests for 32FC3 (RAW + hdr SGILOG compression)
- added test 64FC1
- dump tiff errors on stderr
2019-04-04 14:16:53 +03:00
Alexander Alekhin d8b8c3b145 Merge pull request #14233 from alalek:cmake_fix_license_install 2019-04-03 19:30:47 +00:00
Alexander Alekhin ba6c2df15d Merge pull request #14229 from alalek:ffmpeg_downloader_elevated_run 2019-04-03 19:29:28 +00:00
Alexander Alekhin c300070b8a Merge pull request #14241 from alalek:openvino_2019R1 2019-04-03 19:26:46 +00:00
103yiran 4bb6edf176 Merge pull request #14117 from 103yiran:103yiran-patch-dnn
* Postpone variable definitions

* dnn: reduce scope of 'Mat image' variable
2019-04-03 22:13:11 +03:00
Alexander Alekhin cafa010389 dnn(test): skip tests 2019-04-03 17:49:05 +03:00
Alexander Alekhin 8bc8a94645 dnn: update DNNTestOpenVINO.models tests
- models are moved out from OpenVINO package
- need to download them separatelly
2019-04-03 15:39:47 +03:00
Alexander Alekhin 8483801eab dnn: use OpenVINO 2019R1 defines 2019-04-03 15:39:47 +03:00
Alexander Alekhin d4a96b699e Merge pull request #14234 from alalek:backport_14203 2019-04-02 16:34:41 +00:00
Alexander Alekhin 4fa4bef41d cmake: fix licenses install rules 2019-04-02 19:24:14 +03:00
Alexander Alekhin c4ec46c195 imgcodecs(sunras): avoid undefined shift
backporting of commit: f2803aba07
2019-04-02 18:38:01 +03:00
Alexander Alekhin 69ff7a76d6 Merge pull request #14228 from dkurt:conv_1x1 2019-04-02 14:35:50 +00:00
Alexander Alekhin 3ca6a72457 Merge pull request #14222 from alalek:cmake_remove_test_include_dirs 2019-04-02 14:34:36 +00:00
Alexander Alekhin 7d2118e324 Merge pull request #14223 from alalek:backport_14201 2019-04-02 14:33:57 +00:00
Alexander Alekhin 97548b01c7 FFmpeg: try to download wrapper with elevated privileges 2019-04-02 16:40:11 +03:00
Dmitry Kurtaev e3286c9055 Enable 1x1 convolution optimization 2019-04-02 14:05:17 +03:00
Alexander Alekhin df1f62b34c Merge pull request #14225 from zuoshaobo:my3.4 2019-04-02 09:57:26 +00:00
Alexander Alekhin 2f288f94e5 Merge pull request #14227 from dkurt:fix_build_with_ie 2019-04-02 09:38:05 +00:00
Alexander Alekhin 2a2d195240 cmake: don't add tests dirs as include directories
- use relative paths for includes
- fix PCH generation with GCC (dummy file has been used)
2019-04-02 12:28:25 +03:00
Dmitry Kurtaev 07655c2b4d Fix build with IE > 2018R5 2019-04-02 11:54:50 +03:00
zuoshaobo a34c02a001 add support for tf.add_n operation 2019-04-02 03:20:53 -04:00
Alexander Alekhin 341e2fa72d Merge pull request #14214 from alalek:backport_14202 2019-04-01 14:39:25 +00:00
Alexander Alekhin 21f0146402 Merge pull request #14212 from dkurt:reduce_ie_models_tests 2019-04-01 14:38:07 +00:00
Alexander Alekhin 45169577ca Merge pull request #14207 from alalek:fix_leak_eigenvalue_decomposition 2019-04-01 14:17:37 +00:00
Alexander Alekhin 2ece029fe0 imgcodecs(tiff): avoid leak of helper struct on malformed inputs
backporting of commit: 45428b897f
2019-04-01 14:08:40 +00:00
Alexander Alekhin 06193f28ef Merge pull request #14194 from alalek:backport_14193 2019-04-01 14:03:13 +00:00
Dmitry Kurtaev 144b1f4d9d Reduce number of tested models from OpenVINO 2019-04-01 15:15:00 +03:00
Alexander Alekhin bda90dae77 Merge pull request #14200 from alalek:fix_imgcodecs_stream_set_pos 2019-04-01 11:04:20 +00:00
Alexander Alekhin 1e583942b9 core(lda): don't perform calculations in constructor
- exceptions from constructor will not cause destructor calls
2019-03-31 21:48:44 +00:00
Alexander Alekhin 6894651027 Merge pull request #14198 from alalek:issue_14195 2019-03-31 12:56:57 +00:00
Alexander Alekhin 6dfb6a3016 imgcodecs: fix RBaseStream::setPos() outside of current block
Seeking outside of the current block doesn't update actual data,
so getByte()/etc will get wrong data from stalled buffer.
2019-03-31 12:55:32 +00:00
Alexander Alekhin 4b91dfd215 Merge pull request #14199 from devnexen:openbsd_build_fix 2019-03-31 11:14:42 +00:00
Alexander Alekhin ccb89a889a imgcodecs(bmp): limit size of processed images
2Gb+ images can't be handled properly by current implementation

backporting of commit: 50a6f9d251
2019-03-31 10:52:33 +00:00
David Carlier 06a4c20f60 OpenBSD build fix
required for close calls.
2019-03-31 10:54:47 +01:00
Alexander Alekhin fcb07c64f3 cmake: fix build of dnn tests with shared common code
- don't share .cpp files (PCH support is broken)
2019-03-31 08:52:25 +00:00
Alexander Alekhin 6316b3ed91 Merge pull request #14196 from seiko2plus:issue14195 2019-03-31 08:18:55 +00:00
Sayed Adel de22442046 dnn:perf add missing definition __OPENCV_TEST to fix pch 2019-03-31 03:28:33 +02:00
Alexander Alekhin 10ce935823 3rdparty(zlib): prevent uninitialized use of state->check
backporting of commit: 8afb2f0cb7
2019-03-30 20:26:49 +00:00
Lubov Batanina 7d3d6bc4e2 Merge pull request #13932 from l-bat:MyriadX_master_dldt
* Fix precision in tests for MyriadX

* Fix ONNX tests

* Add output range in ONNX tests

* Skip tests on Myriad OpenVINO 2018R5

* Add detect MyriadX

* Add detect MyriadX on OpenVINO R5

* Skip tests on Myriad next version of OpenVINO

* dnn(ie): VPU type from environment variable

* dnn(test): validate VPU type

* dnn(test): update DLIE test skip conditions
2019-03-29 16:42:58 +03:00
George Wilson 982e6fc721 Merge pull request #14154 from GeorgeWilson96:bugfix/14148
* Fixed #14148 Broken Documentation Link

* fixup: use 3.4 branch
2019-03-28 22:31:38 +03:00
Alexander Alekhin 3cd6e3b304 Merge pull request #14166 from dkurt:fix_slim_mobilenet_v2 2019-03-28 14:37:35 +00:00
Alexander Alekhin 1fb8dcb0de Merge pull request #14170 from alalek:cmake_hide_helper_modules 2019-03-28 14:25:27 +00:00
Alexander Alekhin 428ff431df Merge pull request #14168 from alalek:dnn_fix_drop_IE_2018R2 2019-03-28 14:23:39 +00:00
Alexander Alekhin 8ce7d9a4d1 cmake: hide helper modules
- bindings generators
- keep "ts" module
2019-03-27 21:43:25 +00:00
Alexander Alekhin e8c20bfae6 dnn: fix support drop for IE<2018R3
- fix build with IE 2018R3
2019-03-27 20:36:48 +00:00
Alexander Alekhin d6b82dcd65 Merge pull request #14162 from alalek:eliminate_coverity_scan_issues
core: eliminate coverity scan issues (#14162)

* core(hal): avoid using of r,g,b,a parameters in interleave/deinterleave

- static analysis tools blame on possible parameters reordering
- align AVX parameters with corresponding SSE/NEO/VSX/cpp code

* core: avoid "i,j" parameters in Matx methods

- static analysis tools blame on possible parameters reordering

* core: resolve coverity scan issues
2019-03-27 15:48:00 +03:00
Alexander Alekhin 5368a4ac41 Merge pull request #14102 from alalek:core_refactor_eigenvalues 2019-03-27 12:46:51 +00:00
Dmitry Kurtaev 9cfd219d70 Fix Mobilenet v2 from TensorFlow slim 2019-03-27 15:10:57 +03:00
Alexander Alekhin 9340fc0c50 Merge pull request #14146 from alalek:cmake_cmp0068 2019-03-26 17:16:59 +00:00
Alexander Alekhin f738e490a3 Merge pull request #13989 from kohei-us:onnx-conv-transpose-output-shape 2019-03-26 17:04:52 +00:00
Alexander Alekhin 55366caecd Merge pull request #14155 from alalek:fix_macos_ocl_warnings_3.4 2019-03-26 15:34:49 +00:00
Kohei Yoshida 212420516f Add a test case for handling output_shape property for deconvolution layer. 2019-03-26 10:46:17 -04:00
Kohei Yoshida 3bcff7f941 Make use of explicit output shape for the de-convolution layer.
This is relevant to cases where the net is loaded from an ONNX model
containing ConvTranspose layers, which may include the output_shape
attribute.

c.f. https://github.com/onnx/onnx/blob/master/docs/Operators.md#ConvTranspose
2019-03-26 10:46:09 -04:00
Alexander Alekhin 6686559c70 ocl: define CL_SILENCE_DEPRECATION on MacOSX 2019-03-26 13:11:53 +03:00
Alexander Alekhin cedd78d526 Merge pull request #14142 from mshabunin:fix-c-api-3.4 2019-03-25 18:58:28 +00:00
Alexander Alekhin c443a3d657 cmake: set CMP0068 => NEW 2019-03-25 19:25:51 +03:00
Alexander Alekhin 5f88bbe3d5 Merge pull request #14141 from dkurt:dnn_ie_relax_lrn 2019-03-25 13:45:26 +00:00
Maksim Shabunin 41da3ef1d2 Fixed cvdef.h for MSVC C users 2019-03-25 16:44:08 +03:00
Dmitry Kurtaev 714b38360f Extend LRN layer support with IE backend 2019-03-25 12:53:34 +03:00
iPanda 097fc1a271 Merge pull request #13972 from Mainvooid:add_cuda_support_for_D3D11_interop
* Add CUDA support for D3D11 interop. #13888

color_detail.hpp: fixed build error : dynamic initialization is not supported for a __constant__ variable.
directx.cpp: Add CUDA support(cl_nv_d3d11_sharing) for D3D11 interop.  #13888

Update directx.cpp

Format adjustment.

Update directx.cpp

fix error.

Update directx.cpp

Format adjustment

Update directx.cpp

fix trailing whitespace.

fix format errors

convert indentation to spaces .
Trim trailing whitespace.
Add information about source of cl_d3d11_ext.h
Avoid unrelated changes.

Increase compile-time conditional judgment.

Increase the judgment of whether the OCL device has the required extensions at compile time.

Add compilation option  `HAVE_CLNVEXT`.Check CL support in runtime.

Check result of `clGetExtensionFunctionAddressForPlatform` for KHR is invalid.It always can get the address(from OpenCL.dll),So I check NV support(from nvopencl64.dll) before KHR when `HAVE_CLNVEXT` is enabled.

Delete cl_d3d11_ext.h

Modified parameter list

fix "cannot open include file: 'CL/cl_d3d11_ext.h'"

 remove not referenced var

fix C2143: syntax error

Improve compile-time judgment.

dlrectx.cpp Modify the detection order.
initializeContextFromD3D11Device:
```
    // try with NV(Need to check it first)
    // try with KHR
```

fix warnig C4100

Revert "fix warnig C4100"

This reverts commit 76e5becb67780071d0cbde61cc4f5f807ad7c5ac.

fix warning C4100

fix warning C4505

Format alignment

Format adjustment and automatically detect header files.

Automatically detect header files when users are not configured or configuration errors occur.

avoid unrelated changes.

Update .cmake

Update .cmake

* fix build errors

* fix warning:defined but not used

* Revert "fix warning:defined but not used"

This reverts commit 7ab3537cd0.

* fix warning:defined but not used

* fix build error for mac

* fix build error for win

* optimizing branch judgment

* Revert "optimizing branch judgment"

This reverts commit 88b72b870e.

* fix warning C4702: unreachable code

* remove unused code

* Fix problems that may lead to undefined behavior

* Add status check

* fix error C2664,C2665 : cannot convert argument

* Format adjustment

VSCODE will automatically format the indentation to 4 spaces in some situation.

* fix error C2440

* fix error C2440

* add cl_d3d11_ext.h

* Format adjustment

* remove unnecessary checks
2019-03-24 18:34:09 +03:00
Alexander Alekhin 2bd0844be3 Merge pull request #14126 from brad-kelly:integral_avx512_cn1 2019-03-23 12:09:46 +00:00
Brad Kelly 0fe17eeb68 Implementing AVX512 Support for 1 channel mats for CV_64F format 2019-03-22 09:44:23 -07:00
Alexander Alekhin b82ecaf48c Merge pull request #14125 from alalek:cmake_ie_env_vars 2019-03-22 15:10:25 +00:00
Alexander Alekhin 65fc863d86 cmake: support OpenVINO env variable: INTEL_OPENVINO_DIR 2019-03-22 00:03:03 +03:00
Pedro Ferreira da Costa 9cef78b685 Merge pull request #14109 from PedroFerreiradaCosta:adding_python_version_to_anisotropic_tutorial
* Created python version of the code for the anisotropic image segmentation tutorial. Created python/cpp toggles for the markdown file.

* fix doxygen warnings
2019-03-21 22:53:12 +03:00
Alexander Alekhin 865bd7abff Merge pull request #14121 from seiko2plus:cmake_vsx_fix_aligned_test 2019-03-21 13:25:39 +00:00
Alexander Alekhin 49f43b03b1 Merge pull request #14108 from alalek:fix_python_samples_3.4 2019-03-21 13:22:55 +00:00
Alexander Alekhin 58835eeb78 Merge pull request #14113 from Bharat123rox:calibration 2019-03-21 09:55:31 +00:00
Sayed Adel 0df607e5dd cmake:vsx Fix compilation fail on aligned runtime test when c++11 enabled 2019-03-21 11:21:00 +02:00
Bharat123Rox ea68f7ea1e Remove dead link in calib3d.hpp 2019-03-21 07:41:32 +05:30
Alexander Alekhin e09a464242 Merge pull request #14092 from mattismyname:fix-kmeans 2019-03-20 16:20:46 +00:00
Alexander Alekhin 4e60db9030 Merge pull request #14110 from seiko2plus:core_vsx_fp16 2019-03-20 16:04:20 +00:00
Matthew K. Gumbel 74e3403620 flann/kmeans: Fix non-determinism of KMeans index
When running with >1 OpenCV thread, KMeans index generation was
non-deterministic because of a RWW race. Issue is resolved by removing
the offending logic from the parallel section.
2019-03-20 08:44:31 -07:00
Alexander Alekhin a8e635f177 Merge pull request #14069 from terfendail:transform_wintr 2019-03-20 15:39:40 +00:00
Alexander Alekhin 04fad57fc1 samples: fix python samples compatibility with demo.py 2019-03-20 18:32:34 +03:00
Sayed Adel f41359688b core:vsx Add support for VSX3 half precision conversions 2019-03-20 10:19:42 +02:00
Alexander Alekhin 6c862fae13 Merge pull request #14099 from seiko2plus:vsx_improvements_3 2019-03-19 14:59:58 +00:00
Alexander Alekhin ce1432e42d Merge pull request #14103 from alalek:fixup_test_14089 2019-03-19 14:19:00 +00:00
Alexander Alekhin 93a402d0f2 core: fix Core_EigenNonSymmetric.convergence test 2019-03-19 15:18:43 +03:00
Alexander Alekhin f4c2c4412b Merge pull request #14089 from alalek:fix_14088 2019-03-19 10:33:03 +00:00
Sayed Adel 4fe2d9bdbc core:vsx Several improvements(3)
* optimize v_lut_deinterleave
 * optimize v_interleave_/pairs/quads/triplets
 * optimize v_lut, use vec_extract instead of aligned store
2019-03-19 12:30:50 +02:00
Vitaly Tuzov d43597c199 transform() implementation updated to utilize wide universal intrinsics 2019-03-18 20:33:19 +03:00
Alexander Alekhin 5451b89aed core: refactor EigenvalueDecomposition (hqr2)
- fix resource allocation management
- reduce variables scope
- fix complex_div
- fix comments, constants
- simplify add/sub operations
2019-03-18 19:07:34 +03:00
Alexander Alekhin fdf6323942 Merge pull request #14026 from Palmitoxico:android-ndk 2019-03-18 15:40:03 +00:00
Augusto Fraga Giachero 032e458085 Avoid unexpected line breaks in version_string.inc
The Android NDK 16b has a bug that sets the ANDROID_NDK_REVISION
variable incorrectly, generating an unexpected line break in the
middle of the string. This breaks the build as the generated
version_string.inc presents an invalid C string.

Remove leading and trailing line breaks, warns for line breaks in the
middle of 'msg' and escape them before appending to
OPENCV_BUILD_INFO_STR.
2019-03-18 11:57:05 -03:00
Alexander Alekhin a7c4ee9ae1 core: add iterations limit check in eigenNonSymmetric() 2019-03-18 17:49:17 +03:00
Alexander Alekhin ec25689b42 Merge pull request #14083 from PedroFerreiradaCosta:adding_quick_navigation_between_tutorials 2019-03-18 13:13:40 +00:00
Pedro Ferreira da Costa 4fac12c8d3 adding missing quick navigation to ImageProc module 2019-03-18 09:45:41 +00:00
Alexander Alekhin cae1859324 Merge pull request #14079 from npochhi:cmake_change 2019-03-16 16:54:11 +00:00
npochhi 352f4fead6 changes cmake_system_name matching condition 2019-03-16 20:24:06 +05:30
Alexander Alekhin 2c3f02c83f Merge pull request #14071 from alalek:cmake_remove_unreferenced_functions 2019-03-15 17:50:19 +00:00
Alexander Alekhin 19e8121a38 Merge pull request #14059 from alalek:imgcodecs_disable_jasper 2019-03-15 16:32:57 +00:00
Alexander Alekhin 69fd8964a2 Merge pull request #14057 from alalek:fix_libtiff_build 2019-03-15 16:31:38 +00:00
Alexander Alekhin ccbc16f3a9 cmake: clean unreferenced functions from OpenCV modules too 2019-03-15 18:54:08 +03:00
Alexander Alekhin ec469b5530 Merge pull request #14070 from zuoshaobo:my3.4 2019-03-15 13:11:31 +00:00
zuoshaobo 8b52eabd48 fix the region layer's output anchor size normalization error 2019-03-15 08:41:11 -04:00
Alexander Alekhin d4b9e2d0f4 Merge pull request #14068 from alalek:fix_python_standalone_build 2019-03-15 11:33:08 +00:00
Alexander Alekhin 470dfba96c python: update CMake install rules 2019-03-15 13:11:00 +03:00
Alexander Alekhin 43c68d1864 imgcodecs: OPENCV_IO_ENABLE_JASPER runtime parameter 2019-03-14 21:43:24 +00:00
Alexander Alekhin 40dd96e83a 3rdparty: fix libtiff build
Keep `_FILE_OFFSET_BITS` undefined in Android builds.
2019-03-14 19:35:02 +00:00
Alexander Alekhin 73bf170800 Merge pull request #14050 from npochhi:mlp_ann_eps_change 2019-03-14 13:36:57 +00:00
Alexander Alekhin 990afa9032 Merge pull request #14054 from mshabunin:fix-dc1394 2019-03-14 13:04:56 +00:00
Alexander Alekhin c03a936cfc Merge pull request #14040 from seiko2plus:issue13211 2019-03-14 13:04:35 +00:00
Maksim Shabunin e4a4f93b72 Removed obsolete functions from cap_dc1394_v2.cpp 2019-03-14 12:08:16 +03:00
npochhi f1a99995c4 Changed eps checking condition 2019-03-14 14:01:34 +05:30
Sayed Adel 872e7894b4 core:vsx working around gcc aligned memory access bug
- allow cmake to check sanity of vsx aligned ld/st
 - force universal intrinsics v_load_aligned/v_store_aligned
   to failback to unaligned ld/st if cmake runtime vsx aligned test fail
2019-03-14 01:55:40 +02:00
Alexander Alekhin de8eda5fdf Merge pull request #13655 from sturkmen72:update_doc_photo 2019-03-13 17:57:17 +00:00
Richard Veale 8158e5b7a0 Merge pull request #13695 from flyingfalling:3.4
* Fixed bug that made cuda::filter give corrupted output when different filters called in different threads. This was due to use of global texture variable shared by all filters.

* REV: fixed tab issue for opencv coding style...
2019-03-13 20:53:59 +03:00
Alexander Alekhin f4b6ae46d1 Merge pull request #14045 from rpici:fix_bug_in_test_tiff 2019-03-13 16:17:43 +00:00
Alexander Alekhin cdf6e460e8 Merge pull request #14021 from dkurt:init_opencv_wasm 2019-03-13 16:09:21 +00:00
Alexander Alekhin be1ae9d4a6 Merge pull request #14046 from alalek:fix_static_analysis_issues_3.4 2019-03-13 16:03:21 +00:00
rpici 9cca066ee8 Fix bug in test_tiff.cpp
The big endian data in the tiff_sample_data array was never being tested.  This could be observed by e.g. changing the 9th byte in the big endian data from 0xde to something that should fail the test, e.g. 0xdd, and the test would still pass even though it should fail.
2019-03-13 09:42:47 -05:00
Alexander Alekhin 8c8715c4dd fix static analysis issues 2019-03-13 17:19:39 +03:00
Alexander Alekhin 915c3fd7fa Merge pull request #14041 from nglee:dev_cudaarithmLUTPtr 2019-03-13 14:15:48 +00:00
Namgoo Lee a54affeb8d Move Ptr-related code from lut.cu to lut.cpp 2019-03-13 20:25:28 +09:00
Dmitry Kurtaev 18ab85efc2 Backport commits from
https://github.com/opencv/opencv/pull/12601
https://github.com/opencv/opencv/pull/12622
2019-03-13 13:32:44 +03:00
take1014 e0b664f390 fix dftFilter2D 2019-03-13 00:27:56 +09:00
Alexander Alekhin bd1342c164 Merge pull request #14029 from LaurentBerger:creategrid 2019-03-12 14:46:15 +00:00
Alexander Alekhin ea9a17ebc2 Merge pull request #14036 from jveitchmichaelis:Y16_v4l_fix 2019-03-12 14:38:37 +00:00
Alexander Alekhin 61eb1a6848 Merge pull request #14038 from alalek:update_version_3.4.6-pre 2019-03-12 12:43:02 +00:00
Josh Veitch-Michaelis 2143f7cee1 release frame after disabling convert rgb 2019-03-12 12:42:07 +00:00
Alexander Alekhin 80e5642ca2 pre: OpenCV 3.4.6 (version++) 2019-03-12 13:29:42 +03:00
LaurentBerger af0a83f0b3 Tutorial create pattern grid for calibration using gen_pattern.py 2019-03-12 08:29:17 +01:00
Alexander Alekhin f3074fd559 Merge pull request #14013 from alalek:imgproc_dispatch_filter 2019-03-11 18:59:30 +00:00
Alexander Alekhin 2c07c6718f imgproc: dispatch morph 2019-03-11 13:54:12 +00:00
Alexander Alekhin 5a01227aa1 imgproc: dispatch box_filter 2019-03-11 13:54:12 +00:00
Alexander Alekhin ce3c92eb1f imgproc: dispatch bilateral_filter 2019-03-11 13:54:12 +00:00
Alexander Alekhin b99c9145bf imgproc: dispatch smooth 2019-03-11 13:54:12 +00:00
Alexander Alekhin 6ec08f268f imgproc: dispatch medianBlur 2019-03-11 13:54:12 +00:00
Alexander Alekhin 8546ac3ce6 imgproc: get rid of filter.avx2.cpp 2019-03-11 13:54:12 +00:00
Alexander Alekhin 9a8dbfd57f imgproc: dispatch filter.cpp 2019-03-11 13:54:12 +00:00
Alexander Alekhin 756a98a395 imgproc: keep history of filters files 2019-03-11 13:54:07 +00:00
Alexander Alekhin 9dc7554089 imgproc: copy .dispatch.cpp 2019-03-11 13:53:59 +00:00
Alexander Alekhin 6eac8f78b9 imgproc: copy .simd.hpp 2019-03-11 13:53:59 +00:00
Alexander Alekhin 98e2bb8721 Merge pull request #14022 from alalek:core_fix_neon_intrinsics 2019-03-11 13:52:43 +00:00
Alexander Alekhin 842c58a7d6 core(intrin): NEON v_load_expand_q() support unaligned addr 2019-03-11 12:06:05 +00:00
Alexander Alekhin 7a2dca5947 Merge pull request #14015 from saskatchewancatch:issue-13921 2019-03-11 10:08:06 +00:00
Dmitry Kurtaev 110e80f0ee Add onRuntimeInitialized for opencv.js 2019-03-11 11:44:16 +03:00
Giles Payne 11dbd86aa3 Merge pull request #13956 from komakai:java-mat-class-improvements
* Expose more C++ functionality in the Java wrapper of the Mat class
In particular expose methods for handling Mat with more than 2 dimensions
* add constructors taking an array of dimension sizes
* add constructor taking an existing Mat and an array of Ranges
* add override of the create method taking an array of dimension sizes
* add overrides of the ones and zeros methods taking an array of dimension sizes
* add override of the submat method taking an array of ranges
* add overrides of put and get taking arrays of indices
* add wrapper for copySize method
* fix crash in the JNI wrapper of the reshape(int cn, int[] newshape) method
* add test for each method added to Mat.java

* Fix broken test
2019-03-10 00:11:04 +03:00
Rajkiran Natarajan 40af53b1d6 issue-13921: Support setting compression setting for writing tiff images 2019-03-09 15:48:21 -05:00
Alexander Alekhin 7e8cc580c9 Merge pull request #13997 from alalek:imgproc_dispatch_cvtcolor 2019-03-08 16:18:44 +00:00
Adrian Renner 442fdfd4b2 Merge pull request #13999 from addyi:fixAndroidLintingErrors
* fix android lint error in BaseLoaderCallback (LongLogTag)

Lint Error that was causde by the to long TAG:
BaseLoaderCallback.java:31:
Error: The logging tag can be at most 23 characters,
was 31 (OpenCVLoader/BaseLoaderCallback) [LongLogTag]
Log.e(TAG, "Package installation failed!");

* add requested "OCV" prefix for android logging
2019-03-07 23:18:22 +03:00
Alexander Alekhin 922cd208f7 Merge pull request #13875 from allnes:optimization_fuse 2019-03-07 14:38:59 +00:00
Alexander Alekhin 8b541e450b imgproc: dispatch color*
Lab/XYZ modes have been postponed (color_lab.cpp):
- need to split code for tables initialization and for pixels processing first
- no significant performance improvements for switching between SSE42 / AVX2 code generation
2019-03-07 15:45:05 +03:00
Alexander Alekhin 39783a6584 core: keep history of color*.cpp 2019-03-07 15:38:13 +03:00
Alexander Alekhin f26912960f imgproc: clone color*.dispatch.cpp 2019-03-07 15:35:49 +03:00
Alexander Alekhin db588bb831 imgproc: clone color*.simd.hpp 2019-03-07 15:35:13 +03:00
Alexander Alekhin b9d2e6664d Merge pull request #13979 from alalek:issue_13772 2019-03-07 09:53:25 +00:00
Alexander Alekhin a43337c28e Merge pull request #13986 from alalek:perf_ignore_ovx 2019-03-07 09:50:49 +00:00
Alexander Alekhin eb9001665e Merge pull request #13993 from liuyuns:issue_13963_thresh_nms_yolov3 2019-03-07 07:55:34 +00:00
Easton Liu fcfb29766b Add ability to read thresh and nms_threshold from YOLO layer in YOLOV3 cfg file.
Currently the thresh is hard-coded to be 0.2 and nms_threshold as 0.4.
2019-03-07 09:55:48 +08:00
Alexander Alekhin d8b58205be Merge pull request #13988 from raymanfx:gstreamer 2019-03-06 20:47:03 +00:00
Christopher N. Hesse 796b0fec7d videoio: gst: Fix gst assertion on null msg
According to the gstreamer docs [1], the GstMessage pointer returned by
gst_bus_pop() is nullable, meaning NULL is a valid return value.

Previously, gst_is_missing_plugin_message would throw an assert when its
message object parameter would fail the GST_IS_MESSAGE macro check,
crashing the entire process (unless running in a try-catch block of course).

Instead of relying on valid messages, check if the message object itself is
valid before passing it to other gstreamer functions.

[1] https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-pop

Signed-off-by: Christopher N. Hesse <raymanfx@gmail.com>
2019-03-06 17:37:02 +01:00
Alexander Alekhin d5a2fe5180 perf: ignore _ovx tests 2019-03-06 15:52:23 +03:00
Alexander Nesterov 74574dfae4 Added optimization fuse 2019-03-05 18:12:03 -01:00
Alexander Alekhin d2f70f61aa Merge pull request #13880 from catree:add_hand_eye_calibration 2019-03-05 16:02:39 +00:00
Alexander Alekhin 3182cc4277 Merge pull request #13980 from terfendail:bresize3_fix 2019-03-05 15:59:21 +00:00
Alexander Alekhin 3b43f90cc8 Merge pull request #13962 from Christianwidjaya:master 2019-03-05 15:00:55 +00:00
Alexander Alekhin b9a6a96324 Merge pull request #13953 from saskatchewancatch:patch-1 2019-03-05 14:59:18 +00:00
Alexander Alekhin 7bcfe8f204 Merge pull request #13974 from alalek:fix_build_warnings 2019-03-05 14:57:50 +00:00
Vitaly Tuzov 99b39aa5bd Fixed out of bound reading in LINEAR_EXACT resize for 8UC3 2019-03-05 17:21:21 +03:00
catree bbf39b0964 Add Hand-Eye calibration methods (Tsai, Park, Horaud, Andreff, Daniilidis). 2019-03-05 14:51:33 +01:00
Alexander Alekhin 7366eebebb core: fix condition in OutputArray::create(allowTransposed=True) 2019-03-05 16:26:59 +03:00
Alexander Alekhin e36a3acbc0 Merge pull request #13967 from alalek:backport_android_build_py 2019-03-05 12:46:08 +00:00
Alexander Alekhin 89c106b29e Merge pull request #13945 from alalek:backport_bindings_generator 2019-03-05 12:45:21 +00:00
Alexander Alekhin 35edad3e74 build: fix warnings 2019-03-05 14:47:04 +03:00
RAJKIRAN NATARAJAN 98f89f9079 Need -DBUILD_DOCS CMake flag to build docs
Must have that flag. Otherwise following "doxygen overview" tutorial won't work.
2019-03-05 14:02:31 +03:00
Alexander Alekhin 8ee1be7d09 cmake: support MSVS 2019 2019-03-05 13:38:47 +03:00
Alexander Alekhin 45c4d3a62b Merge pull request #13969 from alalek:issue_13929 2019-03-05 10:28:59 +00:00
Alexander Alekhin 93dab9e1e9 videoio(v4l): fix build due missing defines
- V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT
- V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH
2019-03-04 18:46:56 +03:00
Alexander Alekhin 480c6dae6d android: backport build_sdk.py 2019-03-04 15:29:09 +03:00
Alexander Alekhin 3132c8ee08 Merge pull request #13958 from nglee:dev_FixCuda101BuildIssue 2019-03-03 18:44:28 +00:00
Suleyman TURKMEN 3d1dbd2ccd clean up C API 2019-03-03 21:43:27 +03:00
Namgoo Lee 5a2faab2e6 CUDA 10.1 Build Issue Fix 2019-03-03 16:40:43 +00:00
Alexander Alekhin 6e9b6a27cf Merge pull request #13951 from alalek:dnn_fix_logging_verbose 2019-03-02 20:09:07 +00:00
Alexander Alekhin 80d37ba698 dnn: fix usage of CV_LOG_VERBOSE macro 2019-03-02 14:49:21 +00:00
Alexander Alekhin 0a98bc0ee9 java: avoid enum values with references on other enums
declaration order is not fixed

Error message:
Core.java:97: error: illegal forward reference
    Hamming_normType = NORM_HAMMING,
2019-03-01 21:32:03 +00:00
Alexander Alekhin 47b6955ba0 Merge pull request #13942 from alalek:imgproc_lsd 2019-03-01 21:16:29 +00:00
Alexander Alekhin 030e955db7 python: support Python list for cv::Range 2019-03-01 20:52:35 +00:00
Alexander Alekhin f5b58e5fc9 bindings: backport generator from OpenCV 4.x
- better handling of enum arguments
- less merge conflicts
2019-03-01 20:18:48 +00:00
Alexander Alekhin f0179f96a7 Merge pull request #13940 from alalek:fix_13914 2019-03-01 19:32:36 +00:00
Alexander Alekhin 3ba49ccecc imgproc: removed LSD code due original code license conflict 2019-03-01 16:25:39 +03:00
Alexander Alekhin d034ef6f27 Merge pull request #13935 from seiko2plus:issue13934 2019-03-01 10:52:41 +00:00
Alexander Alekhin 7d24727184 ml: handle sigmoid NaN result (should be Inf)
- added more debug checks
2019-03-01 13:47:45 +03:00
Sayed Adel 5478165e16 core:vsx Fix narrowing warning on vector splats 2019-03-01 00:48:38 +00:00
Alexander Alekhin a9f67c2d1d Merge pull request #13905 from terfendail:pyr_wintr2 2019-02-28 14:53:42 +00:00
Alexander Alekhin ed8f0ab265 Merge pull request #13931 from berak:core_fix_mat_max_mult 2019-02-28 14:29:31 +00:00
berak 20afae5a14 core: fix mat matx multiplication 2019-02-28 14:22:54 +01:00
Alexander Alekhin caa013b2a4 Merge pull request #13925 from alalek:core_disable_io_perf_test 2019-02-28 12:21:03 +00:00
Vitaly Tuzov 9548093b46 Horizontal line processing for pyrDown() reworked using wide universal intrinsics. 2019-02-28 00:12:57 +03:00
Alexander Alekhin 5fd47352cf Merge pull request #13904 from cftang0827:dnn_tf_text_graph_common_bug 2019-02-27 16:32:40 +00:00
Alexander Alekhin f1f0f630c7 core: disable I/O perf test
- can be enable separately if needed
- not stable (due storage I/O processing)
2019-02-27 18:07:45 +03:00
Alexander Alekhin dd696066b5 Merge pull request #13901 from reunanen:update_libjpeg-turbo 2019-02-26 10:35:32 +00:00
Alexander Alekhin 1bf1694506 Merge pull request #13840 from jaewoosong:jaewoosong-patch-1 2019-02-26 10:19:17 +00:00
Alexander Alekhin 865c29a754 Merge pull request #13892 from dkurt:onnx_upsample_unsqueeze 2019-02-26 10:17:07 +00:00
Maksim Shabunin 8c1e0537ec Merge pull request #13889 from mshabunin:enable-narrowing-warning
* Enabled -Wnarrowing warning

* Fixed type narrowing issues

* Cast python constants

* Use long long for python constants

* Use int for python constants with fallback to long

* Update cv2.cpp
2019-02-26 13:15:59 +03:00
Alexander Alekhin d5a3ad5b64 3rdparty: update libjpeg-turbo/CMakeLists.txt 2019-02-26 12:30:46 +03:00
Juha Reunanen 30cf5e0164 Update libjpeg-turbo from 1.5.3 to 2.0.2 2019-02-26 12:30:46 +03:00
Alexander Alekhin 5421d0866b Merge pull request #13912 from alalek:cmake_workaround_trycompile_ios 2019-02-26 09:28:36 +00:00
Jaewoo Song 225bdc21c0 Making JavaCamera2View behaves in the same way as JavaCameraView 2019-02-26 14:18:29 +08:00
Alexander Alekhin a065c10bcb cmake: workaround iOS try_compile(COPY_FILE) bug 2019-02-25 21:35:46 +00:00
cftang 98d8436440 fix tf_text_graph_common tensor_content type bug 2019-02-26 01:20:54 +08:00
Alexander Alekhin 4cf321f3f8 Merge pull request #13903 from nglee:dev_CudevRework 2019-02-25 16:11:38 +00:00
Alexander Alekhin 0aa0f2ada2 Merge pull request #13906 from dkurt:fix_tf_ssd_min_size 2019-02-25 16:09:57 +00:00
Alexander Alekhin f6d3adcf3d Merge pull request #13887 from dkurt:dnn_ie_lrn_bug 2019-02-25 14:26:22 +00:00
Alexander Alekhin e11213dcef Merge pull request #13900 from alalek:core_dispatch_merge 2019-02-25 13:54:10 +00:00
Dmitry Kurtaev fe7c93cc05 Fix priors boxes generation in case of non square inputs for TensorFlow SSDs 2019-02-25 12:43:42 +03:00
Namgoo Lee 2b6be3cb0f cudev - Rework some code
- Use shfl_down, instead of __shfl_down, on warp scan
- Remove race conditions
2019-02-25 13:46:32 +09:00
Alexander Alekhin fd49ee5f39 core: dispatch merge.cpp 2019-02-23 15:42:26 +00:00
Alexander Alekhin 93a36b0df1 core: keep history of merge.cpp 2019-02-23 15:41:39 +00:00
Alexander Alekhin 4e12febe90 core: clone merge.simd.hpp 2019-02-23 15:41:33 +00:00
Alexander Alekhin 6eabe6bc14 core: clone merge.dispatch.cpp 2019-02-23 15:41:33 +00:00
Alexander Alekhin 3bc9912f6e Merge pull request #13893 from alalek:core_dispatch_split 2019-02-23 15:39:54 +00:00
AKAMath 4c94804bb0 Merge pull request #13837 from amithjkamath:test
New computeECC function, and updated findTransformECC function to make gaussian filtering optional (#13837)

* fix for https://github.com/opencv/opencv/issues/12432 with doc and tests

* Added doc string for new parameter.

* Fixes suggested by Alalek for getting around ABI incompatibility.

* Update to docstring, to remove parameter that isn't relevant.

* More updates based on Alalek's usggestions.
2019-02-22 18:36:40 +03:00
Alexander Alekhin 682e03bdb2 Merge pull request #13877 from LaurentBerger:pythonvideo 2019-02-22 11:33:42 +00:00
Alexander Alekhin ca4fd1e427 Merge pull request #13884 from dkurt:dnn_drop_ie_r1_r2 2019-02-22 11:21:43 +00:00
Alexander Alekhin 91d152e2c2 core: dispatch split.cpp 2019-02-22 09:54:31 +00:00
Alexander Alekhin 1d8b30bf4f core: keep history of split.cpp 2019-02-22 09:18:51 +00:00
Alexander Alekhin 0311770e8b core: clone split.simd.hpp 2019-02-22 09:18:27 +00:00
Alexander Alekhin 82cd2f8c93 core: clone split.dispatch.cpp 2019-02-22 09:17:51 +00:00
Dmitry Kurtaev 20400aa9f7 Import Upsample and Unsqueeze from ONNX 2019-02-21 20:17:28 +03:00
Dmitry Kurtaev 4cbd09c41c Add extra limitations for LRN from Inference Engine backend 2019-02-21 14:20:24 +03:00
LaurentBerger 4ebb617000 Check return value in python tutorial 2019-02-21 11:02:12 +01:00
Alexander Alekhin 0e70363f4a Merge pull request #13882 from dkurt:fix_13479 2019-02-21 09:38:26 +00:00
Alexander Alekhin 7baa5efbe4 Merge pull request #13874 from dkurt:dnn_default_conf_thresh 2019-02-21 09:36:44 +00:00
Dmitry Kurtaev ed710eaa1c Make Inference Engine R3 as a minimal supported version 2019-02-21 09:32:26 +03:00
Dmitry Kurtaev bfd663c281 Add a test for grouped deconvolution from ONNX 2019-02-21 08:54:35 +03:00
Ayush Pandey 5c7fe0fe05 Fix Issue #13479 2019-02-21 08:36:16 +03:00
Alexander Alekhin 1db5d82b7f Merge pull request #13844 from brad-kelly:integral_avx512_cn234 2019-02-20 12:27:16 +00:00
Alexander Alekhin 3064e40d9e Merge pull request #13866 from alalek:core_dispatch_mean 2019-02-20 11:50:21 +00:00
Vitaly Tuzov 334c4d62b5 Merge pull request #13781 from terfendail:warp_wintr
Resize reworked using wide universal intrinsics (#13781)

* Added wide universal intrinsics optimized implementation for 3 channel bit-exact linear resize

* Reworked linear resize using new wide LUT intrinsics

* Fix for VSX intrinsics
2019-02-20 14:30:28 +03:00
Dmitry Kurtaev 715f881dda Replace default confidence threshold for dnn detections from -FLT_MAX to 0 2019-02-20 13:09:09 +03:00
Brad Kelly 507f8add1c Implementing AVX512 Support for 2 and 4 channel mats for CV_64F format 2019-02-19 11:31:20 -08:00
Alexander Alekhin 8cedc052ca Merge pull request #13841 from dkurt:dnn_ie_future_3 2019-02-19 14:19:36 +00:00
Alexander Alekhin 6e34d2778f Merge pull request #13865 from lsr0:flann_cudacc 2019-02-19 14:03:54 +00:00
Alexander Alekhin dc84cf9914 core: dispatch mean.cpp 2019-02-19 16:58:32 +03:00
Alexander Alekhin 4b82c8a22b core: keep history of mean.cpp 2019-02-19 16:46:46 +03:00
Alexander Alekhin 7af7bcae18 core: clone mean.dispatch.cpp 2019-02-19 16:46:28 +03:00
Alexander Alekhin 93cea6e46e core: clone mean.simd.hpp 2019-02-19 16:45:42 +03:00
Lindsay Roberts 7c72e095fa Fix Flann compilation under nvcc + NEON
All <arm_neon.h> includes in core/cv_cpu_dispatch.h are protected by an
ifndef __CUDACC__ to prevent attempting to use neon intrinsics when
compiling cuda kernels (.cu) -- this prevents hard errors such as
  error: identifier "__builtin_neon_qi" is undefined

Add this same protection to flann/dist.h to fix compilation involving
flann.hpp.
2019-02-19 15:11:01 +02:00
Alexander Alekhin aebb66682b Merge pull request #13857 from LaurentBerger:bug13853 2019-02-19 10:34:30 +00:00
Dmitry Kurtaev ca5976e3d4 Fix IE backend considering future changes. 2019-02-18 19:26:04 +03:00
LaurentBerger 9e94212eac Solves bug 13853 2019-02-18 17:15:05 +01:00
Alexander Alekhin 3bba5b5a31 Merge pull request #13850 from nglee:dev_FixCudaStereoBMHangRace 2019-02-18 14:50:03 +00:00
Alexander Alekhin 9b71f5fd54 Merge pull request #13835 from catree:real_time_pose_tutorial_keypoints_matching 2019-02-18 14:39:10 +00:00
Alexander Alekhin 428720f490 Merge pull request #13833 from alalek:core_dispatch_matmul 2019-02-18 13:38:44 +00:00
catree 3c92d40f6e Fix arguments parsing. Add possibility to choose between different features type. Add keypoints matching visualization. Auto format code. 2019-02-18 14:15:44 +01:00
Alexander Alekhin cd66f6e3db core: dispatch matmul
- gemm: keep baseline only (lapack is 10x+ faster, lets reduce binary size)
- transform / distTransform
- scaleAdd (32f/64f only)
- Mahalanobis: keep baseline only (no perf tests)
- mulTransposed: keep baseline only (no perf tests)
- dot
2019-02-18 14:36:46 +03:00
Namgoo Lee 1a961660d8 cuda::StereoBM - fix hanging and racing issue
- Fix hanging issue on 2080 Ti
- Fix racing issue
2019-02-18 06:03:12 +00:00
Alexander Alekhin 9d3d5e9d65 Merge pull request #13774 from l-bat:fix-IE-tests 2019-02-15 13:54:24 +00:00
Alexander Alekhin fbde57dba8 core: keep history of matmul.cpp 2019-02-14 19:07:41 +03:00
Alexander Alekhin dcee7b1605 core: clone matmul.dispatch.cpp 2019-02-14 19:07:37 +03:00
Alexander Alekhin b769ad2c23 core: clone matmul.simd.hpp 2019-02-14 19:07:37 +03:00
Alexander Alekhin 3c70d966cb Merge pull request #13823 from alalek:core_dispatch_countNonZero 2019-02-14 15:52:21 +00:00
Alexander Alekhin d9b573795b Merge pull request #13726 from nicolaerosia:android-ffmpeg 2019-02-14 11:40:27 +00:00
Nicolae Rosia 3aaf8dfd11 cmake: allow FFmpeg linking on Android
details: https://github.com/opencv/opencv/pull/13726

In order to help CMake and PkgConfig find FFmpeg you need to:
1) export `PKG_CONFIG_LIBDIR=${SYSROOT}`
where `SYSROOT=${ANDROID_NDK}/sysroot`
2) Add `-DCMAKE_PREFIX_PATH=${FFMPEG_INSTALL_PREFIX}`
3) Append `-DCMAKE_FIND_ROOT_PATH=${FFMPEG_INSTALL_PREFIX}`
2019-02-14 13:58:15 +03:00
Alexander Alekhin e3633ec4a2 core: dispatch count_non_zero 2019-02-14 13:16:20 +03:00
Alexander Alekhin 0b49680339 core: keep history of count_non_zero.cpp 2019-02-14 13:15:43 +03:00
Alexander Alekhin 439e43a027 core: clone count_non_zero.dispatch.cpp 2019-02-14 13:15:39 +03:00
Alexander Alekhin af8a3a0b66 core: clone count_non_zero.simd.hpp 2019-02-14 13:15:39 +03:00
Liubov Batanina 183c0fcab1 Changed condition for resize and lrn layers 2019-02-14 13:11:14 +03:00
Alexander Alekhin bd00471a89 Merge pull request #13808 from tailsu:sd/libtiff-4.0.10 2019-02-14 09:36:10 +00:00
Stefan Dragnev ff1ec6ccc6 update to libtiff-4.0.10 2019-02-14 09:28:14 +01:00
Alexander Alekhin 86136c0ccc Merge pull request #13796 from alalek:core_dispatch_sum 2019-02-14 08:16:42 +00:00
Alexander Alekhin 087d9745b3 Merge pull request #13807 from tailsu:sd/libpng-1.6.36 2019-02-13 16:19:16 +00:00
Alexander Alekhin b40a7ffbe4 core: dispatch sum 2019-02-13 18:17:38 +03:00
Stefan Dragnev 094615b2c5 update libpng to 1.6.36
* re-enabled NEON routines for arm64
2019-02-13 14:54:18 +01:00
Alexander Alekhin c88e6b344b core: keep history of sum.cpp 2019-02-13 13:49:36 +03:00
Alexander Alekhin 6e88bff3e3 core: clone sum.dispatch.cpp 2019-02-13 13:49:29 +03:00
Alexander Alekhin 5aceac6b93 core: clone sum.simd.hpp 2019-02-13 13:49:29 +03:00
Alexander Alekhin b12e1acdec Merge pull request #13810 from nglee:dev_CudaSafeBlockScan 2019-02-12 21:50:29 +00:00
Namgoo Lee 21eb60f88b cudalegacy: Use safe block scan function 2019-02-13 01:55:02 +09:00
Alexander Alekhin b1caa4f4d5 Merge pull request #13803 from thangktran:thangktran/fix-misleading-runtime-assertion-calibrateCamera 2019-02-12 14:25:21 +00:00
Alexander Alekhin 9e7014b59f Merge pull request #13799 from dkurt:dnn_ie_future_2 2019-02-12 14:07:42 +00:00
Thang Tran a1f4e65d03 calib3d: Fix calibrateCamera() misleading error
objectPoints and imagePoints are not checked whether they're empty and
cause checkVector() to fail, thus result in a wrong error message.

Fixes: https://github.com/opencv/opencv/issues/6002
2019-02-12 16:23:34 +03:00
Alexander Alekhin f3d62c94b1 Merge pull request #13800 from dkurt:fix_nvidia_caffe 2019-02-12 13:02:22 +00:00
Alexander Alekhin 2e28ff78c1 Merge pull request #13780 from alalek:core_dispatch_convertTo 2019-02-12 12:08:30 +00:00
Dmitry Kurtaev 1606137df2 Read raw floats data from Caffe models 2019-02-11 20:08:17 +03:00
Dmitry Kurtaev 0711dab09d Fix Intel's Inference Engine backend from future. Second try. 2019-02-11 19:47:57 +03:00
Alexander Alekhin 5f57842575 Merge pull request #13794 from alalek:backport_13786 2019-02-11 14:05:43 +00:00
Alexander Alekhin 4e16ec2826 Merge pull request #13793 from vertextau:tutorial-fix 2019-02-11 12:39:35 +00:00
klemens 5d9c6723ee spelling fixes
backport 997b7b18af
2019-02-11 15:35:10 +03:00
Liubov Batanina 6b4becfd03 Enabled tests on IE backend 2019-02-11 12:39:28 +03:00
Oleh c8777da2d6 Update video_input_psnr_ssim.markdown 2019-02-11 10:45:16 +02:00
Alexander Alekhin b17c1c6721 Merge pull request #13782 from paroj:pypath 2019-02-09 15:26:11 +00:00
Alexander Alekhin f8786c9bf4 Merge pull request #13783 from alalek:fix_13741 2019-02-09 15:25:48 +00:00
Pavel Rojtberg f0ef4b2246 python: sys.path[0] is reserved for the main script 2019-02-08 17:24:31 +01:00
Alexander Alekhin d32d576d6d core: dispatch convert_scale 2019-02-08 18:32:10 +03:00
Alexander Alekhin 39b90ae9fb core: dispatch convert 2019-02-08 18:32:10 +03:00
Alexander Alekhin 757d8ac8f7 Merge pull request #13769 from savuor:cvtColor_tests_16u_32f 2019-02-08 15:29:35 +00:00
Alexander Alekhin 5e2a81dc26 Merge pull request #13766 from dkurt:dnn_mask_rcnn_atrous 2019-02-08 15:23:46 +00:00
Alexander Alekhin 52050ebe32 Merge pull request #13760 from AnastasiaaSenina:fix-bug 2019-02-08 15:22:17 +00:00
Alexander Alekhin 33d477e049 core: keep history of convert_scale.cpp 2019-02-08 16:39:13 +03:00
Alexander Alekhin c4abdb8050 core: clone convert_scale.dispatch.cpp 2019-02-08 16:38:50 +03:00
Alexander Alekhin 0af9e19be7 core: clone convert_scale.simd.hpp 2019-02-08 16:35:52 +03:00
Alexander Alekhin b6a0acb8f6 core: keep history of convert.cpp 2019-02-08 16:29:54 +03:00
Alexander Alekhin 5527c41468 core: clone convert.dispatch.cpp 2019-02-08 16:29:16 +03:00
Alexander Alekhin 1629e29b98 core: clone convert.simd.hpp 2019-02-08 16:27:59 +03:00
Alexander Alekhin 3091d10b00 Merge pull request #13746 from allnes:fix_step_dnn 2019-02-08 10:18:43 +00:00
Alexander Alekhin 8f7e92e466 Merge pull request #13764 from nglee:dev_CudaCLAHE16bitSupport 2019-02-08 10:13:11 +00:00
AnastasiaaSenina d7b1f28a90 fixed bug: added threshold for variables 'rotate_a', ' rotate_c' 2019-02-08 13:06:23 +03:00
Rostislav Vasilikhin 4e679e1cc5 disabled 16u and 32f perf tests 2019-02-07 19:26:36 +03:00
Alexander Alekhin d2174e2e75 Merge pull request #13775 from terfendail:morph_fix 2019-02-07 15:53:58 +00:00
Rostislav Vasilikhin 87f651c119 disabled sanity check for 32f 2019-02-07 18:20:29 +03:00
Vitaly Tuzov 07c10d6fc3 Fixed out of bound reading issue in erode() and dilate() 2019-02-07 17:28:58 +03:00
Alexander Alekhin 66d9a33b50 core(ocl): fix log messages 2019-02-07 16:35:14 +03:00
Alexander Nesterov 9cbdb48d6d Fix change step 2019-02-07 11:14:20 -01:00
Liubov Batanina b068d26fad Using IE backend for normalize layer tests 2019-02-07 11:52:27 +03:00
Namgoo Lee fb8e652c3f Add CV_16UC1 support for cuda::CLAHE
Due to size limit of shared memory, histogram is built on
the global memory for CV_16UC1 case.

The amount of memory needed for building histogram is:

    65536 * 4byte = 256KB

and shared memory limit is 48KB typically.

Added test cases for CV_16UC1 and various clip limits.
Added perf tests for CV_16UC1 on both CPU and CUDA code.

There was also a bug in CV_8UC1 case when redistributing
"residual" clipped pixels. Adding the test case where clip
limit is 5.0 exposes this bug.
2019-02-06 17:21:55 +00:00
Rostislav Vasilikhin bbedebb57c perf tests for cvtColor for 16U and 32f added 2019-02-06 17:56:44 +03:00
Alexander Alekhin f67b197d49 Merge pull request #13738 from dkurt:dnn_ie_lock_shared_plugins 2019-02-06 12:09:58 +00:00
Dmitry Kurtaev 6ad3bf3130 Enable ResNet-based Mask-RCNN models from TensorFlow Object Detection API 2019-02-06 13:05:11 +03:00
Dmitry Kurtaev bc4e471847 Add a mutex for shared Inference Engine plugins 2019-02-05 19:26:58 +03:00
Alexander Alekhin a63f66c90e Merge pull request #13762 from alalek:ocl_dnn_mvn_local_size 2019-02-05 14:58:27 +00:00
Alexander Alekhin eab6744ac7 dnn(ocl): use compile-time LOCAL_SIZE parameter
instead of get_local_size(0) and dynamic local memory allocation
2019-02-05 15:51:16 +03:00
Alexander Alekhin f46cd9dbf5 Merge pull request #13670 from allnes:dnn_fix_obj_detect_sample 2019-02-05 12:37:53 +00:00
winice 37a5af3673 Merge pull request #13737 from winice-test:master
* Optical Flow rework to use wide universal intrinsics

* remove if (useSIMD) check as review requested
2019-02-04 18:59:00 +03:00
Alexander Alekhin b19bb95d66 Merge pull request #12855 from dkurt:js_features2d_tests 2019-02-02 14:22:02 +00:00
Dmitry Kurtaev 8ecc5e6f64 Add tests for features2d JavaScript bindings 2019-02-01 19:12:31 +03:00
Rostislav Vasilikhin 554eae56d1 Merge pull request #13708 from savuor:yuv42x_wide
YUV42x color conversions rewritten to wide intrinsics (#13708)

* a*b+c -> fma

* YUV420sp2RGB initially vectorized

* shorter var names

* loops by 4

* yuv420p2rgb vectorized

* yuv422toRGB vectorized

* reg arrays

* rgb2yuv420 vectorized

* warnings fixed

* try to fix align error
2019-02-01 19:09:31 +03:00
Alexander Alekhin 4e66d078d2 Merge pull request #13722 from alalek:ocl_pass_ptr_for_empty_umat 2019-02-01 16:07:43 +00:00
Alexander Alekhin a42bbc9722 Merge pull request #13736 from dkurt:dnn_ie_future 2019-02-01 10:01:39 +00:00
Alexander Alekhin fe33ce02af Merge pull request #13735 from dkurt:fix_13725 2019-02-01 09:58:14 +00:00
Alexander Alekhin 9362639437 Merge pull request #13716 from dkurt:dnn_conv_weights_clone 2019-02-01 09:57:08 +00:00
Hannah McLaughlin 418898029c Merge pull request #13718 from lochsh:svm-sigmoid-fix
SVM sigmoid kernel fix (issue #13621) (#13718)

* Added test for sigmoid case for retrieving support vectors

* undo unhelpful test

* add test for sigmoid SVM with data that is easily separable into two concentric circles

* Update sigmoid kernel to use tanh(gamma * <x, y> + coef0) instead of -tanh(gamma * <x, y> + coef0)

* remove unnecessary constraint on coef0

* cleanup

* fixing inappropriate use of doubles

* Add f to float literal

* replace CV_Assert with ASSERT_EQ where appropriate
2019-01-31 15:34:36 +03:00
Dmitry Kurtaev c918ac298c Fix IE tests 2019-01-31 14:14:38 +03:00
Dmitry Kurtaev 252fd63194 Align TensorFlow and OpenCV paths to create a text graph 2019-01-31 13:40:54 +03:00
Vitaly Tuzov 2f5af1bd33 Merge pull request #13693 from terfendail:spatialgrad_wintr
* spatialGradient() reworked to use wide universal intrinsics

* Moved row pointers inside loops
2019-01-30 22:37:27 +03:00
Alexander Nesterov cca2c4b314 Update obj. detect sample 2019-01-30 16:44:42 -01:00
Alexander Alekhin 4501a2cdea ocl: support empty "ptr only" UMat in Kernel::set()
add messages to avoid silent kernel destruction
2019-01-30 14:51:06 +03:00
Ramez Rafla eb00dce78e Merge pull request #13710 from ramezrafla:3.4
* Added DMatch bindings

* Added CR which was accidently removed to maintain consistency

* Removed trailing white-space
2019-01-30 00:14:33 +03:00
Alexander Alekhin 268d73165e Merge pull request #13684 from terfendail:lblend_wintr 2019-01-29 16:21:08 +00:00
Alexander Alekhin 5916ebf500 Merge pull request #13679 from alalek:imgproc_median_blur_cleanup
* imgproc: cleanup medianBlur_8u_O1 code

Unnecessary per-channel buffers: H[c] / lut[c]

* imgproc(medianBlur_8u_O1): use CV_SIMD_WIDTH for alignment
2019-01-29 19:20:24 +03:00
Dmitry Kurtaev ac262f5b5d Clone convolution layer weights only for fusion 2019-01-29 14:29:47 +03:00
Arnaud Brejeon d998e70a25 Merge pull request #13672 from arnaudbrejeon:bug_fix_12961
PyrDown: Fix bug #12961 (#13672)

* Force unaligned pointer and create test

* More cross-platform solution

* MSVC expects a proper order

* Remove useless clang macro
2019-01-28 21:36:00 +03:00
Alexander Alekhin 3585522b24 Merge pull request #13692 from dkurt:dnn_do_not_crash_myriad_in_tests 2019-01-28 18:34:20 +00:00
Alexander Alekhin 02e9636f1b Merge pull request #13707 from dkurt:fix_13575 2019-01-28 18:32:21 +00:00
Dmitry Kurtaev 3c3c5ef2b6 Fix a dnn bug with retrieving all the output blobs 2019-01-28 18:48:56 +03:00
Dmitry Kurtaev ff775b2e54 Remove ASSERT_ANY_THROW checks fpr Myriad plugin and FP32 networks 2019-01-25 20:09:54 +03:00
Alexander Alekhin 4f668e1023 Merge pull request #13608 from allnes:dnn_rework 2019-01-25 11:59:29 +00:00
Vitaly Tuzov ed2e1af3e8 Added performance test for blendLinear 2019-01-25 14:16:19 +03:00
Vitaly Tuzov 266725a378 blendLinear() reworked to use wide universal intrinsics 2019-01-25 14:16:20 +03:00
Suleyman TURKMEN 9be8ab06ed Update photo.hpp 2019-01-25 10:44:44 +03:00
Alexander Alekhin 190ad749e4 Merge pull request #13685 from mshabunin:fix-avfoundation-34 2019-01-24 16:21:49 +00:00
Alexander Nesterov 97c3bcb1b7 Added fix for other size 2019-01-24 12:51:16 -01:00
Maksim Shabunin 9c4eb20221 AVFoundation on Mac: fixed frame count and unsupported format handling 2019-01-24 16:15:08 +03:00
Alexander Alekhin dcdbaef348 Merge pull request #13658 from nglee:dev_CudaShflUpCompat 2019-01-21 18:12:38 +00:00
Alexander Alekhin 20d82cf6d5 Merge pull request #13668 from alalek:imgproc_rgb2yuv_regression 2019-01-21 18:10:25 +00:00
Namgoo Lee 970293a229 __shfl_up_sync with mask for CUDA >= 9
* __shfl_up_sync with proper mask value for CUDA >= 9

* BlockScanInclusive for CUDA >= 9

* compatible_shfl_up for use in integral.hpp

* Use CLAHE in cudev

* Add tests for BlockScan
2019-01-21 15:31:15 +00:00
Rostislav Vasilikhin 74ba4b7ae2 fixed (un)signed packing s16 -> u8 2019-01-21 18:10:29 +03:00
Alexander Alekhin a84e11451b imgproc(test): RGB2YUV regression test 2019-01-21 16:07:20 +03:00
Alexander Alekhin 3478240de9 Merge pull request #13656 from dkurt:dnn_tf_atrous_faster_rcnn 2019-01-20 18:39:04 +00:00
Alexander Alekhin 0395b2ea9c Merge pull request #13650 from terfendail:shapedescr_wintr 2019-01-18 16:18:47 +00:00
Rostislav Vasilikhin 3812ae7949 Merge pull request #13649 from savuor:yuv_wide
YUV/YCrCb conversions rewritten to wide intrinsics (#13649)

* YUV: minors

* YUV42x conversions template-merged

* more template-merged YUV42x conversions; some NEON code removed

* rgb2yuv<float> vectorized

* yuv2rgb<float> vectorized

* memcpy removed

* Yuv2RGB<ushort> vectorized

* unused code removed

* rgb2yuv<ushort> vectorized

* rgb2yuv<uchar> vectorized

* v_pack_u used (up to +30% perf)

* yuv2rgb<uchar> vectorized

* fixed compilation
2019-01-18 19:06:29 +03:00
Alexander Alekhin 400fd5c3ec Merge pull request #13539 from dkurt:ie_graph_api 2019-01-18 16:00:18 +00:00
Dmitry Kurtaev 67e6a6077d Create text graphs for Faster-RCNN from TensorFlow with dilated convolutions 2019-01-18 18:46:52 +03:00
Vitaly Tuzov a84bbc62b1 boundingRect() reworked to use wide universal intrinsics 2019-01-18 18:31:54 +03:00
Alexander Alekhin dc5e69b4d4 Revert "Merge pull request #13586 from eightco:Core_bugfix3"
This reverts commit 3721c8bb06
except changes in modules/dnn/test/test_tf_importer.cpp
2019-01-18 18:29:12 +03:00
Vitaly Tuzov 78f80c35d2 Performance test for bounding rect estimation 2019-01-18 15:50:21 +03:00
Lee Jaehwan 3721c8bb06 Merge pull request #13586 from eightco:Core_bugfix3
* Add Operator override for multi-channel Mat with literal constant.

* simple test

* Operator overloading channel constraint for primitive types

* fix some test for #13586
2019-01-17 17:23:09 +03:00
Alexander Alekhin b9496f8d9d Merge pull request #13645 from mshabunin:doc-includes 2019-01-17 12:35:20 +00:00
Alexander Alekhin bbc6b95c02 Merge pull request #13644 from berak:dnn_samples_googlenet 2019-01-17 12:34:53 +00:00
Dmitry Kurtaev f0ddf302b2 Move Inference Engine to new API 2019-01-17 14:28:48 +03:00
berak 6596eab66c dnn/samples: add googlenet to model zoo 2019-01-17 12:14:35 +01:00
Maksim Shabunin 9205ad6990 Enabled #include documentation in all members 2019-01-17 13:57:40 +03:00
Alexander Alekhin 49de982ee7 Merge pull request #13625 from nglee:dev_CudaFarnebackInitFlowFix 2019-01-16 18:18:57 +00:00
Alexander Alekhin ca00c1dce2 Merge pull request #13631 from terfendail:thresh_wintr 2019-01-16 15:45:26 +00:00
Alexander Alekhin 133eb8d13a Merge pull request #13593 from brad-kelly:integral_avx512_ver34 2019-01-15 17:47:21 +00:00
Alexander Alekhin dcdb3b36ef Merge pull request #13622 from sturkmen72:code_clean_up 2019-01-15 17:46:26 +00:00
Vitaly Tuzov a202dc9a90 threshold() reworked to use wide universal intrinsics 2019-01-15 19:15:19 +03:00
Alexander Alekhin 0e9c90a0d9 Merge pull request #13610 from terfendail:morph_wintr 2019-01-15 11:22:00 +00:00
Brad Kelly 0165ffa90d Implementing AVX512 support for 3 channel cv::integral for CV_64F 2019-01-14 16:11:01 -08:00
Suleyman TURKMEN 794c14b29a code clean up 2019-01-14 22:21:21 +03:00
Vitaly Tuzov 012e43de4b Morphology reworked to use wide universal intrinsics 2019-01-14 19:02:58 +03:00
Alexander Alekhin 36dfb71c60 Merge pull request #13619 from alalek:issue_13595 2019-01-14 14:54:11 +00:00
Namgoo Lee 4366c8734f Fix Farneback Optical Flow Algorithm
- Before this PR, following tests failed on some platform.
  CUDA_OptFlow/FarnebackOpticalFlow.Accuracy/19
  CUDA_OptFlow/FarnebackOpticalFlow.Accuracy/23

- The algorithm now recognizes the OPTFLOW_USE_INITIAL_FLOW flag.
  Previously, when the flag was set, it did not use the flow data
  passed as input, instead used some garbage data in memory.

- More strict test limit.
2019-01-13 15:14:45 +00:00
Alexander Alekhin 4ced27e149 Merge pull request #13617 from terfendail:always_inline 2019-01-13 09:35:24 +00:00
atinfinity e48682a9f7 Merge pull request #13616 from atinfinity:fixed-py_matcher-tutorial
* fixed tutorial code of py_matcher

* fixed imread mode
2019-01-13 12:34:05 +03:00
Alexander Alekhin 6e39856623 Merge pull request #13614 from dkurt:dnn_tf_ssd_fpn 2019-01-13 09:33:05 +00:00
Alexander Alekhin 6bd5d7f037 cmake: don't use LIB_SUFFIX with CMAKE_INSTALL_LIBDIR 2019-01-12 11:14:18 +00:00
Vitaly Tuzov ea882d58c6 Added CV_ALWAYS_INLINE macro 2019-01-11 22:40:35 +03:00
Jim Zhou 78bd55c8df Merge pull request #13601 from JimZhou-001:JimZhou-001
* Fix the bug in case determinant of rotation matrix is -1

* calib3d(test): check det(R) == 1
2019-01-11 16:58:47 +03:00
Dmitry Kurtaev 4ae5df5509 SSD with FPN proposals from TensorFlow 2019-01-11 12:20:03 +03:00
Alexander Alekhin 7812a805ad Merge pull request #13606 from rrrapha:malloc-h 2019-01-10 15:15:09 +00:00
Raphael Graf 82c77fa244 dnn: remove malloc.h include 2019-01-10 13:07:36 +01:00
Alexander Alekhin 054bd23a43 Merge pull request #13560 from cuihaoleo:master 2019-01-09 15:45:09 +00:00
Alexander Alekhin 3bbe5d3956 Merge pull request #13592 from tdp2110:master 2019-01-09 14:42:57 +00:00
Alexander Alekhin fd674b85bb Merge pull request #13600 from dkurt:fix_13576 2019-01-09 14:02:59 +00:00
Alexander Alekhin facd5988ce Merge pull request #13599 from dkurt:dnn_conv_error_msg 2019-01-09 14:02:14 +00:00
Alexander Alekhin b11566bfc7 Merge pull request #13553 from luctowers:master 2019-01-09 13:33:45 +00:00
CUI Hao (Lab) e5e1ba3c97 Fix typo in core+RotatedRect.java 2019-01-09 16:30:54 +03:00
Alexander Alekhin ebe14fa4ac Merge pull request #13587 from catree:add_matplotlib_colormaps 2019-01-09 13:30:21 +00:00
Alexander Alekhin 3da8b4ccad Merge pull request #13591 from scramsby:fix-unicode-errors 2019-01-09 13:25:14 +00:00
Alexander Alekhin e986ff46f7 Merge pull request #13596 from nglee:dev_RemoveCudaIncludeWarningMsg 2019-01-09 13:23:54 +00:00
Dmitry Kurtaev 62199df815 Fix edge_detection.py sample for Python 3 2019-01-09 15:28:10 +03:00
Lucas Towers 9cc12ff0ac Fix improper defining of CV_XADD when using Intel C++ 2019-01-09 14:41:21 +03:00
Dmitry Kurtaev d0504c95f4 Add a text message for Convolution layer's input channels check 2019-01-09 13:10:19 +03:00
Thomas Peters e8ac3ea9ea fix implicit fallthrough warning. 2019-01-08 09:49:45 -05:00
Namgoo Lee 4b4874e67a Remove build warning msg with CUDA10.0 2019-01-08 10:57:12 +09:00
Scott Ramsby 7d0d6cd5ee Fix build error when building with Unicode on Windows 2019-01-07 10:18:58 -08:00
catree d745af6763 Add Matplotlib Perceptually Uniform Sequential colormaps (viridis, plasma, inferno, magma, cividis, twilight and twilight shifted). 2019-01-06 22:48:06 +01:00
Lee Jaehwan 71aee662bd Merge pull request #13544 from eightco:bugfix
Fix a bug in cv :: merge when array of 3-channel mat is input (#13544)

* Mat merge function bug fix - Bug fix of merge function of 3-channel vector <Mat> of 3 or 4 matrices

* Add Core_merge test for opencv#13544

* fixups
2019-01-04 15:10:50 +03:00
Alexander Alekhin 14d943f588 copyright: 2019 2019-01-02 01:18:04 +00:00
Alexander Alekhin 5f2fed0e25 Merge pull request #13453 from crackwitz:w32-opengl-mouse-position 2018-12-26 12:38:59 +00:00
Alexander Alekhin caa3633cbf Merge pull request #13451 from crackwitz:gdi-off-by-one 2018-12-26 12:10:09 +00:00
Christoph Rackwitz deb8ba2237 fix for #4990: highgui w32 ogl: correct calculation of image coordinates from window coordinates 2018-12-26 15:00:39 +03:00
Alexander Alekhin 7d69289092 Merge pull request #13511 from knsong:3.4 2018-12-26 07:23:49 +00:00
Alexander Alekhin c9dfcc4de8 Merge pull request #13492 from terfendail:matx_addition 2018-12-26 07:23:30 +00:00
Christoph Rackwitz beba82b22b Off-by-ones in windows/GDI window calculations
Check for "gutter" around displayed image. there was one row/column missing on the bottom/right.
Might as well set gutter = 0?
2018-12-25 17:54:44 +01:00
Vitaly Tuzov cd169941f2 Added test for addition of Mat and Matx 2018-12-25 19:22:04 +03:00
Vitaly Tuzov c8f59bf1e0 Fixed operations on Mat and Matx simultaneously 2018-12-25 19:22:09 +03:00
Dmitry Kurtaev ff8c53ea20 Merge pull request #13481 from dkurt:fix_13227
* Fix drawMatches and drawKeypoints for BGRA input images

* keep BGRA too

* Combine different input types for drawMatches test
2018-12-25 17:29:12 +03:00
Alexander Alekhin 148aee31e4 Merge pull request #13486 from allnes:dnn_rework 2018-12-25 14:27:45 +00:00
Alexander Nesterov a208c3bf04 Fix openpose samples 2018-12-25 14:12:44 -01:00
Alexander Alekhin d9089741bc Merge pull request #13524 from terfendail:filter_unroll 2018-12-25 14:26:59 +00:00
Vitaly Tuzov 7beb24553a Speedup filter2d by loop unrolling
Added filter2d tests for 16S
2018-12-25 14:40:48 +03:00
Kangning Song d4917a5bd3 fix initial values bug 2018-12-23 11:28:28 +08:00
Alexander Alekhin ffc9aa050d Merge pull request #13507 from alalek:revert_13506 2018-12-22 07:38:15 +00:00
Alexander Alekhin c0e11bb50e imgproc: revert "Speedup filter2d by loop unrolling"
Commit: 124011c321
PR: https://github.com/opencv/opencv/pull/13392

Sobel filter with 16S/16U datatype is broken.
2018-12-22 05:37:29 +00:00
Alexander Alekhin f35e043cf9 Merge tag '3.4.5' 2018-12-21 21:48:03 +03:00
1530 changed files with 128384 additions and 51326 deletions
+2
View File
@@ -1127,6 +1127,7 @@ inline int TEGRA_FILTERINIT(cvhalFilter2D **context, uchar *kernel_data, size_t
{ {
std::memcpy(ctx->kernel_data + kernel_width * j, kernel_data + kernel_step * j, kernel_width * sizeof(int16_t)); std::memcpy(ctx->kernel_data + kernel_width * j, kernel_data + kernel_step * j, kernel_width * sizeof(int16_t));
} }
break;
default: default:
delete[] ctx->kernel_data; delete[] ctx->kernel_data;
delete ctx; delete ctx;
@@ -1243,6 +1244,7 @@ inline int TEGRA_SEPFILTERINIT(cvhalFilter2D **context, int src_type, int dst_ty
ctx->kernely_data[0]=((int16_t*)kernely_data)[0]; ctx->kernely_data[0]=((int16_t*)kernely_data)[0];
ctx->kernely_data[1]=((int16_t*)kernely_data)[1]; ctx->kernely_data[1]=((int16_t*)kernely_data)[1];
ctx->kernely_data[2]=((int16_t*)kernely_data)[2]; ctx->kernely_data[2]=((int16_t*)kernely_data)[2];
break;
default: default:
delete ctx; delete ctx;
return CV_HAL_ERROR_NOT_IMPLEMENTED; return CV_HAL_ERROR_NOT_IMPLEMENTED;
+1
View File
@@ -109,6 +109,7 @@ bool isResizeLinearOpenCVSupported(const Size2D &ssize, const Size2D &dsize, u32
&& dsize.width >= 2 && dsize.height >= 8 && dsize.width >= 2 && dsize.height >= 8
&& (2*dsize.width != ssize.width || 2*dsize.height != ssize.height)) // 2x downscaling is performed as area in OpenCV which differs from this implementation && (2*dsize.width != ssize.width || 2*dsize.height != ssize.height)) // 2x downscaling is performed as area in OpenCV which differs from this implementation
return isSupportedConfiguration(); return isSupportedConfiguration();
return false;
default: default:
return false; return false;
}; };
+16
View File
@@ -12,6 +12,22 @@ Write-Output ("=" * 120)
Write-Output "" Write-Output ""
if(![System.IO.File]::Exists($output)) { if(![System.IO.File]::Exists($output)) {
try {
[io.file]::OpenWrite($output).close()
} catch {
Write-Warning "Unable to write: $output"
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Launching with 'Administrator' elevated privileges..."
Pause
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
} else {
Write-Output "FATAL: Unable to write with elevated privileges: $output"
Pause
exit 1
}
}
try { try {
Write-Output ("Downloading: " + $output) Write-Output ("Downloading: " + $output)
Import-Module BitsTransfer Import-Module BitsTransfer
+5 -5
View File
@@ -1,8 +1,8 @@
# Binaries branch name: ffmpeg/3.4_20181103 # Binaries branch name: ffmpeg/3.4_20190905
# Binaries were created for OpenCV: c6d2f0399a706028f476f3d08358ea787503020d # Binaries were created for OpenCV: fafada28ebc0f2e5423a7d8ece425574ef01ff60
ocv_update(FFMPEG_BINARIES_COMMIT "fe71c0ad807fdc33c2178e48e488f1e9b177c39a") ocv_update(FFMPEG_BINARIES_COMMIT "bf1730f4c4ba1996bed1fe268b52e4e942151cd6")
ocv_update(FFMPEG_FILE_HASH_BIN32 "41b81bb9a50cabd4bea385f7b50a069a") ocv_update(FFMPEG_FILE_HASH_BIN32 "6899624f88cb4cbb1604edc5e12b18ab")
ocv_update(FFMPEG_FILE_HASH_BIN64 "a9ea7dbbc8e5afd08e00e223a831b578") ocv_update(FFMPEG_FILE_HASH_BIN64 "4729c052cb0c53ab56e9a0eed91559df")
ocv_update(FFMPEG_FILE_HASH_CMAKE "3b90f67f4b429e77d3da36698cef700c") ocv_update(FFMPEG_FILE_HASH_CMAKE "3b90f67f4b429e77d3da36698cef700c")
function(download_win_ffmpeg script_var) function(download_win_ffmpeg script_var)
+122
View File
@@ -0,0 +1,122 @@
/**********************************************************************************
* Copyright (c) 2008-2009 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Materials.
*
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
**********************************************************************************/
#ifndef __OPENCL_CL_D3D11_EXT_H
#define __OPENCL_CL_D3D11_EXT_H
#include <d3d11.h>
#include <CL/cl.h>
#include <CL/cl_platform.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************
* cl_nv_d3d11_sharing */
typedef cl_uint cl_d3d11_device_source_nv;
typedef cl_uint cl_d3d11_device_set_nv;
/******************************************************************************/
// Error Codes
#define CL_INVALID_D3D11_DEVICE_NV -1006
#define CL_INVALID_D3D11_RESOURCE_NV -1007
#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_NV -1008
#define CL_D3D11_RESOURCE_NOT_ACQUIRED_NV -1009
// cl_d3d11_device_source_nv
#define CL_D3D11_DEVICE_NV 0x4019
#define CL_D3D11_DXGI_ADAPTER_NV 0x401A
// cl_d3d11_device_set_nv
#define CL_PREFERRED_DEVICES_FOR_D3D11_NV 0x401B
#define CL_ALL_DEVICES_FOR_D3D11_NV 0x401C
// cl_context_info
#define CL_CONTEXT_D3D11_DEVICE_NV 0x401D
// cl_mem_info
#define CL_MEM_D3D11_RESOURCE_NV 0x401E
// cl_image_info
#define CL_IMAGE_D3D11_SUBRESOURCE_NV 0x401F
// cl_command_type
#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_NV 0x4020
#define CL_COMMAND_RELEASE_D3D11_OBJECTS_NV 0x4021
/******************************************************************************/
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11NV_fn)(
cl_platform_id platform,
cl_d3d11_device_source_nv d3d_device_source,
void * d3d_object,
cl_d3d11_device_set_nv d3d_device_set,
cl_uint num_entries,
cl_device_id * devices,
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0;
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferNV_fn)(
cl_context context,
cl_mem_flags flags,
ID3D11Buffer * resource,
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DNV_fn)(
cl_context context,
cl_mem_flags flags,
ID3D11Texture2D * resource,
UINT subresource,
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DNV_fn)(
cl_context context,
cl_mem_flags flags,
ID3D11Texture3D * resource,
UINT subresource,
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsNV_fn)(
cl_command_queue command_queue,
cl_uint num_objects,
const cl_mem * mem_objects,
cl_uint num_events_in_wait_list,
const cl_event * event_wait_list,
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsNV_fn)(
cl_command_queue command_queue,
cl_uint num_objects,
cl_mem * mem_objects,
cl_uint num_events_in_wait_list,
const cl_event * event_wait_list,
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
#ifdef __cplusplus
}
#endif
#endif // __OPENCL_CL_D3D11_H
+7 -1
View File
@@ -196,6 +196,10 @@
# define ITT_ARCH_PPC64 5 # define ITT_ARCH_PPC64 5
#endif /* ITT_ARCH_PPC64 */ #endif /* ITT_ARCH_PPC64 */
#ifndef ITT_ARCH_AARCH64 /* 64-bit ARM */
# define ITT_ARCH_AARCH64 6
#endif /* ITT_ARCH_AARCH64 */
#ifndef ITT_ARCH #ifndef ITT_ARCH
# if defined _M_IX86 || defined __i386__ # if defined _M_IX86 || defined __i386__
# define ITT_ARCH ITT_ARCH_IA32 # define ITT_ARCH ITT_ARCH_IA32
@@ -205,6 +209,8 @@
# define ITT_ARCH ITT_ARCH_IA64 # define ITT_ARCH ITT_ARCH_IA64
# elif defined _M_ARM || defined __arm__ # elif defined _M_ARM || defined __arm__
# define ITT_ARCH ITT_ARCH_ARM # define ITT_ARCH ITT_ARCH_ARM
# elif defined __aarch64__
# define ITT_ARCH ITT_ARCH_AARCH64
# elif defined __powerpc64__ # elif defined __powerpc64__
# define ITT_ARCH ITT_ARCH_PPC64 # define ITT_ARCH ITT_ARCH_PPC64
# endif # endif
@@ -359,7 +365,7 @@ ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
: "memory"); : "memory");
return result; return result;
} }
#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64 #elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_AARCH64 || ITT_ARCH==ITT_ARCH_PPC64
#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val) #define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
#endif /* ITT_ARCH==ITT_ARCH_IA64 */ #endif /* ITT_ARCH==ITT_ARCH_IA64 */
#ifndef ITT_SIMPLE_INIT #ifndef ITT_SIMPLE_INIT
+6
View File
@@ -17,6 +17,12 @@
#if !defined(JAS_WIN_MSVC_BUILD) #if !defined(JAS_WIN_MSVC_BUILD)
/* A configure-based build is being used. */ /* A configure-based build is being used. */
#include <stdio.h>
// uClibc-ng workaround: https://github.com/opencv/opencv/pull/15279
#ifndef L_tmpnam
#define L_tmpnam 20
#endif
/* Extra debugging support */ /* Extra debugging support */
+39 -12
View File
@@ -2,11 +2,11 @@ project(${JPEG_LIBRARY} C)
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wsign-compare -Wshorten-64-to-32 -Wimplicit-fallthrough) ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wsign-compare -Wshorten-64-to-32 -Wimplicit-fallthrough)
set(VERSION_MAJOR 1) set(VERSION_MAJOR 2)
set(VERSION_MINOR 5) set(VERSION_MINOR 0)
set(VERSION_REVISION 3) set(VERSION_REVISION 2)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
set(LIBJPEG_TURBO_VERSION_NUMBER 1005003) set(LIBJPEG_TURBO_VERSION_NUMBER 2000002)
string(TIMESTAMP BUILD "opencv-${OPENCV_VERSION}-libjpeg-turbo") string(TIMESTAMP BUILD "opencv-${OPENCV_VERSION}-libjpeg-turbo")
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
@@ -18,16 +18,38 @@ message(STATUS "libjpeg-turbo: VERSION = ${VERSION}, BUILD = ${BUILD}")
option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE) option(WITH_ARITH_ENC "Include arithmetic encoding support when emulating the libjpeg v6b API/ABI" TRUE)
option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE) option(WITH_ARITH_DEC "Include arithmetic decoding support when emulating the libjpeg v6b API/ABI" TRUE)
if(NOT DEFINED SIZEOF_SIZE_T) include(CheckCSourceCompiles)
if(IOS) # Workaround iOS issues include(CheckIncludeFiles)
set(SIZEOF_SIZE_T "${CMAKE_SIZEOF_VOID_P}")
message(STATUS "SIZEOF_SIZE_T = ${SIZEOF_SIZE_T}")
else()
include(CheckTypeSize) include(CheckTypeSize)
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
check_type_size("size_t" SIZEOF_SIZE_T)
check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
if(SIZEOF_SIZE_T EQUAL SIZEOF_UNSIGNED_LONG)
check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }"
HAVE_BUILTIN_CTZL)
endif() endif()
if(MSVC)
check_include_files("intrin.h" HAVE_INTRIN_H)
endif() endif()
if(UNIX)
# Check for headers
check_include_files(locale.h HAVE_LOCALE_H)
check_include_files(stddef.h HAVE_STDDEF_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(sys/types.h NEED_SYS_TYPES_H)
# Other predefines
# undef NEED_BSD_STRINGS
ocv_update(HAVE_UNSIGNED_CHAR 1)
ocv_update(HAVE_UNSIGNED_SHORT 1)
# undef INCOMPLETE_TYPES_BROKEN
ocv_update(RIGHT_SHIFT_IS_UNSIGNED 0)
ocv_update(__CHAR_UNSIGNED__ 0)
endif()
set(BITS_IN_JSAMPLE 8) set(BITS_IN_JSAMPLE 8)
if(WITH_ARITH_ENC) if(WITH_ARITH_ENC)
@@ -47,15 +69,20 @@ if(MSVC)
add_definitions(-W3 -wd4996 -wd4018) add_definitions(-W3 -wd4996 -wd4018)
endif() endif()
if(WIN32)
configure_file(jconfig.h.win.in jconfig.h)
else()
configure_file(jconfig.h.in jconfig.h) configure_file(jconfig.h.in jconfig.h)
endif()
configure_file(jconfigint.h.in jconfigint.h) configure_file(jconfigint.h.in jconfigint.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c set(JPEG_SOURCES
jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c jcicc.c
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c jdmainct.c jdmarker.c
jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c
jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c
jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c) jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
+16 -23
View File
@@ -11,9 +11,10 @@ libjpeg-turbo is covered by three compatible BSD-style open source licenses:
- The Modified (3-clause) BSD License, which is listed below - The Modified (3-clause) BSD License, which is listed below
This license covers the TurboJPEG API library and associated programs. This license covers the TurboJPEG API library and associated programs, as
well as the build system.
- The zlib License, which is listed below - The [zlib License](https://opensource.org/licenses/Zlib)
This license is a subset of the other two, and it covers the libjpeg-turbo This license is a subset of the other two, and it covers the libjpeg-turbo
SIMD extensions. SIMD extensions.
@@ -65,7 +66,7 @@ best of our understanding.
2. If your binary distribution includes or uses the TurboJPEG API, then 2. If your binary distribution includes or uses the TurboJPEG API, then
your product documentation must include the text of the Modified BSD your product documentation must include the text of the Modified BSD
License. License (see below.)
**Origin** **Origin**
- Clause 2 of the Modified BSD License - Clause 2 of the Modified BSD License
@@ -90,7 +91,8 @@ best of our understanding.
The Modified (3-clause) BSD License The Modified (3-clause) BSD License
=================================== ===================================
Copyright (C)\<YEAR\> \<AUTHOR\>. All Rights Reserved. Copyright (C)2009-2019 D. R. Commander. 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
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
@@ -117,23 +119,14 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
The zlib License Why Three Licenses?
================ ===================
Copyright (C) \<YEAR\>, \<AUTHOR\>. The zlib License could have been used instead of the Modified (3-clause) BSD
License, and since the IJG License effectively subsumes the distribution
This software is provided 'as-is', without any express or implied conditions of the zlib License, this would have effectively placed
warranty. In no event will the authors be held liable for any damages libjpeg-turbo binary distributions under the IJG License. However, the IJG
arising from the use of this software. License specifically refers to the Independent JPEG Group and does not extend
attribution and endorsement protections to other entities. Thus, it was
Permission is granted to anyone to use this software for any purpose, desirable to choose a license that granted us the same protections for new code
including commercial applications, and to alter it and redistribute it that were granted to the IJG for code derived from their software.
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
+24 -26
View File
@@ -43,7 +43,7 @@ User documentation:
change.log Version-to-version change highlights. change.log Version-to-version change highlights.
Programmer and internal documentation: Programmer and internal documentation:
libjpeg.txt How to use the JPEG library in your own programs. libjpeg.txt How to use the JPEG library in your own programs.
example.c Sample code for calling the JPEG library. example.txt Sample code for calling the JPEG library.
structure.txt Overview of the JPEG library's internal structure. structure.txt Overview of the JPEG library's internal structure.
coderules.txt Coding style rules --- please read if you contribute code. coderules.txt Coding style rules --- please read if you contribute code.
@@ -159,12 +159,6 @@ commercial products, provided that all warranty or liability claims are
assumed by the product vendor. assumed by the product vendor.
The Unix configuration script "configure" was produced with GNU Autoconf.
It is copyright by the Free Software Foundation but is freely distributable.
The same holds for its supporting scripts (config.guess, config.sub,
ltmain.sh). Another support script, install-sh, is copyright by X Consortium
but is also freely distributable.
The IJG distribution formerly included code to read and write GIF files. The IJG distribution formerly included code to read and write GIF files.
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
support has been removed altogether, and the GIF writer has been simplified support has been removed altogether, and the GIF writer has been simplified
@@ -220,14 +214,14 @@ Continuous-tone Still Images, Part 2: Compliance testing" and has document
numbers ISO/IEC IS 10918-2, ITU-T T.83. numbers ISO/IEC IS 10918-2, ITU-T T.83.
The JPEG standard does not specify all details of an interchangeable file The JPEG standard does not specify all details of an interchangeable file
format. For the omitted details we follow the "JFIF" conventions, revision format. For the omitted details, we follow the "JFIF" conventions, revision
1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report 1.02. JFIF version 1 has been adopted as ISO/IEC 10918-5 (05/2013) and
and thus received a formal publication status. It is available as a free Recommendation ITU-T T.871 (05/2011): Information technology - Digital
download in PDF format from compression and coding of continuous-tone still images: JPEG File Interchange
http://www.ecma-international.org/publications/techreports/E-TR-098.htm. Format (JFIF). It is available as a free download in PDF file format from
A PostScript version of the JFIF document is available at https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871.
http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at A PDF file of the older JFIF 1.02 specification is available at
http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures. http://www.w3.org/Graphics/JPEG/jfif3.pdf.
The TIFF 6.0 file format specification can be obtained by FTP from The TIFF 6.0 file format specification can be obtained by FTP from
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
@@ -259,18 +253,22 @@ with body
send usenet/news.answers/jpeg-faq/part2 send usenet/news.answers/jpeg-faq/part2
FILE FORMAT WARS FILE FORMAT COMPATIBILITY
================ =========================
The ISO/IEC JTC1/SC29/WG1 standards committee (also known as JPEG, together This software implements ITU T.81 | ISO/IEC 10918 with some extensions from
with ITU-T SG16) currently promotes different formats containing the name ITU T.871 | ISO/IEC 10918-5 (JPEG File Interchange Format-- see REFERENCES).
"JPEG" which are incompatible with original DCT-based JPEG. IJG therefore does Informally, the term "JPEG image" or "JPEG file" most often refers to JFIF or
not support these formats (see REFERENCES). Indeed, one of the original a subset thereof, but there are other formats containing the name "JPEG" that
reasons for developing this free software was to help force convergence on are incompatible with the DCT-based JPEG standard or with JFIF (for instance,
common, interoperable format standards for JPEG files. JPEG 2000 and JPEG XR). This software therefore does not support these
Don't use an incompatible file format! formats. Indeed, one of the original reasons for developing this free software
(In any case, our decoder will remain capable of reading existing JPEG was to help force convergence on a common, interoperable format standard for
image files indefinitely.) JPEG files.
JFIF is a minimal or "low end" representation. TIFF/JPEG (TIFF revision 6.0 as
modified by TIFF Technical Note #2) can be used for "high end" applications
that need to record a lot of additional data about an image.
TO DO TO DO
+9 -4
View File
@@ -2,8 +2,9 @@ Background
========== ==========
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
NEON, AltiVec) to accelerate baseline JPEG compression and decompression on AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
x86, x86-64, ARM, and PowerPC systems. On such systems, libjpeg-turbo is 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 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 systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
virtue of its highly-optimized Huffman coding routines. In many cases, the virtue of its highly-optimized Huffman coding routines. In many cases, the
@@ -48,7 +49,10 @@ JPEG images:
straightforward to achieve using the underlying libjpeg API, such as straightforward to achieve using the underlying libjpeg API, such as
generating planar YUV images and performing multiple simultaneous lossless generating planar YUV images and performing multiple simultaneous lossless
transforms on an image. The Java interface for libjpeg-turbo is written on transforms on an image. The Java interface for libjpeg-turbo is written on
top of the TurboJPEG API. top of the TurboJPEG API. The TurboJPEG API is recommended for first-time
users of libjpeg-turbo. Refer to [tjexample.c](tjexample.c) and
[TJExample.java](java/TJExample.java) for examples of its usage and to
<http://libjpeg-turbo.org/Documentation/Documentation> for API documentation.
- **libjpeg API**<br> - **libjpeg API**<br>
This is the de facto industry-standard API for compressing and decompressing This is the de facto industry-standard API for compressing and decompressing
@@ -56,7 +60,8 @@ JPEG images:
more powerful. The libjpeg API implementation in libjpeg-turbo is both more powerful. The libjpeg API implementation in libjpeg-turbo is both
API/ABI-compatible and mathematically compatible with libjpeg v6b. It can API/ABI-compatible and mathematically compatible with libjpeg v6b. It can
also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8 also optionally be configured to be API/ABI-compatible with libjpeg v7 and v8
(see below.) (see below.) Refer to [cjpeg.c](cjpeg.c) and [djpeg.c](djpeg.c) for examples
of its usage and to [libjpeg.txt](libjpeg.txt) for API documentation.
There is no significant performance advantage to either API when both are used There is no significant performance advantage to either API when both are used
to perform similar operations. to perform similar operations.
+54 -34
View File
@@ -1,12 +1,25 @@
/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */ /* Version ID for the JPEG library.
/* see jconfig.txt for explanations */ * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
*/
#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@ #define JPEG_LIB_VERSION @JPEG_LIB_VERSION@
/* libjpeg-turbo version */
#define LIBJPEG_TURBO_VERSION @VERSION@ #define LIBJPEG_TURBO_VERSION @VERSION@
/* libjpeg-turbo version in integer form */
#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@ #define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
#cmakedefine C_ARITH_CODING_SUPPORTED
#cmakedefine D_ARITH_CODING_SUPPORTED /* Support arithmetic encoding */
#cmakedefine MEM_SRCDST_SUPPORTED #cmakedefine C_ARITH_CODING_SUPPORTED 1
/* Support arithmetic decoding */
#cmakedefine D_ARITH_CODING_SUPPORTED 1
/* Support in-memory source/destination managers */
#cmakedefine MEM_SRCDST_SUPPORTED 1
/* Use accelerated SIMD routines. */
#cmakedefine WITH_SIMD 1
/* /*
* Define BITS_IN_JSAMPLE as either * Define BITS_IN_JSAMPLE as either
@@ -19,35 +32,42 @@
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */ #define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
#define HAVE_UNSIGNED_CHAR /* Define to 1 if you have the <locale.h> header file. */
#define HAVE_UNSIGNED_SHORT #cmakedefine HAVE_LOCALE_H 1
/* #define void char */
/* #define const */
#undef __CHAR_UNSIGNED__
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */
#undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, per Windows custom */ /* Define to 1 if you have the <stddef.h> header file. */
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ #cmakedefine HAVE_STDDEF_H 1
typedef unsigned char boolean;
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
/* Define if you need to include <sys/types.h> to get size_t. */
#cmakedefine NEED_SYS_TYPES_H 1
/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
memset/memcpy in <string.h>. */
#cmakedefine NEED_BSD_STRINGS 1
/* Define to 1 if the system has the type `unsigned char'. */
#cmakedefine HAVE_UNSIGNED_CHAR 1
/* Define to 1 if the system has the type `unsigned short'. */
#cmakedefine HAVE_UNSIGNED_SHORT 1
/* Compiler does not support pointers to undefined structures. */
#cmakedefine INCOMPLETE_TYPES_BROKEN 1
/* Define if your (broken) compiler shifts signed values as if they were
unsigned. */
#cmakedefine RIGHT_SHIFT_IS_UNSIGNED 1
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#cmakedefine __CHAR_UNSIGNED__ 1
#endif #endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
/* Define "INT32" as int, not long, per Windows custom */ /* Define to empty if `const' does not conform to ANSI C. */
#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */ /* #undef const */
typedef short INT16;
typedef signed int INT32;
#endif
#define XMD_H /* prevent jmorecfg.h from redefining it */
#ifdef JPEG_INTERNALS /* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
#undef RIGHT_SHIFT_IS_UNSIGNED
#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
#endif /* JPEG_INTERNALS */
+34
View File
@@ -0,0 +1,34 @@
#define JPEG_LIB_VERSION @JPEG_LIB_VERSION@
#define LIBJPEG_TURBO_VERSION @VERSION@
#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
#cmakedefine C_ARITH_CODING_SUPPORTED
#cmakedefine D_ARITH_CODING_SUPPORTED
#cmakedefine MEM_SRCDST_SUPPORTED
#cmakedefine WITH_SIMD
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#undef NEED_SYS_TYPES_H
#undef NEED_BSD_STRINGS
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_SHORT
#undef INCOMPLETE_TYPES_BROKEN
#undef RIGHT_SHIFT_IS_UNSIGNED
#undef __CHAR_UNSIGNED__
/* Define "boolean" as unsigned char, not int, per Windows custom */
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
/* Define "INT32" as int, not long, per Windows custom */
#if !(defined(_BASETSD_H_) || defined(_BASETSD_H)) /* don't conflict if basetsd.h already read */
typedef short INT16;
typedef signed int INT32;
#endif
#define XMD_H /* prevent jmorecfg.h from redefining it */
+28 -2
View File
@@ -1,7 +1,10 @@
#define VERSION "@VERSION@" /* libjpeg-turbo build number */
#define BUILD "@BUILD@" #define BUILD "@BUILD@"
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
/* Compiler's inline keyword */
#undef inline
/* How to obtain function inlining. */
#ifndef INLINE #ifndef INLINE
#if defined(__GNUC__) #if defined(__GNUC__)
#define INLINE inline __attribute__((always_inline)) #define INLINE inline __attribute__((always_inline))
@@ -11,3 +14,26 @@
#define INLINE #define INLINE
#endif #endif
#endif #endif
/* Define to the full name of this package. */
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
/* Version number of package */
#define VERSION "@VERSION@"
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
/* Define if your compiler has __builtin_ctzl() and sizeof(unsigned long) == sizeof(size_t). */
#cmakedefine HAVE_BUILTIN_CTZL
/* Define to 1 if you have the <intrin.h> header file. */
#cmakedefine HAVE_INTRIN_H
#if defined(_MSC_VER) && defined(HAVE_INTRIN_H)
#if (SIZEOF_SIZE_T == 8)
#define HAVE_BITSCANFORWARD64
#elif (SIZEOF_SIZE_T == 4)
#define HAVE_BITSCANFORWARD
#endif
#endif
+6 -5
View File
@@ -4,16 +4,16 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Developed 1997-2009 by Guido Vollbeding. * Developed 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander. * Copyright (C) 2015, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
* This file contains probability estimation tables for common use in * This file contains probability estimation tables for common use in
* arithmetic entropy encoding and decoding routines. * arithmetic entropy encoding and decoding routines.
* *
* This data represents Table D.2 in the JPEG spec (ISO/IEC IS 10918-1 * This data represents Table D.2 in
* and CCITT Recommendation ITU-T T.81) and Table 24 in the JBIG spec * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994 and Table 24 in
* (ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82). * Recommendation ITU-T T.82 (1993) | ISO/IEC 11544:1993.
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -29,7 +29,8 @@
* implementation (jbig_tab.c). * implementation (jbig_tab.c).
*/ */
#define V(i,a,b,c,d) (((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b) #define V(i, a, b, c, d) \
(((JLONG)a << 16) | ((JLONG)c << 8) | ((JLONG)d << 7) | b)
const JLONG jpeg_aritab[113 + 1] = { const JLONG jpeg_aritab[113 + 1] = {
/* /*
+2 -2
View File
@@ -204,8 +204,8 @@ jpeg_finish_compress (j_compress_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_write_marker (j_compress_ptr cinfo, int marker, jpeg_write_marker(j_compress_ptr cinfo, int marker, const JOCTET *dataptr,
const JOCTET *dataptr, unsigned int datalen) unsigned int datalen)
{ {
void (*write_marker_byte) (j_compress_ptr info, int val); void (*write_marker_byte) (j_compress_ptr info, int val);
+9 -5
View File
@@ -4,16 +4,19 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Developed 1997-2009 by Guido Vollbeding. * Developed 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander. * Copyright (C) 2015, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
* This file contains portable arithmetic entropy encoding routines for JPEG * This file contains portable arithmetic entropy encoding routines for JPEG
* (implementing the ISO/IEC IS 10918-1 and CCITT Recommendation ITU-T T.81). * (implementing Recommendation ITU-T T.81 | ISO/IEC 10918-1).
* *
* Both sequential and progressive modes are supported in this single module. * Both sequential and progressive modes are supported in this single module.
* *
* Suspension is not currently supported in this module. * Suspension is not currently supported in this module.
*
* NOTE: All referenced figures are from
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -142,13 +145,13 @@ finish_pass (j_compress_ptr cinfo)
/* Find the e->c in the coding interval with the largest /* Find the e->c in the coding interval with the largest
* number of trailing zero bits */ * number of trailing zero bits */
if ((temp = (e->a - 1 + e->c) & 0xFFFF0000L) < e->c) if ((temp = (e->a - 1 + e->c) & 0xFFFF0000UL) < e->c)
e->c = temp + 0x8000L; e->c = temp + 0x8000L;
else else
e->c = temp; e->c = temp;
/* Send remaining bytes to output */ /* Send remaining bytes to output */
e->c <<= e->ct; e->c <<= e->ct;
if (e->c & 0xF8000000L) { if (e->c & 0xF8000000UL) {
/* One final overflow has to be handled */ /* One final overflow has to be handled */
if (e->buffer >= 0) { if (e->buffer >= 0) {
if (e->zc) if (e->zc)
@@ -881,7 +884,8 @@ start_pass (j_compress_ptr cinfo, boolean gather_statistics)
#ifdef CALCULATE_SPECTRAL_CONDITIONING #ifdef CALCULATE_SPECTRAL_CONDITIONING
if (cinfo->progressive_mode) if (cinfo->progressive_mode)
/* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */ /* Section G.1.3.2: Set appropriate arithmetic conditioning value Kx */
cinfo->arith_ac_K[tbl] = cinfo->Ss + ((8 + cinfo->Se - cinfo->Ss) >> 4); cinfo->arith_ac_K[tbl] = cinfo->Ss +
((8 + cinfo->Se - cinfo->Ss) >> 4);
#endif #endif
} }
} }
+10 -10
View File
@@ -58,13 +58,11 @@ typedef my_coef_controller *my_coef_ptr;
/* Forward declarations */ /* Forward declarations */
METHODDEF(boolean) compress_data METHODDEF(boolean) compress_data(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
#ifdef FULL_COEF_BUFFER_SUPPORTED #ifdef FULL_COEF_BUFFER_SUPPORTED
METHODDEF(boolean) compress_first_pass METHODDEF(boolean) compress_first_pass(j_compress_ptr cinfo,
(j_compress_ptr cinfo, JSAMPIMAGE input_buf); JSAMPIMAGE input_buf);
METHODDEF(boolean) compress_output METHODDEF(boolean) compress_output(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
(j_compress_ptr cinfo, JSAMPIMAGE input_buf);
#endif #endif
@@ -167,8 +165,8 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
blkn = 0; blkn = 0;
for (ci = 0; ci < cinfo->comps_in_scan; ci++) { for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci]; compptr = cinfo->cur_comp_info[ci];
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
: compptr->last_col_width; compptr->last_col_width;
xpos = MCU_col_num * compptr->MCU_sample_width; xpos = MCU_col_num * compptr->MCU_sample_width;
ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
for (yindex = 0; yindex < compptr->MCU_height; yindex++) { for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
@@ -183,7 +181,8 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
jzero_far((void *)coef->MCU_buffer[blkn + blockcnt], jzero_far((void *)coef->MCU_buffer[blkn + blockcnt],
(compptr->MCU_width - blockcnt) * sizeof(JBLOCK)); (compptr->MCU_width - blockcnt) * sizeof(JBLOCK));
for (bi = blockcnt; bi < compptr->MCU_width; bi++) { for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; coef->MCU_buffer[blkn + bi][0][0] =
coef->MCU_buffer[blkn + bi - 1][0][0];
} }
} }
} else { } else {
@@ -191,7 +190,8 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
jzero_far((void *)coef->MCU_buffer[blkn], jzero_far((void *)coef->MCU_buffer[blkn],
compptr->MCU_width * sizeof(JBLOCK)); compptr->MCU_width * sizeof(JBLOCK));
for (bi = 0; bi < compptr->MCU_width; bi++) { for (bi = 0; bi < compptr->MCU_width; bi++) {
coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; coef->MCU_buffer[blkn + bi][0][0] =
coef->MCU_buffer[blkn - 1][0][0];
} }
} }
blkn += compptr->MCU_width; blkn += compptr->MCU_width;
+17 -21
View File
@@ -29,9 +29,9 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_ycc_convert_internal (j_compress_ptr cinfo, rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b; register int r, g, b;
@@ -58,17 +58,14 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
* need the general RIGHT_SHIFT macro. * need the general RIGHT_SHIFT macro.
*/ */
/* Y */ /* Y */
outptr0[col] = (JSAMPLE) outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cb */ /* Cb */
outptr1[col] = (JSAMPLE) outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) ctab[b + B_CB_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cr */ /* Cr */
outptr2[col] = (JSAMPLE) outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) ctab[b + B_CR_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
@@ -86,9 +83,9 @@ rgb_ycc_convert_internal (j_compress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_gray_convert_internal (j_compress_ptr cinfo, rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b; register int r, g, b;
@@ -108,9 +105,8 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
b = GETJSAMPLE(inptr[RGB_BLUE]); b = GETJSAMPLE(inptr[RGB_BLUE]);
inptr += RGB_PIXELSIZE; inptr += RGB_PIXELSIZE;
/* Y */ /* Y */
outptr[col] = (JSAMPLE) outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
@@ -123,9 +119,9 @@ rgb_gray_convert_internal (j_compress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb_convert_internal (j_compress_ptr cinfo, rgb_rgb_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
register JSAMPROW inptr; register JSAMPROW inptr;
register JSAMPROW outptr0, outptr1, outptr2; register JSAMPROW outptr0, outptr1, outptr2;
+17 -26
View File
@@ -231,9 +231,8 @@ rgb_ycc_start (j_compress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
rgb_ycc_convert (j_compress_ptr cinfo, rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
switch (cinfo->in_color_space) { switch (cinfo->in_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -280,9 +279,8 @@ rgb_ycc_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
rgb_gray_convert (j_compress_ptr cinfo, rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
switch (cinfo->in_color_space) { switch (cinfo->in_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -326,9 +324,8 @@ rgb_gray_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
rgb_rgb_convert (j_compress_ptr cinfo, rgb_rgb_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
switch (cinfo->in_color_space) { switch (cinfo->in_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -376,9 +373,8 @@ rgb_rgb_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
cmyk_ycck_convert (j_compress_ptr cinfo, cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b; register int r, g, b;
@@ -408,17 +404,14 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
* need the general RIGHT_SHIFT macro. * need the general RIGHT_SHIFT macro.
*/ */
/* Y */ /* Y */
outptr0[col] = (JSAMPLE) outptr0[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cb */ /* Cb */
outptr1[col] = (JSAMPLE) outptr1[col] = (JSAMPLE)((ctab[r + R_CB_OFF] + ctab[g + G_CB_OFF] +
((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF]) ctab[b + B_CB_OFF]) >> SCALEBITS);
>> SCALEBITS);
/* Cr */ /* Cr */
outptr2[col] = (JSAMPLE) outptr2[col] = (JSAMPLE)((ctab[r + R_CR_OFF] + ctab[g + G_CR_OFF] +
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF]) ctab[b + B_CR_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
@@ -431,9 +424,8 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
grayscale_convert (j_compress_ptr cinfo, grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)
JDIMENSION output_row, int num_rows)
{ {
register JSAMPROW inptr; register JSAMPROW inptr;
register JSAMPROW outptr; register JSAMPROW outptr;
@@ -460,8 +452,7 @@ grayscale_convert (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
null_convert (j_compress_ptr cinfo, null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows) JDIMENSION output_row, int num_rows)
{ {
register JSAMPROW inptr; register JSAMPROW inptr;
+5 -5
View File
@@ -489,8 +489,7 @@ quantize (JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
METHODDEF(void) METHODDEF(void)
forward_DCT(j_compress_ptr cinfo, jpeg_component_info *compptr, forward_DCT(j_compress_ptr cinfo, jpeg_component_info *compptr,
JSAMPARRAY sample_data, JBLOCKROW coef_blocks, JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
JDIMENSION start_row, JDIMENSION start_col, JDIMENSION start_row, JDIMENSION start_col, JDIMENSION num_blocks)
JDIMENSION num_blocks)
/* This version is used for integer DCT implementations. */ /* This version is used for integer DCT implementations. */
{ {
/* This routine is heavily used, so it's worth coding it tightly. */ /* This routine is heavily used, so it's worth coding it tightly. */
@@ -522,9 +521,9 @@ forward_DCT (j_compress_ptr cinfo, jpeg_component_info *compptr,
#ifdef DCT_FLOAT_SUPPORTED #ifdef DCT_FLOAT_SUPPORTED
METHODDEF(void) METHODDEF(void)
convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *workspace) convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
FAST_FLOAT *workspace)
{ {
register FAST_FLOAT *workspaceptr; register FAST_FLOAT *workspaceptr;
register JSAMPROW elemptr; register JSAMPROW elemptr;
@@ -555,7 +554,8 @@ convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col, FAST_FLOAT *worksp
METHODDEF(void) METHODDEF(void)
quantize_float (JCOEFPTR coef_block, FAST_FLOAT *divisors, FAST_FLOAT *workspace) quantize_float(JCOEFPTR coef_block, FAST_FLOAT *divisors,
FAST_FLOAT *workspace)
{ {
register FAST_FLOAT temp; register FAST_FLOAT temp;
register int i; register int i;
+29 -28
View File
@@ -4,7 +4,7 @@
* 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-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, 2014-2016, D. R. Commander. * Copyright (C) 2009-2011, 2014-2016, 2018, D. R. Commander.
* Copyright (C) 2015, Matthieu Darbois. * Copyright (C) 2015, Matthieu Darbois.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
@@ -16,6 +16,9 @@
* back up to the start of the current MCU. To do this, we copy state * back up to the start of the current MCU. To do this, we copy state
* variables into local working storage, and update them back to the * variables into local working storage, and update them back to the
* permanent JPEG objects only upon successful completion of an MCU. * permanent JPEG objects only upon successful completion of an MCU.
*
* NOTE: All referenced figures are from
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -55,10 +58,6 @@
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x) #define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
#endif #endif
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#endif
/* Expanded entropy encoder object for Huffman encoding. /* Expanded entropy encoder object for Huffman encoding.
* *
@@ -310,11 +309,12 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
/* Outputting bytes to the file */ /* Outputting bytes to the file */
/* Emit a byte, taking 'action' if must suspend. */ /* Emit a byte, taking 'action' if must suspend. */
#define emit_byte(state,val,action) \ #define emit_byte(state, val, action) { \
{ *(state)->next_output_byte++ = (JOCTET) (val); \ *(state)->next_output_byte++ = (JOCTET)(val); \
if (--(state)->free_in_buffer == 0) \ if (--(state)->free_in_buffer == 0) \
if (!dump_buffer(state)) \ if (!dump_buffer(state)) \
{ action; } } { action; } \
}
LOCAL(boolean) LOCAL(boolean)
@@ -434,8 +434,8 @@ dump_buffer (working_state *state)
if (state->free_in_buffer < BUFSIZE) { \ if (state->free_in_buffer < BUFSIZE) { \
localbuf = 1; \ localbuf = 1; \
buffer = _buffer; \ buffer = _buffer; \
} \ } else \
else buffer = state->next_output_byte; \ buffer = state->next_output_byte; \
} }
#define STORE_BUFFER() { \ #define STORE_BUFFER() { \
@@ -443,7 +443,7 @@ dump_buffer (working_state *state)
bytes = buffer - _buffer; \ bytes = buffer - _buffer; \
buffer = _buffer; \ buffer = _buffer; \
while (bytes > 0) { \ while (bytes > 0) { \
bytestocopy = min(bytes, state->free_in_buffer); \ bytestocopy = MIN(bytes, state->free_in_buffer); \
MEMCOPY(state->next_output_byte, buffer, bytestocopy); \ MEMCOPY(state->next_output_byte, buffer, bytestocopy); \
state->next_output_byte += bytestocopy; \ state->next_output_byte += bytestocopy; \
buffer += bytestocopy; \ buffer += bytestocopy; \
@@ -452,8 +452,7 @@ dump_buffer (working_state *state)
if (!dump_buffer(state)) return FALSE; \ if (!dump_buffer(state)) return FALSE; \
bytes -= bytestocopy; \ bytes -= bytestocopy; \
} \ } \
} \ } else { \
else { \
state->free_in_buffer -= (buffer - state->next_output_byte); \ state->free_in_buffer -= (buffer - state->next_output_byte); \
state->next_output_byte = buffer; \ state->next_output_byte = buffer; \
} \ } \
@@ -863,13 +862,14 @@ encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
* one bits (so that padding bits added at the end of a compressed segment * one bits (so that padding bits added at the end of a compressed segment
* can't look like a valid code). Because of the canonical ordering of * can't look like a valid code). Because of the canonical ordering of
* codewords, this just means that there must be an unused slot in the * codewords, this just means that there must be an unused slot in the
* longest codeword length category. Section K.2 of the JPEG spec suggests * longest codeword length category. Annex K (Clause K.2) of
* reserving such a slot by pretending that symbol 256 is a valid symbol * Rec. ITU-T T.81 (1992) | ISO/IEC 10918-1:1994 suggests reserving such a slot
* with count 1. In theory that's not optimal; giving it count zero but * by pretending that symbol 256 is a valid symbol with count 1. In theory
* including it in the symbol set anyway should give a better Huffman code. * that's not optimal; giving it count zero but including it in the symbol set
* But the theoretically better code actually seems to come out worse in * anyway should give a better Huffman code. But the theoretically better code
* practice, because it produces more all-ones bytes (which incur stuffed * actually seems to come out worse in practice, because it produces more
* zero bytes in the final file). In any case the difference is tiny. * all-ones bytes (which incur stuffed zero bytes in the final file). In any
* case the difference is tiny.
* *
* The JPEG standard requires Huffman codes to be no more than 16 bits long. * The JPEG standard requires Huffman codes to be no more than 16 bits long.
* If some symbols have a very small but nonzero probability, the Huffman tree * If some symbols have a very small but nonzero probability, the Huffman tree
@@ -971,13 +971,13 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
/* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
* Huffman procedure assigned any such lengths, we must adjust the coding. * Huffman procedure assigned any such lengths, we must adjust the coding.
* Here is what the JPEG spec says about how this next bit works: * Here is what Rec. ITU-T T.81 | ISO/IEC 10918-1 says about how this next
* Since symbols are paired for the longest Huffman code, the symbols are * bit works: Since symbols are paired for the longest Huffman code, the
* removed from this length category two at a time. The prefix for the pair * symbols are removed from this length category two at a time. The prefix
* (which is one bit shorter) is allocated to one of the pair; then, * for the pair (which is one bit shorter) is allocated to one of the pair;
* skipping the BITS entry for that prefix length, a code word from the next * then, skipping the BITS entry for that prefix length, a code word from the
* shortest nonzero BITS entry is converted into a prefix for two code words * next shortest nonzero BITS entry is converted into a prefix for two code
* one bit longer. * words one bit longer.
*/ */
for (i = MAX_CLEN; i > 16; i--) { for (i = MAX_CLEN; i > 16; i--) {
@@ -1003,7 +1003,8 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[])
/* Return a list of the symbols sorted by code length */ /* Return a list of the symbols sorted by code length */
/* It's not real clear to me why we don't need to consider the codelength /* It's not real clear to me why we don't need to consider the codelength
* changes made above, but the JPEG spec seems to think this works. * changes made above, but Rec. ITU-T T.81 | ISO/IEC 10918-1 seems to think
* this works.
*/ */
p = 0; p = 0;
for (i = 1; i <= MAX_CLEN; i++) { for (i = 1; i <= MAX_CLEN; i++) {
+4 -5
View File
@@ -34,10 +34,9 @@ typedef struct {
} c_derived_tbl; } c_derived_tbl;
/* Expand a Huffman table definition into the derived format */ /* Expand a Huffman table definition into the derived format */
EXTERN(void) jpeg_make_c_derived_tbl EXTERN(void) jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC,
(j_compress_ptr cinfo, boolean isDC, int tblno, int tblno, c_derived_tbl **pdtbl);
c_derived_tbl ** pdtbl);
/* Generate an optimal table definition given the specified counts */ /* Generate an optimal table definition given the specified counts */
EXTERN(void) jpeg_gen_optimal_table EXTERN(void) jpeg_gen_optimal_table(j_compress_ptr cinfo, JHUFF_TBL *htbl,
(j_compress_ptr cinfo, JHUFF_TBL *htbl, long freq[]); long freq[]);
+105
View File
@@ -0,0 +1,105 @@
/*
* jcicc.c
*
* Copyright (C) 1997-1998, Thomas G. Lane, Todd Newman.
* Copyright (C) 2017, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
* This file provides code to write International Color Consortium (ICC) device
* profiles embedded in JFIF JPEG image files. The ICC has defined a standard
* for including such data in JPEG "APP2" markers. The code given here does
* not know anything about the internal structure of the ICC profile data; it
* just knows how to embed the profile data in a JPEG file while writing it.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jerror.h"
/*
* Since an ICC profile can be larger than the maximum size of a JPEG marker
* (64K), we need provisions to split it into multiple markers. The format
* defined by the ICC specifies one or more APP2 markers containing the
* following data:
* Identifying string ASCII "ICC_PROFILE\0" (12 bytes)
* Marker sequence number 1 for first APP2, 2 for next, etc (1 byte)
* Number of markers Total number of APP2's used (1 byte)
* Profile data (remainder of APP2 data)
* Decoders should use the marker sequence numbers to reassemble the profile,
* rather than assuming that the APP2 markers appear in the correct sequence.
*/
#define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */
#define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */
#define MAX_BYTES_IN_MARKER 65533 /* maximum data len of a JPEG marker */
#define MAX_DATA_BYTES_IN_MARKER (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
/*
* This routine writes the given ICC profile data into a JPEG file. It *must*
* be called AFTER calling jpeg_start_compress() and BEFORE the first call to
* jpeg_write_scanlines(). (This ordering ensures that the APP2 marker(s) will
* appear after the SOI and JFIF or Adobe markers, but before all else.)
*/
GLOBAL(void)
jpeg_write_icc_profile(j_compress_ptr cinfo, const JOCTET *icc_data_ptr,
unsigned int icc_data_len)
{
unsigned int num_markers; /* total number of markers we'll write */
int cur_marker = 1; /* per spec, counting starts at 1 */
unsigned int length; /* number of bytes to write in this marker */
if (icc_data_ptr == NULL || icc_data_len == 0)
ERREXIT(cinfo, JERR_BUFFER_SIZE);
if (cinfo->global_state < CSTATE_SCANNING)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Calculate the number of markers we'll need, rounding up of course */
num_markers = icc_data_len / MAX_DATA_BYTES_IN_MARKER;
if (num_markers * MAX_DATA_BYTES_IN_MARKER != icc_data_len)
num_markers++;
while (icc_data_len > 0) {
/* length of profile to put in this marker */
length = icc_data_len;
if (length > MAX_DATA_BYTES_IN_MARKER)
length = MAX_DATA_BYTES_IN_MARKER;
icc_data_len -= length;
/* Write the JPEG marker header (APP2 code and marker length) */
jpeg_write_m_header(cinfo, ICC_MARKER,
(unsigned int)(length + ICC_OVERHEAD_LEN));
/* Write the marker identifying string "ICC_PROFILE" (null-terminated). We
* code it in this less-than-transparent way so that the code works even if
* the local character set is not ASCII.
*/
jpeg_write_m_byte(cinfo, 0x49);
jpeg_write_m_byte(cinfo, 0x43);
jpeg_write_m_byte(cinfo, 0x43);
jpeg_write_m_byte(cinfo, 0x5F);
jpeg_write_m_byte(cinfo, 0x50);
jpeg_write_m_byte(cinfo, 0x52);
jpeg_write_m_byte(cinfo, 0x4F);
jpeg_write_m_byte(cinfo, 0x46);
jpeg_write_m_byte(cinfo, 0x49);
jpeg_write_m_byte(cinfo, 0x4C);
jpeg_write_m_byte(cinfo, 0x45);
jpeg_write_m_byte(cinfo, 0x0);
/* Add the sequencing info */
jpeg_write_m_byte(cinfo, cur_marker);
jpeg_write_m_byte(cinfo, (int)num_markers);
/* Add the profile data */
while (length--) {
jpeg_write_m_byte(cinfo, *icc_data_ptr);
icc_data_ptr++;
}
cur_marker++;
}
}
+2 -2
View File
@@ -60,8 +60,8 @@ jinit_compress_master (j_compress_ptr cinfo)
} }
/* Need a full-image coefficient buffer in any multi-pass mode. */ /* Need a full-image coefficient buffer in any multi-pass mode. */
jinit_c_coef_controller(cinfo, jinit_c_coef_controller(cinfo, (boolean)(cinfo->num_scans > 1 ||
(boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding)); cinfo->optimize_coding));
jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */); jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
jinit_marker_writer(cinfo); jinit_marker_writer(cinfo);
+8 -8
View File
@@ -39,8 +39,9 @@ typedef my_main_controller *my_main_ptr;
/* Forward declarations */ /* Forward declarations */
METHODDEF(void) process_data_simple_main METHODDEF(void) process_data_simple_main(j_compress_ptr cinfo,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JSAMPARRAY input_buf,
JDIMENSION *in_row_ctr,
JDIMENSION in_rows_avail); JDIMENSION in_rows_avail);
@@ -75,18 +76,17 @@ start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
METHODDEF(void) METHODDEF(void)
process_data_simple_main (j_compress_ptr cinfo, process_data_simple_main(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)
JDIMENSION in_rows_avail)
{ {
my_main_ptr main_ptr = (my_main_ptr)cinfo->main; my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) { while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
/* Read input data if we haven't filled the main buffer yet */ /* Read input data if we haven't filled the main buffer yet */
if (main_ptr->rowgroup_ctr < DCTSIZE) if (main_ptr->rowgroup_ctr < DCTSIZE)
(*cinfo->prep->pre_process_data) (cinfo, (*cinfo->prep->pre_process_data) (cinfo, input_buf, in_row_ctr,
input_buf, in_row_ctr, in_rows_avail, in_rows_avail, main_ptr->buffer,
main_ptr->buffer, &main_ptr->rowgroup_ctr, &main_ptr->rowgroup_ctr,
(JDIMENSION)DCTSIZE); (JDIMENSION)DCTSIZE);
/* If we don't have a full iMCU row buffered, return to application for /* If we don't have a full iMCU row buffered, return to application for
+1 -2
View File
@@ -296,8 +296,7 @@ emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */ emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
/* Make sure image isn't bigger than SOF field can handle */ /* Make sure image isn't bigger than SOF field can handle */
if ((long) cinfo->_jpeg_height > 65535L || if ((long)cinfo->_jpeg_height > 65535L || (long)cinfo->_jpeg_width > 65535L)
(long) cinfo->_jpeg_width > 65535L)
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535); ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)65535);
emit_byte(cinfo, cinfo->data_precision); emit_byte(cinfo, cinfo->data_precision);
+11 -10
View File
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2010 by Guido Vollbeding. * Modified 2003-2010 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2010, 2016, D. R. Commander. * Copyright (C) 2010, 2016, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -95,8 +95,8 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
#endif #endif
/* Sanity check on image dimensions */ /* Sanity check on image dimensions */
if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 if (cinfo->_jpeg_height <= 0 || cinfo->_jpeg_width <= 0 ||
|| cinfo->num_components <= 0 || cinfo->input_components <= 0) cinfo->num_components <= 0 || cinfo->input_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE); ERREXIT(cinfo, JERR_EMPTY_IMAGE);
/* Make sure image isn't bigger than I can handle */ /* Make sure image isn't bigger than I can handle */
@@ -124,8 +124,10 @@ initial_setup (j_compress_ptr cinfo, boolean transcode_only)
cinfo->max_v_samp_factor = 1; cinfo->max_v_samp_factor = 1;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || if (compptr->h_samp_factor <= 0 ||
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) compptr->h_samp_factor > MAX_SAMP_FACTOR ||
compptr->v_samp_factor <= 0 ||
compptr->v_samp_factor > MAX_SAMP_FACTOR)
ERREXIT(cinfo, JERR_BAD_SAMPLING); ERREXIT(cinfo, JERR_BAD_SAMPLING);
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
compptr->h_samp_factor); compptr->h_samp_factor);
@@ -232,9 +234,9 @@ validate_script (j_compress_ptr cinfo)
Al = scanptr->Al; Al = scanptr->Al;
if (cinfo->progressive_mode) { if (cinfo->progressive_mode) {
#ifdef C_PROGRESSIVE_SUPPORTED #ifdef C_PROGRESSIVE_SUPPORTED
/* The JPEG spec simply gives the ranges 0..13 for Ah and Al, but that /* Rec. ITU-T T.81 | ISO/IEC 10918-1 simply gives the ranges 0..13 for Ah
* seems wrong: the upper bound ought to depend on data precision. * and Al, but that seems wrong: the upper bound ought to depend on data
* Perhaps they really meant 0..N+1 for N-bit precision. * precision. Perhaps they really meant 0..N+1 for N-bit precision.
* Here we allow 0..10 for 8-bit data; Al larger than 10 results in * Here we allow 0..10 for 8-bit data; Al larger than 10 results in
* out-of-range reconstructed DC values during the first DC scan, * out-of-range reconstructed DC values during the first DC scan,
* which might cause problems for some decoders. * which might cause problems for some decoders.
@@ -331,8 +333,7 @@ select_scan_parameters (j_compress_ptr cinfo)
cinfo->Se = scanptr->Se; cinfo->Se = scanptr->Se;
cinfo->Ah = scanptr->Ah; cinfo->Ah = scanptr->Ah;
cinfo->Al = scanptr->Al; cinfo->Al = scanptr->Al;
} } else
else
#endif #endif
{ {
/* Prepare for single sequential-JPEG scan containing all components */ /* Prepare for single sequential-JPEG scan containing all components */
+7 -8
View File
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2003-2008 by Guido Vollbeding. * Modified 2003-2008 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, D. R. Commander. * Copyright (C) 2009-2011, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -26,8 +26,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl, jpeg_add_quant_table(j_compress_ptr cinfo, int which_tbl,
const unsigned int *basic_table, const unsigned int *basic_table, int scale_factor,
int scale_factor, boolean force_baseline) boolean force_baseline)
/* Define a quantization table equal to the basic_table times /* Define a quantization table equal to the basic_table times
* a scale factor (given as a percentage). * a scale factor (given as a percentage).
* If force_baseline is TRUE, the computed quantization table entries * If force_baseline is TRUE, the computed quantization table entries
@@ -65,7 +65,8 @@ jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
} }
/* These are the sample quantization tables given in JPEG spec section K.1. /* These are the sample quantization tables given in Annex K (Clause K.1) of
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
* The spec says that the values given produce "good" quality, and * The spec says that the values given produce "good" quality, and
* when divided by 2, "very good" quality. * when divided by 2, "very good" quality.
*/ */
@@ -404,8 +405,7 @@ jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
#ifdef C_PROGRESSIVE_SUPPORTED #ifdef C_PROGRESSIVE_SUPPORTED
LOCAL(jpeg_scan_info *) LOCAL(jpeg_scan_info *)
fill_a_scan (jpeg_scan_info *scanptr, int ci, fill_a_scan(jpeg_scan_info *scanptr, int ci, int Ss, int Se, int Ah, int Al)
int Ss, int Se, int Ah, int Al)
/* Support routine: generate one scan for specified component */ /* Support routine: generate one scan for specified component */
{ {
scanptr->comps_in_scan = 1; scanptr->comps_in_scan = 1;
@@ -419,8 +419,7 @@ fill_a_scan (jpeg_scan_info *scanptr, int ci,
} }
LOCAL(jpeg_scan_info *) LOCAL(jpeg_scan_info *)
fill_scans (jpeg_scan_info *scanptr, int ncomps, fill_scans(jpeg_scan_info *scanptr, int ncomps, int Ss, int Se, int Ah, int Al)
int Ss, int Se, int Ah, int Al)
/* Support routine: generate one scan for each component */ /* Support routine: generate one scan for each component */
{ {
int ci; int ci;
+417 -146
View File
@@ -4,7 +4,8 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Copyright (C) 1995-1997, Thomas G. Lane. * Copyright (C) 1995-1997, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander. * Copyright (C) 2011, 2015, 2018, D. R. Commander.
* Copyright (C) 2016, 2018, Matthieu Darbois.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -18,15 +19,69 @@
#define JPEG_INTERNALS #define JPEG_INTERNALS
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jchuff.h" /* Declarations shared with jchuff.c */ #include "jsimd.h"
#include "jconfigint.h"
#include <limits.h>
#ifdef HAVE_INTRIN_H
#include <intrin.h>
#ifdef _MSC_VER
#ifdef HAVE_BITSCANFORWARD64
#pragma intrinsic(_BitScanForward64)
#endif
#ifdef HAVE_BITSCANFORWARD
#pragma intrinsic(_BitScanForward)
#endif
#endif
#endif
#ifdef C_PROGRESSIVE_SUPPORTED #ifdef C_PROGRESSIVE_SUPPORTED
/*
* NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be
* used for bit counting rather than the lookup table. This will reduce the
* memory footprint by 64k, which is important for some mobile applications
* that create many isolated instances of libjpeg-turbo (web browsers, for
* instance.) This may improve performance on some mobile platforms as well.
* This feature is enabled by default only on ARM processors, because some x86
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
* shown to have a significant performance impact even on the x86 chips that
* have a fast implementation of it. When building for ARMv6, you can
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
* flags (this defines __thumb__).
*/
/* NOTE: Both GCC and Clang define __GNUC__ */
#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
#if !defined __thumb__ || defined __thumb2__
#define USE_CLZ_INTRINSIC
#endif
#endif
#ifdef USE_CLZ_INTRINSIC
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
#else
#include "jpeg_nbits_table.h"
#define JPEG_NBITS(x) (jpeg_nbits_table[x])
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
#endif
/* Expanded entropy encoder object for progressive Huffman encoding. */ /* Expanded entropy encoder object for progressive Huffman encoding. */
typedef struct { typedef struct {
struct jpeg_entropy_encoder pub; /* public fields */ struct jpeg_entropy_encoder pub; /* public fields */
/* Pointer to routine to prepare data for encode_mcu_AC_first() */
void (*AC_first_prepare) (const JCOEF *block,
const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *values, size_t *zerobits);
/* Pointer to routine to prepare data for encode_mcu_AC_refine() */
int (*AC_refine_prepare) (const JCOEF *block,
const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *absvalues, size_t *bits);
/* Mode flag: TRUE for optimization, FALSE for actual data output */ /* Mode flag: TRUE for optimization, FALSE for actual data output */
boolean gather_statistics; boolean gather_statistics;
@@ -88,19 +143,53 @@ typedef phuff_entropy_encoder *phuff_entropy_ptr;
#define IRIGHT_SHIFT(x, shft) ((x) >> (shft)) #define IRIGHT_SHIFT(x, shft) ((x) >> (shft))
#endif #endif
#define PAD(v, p) ((v + (p) - 1) & (~((p) - 1)))
/* Forward declarations */ /* Forward declarations */
METHODDEF(boolean) encode_mcu_DC_first(j_compress_ptr cinfo, METHODDEF(boolean) encode_mcu_DC_first(j_compress_ptr cinfo,
JBLOCKROW *MCU_data); JBLOCKROW *MCU_data);
METHODDEF(void) encode_mcu_AC_first_prepare
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
JCOEF *values, size_t *zerobits);
METHODDEF(boolean) encode_mcu_AC_first(j_compress_ptr cinfo, METHODDEF(boolean) encode_mcu_AC_first(j_compress_ptr cinfo,
JBLOCKROW *MCU_data); JBLOCKROW *MCU_data);
METHODDEF(boolean) encode_mcu_DC_refine(j_compress_ptr cinfo, METHODDEF(boolean) encode_mcu_DC_refine(j_compress_ptr cinfo,
JBLOCKROW *MCU_data); JBLOCKROW *MCU_data);
METHODDEF(int) encode_mcu_AC_refine_prepare
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
JCOEF *absvalues, size_t *bits);
METHODDEF(boolean) encode_mcu_AC_refine(j_compress_ptr cinfo, METHODDEF(boolean) encode_mcu_AC_refine(j_compress_ptr cinfo,
JBLOCKROW *MCU_data); JBLOCKROW *MCU_data);
METHODDEF(void) finish_pass_phuff(j_compress_ptr cinfo); METHODDEF(void) finish_pass_phuff(j_compress_ptr cinfo);
METHODDEF(void) finish_pass_gather_phuff(j_compress_ptr cinfo); METHODDEF(void) finish_pass_gather_phuff(j_compress_ptr cinfo);
/* Count bit loop zeroes */
INLINE
METHODDEF(int)
count_zeroes(size_t *x)
{
int result;
#if defined(HAVE_BUILTIN_CTZL)
result = __builtin_ctzl(*x);
*x >>= result;
#elif defined(HAVE_BITSCANFORWARD64)
_BitScanForward64(&result, *x);
*x >>= result;
#elif defined(HAVE_BITSCANFORWARD)
_BitScanForward(&result, *x);
*x >>= result;
#else
result = 0;
while ((*x & 1) == 0) {
++result;
*x >>= 1;
}
#endif
return result;
}
/* /*
* Initialize for a Huffman-compressed scan using progressive JPEG. * Initialize for a Huffman-compressed scan using progressive JPEG.
*/ */
@@ -126,11 +215,19 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
entropy->pub.encode_mcu = encode_mcu_DC_first; entropy->pub.encode_mcu = encode_mcu_DC_first;
else else
entropy->pub.encode_mcu = encode_mcu_AC_first; entropy->pub.encode_mcu = encode_mcu_AC_first;
if (jsimd_can_encode_mcu_AC_first_prepare())
entropy->AC_first_prepare = jsimd_encode_mcu_AC_first_prepare;
else
entropy->AC_first_prepare = encode_mcu_AC_first_prepare;
} else { } else {
if (is_DC_band) if (is_DC_band)
entropy->pub.encode_mcu = encode_mcu_DC_refine; entropy->pub.encode_mcu = encode_mcu_DC_refine;
else { else {
entropy->pub.encode_mcu = encode_mcu_AC_refine; entropy->pub.encode_mcu = encode_mcu_AC_refine;
if (jsimd_can_encode_mcu_AC_refine_prepare())
entropy->AC_refine_prepare = jsimd_encode_mcu_AC_refine_prepare;
else
entropy->AC_refine_prepare = encode_mcu_AC_refine_prepare;
/* AC refinement needs a correction bit buffer */ /* AC refinement needs a correction bit buffer */
if (entropy->bit_buffer == NULL) if (entropy->bit_buffer == NULL)
entropy->bit_buffer = (char *) entropy->bit_buffer = (char *)
@@ -198,10 +295,11 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
*/ */
/* Emit a byte */ /* Emit a byte */
#define emit_byte(entropy,val) \ #define emit_byte(entropy, val) { \
{ *(entropy)->next_output_byte++ = (JOCTET) (val); \ *(entropy)->next_output_byte++ = (JOCTET)(val); \
if (--(entropy)->free_in_buffer == 0) \ if (--(entropy)->free_in_buffer == 0) \
dump_buffer(entropy); } dump_buffer(entropy); \
}
LOCAL(void) LOCAL(void)
@@ -320,9 +418,7 @@ emit_eobrun (phuff_entropy_ptr entropy)
if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */ if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */
temp = entropy->EOBRUN; temp = entropy->EOBRUN;
nbits = 0; nbits = JPEG_NBITS_NONZERO(temp) - 1;
while ((temp >>= 1))
nbits++;
/* safety check: shouldn't happen given limited correction-bit buffer */ /* safety check: shouldn't happen given limited correction-bit buffer */
if (nbits > 14) if (nbits > 14)
ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE); ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
@@ -378,7 +474,7 @@ METHODDEF(boolean)
encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_DC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
register int temp, temp2; register int temp, temp2, temp3;
register int nbits; register int nbits;
int blkn, ci; int blkn, ci;
int Al = cinfo->Al; int Al = cinfo->Al;
@@ -410,20 +506,20 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
entropy->last_dc_val[ci] = temp2; entropy->last_dc_val[ci] = temp2;
/* Encode the DC coefficient difference per section G.1.2.1 */ /* Encode the DC coefficient difference per section G.1.2.1 */
temp2 = temp;
if (temp < 0) { /* This is a well-known technique for obtaining the absolute value without
temp = -temp; /* temp is abs value of input */ * a branch. It is derived from an assembly language technique presented
* in "How to Optimize for the Pentium Processors", Copyright (c) 1996,
* 1997 by Agner Fog.
*/
temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
temp ^= temp3;
temp -= temp3; /* temp is abs value of input */
/* For a negative input, want temp2 = bitwise complement of abs(input) */ /* For a negative input, want temp2 = bitwise complement of abs(input) */
/* This code assumes we are on a two's complement machine */ temp2 = temp ^ temp3;
temp2--;
}
/* Find the number of bits needed for the magnitude of the coefficient */ /* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0; nbits = JPEG_NBITS(temp);
while (temp) {
nbits++;
temp >>= 1;
}
/* Check for out-of-range coefficient values. /* Check for out-of-range coefficient values.
* Since we're encoding a difference, the range limit is twice as much. * Since we're encoding a difference, the range limit is twice as much.
*/ */
@@ -456,21 +552,116 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
} }
/*
* Data preparation for encode_mcu_AC_first().
*/
#define COMPUTE_ABSVALUES_AC_FIRST(Sl) { \
for (k = 0; k < Sl; k++) { \
temp = block[jpeg_natural_order_start[k]]; \
if (temp == 0) \
continue; \
/* We must apply the point transform by Al. For AC coefficients this \
* is an integer division with rounding towards 0. To do this portably \
* in C, we shift after obtaining the absolute value; so the code is \
* interwoven with finding the abs value (temp) and output bits (temp2). \
*/ \
temp2 = temp >> (CHAR_BIT * sizeof(int) - 1); \
temp ^= temp2; \
temp -= temp2; /* temp is abs value of input */ \
temp >>= Al; /* apply the point transform */ \
/* Watch out for case that nonzero coef is zero after point transform */ \
if (temp == 0) \
continue; \
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */ \
temp2 ^= temp; \
values[k] = temp; \
values[k + DCTSIZE2] = temp2; \
zerobits |= ((size_t)1U) << k; \
} \
}
METHODDEF(void)
encode_mcu_AC_first_prepare(const JCOEF *block,
const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *values, size_t *bits)
{
register int k, temp, temp2;
size_t zerobits = 0U;
int Sl0 = Sl;
#if SIZEOF_SIZE_T == 4
if (Sl0 > 32)
Sl0 = 32;
#endif
COMPUTE_ABSVALUES_AC_FIRST(Sl0);
bits[0] = zerobits;
#if SIZEOF_SIZE_T == 4
zerobits = 0U;
if (Sl > 32) {
Sl -= 32;
jpeg_natural_order_start += 32;
values += 32;
COMPUTE_ABSVALUES_AC_FIRST(Sl);
}
bits[1] = zerobits;
#endif
}
/* /*
* MCU encoding for AC initial scan (either spectral selection, * MCU encoding for AC initial scan (either spectral selection,
* or first pass of successive approximation). * or first pass of successive approximation).
*/ */
#define ENCODE_COEFS_AC_FIRST(label) { \
while (zerobits) { \
r = count_zeroes(&zerobits); \
cvalue += r; \
label \
temp = cvalue[0]; \
temp2 = cvalue[DCTSIZE2]; \
\
/* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
while (r > 15) { \
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
r -= 16; \
} \
\
/* Find the number of bits needed for the magnitude of the coefficient */ \
nbits = JPEG_NBITS_NONZERO(temp); /* there must be at least one 1 bit */ \
/* Check for out-of-range coefficient values */ \
if (nbits > MAX_COEF_BITS) \
ERREXIT(cinfo, JERR_BAD_DCT_COEF); \
\
/* Count/emit Huffman symbol for run length / number of bits */ \
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits); \
\
/* Emit that number of bits of the value, if positive, */ \
/* or the complement of its magnitude, if negative. */ \
emit_bits(entropy, (unsigned int)temp2, nbits); \
\
cvalue++; \
zerobits >>= 1; \
} \
}
METHODDEF(boolean) METHODDEF(boolean)
encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
register int temp, temp2; register int temp, temp2;
register int nbits; register int nbits, r;
register int r, k; int Sl = cinfo->Se - cinfo->Ss + 1;
int Se = cinfo->Se;
int Al = cinfo->Al; int Al = cinfo->Al;
JBLOCKROW block; JCOEF values_unaligned[2 * DCTSIZE2 + 15];
JCOEF *values;
const JCOEF *cvalue;
size_t zerobits;
size_t bits[8 / SIZEOF_SIZE_T];
entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer; entropy->free_in_buffer = cinfo->dest->free_in_buffer;
@@ -480,66 +671,48 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
if (entropy->restarts_to_go == 0) if (entropy->restarts_to_go == 0)
emit_restart(entropy, entropy->next_restart_num); emit_restart(entropy, entropy->next_restart_num);
/* Encode the MCU data block */ #ifdef WITH_SIMD
block = MCU_data[0]; cvalue = values = (JCOEF *)PAD((size_t)values_unaligned, 16);
#else
/* Not using SIMD, so alignment is not needed */
cvalue = values = values_unaligned;
#endif
/* Prepare data */
entropy->AC_first_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
Sl, Al, values, bits);
zerobits = bits[0];
#if SIZEOF_SIZE_T == 4
zerobits |= bits[1];
#endif
/* Emit any pending EOBRUN */
if (zerobits && (entropy->EOBRUN > 0))
emit_eobrun(entropy);
#if SIZEOF_SIZE_T == 4
zerobits = bits[0];
#endif
/* Encode the AC coefficients per section G.1.2.2, fig. G.3 */ /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
r = 0; /* r = run length of zeros */ ENCODE_COEFS_AC_FIRST((void)0;);
for (k = cinfo->Ss; k <= Se; k++) { #if SIZEOF_SIZE_T == 4
if ((temp = (*block)[jpeg_natural_order[k]]) == 0) { zerobits = bits[1];
r++; if (zerobits) {
continue; int diff = ((values + DCTSIZE2 / 2) - cvalue);
} r = count_zeroes(&zerobits);
/* We must apply the point transform by Al. For AC coefficients this r += diff;
* is an integer division with rounding towards 0. To do this portably cvalue += r;
* in C, we shift after obtaining the absolute value; so the code is goto first_iter_ac_first;
* interwoven with finding the abs value (temp) and output bits (temp2).
*/
if (temp < 0) {
temp = -temp; /* temp is abs value of input */
temp >>= Al; /* apply the point transform */
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */
temp2 = ~temp;
} else {
temp >>= Al; /* apply the point transform */
temp2 = temp;
}
/* Watch out for case that nonzero coef is zero after point transform */
if (temp == 0) {
r++;
continue;
} }
/* Emit any pending EOBRUN */ ENCODE_COEFS_AC_FIRST(first_iter_ac_first:);
if (entropy->EOBRUN > 0) #endif
emit_eobrun(entropy);
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
while (r > 15) {
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
r -= 16;
}
/* Find the number of bits needed for the magnitude of the coefficient */ if (cvalue < (values + Sl)) { /* If there are trailing zeroes, */
nbits = 1; /* there must be at least one 1 bit */
while ((temp >>= 1))
nbits++;
/* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit Huffman symbol for run length / number of bits */
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
emit_bits(entropy, (unsigned int) temp2, nbits);
r = 0; /* reset zero run length */
}
if (r > 0) { /* If there are trailing zeroes, */
entropy->EOBRUN++; /* count an EOB */ entropy->EOBRUN++; /* count an EOB */
if (entropy->EOBRUN == 0x7FFF) if (entropy->EOBRUN == 0x7FFF)
emit_eobrun(entropy); /* force it out to avoid overflow */ emit_eobrun(entropy); /* force it out to avoid overflow */
@@ -611,23 +784,149 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
} }
/*
* Data preparation for encode_mcu_AC_refine().
*/
#define COMPUTE_ABSVALUES_AC_REFINE(Sl, koffset) { \
/* It is convenient to make a pre-pass to determine the transformed \
* coefficients' absolute values and the EOB position. \
*/ \
for (k = 0; k < Sl; k++) { \
temp = block[jpeg_natural_order_start[k]]; \
/* We must apply the point transform by Al. For AC coefficients this \
* is an integer division with rounding towards 0. To do this portably \
* in C, we shift after obtaining the absolute value. \
*/ \
temp2 = temp >> (CHAR_BIT * sizeof(int) - 1); \
temp ^= temp2; \
temp -= temp2; /* temp is abs value of input */ \
temp >>= Al; /* apply the point transform */ \
if (temp != 0) { \
zerobits |= ((size_t)1U) << k; \
signbits |= ((size_t)(temp2 + 1)) << k; \
} \
absvalues[k] = (JCOEF)temp; /* save abs value for main pass */ \
if (temp == 1) \
EOB = k + koffset; /* EOB = index of last newly-nonzero coef */ \
} \
}
METHODDEF(int)
encode_mcu_AC_refine_prepare(const JCOEF *block,
const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *absvalues, size_t *bits)
{
register int k, temp, temp2;
int EOB = 0;
size_t zerobits = 0U, signbits = 0U;
int Sl0 = Sl;
#if SIZEOF_SIZE_T == 4
if (Sl0 > 32)
Sl0 = 32;
#endif
COMPUTE_ABSVALUES_AC_REFINE(Sl0, 0);
bits[0] = zerobits;
#if SIZEOF_SIZE_T == 8
bits[1] = signbits;
#else
bits[2] = signbits;
zerobits = 0U;
signbits = 0U;
if (Sl > 32) {
Sl -= 32;
jpeg_natural_order_start += 32;
absvalues += 32;
COMPUTE_ABSVALUES_AC_REFINE(Sl, 32);
}
bits[1] = zerobits;
bits[3] = signbits;
#endif
return EOB;
}
/* /*
* MCU encoding for AC successive approximation refinement scan. * MCU encoding for AC successive approximation refinement scan.
*/ */
#define ENCODE_COEFS_AC_REFINE(label) { \
while (zerobits) { \
int idx = count_zeroes(&zerobits); \
r += idx; \
cabsvalue += idx; \
signbits >>= idx; \
label \
/* Emit any required ZRLs, but not if they can be folded into EOB */ \
while (r > 15 && (cabsvalue <= EOBPTR)) { \
/* emit any pending EOBRUN and the BE correction bits */ \
emit_eobrun(entropy); \
/* Emit ZRL */ \
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0); \
r -= 16; \
/* Emit buffered correction bits that must be associated with ZRL */ \
emit_buffered_bits(entropy, BR_buffer, BR); \
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
BR = 0; \
} \
\
temp = *cabsvalue++; \
\
/* If the coef was previously nonzero, it only needs a correction bit. \
* NOTE: a straight translation of the spec's figure G.7 would suggest \
* that we also need to test r > 15. But if r > 15, we can only get here \
* if k > EOB, which implies that this coefficient is not 1. \
*/ \
if (temp > 1) { \
/* The correction bit is the next bit of the absolute value. */ \
BR_buffer[BR++] = (char)(temp & 1); \
signbits >>= 1; \
zerobits >>= 1; \
continue; \
} \
\
/* Emit any pending EOBRUN and the BE correction bits */ \
emit_eobrun(entropy); \
\
/* Count/emit Huffman symbol for run length / number of bits */ \
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1); \
\
/* Emit output bit for newly-nonzero coef */ \
temp = signbits & 1; /* ((*block)[jpeg_natural_order_start[k]] < 0) ? 0 : 1 */ \
emit_bits(entropy, (unsigned int)temp, 1); \
\
/* Emit buffered correction bits that must be associated with this code */ \
emit_buffered_bits(entropy, BR_buffer, BR); \
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */ \
BR = 0; \
r = 0; /* reset zero run length */ \
signbits >>= 1; \
zerobits >>= 1; \
} \
}
METHODDEF(boolean) METHODDEF(boolean)
encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data) encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
register int temp; register int temp, r;
register int r, k;
int EOB;
char *BR_buffer; char *BR_buffer;
unsigned int BR; unsigned int BR;
int Se = cinfo->Se; int Sl = cinfo->Se - cinfo->Ss + 1;
int Al = cinfo->Al; int Al = cinfo->Al;
JBLOCKROW block; JCOEF absvalues_unaligned[DCTSIZE2 + 15];
int absvalues[DCTSIZE2]; JCOEF *absvalues;
const JCOEF *cabsvalue, *EOBPTR;
size_t zerobits, signbits;
size_t bits[16 / SIZEOF_SIZE_T];
entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer; entropy->free_in_buffer = cinfo->dest->free_in_buffer;
@@ -637,26 +936,17 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
if (entropy->restarts_to_go == 0) if (entropy->restarts_to_go == 0)
emit_restart(entropy, entropy->next_restart_num); emit_restart(entropy, entropy->next_restart_num);
/* Encode the MCU data block */ #ifdef WITH_SIMD
block = MCU_data[0]; cabsvalue = absvalues = (JCOEF *)PAD((size_t)absvalues_unaligned, 16);
#else
/* Not using SIMD, so alignment is not needed */
cabsvalue = absvalues = absvalues_unaligned;
#endif
/* It is convenient to make a pre-pass to determine the transformed /* Prepare data */
* coefficients' absolute values and the EOB position. EOBPTR = absvalues +
*/ entropy->AC_refine_prepare(MCU_data[0][0], jpeg_natural_order + cinfo->Ss,
EOB = 0; Sl, Al, absvalues, bits);
for (k = cinfo->Ss; k <= Se; k++) {
temp = (*block)[jpeg_natural_order[k]];
/* We must apply the point transform by Al. For AC coefficients this
* is an integer division with rounding towards 0. To do this portably
* in C, we shift after obtaining the absolute value.
*/
if (temp < 0)
temp = -temp; /* temp is abs value of input */
temp >>= Al; /* apply the point transform */
absvalues[k] = temp; /* save abs value for main pass */
if (temp == 1)
EOB = k; /* EOB = index of last newly-nonzero coef */
}
/* Encode the AC coefficients per section G.1.2.3, fig. G.7 */ /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
@@ -664,52 +954,32 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
BR = 0; /* BR = count of buffered bits added now */ BR = 0; /* BR = count of buffered bits added now */
BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */ BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
for (k = cinfo->Ss; k <= Se; k++) { zerobits = bits[0];
if ((temp = absvalues[k]) == 0) { #if SIZEOF_SIZE_T == 8
r++; signbits = bits[1];
continue; #else
signbits = bits[2];
#endif
ENCODE_COEFS_AC_REFINE((void)0;);
#if SIZEOF_SIZE_T == 4
zerobits = bits[1];
signbits = bits[3];
if (zerobits) {
int diff = ((absvalues + DCTSIZE2 / 2) - cabsvalue);
int idx = count_zeroes(&zerobits);
signbits >>= idx;
idx += diff;
r += idx;
cabsvalue += idx;
goto first_iter_ac_refine;
} }
/* Emit any required ZRLs, but not if they can be folded into EOB */ ENCODE_COEFS_AC_REFINE(first_iter_ac_refine:);
while (r > 15 && k <= EOB) { #endif
/* emit any pending EOBRUN and the BE correction bits */
emit_eobrun(entropy);
/* Emit ZRL */
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
r -= 16;
/* Emit buffered correction bits that must be associated with ZRL */
emit_buffered_bits(entropy, BR_buffer, BR);
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
BR = 0;
}
/* If the coef was previously nonzero, it only needs a correction bit. r |= (int)((absvalues + Sl) - cabsvalue);
* NOTE: a straight translation of the spec's figure G.7 would suggest
* that we also need to test r > 15. But if r > 15, we can only get here
* if k > EOB, which implies that this coefficient is not 1.
*/
if (temp > 1) {
/* The correction bit is the next bit of the absolute value. */
BR_buffer[BR++] = (char) (temp & 1);
continue;
}
/* Emit any pending EOBRUN and the BE correction bits */
emit_eobrun(entropy);
/* Count/emit Huffman symbol for run length / number of bits */
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
/* Emit output bit for newly-nonzero coef */
temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
emit_bits(entropy, (unsigned int) temp, 1);
/* Emit buffered correction bits that must be associated with this code */
emit_buffered_bits(entropy, BR_buffer, BR);
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
BR = 0;
r = 0; /* reset zero run length */
}
if (r > 0 || BR > 0) { /* If there are trailing zeroes, */ if (r > 0 || BR > 0) { /* If there are trailing zeroes, */
entropy->EOBRUN++; /* count an EOB */ entropy->EOBRUN++; /* count an EOB */
@@ -718,7 +988,8 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
* 1. overflow of the EOB counter; * 1. overflow of the EOB counter;
* 2. overflow of the correction bit buffer during the next MCU. * 2. overflow of the correction bit buffer during the next MCU.
*/ */
if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1)) if (entropy->EOBRUN == 0x7FFF ||
entropy->BE > (MAX_CORR_BITS - DCTSIZE2 + 1))
emit_eobrun(entropy); emit_eobrun(entropy);
} }
+13 -19
View File
@@ -106,14 +106,14 @@ start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
LOCAL(void) LOCAL(void)
expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols, expand_bottom_edge(JSAMPARRAY image_data, JDIMENSION num_cols, int input_rows,
int input_rows, int output_rows) int output_rows)
{ {
register int row; register int row;
for (row = input_rows; row < output_rows; row++) { for (row = input_rows; row < output_rows; row++) {
jcopy_sample_rows(image_data, input_rows-1, image_data, row, jcopy_sample_rows(image_data, input_rows - 1, image_data, row, 1,
1, num_cols); num_cols);
} }
} }
@@ -128,9 +128,8 @@ expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
*/ */
METHODDEF(void) METHODDEF(void)
pre_process_data (j_compress_ptr cinfo, pre_process_data(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail,
JDIMENSION in_rows_avail,
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
JDIMENSION out_row_groups_avail) JDIMENSION out_row_groups_avail)
{ {
@@ -172,12 +171,10 @@ pre_process_data (j_compress_ptr cinfo,
/* If at bottom of image, pad the output to a full iMCU height. /* If at bottom of image, pad the output to a full iMCU height.
* Note we assume the caller is providing a one-iMCU-height output buffer! * Note we assume the caller is providing a one-iMCU-height output buffer!
*/ */
if (prep->rows_to_go == 0 && if (prep->rows_to_go == 0 && *out_row_group_ctr < out_row_groups_avail) {
*out_row_group_ctr < out_row_groups_avail) {
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
expand_bottom_edge(output_buf[ci], expand_bottom_edge(output_buf[ci], compptr->width_in_blocks * DCTSIZE,
compptr->width_in_blocks * DCTSIZE,
(int)(*out_row_group_ctr * compptr->v_samp_factor), (int)(*out_row_group_ctr * compptr->v_samp_factor),
(int)(out_row_groups_avail * compptr->v_samp_factor)); (int)(out_row_groups_avail * compptr->v_samp_factor));
} }
@@ -195,9 +192,8 @@ pre_process_data (j_compress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
pre_process_context (j_compress_ptr cinfo, pre_process_context(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail,
JDIMENSION in_rows_avail,
JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr, JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
JDIMENSION out_row_groups_avail) JDIMENSION out_row_groups_avail)
{ {
@@ -221,9 +217,8 @@ pre_process_context (j_compress_ptr cinfo,
for (ci = 0; ci < cinfo->num_components; ci++) { for (ci = 0; ci < cinfo->num_components; ci++) {
int row; int row;
for (row = 1; row <= cinfo->max_v_samp_factor; row++) { for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
jcopy_sample_rows(prep->color_buf[ci], 0, jcopy_sample_rows(prep->color_buf[ci], 0, prep->color_buf[ci],
prep->color_buf[ci], -row, -row, 1, cinfo->image_width);
1, cinfo->image_width);
} }
} }
} }
@@ -245,8 +240,7 @@ pre_process_context (j_compress_ptr cinfo,
} }
/* If we've gotten enough data, downsample a row group. */ /* If we've gotten enough data, downsample a row group. */
if (prep->next_buf_row == prep->next_buf_stop) { if (prep->next_buf_row == prep->next_buf_stop) {
(*cinfo->downsample->downsample) (cinfo, (*cinfo->downsample->downsample) (cinfo, prep->color_buf,
prep->color_buf,
(JDIMENSION)prep->this_row_group, (JDIMENSION)prep->this_row_group,
output_buf, *out_row_group_ctr); output_buf, *out_row_group_ctr);
(*out_row_group_ctr)++; (*out_row_group_ctr)++;
+20 -20
View File
@@ -91,8 +91,8 @@ start_pass_downsample (j_compress_ptr cinfo)
*/ */
LOCAL(void) LOCAL(void)
expand_right_edge (JSAMPARRAY image_data, int num_rows, expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols,
JDIMENSION input_cols, JDIMENSION output_cols) JDIMENSION output_cols)
{ {
register JSAMPROW ptr; register JSAMPROW ptr;
register JSAMPLE pixval; register JSAMPLE pixval;
@@ -118,9 +118,9 @@ expand_right_edge (JSAMPARRAY image_data, int num_rows,
*/ */
METHODDEF(void) METHODDEF(void)
sep_downsample (j_compress_ptr cinfo, sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_index, JDIMENSION in_row_index, JSAMPIMAGE output_buf,
JSAMPIMAGE output_buf, JDIMENSION out_row_group_index) JDIMENSION out_row_group_index)
{ {
my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample; my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample;
int ci; int ci;
@@ -162,8 +162,8 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
* by the standard loop. Special-casing padded output would be more * by the standard loop. Special-casing padded output would be more
* efficient. * efficient.
*/ */
expand_right_edge(input_data, cinfo->max_v_samp_factor, expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
cinfo->image_width, output_cols * h_expand); output_cols * h_expand);
inrow = 0; inrow = 0;
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
@@ -195,11 +195,11 @@ fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data) JSAMPARRAY input_data, JSAMPARRAY output_data)
{ {
/* Copy the data */ /* Copy the data */
jcopy_sample_rows(input_data, 0, output_data, 0, jcopy_sample_rows(input_data, 0, output_data, 0, cinfo->max_v_samp_factor,
cinfo->max_v_samp_factor, cinfo->image_width); cinfo->image_width);
/* Edge-expand */ /* Edge-expand */
expand_right_edge(output_data, cinfo->max_v_samp_factor, expand_right_edge(output_data, cinfo->max_v_samp_factor, cinfo->image_width,
cinfo->image_width, compptr->width_in_blocks * DCTSIZE); compptr->width_in_blocks * DCTSIZE);
} }
@@ -229,16 +229,16 @@ h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
* by the standard loop. Special-casing padded output would be more * by the standard loop. Special-casing padded output would be more
* efficient. * efficient.
*/ */
expand_right_edge(input_data, cinfo->max_v_samp_factor, expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
cinfo->image_width, output_cols * 2); output_cols * 2);
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
outptr = output_data[outrow]; outptr = output_data[outrow];
inptr = input_data[outrow]; inptr = input_data[outrow];
bias = 0; /* bias = 0,1,0,1,... for successive samples */ bias = 0; /* bias = 0,1,0,1,... for successive samples */
for (outcol = 0; outcol < output_cols; outcol++) { for (outcol = 0; outcol < output_cols; outcol++) {
*outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) *outptr++ =
+ bias) >> 1); (JSAMPLE)((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) + bias) >> 1);
bias ^= 1; /* 0=>1, 1=>0 */ bias ^= 1; /* 0=>1, 1=>0 */
inptr += 2; inptr += 2;
} }
@@ -266,8 +266,8 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
* by the standard loop. Special-casing padded output would be more * by the standard loop. Special-casing padded output would be more
* efficient. * efficient.
*/ */
expand_right_edge(input_data, cinfo->max_v_samp_factor, expand_right_edge(input_data, cinfo->max_v_samp_factor, cinfo->image_width,
cinfo->image_width, output_cols * 2); output_cols * 2);
inrow = 0; inrow = 0;
for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) { for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
@@ -276,9 +276,9 @@ h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
inptr1 = input_data[inrow + 1]; inptr1 = input_data[inrow + 1];
bias = 1; /* bias = 1,2,1,2,... for successive samples */ bias = 1; /* bias = 1,2,1,2,... for successive samples */
for (outcol = 0; outcol < output_cols; outcol++) { for (outcol = 0; outcol < output_cols; outcol++) {
*outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) + *outptr++ =
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) (JSAMPLE)((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
+ bias) >> 2); GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) + bias) >> 2);
bias ^= 3; /* 1=>2, 2=>1 */ bias ^= 3; /* 1=>2, 2=>1 */
inptr0 += 2; inptr1 += 2; inptr0 += 2; inptr1 += 2;
} }
+8 -10
View File
@@ -20,10 +20,10 @@
/* Forward declarations */ /* Forward declarations */
LOCAL(void) transencode_master_selection LOCAL(void) transencode_master_selection(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays); jvirt_barray_ptr *coef_arrays);
LOCAL(void) transencode_coef_controller LOCAL(void) transencode_coef_controller(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays); jvirt_barray_ptr *coef_arrays);
/* /*
@@ -64,8 +64,7 @@ jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_copy_critical_parameters (j_decompress_ptr srcinfo, jpeg_copy_critical_parameters(j_decompress_ptr srcinfo, j_compress_ptr dstinfo)
j_compress_ptr dstinfo)
{ {
JQUANT_TBL **qtblptr; JQUANT_TBL **qtblptr;
jpeg_component_info *incomp, *outcomp; jpeg_component_info *incomp, *outcomp;
@@ -100,8 +99,7 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
qtblptr = &dstinfo->quant_tbl_ptrs[tblno]; qtblptr = &dstinfo->quant_tbl_ptrs[tblno];
if (*qtblptr == NULL) if (*qtblptr == NULL)
*qtblptr = jpeg_alloc_quant_table((j_common_ptr)dstinfo); *qtblptr = jpeg_alloc_quant_table((j_common_ptr)dstinfo);
MEMCOPY((*qtblptr)->quantval, MEMCOPY((*qtblptr)->quantval, srcinfo->quant_tbl_ptrs[tblno]->quantval,
srcinfo->quant_tbl_ptrs[tblno]->quantval,
sizeof((*qtblptr)->quantval)); sizeof((*qtblptr)->quantval));
(*qtblptr)->sent_table = FALSE; (*qtblptr)->sent_table = FALSE;
} }
@@ -321,8 +319,8 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
for (ci = 0; ci < cinfo->comps_in_scan; ci++) { for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci]; compptr = cinfo->cur_comp_info[ci];
start_col = MCU_col_num * compptr->MCU_width; start_col = MCU_col_num * compptr->MCU_width;
blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width :
: compptr->last_col_width; compptr->last_col_width;
for (yindex = 0; yindex < compptr->MCU_height; yindex++) { for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
if (coef->iMCU_row_num < last_iMCU_row || if (coef->iMCU_row_num < last_iMCU_row ||
yindex + yoffset < compptr->last_row_height) { yindex + yoffset < compptr->last_row_height) {
+11 -9
View File
@@ -4,7 +4,7 @@
* 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-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2010, 2015-2017, D. R. Commander. * Copyright (C) 2010, 2015-2018, D. R. Commander.
* Copyright (C) 2015, Google, Inc. * Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
@@ -210,8 +210,7 @@ jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
/* Set the first and last iMCU columns that we must decompress. These values /* Set the first and last iMCU columns that we must decompress. These values
* will be used in single-scan decompressions. * will be used in single-scan decompressions.
*/ */
cinfo->master->first_iMCU_col = cinfo->master->first_iMCU_col = (JDIMENSION)(long)(*xoffset) / (long)align;
(JDIMENSION) (long) (*xoffset) / (long) align;
cinfo->master->last_iMCU_col = cinfo->master->last_iMCU_col =
(JDIMENSION)jdiv_round_up((long)(*xoffset + cinfo->output_width), (JDIMENSION)jdiv_round_up((long)(*xoffset + cinfo->output_width),
(long)align) - 1; (long)align) - 1;
@@ -236,8 +235,7 @@ jpeg_crop_scanline (j_decompress_ptr cinfo, JDIMENSION *xoffset,
cinfo->master->first_MCU_col[ci] = cinfo->master->first_MCU_col[ci] =
(JDIMENSION)(long)(*xoffset * hsf) / (long)align; (JDIMENSION)(long)(*xoffset * hsf) / (long)align;
cinfo->master->last_MCU_col[ci] = cinfo->master->last_MCU_col[ci] =
(JDIMENSION) jdiv_round_up((long) ((*xoffset + cinfo->output_width) * (JDIMENSION)jdiv_round_up((long)((*xoffset + cinfo->output_width) * hsf),
hsf),
(long)align) - 1; (long)align) - 1;
} }
@@ -320,12 +318,15 @@ read_and_discard_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
JDIMENSION n; JDIMENSION n;
void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION input_row, JSAMPARRAY output_buf, JDIMENSION input_row, JSAMPARRAY output_buf,
int num_rows); int num_rows) = NULL;
void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf, void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows) = NULL; JSAMPARRAY output_buf, int num_rows) = NULL;
if (cinfo->cconvert && cinfo->cconvert->color_convert) {
color_convert = cinfo->cconvert->color_convert; color_convert = cinfo->cconvert->color_convert;
cinfo->cconvert->color_convert = noop_convert; cinfo->cconvert->color_convert = noop_convert;
}
if (cinfo->cquantize && cinfo->cquantize->color_quantize) { if (cinfo->cquantize && cinfo->cquantize->color_quantize) {
color_quantize = cinfo->cquantize->color_quantize; color_quantize = cinfo->cquantize->color_quantize;
cinfo->cquantize->color_quantize = noop_quantize; cinfo->cquantize->color_quantize = noop_quantize;
@@ -334,7 +335,9 @@ read_and_discard_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
for (n = 0; n < num_lines; n++) for (n = 0; n < num_lines; n++)
jpeg_read_scanlines(cinfo, NULL, 1); jpeg_read_scanlines(cinfo, NULL, 1);
if (color_convert)
cinfo->cconvert->color_convert = color_convert; cinfo->cconvert->color_convert = color_convert;
if (color_quantize) if (color_quantize)
cinfo->cquantize->color_quantize = color_quantize; cinfo->cquantize->color_quantize = color_quantize;
} }
@@ -481,7 +484,7 @@ jpeg_skip_scanlines (j_decompress_ptr cinfo, JDIMENSION num_lines)
if (cinfo->upsample->need_context_rows) { if (cinfo->upsample->need_context_rows) {
cinfo->output_scanline += lines_to_skip; cinfo->output_scanline += lines_to_skip;
cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row; cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
main_ptr->iMCU_row_ctr += lines_after_iMCU_row / lines_per_iMCU_row; main_ptr->iMCU_row_ctr += lines_to_skip / lines_per_iMCU_row;
/* It is complex to properly move to the middle of a context block, so /* It is complex to properly move to the middle of a context block, so
* read the remaining lines instead of skipping them. * read the remaining lines instead of skipping them.
*/ */
@@ -595,8 +598,7 @@ jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
/* Limit scan number to valid range */ /* Limit scan number to valid range */
if (scan_number <= 0) if (scan_number <= 0)
scan_number = 1; scan_number = 1;
if (cinfo->inputctl->eoi_reached && if (cinfo->inputctl->eoi_reached && scan_number > cinfo->input_scan_number)
scan_number > cinfo->input_scan_number)
scan_number = cinfo->input_scan_number; scan_number = cinfo->input_scan_number;
cinfo->output_scan_number = scan_number; cinfo->output_scan_number = scan_number;
/* Perform any dummy output passes, and set up for the real pass */ /* Perform any dummy output passes, and set up for the real pass */
+10 -6
View File
@@ -4,16 +4,19 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Developed 1997-2015 by Guido Vollbeding. * Developed 1997-2015 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2015-2016, D. R. Commander. * Copyright (C) 2015-2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
* This file contains portable arithmetic entropy decoding routines for JPEG * This file contains portable arithmetic entropy encoding routines for JPEG
* (implementing the ISO/IEC IS 10918-1 and CCITT Recommendation ITU-T T.81). * (implementing Recommendation ITU-T T.81 | ISO/IEC 10918-1).
* *
* Both sequential and progressive modes are supported in this single module. * Both sequential and progressive modes are supported in this single module.
* *
* Suspension is not currently supported in this module. * Suspension is not currently supported in this module.
*
* NOTE: All referenced figures are from
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -306,7 +309,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
while (m >>= 1) while (m >>= 1)
if (arith_decode(cinfo, st)) v |= m; if (arith_decode(cinfo, st)) v |= m;
v += 1; if (sign) v = -v; v += 1; if (sign) v = -v;
entropy->last_dc_val[ci] += v; entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
} }
/* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */ /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
@@ -564,7 +567,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
while (m >>= 1) while (m >>= 1)
if (arith_decode(cinfo, st)) v |= m; if (arith_decode(cinfo, st)) v |= m;
v += 1; if (sign) v = -v; v += 1; if (sign) v = -v;
entropy->last_dc_val[ci] += v; entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
} }
if (block) if (block)
@@ -760,7 +763,8 @@ jinit_arith_decoder (j_decompress_ptr cinfo)
int *coef_bit_ptr, ci; int *coef_bit_ptr, ci;
cinfo->coef_bits = (int (*)[DCTSIZE2]) cinfo->coef_bits = (int (*)[DCTSIZE2])
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components*DCTSIZE2*sizeof(int)); cinfo->num_components * DCTSIZE2 *
sizeof(int));
coef_bit_ptr = &cinfo->coef_bits[0][0]; coef_bit_ptr = &cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++) for (ci = 0; ci < cinfo->num_components; ci++)
for (i = 0; i < DCTSIZE2; i++) for (i = 0; i < DCTSIZE2; i++)
+2 -2
View File
@@ -249,8 +249,8 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE *outfile)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_mem_dest (j_compress_ptr cinfo, jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer,
unsigned char **outbuffer, unsigned long *outsize) unsigned long *outsize)
{ {
my_mem_dest_ptr dest; my_mem_dest_ptr dest;
+2 -2
View File
@@ -260,8 +260,8 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_mem_src (j_decompress_ptr cinfo, jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer,
const unsigned char *inbuffer, unsigned long insize) unsigned long insize)
{ {
struct jpeg_source_mgr *src; struct jpeg_source_mgr *src;
+11 -12
View File
@@ -25,16 +25,15 @@
/* Forward declarations */ /* Forward declarations */
METHODDEF(int) decompress_onepass METHODDEF(int) decompress_onepass(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE output_buf); JSAMPIMAGE output_buf);
#ifdef D_MULTISCAN_FILES_SUPPORTED #ifdef D_MULTISCAN_FILES_SUPPORTED
METHODDEF(int) decompress_data METHODDEF(int) decompress_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf);
(j_decompress_ptr cinfo, JSAMPIMAGE output_buf);
#endif #endif
#ifdef BLOCK_SMOOTHING_SUPPORTED #ifdef BLOCK_SMOOTHING_SUPPORTED
LOCAL(boolean) smoothing_ok(j_decompress_ptr cinfo); LOCAL(boolean) smoothing_ok(j_decompress_ptr cinfo);
METHODDEF(int) decompress_smooth_data METHODDEF(int) decompress_smooth_data(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE output_buf); JSAMPIMAGE output_buf);
#endif #endif
@@ -129,8 +128,8 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
continue; continue;
} }
inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index]; inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width useful_width = (MCU_col_num < last_MCU_col) ?
: compptr->last_col_width; compptr->MCU_width : compptr->last_col_width;
output_ptr = output_buf[compptr->component_index] + output_ptr = output_buf[compptr->component_index] +
yoffset * compptr->_DCT_scaled_size; yoffset * compptr->_DCT_scaled_size;
start_col = (MCU_col_num - cinfo->master->first_iMCU_col) * start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
@@ -307,8 +306,8 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
output_col = 0; output_col = 0;
for (block_num = cinfo->master->first_MCU_col[ci]; for (block_num = cinfo->master->first_MCU_col[ci];
block_num <= cinfo->master->last_MCU_col[ci]; block_num++) { block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr, (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
output_ptr, output_col); output_col);
buffer_ptr++; buffer_ptr++;
output_col += compptr->_DCT_scaled_size; output_col += compptr->_DCT_scaled_size;
} }
@@ -599,8 +598,8 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
workspace[2] = (JCOEF)pred; workspace[2] = (JCOEF)pred;
} }
/* OK, do the IDCT */ /* OK, do the IDCT */
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR) workspace, (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
output_ptr, output_col); output_col);
/* Advance for next column */ /* Advance for next column */
DC1 = DC2; DC2 = DC3; DC1 = DC2; DC2 = DC3;
DC4 = DC5; DC5 = DC6; DC4 = DC5; DC5 = DC6;
+18 -18
View File
@@ -17,9 +17,9 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
ycc_rgb565_convert_internal (j_decompress_ptr cinfo, ycc_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr; register int y, cb, cr;
@@ -96,9 +96,9 @@ ycc_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
ycc_rgb565D_convert_internal (j_decompress_ptr cinfo, ycc_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr; register int y, cb, cr;
@@ -182,9 +182,9 @@ ycc_rgb565D_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb565_convert_internal (j_decompress_ptr cinfo, rgb_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW outptr; register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW inptr0, inptr1, inptr2;
@@ -237,9 +237,9 @@ rgb_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb565D_convert_internal (j_decompress_ptr cinfo, rgb_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW outptr; register JSAMPROW outptr;
register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW inptr0, inptr1, inptr2;
@@ -296,9 +296,9 @@ rgb_rgb565D_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
gray_rgb565_convert_internal (j_decompress_ptr cinfo, gray_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW inptr, outptr; register JSAMPROW inptr, outptr;
register JDIMENSION col; register JDIMENSION col;
@@ -336,9 +336,9 @@ gray_rgb565_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
gray_rgb565D_convert_internal (j_decompress_ptr cinfo, gray_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW inptr, outptr; register JSAMPROW inptr, outptr;
register JDIMENSION col; register JDIMENSION col;
+9 -9
View File
@@ -28,9 +28,9 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
ycc_rgb_convert_internal (j_decompress_ptr cinfo, ycc_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr; register int y, cb, cr;
@@ -81,9 +81,9 @@ ycc_rgb_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
gray_rgb_convert_internal (j_decompress_ptr cinfo, gray_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW inptr, outptr; register JSAMPROW inptr, outptr;
register JDIMENSION col; register JDIMENSION col;
@@ -112,9 +112,9 @@ gray_rgb_convert_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
rgb_rgb_convert_internal (j_decompress_ptr cinfo, rgb_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
register JSAMPROW inptr0, inptr1, inptr2; register JSAMPROW inptr0, inptr1, inptr2;
register JSAMPROW outptr; register JSAMPROW outptr;
+31 -45
View File
@@ -251,9 +251,8 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
ycc_rgb_convert (j_decompress_ptr cinfo, ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -324,9 +323,8 @@ build_rgb_y_table (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
rgb_gray_convert (j_decompress_ptr cinfo, rgb_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int r, g, b; register int r, g, b;
@@ -347,9 +345,8 @@ rgb_gray_convert (j_decompress_ptr cinfo,
g = GETJSAMPLE(inptr1[col]); g = GETJSAMPLE(inptr1[col]);
b = GETJSAMPLE(inptr2[col]); b = GETJSAMPLE(inptr2[col]);
/* Y */ /* Y */
outptr[col] = (JSAMPLE) outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) ctab[b + B_Y_OFF]) >> SCALEBITS);
>> SCALEBITS);
} }
} }
} }
@@ -361,9 +358,8 @@ rgb_gray_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
null_convert (j_decompress_ptr cinfo, null_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
register JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr; register JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
register JDIMENSION col; register JDIMENSION col;
@@ -423,12 +419,11 @@ null_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
grayscale_convert (j_decompress_ptr cinfo, grayscale_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
jcopy_sample_rows(input_buf[0], (int) input_row, output_buf, 0, jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
num_rows, cinfo->output_width); cinfo->output_width);
} }
@@ -437,9 +432,8 @@ grayscale_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
gray_rgb_convert (j_decompress_ptr cinfo, gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -483,9 +477,8 @@ gray_rgb_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
rgb_rgb_convert (j_decompress_ptr cinfo, rgb_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -532,9 +525,8 @@ rgb_rgb_convert (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
ycck_cmyk_convert (j_decompress_ptr cinfo, ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
register int y, cb, cr; register int y, cb, cr;
@@ -600,7 +592,7 @@ ycck_cmyk_convert (j_decompress_ptr cinfo,
/* Declarations for ordered dithering /* Declarations for ordered dithering
* *
* We use a 4x4 ordered dither array packed into 32 bits. This array is * We use a 4x4 ordered dither array packed into 32 bits. This array is
* sufficent for dithering RGB888 to RGB565. * sufficient for dithering RGB888 to RGB565.
*/ */
#define DITHER_MASK 0x3 #define DITHER_MASK 0x3
@@ -662,9 +654,8 @@ static INLINE boolean is_big_endian(void)
METHODDEF(void) METHODDEF(void)
ycc_rgb565_convert (j_decompress_ptr cinfo, ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
ycc_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); ycc_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -674,9 +665,8 @@ ycc_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
ycc_rgb565D_convert (j_decompress_ptr cinfo, ycc_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
ycc_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); ycc_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -686,9 +676,8 @@ ycc_rgb565D_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
rgb_rgb565_convert (j_decompress_ptr cinfo, rgb_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
rgb_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); rgb_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -698,9 +687,8 @@ rgb_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
rgb_rgb565D_convert (j_decompress_ptr cinfo, rgb_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
rgb_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); rgb_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -710,9 +698,8 @@ rgb_rgb565D_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
gray_rgb565_convert (j_decompress_ptr cinfo, gray_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
gray_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); gray_rgb565_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
@@ -722,9 +709,8 @@ gray_rgb565_convert (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
gray_rgb565D_convert (j_decompress_ptr cinfo, gray_rgb565D_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
JSAMPARRAY output_buf, int num_rows)
{ {
if (is_big_endian()) if (is_big_endian())
gray_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows); gray_rgb565D_convert_be(cinfo, input_buf, input_row, output_buf, num_rows);
+54 -54
View File
@@ -94,60 +94,60 @@ EXTERN(void) jpeg_fdct_islow (DCTELEM *data);
EXTERN(void) jpeg_fdct_ifast(DCTELEM *data); EXTERN(void) jpeg_fdct_ifast(DCTELEM *data);
EXTERN(void) jpeg_fdct_float(FAST_FLOAT *data); EXTERN(void) jpeg_fdct_float(FAST_FLOAT *data);
EXTERN(void) jpeg_idct_islow EXTERN(void) jpeg_idct_islow(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_ifast EXTERN(void) jpeg_idct_ifast(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_float EXTERN(void) jpeg_idct_float(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_7x7 EXTERN(void) jpeg_idct_7x7(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_6x6 EXTERN(void) jpeg_idct_6x6(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_5x5 EXTERN(void) jpeg_idct_5x5(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_4x4 EXTERN(void) jpeg_idct_4x4(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_3x3 EXTERN(void) jpeg_idct_3x3(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_2x2 EXTERN(void) jpeg_idct_2x2(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_1x1 EXTERN(void) jpeg_idct_1x1(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_9x9 EXTERN(void) jpeg_idct_9x9(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_10x10 EXTERN(void) jpeg_idct_10x10(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_11x11 EXTERN(void) jpeg_idct_11x11(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_12x12 EXTERN(void) jpeg_idct_12x12(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_13x13 EXTERN(void) jpeg_idct_13x13(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_14x14 EXTERN(void) jpeg_idct_14x14(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_15x15 EXTERN(void) jpeg_idct_15x15(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
EXTERN(void) jpeg_idct_16x16 EXTERN(void) jpeg_idct_16x16(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col); JSAMPARRAY output_buf, JDIMENSION output_col);
/* /*
+21 -16
View File
@@ -4,7 +4,7 @@
* 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-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, 2016, D. R. Commander. * Copyright (C) 2009-2011, 2016, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -15,6 +15,9 @@
* up to the start of the current MCU. To do this, we copy state variables * up to the start of the current MCU. To do this, we copy state variables
* into local working storage, and update them back to the permanent * into local working storage, and update them back to the permanent
* storage only upon successful completion of an MCU. * storage only upon successful completion of an MCU.
*
* NOTE: All referenced figures are from
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
@@ -400,8 +403,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state,
handle markers. We have to hand off any blocks with markers to the handle markers. We have to hand off any blocks with markers to the
slower routines. */ slower routines. */
#define GET_BYTE \ #define GET_BYTE { \
{ \
register int c0, c1; \ register int c0, c1; \
c0 = GETJOCTET(*buffer++); \ c0 = GETJOCTET(*buffer++); \
c1 = GETJOCTET(*buffer); \ c1 = GETJOCTET(*buffer); \
@@ -460,7 +462,7 @@ jpeg_huff_decode (bitread_working_state *state,
code = GET_BITS(l); code = GET_BITS(l);
/* Collect the rest of the Huffman code one bit at a time. */ /* Collect the rest of the Huffman code one bit at a time. */
/* This is per Figure F.16 in the JPEG spec. */ /* This is per Figure F.16. */
while (code > htbl->maxcode[l]) { while (code > htbl->maxcode[l]) {
code <<= 1; code <<= 1;
@@ -493,21 +495,25 @@ jpeg_huff_decode (bitread_working_state *state,
#ifdef AVOID_TABLES #ifdef AVOID_TABLES
#define NEG_1 ((unsigned int)-1) #define NEG_1 ((unsigned int)-1)
#define HUFF_EXTEND(x,s) ((x) + ((((x) - (1<<((s)-1))) >> 31) & (((NEG_1)<<(s)) + 1))) #define HUFF_EXTEND(x, s) \
((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
#else #else
#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) #define HUFF_EXTEND(x, s) \
((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
static const int extend_test[16] = /* entry n is 2**(n-1) */ static const int extend_test[16] = { /* entry n is 2**(n-1) */
{ 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000
};
static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ static const int extend_offset[16] = { /* entry n is (-1 << n) + 1 */
{ 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, 0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1,
((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1, ((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1,
((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1, ((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1,
((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; ((-1) << 13) + 1, ((-1) << 14) + 1, ((-1) << 15) + 1
};
#endif /* AVOID_TABLES */ #endif /* AVOID_TABLES */
@@ -766,8 +772,8 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
usefast = 0; usefast = 0;
} }
if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
|| cinfo->unread_marker != 0) cinfo->unread_marker != 0)
usefast = 0; usefast = 0;
/* If we've run out of data, just leave the MCU set to zeroes. /* If we've run out of data, just leave the MCU set to zeroes.
@@ -777,8 +783,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if (usefast) { if (usefast) {
if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow; if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
} } else {
else {
use_slow: use_slow:
if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE; if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
} }
+19 -15
View File
@@ -47,9 +47,8 @@ typedef struct {
} d_derived_tbl; } d_derived_tbl;
/* Expand a Huffman table definition into the derived format */ /* Expand a Huffman table definition into the derived format */
EXTERN(void) jpeg_make_d_derived_tbl EXTERN(void) jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC,
(j_decompress_ptr cinfo, boolean isDC, int tblno, int tblno, d_derived_tbl **pdtbl);
d_derived_tbl ** pdtbl);
/* /*
@@ -149,11 +148,13 @@ typedef struct { /* Bitreading working state within an MCU */
* is evaluated multiple times. * is evaluated multiple times.
*/ */
#define CHECK_BIT_BUFFER(state,nbits,action) \ #define CHECK_BIT_BUFFER(state, nbits, action) { \
{ if (bits_left < (nbits)) { \ if (bits_left < (nbits)) { \
if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \ if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
{ action; } \ { action; } \
get_buffer = (state).get_buffer; bits_left = (state).bits_left; } } get_buffer = (state).get_buffer; bits_left = (state).bits_left; \
} \
}
#define GET_BITS(nbits) \ #define GET_BITS(nbits) \
(((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1)) (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
@@ -165,8 +166,8 @@ typedef struct { /* Bitreading working state within an MCU */
(bits_left -= (nbits)) (bits_left -= (nbits))
/* Load up the bit buffer to a depth of at least nbits */ /* Load up the bit buffer to a depth of at least nbits */
EXTERN(boolean) jpeg_fill_bit_buffer EXTERN(boolean) jpeg_fill_bit_buffer(bitread_working_state *state,
(bitread_working_state *state, register bit_buf_type get_buffer, register bit_buf_type get_buffer,
register int bits_left, int nbits); register int bits_left, int nbits);
@@ -187,10 +188,11 @@ EXTERN(boolean) jpeg_fill_bit_buffer
* 3. jpeg_huff_decode returns -1 if forced to suspend. * 3. jpeg_huff_decode returns -1 if forced to suspend.
*/ */
#define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \ #define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
{ register int nb, look; \ register int nb, look; \
if (bits_left < HUFF_LOOKAHEAD) { \ if (bits_left < HUFF_LOOKAHEAD) { \
if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \ if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
{ failaction; } \
get_buffer = state.get_buffer; bits_left = state.bits_left; \ get_buffer = state.get_buffer; bits_left = state.bits_left; \
if (bits_left < HUFF_LOOKAHEAD) { \ if (bits_left < HUFF_LOOKAHEAD) { \
nb = 1; goto slowlabel; \ nb = 1; goto slowlabel; \
@@ -202,7 +204,8 @@ EXTERN(boolean) jpeg_fill_bit_buffer
result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \ result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
} else { \ } else { \
slowlabel: \ slowlabel: \
if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \ if ((result = \
jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
{ failaction; } \ { failaction; } \
get_buffer = state.get_buffer; bits_left = state.bits_left; \ get_buffer = state.get_buffer; bits_left = state.bits_left; \
} \ } \
@@ -229,6 +232,7 @@ slowlabel: \
} }
/* Out-of-line case for Huffman code fetching */ /* Out-of-line case for Huffman code fetching */
EXTERN(int) jpeg_huff_decode EXTERN(int) jpeg_huff_decode(bitread_working_state *state,
(bitread_working_state *state, register bit_buf_type get_buffer, register bit_buf_type get_buffer,
register int bits_left, d_derived_tbl *htbl, int min_bits); register int bits_left, d_derived_tbl *htbl,
int min_bits);
+171
View File
@@ -0,0 +1,171 @@
/*
* jdicc.c
*
* Copyright (C) 1997-1998, Thomas G. Lane, Todd Newman.
* Copyright (C) 2017, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
* This file provides code to read International Color Consortium (ICC) device
* profiles embedded in JFIF JPEG image files. The ICC has defined a standard
* for including such data in JPEG "APP2" markers. The code given here does
* not know anything about the internal structure of the ICC profile data; it
* just knows how to get the profile data from a JPEG file while reading it.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jerror.h"
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc() */
extern void *malloc(size_t size);
#endif
#define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */
#define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */
/*
* Handy subroutine to test whether a saved marker is an ICC profile marker.
*/
LOCAL(boolean)
marker_is_icc(jpeg_saved_marker_ptr marker)
{
return
marker->marker == ICC_MARKER &&
marker->data_length >= ICC_OVERHEAD_LEN &&
/* verify the identifying string */
GETJOCTET(marker->data[0]) == 0x49 &&
GETJOCTET(marker->data[1]) == 0x43 &&
GETJOCTET(marker->data[2]) == 0x43 &&
GETJOCTET(marker->data[3]) == 0x5F &&
GETJOCTET(marker->data[4]) == 0x50 &&
GETJOCTET(marker->data[5]) == 0x52 &&
GETJOCTET(marker->data[6]) == 0x4F &&
GETJOCTET(marker->data[7]) == 0x46 &&
GETJOCTET(marker->data[8]) == 0x49 &&
GETJOCTET(marker->data[9]) == 0x4C &&
GETJOCTET(marker->data[10]) == 0x45 &&
GETJOCTET(marker->data[11]) == 0x0;
}
/*
* See if there was an ICC profile in the JPEG file being read; if so,
* reassemble and return the profile data.
*
* TRUE is returned if an ICC profile was found, FALSE if not. If TRUE is
* returned, *icc_data_ptr is set to point to the returned data, and
* *icc_data_len is set to its length.
*
* IMPORTANT: the data at *icc_data_ptr is allocated with malloc() and must be
* freed by the caller with free() when the caller no longer needs it.
* (Alternatively, we could write this routine to use the IJG library's memory
* allocator, so that the data would be freed implicitly when
* jpeg_finish_decompress() is called. But it seems likely that many
* applications will prefer to have the data stick around after decompression
* finishes.)
*/
GLOBAL(boolean)
jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr,
unsigned int *icc_data_len)
{
jpeg_saved_marker_ptr marker;
int num_markers = 0;
int seq_no;
JOCTET *icc_data;
unsigned int total_length;
#define MAX_SEQ_NO 255 /* sufficient since marker numbers are bytes */
char marker_present[MAX_SEQ_NO + 1]; /* 1 if marker found */
unsigned int data_length[MAX_SEQ_NO + 1]; /* size of profile data in marker */
unsigned int data_offset[MAX_SEQ_NO + 1]; /* offset for data in marker */
if (icc_data_ptr == NULL || icc_data_len == NULL)
ERREXIT(cinfo, JERR_BUFFER_SIZE);
if (cinfo->global_state < DSTATE_READY)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
*icc_data_ptr = NULL; /* avoid confusion if FALSE return */
*icc_data_len = 0;
/* This first pass over the saved markers discovers whether there are
* any ICC markers and verifies the consistency of the marker numbering.
*/
for (seq_no = 1; seq_no <= MAX_SEQ_NO; seq_no++)
marker_present[seq_no] = 0;
for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
if (marker_is_icc(marker)) {
if (num_markers == 0)
num_markers = GETJOCTET(marker->data[13]);
else if (num_markers != GETJOCTET(marker->data[13])) {
WARNMS(cinfo, JWRN_BOGUS_ICC); /* inconsistent num_markers fields */
return FALSE;
}
seq_no = GETJOCTET(marker->data[12]);
if (seq_no <= 0 || seq_no > num_markers) {
WARNMS(cinfo, JWRN_BOGUS_ICC); /* bogus sequence number */
return FALSE;
}
if (marker_present[seq_no]) {
WARNMS(cinfo, JWRN_BOGUS_ICC); /* duplicate sequence numbers */
return FALSE;
}
marker_present[seq_no] = 1;
data_length[seq_no] = marker->data_length - ICC_OVERHEAD_LEN;
}
}
if (num_markers == 0)
return FALSE;
/* Check for missing markers, count total space needed,
* compute offset of each marker's part of the data.
*/
total_length = 0;
for (seq_no = 1; seq_no <= num_markers; seq_no++) {
if (marker_present[seq_no] == 0) {
WARNMS(cinfo, JWRN_BOGUS_ICC); /* missing sequence number */
return FALSE;
}
data_offset[seq_no] = total_length;
total_length += data_length[seq_no];
}
if (total_length == 0) {
WARNMS(cinfo, JWRN_BOGUS_ICC); /* found only empty markers? */
return FALSE;
}
/* Allocate space for assembled data */
icc_data = (JOCTET *)malloc(total_length * sizeof(JOCTET));
if (icc_data == NULL)
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 11); /* oops, out of memory */
/* and fill it in */
for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
if (marker_is_icc(marker)) {
JOCTET FAR *src_ptr;
JOCTET *dst_ptr;
unsigned int length;
seq_no = GETJOCTET(marker->data[12]);
dst_ptr = icc_data + data_offset[seq_no];
src_ptr = marker->data + ICC_OVERHEAD_LEN;
length = data_length[seq_no];
while (length--) {
*dst_ptr++ = *src_ptr++;
}
}
}
*icc_data_ptr = icc_data;
*icc_data_len = total_length;
return TRUE;
}
+11 -8
View File
@@ -4,7 +4,7 @@
* 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-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2010, 2016, D. R. Commander. * Copyright (C) 2010, 2016, 2018, D. R. Commander.
* Copyright (C) 2015, Google, Inc. * Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
@@ -66,8 +66,10 @@ initial_setup (j_decompress_ptr cinfo)
cinfo->max_v_samp_factor = 1; cinfo->max_v_samp_factor = 1;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) { ci++, compptr++) {
if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR || if (compptr->h_samp_factor <= 0 ||
compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR) compptr->h_samp_factor > MAX_SAMP_FACTOR ||
compptr->v_samp_factor <= 0 ||
compptr->v_samp_factor > MAX_SAMP_FACTOR)
ERREXIT(cinfo, JERR_BAD_SAMPLING); ERREXIT(cinfo, JERR_BAD_SAMPLING);
cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor, cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
compptr->h_samp_factor); compptr->h_samp_factor);
@@ -198,7 +200,8 @@ per_scan_setup (j_decompress_ptr cinfo)
compptr->MCU_width = compptr->h_samp_factor; compptr->MCU_width = compptr->h_samp_factor;
compptr->MCU_height = compptr->v_samp_factor; compptr->MCU_height = compptr->v_samp_factor;
compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height; compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
compptr->MCU_sample_width = compptr->MCU_width * compptr->_DCT_scaled_size; compptr->MCU_sample_width = compptr->MCU_width *
compptr->_DCT_scaled_size;
/* Figure number of non-dummy blocks in last MCU column & row */ /* Figure number of non-dummy blocks in last MCU column & row */
tmp = (int)(compptr->width_in_blocks % compptr->MCU_width); tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
if (tmp == 0) tmp = compptr->MCU_width; if (tmp == 0) tmp = compptr->MCU_width;
@@ -231,10 +234,10 @@ per_scan_setup (j_decompress_ptr cinfo)
* means that we have to save away the table actually used for each component. * means that we have to save away the table actually used for each component.
* We do this by copying the table at the start of the first scan containing * We do this by copying the table at the start of the first scan containing
* the component. * the component.
* The JPEG spec prohibits the encoder from changing the contents of a Q-table * Rec. ITU-T T.81 | ISO/IEC 10918-1 prohibits the encoder from changing the
* slot between scans of a component using that slot. If the encoder does so * contents of a Q-table slot between scans of a component using that slot. If
* anyway, this decoder will simply use the Q-table values that were current * the encoder does so anyway, this decoder will simply use the Q-table values
* at the start of the first scan for the component. * that were current at the start of the first scan for the component.
* *
* The decompressor output side looks only at the saved quant tables, * The decompressor output side looks only at the saved quant tables,
* not at the current Q-table slots. * not at the current Q-table slots.
+28 -24
View File
@@ -112,16 +112,19 @@
/* Forward declarations */ /* Forward declarations */
METHODDEF(void) process_data_simple_main METHODDEF(void) process_data_simple_main(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPARRAY output_buf, JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); JDIMENSION *out_row_ctr,
METHODDEF(void) process_data_context_main JDIMENSION out_rows_avail);
(j_decompress_ptr cinfo, JSAMPARRAY output_buf, METHODDEF(void) process_data_context_main(j_decompress_ptr cinfo,
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail);
#ifdef QUANT_2PASS_SUPPORTED #ifdef QUANT_2PASS_SUPPORTED
METHODDEF(void) process_data_crank_post METHODDEF(void) process_data_crank_post(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPARRAY output_buf, JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail);
#endif #endif
@@ -286,9 +289,8 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
METHODDEF(void) METHODDEF(void)
process_data_simple_main (j_decompress_ptr cinfo, process_data_simple_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_main_ptr main_ptr = (my_main_ptr)cinfo->main; my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
JDIMENSION rowgroups_avail; JDIMENSION rowgroups_avail;
@@ -326,9 +328,8 @@ process_data_simple_main (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
process_data_context_main (j_decompress_ptr cinfo, process_data_context_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_main_ptr main_ptr = (my_main_ptr)cinfo->main; my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
@@ -349,9 +350,11 @@ process_data_context_main (j_decompress_ptr cinfo,
switch (main_ptr->context_state) { switch (main_ptr->context_state) {
case CTX_POSTPONED_ROW: case CTX_POSTPONED_ROW:
/* Call postprocessor using previously set pointers for postponed row */ /* Call postprocessor using previously set pointers for postponed row */
(*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], (*cinfo->post->post_process_data) (cinfo,
&main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, main_ptr->xbuffer[main_ptr->whichptr],
output_buf, out_row_ctr, out_rows_avail); &main_ptr->rowgroup_ctr,
main_ptr->rowgroups_avail, output_buf,
out_row_ctr, out_rows_avail);
if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
return; /* Need to suspend */ return; /* Need to suspend */
main_ptr->context_state = CTX_PREPARE_FOR_IMCU; main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
@@ -371,9 +374,11 @@ process_data_context_main (j_decompress_ptr cinfo,
/*FALLTHROUGH*/ /*FALLTHROUGH*/
case CTX_PROCESS_IMCU: case CTX_PROCESS_IMCU:
/* Call postprocessor using previously set pointers */ /* Call postprocessor using previously set pointers */
(*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr], (*cinfo->post->post_process_data) (cinfo,
&main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail, main_ptr->xbuffer[main_ptr->whichptr],
output_buf, out_row_ctr, out_rows_avail); &main_ptr->rowgroup_ctr,
main_ptr->rowgroups_avail, output_buf,
out_row_ctr, out_rows_avail);
if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail) if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
return; /* Need to suspend */ return; /* Need to suspend */
/* After the first iMCU, change wraparound pointers to normal state */ /* After the first iMCU, change wraparound pointers to normal state */
@@ -400,9 +405,8 @@ process_data_context_main (j_decompress_ptr cinfo,
#ifdef QUANT_2PASS_SUPPORTED #ifdef QUANT_2PASS_SUPPORTED
METHODDEF(void) METHODDEF(void)
process_data_crank_post (j_decompress_ptr cinfo, process_data_crank_post(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
(*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE)NULL, (*cinfo->post->post_process_data) (cinfo, (JSAMPIMAGE)NULL,
(JDIMENSION *)NULL, (JDIMENSION)0, (JDIMENSION *)NULL, (JDIMENSION)0,
+6 -6
View File
@@ -267,8 +267,8 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
/* We don't support files in which the image height is initially specified */ /* We don't support files in which the image height is initially specified */
/* as 0 and is later redefined by DNL. As long as we have to check that, */ /* as 0 and is later redefined by DNL. As long as we have to check that, */
/* might as well have a general sanity check. */ /* might as well have a general sanity check. */
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|| cinfo->num_components <= 0) cinfo->num_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE); ERREXIT(cinfo, JERR_EMPTY_IMAGE);
if (length != (cinfo->num_components * 3)) if (length != (cinfo->num_components * 3))
@@ -598,8 +598,8 @@ get_dri (j_decompress_ptr cinfo)
LOCAL(void) LOCAL(void)
examine_app0 (j_decompress_ptr cinfo, JOCTET *data, examine_app0(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
unsigned int datalen, JLONG remaining) JLONG remaining)
/* Examine first few bytes from an APP0. /* Examine first few bytes from an APP0.
* Take appropriate action if it is a JFIF marker. * Take appropriate action if it is a JFIF marker.
* datalen is # of bytes at data[], remaining is length of rest of marker data. * datalen is # of bytes at data[], remaining is length of rest of marker data.
@@ -674,8 +674,8 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET *data,
LOCAL(void) LOCAL(void)
examine_app14 (j_decompress_ptr cinfo, JOCTET *data, examine_app14(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
unsigned int datalen, JLONG remaining) JLONG remaining)
/* Examine first few bytes from an APP14. /* Examine first few bytes from an APP14.
* Take appropriate action if it is an Adobe marker. * Take appropriate action if it is an Adobe marker.
* datalen is # of bytes at data[], remaining is length of rest of marker data. * datalen is # of bytes at data[], remaining is length of rest of marker data.
+2 -1
View File
@@ -469,7 +469,8 @@ master_selection (j_decompress_ptr cinfo)
prepare_range_limit_table(cinfo); prepare_range_limit_table(cinfo);
/* Width of an output scanline must be representable as JDIMENSION. */ /* Width of an output scanline must be representable as JDIMENSION. */
samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; samplesperrow = (long)cinfo->output_width *
(long)cinfo->out_color_components;
jd_samplesperrow = (JDIMENSION)samplesperrow; jd_samplesperrow = (JDIMENSION)samplesperrow;
if ((long)jd_samplesperrow != samplesperrow) if ((long)jd_samplesperrow != samplesperrow)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
+23 -31
View File
@@ -248,11 +248,10 @@ start_pass_merged_upsample (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
merged_2v_upsample (j_decompress_ptr cinfo, merged_2v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */ /* 2:1 vertical sampling case: may need a spare row. */
{ {
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
@@ -264,8 +263,8 @@ merged_2v_upsample (j_decompress_ptr cinfo,
JDIMENSION size = upsample->out_row_width; JDIMENSION size = upsample->out_row_width;
if (cinfo->out_color_space == JCS_RGB565) if (cinfo->out_color_space == JCS_RGB565)
size = cinfo->output_width * 2; size = cinfo->output_width * 2;
jcopy_sample_rows(& upsample->spare_row, 0, output_buf + *out_row_ctr, 0, jcopy_sample_rows(&upsample->spare_row, 0, output_buf + *out_row_ctr, 0, 1,
1, size); size);
num_rows = 1; num_rows = 1;
upsample->spare_full = FALSE; upsample->spare_full = FALSE;
} else { } else {
@@ -300,11 +299,10 @@ merged_2v_upsample (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
merged_1v_upsample (j_decompress_ptr cinfo, merged_1v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */ /* 1:1 vertical sampling case: much easier, never need a spare row. */
{ {
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
@@ -333,9 +331,8 @@ merged_1v_upsample (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
h2v1_merged_upsample (j_decompress_ptr cinfo, h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -379,9 +376,8 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
h2v2_merged_upsample (j_decompress_ptr cinfo, h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
switch (cinfo->out_color_space) { switch (cinfo->out_color_space) {
case JCS_EXT_RGB: case JCS_EXT_RGB:
@@ -452,7 +448,7 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
/* Declarations for ordered dithering /* Declarations for ordered dithering
* *
* We use a 4x4 ordered dither array packed into 32 bits. This array is * We use a 4x4 ordered dither array packed into 32 bits. This array is
* sufficent for dithering RGB888 to RGB565. * sufficient for dithering RGB888 to RGB565.
*/ */
#define DITHER_MASK 0x3 #define DITHER_MASK 0x3
@@ -510,9 +506,8 @@ static INLINE boolean is_big_endian(void)
METHODDEF(void) METHODDEF(void)
h2v1_merged_upsample_565 (j_decompress_ptr cinfo, h2v1_merged_upsample_565(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
if (is_big_endian()) if (is_big_endian())
h2v1_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr, h2v1_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr,
@@ -524,9 +519,8 @@ h2v1_merged_upsample_565 (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
h2v1_merged_upsample_565D (j_decompress_ptr cinfo, h2v1_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
if (is_big_endian()) if (is_big_endian())
h2v1_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr, h2v1_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr,
@@ -538,9 +532,8 @@ h2v1_merged_upsample_565D (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
h2v2_merged_upsample_565 (j_decompress_ptr cinfo, h2v2_merged_upsample_565(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
if (is_big_endian()) if (is_big_endian())
h2v2_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr, h2v2_merged_upsample_565_be(cinfo, input_buf, in_row_group_ctr,
@@ -552,9 +545,8 @@ h2v2_merged_upsample_565 (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
h2v2_merged_upsample_565D (j_decompress_ptr cinfo, h2v2_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JSAMPARRAY output_buf)
{ {
if (is_big_endian()) if (is_big_endian())
h2v2_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr, h2v2_merged_upsample_565D_be(cinfo, input_buf, in_row_group_ctr,
+11 -13
View File
@@ -5,7 +5,7 @@
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2013, Linaro Limited. * Copyright (C) 2013, Linaro Limited.
* Copyright (C) 2014-2015, D. R. Commander. * Copyright (C) 2014-2015, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -15,8 +15,7 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
h2v1_merged_upsample_565_internal (j_decompress_ptr cinfo, h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
@@ -160,8 +159,7 @@ h2v1_merged_upsample_565D_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
h2v2_merged_upsample_565_internal (j_decompress_ptr cinfo, h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
@@ -304,20 +302,20 @@ h2v2_merged_upsample_565D_internal (j_decompress_ptr cinfo,
rgb = PACK_SHORT_565(r, g, b); rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr00++); y = GETJSAMPLE(*inptr00++);
r = range_limit[DITHER_565_R(y + cred, d1)]; r = range_limit[DITHER_565_R(y + cred, d0)];
g = range_limit[DITHER_565_G(y + cgreen, d1)]; g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d1)]; b = range_limit[DITHER_565_B(y + cblue, d0)];
d1 = DITHER_ROTATE(d1); d0 = DITHER_ROTATE(d0);
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b)); rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
WRITE_TWO_PIXELS(outptr0, rgb); WRITE_TWO_PIXELS(outptr0, rgb);
outptr0 += 4; outptr0 += 4;
y = GETJSAMPLE(*inptr01++); y = GETJSAMPLE(*inptr01++);
r = range_limit[DITHER_565_R(y + cred, d0)]; r = range_limit[DITHER_565_R(y + cred, d1)];
g = range_limit[DITHER_565_G(y + cgreen, d0)]; g = range_limit[DITHER_565_G(y + cgreen, d1)];
b = range_limit[DITHER_565_B(y + cblue, d0)]; b = range_limit[DITHER_565_B(y + cblue, d1)];
d0 = DITHER_ROTATE(d0); d1 = DITHER_ROTATE(d1);
rgb = PACK_SHORT_565(r, g, b); rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr01++); y = GETJSAMPLE(*inptr01++);
+2 -4
View File
@@ -21,8 +21,7 @@
INLINE INLINE
LOCAL(void) LOCAL(void)
h2v1_merged_upsample_internal (j_decompress_ptr cinfo, h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
@@ -94,8 +93,7 @@ h2v1_merged_upsample_internal (j_decompress_ptr cinfo,
INLINE INLINE
LOCAL(void) LOCAL(void)
h2v2_merged_upsample_internal (j_decompress_ptr cinfo, h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf) JSAMPARRAY output_buf)
{ {
+23 -10
View File
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Copyright (C) 1995-1997, Thomas G. Lane. * Copyright (C) 1995-1997, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2015-2016, D. R. Commander. * Copyright (C) 2015-2016, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -15,12 +15,16 @@
* up to the start of the current MCU. To do this, we copy state variables * up to the start of the current MCU. To do this, we copy state variables
* into local working storage, and update them back to the permanent * into local working storage, and update them back to the permanent
* storage only upon successful completion of an MCU. * storage only upon successful completion of an MCU.
*
* NOTE: All referenced figures are from
* Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994.
*/ */
#define JPEG_INTERNALS #define JPEG_INTERNALS
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jdhuff.h" /* Declarations shared with jdhuff.c */ #include "jdhuff.h" /* Declarations shared with jdhuff.c */
#include <limits.h>
#ifdef D_PROGRESSIVE_SUPPORTED #ifdef D_PROGRESSIVE_SUPPORTED
@@ -206,21 +210,25 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo)
#ifdef AVOID_TABLES #ifdef AVOID_TABLES
#define NEG_1 ((unsigned)-1) #define NEG_1 ((unsigned)-1)
#define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((NEG_1)<<(s)) + 1) : (x)) #define HUFF_EXTEND(x, s) \
((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
#else #else
#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) #define HUFF_EXTEND(x, s) \
((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
static const int extend_test[16] = /* entry n is 2**(n-1) */ static const int extend_test[16] = { /* entry n is 2**(n-1) */
{ 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000
};
static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ static const int extend_offset[16] = { /* entry n is (-1 << n) + 1 */
{ 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, 0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1,
((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1, ((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1,
((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1, ((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1,
((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; ((-1) << 13) + 1, ((-1) << 14) + 1, ((-1) << 15) + 1
};
#endif /* AVOID_TABLES */ #endif /* AVOID_TABLES */
@@ -336,6 +344,10 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
} }
/* Convert DC difference to actual value, update last_dc_val */ /* Convert DC difference to actual value, update last_dc_val */
if ((state.last_dc_val[ci] >= 0 &&
s > INT_MAX - state.last_dc_val[ci]) ||
(state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
s += state.last_dc_val[ci]; s += state.last_dc_val[ci];
state.last_dc_val[ci] = s; state.last_dc_val[ci] = s;
/* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */ /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
@@ -664,7 +676,8 @@ jinit_phuff_decoder (j_decompress_ptr cinfo)
/* Create progression status table */ /* Create progression status table */
cinfo->coef_bits = (int (*)[DCTSIZE2]) cinfo->coef_bits = (int (*)[DCTSIZE2])
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components*DCTSIZE2*sizeof(int)); cinfo->num_components * DCTSIZE2 *
sizeof(int));
coef_bit_ptr = &cinfo->coef_bits[0][0]; coef_bit_ptr = &cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++) for (ci = 0; ci < cinfo->num_components; ci++)
for (i = 0; i < DCTSIZE2; i++) for (i = 0; i < DCTSIZE2; i++)
+41 -37
View File
@@ -46,21 +46,27 @@ typedef my_post_controller *my_post_ptr;
/* Forward declarations */ /* Forward declarations */
METHODDEF(void) post_process_1pass METHODDEF(void) post_process_1pass(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JSAMPIMAGE input_buf,
JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JDIMENSION *in_row_group_ctr,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION in_row_groups_avail,
JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail); JDIMENSION out_rows_avail);
#ifdef QUANT_2PASS_SUPPORTED #ifdef QUANT_2PASS_SUPPORTED
METHODDEF(void) post_process_prepass METHODDEF(void) post_process_prepass(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JSAMPIMAGE input_buf,
JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JDIMENSION *in_row_group_ctr,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION in_row_groups_avail,
JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail); JDIMENSION out_rows_avail);
METHODDEF(void) post_process_2pass METHODDEF(void) post_process_2pass(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JSAMPIMAGE input_buf,
JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JDIMENSION *in_row_group_ctr,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION in_row_groups_avail,
JSAMPARRAY output_buf,
JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail); JDIMENSION out_rows_avail);
#endif #endif
@@ -123,11 +129,10 @@ start_pass_dpost (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
*/ */
METHODDEF(void) METHODDEF(void)
post_process_1pass (j_decompress_ptr cinfo, post_process_1pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_post_ptr post = (my_post_ptr)cinfo->post; my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION num_rows, max_rows; JDIMENSION num_rows, max_rows;
@@ -138,12 +143,13 @@ post_process_1pass (j_decompress_ptr cinfo,
if (max_rows > post->strip_height) if (max_rows > post->strip_height)
max_rows = post->strip_height; max_rows = post->strip_height;
num_rows = 0; num_rows = 0;
(*cinfo->upsample->upsample) (cinfo, (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr,
input_buf, in_row_group_ctr, in_row_groups_avail, in_row_groups_avail, post->buffer, &num_rows,
post->buffer, &num_rows, max_rows); max_rows);
/* Quantize and emit data. */ /* Quantize and emit data. */
(*cinfo->cquantize->color_quantize) (cinfo, (*cinfo->cquantize->color_quantize) (cinfo, post->buffer,
post->buffer, output_buf + *out_row_ctr, (int) num_rows); output_buf + *out_row_ctr,
(int)num_rows);
*out_row_ctr += num_rows; *out_row_ctr += num_rows;
} }
@@ -155,11 +161,10 @@ post_process_1pass (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
post_process_prepass (j_decompress_ptr cinfo, post_process_prepass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_post_ptr post = (my_post_ptr)cinfo->post; my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION old_next_row, num_rows; JDIMENSION old_next_row, num_rows;
@@ -173,9 +178,9 @@ post_process_prepass (j_decompress_ptr cinfo,
/* Upsample some data (up to a strip height's worth). */ /* Upsample some data (up to a strip height's worth). */
old_next_row = post->next_row; old_next_row = post->next_row;
(*cinfo->upsample->upsample) (cinfo, (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr,
input_buf, in_row_group_ctr, in_row_groups_avail, in_row_groups_avail, post->buffer,
post->buffer, &post->next_row, post->strip_height); &post->next_row, post->strip_height);
/* Allow quantizer to scan new data. No data is emitted, */ /* Allow quantizer to scan new data. No data is emitted, */
/* but we advance out_row_ctr so outer loop can tell when we're done. */ /* but we advance out_row_ctr so outer loop can tell when we're done. */
@@ -199,11 +204,10 @@ post_process_prepass (j_decompress_ptr cinfo,
*/ */
METHODDEF(void) METHODDEF(void)
post_process_2pass (j_decompress_ptr cinfo, post_process_2pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr,
JDIMENSION in_row_groups_avail, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
JDIMENSION out_rows_avail)
{ {
my_post_ptr post = (my_post_ptr)cinfo->post; my_post_ptr post = (my_post_ptr)cinfo->post;
JDIMENSION num_rows, max_rows; JDIMENSION num_rows, max_rows;
@@ -226,8 +230,8 @@ post_process_2pass (j_decompress_ptr cinfo,
num_rows = max_rows; num_rows = max_rows;
/* Quantize and emit data. */ /* Quantize and emit data. */
(*cinfo->cquantize->color_quantize) (cinfo, (*cinfo->cquantize->color_quantize) (cinfo, post->buffer + post->next_row,
post->buffer + post->next_row, output_buf + *out_row_ctr, output_buf + *out_row_ctr,
(int)num_rows); (int)num_rows);
*out_row_ctr += num_rows; *out_row_ctr += num_rows;
+6 -9
View File
@@ -56,9 +56,8 @@ start_pass_upsample (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
sep_upsample (j_decompress_ptr cinfo, sep_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail,
JDIMENSION in_row_groups_avail,
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail) JDIMENSION out_rows_avail)
{ {
@@ -97,8 +96,7 @@ sep_upsample (j_decompress_ptr cinfo,
(*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf, (*cinfo->cconvert->color_convert) (cinfo, upsample->color_buf,
(JDIMENSION)upsample->next_row_out, (JDIMENSION)upsample->next_row_out,
output_buf + *out_row_ctr, output_buf + *out_row_ctr, (int)num_rows);
(int) num_rows);
/* Adjust counts */ /* Adjust counts */
*out_row_ctr += num_rows; *out_row_ctr += num_rows;
@@ -247,8 +245,8 @@ h2v2_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
*outptr++ = invalue; *outptr++ = invalue;
*outptr++ = invalue; *outptr++ = invalue;
} }
jcopy_sample_rows(output_data, outrow, output_data, outrow+1, jcopy_sample_rows(output_data, outrow, output_data, outrow + 1, 1,
1, cinfo->output_width); cinfo->output_width);
inrow++; inrow++;
outrow += 2; outrow += 2;
} }
@@ -459,8 +457,7 @@ jinit_upsampler (j_decompress_ptr cinfo)
/* Fullsize components can be processed without any work. */ /* Fullsize components can be processed without any work. */
upsample->methods[ci] = fullsize_upsample; upsample->methods[ci] = fullsize_upsample;
need_buffer = FALSE; need_buffer = FALSE;
} else if (h_in_group * 2 == h_out_group && } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
v_in_group == v_out_group) {
/* Special cases for 2h1v upsampling */ /* Special cases for 2h1v upsampling */
if (do_fancy && compptr->downsampled_width > 2) { if (do_fancy && compptr->downsampled_width > 2) {
if (jsimd_can_h2v1_fancy_upsample()) if (jsimd_can_h2v1_fancy_upsample())
+4 -5
View File
@@ -5,7 +5,7 @@
* Copyright (C) 1994-1997, Thomas G. Lane. * Copyright (C) 1994-1997, Thomas G. Lane.
* Modified 1997-2009 by Guido Vollbeding. * Modified 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2014, D. R. Commander. * Copyright (C) 2014, 2017, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -44,8 +44,7 @@ JMESSAGE(JMSG_NOMESSAGE, "Bogus message code %d") /* Must be first entry! */
/* For maintenance convenience, list is alphabetical by message code name */ /* For maintenance convenience, list is alphabetical by message code name */
#if JPEG_LIB_VERSION < 70 #if JPEG_LIB_VERSION < 70
JMESSAGE(JERR_ARITH_NOTIMPL, JMESSAGE(JERR_ARITH_NOTIMPL, "Sorry, arithmetic coding is not implemented")
"Sorry, arithmetic coding is not implemented")
#endif #endif
JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix") JMESSAGE(JERR_BAD_ALIGN_TYPE, "ALIGN_TYPE is wrong, please fix")
JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix") JMESSAGE(JERR_BAD_ALLOC_CHUNK, "MAX_ALLOC_CHUNK is wrong, please fix")
@@ -154,8 +153,7 @@ JMESSAGE(JTRC_HUFFBITS, " %3d %3d %3d %3d %3d %3d %3d %3d")
JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d") JMESSAGE(JTRC_JFIF, "JFIF APP0 marker: version %d.%02d, density %dx%d %d")
JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE, JMESSAGE(JTRC_JFIF_BADTHUMBNAILSIZE,
"Warning: thumbnail image size does not match data length %u") "Warning: thumbnail image size does not match data length %u")
JMESSAGE(JTRC_JFIF_EXTENSION, JMESSAGE(JTRC_JFIF_EXTENSION, "JFIF extension marker: type 0x%02x, length %u")
"JFIF extension marker: type 0x%02x, length %u")
JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image") JMESSAGE(JTRC_JFIF_THUMBNAIL, " with %d x %d thumbnail image")
JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u") JMESSAGE(JTRC_MISC_MARKER, "Miscellaneous marker 0x%02x, length %u")
JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x") JMESSAGE(JTRC_PARMLESS_MARKER, "Unexpected marker 0x%02x")
@@ -208,6 +206,7 @@ JMESSAGE(JERR_NO_ARITH_TABLE, "Arithmetic table 0x%02x was not defined")
JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code") JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
#endif #endif
#endif #endif
JMESSAGE(JWRN_BOGUS_ICC, "Corrupt JPEG data: bad ICC marker")
#ifdef JMAKE_ENUM_LIST #ifdef JMAKE_ENUM_LIST
+4 -2
View File
@@ -242,9 +242,11 @@ jpeg_fdct_islow (DCTELEM *data)
dataptr[DCTSIZE * 4] = (DCTELEM)DESCALE(tmp10 - tmp11, PASS1_BITS); dataptr[DCTSIZE * 4] = (DCTELEM)DESCALE(tmp10 - tmp11, PASS1_BITS);
z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100); z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865), dataptr[DCTSIZE * 2] =
(DCTELEM)DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
CONST_BITS + PASS1_BITS); CONST_BITS + PASS1_BITS);
dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065), dataptr[DCTSIZE * 6] =
(DCTELEM)DESCALE(z1 + MULTIPLY(tmp12, -FIX_1_847759065),
CONST_BITS + PASS1_BITS); CONST_BITS + PASS1_BITS);
/* Odd part per figure 8 --- note paper omits factor of sqrt(2). /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
+2 -2
View File
@@ -70,8 +70,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_float(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
FAST_FLOAT tmp10, tmp11, tmp12, tmp13; FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
+22 -22
View File
@@ -169,8 +169,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_ifast(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
DCTELEM tmp10, tmp11, tmp12, tmp13; DCTELEM tmp10, tmp11, tmp12, tmp13;
@@ -296,8 +296,8 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) JSAMPLE dcval =
& RANGE_MASK]; range_limit[IDESCALE(wsptr[0], PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
@@ -319,8 +319,8 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp11 = ((DCTELEM)wsptr[0] - (DCTELEM)wsptr[4]); tmp11 = ((DCTELEM)wsptr[0] - (DCTELEM)wsptr[4]);
tmp13 = ((DCTELEM)wsptr[2] + (DCTELEM)wsptr[6]); tmp13 = ((DCTELEM)wsptr[2] + (DCTELEM)wsptr[6]);
tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562) tmp12 =
- tmp13; MULTIPLY((DCTELEM)wsptr[2] - (DCTELEM)wsptr[6], FIX_1_414213562) - tmp13;
tmp0 = tmp10 + tmp13; tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13; tmp3 = tmp10 - tmp13;
@@ -347,22 +347,22 @@ jpeg_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage: scale down by a factor of 8 and range-limit */ /* Final output stage: scale down by a factor of 8 and range-limit */
outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) outptr[0] =
& RANGE_MASK]; range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS + 3) & RANGE_MASK];
outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) outptr[7] =
& RANGE_MASK]; range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS + 3) & RANGE_MASK];
outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) outptr[1] =
& RANGE_MASK]; range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS + 3) & RANGE_MASK];
outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) outptr[6] =
& RANGE_MASK]; range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS + 3) & RANGE_MASK];
outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) outptr[2] =
& RANGE_MASK]; range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS + 3) & RANGE_MASK];
outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) outptr[5] =
& RANGE_MASK]; range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS + 3) & RANGE_MASK];
outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) outptr[4] =
& RANGE_MASK]; range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS + 3) & RANGE_MASK];
outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) outptr[3] =
& RANGE_MASK]; range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS + 3) & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
+288 -288
View File
@@ -171,8 +171,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp3; JLONG tmp0, tmp1, tmp2, tmp3;
JLONG tmp10, tmp11, tmp12, tmp13; JLONG tmp10, tmp11, tmp12, tmp13;
@@ -208,8 +208,8 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 && inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
inptr[DCTSIZE * 7] == 0) { inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]), int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
PASS1_BITS); quantptr[DCTSIZE * 0]), PASS1_BITS);
wsptr[DCTSIZE * 0] = dcval; wsptr[DCTSIZE * 0] = dcval;
wsptr[DCTSIZE * 1] = dcval; wsptr[DCTSIZE * 1] = dcval;
@@ -314,8 +314,8 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
& RANGE_MASK]; PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
@@ -384,29 +384,29 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3, outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3, outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2, outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2, outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1, outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1, outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0, outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0, outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
@@ -425,8 +425,8 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_7x7(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_7x7(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13; JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12, tmp13;
JLONG z1, z2, z3; JLONG z1, z2, z3;
@@ -538,26 +538,26 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 7; /* advance pointer to next row */ wsptr += 7; /* advance pointer to next row */
} }
@@ -574,8 +574,8 @@ jpeg_idct_7x7 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_6x6(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_6x6(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12; JLONG tmp0, tmp1, tmp2, tmp10, tmp11, tmp12;
JLONG z1, z2, z3; JLONG z1, z2, z3;
@@ -662,23 +662,23 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 6; /* advance pointer to next row */ wsptr += 6; /* advance pointer to next row */
} }
@@ -695,8 +695,8 @@ jpeg_idct_6x6 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_5x5(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_5x5(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp10, tmp11, tmp12; JLONG tmp0, tmp1, tmp10, tmp11, tmp12;
JLONG z1, z2, z3; JLONG z1, z2, z3;
@@ -780,20 +780,20 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 5; /* advance pointer to next row */ wsptr += 5; /* advance pointer to next row */
} }
@@ -810,8 +810,8 @@ jpeg_idct_5x5 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_3x3(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_3x3(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp2, tmp10, tmp12; JLONG tmp0, tmp2, tmp10, tmp12;
JCOEFPTR inptr; JCOEFPTR inptr;
@@ -876,14 +876,14 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp2, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 3; /* advance pointer to next row */ wsptr += 3; /* advance pointer to next row */
} }
@@ -900,8 +900,8 @@ jpeg_idct_3x3 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_9x9(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_9x9(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14; JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG z1, z2, z3, z4; JLONG z1, z2, z3, z4;
@@ -1029,32 +1029,32 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp11 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp11 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp12 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp12 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13 + tmp3, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp13 + tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp13 - tmp3, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp13 - tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1071,8 +1071,8 @@ jpeg_idct_9x9 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_10x10(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_10x10(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14; JLONG tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24; JLONG tmp20, tmp21, tmp22, tmp23, tmp24;
@@ -1221,35 +1221,35 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1266,8 +1266,8 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_11x11(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_11x11(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14; JLONG tmp10, tmp11, tmp12, tmp13, tmp14;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25;
@@ -1412,38 +1412,38 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1460,8 +1460,8 @@ jpeg_idct_11x11 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_12x12(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_12x12(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25;
@@ -1625,41 +1625,41 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1676,8 +1676,8 @@ jpeg_idct_12x12 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_13x13(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_13x13(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15; JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26;
@@ -1850,44 +1850,44 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -1904,8 +1904,8 @@ jpeg_idct_13x13 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_14x14(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_14x14(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26;
@@ -2073,47 +2073,47 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -2130,8 +2130,8 @@ jpeg_idct_14x14 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_15x15(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_15x15(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16; JLONG tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27;
@@ -2312,50 +2312,50 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10, outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11, outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12, outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp14,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp15,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp16,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp16,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
@@ -2372,8 +2372,8 @@ jpeg_idct_15x15 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_16x16(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_16x16(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13; JLONG tmp0, tmp1, tmp2, tmp3, tmp10, tmp11, tmp12, tmp13;
JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27; JLONG tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27;
@@ -2571,53 +2571,53 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp0, outptr[0] = range_limit[(int)RIGHT_SHIFT(tmp20 + tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[15] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp0, outptr[15] = range_limit[(int)RIGHT_SHIFT(tmp20 - tmp0,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp1, outptr[1] = range_limit[(int)RIGHT_SHIFT(tmp21 + tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp1, outptr[14] = range_limit[(int)RIGHT_SHIFT(tmp21 - tmp1,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp2, outptr[2] = range_limit[(int)RIGHT_SHIFT(tmp22 + tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp2, outptr[13] = range_limit[(int)RIGHT_SHIFT(tmp22 - tmp2,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp3, outptr[3] = range_limit[(int)RIGHT_SHIFT(tmp23 + tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp3, outptr[12] = range_limit[(int)RIGHT_SHIFT(tmp23 - tmp3,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp10, outptr[4] = range_limit[(int)RIGHT_SHIFT(tmp24 + tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp10, outptr[11] = range_limit[(int)RIGHT_SHIFT(tmp24 - tmp10,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp11, outptr[5] = range_limit[(int)RIGHT_SHIFT(tmp25 + tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp11, outptr[10] = range_limit[(int)RIGHT_SHIFT(tmp25 - tmp11,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp12, outptr[6] = range_limit[(int)RIGHT_SHIFT(tmp26 + tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp12, outptr[9] = range_limit[(int)RIGHT_SHIFT(tmp26 - tmp12,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27 + tmp13, outptr[7] = range_limit[(int)RIGHT_SHIFT(tmp27 + tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp27 - tmp13, outptr[8] = range_limit[(int)RIGHT_SHIFT(tmp27 - tmp13,
CONST_BITS+PASS1_BITS+3) CONST_BITS + PASS1_BITS + 3) &
& RANGE_MASK]; RANGE_MASK];
wsptr += 8; /* advance pointer to next row */ wsptr += 8; /* advance pointer to next row */
} }
+60 -54
View File
@@ -119,8 +119,8 @@
GLOBAL(void) GLOBAL(void)
jpeg_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_4x4(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp2, tmp10, tmp12; JLONG tmp0, tmp2, tmp10, tmp12;
JLONG z1, z2, z3, z4; JLONG z1, z2, z3, z4;
@@ -146,8 +146,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 5] == 0 &&
inptr[DCTSIZE * 6] == 0 && inptr[DCTSIZE * 7] == 0) { inptr[DCTSIZE * 6] == 0 && inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero; we need not examine term 4 for 4x4 output */ /* AC terms all zero; we need not examine term 4 for 4x4 output */
int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]), int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
PASS1_BITS); quantptr[DCTSIZE * 0]), PASS1_BITS);
wsptr[DCTSIZE * 0] = dcval; wsptr[DCTSIZE * 0] = dcval;
wsptr[DCTSIZE * 1] = dcval; wsptr[DCTSIZE * 1] = dcval;
@@ -177,22 +177,26 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z3 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]); z3 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
z4 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]); z4 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ tmp0 = MULTIPLY(z1, -FIX_0_211164243) + /* sqrt(2) * ( c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ MULTIPLY(z2, FIX_1_451774981) + /* sqrt(2) * ( c3+c7) */
+ MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ MULTIPLY(z3, -FIX_2_172734803) + /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * ( c5+c7) */
tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ tmp2 = MULTIPLY(z1, -FIX_0_509795579) + /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ MULTIPLY(z2, -FIX_0_601344887) + /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ MULTIPLY(z3, FIX_0_899976223) + /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */ /* Final output stage */
wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp2, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE * 0] =
wsptr[DCTSIZE*3] = (int) DESCALE(tmp10 - tmp2, CONST_BITS-PASS1_BITS+1); (int)DESCALE(tmp10 + tmp2, CONST_BITS - PASS1_BITS + 1);
wsptr[DCTSIZE*1] = (int) DESCALE(tmp12 + tmp0, CONST_BITS-PASS1_BITS+1); wsptr[DCTSIZE * 3] =
wsptr[DCTSIZE*2] = (int) DESCALE(tmp12 - tmp0, CONST_BITS-PASS1_BITS+1); (int)DESCALE(tmp10 - tmp2, CONST_BITS - PASS1_BITS + 1);
wsptr[DCTSIZE * 1] =
(int)DESCALE(tmp12 + tmp0, CONST_BITS - PASS1_BITS + 1);
wsptr[DCTSIZE * 2] =
(int)DESCALE(tmp12 - tmp0, CONST_BITS - PASS1_BITS + 1);
} }
/* Pass 2: process 4 rows from work array, store into output array. */ /* Pass 2: process 4 rows from work array, store into output array. */
@@ -206,8 +210,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
& RANGE_MASK]; PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
@@ -223,8 +227,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp0 = LEFT_SHIFT((JLONG)wsptr[0], CONST_BITS + 1); tmp0 = LEFT_SHIFT((JLONG)wsptr[0], CONST_BITS + 1);
tmp2 = MULTIPLY((JLONG) wsptr[2], FIX_1_847759065) tmp2 = MULTIPLY((JLONG)wsptr[2], FIX_1_847759065) +
+ MULTIPLY((JLONG) wsptr[6], - FIX_0_765366865); MULTIPLY((JLONG)wsptr[6], -FIX_0_765366865);
tmp10 = tmp0 + tmp2; tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2; tmp12 = tmp0 - tmp2;
@@ -236,30 +240,30 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
z3 = (JLONG)wsptr[3]; z3 = (JLONG)wsptr[3];
z4 = (JLONG)wsptr[1]; z4 = (JLONG)wsptr[1];
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ tmp0 = MULTIPLY(z1, -FIX_0_211164243) + /* sqrt(2) * ( c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ MULTIPLY(z2, FIX_1_451774981) + /* sqrt(2) * ( c3+c7) */
+ MULTIPLY(z3, - FIX_2_172734803) /* sqrt(2) * (-c1-c5) */ MULTIPLY(z3, -FIX_2_172734803) + /* sqrt(2) * (-c1-c5) */
+ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * (c5+c7) */ MULTIPLY(z4, FIX_1_061594337); /* sqrt(2) * ( c5+c7) */
tmp2 = MULTIPLY(z1, - FIX_0_509795579) /* sqrt(2) * (c7-c5) */ tmp2 = MULTIPLY(z1, -FIX_0_509795579) + /* sqrt(2) * (c7-c5) */
+ MULTIPLY(z2, - FIX_0_601344887) /* sqrt(2) * (c5-c1) */ MULTIPLY(z2, -FIX_0_601344887) + /* sqrt(2) * (c5-c1) */
+ MULTIPLY(z3, FIX_0_899976223) /* sqrt(2) * (c3-c7) */ MULTIPLY(z3, FIX_0_899976223) + /* sqrt(2) * (c3-c7) */
+ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */ MULTIPLY(z4, FIX_2_562915447); /* sqrt(2) * (c1+c3) */
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp2, outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp2,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS + PASS1_BITS + 3 + 1) &
& RANGE_MASK]; RANGE_MASK];
outptr[3] = range_limit[(int)DESCALE(tmp10 - tmp2, outptr[3] = range_limit[(int)DESCALE(tmp10 - tmp2,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS + PASS1_BITS + 3 + 1) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)DESCALE(tmp12 + tmp0, outptr[1] = range_limit[(int)DESCALE(tmp12 + tmp0,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS + PASS1_BITS + 3 + 1) &
& RANGE_MASK]; RANGE_MASK];
outptr[2] = range_limit[(int)DESCALE(tmp12 - tmp0, outptr[2] = range_limit[(int)DESCALE(tmp12 - tmp0,
CONST_BITS+PASS1_BITS+3+1) CONST_BITS + PASS1_BITS + 3 + 1) &
& RANGE_MASK]; RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
@@ -273,8 +277,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_2x2(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
JLONG tmp0, tmp10, z1; JLONG tmp0, tmp10, z1;
JCOEFPTR inptr; JCOEFPTR inptr;
@@ -298,8 +302,8 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 3] == 0 && if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 3] == 0 &&
inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 7] == 0) { inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 7] == 0) {
/* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */ /* AC terms all zero; we need not examine terms 2,4,6 for 2x2 output */
int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]), int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
PASS1_BITS); quantptr[DCTSIZE * 0]), PASS1_BITS);
wsptr[DCTSIZE * 0] = dcval; wsptr[DCTSIZE * 0] = dcval;
wsptr[DCTSIZE * 1] = dcval; wsptr[DCTSIZE * 1] = dcval;
@@ -325,8 +329,10 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Final output stage */ /* Final output stage */
wsptr[DCTSIZE*0] = (int) DESCALE(tmp10 + tmp0, CONST_BITS-PASS1_BITS+2); wsptr[DCTSIZE * 0] =
wsptr[DCTSIZE*1] = (int) DESCALE(tmp10 - tmp0, CONST_BITS-PASS1_BITS+2); (int)DESCALE(tmp10 + tmp0, CONST_BITS - PASS1_BITS + 2);
wsptr[DCTSIZE * 1] =
(int)DESCALE(tmp10 - tmp0, CONST_BITS - PASS1_BITS + 2);
} }
/* Pass 2: process 2 rows from work array, store into output array. */ /* Pass 2: process 2 rows from work array, store into output array. */
@@ -339,8 +345,8 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
#ifndef NO_ZERO_ROW_TEST #ifndef NO_ZERO_ROW_TEST
if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) { if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((JLONG) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
& RANGE_MASK]; PASS1_BITS + 3) & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
outptr[1] = dcval; outptr[1] = dcval;
@@ -356,19 +362,19 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
/* Odd part */ /* Odd part */
tmp0 = MULTIPLY((JLONG) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ tmp0 = MULTIPLY((JLONG)wsptr[7], -FIX_0_720959822) + /* sqrt(2) * ( c7-c5+c3-c1) */
+ MULTIPLY((JLONG) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ MULTIPLY((JLONG)wsptr[5], FIX_0_850430095) + /* sqrt(2) * (-c1+c3+c5+c7) */
+ MULTIPLY((JLONG) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ MULTIPLY((JLONG)wsptr[3], -FIX_1_272758580) + /* sqrt(2) * (-c1+c3-c5-c7) */
+ MULTIPLY((JLONG) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ MULTIPLY((JLONG)wsptr[1], FIX_3_624509785); /* sqrt(2) * ( c1+c3+c5+c7) */
/* Final output stage */ /* Final output stage */
outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp0, outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp0,
CONST_BITS+PASS1_BITS+3+2) CONST_BITS + PASS1_BITS + 3 + 2) &
& RANGE_MASK]; RANGE_MASK];
outptr[1] = range_limit[(int)DESCALE(tmp10 - tmp0, outptr[1] = range_limit[(int)DESCALE(tmp10 - tmp0,
CONST_BITS+PASS1_BITS+3+2) CONST_BITS + PASS1_BITS + 3 + 2) &
& RANGE_MASK]; RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
} }
@@ -382,8 +388,8 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info *compptr,
GLOBAL(void) GLOBAL(void)
jpeg_idct_1x1(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_idct_1x1(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, JDIMENSION output_col) JDIMENSION output_col)
{ {
int dcval; int dcval;
ISLOW_MULT_TYPE *quantptr; ISLOW_MULT_TYPE *quantptr;
+8 -4
View File
@@ -61,14 +61,18 @@
#ifdef NEED_BSD_STRINGS #ifdef NEED_BSD_STRINGS
#include <strings.h> #include <strings.h>
#define MEMZERO(target,size) bzero((void *)(target), (size_t)(size)) #define MEMZERO(target, size) \
#define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size)) bzero((void *)(target), (size_t)(size))
#define MEMCOPY(dest, src, size) \
bcopy((const void *)(src), (void *)(dest), (size_t)(size))
#else /* not BSD, assume ANSI/SysV string lib */ #else /* not BSD, assume ANSI/SysV string lib */
#include <string.h> #include <string.h>
#define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size)) #define MEMZERO(target, size) \
#define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size)) memset((void *)(target), 0, (size_t)(size))
#define MEMCOPY(dest, src, size) \
memcpy((void *)(dest), (const void *)(src), (size_t)(size))
#endif #endif
+21 -25
View File
@@ -32,7 +32,7 @@
#include "jinclude.h" #include "jinclude.h"
#include "jpeglib.h" #include "jpeglib.h"
#include "jmemsys.h" /* import the system-dependent declarations */ #include "jmemsys.h" /* import the system-dependent declarations */
#ifndef _WIN32 #if !defined(_MSC_VER) || _MSC_VER > 1600
#include <stdint.h> #include <stdint.h>
#endif #endif
#include <limits.h> #include <limits.h>
@@ -89,7 +89,9 @@ round_up_pow2 (size_t a, size_t b)
#ifndef WITH_SIMD #ifndef WITH_SIMD
#define ALIGN_SIZE sizeof(double) #define ALIGN_SIZE sizeof(double)
#else #else
#define ALIGN_SIZE 16 /* Most SIMD implementations require this */ #define ALIGN_SIZE 32 /* Most of the SIMD instructions we support require
16-byte (128-bit) alignment, but AVX2 requires
32-byte alignment. */
#endif #endif
#endif #endif
@@ -206,15 +208,13 @@ print_mem_stats (j_common_ptr cinfo, int pool_id)
for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL; for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL;
lhdr_ptr = lhdr_ptr->next) { lhdr_ptr = lhdr_ptr->next) {
fprintf(stderr, " Large chunk used %ld\n", fprintf(stderr, " Large chunk used %ld\n", (long)lhdr_ptr->bytes_used);
(long) lhdr_ptr->bytes_used);
} }
for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL; for (shdr_ptr = mem->small_list[pool_id]; shdr_ptr != NULL;
shdr_ptr = shdr_ptr->next) { shdr_ptr = shdr_ptr->next) {
fprintf(stderr, " Small chunk used %ld free %ld\n", fprintf(stderr, " Small chunk used %ld free %ld\n",
(long) shdr_ptr->bytes_used, (long)shdr_ptr->bytes_used, (long)shdr_ptr->bytes_left);
(long) shdr_ptr->bytes_left);
} }
} }
@@ -250,14 +250,12 @@ out_of_memory (j_common_ptr cinfo, int which)
* adjustment. * adjustment.
*/ */
static const size_t first_pool_slop[JPOOL_NUMPOOLS] = static const size_t first_pool_slop[JPOOL_NUMPOOLS] = {
{
1600, /* first PERMANENT pool */ 1600, /* first PERMANENT pool */
16000 /* first IMAGE pool */ 16000 /* first IMAGE pool */
}; };
static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = static const size_t extra_pool_slop[JPOOL_NUMPOOLS] = {
{
0, /* additional PERMANENT pools */ 0, /* additional PERMANENT pools */
5000 /* additional IMAGE pools */ 5000 /* additional IMAGE pools */
}; };
@@ -433,8 +431,8 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
*/ */
METHODDEF(JSAMPARRAY) METHODDEF(JSAMPARRAY)
alloc_sarray (j_common_ptr cinfo, int pool_id, alloc_sarray(j_common_ptr cinfo, int pool_id, JDIMENSION samplesperrow,
JDIMENSION samplesperrow, JDIMENSION numrows) JDIMENSION numrows)
/* Allocate a 2-D sample array */ /* Allocate a 2-D sample array */
{ {
my_mem_ptr mem = (my_mem_ptr)cinfo->mem; my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
@@ -475,8 +473,8 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
while (currow < numrows) { while (currow < numrows) {
rowsperchunk = MIN(rowsperchunk, numrows - currow); rowsperchunk = MIN(rowsperchunk, numrows - currow);
workspace = (JSAMPROW)alloc_large(cinfo, pool_id, workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
(size_t) ((size_t) rowsperchunk * (size_t) samplesperrow (size_t)((size_t)rowsperchunk * (size_t)samplesperrow *
* sizeof(JSAMPLE))); sizeof(JSAMPLE)));
for (i = rowsperchunk; i > 0; i--) { for (i = rowsperchunk; i > 0; i--) {
result[currow++] = workspace; result[currow++] = workspace;
workspace += samplesperrow; workspace += samplesperrow;
@@ -493,8 +491,8 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
*/ */
METHODDEF(JBLOCKARRAY) METHODDEF(JBLOCKARRAY)
alloc_barray (j_common_ptr cinfo, int pool_id, alloc_barray(j_common_ptr cinfo, int pool_id, JDIMENSION blocksperrow,
JDIMENSION blocksperrow, JDIMENSION numrows) JDIMENSION numrows)
/* Allocate a 2-D coefficient-block array */ /* Allocate a 2-D coefficient-block array */
{ {
my_mem_ptr mem = (my_mem_ptr)cinfo->mem; my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
@@ -527,8 +525,8 @@ alloc_barray (j_common_ptr cinfo, int pool_id,
while (currow < numrows) { while (currow < numrows) {
rowsperchunk = MIN(rowsperchunk, numrows - currow); rowsperchunk = MIN(rowsperchunk, numrows - currow);
workspace = (JBLOCKROW)alloc_large(cinfo, pool_id, workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
(size_t) ((size_t) rowsperchunk * (size_t) blocksperrow (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
* sizeof(JBLOCK))); sizeof(JBLOCK)));
for (i = rowsperchunk; i > 0; i--) { for (i = rowsperchunk; i > 0; i--) {
result[currow++] = workspace; result[currow++] = workspace;
workspace += blocksperrow; workspace += blocksperrow;
@@ -819,8 +817,7 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
METHODDEF(JSAMPARRAY) METHODDEF(JSAMPARRAY)
access_virt_sarray(j_common_ptr cinfo, jvirt_sarray_ptr ptr, access_virt_sarray(j_common_ptr cinfo, jvirt_sarray_ptr ptr,
JDIMENSION start_row, JDIMENSION num_rows, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)
boolean writable)
/* Access the part of a virtual sample array starting at start_row */ /* Access the part of a virtual sample array starting at start_row */
/* and extending for num_rows rows. writable is true if */ /* and extending for num_rows rows. writable is true if */
/* caller intends to modify the accessed area. */ /* caller intends to modify the accessed area. */
@@ -904,8 +901,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
METHODDEF(JBLOCKARRAY) METHODDEF(JBLOCKARRAY)
access_virt_barray(j_common_ptr cinfo, jvirt_barray_ptr ptr, access_virt_barray(j_common_ptr cinfo, jvirt_barray_ptr ptr,
JDIMENSION start_row, JDIMENSION num_rows, JDIMENSION start_row, JDIMENSION num_rows, boolean writable)
boolean writable)
/* Access the part of a virtual block array starting at start_row */ /* Access the part of a virtual block array starting at start_row */
/* and extending for num_rows rows. writable is true if */ /* and extending for num_rows rows. writable is true if */
/* caller intends to modify the accessed area. */ /* caller intends to modify the accessed area. */
@@ -1048,8 +1044,7 @@ free_pool (j_common_ptr cinfo, int pool_id)
while (shdr_ptr != NULL) { while (shdr_ptr != NULL) {
small_pool_ptr next_shdr_ptr = shdr_ptr->next; small_pool_ptr next_shdr_ptr = shdr_ptr->next;
space_freed = shdr_ptr->bytes_used + space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
shdr_ptr->bytes_left +
sizeof(small_pool_hdr); sizeof(small_pool_hdr);
jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed); jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
mem->total_space_allocated -= space_freed; mem->total_space_allocated -= space_freed;
@@ -1166,7 +1161,8 @@ jinit_memory_mgr (j_common_ptr cinfo)
* this feature. * this feature.
*/ */
#ifndef NO_GETENV #ifndef NO_GETENV
{ char *memenv; {
char *memenv;
if ((memenv = getenv("JPEGMEM")) != NULL) { if ((memenv = getenv("JPEGMEM")) != NULL) {
char ch = 'x'; char ch = 'x';
+2 -2
View File
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software: * This file was part of the Independent JPEG Group's software:
* Copyright (C) 1992-1996, Thomas G. Lane. * Copyright (C) 1992-1996, Thomas G. Lane.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2017, D. R. Commander. * Copyright (C) 2017-2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -72,7 +72,7 @@ jpeg_mem_available (j_common_ptr cinfo, size_t min_bytes_needed,
size_t max_bytes_needed, size_t already_allocated) size_t max_bytes_needed, size_t already_allocated)
{ {
if (cinfo->mem->max_memory_to_use) { if (cinfo->mem->max_memory_to_use) {
if (cinfo->mem->max_memory_to_use > already_allocated) if ((size_t)cinfo->mem->max_memory_to_use > already_allocated)
return cinfo->mem->max_memory_to_use - already_allocated; return cinfo->mem->max_memory_to_use - already_allocated;
else else
return 0; return 0;
+8 -8
View File
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2009 by Guido Vollbeding. * Modified 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2009, 2011, 2014-2015, D. R. Commander. * Copyright (C) 2009, 2011, 2014-2015, 2018, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -17,9 +17,9 @@
/* /*
* Maximum number of components (color channels) allowed in JPEG image. * Maximum number of components (color channels) allowed in JPEG image.
* To meet the letter of the JPEG spec, set this to 255. However, darn * To meet the letter of Rec. ITU-T T.81 | ISO/IEC 10918-1, set this to 255.
* few applications need more than 4 channels (maybe 5 for CMYK + alpha * However, darn few applications need more than 4 channels (maybe 5 for CMYK +
* mask). We recommend 10 as a reasonable compromise; use 4 if you are * alpha mask). We recommend 10 as a reasonable compromise; use 4 if you are
* really short on memory. (Each allowed component costs a hundred or so * really short on memory. (Each allowed component costs a hundred or so
* bytes of storage, whether actually used in an image or not.) * bytes of storage, whether actually used in an image or not.)
*/ */
@@ -315,10 +315,10 @@ typedef int boolean;
* with it. In reality, few people ever did this, because there were some * with it. In reality, few people ever did this, because there were some
* severe restrictions involved (cjpeg and djpeg no longer worked properly, * severe restrictions involved (cjpeg and djpeg no longer worked properly,
* compressing/decompressing RGB JPEGs no longer worked properly, and the color * compressing/decompressing RGB JPEGs no longer worked properly, and the color
* quantizer wouldn't work with pixel sizes other than 3.) Further, since all * quantizer wouldn't work with pixel sizes other than 3.) Furthermore, since
* of the O/S-supplied versions of libjpeg were built with the default values * all of the O/S-supplied versions of libjpeg were built with the default
* of RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE, many applications have * values of RGB_RED, RGB_GREEN, RGB_BLUE, and RGB_PIXELSIZE, many applications
* come to regard these values as immutable. * have come to regard these values as immutable.
* *
* The libjpeg-turbo colorspace extensions provide a much cleaner way of * The libjpeg-turbo colorspace extensions provide a much cleaner way of
* compressing from/decompressing to buffers with arbitrary component orders * compressing from/decompressing to buffers with arbitrary component orders
+13 -3
View File
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2009 by Guido Vollbeding. * Modified 2002-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander. * Copyright (C) 2009-2011, 2013-2014, 2016-2017, D. R. Commander.
* Copyright (C) 2015, Google, Inc. * Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
@@ -921,8 +921,7 @@ EXTERN(void) jpeg_stdio_src (j_decompress_ptr cinfo, FILE *infile);
EXTERN(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer, EXTERN(void) jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer,
unsigned long *outsize); unsigned long *outsize);
EXTERN(void) jpeg_mem_src(j_decompress_ptr cinfo, EXTERN(void) jpeg_mem_src(j_decompress_ptr cinfo,
const unsigned char *inbuffer, const unsigned char *inbuffer, unsigned long insize);
unsigned long insize);
#endif #endif
/* Default parameter setup for compression */ /* Default parameter setup for compression */
@@ -976,6 +975,12 @@ EXTERN(void) jpeg_write_m_byte (j_compress_ptr cinfo, int val);
/* Alternate compression function: just write an abbreviated table file */ /* Alternate compression function: just write an abbreviated table file */
EXTERN(void) jpeg_write_tables(j_compress_ptr cinfo); EXTERN(void) jpeg_write_tables(j_compress_ptr cinfo);
/* Write ICC profile. See libjpeg.txt for usage information. */
EXTERN(void) jpeg_write_icc_profile(j_compress_ptr cinfo,
const JOCTET *icc_data_ptr,
unsigned int icc_data_len);
/* Decompression startup: read start of JPEG datastream to see what's there */ /* Decompression startup: read start of JPEG datastream to see what's there */
EXTERN(int) jpeg_read_header(j_decompress_ptr cinfo, boolean require_image); EXTERN(int) jpeg_read_header(j_decompress_ptr cinfo, boolean require_image);
/* Return value is one of: */ /* Return value is one of: */
@@ -1057,6 +1062,11 @@ EXTERN(void) jpeg_destroy (j_common_ptr cinfo);
/* Default restart-marker-resync procedure for use by data source modules */ /* Default restart-marker-resync procedure for use by data source modules */
EXTERN(boolean) jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired); EXTERN(boolean) jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired);
/* Read ICC profile. See libjpeg.txt for usage information. */
EXTERN(boolean) jpeg_read_icc_profile(j_decompress_ptr cinfo,
JOCTET **icc_data_ptr,
unsigned int *icc_data_len);
/* These marker codes are exported since applications and data source modules /* These marker codes are exported since applications and data source modules
* are likely to want to use them. * are likely to want to use them.
+16 -14
View File
@@ -74,7 +74,8 @@
#define ODITHER_SIZE 16 /* dimension of dither matrix */ #define ODITHER_SIZE 16 /* dimension of dither matrix */
/* NB: if ODITHER_SIZE is not a power of 2, ODITHER_MASK uses will break */ /* NB: if ODITHER_SIZE is not a power of 2, ODITHER_MASK uses will break */
#define ODITHER_CELLS (ODITHER_SIZE * ODITHER_SIZE) /* # cells in matrix */ #define ODITHER_CELLS (ODITHER_SIZE * ODITHER_SIZE) /* # cells in matrix */
#define ODITHER_MASK (ODITHER_SIZE-1) /* mask for wrapping around counters */ #define ODITHER_MASK (ODITHER_SIZE - 1) /* mask for wrapping around
counters */
typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE]; typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE];
typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE]; typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE];
@@ -153,7 +154,7 @@ typedef struct {
*/ */
boolean is_padded; /* is the colorindex padded for odither? */ boolean is_padded; /* is the colorindex padded for odither? */
int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */ int Ncolors[MAX_Q_COMPS]; /* # of values allocated to each component */
/* Variables for ordered dithering */ /* Variables for ordered dithering */
int row_index; /* cur row's vertical index in dither matrix */ int row_index; /* cur row's vertical index in dither matrix */
@@ -285,9 +286,9 @@ create_colormap (j_decompress_ptr cinfo)
/* Report selected color counts */ /* Report selected color counts */
if (cinfo->out_color_components == 3) if (cinfo->out_color_components == 3)
TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, TRACEMS4(cinfo, 1, JTRC_QUANT_3_NCOLORS, total_colors,
total_colors, cquantize->Ncolors[0], cquantize->Ncolors[0], cquantize->Ncolors[1],
cquantize->Ncolors[1], cquantize->Ncolors[2]); cquantize->Ncolors[2]);
else else
TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors); TRACEMS1(cinfo, 1, JTRC_QUANT_NCOLORS, total_colors);
@@ -413,8 +414,8 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors)
den = 2 * ODITHER_CELLS * ((JLONG)(ncolors - 1)); den = 2 * ODITHER_CELLS * ((JLONG)(ncolors - 1));
for (j = 0; j < ODITHER_SIZE; j++) { for (j = 0; j < ODITHER_SIZE; j++) {
for (k = 0; k < ODITHER_SIZE; k++) { for (k = 0; k < ODITHER_SIZE; k++) {
num = ((JLONG) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) num = ((JLONG)(ODITHER_CELLS - 1 -
* MAXJSAMPLE; 2 * ((int)base_dither_matrix[j][k]))) * MAXJSAMPLE;
/* Ensure round towards zero despite C's lack of consistency /* Ensure round towards zero despite C's lack of consistency
* about rounding negative values in integer division... * about rounding negative values in integer division...
*/ */
@@ -550,7 +551,8 @@ quantize_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
* inputs. The maximum dither is +- MAXJSAMPLE; this sets the * inputs. The maximum dither is +- MAXJSAMPLE; this sets the
* required amount of padding. * required amount of padding.
*/ */
*output_ptr += colorindex_ci[GETJSAMPLE(*input_ptr)+dither[col_index]]; *output_ptr +=
colorindex_ci[GETJSAMPLE(*input_ptr) + dither[col_index]];
input_ptr += nc; input_ptr += nc;
output_ptr++; output_ptr++;
col_index = (col_index + 1) & ODITHER_MASK; col_index = (col_index + 1) & ODITHER_MASK;
@@ -593,12 +595,12 @@ quantize3_ord_dither (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
col_index = 0; col_index = 0;
for (col = width; col > 0; col--) { for (col = width; col > 0; col--) {
pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + pixcode =
dither0[col_index]]); GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + dither0[col_index]]);
pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + pixcode +=
dither1[col_index]]); GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + dither1[col_index]]);
pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + pixcode +=
dither2[col_index]]); GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + dither2[col_index]]);
*output_ptr++ = (JSAMPLE)pixcode; *output_ptr++ = (JSAMPLE)pixcode;
col_index = (col_index + 1) & ODITHER_MASK; col_index = (col_index + 1) & ODITHER_MASK;
} }
+15 -12
View File
@@ -437,8 +437,7 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
cmax = c1; n = 1; cmax = c1; n = 1;
if (c0 > cmax) { cmax = c0; n = 0; } if (c0 > cmax) { cmax = c0; n = 0; }
if (c2 > cmax) { n = 2; } if (c2 > cmax) { n = 2; }
} } else {
else {
cmax = c1; n = 1; cmax = c1; n = 1;
if (c2 > cmax) { cmax = c2; n = 2; } if (c2 > cmax) { cmax = c2; n = 2; }
if (c0 > cmax) { n = 0; } if (c0 > cmax) { n = 0; }
@@ -892,8 +891,8 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
*/ */
METHODDEF(void) METHODDEF(void)
pass2_no_dither (j_decompress_ptr cinfo, pass2_no_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) JSAMPARRAY output_buf, int num_rows)
/* This version performs no dithering */ /* This version performs no dithering */
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
@@ -926,8 +925,8 @@ pass2_no_dither (j_decompress_ptr cinfo,
METHODDEF(void) METHODDEF(void)
pass2_fs_dither (j_decompress_ptr cinfo, pass2_fs_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) JSAMPARRAY output_buf, int num_rows)
/* This version performs Floyd-Steinberg dithering */ /* This version performs Floyd-Steinberg dithering */
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr)cinfo->cquantize;
@@ -1004,13 +1003,16 @@ pass2_fs_dither (j_decompress_ptr cinfo,
cur1 = GETJSAMPLE(range_limit[cur1]); cur1 = GETJSAMPLE(range_limit[cur1]);
cur2 = GETJSAMPLE(range_limit[cur2]); cur2 = GETJSAMPLE(range_limit[cur2]);
/* Index into the cache with adjusted pixel value */ /* Index into the cache with adjusted pixel value */
cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT]; cachep =
&histogram[cur0 >> C0_SHIFT][cur1 >> C1_SHIFT][cur2 >> C2_SHIFT];
/* If we have not seen this color before, find nearest colormap */ /* If we have not seen this color before, find nearest colormap */
/* entry and update the cache */ /* entry and update the cache */
if (*cachep == 0) if (*cachep == 0)
fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); fill_inverse_cmap(cinfo, cur0 >> C0_SHIFT, cur1 >> C1_SHIFT,
cur2 >> C2_SHIFT);
/* Now emit the colormap index for this cell */ /* Now emit the colormap index for this cell */
{ register int pixcode = *cachep - 1; {
register int pixcode = *cachep - 1;
*outptr = (JSAMPLE)pixcode; *outptr = (JSAMPLE)pixcode;
/* Compute representation error for this pixel */ /* Compute representation error for this pixel */
cur0 -= GETJSAMPLE(colormap0[pixcode]); cur0 -= GETJSAMPLE(colormap0[pixcode]);
@@ -1021,7 +1023,8 @@ pass2_fs_dither (j_decompress_ptr cinfo,
* Add these into the running sums, and simultaneously shift the * Add these into the running sums, and simultaneously shift the
* next-line error sums left by 1 column. * next-line error sums left by 1 column.
*/ */
{ register LOCFSERROR bnexterr; {
register LOCFSERROR bnexterr;
bnexterr = cur0; /* Process component 0 */ bnexterr = cur0; /* Process component 0 */
errorptr[0] = (FSERROR)(bpreverr0 + cur0 * 3); errorptr[0] = (FSERROR)(bpreverr0 + cur0 * 3);
@@ -1167,8 +1170,8 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS); ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
if (cinfo->dither_mode == JDITHER_FS) { if (cinfo->dither_mode == JDITHER_FS) {
size_t arraysize = (size_t) ((cinfo->output_width + 2) * size_t arraysize =
(3 * sizeof(FSERROR))); (size_t)((cinfo->output_width + 2) * (3 * sizeof(FSERROR)));
/* Allocate Floyd-Steinberg workspace if we didn't already. */ /* Allocate Floyd-Steinberg workspace if we didn't already. */
if (cquantize->fserrors == NULL) if (cquantize->fserrors == NULL)
cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large) cquantize->fserrors = (FSERRPTR)(*cinfo->mem->alloc_large)
+69 -45
View File
@@ -3,7 +3,7 @@
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2011, 2014, D. R. Commander. * Copyright (C) 2011, 2014, D. R. Commander.
* Copyright (C) 2015, Matthieu Darbois. * Copyright (C) 2015-2016, 2018, Matthieu Darbois.
* *
* Based on the x86 SIMD extension for IJG JPEG library, * Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru. * Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -19,75 +19,99 @@ EXTERN(int) jsimd_can_ycc_rgb (void);
EXTERN(int) jsimd_can_ycc_rgb565(void); EXTERN(int) jsimd_can_ycc_rgb565(void);
EXTERN(int) jsimd_c_can_null_convert(void); EXTERN(int) jsimd_c_can_null_convert(void);
EXTERN(void) jsimd_rgb_ycc_convert EXTERN(void) jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows); JDIMENSION output_row, int num_rows);
EXTERN(void) jsimd_rgb_gray_convert EXTERN(void) jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows); JDIMENSION output_row, int num_rows);
EXTERN(void) jsimd_ycc_rgb_convert EXTERN(void) jsimd_ycc_rgb_convert(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows); JSAMPARRAY output_buf, int num_rows);
EXTERN(void) jsimd_ycc_rgb565_convert EXTERN(void) jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPIMAGE input_buf,
JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows); JSAMPARRAY output_buf, int num_rows);
EXTERN(void) jsimd_c_null_convert EXTERN(void) jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows); int num_rows);
EXTERN(int) jsimd_can_h2v2_downsample(void); EXTERN(int) jsimd_can_h2v2_downsample(void);
EXTERN(int) jsimd_can_h2v1_downsample(void); EXTERN(int) jsimd_can_h2v1_downsample(void);
EXTERN(void) jsimd_h2v2_downsample EXTERN(void) jsimd_h2v2_downsample(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data); JSAMPARRAY input_data,
JSAMPARRAY output_data);
EXTERN(int) jsimd_can_h2v2_smooth_downsample(void); EXTERN(int) jsimd_can_h2v2_smooth_downsample(void);
EXTERN(void) jsimd_h2v2_smooth_downsample EXTERN(void) jsimd_h2v2_smooth_downsample(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data); JSAMPARRAY input_data,
JSAMPARRAY output_data);
EXTERN(void) jsimd_h2v1_downsample EXTERN(void) jsimd_h2v1_downsample(j_compress_ptr cinfo,
(j_compress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data); JSAMPARRAY input_data,
JSAMPARRAY output_data);
EXTERN(int) jsimd_can_h2v2_upsample(void); EXTERN(int) jsimd_can_h2v2_upsample(void);
EXTERN(int) jsimd_can_h2v1_upsample(void); EXTERN(int) jsimd_can_h2v1_upsample(void);
EXTERN(int) jsimd_can_int_upsample(void); EXTERN(int) jsimd_can_int_upsample(void);
EXTERN(void) jsimd_h2v2_upsample EXTERN(void) jsimd_h2v2_upsample(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); JSAMPARRAY input_data,
EXTERN(void) jsimd_h2v1_upsample JSAMPARRAY *output_data_ptr);
(j_decompress_ptr cinfo, jpeg_component_info *compptr, EXTERN(void) jsimd_h2v1_upsample(j_decompress_ptr cinfo,
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); jpeg_component_info *compptr,
EXTERN(void) jsimd_int_upsample JSAMPARRAY input_data,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY *output_data_ptr);
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); EXTERN(void) jsimd_int_upsample(j_decompress_ptr cinfo,
jpeg_component_info *compptr,
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr);
EXTERN(int) jsimd_can_h2v2_fancy_upsample(void); EXTERN(int) jsimd_can_h2v2_fancy_upsample(void);
EXTERN(int) jsimd_can_h2v1_fancy_upsample(void); EXTERN(int) jsimd_can_h2v1_fancy_upsample(void);
EXTERN(void) jsimd_h2v2_fancy_upsample EXTERN(void) jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, jpeg_component_info *compptr, jpeg_component_info *compptr,
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); JSAMPARRAY input_data,
EXTERN(void) jsimd_h2v1_fancy_upsample JSAMPARRAY *output_data_ptr);
(j_decompress_ptr cinfo, jpeg_component_info *compptr, EXTERN(void) jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo,
JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr); jpeg_component_info *compptr,
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr);
EXTERN(int) jsimd_can_h2v2_merged_upsample(void); EXTERN(int) jsimd_can_h2v2_merged_upsample(void);
EXTERN(int) jsimd_can_h2v1_merged_upsample(void); EXTERN(int) jsimd_can_h2v1_merged_upsample(void);
EXTERN(void) jsimd_h2v2_merged_upsample EXTERN(void) jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo,
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); JDIMENSION in_row_group_ctr,
EXTERN(void) jsimd_h2v1_merged_upsample JSAMPARRAY output_buf);
(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, EXTERN(void) jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo,
JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf); JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf);
EXTERN(int) jsimd_can_huff_encode_one_block(void); EXTERN(int) jsimd_can_huff_encode_one_block(void);
EXTERN(JOCTET*) jsimd_huff_encode_one_block EXTERN(JOCTET *) jsimd_huff_encode_one_block(void *state, JOCTET *buffer,
(void *state, JOCTET *buffer, JCOEFPTR block, int last_dc_val, JCOEFPTR block, int last_dc_val,
c_derived_tbl *dctbl, c_derived_tbl *actbl); c_derived_tbl *dctbl,
c_derived_tbl *actbl);
EXTERN(int) jsimd_can_encode_mcu_AC_first_prepare(void);
EXTERN(void) jsimd_encode_mcu_AC_first_prepare
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
JCOEF *values, size_t *zerobits);
EXTERN(int) jsimd_can_encode_mcu_AC_refine_prepare(void);
EXTERN(int) jsimd_encode_mcu_AC_refine_prepare
(const JCOEF *block, const int *jpeg_natural_order_start, int Sl, int Al,
JCOEF *absvalues, size_t *bits);
+56 -42
View File
@@ -3,7 +3,7 @@
* *
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009-2011, 2014, D. R. Commander. * Copyright (C) 2009-2011, 2014, D. R. Commander.
* Copyright (C) 2015, Matthieu Darbois. * Copyright (C) 2015-2016, 2018, Matthieu Darbois.
* *
* Based on the x86 SIMD extension for IJG JPEG library, * Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru. * Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -50,37 +50,37 @@ jsimd_c_can_null_convert (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_rgb_ycc_convert (j_compress_ptr cinfo, jsimd_rgb_ycc_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_rgb_gray_convert (j_compress_ptr cinfo, jsimd_rgb_gray_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_ycc_rgb_convert (j_decompress_ptr cinfo, jsimd_ycc_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_ycc_rgb565_convert (j_decompress_ptr cinfo, jsimd_ycc_rgb565_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION input_row, JDIMENSION input_row, JSAMPARRAY output_buf,
JSAMPARRAY output_buf, int num_rows) int num_rows)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_c_null_convert (j_compress_ptr cinfo, jsimd_c_null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JSAMPIMAGE output_buf, JDIMENSION output_row,
JDIMENSION output_row, int num_rows) int num_rows)
{ {
} }
@@ -146,18 +146,14 @@ jsimd_int_upsample (j_decompress_ptr cinfo, jpeg_component_info *compptr,
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_upsample (j_decompress_ptr cinfo, jsimd_h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_upsample (j_decompress_ptr cinfo, jsimd_h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
@@ -174,18 +170,14 @@ jsimd_can_h2v1_fancy_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo, jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo, jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr)
{ {
} }
@@ -202,18 +194,14 @@ jsimd_can_h2v1_merged_upsample (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo, jsimd_h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{ {
} }
GLOBAL(void) GLOBAL(void)
jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo, jsimd_h2v1_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf)
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{ {
} }
@@ -287,8 +275,7 @@ jsimd_can_quantize_float (void)
} }
GLOBAL(void) GLOBAL(void)
jsimd_quantize (JCOEFPTR coef_block, DCTELEM *divisors, jsimd_quantize(JCOEFPTR coef_block, DCTELEM *divisors, DCTELEM *workspace)
DCTELEM *workspace)
{ {
} }
@@ -402,3 +389,30 @@ jsimd_huff_encode_one_block (void *state, JOCTET *buffer, JCOEFPTR block,
{ {
return NULL; return NULL;
} }
GLOBAL(int)
jsimd_can_encode_mcu_AC_first_prepare(void)
{
return 0;
}
GLOBAL(void)
jsimd_encode_mcu_AC_first_prepare(const JCOEF *block,
const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *values, size_t *zerobits)
{
}
GLOBAL(int)
jsimd_can_encode_mcu_AC_refine_prepare(void)
{
return 0;
}
GLOBAL(int)
jsimd_encode_mcu_AC_refine_prepare(const JCOEF *block,
const int *jpeg_natural_order_start, int Sl,
int Al, JCOEF *absvalues, size_t *bits)
{
return 0;
}
+7 -11
View File
@@ -14,8 +14,7 @@ EXTERN(int) jsimd_can_convsamp_float (void);
EXTERN(void) jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col, EXTERN(void) jsimd_convsamp(JSAMPARRAY sample_data, JDIMENSION start_col,
DCTELEM *workspace); DCTELEM *workspace);
EXTERN(void) jsimd_convsamp_float (JSAMPARRAY sample_data, EXTERN(void) jsimd_convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
JDIMENSION start_col,
FAST_FLOAT *workspace); FAST_FLOAT *workspace);
EXTERN(int) jsimd_can_fdct_islow(void); EXTERN(int) jsimd_can_fdct_islow(void);
@@ -40,17 +39,14 @@ EXTERN(int) jsimd_can_idct_6x6 (void);
EXTERN(int) jsimd_can_idct_12x12(void); EXTERN(int) jsimd_can_idct_12x12(void);
EXTERN(void) jsimd_idct_2x2(j_decompress_ptr cinfo, EXTERN(void) jsimd_idct_2x2(j_decompress_ptr cinfo,
jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JSAMPARRAY output_buf, JDIMENSION output_col);
JDIMENSION output_col);
EXTERN(void) jsimd_idct_4x4(j_decompress_ptr cinfo, EXTERN(void) jsimd_idct_4x4(j_decompress_ptr cinfo,
jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JSAMPARRAY output_buf, JDIMENSION output_col);
JDIMENSION output_col);
EXTERN(void) jsimd_idct_6x6(j_decompress_ptr cinfo, EXTERN(void) jsimd_idct_6x6(j_decompress_ptr cinfo,
jpeg_component_info *compptr, jpeg_component_info *compptr, JCOEFPTR coef_block,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JSAMPARRAY output_buf, JDIMENSION output_col);
JDIMENSION output_col);
EXTERN(void) jsimd_idct_12x12(j_decompress_ptr cinfo, EXTERN(void) jsimd_idct_12x12(j_decompress_ptr cinfo,
jpeg_component_info *compptr, jpeg_component_info *compptr,
JCOEFPTR coef_block, JSAMPARRAY output_buf, JCOEFPTR coef_block, JSAMPARRAY output_buf,
+28 -20
View File
@@ -17,8 +17,8 @@
*/ */
LOCAL(void) LOCAL(void)
add_huff_table (j_common_ptr cinfo, add_huff_table(j_common_ptr cinfo, JHUFF_TBL **htblptr, const UINT8 *bits,
JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val) const UINT8 *val)
/* Define a Huffman table */ /* Define a Huffman table */
{ {
int nsymbols, len; int nsymbols, len;
@@ -56,20 +56,25 @@ std_huff_tables (j_common_ptr cinfo)
{ {
JHUFF_TBL **dc_huff_tbl_ptrs, **ac_huff_tbl_ptrs; JHUFF_TBL **dc_huff_tbl_ptrs, **ac_huff_tbl_ptrs;
static const UINT8 bits_dc_luminance[17] = static const UINT8 bits_dc_luminance[17] = {
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
static const UINT8 val_dc_luminance[] = };
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static const UINT8 val_dc_luminance[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
};
static const UINT8 bits_dc_chrominance[17] = static const UINT8 bits_dc_chrominance[17] = {
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
static const UINT8 val_dc_chrominance[] = };
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; static const UINT8 val_dc_chrominance[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
};
static const UINT8 bits_ac_luminance[17] = static const UINT8 bits_ac_luminance[17] = {
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
static const UINT8 val_ac_luminance[] = };
{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, static const UINT8 val_ac_luminance[] = {
0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
@@ -89,12 +94,14 @@ std_huff_tables (j_common_ptr cinfo)
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa }; 0xf9, 0xfa
};
static const UINT8 bits_ac_chrominance[17] = static const UINT8 bits_ac_chrominance[17] = {
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
static const UINT8 val_ac_chrominance[] = };
{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, static const UINT8 val_ac_chrominance[] = {
0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
@@ -114,7 +121,8 @@ std_huff_tables (j_common_ptr cinfo)
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa }; 0xf9, 0xfa
};
if (cinfo->is_decompressor) { if (cinfo->is_decompressor) {
dc_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->dc_huff_tbl_ptrs; dc_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->dc_huff_tbl_ptrs;
+2 -2
View File
@@ -92,8 +92,8 @@ jround_up (long a, long b)
GLOBAL(void) GLOBAL(void)
jcopy_sample_rows(JSAMPARRAY input_array, int source_row, jcopy_sample_rows(JSAMPARRAY input_array, int source_row,
JSAMPARRAY output_array, int dest_row, JSAMPARRAY output_array, int dest_row, int num_rows,
int num_rows, JDIMENSION num_cols) JDIMENSION num_cols)
/* Copy some rows of samples from one place to another. /* Copy some rows of samples from one place to another.
* num_rows rows are copied from input_array[source_row++] * num_rows rows are copied from input_array[source_row++]
* to output_array[dest_row++]; these areas may overlap for duplication. * to output_array[dest_row++]; these areas may overlap for duplication.
+8 -5
View File
@@ -4,7 +4,7 @@
* 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-2012, Thomas G. Lane, Guido Vollbeding. * Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
* libjpeg-turbo Modifications: * libjpeg-turbo Modifications:
* Copyright (C) 2010, 2012-2017, D. R. Commander. * Copyright (C) 2010, 2012-2019, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg * For conditions of distribution and use, see the accompanying README.ijg
* file. * file.
* *
@@ -35,15 +35,18 @@
* their code * their code
*/ */
#define JCOPYRIGHT "Copyright (C) 2009-2017 D. R. Commander\n" \ #define JCOPYRIGHT \
"Copyright (C) 2009-2019 D. R. Commander\n" \
"Copyright (C) 2011-2016 Siarhei Siamashka\n" \ "Copyright (C) 2011-2016 Siarhei Siamashka\n" \
"Copyright (C) 2015-2016 Matthieu Darbois\n" \ "Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \
"Copyright (C) 2015 Intel Corporation\n" \
"Copyright (C) 2015 Google, Inc.\n" \ "Copyright (C) 2015 Google, Inc.\n" \
"Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \ "Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \
"Copyright (C) 2013 Linaro Limited\n" \ "Copyright (C) 2013 Linaro Limited\n" \
"Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \ "Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \ "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
"Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding" \ "Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding"
#define JCOPYRIGHT_SHORT "Copyright (C) 1991-2017 The libjpeg-turbo Project and many others" #define JCOPYRIGHT_SHORT \
"Copyright (C) 1991-2019 The libjpeg-turbo Project and many others"
-7
View File
@@ -15,13 +15,6 @@ else()
ocv_list_filterout(lib_srcs jmemnobs.c) ocv_list_filterout(lib_srcs jmemnobs.c)
endif() endif()
if(WINRT)
add_definitions(-DNO_GETENV)
get_directory_property( DirDefs COMPILE_DEFINITIONS )
message(STATUS "Adding NO_GETENV to compiler definitions for WINRT:")
message(STATUS " COMPILE_DEFINITIONS = ${DirDefs}")
endif()
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
# Define the library target: # Define the library target:
# ---------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------
+9 -6
View File
@@ -1,7 +1,7 @@
The Independent JPEG Group's JPEG software The Independent JPEG Group's JPEG software
========================================== ==========================================
README for release 9b of 17-Jan-2016 README for release 9c of 14-Jan-2018
==================================== ====================================
This distribution contains the ninth public release of the Independent JPEG This distribution contains the ninth public release of the Independent JPEG
@@ -115,7 +115,7 @@ with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you, fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy. its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding. This software is copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below. All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this Permission is hereby granted to use, copy, modify, and distribute this
@@ -246,8 +246,8 @@ ARCHIVE LOCATIONS
The "official" archive site for this software is www.ijg.org. The "official" archive site for this software is www.ijg.org.
The most recent released version can always be found there in The most recent released version can always be found there in
directory "files". This particular version will be archived as directory "files". This particular version will be archived as
http://www.ijg.org/files/jpegsrc.v9b.tar.gz, and in Windows-compatible http://www.ijg.org/files/jpegsrc.v9c.tar.gz, and in Windows-compatible
"zip" archive format as http://www.ijg.org/files/jpegsr9b.zip. "zip" archive format as http://www.ijg.org/files/jpegsr9c.zip.
The JPEG FAQ (Frequently Asked Questions) article is a source of some The JPEG FAQ (Frequently Asked Questions) article is a source of some
general information about JPEG. general information about JPEG.
@@ -293,8 +293,11 @@ communication about JPEG configuration in Sigma Photo Pro software.
Thank to Andrew Finkenstadt for hosting the ijg.org site. Thank to Andrew Finkenstadt for hosting the ijg.org site.
Last but not least special thank to Thomas G. Lane for the original Thank to Thomas G. Lane for the original design and development of
design and development of this singular software package. this singular software package.
Thank to Lars Goehler, Andreas Heinecke, Sebastian Fuss, Yvonne Roebert,
Andrej Werner, and Ulf-Dietrich Braumann for support and public relations.
FILE FORMAT WARS FILE FORMAT WARS
+21
View File
@@ -1,6 +1,27 @@
CHANGE LOG for Independent JPEG Group's JPEG software CHANGE LOG for Independent JPEG Group's JPEG software
Version 9c 14-Jan-2018
-----------------------
jpegtran: add an option to the -wipe switch to fill the region
with the average of adjacent blocks, instead of gray out.
Thank to Caitlyn Feddock and Maddie Ziegler for inspiration.
Make range extension bits adjustable (in jpegint.h).
Thank to Robin Watts for suggestion.
Provide macros for fflush() and ferror() in jinclude.h in order
to facilitate adaption by applications using an own FILE class.
Thank to Gerhard Huber for suggestion.
Add libjpeg pkg-config file. Thank to Mark Lavi, Vincent Torri,
Patrick McMunn, and Huw Davies for suggestion.
Add sanity checks in cjpeg image reader modules.
Thank to Bingchang, Liu for reports.
Version 9b 17-Jan-2016 Version 9b 17-Jan-2016
----------------------- -----------------------
+167 -2
View File
@@ -2,7 +2,7 @@
* jcinit.c * jcinit.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2013 by Guido Vollbeding. * Modified 2003-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -21,6 +21,168 @@
#include "jpeglib.h" #include "jpeglib.h"
/*
* Compute JPEG image dimensions and related values.
* NOTE: this is exported for possible use by application.
* Hence it mustn't do anything that can't be done twice.
*/
GLOBAL(void)
jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
/* Do computations that are needed before master selection phase */
{
/* Sanity check on input image dimensions to prevent overflow in
* following calculations.
* We do check jpeg_width and jpeg_height in initial_setup in jcmaster.c,
* but image_width and image_height can come from arbitrary data,
* and we need some space for multiplication by block_size.
*/
if (((long) cinfo->image_width >> 24) || ((long) cinfo->image_height >> 24))
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
#ifdef DCT_SCALING_SUPPORTED
/* Compute actual JPEG image dimensions and DCT scaling choices. */
if (cinfo->scale_num >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/1 scaling */
cinfo->jpeg_width = cinfo->image_width * cinfo->block_size;
cinfo->jpeg_height = cinfo->image_height * cinfo->block_size;
cinfo->min_DCT_h_scaled_size = 1;
cinfo->min_DCT_v_scaled_size = 1;
} else if (cinfo->scale_num * 2 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/2 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 2L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 2L);
cinfo->min_DCT_h_scaled_size = 2;
cinfo->min_DCT_v_scaled_size = 2;
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/3 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 3L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 3L);
cinfo->min_DCT_h_scaled_size = 3;
cinfo->min_DCT_v_scaled_size = 3;
} else if (cinfo->scale_num * 4 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/4 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 4L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 4L);
cinfo->min_DCT_h_scaled_size = 4;
cinfo->min_DCT_v_scaled_size = 4;
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/5 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 5L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 5L);
cinfo->min_DCT_h_scaled_size = 5;
cinfo->min_DCT_v_scaled_size = 5;
} else if (cinfo->scale_num * 6 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/6 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 6L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 6L);
cinfo->min_DCT_h_scaled_size = 6;
cinfo->min_DCT_v_scaled_size = 6;
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/7 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 7L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 7L);
cinfo->min_DCT_h_scaled_size = 7;
cinfo->min_DCT_v_scaled_size = 7;
} else if (cinfo->scale_num * 8 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/8 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 8L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 8L);
cinfo->min_DCT_h_scaled_size = 8;
cinfo->min_DCT_v_scaled_size = 8;
} else if (cinfo->scale_num * 9 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/9 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 9L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 9L);
cinfo->min_DCT_h_scaled_size = 9;
cinfo->min_DCT_v_scaled_size = 9;
} else if (cinfo->scale_num * 10 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/10 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 10L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 10L);
cinfo->min_DCT_h_scaled_size = 10;
cinfo->min_DCT_v_scaled_size = 10;
} else if (cinfo->scale_num * 11 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/11 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 11L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 11L);
cinfo->min_DCT_h_scaled_size = 11;
cinfo->min_DCT_v_scaled_size = 11;
} else if (cinfo->scale_num * 12 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/12 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 12L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 12L);
cinfo->min_DCT_h_scaled_size = 12;
cinfo->min_DCT_v_scaled_size = 12;
} else if (cinfo->scale_num * 13 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/13 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 13L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 13L);
cinfo->min_DCT_h_scaled_size = 13;
cinfo->min_DCT_v_scaled_size = 13;
} else if (cinfo->scale_num * 14 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/14 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 14L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 14L);
cinfo->min_DCT_h_scaled_size = 14;
cinfo->min_DCT_v_scaled_size = 14;
} else if (cinfo->scale_num * 15 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/15 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 15L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 15L);
cinfo->min_DCT_h_scaled_size = 15;
cinfo->min_DCT_v_scaled_size = 15;
} else {
/* Provide block_size/16 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 16L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 16L);
cinfo->min_DCT_h_scaled_size = 16;
cinfo->min_DCT_v_scaled_size = 16;
}
#else /* !DCT_SCALING_SUPPORTED */
/* Hardwire it to "no scaling" */
cinfo->jpeg_width = cinfo->image_width;
cinfo->jpeg_height = cinfo->image_height;
cinfo->min_DCT_h_scaled_size = DCTSIZE;
cinfo->min_DCT_v_scaled_size = DCTSIZE;
#endif /* DCT_SCALING_SUPPORTED */
}
/* /*
* Master selection of compression modules. * Master selection of compression modules.
* This is done once at the start of processing an image. We determine * This is done once at the start of processing an image. We determine
@@ -37,7 +199,7 @@ jinit_compress_master (j_compress_ptr cinfo)
if (cinfo->data_precision != BITS_IN_JSAMPLE) if (cinfo->data_precision != BITS_IN_JSAMPLE)
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
/* Sanity check on image dimensions */ /* Sanity check on input image dimensions */
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 || if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
cinfo->input_components <= 0) cinfo->input_components <= 0)
ERREXIT(cinfo, JERR_EMPTY_IMAGE); ERREXIT(cinfo, JERR_EMPTY_IMAGE);
@@ -48,6 +210,9 @@ jinit_compress_master (j_compress_ptr cinfo)
if ((long) jd_samplesperrow != samplesperrow) if ((long) jd_samplesperrow != samplesperrow)
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW); ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
/* Compute JPEG image dimensions and related values. */
jpeg_calc_jpeg_dimensions(cinfo);
/* Initialize master control (includes parameter checking/processing) */ /* Initialize master control (includes parameter checking/processing) */
jinit_c_master_control(cinfo, FALSE /* full compression */); jinit_c_master_control(cinfo, FALSE /* full compression */);
+5 -187
View File
@@ -2,7 +2,7 @@
* jcmaster.c * jcmaster.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2013 by Guido Vollbeding. * Modified 2003-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -43,191 +43,13 @@ typedef my_comp_master * my_master_ptr;
* Support routines that do various essential calculations. * Support routines that do various essential calculations.
*/ */
/*
* Compute JPEG image dimensions and related values.
* NOTE: this is exported for possible use by application.
* Hence it mustn't do anything that can't be done twice.
*/
GLOBAL(void)
jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
/* Do computations that are needed before master selection phase */
{
#ifdef DCT_SCALING_SUPPORTED
/* Sanity check on input image dimensions to prevent overflow in
* following calculation.
* We do check jpeg_width and jpeg_height in initial_setup below,
* but image_width and image_height can come from arbitrary data,
* and we need some space for multiplication by block_size.
*/
if (((long) cinfo->image_width >> 24) || ((long) cinfo->image_height >> 24))
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
/* Compute actual JPEG image dimensions and DCT scaling choices. */
if (cinfo->scale_num >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/1 scaling */
cinfo->jpeg_width = cinfo->image_width * cinfo->block_size;
cinfo->jpeg_height = cinfo->image_height * cinfo->block_size;
cinfo->min_DCT_h_scaled_size = 1;
cinfo->min_DCT_v_scaled_size = 1;
} else if (cinfo->scale_num * 2 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/2 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 2L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 2L);
cinfo->min_DCT_h_scaled_size = 2;
cinfo->min_DCT_v_scaled_size = 2;
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/3 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 3L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 3L);
cinfo->min_DCT_h_scaled_size = 3;
cinfo->min_DCT_v_scaled_size = 3;
} else if (cinfo->scale_num * 4 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/4 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 4L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 4L);
cinfo->min_DCT_h_scaled_size = 4;
cinfo->min_DCT_v_scaled_size = 4;
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/5 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 5L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 5L);
cinfo->min_DCT_h_scaled_size = 5;
cinfo->min_DCT_v_scaled_size = 5;
} else if (cinfo->scale_num * 6 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/6 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 6L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 6L);
cinfo->min_DCT_h_scaled_size = 6;
cinfo->min_DCT_v_scaled_size = 6;
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/7 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 7L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 7L);
cinfo->min_DCT_h_scaled_size = 7;
cinfo->min_DCT_v_scaled_size = 7;
} else if (cinfo->scale_num * 8 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/8 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 8L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 8L);
cinfo->min_DCT_h_scaled_size = 8;
cinfo->min_DCT_v_scaled_size = 8;
} else if (cinfo->scale_num * 9 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/9 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 9L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 9L);
cinfo->min_DCT_h_scaled_size = 9;
cinfo->min_DCT_v_scaled_size = 9;
} else if (cinfo->scale_num * 10 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/10 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 10L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 10L);
cinfo->min_DCT_h_scaled_size = 10;
cinfo->min_DCT_v_scaled_size = 10;
} else if (cinfo->scale_num * 11 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/11 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 11L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 11L);
cinfo->min_DCT_h_scaled_size = 11;
cinfo->min_DCT_v_scaled_size = 11;
} else if (cinfo->scale_num * 12 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/12 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 12L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 12L);
cinfo->min_DCT_h_scaled_size = 12;
cinfo->min_DCT_v_scaled_size = 12;
} else if (cinfo->scale_num * 13 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/13 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 13L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 13L);
cinfo->min_DCT_h_scaled_size = 13;
cinfo->min_DCT_v_scaled_size = 13;
} else if (cinfo->scale_num * 14 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/14 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 14L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 14L);
cinfo->min_DCT_h_scaled_size = 14;
cinfo->min_DCT_v_scaled_size = 14;
} else if (cinfo->scale_num * 15 >= cinfo->scale_denom * cinfo->block_size) {
/* Provide block_size/15 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 15L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 15L);
cinfo->min_DCT_h_scaled_size = 15;
cinfo->min_DCT_v_scaled_size = 15;
} else {
/* Provide block_size/16 scaling */
cinfo->jpeg_width = (JDIMENSION)
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 16L);
cinfo->jpeg_height = (JDIMENSION)
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 16L);
cinfo->min_DCT_h_scaled_size = 16;
cinfo->min_DCT_v_scaled_size = 16;
}
#else /* !DCT_SCALING_SUPPORTED */
/* Hardwire it to "no scaling" */
cinfo->jpeg_width = cinfo->image_width;
cinfo->jpeg_height = cinfo->image_height;
cinfo->min_DCT_h_scaled_size = DCTSIZE;
cinfo->min_DCT_v_scaled_size = DCTSIZE;
#endif /* DCT_SCALING_SUPPORTED */
}
LOCAL(void) LOCAL(void)
jpeg_calc_trans_dimensions (j_compress_ptr cinfo) initial_setup (j_compress_ptr cinfo)
{
if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);
cinfo->block_size = cinfo->min_DCT_h_scaled_size;
}
LOCAL(void)
initial_setup (j_compress_ptr cinfo, boolean transcode_only)
/* Do computations that are needed before master selection phase */ /* Do computations that are needed before master selection phase */
{ {
int ci, ssize; int ci, ssize;
jpeg_component_info *compptr; jpeg_component_info *compptr;
if (transcode_only)
jpeg_calc_trans_dimensions(cinfo);
else
jpeg_calc_jpeg_dimensions(cinfo);
/* Sanity check on block_size */ /* Sanity check on block_size */
if (cinfo->block_size < 1 || cinfo->block_size > 16) if (cinfo->block_size < 1 || cinfo->block_size > 16)
ERREXIT2(cinfo, JERR_BAD_DCTSIZE, cinfo->block_size, cinfo->block_size); ERREXIT2(cinfo, JERR_BAD_DCTSIZE, cinfo->block_size, cinfo->block_size);
@@ -414,13 +236,9 @@ validate_script (j_compress_ptr cinfo)
* out-of-range reconstructed DC values during the first DC scan, * out-of-range reconstructed DC values during the first DC scan,
* which might cause problems for some decoders. * which might cause problems for some decoders.
*/ */
#if BITS_IN_JSAMPLE == 8
#define MAX_AH_AL 10
#else
#define MAX_AH_AL 13
#endif
if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 || if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL) Ah < 0 || Ah > (cinfo->data_precision > 8 ? 13 : 10) ||
Al < 0 || Al > (cinfo->data_precision > 8 ? 13 : 10))
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno); ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
if (Ss == 0) { if (Ss == 0) {
if (Se != 0) /* DC and AC together not OK */ if (Se != 0) /* DC and AC together not OK */
@@ -812,7 +630,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
master->pub.is_last_pass = FALSE; master->pub.is_last_pass = FALSE;
/* Validate parameters, determine derived values */ /* Validate parameters, determine derived values */
initial_setup(cinfo, transcode_only); initial_setup(cinfo);
if (cinfo->scan_info != NULL) { if (cinfo->scan_info != NULL) {
#ifdef C_MULTISCAN_FILES_SUPPORTED #ifdef C_MULTISCAN_FILES_SUPPORTED
+21 -3
View File
@@ -2,7 +2,7 @@
* jctrans.c * jctrans.c
* *
* Copyright (C) 1995-1998, Thomas G. Lane. * Copyright (C) 1995-1998, Thomas G. Lane.
* Modified 2000-2013 by Guido Vollbeding. * Modified 2000-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -85,12 +85,15 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
jpeg_set_defaults(dstinfo); jpeg_set_defaults(dstinfo);
/* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB. /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
* Fix it to get the right header markers for the image colorspace. * Fix it to get the right header markers for the image colorspace.
* Note: Entropy table assignment in jpeg_set_colorspace depends * Note: Entropy table assignment in jpeg_set_colorspace
* on color_transform. * depends on color_transform.
* Adaption is also required for setting the appropriate
* entropy coding mode dependent on image data precision.
*/ */
dstinfo->color_transform = srcinfo->color_transform; dstinfo->color_transform = srcinfo->color_transform;
jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space); jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
dstinfo->data_precision = srcinfo->data_precision; dstinfo->data_precision = srcinfo->data_precision;
dstinfo->arith_code = srcinfo->data_precision > 8 ? TRUE : FALSE;
dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling; dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
/* Copy the source's quantization tables. */ /* Copy the source's quantization tables. */
for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) { for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
@@ -157,6 +160,18 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
} }
LOCAL(void)
jpeg_calc_trans_dimensions (j_compress_ptr cinfo)
/* Do computations that are needed before master selection phase */
{
if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);
cinfo->block_size = cinfo->min_DCT_h_scaled_size;
}
/* /*
* Master selection of compression modules for transcoding. * Master selection of compression modules for transcoding.
* This substitutes for jcinit.c's initialization of the full compressor. * This substitutes for jcinit.c's initialization of the full compressor.
@@ -166,6 +181,9 @@ LOCAL(void)
transencode_master_selection (j_compress_ptr cinfo, transencode_master_selection (j_compress_ptr cinfo,
jvirt_barray_ptr * coef_arrays) jvirt_barray_ptr * coef_arrays)
{ {
/* Do computations that are needed before master selection phase */
jpeg_calc_trans_dimensions(cinfo);
/* Initialize master control (includes parameter checking/processing) */ /* Initialize master control (includes parameter checking/processing) */
jinit_c_master_control(cinfo, TRUE /* transcode only */); jinit_c_master_control(cinfo, TRUE /* transcode only */);
+3 -3
View File
@@ -2,7 +2,7 @@
* jdatadst.c * jdatadst.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2009-2012 by Guido Vollbeding. * Modified 2009-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -170,9 +170,9 @@ term_destination (j_compress_ptr cinfo)
if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount) if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
ERREXIT(cinfo, JERR_FILE_WRITE); ERREXIT(cinfo, JERR_FILE_WRITE);
} }
fflush(dest->outfile); JFFLUSH(dest->outfile);
/* Make sure we wrote the output file OK */ /* Make sure we wrote the output file OK */
if (ferror(dest->outfile)) if (JFERROR(dest->outfile))
ERREXIT(cinfo, JERR_FILE_WRITE); ERREXIT(cinfo, JERR_FILE_WRITE);
} }
+7 -1
View File
@@ -2,7 +2,7 @@
* jdcolor.c * jdcolor.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2011-2015 by Guido Vollbeding. * Modified 2011-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -14,6 +14,12 @@
#include "jpeglib.h" #include "jpeglib.h"
#if RANGE_BITS < 2
/* Deliberate syntax err */
Sorry, this code requires 2 or more range extension bits.
#endif
/* Private subobject */ /* Private subobject */
typedef struct { typedef struct {
+5 -6
View File
@@ -2,7 +2,7 @@
* jdct.h * jdct.h
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2002-2015 by Guido Vollbeding. * Modified 2002-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -79,13 +79,12 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
* converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
* be quite far out of range if the input data is corrupt, so a bulletproof * be quite far out of range if the input data is corrupt, so a bulletproof
* range-limiting step is required. We use a mask-and-table-lookup method * range-limiting step is required. We use a mask-and-table-lookup method
* to do the combined operations quickly, assuming that MAXJSAMPLE+1 * to do the combined operations quickly, assuming that RANGE_CENTER
* is a power of 2. See the comments with prepare_range_limit_table * (defined in jpegint.h) is a power of 2. See the comments with
* (in jdmaster.c) for more info. * prepare_range_limit_table (in jdmaster.c) for more info.
*/ */
#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ #define RANGE_MASK (RANGE_CENTER * 2 - 1)
#define RANGE_CENTER (MAXJSAMPLE * 2 + 2)
#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE) #define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET) #define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
+4 -5
View File
@@ -2,7 +2,7 @@
* jdhuff.c * jdhuff.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2006-2013 by Guido Vollbeding. * Modified 2006-2016 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -799,10 +799,6 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
*/ */
if (! entropy->insufficient_data) { if (! entropy->insufficient_data) {
Se = cinfo->Se;
Al = cinfo->Al;
natural_order = cinfo->natural_order;
/* Load up working state. /* Load up working state.
* We can avoid loading/saving bitread state if in an EOB run. * We can avoid loading/saving bitread state if in an EOB run.
*/ */
@@ -814,6 +810,9 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
EOBRUN--; /* ...process it now (we do nothing) */ EOBRUN--; /* ...process it now (we do nothing) */
else { else {
BITREAD_LOAD_STATE(cinfo,entropy->bitstate); BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
Se = cinfo->Se;
Al = cinfo->Al;
natural_order = cinfo->natural_order;
block = MCU_data[0]; block = MCU_data[0];
tbl = entropy->ac_derived_tbl; tbl = entropy->ac_derived_tbl;
+19 -25
View File
@@ -2,7 +2,7 @@
* jdmainct.c * jdmainct.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2002-2012 by Guido Vollbeding. * Modified 2002-2016 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -26,8 +26,8 @@
* trivial. Its responsibility is to provide context rows for upsampling/ * trivial. Its responsibility is to provide context rows for upsampling/
* rescaling, and doing this in an efficient fashion is a bit tricky. * rescaling, and doing this in an efficient fashion is a bit tricky.
* *
* Postprocessor input data is counted in "row groups". A row group * Postprocessor input data is counted in "row groups". A row group is
* is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size) * defined to be (v_samp_factor * DCT_v_scaled_size / min_DCT_v_scaled_size)
* sample rows of each component. (We require DCT_scaled_size values to be * sample rows of each component. (We require DCT_scaled_size values to be
* chosen such that these numbers are integers. In practice DCT_scaled_size * chosen such that these numbers are integers. In practice DCT_scaled_size
* values will likely be powers of two, so we actually have the stronger * values will likely be powers of two, so we actually have the stronger
@@ -37,8 +37,8 @@
* applying). * applying).
* *
* The coefficient controller will deliver data to us one iMCU row at a time; * The coefficient controller will deliver data to us one iMCU row at a time;
* each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or * each iMCU row contains v_samp_factor * DCT_v_scaled_size sample rows, or
* exactly min_DCT_scaled_size row groups. (This amount of data corresponds * exactly min_DCT_v_scaled_size row groups. (This amount of data corresponds
* to one row of MCUs when the image is fully interleaved.) Note that the * to one row of MCUs when the image is fully interleaved.) Note that the
* number of sample rows varies across components, but the number of row * number of sample rows varies across components, but the number of row
* groups does not. Some garbage sample rows may be included in the last iMCU * groups does not. Some garbage sample rows may be included in the last iMCU
@@ -75,7 +75,7 @@
* We could do this most simply by copying data around in our buffer, but * We could do this most simply by copying data around in our buffer, but
* that'd be very slow. We can avoid copying any data by creating a rather * that'd be very slow. We can avoid copying any data by creating a rather
* strange pointer structure. Here's how it works. We allocate a workspace * strange pointer structure. Here's how it works. We allocate a workspace
* consisting of M+2 row groups (where M = min_DCT_scaled_size is the number * consisting of M+2 row groups (where M = min_DCT_v_scaled_size is the number
* of row groups per iMCU row). We create two sets of redundant pointers to * of row groups per iMCU row). We create two sets of redundant pointers to
* the workspace. Labeling the physical row groups 0 to M+1, the synthesized * the workspace. Labeling the physical row groups 0 to M+1, the synthesized
* pointer lists look like this: * pointer lists look like this:
@@ -100,11 +100,11 @@
* the first or last sample row as necessary (this is cheaper than copying * the first or last sample row as necessary (this is cheaper than copying
* sample rows around). * sample rows around).
* *
* This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1. In that * This scheme breaks down if M < 2, ie, min_DCT_v_scaled_size is 1. In that
* situation each iMCU row provides only one row group so the buffering logic * situation each iMCU row provides only one row group so the buffering logic
* must be different (eg, we must read two iMCU rows before we can emit the * must be different (eg, we must read two iMCU rows before we can emit the
* first row group). For now, we simply do not support providing context * first row group). For now, we simply do not support providing context
* rows when min_DCT_scaled_size is 1. That combination seems unlikely to * rows when min_DCT_v_scaled_size is 1. That combination seems unlikely to
* be worth providing --- if someone wants a 1/8th-size preview, they probably * be worth providing --- if someone wants a 1/8th-size preview, they probably
* want it quick and dirty, so a context-free upsampler is sufficient. * want it quick and dirty, so a context-free upsampler is sufficient.
*/ */
@@ -118,17 +118,18 @@ typedef struct {
/* Pointer to allocated workspace (M or M+2 row groups). */ /* Pointer to allocated workspace (M or M+2 row groups). */
JSAMPARRAY buffer[MAX_COMPONENTS]; JSAMPARRAY buffer[MAX_COMPONENTS];
boolean buffer_full; /* Have we gotten an iMCU row from decoder? */
JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */
JDIMENSION rowgroups_avail; /* row groups available to postprocessor */
/* Remaining fields are only used in the context case. */ /* Remaining fields are only used in the context case. */
boolean buffer_full; /* Have we gotten an iMCU row from decoder? */
/* These are the master pointers to the funny-order pointer lists. */ /* These are the master pointers to the funny-order pointer lists. */
JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */ JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */
int whichptr; /* indicates which pointer set is now in use */ int whichptr; /* indicates which pointer set is now in use */
int context_state; /* process_data state machine status */ int context_state; /* process_data state machine status */
JDIMENSION rowgroups_avail; /* row groups available to postprocessor */
JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */
} my_main_controller; } my_main_controller;
@@ -195,7 +196,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
LOCAL(void) LOCAL(void)
make_funny_pointers (j_decompress_ptr cinfo) make_funny_pointers (j_decompress_ptr cinfo)
/* Create the funny pointer lists discussed in the comments above. /* Create the funny pointer lists discussed in the comments above.
* The actual workspace is already allocated (in main->buffer), * The actual workspace is already allocated (in mainp->buffer),
* and the space for the pointer lists is allocated too. * and the space for the pointer lists is allocated too.
* This routine just fills in the curiously ordered lists. * This routine just fills in the curiously ordered lists.
* This will be repeated at the beginning of each pass. * This will be repeated at the beginning of each pass.
@@ -317,12 +318,12 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */ mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
mainp->context_state = CTX_PREPARE_FOR_IMCU; mainp->context_state = CTX_PREPARE_FOR_IMCU;
mainp->iMCU_row_ctr = 0; mainp->iMCU_row_ctr = 0;
mainp->buffer_full = FALSE; /* Mark buffer empty */
} else { } else {
/* Simple case with no context needed */ /* Simple case with no context needed */
mainp->pub.process_data = process_data_simple_main; mainp->pub.process_data = process_data_simple_main;
mainp->rowgroup_ctr = mainp->rowgroups_avail; /* Mark buffer empty */
} }
mainp->buffer_full = FALSE; /* Mark buffer empty */
mainp->rowgroup_ctr = 0;
break; break;
#ifdef QUANT_2PASS_SUPPORTED #ifdef QUANT_2PASS_SUPPORTED
case JBUF_CRANK_DEST: case JBUF_CRANK_DEST:
@@ -348,17 +349,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
JDIMENSION out_rows_avail) JDIMENSION out_rows_avail)
{ {
my_main_ptr mainp = (my_main_ptr) cinfo->main; my_main_ptr mainp = (my_main_ptr) cinfo->main;
JDIMENSION rowgroups_avail;
/* Read input data if we haven't filled the main buffer yet */ /* Read input data if we haven't filled the main buffer yet */
if (! mainp->buffer_full) { if (mainp->rowgroup_ctr >= mainp->rowgroups_avail) {
if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer)) if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer))
return; /* suspension forced, can do nothing more */ return; /* suspension forced, can do nothing more */
mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */ mainp->rowgroup_ctr = 0; /* OK, we have an iMCU row to work with */
} }
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
rowgroups_avail = (JDIMENSION) cinfo->min_DCT_v_scaled_size;
/* Note: at the bottom of the image, we may pass extra garbage row groups /* Note: at the bottom of the image, we may pass extra garbage row groups
* to the postprocessor. The postprocessor has to check for bottom * to the postprocessor. The postprocessor has to check for bottom
* of image anyway (at row resolution), so no point in us doing it too. * of image anyway (at row resolution), so no point in us doing it too.
@@ -366,14 +364,8 @@ process_data_simple_main (j_decompress_ptr cinfo,
/* Feed the postprocessor */ /* Feed the postprocessor */
(*cinfo->post->post_process_data) (cinfo, mainp->buffer, (*cinfo->post->post_process_data) (cinfo, mainp->buffer,
&mainp->rowgroup_ctr, rowgroups_avail, &mainp->rowgroup_ctr, mainp->rowgroups_avail,
output_buf, out_row_ctr, out_rows_avail); output_buf, out_row_ctr, out_rows_avail);
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
if (mainp->rowgroup_ctr >= rowgroups_avail) {
mainp->buffer_full = FALSE;
mainp->rowgroup_ctr = 0;
}
} }
@@ -498,7 +490,9 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */ alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
ngroups = cinfo->min_DCT_v_scaled_size + 2; ngroups = cinfo->min_DCT_v_scaled_size + 2;
} else { } else {
/* There are always min_DCT_v_scaled_size row groups in an iMCU row. */
ngroups = cinfo->min_DCT_v_scaled_size; ngroups = cinfo->min_DCT_v_scaled_size;
mainp->rowgroups_avail = (JDIMENSION) ngroups;
} }
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
+6 -7
View File
@@ -2,7 +2,7 @@
* jdmaster.c * jdmaster.c
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2002-2015 by Guido Vollbeding. * Modified 2002-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -237,18 +237,17 @@ prepare_range_limit_table (j_decompress_ptr cinfo)
JSAMPLE * table; JSAMPLE * table;
int i; int i;
table = (JSAMPLE *) table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, JPOOL_IMAGE, (RANGE_CENTER * 2 + MAXJSAMPLE + 1) * SIZEOF(JSAMPLE));
5 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
/* First segment of range limit table: limit[x] = 0 for x < 0 */ /* First segment of range limit table: limit[x] = 0 for x < 0 */
MEMZERO(table, 2 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); MEMZERO(table, RANGE_CENTER * SIZEOF(JSAMPLE));
table += 2 * (MAXJSAMPLE+1); /* allow negative subscripts of table */ table += RANGE_CENTER; /* allow negative subscripts of table */
cinfo->sample_range_limit = table; cinfo->sample_range_limit = table;
/* Main part of range limit table: limit[x] = x */ /* Main part of range limit table: limit[x] = x */
for (i = 0; i <= MAXJSAMPLE; i++) for (i = 0; i <= MAXJSAMPLE; i++)
table[i] = (JSAMPLE) i; table[i] = (JSAMPLE) i;
/* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */ /* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
for (; i < 3 * (MAXJSAMPLE+1); i++) for (; i <= MAXJSAMPLE + RANGE_CENTER; i++)
table[i] = MAXJSAMPLE; table[i] = MAXJSAMPLE;
} }
+7 -1
View File
@@ -2,7 +2,7 @@
* jdmerge.c * jdmerge.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2013-2015 by Guido Vollbeding. * Modified 2013-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -40,6 +40,12 @@
#ifdef UPSAMPLE_MERGING_SUPPORTED #ifdef UPSAMPLE_MERGING_SUPPORTED
#if RANGE_BITS < 2
/* Deliberate syntax err */
Sorry, this code requires 2 or more range extension bits.
#endif
/* Private subobject */ /* Private subobject */
typedef struct { typedef struct {
+2 -2
View File
@@ -2,7 +2,7 @@
* jfdctflt.c * jfdctflt.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2003-2015 by Guido Vollbeding. * Modified 2003-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -48,7 +48,7 @@
*/ */
#if DCTSIZE != 8 #if DCTSIZE != 8
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
#endif #endif
+2 -2
View File
@@ -2,7 +2,7 @@
* jfdctfst.c * jfdctfst.c
* *
* Copyright (C) 1994-1996, Thomas G. Lane. * Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2003-2015 by Guido Vollbeding. * Modified 2003-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -44,7 +44,7 @@
*/ */
#if DCTSIZE != 8 #if DCTSIZE != 8
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
#endif #endif
+2 -2
View File
@@ -2,7 +2,7 @@
* jidctflt.c * jidctflt.c
* *
* Copyright (C) 1994-1998, Thomas G. Lane. * Copyright (C) 1994-1998, Thomas G. Lane.
* Modified 2010-2015 by Guido Vollbeding. * Modified 2010-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -50,7 +50,7 @@
*/ */
#if DCTSIZE != 8 #if DCTSIZE != 8
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
#endif #endif
+2 -2
View File
@@ -2,7 +2,7 @@
* jidctfst.c * jidctfst.c
* *
* Copyright (C) 1994-1998, Thomas G. Lane. * Copyright (C) 1994-1998, Thomas G. Lane.
* Modified 2015 by Guido Vollbeding. * Modified 2015-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -46,7 +46,7 @@
*/ */
#if DCTSIZE != 8 #if DCTSIZE != 8
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
#endif #endif
+18 -17
View File
@@ -2,7 +2,7 @@
* jidctint.c * jidctint.c
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modification developed 2002-2015 by Guido Vollbeding. * Modification developed 2002-2016 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -166,6 +166,7 @@
/* /*
* Perform dequantization and inverse DCT on one block of coefficients. * Perform dequantization and inverse DCT on one block of coefficients.
* *
* Optimized algorithm with 12 multiplications in the 1-D kernel.
* cK represents sqrt(2) * cos(K*pi/16). * cK represents sqrt(2) * cos(K*pi/16).
*/ */
@@ -428,7 +429,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* /*
* Perform dequantization and inverse DCT on one block of coefficients, * Perform dequantization and inverse DCT on one block of coefficients,
* producing a 7x7 output block. * producing a reduced-size 7x7 output block.
* *
* Optimized algorithm with 12 multiplications in the 1-D kernel. * Optimized algorithm with 12 multiplications in the 1-D kernel.
* cK represents sqrt(2) * cos(K*pi/14). * cK represents sqrt(2) * cos(K*pi/14).
@@ -2623,7 +2624,7 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
tmp0 <<= CONST_BITS; tmp0 <<= CONST_BITS;
/* Add fudge factor here for final descale. */ /* Add fudge factor here for final descale. */
tmp0 += 1 << (CONST_BITS-PASS1_BITS-1); tmp0 += ONE << (CONST_BITS-PASS1_BITS-1);
z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */ tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */
@@ -2920,13 +2921,6 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* The rotator is c(-6). * The rotator is c(-6).
*/ */
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
z2 <<= CONST_BITS; z2 <<= CONST_BITS;
@@ -2937,6 +2931,13 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp0 = z2 + z3; tmp0 = z2 + z3;
tmp1 = z2 - z3; tmp1 = z2 - z3;
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
tmp10 = tmp0 + tmp2; tmp10 = tmp0 + tmp2;
tmp13 = tmp0 - tmp2; tmp13 = tmp0 - tmp2;
tmp11 = tmp1 + tmp3; tmp11 = tmp1 + tmp3;
@@ -4883,13 +4884,6 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
* The rotator is c(-6). * The rotator is c(-6).
*/ */
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
z2 <<= CONST_BITS; z2 <<= CONST_BITS;
@@ -4900,6 +4894,13 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
tmp0 = z2 + z3; tmp0 = z2 + z3;
tmp1 = z2 - z3; tmp1 = z2 - z3;
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
tmp10 = tmp0 + tmp2; tmp10 = tmp0 + tmp2;
tmp13 = tmp0 - tmp2; tmp13 = tmp0 - tmp2;
tmp11 = tmp1 + tmp3; tmp11 = tmp1 + tmp3;
+6
View File
@@ -2,6 +2,7 @@
* jinclude.h * jinclude.h
* *
* Copyright (C) 1991-1994, Thomas G. Lane. * Copyright (C) 1991-1994, Thomas G. Lane.
* Modified 2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -83,9 +84,14 @@
* The modules that use fread() and fwrite() always invoke them through * The modules that use fread() and fwrite() always invoke them through
* these macros. On some systems you may need to twiddle the argument casts. * these macros. On some systems you may need to twiddle the argument casts.
* CAUTION: argument order is different from underlying functions! * CAUTION: argument order is different from underlying functions!
*
* Furthermore, macros are provided for fflush() and ferror() in order
* to facilitate adaption by applications using an own FILE class.
*/ */
#define JFREAD(file,buf,sizeofbuf) \ #define JFREAD(file,buf,sizeofbuf) \
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define JFWRITE(file,buf,sizeofbuf) \ #define JFWRITE(file,buf,sizeofbuf) \
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
#define JFFLUSH(file) fflush(file)
#define JFERROR(file) ferror(file)
+14 -1
View File
@@ -2,7 +2,7 @@
* jpegint.h * jpegint.h
* *
* Copyright (C) 1991-1997, Thomas G. Lane. * Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2013 by Guido Vollbeding. * Modified 1997-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -260,6 +260,19 @@ struct jpeg_color_quantizer {
}; };
/* Definition of range extension bits for decompression processes.
* See the comments with prepare_range_limit_table (in jdmaster.c)
* for more info.
* The recommended default value for normal applications is 2.
* Applications with special requirements may use a different value.
* For example, Ghostscript wants to use 3 for proper handling of
* wacky images with oversize coefficient values.
*/
#define RANGE_BITS 2
#define RANGE_CENTER (CENTERJSAMPLE << RANGE_BITS)
/* Miscellaneous useful macros */ /* Miscellaneous useful macros */
#undef MAX #undef MAX
+4 -4
View File
@@ -2,7 +2,7 @@
* jpeglib.h * jpeglib.h
* *
* Copyright (C) 1991-1998, Thomas G. Lane. * Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2015 by Guido Vollbeding. * Modified 2002-2017 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -39,7 +39,7 @@ extern "C" {
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */ #define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
#define JPEG_LIB_VERSION_MAJOR 9 #define JPEG_LIB_VERSION_MAJOR 9
#define JPEG_LIB_VERSION_MINOR 2 #define JPEG_LIB_VERSION_MINOR 3
/* Various constants determining the sizes of things. /* Various constants determining the sizes of things.
@@ -411,8 +411,8 @@ struct jpeg_compress_struct {
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
/* The coefficient controller receives data in units of MCU rows as defined /* The coefficient controller receives data in units of MCU rows as defined
* for fully interleaved scans (whether the JPEG file is interleaved or not). * for fully interleaved scans (whether the JPEG file is interleaved or not).
* There are v_samp_factor * DCTSIZE sample rows of each component in an * There are v_samp_factor * DCT_v_scaled_size sample rows of each component
* "iMCU" (interleaved MCU) row. * in an "iMCU" (interleaved MCU) row.
*/ */
/* /*
+3 -3
View File
@@ -1,7 +1,7 @@
/* /*
* jversion.h * jversion.h
* *
* Copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding. * Copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
* This file is part of the Independent JPEG Group's software. * This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file. * For conditions of distribution and use, see the accompanying README file.
* *
@@ -9,6 +9,6 @@
*/ */
#define JVERSION "9b 17-Jan-2016" #define JVERSION "9c 14-Jan-2018"
#define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding" #define JCOPYRIGHT "Copyright (C) 2018, Thomas G. Lane, Guido Vollbeding"
+43 -5
View File
@@ -6063,9 +6063,47 @@ Version 1.6.35 [July 15, 2018]
Added missing parentheses to a macro definition Added missing parentheses to a macro definition
(suggested by "irwir" in GitHub issue #216) (suggested by "irwir" in GitHub issue #216)
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Version 1.6.36 [December 1, 2018]
(subscription required; visit Optimized png_do_expand_palette for ARM processors.
https://lists.sourceforge.net/lists/listinfo/png-mng-implement Improved performance by around 10-22% on a recent ARM Chromebook.
to subscribe). (Contributed by Richard Townsend, ARM Holdings)
Fixed manipulation of machine-specific optimization options.
(Contributed by Vicki Pfau)
Used memcpy instead of manual pointer arithmetic on Intel SSE2.
(Contributed by Samuel Williams)
Fixed build errors with MSVC on ARM64.
(Contributed by Zhijie Liang)
Fixed detection of libm in CMakeLists.
(Contributed by Cameron Cawley)
Fixed incorrect creation of pkg-config file in CMakeLists.
(Contributed by Kyle Bentley)
Fixed the CMake build on Windows MSYS by avoiding symlinks.
Fixed a build warning on OpenBSD.
(Contributed by Theo Buehler)
Fixed various typos in comments.
(Contributed by "luz.paz")
Raised the minimum required CMake version from 3.0.2 to 3.1.
Removed yet more of the vestigial support for pre-ANSI C compilers.
Removed ancient makefiles for ancient systems that have been broken
across all previous libpng-1.6.x versions.
Removed the Y2K compliance statement and the export control
information.
Applied various code style and documentation fixes.
Glenn R-P Version 1.6.37 [April 14, 2019]
Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
Fixed a memory leak in pngtest.c.
Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
contrib/pngminus; refactor.
Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
(Contributed by Willem van Schaik)
Fixed a typo in the libpng license v2.
(Contributed by Miguel Ojeda)
Added makefiles for AddressSanitizer-enabled builds.
Cleaned up various makefiles.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe.
+19 -5
View File
@@ -29,8 +29,11 @@ file(GLOB lib_hdrs *.h)
if(ARM OR AARCH64) if(ARM OR AARCH64)
if(ENABLE_NEON AND NOT AARCH64) if(ENABLE_NEON)
list(APPEND lib_srcs arm/arm_init.c arm/filter_neon.S arm/filter_neon_intrinsics.c) if(NOT AARCH64)
list(APPEND lib_srcs arm/filter_neon.S)
endif()
list(APPEND lib_srcs arm/arm_init.c arm/filter_neon_intrinsics.c arm/palette_neon_intrinsics.c)
add_definitions(-DPNG_ARM_NEON_OPT=2) add_definitions(-DPNG_ARM_NEON_OPT=2)
else() else()
add_definitions(-DPNG_ARM_NEON_OPT=0) # NEON assembler is not supported add_definitions(-DPNG_ARM_NEON_OPT=0) # NEON assembler is not supported
@@ -43,8 +46,19 @@ if(";${CPU_BASELINE_FINAL};" MATCHES "SSE2"
add_definitions(-DPNG_INTEL_SSE) add_definitions(-DPNG_INTEL_SSE)
endif() endif()
# set definitions and sources for MIPS
if(";${CPU_BASELINE_FINAL};" MATCHES "MSA")
list(APPEND lib_srcs mips/mips_init.c mips/filter_msa_intrinsics.c)
add_definitions(-DPNG_MIPS_MSA_OPT=2)
ocv_warnings_disable(CMAKE_C_FLAGS -Wshadow)
else()
add_definitions(-DPNG_MIPS_MSA_OPT=0)
endif()
if(PPC64LE OR PPC64) if(PPC64LE OR PPC64)
if(ENABLE_VSX AND NOT PPC64) # VSX3 features are backwards compatible
if(";${CPU_BASELINE_FINAL};" MATCHES "VSX.*"
AND NOT PPC64)
list(APPEND lib_srcs powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c) list(APPEND lib_srcs powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c)
add_definitions(-DPNG_POWERPC_VSX_OPT=2) add_definitions(-DPNG_POWERPC_VSX_OPT=2)
else() else()
@@ -63,7 +77,7 @@ endif(MSVC)
add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs}) add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES}) target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES})
ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wcast-align -Wimplicit-fallthrough) ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wcast-align -Wimplicit-fallthrough -Wunused-parameter -Wsign-compare)
set_target_properties(${PNG_LIBRARY} set_target_properties(${PNG_LIBRARY}
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY} PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
@@ -81,4 +95,4 @@ if(NOT BUILD_SHARED_LIBS)
ocv_install_target(${PNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev) ocv_install_target(${PNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
endif() endif()
ocv_install_3rdparty_licenses(libpng LICENSE README opencv-libpng.patch) ocv_install_3rdparty_licenses(libpng LICENSE README)
+58 -57
View File
@@ -1,16 +1,45 @@
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
=========================================
This copy of the libpng notices is provided for your convenience. In case of PNG Reference Library License version 2
any discrepancy between this copy and the notices in the file png.h that is ---------------------------------------
included in the libpng distribution, the latter shall prevail.
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: * Copyright (c) 1995-2019 The PNG Reference Library Authors.
* Copyright (c) 2018-2019 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
If you modify libpng you may insert additional notices immediately following The software is supplied "as is", without warranty of any kind,
this sentence. express or implied, including, without limitation, the warranties
of merchantability, fitness for a particular purpose, title, and
non-infringement. In no event shall the Copyright owners, or
anyone distributing the software, be liable for any damages or
other liability, whether in contract, tort or otherwise, arising
from, out of, or in connection with the software, or the use or
other dealings in the software, even if advised of the possibility
of such damage.
This code is released under the libpng license. Permission is hereby granted to use, copy, modify, and distribute
this software, or portions hereof, for any purpose, without fee,
subject to the following restrictions:
libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are 1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you
use this software in a product, an acknowledgment in the product
documentation would be appreciated, but is not required.
2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
-----------------------------------------------------------------------
libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals disclaimer and license as libpng-1.0.6 with the following individuals
@@ -28,22 +57,22 @@ added to the list of Contributing Authors:
and with the following additions to the disclaimer: and with the following additions to the disclaimer:
There is no warranty against interference with your enjoyment of the There is no warranty against interference with your enjoyment of
library or against infringement. There is no warranty that our the library or against infringement. There is no warranty that our
efforts or the library will fulfill any of your particular purposes efforts or the library will fulfill any of your particular purposes
or needs. This library is provided with all faults, and the entire or needs. This library is provided with all faults, and the entire
risk of satisfactory quality, performance, accuracy, and effort is with risk of satisfactory quality, performance, accuracy, and effort is
the user. with the user.
Some files in the "contrib" directory and some configure-generated Some files in the "contrib" directory and some configure-generated
files that are distributed with libpng have other copyright owners and files that are distributed with libpng have other copyright owners, and
are released under other open source licenses. are released under other open source licenses.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
libpng-0.96, and are distributed according to the same disclaimer and libpng-0.96, and are distributed according to the same disclaimer and
license as libpng-0.96, with the following individuals added to the list license as libpng-0.96, with the following individuals added to the
of Contributing Authors: list of Contributing Authors:
Tom Lane Tom Lane
Glenn Randers-Pehrson Glenn Randers-Pehrson
@@ -62,7 +91,7 @@ Contributing Authors:
Greg Roelofs Greg Roelofs
Tom Tanner Tom Tanner
Some files in the "scripts" directory have other copyright owners Some files in the "scripts" directory have other copyright owners,
but are released under this license. but are released under this license.
libpng versions 0.5, May 1995, through 0.88, January 1996, are libpng versions 0.5, May 1995, through 0.88, January 1996, are
@@ -77,13 +106,14 @@ is defined as the following set of individuals:
Paul Schmidt Paul Schmidt
Tim Wegner Tim Wegner
The PNG Reference Library is supplied "AS IS". The Contributing Authors The PNG Reference Library is supplied "AS IS". The Contributing
and Group 42, Inc. disclaim all warranties, expressed or implied, Authors and Group 42, Inc. disclaim all warranties, expressed or
including, without limitation, the warranties of merchantability and of implied, including, without limitation, the warranties of
fitness for any purpose. The Contributing Authors and Group 42, Inc. merchantability and of fitness for any purpose. The Contributing
assume no liability for direct, indirect, incidental, special, exemplary, Authors and Group 42, Inc. assume no liability for direct, indirect,
or consequential damages, which may result from the use of the PNG incidental, special, exemplary, or consequential damages, which may
Reference Library, even if advised of the possibility of such damage. result from the use of the PNG Reference Library, even if advised of
the possibility of such damage.
Permission is hereby granted to use, copy, modify, and distribute this Permission is hereby granted to use, copy, modify, and distribute this
source code, or portions hereof, for any purpose, without fee, subject source code, or portions hereof, for any purpose, without fee, subject
@@ -97,37 +127,8 @@ to the following restrictions:
3. This Copyright notice may not be removed or altered from any 3. This Copyright notice may not be removed or altered from any
source or altered source distribution. source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit, without The Contributing Authors and Group 42, Inc. specifically permit,
fee, and encourage the use of this source code as a component to without fee, and encourage the use of this source code as a component
supporting the PNG file format in commercial products. If you use this to supporting the PNG file format in commercial products. If you use
source code in a product, acknowledgment is not required but would be this source code in a product, acknowledgment is not required but would
appreciated. be appreciated.
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
TRADEMARK:
The name "libpng" has not been registered by the Copyright owner
as a trademark in any jurisdiction. However, because libpng has
been distributed and maintained world-wide, continually since 1995,
the Copyright owner claims "common-law trademark protection" in any
jurisdiction where common-law trademark is recognized.
OSI CERTIFICATION:
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
a certification mark of the Open Source Initiative. OSI has not addressed
the additional disclaimers inserted at version 1.0.7.
EXPORT CONTROL:
The Copyright owner believes that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
controls or International Traffic in Arms Regulations (ITAR) because
it is open source, publicly available software, that does not contain
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
734.7(b).
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
July 15, 2018
+35 -74
View File
@@ -1,15 +1,16 @@
README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0) README for libpng version 1.6.37 - April 14, 2019
See the note about version numbers near the top of png.h =================================================
See the note about version numbers near the top of png.h.
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz or Libpng comes in several distribution formats. Get libpng-*.tar.gz or
libpng-*.tar.xz or if you want UNIX-style line endings in the text files, libpng-*.tar.xz or if you want UNIX-style line endings in the text
or lpng*.7z or lpng*.zip if you want DOS-style line endings. files, or lpng*.7z or lpng*.zip if you want DOS-style line endings.
Version 0.89 was the first official release of libpng. Don't let the Version 0.89 was the first official release of libpng. Don't let the
fact that it's the first release fool you. The libpng library has been in fact that it's the first release fool you. The libpng library has been
extensive use and testing since mid-1995. By late 1997 it had in extensive use and testing since mid-1995. By late 1997 it had
finally gotten to the stage where there hadn't been significant finally gotten to the stage where there hadn't been significant
changes to the API in some time, and people have a bad feeling about changes to the API in some time, and people have a bad feeling about
libraries with versions < 1.0. Version 1.0.0 was released in libraries with versions < 1.0. Version 1.0.0 was released in
@@ -60,59 +61,37 @@ the library action on the detection of chunk CRC errors. It is possible
to set different actions based on whether the CRC error occurred in a to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk. critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions For a detailed description on using libpng, read libpng-manual.txt.
on the PNG-implement mailing list and not on material submitted For examples of libpng in a program, see example.c and pngtest.c. For
privately to Guy, Andreas, or Glenn. They will forward any good usage information and restrictions (what little they are) on libpng,
suggestions to the list. see png.h. For a description on using zlib (the compression library
used by libpng) and zlib's restrictions, see zlib.h
For a detailed description on using libpng, read libpng-manual.txt. For
examples of libpng in a program, see example.c and pngtest.c. For usage
information and restrictions (what little they are) on libpng, see
png.h. For a description on using zlib (the compression library used by
libpng) and zlib's restrictions, see zlib.h
I have included a general makefile, as well as several machine and I have included a general makefile, as well as several machine and
compiler specific ones, but you may have to modify one for your own needs. compiler specific ones, but you may have to modify one for your own
needs.
You should use zlib 1.0.4 or later to run this, but it MAY work with You should use zlib 1.0.4 or later to run this, but it MAY work with
versions as old as zlib 0.95. Even so, there are bugs in older zlib versions as old as zlib 0.95. Even so, there are bugs in older zlib
versions which can cause the output of invalid compression streams for versions which can cause the output of invalid compression streams for
some images. You will definitely need zlib 1.0.4 or later if you are some images.
taking advantage of the MS-DOS "far" structure allocation for the small
and medium memory models. You should also note that zlib is a
compression library that is useful for more things than just PNG files.
You can use zlib as a drop-in replacement for fread() and fwrite() if
you are so inclined.
zlib should be available at the same place that libpng is, or at zlib.net. You should also note that zlib is a compression library that is useful
for more things than just PNG files. You can use zlib as a drop-in
replacement for fread() and fwrite(), if you are so inclined.
zlib should be available at the same place that libpng is, or at
https://zlib.net.
You may also want a copy of the PNG specification. It is available You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
these at http://www.libpng.org/pub/png/pngdocs.html . these at http://www.libpng.org/pub/png/pngdocs.html .
This code is currently being archived at libpng.sourceforge.io in the This code is currently being archived at libpng.sourceforge.io in the
[DOWNLOAD] area, and at http://libpng.download/src . If you [DOWNLOAD] area, and at http://libpng.download/src .
can't find it in any of those places, e-mail me, and I'll help you find it.
I am not a lawyer, but I believe that the Export Control Classification This release, based in a large way on Glenn's, Guy's and Andreas'
Number (ECCN) for libpng is EAR99, which means not subject to export earlier work, was created and will be supported by myself and the PNG
controls or International Traffic in Arms Regulations (ITAR) because it
is open source, publicly available software, that does not contain any
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
If you have any code changes, requests, problems, etc., please e-mail
them to me. Also, I'd appreciate any make files or project files,
and any modifications you needed to make to get libpng to compile,
along with a #define variable to tell what compiler/system you are on.
If you needed to add transformations to libpng, or wish libpng would
provide the image in a different way, drop me a note (and code, if
possible), so I can consider supporting the transformation.
Finally, if you get any warning messages when compiling libpng
(note: not zlib), and they are easy to fix, I'd appreciate the
fix. Please mention "libpng" somewhere in the subject line. Thanks.
This release was created and will be supported by myself (of course
based in a large way on Guy's and Andreas' earlier work), and the PNG
development group. development group.
Send comments/corrections/commendations to png-mng-implement at Send comments/corrections/commendations to png-mng-implement at
@@ -120,34 +99,21 @@ lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe). to subscribe).
You can't reach Guy, the original libpng author, at the addresses Send general questions about the PNG specification to png-mng-misc
given in previous versions of this document. He and Andreas will at lists.sourceforge.net (subscription required; visit
read mail addressed to the png-implement list, however.
Please do not send general questions about PNG. Send them to
png-mng-misc at lists.sf.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
subscribe). If you have a question about something subscribe).
in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng,
and ...". If in doubt, send questions to me. I'll bounce them
to others, if necessary.
Please do not send suggestions on how to change PNG. We have
been discussing PNG for twenty years now, and it is official and
finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately,
it may be used later.
Files in this distribution: Files in this distribution:
ANNOUNCE => Announcement of this version, with recent changes ANNOUNCE => Announcement of this version, with recent changes
AUTHORS => List of contributing authors
CHANGES => Description of changes between libpng versions CHANGES => Description of changes between libpng versions
KNOWNBUG => List of known bugs and deficiencies KNOWNBUG => List of known bugs and deficiencies
LICENSE => License to use and redistribute libpng LICENSE => License to use and redistribute libpng
README => This file README => This file
TODO => Things not implemented in the current library TODO => Things not implemented in the current library
Y2KINFO => Statement of Y2K compliance TRADEMARK => Trademark information
example.c => Example code for using libpng functions example.c => Example code for using libpng functions
libpng.3 => manual page for libpng (includes libpng-manual.txt) libpng.3 => manual page for libpng (includes libpng-manual.txt)
libpng-manual.txt => Description of libpng and its functions libpng-manual.txt => Description of libpng and its functions
@@ -208,15 +174,10 @@ Files in this distribution:
scripts => Directory containing scripts for building libpng: scripts => Directory containing scripts for building libpng:
(see scripts/README.txt for the list of scripts) (see scripts/README.txt for the list of scripts)
Good luck, and happy coding. Good luck, and happy coding!
-Glenn Randers-Pehrson (current maintainer, since 1998) * Cosmin Truta (current maintainer, since 2018)
Internet: glennrp at users.sourceforge.net * Glenn Randers-Pehrson (former maintainer, 1998-2018)
* Andreas Eric Dilger (former maintainer, 1996-1997)
-Andreas Eric Dilger (former maintainer, 1996-1997) * Guy Eric Schalnat (original author and former maintainer, 1995-1996)
Internet: adilger at enel.ucalgary.ca (formerly of Group 42, Inc.)
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
(formerly of Group 42, Inc)
Internet: gschal at infinet.com

Some files were not shown because too many files have changed in this diff Show More